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

Merge branch 'pci/dead-code' into next

* pci/dead-code:
PCI: Make local functions static
PCI: Remove unused alloc_pci_dev()
PCI: Remove unused pci_renumber_slot()
PCI: Remove unused pcie_aspm_enabled()
PCI: Remove unused pci_vpd_truncate()
PCI: Remove unused ID-Based Ordering support
PCI: Remove unused Optimized Buffer Flush/Fill support
PCI: Remove unused Latency Tolerance Reporting support
PCI: Removed unused parts of Page Request Interface support

Conflicts:
drivers/pci/pci.c
include/linux/pci.h

+82 -530
-24
drivers/pci/access.c
··· 381 381 } 382 382 383 383 /** 384 - * pci_vpd_truncate - Set available Vital Product Data size 385 - * @dev: pci device struct 386 - * @size: available memory in bytes 387 - * 388 - * Adjust size of available VPD area. 389 - */ 390 - int pci_vpd_truncate(struct pci_dev *dev, size_t size) 391 - { 392 - if (!dev->vpd) 393 - return -EINVAL; 394 - 395 - /* limited by the access method */ 396 - if (size > dev->vpd->len) 397 - return -EINVAL; 398 - 399 - dev->vpd->len = size; 400 - if (dev->vpd->attr) 401 - dev->vpd->attr->size = size; 402 - 403 - return 0; 404 - } 405 - EXPORT_SYMBOL(pci_vpd_truncate); 406 - 407 - /** 408 384 * pci_cfg_access_lock - Lock PCI config reads/writes 409 385 * @dev: pci device struct 410 386 *
-82
drivers/pci/ats.c
··· 235 235 EXPORT_SYMBOL_GPL(pci_disable_pri); 236 236 237 237 /** 238 - * pci_pri_enabled - Checks if PRI capability is enabled 239 - * @pdev: PCI device structure 240 - * 241 - * Returns true if PRI is enabled on the device, false otherwise 242 - */ 243 - bool pci_pri_enabled(struct pci_dev *pdev) 244 - { 245 - u16 control; 246 - int pos; 247 - 248 - pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI); 249 - if (!pos) 250 - return false; 251 - 252 - pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control); 253 - 254 - return (control & PCI_PRI_CTRL_ENABLE) ? true : false; 255 - } 256 - EXPORT_SYMBOL_GPL(pci_pri_enabled); 257 - 258 - /** 259 238 * pci_reset_pri - Resets device's PRI state 260 239 * @pdev: PCI device structure 261 240 * ··· 261 282 return 0; 262 283 } 263 284 EXPORT_SYMBOL_GPL(pci_reset_pri); 264 - 265 - /** 266 - * pci_pri_stopped - Checks whether the PRI capability is stopped 267 - * @pdev: PCI device structure 268 - * 269 - * Returns true if the PRI capability on the device is disabled and the 270 - * device has no outstanding PRI requests, false otherwise. The device 271 - * indicates this via the STOPPED bit in the status register of the 272 - * capability. 273 - * The device internal state can be cleared by resetting the PRI state 274 - * with pci_reset_pri(). This can force the capability into the STOPPED 275 - * state. 276 - */ 277 - bool pci_pri_stopped(struct pci_dev *pdev) 278 - { 279 - u16 control, status; 280 - int pos; 281 - 282 - pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI); 283 - if (!pos) 284 - return true; 285 - 286 - pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control); 287 - pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status); 288 - 289 - if (control & PCI_PRI_CTRL_ENABLE) 290 - return false; 291 - 292 - return (status & PCI_PRI_STATUS_STOPPED) ? true : false; 293 - } 294 - EXPORT_SYMBOL_GPL(pci_pri_stopped); 295 - 296 - /** 297 - * pci_pri_status - Request PRI status of a device 298 - * @pdev: PCI device structure 299 - * 300 - * Returns negative value on failure, status on success. The status can 301 - * be checked against status-bits. Supported bits are currently: 302 - * PCI_PRI_STATUS_RF: Response failure 303 - * PCI_PRI_STATUS_UPRGI: Unexpected Page Request Group Index 304 - * PCI_PRI_STATUS_STOPPED: PRI has stopped 305 - */ 306 - int pci_pri_status(struct pci_dev *pdev) 307 - { 308 - u16 status, control; 309 - int pos; 310 - 311 - pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI); 312 - if (!pos) 313 - return -EINVAL; 314 - 315 - pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control); 316 - pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status); 317 - 318 - /* Stopped bit is undefined when enable == 1, so clear it */ 319 - if (control & PCI_PRI_CTRL_ENABLE) 320 - status &= ~PCI_PRI_STATUS_STOPPED; 321 - 322 - return status; 323 - } 324 - EXPORT_SYMBOL_GPL(pci_pri_status); 325 285 #endif /* CONFIG_PCI_PRI */ 326 286 327 287 #ifdef CONFIG_PCI_PASID
-1
drivers/pci/hotplug/pciehp.h
··· 43 43 extern bool pciehp_poll_mode; 44 44 extern int pciehp_poll_time; 45 45 extern bool pciehp_debug; 46 - extern bool pciehp_force; 47 46 48 47 #define dbg(format, arg...) \ 49 48 do { \
+1 -1
drivers/pci/hotplug/pciehp_core.c
··· 41 41 bool pciehp_debug; 42 42 bool pciehp_poll_mode; 43 43 int pciehp_poll_time; 44 - bool pciehp_force; 44 + static bool pciehp_force; 45 45 46 46 #define DRIVER_VERSION "0.4" 47 47 #define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
+25 -261
drivers/pci/pci.c
··· 683 683 } 684 684 685 685 /** 686 + * pci_wakeup - Wake up a PCI device 687 + * @pci_dev: Device to handle. 688 + * @ign: ignored parameter 689 + */ 690 + static int pci_wakeup(struct pci_dev *pci_dev, void *ign) 691 + { 692 + pci_wakeup_event(pci_dev); 693 + pm_request_resume(&pci_dev->dev); 694 + return 0; 695 + } 696 + 697 + /** 698 + * pci_wakeup_bus - Walk given bus and wake up devices on it 699 + * @bus: Top bus of the subtree to walk. 700 + */ 701 + static void pci_wakeup_bus(struct pci_bus *bus) 702 + { 703 + if (bus) 704 + pci_walk_bus(bus, pci_wakeup, NULL); 705 + } 706 + 707 + /** 686 708 * __pci_start_power_transition - Start power transition of a PCI device 687 709 * @dev: PCI device to handle. 688 710 * @state: State to put the device into. ··· 1132 1110 * @dev: PCI device that we're dealing with 1133 1111 * @state: Saved state returned from pci_store_saved_state() 1134 1112 */ 1135 - int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state) 1113 + static int pci_load_saved_state(struct pci_dev *dev, 1114 + struct pci_saved_state *state) 1136 1115 { 1137 1116 struct pci_cap_saved_data *cap; 1138 1117 ··· 1161 1138 dev->state_saved = true; 1162 1139 return 0; 1163 1140 } 1164 - EXPORT_SYMBOL_GPL(pci_load_saved_state); 1165 1141 1166 1142 /** 1167 1143 * pci_load_and_free_saved_state - Reload the save state pointed to by state, ··· 1592 1570 pci_walk_bus(bus, pci_pme_wakeup, (void *)true); 1593 1571 } 1594 1572 1595 - /** 1596 - * pci_wakeup - Wake up a PCI device 1597 - * @pci_dev: Device to handle. 1598 - * @ign: ignored parameter 1599 - */ 1600 - static int pci_wakeup(struct pci_dev *pci_dev, void *ign) 1601 - { 1602 - pci_wakeup_event(pci_dev); 1603 - pm_request_resume(&pci_dev->dev); 1604 - return 0; 1605 - } 1606 - 1607 - /** 1608 - * pci_wakeup_bus - Walk given bus and wake up devices on it 1609 - * @bus: Top bus of the subtree to walk. 1610 - */ 1611 - void pci_wakeup_bus(struct pci_bus *bus) 1612 - { 1613 - if (bus) 1614 - pci_walk_bus(bus, pci_wakeup, NULL); 1615 - } 1616 1573 1617 1574 /** 1618 1575 * pci_pme_capable - check the capability of PCI device to generate PME# ··· 1805 1804 * If the platform can't manage @dev, return the deepest state from which it 1806 1805 * can generate wake events, based on any available PME info. 1807 1806 */ 1808 - pci_power_t pci_target_state(struct pci_dev *dev) 1807 + static pci_power_t pci_target_state(struct pci_dev *dev) 1809 1808 { 1810 1809 pci_power_t target_state = PCI_D3hot; 1811 1810 ··· 2168 2167 bridge->ari_enabled = 0; 2169 2168 } 2170 2169 } 2171 - 2172 - /** 2173 - * pci_enable_ido - enable ID-based Ordering on a device 2174 - * @dev: the PCI device 2175 - * @type: which types of IDO to enable 2176 - * 2177 - * Enable ID-based ordering on @dev. @type can contain the bits 2178 - * %PCI_EXP_IDO_REQUEST and/or %PCI_EXP_IDO_COMPLETION to indicate 2179 - * which types of transactions are allowed to be re-ordered. 2180 - */ 2181 - void pci_enable_ido(struct pci_dev *dev, unsigned long type) 2182 - { 2183 - u16 ctrl = 0; 2184 - 2185 - if (type & PCI_EXP_IDO_REQUEST) 2186 - ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN; 2187 - if (type & PCI_EXP_IDO_COMPLETION) 2188 - ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN; 2189 - if (ctrl) 2190 - pcie_capability_set_word(dev, PCI_EXP_DEVCTL2, ctrl); 2191 - } 2192 - EXPORT_SYMBOL(pci_enable_ido); 2193 - 2194 - /** 2195 - * pci_disable_ido - disable ID-based ordering on a device 2196 - * @dev: the PCI device 2197 - * @type: which types of IDO to disable 2198 - */ 2199 - void pci_disable_ido(struct pci_dev *dev, unsigned long type) 2200 - { 2201 - u16 ctrl = 0; 2202 - 2203 - if (type & PCI_EXP_IDO_REQUEST) 2204 - ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN; 2205 - if (type & PCI_EXP_IDO_COMPLETION) 2206 - ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN; 2207 - if (ctrl) 2208 - pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, ctrl); 2209 - } 2210 - EXPORT_SYMBOL(pci_disable_ido); 2211 - 2212 - /** 2213 - * pci_enable_obff - enable optimized buffer flush/fill 2214 - * @dev: PCI device 2215 - * @type: type of signaling to use 2216 - * 2217 - * Try to enable @type OBFF signaling on @dev. It will try using WAKE# 2218 - * signaling if possible, falling back to message signaling only if 2219 - * WAKE# isn't supported. @type should indicate whether the PCIe link 2220 - * be brought out of L0s or L1 to send the message. It should be either 2221 - * %PCI_EXP_OBFF_SIGNAL_ALWAYS or %PCI_OBFF_SIGNAL_L0. 2222 - * 2223 - * If your device can benefit from receiving all messages, even at the 2224 - * power cost of bringing the link back up from a low power state, use 2225 - * %PCI_EXP_OBFF_SIGNAL_ALWAYS. Otherwise, use %PCI_OBFF_SIGNAL_L0 (the 2226 - * preferred type). 2227 - * 2228 - * RETURNS: 2229 - * Zero on success, appropriate error number on failure. 2230 - */ 2231 - int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type) 2232 - { 2233 - u32 cap; 2234 - u16 ctrl; 2235 - int ret; 2236 - 2237 - pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap); 2238 - if (!(cap & PCI_EXP_DEVCAP2_OBFF_MASK)) 2239 - return -ENOTSUPP; /* no OBFF support at all */ 2240 - 2241 - /* Make sure the topology supports OBFF as well */ 2242 - if (dev->bus->self) { 2243 - ret = pci_enable_obff(dev->bus->self, type); 2244 - if (ret) 2245 - return ret; 2246 - } 2247 - 2248 - pcie_capability_read_word(dev, PCI_EXP_DEVCTL2, &ctrl); 2249 - if (cap & PCI_EXP_DEVCAP2_OBFF_WAKE) 2250 - ctrl |= PCI_EXP_DEVCTL2_OBFF_WAKE_EN; 2251 - else { 2252 - switch (type) { 2253 - case PCI_EXP_OBFF_SIGNAL_L0: 2254 - if (!(ctrl & PCI_EXP_DEVCTL2_OBFF_WAKE_EN)) 2255 - ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGA_EN; 2256 - break; 2257 - case PCI_EXP_OBFF_SIGNAL_ALWAYS: 2258 - ctrl &= ~PCI_EXP_DEVCTL2_OBFF_WAKE_EN; 2259 - ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGB_EN; 2260 - break; 2261 - default: 2262 - WARN(1, "bad OBFF signal type\n"); 2263 - return -ENOTSUPP; 2264 - } 2265 - } 2266 - pcie_capability_write_word(dev, PCI_EXP_DEVCTL2, ctrl); 2267 - 2268 - return 0; 2269 - } 2270 - EXPORT_SYMBOL(pci_enable_obff); 2271 - 2272 - /** 2273 - * pci_disable_obff - disable optimized buffer flush/fill 2274 - * @dev: PCI device 2275 - * 2276 - * Disable OBFF on @dev. 2277 - */ 2278 - void pci_disable_obff(struct pci_dev *dev) 2279 - { 2280 - pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, 2281 - PCI_EXP_DEVCTL2_OBFF_WAKE_EN); 2282 - } 2283 - EXPORT_SYMBOL(pci_disable_obff); 2284 - 2285 - /** 2286 - * pci_ltr_supported - check whether a device supports LTR 2287 - * @dev: PCI device 2288 - * 2289 - * RETURNS: 2290 - * True if @dev supports latency tolerance reporting, false otherwise. 2291 - */ 2292 - static bool pci_ltr_supported(struct pci_dev *dev) 2293 - { 2294 - u32 cap; 2295 - 2296 - pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap); 2297 - 2298 - return cap & PCI_EXP_DEVCAP2_LTR; 2299 - } 2300 - 2301 - /** 2302 - * pci_enable_ltr - enable latency tolerance reporting 2303 - * @dev: PCI device 2304 - * 2305 - * Enable LTR on @dev if possible, which means enabling it first on 2306 - * upstream ports. 2307 - * 2308 - * RETURNS: 2309 - * Zero on success, errno on failure. 2310 - */ 2311 - int pci_enable_ltr(struct pci_dev *dev) 2312 - { 2313 - int ret; 2314 - 2315 - /* Only primary function can enable/disable LTR */ 2316 - if (PCI_FUNC(dev->devfn) != 0) 2317 - return -EINVAL; 2318 - 2319 - if (!pci_ltr_supported(dev)) 2320 - return -ENOTSUPP; 2321 - 2322 - /* Enable upstream ports first */ 2323 - if (dev->bus->self) { 2324 - ret = pci_enable_ltr(dev->bus->self); 2325 - if (ret) 2326 - return ret; 2327 - } 2328 - 2329 - return pcie_capability_set_word(dev, PCI_EXP_DEVCTL2, 2330 - PCI_EXP_DEVCTL2_LTR_EN); 2331 - } 2332 - EXPORT_SYMBOL(pci_enable_ltr); 2333 - 2334 - /** 2335 - * pci_disable_ltr - disable latency tolerance reporting 2336 - * @dev: PCI device 2337 - */ 2338 - void pci_disable_ltr(struct pci_dev *dev) 2339 - { 2340 - /* Only primary function can enable/disable LTR */ 2341 - if (PCI_FUNC(dev->devfn) != 0) 2342 - return; 2343 - 2344 - if (!pci_ltr_supported(dev)) 2345 - return; 2346 - 2347 - pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, 2348 - PCI_EXP_DEVCTL2_LTR_EN); 2349 - } 2350 - EXPORT_SYMBOL(pci_disable_ltr); 2351 - 2352 - static int __pci_ltr_scale(int *val) 2353 - { 2354 - int scale = 0; 2355 - 2356 - while (*val > 1023) { 2357 - *val = (*val + 31) / 32; 2358 - scale++; 2359 - } 2360 - return scale; 2361 - } 2362 - 2363 - /** 2364 - * pci_set_ltr - set LTR latency values 2365 - * @dev: PCI device 2366 - * @snoop_lat_ns: snoop latency in nanoseconds 2367 - * @nosnoop_lat_ns: nosnoop latency in nanoseconds 2368 - * 2369 - * Figure out the scale and set the LTR values accordingly. 2370 - */ 2371 - int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns) 2372 - { 2373 - int pos, ret, snoop_scale, nosnoop_scale; 2374 - u16 val; 2375 - 2376 - if (!pci_ltr_supported(dev)) 2377 - return -ENOTSUPP; 2378 - 2379 - snoop_scale = __pci_ltr_scale(&snoop_lat_ns); 2380 - nosnoop_scale = __pci_ltr_scale(&nosnoop_lat_ns); 2381 - 2382 - if (snoop_lat_ns > PCI_LTR_VALUE_MASK || 2383 - nosnoop_lat_ns > PCI_LTR_VALUE_MASK) 2384 - return -EINVAL; 2385 - 2386 - if ((snoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)) || 2387 - (nosnoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT))) 2388 - return -EINVAL; 2389 - 2390 - pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_LTR); 2391 - if (!pos) 2392 - return -ENOTSUPP; 2393 - 2394 - val = (snoop_scale << PCI_LTR_SCALE_SHIFT) | snoop_lat_ns; 2395 - ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_SNOOP_LAT, val); 2396 - if (ret != 4) 2397 - return -EIO; 2398 - 2399 - val = (nosnoop_scale << PCI_LTR_SCALE_SHIFT) | nosnoop_lat_ns; 2400 - ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_NOSNOOP_LAT, val); 2401 - if (ret != 4) 2402 - return -EIO; 2403 - 2404 - return 0; 2405 - } 2406 - EXPORT_SYMBOL(pci_set_ltr); 2407 2170 2408 2171 static int pci_acs_enable; 2409 2172 ··· 4247 4482 EXPORT_SYMBOL(pci_pme_capable); 4248 4483 EXPORT_SYMBOL(pci_pme_active); 4249 4484 EXPORT_SYMBOL(pci_wake_from_d3); 4250 - EXPORT_SYMBOL(pci_target_state); 4251 4485 EXPORT_SYMBOL(pci_prepare_to_sleep); 4252 4486 EXPORT_SYMBOL(pci_back_from_sleep); 4253 4487 EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
-2
drivers/pci/pci.h
··· 6 6 #define PCI_CFG_SPACE_SIZE 256 7 7 #define PCI_CFG_SPACE_EXP_SIZE 4096 8 8 9 - extern const unsigned char pcix_bus_speed[]; 10 9 extern const unsigned char pcie_link_speed[]; 11 10 12 11 /* Functions internal to the PCI core code */ ··· 67 68 void pci_disable_enabled_device(struct pci_dev *dev); 68 69 int pci_finish_runtime_suspend(struct pci_dev *dev); 69 70 int __pci_pme_wakeup(struct pci_dev *dev, void *ign); 70 - void pci_wakeup_bus(struct pci_bus *bus); 71 71 void pci_config_pm_runtime_get(struct pci_dev *dev); 72 72 void pci_config_pm_runtime_put(struct pci_dev *dev); 73 73 void pci_pm_init(struct pci_dev *dev);
-12
drivers/pci/pcie/aspm.c
··· 984 984 } 985 985 } 986 986 987 - /** 988 - * pcie_aspm_enabled - is PCIe ASPM enabled? 989 - * 990 - * Returns true if ASPM has not been disabled by the command-line option 991 - * pcie_aspm=off. 992 - **/ 993 - int pcie_aspm_enabled(void) 994 - { 995 - return !aspm_disabled; 996 - } 997 - EXPORT_SYMBOL(pcie_aspm_enabled); 998 - 999 987 bool pcie_aspm_support_enabled(void) 1000 988 { 1001 989 return aspm_support_enabled;
+56 -61
drivers/pci/probe.c
··· 16 16 #define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ 17 17 #define CARDBUS_RESERVE_BUSNR 3 18 18 19 - struct resource busn_resource = { 19 + static struct resource busn_resource = { 20 20 .name = "PCI busn", 21 21 .start = 0, 22 22 .end = 255, ··· 518 518 return bridge; 519 519 } 520 520 521 - const unsigned char pcix_bus_speed[] = { 521 + static const unsigned char pcix_bus_speed[] = { 522 522 PCI_SPEED_UNKNOWN, /* 0 */ 523 523 PCI_SPEED_66MHz_PCIX, /* 1 */ 524 524 PCI_SPEED_100MHz_PCIX, /* 2 */ ··· 999 999 pdev->is_hotplug_bridge = 1; 1000 1000 } 1001 1001 1002 + 1003 + /** 1004 + * pci_cfg_space_size - get the configuration space size of the PCI device. 1005 + * @dev: PCI device 1006 + * 1007 + * Regular PCI devices have 256 bytes, but PCI-X 2 and PCI Express devices 1008 + * have 4096 bytes. Even if the device is capable, that doesn't mean we can 1009 + * access it. Maybe we don't have a way to generate extended config space 1010 + * accesses, or the device is behind a reverse Express bridge. So we try 1011 + * reading the dword at 0x100 which must either be 0 or a valid extended 1012 + * capability header. 1013 + */ 1014 + static int pci_cfg_space_size_ext(struct pci_dev *dev) 1015 + { 1016 + u32 status; 1017 + int pos = PCI_CFG_SPACE_SIZE; 1018 + 1019 + if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL) 1020 + goto fail; 1021 + if (status == 0xffffffff) 1022 + goto fail; 1023 + 1024 + return PCI_CFG_SPACE_EXP_SIZE; 1025 + 1026 + fail: 1027 + return PCI_CFG_SPACE_SIZE; 1028 + } 1029 + 1030 + int pci_cfg_space_size(struct pci_dev *dev) 1031 + { 1032 + int pos; 1033 + u32 status; 1034 + u16 class; 1035 + 1036 + class = dev->class >> 8; 1037 + if (class == PCI_CLASS_BRIDGE_HOST) 1038 + return pci_cfg_space_size_ext(dev); 1039 + 1040 + if (!pci_is_pcie(dev)) { 1041 + pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); 1042 + if (!pos) 1043 + goto fail; 1044 + 1045 + pci_read_config_dword(dev, pos + PCI_X_STATUS, &status); 1046 + if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ))) 1047 + goto fail; 1048 + } 1049 + 1050 + return pci_cfg_space_size_ext(dev); 1051 + 1052 + fail: 1053 + return PCI_CFG_SPACE_SIZE; 1054 + } 1055 + 1002 1056 #define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) 1003 1057 1004 1058 /** ··· 1244 1190 kfree(pci_dev); 1245 1191 } 1246 1192 1247 - /** 1248 - * pci_cfg_space_size - get the configuration space size of the PCI device. 1249 - * @dev: PCI device 1250 - * 1251 - * Regular PCI devices have 256 bytes, but PCI-X 2 and PCI Express devices 1252 - * have 4096 bytes. Even if the device is capable, that doesn't mean we can 1253 - * access it. Maybe we don't have a way to generate extended config space 1254 - * accesses, or the device is behind a reverse Express bridge. So we try 1255 - * reading the dword at 0x100 which must either be 0 or a valid extended 1256 - * capability header. 1257 - */ 1258 - int pci_cfg_space_size_ext(struct pci_dev *dev) 1259 - { 1260 - u32 status; 1261 - int pos = PCI_CFG_SPACE_SIZE; 1262 - 1263 - if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL) 1264 - goto fail; 1265 - if (status == 0xffffffff) 1266 - goto fail; 1267 - 1268 - return PCI_CFG_SPACE_EXP_SIZE; 1269 - 1270 - fail: 1271 - return PCI_CFG_SPACE_SIZE; 1272 - } 1273 - 1274 - int pci_cfg_space_size(struct pci_dev *dev) 1275 - { 1276 - int pos; 1277 - u32 status; 1278 - u16 class; 1279 - 1280 - class = dev->class >> 8; 1281 - if (class == PCI_CLASS_BRIDGE_HOST) 1282 - return pci_cfg_space_size_ext(dev); 1283 - 1284 - if (!pci_is_pcie(dev)) { 1285 - pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); 1286 - if (!pos) 1287 - goto fail; 1288 - 1289 - pci_read_config_dword(dev, pos + PCI_X_STATUS, &status); 1290 - if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ))) 1291 - goto fail; 1292 - } 1293 - 1294 - return pci_cfg_space_size_ext(dev); 1295 - 1296 - fail: 1297 - return PCI_CFG_SPACE_SIZE; 1298 - } 1299 - 1300 1193 struct pci_dev *pci_alloc_dev(struct pci_bus *bus) 1301 1194 { 1302 1195 struct pci_dev *dev; ··· 1259 1258 return dev; 1260 1259 } 1261 1260 EXPORT_SYMBOL(pci_alloc_dev); 1262 - 1263 - struct pci_dev *alloc_pci_dev(void) 1264 - { 1265 - return pci_alloc_dev(NULL); 1266 - } 1267 - EXPORT_SYMBOL(alloc_pci_dev); 1268 1261 1269 1262 bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, 1270 1263 int crs_timeout)
-26
drivers/pci/slot.c
··· 320 320 EXPORT_SYMBOL_GPL(pci_create_slot); 321 321 322 322 /** 323 - * pci_renumber_slot - update %struct pci_slot -> number 324 - * @slot: &struct pci_slot to update 325 - * @slot_nr: new number for slot 326 - * 327 - * The primary purpose of this interface is to allow callers who earlier 328 - * created a placeholder slot in pci_create_slot() by passing a -1 as 329 - * slot_nr, to update their %struct pci_slot with the correct @slot_nr. 330 - */ 331 - void pci_renumber_slot(struct pci_slot *slot, int slot_nr) 332 - { 333 - struct pci_slot *tmp; 334 - 335 - down_write(&pci_bus_sem); 336 - 337 - list_for_each_entry(tmp, &slot->bus->slots, list) { 338 - WARN_ON(tmp->number == slot_nr); 339 - goto out; 340 - } 341 - 342 - slot->number = slot_nr; 343 - out: 344 - up_write(&pci_bus_sem); 345 - } 346 - EXPORT_SYMBOL_GPL(pci_renumber_slot); 347 - 348 - /** 349 323 * pci_destroy_slot - decrement refcount for physical PCI slot 350 324 * @slot: struct pci_slot to decrement 351 325 *
-17
include/linux/pci-ats.h
··· 56 56 57 57 int pci_enable_pri(struct pci_dev *pdev, u32 reqs); 58 58 void pci_disable_pri(struct pci_dev *pdev); 59 - bool pci_pri_enabled(struct pci_dev *pdev); 60 59 int pci_reset_pri(struct pci_dev *pdev); 61 - bool pci_pri_stopped(struct pci_dev *pdev); 62 - int pci_pri_status(struct pci_dev *pdev); 63 60 64 61 #else /* CONFIG_PCI_PRI */ 65 62 ··· 69 72 { 70 73 } 71 74 72 - static inline bool pci_pri_enabled(struct pci_dev *pdev) 73 - { 74 - return false; 75 - } 76 - 77 75 static inline int pci_reset_pri(struct pci_dev *pdev) 78 76 { 79 77 return -ENODEV; 80 78 } 81 79 82 - static inline bool pci_pri_stopped(struct pci_dev *pdev) 83 - { 84 - return true; 85 - } 86 - 87 - static inline int pci_pri_status(struct pci_dev *pdev) 88 - { 89 - return -ENODEV; 90 - } 91 80 #endif /* CONFIG_PCI_PRI */ 92 81 93 82 #ifdef CONFIG_PCI_PASID
-43
include/linux/pci.h
··· 376 376 } 377 377 378 378 struct pci_dev *pci_alloc_dev(struct pci_bus *bus); 379 - struct pci_dev * __deprecated alloc_pci_dev(void); 380 379 381 380 #define to_pci_dev(n) container_of(n, struct pci_dev, dev) 382 381 #define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) ··· 384 385 { 385 386 return (pdev->error_state != pci_channel_io_normal); 386 387 } 387 - 388 - extern struct resource busn_resource; 389 388 390 389 struct pci_host_bridge_window { 391 390 struct list_head list; ··· 760 763 const char *name, 761 764 struct hotplug_slot *hotplug); 762 765 void pci_destroy_slot(struct pci_slot *slot); 763 - void pci_renumber_slot(struct pci_slot *slot, int slot_nr); 764 766 int pci_scan_slot(struct pci_bus *bus, int devfn); 765 767 struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 766 768 void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); ··· 970 974 int pci_save_state(struct pci_dev *dev); 971 975 void pci_restore_state(struct pci_dev *dev); 972 976 struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); 973 - int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state); 974 977 int pci_load_and_free_saved_state(struct pci_dev *dev, 975 978 struct pci_saved_state **state); 976 979 struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap); ··· 986 991 int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, 987 992 bool runtime, bool enable); 988 993 int pci_wake_from_d3(struct pci_dev *dev, bool enable); 989 - pci_power_t pci_target_state(struct pci_dev *dev); 990 994 int pci_prepare_to_sleep(struct pci_dev *dev); 991 995 int pci_back_from_sleep(struct pci_dev *dev); 992 996 bool pci_dev_run_wake(struct pci_dev *dev); ··· 1003 1009 void pci_restore_vc_state(struct pci_dev *dev); 1004 1010 void pci_allocate_vc_save_buffers(struct pci_dev *dev); 1005 1011 1006 - #define PCI_EXP_IDO_REQUEST (1<<0) 1007 - #define PCI_EXP_IDO_COMPLETION (1<<1) 1008 - void pci_enable_ido(struct pci_dev *dev, unsigned long type); 1009 - void pci_disable_ido(struct pci_dev *dev, unsigned long type); 1010 - 1011 - enum pci_obff_signal_type { 1012 - PCI_EXP_OBFF_SIGNAL_L0 = 0, 1013 - PCI_EXP_OBFF_SIGNAL_ALWAYS = 1, 1014 - }; 1015 - int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type); 1016 - void pci_disable_obff(struct pci_dev *dev); 1017 - 1018 - int pci_enable_ltr(struct pci_dev *dev); 1019 - void pci_disable_ltr(struct pci_dev *dev); 1020 - int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns); 1021 - 1022 1012 /* For use by arch with custom probe code */ 1023 1013 void set_pcie_port_type(struct pci_dev *pdev); 1024 1014 void set_pcie_hotplug_bridge(struct pci_dev *pdev); ··· 1015 1037 /* Vital product data routines */ 1016 1038 ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 1017 1039 ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); 1018 - int pci_vpd_truncate(struct pci_dev *dev, size_t size); 1019 1040 1020 1041 /* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 1021 1042 resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); ··· 1111 1134 1112 1135 void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), 1113 1136 void *userdata); 1114 - int pci_cfg_space_size_ext(struct pci_dev *dev); 1115 1137 int pci_cfg_space_size(struct pci_dev *dev); 1116 1138 unsigned char pci_bus_max_busnr(struct pci_bus *bus); 1117 1139 void pci_setup_bridge(struct pci_bus *bus); ··· 1226 1250 #endif 1227 1251 1228 1252 #ifndef CONFIG_PCIEASPM 1229 - static inline int pcie_aspm_enabled(void) { return 0; } 1230 1253 static inline bool pcie_aspm_support_enabled(void) { return false; } 1231 1254 #else 1232 - int pcie_aspm_enabled(void); 1233 1255 bool pcie_aspm_support_enabled(void); 1234 1256 #endif 1235 1257 ··· 1428 1454 int enable) 1429 1455 { 1430 1456 return 0; 1431 - } 1432 - 1433 - static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type) 1434 - { 1435 - } 1436 - 1437 - static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type) 1438 - { 1439 - } 1440 - 1441 - static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type) 1442 - { 1443 - return 0; 1444 - } 1445 - 1446 - static inline void pci_disable_obff(struct pci_dev *dev) 1447 - { 1448 1457 } 1449 1458 1450 1459 static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)