Lines Matching +full:broken +full:- +full:prefetch +full:- +full:cmd
1 // SPDX-License-Identifier: GPL-2.0
5 * Copyright 1993 -- 1997 Drew Eckhardt, Frederic Potter,
6 * David Mosberger-Tang
8 * Copyright 1997 -- 2000 Martin Mares <mj@ucw.cz>
84 unsigned int delay_ms = max(dev->d3hot_delay, pci_pm_d3hot_delay); in pci_dev_d3_sleep()
97 return dev->reset_methods[0] != 0; in pci_reset_supported()
116 * pci=hpmmiosize=nnM overrides non-prefetchable MMIO size,
127 /* PCIe MPS/MRRS strategy; can be overridden by kernel command-line param */
144 * measured in 32-bit words, not bytes.
186 * pci_bus_max_busnr - returns maximum PCI bus number of given bus' children
197 max = bus->busn_res.end; in pci_bus_max_busnr()
198 list_for_each_entry(tmp, &bus->children, node) { in pci_bus_max_busnr()
208 * pci_status_get_and_clear_errors - return and clear error bits in PCI_STATUS
220 return -EIO; in pci_status_get_and_clear_errors()
234 struct resource *res = &pdev->resource[bar]; in __pci_ioremap_resource()
235 resource_size_t start = res->start; in __pci_ioremap_resource()
241 if (res->flags & IORESOURCE_UNSET || !(res->flags & IORESOURCE_MEM)) { in __pci_ioremap_resource()
266 * pci_dev_str_match_path - test if a path string matches a device
277 * A path for a device can be obtained using 'lspci -t'. Using a path
294 wpath = kmemdup_nul(path, *endptr - path, GFP_ATOMIC); in pci_dev_str_match_path()
296 return -ENOMEM; in pci_dev_str_match_path()
304 ret = -EINVAL; in pci_dev_str_match_path()
308 if (dev->devfn != PCI_DEVFN(slot, func)) { in pci_dev_str_match_path()
334 ret = -EINVAL; in pci_dev_str_match_path()
339 ret = (seg == pci_domain_nr(dev->bus) && in pci_dev_str_match_path()
340 bus == dev->bus->number && in pci_dev_str_match_path()
341 dev->devfn == PCI_DEVFN(slot, func)); in pci_dev_str_match_path()
349 * pci_dev_str_match - test if a string matches a device
366 * through the use of 'lspci -t'.
371 * in-kernel code that uses PCI_ANY_ID which is ~0; this is for
393 return -EINVAL; in pci_dev_str_match()
401 if ((!vendor || vendor == dev->vendor) && in pci_dev_str_match()
402 (!device || device == dev->device) && in pci_dev_str_match()
404 subsystem_vendor == dev->subsystem_vendor) && in pci_dev_str_match()
406 subsystem_device == dev->subsystem_device)) in pci_dev_str_match()
436 while ((*ttl)--) { in __pci_find_next_cap_ttl()
462 return __pci_find_next_cap(dev->bus, dev->devfn, in pci_find_next_capability()
488 * pci_find_capability - query for devices' capabilities
503 * %PCI_CAP_ID_PCIX PCI-X
510 pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type); in pci_find_capability()
512 pos = __pci_find_next_cap(dev->bus, dev->devfn, pos, cap); in pci_find_capability()
519 * pci_bus_find_capability - query for devices' capabilities
546 * pci_find_next_ext_capability - Find an extended capability
554 * vendor-specific capability, and this provides a way to find them all.
563 ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8; in pci_find_next_ext_capability()
565 if (dev->cfg_size <= PCI_CFG_SPACE_SIZE) in pci_find_next_ext_capability()
581 while (ttl-- > 0) { in pci_find_next_ext_capability()
598 * pci_find_ext_capability - Find an extended capability
618 * pci_get_dsn - Read and return the 8-byte Device Serial Number
661 pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, pos, in __pci_find_next_ht_cap()
671 pos = __pci_find_next_cap_ttl(dev->bus, dev->devfn, in __pci_find_next_ht_cap()
680 * pci_find_next_ht_capability - query a device's HyperTransport capabilities
689 * NB. To be 100% safe against broken PCI devices, the caller should take
699 * pci_find_ht_capability - query a device's HyperTransport capabilities
713 pos = __pci_bus_find_cap_start(dev->bus, dev->devfn, dev->hdr_type); in pci_find_ht_capability()
722 * pci_find_vsec_capability - Find a vendor-specific extended capability
725 * @cap: Vendor-specific capability ID
737 if (vendor != dev->vendor) in pci_find_vsec_capability()
755 * pci_find_dvsec_capability - Find DVSEC for vendor
758 * @dvsec: Designated Vendor-specific capability ID
787 * pci_find_parent_resource - return resource region of parent bus of given
798 const struct pci_bus *bus = dev->bus; in pci_find_parent_resource()
810 if (r->flags & IORESOURCE_PREFETCH && in pci_find_parent_resource()
811 !(res->flags & IORESOURCE_PREFETCH)) in pci_find_parent_resource()
816 * be both a positively-decoded aperture and a in pci_find_parent_resource()
817 * subtractively-decoded region that contain the BAR. in pci_find_parent_resource()
818 * We want the positively-decoded one, so this depends in pci_find_parent_resource()
830 * pci_find_resource - Return matching PCI device resource
843 struct resource *r = &dev->resource[i]; in pci_find_resource()
845 if (r->start && resource_contains(r, res)) in pci_find_resource()
854 * pci_wait_for_pending - wait for @mask bit(s) to clear in status word @pos
869 msleep((1 << (i - 1)) * 100); in pci_wait_for_pending()
882 * pci_request_acs - ask for ACS to be enabled if supported
892 * pci_disable_acs_redir - disable ACS redirect capabilities
933 pos = dev->acs_cap; in pci_disable_acs_redir()
950 * pci_std_enable_acs - enable ACS on devices using standard ACS capabilities
959 pos = dev->acs_cap; in pci_std_enable_acs()
979 if (pci_ats_disabled() || dev->external_facing || dev->untrusted) in pci_std_enable_acs()
986 * pci_enable_acs - enable ACS if hardware support it
1011 * pci_restore_bars - restore a device's BAR values (e.g. after wake-up)
1089 * pci_update_current_state - Read power state of given device and cache it
1103 dev->current_state = PCI_D3cold; in pci_update_current_state()
1104 } else if (dev->pm_cap) { in pci_update_current_state()
1107 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_update_current_state()
1109 dev->current_state = PCI_D3cold; in pci_update_current_state()
1112 dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; in pci_update_current_state()
1114 dev->current_state = state; in pci_update_current_state()
1119 * pci_refresh_power_state - Refresh the given device's power state data
1128 pci_update_current_state(dev, dev->current_state); in pci_refresh_power_state()
1132 * pci_platform_power_transition - Use platform to change device power state
1143 else if (!dev->pm_cap) /* Fall back to PCI_D0 */ in pci_platform_power_transition()
1144 dev->current_state = PCI_D0; in pci_platform_power_transition()
1152 pm_request_resume(&pci_dev->dev); in pci_resume_one()
1157 * pci_resume_bus - Walk given bus and runtime resume devices on it
1186 * Wait for the device to return a non-CRS completion. Read the in pci_dev_wait()
1199 delay - 1, reset_type); in pci_dev_wait()
1200 return -ENOTTY; in pci_dev_wait()
1212 delay - 1, reset_type); in pci_dev_wait()
1220 pci_info(dev, "ready %dms after %s\n", delay - 1, in pci_dev_wait()
1227 * pci_power_up - Put the given device into D0
1235 * put the device in D0 via non-PCI means.
1245 if (!dev->pm_cap) { in pci_power_up()
1248 dev->current_state = PCI_D0; in pci_power_up()
1250 dev->current_state = state; in pci_power_up()
1252 return -EIO; in pci_power_up()
1255 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_power_up()
1258 pci_power_name(dev->current_state)); in pci_power_up()
1259 dev->current_state = PCI_D3cold; in pci_power_up()
1260 return -EIO; in pci_power_up()
1265 need_restore = (state == PCI_D3hot || dev->current_state >= PCI_D3hot) && in pci_power_up()
1275 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, 0); in pci_power_up()
1284 dev->current_state = PCI_D0; in pci_power_up()
1292 * pci_set_full_power_state - Put a PCI device into D0 and update its state
1310 if (dev->current_state == PCI_D0) in pci_set_full_power_state()
1316 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_set_full_power_state()
1317 dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; in pci_set_full_power_state()
1318 if (dev->current_state != PCI_D0) { in pci_set_full_power_state()
1320 pci_power_name(dev->current_state)); in pci_set_full_power_state()
1338 if (dev->bus->self) in pci_set_full_power_state()
1339 pcie_aspm_pm_state_change(dev->bus->self); in pci_set_full_power_state()
1345 * __pci_dev_set_current_state - Set current state of a PCI device
1353 dev->current_state = state; in __pci_dev_set_current_state()
1358 * pci_bus_set_current_state - Walk given bus and set current state of devices
1369 * pci_set_low_power_state - Put a PCI device into a low-power state.
1373 * Use the device's PCI_PM_CTRL register to put it into a low-power state.
1376 * -EINVAL if the requested state is invalid.
1377 * -EIO if device does not support PCI PM or its PM capabilities register has a
1386 if (!dev->pm_cap) in pci_set_low_power_state()
1387 return -EIO; in pci_set_low_power_state()
1391 * we're already in a low-power state, we can only go deeper. E.g., in pci_set_low_power_state()
1395 if (dev->current_state <= PCI_D3cold && dev->current_state > state) { in pci_set_low_power_state()
1397 pci_power_name(dev->current_state), in pci_set_low_power_state()
1399 return -EINVAL; in pci_set_low_power_state()
1403 if ((state == PCI_D1 && !dev->d1_support) in pci_set_low_power_state()
1404 || (state == PCI_D2 && !dev->d2_support)) in pci_set_low_power_state()
1405 return -EIO; in pci_set_low_power_state()
1407 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_set_low_power_state()
1410 pci_power_name(dev->current_state), in pci_set_low_power_state()
1412 dev->current_state = PCI_D3cold; in pci_set_low_power_state()
1413 return -EIO; in pci_set_low_power_state()
1420 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); in pci_set_low_power_state()
1428 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_set_low_power_state()
1429 dev->current_state = pmcsr & PCI_PM_CTRL_STATE_MASK; in pci_set_low_power_state()
1430 if (dev->current_state != state) in pci_set_low_power_state()
1432 pci_power_name(dev->current_state), in pci_set_low_power_state()
1435 if (dev->bus->self) in pci_set_low_power_state()
1436 pcie_aspm_pm_state_change(dev->bus->self); in pci_set_low_power_state()
1442 * pci_set_power_state - Set the power state of a PCI device
1450 * -EINVAL if the requested state is invalid.
1451 * -EIO if device does not support PCI PM or its PM capabilities register has a
1478 if (dev->current_state == state) in pci_set_power_state()
1488 if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3)) in pci_set_power_state()
1502 if (dev->current_state == PCI_D3cold) in pci_set_power_state()
1503 pci_bus_set_current_state(dev->subordinate, PCI_D3cold); in pci_set_power_state()
1522 hlist_for_each_entry(tmp, &pci_dev->saved_cap_space, next) { in _pci_find_saved_cap()
1523 if (tmp->cap.cap_extended == extended && tmp->cap.cap_nr == cap) in _pci_find_saved_cap()
1551 return -ENOMEM; in pci_save_pcie_state()
1554 cap = (u16 *)&save_state->cap.data[0]; in pci_save_pcie_state()
1573 if (bridge && bridge->ltr_path) { in pci_bridge_reconfigure_ltr()
1576 pci_dbg(bridge, "re-enabling LTR\n"); in pci_bridge_reconfigure_ltr()
1596 * Check and re-configure the bit here before restoring device. in pci_restore_pcie_state()
1601 cap = (u16 *)&save_state->cap.data[0]; in pci_restore_pcie_state()
1623 return -ENOMEM; in pci_save_pcix_state()
1627 (u16 *)save_state->cap.data); in pci_save_pcix_state()
1642 cap = (u16 *)&save_state->cap.data[0]; in pci_restore_pcix_state()
1666 /* Some broken devices only support dword access to LTR */ in pci_save_ltr_state()
1667 cap = &save_state->cap.data[0]; in pci_save_ltr_state()
1682 /* Some broken devices only support dword access to LTR */ in pci_restore_ltr_state()
1683 cap = &save_state->cap.data[0]; in pci_restore_ltr_state()
1688 * pci_save_state - save the PCI configuration space of a device before
1697 pci_read_config_dword(dev, i * 4, &dev->saved_config_space[i]); in pci_save_state()
1699 i * 4, dev->saved_config_space[i]); in pci_save_state()
1701 dev->state_saved = true; in pci_save_state()
1729 pci_dbg(pdev, "restore config %#04x: %#010x -> %#010x\n", in pci_restore_config_dword()
1732 if (retry-- <= 0) in pci_restore_config_dword()
1749 for (index = end; index >= start; index--) in pci_restore_config_space_range()
1751 pdev->saved_config_space[index], in pci_restore_config_space_range()
1757 if (pdev->hdr_type == PCI_HEADER_TYPE_NORMAL) { in pci_restore_config_space()
1762 } else if (pdev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { in pci_restore_config_space()
1766 * Force rewriting of prefetch registers to avoid S3 resume in pci_restore_config_space()
1796 res = pdev->resource + bar_idx; in pci_restore_rebar_state()
1805 * pci_restore_state - Restore the saved state of a PCI device
1810 if (!dev->state_saved) in pci_restore_state()
1840 dev->state_saved = false; in pci_restore_state()
1850 * pci_store_saved_state - Allocate and return an opaque struct containing
1863 if (!dev->state_saved) in pci_store_saved_state()
1868 hlist_for_each_entry(tmp, &dev->saved_cap_space, next) in pci_store_saved_state()
1869 size += sizeof(struct pci_cap_saved_data) + tmp->cap.size; in pci_store_saved_state()
1875 memcpy(state->config_space, dev->saved_config_space, in pci_store_saved_state()
1876 sizeof(state->config_space)); in pci_store_saved_state()
1878 cap = state->cap; in pci_store_saved_state()
1879 hlist_for_each_entry(tmp, &dev->saved_cap_space, next) { in pci_store_saved_state()
1880 size_t len = sizeof(struct pci_cap_saved_data) + tmp->cap.size; in pci_store_saved_state()
1881 memcpy(cap, &tmp->cap, len); in pci_store_saved_state()
1891 * pci_load_saved_state - Reload the provided save state into struct pci_dev.
1900 dev->state_saved = false; in pci_load_saved_state()
1905 memcpy(dev->saved_config_space, state->config_space, in pci_load_saved_state()
1906 sizeof(state->config_space)); in pci_load_saved_state()
1908 cap = state->cap; in pci_load_saved_state()
1909 while (cap->size) { in pci_load_saved_state()
1912 tmp = _pci_find_saved_cap(dev, cap->cap_nr, cap->cap_extended); in pci_load_saved_state()
1913 if (!tmp || tmp->cap.size != cap->size) in pci_load_saved_state()
1914 return -EINVAL; in pci_load_saved_state()
1916 memcpy(tmp->cap.data, cap->data, tmp->cap.size); in pci_load_saved_state()
1918 sizeof(struct pci_cap_saved_data) + cap->size); in pci_load_saved_state()
1921 dev->state_saved = true; in pci_load_saved_state()
1927 * pci_load_and_free_saved_state - Reload the save state pointed to by state,
1951 u16 cmd; in do_pci_enable_device() local
1955 if (err < 0 && err != -EIO) in do_pci_enable_device()
1967 if (dev->msi_enabled || dev->msix_enabled) in do_pci_enable_device()
1972 pci_read_config_word(dev, PCI_COMMAND, &cmd); in do_pci_enable_device()
1973 if (cmd & PCI_COMMAND_INTX_DISABLE) in do_pci_enable_device()
1975 cmd & ~PCI_COMMAND_INTX_DISABLE); in do_pci_enable_device()
1982 * pci_reenable_device - Resume abandoned device
1991 return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1); in pci_reenable_device()
2006 if (!dev->is_busmaster) in pci_enable_bridge()
2030 pci_update_current_state(dev, dev->current_state); in pci_enable_device_flags()
2032 if (atomic_inc_return(&dev->enable_cnt) > 1) in pci_enable_device_flags()
2041 if (dev->resource[i].flags & flags) in pci_enable_device_flags()
2044 if (dev->resource[i].flags & flags) in pci_enable_device_flags()
2049 atomic_dec(&dev->enable_cnt); in pci_enable_device_flags()
2054 * pci_enable_device_io - Initialize a device for use with IO space
2057 * Initialize device before it's used by a driver. Ask low-level code
2068 * pci_enable_device_mem - Initialize a device for use with Memory space
2071 * Initialize device before it's used by a driver. Ask low-level code
2082 * pci_enable_device - Initialize device before it's used by a driver.
2085 * Initialize device before it's used by a driver. Ask low-level code
2099 * Managed PCI resources. This manages device on/off, INTx/MSI/MSI-X
2100 * on/off and BAR regions. pci_dev itself records MSI/MSI-X status, so
2120 if (this->region_mask & (1 << i)) in pcim_release()
2123 if (this->mwi) in pcim_release()
2126 if (this->restore_intx) in pcim_release()
2127 pci_intx(dev, this->orig_intx); in pcim_release()
2129 if (this->enabled && !this->pinned) in pcim_release()
2137 dr = devres_find(&pdev->dev, pcim_release, NULL, NULL); in get_pci_dr()
2144 return devres_get(&pdev->dev, new_dr, NULL, NULL); in get_pci_dr()
2150 return devres_find(&pdev->dev, pcim_release, NULL, NULL); in find_pci_dr()
2155 * pcim_enable_device - Managed pci_enable_device()
2167 return -ENOMEM; in pcim_enable_device()
2168 if (dr->enabled) in pcim_enable_device()
2173 pdev->is_managed = 1; in pcim_enable_device()
2174 dr->enabled = 1; in pcim_enable_device()
2181 * pcim_pin_device - Pin managed PCI device
2193 WARN_ON(!dr || !dr->enabled); in pcim_pin_device()
2195 dr->pinned = 1; in pcim_pin_device()
2200 * pcibios_device_add - provide arch specific hooks when adding device dev
2213 * pcibios_release_device - provide arch specific hooks when releasing
2224 * pcibios_disable_device - disable arch specific PCI resources for device dev
2234 * pcibios_penalize_isa_irq - penalize an ISA IRQ
2238 * Permits the platform to provide architecture-specific functionality when
2258 * pci_disable_enabled_device - Disable device without updating enable_cnt
2271 * pci_disable_device - Disable PCI device after use
2275 * anymore. This only involves disabling PCI bus-mastering, if active.
2286 dr->enabled = 0; in pci_disable_device()
2288 dev_WARN_ONCE(&dev->dev, atomic_read(&dev->enable_cnt) <= 0, in pci_disable_device()
2289 "disabling already-disabled device"); in pci_disable_device()
2291 if (atomic_dec_return(&dev->enable_cnt) != 0) in pci_disable_device()
2296 dev->is_busmaster = 0; in pci_disable_device()
2301 * pcibios_set_pcie_reset_state - set reset state for device dev
2311 return -EINVAL; in pcibios_set_pcie_reset_state()
2315 * pci_set_pcie_reset_state - set reset state for device dev
2338 * pcie_clear_root_pme_status - Clear root port PME interrupt status.
2347 * pci_check_pme_status - Check if given device has generated PME.
2360 if (!dev->pm_cap) in pci_check_pme_status()
2363 pmcsr_pos = dev->pm_cap + PCI_PM_CTRL; in pci_check_pme_status()
2382 * pci_pme_wakeup - Wake up a PCI device if its PME Status bit is set.
2391 if (pme_poll_reset && dev->pme_poll) in pci_pme_wakeup()
2392 dev->pme_poll = false; in pci_pme_wakeup()
2396 pm_request_resume(&dev->dev); in pci_pme_wakeup()
2402 * pci_pme_wakeup_bus - Walk given bus and wake up devices on it, if necessary.
2413 * pci_pme_capable - check the capability of PCI device to generate PME#
2419 if (!dev->pm_cap) in pci_pme_capable()
2422 return !!(dev->pme_support & (1 << state)); in pci_pme_capable()
2432 struct pci_dev *pdev = pme_dev->dev; in pci_pme_list_scan()
2434 if (pdev->pme_poll) { in pci_pme_list_scan()
2435 struct pci_dev *bridge = pdev->bus->self; in pci_pme_list_scan()
2436 struct device *dev = &pdev->dev; in pci_pme_list_scan()
2437 struct device *bdev = bridge ? &bridge->dev : NULL; in pci_pme_list_scan()
2451 if (bridge->current_state != PCI_D0) in pci_pme_list_scan()
2461 pdev->current_state != PCI_D3cold) in pci_pme_list_scan()
2468 list_del(&pme_dev->list); in pci_pme_list_scan()
2482 if (!dev->pme_support) in __pci_pme_active()
2485 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in __pci_pme_active()
2491 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); in __pci_pme_active()
2495 * pci_pme_restore - Restore PME configuration after config space restore.
2502 if (!dev->pme_support) in pci_pme_restore()
2505 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); in pci_pme_restore()
2506 if (dev->wakeup_prepared) { in pci_pme_restore()
2513 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, pmcsr); in pci_pme_restore()
2517 * pci_pme_active - enable or disable PCI device's PME# function
2539 * Although PCIe uses in-band PME message instead of PME# line in pci_pme_active()
2548 if (dev->pme_poll) { in pci_pme_active()
2557 pme_dev->dev = dev; in pci_pme_active()
2559 list_add(&pme_dev->list, &pci_pme_list); in pci_pme_active()
2568 if (pme_dev->dev == dev) { in pci_pme_active()
2569 list_del(&pme_dev->list); in pci_pme_active()
2583 * __pci_enable_wake - enable PCI device as wakeup event source
2589 * When such events involves platform-specific hooks, those hooks are
2597 * -EINVAL is returned if device is not supposed to wake up the system
2599 * the native mechanism fail to enable the generation of wake-up events
2606 * Bridges that are not power-manageable directly only signal in __pci_enable_wake()
2609 * power-manageable may signal wakeup for themselves (for example, in __pci_enable_wake()
2616 if (!!enable == !!dev->wakeup_prepared) in __pci_enable_wake()
2622 * enable. To disable wake-up we call the platform first, for symmetry. in __pci_enable_wake()
2643 dev->wakeup_prepared = true; in __pci_enable_wake()
2647 dev->wakeup_prepared = false; in __pci_enable_wake()
2654 * pci_enable_wake - change wakeup settings for a PCI device
2664 if (enable && !device_may_wakeup(&pci_dev->dev)) in pci_enable_wake()
2665 return -EINVAL; in pci_enable_wake()
2672 * pci_wake_from_d3 - enable/disable device to wake up from D3_hot or D3_cold
2674 * @enable: True to enable wake-up event generation; false to disable
2677 * and this function allows them to set that up cleanly - pci_enable_wake()
2678 * should not be called twice in a row to enable wake-up due to PCI PM vs ACPI
2683 * D3_hot and D3_cold and the platform is unable to enable wake-up power for it.
2694 * pci_target_state - find an appropriate low power state for a given PCI dev
2725 * If the device is in D3cold even though it's not power-manageable by in pci_target_state()
2726 * the platform, it may have been powered down by non-standard means. in pci_target_state()
2729 if (dev->current_state == PCI_D3cold) in pci_target_state()
2731 else if (!dev->pm_cap) in pci_target_state()
2734 if (wakeup && dev->pme_support) { in pci_target_state()
2741 while (state && !(dev->pme_support & (1 << state))) in pci_target_state()
2742 state--; in pci_target_state()
2746 else if (dev->pme_support & 1) in pci_target_state()
2754 * pci_prepare_to_sleep - prepare PCI device for system-wide transition
2764 bool wakeup = device_may_wakeup(&dev->dev); in pci_prepare_to_sleep()
2769 return -EIO; in pci_prepare_to_sleep()
2783 * pci_back_from_sleep - turn PCI device on during system-wide transition
2787 * Disable device's system wake-up capability and put it into D0.
2802 * pci_finish_runtime_suspend - Carry out PCI-specific part of runtime suspend.
2805 * Prepare @dev to generate wake-up events at run time and put it into a low
2813 target_state = pci_target_state(dev, device_can_wakeup(&dev->dev)); in pci_finish_runtime_suspend()
2815 return -EIO; in pci_finish_runtime_suspend()
2828 * pci_dev_run_wake - Check if device can generate run-time wake-up events.
2831 * Return true if the device itself is capable of generating wake-up events
2833 * PME and one of its upstream bridges can generate wake-up events.
2837 struct pci_bus *bus = dev->bus; in pci_dev_run_wake()
2839 if (!dev->pme_support) in pci_dev_run_wake()
2842 /* PME-capable in principle, but not from the target power state */ in pci_dev_run_wake()
2846 if (device_can_wakeup(&dev->dev)) in pci_dev_run_wake()
2849 while (bus->parent) { in pci_dev_run_wake()
2850 struct pci_dev *bridge = bus->self; in pci_dev_run_wake()
2852 if (device_can_wakeup(&bridge->dev)) in pci_dev_run_wake()
2855 bus = bus->parent; in pci_dev_run_wake()
2859 if (bus->bridge) in pci_dev_run_wake()
2860 return device_can_wakeup(bus->bridge); in pci_dev_run_wake()
2867 * pci_dev_need_resume - Check if it is necessary to resume the device.
2870 * Return 'true' if the device is not runtime-suspended or it has to be
2873 * (system-wide) transition.
2877 struct device *dev = &pci_dev->dev; in pci_dev_need_resume()
2890 return target_state != pci_dev->current_state && in pci_dev_need_resume()
2892 pci_dev->current_state != PCI_D3hot; in pci_dev_need_resume()
2896 * pci_dev_adjust_pme - Adjust PME setting for a suspended device.
2908 struct device *dev = &pci_dev->dev; in pci_dev_adjust_pme()
2910 spin_lock_irq(&dev->power.lock); in pci_dev_adjust_pme()
2913 pci_dev->current_state < PCI_D3cold) in pci_dev_adjust_pme()
2916 spin_unlock_irq(&dev->power.lock); in pci_dev_adjust_pme()
2920 * pci_dev_complete_resume - Finalize resume from system sleep for a device.
2923 * If the device is runtime suspended and wakeup-capable, enable PME for it as
2929 struct device *dev = &pci_dev->dev; in pci_dev_complete_resume()
2934 spin_lock_irq(&dev->power.lock); in pci_dev_complete_resume()
2936 if (pm_runtime_suspended(dev) && pci_dev->current_state < PCI_D3cold) in pci_dev_complete_resume()
2939 spin_unlock_irq(&dev->power.lock); in pci_dev_complete_resume()
2943 * pci_choose_state - Choose the power state of a PCI device.
2960 struct device *dev = &pdev->dev; in pci_config_pm_runtime_get()
2961 struct device *parent = dev->parent; in pci_config_pm_runtime_get()
2967 * pdev->current_state is set to PCI_D3cold during suspending, in pci_config_pm_runtime_get()
2976 if (pdev->current_state == PCI_D3cold) in pci_config_pm_runtime_get()
2982 struct device *dev = &pdev->dev; in pci_config_pm_runtime_put()
2983 struct device *parent = dev->parent; in pci_config_pm_runtime_put()
2999 .ident = "X299 DESIGNARE EX-CF",
3002 DMI_MATCH(DMI_BOARD_NAME, "X299 DESIGNARE EX-CF"),
3022 * pci_bridge_d3_possible - Is it possible to put the bridge into D3
3042 * may not be put into D3 by the OS (Thunderbolt on non-Macs). in pci_bridge_d3_possible()
3044 if (bridge->is_hotplug_bridge && !pciehp_is_native(bridge)) in pci_bridge_d3_possible()
3051 if (bridge->is_thunderbolt) in pci_bridge_d3_possible()
3063 if (bridge->is_hotplug_bridge) in pci_bridge_d3_possible()
3086 dev->no_d3cold || !dev->d3cold_allowed || in pci_dev_check_d3cold()
3089 (device_may_wakeup(&dev->dev) && in pci_dev_check_d3cold()
3101 * pci_bridge_d3_update - Update bridge D3 capabilities
3110 bool remove = !device_is_registered(&dev->dev); in pci_bridge_d3_update()
3122 if (remove && bridge->bridge_d3) in pci_bridge_d3_update()
3142 if (d3cold_ok && !bridge->bridge_d3) in pci_bridge_d3_update()
3143 pci_walk_bus(bridge->subordinate, pci_dev_check_d3cold, in pci_bridge_d3_update()
3146 if (bridge->bridge_d3 != d3cold_ok) { in pci_bridge_d3_update()
3147 bridge->bridge_d3 = d3cold_ok; in pci_bridge_d3_update()
3154 * pci_d3cold_enable - Enable D3cold for device
3163 if (dev->no_d3cold) { in pci_d3cold_enable()
3164 dev->no_d3cold = false; in pci_d3cold_enable()
3171 * pci_d3cold_disable - Disable D3cold for device
3180 if (!dev->no_d3cold) { in pci_d3cold_disable()
3181 dev->no_d3cold = true; in pci_d3cold_disable()
3188 * pci_pm_init - Initialize PM functions of given PCI device
3197 pm_runtime_forbid(&dev->dev); in pci_pm_init()
3198 pm_runtime_set_active(&dev->dev); in pci_pm_init()
3199 pm_runtime_enable(&dev->dev); in pci_pm_init()
3200 device_enable_async_suspend(&dev->dev); in pci_pm_init()
3201 dev->wakeup_prepared = false; in pci_pm_init()
3203 dev->pm_cap = 0; in pci_pm_init()
3204 dev->pme_support = 0; in pci_pm_init()
3219 dev->pm_cap = pm; in pci_pm_init()
3220 dev->d3hot_delay = PCI_PM_D3HOT_WAIT; in pci_pm_init()
3221 dev->d3cold_delay = PCI_PM_D3COLD_WAIT; in pci_pm_init()
3222 dev->bridge_d3 = pci_bridge_d3_possible(dev); in pci_pm_init()
3223 dev->d3cold_allowed = true; in pci_pm_init()
3225 dev->d1_support = false; in pci_pm_init()
3226 dev->d2_support = false; in pci_pm_init()
3229 dev->d1_support = true; in pci_pm_init()
3231 dev->d2_support = true; in pci_pm_init()
3233 if (dev->d1_support || dev->d2_support) in pci_pm_init()
3235 dev->d1_support ? " D1" : "", in pci_pm_init()
3236 dev->d2_support ? " D2" : ""); in pci_pm_init()
3247 dev->pme_support = pmc >> PCI_PM_CAP_PME_SHIFT; in pci_pm_init()
3248 dev->pme_poll = true; in pci_pm_init()
3250 * Make device's PM flags reflect the wake-up capability, but in pci_pm_init()
3253 device_set_wakeup_capable(&dev->dev, true); in pci_pm_init()
3260 dev->imm_ready = 1; in pci_pm_init()
3290 return &dev->resource[bei]; in pci_ea_get_resource()
3294 return &dev->resource[PCI_IOV_RESOURCES + in pci_ea_get_resource()
3295 bei - PCI_EA_BEI_VF_BAR0]; in pci_ea_get_resource()
3298 return &dev->resource[PCI_ROM_RESOURCE]; in pci_ea_get_resource()
3356 /* Read Base MSBs (if 64-bit entry) */ in pci_ea_read()
3365 /* entry starts above 32-bit boundary, can't use */ in pci_ea_read()
3375 /* Read MaxOffset MSBs (if 64-bit entry) */ in pci_ea_read()
3397 if (ent_size != ent_offset - offset) { in pci_ea_read()
3399 ent_size, ent_offset - offset); in pci_ea_read()
3403 res->name = pci_name(dev); in pci_ea_read()
3404 res->start = start; in pci_ea_read()
3405 res->end = end; in pci_ea_read()
3406 res->flags = flags; in pci_ea_read()
3416 bei - PCI_EA_BEI_VF_BAR0, res, prop); in pci_ea_read()
3439 pci_bus_read_config_byte(dev->bus, dev->devfn, ea + PCI_EA_NUM_ENT, in pci_ea_init()
3446 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) in pci_ea_init()
3457 hlist_add_head(&new_cap->next, &pci_dev->saved_cap_space); in pci_add_saved_cap()
3461 * _pci_add_cap_save_buffer - allocate buffer for saving given
3484 return -ENOMEM; in _pci_add_cap_save_buffer()
3486 save_state->cap.cap_nr = cap; in _pci_add_cap_save_buffer()
3487 save_state->cap.cap_extended = extended; in _pci_add_cap_save_buffer()
3488 save_state->cap.size = size; in _pci_add_cap_save_buffer()
3505 * pci_allocate_cap_save_buffers - allocate buffers for saving capabilities
3519 pci_err(dev, "unable to preallocate PCI-X save buffer\n"); in pci_allocate_cap_save_buffers()
3534 hlist_for_each_entry_safe(tmp, n, &dev->saved_cap_space, next) in pci_free_cap_save_buffers()
3539 * pci_configure_ari - enable or disable ARI forwarding
3550 if (pcie_ari_disabled || !pci_is_pcie(dev) || dev->devfn) in pci_configure_ari()
3553 bridge = dev->bus->self; in pci_configure_ari()
3564 bridge->ari_enabled = 1; in pci_configure_ari()
3568 bridge->ari_enabled = 0; in pci_configure_ari()
3577 pos = pdev->acs_cap; in pci_acs_flags_enabled()
3584 * capability field can therefore be assumed as hard-wired enabled. in pci_acs_flags_enabled()
3594 * pci_acs_enabled - test ACS against required flags for a given device
3604 * opportunity for peer-to-peer access. We therefore return 'true'
3618 * Conventional PCI and PCI-X devices never support ACS, either in pci_acs_enabled()
3627 * PCI/X-to-PCIe bridges are not specifically mentioned by the spec, in pci_acs_enabled()
3629 * handle them as we would a non-PCIe device. in pci_acs_enabled()
3643 * implement ACS in order to indicate their peer-to-peer capabilities, in pci_acs_enabled()
3644 * regardless of whether they are single- or multi-function devices. in pci_acs_enabled()
3651 * implemented by the remaining PCIe types to indicate peer-to-peer in pci_acs_enabled()
3660 if (!pdev->multifunction) in pci_acs_enabled()
3674 * pci_acs_path_enabled - test ACS flags from start to end in a hierarchy
3693 if (pci_is_root_bus(pdev->bus)) in pci_acs_path_enabled()
3696 parent = pdev->bus->self; in pci_acs_path_enabled()
3703 * pci_acs_init - Initialize ACS if hardware supports it
3708 dev->acs_cap = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ACS); in pci_acs_init()
3720 * pci_rebar_find_pos - find position of resize ctrl reg for BAR
3725 * Returns -ENOTSUPP if resizable BARs are not supported at all.
3726 * Returns -ENOENT if no ctrl register for the BAR could be found.
3735 return -ENOTSUPP; in pci_rebar_find_pos()
3750 return -ENOENT; in pci_rebar_find_pos()
3754 * pci_rebar_get_possible_sizes - get possible sizes for BAR
3774 if (pdev->vendor == PCI_VENDOR_ID_ATI && pdev->device == 0x731f && in pci_rebar_get_possible_sizes()
3783 * pci_rebar_get_current_size - get the current size of a BAR
3804 * pci_rebar_set_size - set a new size for a BAR
3829 * pci_enable_atomic_ops_to_root - enable AtomicOp requests to root port
3838 * the requested completion capabilities (32-bit, 64-bit and/or 128-bit
3843 struct pci_bus *bus = dev->bus; in pci_enable_atomic_ops_to_root()
3852 if (dev->is_virtfn) in pci_enable_atomic_ops_to_root()
3853 return -EINVAL; in pci_enable_atomic_ops_to_root()
3856 return -EINVAL; in pci_enable_atomic_ops_to_root()
3862 * completers, and no peer-to-peer. in pci_enable_atomic_ops_to_root()
3871 return -EINVAL; in pci_enable_atomic_ops_to_root()
3874 while (bus->parent) { in pci_enable_atomic_ops_to_root()
3875 bridge = bus->self; in pci_enable_atomic_ops_to_root()
3884 return -EINVAL; in pci_enable_atomic_ops_to_root()
3890 return -EINVAL; in pci_enable_atomic_ops_to_root()
3899 return -EINVAL; in pci_enable_atomic_ops_to_root()
3902 bus = bus->parent; in pci_enable_atomic_ops_to_root()
3912 * pci_swizzle_interrupt_pin - swizzle INTx for device behind bridge
3917 * required by section 9.1 of the PCI-to-PCI bridge specification for devices
3918 * behind bridges on add-in cards. For devices with ARI enabled, the slot
3926 if (pci_ari_enabled(dev->bus)) in pci_swizzle_interrupt_pin()
3929 slot = PCI_SLOT(dev->devfn); in pci_swizzle_interrupt_pin()
3931 return (((pin - 1) + slot) % 4) + 1; in pci_swizzle_interrupt_pin()
3938 pin = dev->pin; in pci_get_interrupt_pin()
3940 return -1; in pci_get_interrupt_pin()
3942 while (!pci_is_root_bus(dev->bus)) { in pci_get_interrupt_pin()
3944 dev = dev->bus->self; in pci_get_interrupt_pin()
3951 * pci_common_swizzle - swizzle INTx all the way to root bridge
3955 * Perform INTx swizzling for a device. This traverses through all PCI-to-PCI
3962 while (!pci_is_root_bus(dev->bus)) { in pci_common_swizzle()
3964 dev = dev->bus->self; in pci_common_swizzle()
3967 return PCI_SLOT(dev->devfn); in pci_common_swizzle()
3972 * pci_release_region - Release a PCI bar
3996 dr->region_mask &= ~(1 << bar); in pci_release_region()
4001 * __pci_request_region - Reserved PCI I/O and memory resource
4040 dr->region_mask |= 1 << bar; in __pci_request_region()
4046 &pdev->resource[bar]); in __pci_request_region()
4047 return -EBUSY; in __pci_request_region()
4051 * pci_request_region - Reserve PCI I/O and memory resource
4071 * pci_release_selected_regions - Release selected PCI I/O and memory resources
4100 while (--i >= 0) in __pci_request_selected_regions()
4104 return -EBUSY; in __pci_request_selected_regions()
4109 * pci_request_selected_regions - Reserve selected PCI I/O and memory resources
4130 * pci_release_regions - Release reserved PCI I/O and memory resources
4141 pci_release_selected_regions(pdev, (1 << PCI_STD_NUM_BARS) - 1); in pci_release_regions()
4146 * pci_request_regions - Reserve PCI I/O and memory resources
4161 ((1 << PCI_STD_NUM_BARS) - 1), res_name); in pci_request_regions()
4166 * pci_request_regions_exclusive - Reserve PCI I/O and memory resources
4183 ((1 << PCI_STD_NUM_BARS) - 1), res_name); in pci_request_regions_exclusive()
4199 return -EINVAL; in pci_register_io_range()
4203 return -ENOMEM; in pci_register_io_range()
4205 range->fwnode = fwnode; in pci_register_io_range()
4206 range->size = size; in pci_register_io_range()
4207 range->hw_start = addr; in pci_register_io_range()
4208 range->flags = LOGIC_PIO_CPU_MMIO; in pci_register_io_range()
4215 if (ret == -EEXIST) in pci_register_io_range()
4239 return (unsigned long)-1; in pci_address_to_pio()
4246 * pci_remap_iospace - Remap the memory mapped I/O space
4259 unsigned long vaddr = (unsigned long)PCI_IOBASE + res->start; in pci_remap_iospace()
4261 if (!(res->flags & IORESOURCE_IO)) in pci_remap_iospace()
4262 return -EINVAL; in pci_remap_iospace()
4264 if (res->end > IO_SPACE_LIMIT) in pci_remap_iospace()
4265 return -EINVAL; in pci_remap_iospace()
4275 return -ENODEV; in pci_remap_iospace()
4282 * pci_unmap_iospace - Unmap the memory mapped I/O space
4292 unsigned long vaddr = (unsigned long)PCI_IOBASE + res->start; in pci_unmap_iospace()
4307 * devm_pci_remap_iospace - Managed pci_remap_iospace()
4323 return -ENOMEM; in devm_pci_remap_iospace()
4338 * devm_pci_remap_cfgspace - Managed pci_remap_cfgspace()
4368 * devm_pci_remap_cfg_resource - check, request region and ioremap cfg resource
4382 * base = devm_pci_remap_cfg_resource(&pdev->dev, res);
4397 return IOMEM_ERR_PTR(-EINVAL); in devm_pci_remap_cfg_resource()
4402 if (res->name) in devm_pci_remap_cfg_resource()
4404 res->name); in devm_pci_remap_cfg_resource()
4408 return IOMEM_ERR_PTR(-ENOMEM); in devm_pci_remap_cfg_resource()
4410 if (!devm_request_mem_region(dev, res->start, size, name)) { in devm_pci_remap_cfg_resource()
4412 return IOMEM_ERR_PTR(-EBUSY); in devm_pci_remap_cfg_resource()
4415 dest_ptr = devm_pci_remap_cfgspace(dev, res->start, size); in devm_pci_remap_cfg_resource()
4418 devm_release_mem_region(dev, res->start, size); in devm_pci_remap_cfg_resource()
4419 dest_ptr = IOMEM_ERR_PTR(-ENOMEM); in devm_pci_remap_cfg_resource()
4428 u16 old_cmd, cmd; in __pci_set_master() local
4432 cmd = old_cmd | PCI_COMMAND_MASTER; in __pci_set_master()
4434 cmd = old_cmd & ~PCI_COMMAND_MASTER; in __pci_set_master()
4435 if (cmd != old_cmd) { in __pci_set_master()
4438 pci_write_config_word(dev, PCI_COMMAND, cmd); in __pci_set_master()
4440 dev->is_busmaster = enable; in __pci_set_master()
4444 * pcibios_setup - process "pci=" kernel boot arguments
4456 * pcibios_set_master - enable PCI bus-mastering for device dev
4459 * Enables PCI bus-mastering for the device. This is the default
4483 * pci_set_master - enables bus-mastering for device dev
4486 * Enables bus-mastering on the device and calls pcibios_set_master()
4497 * pci_clear_master - disables bus-mastering for device dev
4507 * pci_set_cacheline_size - ensure the CACHE_LINE_SIZE register is programmed
4512 * Copyright 1998-2001 by Jes Sorensen, <jes@trained-monkey.org>.
4514 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
4521 return -EINVAL; in pci_set_cacheline_size()
4540 return -EINVAL; in pci_set_cacheline_size()
4545 * pci_set_mwi - enables memory-write-invalidate PCI transaction
4548 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
4550 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
4558 u16 cmd; in pci_set_mwi()
4564 pci_read_config_word(dev, PCI_COMMAND, &cmd); in pci_set_mwi()
4565 if (!(cmd & PCI_COMMAND_INVALIDATE)) { in pci_set_mwi()
4566 pci_dbg(dev, "enabling Mem-Wr-Inval\n"); in pci_set_mwi()
4567 cmd |= PCI_COMMAND_INVALIDATE; in pci_set_mwi()
4568 pci_write_config_word(dev, PCI_COMMAND, cmd); in pci_set_mwi()
4576 * pcim_set_mwi - a device-managed pci_set_mwi()
4581 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
4589 return -ENOMEM; in pcim_set_mwi()
4591 dr->mwi = 1; in pcim_set_mwi()
4597 * pci_try_set_mwi - enables memory-write-invalidate PCI transaction
4600 * Enables the Memory-Write-Invalidate transaction in %PCI_COMMAND.
4603 * RETURNS: An appropriate -ERRNO error value on error, or zero for success.
4616 * pci_clear_mwi - disables Memory-Write-Invalidate for device dev
4619 * Disables PCI Memory-Write-Invalidate transaction on the device
4624 u16 cmd; in pci_clear_mwi() local
4626 pci_read_config_word(dev, PCI_COMMAND, &cmd); in pci_clear_mwi()
4627 if (cmd & PCI_COMMAND_INVALIDATE) { in pci_clear_mwi()
4628 cmd &= ~PCI_COMMAND_INVALIDATE; in pci_clear_mwi()
4629 pci_write_config_word(dev, PCI_COMMAND, cmd); in pci_clear_mwi()
4636 * pci_disable_parity - disable parity checking for device
4643 u16 cmd; in pci_disable_parity() local
4645 pci_read_config_word(dev, PCI_COMMAND, &cmd); in pci_disable_parity()
4646 if (cmd & PCI_COMMAND_PARITY) { in pci_disable_parity()
4647 cmd &= ~PCI_COMMAND_PARITY; in pci_disable_parity()
4648 pci_write_config_word(dev, PCI_COMMAND, cmd); in pci_disable_parity()
4653 * pci_intx - enables/disables PCI INTx for device dev
4676 if (dr && !dr->restore_intx) { in pci_intx()
4677 dr->restore_intx = 1; in pci_intx()
4678 dr->orig_intx = !enable; in pci_intx()
4686 struct pci_bus *bus = dev->bus; in pci_check_and_set_intx_mask()
4702 bus->ops->read(bus, dev->devfn, PCI_COMMAND, 4, &cmd_status_dword); in pci_check_and_set_intx_mask()
4721 bus->ops->write(bus, dev->devfn, PCI_COMMAND, 2, newcmd); in pci_check_and_set_intx_mask()
4730 * pci_check_and_mask_intx - mask INTx on pending interrupt
4743 * pci_check_and_unmask_intx - unmask INTx if no interrupt is pending
4757 * pci_wait_for_pending_transaction - wait for pending transaction
4773 * pcie_flr - initiate a PCIe function level reset
4786 if (dev->imm_ready) in pcie_flr()
4801 * pcie_reset_flr - initiate a PCIe function level reset
4809 if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET) in pcie_reset_flr()
4810 return -ENOTTY; in pcie_reset_flr()
4812 if (!(dev->devcap & PCI_EXP_DEVCAP_FLR)) in pcie_reset_flr()
4813 return -ENOTTY; in pcie_reset_flr()
4829 return -ENOTTY; in pci_af_flr()
4831 if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET) in pci_af_flr()
4832 return -ENOTTY; in pci_af_flr()
4836 return -ENOTTY; in pci_af_flr()
4842 * Wait for Transaction Pending bit to clear. A word-aligned test in pci_af_flr()
4852 if (dev->imm_ready) in pci_af_flr()
4867 * pci_pm_reset - Put device into PCI_D3 and back into PCI_D0.
4873 * PCI_D0. If that's the case and the device is not in a low-power state
4877 * cooldown period, which for the D0->D3hot and D3hot->D0 transitions is 10 ms
4885 if (!dev->pm_cap || dev->dev_flags & PCI_DEV_FLAGS_NO_PM_RESET) in pci_pm_reset()
4886 return -ENOTTY; in pci_pm_reset()
4888 pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &csr); in pci_pm_reset()
4890 return -ENOTTY; in pci_pm_reset()
4895 if (dev->current_state != PCI_D0) in pci_pm_reset()
4896 return -EINVAL; in pci_pm_reset()
4900 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); in pci_pm_reset()
4905 pci_write_config_word(dev, dev->pm_cap + PCI_PM_CTRL, csr); in pci_pm_reset()
4908 return pci_dev_wait(dev, "PM D3hot->D0", PCIE_RESET_READY_POLL_MS); in pci_pm_reset()
4912 * pcie_wait_for_link_status - Wait for link status change
4917 * Return 0 if successful, or -ETIMEDOUT if status has not changed within
4938 return -ETIMEDOUT; in pcie_wait_for_link_status()
4942 * pcie_retrain_link - Request a link retrain and wait for it to complete
4950 * Return 0 if successful, or -ETIMEDOUT if training has not completed
4968 if (pdev->clear_retrain_link) { in pcie_retrain_link()
4981 * pcie_wait_for_link_delay - Wait until link is active or inactive
4997 if (!pdev->link_active_reporting) { in pcie_wait_for_link_delay()
5031 * pcie_wait_for_link - Wait until link is active or inactive
5055 list_for_each_entry(pdev, &bus->devices, bus_list) { in pci_bus_max_d3cold_delay()
5056 if (pdev->d3cold_delay < min_delay) in pci_bus_max_d3cold_delay()
5057 min_delay = pdev->d3cold_delay; in pci_bus_max_d3cold_delay()
5058 if (pdev->d3cold_delay > max_delay) in pci_bus_max_d3cold_delay()
5059 max_delay = pdev->d3cold_delay; in pci_bus_max_d3cold_delay()
5066 * pci_bridge_wait_for_secondary_bus - Wait for secondary bus to be accessible
5068 * @reset_type: reset type in human-readable form
5078 * Return 0 on success or -ENOTTY if the first device on the secondary bus
5096 * For any hot-added devices the access delay is handled in pciehp in pci_bridge_wait_for_secondary_bus()
5100 if (!dev->subordinate || list_empty(&dev->subordinate->devices)) { in pci_bridge_wait_for_secondary_bus()
5106 delay = pci_bus_max_d3cold_delay(dev->subordinate); in pci_bridge_wait_for_secondary_bus()
5112 child = list_first_entry(&dev->subordinate->devices, struct pci_dev, in pci_bridge_wait_for_secondary_bus()
5117 * Conventional PCI and PCI-X we need to wait Tpvrh + Trhfa before in pci_bridge_wait_for_secondary_bus()
5134 * device that did not respond is a broken device. Also device can in pci_bridge_wait_for_secondary_bus()
5150 if (!pci_dev_wait(child, reset_type, PCI_RESET_WAIT - delay)) in pci_bridge_wait_for_secondary_bus()
5158 if (!dev->link_active_reporting) in pci_bridge_wait_for_secondary_bus()
5159 return -ENOTTY; in pci_bridge_wait_for_secondary_bus()
5163 return -ENOTTY; in pci_bridge_wait_for_secondary_bus()
5166 PCIE_RESET_READY_POLL_MS - PCI_RESET_WAIT); in pci_bridge_wait_for_secondary_bus()
5174 return -ENOTTY; in pci_bridge_wait_for_secondary_bus()
5178 PCIE_RESET_READY_POLL_MS - delay); in pci_bridge_wait_for_secondary_bus()
5205 * pci_bridge_secondary_bus_reset - Reset the secondary bus on a PCI bridge.
5209 * Devices on the secondary bus are left in power-on state.
5223 if (pci_is_root_bus(dev->bus) || dev->subordinate || in pci_parent_bus_reset()
5224 !dev->bus->self || dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) in pci_parent_bus_reset()
5225 return -ENOTTY; in pci_parent_bus_reset()
5227 list_for_each_entry(pdev, &dev->bus->devices, bus_list) in pci_parent_bus_reset()
5229 return -ENOTTY; in pci_parent_bus_reset()
5234 return pci_bridge_secondary_bus_reset(dev->bus->self); in pci_parent_bus_reset()
5239 int rc = -ENOTTY; in pci_reset_hotplug_slot()
5241 if (!hotplug || !try_module_get(hotplug->owner)) in pci_reset_hotplug_slot()
5244 if (hotplug->ops->reset_slot) in pci_reset_hotplug_slot()
5245 rc = hotplug->ops->reset_slot(hotplug, probe); in pci_reset_hotplug_slot()
5247 module_put(hotplug->owner); in pci_reset_hotplug_slot()
5254 if (dev->multifunction || dev->subordinate || !dev->slot || in pci_dev_reset_slot_function()
5255 dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET) in pci_dev_reset_slot_function()
5256 return -ENOTTY; in pci_dev_reset_slot_function()
5258 return pci_reset_hotplug_slot(dev->slot->hotplug, probe); in pci_dev_reset_slot_function()
5266 if (rc != -ENOTTY) in pci_reset_bus_function()
5274 device_lock(&dev->dev); in pci_dev_lock()
5282 if (device_trylock(&dev->dev)) { in pci_dev_trylock()
5285 device_unlock(&dev->dev); in pci_dev_trylock()
5295 device_unlock(&dev->dev); in pci_dev_unlock()
5302 dev->driver ? dev->driver->err_handler : NULL; in pci_dev_save_and_disable()
5305 * dev->driver->err_handler->reset_prepare() is protected against in pci_dev_save_and_disable()
5306 * races with ->remove() by the device lock, which must be held by in pci_dev_save_and_disable()
5309 if (err_handler && err_handler->reset_prepare) in pci_dev_save_and_disable()
5310 err_handler->reset_prepare(dev); in pci_dev_save_and_disable()
5313 * Wake-up device prior to save. PM registers default to D0 after in pci_dev_save_and_disable()
5315 * to a non-D0 state anyway. in pci_dev_save_and_disable()
5322 * INTx-disable which is set. This not only disables MMIO and I/O port in pci_dev_save_and_disable()
5324 * DMA from the device including MSI/MSI-X interrupts. For PCI 2.3 in pci_dev_save_and_disable()
5325 * compliant devices, INTx-disable prevents legacy interrupts. in pci_dev_save_and_disable()
5333 dev->driver ? dev->driver->err_handler : NULL; in pci_dev_restore()
5338 * dev->driver->err_handler->reset_done() is protected against in pci_dev_restore()
5339 * races with ->remove() by the device lock, which must be held by in pci_dev_restore()
5342 if (err_handler && err_handler->reset_done) in pci_dev_restore()
5343 err_handler->reset_done(dev); in pci_dev_restore()
5346 /* dev->reset_methods[] is a 0-terminated list of indices into this array */
5365 m = pdev->reset_methods[i]; in reset_method_show()
5401 pdev->reset_methods[0] = 0; in reset_method_store()
5413 return -ENOMEM; in reset_method_store()
5433 if (n == PCI_NUM_RESET_METHODS - 1) { in reset_method_store()
5443 /* Warn if dev-specific supported but not highest priority */ in reset_method_store()
5446 pci_warn(pdev, "Device-specific reset disabled/de-prioritized by user"); in reset_method_store()
5447 memcpy(pdev->reset_methods, reset_methods, sizeof(pdev->reset_methods)); in reset_method_store()
5454 return -EINVAL; in reset_method_store()
5471 return a->mode; in pci_dev_reset_method_attr_is_visible()
5480 * __pci_reset_function_locked - reset a PCI device function while holding
5506 * A reset method returns -ENOTTY if it doesn't support this device and in __pci_reset_function_locked()
5511 * mechanisms might be broken on the device. in __pci_reset_function_locked()
5514 m = dev->reset_methods[i]; in __pci_reset_function_locked()
5516 return -ENOTTY; in __pci_reset_function_locked()
5521 if (rc != -ENOTTY) in __pci_reset_function_locked()
5525 return -ENOTTY; in __pci_reset_function_locked()
5530 * pci_init_reset_methods - check whether device can be safely reset
5535 * other functions in the same device. The PCI device must be in D0-D3hot
5553 dev->reset_methods[i++] = m; in pci_init_reset_methods()
5554 else if (rc != -ENOTTY) in pci_init_reset_methods()
5558 dev->reset_methods[i] = 0; in pci_init_reset_methods()
5562 * pci_reset_function - quiesce and reset a PCI device function
5582 return -ENOTTY; in pci_reset_function()
5597 * pci_reset_function_locked - quiesce and reset a PCI device function
5618 return -ENOTTY; in pci_reset_function_locked()
5631 * pci_try_reset_function - quiesce and reset a PCI device function
5634 * Same as above, except return -EAGAIN if unable to lock device.
5641 return -ENOTTY; in pci_try_reset_function()
5644 return -EAGAIN; in pci_try_reset_function()
5661 if (bus->self && (bus->self->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)) in pci_bus_resettable()
5664 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_resettable()
5665 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || in pci_bus_resettable()
5666 (dev->subordinate && !pci_bus_resettable(dev->subordinate))) in pci_bus_resettable()
5678 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_lock()
5680 if (dev->subordinate) in pci_bus_lock()
5681 pci_bus_lock(dev->subordinate); in pci_bus_lock()
5690 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_unlock()
5691 if (dev->subordinate) in pci_bus_unlock()
5692 pci_bus_unlock(dev->subordinate); in pci_bus_unlock()
5702 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_trylock()
5705 if (dev->subordinate) { in pci_bus_trylock()
5706 if (!pci_bus_trylock(dev->subordinate)) { in pci_bus_trylock()
5715 list_for_each_entry_continue_reverse(dev, &bus->devices, bus_list) { in pci_bus_trylock()
5716 if (dev->subordinate) in pci_bus_trylock()
5717 pci_bus_unlock(dev->subordinate); in pci_bus_trylock()
5728 if (slot->bus->self && in pci_slot_resettable()
5729 (slot->bus->self->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET)) in pci_slot_resettable()
5732 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_resettable()
5733 if (!dev->slot || dev->slot != slot) in pci_slot_resettable()
5735 if (dev->dev_flags & PCI_DEV_FLAGS_NO_BUS_RESET || in pci_slot_resettable()
5736 (dev->subordinate && !pci_bus_resettable(dev->subordinate))) in pci_slot_resettable()
5748 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_lock()
5749 if (!dev->slot || dev->slot != slot) in pci_slot_lock()
5752 if (dev->subordinate) in pci_slot_lock()
5753 pci_bus_lock(dev->subordinate); in pci_slot_lock()
5762 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_unlock()
5763 if (!dev->slot || dev->slot != slot) in pci_slot_unlock()
5765 if (dev->subordinate) in pci_slot_unlock()
5766 pci_bus_unlock(dev->subordinate); in pci_slot_unlock()
5776 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_trylock()
5777 if (!dev->slot || dev->slot != slot) in pci_slot_trylock()
5781 if (dev->subordinate) { in pci_slot_trylock()
5782 if (!pci_bus_trylock(dev->subordinate)) { in pci_slot_trylock()
5792 &slot->bus->devices, bus_list) { in pci_slot_trylock()
5793 if (!dev->slot || dev->slot != slot) in pci_slot_trylock()
5795 if (dev->subordinate) in pci_slot_trylock()
5796 pci_bus_unlock(dev->subordinate); in pci_slot_trylock()
5810 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_save_and_disable_locked()
5812 if (dev->subordinate) in pci_bus_save_and_disable_locked()
5813 pci_bus_save_and_disable_locked(dev->subordinate); in pci_bus_save_and_disable_locked()
5826 list_for_each_entry(dev, &bus->devices, bus_list) { in pci_bus_restore_locked()
5828 if (dev->subordinate) in pci_bus_restore_locked()
5829 pci_bus_restore_locked(dev->subordinate); in pci_bus_restore_locked()
5841 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_save_and_disable_locked()
5842 if (!dev->slot || dev->slot != slot) in pci_slot_save_and_disable_locked()
5845 if (dev->subordinate) in pci_slot_save_and_disable_locked()
5846 pci_bus_save_and_disable_locked(dev->subordinate); in pci_slot_save_and_disable_locked()
5859 list_for_each_entry(dev, &slot->bus->devices, bus_list) { in pci_slot_restore_locked()
5860 if (!dev->slot || dev->slot != slot) in pci_slot_restore_locked()
5863 if (dev->subordinate) in pci_slot_restore_locked()
5864 pci_bus_restore_locked(dev->subordinate); in pci_slot_restore_locked()
5873 return -ENOTTY; in pci_slot_reset()
5880 rc = pci_reset_hotplug_slot(slot->hotplug, probe); in pci_slot_reset()
5889 * pci_probe_reset_slot - probe whether a PCI slot can be reset
5901 * __pci_reset_slot - Try to reset a PCI slot
5913 * Same as above except return -EAGAIN if the slot cannot be locked
5926 rc = pci_reset_hotplug_slot(slot->hotplug, PCI_RESET_DO_RESET); in __pci_reset_slot()
5930 rc = -EAGAIN; in __pci_reset_slot()
5939 if (!bus->self || !pci_bus_resettable(bus)) in pci_bus_reset()
5940 return -ENOTTY; in pci_bus_reset()
5949 ret = pci_bridge_secondary_bus_reset(bus->self); in pci_bus_reset()
5957 * pci_bus_error_reset - reset the bridge's subordinate bus
5966 struct pci_bus *bus = bridge->subordinate; in pci_bus_error_reset()
5970 return -ENOTTY; in pci_bus_error_reset()
5973 if (list_empty(&bus->slots)) in pci_bus_error_reset()
5976 list_for_each_entry(slot, &bus->slots, list) in pci_bus_error_reset()
5980 list_for_each_entry(slot, &bus->slots, list) in pci_bus_error_reset()
5988 return pci_bus_reset(bridge->subordinate, PCI_RESET_DO_RESET); in pci_bus_error_reset()
5992 * pci_probe_reset_bus - probe whether a PCI bus can be reset
6004 * __pci_reset_bus - Try to reset a PCI bus
6007 * Same as above except return -EAGAIN if the bus cannot be locked
6020 rc = pci_bridge_secondary_bus_reset(bus->self); in __pci_reset_bus()
6024 rc = -EAGAIN; in __pci_reset_bus()
6030 * pci_reset_bus - Try to reset a PCI bus
6033 * Same as above except return -EAGAIN if the bus cannot be locked
6037 return (!pci_probe_reset_slot(pdev->slot)) ? in pci_reset_bus()
6038 __pci_reset_slot(pdev->slot) : __pci_reset_bus(pdev->bus); in pci_reset_bus()
6043 * pcix_get_max_mmrbc - get PCI-X maximum designed memory read byte count
6056 return -EINVAL; in pcix_get_max_mmrbc()
6059 return -EINVAL; in pcix_get_max_mmrbc()
6066 * pcix_get_mmrbc - get PCI-X maximum memory read byte count
6075 u16 cmd; in pcix_get_mmrbc() local
6079 return -EINVAL; in pcix_get_mmrbc()
6081 if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) in pcix_get_mmrbc()
6082 return -EINVAL; in pcix_get_mmrbc()
6084 return 512 << ((cmd & PCI_X_CMD_MAX_READ) >> 2); in pcix_get_mmrbc()
6089 * pcix_set_mmrbc - set PCI-X maximum memory read byte count
6101 u16 cmd; in pcix_set_mmrbc() local
6104 return -EINVAL; in pcix_set_mmrbc()
6106 v = ffs(mmrbc) - 10; in pcix_set_mmrbc()
6110 return -EINVAL; in pcix_set_mmrbc()
6113 return -EINVAL; in pcix_set_mmrbc()
6116 return -E2BIG; in pcix_set_mmrbc()
6118 if (pci_read_config_word(dev, cap + PCI_X_CMD, &cmd)) in pcix_set_mmrbc()
6119 return -EINVAL; in pcix_set_mmrbc()
6121 o = (cmd & PCI_X_CMD_MAX_READ) >> 2; in pcix_set_mmrbc()
6123 if (v > o && (dev->bus->bus_flags & PCI_BUS_FLAGS_NO_MMRBC)) in pcix_set_mmrbc()
6124 return -EIO; in pcix_set_mmrbc()
6126 cmd &= ~PCI_X_CMD_MAX_READ; in pcix_set_mmrbc()
6127 cmd |= v << 2; in pcix_set_mmrbc()
6128 if (pci_write_config_word(dev, cap + PCI_X_CMD, cmd)) in pcix_set_mmrbc()
6129 return -EIO; in pcix_set_mmrbc()
6136 * pcie_get_readrq - get PCI Express read request size
6152 * pcie_set_readrq - set PCI Express maximum memory read request
6163 struct pci_host_bridge *bridge = pci_find_host_bridge(dev->bus); in pcie_set_readrq()
6166 return -EINVAL; in pcie_set_readrq()
6180 v = (ffs(rq) - 8) << 12; in pcie_set_readrq()
6182 if (bridge->no_inc_mrrs) { in pcie_set_readrq()
6187 return -EINVAL; in pcie_set_readrq()
6199 * pcie_get_mps - get PCI Express maximum payload size
6215 * pcie_set_mps - set PCI Express maximum payload size
6228 return -EINVAL; in pcie_set_mps()
6230 v = ffs(mps) - 8; in pcie_set_mps()
6231 if (v > dev->pcie_mpss) in pcie_set_mps()
6232 return -EINVAL; in pcie_set_mps()
6243 * pcie_bandwidth_available - determine minimum link settings of a PCIe
6300 * pcie_get_speed_cap - query for the PCI device's link speed capability
6321 /* PCIe r3.0-compliant */ in pcie_get_speed_cap()
6336 * pcie_get_width_cap - query for the PCI device's link width capability
6355 * pcie_bandwidth_capable - calculate a PCI device's link bandwidth capability
6377 * __pcie_print_link_status - Report the PCI device's link speed and width
6410 * pcie_print_link_status - Report the PCI device's link speed and width
6422 * pci_select_bars - Make BAR mask from the type of resource
6456 * pci_set_vga_state - set VGA decode state on device and parents if requested
6468 u16 cmd; in pci_set_vga_state() local
6479 pci_read_config_word(dev, PCI_COMMAND, &cmd); in pci_set_vga_state()
6481 cmd |= command_bits; in pci_set_vga_state()
6483 cmd &= ~command_bits; in pci_set_vga_state()
6484 pci_write_config_word(dev, PCI_COMMAND, cmd); in pci_set_vga_state()
6490 bus = dev->bus; in pci_set_vga_state()
6492 bridge = bus->self; in pci_set_vga_state()
6495 &cmd); in pci_set_vga_state()
6497 cmd |= PCI_BRIDGE_CTL_VGA; in pci_set_vga_state()
6499 cmd &= ~PCI_BRIDGE_CTL_VGA; in pci_set_vga_state()
6501 cmd); in pci_set_vga_state()
6503 bus = bus->parent; in pci_set_vga_state()
6516 adev = ACPI_COMPANION(&pdev->dev); in pci_pr3_present()
6520 return adev->power.flags.power_resources && in pci_pr3_present()
6521 acpi_has_method(adev->handle, "_PR3"); in pci_pr3_present()
6527 * pci_add_dma_alias - Add a DMA devfn alias for a device
6532 * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask
6533 * which is used to program permissible bus-devfn source addresses for DMA
6536 * from their logical bus-devfn. Examples include device quirks where the
6537 * device simply uses the wrong devfn, as well as non-transparent bridges
6551 nr_devfns = min(nr_devfns, (unsigned int)MAX_NR_DEVFNS - devfn_from); in pci_add_dma_alias()
6552 devfn_to = devfn_from + nr_devfns - 1; in pci_add_dma_alias()
6554 if (!dev->dma_alias_mask) in pci_add_dma_alias()
6555 dev->dma_alias_mask = bitmap_zalloc(MAX_NR_DEVFNS, GFP_KERNEL); in pci_add_dma_alias()
6556 if (!dev->dma_alias_mask) { in pci_add_dma_alias()
6561 bitmap_set(dev->dma_alias_mask, devfn_from, nr_devfns); in pci_add_dma_alias()
6574 return (dev1->dma_alias_mask && in pci_devs_are_dma_aliases()
6575 test_bit(dev2->devfn, dev1->dma_alias_mask)) || in pci_devs_are_dma_aliases()
6576 (dev2->dma_alias_mask && in pci_devs_are_dma_aliases()
6577 test_bit(dev1->devfn, dev2->dma_alias_mask)) || in pci_devs_are_dma_aliases()
6590 return pci_bus_read_dev_vendor_id(pdev->bus, pdev->devfn, &v, 0); in pci_device_is_present()
6596 struct pci_dev *bridge = dev->bus->self; in pci_ignore_hotplug()
6598 dev->ignore_hotplug = 1; in pci_ignore_hotplug()
6601 bridge->ignore_hotplug = 1; in pci_ignore_hotplug()
6606 * pci_real_dma_dev - Get PCI DMA device for PCI device
6609 * Permits the platform to provide architecture-specific functionality to
6626 * Arches that don't want to expose struct resource to userland as-is in
6633 *start = rsrc->start; in pci_resource_to_user()
6634 *end = rsrc->end; in pci_resource_to_user()
6641 * pci_specified_resource_alignment - get resource alignment specified by user.
6705 struct resource *r = &dev->resource[bar]; in pci_request_resource_alignment()
6708 if (!(r->flags & IORESOURCE_MEM)) in pci_request_resource_alignment()
6711 if (r->flags & IORESOURCE_PCI_FIXED) { in pci_request_resource_alignment()
6738 * set r->start to the desired alignment. By itself this in pci_request_resource_alignment()
6753 r->start = 0; in pci_request_resource_alignment()
6754 r->end = align - 1; in pci_request_resource_alignment()
6756 r->flags &= ~IORESOURCE_SIZEALIGN; in pci_request_resource_alignment()
6757 r->flags |= IORESOURCE_STARTALIGN; in pci_request_resource_alignment()
6758 r->start = align; in pci_request_resource_alignment()
6759 r->end = r->start + size - 1; in pci_request_resource_alignment()
6761 r->flags |= IORESOURCE_UNSET; in pci_request_resource_alignment()
6768 * Later on, the kernel will assign page-aligned memory resource back
6780 * VF BARs are read-only zero according to SR-IOV spec r1.1, sec in pci_reassigndev_resource_alignment()
6782 * described by the VF BARx register in the PF's SR-IOV capability. in pci_reassigndev_resource_alignment()
6785 if (dev->is_virtfn) in pci_reassigndev_resource_alignment()
6793 if (dev->hdr_type == PCI_HEADER_TYPE_NORMAL && in pci_reassigndev_resource_alignment()
6794 (dev->class >> 8) == PCI_CLASS_BRIDGE_HOST) { in pci_reassigndev_resource_alignment()
6811 if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) { in pci_reassigndev_resource_alignment()
6813 r = &dev->resource[i]; in pci_reassigndev_resource_alignment()
6814 if (!(r->flags & IORESOURCE_MEM)) in pci_reassigndev_resource_alignment()
6816 r->flags |= IORESOURCE_UNSET; in pci_reassigndev_resource_alignment()
6817 r->end = resource_size(r) - 1; in pci_reassigndev_resource_alignment()
6818 r->start = 0; in pci_reassigndev_resource_alignment()
6841 if (count >= (PAGE_SIZE - 1)) in resource_alignment_store()
6842 return -EINVAL; in resource_alignment_store()
6846 return -ENOMEM; in resource_alignment_store()
6922 domain_nr = of_get_pci_domain_nr(parent->of_node); in of_pci_bus_find_domain_nr()
6940 if (bus->domain_nr < 0) in of_pci_bus_release_domain_nr()
6944 if (of_get_pci_domain_nr(parent->of_node) == bus->domain_nr) in of_pci_bus_release_domain_nr()
6945 ida_free(&pci_domain_nr_static_ida, bus->domain_nr); in of_pci_bus_release_domain_nr()
6947 ida_free(&pci_domain_nr_dynamic_ida, bus->domain_nr); in of_pci_bus_release_domain_nr()
6965 * pci_ext_cfg_avail - can we access extended PCI config space?