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

📄 cpqphp.h

📁 优龙2410linux2.6.8内核源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define PCISLOT_INTERLOCK_CLOSED	0x00000001#define PCISLOT_ADAPTER_PRESENT		0x00000002#define PCISLOT_POWERED			0x00000004#define PCISLOT_66_MHZ_OPERATION	0x00000008#define PCISLOT_64_BIT_OPERATION	0x00000010#define PCISLOT_REPLACE_SUPPORTED	0x00000020#define PCISLOT_ADD_SUPPORTED		0x00000040#define PCISLOT_INTERLOCK_SUPPORTED	0x00000080#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"/* sysfs functions for the hotplug controller info */extern void cpqhp_create_ctrl_files		(struct controller *ctrl);/* controller functions */extern void	cpqhp_pushbutton_thread		(unsigned long event_pointer);extern irqreturn_t cpqhp_ctrl_intr		(int IRQ, void *data, 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 int cpqhp_legacy_mode;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 *//* * 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 &= ~(0x0101L << slot);	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);}/* * get_controller_speed - find the current frequency/mode of controller. * * @ctrl: controller to get frequency/mode for. * * Returns controller speed. * */static inline u8 get_controller_speed(struct controller *ctrl){	u8 curr_freq; 	u16 misc; 		if (ctrl->pcix_support) {		curr_freq = readb(ctrl->hpc_reg + NEXT_CURR_FREQ);		if ((curr_freq & 0xB0) == 0xB0) 			return PCI_SPEED_133MHz_PCIX;		if ((curr_freq & 0xA0) == 0xA0)			return PCI_SPEED_100MHz_PCIX;		if ((curr_freq & 0x90) == 0x90)			return PCI_SPEED_66MHz_PCIX;		if (curr_freq & 0x10)			return PCI_SPEED_66MHz;		return PCI_SPEED_33MHz;	} 	misc = readw(ctrl->hpc_reg + MISC); 	return (misc & 0x0800) ? PCI_SPEED_66MHz : PCI_SPEED_33MHz;} /* * get_adapter_speed - find the max supported frequency/mode of adapter. * * @ctrl: hotplug controller. * @hp_slot: hotplug slot where adapter is installed. * * Returns adapter speed. * */static inline u8 get_adapter_speed(struct controller *ctrl, u8 hp_slot){	u32 temp_dword = readl(ctrl->hpc_reg + NON_INT_INPUT);	dbg("slot: %d, PCIXCAP: %8x\n", hp_slot, temp_dword);	if (ctrl->pcix_support) {		if (temp_dword & (0x10000 << hp_slot))			return PCI_SPEED_133MHz_PCIX;		if (temp_dword & (0x100 << hp_slot))			return PCI_SPEED_66MHz_PCIX;	}	if (temp_dword & (0x01 << hp_slot))		return PCI_SPEED_66MHz;	return PCI_SPEED_33MHz;}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;	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;	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;	hp_slot = slot->device - ctrl->slot_device_offset;	dbg("%s: slot->device = %d, ctrl->slot_device_offset = %d \n",	    __FUNCTION__, 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;	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("%s - start\n", __FUNCTION__);	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);	remove_wait_queue(&ctrl->queue, &wait);	if (signal_pending(current))		retval =  -EINTR;	dbg("%s - end\n", __FUNCTION__);	return retval;}#endif

⌨️ 快捷键说明

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