Re: [PATCH 3/5] PCI: Move pci_dev_is/assign_added() to pci.h
From: kernel test robot
Date: Mon Sep 06 2021 - 20:25:57 EST
Hi Niklas,
I love your patch! Yet something to improve:
[auto build test ERROR on s390/features]
[also build test ERROR on next-20210906]
[cannot apply to pci/next powerpc/next v5.14]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
base: https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git features
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce (this is a W=1 build):
# https://github.com/0day-ci/linux/commit/404ed8c00a612e7ae31c50557c80c6726c464863
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Niklas-Schnelle/s390-pci-automatic-error-recovery/20210906-175309
git checkout 404ed8c00a612e7ae31c50557c80c6726c464863
# save the attached .config to linux build tree
make W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
drivers/pci/hotplug/acpiphp_glue.c: In function 'acpiphp_add_context':
>> drivers/pci/hotplug/acpiphp_glue.c:330:6: error: implicit declaration of function 'pci_bus_read_dev_vendor_id' [-Werror=implicit-function-declaration]
330 | if (pci_bus_read_dev_vendor_id(pbus, PCI_DEVFN(device, function),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/pci/hotplug/acpiphp_glue.c: In function 'enable_slot':
>> drivers/pci/hotplug/acpiphp_glue.c:505:6: error: implicit declaration of function '__pci_bus_size_bridges'; did you mean 'pci_bus_size_bridges'? [-Werror=implicit-function-declaration]
505 | __pci_bus_size_bridges(dev->subordinate,
| ^~~~~~~~~~~~~~~~~~~~~~
| pci_bus_size_bridges
>> drivers/pci/hotplug/acpiphp_glue.c:510:3: error: implicit declaration of function '__pci_bus_assign_resources'; did you mean 'pci_bus_assign_resources'? [-Werror=implicit-function-declaration]
510 | __pci_bus_assign_resources(bus, &add_list, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| pci_bus_assign_resources
drivers/pci/hotplug/acpiphp_glue.c: In function 'trim_stale_devices':
>> drivers/pci/hotplug/acpiphp_glue.c:660:3: error: implicit declaration of function 'pci_dev_set_disconnected' [-Werror=implicit-function-declaration]
660 | pci_dev_set_disconnected(dev, NULL);
| ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/pci/hotplug/acpiphp_glue.c:661:7: error: implicit declaration of function 'pci_has_subordinate' [-Werror=implicit-function-declaration]
661 | if (pci_has_subordinate(dev))
| ^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/pci_bus_read_dev_vendor_id +330 drivers/pci/hotplug/acpiphp_glue.c
4e8662bbd680c5 Kristen Accardi 2006-06-28 217
3799c5a032aefb Rafael J. Wysocki 2014-02-16 218 /**
3799c5a032aefb Rafael J. Wysocki 2014-02-16 219 * acpiphp_add_context - Add ACPIPHP context to an ACPI device object.
3799c5a032aefb Rafael J. Wysocki 2014-02-16 220 * @handle: ACPI handle of the object to add a context to.
3799c5a032aefb Rafael J. Wysocki 2014-02-16 221 * @lvl: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16 222 * @data: The object's parent ACPIPHP bridge.
3799c5a032aefb Rafael J. Wysocki 2014-02-16 223 * @rv: Not used.
3799c5a032aefb Rafael J. Wysocki 2014-02-16 224 */
3799c5a032aefb Rafael J. Wysocki 2014-02-16 225 static acpi_status acpiphp_add_context(acpi_handle handle, u32 lvl, void *data,
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 226 void **rv)
^1da177e4c3f41 Linus Torvalds 2005-04-16 227 {
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 228 struct acpiphp_bridge *bridge = data;
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 229 struct acpiphp_context *context;
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04 230 struct acpi_device *adev;
^1da177e4c3f41 Linus Torvalds 2005-04-16 231 struct acpiphp_slot *slot;
^1da177e4c3f41 Linus Torvalds 2005-04-16 232 struct acpiphp_func *newfunc;
^1da177e4c3f41 Linus Torvalds 2005-04-16 233 acpi_status status = AE_OK;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 234 unsigned long long adr;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 235 int device, function;
e8c331e963c58b Kenji Kaneshige 2008-12-17 236 struct pci_bus *pbus = bridge->pci_bus;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 237 struct pci_dev *pdev = bridge->pci_dev;
3b63aaa70e1ccc Jiang Liu 2013-04-12 238 u32 val;
^1da177e4c3f41 Linus Torvalds 2005-04-16 239
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 240 status = acpi_evaluate_integer(handle, "_ADR", NULL, &adr);
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 241 if (ACPI_FAILURE(status)) {
f26ca1d699e8b5 Toshi Kani 2013-11-27 242 if (status != AE_NOT_FOUND)
f26ca1d699e8b5 Toshi Kani 2013-11-27 243 acpi_handle_warn(handle,
f26ca1d699e8b5 Toshi Kani 2013-11-27 244 "can't evaluate _ADR (%#x)\n", status);
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 245 return AE_OK;
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 246 }
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04 247 if (acpi_bus_get_device(handle, &adev))
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04 248 return AE_OK;
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 249
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 250 device = (adr >> 16) & 0xffff;
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 251 function = adr & 0xffff;
dfb117b3e50c52 Bjorn Helgaas 2012-06-20 252
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 253 acpi_lock_hp_context();
bbcbfc0eed6220 Rafael J. Wysocki 2014-02-04 254 context = acpiphp_init_context(adev);
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 255 if (!context) {
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 256 acpi_unlock_hp_context();
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 257 acpi_handle_err(handle, "No hotplug context\n");
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 258 return AE_NOT_EXIST;
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 259 }
bd4674dfc5fc70 Rafael J. Wysocki 2013-07-13 260 newfunc = &context->func;
bd4674dfc5fc70 Rafael J. Wysocki 2013-07-13 261 newfunc->function = function;
bda46dbb6626c9 Rafael J. Wysocki 2013-07-13 262 newfunc->parent = bridge;
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 263 acpi_unlock_hp_context();
cb7b8cedf6c88b Rafael J. Wysocki 2013-07-13 264
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 265 /*
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 266 * If this is a dock device, its _EJ0 should be executed by the dock
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 267 * notify handler after calling _DCK.
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 268 */
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 269 if (!is_dock_device(adev) && acpi_has_method(handle, "_EJ0"))
^1da177e4c3f41 Linus Torvalds 2005-04-16 270 newfunc->flags = FUNC_HAS_EJ0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 271
ecd046da57d332 Jiang Liu 2013-06-29 272 if (acpi_has_method(handle, "_STA"))
^1da177e4c3f41 Linus Torvalds 2005-04-16 273 newfunc->flags |= FUNC_HAS_STA;
^1da177e4c3f41 Linus Torvalds 2005-04-16 274
^1da177e4c3f41 Linus Torvalds 2005-04-16 275 /* search for objects that share the same slot */
ad41dd9dd0c8ca Yijing Wang 2013-04-12 276 list_for_each_entry(slot, &bridge->slots, node)
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 277 if (slot->device == device)
ac372338b75064 Rafael J. Wysocki 2013-07-13 278 goto slot_found;
^1da177e4c3f41 Linus Torvalds 2005-04-16 279
f5afe8064f3087 Eric Sesterhenn 2006-02-28 280 slot = kzalloc(sizeof(struct acpiphp_slot), GFP_KERNEL);
^1da177e4c3f41 Linus Torvalds 2005-04-16 281 if (!slot) {
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 282 acpi_lock_hp_context();
146fc68a4bdd78 Rafael J. Wysocki 2014-02-04 283 acpiphp_put_context(context);
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 284 acpi_unlock_hp_context();
146fc68a4bdd78 Rafael J. Wysocki 2014-02-04 285 return AE_NO_MEMORY;
^1da177e4c3f41 Linus Torvalds 2005-04-16 286 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 287
bda46dbb6626c9 Rafael J. Wysocki 2013-07-13 288 slot->bus = bridge->pci_bus;
^1da177e4c3f41 Linus Torvalds 2005-04-16 289 slot->device = device;
^1da177e4c3f41 Linus Torvalds 2005-04-16 290 INIT_LIST_HEAD(&slot->funcs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 291
ad41dd9dd0c8ca Yijing Wang 2013-04-12 292 list_add_tail(&slot->node, &bridge->slots);
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 293
cc6254e00eb676 Rafael J. Wysocki 2014-02-16 294 /*
cc6254e00eb676 Rafael J. Wysocki 2014-02-16 295 * Expose slots to user space for functions that have _EJ0 or _RMV or
cc6254e00eb676 Rafael J. Wysocki 2014-02-16 296 * are located in dock stations. Do not expose them for devices handled
84c8b58ed3addf Mika Westerberg 2018-05-29 297 * by the native PCIe hotplug (PCIeHP) or standard PCI hotplug
84c8b58ed3addf Mika Westerberg 2018-05-29 298 * (SHPCHP), because that code is supposed to expose slots to user
84c8b58ed3addf Mika Westerberg 2018-05-29 299 * space in those cases.
cc6254e00eb676 Rafael J. Wysocki 2014-02-16 300 */
3b52b21fa1f44c Rafael J. Wysocki 2014-02-21 301 if ((acpi_pci_check_ejectable(pbus, handle) || is_dock_device(adev))
84c8b58ed3addf Mika Westerberg 2018-05-29 302 && !(pdev && hotplug_is_native(pdev))) {
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 303 unsigned long long sun;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 304 int retval;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 305
^1da177e4c3f41 Linus Torvalds 2005-04-16 306 bridge->nr_slots++;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 307 status = acpi_evaluate_integer(handle, "_SUN", NULL, &sun);
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 308 if (ACPI_FAILURE(status))
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 309 sun = bridge->nr_slots;
^1da177e4c3f41 Linus Torvalds 2005-04-16 310
bd950799d9510c Lan Tianyu 2013-09-24 311 pr_debug("found ACPI PCI Hotplug slot %llu at PCI %04x:%02x:%02x\n",
7342798d0ab850 Rafael J. Wysocki 2013-07-13 312 sun, pci_domain_nr(pbus), pbus->number, device);
ac372338b75064 Rafael J. Wysocki 2013-07-13 313
7342798d0ab850 Rafael J. Wysocki 2013-07-13 314 retval = acpiphp_register_hotplug_slot(slot, sun);
e27da381417038 MUNEDA Takahiro 2006-02-23 315 if (retval) {
1aaac07112f040 Rafael J. Wysocki 2013-08-17 316 slot->slot = NULL;
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 317 bridge->nr_slots--;
f46753c5e354b8 Alex Chiang 2008-06-10 318 if (retval == -EBUSY)
227f06470502c4 Ryan Desfosses 2014-04-18 319 pr_warn("Slot %llu already registered by another hotplug driver\n", sun);
f46753c5e354b8 Alex Chiang 2008-06-10 320 else
227f06470502c4 Ryan Desfosses 2014-04-18 321 pr_warn("acpiphp_register_hotplug_slot failed (err code = 0x%x)\n", retval);
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 322 }
bbd34fcdd1b201 Rafael J. Wysocki 2013-07-13 323 /* Even if the slot registration fails, we can still use it. */
e27da381417038 MUNEDA Takahiro 2006-02-23 324 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 325
ac372338b75064 Rafael J. Wysocki 2013-07-13 326 slot_found:
^1da177e4c3f41 Linus Torvalds 2005-04-16 327 newfunc->slot = slot;
^1da177e4c3f41 Linus Torvalds 2005-04-16 328 list_add_tail(&newfunc->sibling, &slot->funcs);
^1da177e4c3f41 Linus Torvalds 2005-04-16 329
3b63aaa70e1ccc Jiang Liu 2013-04-12 @330 if (pci_bus_read_dev_vendor_id(pbus, PCI_DEVFN(device, function),
3b63aaa70e1ccc Jiang Liu 2013-04-12 331 &val, 60*1000))
bc805a55392a7c Rafael J. Wysocki 2013-07-13 332 slot->flags |= SLOT_ENABLED;
^1da177e4c3f41 Linus Torvalds 2005-04-16 333
2e862c51904ddd Rafael J. Wysocki 2013-07-13 334 return AE_OK;
^1da177e4c3f41 Linus Torvalds 2005-04-16 335 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 336
364d5094a43ff2 Rajesh Shah 2005-04-28 337 static void cleanup_bridge(struct acpiphp_bridge *bridge)
^1da177e4c3f41 Linus Torvalds 2005-04-16 338 {
3d54a3160fb6ba Jiang Liu 2013-04-12 339 struct acpiphp_slot *slot;
3d54a3160fb6ba Jiang Liu 2013-04-12 340 struct acpiphp_func *func;
42f49a6ae5dca9 Rajesh Shah 2005-04-28 341
3d54a3160fb6ba Jiang Liu 2013-04-12 342 list_for_each_entry(slot, &bridge->slots, node) {
3d54a3160fb6ba Jiang Liu 2013-04-12 343 list_for_each_entry(func, &slot->funcs, sibling) {
1a699476e25814 Rafael J. Wysocki 2014-02-06 344 struct acpi_device *adev = func_to_acpi_device(func);
5a3bc573ae32a7 Rafael J. Wysocki 2013-07-13 345
1a699476e25814 Rafael J. Wysocki 2014-02-06 346 acpi_lock_hp_context();
be27b3dcb02335 Rafael J. Wysocki 2014-02-21 347 adev->hp->notify = NULL;
edf5bf34d40804 Rafael J. Wysocki 2014-02-21 348 adev->hp->fixup = NULL;
1a699476e25814 Rafael J. Wysocki 2014-02-06 349 acpi_unlock_hp_context();
42f49a6ae5dca9 Rajesh Shah 2005-04-28 350 }
9217a984671e8a Rafael J. Wysocki 2014-01-10 351 slot->flags |= SLOT_IS_GOING_AWAY;
1aaac07112f040 Rafael J. Wysocki 2013-08-17 352 if (slot->slot)
e27da381417038 MUNEDA Takahiro 2006-02-23 353 acpiphp_unregister_hotplug_slot(slot);
42f49a6ae5dca9 Rajesh Shah 2005-04-28 354 }
42f49a6ae5dca9 Rajesh Shah 2005-04-28 355
3d54a3160fb6ba Jiang Liu 2013-04-12 356 mutex_lock(&bridge_mutex);
42f49a6ae5dca9 Rajesh Shah 2005-04-28 357 list_del(&bridge->list);
3d54a3160fb6ba Jiang Liu 2013-04-12 358 mutex_unlock(&bridge_mutex);
9217a984671e8a Rafael J. Wysocki 2014-01-10 359
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 360 acpi_lock_hp_context();
9217a984671e8a Rafael J. Wysocki 2014-01-10 361 bridge->is_going_away = true;
e525506fcb67a9 Rafael J. Wysocki 2014-02-04 362 acpi_unlock_hp_context();
^1da177e4c3f41 Linus Torvalds 2005-04-16 363 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 364
15a1ae74879925 Kristen Accardi 2006-02-23 365 /**
26e6c66e47fe7f Randy Dunlap 2007-11-28 366 * acpiphp_max_busnr - return the highest reserved bus number under the given bus.
15a1ae74879925 Kristen Accardi 2006-02-23 367 * @bus: bus to start search with
15a1ae74879925 Kristen Accardi 2006-02-23 368 */
15a1ae74879925 Kristen Accardi 2006-02-23 369 static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
15a1ae74879925 Kristen Accardi 2006-02-23 370 {
c6f0d5adc21e2d Yijing Wang 2014-02-13 371 struct pci_bus *tmp;
15a1ae74879925 Kristen Accardi 2006-02-23 372 unsigned char max, n;
15a1ae74879925 Kristen Accardi 2006-02-23 373
15a1ae74879925 Kristen Accardi 2006-02-23 374 /*
15a1ae74879925 Kristen Accardi 2006-02-23 375 * pci_bus_max_busnr will return the highest
15a1ae74879925 Kristen Accardi 2006-02-23 376 * reserved busnr for all these children.
15a1ae74879925 Kristen Accardi 2006-02-23 377 * that is equivalent to the bus->subordinate
15a1ae74879925 Kristen Accardi 2006-02-23 378 * value. We don't want to use the parent's
15a1ae74879925 Kristen Accardi 2006-02-23 379 * bus->subordinate value because it could have
15a1ae74879925 Kristen Accardi 2006-02-23 380 * padding in it.
15a1ae74879925 Kristen Accardi 2006-02-23 381 */
b918c62e086b21 Yinghai Lu 2012-05-17 382 max = bus->busn_res.start;
15a1ae74879925 Kristen Accardi 2006-02-23 383
c6f0d5adc21e2d Yijing Wang 2014-02-13 384 list_for_each_entry(tmp, &bus->children, node) {
c6f0d5adc21e2d Yijing Wang 2014-02-13 385 n = pci_bus_max_busnr(tmp);
15a1ae74879925 Kristen Accardi 2006-02-23 386 if (n > max)
15a1ae74879925 Kristen Accardi 2006-02-23 387 max = n;
15a1ae74879925 Kristen Accardi 2006-02-23 388 }
15a1ae74879925 Kristen Accardi 2006-02-23 389 return max;
15a1ae74879925 Kristen Accardi 2006-02-23 390 }
15a1ae74879925 Kristen Accardi 2006-02-23 391
d06070509147c9 Shaohua Li 2010-02-25 392 static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
d06070509147c9 Shaohua Li 2010-02-25 393 {
d06070509147c9 Shaohua Li 2010-02-25 394 struct acpiphp_func *func;
d06070509147c9 Shaohua Li 2010-02-25 395
d06070509147c9 Shaohua Li 2010-02-25 396 list_for_each_entry(func, &slot->funcs, sibling) {
d06070509147c9 Shaohua Li 2010-02-25 397 /* _REG is optional, we don't care about if there is failure */
6dd10c47e91239 Hans de Goede 2020-05-07 398 acpi_evaluate_reg(func_to_handle(func),
6dd10c47e91239 Hans de Goede 2020-05-07 399 ACPI_ADR_SPACE_PCI_CONFIG,
6dd10c47e91239 Hans de Goede 2020-05-07 400 ACPI_REG_CONNECT);
d06070509147c9 Shaohua Li 2010-02-25 401 }
d06070509147c9 Shaohua Li 2010-02-25 402 }
d06070509147c9 Shaohua Li 2010-02-25 403
1f96a965e30d09 Yinghai Lu 2013-01-21 404 static void check_hotplug_bridge(struct acpiphp_slot *slot, struct pci_dev *dev)
1f96a965e30d09 Yinghai Lu 2013-01-21 405 {
1f96a965e30d09 Yinghai Lu 2013-01-21 406 struct acpiphp_func *func;
1f96a965e30d09 Yinghai Lu 2013-01-21 407
1f96a965e30d09 Yinghai Lu 2013-01-21 408 /* quirk, or pcie could set it already */
1f96a965e30d09 Yinghai Lu 2013-01-21 409 if (dev->is_hotplug_bridge)
1f96a965e30d09 Yinghai Lu 2013-01-21 410 return;
1f96a965e30d09 Yinghai Lu 2013-01-21 411
1f96a965e30d09 Yinghai Lu 2013-01-21 412 list_for_each_entry(func, &slot->funcs, sibling) {
1f96a965e30d09 Yinghai Lu 2013-01-21 413 if (PCI_FUNC(dev->devfn) == func->function) {
1f96a965e30d09 Yinghai Lu 2013-01-21 414 dev->is_hotplug_bridge = 1;
1f96a965e30d09 Yinghai Lu 2013-01-21 415 break;
1f96a965e30d09 Yinghai Lu 2013-01-21 416 }
1f96a965e30d09 Yinghai Lu 2013-01-21 417 }
1f96a965e30d09 Yinghai Lu 2013-01-21 418 }
3b63aaa70e1ccc Jiang Liu 2013-04-12 419
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 420 static int acpiphp_rescan_slot(struct acpiphp_slot *slot)
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 421 {
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 422 struct acpiphp_func *func;
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 423
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 424 list_for_each_entry(func, &slot->funcs, sibling) {
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 425 struct acpi_device *adev = func_to_acpi_device(func);
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 426
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 427 acpi_bus_scan(adev->handle);
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 428 if (acpi_device_enumerated(adev))
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 429 acpi_device_set_power(adev, ACPI_STATE_D0);
b6708fbf98ac01 Rafael J. Wysocki 2014-02-04 430 }
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 431 return pci_scan_slot(slot->bus, PCI_DEVFN(slot->device, 0));
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 432 }
a47d8c8e72a5fa Rafael J. Wysocki 2013-09-08 433
84c8b58ed3addf Mika Westerberg 2018-05-29 434 static void acpiphp_native_scan_bridge(struct pci_dev *bridge)
84c8b58ed3addf Mika Westerberg 2018-05-29 435 {
84c8b58ed3addf Mika Westerberg 2018-05-29 436 struct pci_bus *bus = bridge->subordinate;
84c8b58ed3addf Mika Westerberg 2018-05-29 437 struct pci_dev *dev;
84c8b58ed3addf Mika Westerberg 2018-05-29 438 int max;
84c8b58ed3addf Mika Westerberg 2018-05-29 439
84c8b58ed3addf Mika Westerberg 2018-05-29 440 if (!bus)
84c8b58ed3addf Mika Westerberg 2018-05-29 441 return;
84c8b58ed3addf Mika Westerberg 2018-05-29 442
84c8b58ed3addf Mika Westerberg 2018-05-29 443 max = bus->busn_res.start;
84c8b58ed3addf Mika Westerberg 2018-05-29 444 /* Scan already configured non-hotplug bridges */
84c8b58ed3addf Mika Westerberg 2018-05-29 445 for_each_pci_bridge(dev, bus) {
84c8b58ed3addf Mika Westerberg 2018-05-29 446 if (!hotplug_is_native(dev))
84c8b58ed3addf Mika Westerberg 2018-05-29 447 max = pci_scan_bridge(bus, dev, max, 0);
84c8b58ed3addf Mika Westerberg 2018-05-29 448 }
84c8b58ed3addf Mika Westerberg 2018-05-29 449
84c8b58ed3addf Mika Westerberg 2018-05-29 450 /* Scan non-hotplug bridges that need to be reconfigured */
84c8b58ed3addf Mika Westerberg 2018-05-29 451 for_each_pci_bridge(dev, bus) {
77adf9355304f8 Mika Westerberg 2019-10-30 452 if (hotplug_is_native(dev))
77adf9355304f8 Mika Westerberg 2019-10-30 453 continue;
77adf9355304f8 Mika Westerberg 2019-10-30 454
84c8b58ed3addf Mika Westerberg 2018-05-29 455 max = pci_scan_bridge(bus, dev, max, 1);
77adf9355304f8 Mika Westerberg 2019-10-30 456 if (dev->subordinate) {
77adf9355304f8 Mika Westerberg 2019-10-30 457 pcibios_resource_survey_bus(dev->subordinate);
77adf9355304f8 Mika Westerberg 2019-10-30 458 pci_bus_size_bridges(dev->subordinate);
77adf9355304f8 Mika Westerberg 2019-10-30 459 pci_bus_assign_resources(dev->subordinate);
77adf9355304f8 Mika Westerberg 2019-10-30 460 }
84c8b58ed3addf Mika Westerberg 2018-05-29 461 }
84c8b58ed3addf Mika Westerberg 2018-05-29 462 }
84c8b58ed3addf Mika Westerberg 2018-05-29 463
^1da177e4c3f41 Linus Torvalds 2005-04-16 464 /**
a1d0abcea84573 Rafael J. Wysocki 2013-07-13 465 * enable_slot - enable, configure a slot
^1da177e4c3f41 Linus Torvalds 2005-04-16 466 * @slot: slot to be enabled
f188b99f0b2d33 Mika Westerberg 2018-09-26 467 * @bridge: true if enable is for the whole bridge (not a single slot)
^1da177e4c3f41 Linus Torvalds 2005-04-16 468 *
^1da177e4c3f41 Linus Torvalds 2005-04-16 469 * This function should be called per *physical slot*,
^1da177e4c3f41 Linus Torvalds 2005-04-16 470 * not per each slot object in ACPI namespace.
^1da177e4c3f41 Linus Torvalds 2005-04-16 471 */
f188b99f0b2d33 Mika Westerberg 2018-09-26 472 static void enable_slot(struct acpiphp_slot *slot, bool bridge)
^1da177e4c3f41 Linus Torvalds 2005-04-16 473 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 474 struct pci_dev *dev;
bda46dbb6626c9 Rafael J. Wysocki 2013-07-13 475 struct pci_bus *bus = slot->bus;
^1da177e4c3f41 Linus Torvalds 2005-04-16 476 struct acpiphp_func *func;
84c8b58ed3addf Mika Westerberg 2018-05-29 477
f188b99f0b2d33 Mika Westerberg 2018-09-26 478 if (bridge && bus->self && hotplug_is_native(bus->self)) {
84c8b58ed3addf Mika Westerberg 2018-05-29 479 /*
84c8b58ed3addf Mika Westerberg 2018-05-29 480 * If native hotplug is used, it will take care of hotplug
84c8b58ed3addf Mika Westerberg 2018-05-29 481 * slot management and resource allocation for hotplug
84c8b58ed3addf Mika Westerberg 2018-05-29 482 * bridges. However, ACPI hotplug may still be used for
84c8b58ed3addf Mika Westerberg 2018-05-29 483 * non-hotplug bridges to bring in additional devices such
84c8b58ed3addf Mika Westerberg 2018-05-29 484 * as a Thunderbolt host controller.
84c8b58ed3addf Mika Westerberg 2018-05-29 485 */
84c8b58ed3addf Mika Westerberg 2018-05-29 486 for_each_pci_bridge(dev, bus) {
84c8b58ed3addf Mika Westerberg 2018-05-29 487 if (PCI_SLOT(dev->devfn) == slot->device)
84c8b58ed3addf Mika Westerberg 2018-05-29 488 acpiphp_native_scan_bridge(dev);
84c8b58ed3addf Mika Westerberg 2018-05-29 489 }
84c8b58ed3addf Mika Westerberg 2018-05-29 490 } else {
d66ecb7220a70e Jiang Liu 2013-06-23 491 LIST_HEAD(add_list);
84c8b58ed3addf Mika Westerberg 2018-05-29 492 int max, pass;
^1da177e4c3f41 Linus Torvalds 2005-04-16 493
ab1225901da2d4 Mika Westerberg 2013-10-30 494 acpiphp_rescan_slot(slot);
15a1ae74879925 Kristen Accardi 2006-02-23 495 max = acpiphp_max_busnr(bus);
42f49a6ae5dca9 Rajesh Shah 2005-04-28 496 for (pass = 0; pass < 2; pass++) {
24a0c654d7d606 Andy Shevchenko 2017-10-20 497 for_each_pci_bridge(dev, bus) {
42f49a6ae5dca9 Rajesh Shah 2005-04-28 498 if (PCI_SLOT(dev->devfn) != slot->device)
42f49a6ae5dca9 Rajesh Shah 2005-04-28 499 continue;
a1d0abcea84573 Rafael J. Wysocki 2013-07-13 500
42f49a6ae5dca9 Rajesh Shah 2005-04-28 501 max = pci_scan_bridge(bus, dev, max, pass);
1f96a965e30d09 Yinghai Lu 2013-01-21 502 if (pass && dev->subordinate) {
1f96a965e30d09 Yinghai Lu 2013-01-21 503 check_hotplug_bridge(slot, dev);
d66ecb7220a70e Jiang Liu 2013-06-23 504 pcibios_resource_survey_bus(dev->subordinate);
84c8b58ed3addf Mika Westerberg 2018-05-29 @505 __pci_bus_size_bridges(dev->subordinate,
84c8b58ed3addf Mika Westerberg 2018-05-29 506 &add_list);
c64b5eead93f9d Kristen Accardi 2005-12-14 507 }
42f49a6ae5dca9 Rajesh Shah 2005-04-28 508 }
1f96a965e30d09 Yinghai Lu 2013-01-21 509 }
d66ecb7220a70e Jiang Liu 2013-06-23 @510 __pci_bus_assign_resources(bus, &add_list, NULL);
84c8b58ed3addf Mika Westerberg 2018-05-29 511 }
2dc41281b1d117 Rafael J. Wysocki 2013-09-06 512
8e5dce35221850 Kristen Accardi 2005-10-18 513 acpiphp_sanitize_bus(bus);
81ee57326c9ca6 Bjorn Helgaas 2014-08-28 514 pcie_bus_configure_settings(bus);
d06070509147c9 Shaohua Li 2010-02-25 515 acpiphp_set_acpi_region(slot);
69643e4829c5cd Ian Campbell 2011-05-11 516
69643e4829c5cd Ian Campbell 2011-05-11 517 list_for_each_entry(dev, &bus->devices, bus_list) {
69643e4829c5cd Ian Campbell 2011-05-11 518 /* Assume that newly added devices are powered on already. */
44bda4b7d26e9f Hari Vyas 2018-07-03 519 if (!pci_dev_is_added(dev))
69643e4829c5cd Ian Campbell 2011-05-11 520 dev->current_state = PCI_D0;
69643e4829c5cd Ian Campbell 2011-05-11 521 }
69643e4829c5cd Ian Campbell 2011-05-11 522
42f49a6ae5dca9 Rajesh Shah 2005-04-28 523 pci_bus_add_devices(bus);
42f49a6ae5dca9 Rajesh Shah 2005-04-28 524
f382a086f3129e Amos Kong 2011-11-25 525 slot->flags |= SLOT_ENABLED;
58c08628c4fe66 Alex Chiang 2009-10-26 526 list_for_each_entry(func, &slot->funcs, sibling) {
9d911d7903926a Alex Chiang 2009-05-21 527 dev = pci_get_slot(bus, PCI_DEVFN(slot->device,
^1da177e4c3f41 Linus Torvalds 2005-04-16 528 func->function));
f382a086f3129e Amos Kong 2011-11-25 529 if (!dev) {
f382a086f3129e Amos Kong 2011-11-25 530 /* Do not set SLOT_ENABLED flag if some funcs
f382a086f3129e Amos Kong 2011-11-25 531 are not added. */
9337a493623d59 Mika Westerberg 2018-05-24 532 slot->flags &= ~SLOT_ENABLED;
551bcb75b3d9f2 MUNEDA Takahiro 2006-03-22 533 continue;
f382a086f3129e Amos Kong 2011-11-25 534 }
3bbfd319034ddc Feilong Lin 2021-03-25 535 pci_dev_put(dev);
^1da177e4c3f41 Linus Torvalds 2005-04-16 536 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 537 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 538
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip