diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/hotplug/cpqphp_core.c | 55 |
1 files changed, 22 insertions, 33 deletions
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index f05ea7a5606b..195c8c9b33e0 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -154,7 +154,6 @@ static int init_SERR(struct controller * ctrl) | |||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | 156 | ||
157 | |||
158 | /* nice debugging output */ | 157 | /* nice debugging output */ |
159 | static int pci_print_IRQ_route (void) | 158 | static int pci_print_IRQ_route (void) |
160 | { | 159 | { |
@@ -214,7 +213,7 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | |||
214 | void __iomem *p_max; | 213 | void __iomem *p_max; |
215 | 214 | ||
216 | if (!smbios_table || !curr) | 215 | if (!smbios_table || !curr) |
217 | return(NULL); | 216 | return NULL; |
218 | 217 | ||
219 | /* set p_max to the end of the table */ | 218 | /* set p_max to the end of the table */ |
220 | p_max = smbios_start + readw(smbios_table + ST_LENGTH); | 219 | p_max = smbios_start + readw(smbios_table + ST_LENGTH); |
@@ -227,19 +226,17 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | |||
227 | * The first condition is the previous byte | 226 | * The first condition is the previous byte |
228 | * and the second is the curr | 227 | * and the second is the curr |
229 | */ | 228 | */ |
230 | if (!previous_byte && !(readb(p_temp))) { | 229 | if (!previous_byte && !(readb(p_temp))) |
231 | bail = 1; | 230 | bail = 1; |
232 | } | ||
233 | 231 | ||
234 | previous_byte = readb(p_temp); | 232 | previous_byte = readb(p_temp); |
235 | p_temp++; | 233 | p_temp++; |
236 | } | 234 | } |
237 | 235 | ||
238 | if (p_temp < p_max) { | 236 | if (p_temp < p_max) |
239 | return p_temp; | 237 | return p_temp; |
240 | } else { | 238 | else |
241 | return NULL; | 239 | return NULL; |
242 | } | ||
243 | } | 240 | } |
244 | 241 | ||
245 | 242 | ||
@@ -265,21 +262,18 @@ static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, | |||
265 | if (!smbios_table) | 262 | if (!smbios_table) |
266 | return NULL; | 263 | return NULL; |
267 | 264 | ||
268 | if (!previous) { | 265 | if (!previous) |
269 | previous = smbios_start; | 266 | previous = smbios_start; |
270 | } else { | 267 | else |
271 | previous = get_subsequent_smbios_entry(smbios_start, | 268 | previous = get_subsequent_smbios_entry(smbios_start, |
272 | smbios_table, previous); | 269 | smbios_table, previous); |
273 | } | ||
274 | 270 | ||
275 | while (previous) { | 271 | while (previous) |
276 | if (readb(previous + SMBIOS_GENERIC_TYPE) != type) { | 272 | if (readb(previous + SMBIOS_GENERIC_TYPE) != type) |
277 | previous = get_subsequent_smbios_entry(smbios_start, | 273 | previous = get_subsequent_smbios_entry(smbios_start, |
278 | smbios_table, previous); | 274 | smbios_table, previous); |
279 | } else { | 275 | else |
280 | break; | 276 | break; |
281 | } | ||
282 | } | ||
283 | 277 | ||
284 | return previous; | 278 | return previous; |
285 | } | 279 | } |
@@ -319,7 +313,7 @@ static int ctrl_slot_cleanup (struct controller * ctrl) | |||
319 | release_mem_region(pci_resource_start(ctrl->pci_dev, 0), | 313 | release_mem_region(pci_resource_start(ctrl->pci_dev, 0), |
320 | pci_resource_len(ctrl->pci_dev, 0)); | 314 | pci_resource_len(ctrl->pci_dev, 0)); |
321 | 315 | ||
322 | return(0); | 316 | return 0; |
323 | } | 317 | } |
324 | 318 | ||
325 | 319 | ||
@@ -388,9 +382,8 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot) | |||
388 | PCI_DEVFN(tdevice, 0), | 382 | PCI_DEVFN(tdevice, 0), |
389 | PCI_PRIMARY_BUS, &work); | 383 | PCI_PRIMARY_BUS, &work); |
390 | // See if bridge's secondary bus matches target bus. | 384 | // See if bridge's secondary bus matches target bus. |
391 | if (((work >> 8) & 0x000000FF) == (long) bus_num) { | 385 | if (((work >> 8) & 0x000000FF) == (long) bus_num) |
392 | bridgeSlot = tslot; | 386 | bridgeSlot = tslot; |
393 | } | ||
394 | } | 387 | } |
395 | } | 388 | } |
396 | 389 | ||
@@ -425,21 +418,21 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
425 | u8 hp_slot; | 418 | u8 hp_slot; |
426 | 419 | ||
427 | if (func == NULL) | 420 | if (func == NULL) |
428 | return(1); | 421 | return 1; |
429 | 422 | ||
430 | hp_slot = func->device - ctrl->slot_device_offset; | 423 | hp_slot = func->device - ctrl->slot_device_offset; |
431 | 424 | ||
432 | /* Wait for exclusive access to hardware */ | 425 | /* Wait for exclusive access to hardware */ |
433 | mutex_lock(&ctrl->crit_sect); | 426 | mutex_lock(&ctrl->crit_sect); |
434 | 427 | ||
435 | if (status == 1) { | 428 | if (status == 1) |
436 | amber_LED_on (ctrl, hp_slot); | 429 | amber_LED_on (ctrl, hp_slot); |
437 | } else if (status == 0) { | 430 | else if (status == 0) |
438 | amber_LED_off (ctrl, hp_slot); | 431 | amber_LED_off (ctrl, hp_slot); |
439 | } else { | 432 | else { |
440 | /* Done with exclusive hardware access */ | 433 | /* Done with exclusive hardware access */ |
441 | mutex_unlock(&ctrl->crit_sect); | 434 | mutex_unlock(&ctrl->crit_sect); |
442 | return(1); | 435 | return 1; |
443 | } | 436 | } |
444 | 437 | ||
445 | set_SOGO(ctrl); | 438 | set_SOGO(ctrl); |
@@ -450,7 +443,7 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
450 | /* Done with exclusive hardware access */ | 443 | /* Done with exclusive hardware access */ |
451 | mutex_unlock(&ctrl->crit_sect); | 444 | mutex_unlock(&ctrl->crit_sect); |
452 | 445 | ||
453 | return(0); | 446 | return 0; |
454 | } | 447 | } |
455 | 448 | ||
456 | 449 | ||
@@ -678,8 +671,7 @@ static int ctrl_slot_setup(struct controller *ctrl, | |||
678 | goto error_slot; | 671 | goto error_slot; |
679 | hotplug_slot = slot->hotplug_slot; | 672 | hotplug_slot = slot->hotplug_slot; |
680 | 673 | ||
681 | hotplug_slot->info = | 674 | hotplug_slot->info = kzalloc(sizeof(*(hotplug_slot->info)), |
682 | kzalloc(sizeof(*(hotplug_slot->info)), | ||
683 | GFP_KERNEL); | 675 | GFP_KERNEL); |
684 | if (!hotplug_slot->info) | 676 | if (!hotplug_slot->info) |
685 | goto error_hpslot; | 677 | goto error_hpslot; |
@@ -801,9 +793,8 @@ static int one_time_init(void) | |||
801 | goto error; | 793 | goto error; |
802 | 794 | ||
803 | dbg("Initialize slot lists\n"); | 795 | dbg("Initialize slot lists\n"); |
804 | for (loop = 0; loop < 256; loop++) { | 796 | for (loop = 0; loop < 256; loop++) |
805 | cpqhp_slot_list[loop] = NULL; | 797 | cpqhp_slot_list[loop] = NULL; |
806 | } | ||
807 | 798 | ||
808 | /* FIXME: We also need to hook the NMI handler eventually. | 799 | /* FIXME: We also need to hook the NMI handler eventually. |
809 | * this also needs to be worked with Christoph | 800 | * this also needs to be worked with Christoph |
@@ -1306,18 +1297,16 @@ static int cpqhpc_probe(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1306 | func->presence_save = (temp_word >> hp_slot) & 0x01; | 1297 | func->presence_save = (temp_word >> hp_slot) & 0x01; |
1307 | func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02; | 1298 | func->presence_save |= (temp_word >> (hp_slot + 7)) & 0x02; |
1308 | 1299 | ||
1309 | if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) { | 1300 | if (ctrl->ctrl_int_comp & (0x1L << hp_slot)) |
1310 | func->switch_save = 0; | 1301 | func->switch_save = 0; |
1311 | } else { | 1302 | else |
1312 | func->switch_save = 0x10; | 1303 | func->switch_save = 0x10; |
1313 | } | ||
1314 | 1304 | ||
1315 | if (!power_mode) { | 1305 | if (!power_mode) |
1316 | if (!func->is_a_board) { | 1306 | if (!func->is_a_board) { |
1317 | green_LED_off(ctrl, hp_slot); | 1307 | green_LED_off(ctrl, hp_slot); |
1318 | slot_disable(ctrl, hp_slot); | 1308 | slot_disable(ctrl, hp_slot); |
1319 | } | 1309 | } |
1320 | } | ||
1321 | 1310 | ||
1322 | device++; | 1311 | device++; |
1323 | num_of_slots--; | 1312 | num_of_slots--; |