fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / pci / hotplug / pciehp_core.c
index 601cf90..f13f313 100644 (file)
@@ -69,6 +69,7 @@ static int get_power_status   (struct hotplug_slot *slot, u8 *value);
 static int get_attention_status        (struct hotplug_slot *slot, u8 *value);
 static int get_latch_status    (struct hotplug_slot *slot, u8 *value);
 static int get_adapter_status  (struct hotplug_slot *slot, u8 *value);
+static int get_address         (struct hotplug_slot *slot, u32 *value);
 static int get_max_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
 static int get_cur_bus_speed   (struct hotplug_slot *slot, enum pci_bus_speed *value);
 
@@ -81,6 +82,7 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = {
        .get_attention_status = get_attention_status,
        .get_latch_status =     get_latch_status,
        .get_adapter_status =   get_adapter_status,
+       .get_address =          get_address,
        .get_max_bus_speed =    get_max_bus_speed,
        .get_cur_bus_speed =    get_cur_bus_speed,
 };
@@ -331,6 +333,18 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
        return 0;
 }
 
+static int get_address(struct hotplug_slot *hotplug_slot, u32 *value)
+{
+       struct slot *slot = hotplug_slot->private;
+       struct pci_bus *bus = slot->ctrl->pci_dev->subordinate;
+
+       dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name);
+
+       *value = (pci_domain_nr(bus) << 16) | (slot->bus << 8) | slot->device;
+
+       return 0;
+}
+
 static int get_max_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_speed *value)
 {
        struct slot *slot = hotplug_slot->private;
@@ -434,7 +448,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
        }
 
        /* Wait for exclusive access to hardware */
-       mutex_lock(&ctrl->crit_sect);
+       mutex_lock(&ctrl->ctrl_lock);
 
        t_slot->hpc_ops->get_adapter_status(t_slot, &value); /* Check if slot is occupied */
        
@@ -442,7 +456,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
                rc = t_slot->hpc_ops->power_off_slot(t_slot); /* Power off slot if not occupied*/
                if (rc) {
                        /* Done with exclusive hardware access */
-                       mutex_unlock(&ctrl->crit_sect);
+                       mutex_unlock(&ctrl->ctrl_lock);
                        goto err_out_free_ctrl_slot;
                } else
                        /* Wait for the command to complete */
@@ -450,7 +464,7 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
        }
 
        /* Done with exclusive hardware access */
-       mutex_unlock(&ctrl->crit_sect);
+       mutex_unlock(&ctrl->ctrl_lock);
 
        return 0;
 
@@ -507,14 +521,9 @@ static void __exit unload_pciehpd(void)
 
 }
 
-static int hpdriver_context = 0;
-
 static void pciehp_remove (struct pcie_device *device)
 {
-       printk("%s ENTRY\n", __FUNCTION__);     
-       printk("%s -> Call free_irq for irq = %d\n",  
-               __FUNCTION__, device->irq);
-       free_irq(device->irq, &hpdriver_context);
+       /* XXX - Needs to be adapted to device driver model */
 }
 
 #ifdef CONFIG_PM