Commit af6e9e07 authored by Irene Zubarev's avatar Irene Zubarev Committed by Greg Kroah-Hartman

[PATCH] IBM PCI Hotplug driver update

- fix polling logic
- add ability to write [chassis/rxe]#slot# instead of just slot#
parent d9a26363
...@@ -39,7 +39,8 @@ extern int ibmphp_debug; ...@@ -39,7 +39,8 @@ extern int ibmphp_debug;
#else #else
#define MY_NAME THIS_MODULE->name #define MY_NAME THIS_MODULE->name
#endif #endif
#define debug(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0) #define debug(fmt, arg...) do { if (ibmphp_debug == 1) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
#define debug_pci(fmt, arg...) do { if (ibmphp_debug) printk(KERN_DEBUG "%s: " fmt , MY_NAME , ## arg); } while (0)
#define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg) #define err(format, arg...) printk(KERN_ERR "%s: " format , MY_NAME , ## arg)
#define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg) #define info(format, arg...) printk(KERN_INFO "%s: " format , MY_NAME , ## arg)
#define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg) #define warn(format, arg...) printk(KERN_WARNING "%s: " format , MY_NAME , ## arg)
...@@ -121,6 +122,7 @@ struct scal_detail { ...@@ -121,6 +122,7 @@ struct scal_detail {
u8 port1_port_connect; u8 port1_port_connect;
u8 port2_node_connect; u8 port2_node_connect;
u8 port2_port_connect; u8 port2_port_connect;
u8 chassis_num;
// struct list_head scal_detail_list; // struct list_head scal_detail_list;
}; };
...@@ -139,9 +141,27 @@ struct rio_detail { ...@@ -139,9 +141,27 @@ struct rio_detail {
u8 port1_port_connect; u8 port1_port_connect;
u8 first_slot_num; u8 first_slot_num;
u8 status; u8 status;
// struct list_head rio_detail_list; u8 wpindex;
u8 chassis_num;
struct list_head rio_detail_list;
}; };
struct opt_rio {
u8 rio_type;
u8 chassis_num;
u8 first_slot_num;
u8 middle_num;
struct list_head opt_rio_list;
};
struct opt_rio_lo {
u8 rio_type;
u8 chassis_num;
u8 first_slot_num;
u8 middle_num;
u8 pack_count;
struct list_head opt_rio_lo_list;
};
/**************************************************************** /****************************************************************
* HPC DESCRIPTOR NODE * * HPC DESCRIPTOR NODE *
...@@ -153,7 +173,6 @@ struct ebda_hpc_list { ...@@ -153,7 +173,6 @@ struct ebda_hpc_list {
short phys_addr; short phys_addr;
// struct list_head ebda_hpc_list; // struct list_head ebda_hpc_list;
}; };
/***************************************************************** /*****************************************************************
* IN HPC DATA STRUCTURE, THE ASSOCIATED SLOT AND BUS * * IN HPC DATA STRUCTURE, THE ASSOCIATED SLOT AND BUS *
* STRUCTURE * * STRUCTURE *
...@@ -195,6 +214,9 @@ struct wpeg_i2c_ctlr_access { ...@@ -195,6 +214,9 @@ struct wpeg_i2c_ctlr_access {
u8 i2c_addr; u8 i2c_addr;
}; };
#define HPC_DEVICE_ID 0x0246
#define HPC_SUBSYSTEM_ID 0x0247
#define HPC_PCI_OFFSET 0x40
/************************************************************************* /*************************************************************************
* RSTC DESCRIPTOR NODE * * RSTC DESCRIPTOR NODE *
*************************************************************************/ *************************************************************************/
...@@ -215,8 +237,9 @@ struct ebda_pci_rsrc { ...@@ -215,8 +237,9 @@ struct ebda_pci_rsrc {
u8 rsrc_type; u8 rsrc_type;
u8 bus_num; u8 bus_num;
u8 dev_fun; u8 dev_fun;
ulong start_addr; u32 start_addr;
ulong end_addr; u32 end_addr;
u8 marked; /* for NVRAM */
struct list_head ebda_pci_rsrc_list; struct list_head ebda_pci_rsrc_list;
}; };
...@@ -248,7 +271,7 @@ struct bus_info { ...@@ -248,7 +271,7 @@ struct bus_info {
***********************************************************/ ***********************************************************/
extern struct list_head ibmphp_ebda_pci_rsrc_head; extern struct list_head ibmphp_ebda_pci_rsrc_head;
extern struct list_head ibmphp_slot_head; extern struct list_head ibmphp_slot_head;
extern struct list_head ibmphp_res_head;
/*********************************************************** /***********************************************************
* FUNCTION PROTOTYPES * * FUNCTION PROTOTYPES *
***********************************************************/ ***********************************************************/
...@@ -263,6 +286,7 @@ extern void ibmphp_free_ebda_pci_rsrc_queue (void); ...@@ -263,6 +286,7 @@ extern void ibmphp_free_ebda_pci_rsrc_queue (void);
extern struct bus_info *ibmphp_find_same_bus_num (u32); extern struct bus_info *ibmphp_find_same_bus_num (u32);
extern int ibmphp_get_bus_index (u8); extern int ibmphp_get_bus_index (u8);
extern u16 ibmphp_get_total_controllers (void); extern u16 ibmphp_get_total_controllers (void);
extern int ibmphp_register_pci (void);
/* passed parameters */ /* passed parameters */
#define MEM 0 #define MEM 0
...@@ -739,6 +763,7 @@ extern int ibmphp_disable_slot (struct hotplug_slot *); /* This function is call ...@@ -739,6 +763,7 @@ extern int ibmphp_disable_slot (struct hotplug_slot *); /* This function is call
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_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_configure_card (struct pci_func *, u8);
extern int ibmphp_unconfigure_card (struct slot **, int); extern int ibmphp_unconfigure_card (struct slot **, int);
extern void ibmphp_increase_count (void);
extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops; extern struct hotplug_slot_ops ibmphp_hotplug_slot_ops;
static inline void long_delay (int delay) static inline void long_delay (int delay)
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -920,16 +920,30 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno) ...@@ -920,16 +920,30 @@ static int configure_bridge (struct pci_func **func_passed, u8 slotno)
debug ("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem); debug ("flag_io = %x, flag_mem = %x, flag_pfmem = %x\n", flag_io, flag_mem, flag_pfmem);
if (flag_io && flag_mem && flag_pfmem) { if (flag_io && flag_mem && flag_pfmem) {
bus = kmalloc (sizeof (struct bus_node), GFP_KERNEL); /* If on bootup, there was a bridged card in this slot,
* then card was removed and ibmphp got unloaded and loaded
* back again, there's no way for us to remove the bus
* struct, so no need to kmalloc, can use existing node
*/
bus = ibmphp_find_res_bus (sec_number);
if (!bus) { if (!bus) {
err ("out of system memory \n"); bus = kmalloc (sizeof (struct bus_node), GFP_KERNEL);
retval = -ENOMEM; if (!bus) {
err ("out of system memory \n");
retval = -ENOMEM;
goto error;
}
memset (bus, 0, sizeof (struct bus_node));
bus->busno = sec_number;
debug ("b4 adding new bus\n");
rc = add_new_bus (bus, io, mem, pfmem, func->busno);
} else if (!(bus->rangeIO) && !(bus->rangeMem) && !(bus->rangePFMem))
rc = add_new_bus (bus, io, mem, pfmem, 0xFF);
else {
err ("expected bus structure not empty? \n");
retval = -EIO;
goto error; goto error;
} }
memset (bus, 0, sizeof (struct bus_node));
bus->busno = sec_number;
debug ("b4 adding new bus\n");
rc = add_new_bus (bus, io, mem, pfmem, func->busno);
if (rc) { if (rc) {
if (rc == -ENOMEM) { if (rc == -ENOMEM) {
ibmphp_remove_bus (bus, func->busno); ibmphp_remove_bus (bus, func->busno);
...@@ -1579,7 +1593,6 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) ...@@ -1579,7 +1593,6 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end)
} }
if (sl->func) { if (sl->func) {
debug ("do we come in here? \n");
cur_func = sl->func; cur_func = sl->func;
while (cur_func) { while (cur_func) {
/* TO DO: WILL MOST LIKELY NEED TO GET RID OF THE BUS STRUCTURE FROM RESOURCES AS WELL */ /* TO DO: WILL MOST LIKELY NEED TO GET RID OF THE BUS STRUCTURE FROM RESOURCES AS WELL */
...@@ -1619,6 +1632,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end) ...@@ -1619,6 +1632,7 @@ int ibmphp_unconfigure_card (struct slot **slot_cur, int the_end)
sl->func = NULL; sl->func = NULL;
*slot_cur = sl; *slot_cur = sl;
debug ("%s - exit\n", __FUNCTION__);
return 0; return 0;
} }
...@@ -1638,14 +1652,15 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r ...@@ -1638,14 +1652,15 @@ static int add_new_bus (struct bus_node *bus, struct resource_node *io, struct r
struct bus_node *cur_bus = NULL; struct bus_node *cur_bus = NULL;
/* Trying to find the parent bus number */ /* Trying to find the parent bus number */
cur_bus = ibmphp_find_res_bus (parent_busno); if (parent_busno != 0xFF) {
if (!cur_bus) { cur_bus = ibmphp_find_res_bus (parent_busno);
err ("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n"); if (!cur_bus) {
return -ENODEV; err ("strange, cannot find bus which is supposed to be at the system... something is terribly wrong...\n");
return -ENODEV;
}
list_add (&bus->bus_list, &cur_bus->bus_list);
} }
list_add (&bus->bus_list, &cur_bus->bus_list);
if (io) { if (io) {
io_range = kmalloc (sizeof (struct range_node), GFP_KERNEL); io_range = kmalloc (sizeof (struct range_node), GFP_KERNEL);
if (!io_range) { if (!io_range) {
...@@ -1698,6 +1713,7 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno) ...@@ -1698,6 +1713,7 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno)
int min, max; int min, max;
u8 busno; u8 busno;
struct bus_info *bus; struct bus_info *bus;
struct bus_node *bus_cur;
bus = ibmphp_find_same_bus_num (primary_busno); bus = ibmphp_find_same_bus_num (primary_busno);
if (!bus) { if (!bus) {
...@@ -1712,7 +1728,12 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno) ...@@ -1712,7 +1728,12 @@ static u8 find_sec_number (u8 primary_busno, u8 slotno)
} }
busno = (u8) (slotno - (u8) min); busno = (u8) (slotno - (u8) min);
busno += primary_busno + 0x01; busno += primary_busno + 0x01;
if (!ibmphp_find_res_bus (busno)) bus_cur = ibmphp_find_res_bus (busno);
/* either there is no such bus number, or there are no ranges, which
* can only happen if we removed the bridged device in previous load
* of the driver, and now only have the skeleton bus struct
*/
if ((!bus_cur) || (!(bus_cur->rangeIO) && !(bus_cur->rangeMem) && !(bus_cur->rangePFMem)))
return busno; return busno;
return 0xff; return 0xff;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment