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