acpi.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. // SPDX-License-Identifier: GPL-2.0
  2. #define pr_fmt(fmt) "PCI: " fmt
  3. #include <linux/pci.h>
  4. #include <linux/acpi.h>
  5. #include <linux/init.h>
  6. #include <linux/irq.h>
  7. #include <linux/dmi.h>
  8. #include <linux/slab.h>
  9. #include <linux/pci-acpi.h>
  10. #include <asm/numa.h>
  11. #include <asm/pci_x86.h>
  12. struct pci_root_info {
  13. struct acpi_pci_root_info common;
  14. struct pci_sysdata sd;
  15. #ifdef CONFIG_PCI_MMCONFIG
  16. bool mcfg_added;
  17. u8 start_bus;
  18. u8 end_bus;
  19. #endif
  20. };
  21. bool pci_use_e820 = true;
  22. static bool pci_use_crs = true;
  23. static bool pci_ignore_seg;
  24. static int __init set_use_crs(const struct dmi_system_id *id)
  25. {
  26. pci_use_crs = true;
  27. return 0;
  28. }
  29. static int __init set_nouse_crs(const struct dmi_system_id *id)
  30. {
  31. pci_use_crs = false;
  32. return 0;
  33. }
  34. static int __init set_ignore_seg(const struct dmi_system_id *id)
  35. {
  36. pr_info("%s detected: ignoring ACPI _SEG\n", id->ident);
  37. pci_ignore_seg = true;
  38. return 0;
  39. }
  40. static int __init set_no_e820(const struct dmi_system_id *id)
  41. {
  42. pr_info("%s detected: not clipping E820 regions from _CRS\n",
  43. id->ident);
  44. pci_use_e820 = false;
  45. return 0;
  46. }
  47. static const struct dmi_system_id pci_crs_quirks[] __initconst = {
  48. /* http://bugzilla.kernel.org/show_bug.cgi?id=14183 */
  49. {
  50. .callback = set_use_crs,
  51. .ident = "IBM System x3800",
  52. .matches = {
  53. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  54. DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
  55. },
  56. },
  57. /* https://bugzilla.kernel.org/show_bug.cgi?id=16007 */
  58. /* 2006 AMD HT/VIA system with two host bridges */
  59. {
  60. .callback = set_use_crs,
  61. .ident = "ASRock ALiveSATA2-GLAN",
  62. .matches = {
  63. DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"),
  64. },
  65. },
  66. /* https://bugzilla.kernel.org/show_bug.cgi?id=30552 */
  67. /* 2006 AMD HT/VIA system with two host bridges */
  68. {
  69. .callback = set_use_crs,
  70. .ident = "ASUS M2V-MX SE",
  71. .matches = {
  72. DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
  73. DMI_MATCH(DMI_BOARD_NAME, "M2V-MX SE"),
  74. DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
  75. },
  76. },
  77. /* https://bugzilla.kernel.org/show_bug.cgi?id=42619 */
  78. {
  79. .callback = set_use_crs,
  80. .ident = "MSI MS-7253",
  81. .matches = {
  82. DMI_MATCH(DMI_BOARD_VENDOR, "MICRO-STAR INTERNATIONAL CO., LTD"),
  83. DMI_MATCH(DMI_BOARD_NAME, "MS-7253"),
  84. DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
  85. },
  86. },
  87. /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/931368 */
  88. /* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1033299 */
  89. {
  90. .callback = set_use_crs,
  91. .ident = "Foxconn K8M890-8237A",
  92. .matches = {
  93. DMI_MATCH(DMI_BOARD_VENDOR, "Foxconn"),
  94. DMI_MATCH(DMI_BOARD_NAME, "K8M890-8237A"),
  95. DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"),
  96. },
  97. },
  98. /* Now for the blacklist.. */
  99. /* https://bugzilla.redhat.com/show_bug.cgi?id=769657 */
  100. {
  101. .callback = set_nouse_crs,
  102. .ident = "Dell Studio 1557",
  103. .matches = {
  104. DMI_MATCH(DMI_BOARD_VENDOR, "Dell Inc."),
  105. DMI_MATCH(DMI_PRODUCT_NAME, "Studio 1557"),
  106. DMI_MATCH(DMI_BIOS_VERSION, "A09"),
  107. },
  108. },
  109. /* https://bugzilla.redhat.com/show_bug.cgi?id=769657 */
  110. {
  111. .callback = set_nouse_crs,
  112. .ident = "Thinkpad SL510",
  113. .matches = {
  114. DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
  115. DMI_MATCH(DMI_BOARD_NAME, "2847DFG"),
  116. DMI_MATCH(DMI_BIOS_VERSION, "6JET85WW (1.43 )"),
  117. },
  118. },
  119. /* https://bugzilla.kernel.org/show_bug.cgi?id=42606 */
  120. {
  121. .callback = set_nouse_crs,
  122. .ident = "Supermicro X8DTH",
  123. .matches = {
  124. DMI_MATCH(DMI_SYS_VENDOR, "Supermicro"),
  125. DMI_MATCH(DMI_PRODUCT_NAME, "X8DTH-i/6/iF/6F"),
  126. DMI_MATCH(DMI_BIOS_VERSION, "2.0a"),
  127. },
  128. },
  129. /* https://bugzilla.kernel.org/show_bug.cgi?id=15362 */
  130. {
  131. .callback = set_ignore_seg,
  132. .ident = "HP xw9300",
  133. .matches = {
  134. DMI_MATCH(DMI_SYS_VENDOR, "Hewlett-Packard"),
  135. DMI_MATCH(DMI_PRODUCT_NAME, "HP xw9300 Workstation"),
  136. },
  137. },
  138. /*
  139. * Many Lenovo models with "IIL" in their DMI_PRODUCT_VERSION have
  140. * an E820 reserved region that covers the entire 32-bit host
  141. * bridge memory window from _CRS. Using the E820 region to clip
  142. * _CRS means no space is available for hot-added or uninitialized
  143. * PCI devices. This typically breaks I2C controllers for touchpads
  144. * and hot-added Thunderbolt devices. See the commit log for
  145. * models known to require this quirk and related bug reports.
  146. */
  147. {
  148. .callback = set_no_e820,
  149. .ident = "Lenovo *IIL* product version",
  150. .matches = {
  151. DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
  152. DMI_MATCH(DMI_PRODUCT_VERSION, "IIL"),
  153. },
  154. },
  155. /*
  156. * The Acer Spin 5 (SP513-54N) has the same E820 reservation covering
  157. * the entire _CRS 32-bit window issue as the Lenovo *IIL* models.
  158. * See https://bugs.launchpad.net/bugs/1884232
  159. */
  160. {
  161. .callback = set_no_e820,
  162. .ident = "Acer Spin 5 (SP513-54N)",
  163. .matches = {
  164. DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
  165. DMI_MATCH(DMI_PRODUCT_NAME, "Spin SP513-54N"),
  166. },
  167. },
  168. /*
  169. * Clevo X170KM-G barebones have the same E820 reservation covering
  170. * the entire _CRS 32-bit window issue as the Lenovo *IIL* models.
  171. * See https://bugzilla.kernel.org/show_bug.cgi?id=214259
  172. */
  173. {
  174. .callback = set_no_e820,
  175. .ident = "Clevo X170KM-G Barebone",
  176. .matches = {
  177. DMI_MATCH(DMI_BOARD_NAME, "X170KM-G"),
  178. },
  179. },
  180. {}
  181. };
  182. void __init pci_acpi_crs_quirks(void)
  183. {
  184. int year = dmi_get_bios_year();
  185. if (year >= 0 && year < 2008 && iomem_resource.end <= 0xffffffff)
  186. pci_use_crs = false;
  187. /*
  188. * Some firmware includes unusable space (host bridge registers,
  189. * hidden PCI device BARs, etc) in PCI host bridge _CRS. This is a
  190. * firmware defect, and 4dc2287c1805 ("x86: avoid E820 regions when
  191. * allocating address space") has clipped out the unusable space in
  192. * the past.
  193. *
  194. * But other firmware supplies E820 reserved regions that cover
  195. * entire _CRS windows, so clipping throws away the entire window,
  196. * leaving none for hot-added or uninitialized devices. These E820
  197. * entries are probably *not* a firmware defect, so disable the
  198. * clipping by default for post-2022 machines.
  199. *
  200. * We already have quirks to disable clipping for pre-2023
  201. * machines, and we'll likely need quirks to *enable* clipping for
  202. * post-2022 machines that incorrectly include unusable space in
  203. * _CRS.
  204. */
  205. if (year >= 2023)
  206. pci_use_e820 = false;
  207. dmi_check_system(pci_crs_quirks);
  208. /*
  209. * If the user specifies "pci=use_crs" or "pci=nocrs" explicitly, that
  210. * takes precedence over anything we figured out above.
  211. */
  212. if (pci_probe & PCI_ROOT_NO_CRS)
  213. pci_use_crs = false;
  214. else if (pci_probe & PCI_USE__CRS)
  215. pci_use_crs = true;
  216. pr_info("%s host bridge windows from ACPI; if necessary, use \"pci=%s\" and report a bug\n",
  217. pci_use_crs ? "Using" : "Ignoring",
  218. pci_use_crs ? "nocrs" : "use_crs");
  219. /* "pci=use_e820"/"pci=no_e820" on the kernel cmdline takes precedence */
  220. if (pci_probe & PCI_NO_E820)
  221. pci_use_e820 = false;
  222. else if (pci_probe & PCI_USE_E820)
  223. pci_use_e820 = true;
  224. pr_info("%s E820 reservations for host bridge windows\n",
  225. pci_use_e820 ? "Using" : "Ignoring");
  226. if (pci_probe & (PCI_NO_E820 | PCI_USE_E820))
  227. pr_info("Please notify linux-pci@vger.kernel.org so future kernels can do this automatically\n");
  228. }
  229. /*
  230. * Check if pdev is part of a PCIe switch that is directly below the
  231. * specified bridge.
  232. */
  233. static bool pcie_switch_directly_under(struct pci_dev *bridge,
  234. struct pci_dev *pdev)
  235. {
  236. struct pci_dev *parent = pci_upstream_bridge(pdev);
  237. /* If the device doesn't have a parent, it's not under anything */
  238. if (!parent)
  239. return false;
  240. /*
  241. * If the device has a PCIe type, check if it is below the
  242. * corresponding PCIe switch components (if applicable). Then check
  243. * if its upstream port is directly beneath the specified bridge.
  244. */
  245. switch (pci_pcie_type(pdev)) {
  246. case PCI_EXP_TYPE_UPSTREAM:
  247. return parent == bridge;
  248. case PCI_EXP_TYPE_DOWNSTREAM:
  249. if (pci_pcie_type(parent) != PCI_EXP_TYPE_UPSTREAM)
  250. return false;
  251. parent = pci_upstream_bridge(parent);
  252. return parent == bridge;
  253. case PCI_EXP_TYPE_ENDPOINT:
  254. if (pci_pcie_type(parent) != PCI_EXP_TYPE_DOWNSTREAM)
  255. return false;
  256. parent = pci_upstream_bridge(parent);
  257. if (!parent || pci_pcie_type(parent) != PCI_EXP_TYPE_UPSTREAM)
  258. return false;
  259. parent = pci_upstream_bridge(parent);
  260. return parent == bridge;
  261. }
  262. return false;
  263. }
  264. static bool pcie_has_usb4_host_interface(struct pci_dev *pdev)
  265. {
  266. struct fwnode_handle *fwnode;
  267. /*
  268. * For USB4, the tunneled PCIe Root or Downstream Ports are marked
  269. * with the "usb4-host-interface" ACPI property, so we look for
  270. * that first. This should cover most cases.
  271. */
  272. fwnode = fwnode_find_reference(dev_fwnode(&pdev->dev),
  273. "usb4-host-interface", 0);
  274. if (!IS_ERR(fwnode)) {
  275. fwnode_handle_put(fwnode);
  276. return true;
  277. }
  278. /*
  279. * Any integrated Thunderbolt 3/4 PCIe Root Ports from Intel
  280. * before Alder Lake do not have the "usb4-host-interface"
  281. * property so we use their PCI IDs instead. All these are
  282. * tunneled. This list is not expected to grow.
  283. */
  284. if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
  285. switch (pdev->device) {
  286. /* Ice Lake Thunderbolt 3 PCIe Root Ports */
  287. case 0x8a1d:
  288. case 0x8a1f:
  289. case 0x8a21:
  290. case 0x8a23:
  291. /* Tiger Lake-LP Thunderbolt 4 PCIe Root Ports */
  292. case 0x9a23:
  293. case 0x9a25:
  294. case 0x9a27:
  295. case 0x9a29:
  296. /* Tiger Lake-H Thunderbolt 4 PCIe Root Ports */
  297. case 0x9a2b:
  298. case 0x9a2d:
  299. case 0x9a2f:
  300. case 0x9a31:
  301. return true;
  302. }
  303. }
  304. return false;
  305. }
  306. bool arch_pci_dev_is_removable(struct pci_dev *pdev)
  307. {
  308. struct pci_dev *parent, *root;
  309. /* pdev without a parent or Root Port is never tunneled */
  310. parent = pci_upstream_bridge(pdev);
  311. if (!parent)
  312. return false;
  313. root = pcie_find_root_port(pdev);
  314. if (!root)
  315. return false;
  316. /* Internal PCIe devices are not tunneled */
  317. if (!root->external_facing)
  318. return false;
  319. /* Anything directly behind a "usb4-host-interface" is tunneled */
  320. if (pcie_has_usb4_host_interface(parent))
  321. return true;
  322. /*
  323. * Check if this is a discrete Thunderbolt/USB4 controller that is
  324. * directly behind the non-USB4 PCIe Root Port marked as
  325. * "ExternalFacingPort". Those are not behind a PCIe tunnel.
  326. */
  327. if (pcie_switch_directly_under(root, pdev))
  328. return false;
  329. /* PCIe devices after the discrete chip are tunneled */
  330. return true;
  331. }
  332. #ifdef CONFIG_PCI_MMCONFIG
  333. static int check_segment(u16 seg, struct device *dev, char *estr)
  334. {
  335. if (seg) {
  336. dev_err(dev, "%s can't access configuration space under this host bridge\n",
  337. estr);
  338. return -EIO;
  339. }
  340. /*
  341. * Failure in adding MMCFG information is not fatal,
  342. * just can't access extended configuration space of
  343. * devices under this host bridge.
  344. */
  345. dev_warn(dev, "%s can't access extended configuration space under this bridge\n",
  346. estr);
  347. return 0;
  348. }
  349. static int setup_mcfg_map(struct acpi_pci_root_info *ci)
  350. {
  351. int result, seg;
  352. struct pci_root_info *info;
  353. struct acpi_pci_root *root = ci->root;
  354. struct device *dev = &ci->bridge->dev;
  355. info = container_of(ci, struct pci_root_info, common);
  356. info->start_bus = (u8)root->secondary.start;
  357. info->end_bus = (u8)root->secondary.end;
  358. info->mcfg_added = false;
  359. seg = info->sd.domain;
  360. dev_dbg(dev, "%s(%04x %pR ECAM %pa)\n", __func__, seg,
  361. &root->secondary, &root->mcfg_addr);
  362. /* return success if MMCFG is not in use */
  363. if (raw_pci_ext_ops && raw_pci_ext_ops != &pci_mmcfg)
  364. return 0;
  365. if (!(pci_probe & PCI_PROBE_MMCONF))
  366. return check_segment(seg, dev, "MMCONFIG is disabled,");
  367. result = pci_mmconfig_insert(dev, seg, info->start_bus, info->end_bus,
  368. root->mcfg_addr);
  369. if (result == 0) {
  370. /* enable MMCFG if it hasn't been enabled yet */
  371. if (raw_pci_ext_ops == NULL)
  372. raw_pci_ext_ops = &pci_mmcfg;
  373. info->mcfg_added = true;
  374. } else if (result != -EEXIST)
  375. return check_segment(seg, dev,
  376. "fail to add MMCONFIG information,");
  377. return 0;
  378. }
  379. static void teardown_mcfg_map(struct acpi_pci_root_info *ci)
  380. {
  381. struct pci_root_info *info;
  382. info = container_of(ci, struct pci_root_info, common);
  383. if (info->mcfg_added) {
  384. pci_mmconfig_delete(info->sd.domain,
  385. info->start_bus, info->end_bus);
  386. info->mcfg_added = false;
  387. }
  388. }
  389. #else
  390. static int setup_mcfg_map(struct acpi_pci_root_info *ci)
  391. {
  392. return 0;
  393. }
  394. static void teardown_mcfg_map(struct acpi_pci_root_info *ci)
  395. {
  396. }
  397. #endif
  398. static int pci_acpi_root_get_node(struct acpi_pci_root *root)
  399. {
  400. int busnum = root->secondary.start;
  401. struct acpi_device *device = root->device;
  402. int node = acpi_get_node(device->handle);
  403. if (node == NUMA_NO_NODE) {
  404. node = x86_pci_root_bus_node(busnum);
  405. if (node != 0 && node != NUMA_NO_NODE)
  406. dev_info(&device->dev, FW_BUG "no _PXM; falling back to node %d from hardware (may be inconsistent with ACPI node numbers)\n",
  407. node);
  408. }
  409. if (node != NUMA_NO_NODE && !node_online(node))
  410. node = NUMA_NO_NODE;
  411. return node;
  412. }
  413. static int pci_acpi_root_init_info(struct acpi_pci_root_info *ci)
  414. {
  415. return setup_mcfg_map(ci);
  416. }
  417. static void pci_acpi_root_release_info(struct acpi_pci_root_info *ci)
  418. {
  419. teardown_mcfg_map(ci);
  420. kfree(container_of(ci, struct pci_root_info, common));
  421. }
  422. /*
  423. * An IO port or MMIO resource assigned to a PCI host bridge may be
  424. * consumed by the host bridge itself or available to its child
  425. * bus/devices. The ACPI specification defines a bit (Producer/Consumer)
  426. * to tell whether the resource is consumed by the host bridge itself,
  427. * but firmware hasn't used that bit consistently, so we can't rely on it.
  428. *
  429. * On x86 and IA64 platforms, all IO port and MMIO resources are assumed
  430. * to be available to child bus/devices except one special case:
  431. * IO port [0xCF8-0xCFF] is consumed by the host bridge itself
  432. * to access PCI configuration space.
  433. *
  434. * So explicitly filter out PCI CFG IO ports[0xCF8-0xCFF].
  435. */
  436. static bool resource_is_pcicfg_ioport(struct resource *res)
  437. {
  438. return (res->flags & IORESOURCE_IO) &&
  439. res->start == 0xCF8 && res->end == 0xCFF;
  440. }
  441. static int pci_acpi_root_prepare_resources(struct acpi_pci_root_info *ci)
  442. {
  443. struct acpi_device *device = ci->bridge;
  444. int busnum = ci->root->secondary.start;
  445. struct resource_entry *entry, *tmp;
  446. int status;
  447. status = acpi_pci_probe_root_resources(ci);
  448. if (pci_use_crs) {
  449. resource_list_for_each_entry_safe(entry, tmp, &ci->resources)
  450. if (resource_is_pcicfg_ioport(entry->res))
  451. resource_list_destroy_entry(entry);
  452. return status;
  453. }
  454. resource_list_for_each_entry_safe(entry, tmp, &ci->resources) {
  455. dev_printk(KERN_DEBUG, &device->dev,
  456. "host bridge window %pR (ignored)\n", entry->res);
  457. resource_list_destroy_entry(entry);
  458. }
  459. x86_pci_root_bus_resources(busnum, &ci->resources);
  460. return 0;
  461. }
  462. static struct acpi_pci_root_ops acpi_pci_root_ops = {
  463. .pci_ops = &pci_root_ops,
  464. .init_info = pci_acpi_root_init_info,
  465. .release_info = pci_acpi_root_release_info,
  466. .prepare_resources = pci_acpi_root_prepare_resources,
  467. };
  468. struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
  469. {
  470. int domain = root->segment;
  471. int busnum = root->secondary.start;
  472. int node = pci_acpi_root_get_node(root);
  473. struct pci_bus *bus;
  474. if (pci_ignore_seg)
  475. root->segment = domain = 0;
  476. if (domain && !pci_domains_supported) {
  477. pr_warn("pci_bus %04x:%02x: ignored (multiple domains not supported)\n",
  478. domain, busnum);
  479. return NULL;
  480. }
  481. bus = pci_find_bus(domain, busnum);
  482. if (bus) {
  483. /*
  484. * If the desired bus has been scanned already, replace
  485. * its bus->sysdata.
  486. */
  487. struct pci_sysdata sd = {
  488. .domain = domain,
  489. .node = node,
  490. .companion = root->device
  491. };
  492. memcpy(bus->sysdata, &sd, sizeof(sd));
  493. } else {
  494. struct pci_root_info *info;
  495. info = kzalloc(sizeof(*info), GFP_KERNEL);
  496. if (!info)
  497. dev_err(&root->device->dev,
  498. "pci_bus %04x:%02x: ignored (out of memory)\n",
  499. domain, busnum);
  500. else {
  501. info->sd.domain = domain;
  502. info->sd.node = node;
  503. info->sd.companion = root->device;
  504. bus = acpi_pci_root_create(root, &acpi_pci_root_ops,
  505. &info->common, &info->sd);
  506. }
  507. }
  508. /* After the PCI-E bus has been walked and all devices discovered,
  509. * configure any settings of the fabric that might be necessary.
  510. */
  511. if (bus) {
  512. struct pci_bus *child;
  513. list_for_each_entry(child, &bus->children, node)
  514. pcie_bus_configure_settings(child);
  515. }
  516. return bus;
  517. }
  518. int pcibios_root_bridge_prepare(struct pci_host_bridge *bridge)
  519. {
  520. /*
  521. * We pass NULL as parent to pci_create_root_bus(), so if it is not NULL
  522. * here, pci_create_root_bus() has been called by someone else and
  523. * sysdata is likely to be different from what we expect. Let it go in
  524. * that case.
  525. */
  526. if (!bridge->dev.parent) {
  527. struct pci_sysdata *sd = bridge->bus->sysdata;
  528. ACPI_COMPANION_SET(&bridge->dev, sd->companion);
  529. }
  530. return 0;
  531. }
  532. int __init pci_acpi_init(void)
  533. {
  534. struct pci_dev *dev = NULL;
  535. if (acpi_noirq)
  536. return -ENODEV;
  537. pr_info("Using ACPI for IRQ routing\n");
  538. acpi_irq_penalty_init();
  539. pcibios_enable_irq = acpi_pci_irq_enable;
  540. pcibios_disable_irq = acpi_pci_irq_disable;
  541. x86_init.pci.init_irq = x86_init_noop;
  542. if (pci_routeirq) {
  543. /*
  544. * PCI IRQ routing is set up by pci_enable_device(), but we
  545. * also do it here in case there are still broken drivers that
  546. * don't use pci_enable_device().
  547. */
  548. pr_info("Routing PCI interrupts for all devices because \"pci=routeirq\" specified\n");
  549. for_each_pci_dev(dev)
  550. acpi_pci_irq_enable(dev);
  551. }
  552. return 0;
  553. }