bios32.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. /*
  2. * linux/arch/arm/kernel/bios32.c
  3. *
  4. * PCI bios-type initialisation for PCI machines
  5. *
  6. * Bits taken from various places.
  7. */
  8. #include <linux/export.h>
  9. #include <linux/kernel.h>
  10. #include <linux/pci.h>
  11. #include <linux/slab.h>
  12. #include <linux/init.h>
  13. #include <linux/io.h>
  14. #include <asm/mach-types.h>
  15. #include <asm/mach/map.h>
  16. #include <asm/mach/pci.h>
  17. static int debug_pci;
  18. #ifdef CONFIG_PCI_MSI
  19. struct msi_controller *pcibios_msi_controller(struct pci_dev *dev)
  20. {
  21. struct pci_sys_data *sysdata = dev->bus->sysdata;
  22. return sysdata->msi_ctrl;
  23. }
  24. #endif
  25. /*
  26. * We can't use pci_get_device() here since we are
  27. * called from interrupt context.
  28. */
  29. static void pcibios_bus_report_status(struct pci_bus *bus, u_int status_mask, int warn)
  30. {
  31. struct pci_dev *dev;
  32. list_for_each_entry(dev, &bus->devices, bus_list) {
  33. u16 status;
  34. /*
  35. * ignore host bridge - we handle
  36. * that separately
  37. */
  38. if (dev->bus->number == 0 && dev->devfn == 0)
  39. continue;
  40. pci_read_config_word(dev, PCI_STATUS, &status);
  41. if (status == 0xffff)
  42. continue;
  43. if ((status & status_mask) == 0)
  44. continue;
  45. /* clear the status errors */
  46. pci_write_config_word(dev, PCI_STATUS, status & status_mask);
  47. if (warn)
  48. printk("(%s: %04X) ", pci_name(dev), status);
  49. }
  50. list_for_each_entry(dev, &bus->devices, bus_list)
  51. if (dev->subordinate)
  52. pcibios_bus_report_status(dev->subordinate, status_mask, warn);
  53. }
  54. void pcibios_report_status(u_int status_mask, int warn)
  55. {
  56. struct pci_bus *bus;
  57. list_for_each_entry(bus, &pci_root_buses, node)
  58. pcibios_bus_report_status(bus, status_mask, warn);
  59. }
  60. /*
  61. * We don't use this to fix the device, but initialisation of it.
  62. * It's not the correct use for this, but it works.
  63. * Note that the arbiter/ISA bridge appears to be buggy, specifically in
  64. * the following area:
  65. * 1. park on CPU
  66. * 2. ISA bridge ping-pong
  67. * 3. ISA bridge master handling of target RETRY
  68. *
  69. * Bug 3 is responsible for the sound DMA grinding to a halt. We now
  70. * live with bug 2.
  71. */
  72. static void pci_fixup_83c553(struct pci_dev *dev)
  73. {
  74. /*
  75. * Set memory region to start at address 0, and enable IO
  76. */
  77. pci_write_config_dword(dev, PCI_BASE_ADDRESS_0, PCI_BASE_ADDRESS_SPACE_MEMORY);
  78. pci_write_config_word(dev, PCI_COMMAND, PCI_COMMAND_IO);
  79. dev->resource[0].end -= dev->resource[0].start;
  80. dev->resource[0].start = 0;
  81. /*
  82. * All memory requests from ISA to be channelled to PCI
  83. */
  84. pci_write_config_byte(dev, 0x48, 0xff);
  85. /*
  86. * Enable ping-pong on bus master to ISA bridge transactions.
  87. * This improves the sound DMA substantially. The fixed
  88. * priority arbiter also helps (see below).
  89. */
  90. pci_write_config_byte(dev, 0x42, 0x01);
  91. /*
  92. * Enable PCI retry
  93. */
  94. pci_write_config_byte(dev, 0x40, 0x22);
  95. /*
  96. * We used to set the arbiter to "park on last master" (bit
  97. * 1 set), but unfortunately the CyberPro does not park the
  98. * bus. We must therefore park on CPU. Unfortunately, this
  99. * may trigger yet another bug in the 553.
  100. */
  101. pci_write_config_byte(dev, 0x83, 0x02);
  102. /*
  103. * Make the ISA DMA request lowest priority, and disable
  104. * rotating priorities completely.
  105. */
  106. pci_write_config_byte(dev, 0x80, 0x11);
  107. pci_write_config_byte(dev, 0x81, 0x00);
  108. /*
  109. * Route INTA input to IRQ 11, and set IRQ11 to be level
  110. * sensitive.
  111. */
  112. pci_write_config_word(dev, 0x44, 0xb000);
  113. outb(0x08, 0x4d1);
  114. }
  115. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_83C553, pci_fixup_83c553);
  116. static void pci_fixup_unassign(struct pci_dev *dev)
  117. {
  118. dev->resource[0].end -= dev->resource[0].start;
  119. dev->resource[0].start = 0;
  120. }
  121. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND2, PCI_DEVICE_ID_WINBOND2_89C940F, pci_fixup_unassign);
  122. /*
  123. * Prevent the PCI layer from seeing the resources allocated to this device
  124. * if it is the host bridge by marking it as such. These resources are of
  125. * no consequence to the PCI layer (they are handled elsewhere).
  126. */
  127. static void pci_fixup_dec21285(struct pci_dev *dev)
  128. {
  129. int i;
  130. if (dev->devfn == 0) {
  131. dev->class &= 0xff;
  132. dev->class |= PCI_CLASS_BRIDGE_HOST << 8;
  133. for (i = 0; i < PCI_NUM_RESOURCES; i++) {
  134. dev->resource[i].start = 0;
  135. dev->resource[i].end = 0;
  136. dev->resource[i].flags = 0;
  137. }
  138. }
  139. }
  140. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21285, pci_fixup_dec21285);
  141. /*
  142. * PCI IDE controllers use non-standard I/O port decoding, respect it.
  143. */
  144. static void pci_fixup_ide_bases(struct pci_dev *dev)
  145. {
  146. struct resource *r;
  147. int i;
  148. if ((dev->class >> 8) != PCI_CLASS_STORAGE_IDE)
  149. return;
  150. for (i = 0; i < PCI_NUM_RESOURCES; i++) {
  151. r = dev->resource + i;
  152. if ((r->start & ~0x80) == 0x374) {
  153. r->start |= 2;
  154. r->end = r->start;
  155. }
  156. }
  157. }
  158. DECLARE_PCI_FIXUP_HEADER(PCI_ANY_ID, PCI_ANY_ID, pci_fixup_ide_bases);
  159. /*
  160. * Put the DEC21142 to sleep
  161. */
  162. static void pci_fixup_dec21142(struct pci_dev *dev)
  163. {
  164. pci_write_config_dword(dev, 0x40, 0x80000000);
  165. }
  166. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_DEC, PCI_DEVICE_ID_DEC_21142, pci_fixup_dec21142);
  167. /*
  168. * The CY82C693 needs some rather major fixups to ensure that it does
  169. * the right thing. Idea from the Alpha people, with a few additions.
  170. *
  171. * We ensure that the IDE base registers are set to 1f0/3f4 for the
  172. * primary bus, and 170/374 for the secondary bus. Also, hide them
  173. * from the PCI subsystem view as well so we won't try to perform
  174. * our own auto-configuration on them.
  175. *
  176. * In addition, we ensure that the PCI IDE interrupts are routed to
  177. * IRQ 14 and IRQ 15 respectively.
  178. *
  179. * The above gets us to a point where the IDE on this device is
  180. * functional. However, The CY82C693U _does not work_ in bus
  181. * master mode without locking the PCI bus solid.
  182. */
  183. static void pci_fixup_cy82c693(struct pci_dev *dev)
  184. {
  185. if ((dev->class >> 8) == PCI_CLASS_STORAGE_IDE) {
  186. u32 base0, base1;
  187. if (dev->class & 0x80) { /* primary */
  188. base0 = 0x1f0;
  189. base1 = 0x3f4;
  190. } else { /* secondary */
  191. base0 = 0x170;
  192. base1 = 0x374;
  193. }
  194. pci_write_config_dword(dev, PCI_BASE_ADDRESS_0,
  195. base0 | PCI_BASE_ADDRESS_SPACE_IO);
  196. pci_write_config_dword(dev, PCI_BASE_ADDRESS_1,
  197. base1 | PCI_BASE_ADDRESS_SPACE_IO);
  198. dev->resource[0].start = 0;
  199. dev->resource[0].end = 0;
  200. dev->resource[0].flags = 0;
  201. dev->resource[1].start = 0;
  202. dev->resource[1].end = 0;
  203. dev->resource[1].flags = 0;
  204. } else if (PCI_FUNC(dev->devfn) == 0) {
  205. /*
  206. * Setup IDE IRQ routing.
  207. */
  208. pci_write_config_byte(dev, 0x4b, 14);
  209. pci_write_config_byte(dev, 0x4c, 15);
  210. /*
  211. * Disable FREQACK handshake, enable USB.
  212. */
  213. pci_write_config_byte(dev, 0x4d, 0x41);
  214. /*
  215. * Enable PCI retry, and PCI post-write buffer.
  216. */
  217. pci_write_config_byte(dev, 0x44, 0x17);
  218. /*
  219. * Enable ISA master and DMA post write buffering.
  220. */
  221. pci_write_config_byte(dev, 0x45, 0x03);
  222. }
  223. }
  224. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_CONTAQ, PCI_DEVICE_ID_CONTAQ_82C693, pci_fixup_cy82c693);
  225. static void pci_fixup_it8152(struct pci_dev *dev)
  226. {
  227. int i;
  228. /* fixup for ITE 8152 devices */
  229. /* FIXME: add defines for class 0x68000 and 0x80103 */
  230. if ((dev->class >> 8) == PCI_CLASS_BRIDGE_HOST ||
  231. dev->class == 0x68000 ||
  232. dev->class == 0x80103) {
  233. for (i = 0; i < PCI_NUM_RESOURCES; i++) {
  234. dev->resource[i].start = 0;
  235. dev->resource[i].end = 0;
  236. dev->resource[i].flags = 0;
  237. }
  238. }
  239. }
  240. DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_8152, pci_fixup_it8152);
  241. /*
  242. * If the bus contains any of these devices, then we must not turn on
  243. * parity checking of any kind. Currently this is CyberPro 20x0 only.
  244. */
  245. static inline int pdev_bad_for_parity(struct pci_dev *dev)
  246. {
  247. return ((dev->vendor == PCI_VENDOR_ID_INTERG &&
  248. (dev->device == PCI_DEVICE_ID_INTERG_2000 ||
  249. dev->device == PCI_DEVICE_ID_INTERG_2010)) ||
  250. (dev->vendor == PCI_VENDOR_ID_ITE &&
  251. dev->device == PCI_DEVICE_ID_ITE_8152));
  252. }
  253. /*
  254. * pcibios_fixup_bus - Called after each bus is probed,
  255. * but before its children are examined.
  256. */
  257. void pcibios_fixup_bus(struct pci_bus *bus)
  258. {
  259. struct pci_dev *dev;
  260. u16 features = PCI_COMMAND_SERR | PCI_COMMAND_PARITY | PCI_COMMAND_FAST_BACK;
  261. /*
  262. * Walk the devices on this bus, working out what we can
  263. * and can't support.
  264. */
  265. list_for_each_entry(dev, &bus->devices, bus_list) {
  266. u16 status;
  267. pci_read_config_word(dev, PCI_STATUS, &status);
  268. /*
  269. * If any device on this bus does not support fast back
  270. * to back transfers, then the bus as a whole is not able
  271. * to support them. Having fast back to back transfers
  272. * on saves us one PCI cycle per transaction.
  273. */
  274. if (!(status & PCI_STATUS_FAST_BACK))
  275. features &= ~PCI_COMMAND_FAST_BACK;
  276. if (pdev_bad_for_parity(dev))
  277. features &= ~(PCI_COMMAND_SERR | PCI_COMMAND_PARITY);
  278. switch (dev->class >> 8) {
  279. case PCI_CLASS_BRIDGE_PCI:
  280. pci_read_config_word(dev, PCI_BRIDGE_CONTROL, &status);
  281. status |= PCI_BRIDGE_CTL_PARITY|PCI_BRIDGE_CTL_MASTER_ABORT;
  282. status &= ~(PCI_BRIDGE_CTL_BUS_RESET|PCI_BRIDGE_CTL_FAST_BACK);
  283. pci_write_config_word(dev, PCI_BRIDGE_CONTROL, status);
  284. break;
  285. case PCI_CLASS_BRIDGE_CARDBUS:
  286. pci_read_config_word(dev, PCI_CB_BRIDGE_CONTROL, &status);
  287. status |= PCI_CB_BRIDGE_CTL_PARITY|PCI_CB_BRIDGE_CTL_MASTER_ABORT;
  288. pci_write_config_word(dev, PCI_CB_BRIDGE_CONTROL, status);
  289. break;
  290. }
  291. }
  292. /*
  293. * Now walk the devices again, this time setting them up.
  294. */
  295. list_for_each_entry(dev, &bus->devices, bus_list) {
  296. u16 cmd;
  297. pci_read_config_word(dev, PCI_COMMAND, &cmd);
  298. cmd |= features;
  299. pci_write_config_word(dev, PCI_COMMAND, cmd);
  300. pci_write_config_byte(dev, PCI_CACHE_LINE_SIZE,
  301. L1_CACHE_BYTES >> 2);
  302. }
  303. /*
  304. * Propagate the flags to the PCI bridge.
  305. */
  306. if (bus->self && bus->self->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
  307. if (features & PCI_COMMAND_FAST_BACK)
  308. bus->bridge_ctl |= PCI_BRIDGE_CTL_FAST_BACK;
  309. if (features & PCI_COMMAND_PARITY)
  310. bus->bridge_ctl |= PCI_BRIDGE_CTL_PARITY;
  311. }
  312. /*
  313. * Report what we did for this bus
  314. */
  315. pr_info("PCI: bus%d: Fast back to back transfers %sabled\n",
  316. bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
  317. }
  318. EXPORT_SYMBOL(pcibios_fixup_bus);
  319. /*
  320. * Swizzle the device pin each time we cross a bridge. If a platform does
  321. * not provide a swizzle function, we perform the standard PCI swizzling.
  322. *
  323. * The default swizzling walks up the bus tree one level at a time, applying
  324. * the standard swizzle function at each step, stopping when it finds the PCI
  325. * root bus. This will return the slot number of the bridge device on the
  326. * root bus and the interrupt pin on that device which should correspond
  327. * with the downstream device interrupt.
  328. *
  329. * Platforms may override this, in which case the slot and pin returned
  330. * depend entirely on the platform code. However, please note that the
  331. * PCI standard swizzle is implemented on plug-in cards and Cardbus based
  332. * PCI extenders, so it can not be ignored.
  333. */
  334. static u8 pcibios_swizzle(struct pci_dev *dev, u8 *pin)
  335. {
  336. struct pci_sys_data *sys = dev->sysdata;
  337. int slot, oldpin = *pin;
  338. if (sys->swizzle)
  339. slot = sys->swizzle(dev, pin);
  340. else
  341. slot = pci_common_swizzle(dev, pin);
  342. if (debug_pci)
  343. printk("PCI: %s swizzling pin %d => pin %d slot %d\n",
  344. pci_name(dev), oldpin, *pin, slot);
  345. return slot;
  346. }
  347. /*
  348. * Map a slot/pin to an IRQ.
  349. */
  350. static int pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
  351. {
  352. struct pci_sys_data *sys = dev->sysdata;
  353. int irq = -1;
  354. if (sys->map_irq)
  355. irq = sys->map_irq(dev, slot, pin);
  356. if (debug_pci)
  357. printk("PCI: %s mapping slot %d pin %d => irq %d\n",
  358. pci_name(dev), slot, pin, irq);
  359. return irq;
  360. }
  361. static int pcibios_init_resources(int busnr, struct pci_sys_data *sys)
  362. {
  363. int ret;
  364. struct resource_entry *window;
  365. if (list_empty(&sys->resources)) {
  366. pci_add_resource_offset(&sys->resources,
  367. &iomem_resource, sys->mem_offset);
  368. }
  369. resource_list_for_each_entry(window, &sys->resources)
  370. if (resource_type(window->res) == IORESOURCE_IO)
  371. return 0;
  372. sys->io_res.start = (busnr * SZ_64K) ? : pcibios_min_io;
  373. sys->io_res.end = (busnr + 1) * SZ_64K - 1;
  374. sys->io_res.flags = IORESOURCE_IO;
  375. sys->io_res.name = sys->io_res_name;
  376. sprintf(sys->io_res_name, "PCI%d I/O", busnr);
  377. ret = request_resource(&ioport_resource, &sys->io_res);
  378. if (ret) {
  379. pr_err("PCI: unable to allocate I/O port region (%d)\n", ret);
  380. return ret;
  381. }
  382. pci_add_resource_offset(&sys->resources, &sys->io_res,
  383. sys->io_offset);
  384. return 0;
  385. }
  386. static void pcibios_init_hw(struct device *parent, struct hw_pci *hw,
  387. struct list_head *head)
  388. {
  389. struct pci_sys_data *sys = NULL;
  390. int ret;
  391. int nr, busnr;
  392. for (nr = busnr = 0; nr < hw->nr_controllers; nr++) {
  393. sys = kzalloc(sizeof(struct pci_sys_data), GFP_KERNEL);
  394. if (!sys)
  395. panic("PCI: unable to allocate sys data!");
  396. #ifdef CONFIG_PCI_MSI
  397. sys->msi_ctrl = hw->msi_ctrl;
  398. #endif
  399. sys->busnr = busnr;
  400. sys->swizzle = hw->swizzle;
  401. sys->map_irq = hw->map_irq;
  402. sys->align_resource = hw->align_resource;
  403. INIT_LIST_HEAD(&sys->resources);
  404. if (hw->private_data)
  405. sys->private_data = hw->private_data[nr];
  406. ret = hw->setup(nr, sys);
  407. if (ret > 0) {
  408. ret = pcibios_init_resources(nr, sys);
  409. if (ret) {
  410. kfree(sys);
  411. break;
  412. }
  413. if (hw->scan)
  414. sys->bus = hw->scan(nr, sys);
  415. else
  416. sys->bus = pci_scan_root_bus(parent, sys->busnr,
  417. hw->ops, sys, &sys->resources);
  418. if (!sys->bus)
  419. panic("PCI: unable to scan bus!");
  420. busnr = sys->bus->busn_res.end + 1;
  421. list_add(&sys->node, head);
  422. } else {
  423. kfree(sys);
  424. if (ret < 0)
  425. break;
  426. }
  427. }
  428. }
  429. void pci_common_init_dev(struct device *parent, struct hw_pci *hw)
  430. {
  431. struct pci_sys_data *sys;
  432. LIST_HEAD(head);
  433. pci_add_flags(PCI_REASSIGN_ALL_RSRC);
  434. if (hw->preinit)
  435. hw->preinit();
  436. pcibios_init_hw(parent, hw, &head);
  437. if (hw->postinit)
  438. hw->postinit();
  439. pci_fixup_irqs(pcibios_swizzle, pcibios_map_irq);
  440. list_for_each_entry(sys, &head, node) {
  441. struct pci_bus *bus = sys->bus;
  442. if (!pci_has_flag(PCI_PROBE_ONLY)) {
  443. /*
  444. * Size the bridge windows.
  445. */
  446. pci_bus_size_bridges(bus);
  447. /*
  448. * Assign resources.
  449. */
  450. pci_bus_assign_resources(bus);
  451. }
  452. /*
  453. * Tell drivers about devices found.
  454. */
  455. pci_bus_add_devices(bus);
  456. }
  457. list_for_each_entry(sys, &head, node) {
  458. struct pci_bus *bus = sys->bus;
  459. /* Configure PCI Express settings */
  460. if (bus && !pci_has_flag(PCI_PROBE_ONLY)) {
  461. struct pci_bus *child;
  462. list_for_each_entry(child, &bus->children, node)
  463. pcie_bus_configure_settings(child);
  464. }
  465. }
  466. }
  467. #ifndef CONFIG_PCI_HOST_ITE8152
  468. void pcibios_set_master(struct pci_dev *dev)
  469. {
  470. /* No special bus mastering setup handling */
  471. }
  472. #endif
  473. char * __init pcibios_setup(char *str)
  474. {
  475. if (!strcmp(str, "debug")) {
  476. debug_pci = 1;
  477. return NULL;
  478. } else if (!strcmp(str, "firmware")) {
  479. pci_add_flags(PCI_PROBE_ONLY);
  480. return NULL;
  481. }
  482. return str;
  483. }
  484. /*
  485. * From arch/i386/kernel/pci-i386.c:
  486. *
  487. * We need to avoid collisions with `mirrored' VGA ports
  488. * and other strange ISA hardware, so we always want the
  489. * addresses to be allocated in the 0x000-0x0ff region
  490. * modulo 0x400.
  491. *
  492. * Why? Because some silly external IO cards only decode
  493. * the low 10 bits of the IO address. The 0x00-0xff region
  494. * is reserved for motherboard devices that decode all 16
  495. * bits, so it's ok to allocate at, say, 0x2800-0x28ff,
  496. * but we want to try to avoid allocating at 0x2900-0x2bff
  497. * which might be mirrored at 0x0100-0x03ff..
  498. */
  499. resource_size_t pcibios_align_resource(void *data, const struct resource *res,
  500. resource_size_t size, resource_size_t align)
  501. {
  502. struct pci_dev *dev = data;
  503. struct pci_sys_data *sys = dev->sysdata;
  504. resource_size_t start = res->start;
  505. if (res->flags & IORESOURCE_IO && start & 0x300)
  506. start = (start + 0x3ff) & ~0x3ff;
  507. start = (start + align - 1) & ~(align - 1);
  508. if (sys->align_resource)
  509. return sys->align_resource(dev, res, start, size, align);
  510. return start;
  511. }
  512. /**
  513. * pcibios_enable_device - Enable I/O and memory.
  514. * @dev: PCI device to be enabled
  515. */
  516. int pcibios_enable_device(struct pci_dev *dev, int mask)
  517. {
  518. if (pci_has_flag(PCI_PROBE_ONLY))
  519. return 0;
  520. return pci_enable_resources(dev, mask);
  521. }
  522. int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
  523. enum pci_mmap_state mmap_state, int write_combine)
  524. {
  525. if (mmap_state == pci_mmap_io)
  526. return -EINVAL;
  527. /*
  528. * Mark this as IO
  529. */
  530. vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
  531. if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
  532. vma->vm_end - vma->vm_start,
  533. vma->vm_page_prot))
  534. return -EAGAIN;
  535. return 0;
  536. }
  537. void __init pci_map_io_early(unsigned long pfn)
  538. {
  539. struct map_desc pci_io_desc = {
  540. .virtual = PCI_IO_VIRT_BASE,
  541. .type = MT_DEVICE,
  542. .length = SZ_64K,
  543. };
  544. pci_io_desc.pfn = pfn;
  545. iotable_init(&pci_io_desc, 1);
  546. }