📄 ibmphp.h
字号:
/* functions */extern int ibmphp_rsrc_init (void);extern int ibmphp_add_resource (struct resource_node *);extern int ibmphp_remove_resource (struct resource_node *);extern int ibmphp_find_resource (struct bus_node *, u32, struct resource_node **, int);extern int ibmphp_check_resource (struct resource_node *, u8);extern int ibmphp_remove_bus (struct bus_node *, u8);extern void ibmphp_free_resources (void);extern int ibmphp_add_pfmem_from_mem (struct resource_node *);extern struct bus_node *ibmphp_find_res_bus (u8);extern void ibmphp_print_test (void); /* for debugging purposes */extern void ibmphp_hpc_initvars (void);extern int ibmphp_hpc_readslot (struct slot *, u8, u8 *);extern int ibmphp_hpc_writeslot (struct slot *, u8);extern void ibmphp_lock_operations (void);extern void ibmphp_unlock_operations (void);extern int ibmphp_hpc_start_poll_thread (void);extern void ibmphp_hpc_stop_poll_thread (void);//----------------------------------------------------------------------------//----------------------------------------------------------------------------// HPC return codes//----------------------------------------------------------------------------#define HPC_ERROR 0xFF//-----------------------------------------------------------------------------// BUS INFO//-----------------------------------------------------------------------------#define BUS_SPEED 0x30#define BUS_MODE 0x40#define BUS_MODE_PCIX 0x01#define BUS_MODE_PCI 0x00#define BUS_SPEED_2 0x20#define BUS_SPEED_1 0x10#define BUS_SPEED_33 0x00#define BUS_SPEED_66 0x01#define BUS_SPEED_100 0x02#define BUS_SPEED_133 0x03#define BUS_SPEED_66PCIX 0x04#define BUS_SPEED_66UNKNOWN 0x05#define BUS_STATUS_AVAILABLE 0x01#define BUS_CONTROL_AVAILABLE 0x02#define SLOT_LATCH_REGS_SUPPORTED 0x10#define PRGM_MODEL_REV_LEVEL 0xF0#define MAX_ADAPTER_NONE 0x09//----------------------------------------------------------------------------// HPC 'write' operations/commands//----------------------------------------------------------------------------// Command Code State Write to reg// Machine at index//------------------------- ---- ------- ------------#define HPC_CTLR_ENABLEIRQ 0x00 // N 15#define HPC_CTLR_DISABLEIRQ 0x01 // N 15#define HPC_SLOT_OFF 0x02 // Y 0-14#define HPC_SLOT_ON 0x03 // Y 0-14#define HPC_SLOT_ATTNOFF 0x04 // N 0-14#define HPC_SLOT_ATTNON 0x05 // N 0-14#define HPC_CTLR_CLEARIRQ 0x06 // N 15#define HPC_CTLR_RESET 0x07 // Y 15#define HPC_CTLR_IRQSTEER 0x08 // N 15#define HPC_BUS_33CONVMODE 0x09 // Y 31-34#define HPC_BUS_66CONVMODE 0x0A // Y 31-34#define HPC_BUS_66PCIXMODE 0x0B // Y 31-34#define HPC_BUS_100PCIXMODE 0x0C // Y 31-34#define HPC_BUS_133PCIXMODE 0x0D // Y 31-34#define HPC_ALLSLOT_OFF 0x11 // Y 15#define HPC_ALLSLOT_ON 0x12 // Y 15#define HPC_SLOT_BLINKLED 0x13 // N 0-14//----------------------------------------------------------------------------// read commands//----------------------------------------------------------------------------#define READ_SLOTSTATUS 0x01#define READ_EXTSLOTSTATUS 0x02#define READ_BUSSTATUS 0x03#define READ_CTLRSTATUS 0x04#define READ_ALLSTAT 0x05#define READ_ALLSLOT 0x06#define READ_SLOTLATCHLOWREG 0x07#define READ_REVLEVEL 0x08#define READ_HPCOPTIONS 0x09//----------------------------------------------------------------------------// slot status//----------------------------------------------------------------------------#define HPC_SLOT_POWER 0x01#define HPC_SLOT_CONNECT 0x02#define HPC_SLOT_ATTN 0x04#define HPC_SLOT_PRSNT2 0x08#define HPC_SLOT_PRSNT1 0x10#define HPC_SLOT_PWRGD 0x20#define HPC_SLOT_BUS_SPEED 0x40#define HPC_SLOT_LATCH 0x80//----------------------------------------------------------------------------// HPC_SLOT_POWER status return codes//----------------------------------------------------------------------------#define HPC_SLOT_POWER_OFF 0x00#define HPC_SLOT_POWER_ON 0x01//----------------------------------------------------------------------------// HPC_SLOT_CONNECT status return codes//----------------------------------------------------------------------------#define HPC_SLOT_CONNECTED 0x00#define HPC_SLOT_DISCONNECTED 0x01//----------------------------------------------------------------------------// HPC_SLOT_ATTN status return codes//----------------------------------------------------------------------------#define HPC_SLOT_ATTN_OFF 0x00#define HPC_SLOT_ATTN_ON 0x01#define HPC_SLOT_ATTN_BLINK 0x02//----------------------------------------------------------------------------// HPC_SLOT_PRSNT status return codes//----------------------------------------------------------------------------#define HPC_SLOT_EMPTY 0x00#define HPC_SLOT_PRSNT_7 0x01#define HPC_SLOT_PRSNT_15 0x02#define HPC_SLOT_PRSNT_25 0x03//----------------------------------------------------------------------------// HPC_SLOT_PWRGD status return codes//----------------------------------------------------------------------------#define HPC_SLOT_PWRGD_FAULT_NONE 0x00#define HPC_SLOT_PWRGD_GOOD 0x01//----------------------------------------------------------------------------// HPC_SLOT_BUS_SPEED status return codes//----------------------------------------------------------------------------#define HPC_SLOT_BUS_SPEED_OK 0x00#define HPC_SLOT_BUS_SPEED_MISM 0x01//----------------------------------------------------------------------------// HPC_SLOT_LATCH status return codes//----------------------------------------------------------------------------#define HPC_SLOT_LATCH_OPEN 0x01 // NOTE : in PCI spec bit off = open#define HPC_SLOT_LATCH_CLOSED 0x00 // NOTE : in PCI spec bit on = closed//----------------------------------------------------------------------------// extended slot status//----------------------------------------------------------------------------#define HPC_SLOT_PCIX 0x01#define HPC_SLOT_SPEED1 0x02#define HPC_SLOT_SPEED2 0x04#define HPC_SLOT_BLINK_ATTN 0x08#define HPC_SLOT_RSRVD1 0x10#define HPC_SLOT_RSRVD2 0x20#define HPC_SLOT_BUS_MODE 0x40#define HPC_SLOT_RSRVD3 0x80//----------------------------------------------------------------------------// HPC_XSLOT_PCIX_CAP status return codes//----------------------------------------------------------------------------#define HPC_SLOT_PCIX_NO 0x00#define HPC_SLOT_PCIX_YES 0x01//----------------------------------------------------------------------------// HPC_XSLOT_SPEED status return codes//----------------------------------------------------------------------------#define HPC_SLOT_SPEED_33 0x00#define HPC_SLOT_SPEED_66 0x01#define HPC_SLOT_SPEED_133 0x02//----------------------------------------------------------------------------// HPC_XSLOT_ATTN_BLINK status return codes//----------------------------------------------------------------------------#define HPC_SLOT_ATTN_BLINK_OFF 0x00#define HPC_SLOT_ATTN_BLINK_ON 0x01//----------------------------------------------------------------------------// HPC_XSLOT_BUS_MODE status return codes//----------------------------------------------------------------------------#define HPC_SLOT_BUS_MODE_OK 0x00#define HPC_SLOT_BUS_MODE_MISM 0x01//----------------------------------------------------------------------------// Controller status//----------------------------------------------------------------------------#define HPC_CTLR_WORKING 0x01#define HPC_CTLR_FINISHED 0x02#define HPC_CTLR_RESULT0 0x04#define HPC_CTLR_RESULT1 0x08#define HPC_CTLR_RESULE2 0x10#define HPC_CTLR_RESULT3 0x20#define HPC_CTLR_IRQ_ROUTG 0x40#define HPC_CTLR_IRQ_PENDG 0x80//----------------------------------------------------------------------------// HPC_CTLR_WROKING status return codes//----------------------------------------------------------------------------#define HPC_CTLR_WORKING_NO 0x00#define HPC_CTLR_WORKING_YES 0x01//----------------------------------------------------------------------------// HPC_CTLR_FINISHED status return codes//----------------------------------------------------------------------------#define HPC_CTLR_FINISHED_NO 0x00#define HPC_CTLR_FINISHED_YES 0x01//----------------------------------------------------------------------------// HPC_CTLR_RESULT status return codes//----------------------------------------------------------------------------#define HPC_CTLR_RESULT_SUCCESS 0x00#define HPC_CTLR_RESULT_FAILED 0x01#define HPC_CTLR_RESULT_RSVD 0x02#define HPC_CTLR_RESULT_NORESP 0x03//----------------------------------------------------------------------------// macro for slot info//----------------------------------------------------------------------------#define SLOT_POWER(s) ((u8) ((s & HPC_SLOT_POWER) \ ? HPC_SLOT_POWER_ON : HPC_SLOT_POWER_OFF))#define SLOT_CONNECT(s) ((u8) ((s & HPC_SLOT_CONNECT) \ ? HPC_SLOT_DISCONNECTED : HPC_SLOT_CONNECTED))#define SLOT_ATTN(s,es) ((u8) ((es & HPC_SLOT_BLINK_ATTN) \ ? HPC_SLOT_ATTN_BLINK \ : ((s & HPC_SLOT_ATTN) ? HPC_SLOT_ATTN_ON : HPC_SLOT_ATTN_OFF)))#define SLOT_PRESENT(s) ((u8) ((s & HPC_SLOT_PRSNT1) \ ? ((s & HPC_SLOT_PRSNT2) ? HPC_SLOT_EMPTY : HPC_SLOT_PRSNT_15) \ : ((s & HPC_SLOT_PRSNT2) ? HPC_SLOT_PRSNT_25 : HPC_SLOT_PRSNT_7)))#define SLOT_PWRGD(s) ((u8) ((s & HPC_SLOT_PWRGD) \ ? HPC_SLOT_PWRGD_GOOD : HPC_SLOT_PWRGD_FAULT_NONE))#define SLOT_BUS_SPEED(s) ((u8) ((s & HPC_SLOT_BUS_SPEED) \ ? HPC_SLOT_BUS_SPEED_MISM : HPC_SLOT_BUS_SPEED_OK))#define SLOT_LATCH(s) ((u8) ((s & HPC_SLOT_LATCH) \ ? HPC_SLOT_LATCH_CLOSED : HPC_SLOT_LATCH_OPEN))#define SLOT_PCIX(es) ((u8) ((es & HPC_SLOT_PCIX) \ ? HPC_SLOT_PCIX_YES : HPC_SLOT_PCIX_NO))#define SLOT_SPEED(es) ((u8) ((es & HPC_SLOT_SPEED2) \ ? ((es & HPC_SLOT_SPEED1) ? HPC_SLOT_SPEED_133 \ : HPC_SLOT_SPEED_66) \ : HPC_SLOT_SPEED_33))#define SLOT_BUS_MODE(es) ((u8) ((es & HPC_SLOT_BUS_MODE) \ ? HPC_SLOT_BUS_MODE_MISM : HPC_SLOT_BUS_MODE_OK))//--------------------------------------------------------------------------// macro for bus info//---------------------------------------------------------------------------#define CURRENT_BUS_SPEED(s) ((u8) (s & BUS_SPEED_2) \ ? ((s & BUS_SPEED_1) ? BUS_SPEED_133 : BUS_SPEED_100) \ : ((s & BUS_SPEED_1) ? BUS_SPEED_66 : BUS_SPEED_33))#define CURRENT_BUS_MODE(s) ((u8) (s & BUS_MODE) ? BUS_MODE_PCIX : BUS_MODE_PCI)#define READ_BUS_STATUS(s) ((u8) (s->options & BUS_STATUS_AVAILABLE))#define READ_BUS_MODE(s) ((s->revision & PRGM_MODEL_REV_LEVEL) >= 0x20)#define SET_BUS_STATUS(s) ((u8) (s->options & BUS_CONTROL_AVAILABLE))#define READ_SLOT_LATCH(s) ((u8) (s->options & SLOT_LATCH_REGS_SUPPORTED))//----------------------------------------------------------------------------// macro for controller info//----------------------------------------------------------------------------#define CTLR_WORKING(c) ((u8) ((c & HPC_CTLR_WORKING) \ ? HPC_CTLR_WORKING_YES : HPC_CTLR_WORKING_NO))#define CTLR_FINISHED(c) ((u8) ((c & HPC_CTLR_FINISHED) \ ? HPC_CTLR_FINISHED_YES : HPC_CTLR_FINISHED_NO))#define CTLR_RESULT(c) ((u8) ((c & HPC_CTLR_RESULT1) \ ? ((c & HPC_CTLR_RESULT0) ? HPC_CTLR_RESULT_NORESP \ : HPC_CTLR_RESULT_RSVD) \ : ((c & HPC_CTLR_RESULT0) ? HPC_CTLR_RESULT_FAILED \ : HPC_CTLR_RESULT_SUCCESS)))// command that affect the state machine of HPC#define NEEDTOCHECK_CMDSTATUS(c) ((c == HPC_SLOT_OFF) || \ (c == HPC_SLOT_ON) || \ (c == HPC_CTLR_RESET) || \ (c == HPC_BUS_33CONVMODE) || \ (c == HPC_BUS_66CONVMODE) || \ (c == HPC_BUS_66PCIXMODE) || \ (c == HPC_BUS_100PCIXMODE) || \ (c == HPC_BUS_133PCIXMODE) || \ (c == HPC_ALLSLOT_OFF) || \ (c == HPC_ALLSLOT_ON))/* Core part of the driver */#define ENABLE 1#define DISABLE 0#define CARD_INFO 0x07#define PCIX133 0x07#define PCIX66 0x05#define PCI66 0x04extern struct pci_bus *ibmphp_pci_bus;/* Variables */struct pci_func { struct pci_dev *dev; /* from the OS */ u8 busno; u8 device; u8 function; struct resource_node *io[6]; struct resource_node *mem[6]; struct resource_node *pfmem[6]; struct pci_func *next; int devices[32]; /* for bridge config */ u8 irq[4]; /* for interrupt config */ u8 bus; /* flag for unconfiguring, to say if PPB */};struct slot { u8 bus; u8 device; u8 number; u8 real_physical_slot_num; u32 capabilities; u8 supported_speed; u8 supported_bus_mode; u8 flag; /* this is for disable slot and polling */ u8 ctlr_index; struct hotplug_slot *hotplug_slot; struct controller *ctrl; struct pci_func *func; u8 irq[4]; int bit_mode; /* 0 = 32, 1 = 64 */ struct bus_info *bus_on; struct list_head ibm_slot_list; u8 status; u8 ext_status; u8 busstatus;};struct controller { struct ebda_hpc_slot *slots; struct ebda_hpc_bus *buses; struct pci_dev *ctrl_dev; /* in case where controller is PCI */ u8 starting_slot_num; /* starting and ending slot #'s this ctrl controls*/ u8 ending_slot_num; u8 revision; u8 options; /* which options HPC supports */ u8 status; u8 ctlr_id; u8 slot_count; u8 bus_count; u8 ctlr_relative_id; u32 irq; union { struct isa_ctlr_access isa_ctlr; struct pci_ctlr_access pci_ctlr; struct wpeg_i2c_ctlr_access wpeg_ctlr; } u; u8 ctlr_type; struct list_head ebda_hpc_list;};/* Functions */extern int ibmphp_init_devno (struct slot **); /* This function is called from EBDA, so we need it not be static */extern int ibmphp_do_disable_slot (struct slot *slot_cur);extern int ibmphp_update_slot_info (struct slot *); /* This function is called from HPC, so we need it to not be be static */extern int ibmphp_configure_card (struct pci_func *, u8);extern int ibmphp_unconfigure_card (struct slot **, int);extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops;#endif //__IBMPHP_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -