vserver 1.9.5.x5
[linux-2.6.git] / drivers / pci / hotplug / cpqphp_pci.c
index bde394f..93e39c4 100644 (file)
@@ -51,10 +51,10 @@ static u16 unused_IRQ;
  * find the Hot Plug Resource Table in the specified region of memory.
  *
  */
-static void *detect_HRT_floating_pointer(void *begin, void *end)
+static void __iomem *detect_HRT_floating_pointer(void __iomem *begin, void __iomem *end)
 {
-       void *fp;
-       void *endp;
+       void __iomem *fp;
+       void __iomem *endp;
        u8 temp1, temp2, temp3, temp4;
        int status = 0;
 
@@ -151,18 +151,29 @@ static int PCI_RefinedAccessConfig(struct pci_bus *bus, unsigned int devfn, u8 o
  */
 int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num)
 {
-       int rc;
-       u16 temp_word;
-       struct pci_dev fakedev;
-       struct pci_bus fakebus;
+       int rc = 0;
 
        if (cpqhp_legacy_mode) {
-               fakedev.devfn = dev_num << 3;
-               fakedev.bus = &fakebus;
-               fakebus.number = bus_num;
+               struct pci_dev *fakedev;
+               struct pci_bus *fakebus;
+               u16 temp_word;
+
+               fakedev = kmalloc(sizeof(*fakedev), GFP_KERNEL);
+               fakebus = kmalloc(sizeof(*fakebus), GFP_KERNEL);
+               if (!fakedev || !fakebus) {
+                       kfree(fakedev);
+                       kfree(fakebus);
+                       return -ENOMEM;
+               }
+
+               fakedev->devfn = dev_num << 3;
+               fakedev->bus = fakebus;
+               fakebus->number = bus_num;
                dbg("%s: dev %d, bus %d, pin %d, num %d\n",
                    __FUNCTION__, dev_num, bus_num, int_pin, irq_num);
-               rc = pcibios_set_irq_routing(&fakedev, int_pin - 0x0a, irq_num);
+               rc = pcibios_set_irq_routing(fakedev, int_pin - 0x0a, irq_num);
+               kfree(fakedev);
+               kfree(fakebus);
                dbg("%s: rc %d\n", __FUNCTION__, rc);
                if (!rc)
                        return !rc;
@@ -176,9 +187,10 @@ int cpqhp_set_irq (u8 bus_num, u8 dev_num, u8 int_pin, u8 irq_num)
                // This should only be for x86 as it sets the Edge Level Control Register
                outb((u8) (temp_word & 0xFF), 0x4d0);
                outb((u8) ((temp_word & 0xFF00) >> 8), 0x4d1);
+               rc = 0;
        }
 
-       return 0;
+       return rc;
 }
 
 
@@ -194,7 +206,7 @@ static int PCI_ScanBusNonBridge (u8 bus, u8 device)
 
 static int PCI_ScanBusForNonBridge(struct controller *ctrl, u8 bus_num, u8 * dev_num)
 {
-       u8 tdevice;
+       u16 tdevice;
        u32 work;
        u8 tbus;
 
@@ -1162,12 +1174,13 @@ int cpqhp_valid_replace(struct controller *ctrl, struct pci_func * func)
  *
  * returns 0 if success
  */  
-int cpqhp_find_available_resources (struct controller *ctrl, void *rom_start)
+int cpqhp_find_available_resources(struct controller *ctrl, void __iomem *rom_start)
 {
        u8 temp;
        u8 populated_slot;
        u8 bridged_slot;
-       void *one_slot;
+       void __iomem *one_slot;
+       void __iomem *rom_resource_table;
        struct pci_func *func = NULL;
        int i = 10, index;
        u32 temp_dword, rc;
@@ -1175,7 +1188,6 @@ int cpqhp_find_available_resources (struct controller *ctrl, void *rom_start)
        struct pci_resource *p_mem_node;
        struct pci_resource *io_node;
        struct pci_resource *bus_node;
-       void *rom_resource_table;
 
        rom_resource_table = detect_HRT_floating_pointer(rom_start, rom_start+0xffff);
        dbg("rom_resource_table = %p\n", rom_resource_table);