common.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697
  1. /*
  2. * Low-Level PCI Support for PC
  3. *
  4. * (c) 1999--2000 Martin Mares <mj@ucw.cz>
  5. */
  6. #include <linux/sched.h>
  7. #include <linux/pci.h>
  8. #include <linux/pci-acpi.h>
  9. #include <linux/ioport.h>
  10. #include <linux/init.h>
  11. #include <linux/dmi.h>
  12. #include <linux/slab.h>
  13. #include <asm-generic/pci-bridge.h>
  14. #include <asm/acpi.h>
  15. #include <asm/segment.h>
  16. #include <asm/io.h>
  17. #include <asm/smp.h>
  18. #include <asm/pci_x86.h>
  19. #include <asm/setup.h>
  20. unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 |
  21. PCI_PROBE_MMCONF;
  22. unsigned int pci_early_dump_regs;
  23. static int pci_bf_sort;
  24. static int smbios_type_b1_flag;
  25. int pci_routeirq;
  26. int noioapicquirk;
  27. #ifdef CONFIG_X86_REROUTE_FOR_BROKEN_BOOT_IRQS
  28. int noioapicreroute = 0;
  29. #else
  30. int noioapicreroute = 1;
  31. #endif
  32. int pcibios_last_bus = -1;
  33. unsigned long pirq_table_addr;
  34. const struct pci_raw_ops *__read_mostly raw_pci_ops;
  35. const struct pci_raw_ops *__read_mostly raw_pci_ext_ops;
  36. int raw_pci_read(unsigned int domain, unsigned int bus, unsigned int devfn,
  37. int reg, int len, u32 *val)
  38. {
  39. if (domain == 0 && reg < 256 && raw_pci_ops)
  40. return raw_pci_ops->read(domain, bus, devfn, reg, len, val);
  41. if (raw_pci_ext_ops)
  42. return raw_pci_ext_ops->read(domain, bus, devfn, reg, len, val);
  43. return -EINVAL;
  44. }
  45. int raw_pci_write(unsigned int domain, unsigned int bus, unsigned int devfn,
  46. int reg, int len, u32 val)
  47. {
  48. if (domain == 0 && reg < 256 && raw_pci_ops)
  49. return raw_pci_ops->write(domain, bus, devfn, reg, len, val);
  50. if (raw_pci_ext_ops)
  51. return raw_pci_ext_ops->write(domain, bus, devfn, reg, len, val);
  52. return -EINVAL;
  53. }
  54. static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value)
  55. {
  56. return raw_pci_read(pci_domain_nr(bus), bus->number,
  57. devfn, where, size, value);
  58. }
  59. static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value)
  60. {
  61. return raw_pci_write(pci_domain_nr(bus), bus->number,
  62. devfn, where, size, value);
  63. }
  64. struct pci_ops pci_root_ops = {
  65. .read = pci_read,
  66. .write = pci_write,
  67. };
  68. /*
  69. * This interrupt-safe spinlock protects all accesses to PCI
  70. * configuration space.
  71. */
  72. DEFINE_RAW_SPINLOCK(pci_config_lock);
  73. static int __init can_skip_ioresource_align(const struct dmi_system_id *d)
  74. {
  75. pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
  76. printk(KERN_INFO "PCI: %s detected, can skip ISA alignment\n", d->ident);
  77. return 0;
  78. }
  79. static const struct dmi_system_id can_skip_pciprobe_dmi_table[] __initconst = {
  80. /*
  81. * Systems where PCI IO resource ISA alignment can be skipped
  82. * when the ISA enable bit in the bridge control is not set
  83. */
  84. {
  85. .callback = can_skip_ioresource_align,
  86. .ident = "IBM System x3800",
  87. .matches = {
  88. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  89. DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
  90. },
  91. },
  92. {
  93. .callback = can_skip_ioresource_align,
  94. .ident = "IBM System x3850",
  95. .matches = {
  96. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  97. DMI_MATCH(DMI_PRODUCT_NAME, "x3850"),
  98. },
  99. },
  100. {
  101. .callback = can_skip_ioresource_align,
  102. .ident = "IBM System x3950",
  103. .matches = {
  104. DMI_MATCH(DMI_SYS_VENDOR, "IBM"),
  105. DMI_MATCH(DMI_PRODUCT_NAME, "x3950"),
  106. },
  107. },
  108. {}
  109. };
  110. void __init dmi_check_skip_isa_align(void)
  111. {
  112. dmi_check_system(can_skip_pciprobe_dmi_table);
  113. }
  114. static void pcibios_fixup_device_resources(struct pci_dev *dev)
  115. {
  116. struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
  117. struct resource *bar_r;
  118. int bar;
  119. if (pci_probe & PCI_NOASSIGN_BARS) {
  120. /*
  121. * If the BIOS did not assign the BAR, zero out the
  122. * resource so the kernel doesn't attmept to assign
  123. * it later on in pci_assign_unassigned_resources
  124. */
  125. for (bar = 0; bar <= PCI_STD_RESOURCE_END; bar++) {
  126. bar_r = &dev->resource[bar];
  127. if (bar_r->start == 0 && bar_r->end != 0) {
  128. bar_r->flags = 0;
  129. bar_r->end = 0;
  130. }
  131. }
  132. }
  133. if (pci_probe & PCI_NOASSIGN_ROMS) {
  134. if (rom_r->parent)
  135. return;
  136. if (rom_r->start) {
  137. /* we deal with BIOS assigned ROM later */
  138. return;
  139. }
  140. rom_r->start = rom_r->end = rom_r->flags = 0;
  141. }
  142. }
  143. /*
  144. * Called after each bus is probed, but before its children
  145. * are examined.
  146. */
  147. void pcibios_fixup_bus(struct pci_bus *b)
  148. {
  149. struct pci_dev *dev;
  150. list_for_each_entry(dev, &b->devices, bus_list)
  151. pcibios_fixup_device_resources(dev);
  152. }
  153. void pcibios_add_bus(struct pci_bus *bus)
  154. {
  155. acpi_pci_add_bus(bus);
  156. }
  157. void pcibios_remove_bus(struct pci_bus *bus)
  158. {
  159. acpi_pci_remove_bus(bus);
  160. }
  161. /*
  162. * Only use DMI information to set this if nothing was passed
  163. * on the kernel command line (which was parsed earlier).
  164. */
  165. static int __init set_bf_sort(const struct dmi_system_id *d)
  166. {
  167. if (pci_bf_sort == pci_bf_sort_default) {
  168. pci_bf_sort = pci_dmi_bf;
  169. printk(KERN_INFO "PCI: %s detected, enabling pci=bfsort.\n", d->ident);
  170. }
  171. return 0;
  172. }
  173. static void __init read_dmi_type_b1(const struct dmi_header *dm,
  174. void *private_data)
  175. {
  176. u8 *d = (u8 *)dm + 4;
  177. if (dm->type != 0xB1)
  178. return;
  179. switch (((*(u32 *)d) >> 9) & 0x03) {
  180. case 0x00:
  181. printk(KERN_INFO "dmi type 0xB1 record - unknown flag\n");
  182. break;
  183. case 0x01: /* set pci=bfsort */
  184. smbios_type_b1_flag = 1;
  185. break;
  186. case 0x02: /* do not set pci=bfsort */
  187. smbios_type_b1_flag = 2;
  188. break;
  189. default:
  190. break;
  191. }
  192. }
  193. static int __init find_sort_method(const struct dmi_system_id *d)
  194. {
  195. dmi_walk(read_dmi_type_b1, NULL);
  196. if (smbios_type_b1_flag == 1) {
  197. set_bf_sort(d);
  198. return 0;
  199. }
  200. return -1;
  201. }
  202. /*
  203. * Enable renumbering of PCI bus# ranges to reach all PCI busses (Cardbus)
  204. */
  205. #ifdef __i386__
  206. static int __init assign_all_busses(const struct dmi_system_id *d)
  207. {
  208. pci_probe |= PCI_ASSIGN_ALL_BUSSES;
  209. printk(KERN_INFO "%s detected: enabling PCI bus# renumbering"
  210. " (pci=assign-busses)\n", d->ident);
  211. return 0;
  212. }
  213. #endif
  214. static int __init set_scan_all(const struct dmi_system_id *d)
  215. {
  216. printk(KERN_INFO "PCI: %s detected, enabling pci=pcie_scan_all\n",
  217. d->ident);
  218. pci_add_flags(PCI_SCAN_ALL_PCIE_DEVS);
  219. return 0;
  220. }
  221. static const struct dmi_system_id pciprobe_dmi_table[] __initconst = {
  222. #ifdef __i386__
  223. /*
  224. * Laptops which need pci=assign-busses to see Cardbus cards
  225. */
  226. {
  227. .callback = assign_all_busses,
  228. .ident = "Samsung X20 Laptop",
  229. .matches = {
  230. DMI_MATCH(DMI_SYS_VENDOR, "Samsung Electronics"),
  231. DMI_MATCH(DMI_PRODUCT_NAME, "SX20S"),
  232. },
  233. },
  234. #endif /* __i386__ */
  235. {
  236. .callback = set_bf_sort,
  237. .ident = "Dell PowerEdge 1950",
  238. .matches = {
  239. DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
  240. DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1950"),
  241. },
  242. },
  243. {
  244. .callback = set_bf_sort,
  245. .ident = "Dell PowerEdge 1955",
  246. .matches = {
  247. DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
  248. DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 1955"),
  249. },
  250. },
  251. {
  252. .callback = set_bf_sort,
  253. .ident = "Dell PowerEdge 2900",
  254. .matches = {
  255. DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
  256. DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2900"),
  257. },
  258. },
  259. {
  260. .callback = set_bf_sort,
  261. .ident = "Dell PowerEdge 2950",
  262. .matches = {
  263. DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
  264. DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge 2950"),
  265. },
  266. },
  267. {
  268. .callback = set_bf_sort,
  269. .ident = "Dell PowerEdge R900",
  270. .matches = {
  271. DMI_MATCH(DMI_SYS_VENDOR, "Dell"),
  272. DMI_MATCH(DMI_PRODUCT_NAME, "PowerEdge R900"),
  273. },
  274. },
  275. {
  276. .callback = find_sort_method,
  277. .ident = "Dell System",
  278. .matches = {
  279. DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
  280. },
  281. },
  282. {
  283. .callback = set_bf_sort,
  284. .ident = "HP ProLiant BL20p G3",
  285. .matches = {
  286. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  287. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G3"),
  288. },
  289. },
  290. {
  291. .callback = set_bf_sort,
  292. .ident = "HP ProLiant BL20p G4",
  293. .matches = {
  294. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  295. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL20p G4"),
  296. },
  297. },
  298. {
  299. .callback = set_bf_sort,
  300. .ident = "HP ProLiant BL30p G1",
  301. .matches = {
  302. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  303. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL30p G1"),
  304. },
  305. },
  306. {
  307. .callback = set_bf_sort,
  308. .ident = "HP ProLiant BL25p G1",
  309. .matches = {
  310. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  311. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL25p G1"),
  312. },
  313. },
  314. {
  315. .callback = set_bf_sort,
  316. .ident = "HP ProLiant BL35p G1",
  317. .matches = {
  318. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  319. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL35p G1"),
  320. },
  321. },
  322. {
  323. .callback = set_bf_sort,
  324. .ident = "HP ProLiant BL45p G1",
  325. .matches = {
  326. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  327. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G1"),
  328. },
  329. },
  330. {
  331. .callback = set_bf_sort,
  332. .ident = "HP ProLiant BL45p G2",
  333. .matches = {
  334. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  335. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL45p G2"),
  336. },
  337. },
  338. {
  339. .callback = set_bf_sort,
  340. .ident = "HP ProLiant BL460c G1",
  341. .matches = {
  342. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  343. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL460c G1"),
  344. },
  345. },
  346. {
  347. .callback = set_bf_sort,
  348. .ident = "HP ProLiant BL465c G1",
  349. .matches = {
  350. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  351. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL465c G1"),
  352. },
  353. },
  354. {
  355. .callback = set_bf_sort,
  356. .ident = "HP ProLiant BL480c G1",
  357. .matches = {
  358. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  359. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL480c G1"),
  360. },
  361. },
  362. {
  363. .callback = set_bf_sort,
  364. .ident = "HP ProLiant BL685c G1",
  365. .matches = {
  366. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  367. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant BL685c G1"),
  368. },
  369. },
  370. {
  371. .callback = set_bf_sort,
  372. .ident = "HP ProLiant DL360",
  373. .matches = {
  374. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  375. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL360"),
  376. },
  377. },
  378. {
  379. .callback = set_bf_sort,
  380. .ident = "HP ProLiant DL380",
  381. .matches = {
  382. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  383. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL380"),
  384. },
  385. },
  386. #ifdef __i386__
  387. {
  388. .callback = assign_all_busses,
  389. .ident = "Compaq EVO N800c",
  390. .matches = {
  391. DMI_MATCH(DMI_SYS_VENDOR, "Compaq"),
  392. DMI_MATCH(DMI_PRODUCT_NAME, "EVO N800c"),
  393. },
  394. },
  395. #endif
  396. {
  397. .callback = set_bf_sort,
  398. .ident = "HP ProLiant DL385 G2",
  399. .matches = {
  400. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  401. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL385 G2"),
  402. },
  403. },
  404. {
  405. .callback = set_bf_sort,
  406. .ident = "HP ProLiant DL585 G2",
  407. .matches = {
  408. DMI_MATCH(DMI_SYS_VENDOR, "HP"),
  409. DMI_MATCH(DMI_PRODUCT_NAME, "ProLiant DL585 G2"),
  410. },
  411. },
  412. {
  413. .callback = set_scan_all,
  414. .ident = "Stratus/NEC ftServer",
  415. .matches = {
  416. DMI_MATCH(DMI_SYS_VENDOR, "Stratus"),
  417. DMI_MATCH(DMI_PRODUCT_NAME, "ftServer"),
  418. },
  419. },
  420. {
  421. .callback = set_scan_all,
  422. .ident = "Stratus/NEC ftServer",
  423. .matches = {
  424. DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
  425. DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R32"),
  426. },
  427. },
  428. {
  429. .callback = set_scan_all,
  430. .ident = "Stratus/NEC ftServer",
  431. .matches = {
  432. DMI_MATCH(DMI_SYS_VENDOR, "NEC"),
  433. DMI_MATCH(DMI_PRODUCT_NAME, "Express5800/R31"),
  434. },
  435. },
  436. {}
  437. };
  438. void __init dmi_check_pciprobe(void)
  439. {
  440. dmi_check_system(pciprobe_dmi_table);
  441. }
  442. void pcibios_scan_root(int busnum)
  443. {
  444. struct pci_bus *bus;
  445. struct pci_sysdata *sd;
  446. LIST_HEAD(resources);
  447. sd = kzalloc(sizeof(*sd), GFP_KERNEL);
  448. if (!sd) {
  449. printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busnum);
  450. return;
  451. }
  452. sd->node = x86_pci_root_bus_node(busnum);
  453. x86_pci_root_bus_resources(busnum, &resources);
  454. printk(KERN_DEBUG "PCI: Probing PCI hardware (bus %02x)\n", busnum);
  455. bus = pci_scan_root_bus(NULL, busnum, &pci_root_ops, sd, &resources);
  456. if (!bus) {
  457. pci_free_resource_list(&resources);
  458. kfree(sd);
  459. return;
  460. }
  461. pci_bus_add_devices(bus);
  462. }
  463. void __init pcibios_set_cache_line_size(void)
  464. {
  465. struct cpuinfo_x86 *c = &boot_cpu_data;
  466. /*
  467. * Set PCI cacheline size to that of the CPU if the CPU has reported it.
  468. * (For older CPUs that don't support cpuid, we se it to 32 bytes
  469. * It's also good for 386/486s (which actually have 16)
  470. * as quite a few PCI devices do not support smaller values.
  471. */
  472. if (c->x86_clflush_size > 0) {
  473. pci_dfl_cache_line_size = c->x86_clflush_size >> 2;
  474. printk(KERN_DEBUG "PCI: pci_cache_line_size set to %d bytes\n",
  475. pci_dfl_cache_line_size << 2);
  476. } else {
  477. pci_dfl_cache_line_size = 32 >> 2;
  478. printk(KERN_DEBUG "PCI: Unknown cacheline size. Setting to 32 bytes\n");
  479. }
  480. }
  481. int __init pcibios_init(void)
  482. {
  483. if (!raw_pci_ops) {
  484. printk(KERN_WARNING "PCI: System does not support PCI\n");
  485. return 0;
  486. }
  487. pcibios_set_cache_line_size();
  488. pcibios_resource_survey();
  489. if (pci_bf_sort >= pci_force_bf)
  490. pci_sort_breadthfirst();
  491. return 0;
  492. }
  493. char *__init pcibios_setup(char *str)
  494. {
  495. if (!strcmp(str, "off")) {
  496. pci_probe = 0;
  497. return NULL;
  498. } else if (!strcmp(str, "bfsort")) {
  499. pci_bf_sort = pci_force_bf;
  500. return NULL;
  501. } else if (!strcmp(str, "nobfsort")) {
  502. pci_bf_sort = pci_force_nobf;
  503. return NULL;
  504. }
  505. #ifdef CONFIG_PCI_BIOS
  506. else if (!strcmp(str, "bios")) {
  507. pci_probe = PCI_PROBE_BIOS;
  508. return NULL;
  509. } else if (!strcmp(str, "nobios")) {
  510. pci_probe &= ~PCI_PROBE_BIOS;
  511. return NULL;
  512. } else if (!strcmp(str, "biosirq")) {
  513. pci_probe |= PCI_BIOS_IRQ_SCAN;
  514. return NULL;
  515. } else if (!strncmp(str, "pirqaddr=", 9)) {
  516. pirq_table_addr = simple_strtoul(str+9, NULL, 0);
  517. return NULL;
  518. }
  519. #endif
  520. #ifdef CONFIG_PCI_DIRECT
  521. else if (!strcmp(str, "conf1")) {
  522. pci_probe = PCI_PROBE_CONF1 | PCI_NO_CHECKS;
  523. return NULL;
  524. }
  525. else if (!strcmp(str, "conf2")) {
  526. pci_probe = PCI_PROBE_CONF2 | PCI_NO_CHECKS;
  527. return NULL;
  528. }
  529. #endif
  530. #ifdef CONFIG_PCI_MMCONFIG
  531. else if (!strcmp(str, "nommconf")) {
  532. pci_probe &= ~PCI_PROBE_MMCONF;
  533. return NULL;
  534. }
  535. else if (!strcmp(str, "check_enable_amd_mmconf")) {
  536. pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
  537. return NULL;
  538. }
  539. #endif
  540. else if (!strcmp(str, "noacpi")) {
  541. acpi_noirq_set();
  542. return NULL;
  543. }
  544. else if (!strcmp(str, "noearly")) {
  545. pci_probe |= PCI_PROBE_NOEARLY;
  546. return NULL;
  547. }
  548. else if (!strcmp(str, "usepirqmask")) {
  549. pci_probe |= PCI_USE_PIRQ_MASK;
  550. return NULL;
  551. } else if (!strncmp(str, "irqmask=", 8)) {
  552. pcibios_irq_mask = simple_strtol(str+8, NULL, 0);
  553. return NULL;
  554. } else if (!strncmp(str, "lastbus=", 8)) {
  555. pcibios_last_bus = simple_strtol(str+8, NULL, 0);
  556. return NULL;
  557. } else if (!strcmp(str, "rom")) {
  558. pci_probe |= PCI_ASSIGN_ROMS;
  559. return NULL;
  560. } else if (!strcmp(str, "norom")) {
  561. pci_probe |= PCI_NOASSIGN_ROMS;
  562. return NULL;
  563. } else if (!strcmp(str, "nobar")) {
  564. pci_probe |= PCI_NOASSIGN_BARS;
  565. return NULL;
  566. } else if (!strcmp(str, "assign-busses")) {
  567. pci_probe |= PCI_ASSIGN_ALL_BUSSES;
  568. return NULL;
  569. } else if (!strcmp(str, "use_crs")) {
  570. pci_probe |= PCI_USE__CRS;
  571. return NULL;
  572. } else if (!strcmp(str, "nocrs")) {
  573. pci_probe |= PCI_ROOT_NO_CRS;
  574. return NULL;
  575. } else if (!strcmp(str, "earlydump")) {
  576. pci_early_dump_regs = 1;
  577. return NULL;
  578. } else if (!strcmp(str, "routeirq")) {
  579. pci_routeirq = 1;
  580. return NULL;
  581. } else if (!strcmp(str, "skip_isa_align")) {
  582. pci_probe |= PCI_CAN_SKIP_ISA_ALIGN;
  583. return NULL;
  584. } else if (!strcmp(str, "noioapicquirk")) {
  585. noioapicquirk = 1;
  586. return NULL;
  587. } else if (!strcmp(str, "ioapicreroute")) {
  588. if (noioapicreroute != -1)
  589. noioapicreroute = 0;
  590. return NULL;
  591. } else if (!strcmp(str, "noioapicreroute")) {
  592. if (noioapicreroute != -1)
  593. noioapicreroute = 1;
  594. return NULL;
  595. }
  596. return str;
  597. }
  598. unsigned int pcibios_assign_all_busses(void)
  599. {
  600. return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0;
  601. }
  602. int pcibios_add_device(struct pci_dev *dev)
  603. {
  604. struct setup_data *data;
  605. struct pci_setup_rom *rom;
  606. u64 pa_data;
  607. pa_data = boot_params.hdr.setup_data;
  608. while (pa_data) {
  609. data = ioremap(pa_data, sizeof(*rom));
  610. if (!data)
  611. return -ENOMEM;
  612. if (data->type == SETUP_PCI) {
  613. rom = (struct pci_setup_rom *)data;
  614. if ((pci_domain_nr(dev->bus) == rom->segment) &&
  615. (dev->bus->number == rom->bus) &&
  616. (PCI_SLOT(dev->devfn) == rom->device) &&
  617. (PCI_FUNC(dev->devfn) == rom->function) &&
  618. (dev->vendor == rom->vendor) &&
  619. (dev->device == rom->devid)) {
  620. dev->rom = pa_data +
  621. offsetof(struct pci_setup_rom, romdata);
  622. dev->romlen = rom->pcilen;
  623. }
  624. }
  625. pa_data = data->next;
  626. iounmap(data);
  627. }
  628. return 0;
  629. }
  630. int pcibios_alloc_irq(struct pci_dev *dev)
  631. {
  632. return pcibios_enable_irq(dev);
  633. }
  634. void pcibios_free_irq(struct pci_dev *dev)
  635. {
  636. if (pcibios_disable_irq)
  637. pcibios_disable_irq(dev);
  638. }
  639. int pcibios_enable_device(struct pci_dev *dev, int mask)
  640. {
  641. return pci_enable_resources(dev, mask);
  642. }
  643. int pci_ext_cfg_avail(void)
  644. {
  645. if (raw_pci_ext_ops)
  646. return 1;
  647. else
  648. return 0;
  649. }