aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/pciehp_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/pciehp_core.c')
-rw-r--r--drivers/pci/hotplug/pciehp_core.c78
1 files changed, 47 insertions, 31 deletions
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 4fd5355bc3b..c748a19db89 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -144,9 +144,10 @@ set_lock_exit:
144 * sysfs interface which allows the user to toggle the Electro Mechanical 144 * sysfs interface which allows the user to toggle the Electro Mechanical
145 * Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock 145 * Interlock. Valid values are either 0 or 1. 0 == unlock, 1 == lock
146 */ 146 */
147static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf, 147static ssize_t lock_write_file(struct hotplug_slot *hotplug_slot,
148 size_t count) 148 const char *buf, size_t count)
149{ 149{
150 struct slot *slot = hotplug_slot->private;
150 unsigned long llock; 151 unsigned long llock;
151 u8 lock; 152 u8 lock;
152 int retval = 0; 153 int retval = 0;
@@ -157,10 +158,11 @@ static ssize_t lock_write_file(struct hotplug_slot *slot, const char *buf,
157 switch (lock) { 158 switch (lock) {
158 case 0: 159 case 0:
159 case 1: 160 case 1:
160 retval = set_lock_status(slot, lock); 161 retval = set_lock_status(hotplug_slot, lock);
161 break; 162 break;
162 default: 163 default:
163 err ("%d is an invalid lock value\n", lock); 164 ctrl_err(slot->ctrl, "%d is an invalid lock value\n",
165 lock);
164 retval = -EINVAL; 166 retval = -EINVAL;
165 } 167 }
166 if (retval) 168 if (retval)
@@ -180,7 +182,10 @@ static struct hotplug_slot_attribute hotplug_slot_attr_lock = {
180 */ 182 */
181static void release_slot(struct hotplug_slot *hotplug_slot) 183static void release_slot(struct hotplug_slot *hotplug_slot)
182{ 184{
183 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 185 struct slot *slot = hotplug_slot->private;
186
187 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
188 __func__, hotplug_slot->name);
184 189
185 kfree(hotplug_slot->info); 190 kfree(hotplug_slot->info);
186 kfree(hotplug_slot); 191 kfree(hotplug_slot);
@@ -215,9 +220,9 @@ static int init_slots(struct controller *ctrl)
215 get_adapter_status(hotplug_slot, &info->adapter_status); 220 get_adapter_status(hotplug_slot, &info->adapter_status);
216 slot->hotplug_slot = hotplug_slot; 221 slot->hotplug_slot = hotplug_slot;
217 222
218 dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x " 223 ctrl_dbg(ctrl, "Registering bus=%x dev=%x hp_slot=%x sun=%x "
219 "slot_device_offset=%x\n", slot->bus, slot->device, 224 "slot_device_offset=%x\n", slot->bus, slot->device,
220 slot->hp_slot, slot->number, ctrl->slot_device_offset); 225 slot->hp_slot, slot->number, ctrl->slot_device_offset);
221duplicate_name: 226duplicate_name:
222 retval = pci_hp_register(hotplug_slot, 227 retval = pci_hp_register(hotplug_slot,
223 ctrl->pci_dev->subordinate, 228 ctrl->pci_dev->subordinate,
@@ -233,9 +238,11 @@ duplicate_name:
233 if (len < SLOT_NAME_SIZE) 238 if (len < SLOT_NAME_SIZE)
234 goto duplicate_name; 239 goto duplicate_name;
235 else 240 else
236 err("duplicate slot name overflow\n"); 241 ctrl_err(ctrl, "duplicate slot name "
242 "overflow\n");
237 } 243 }
238 err("pci_hp_register failed with error %d\n", retval); 244 ctrl_err(ctrl, "pci_hp_register failed with error %d\n",
245 retval);
239 goto error_info; 246 goto error_info;
240 } 247 }
241 /* create additional sysfs entries */ 248 /* create additional sysfs entries */
@@ -244,7 +251,8 @@ duplicate_name:
244 &hotplug_slot_attr_lock.attr); 251 &hotplug_slot_attr_lock.attr);
245 if (retval) { 252 if (retval) {
246 pci_hp_deregister(hotplug_slot); 253 pci_hp_deregister(hotplug_slot);
247 err("cannot create additional sysfs entries\n"); 254 ctrl_err(ctrl, "cannot create additional sysfs "
255 "entries\n");
248 goto error_info; 256 goto error_info;
249 } 257 }
250 } 258 }
@@ -278,7 +286,8 @@ static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status)
278{ 286{
279 struct slot *slot = hotplug_slot->private; 287 struct slot *slot = hotplug_slot->private;
280 288
281 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 289 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
290 __func__, hotplug_slot->name);
282 291
283 hotplug_slot->info->attention_status = status; 292 hotplug_slot->info->attention_status = status;
284 293
@@ -293,7 +302,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
293{ 302{
294 struct slot *slot = hotplug_slot->private; 303 struct slot *slot = hotplug_slot->private;
295 304
296 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 305 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
306 __func__, hotplug_slot->name);
297 307
298 return pciehp_sysfs_enable_slot(slot); 308 return pciehp_sysfs_enable_slot(slot);
299} 309}
@@ -303,7 +313,8 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
303{ 313{
304 struct slot *slot = hotplug_slot->private; 314 struct slot *slot = hotplug_slot->private;
305 315
306 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 316 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
317 __func__, hotplug_slot->name);
307 318
308 return pciehp_sysfs_disable_slot(slot); 319 return pciehp_sysfs_disable_slot(slot);
309} 320}
@@ -313,7 +324,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value)
313 struct slot *slot = hotplug_slot->private; 324 struct slot *slot = hotplug_slot->private;
314 int retval; 325 int retval;
315 326
316 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 327 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
328 __func__, hotplug_slot->name);
317 329
318 retval = slot->hpc_ops->get_power_status(slot, value); 330 retval = slot->hpc_ops->get_power_status(slot, value);
319 if (retval < 0) 331 if (retval < 0)
@@ -327,7 +339,8 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value)
327 struct slot *slot = hotplug_slot->private; 339 struct slot *slot = hotplug_slot->private;
328 int retval; 340 int retval;
329 341
330 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 342 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
343 __func__, hotplug_slot->name);
331 344
332 retval = slot->hpc_ops->get_attention_status(slot, value); 345 retval = slot->hpc_ops->get_attention_status(slot, value);
333 if (retval < 0) 346 if (retval < 0)
@@ -341,7 +354,8 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value)
341 struct slot *slot = hotplug_slot->private; 354 struct slot *slot = hotplug_slot->private;
342 int retval; 355 int retval;
343 356
344 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 357 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
358 __func__, hotplug_slot->name);
345 359
346 retval = slot->hpc_ops->get_latch_status(slot, value); 360 retval = slot->hpc_ops->get_latch_status(slot, value);
347 if (retval < 0) 361 if (retval < 0)
@@ -355,7 +369,8 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value)
355 struct slot *slot = hotplug_slot->private; 369 struct slot *slot = hotplug_slot->private;
356 int retval; 370 int retval;
357 371
358 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 372 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
373 __func__, hotplug_slot->name);
359 374
360 retval = slot->hpc_ops->get_adapter_status(slot, value); 375 retval = slot->hpc_ops->get_adapter_status(slot, value);
361 if (retval < 0) 376 if (retval < 0)
@@ -370,7 +385,8 @@ static int get_max_bus_speed(struct hotplug_slot *hotplug_slot,
370 struct slot *slot = hotplug_slot->private; 385 struct slot *slot = hotplug_slot->private;
371 int retval; 386 int retval;
372 387
373 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 388 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
389 __func__, hotplug_slot->name);
374 390
375 retval = slot->hpc_ops->get_max_bus_speed(slot, value); 391 retval = slot->hpc_ops->get_max_bus_speed(slot, value);
376 if (retval < 0) 392 if (retval < 0)
@@ -384,7 +400,8 @@ static int get_cur_bus_speed(struct hotplug_slot *hotplug_slot, enum pci_bus_spe
384 struct slot *slot = hotplug_slot->private; 400 struct slot *slot = hotplug_slot->private;
385 int retval; 401 int retval;
386 402
387 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot->name); 403 ctrl_dbg(slot->ctrl, "%s - physical_slot = %s\n",
404 __func__, hotplug_slot->name);
388 405
389 retval = slot->hpc_ops->get_cur_bus_speed(slot, value); 406 retval = slot->hpc_ops->get_cur_bus_speed(slot, value);
390 if (retval < 0) 407 if (retval < 0)
@@ -402,14 +419,15 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
402 struct pci_dev *pdev = dev->port; 419 struct pci_dev *pdev = dev->port;
403 420
404 if (pciehp_force) 421 if (pciehp_force)
405 dbg("Bypassing BIOS check for pciehp use on %s\n", 422 dev_info(&dev->device,
406 pci_name(pdev)); 423 "Bypassing BIOS check for pciehp use on %s\n",
424 pci_name(pdev));
407 else if (pciehp_get_hp_hw_control_from_firmware(pdev)) 425 else if (pciehp_get_hp_hw_control_from_firmware(pdev))
408 goto err_out_none; 426 goto err_out_none;
409 427
410 ctrl = pcie_init(dev); 428 ctrl = pcie_init(dev);
411 if (!ctrl) { 429 if (!ctrl) {
412 dbg("%s: controller initialization failed\n", PCIE_MODULE_NAME); 430 dev_err(&dev->device, "controller initialization failed\n");
413 goto err_out_none; 431 goto err_out_none;
414 } 432 }
415 set_service_data(dev, ctrl); 433 set_service_data(dev, ctrl);
@@ -418,11 +436,10 @@ static int pciehp_probe(struct pcie_device *dev, const struct pcie_port_service_
418 rc = init_slots(ctrl); 436 rc = init_slots(ctrl);
419 if (rc) { 437 if (rc) {
420 if (rc == -EBUSY) 438 if (rc == -EBUSY)
421 warn("%s: slot already registered by another " 439 ctrl_warn(ctrl, "slot already registered by another "
422 "hotplug driver\n", PCIE_MODULE_NAME); 440 "hotplug driver\n");
423 else 441 else
424 err("%s: slot initialization failed\n", 442 ctrl_err(ctrl, "slot initialization failed\n");
425 PCIE_MODULE_NAME);
426 goto err_out_release_ctlr; 443 goto err_out_release_ctlr;
427 } 444 }
428 445
@@ -461,13 +478,13 @@ static void pciehp_remove (struct pcie_device *dev)
461#ifdef CONFIG_PM 478#ifdef CONFIG_PM
462static int pciehp_suspend (struct pcie_device *dev, pm_message_t state) 479static int pciehp_suspend (struct pcie_device *dev, pm_message_t state)
463{ 480{
464 printk("%s ENTRY\n", __func__); 481 dev_info(&dev->device, "%s ENTRY\n", __func__);
465 return 0; 482 return 0;
466} 483}
467 484
468static int pciehp_resume (struct pcie_device *dev) 485static int pciehp_resume (struct pcie_device *dev)
469{ 486{
470 printk("%s ENTRY\n", __func__); 487 dev_info(&dev->device, "%s ENTRY\n", __func__);
471 if (pciehp_force) { 488 if (pciehp_force) {
472 struct controller *ctrl = get_service_data(dev); 489 struct controller *ctrl = get_service_data(dev);
473 struct slot *t_slot; 490 struct slot *t_slot;
@@ -497,10 +514,9 @@ static struct pcie_port_service_id port_pci_ids[] = { {
497 .driver_data = 0, 514 .driver_data = 0,
498 }, { /* end: all zeroes */ } 515 }, { /* end: all zeroes */ }
499}; 516};
500static const char device_name[] = "hpdriver";
501 517
502static struct pcie_port_service_driver hpdriver_portdrv = { 518static struct pcie_port_service_driver hpdriver_portdrv = {
503 .name = (char *)device_name, 519 .name = PCIE_MODULE_NAME,
504 .id_table = &port_pci_ids[0], 520 .id_table = &port_pci_ids[0],
505 521
506 .probe = pciehp_probe, 522 .probe = pciehp_probe,