Commit 159b0104 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://linuxusb.bkbits.net/pci_hp-2.5

into penguin.transmeta.com:/home/penguin/torvalds/repositories/kernel/linux
parents b6a3d01f 441a1393
...@@ -292,16 +292,14 @@ struct controller { ...@@ -292,16 +292,14 @@ struct controller {
struct pci_resource *io_head; struct pci_resource *io_head;
struct pci_resource *bus_head; struct pci_resource *bus_head;
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
struct pci_ops *pci_ops; struct pci_bus *pci_bus;
struct proc_dir_entry* proc_entry; struct proc_dir_entry* proc_entry;
struct proc_dir_entry* proc_entry2; struct proc_dir_entry* proc_entry2;
struct event_info event_queue[10]; struct event_info event_queue[10];
struct slot *slot; struct slot *slot;
u8 next_event; u8 next_event;
u8 interrupt; u8 interrupt;
u8 bus; u8 bus; /* bus number for the pci hotplug controller */
u8 device;
u8 function;
u8 rev; u8 rev;
u8 slot_device_offset; u8 slot_device_offset;
u8 first_slot; u8 first_slot;
...@@ -695,7 +693,8 @@ static inline int cpq_get_latch_status (struct controller *ctrl, struct slot *sl ...@@ -695,7 +693,8 @@ static inline int cpq_get_latch_status (struct controller *ctrl, struct slot *sl
return 1; return 1;
hp_slot = slot->device - ctrl->slot_device_offset; 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); 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)); status = (readl(ctrl->hpc_reg + INT_INPUT_CLEAR) & (0x01L << hp_slot));
...@@ -733,7 +732,7 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl) ...@@ -733,7 +732,7 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
int retval = 0; int retval = 0;
dbg(__FUNCTION__" - start\n"); dbg("%s - start\n", __FUNCTION__);
add_wait_queue(&ctrl->queue, &wait); add_wait_queue(&ctrl->queue, &wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
/* Sleep for up to 1 second to wait for the LED to change. */ /* Sleep for up to 1 second to wait for the LED to change. */
...@@ -743,7 +742,7 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl) ...@@ -743,7 +742,7 @@ static inline int wait_for_ctrl_irq (struct controller *ctrl)
if (signal_pending(current)) if (signal_pending(current))
retval = -EINTR; retval = -EINTR;
dbg(__FUNCTION__" - end\n"); dbg("%s - end\n", __FUNCTION__);
return retval; return retval;
} }
......
...@@ -314,7 +314,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void * ...@@ -314,7 +314,7 @@ static int ctrl_slot_setup (struct controller * ctrl, void *smbios_start, void *
void *slot_entry= NULL; void *slot_entry= NULL;
int result; int result;
dbg(__FUNCTION__"\n"); dbg("%s\n", __FUNCTION__);
tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR); tempdword = readl(ctrl->hpc_reg + INT_INPUT_CLEAR);
...@@ -467,7 +467,7 @@ static int ctrl_slot_cleanup (struct controller * ctrl) ...@@ -467,7 +467,7 @@ static int ctrl_slot_cleanup (struct controller * ctrl)
// //
// Output: SUCCESS or FAILURE // Output: SUCCESS or FAILURE
//============================================================================= //=============================================================================
static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *slot) static int get_slot_mapping (struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot)
{ {
struct irq_routing_table *PCIIRQRoutingInfoLength; struct irq_routing_table *PCIIRQRoutingInfoLength;
u32 work; u32 work;
...@@ -476,7 +476,7 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl ...@@ -476,7 +476,7 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
u8 tbus, tdevice, tslot, bridgeSlot; u8 tbus, tdevice, tslot, bridgeSlot;
dbg(__FUNCTION__" %p, %d, %d, %p\n", ops, bus_num, dev_num, slot); dbg("%s: %p, %d, %d, %p\n", __FUNCTION__, bus, bus_num, dev_num, slot);
bridgeSlot = 0xFF; bridgeSlot = 0xFF;
...@@ -490,7 +490,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl ...@@ -490,7 +490,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
return -1; return -1;
} }
for (loop = 0; loop < len; ++loop) { for (loop = 0; loop < len; ++loop) {
tbus = PCIIRQRoutingInfoLength->slots[loop].bus; tbus = PCIIRQRoutingInfoLength->slots[loop].bus;
tdevice = PCIIRQRoutingInfoLength->slots[loop].devfn >> 3; tdevice = PCIIRQRoutingInfoLength->slots[loop].devfn >> 3;
...@@ -499,7 +498,8 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl ...@@ -499,7 +498,8 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
if ((tbus == bus_num) && (tdevice == dev_num)) { if ((tbus == bus_num) && (tdevice == dev_num)) {
*slot = tslot; *slot = tslot;
if (PCIIRQRoutingInfoLength != NULL) kfree(PCIIRQRoutingInfoLength ); if (PCIIRQRoutingInfoLength != NULL)
kfree(PCIIRQRoutingInfoLength);
return 0; return 0;
} else { } else {
// Didn't get a match on the target PCI device. Check if the // Didn't get a match on the target PCI device. Check if the
...@@ -508,10 +508,11 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl ...@@ -508,10 +508,11 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
// device, I need to save the bridge's slot number. If I can't // device, I need to save the bridge's slot number. If I can't
// find an entry for the target device, I will have to assume it's // find an entry for the target device, I will have to assume it's
// on the other side of the bridge, and assign it the bridge's slot. // on the other side of the bridge, and assign it the bridge's slot.
pci_read_config_dword_nodev (ops, tbus, tdevice, 0, PCI_REVISION_ID, &work); bus->number = tbus;
pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_REVISION_ID, &work);
if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) { if ((work >> 8) == PCI_TO_PCI_BRIDGE_CLASS) {
pci_read_config_dword_nodev (ops, tbus, tdevice, 0, PCI_PRIMARY_BUS, &work); pci_bus_read_config_dword (bus, PCI_DEVFN(tdevice, 0), PCI_PRIMARY_BUS, &work);
// See if bridge's secondary bus matches target bus. // See if bridge's secondary bus matches target bus.
if (((work >> 8) & 0x000000FF) == (long) bus_num) { if (((work >> 8) & 0x000000FF) == (long) bus_num) {
bridgeSlot = tslot; bridgeSlot = tslot;
...@@ -521,7 +522,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl ...@@ -521,7 +522,6 @@ static int get_slot_mapping (struct pci_ops *ops, u8 bus_num, u8 dev_num, u8 *sl
} }
// If we got here, we didn't find an entry in the IRQ mapping table // If we got here, we didn't find an entry in the IRQ mapping table
// for the target PCI device. If we did determine that the target // for the target PCI device. If we did determine that the target
// device is on the other side of a PCI-to-PCI bridge, return the // device is on the other side of a PCI-to-PCI bridge, return the
...@@ -592,7 +592,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) ...@@ -592,7 +592,7 @@ static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -627,7 +627,7 @@ static int process_SI (struct hotplug_slot *hotplug_slot) ...@@ -627,7 +627,7 @@ static int process_SI (struct hotplug_slot *hotplug_slot)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -667,7 +667,7 @@ static int process_SS (struct hotplug_slot *hotplug_slot) ...@@ -667,7 +667,7 @@ static int process_SS (struct hotplug_slot *hotplug_slot)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -695,7 +695,7 @@ static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value) ...@@ -695,7 +695,7 @@ static int hardware_test (struct hotplug_slot *hotplug_slot, u32 value)
struct slot *slot = get_slot (hotplug_slot, __FUNCTION__); struct slot *slot = get_slot (hotplug_slot, __FUNCTION__);
struct controller *ctrl; struct controller *ctrl;
dbg(__FUNCTION__"\n"); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
...@@ -716,7 +716,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -716,7 +716,7 @@ static int get_power_status (struct hotplug_slot *hotplug_slot, u8 *value)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -734,7 +734,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -734,7 +734,7 @@ static int get_attention_status (struct hotplug_slot *hotplug_slot, u8 *value)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -752,7 +752,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -752,7 +752,7 @@ static int get_latch_status (struct hotplug_slot *hotplug_slot, u8 *value)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -771,7 +771,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value) ...@@ -771,7 +771,7 @@ static int get_adapter_status (struct hotplug_slot *hotplug_slot, u8 *value)
if (slot == NULL) if (slot == NULL)
return -ENODEV; return -ENODEV;
dbg(__FUNCTION__" - physical_slot = %s\n", hotplug_slot->name); dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
ctrl = slot->ctrl; ctrl = slot->ctrl;
if (ctrl == NULL) if (ctrl == NULL)
...@@ -820,7 +820,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -820,7 +820,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
// TODO: This code can be made to support non-Compaq or Intel subsystem IDs // TODO: This code can be made to support non-Compaq or Intel subsystem IDs
rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid); rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vid);
if (rc) { if (rc) {
err(__FUNCTION__" : pci_read_config_word failed\n"); err("%s : pci_read_config_word failed\n", __FUNCTION__);
return rc; return rc;
} }
dbg("Subsystem Vendor ID: %x\n", subsystem_vid); dbg("Subsystem Vendor ID: %x\n", subsystem_vid);
...@@ -831,14 +831,14 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -831,14 +831,14 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL); ctrl = (struct controller *) kmalloc(sizeof(struct controller), GFP_KERNEL);
if (!ctrl) { if (!ctrl) {
err(__FUNCTION__" : out of memory\n"); err("%s : out of memory\n", __FUNCTION__);
return -ENOMEM; return -ENOMEM;
} }
memset(ctrl, 0, sizeof(struct controller)); memset(ctrl, 0, sizeof(struct controller));
rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid); rc = pci_read_config_word(pdev, PCI_SUBSYSTEM_ID, &subsystem_deviceid);
if (rc) { if (rc) {
err(__FUNCTION__" : pci_read_config_word failed\n"); err("%s : pci_read_config_word failed\n", __FUNCTION__);
goto err_free_ctrl; goto err_free_ctrl;
} }
...@@ -991,12 +991,20 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -991,12 +991,20 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
dbg (" pcix_support %s\n", ctrl->pcix_support == 0 ? "not supported" : "supported"); dbg (" pcix_support %s\n", ctrl->pcix_support == 0 ? "not supported" : "supported");
ctrl->pci_dev = pdev; ctrl->pci_dev = pdev;
ctrl->pci_ops = pdev->bus->ops;
/* make our own copy of the pci bus structure, as we like tweaking it a lot */
ctrl->pci_bus = kmalloc (sizeof (*ctrl->pci_bus), GFP_KERNEL);
if (!ctrl->pci_bus) {
err("out of memory\n");
rc = -ENOMEM;
goto err_free_ctrl;
}
memcpy (ctrl->pci_bus, pdev->bus, sizeof (*ctrl->pci_bus));
ctrl->bus = pdev->bus->number; ctrl->bus = pdev->bus->number;
ctrl->device = PCI_SLOT(pdev->devfn);
ctrl->function = PCI_FUNC(pdev->devfn);
ctrl->rev = rev; ctrl->rev = rev;
dbg("bus device function rev: %d %d %d %d\n", ctrl->bus, ctrl->device, ctrl->function, ctrl->rev); dbg("bus device function rev: %d %d %d %d\n", ctrl->bus,
PCI_SLOT(pdev->devfn), PCI_FUNC(pdev->devfn), ctrl->rev);
init_MUTEX(&ctrl->crit_sect); init_MUTEX(&ctrl->crit_sect);
init_waitqueue_head(&ctrl->queue); init_waitqueue_head(&ctrl->queue);
...@@ -1004,7 +1012,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1004,7 +1012,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
/* initialize our threads if they haven't already been started up */ /* initialize our threads if they haven't already been started up */
rc = one_time_init(); rc = one_time_init();
if (rc) { if (rc) {
goto err_free_ctrl; goto err_free_bus;
} }
dbg("pdev = %p\n", pdev); dbg("pdev = %p\n", pdev);
...@@ -1015,7 +1023,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1015,7 +1023,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
pci_resource_len(pdev, 0), MY_NAME)) { pci_resource_len(pdev, 0), MY_NAME)) {
err("cannot reserve MMIO region\n"); err("cannot reserve MMIO region\n");
rc = -ENOMEM; rc = -ENOMEM;
goto err_free_ctrl; goto err_free_bus;
} }
ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); ctrl->hpc_reg = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
...@@ -1043,7 +1051,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1043,7 +1051,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
// in this case it will always be called for the "base" // in this case it will always be called for the "base"
// bus/dev/func of a slot. // bus/dev/func of a slot.
// CS: this is leveraging the PCIIRQ routing code from the kernel (pci-pc.c: get_irq_routing_table) // CS: this is leveraging the PCIIRQ routing code from the kernel (pci-pc.c: get_irq_routing_table)
rc = get_slot_mapping(ctrl->pci_ops, pdev->bus->number, (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), &(ctrl->first_slot)); rc = get_slot_mapping(ctrl->pci_bus, pdev->bus->number, (readb(ctrl->hpc_reg + SLOT_MASK) >> 4), &(ctrl->first_slot));
dbg("get_slot_mapping: first_slot = %d, returned = %d\n", ctrl->first_slot, rc); dbg("get_slot_mapping: first_slot = %d, returned = %d\n", ctrl->first_slot, rc);
if (rc) { if (rc) {
err(msg_initialization_err, rc); err(msg_initialization_err, rc);
...@@ -1053,7 +1061,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1053,7 +1061,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
// Store PCI Config Space for all devices on this bus // Store PCI Config Space for all devices on this bus
rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK)); rc = cpqhp_save_config(ctrl, ctrl->bus, readb(ctrl->hpc_reg + SLOT_MASK));
if (rc) { if (rc) {
err(__FUNCTION__": unable to save PCI configuration data, error %d\n", rc); err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
goto err_iounmap; goto err_iounmap;
} }
...@@ -1080,7 +1088,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1080,7 +1088,7 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table); rc = ctrl_slot_setup(ctrl, smbios_start, smbios_table);
if (rc) { if (rc) {
err(msg_initialization_err, 6); err(msg_initialization_err, 6);
err(__FUNCTION__": unable to save PCI configuration data, error %d\n", rc); err("%s: unable to save PCI configuration data, error %d\n", __FUNCTION__, rc);
goto err_iounmap; goto err_iounmap;
} }
...@@ -1188,6 +1196,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -1188,6 +1196,8 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
iounmap(ctrl->hpc_reg); iounmap(ctrl->hpc_reg);
err_free_mem_region: err_free_mem_region:
release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); release_mem_region(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
err_free_bus:
kfree(ctrl->pci_bus);
err_free_ctrl: err_free_ctrl:
kfree(ctrl); kfree(ctrl);
return rc; return rc;
...@@ -1328,6 +1338,8 @@ static void unload_cpqphpd(void) ...@@ -1328,6 +1338,8 @@ static void unload_cpqphpd(void)
kfree(tres); kfree(tres);
} }
kfree (ctrl->pci_bus);
tctrl = ctrl; tctrl = ctrl;
ctrl = ctrl->next; ctrl = ctrl->next;
kfree(tctrl); kfree(tctrl);
......
This diff is collapsed.
...@@ -161,7 +161,7 @@ static int check_for_compaq_ROM (void *rom_start) ...@@ -161,7 +161,7 @@ static int check_for_compaq_ROM (void *rom_start)
(temp6 == 'Q')) { (temp6 == 'Q')) {
result = 1; result = 1;
} }
dbg (__FUNCTION__" - returned %d\n", result); dbg ("%s - returned %d\n", __FUNCTION__, result);
return result; return result;
} }
...@@ -286,12 +286,12 @@ static u32 store_HRT (void *rom_start) ...@@ -286,12 +286,12 @@ static u32 store_HRT (void *rom_start)
return(rc); return(rc);
// The device Number // The device Number
rc = add_byte( &pFill, ctrl->device, &usedbytes, &available); rc = add_byte( &pFill, PCI_SLOT(ctrl->pci_dev->devfn), &usedbytes, &available);
if (rc) if (rc)
return(rc); return(rc);
// The function Number // The function Number
rc = add_byte( &pFill, ctrl->function, &usedbytes, &available); rc = add_byte( &pFill, PCI_FUNC(ctrl->pci_dev->devfn), &usedbytes, &available);
if (rc) if (rc)
return(rc); return(rc);
...@@ -479,8 +479,9 @@ int compaq_nvram_load (void *rom_start, struct controller *ctrl) ...@@ -479,8 +479,9 @@ int compaq_nvram_load (void *rom_start, struct controller *ctrl)
device = p_ev_ctrl->device; device = p_ev_ctrl->device;
function = p_ev_ctrl->function; function = p_ev_ctrl->function;
while ((bus != ctrl->bus) || (device != ctrl->device) while ((bus != ctrl->bus) ||
|| (function != ctrl->function)) { (device != PCI_SLOT(ctrl->pci_dev->devfn)) ||
(function != PCI_FUNC(ctrl->pci_dev->devfn))) {
nummem = p_ev_ctrl->mem_avail; nummem = p_ev_ctrl->mem_avail;
numpmem = p_ev_ctrl->p_mem_avail; numpmem = p_ev_ctrl->p_mem_avail;
numio = p_ev_ctrl->io_avail; numio = p_ev_ctrl->io_avail;
......
This diff is collapsed.
...@@ -53,8 +53,9 @@ static int read_ctrl (char *buf, char **start, off_t offset, int len, int *eof, ...@@ -53,8 +53,9 @@ static int read_ctrl (char *buf, char **start, off_t offset, int len, int *eof,
*eof = 1; *eof = 1;
out += sprintf(out, "hot plug ctrl Info Page\n"); out += sprintf(out, "hot plug ctrl Info Page\n");
out += sprintf(out, "bus = %d, device = %d, function = %d\n",ctrl->bus, out += sprintf(out, "bus = %d, device = %d, function = %d\n",
ctrl->device, ctrl->function); ctrl->bus, PCI_SLOT(ctrl->pci_dev->devfn),
PCI_FUNC(ctrl->pci_dev->devfn));
out += sprintf(out, "Free resources: memory\n"); out += sprintf(out, "Free resources: memory\n");
index = 11; index = 11;
res = ctrl->mem_head; res = ctrl->mem_head;
...@@ -104,8 +105,9 @@ static int read_dev (char *buf, char **start, off_t offset, int len, int *eof, v ...@@ -104,8 +105,9 @@ static int read_dev (char *buf, char **start, off_t offset, int len, int *eof, v
*eof = 1; *eof = 1;
out += sprintf(out, "hot plug ctrl Info Page\n"); out += sprintf(out, "hot plug ctrl Info Page\n");
out += sprintf(out, "bus = %d, device = %d, function = %d\n",ctrl->bus, out += sprintf(out, "bus = %d, device = %d, function = %d\n",
ctrl->device, ctrl->function); ctrl->bus, PCI_SLOT(ctrl->pci_dev->devfn),
PCI_FUNC(ctrl->pci_dev->devfn));
slot=ctrl->slot; slot=ctrl->slot;
......
...@@ -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
...@@ -669,7 +693,7 @@ extern void ibmphp_hpc_stop_poll_thread (void); ...@@ -669,7 +693,7 @@ extern void ibmphp_hpc_stop_poll_thread (void);
#define PCIX66 0x05 #define PCIX66 0x05
#define PCI66 0x04 #define PCI66 0x04
extern struct pci_ops *ibmphp_pci_root_ops; extern struct pci_bus *ibmphp_pci_bus;
/* Variables */ /* Variables */
...@@ -713,6 +737,7 @@ struct slot { ...@@ -713,6 +737,7 @@ struct slot {
struct controller { struct controller {
struct ebda_hpc_slot *slots; struct ebda_hpc_slot *slots;
struct ebda_hpc_bus *buses; 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 starting_slot_num; /* starting and ending slot #'s this ctrl controls*/
u8 ending_slot_num; u8 ending_slot_num;
u8 revision; u8 revision;
......
This diff is collapsed.
This diff is collapsed.
...@@ -107,8 +107,8 @@ static struct semaphore sem_exit; // make sure polling thread goes away ...@@ -107,8 +107,8 @@ static struct semaphore sem_exit; // make sure polling thread goes away
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
// local function prototypes // local function prototypes
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static u8 ctrl_read (struct controller *, void *, u8); static u8 i2c_ctrl_read (struct controller *, void *, u8);
static u8 ctrl_write (struct controller *, void *, u8, u8); static u8 i2c_ctrl_write (struct controller *, void *, u8, u8);
static u8 hpc_writecmdtoindex (u8, u8); static u8 hpc_writecmdtoindex (u8, u8);
static u8 hpc_readcmdtoindex (u8, u8); static u8 hpc_readcmdtoindex (u8, u8);
static void get_hpc_access (void); static void get_hpc_access (void);
...@@ -142,12 +142,12 @@ void __init ibmphp_hpc_initvars (void) ...@@ -142,12 +142,12 @@ void __init ibmphp_hpc_initvars (void)
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Name: ctrl_read * Name: i2c_ctrl_read
* *
* Action: read from HPC over I2C * Action: read from HPC over I2C
* *
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
static u8 ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index) static u8 i2c_ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
{ {
u8 status; u8 status;
int i; int i;
...@@ -249,13 +249,13 @@ static u8 ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index) ...@@ -249,13 +249,13 @@ static u8 ctrl_read (struct controller *ctlr_ptr, void *WPGBbar, u8 index)
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Name: ctrl_write * Name: i2c_ctrl_write
* *
* Action: write to HPC over I2C * Action: write to HPC over I2C
* *
* Return 0 or error codes * Return 0 or error codes
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
static u8 ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index, u8 cmd) static u8 i2c_ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index, u8 cmd)
{ {
u8 rc; u8 rc;
void *wpg_addr; // base addr + offset void *wpg_addr; // base addr + offset
...@@ -351,6 +351,93 @@ static u8 ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index, u8 c ...@@ -351,6 +351,93 @@ static u8 ctrl_write (struct controller *ctlr_ptr, void *WPGBbar, u8 index, u8 c
return (rc); return (rc);
} }
//------------------------------------------------------------
// Read from ISA type HPC
//------------------------------------------------------------
static u8 isa_ctrl_read (struct controller *ctlr_ptr, u8 offset)
{
u16 start_address;
u16 end_address;
u8 data;
start_address = ctlr_ptr->u.isa_ctlr.io_start;
end_address = ctlr_ptr->u.isa_ctlr.io_end;
data = inb (start_address + offset);
return data;
}
//--------------------------------------------------------------
// Write to ISA type HPC
//--------------------------------------------------------------
static void isa_ctrl_write (struct controller *ctlr_ptr, u8 offset, u8 data)
{
u16 start_address;
u16 port_address;
start_address = ctlr_ptr->u.isa_ctlr.io_start;
port_address = start_address + (u16) offset;
outb (data, port_address);
}
static u8 pci_ctrl_read (struct controller *ctrl, u8 offset)
{
u8 data = 0x00;
debug ("inside pci_ctrl_read\n");
if (ctrl->ctrl_dev)
pci_read_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, &data);
return data;
}
static u8 pci_ctrl_write (struct controller *ctrl, u8 offset, u8 data)
{
u8 rc = -ENODEV;
debug ("inside pci_ctrl_write\n");
if (ctrl->ctrl_dev) {
pci_write_config_byte (ctrl->ctrl_dev, HPC_PCI_OFFSET + offset, data);
rc = 0;
}
return rc;
}
static u8 ctrl_read (struct controller *ctlr, void *base, u8 offset)
{
u8 rc;
switch (ctlr->ctlr_type) {
case 0:
rc = isa_ctrl_read (ctlr, offset);
break;
case 1:
rc = pci_ctrl_read (ctlr, offset);
break;
case 2:
case 4:
rc = i2c_ctrl_read (ctlr, base, offset);
break;
default:
return -ENODEV;
}
return rc;
}
static u8 ctrl_write (struct controller *ctlr, void *base, u8 offset, u8 data)
{
u8 rc = 0;
switch (ctlr->ctlr_type) {
case 0:
isa_ctrl_write(ctlr, offset, data);
break;
case 1:
rc = pci_ctrl_write (ctlr, offset, data);
break;
case 2:
case 4:
rc = i2c_ctrl_write(ctlr, base, offset, data);
break;
default:
return -ENODEV;
}
return rc;
}
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
* Name: hpc_writecmdtoindex() * Name: hpc_writecmdtoindex()
* *
...@@ -449,7 +536,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index) ...@@ -449,7 +536,7 @@ static u8 hpc_readcmdtoindex (u8 cmd, u8 index)
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
{ {
void *wpg_bbar; void *wpg_bbar = NULL;
struct controller *ctlr_ptr; struct controller *ctlr_ptr;
struct list_head *pslotlist; struct list_head *pslotlist;
u8 index, status; u8 index, status;
...@@ -491,6 +578,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) ...@@ -491,6 +578,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// map physical address to logical address // map physical address to logical address
//-------------------------------------------------------------------- //--------------------------------------------------------------------
if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4))
wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE);
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -569,7 +657,11 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) ...@@ -569,7 +657,11 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// cleanup // cleanup
//-------------------------------------------------------------------- //--------------------------------------------------------------------
iounmap (wpg_bbar); // remove physical to logical address mapping
// remove physical to logical address mapping
if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4))
iounmap (wpg_bbar);
free_hpc_access (); free_hpc_access ();
debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc); debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
...@@ -583,7 +675,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus) ...@@ -583,7 +675,7 @@ int ibmphp_hpc_readslot (struct slot * pslot, u8 cmd, u8 * pstatus)
*---------------------------------------------------------------------*/ *---------------------------------------------------------------------*/
int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
{ {
void *wpg_bbar; void *wpg_bbar = NULL;
struct controller *ctlr_ptr; struct controller *ctlr_ptr;
u8 index, status; u8 index, status;
int busindex; int busindex;
...@@ -626,12 +718,13 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) ...@@ -626,12 +718,13 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// map physical address to logical address // map physical address to logical address
//-------------------------------------------------------------------- //--------------------------------------------------------------------
if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4)) {
wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE); wpg_bbar = ioremap (ctlr_ptr->u.wpeg_ctlr.wpegbbar, WPG_I2C_IOREMAP_SIZE);
debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __FUNCTION__, debug ("%s - ctlr id[%x] physical[%lx] logical[%lx] i2c[%x]\n", __FUNCTION__,
ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar, ctlr_ptr->ctlr_id, (ulong) (ctlr_ptr->u.wpeg_ctlr.wpegbbar), (ulong) wpg_bbar,
ctlr_ptr->u.wpeg_ctlr.i2c_addr); ctlr_ptr->u.wpeg_ctlr.i2c_addr);
}
//-------------------------------------------------------------------- //--------------------------------------------------------------------
// check controller status before writing // check controller status before writing
//-------------------------------------------------------------------- //--------------------------------------------------------------------
...@@ -668,7 +761,10 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd) ...@@ -668,7 +761,10 @@ int ibmphp_hpc_writeslot (struct slot * pslot, u8 cmd)
ctlr_ptr->status = status; ctlr_ptr->status = status;
} }
// cleanup // cleanup
iounmap (wpg_bbar); // remove physical to logical address mapping
// remove physical to logical address mapping
if ((ctlr_ptr->ctlr_type == 2) || (ctlr_ptr->ctlr_type == 4))
iounmap (wpg_bbar);
free_hpc_access (); free_hpc_access ();
debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc); debug_polling ("%s - Exit rc[%d]\n", __FUNCTION__, rc);
...@@ -701,6 +797,7 @@ void free_hpc_access (void) ...@@ -701,6 +797,7 @@ void free_hpc_access (void)
void ibmphp_lock_operations (void) void ibmphp_lock_operations (void)
{ {
down (&semOperations); down (&semOperations);
to_debug = TRUE;
} }
/*---------------------------------------------------------------------- /*----------------------------------------------------------------------
...@@ -710,6 +807,7 @@ void ibmphp_unlock_operations (void) ...@@ -710,6 +807,7 @@ void ibmphp_unlock_operations (void)
{ {
debug ("%s - Entry\n", __FUNCTION__); debug ("%s - Entry\n", __FUNCTION__);
up (&semOperations); up (&semOperations);
to_debug = FALSE;
debug ("%s - Exit\n", __FUNCTION__); debug ("%s - Exit\n", __FUNCTION__);
} }
...@@ -734,6 +832,9 @@ static void poll_hpc (void) ...@@ -734,6 +832,9 @@ static void poll_hpc (void)
debug ("%s - Entry\n", __FUNCTION__); debug ("%s - Entry\n", __FUNCTION__);
while (!ibmphp_shutdown) { while (!ibmphp_shutdown) {
if (ibmphp_shutdown)
break;
/* try to get the lock to do some kind of harware access */ /* try to get the lock to do some kind of harware access */
down (&semOperations); down (&semOperations);
...@@ -758,9 +859,9 @@ static void poll_hpc (void) ...@@ -758,9 +859,9 @@ static void poll_hpc (void)
} }
} }
} }
poll_state = POLL_SLOTS; ++poll_count;
poll_state = POLL_SLEEP;
break; break;
case POLL_SLOTS: case POLL_SLOTS:
list_for_each (pslotlist, &ibmphp_slot_head) { list_for_each (pslotlist, &ibmphp_slot_head) {
pslot = list_entry (pslotlist, struct slot, ibm_slot_list); pslot = list_entry (pslotlist, struct slot, ibm_slot_list);
...@@ -772,7 +873,6 @@ static void poll_hpc (void) ...@@ -772,7 +873,6 @@ static void poll_hpc (void)
|| (myslot.ext_status != pslot->ext_status)) || (myslot.ext_status != pslot->ext_status))
process_changeinstatus (pslot, &myslot); process_changeinstatus (pslot, &myslot);
} }
ctrl_count = 0x00; ctrl_count = 0x00;
list_for_each (pslotlist, &ibmphp_slot_head) { list_for_each (pslotlist, &ibmphp_slot_head) {
if (ctrl_count >= ibmphp_get_total_controllers()) if (ctrl_count >= ibmphp_get_total_controllers())
...@@ -787,29 +887,31 @@ static void poll_hpc (void) ...@@ -787,29 +887,31 @@ static void poll_hpc (void)
} }
} }
++poll_count; ++poll_count;
if (poll_count >= POLL_LATCH_CNT) {
poll_count = 0;
poll_state = POLL_SLEEP; poll_state = POLL_SLEEP;
}
break; break;
case POLL_SLEEP: case POLL_SLEEP:
/* don't sleep with a lock on the hardware */ /* don't sleep with a lock on the hardware */
up (&semOperations); up (&semOperations);
long_delay (POLL_INTERVAL_SEC * HZ); long_delay (POLL_INTERVAL_SEC * HZ);
if (ibmphp_shutdown)
break;
down (&semOperations); down (&semOperations);
if (poll_count >= POLL_LATCH_CNT) {
poll_count = 0;
poll_state = POLL_SLOTS;
} else
poll_state = POLL_LATCH_REGISTER; poll_state = POLL_LATCH_REGISTER;
break; break;
} }
/* give up the harware semaphore */ /* give up the harware semaphore */
up (&semOperations); up (&semOperations);
/* sleep for a short time just for good measure */ /* sleep for a short time just for good measure */
set_current_state (TASK_INTERRUPTIBLE); set_current_state (TASK_INTERRUPTIBLE);
schedule_timeout (HZ/10); schedule_timeout (HZ/10);
} }
up (&sem_exit); up (&sem_exit);
debug ("%s - Exit\n", __FUNCTION__); debug ("%s - Exit\n", __FUNCTION__);
} }
...@@ -1070,15 +1172,23 @@ void __exit ibmphp_hpc_stop_poll_thread (void) ...@@ -1070,15 +1172,23 @@ void __exit ibmphp_hpc_stop_poll_thread (void)
debug ("%s - Entry\n", __FUNCTION__); debug ("%s - Entry\n", __FUNCTION__);
ibmphp_shutdown = TRUE; ibmphp_shutdown = TRUE;
debug ("before locking operations \n");
ibmphp_lock_operations (); ibmphp_lock_operations ();
debug ("after locking operations \n");
// wait for poll thread to exit // wait for poll thread to exit
debug ("before sem_exit down \n");
down (&sem_exit); down (&sem_exit);
debug ("after sem_exit down \n");
// cleanup // cleanup
debug ("before free_hpc_access \n");
free_hpc_access (); free_hpc_access ();
debug ("after free_hpc_access \n");
ibmphp_unlock_operations (); ibmphp_unlock_operations ();
debug ("after unlock operations \n");
up (&sem_exit); up (&sem_exit);
debug ("after sem exit up\n");
debug ("%s - Exit\n", __FUNCTION__); debug ("%s - Exit\n", __FUNCTION__);
} }
......
This diff is collapsed.
This diff is collapsed.
...@@ -141,20 +141,5 @@ extern int pci_visit_dev (struct pci_visit *fn, ...@@ -141,20 +141,5 @@ extern int pci_visit_dev (struct pci_visit *fn,
struct pci_dev_wrapped *wrapped_dev, struct pci_dev_wrapped *wrapped_dev,
struct pci_bus_wrapped *wrapped_parent); struct pci_bus_wrapped *wrapped_parent);
extern int pci_read_config_byte_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u8 *val);
extern int pci_read_config_word_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u16 *val);
extern int pci_read_config_dword_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u32 *val);
extern int pci_write_config_byte_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u8 val);
extern int pci_write_config_word_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u16 val);
extern int pci_write_config_dword_nodev (struct pci_ops *ops, u8 bus, u8 device,
u8 function, int where, u32 val);
#endif #endif
...@@ -6,10 +6,8 @@ export-objs := access.o hotplug.o pci-driver.o pci.o pool.o \ ...@@ -6,10 +6,8 @@ export-objs := access.o hotplug.o pci-driver.o pci.o pool.o \
probe.o proc.o search.o compat.o probe.o proc.o search.o compat.o
obj-y += access.o probe.o pci.o pool.o quirks.o \ obj-y += access.o probe.o pci.o pool.o quirks.o \
compat.o names.o pci-driver.o search.o compat.o names.o pci-driver.o search.o hotplug.o
obj-$(CONFIG_PM) += power.o obj-$(CONFIG_PM) += power.o
obj-$(CONFIG_HOTPLUG) += hotplug.o
obj-$(CONFIG_PROC_FS) += proc.o obj-$(CONFIG_PROC_FS) += proc.o
ifndef CONFIG_SPARC64 ifndef CONFIG_SPARC64
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#define TRUE (!FALSE) #define TRUE (!FALSE)
#endif #endif
static void #ifdef CONFIG_HOTPLUG
run_sbin_hotplug(struct pci_dev *pdev, int insert) static void run_sbin_hotplug(struct pci_dev *pdev, int insert)
{ {
int i; int i;
char *argv[3], *envp[8]; char *argv[3], *envp[8];
...@@ -45,13 +45,18 @@ run_sbin_hotplug(struct pci_dev *pdev, int insert) ...@@ -45,13 +45,18 @@ run_sbin_hotplug(struct pci_dev *pdev, int insert)
call_usermodehelper (argv [0], argv, envp); call_usermodehelper (argv [0], argv, envp);
} }
#else
static void run_sbin_hotplug(struct pci_dev *pdev, int insert) { }
#endif
/** /**
* pci_insert_device - insert a hotplug device * pci_insert_device - insert a pci device
* @dev: the device to insert * @dev: the device to insert
* @bus: where to insert it * @bus: where to insert it
* *
* Add a new device to the device lists and notify userspace (/sbin/hotplug). * Link the device to both the global PCI device chain and the
* per-bus list of devices, add the /proc entry, and notify
* userspace (/sbin/hotplug).
*/ */
void void
pci_insert_device(struct pci_dev *dev, struct pci_bus *bus) pci_insert_device(struct pci_dev *dev, struct pci_bus *bus)
...@@ -78,11 +83,11 @@ pci_free_resources(struct pci_dev *dev) ...@@ -78,11 +83,11 @@ pci_free_resources(struct pci_dev *dev)
} }
/** /**
* pci_remove_device - remove a hotplug device * pci_remove_device - remove a pci device
* @dev: the device to remove * @dev: the device to remove
* *
* Delete the device structure from the device lists and * Delete the device structure from the device lists,
* notify userspace (/sbin/hotplug). * remove the /proc entry, and notify userspace (/sbin/hotplug).
*/ */
void void
pci_remove_device(struct pci_dev *dev) pci_remove_device(struct pci_dev *dev)
...@@ -94,10 +99,11 @@ pci_remove_device(struct pci_dev *dev) ...@@ -94,10 +99,11 @@ pci_remove_device(struct pci_dev *dev)
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
pci_proc_detach_device(dev); pci_proc_detach_device(dev);
#endif #endif
/* notify userspace of hotplug device removal */ /* notify userspace of hotplug device removal */
run_sbin_hotplug(dev, FALSE); run_sbin_hotplug(dev, FALSE);
} }
#ifdef CONFIG_HOTPLUG
EXPORT_SYMBOL(pci_insert_device); EXPORT_SYMBOL(pci_insert_device);
EXPORT_SYMBOL(pci_remove_device); EXPORT_SYMBOL(pci_remove_device);
#endif
...@@ -479,10 +479,10 @@ struct pci_dev * __devinit pci_scan_slot(struct pci_dev *temp) ...@@ -479,10 +479,10 @@ struct pci_dev * __devinit pci_scan_slot(struct pci_dev *temp)
/* /*
* Link the device to both the global PCI device chain and * Link the device to both the global PCI device chain and
* the per-bus list of devices. * the per-bus list of devices and call /sbin/hotplug if we
* should.
*/ */
list_add_tail(&dev->global_list, &pci_devices); pci_insert_device (dev, bus);
list_add_tail(&dev->bus_list, &bus->devices);
/* Fix up broken headers */ /* Fix up broken headers */
pci_fixup_device(PCI_FIXUP_HEADER, dev); pci_fixup_device(PCI_FIXUP_HEADER, dev);
...@@ -594,4 +594,5 @@ EXPORT_SYMBOL(pci_setup_device); ...@@ -594,4 +594,5 @@ EXPORT_SYMBOL(pci_setup_device);
EXPORT_SYMBOL(pci_add_new_bus); EXPORT_SYMBOL(pci_add_new_bus);
EXPORT_SYMBOL(pci_do_scan_bus); EXPORT_SYMBOL(pci_do_scan_bus);
EXPORT_SYMBOL(pci_scan_slot); EXPORT_SYMBOL(pci_scan_slot);
EXPORT_SYMBOL(pci_scan_bus);
#endif #endif
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#define PCI_CFG_SPACE_SIZE 256 #define PCI_CFG_SPACE_SIZE 256
static int proc_initialized; /* = 0 */
static loff_t static loff_t
proc_bus_pci_lseek(struct file *file, loff_t off, int whence) proc_bus_pci_lseek(struct file *file, loff_t off, int whence)
{ {
...@@ -410,6 +412,9 @@ int pci_proc_attach_device(struct pci_dev *dev) ...@@ -410,6 +412,9 @@ int pci_proc_attach_device(struct pci_dev *dev)
struct proc_dir_entry *de, *e; struct proc_dir_entry *de, *e;
char name[16]; char name[16];
if (!proc_initialized)
return -EACCES;
if (!(de = bus->procdir)) { if (!(de = bus->procdir)) {
sprintf(name, "%02x", bus->number); sprintf(name, "%02x", bus->number);
de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir); de = bus->procdir = proc_mkdir(name, proc_bus_pci_dir);
...@@ -446,6 +451,9 @@ int pci_proc_attach_bus(struct pci_bus* bus) ...@@ -446,6 +451,9 @@ int pci_proc_attach_bus(struct pci_bus* bus)
{ {
struct proc_dir_entry *de = bus->procdir; struct proc_dir_entry *de = bus->procdir;
if (!proc_initialized)
return -EACCES;
if (!de) { if (!de) {
char name[16]; char name[16];
sprintf(name, "%02x", bus->number); sprintf(name, "%02x", bus->number);
...@@ -595,6 +603,7 @@ static int __init pci_proc_init(void) ...@@ -595,6 +603,7 @@ static int __init pci_proc_init(void)
entry = create_proc_entry("devices", 0, proc_bus_pci_dir); entry = create_proc_entry("devices", 0, proc_bus_pci_dir);
if (entry) if (entry)
entry->proc_fops = &proc_bus_pci_dev_operations; entry->proc_fops = &proc_bus_pci_dev_operations;
proc_initialized = 1;
pci_for_each_dev(dev) { pci_for_each_dev(dev) {
pci_proc_attach_device(dev); pci_proc_attach_device(dev);
} }
......
...@@ -634,7 +634,6 @@ void pci_insert_device(struct pci_dev *, struct pci_bus *); ...@@ -634,7 +634,6 @@ void pci_insert_device(struct pci_dev *, struct pci_bus *);
void pci_remove_device(struct pci_dev *); void pci_remove_device(struct pci_dev *);
struct pci_driver *pci_dev_driver(const struct pci_dev *); struct pci_driver *pci_dev_driver(const struct pci_dev *);
const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev); const struct pci_device_id *pci_match_device(const struct pci_device_id *ids, const struct pci_dev *dev);
void pci_announce_device_to_drivers(struct pci_dev *);
unsigned int pci_do_scan_bus(struct pci_bus *bus); unsigned int pci_do_scan_bus(struct pci_bus *bus);
struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr); struct pci_bus * pci_add_new_bus(struct pci_bus *parent, struct pci_dev *dev, int busnr);
......
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