Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: remove unused resource assignment in pci_read_bridge_bases()
PCI hotplug: shpchp: message refinement
PCI hotplug: shpchp: replace printk with dev_printk
PCI: add routines for debugging and handling lost interrupts
PCI hotplug: pciehp: message refinement
PCI: fix ARI code to be compatible with mixed ARI/non-ARI systems
PCI hotplug: cpqphp: fix kernel NULL pointer dereference

+378 -265
+2 -1
drivers/pci/Makefile
··· 3 3 # 4 4 5 5 obj-y += access.o bus.o probe.o remove.o pci.o quirks.o slot.o \ 6 - pci-driver.o search.o pci-sysfs.o rom.o setup-res.o 6 + pci-driver.o search.o pci-sysfs.o rom.o setup-res.o \ 7 + irq.o 7 8 obj-$(CONFIG_PROC_FS) += proc.o 8 9 9 10 # Build PCI Express stuff if needed
+1 -1
drivers/pci/hotplug/cpqphp_core.c
··· 433 433 slot->number, ctrl->slot_device_offset, 434 434 slot_number); 435 435 result = pci_hp_register(hotplug_slot, 436 - ctrl->pci_dev->subordinate, 436 + ctrl->pci_dev->bus, 437 437 slot->device, 438 438 name); 439 439 if (result) {
+1 -1
drivers/pci/hotplug/pciehp.h
··· 188 188 return slot; 189 189 } 190 190 191 - ctrl_err(ctrl, "%s: slot (device=0x%x) not found\n", __func__, device); 191 + ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device); 192 192 return NULL; 193 193 } 194 194
+20 -18
drivers/pci/hotplug/pciehp_core.c
··· 184 184 { 185 185 struct slot *slot = hotplug_slot->private; 186 186 187 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 187 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 188 188 __func__, hotplug_slot_name(hotplug_slot)); 189 189 190 190 kfree(hotplug_slot->info); ··· 216 216 slot->hotplug_slot = hotplug_slot; 217 217 snprintf(name, SLOT_NAME_SIZE, "%u", slot->number); 218 218 219 - ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x " 220 - "slot_device_offset=%x\n", slot->bus, slot->device, 221 - slot->hp_slot, slot->number, ctrl->slot_device_offset); 219 + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " 220 + "hp_slot=%x sun=%x slot_device_offset=%x\n", 221 + pci_domain_nr(ctrl->pci_dev->subordinate), 222 + slot->bus, slot->device, slot->hp_slot, slot->number, 223 + ctrl->slot_device_offset); 222 224 retval = pci_hp_register(hotplug_slot, 223 225 ctrl->pci_dev->subordinate, 224 226 slot->device, ··· 240 238 &hotplug_slot_attr_lock.attr); 241 239 if (retval) { 242 240 pci_hp_deregister(hotplug_slot); 243 - ctrl_err(ctrl, "cannot create additional sysfs " 241 + ctrl_err(ctrl, "Cannot create additional sysfs " 244 242 "entries\n"); 245 243 goto error_info; 246 244 } ··· 275 273 { 276 274 struct slot *slot = hotplug_slot->private; 277 275 278 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 276 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 279 277 __func__, slot_name(slot)); 280 278 281 279 hotplug_slot->info->attention_status = status; ··· 291 289 { 292 290 struct slot *slot = hotplug_slot->private; 293 291 294 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 292 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 295 293 __func__, slot_name(slot)); 296 294 297 295 return pciehp_sysfs_enable_slot(slot); ··· 302 300 { 303 301 struct slot *slot = hotplug_slot->private; 304 302 305 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 303 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 306 304 __func__, slot_name(slot)); 307 305 308 306 return pciehp_sysfs_disable_slot(slot); ··· 313 311 struct slot *slot = hotplug_slot->private; 314 312 int retval; 315 313 316 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 314 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 317 315 __func__, slot_name(slot)); 318 316 319 317 retval = slot->hpc_ops->get_power_status(slot, value); ··· 328 326 struct slot *slot = hotplug_slot->private; 329 327 int retval; 330 328 331 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 329 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 332 330 __func__, slot_name(slot)); 333 331 334 332 retval = slot->hpc_ops->get_attention_status(slot, value); ··· 343 341 struct slot *slot = hotplug_slot->private; 344 342 int retval; 345 343 346 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 344 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 347 345 __func__, slot_name(slot)); 348 346 349 347 retval = slot->hpc_ops->get_latch_status(slot, value); ··· 358 356 struct slot *slot = hotplug_slot->private; 359 357 int retval; 360 358 361 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 359 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 362 360 __func__, slot_name(slot)); 363 361 364 362 retval = slot->hpc_ops->get_adapter_status(slot, value); ··· 374 372 struct slot *slot = hotplug_slot->private; 375 373 int retval; 376 374 377 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 375 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 378 376 __func__, slot_name(slot)); 379 377 380 378 retval = slot->hpc_ops->get_max_bus_speed(slot, value); ··· 389 387 struct slot *slot = hotplug_slot->private; 390 388 int retval; 391 389 392 - ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n", 390 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 393 391 __func__, slot_name(slot)); 394 392 395 393 retval = slot->hpc_ops->get_cur_bus_speed(slot, value); ··· 416 414 417 415 ctrl = pcie_init(dev); 418 416 if (!ctrl) { 419 - dev_err(&dev->device, "controller initialization failed\n"); 417 + dev_err(&dev->device, "Controller initialization failed\n"); 420 418 goto err_out_none; 421 419 } 422 420 set_service_data(dev, ctrl); ··· 425 423 rc = init_slots(ctrl); 426 424 if (rc) { 427 425 if (rc == -EBUSY) 428 - ctrl_warn(ctrl, "slot already registered by another " 426 + ctrl_warn(ctrl, "Slot already registered by another " 429 427 "hotplug driver\n"); 430 428 else 431 - ctrl_err(ctrl, "slot initialization failed\n"); 429 + ctrl_err(ctrl, "Slot initialization failed\n"); 432 430 goto err_out_release_ctlr; 433 431 } 434 432 ··· 525 523 dbg("pcie_port_service_register = %d\n", retval); 526 524 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 527 525 if (retval) 528 - dbg("%s: Failure to register service\n", __func__); 526 + dbg("Failure to register service\n"); 529 527 return retval; 530 528 } 531 529
+32 -32
drivers/pci/hotplug/pciehp_ctrl.c
··· 61 61 struct controller *ctrl = p_slot->ctrl; 62 62 63 63 /* Attention Button Change */ 64 - ctrl_dbg(ctrl, "Attention button interrupt received.\n"); 64 + ctrl_dbg(ctrl, "Attention button interrupt received\n"); 65 65 66 66 /* 67 67 * Button pressed - See if need to TAKE ACTION!!! ··· 81 81 struct controller *ctrl = p_slot->ctrl; 82 82 83 83 /* Switch Change */ 84 - ctrl_dbg(ctrl, "Switch interrupt received.\n"); 84 + ctrl_dbg(ctrl, "Switch interrupt received\n"); 85 85 86 86 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 87 87 if (getstatus) { ··· 110 110 struct controller *ctrl = p_slot->ctrl; 111 111 112 112 /* Presence Change */ 113 - ctrl_dbg(ctrl, "Presence/Notify input change.\n"); 113 + ctrl_dbg(ctrl, "Presence/Notify input change\n"); 114 114 115 115 /* Switch is open, assume a presence change 116 116 * Save the presence state ··· 142 142 struct controller *ctrl = p_slot->ctrl; 143 143 144 144 /* power fault */ 145 - ctrl_dbg(ctrl, "Power fault interrupt received.\n"); 145 + ctrl_dbg(ctrl, "Power fault interrupt received\n"); 146 146 147 147 if ( !(p_slot->hpc_ops->query_power_fault(p_slot))) { 148 148 /* ··· 157 157 */ 158 158 ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); 159 159 event_type = INT_POWER_FAULT; 160 - ctrl_info(ctrl, "power fault bit %x set\n", 0); 160 + ctrl_info(ctrl, "Power fault bit %x set\n", 0); 161 161 } 162 162 163 163 queue_interrupt_event(p_slot, event_type); ··· 175 175 if (POWER_CTRL(ctrl)) { 176 176 if (pslot->hpc_ops->power_off_slot(pslot)) { 177 177 ctrl_err(ctrl, 178 - "%s: Issue of Slot Power Off command failed\n", 179 - __func__); 178 + "Issue of Slot Power Off command failed\n"); 180 179 return; 181 180 } 182 181 } ··· 192 193 193 194 if (ATTN_LED(ctrl)) { 194 195 if (pslot->hpc_ops->set_attention_status(pslot, 1)) { 195 - ctrl_err(ctrl, "%s: Issue of Set Attention " 196 - "Led command failed\n", __func__); 196 + ctrl_err(ctrl, 197 + "Issue of Set Attention Led command failed\n"); 197 198 return; 198 199 } 199 200 } ··· 210 211 { 211 212 int retval = 0; 212 213 struct controller *ctrl = p_slot->ctrl; 214 + struct pci_bus *parent = ctrl->pci_dev->subordinate; 213 215 214 - ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d ,%d\n", 216 + ctrl_dbg(ctrl, "%s: slot device, slot offset, hp slot = %d, %d, %d\n", 215 217 __func__, p_slot->device, ctrl->slot_device_offset, 216 218 p_slot->hp_slot); 217 219 ··· 229 229 /* Check link training status */ 230 230 retval = p_slot->hpc_ops->check_lnk_status(ctrl); 231 231 if (retval) { 232 - ctrl_err(ctrl, "%s: Failed to check link status\n", __func__); 232 + ctrl_err(ctrl, "Failed to check link status\n"); 233 233 set_slot_off(ctrl, p_slot); 234 234 return retval; 235 235 } 236 236 237 237 /* Check for a power fault */ 238 238 if (p_slot->hpc_ops->query_power_fault(p_slot)) { 239 - ctrl_dbg(ctrl, "%s: power fault detected\n", __func__); 239 + ctrl_dbg(ctrl, "Power fault detected\n"); 240 240 retval = POWER_FAILURE; 241 241 goto err_exit; 242 242 } 243 243 244 244 retval = pciehp_configure_device(p_slot); 245 245 if (retval) { 246 - ctrl_err(ctrl, "Cannot add device 0x%x:%x\n", 247 - p_slot->bus, p_slot->device); 246 + ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", 247 + pci_domain_nr(parent), p_slot->bus, p_slot->device); 248 248 goto err_exit; 249 249 } 250 250 ··· 276 276 if (retval) 277 277 return retval; 278 278 279 - ctrl_dbg(ctrl, "In %s, hp_slot = %d\n", __func__, p_slot->hp_slot); 279 + ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, p_slot->hp_slot); 280 280 281 281 if (POWER_CTRL(ctrl)) { 282 282 /* power off slot */ 283 283 retval = p_slot->hpc_ops->power_off_slot(p_slot); 284 284 if (retval) { 285 - ctrl_err(ctrl, "%s: Issue of Slot Disable command " 286 - "failed\n", __func__); 285 + ctrl_err(ctrl, 286 + "Issue of Slot Disable command failed\n"); 287 287 return retval; 288 288 } 289 289 } ··· 324 324 switch (p_slot->state) { 325 325 case POWEROFF_STATE: 326 326 mutex_unlock(&p_slot->lock); 327 - ctrl_dbg(p_slot->ctrl, "%s: disabling bus:device(%x:%x)\n", 328 - __func__, p_slot->bus, p_slot->device); 327 + ctrl_dbg(p_slot->ctrl, 328 + "Disabling domain:bus:device=%04x:%02x:%02x\n", 329 + pci_domain_nr(p_slot->ctrl->pci_dev->subordinate), 330 + p_slot->bus, p_slot->device); 329 331 pciehp_disable_slot(p_slot); 330 332 mutex_lock(&p_slot->lock); 331 333 p_slot->state = STATIC_STATE; ··· 435 433 * expires to cancel hot-add or hot-remove 436 434 */ 437 435 ctrl_info(ctrl, "Button cancel on Slot(%s)\n", slot_name(p_slot)); 438 - ctrl_dbg(ctrl, "%s: button cancel\n", __func__); 439 436 cancel_delayed_work(&p_slot->work); 440 437 if (p_slot->state == BLINKINGOFF_STATE) { 441 438 if (PWR_LED(ctrl)) ··· 538 537 539 538 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 540 539 if (rc || !getstatus) { 541 - ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", 542 - __func__, slot_name(p_slot)); 540 + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 543 541 mutex_unlock(&p_slot->ctrl->crit_sect); 544 542 return -ENODEV; 545 543 } 546 544 if (MRL_SENS(p_slot->ctrl)) { 547 545 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 548 546 if (rc || getstatus) { 549 - ctrl_info(ctrl, "%s: latch open on slot(%s)\n", 550 - __func__, slot_name(p_slot)); 547 + ctrl_info(ctrl, "Latch open on slot(%s)\n", 548 + slot_name(p_slot)); 551 549 mutex_unlock(&p_slot->ctrl->crit_sect); 552 550 return -ENODEV; 553 551 } ··· 555 555 if (POWER_CTRL(p_slot->ctrl)) { 556 556 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 557 557 if (rc || getstatus) { 558 - ctrl_info(ctrl, "%s: already enabled on slot(%s)\n", 559 - __func__, slot_name(p_slot)); 558 + ctrl_info(ctrl, "Already enabled on slot(%s)\n", 559 + slot_name(p_slot)); 560 560 mutex_unlock(&p_slot->ctrl->crit_sect); 561 561 return -EINVAL; 562 562 } ··· 591 591 if (!HP_SUPR_RM(p_slot->ctrl)) { 592 592 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 593 593 if (ret || !getstatus) { 594 - ctrl_info(ctrl, "%s: no adapter on slot(%s)\n", 595 - __func__, slot_name(p_slot)); 594 + ctrl_info(ctrl, "No adapter on slot(%s)\n", 595 + slot_name(p_slot)); 596 596 mutex_unlock(&p_slot->ctrl->crit_sect); 597 597 return -ENODEV; 598 598 } ··· 601 601 if (MRL_SENS(p_slot->ctrl)) { 602 602 ret = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 603 603 if (ret || getstatus) { 604 - ctrl_info(ctrl, "%s: latch open on slot(%s)\n", 605 - __func__, slot_name(p_slot)); 604 + ctrl_info(ctrl, "Latch open on slot(%s)\n", 605 + slot_name(p_slot)); 606 606 mutex_unlock(&p_slot->ctrl->crit_sect); 607 607 return -ENODEV; 608 608 } ··· 611 611 if (POWER_CTRL(p_slot->ctrl)) { 612 612 ret = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 613 613 if (ret || !getstatus) { 614 - ctrl_info(ctrl, "%s: already disabled slot(%s)\n", 615 - __func__, slot_name(p_slot)); 614 + ctrl_info(ctrl, "Already disabled on slot(%s)\n", 615 + slot_name(p_slot)); 616 616 mutex_unlock(&p_slot->ctrl->crit_sect); 617 617 return -EINVAL; 618 618 }
+17 -26
drivers/pci/hotplug/pciehp_hpc.c
··· 316 316 * proceed forward to issue the next command according 317 317 * to spec. Just print out the error message. 318 318 */ 319 - ctrl_dbg(ctrl, 320 - "%s: CMD_COMPLETED not clear after 1 sec.\n", 321 - __func__); 319 + ctrl_dbg(ctrl, "CMD_COMPLETED not clear after 1 sec\n"); 322 320 } else if (!NO_CMD_CMPL(ctrl)) { 323 321 /* 324 322 * This controller semms to notify of command completed 325 323 * event even though it supports none of power 326 324 * controller, attention led, power led and EMI. 327 325 */ 328 - ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Need to " 329 - "wait for command completed event.\n", 330 - __func__); 326 + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Need to " 327 + "wait for command completed event.\n"); 331 328 ctrl->no_cmd_complete = 0; 332 329 } else { 333 - ctrl_dbg(ctrl, "%s: Unexpected CMD_COMPLETED. Maybe " 334 - "the controller is broken.\n", __func__); 330 + ctrl_dbg(ctrl, "Unexpected CMD_COMPLETED. Maybe " 331 + "the controller is broken.\n"); 335 332 } 336 333 } 337 334 ··· 344 347 smp_mb(); 345 348 retval = pciehp_writew(ctrl, SLOTCTRL, slot_ctrl); 346 349 if (retval) 347 - ctrl_err(ctrl, "%s: Cannot write to SLOTCTRL register\n", 348 - __func__); 350 + ctrl_err(ctrl, "Cannot write to SLOTCTRL register\n"); 349 351 350 352 /* 351 353 * Wait for command completion. ··· 414 418 415 419 retval = pciehp_readw(ctrl, LNKSTATUS, &lnk_status); 416 420 if (retval) { 417 - ctrl_err(ctrl, "%s: Cannot read LNKSTATUS register\n", 418 - __func__); 421 + ctrl_err(ctrl, "Cannot read LNKSTATUS register\n"); 419 422 return retval; 420 423 } 421 424 422 425 ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status); 423 426 if ( (lnk_status & LNK_TRN) || (lnk_status & LNK_TRN_ERR) || 424 427 !(lnk_status & NEG_LINK_WD)) { 425 - ctrl_err(ctrl, "%s : Link Training Error occurs \n", __func__); 428 + ctrl_err(ctrl, "Link Training Error occurs \n"); 426 429 retval = -1; 427 430 return retval; 428 431 } ··· 546 551 547 552 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 548 553 if (retval) { 549 - ctrl_err(ctrl, "%s: Cannot check for power fault\n", __func__); 554 + ctrl_err(ctrl, "Cannot check for power fault\n"); 550 555 return retval; 551 556 } 552 557 pwr_fault = (u8)((slot_status & PWR_FAULT_DETECTED) >> 1); ··· 562 567 563 568 retval = pciehp_readw(ctrl, SLOTSTATUS, &slot_status); 564 569 if (retval) { 565 - ctrl_err(ctrl, "%s : Cannot check EMI status\n", __func__); 570 + ctrl_err(ctrl, "Cannot check EMI status\n"); 566 571 return retval; 567 572 } 568 573 *status = (slot_status & EMI_STATE) >> EMI_STATUS_BIT; ··· 692 697 retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); 693 698 694 699 if (retval) { 695 - ctrl_err(ctrl, "%s: Write %x command failed!\n", 696 - __func__, slot_cmd); 700 + ctrl_err(ctrl, "Write %x command failed!\n", slot_cmd); 697 701 return -1; 698 702 } 699 703 ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", ··· 770 776 771 777 retval = pcie_write_cmd(ctrl, slot_cmd, cmd_mask); 772 778 if (retval) { 773 - ctrl_err(ctrl, "%s: Write command failed!\n", __func__); 779 + ctrl_err(ctrl, "Write command failed!\n"); 774 780 retval = -1; 775 781 goto out; 776 782 } ··· 1050 1056 PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; 1051 1057 1052 1058 if (pcie_write_cmd(ctrl, cmd, mask)) { 1053 - ctrl_err(ctrl, "%s: Cannot enable software notification\n", 1054 - __func__); 1059 + ctrl_err(ctrl, "Cannot enable software notification\n"); 1055 1060 return -1; 1056 1061 } 1057 1062 return 0; ··· 1062 1069 mask = PRSN_DETECT_ENABLE | ATTN_BUTTN_ENABLE | MRL_DETECT_ENABLE | 1063 1070 PWR_FAULT_DETECT_ENABLE | HP_INTR_ENABLE | CMD_CMPL_INTR_ENABLE; 1064 1071 if (pcie_write_cmd(ctrl, 0, mask)) 1065 - ctrl_warn(ctrl, "%s: Cannot disable software notification\n", 1066 - __func__); 1072 + ctrl_warn(ctrl, "Cannot disable software notification\n"); 1067 1073 } 1068 1074 1069 1075 static int pcie_init_notification(struct controller *ctrl) ··· 1171 1179 1172 1180 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 1173 1181 if (!ctrl) { 1174 - dev_err(&dev->device, "%s : out of memory\n", __func__); 1182 + dev_err(&dev->device, "%s: Out of memory\n", __func__); 1175 1183 goto abort; 1176 1184 } 1177 1185 INIT_LIST_HEAD(&ctrl->slot_list); ··· 1180 1188 ctrl->pci_dev = pdev; 1181 1189 ctrl->cap_base = pci_find_capability(pdev, PCI_CAP_ID_EXP); 1182 1190 if (!ctrl->cap_base) { 1183 - ctrl_err(ctrl, "%s: Cannot find PCI Express capability\n", 1184 - __func__); 1191 + ctrl_err(ctrl, "Cannot find PCI Express capability\n"); 1185 1192 goto abort_ctrl; 1186 1193 } 1187 1194 if (pciehp_readl(ctrl, SLOTCAP, &slot_cap)) { 1188 - ctrl_err(ctrl, "%s: Cannot read SLOTCAP register\n", __func__); 1195 + ctrl_err(ctrl, "Cannot read SLOTCAP register\n"); 1189 1196 goto abort_ctrl; 1190 1197 } 1191 1198
+8 -11
drivers/pci/hotplug/pciehp_pci.c
··· 39 39 u16 pci_cmd, pci_bctl; 40 40 41 41 if (hpp->revision > 1) { 42 - printk(KERN_WARNING "%s: Rev.%d type0 record not supported\n", 43 - __func__, hpp->revision); 42 + warn("Rev.%d type0 record not supported\n", hpp->revision); 44 43 return; 45 44 } 46 45 ··· 80 81 u32 reg32; 81 82 82 83 if (hpp->revision > 1) { 83 - printk(KERN_WARNING "%s: Rev.%d type2 record not supported\n", 84 - __func__, hpp->revision); 84 + warn("Rev.%d type2 record not supported\n", hpp->revision); 85 85 return; 86 86 } 87 87 ··· 147 149 return; 148 150 149 151 if (pciehp_get_hp_params_from_firmware(dev, &hpp)) { 150 - printk(KERN_WARNING "%s: Could not get hotplug parameters\n", 151 - __func__); 152 + warn("Could not get hotplug parameters\n"); 152 153 return; 153 154 } 154 155 ··· 199 202 200 203 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 201 204 if (dev) { 202 - ctrl_err(ctrl, 203 - "Device %s already exists at %x:%x, cannot hot-add\n", 204 - pci_name(dev), p_slot->bus, p_slot->device); 205 + ctrl_err(ctrl, "Device %s already exists " 206 + "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 207 + pci_domain_nr(parent), p_slot->bus, p_slot->device); 205 208 pci_dev_put(dev); 206 209 return -EINVAL; 207 210 } ··· 245 248 u16 command; 246 249 struct controller *ctrl = p_slot->ctrl; 247 250 248 - ctrl_dbg(ctrl, "%s: bus/dev = %x/%x\n", __func__, 249 - p_slot->bus, p_slot->device); 251 + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", 252 + __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); 250 253 ret = p_slot->hpc_ops->get_adapter_status(p_slot, &presence); 251 254 if (ret) 252 255 presence = 0;
+19 -3
drivers/pci/hotplug/shpchp.h
··· 59 59 #define warn(format, arg...) \ 60 60 printk(KERN_WARNING "%s: " format, MY_NAME , ## arg) 61 61 62 + #define ctrl_dbg(ctrl, format, arg...) \ 63 + do { \ 64 + if (shpchp_debug) \ 65 + dev_printk(, &ctrl->pci_dev->dev, \ 66 + format, ## arg); \ 67 + } while (0) 68 + #define ctrl_err(ctrl, format, arg...) \ 69 + dev_err(&ctrl->pci_dev->dev, format, ## arg) 70 + #define ctrl_info(ctrl, format, arg...) \ 71 + dev_info(&ctrl->pci_dev->dev, format, ## arg) 72 + #define ctrl_warn(ctrl, format, arg...) \ 73 + dev_warn(&ctrl->pci_dev->dev, format, ## arg) 74 + 75 + 62 76 #define SLOT_NAME_SIZE 10 63 77 struct slot { 64 78 u8 bus; ··· 253 239 return slot; 254 240 } 255 241 256 - err("%s: slot (device=0x%x) not found\n", __func__, device); 242 + ctrl_err(ctrl, "Slot (device=0x%02x) not found\n", device); 257 243 return NULL; 258 244 } 259 245 ··· 287 273 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, &pcix_bridge_errors_reg); 288 274 perr_set = pcix_bridge_errors_reg & PERR_OBSERVED_MASK; 289 275 if (perr_set) { 290 - dbg ("%s W1C: Bridge_Errors[ PERR_OBSERVED = %08X]\n",__func__ , perr_set); 276 + ctrl_dbg(p_slot->ctrl, 277 + "Bridge_Errors[ PERR_OBSERVED = %08X] (W1C)\n", 278 + perr_set); 291 279 292 280 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MISC_BRIDGE_ERRORS_OFFSET, perr_set); 293 281 } ··· 298 282 pci_read_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, &pcix_mem_base_reg); 299 283 rse_set = pcix_mem_base_reg & RSE_MASK; 300 284 if (rse_set) { 301 - dbg ("%s W1C: Memory_Base_Limit[ RSE ]\n",__func__ ); 285 + ctrl_dbg(p_slot->ctrl, "Memory_Base_Limit[ RSE ] (W1C)\n"); 302 286 303 287 pci_write_config_dword(p_slot->ctrl->pci_dev, PCIX_MEM_BASE_LIMIT_OFFSET, rse_set); 304 288 }
+30 -18
drivers/pci/hotplug/shpchp_core.c
··· 89 89 { 90 90 struct slot *slot = hotplug_slot->private; 91 91 92 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 92 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 93 + __func__, slot_name(slot)); 93 94 94 95 kfree(slot->hotplug_slot->info); 95 96 kfree(slot->hotplug_slot); ··· 136 135 snprintf(name, SLOT_NAME_SIZE, "%d", slot->number); 137 136 hotplug_slot->ops = &shpchp_hotplug_slot_ops; 138 137 139 - dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " 140 - "slot_device_offset=%x\n", slot->bus, slot->device, 141 - slot->hp_slot, slot->number, ctrl->slot_device_offset); 138 + ctrl_dbg(ctrl, "Registering domain:bus:dev=%04x:%02x:%02x " 139 + "hp_slot=%x sun=%x slot_device_offset=%x\n", 140 + pci_domain_nr(ctrl->pci_dev->subordinate), 141 + slot->bus, slot->device, slot->hp_slot, slot->number, 142 + ctrl->slot_device_offset); 142 143 retval = pci_hp_register(slot->hotplug_slot, 143 144 ctrl->pci_dev->subordinate, slot->device, name); 144 145 if (retval) { 145 - err("pci_hp_register failed with error %d\n", retval); 146 + ctrl_err(ctrl, "pci_hp_register failed with error %d\n", 147 + retval); 146 148 goto error_info; 147 149 } 148 150 ··· 191 187 { 192 188 struct slot *slot = get_slot(hotplug_slot); 193 189 194 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 190 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 191 + __func__, slot_name(slot)); 195 192 196 193 hotplug_slot->info->attention_status = status; 197 194 slot->hpc_ops->set_attention_status(slot, status); ··· 204 199 { 205 200 struct slot *slot = get_slot(hotplug_slot); 206 201 207 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 202 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 203 + __func__, slot_name(slot)); 208 204 209 205 return shpchp_sysfs_enable_slot(slot); 210 206 } ··· 214 208 { 215 209 struct slot *slot = get_slot(hotplug_slot); 216 210 217 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 211 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 212 + __func__, slot_name(slot)); 218 213 219 214 return shpchp_sysfs_disable_slot(slot); 220 215 } ··· 225 218 struct slot *slot = get_slot(hotplug_slot); 226 219 int retval; 227 220 228 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 221 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 222 + __func__, slot_name(slot)); 229 223 230 224 retval = slot->hpc_ops->get_power_status(slot, value); 231 225 if (retval < 0) ··· 240 232 struct slot *slot = get_slot(hotplug_slot); 241 233 int retval; 242 234 243 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 235 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 236 + __func__, slot_name(slot)); 244 237 245 238 retval = slot->hpc_ops->get_attention_status(slot, value); 246 239 if (retval < 0) ··· 255 246 struct slot *slot = get_slot(hotplug_slot); 256 247 int retval; 257 248 258 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 249 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 250 + __func__, slot_name(slot)); 259 251 260 252 retval = slot->hpc_ops->get_latch_status(slot, value); 261 253 if (retval < 0) ··· 270 260 struct slot *slot = get_slot(hotplug_slot); 271 261 int retval; 272 262 273 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 263 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 264 + __func__, slot_name(slot)); 274 265 275 266 retval = slot->hpc_ops->get_adapter_status(slot, value); 276 267 if (retval < 0) ··· 286 275 struct slot *slot = get_slot(hotplug_slot); 287 276 int retval; 288 277 289 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 278 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 279 + __func__, slot_name(slot)); 290 280 291 281 retval = slot->hpc_ops->get_max_bus_speed(slot, value); 292 282 if (retval < 0) ··· 301 289 struct slot *slot = get_slot(hotplug_slot); 302 290 int retval; 303 291 304 - dbg("%s - physical_slot = %s\n", __func__, slot_name(slot)); 292 + ctrl_dbg(slot->ctrl, "%s: physical_slot = %s\n", 293 + __func__, slot_name(slot)); 305 294 306 295 retval = slot->hpc_ops->get_cur_bus_speed(slot, value); 307 296 if (retval < 0) ··· 333 320 334 321 ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL); 335 322 if (!ctrl) { 336 - err("%s : out of memory\n", __func__); 323 + dev_err(&pdev->dev, "%s: Out of memory\n", __func__); 337 324 goto err_out_none; 338 325 } 339 326 INIT_LIST_HEAD(&ctrl->slot_list); 340 327 341 328 rc = shpc_init(ctrl, pdev); 342 329 if (rc) { 343 - dbg("%s: controller initialization failed\n", 344 - SHPC_MODULE_NAME); 330 + ctrl_dbg(ctrl, "Controller initialization failed\n"); 345 331 goto err_out_free_ctrl; 346 332 } 347 333 ··· 349 337 /* Setup the slot information structures */ 350 338 rc = init_slots(ctrl); 351 339 if (rc) { 352 - err("%s: slot initialization failed\n", SHPC_MODULE_NAME); 340 + ctrl_err(ctrl, "Slot initialization failed\n"); 353 341 goto err_out_release_ctlr; 354 342 } 355 343
+89 -69
drivers/pci/hotplug/shpchp_ctrl.c
··· 62 62 u32 event_type; 63 63 64 64 /* Attention Button Change */ 65 - dbg("shpchp: Attention button interrupt received.\n"); 65 + ctrl_dbg(ctrl, "Attention button interrupt received\n"); 66 66 67 67 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 68 68 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); ··· 70 70 /* 71 71 * Button pressed - See if need to TAKE ACTION!!! 72 72 */ 73 - info("Button pressed on Slot(%s)\n", slot_name(p_slot)); 73 + ctrl_info(ctrl, "Button pressed on Slot(%s)\n", slot_name(p_slot)); 74 74 event_type = INT_BUTTON_PRESS; 75 75 76 76 queue_interrupt_event(p_slot, event_type); ··· 86 86 u32 event_type; 87 87 88 88 /* Switch Change */ 89 - dbg("shpchp: Switch interrupt received.\n"); 89 + ctrl_dbg(ctrl, "Switch interrupt received\n"); 90 90 91 91 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 92 92 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 93 93 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 94 - dbg("%s: Card present %x Power status %x\n", __func__, 95 - p_slot->presence_save, p_slot->pwr_save); 94 + ctrl_dbg(ctrl, "Card present %x Power status %x\n", 95 + p_slot->presence_save, p_slot->pwr_save); 96 96 97 97 if (getstatus) { 98 98 /* 99 99 * Switch opened 100 100 */ 101 - info("Latch open on Slot(%s)\n", slot_name(p_slot)); 101 + ctrl_info(ctrl, "Latch open on Slot(%s)\n", slot_name(p_slot)); 102 102 event_type = INT_SWITCH_OPEN; 103 103 if (p_slot->pwr_save && p_slot->presence_save) { 104 104 event_type = INT_POWER_FAULT; 105 - err("Surprise Removal of card\n"); 105 + ctrl_err(ctrl, "Surprise Removal of card\n"); 106 106 } 107 107 } else { 108 108 /* 109 109 * Switch closed 110 110 */ 111 - info("Latch close on Slot(%s)\n", slot_name(p_slot)); 111 + ctrl_info(ctrl, "Latch close on Slot(%s)\n", slot_name(p_slot)); 112 112 event_type = INT_SWITCH_CLOSE; 113 113 } 114 114 ··· 123 123 u32 event_type; 124 124 125 125 /* Presence Change */ 126 - dbg("shpchp: Presence/Notify input change.\n"); 126 + ctrl_dbg(ctrl, "Presence/Notify input change\n"); 127 127 128 128 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 129 129 ··· 135 135 /* 136 136 * Card Present 137 137 */ 138 - info("Card present on Slot(%s)\n", slot_name(p_slot)); 138 + ctrl_info(ctrl, "Card present on Slot(%s)\n", 139 + slot_name(p_slot)); 139 140 event_type = INT_PRESENCE_ON; 140 141 } else { 141 142 /* 142 143 * Not Present 143 144 */ 144 - info("Card not present on Slot(%s)\n", slot_name(p_slot)); 145 + ctrl_info(ctrl, "Card not present on Slot(%s)\n", 146 + slot_name(p_slot)); 145 147 event_type = INT_PRESENCE_OFF; 146 148 } 147 149 ··· 158 156 u32 event_type; 159 157 160 158 /* Power fault */ 161 - dbg("shpchp: Power fault interrupt received.\n"); 159 + ctrl_dbg(ctrl, "Power fault interrupt received\n"); 162 160 163 161 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 164 162 ··· 166 164 /* 167 165 * Power fault Cleared 168 166 */ 169 - info("Power fault cleared on Slot(%s)\n", slot_name(p_slot)); 167 + ctrl_info(ctrl, "Power fault cleared on Slot(%s)\n", 168 + slot_name(p_slot)); 170 169 p_slot->status = 0x00; 171 170 event_type = INT_POWER_FAULT_CLEAR; 172 171 } else { 173 172 /* 174 173 * Power fault 175 174 */ 176 - info("Power fault on Slot(%s)\n", slot_name(p_slot)); 175 + ctrl_info(ctrl, "Power fault on Slot(%s)\n", slot_name(p_slot)); 177 176 event_type = INT_POWER_FAULT; 178 177 /* set power fault status for this board */ 179 178 p_slot->status = 0xFF; 180 - info("power fault bit %x set\n", hp_slot); 179 + ctrl_info(ctrl, "Power fault bit %x set\n", hp_slot); 181 180 } 182 181 183 182 queue_interrupt_event(p_slot, event_type); ··· 194 191 { 195 192 int rc = 0; 196 193 197 - dbg("%s: change to speed %d\n", __func__, speed); 194 + ctrl_dbg(ctrl, "Change speed to %d\n", speed); 198 195 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, speed))) { 199 - err("%s: Issue of set bus speed mode command failed\n", 200 - __func__); 196 + ctrl_err(ctrl, "%s: Issue of set bus speed mode command " 197 + "failed\n", __func__); 201 198 return WRONG_BUS_FREQUENCY; 202 199 } 203 200 return rc; ··· 215 212 */ 216 213 if (flag) { 217 214 if (asp < bsp) { 218 - err("%s: speed of bus %x and adapter %x mismatch\n", 219 - __func__, bsp, asp); 215 + ctrl_err(ctrl, "Speed of bus %x and adapter %x " 216 + "mismatch\n", bsp, asp); 220 217 rc = WRONG_BUS_FREQUENCY; 221 218 } 222 219 return rc; ··· 246 243 int rc = 0; 247 244 enum pci_bus_speed asp, bsp, msp; 248 245 struct controller *ctrl = p_slot->ctrl; 246 + struct pci_bus *parent = ctrl->pci_dev->subordinate; 249 247 250 248 hp_slot = p_slot->device - ctrl->slot_device_offset; 251 249 252 - dbg("%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 253 - __func__, p_slot->device, 254 - ctrl->slot_device_offset, hp_slot); 250 + ctrl_dbg(ctrl, 251 + "%s: p_slot->device, slot_offset, hp_slot = %d, %d ,%d\n", 252 + __func__, p_slot->device, ctrl->slot_device_offset, hp_slot); 255 253 256 254 /* Power on slot without connecting to bus */ 257 255 rc = p_slot->hpc_ops->power_on_slot(p_slot); 258 256 if (rc) { 259 - err("%s: Failed to power on slot\n", __func__); 257 + ctrl_err(ctrl, "Failed to power on slot\n"); 260 258 return -1; 261 259 } 262 260 ··· 266 262 return WRONG_BUS_FREQUENCY; 267 263 268 264 if ((rc = p_slot->hpc_ops->set_bus_speed_mode(p_slot, PCI_SPEED_33MHz))) { 269 - err("%s: Issue of set bus speed mode command failed\n", __func__); 265 + ctrl_err(ctrl, "%s: Issue of set bus speed mode command" 266 + " failed\n", __func__); 270 267 return WRONG_BUS_FREQUENCY; 271 268 } 272 269 273 270 /* turn on board, blink green LED, turn off Amber LED */ 274 271 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 275 - err("%s: Issue of Slot Enable command failed\n", __func__); 272 + ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); 276 273 return rc; 277 274 } 278 275 } 279 276 280 277 rc = p_slot->hpc_ops->get_adapter_speed(p_slot, &asp); 281 278 if (rc) { 282 - err("%s: Can't get adapter speed or bus mode mismatch\n", 283 - __func__); 279 + ctrl_err(ctrl, "Can't get adapter speed or " 280 + "bus mode mismatch\n"); 284 281 return WRONG_BUS_FREQUENCY; 285 282 } 286 283 287 284 rc = p_slot->hpc_ops->get_cur_bus_speed(p_slot, &bsp); 288 285 if (rc) { 289 - err("%s: Can't get bus operation speed\n", __func__); 286 + ctrl_err(ctrl, "Can't get bus operation speed\n"); 290 287 return WRONG_BUS_FREQUENCY; 291 288 } 292 289 293 290 rc = p_slot->hpc_ops->get_max_bus_speed(p_slot, &msp); 294 291 if (rc) { 295 - err("%s: Can't get max bus operation speed\n", __func__); 292 + ctrl_err(ctrl, "Can't get max bus operation speed\n"); 296 293 msp = bsp; 297 294 } 298 295 ··· 301 296 if (!list_empty(&ctrl->pci_dev->subordinate->devices)) 302 297 slots_not_empty = 1; 303 298 304 - dbg("%s: slots_not_empty %d, adapter_speed %d, bus_speed %d, " 305 - "max_bus_speed %d\n", __func__, slots_not_empty, asp, 306 - bsp, msp); 299 + ctrl_dbg(ctrl, "%s: slots_not_empty %d, adapter_speed %d, bus_speed %d," 300 + " max_bus_speed %d\n", __func__, slots_not_empty, asp, 301 + bsp, msp); 307 302 308 303 rc = fix_bus_speed(ctrl, p_slot, slots_not_empty, asp, bsp, msp); 309 304 if (rc) ··· 311 306 312 307 /* turn on board, blink green LED, turn off Amber LED */ 313 308 if ((rc = p_slot->hpc_ops->slot_enable(p_slot))) { 314 - err("%s: Issue of Slot Enable command failed\n", __func__); 309 + ctrl_err(ctrl, "Issue of Slot Enable command failed\n"); 315 310 return rc; 316 311 } 317 312 318 313 /* Wait for ~1 second */ 319 314 msleep(1000); 320 315 321 - dbg("%s: slot status = %x\n", __func__, p_slot->status); 316 + ctrl_dbg(ctrl, "%s: slot status = %x\n", __func__, p_slot->status); 322 317 /* Check for a power fault */ 323 318 if (p_slot->status == 0xFF) { 324 319 /* power fault occurred, but it was benign */ 325 - dbg("%s: power fault\n", __func__); 320 + ctrl_dbg(ctrl, "%s: Power fault\n", __func__); 326 321 rc = POWER_FAILURE; 327 322 p_slot->status = 0; 328 323 goto err_exit; 329 324 } 330 325 331 326 if (shpchp_configure_device(p_slot)) { 332 - err("Cannot add device at 0x%x:0x%x\n", p_slot->bus, 333 - p_slot->device); 327 + ctrl_err(ctrl, "Cannot add device at %04x:%02x:%02x\n", 328 + pci_domain_nr(parent), p_slot->bus, p_slot->device); 334 329 goto err_exit; 335 330 } 336 331 ··· 346 341 /* turn off slot, turn on Amber LED, turn off Green LED */ 347 342 rc = p_slot->hpc_ops->slot_disable(p_slot); 348 343 if (rc) { 349 - err("%s: Issue of Slot Disable command failed\n", __func__); 344 + ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n", 345 + __func__); 350 346 return rc; 351 347 } 352 348 ··· 371 365 hp_slot = p_slot->device - ctrl->slot_device_offset; 372 366 p_slot = shpchp_find_slot(ctrl, hp_slot + ctrl->slot_device_offset); 373 367 374 - dbg("In %s, hp_slot = %d\n", __func__, hp_slot); 368 + ctrl_dbg(ctrl, "%s: hp_slot = %d\n", __func__, hp_slot); 375 369 376 370 /* Change status to shutdown */ 377 371 if (p_slot->is_a_board) ··· 380 374 /* turn off slot, turn on Amber LED, turn off Green LED */ 381 375 rc = p_slot->hpc_ops->slot_disable(p_slot); 382 376 if (rc) { 383 - err("%s: Issue of Slot Disable command failed\n", __func__); 377 + ctrl_err(ctrl, "%s: Issue of Slot Disable command failed\n", 378 + __func__); 384 379 return rc; 385 380 } 386 381 387 382 rc = p_slot->hpc_ops->set_attention_status(p_slot, 0); 388 383 if (rc) { 389 - err("%s: Issue of Set Attention command failed\n", __func__); 384 + ctrl_err(ctrl, "Issue of Set Attention command failed\n"); 390 385 return rc; 391 386 } 392 387 ··· 446 439 447 440 info = kmalloc(sizeof(*info), GFP_KERNEL); 448 441 if (!info) { 449 - err("%s: Cannot allocate memory\n", __func__); 442 + ctrl_err(p_slot->ctrl, "%s: Cannot allocate memory\n", 443 + __func__); 450 444 return; 451 445 } 452 446 info->p_slot = p_slot; ··· 494 486 static void handle_button_press_event(struct slot *p_slot) 495 487 { 496 488 u8 getstatus; 489 + struct controller *ctrl = p_slot->ctrl; 497 490 498 491 switch (p_slot->state) { 499 492 case STATIC_STATE: 500 493 p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 501 494 if (getstatus) { 502 495 p_slot->state = BLINKINGOFF_STATE; 503 - info("PCI slot #%s - powering off due to button " 504 - "press.\n", slot_name(p_slot)); 496 + ctrl_info(ctrl, "PCI slot #%s - powering off due to " 497 + "button press.\n", slot_name(p_slot)); 505 498 } else { 506 499 p_slot->state = BLINKINGON_STATE; 507 - info("PCI slot #%s - powering on due to button " 508 - "press.\n", slot_name(p_slot)); 500 + ctrl_info(ctrl, "PCI slot #%s - powering on due to " 501 + "button press.\n", slot_name(p_slot)); 509 502 } 510 503 /* blink green LED and turn off amber */ 511 504 p_slot->hpc_ops->green_led_blink(p_slot); ··· 521 512 * press the attention again before the 5 sec. limit 522 513 * expires to cancel hot-add or hot-remove 523 514 */ 524 - info("Button cancel on Slot(%s)\n", slot_name(p_slot)); 525 - dbg("%s: button cancel\n", __func__); 515 + ctrl_info(ctrl, "Button cancel on Slot(%s)\n", 516 + slot_name(p_slot)); 526 517 cancel_delayed_work(&p_slot->work); 527 518 if (p_slot->state == BLINKINGOFF_STATE) 528 519 p_slot->hpc_ops->green_led_on(p_slot); 529 520 else 530 521 p_slot->hpc_ops->green_led_off(p_slot); 531 522 p_slot->hpc_ops->set_attention_status(p_slot, 0); 532 - info("PCI slot #%s - action canceled due to button press\n", 533 - slot_name(p_slot)); 523 + ctrl_info(ctrl, "PCI slot #%s - action canceled due to " 524 + "button press\n", slot_name(p_slot)); 534 525 p_slot->state = STATIC_STATE; 535 526 break; 536 527 case POWEROFF_STATE: ··· 540 531 * this means that the previous attention button action 541 532 * to hot-add or hot-remove is undergoing 542 533 */ 543 - info("Button ignore on Slot(%s)\n", slot_name(p_slot)); 534 + ctrl_info(ctrl, "Button ignore on Slot(%s)\n", 535 + slot_name(p_slot)); 544 536 update_slot_info(p_slot); 545 537 break; 546 538 default: 547 - warn("Not a valid state\n"); 539 + ctrl_warn(ctrl, "Not a valid state\n"); 548 540 break; 549 541 } 550 542 } ··· 561 551 handle_button_press_event(p_slot); 562 552 break; 563 553 case INT_POWER_FAULT: 564 - dbg("%s: power fault\n", __func__); 554 + ctrl_dbg(p_slot->ctrl, "%s: Power fault\n", __func__); 565 555 p_slot->hpc_ops->set_attention_status(p_slot, 1); 566 556 p_slot->hpc_ops->green_led_off(p_slot); 567 557 break; ··· 579 569 { 580 570 u8 getstatus = 0; 581 571 int rc, retval = -ENODEV; 572 + struct controller *ctrl = p_slot->ctrl; 582 573 583 574 /* Check to see if (latch closed, card present, power off) */ 584 575 mutex_lock(&p_slot->ctrl->crit_sect); 585 576 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 586 577 if (rc || !getstatus) { 587 - info("No adapter on slot(%s)\n", slot_name(p_slot)); 578 + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 588 579 goto out; 589 580 } 590 581 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 591 582 if (rc || getstatus) { 592 - info("Latch open on slot(%s)\n", slot_name(p_slot)); 583 + ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); 593 584 goto out; 594 585 } 595 586 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 596 587 if (rc || getstatus) { 597 - info("Already enabled on slot(%s)\n", slot_name(p_slot)); 588 + ctrl_info(ctrl, "Already enabled on slot(%s)\n", 589 + slot_name(p_slot)); 598 590 goto out; 599 591 } 600 592 ··· 605 593 /* We have to save the presence info for these slots */ 606 594 p_slot->hpc_ops->get_adapter_status(p_slot, &(p_slot->presence_save)); 607 595 p_slot->hpc_ops->get_power_status(p_slot, &(p_slot->pwr_save)); 608 - dbg("%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); 596 + ctrl_dbg(ctrl, "%s: p_slot->pwr_save %x\n", __func__, p_slot->pwr_save); 609 597 p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 610 598 611 599 if(((p_slot->ctrl->pci_dev->vendor == PCI_VENDOR_ID_AMD) || ··· 636 624 { 637 625 u8 getstatus = 0; 638 626 int rc, retval = -ENODEV; 627 + struct controller *ctrl = p_slot->ctrl; 639 628 640 629 if (!p_slot->ctrl) 641 630 return -ENODEV; ··· 646 633 647 634 rc = p_slot->hpc_ops->get_adapter_status(p_slot, &getstatus); 648 635 if (rc || !getstatus) { 649 - info("No adapter on slot(%s)\n", slot_name(p_slot)); 636 + ctrl_info(ctrl, "No adapter on slot(%s)\n", slot_name(p_slot)); 650 637 goto out; 651 638 } 652 639 rc = p_slot->hpc_ops->get_latch_status(p_slot, &getstatus); 653 640 if (rc || getstatus) { 654 - info("Latch open on slot(%s)\n", slot_name(p_slot)); 641 + ctrl_info(ctrl, "Latch open on slot(%s)\n", slot_name(p_slot)); 655 642 goto out; 656 643 } 657 644 rc = p_slot->hpc_ops->get_power_status(p_slot, &getstatus); 658 645 if (rc || !getstatus) { 659 - info("Already disabled slot(%s)\n", slot_name(p_slot)); 646 + ctrl_info(ctrl, "Already disabled on slot(%s)\n", 647 + slot_name(p_slot)); 660 648 goto out; 661 649 } 662 650 ··· 671 657 int shpchp_sysfs_enable_slot(struct slot *p_slot) 672 658 { 673 659 int retval = -ENODEV; 660 + struct controller *ctrl = p_slot->ctrl; 674 661 675 662 mutex_lock(&p_slot->lock); 676 663 switch (p_slot->state) { ··· 685 670 p_slot->state = STATIC_STATE; 686 671 break; 687 672 case POWERON_STATE: 688 - info("Slot %s is already in powering on state\n", 689 - slot_name(p_slot)); 673 + ctrl_info(ctrl, "Slot %s is already in powering on state\n", 674 + slot_name(p_slot)); 690 675 break; 691 676 case BLINKINGOFF_STATE: 692 677 case POWEROFF_STATE: 693 - info("Already enabled on slot %s\n", slot_name(p_slot)); 678 + ctrl_info(ctrl, "Already enabled on slot %s\n", 679 + slot_name(p_slot)); 694 680 break; 695 681 default: 696 - err("Not a valid state on slot %s\n", slot_name(p_slot)); 682 + ctrl_err(ctrl, "Not a valid state on slot %s\n", 683 + slot_name(p_slot)); 697 684 break; 698 685 } 699 686 mutex_unlock(&p_slot->lock); ··· 706 689 int shpchp_sysfs_disable_slot(struct slot *p_slot) 707 690 { 708 691 int retval = -ENODEV; 692 + struct controller *ctrl = p_slot->ctrl; 709 693 710 694 mutex_lock(&p_slot->lock); 711 695 switch (p_slot->state) { ··· 720 702 p_slot->state = STATIC_STATE; 721 703 break; 722 704 case POWEROFF_STATE: 723 - info("Slot %s is already in powering off state\n", 724 - slot_name(p_slot)); 705 + ctrl_info(ctrl, "Slot %s is already in powering off state\n", 706 + slot_name(p_slot)); 725 707 break; 726 708 case BLINKINGON_STATE: 727 709 case POWERON_STATE: 728 - info("Already disabled on slot %s\n", slot_name(p_slot)); 710 + ctrl_info(ctrl, "Already disabled on slot %s\n", 711 + slot_name(p_slot)); 729 712 break; 730 713 default: 731 - err("Not a valid state on slot %s\n", slot_name(p_slot)); 714 + ctrl_err(ctrl, "Not a valid state on slot %s\n", 715 + slot_name(p_slot)); 732 716 break; 733 717 } 734 718 mutex_unlock(&p_slot->lock);
+57 -56
drivers/pci/hotplug/shpchp_hpc.c
··· 300 300 !is_ctrl_busy(ctrl), timeout); 301 301 if (!rc && is_ctrl_busy(ctrl)) { 302 302 retval = -EIO; 303 - err("Command not completed in 1000 msec\n"); 303 + ctrl_err(ctrl, "Command not completed in 1000 msec\n"); 304 304 } else if (rc < 0) { 305 305 retval = -EINTR; 306 - info("Command was interrupted by a signal\n"); 306 + ctrl_info(ctrl, "Command was interrupted by a signal\n"); 307 307 } 308 308 309 309 return retval; ··· 320 320 321 321 if (!shpc_poll_ctrl_busy(ctrl)) { 322 322 /* After 1 sec and and the controller is still busy */ 323 - err("%s : Controller is still busy after 1 sec.\n", 324 - __func__); 323 + ctrl_err(ctrl, "Controller is still busy after 1 sec\n"); 325 324 retval = -EBUSY; 326 325 goto out; 327 326 } 328 327 329 328 ++t_slot; 330 329 temp_word = (t_slot << 8) | (cmd & 0xFF); 331 - dbg("%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); 330 + ctrl_dbg(ctrl, "%s: t_slot %x cmd %x\n", __func__, t_slot, cmd); 332 331 333 332 /* To make sure the Controller Busy bit is 0 before we send out the 334 333 * command. ··· 343 344 344 345 cmd_status = hpc_check_cmd_status(slot->ctrl); 345 346 if (cmd_status) { 346 - err("%s: Failed to issued command 0x%x (error code = %d)\n", 347 - __func__, cmd, cmd_status); 347 + ctrl_err(ctrl, 348 + "Failed to issued command 0x%x (error code = %d)\n", 349 + cmd, cmd_status); 348 350 retval = -EIO; 349 351 } 350 352 out: ··· 364 364 break; 365 365 case 1: 366 366 retval = SWITCH_OPEN; 367 - err("%s: Switch opened!\n", __func__); 367 + ctrl_err(ctrl, "Switch opened!\n"); 368 368 break; 369 369 case 2: 370 370 retval = INVALID_CMD; 371 - err("%s: Invalid HPC command!\n", __func__); 371 + ctrl_err(ctrl, "Invalid HPC command!\n"); 372 372 break; 373 373 case 4: 374 374 retval = INVALID_SPEED_MODE; 375 - err("%s: Invalid bus speed/mode!\n", __func__); 375 + ctrl_err(ctrl, "Invalid bus speed/mode!\n"); 376 376 break; 377 377 default: 378 378 retval = cmd_status; ··· 483 483 return -ENODEV; 484 484 } 485 485 486 - dbg("%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", 487 - __func__, slot_reg, pcix_cap, m66_cap); 486 + ctrl_dbg(ctrl, "%s: slot_reg = %x, pcix_cap = %x, m66_cap = %x\n", 487 + __func__, slot_reg, pcix_cap, m66_cap); 488 488 489 489 switch (pcix_cap) { 490 490 case 0x0: ··· 509 509 break; 510 510 } 511 511 512 - dbg("Adapter speed = %d\n", *value); 512 + ctrl_dbg(ctrl, "Adapter speed = %d\n", *value); 513 513 return retval; 514 514 } 515 515 ··· 526 526 retval = -1; 527 527 } 528 528 529 - dbg("Mode 1 ECC cap = %d\n", *mode); 529 + ctrl_dbg(ctrl, "Mode 1 ECC cap = %d\n", *mode); 530 530 return retval; 531 531 } 532 532 ··· 629 629 630 630 retval = shpc_write_cmd(slot, slot->hp_slot, SET_SLOT_PWR); 631 631 if (retval) 632 - err("%s: Write command failed!\n", __func__); 632 + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); 633 633 634 634 return retval; 635 635 } ··· 642 642 retval = shpc_write_cmd(slot, slot->hp_slot, 643 643 SET_SLOT_ENABLE | SET_PWR_BLINK | SET_ATTN_OFF); 644 644 if (retval) 645 - err("%s: Write command failed!\n", __func__); 645 + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); 646 646 647 647 return retval; 648 648 } ··· 655 655 retval = shpc_write_cmd(slot, slot->hp_slot, 656 656 SET_SLOT_DISABLE | SET_PWR_OFF | SET_ATTN_ON); 657 657 if (retval) 658 - err("%s: Write command failed!\n", __func__); 658 + ctrl_err(slot->ctrl, "%s: Write command failed!\n", __func__); 659 659 660 660 return retval; 661 661 } ··· 719 719 720 720 retval = shpc_write_cmd(slot, 0, cmd); 721 721 if (retval) 722 - err("%s: Write command failed!\n", __func__); 722 + ctrl_err(ctrl, "%s: Write command failed!\n", __func__); 723 723 724 724 return retval; 725 725 } ··· 735 735 if (!intr_loc) 736 736 return IRQ_NONE; 737 737 738 - dbg("%s: intr_loc = %x\n",__func__, intr_loc); 738 + ctrl_dbg(ctrl, "%s: intr_loc = %x\n", __func__, intr_loc); 739 739 740 740 if(!shpchp_poll_mode) { 741 741 /* ··· 748 748 shpc_writel(ctrl, SERR_INTR_ENABLE, serr_int); 749 749 750 750 intr_loc2 = shpc_readl(ctrl, INTR_LOC); 751 - dbg("%s: intr_loc2 = %x\n",__func__, intr_loc2); 751 + ctrl_dbg(ctrl, "%s: intr_loc2 = %x\n", __func__, intr_loc2); 752 752 } 753 753 754 754 if (intr_loc & CMD_INTR_PENDING) { ··· 773 773 continue; 774 774 775 775 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 776 - dbg("%s: Slot %x with intr, slot register = %x\n", 777 - __func__, hp_slot, slot_reg); 776 + ctrl_dbg(ctrl, "Slot %x with intr, slot register = %x\n", 777 + hp_slot, slot_reg); 778 778 779 779 if (slot_reg & MRL_CHANGE_DETECTED) 780 780 shpchp_handle_switch_change(hp_slot, ctrl); ··· 843 843 } 844 844 845 845 *value = bus_speed; 846 - dbg("Max bus speed = %d\n", bus_speed); 846 + ctrl_dbg(ctrl, "Max bus speed = %d\n", bus_speed); 847 847 848 848 return retval; 849 849 } ··· 911 911 break; 912 912 } 913 913 914 - dbg("Current bus speed = %d\n", bus_speed); 914 + ctrl_dbg(ctrl, "Current bus speed = %d\n", bus_speed); 915 915 return retval; 916 916 } 917 917 ··· 949 949 u8 i; 950 950 951 951 ctrl->pci_dev = pdev; /* pci_dev of the P2P bridge */ 952 + ctrl_dbg(ctrl, "Hotplug Controller:\n"); 952 953 953 954 if ((pdev->vendor == PCI_VENDOR_ID_AMD) || (pdev->device == 954 955 PCI_DEVICE_ID_AMD_GOLAM_7450)) { ··· 959 958 } else { 960 959 ctrl->cap_offset = pci_find_capability(pdev, PCI_CAP_ID_SHPC); 961 960 if (!ctrl->cap_offset) { 962 - err("%s : cap_offset == 0\n", __func__); 961 + ctrl_err(ctrl, "Cannot find PCI capability\n"); 963 962 goto abort; 964 963 } 965 - dbg("%s: cap_offset = %x\n", __func__, ctrl->cap_offset); 964 + ctrl_dbg(ctrl, " cap_offset = %x\n", ctrl->cap_offset); 966 965 967 966 rc = shpc_indirect_read(ctrl, 0, &shpc_base_offset); 968 967 if (rc) { 969 - err("%s: cannot read base_offset\n", __func__); 968 + ctrl_err(ctrl, "Cannot read base_offset\n"); 970 969 goto abort; 971 970 } 972 971 973 972 rc = shpc_indirect_read(ctrl, 3, &tempdword); 974 973 if (rc) { 975 - err("%s: cannot read slot config\n", __func__); 974 + ctrl_err(ctrl, "Cannot read slot config\n"); 976 975 goto abort; 977 976 } 978 977 num_slots = tempdword & SLOT_NUM; 979 - dbg("%s: num_slots (indirect) %x\n", __func__, num_slots); 978 + ctrl_dbg(ctrl, " num_slots (indirect) %x\n", num_slots); 980 979 981 980 for (i = 0; i < 9 + num_slots; i++) { 982 981 rc = shpc_indirect_read(ctrl, i, &tempdword); 983 982 if (rc) { 984 - err("%s: cannot read creg (index = %d)\n", 985 - __func__, i); 983 + ctrl_err(ctrl, 984 + "Cannot read creg (index = %d)\n", i); 986 985 goto abort; 987 986 } 988 - dbg("%s: offset %d: value %x\n", __func__,i, 989 - tempdword); 987 + ctrl_dbg(ctrl, " offset %d: value %x\n", i, tempdword); 990 988 } 991 989 992 990 ctrl->mmio_base = ··· 993 993 ctrl->mmio_size = 0x24 + 0x4 * num_slots; 994 994 } 995 995 996 - info("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", pdev->vendor, pdev->device, pdev->subsystem_vendor, 997 - pdev->subsystem_device); 996 + ctrl_info(ctrl, "HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n", 997 + pdev->vendor, pdev->device, pdev->subsystem_vendor, 998 + pdev->subsystem_device); 998 999 999 1000 rc = pci_enable_device(pdev); 1000 1001 if (rc) { 1001 - err("%s: pci_enable_device failed\n", __func__); 1002 + ctrl_err(ctrl, "pci_enable_device failed\n"); 1002 1003 goto abort; 1003 1004 } 1004 1005 1005 1006 if (!request_mem_region(ctrl->mmio_base, ctrl->mmio_size, MY_NAME)) { 1006 - err("%s: cannot reserve MMIO region\n", __func__); 1007 + ctrl_err(ctrl, "Cannot reserve MMIO region\n"); 1007 1008 rc = -1; 1008 1009 goto abort; 1009 1010 } 1010 1011 1011 1012 ctrl->creg = ioremap(ctrl->mmio_base, ctrl->mmio_size); 1012 1013 if (!ctrl->creg) { 1013 - err("%s: cannot remap MMIO region %lx @ %lx\n", __func__, 1014 - ctrl->mmio_size, ctrl->mmio_base); 1014 + ctrl_err(ctrl, "Cannot remap MMIO region %lx @ %lx\n", 1015 + ctrl->mmio_size, ctrl->mmio_base); 1015 1016 release_mem_region(ctrl->mmio_base, ctrl->mmio_size); 1016 1017 rc = -1; 1017 1018 goto abort; 1018 1019 } 1019 - dbg("%s: ctrl->creg %p\n", __func__, ctrl->creg); 1020 + ctrl_dbg(ctrl, "ctrl->creg %p\n", ctrl->creg); 1020 1021 1021 1022 mutex_init(&ctrl->crit_sect); 1022 1023 mutex_init(&ctrl->cmd_lock); ··· 1036 1035 1037 1036 /* Mask Global Interrupt Mask & Command Complete Interrupt Mask */ 1038 1037 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1039 - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1038 + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); 1040 1039 tempdword |= (GLOBAL_INTR_MASK | GLOBAL_SERR_MASK | 1041 1040 COMMAND_INTR_MASK | ARBITER_SERR_MASK); 1042 1041 tempdword &= ~SERR_INTR_RSVDZ_MASK; 1043 1042 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); 1044 1043 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1045 - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1044 + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); 1046 1045 1047 1046 /* Mask the MRL sensor SERR Mask of individual slot in 1048 1047 * Slot SERR-INT Mask & clear all the existing event if any 1049 1048 */ 1050 1049 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { 1051 1050 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 1052 - dbg("%s: Default Logical Slot Register %d value %x\n", __func__, 1053 - hp_slot, slot_reg); 1051 + ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n", 1052 + hp_slot, slot_reg); 1054 1053 slot_reg |= (PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | 1055 1054 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | 1056 1055 CON_PFAULT_INTR_MASK | MRL_CHANGE_SERR_MASK | ··· 1067 1066 /* Installs the interrupt handler */ 1068 1067 rc = pci_enable_msi(pdev); 1069 1068 if (rc) { 1070 - info("Can't get msi for the hotplug controller\n"); 1071 - info("Use INTx for the hotplug controller\n"); 1069 + ctrl_info(ctrl, 1070 + "Can't get msi for the hotplug controller\n"); 1071 + ctrl_info(ctrl, 1072 + "Use INTx for the hotplug controller\n"); 1072 1073 } 1073 1074 1074 1075 rc = request_irq(ctrl->pci_dev->irq, shpc_isr, IRQF_SHARED, 1075 1076 MY_NAME, (void *)ctrl); 1076 - dbg("%s: request_irq %d for hpc%d (returns %d)\n", 1077 - __func__, ctrl->pci_dev->irq, 1077 + ctrl_dbg(ctrl, "request_irq %d for hpc%d (returns %d)\n", 1078 + ctrl->pci_dev->irq, 1078 1079 atomic_read(&shpchp_num_controllers), rc); 1079 1080 if (rc) { 1080 - err("Can't get irq %d for the hotplug controller\n", 1081 - ctrl->pci_dev->irq); 1081 + ctrl_err(ctrl, "Can't get irq %d for the hotplug " 1082 + "controller\n", ctrl->pci_dev->irq); 1082 1083 goto abort_iounmap; 1083 1084 } 1084 1085 } 1085 - dbg("%s: HPC at b:d:f:irq=0x%x:%x:%x:%x\n", __func__, 1086 - pdev->bus->number, PCI_SLOT(pdev->devfn), 1087 - PCI_FUNC(pdev->devfn), pdev->irq); 1086 + ctrl_dbg(ctrl, "HPC at %s irq=%x\n", pci_name(pdev), pdev->irq); 1088 1087 1089 1088 /* 1090 1089 * If this is the first controller to be initialized, ··· 1103 1102 */ 1104 1103 for (hp_slot = 0; hp_slot < ctrl->num_slots; hp_slot++) { 1105 1104 slot_reg = shpc_readl(ctrl, SLOT_REG(hp_slot)); 1106 - dbg("%s: Default Logical Slot Register %d value %x\n", __func__, 1107 - hp_slot, slot_reg); 1105 + ctrl_dbg(ctrl, "Default Logical Slot Register %d value %x\n", 1106 + hp_slot, slot_reg); 1108 1107 slot_reg &= ~(PRSNT_CHANGE_INTR_MASK | ISO_PFAULT_INTR_MASK | 1109 1108 BUTTON_PRESS_INTR_MASK | MRL_CHANGE_INTR_MASK | 1110 1109 CON_PFAULT_INTR_MASK | SLOT_REG_RSVDZ_MASK); ··· 1117 1116 SERR_INTR_RSVDZ_MASK); 1118 1117 shpc_writel(ctrl, SERR_INTR_ENABLE, tempdword); 1119 1118 tempdword = shpc_readl(ctrl, SERR_INTR_ENABLE); 1120 - dbg("%s: SERR_INTR_ENABLE = %x\n", __func__, tempdword); 1119 + ctrl_dbg(ctrl, "SERR_INTR_ENABLE = %x\n", tempdword); 1121 1120 } 1122 1121 1123 1122 return 0;
+20 -16
drivers/pci/hotplug/shpchp_pci.c
··· 49 49 /* use default values if we can't get them from firmware */ 50 50 if (get_hp_params_from_firmware(dev, &hpp) || 51 51 !hpp.t0 || (hpp.t0->revision > 1)) { 52 - printk(KERN_WARNING 53 - "%s: Could not get hotplug parameters. Use defaults\n", 54 - __func__); 52 + warn("Could not get hotplug parameters. Use defaults\n"); 55 53 hpp.t0 = &hpp.type0_data; 56 54 hpp.t0->revision = 0; 57 55 hpp.t0->cache_line_size = 8; ··· 99 101 struct pci_dev *dev; 100 102 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 101 103 int num, fn; 104 + struct controller *ctrl = p_slot->ctrl; 102 105 103 106 dev = pci_get_slot(parent, PCI_DEVFN(p_slot->device, 0)); 104 107 if (dev) { 105 - err("Device %s already exists at %x:%x, cannot hot-add\n", 106 - pci_name(dev), p_slot->bus, p_slot->device); 108 + ctrl_err(ctrl, "Device %s already exists " 109 + "at %04x:%02x:%02x, cannot hot-add\n", pci_name(dev), 110 + pci_domain_nr(parent), p_slot->bus, p_slot->device); 107 111 pci_dev_put(dev); 108 112 return -EINVAL; 109 113 } 110 114 111 115 num = pci_scan_slot(parent, PCI_DEVFN(p_slot->device, 0)); 112 116 if (num == 0) { 113 - err("No new device found\n"); 117 + ctrl_err(ctrl, "No new device found\n"); 114 118 return -ENODEV; 115 119 } 116 120 ··· 121 121 if (!dev) 122 122 continue; 123 123 if ((dev->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 124 - err("Cannot hot-add display device %s\n", 125 - pci_name(dev)); 124 + ctrl_err(ctrl, "Cannot hot-add display device %s\n", 125 + pci_name(dev)); 126 126 pci_dev_put(dev); 127 127 continue; 128 128 } ··· 138 138 break; 139 139 } 140 140 if (busnr >= end) { 141 - err("No free bus for hot-added bridge\n"); 141 + ctrl_err(ctrl, 142 + "No free bus for hot-added bridge\n"); 142 143 pci_dev_put(dev); 143 144 continue; 144 145 } 145 146 child = pci_add_new_bus(parent, dev, busnr); 146 147 if (!child) { 147 - err("Cannot add new bus for %s\n", 148 - pci_name(dev)); 148 + ctrl_err(ctrl, "Cannot add new bus for %s\n", 149 + pci_name(dev)); 149 150 pci_dev_put(dev); 150 151 continue; 151 152 } ··· 169 168 int j; 170 169 u8 bctl = 0; 171 170 struct pci_bus *parent = p_slot->ctrl->pci_dev->subordinate; 171 + struct controller *ctrl = p_slot->ctrl; 172 172 173 - dbg("%s: bus/dev = %x/%x\n", __func__, p_slot->bus, p_slot->device); 173 + ctrl_dbg(ctrl, "%s: domain:bus:dev = %04x:%02x:%02x\n", 174 + __func__, pci_domain_nr(parent), p_slot->bus, p_slot->device); 174 175 175 176 for (j=0; j<8 ; j++) { 176 177 struct pci_dev* temp = pci_get_slot(parent, ··· 180 177 if (!temp) 181 178 continue; 182 179 if ((temp->class >> 16) == PCI_BASE_CLASS_DISPLAY) { 183 - err("Cannot remove display device %s\n", 184 - pci_name(temp)); 180 + ctrl_err(ctrl, "Cannot remove display device %s\n", 181 + pci_name(temp)); 185 182 pci_dev_put(temp); 186 183 continue; 187 184 } 188 185 if (temp->hdr_type == PCI_HEADER_TYPE_BRIDGE) { 189 186 pci_read_config_byte(temp, PCI_BRIDGE_CONTROL, &bctl); 190 187 if (bctl & PCI_BRIDGE_CTL_VGA) { 191 - err("Cannot remove display device %s\n", 192 - pci_name(temp)); 188 + ctrl_err(ctrl, 189 + "Cannot remove display device %s\n", 190 + pci_name(temp)); 193 191 pci_dev_put(temp); 194 192 continue; 195 193 }
+60
drivers/pci/irq.c
··· 1 + /* 2 + * PCI IRQ failure handing code 3 + * 4 + * Copyright (c) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> 5 + */ 6 + 7 + #include <linux/acpi.h> 8 + #include <linux/device.h> 9 + #include <linux/kernel.h> 10 + #include <linux/pci.h> 11 + 12 + static void pci_note_irq_problem(struct pci_dev *pdev, const char *reason) 13 + { 14 + struct pci_dev *parent = to_pci_dev(pdev->dev.parent); 15 + 16 + dev_printk(KERN_ERR, &pdev->dev, 17 + "Potentially misrouted IRQ (Bridge %s %04x:%04x)\n", 18 + parent->dev.bus_id, parent->vendor, parent->device); 19 + dev_printk(KERN_ERR, &pdev->dev, "%s\n", reason); 20 + dev_printk(KERN_ERR, &pdev->dev, "Please report to linux-kernel@vger.kernel.org\n"); 21 + WARN_ON(1); 22 + } 23 + 24 + /** 25 + * pci_lost_interrupt - reports a lost PCI interrupt 26 + * @pdev: device whose interrupt is lost 27 + * 28 + * The primary function of this routine is to report a lost interrupt 29 + * in a standard way which users can recognise (instead of blaming the 30 + * driver). 31 + * 32 + * Returns: 33 + * a suggestion for fixing it (although the driver is not required to 34 + * act on this). 35 + */ 36 + enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *pdev) 37 + { 38 + if (pdev->msi_enabled || pdev->msix_enabled) { 39 + enum pci_lost_interrupt_reason ret; 40 + 41 + if (pdev->msix_enabled) { 42 + pci_note_irq_problem(pdev, "MSIX routing failure"); 43 + ret = PCI_LOST_IRQ_DISABLE_MSIX; 44 + } else { 45 + pci_note_irq_problem(pdev, "MSI routing failure"); 46 + ret = PCI_LOST_IRQ_DISABLE_MSI; 47 + } 48 + return ret; 49 + } 50 + #ifdef CONFIG_ACPI 51 + if (!(acpi_disabled || acpi_noirq)) { 52 + pci_note_irq_problem(pdev, "Potential ACPI misrouting please reboot with acpi=noirq"); 53 + /* currently no way to fix acpi on the fly */ 54 + return PCI_LOST_IRQ_DISABLE_ACPI; 55 + } 56 + #endif 57 + pci_note_irq_problem(pdev, "unknown cause (not MSI or ACPI)"); 58 + return PCI_LOST_IRQ_NO_INFORMATION; 59 + } 60 + EXPORT_SYMBOL(pci_lost_interrupt);
+15 -10
drivers/pci/pci.c
··· 1309 1309 int pos; 1310 1310 u32 cap; 1311 1311 u16 ctrl; 1312 + struct pci_dev *bridge; 1312 1313 1313 - if (!dev->is_pcie) 1314 + if (!dev->is_pcie || dev->devfn) 1314 1315 return; 1315 1316 1316 - if (dev->pcie_type != PCI_EXP_TYPE_ROOT_PORT && 1317 - dev->pcie_type != PCI_EXP_TYPE_DOWNSTREAM) 1318 - return; 1319 - 1320 - pos = pci_find_capability(dev, PCI_CAP_ID_EXP); 1317 + pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ARI); 1321 1318 if (!pos) 1322 1319 return; 1323 1320 1324 - pci_read_config_dword(dev, pos + PCI_EXP_DEVCAP2, &cap); 1321 + bridge = dev->bus->self; 1322 + if (!bridge || !bridge->is_pcie) 1323 + return; 1324 + 1325 + pos = pci_find_capability(bridge, PCI_CAP_ID_EXP); 1326 + if (!pos) 1327 + return; 1328 + 1329 + pci_read_config_dword(bridge, pos + PCI_EXP_DEVCAP2, &cap); 1325 1330 if (!(cap & PCI_EXP_DEVCAP2_ARI)) 1326 1331 return; 1327 1332 1328 - pci_read_config_word(dev, pos + PCI_EXP_DEVCTL2, &ctrl); 1333 + pci_read_config_word(bridge, pos + PCI_EXP_DEVCTL2, &ctrl); 1329 1334 ctrl |= PCI_EXP_DEVCTL2_ARI; 1330 - pci_write_config_word(dev, pos + PCI_EXP_DEVCTL2, ctrl); 1335 + pci_write_config_word(bridge, pos + PCI_EXP_DEVCTL2, ctrl); 1331 1336 1332 - dev->ari_enabled = 1; 1337 + bridge->ari_enabled = 1; 1333 1338 } 1334 1339 1335 1340 int
-3
drivers/pci/probe.c
··· 298 298 child->resource[i] = child->parent->resource[i - 3]; 299 299 } 300 300 301 - for(i=0; i<3; i++) 302 - child->resource[i] = &dev->resource[PCI_BRIDGE_RESOURCES+i]; 303 - 304 301 res = child->resource[0]; 305 302 pci_read_config_byte(dev, PCI_IO_BASE, &io_base_lo); 306 303 pci_read_config_byte(dev, PCI_IO_LIMIT, &io_limit_lo);
+7
include/linux/pci.h
··· 546 546 unsigned int devfn); 547 547 #endif /* CONFIG_PCI_LEGACY */ 548 548 549 + enum pci_lost_interrupt_reason { 550 + PCI_LOST_IRQ_NO_INFORMATION = 0, 551 + PCI_LOST_IRQ_DISABLE_MSI, 552 + PCI_LOST_IRQ_DISABLE_MSIX, 553 + PCI_LOST_IRQ_DISABLE_ACPI, 554 + }; 555 + enum pci_lost_interrupt_reason pci_lost_interrupt(struct pci_dev *dev); 549 556 int pci_find_capability(struct pci_dev *dev, int cap); 550 557 int pci_find_next_capability(struct pci_dev *dev, u8 pos, int cap); 551 558 int pci_find_ext_capability(struct pci_dev *dev, int cap);