⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cpqphp.h

📁 linux和2410结合开发 用他可以生成2410所需的zImage文件
💻 H
📖 第 1 页 / 共 2 页
字号:
#define PCISLOT_66_MHZ_SUPPORTED	0x00000100#define PCISLOT_64_BIT_SUPPORTED	0x00000200#define PCI_TO_PCI_BRIDGE_CLASS		0x00060400#define INTERLOCK_OPEN			0x00000002#define ADD_NOT_SUPPORTED		0x00000003#define CARD_FUNCTIONING		0x00000005#define ADAPTER_NOT_SAME		0x00000006#define NO_ADAPTER_PRESENT		0x00000009#define NOT_ENOUGH_RESOURCES		0x0000000B#define DEVICE_TYPE_NOT_SUPPORTED	0x0000000C#define POWER_FAILURE			0x0000000E#define REMOVE_NOT_SUPPORTED		0x00000003/* * error Messages */#define msg_initialization_err	"Initialization failure, error=%d\n"#define msg_HPC_rev_error	"Unsupported revision of the PCI hot plug controller found.\n"#define msg_HPC_non_compaq_or_intel	"The PCI hot plug controller is not supported by this driver.\n"#define msg_HPC_not_supported	"this system is not supported by this version of cpqphpd. Upgrade to a newer version of cpqphpd\n"#define msg_unable_to_save	"unable to store PCI hot plug add resource information. This system must be rebooted before adding any PCI devices.\n"#define msg_button_on		"PCI slot #%d - powering on due to button press.\n"#define msg_button_off		"PCI slot #%d - powering off due to button press.\n"#define msg_button_cancel	"PCI slot #%d - action canceled due to button press.\n"#define msg_button_ignore	"PCI slot #%d - button press ignored.  (action in progress...)\n"/* Proc functions for the hotplug controller info */#ifdef CONFIG_PROC_FSextern int cpqhp_proc_init_ctrl		(void);extern int cpqhp_proc_destroy_ctrl	(void);extern int cpqhp_proc_create_ctrl	(struct controller *ctrl);extern int cpqhp_proc_remove_ctrl	(struct controller *ctrl);#elsestatic inline int cpqhp_proc_init_ctrl (void){	return 0;}static inline int cpqhp_proc_destroy_ctrl (void){	return 0;}static inline int cpqhp_proc_create_ctrl (struct controller *ctrl){	return 0;}static inline int cpqhp_proc_remove_ctrl (struct controller *ctrl){	return 0;}#endif/* controller functions */extern void	cpqhp_pushbutton_thread		(unsigned long event_pointer);extern void	cpqhp_ctrl_intr			(int IRQ, struct controller *ctrl_input, struct pt_regs *regs);extern int	cpqhp_find_available_resources	(struct controller *ctrl, void *rom_start);extern int	cpqhp_event_start_thread	(void);extern void	cpqhp_event_stop_thread		(void);extern struct pci_func *cpqhp_slot_create	(unsigned char busnumber);extern struct pci_func *cpqhp_slot_find		(unsigned char bus, unsigned char device, unsigned char index);extern int	cpqhp_process_SI		(struct controller *ctrl, struct pci_func *func);extern int	cpqhp_process_SS		(struct controller *ctrl, struct pci_func *func);extern int	cpqhp_hardware_test		(struct controller *ctrl, int test_num);/* resource functions */extern int	cpqhp_resource_sort_and_combine	(struct pci_resource **head);/* pci functions */extern int	cpqhp_set_irq			(u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num);extern int	cpqhp_get_bus_dev		(struct controller *ctrl, u8 *bus_num, u8 *dev_num, u8 slot);extern int	cpqhp_save_config		(struct controller *ctrl, int busnumber, int is_hot_plug);extern int	cpqhp_save_base_addr_length	(struct controller *ctrl, struct pci_func * func);extern int	cpqhp_save_used_resources	(struct controller *ctrl, struct pci_func * func);extern int	cpqhp_configure_board		(struct controller *ctrl, struct pci_func * func);extern int	cpqhp_save_slot_config		(struct controller *ctrl, struct pci_func * new_slot);extern int	cpqhp_valid_replace		(struct controller *ctrl, struct pci_func * func);extern void	cpqhp_destroy_board_resources	(struct pci_func * func);extern int	cpqhp_return_board_resources	(struct pci_func * func, struct resource_lists * resources);extern void	cpqhp_destroy_resource_list	(struct resource_lists * resources);extern int	cpqhp_configure_device		(struct controller* ctrl, struct pci_func* func);extern int	cpqhp_unconfigure_device	(struct pci_func* func);/* Global variables */extern int cpqhp_debug;extern struct controller *cpqhp_ctrl_list;extern struct pci_func *cpqhp_slot_list[256];/* these can be gotten rid of, but for debugging they are purty */extern u8 cpqhp_nic_irq;extern u8 cpqhp_disk_irq;/* inline functions *//* Inline functions to check the sanity of a pointer that is passed to us */static inline int slot_paranoia_check (struct slot *slot, const char *function){	if (!slot) {		dbg("%s - slot == NULL", function);		return -1;	}	if (slot->magic != SLOT_MAGIC) {		dbg("%s - bad magic number for slot", function);		return -1;	}	if (!slot->hotplug_slot) {		dbg("%s - slot->hotplug_slot == NULL!", function);		return -1;	}	return 0;}static inline struct slot *get_slot (struct hotplug_slot *hotplug_slot, const char *function){ 	struct slot *slot;	if (!hotplug_slot) {		dbg("%s - hotplug_slot == NULL\n", function);		return NULL;	}	slot = (struct slot *)hotplug_slot->private;	if (slot_paranoia_check (slot, function))                return NULL;	return slot;}               /* * return_resource * * Puts node back in the resource list pointed to by head * */static inline void return_resource (struct pci_resource **head, struct pci_resource *node){	if (!node || !head)		return;	node->next = *head;	*head = node;}static inline void set_SOGO (struct controller *ctrl){	u16 misc;		misc = readw(ctrl->hpc_reg + MISC);	misc = (misc | 0x0001) & 0xFFFB;	writew(misc, ctrl->hpc_reg + MISC);}static inline void amber_LED_on (struct controller *ctrl, u8 slot){	u32 led_control;		led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control |= (0x01010000L << slot);	writel(led_control, ctrl->hpc_reg + LED_CONTROL);}static inline void amber_LED_off (struct controller *ctrl, u8 slot){	u32 led_control;		led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control &= ~(0x01010000L << slot);	writel(led_control, ctrl->hpc_reg + LED_CONTROL);}static inline int read_amber_LED (struct controller *ctrl, u8 slot){	u32 led_control;	led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control &= (0x01010000L << slot);		return led_control ? 1 : 0;}static inline void green_LED_on (struct controller *ctrl, u8 slot){	u32 led_control;		led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control |= 0x0101L << slot;	writel(led_control, ctrl->hpc_reg + LED_CONTROL);}static inline void green_LED_off (struct controller *ctrl, u8 slot){	u32 led_control;		led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control &= ~(0x0101L << slot);	writel(led_control, ctrl->hpc_reg + LED_CONTROL);}static inline void green_LED_blink (struct controller *ctrl, u8 slot){	u32 led_control;		led_control = readl(ctrl->hpc_reg + LED_CONTROL);	led_control |= (0x0001L << slot);	writel(led_control, ctrl->hpc_reg + LED_CONTROL);}static inline void slot_disable (struct controller *ctrl, u8 slot){	u8 slot_enable;	slot_enable = readb(ctrl->hpc_reg + SLOT_ENABLE);	slot_enable &= ~(0x01 << slot);	writeb(slot_enable, ctrl->hpc_reg + SLOT_ENABLE);}static inline void slot_enable (struct controller *ctrl, u8 slot){	u8 slot_enable;	slot_enable = readb(ctrl->hpc_reg + SLOT_ENABLE);	slot_enable |= (0x01 << slot);	writeb(slot_enable, ctrl->hpc_reg + SLOT_ENABLE);}static inline u8 is_slot_enabled (struct controller *ctrl, u8 slot){	u8 slot_enable;	slot_enable = readb(ctrl->hpc_reg + SLOT_ENABLE);	slot_enable &= (0x01 << slot);	return slot_enable ? 1 : 0;}static inline u8 read_slot_enable (struct controller *ctrl){	return readb(ctrl->hpc_reg + SLOT_ENABLE);}static inline u8 get_controller_speed (struct controller *ctrl){	u16 misc;		misc = readw(ctrl->hpc_reg + MISC);	return (misc & 0x0800) ? 1 : 0;}static inline void enable_slot_power (struct controller *ctrl, u8 slot){	u8 slot_power;	slot_power = readb(ctrl->hpc_reg + SLOT_POWER);	slot_power |= (0x01 << slot);	writeb(slot_power, ctrl->hpc_reg + SLOT_POWER);}static inline void disable_slot_power (struct controller *ctrl, u8 slot){	u8 slot_power;	slot_power = readb(ctrl->hpc_reg + SLOT_POWER);	slot_power &= ~(0x01 << slot);	writeb(slot_power, ctrl->hpc_reg + SLOT_POWER);}static inline int cpq_get_attention_status (struct controller *ctrl, struct slot *slot){	u8 hp_slot;	if (slot == NULL)		return 1;	hp_slot = slot->device - ctrl->slot_device_offset;	return read_amber_LED (ctrl, hp_slot);}static inline int get_slot_enabled (struct controller *ctrl, struct slot *slot){	u8 hp_slot;	if (slot == NULL)		return 1;	hp_slot = slot->device - ctrl->slot_device_offset;	return is_slot_enabled (ctrl, hp_slot);}static inline int cpq_get_latch_status (struct controller *ctrl, struct slot *slot){	u32 status;	u8 hp_slot;	if (slot == NULL)		return 1;	hp_slot = slot->device - ctrl->slot_device_offset;	dbg(__FUNCTION__": slot->device = %d, ctrl->slot_device_offset = %d \n", slot->device, ctrl->slot_device_offset);	status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot));	return(status == 0) ? 1 : 0;}static inline int get_presence_status (struct controller *ctrl, struct slot *slot){	int presence_save = 0;	u8 hp_slot;	u32 tempdword;	if (slot == NULL)		return 0;	hp_slot = slot->device - ctrl->slot_device_offset;	tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);	presence_save = (int) ((((~tempdword) >> 23) | ((~tempdword) >> 15)) >> hp_slot) & 0x02;	return presence_save;}#define SLOT_NAME_SIZE 10static inline void make_slot_name (char *buffer, int buffer_size, struct slot *slot){	snprintf (buffer, buffer_size, "%d", slot->number);}static inline int wait_for_ctrl_irq (struct controller *ctrl){        DECLARE_WAITQUEUE(wait, current);	int retval = 0;	dbg(__FUNCTION__" - start\n");	add_wait_queue(&ctrl->queue, &wait);	set_current_state(TASK_INTERRUPTIBLE);	/* Sleep for up to 1 second to wait for the LED to change. */	schedule_timeout(1*HZ);	set_current_state(TASK_RUNNING);	remove_wait_queue(&ctrl->queue, &wait);	if (signal_pending(current))		retval =  -EINTR;	dbg(__FUNCTION__" - end\n");	return retval;}#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -