aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjorn Helgaas <bhelgaas@google.com>2014-01-13 18:47:08 -0500
committerBjorn Helgaas <bhelgaas@google.com>2014-01-13 18:47:08 -0500
commit597db6f38c4bcb90406d4e2f56446ba5a5dc20c6 (patch)
tree82cb8a6e1cec2df8adaf527b92667a4c5ba29254
parent6b9bd1e3ee8f23b55d407becf4f6f422ec4610f2 (diff)
parent0b950f0f3c67e42f18c655a3ab3e36ea192635bb (diff)
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
-rw-r--r--drivers/pci/access.c24
-rw-r--r--drivers/pci/ats.c82
-rw-r--r--drivers/pci/hotplug/pciehp.h1
-rw-r--r--drivers/pci/hotplug/pciehp_core.c2
-rw-r--r--drivers/pci/pci.c286
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/pcie/aspm.c12
-rw-r--r--drivers/pci/probe.c117
-rw-r--r--drivers/pci/slot.c26
-rw-r--r--include/linux/pci-ats.h17
-rw-r--r--include/linux/pci.h43
11 files changed, 82 insertions, 530 deletions
diff --git a/drivers/pci/access.c b/drivers/pci/access.c
index 0857ca981fae..7f8b78c08879 100644
--- a/drivers/pci/access.c
+++ b/drivers/pci/access.c
@@ -381,30 +381,6 @@ int pci_vpd_pci22_init(struct pci_dev *dev)
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 */
390int 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}
405EXPORT_SYMBOL(pci_vpd_truncate);
406
407/**
408 * pci_cfg_access_lock - Lock PCI config reads/writes 384 * pci_cfg_access_lock - Lock PCI config reads/writes
409 * @dev: pci device struct 385 * @dev: pci device struct
410 * 386 *
diff --git a/drivers/pci/ats.c b/drivers/pci/ats.c
index e52d7ffa38b9..a8099d4d0c9d 100644
--- a/drivers/pci/ats.c
+++ b/drivers/pci/ats.c
@@ -235,27 +235,6 @@ void pci_disable_pri(struct pci_dev *pdev)
235EXPORT_SYMBOL_GPL(pci_disable_pri); 235EXPORT_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 */
243bool 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}
256EXPORT_SYMBOL_GPL(pci_pri_enabled);
257
258/**
259 * pci_reset_pri - Resets device's PRI state 238 * pci_reset_pri - Resets device's PRI state
260 * @pdev: PCI device structure 239 * @pdev: PCI device structure
261 * 240 *
@@ -282,67 +261,6 @@ int pci_reset_pri(struct pci_dev *pdev)
282 return 0; 261 return 0;
283} 262}
284EXPORT_SYMBOL_GPL(pci_reset_pri); 263EXPORT_SYMBOL_GPL(pci_reset_pri);
285
286/**
287 * pci_pri_stopped - Checks whether the PRI capability is stopped
288 * @pdev: PCI device structure
289 *
290 * Returns true if the PRI capability on the device is disabled and the
291 * device has no outstanding PRI requests, false otherwise. The device
292 * indicates this via the STOPPED bit in the status register of the
293 * capability.
294 * The device internal state can be cleared by resetting the PRI state
295 * with pci_reset_pri(). This can force the capability into the STOPPED
296 * state.
297 */
298bool pci_pri_stopped(struct pci_dev *pdev)
299{
300 u16 control, status;
301 int pos;
302
303 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
304 if (!pos)
305 return true;
306
307 pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
308 pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
309
310 if (control & PCI_PRI_CTRL_ENABLE)
311 return false;
312
313 return (status & PCI_PRI_STATUS_STOPPED) ? true : false;
314}
315EXPORT_SYMBOL_GPL(pci_pri_stopped);
316
317/**
318 * pci_pri_status - Request PRI status of a device
319 * @pdev: PCI device structure
320 *
321 * Returns negative value on failure, status on success. The status can
322 * be checked against status-bits. Supported bits are currently:
323 * PCI_PRI_STATUS_RF: Response failure
324 * PCI_PRI_STATUS_UPRGI: Unexpected Page Request Group Index
325 * PCI_PRI_STATUS_STOPPED: PRI has stopped
326 */
327int pci_pri_status(struct pci_dev *pdev)
328{
329 u16 status, control;
330 int pos;
331
332 pos = pci_find_ext_capability(pdev, PCI_EXT_CAP_ID_PRI);
333 if (!pos)
334 return -EINVAL;
335
336 pci_read_config_word(pdev, pos + PCI_PRI_CTRL, &control);
337 pci_read_config_word(pdev, pos + PCI_PRI_STATUS, &status);
338
339 /* Stopped bit is undefined when enable == 1, so clear it */
340 if (control & PCI_PRI_CTRL_ENABLE)
341 status &= ~PCI_PRI_STATUS_STOPPED;
342
343 return status;
344}
345EXPORT_SYMBOL_GPL(pci_pri_status);
346#endif /* CONFIG_PCI_PRI */ 264#endif /* CONFIG_PCI_PRI */
347 265
348#ifdef CONFIG_PCI_PASID 266#ifdef CONFIG_PCI_PASID
diff --git a/drivers/pci/hotplug/pciehp.h b/drivers/pci/hotplug/pciehp.h
index ffe6a6b336cf..ccb0925bcd7b 100644
--- a/drivers/pci/hotplug/pciehp.h
+++ b/drivers/pci/hotplug/pciehp.h
@@ -43,7 +43,6 @@
43extern bool pciehp_poll_mode; 43extern bool pciehp_poll_mode;
44extern int pciehp_poll_time; 44extern int pciehp_poll_time;
45extern bool pciehp_debug; 45extern bool pciehp_debug;
46extern bool pciehp_force;
47 46
48#define dbg(format, arg...) \ 47#define dbg(format, arg...) \
49do { \ 48do { \
diff --git a/drivers/pci/hotplug/pciehp_core.c b/drivers/pci/hotplug/pciehp_core.c
index 143a389d81fa..53b58debc288 100644
--- a/drivers/pci/hotplug/pciehp_core.c
+++ b/drivers/pci/hotplug/pciehp_core.c
@@ -41,7 +41,7 @@
41bool pciehp_debug; 41bool pciehp_debug;
42bool pciehp_poll_mode; 42bool pciehp_poll_mode;
43int pciehp_poll_time; 43int pciehp_poll_time;
44bool pciehp_force; 44static bool pciehp_force;
45 45
46#define DRIVER_VERSION "0.4" 46#define DRIVER_VERSION "0.4"
47#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>" 47#define DRIVER_AUTHOR "Dan Zink <dan.zink@compaq.com>, Greg Kroah-Hartman <greg@kroah.com>, Dely Sy <dely.l.sy@intel.com>"
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 508e560b7d2a..1cbd590cf1d1 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -683,6 +683,28 @@ static int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
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 */
690static 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 */
701static void pci_wakeup_bus(struct pci_bus *bus)
702{
703 if (bus)
704 pci_walk_bus(bus, pci_wakeup, NULL);
705}
706
707/**
686 * __pci_start_power_transition - Start power transition of a PCI device 708 * __pci_start_power_transition - Start power transition of a PCI device
687 * @dev: PCI device to handle. 709 * @dev: PCI device to handle.
688 * @state: State to put the device into. 710 * @state: State to put the device into.
@@ -1110,7 +1132,8 @@ EXPORT_SYMBOL_GPL(pci_store_saved_state);
1110 * @dev: PCI device that we're dealing with 1132 * @dev: PCI device that we're dealing with
1111 * @state: Saved state returned from pci_store_saved_state() 1133 * @state: Saved state returned from pci_store_saved_state()
1112 */ 1134 */
1113int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state) 1135static int pci_load_saved_state(struct pci_dev *dev,
1136 struct pci_saved_state *state)
1114{ 1137{
1115 struct pci_cap_saved_data *cap; 1138 struct pci_cap_saved_data *cap;
1116 1139
@@ -1138,7 +1161,6 @@ int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state)
1138 dev->state_saved = true; 1161 dev->state_saved = true;
1139 return 0; 1162 return 0;
1140} 1163}
1141EXPORT_SYMBOL_GPL(pci_load_saved_state);
1142 1164
1143/** 1165/**
1144 * pci_load_and_free_saved_state - Reload the save state pointed to by state, 1166 * pci_load_and_free_saved_state - Reload the save state pointed to by state,
@@ -1570,27 +1592,6 @@ void pci_pme_wakeup_bus(struct pci_bus *bus)
1570 pci_walk_bus(bus, pci_pme_wakeup, (void *)true); 1592 pci_walk_bus(bus, pci_pme_wakeup, (void *)true);
1571} 1593}
1572 1594
1573/**
1574 * pci_wakeup - Wake up a PCI device
1575 * @pci_dev: Device to handle.
1576 * @ign: ignored parameter
1577 */
1578static int pci_wakeup(struct pci_dev *pci_dev, void *ign)
1579{
1580 pci_wakeup_event(pci_dev);
1581 pm_request_resume(&pci_dev->dev);
1582 return 0;
1583}
1584
1585/**
1586 * pci_wakeup_bus - Walk given bus and wake up devices on it
1587 * @bus: Top bus of the subtree to walk.
1588 */
1589void pci_wakeup_bus(struct pci_bus *bus)
1590{
1591 if (bus)
1592 pci_walk_bus(bus, pci_wakeup, NULL);
1593}
1594 1595
1595/** 1596/**
1596 * pci_pme_capable - check the capability of PCI device to generate PME# 1597 * pci_pme_capable - check the capability of PCI device to generate PME#
@@ -1804,7 +1805,7 @@ int pci_wake_from_d3(struct pci_dev *dev, bool enable)
1804 * If the platform can't manage @dev, return the deepest state from which it 1805 * If the platform can't manage @dev, return the deepest state from which it
1805 * can generate wake events, based on any available PME info. 1806 * can generate wake events, based on any available PME info.
1806 */ 1807 */
1807pci_power_t pci_target_state(struct pci_dev *dev) 1808static pci_power_t pci_target_state(struct pci_dev *dev)
1808{ 1809{
1809 pci_power_t target_state = PCI_D3hot; 1810 pci_power_t target_state = PCI_D3hot;
1810 1811
@@ -2168,242 +2169,6 @@ void pci_configure_ari(struct pci_dev *dev)
2168 } 2169 }
2169} 2170}
2170 2171
2171/**
2172 * pci_enable_ido - enable ID-based Ordering on a device
2173 * @dev: the PCI device
2174 * @type: which types of IDO to enable
2175 *
2176 * Enable ID-based ordering on @dev. @type can contain the bits
2177 * %PCI_EXP_IDO_REQUEST and/or %PCI_EXP_IDO_COMPLETION to indicate
2178 * which types of transactions are allowed to be re-ordered.
2179 */
2180void pci_enable_ido(struct pci_dev *dev, unsigned long type)
2181{
2182 u16 ctrl = 0;
2183
2184 if (type & PCI_EXP_IDO_REQUEST)
2185 ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN;
2186 if (type & PCI_EXP_IDO_COMPLETION)
2187 ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN;
2188 if (ctrl)
2189 pcie_capability_set_word(dev, PCI_EXP_DEVCTL2, ctrl);
2190}
2191EXPORT_SYMBOL(pci_enable_ido);
2192
2193/**
2194 * pci_disable_ido - disable ID-based ordering on a device
2195 * @dev: the PCI device
2196 * @type: which types of IDO to disable
2197 */
2198void pci_disable_ido(struct pci_dev *dev, unsigned long type)
2199{
2200 u16 ctrl = 0;
2201
2202 if (type & PCI_EXP_IDO_REQUEST)
2203 ctrl |= PCI_EXP_DEVCTL2_IDO_REQ_EN;
2204 if (type & PCI_EXP_IDO_COMPLETION)
2205 ctrl |= PCI_EXP_DEVCTL2_IDO_CMP_EN;
2206 if (ctrl)
2207 pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2, ctrl);
2208}
2209EXPORT_SYMBOL(pci_disable_ido);
2210
2211/**
2212 * pci_enable_obff - enable optimized buffer flush/fill
2213 * @dev: PCI device
2214 * @type: type of signaling to use
2215 *
2216 * Try to enable @type OBFF signaling on @dev. It will try using WAKE#
2217 * signaling if possible, falling back to message signaling only if
2218 * WAKE# isn't supported. @type should indicate whether the PCIe link
2219 * be brought out of L0s or L1 to send the message. It should be either
2220 * %PCI_EXP_OBFF_SIGNAL_ALWAYS or %PCI_OBFF_SIGNAL_L0.
2221 *
2222 * If your device can benefit from receiving all messages, even at the
2223 * power cost of bringing the link back up from a low power state, use
2224 * %PCI_EXP_OBFF_SIGNAL_ALWAYS. Otherwise, use %PCI_OBFF_SIGNAL_L0 (the
2225 * preferred type).
2226 *
2227 * RETURNS:
2228 * Zero on success, appropriate error number on failure.
2229 */
2230int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type type)
2231{
2232 u32 cap;
2233 u16 ctrl;
2234 int ret;
2235
2236 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap);
2237 if (!(cap & PCI_EXP_DEVCAP2_OBFF_MASK))
2238 return -ENOTSUPP; /* no OBFF support at all */
2239
2240 /* Make sure the topology supports OBFF as well */
2241 if (dev->bus->self) {
2242 ret = pci_enable_obff(dev->bus->self, type);
2243 if (ret)
2244 return ret;
2245 }
2246
2247 pcie_capability_read_word(dev, PCI_EXP_DEVCTL2, &ctrl);
2248 if (cap & PCI_EXP_DEVCAP2_OBFF_WAKE)
2249 ctrl |= PCI_EXP_DEVCTL2_OBFF_WAKE_EN;
2250 else {
2251 switch (type) {
2252 case PCI_EXP_OBFF_SIGNAL_L0:
2253 if (!(ctrl & PCI_EXP_DEVCTL2_OBFF_WAKE_EN))
2254 ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGA_EN;
2255 break;
2256 case PCI_EXP_OBFF_SIGNAL_ALWAYS:
2257 ctrl &= ~PCI_EXP_DEVCTL2_OBFF_WAKE_EN;
2258 ctrl |= PCI_EXP_DEVCTL2_OBFF_MSGB_EN;
2259 break;
2260 default:
2261 WARN(1, "bad OBFF signal type\n");
2262 return -ENOTSUPP;
2263 }
2264 }
2265 pcie_capability_write_word(dev, PCI_EXP_DEVCTL2, ctrl);
2266
2267 return 0;
2268}
2269EXPORT_SYMBOL(pci_enable_obff);
2270
2271/**
2272 * pci_disable_obff - disable optimized buffer flush/fill
2273 * @dev: PCI device
2274 *
2275 * Disable OBFF on @dev.
2276 */
2277void pci_disable_obff(struct pci_dev *dev)
2278{
2279 pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2,
2280 PCI_EXP_DEVCTL2_OBFF_WAKE_EN);
2281}
2282EXPORT_SYMBOL(pci_disable_obff);
2283
2284/**
2285 * pci_ltr_supported - check whether a device supports LTR
2286 * @dev: PCI device
2287 *
2288 * RETURNS:
2289 * True if @dev supports latency tolerance reporting, false otherwise.
2290 */
2291static bool pci_ltr_supported(struct pci_dev *dev)
2292{
2293 u32 cap;
2294
2295 pcie_capability_read_dword(dev, PCI_EXP_DEVCAP2, &cap);
2296
2297 return cap & PCI_EXP_DEVCAP2_LTR;
2298}
2299
2300/**
2301 * pci_enable_ltr - enable latency tolerance reporting
2302 * @dev: PCI device
2303 *
2304 * Enable LTR on @dev if possible, which means enabling it first on
2305 * upstream ports.
2306 *
2307 * RETURNS:
2308 * Zero on success, errno on failure.
2309 */
2310int pci_enable_ltr(struct pci_dev *dev)
2311{
2312 int ret;
2313
2314 /* Only primary function can enable/disable LTR */
2315 if (PCI_FUNC(dev->devfn) != 0)
2316 return -EINVAL;
2317
2318 if (!pci_ltr_supported(dev))
2319 return -ENOTSUPP;
2320
2321 /* Enable upstream ports first */
2322 if (dev->bus->self) {
2323 ret = pci_enable_ltr(dev->bus->self);
2324 if (ret)
2325 return ret;
2326 }
2327
2328 return pcie_capability_set_word(dev, PCI_EXP_DEVCTL2,
2329 PCI_EXP_DEVCTL2_LTR_EN);
2330}
2331EXPORT_SYMBOL(pci_enable_ltr);
2332
2333/**
2334 * pci_disable_ltr - disable latency tolerance reporting
2335 * @dev: PCI device
2336 */
2337void pci_disable_ltr(struct pci_dev *dev)
2338{
2339 /* Only primary function can enable/disable LTR */
2340 if (PCI_FUNC(dev->devfn) != 0)
2341 return;
2342
2343 if (!pci_ltr_supported(dev))
2344 return;
2345
2346 pcie_capability_clear_word(dev, PCI_EXP_DEVCTL2,
2347 PCI_EXP_DEVCTL2_LTR_EN);
2348}
2349EXPORT_SYMBOL(pci_disable_ltr);
2350
2351static int __pci_ltr_scale(int *val)
2352{
2353 int scale = 0;
2354
2355 while (*val > 1023) {
2356 *val = (*val + 31) / 32;
2357 scale++;
2358 }
2359 return scale;
2360}
2361
2362/**
2363 * pci_set_ltr - set LTR latency values
2364 * @dev: PCI device
2365 * @snoop_lat_ns: snoop latency in nanoseconds
2366 * @nosnoop_lat_ns: nosnoop latency in nanoseconds
2367 *
2368 * Figure out the scale and set the LTR values accordingly.
2369 */
2370int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns)
2371{
2372 int pos, ret, snoop_scale, nosnoop_scale;
2373 u16 val;
2374
2375 if (!pci_ltr_supported(dev))
2376 return -ENOTSUPP;
2377
2378 snoop_scale = __pci_ltr_scale(&snoop_lat_ns);
2379 nosnoop_scale = __pci_ltr_scale(&nosnoop_lat_ns);
2380
2381 if (snoop_lat_ns > PCI_LTR_VALUE_MASK ||
2382 nosnoop_lat_ns > PCI_LTR_VALUE_MASK)
2383 return -EINVAL;
2384
2385 if ((snoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)) ||
2386 (nosnoop_scale > (PCI_LTR_SCALE_MASK >> PCI_LTR_SCALE_SHIFT)))
2387 return -EINVAL;
2388
2389 pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_LTR);
2390 if (!pos)
2391 return -ENOTSUPP;
2392
2393 val = (snoop_scale << PCI_LTR_SCALE_SHIFT) | snoop_lat_ns;
2394 ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_SNOOP_LAT, val);
2395 if (ret != 4)
2396 return -EIO;
2397
2398 val = (nosnoop_scale << PCI_LTR_SCALE_SHIFT) | nosnoop_lat_ns;
2399 ret = pci_write_config_word(dev, pos + PCI_LTR_MAX_NOSNOOP_LAT, val);
2400 if (ret != 4)
2401 return -EIO;
2402
2403 return 0;
2404}
2405EXPORT_SYMBOL(pci_set_ltr);
2406
2407static int pci_acs_enable; 2172static int pci_acs_enable;
2408 2173
2409/** 2174/**
@@ -4482,7 +4247,6 @@ EXPORT_SYMBOL(pci_restore_state);
4482EXPORT_SYMBOL(pci_pme_capable); 4247EXPORT_SYMBOL(pci_pme_capable);
4483EXPORT_SYMBOL(pci_pme_active); 4248EXPORT_SYMBOL(pci_pme_active);
4484EXPORT_SYMBOL(pci_wake_from_d3); 4249EXPORT_SYMBOL(pci_wake_from_d3);
4485EXPORT_SYMBOL(pci_target_state);
4486EXPORT_SYMBOL(pci_prepare_to_sleep); 4250EXPORT_SYMBOL(pci_prepare_to_sleep);
4487EXPORT_SYMBOL(pci_back_from_sleep); 4251EXPORT_SYMBOL(pci_back_from_sleep);
4488EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state); 4252EXPORT_SYMBOL_GPL(pci_set_pcie_reset_state);
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 9c91ecc1301b..4df38df224f4 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -6,7 +6,6 @@
6#define PCI_CFG_SPACE_SIZE 256 6#define PCI_CFG_SPACE_SIZE 256
7#define PCI_CFG_SPACE_EXP_SIZE 4096 7#define PCI_CFG_SPACE_EXP_SIZE 4096
8 8
9extern const unsigned char pcix_bus_speed[];
10extern const unsigned char pcie_link_speed[]; 9extern const unsigned char pcie_link_speed[];
11 10
12/* Functions internal to the PCI core code */ 11/* Functions internal to the PCI core code */
@@ -68,7 +67,6 @@ void pci_power_up(struct pci_dev *dev);
68void pci_disable_enabled_device(struct pci_dev *dev); 67void pci_disable_enabled_device(struct pci_dev *dev);
69int pci_finish_runtime_suspend(struct pci_dev *dev); 68int pci_finish_runtime_suspend(struct pci_dev *dev);
70int __pci_pme_wakeup(struct pci_dev *dev, void *ign); 69int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
71void pci_wakeup_bus(struct pci_bus *bus);
72void pci_config_pm_runtime_get(struct pci_dev *dev); 70void pci_config_pm_runtime_get(struct pci_dev *dev);
73void pci_config_pm_runtime_put(struct pci_dev *dev); 71void pci_config_pm_runtime_put(struct pci_dev *dev);
74void pci_pm_init(struct pci_dev *dev); 72void pci_pm_init(struct pci_dev *dev);
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
index f1272dc54de1..e1e7026b838d 100644
--- a/drivers/pci/pcie/aspm.c
+++ b/drivers/pci/pcie/aspm.c
@@ -984,18 +984,6 @@ void pcie_no_aspm(void)
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 **/
993int pcie_aspm_enabled(void)
994{
995 return !aspm_disabled;
996}
997EXPORT_SYMBOL(pcie_aspm_enabled);
998
999bool pcie_aspm_support_enabled(void) 987bool pcie_aspm_support_enabled(void)
1000{ 988{
1001 return aspm_support_enabled; 989 return aspm_support_enabled;
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 23cdfac0bdb3..c86c8638d3c4 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -16,7 +16,7 @@
16#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */ 16#define CARDBUS_LATENCY_TIMER 176 /* secondary latency timer */
17#define CARDBUS_RESERVE_BUSNR 3 17#define CARDBUS_RESERVE_BUSNR 3
18 18
19struct resource busn_resource = { 19static struct resource busn_resource = {
20 .name = "PCI busn", 20 .name = "PCI busn",
21 .start = 0, 21 .start = 0,
22 .end = 255, 22 .end = 255,
@@ -518,7 +518,7 @@ static struct pci_host_bridge *pci_alloc_host_bridge(struct pci_bus *b)
518 return bridge; 518 return bridge;
519} 519}
520 520
521const unsigned char pcix_bus_speed[] = { 521static const unsigned char pcix_bus_speed[] = {
522 PCI_SPEED_UNKNOWN, /* 0 */ 522 PCI_SPEED_UNKNOWN, /* 0 */
523 PCI_SPEED_66MHz_PCIX, /* 1 */ 523 PCI_SPEED_66MHz_PCIX, /* 1 */
524 PCI_SPEED_100MHz_PCIX, /* 2 */ 524 PCI_SPEED_100MHz_PCIX, /* 2 */
@@ -999,6 +999,60 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev)
999 pdev->is_hotplug_bridge = 1; 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 */
1014static 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
1030int 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#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED) 1056#define LEGACY_IO_RESOURCE (IORESOURCE_IO | IORESOURCE_PCI_FIXED)
1003 1057
1004/** 1058/**
@@ -1190,59 +1244,6 @@ static void pci_release_dev(struct device *dev)
1190 kfree(pci_dev); 1244 kfree(pci_dev);
1191} 1245}
1192 1246
1193/**
1194 * pci_cfg_space_size - get the configuration space size of the PCI device.
1195 * @dev: PCI device
1196 *
1197 * Regular PCI devices have 256 bytes, but PCI-X 2 and PCI Express devices
1198 * have 4096 bytes. Even if the device is capable, that doesn't mean we can
1199 * access it. Maybe we don't have a way to generate extended config space
1200 * accesses, or the device is behind a reverse Express bridge. So we try
1201 * reading the dword at 0x100 which must either be 0 or a valid extended
1202 * capability header.
1203 */
1204int pci_cfg_space_size_ext(struct pci_dev *dev)
1205{
1206 u32 status;
1207 int pos = PCI_CFG_SPACE_SIZE;
1208
1209 if (pci_read_config_dword(dev, pos, &status) != PCIBIOS_SUCCESSFUL)
1210 goto fail;
1211 if (status == 0xffffffff)
1212 goto fail;
1213
1214 return PCI_CFG_SPACE_EXP_SIZE;
1215
1216 fail:
1217 return PCI_CFG_SPACE_SIZE;
1218}
1219
1220int pci_cfg_space_size(struct pci_dev *dev)
1221{
1222 int pos;
1223 u32 status;
1224 u16 class;
1225
1226 class = dev->class >> 8;
1227 if (class == PCI_CLASS_BRIDGE_HOST)
1228 return pci_cfg_space_size_ext(dev);
1229
1230 if (!pci_is_pcie(dev)) {
1231 pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
1232 if (!pos)
1233 goto fail;
1234
1235 pci_read_config_dword(dev, pos + PCI_X_STATUS, &status);
1236 if (!(status & (PCI_X_STATUS_266MHZ | PCI_X_STATUS_533MHZ)))
1237 goto fail;
1238 }
1239
1240 return pci_cfg_space_size_ext(dev);
1241
1242 fail:
1243 return PCI_CFG_SPACE_SIZE;
1244}
1245
1246struct pci_dev *pci_alloc_dev(struct pci_bus *bus) 1247struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
1247{ 1248{
1248 struct pci_dev *dev; 1249 struct pci_dev *dev;
@@ -1259,12 +1260,6 @@ struct pci_dev *pci_alloc_dev(struct pci_bus *bus)
1259} 1260}
1260EXPORT_SYMBOL(pci_alloc_dev); 1261EXPORT_SYMBOL(pci_alloc_dev);
1261 1262
1262struct pci_dev *alloc_pci_dev(void)
1263{
1264 return pci_alloc_dev(NULL);
1265}
1266EXPORT_SYMBOL(alloc_pci_dev);
1267
1268bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l, 1263bool pci_bus_read_dev_vendor_id(struct pci_bus *bus, int devfn, u32 *l,
1269 int crs_timeout) 1264 int crs_timeout)
1270{ 1265{
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c
index 448ca562d1f8..7dd62fa9d0bd 100644
--- a/drivers/pci/slot.c
+++ b/drivers/pci/slot.c
@@ -320,32 +320,6 @@ err:
320EXPORT_SYMBOL_GPL(pci_create_slot); 320EXPORT_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 */
331void 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;
343out:
344 up_write(&pci_bus_sem);
345}
346EXPORT_SYMBOL_GPL(pci_renumber_slot);
347
348/**
349 * pci_destroy_slot - decrement refcount for physical PCI slot 323 * pci_destroy_slot - decrement refcount for physical PCI slot
350 * @slot: struct pci_slot to decrement 324 * @slot: struct pci_slot to decrement
351 * 325 *
diff --git a/include/linux/pci-ats.h b/include/linux/pci-ats.h
index 68bcefd7fca0..72031785fe1d 100644
--- a/include/linux/pci-ats.h
+++ b/include/linux/pci-ats.h
@@ -56,10 +56,7 @@ static inline int pci_ats_enabled(struct pci_dev *dev)
56 56
57int pci_enable_pri(struct pci_dev *pdev, u32 reqs); 57int pci_enable_pri(struct pci_dev *pdev, u32 reqs);
58void pci_disable_pri(struct pci_dev *pdev); 58void pci_disable_pri(struct pci_dev *pdev);
59bool pci_pri_enabled(struct pci_dev *pdev);
60int pci_reset_pri(struct pci_dev *pdev); 59int pci_reset_pri(struct pci_dev *pdev);
61bool pci_pri_stopped(struct pci_dev *pdev);
62int pci_pri_status(struct pci_dev *pdev);
63 60
64#else /* CONFIG_PCI_PRI */ 61#else /* CONFIG_PCI_PRI */
65 62
@@ -72,25 +69,11 @@ static inline void pci_disable_pri(struct pci_dev *pdev)
72{ 69{
73} 70}
74 71
75static inline bool pci_pri_enabled(struct pci_dev *pdev)
76{
77 return false;
78}
79
80static inline int pci_reset_pri(struct pci_dev *pdev) 72static inline int pci_reset_pri(struct pci_dev *pdev)
81{ 73{
82 return -ENODEV; 74 return -ENODEV;
83} 75}
84 76
85static inline bool pci_pri_stopped(struct pci_dev *pdev)
86{
87 return true;
88}
89
90static inline int pci_pri_status(struct pci_dev *pdev)
91{
92 return -ENODEV;
93}
94#endif /* CONFIG_PCI_PRI */ 77#endif /* CONFIG_PCI_PRI */
95 78
96#ifdef CONFIG_PCI_PASID 79#ifdef CONFIG_PCI_PASID
diff --git a/include/linux/pci.h b/include/linux/pci.h
index f7d1dcc002fa..eba7764b1586 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -376,7 +376,6 @@ static inline struct pci_dev *pci_physfn(struct pci_dev *dev)
376} 376}
377 377
378struct pci_dev *pci_alloc_dev(struct pci_bus *bus); 378struct pci_dev *pci_alloc_dev(struct pci_bus *bus);
379struct pci_dev * __deprecated alloc_pci_dev(void);
380 379
381#define to_pci_dev(n) container_of(n, struct pci_dev, dev) 380#define to_pci_dev(n) container_of(n, struct pci_dev, dev)
382#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL) 381#define for_each_pci_dev(d) while ((d = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, d)) != NULL)
@@ -386,8 +385,6 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
386 return (pdev->error_state != pci_channel_io_normal); 385 return (pdev->error_state != pci_channel_io_normal);
387} 386}
388 387
389extern struct resource busn_resource;
390
391struct pci_host_bridge_window { 388struct pci_host_bridge_window {
392 struct list_head list; 389 struct list_head list;
393 struct resource *res; /* host bridge aperture (CPU address) */ 390 struct resource *res; /* host bridge aperture (CPU address) */
@@ -763,7 +760,6 @@ struct pci_slot *pci_create_slot(struct pci_bus *parent, int slot_nr,
763 const char *name, 760 const char *name,
764 struct hotplug_slot *hotplug); 761 struct hotplug_slot *hotplug);
765void pci_destroy_slot(struct pci_slot *slot); 762void pci_destroy_slot(struct pci_slot *slot);
766void pci_renumber_slot(struct pci_slot *slot, int slot_nr);
767int pci_scan_slot(struct pci_bus *bus, int devfn); 763int pci_scan_slot(struct pci_bus *bus, int devfn);
768struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn); 764struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn);
769void pci_device_add(struct pci_dev *dev, struct pci_bus *bus); 765void pci_device_add(struct pci_dev *dev, struct pci_bus *bus);
@@ -974,7 +970,6 @@ void __iomem __must_check *pci_platform_rom(struct pci_dev *pdev, size_t *size);
974int pci_save_state(struct pci_dev *dev); 970int pci_save_state(struct pci_dev *dev);
975void pci_restore_state(struct pci_dev *dev); 971void pci_restore_state(struct pci_dev *dev);
976struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev); 972struct pci_saved_state *pci_store_saved_state(struct pci_dev *dev);
977int pci_load_saved_state(struct pci_dev *dev, struct pci_saved_state *state);
978int pci_load_and_free_saved_state(struct pci_dev *dev, 973int pci_load_and_free_saved_state(struct pci_dev *dev,
979 struct pci_saved_state **state); 974 struct pci_saved_state **state);
980struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap); 975struct pci_cap_saved_state *pci_find_saved_cap(struct pci_dev *dev, char cap);
@@ -991,7 +986,6 @@ void pci_pme_active(struct pci_dev *dev, bool enable);
991int __pci_enable_wake(struct pci_dev *dev, pci_power_t state, 986int __pci_enable_wake(struct pci_dev *dev, pci_power_t state,
992 bool runtime, bool enable); 987 bool runtime, bool enable);
993int pci_wake_from_d3(struct pci_dev *dev, bool enable); 988int pci_wake_from_d3(struct pci_dev *dev, bool enable);
994pci_power_t pci_target_state(struct pci_dev *dev);
995int pci_prepare_to_sleep(struct pci_dev *dev); 989int pci_prepare_to_sleep(struct pci_dev *dev);
996int pci_back_from_sleep(struct pci_dev *dev); 990int pci_back_from_sleep(struct pci_dev *dev);
997bool pci_dev_run_wake(struct pci_dev *dev); 991bool pci_dev_run_wake(struct pci_dev *dev);
@@ -1009,22 +1003,6 @@ int pci_save_vc_state(struct pci_dev *dev);
1009void pci_restore_vc_state(struct pci_dev *dev); 1003void pci_restore_vc_state(struct pci_dev *dev);
1010void pci_allocate_vc_save_buffers(struct pci_dev *dev); 1004void pci_allocate_vc_save_buffers(struct pci_dev *dev);
1011 1005
1012#define PCI_EXP_IDO_REQUEST (1<<0)
1013#define PCI_EXP_IDO_COMPLETION (1<<1)
1014void pci_enable_ido(struct pci_dev *dev, unsigned long type);
1015void pci_disable_ido(struct pci_dev *dev, unsigned long type);
1016
1017enum pci_obff_signal_type {
1018 PCI_EXP_OBFF_SIGNAL_L0 = 0,
1019 PCI_EXP_OBFF_SIGNAL_ALWAYS = 1,
1020};
1021int pci_enable_obff(struct pci_dev *dev, enum pci_obff_signal_type);
1022void pci_disable_obff(struct pci_dev *dev);
1023
1024int pci_enable_ltr(struct pci_dev *dev);
1025void pci_disable_ltr(struct pci_dev *dev);
1026int pci_set_ltr(struct pci_dev *dev, int snoop_lat_ns, int nosnoop_lat_ns);
1027
1028/* For use by arch with custom probe code */ 1006/* For use by arch with custom probe code */
1029void set_pcie_port_type(struct pci_dev *pdev); 1007void set_pcie_port_type(struct pci_dev *pdev);
1030void set_pcie_hotplug_bridge(struct pci_dev *pdev); 1008void set_pcie_hotplug_bridge(struct pci_dev *pdev);
@@ -1037,7 +1015,6 @@ unsigned int pci_rescan_bus(struct pci_bus *bus);
1037/* Vital product data routines */ 1015/* Vital product data routines */
1038ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf); 1016ssize_t pci_read_vpd(struct pci_dev *dev, loff_t pos, size_t count, void *buf);
1039ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf); 1017ssize_t pci_write_vpd(struct pci_dev *dev, loff_t pos, size_t count, const void *buf);
1040int pci_vpd_truncate(struct pci_dev *dev, size_t size);
1041 1018
1042/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */ 1019/* Helper functions for low-level code (drivers/pci/setup-[bus,res].c) */
1043resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx); 1020resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx);
@@ -1134,7 +1111,6 @@ int pci_scan_bridge(struct pci_bus *bus, struct pci_dev *dev, int max,
1134 1111
1135void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), 1112void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *),
1136 void *userdata); 1113 void *userdata);
1137int pci_cfg_space_size_ext(struct pci_dev *dev);
1138int pci_cfg_space_size(struct pci_dev *dev); 1114int pci_cfg_space_size(struct pci_dev *dev);
1139unsigned char pci_bus_max_busnr(struct pci_bus *bus); 1115unsigned char pci_bus_max_busnr(struct pci_bus *bus);
1140void pci_setup_bridge(struct pci_bus *bus); 1116void pci_setup_bridge(struct pci_bus *bus);
@@ -1250,10 +1226,8 @@ extern bool pcie_ports_auto;
1250#endif 1226#endif
1251 1227
1252#ifndef CONFIG_PCIEASPM 1228#ifndef CONFIG_PCIEASPM
1253static inline int pcie_aspm_enabled(void) { return 0; }
1254static inline bool pcie_aspm_support_enabled(void) { return false; } 1229static inline bool pcie_aspm_support_enabled(void) { return false; }
1255#else 1230#else
1256int pcie_aspm_enabled(void);
1257bool pcie_aspm_support_enabled(void); 1231bool pcie_aspm_support_enabled(void);
1258#endif 1232#endif
1259 1233
@@ -1456,23 +1430,6 @@ static inline int pci_enable_wake(struct pci_dev *dev, pci_power_t state,
1456 return 0; 1430 return 0;
1457} 1431}
1458 1432
1459static inline void pci_enable_ido(struct pci_dev *dev, unsigned long type)
1460{
1461}
1462
1463static inline void pci_disable_ido(struct pci_dev *dev, unsigned long type)
1464{
1465}
1466
1467static inline int pci_enable_obff(struct pci_dev *dev, unsigned long type)
1468{
1469 return 0;
1470}
1471
1472static inline void pci_disable_obff(struct pci_dev *dev)
1473{
1474}
1475
1476static inline int pci_request_regions(struct pci_dev *dev, const char *res_name) 1433static inline int pci_request_regions(struct pci_dev *dev, const char *res_name)
1477{ 1434{
1478 return -EIO; 1435 return -EIO;