diff options
Diffstat (limited to 'drivers/pci/hotplug')
-rw-r--r-- | drivers/pci/hotplug/ibmphp.h | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_hpc.c | 6 | ||||
-rw-r--r-- | drivers/pci/hotplug/ibmphp_pci.c | 7 | ||||
-rw-r--r-- | drivers/pci/hotplug/pci_hotplug.h | 2 | ||||
-rw-r--r-- | drivers/pci/hotplug/pciehp_core.c | 23 | ||||
-rw-r--r-- | drivers/pci/hotplug/pcihp_skeleton.c | 2 |
6 files changed, 29 insertions, 13 deletions
diff --git a/drivers/pci/hotplug/ibmphp.h b/drivers/pci/hotplug/ibmphp.h index 5bc039da647f..c22e0284d7b1 100644 --- a/drivers/pci/hotplug/ibmphp.h +++ b/drivers/pci/hotplug/ibmphp.h | |||
@@ -196,7 +196,7 @@ struct ebda_hpc_bus { | |||
196 | 196 | ||
197 | 197 | ||
198 | /******************************************************************** | 198 | /******************************************************************** |
199 | * THREE TYPE OF HOT PLUG CONTROLER * | 199 | * THREE TYPE OF HOT PLUG CONTROLLER * |
200 | ********************************************************************/ | 200 | ********************************************************************/ |
201 | 201 | ||
202 | struct isa_ctlr_access { | 202 | struct isa_ctlr_access { |
diff --git a/drivers/pci/hotplug/ibmphp_hpc.c b/drivers/pci/hotplug/ibmphp_hpc.c index 6894b548c8ca..1a3eb8d3d4cb 100644 --- a/drivers/pci/hotplug/ibmphp_hpc.c +++ b/drivers/pci/hotplug/ibmphp_hpc.c | |||
@@ -64,7 +64,7 @@ static int to_debug = FALSE; | |||
64 | #define WPG_I2C_OR 0x2000 // I2C OR operation | 64 | #define WPG_I2C_OR 0x2000 // I2C OR operation |
65 | 65 | ||
66 | //---------------------------------------------------------------------------- | 66 | //---------------------------------------------------------------------------- |
67 | // Command set for I2C Master Operation Setup Regisetr | 67 | // Command set for I2C Master Operation Setup Register |
68 | //---------------------------------------------------------------------------- | 68 | //---------------------------------------------------------------------------- |
69 | #define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index | 69 | #define WPG_READATADDR_MASK 0x00010000 // read,bytes,I2C shifted,index |
70 | #define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index | 70 | #define WPG_WRITEATADDR_MASK 0x40010000 // write,bytes,I2C shifted,index |
@@ -835,7 +835,7 @@ static void poll_hpc (void) | |||
835 | if (ibmphp_shutdown) | 835 | if (ibmphp_shutdown) |
836 | break; | 836 | break; |
837 | 837 | ||
838 | /* try to get the lock to do some kind of harware access */ | 838 | /* try to get the lock to do some kind of hardware access */ |
839 | down (&semOperations); | 839 | down (&semOperations); |
840 | 840 | ||
841 | switch (poll_state) { | 841 | switch (poll_state) { |
@@ -906,7 +906,7 @@ static void poll_hpc (void) | |||
906 | poll_state = POLL_LATCH_REGISTER; | 906 | poll_state = POLL_LATCH_REGISTER; |
907 | break; | 907 | break; |
908 | } | 908 | } |
909 | /* give up the harware semaphore */ | 909 | /* give up the hardware semaphore */ |
910 | up (&semOperations); | 910 | up (&semOperations); |
911 | /* sleep for a short time just for good measure */ | 911 | /* sleep for a short time just for good measure */ |
912 | msleep(100); | 912 | msleep(100); |
diff --git a/drivers/pci/hotplug/ibmphp_pci.c b/drivers/pci/hotplug/ibmphp_pci.c index 2335fac65fb4..8122fe734aa7 100644 --- a/drivers/pci/hotplug/ibmphp_pci.c +++ b/drivers/pci/hotplug/ibmphp_pci.c | |||
@@ -1308,10 +1308,10 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1308 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1308 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
1309 | } else { | 1309 | } else { |
1310 | /* This is Memory */ | 1310 | /* This is Memory */ |
1311 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1312 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1311 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
1313 | /* pfmem */ | 1312 | /* pfmem */ |
1314 | debug ("start address of pfmem is %x\n", start_address); | 1313 | debug ("start address of pfmem is %x\n", start_address); |
1314 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1315 | 1315 | ||
1316 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1316 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { |
1317 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1317 | err ("cannot find corresponding PFMEM resource to remove\n"); |
@@ -1325,6 +1325,8 @@ static int unconfigure_boot_device (u8 busno, u8 device, u8 function) | |||
1325 | } else { | 1325 | } else { |
1326 | /* regular memory */ | 1326 | /* regular memory */ |
1327 | debug ("start address of mem is %x\n", start_address); | 1327 | debug ("start address of mem is %x\n", start_address); |
1328 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1329 | |||
1328 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1330 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { |
1329 | err ("cannot find corresponding MEM resource to remove\n"); | 1331 | err ("cannot find corresponding MEM resource to remove\n"); |
1330 | return -EIO; | 1332 | return -EIO; |
@@ -1422,9 +1424,9 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1422 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ | 1424 | /* ????????? DO WE NEED TO WRITE ANYTHING INTO THE PCI CONFIG SPACE BACK ?????????? */ |
1423 | } else { | 1425 | } else { |
1424 | /* This is Memory */ | 1426 | /* This is Memory */ |
1425 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1426 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { | 1427 | if (start_address & PCI_BASE_ADDRESS_MEM_PREFETCH) { |
1427 | /* pfmem */ | 1428 | /* pfmem */ |
1429 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1428 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { | 1430 | if (ibmphp_find_resource (bus, start_address, &pfmem, PFMEM) < 0) { |
1429 | err ("cannot find corresponding PFMEM resource to remove\n"); | 1431 | err ("cannot find corresponding PFMEM resource to remove\n"); |
1430 | return -EINVAL; | 1432 | return -EINVAL; |
@@ -1436,6 +1438,7 @@ static int unconfigure_boot_bridge (u8 busno, u8 device, u8 function) | |||
1436 | } | 1438 | } |
1437 | } else { | 1439 | } else { |
1438 | /* regular memory */ | 1440 | /* regular memory */ |
1441 | start_address &= PCI_BASE_ADDRESS_MEM_MASK; | ||
1439 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { | 1442 | if (ibmphp_find_resource (bus, start_address, &mem, MEM) < 0) { |
1440 | err ("cannot find corresponding MEM resource to remove\n"); | 1443 | err ("cannot find corresponding MEM resource to remove\n"); |
1441 | return -EINVAL; | 1444 | return -EINVAL; |
diff --git a/drivers/pci/hotplug/pci_hotplug.h b/drivers/pci/hotplug/pci_hotplug.h index 57ace325168d..88d44f7fef29 100644 --- a/drivers/pci/hotplug/pci_hotplug.h +++ b/drivers/pci/hotplug/pci_hotplug.h | |||
@@ -150,7 +150,7 @@ struct hotplug_slot_info { | |||
150 | * @name: the name of the slot being registered. This string must | 150 | * @name: the name of the slot being registered. This string must |
151 | * be unique amoung slots registered on this system. | 151 | * be unique amoung slots registered on this system. |
152 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot | 152 | * @ops: pointer to the &struct hotplug_slot_ops to be used for this slot |
153 | * @info: pointer to the &struct hotplug_slot_info for the inital values for | 153 | * @info: pointer to the &struct hotplug_slot_info for the initial values for |
154 | * this slot. | 154 | * this slot. |
155 | * @release: called during pci_hp_deregister to free memory allocated in a | 155 | * @release: called during pci_hp_deregister to free memory allocated in a |
156 | * hotplug_slot structure. | 156 | * hotplug_slot structure. |
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c index 72baf749e65e..ed1fd8d6178d 100644 --- a/drivers/pci/hotplug/pciehp_core.c +++ b/drivers/pci/hotplug/pciehp_core.c | |||
@@ -90,6 +90,22 @@ static struct hotplug_slot_ops pciehp_hotplug_slot_ops = { | |||
90 | .get_cur_bus_speed = get_cur_bus_speed, | 90 | .get_cur_bus_speed = get_cur_bus_speed, |
91 | }; | 91 | }; |
92 | 92 | ||
93 | /** | ||
94 | * release_slot - free up the memory used by a slot | ||
95 | * @hotplug_slot: slot to free | ||
96 | */ | ||
97 | static void release_slot(struct hotplug_slot *hotplug_slot) | ||
98 | { | ||
99 | struct slot *slot = hotplug_slot->private; | ||
100 | |||
101 | dbg("%s - physical_slot = %s\n", __FUNCTION__, hotplug_slot->name); | ||
102 | |||
103 | kfree(slot->hotplug_slot->info); | ||
104 | kfree(slot->hotplug_slot->name); | ||
105 | kfree(slot->hotplug_slot); | ||
106 | kfree(slot); | ||
107 | } | ||
108 | |||
93 | static int init_slots(struct controller *ctrl) | 109 | static int init_slots(struct controller *ctrl) |
94 | { | 110 | { |
95 | struct slot *new_slot; | 111 | struct slot *new_slot; |
@@ -139,7 +155,8 @@ static int init_slots(struct controller *ctrl) | |||
139 | 155 | ||
140 | /* register this slot with the hotplug pci core */ | 156 | /* register this slot with the hotplug pci core */ |
141 | new_slot->hotplug_slot->private = new_slot; | 157 | new_slot->hotplug_slot->private = new_slot; |
142 | make_slot_name (new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | 158 | new_slot->hotplug_slot->release = &release_slot; |
159 | make_slot_name(new_slot->hotplug_slot->name, SLOT_NAME_SIZE, new_slot); | ||
143 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; | 160 | new_slot->hotplug_slot->ops = &pciehp_hotplug_slot_ops; |
144 | 161 | ||
145 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); | 162 | new_slot->hpc_ops->get_power_status(new_slot, &(new_slot->hotplug_slot->info->power_status)); |
@@ -188,10 +205,6 @@ static int cleanup_slots (struct controller * ctrl) | |||
188 | while (old_slot) { | 205 | while (old_slot) { |
189 | next_slot = old_slot->next; | 206 | next_slot = old_slot->next; |
190 | pci_hp_deregister (old_slot->hotplug_slot); | 207 | pci_hp_deregister (old_slot->hotplug_slot); |
191 | kfree(old_slot->hotplug_slot->info); | ||
192 | kfree(old_slot->hotplug_slot->name); | ||
193 | kfree(old_slot->hotplug_slot); | ||
194 | kfree(old_slot); | ||
195 | old_slot = next_slot; | 208 | old_slot = next_slot; |
196 | } | 209 | } |
197 | 210 | ||
diff --git a/drivers/pci/hotplug/pcihp_skeleton.c b/drivers/pci/hotplug/pcihp_skeleton.c index 6605d6bda529..3194d51c6ec9 100644 --- a/drivers/pci/hotplug/pcihp_skeleton.c +++ b/drivers/pci/hotplug/pcihp_skeleton.c | |||
@@ -297,7 +297,7 @@ static int __init init_slots(void) | |||
297 | hotplug_slot->ops = &skel_hotplug_slot_ops; | 297 | hotplug_slot->ops = &skel_hotplug_slot_ops; |
298 | 298 | ||
299 | /* | 299 | /* |
300 | * Initilize the slot info structure with some known | 300 | * Initialize the slot info structure with some known |
301 | * good values. | 301 | * good values. |
302 | */ | 302 | */ |
303 | info->power_status = get_power_status(slot); | 303 | info->power_status = get_power_status(slot); |