resPtr xf86PciBusAccWindowsFromOS(void) { pciConfigPtr *ppPCI, pPCI; resPtr pRes = NULL; resRange range; unsigned long io_size, mem_size; int domain; if ((ppPCI = xf86scanpci(0))) { for (; (pPCI = *ppPCI); ppPCI++) { if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) continue; domain = xf86GetPciDomain(pPCI->tag); linuxGetSizes(pPCI->tag, &io_size, &mem_size); RANGE(range, 0, (ADDRESS)(mem_size - 1), RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, 0, (IOADDRESS)(io_size - 1), RANGE_TYPE(ResExcIoBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); if (domain <= 0) break; } } return pRes; }
/* Retrieves a list of the resources routed to a host bridge's secondary bus */ static void Get460GXBridgeResources(int bus, pointer *ppIoRes, pointer *ppMemRes, pointer *ppPmemRes) { pciConfigPtr pPCI = Verify460GXBus(bus); resRange range; unsigned int i, j; if (ppIoRes) { xf86FreeResList(*ppIoRes); *ppIoRes = NULL; if (pPCI) { for (i = 0; i <= 0x0F; i++) { if (iomap_460gx[i] != pPCI->devnum) continue; RANGE(range, i << 12, ((i + 1) << 12) - 1, RANGE_TYPE(ResExcIoBlock, 0)); *ppIoRes = xf86AddResToList(*ppIoRes, &range, -1); } } } if (ppMemRes) { xf86FreeResList(*ppMemRes); *ppMemRes = NULL; if (pPCI) { if (!(i = (pPCI->devnum - 0x10))) j = 127; /* (4GB - 32M) / 32M */ else j = pcis_460gx[i - 1] & 0x7F; i = pcis_460gx[i] & 0x7F; if (i < j) { RANGE(range, i << 25, (j << 25) - 1, RANGE_TYPE(ResExcMemBlock, 0)); *ppMemRes = xf86AddResToList(*ppMemRes, &range, -1); } } } if (ppPmemRes) { xf86FreeResList(*ppPmemRes); *ppPmemRes = NULL; } }
resPtr xf86AccResFromOS(resPtr pRes) { pciConfigPtr *ppPCI, pPCI; resRange range; unsigned long io_size, mem_size; int domain; if ((ppPCI = xf86scanpci(0))) { for (; (pPCI = *ppPCI); ppPCI++) { if ((pPCI->pci_base_class != PCI_CLASS_BRIDGE) || (pPCI->pci_sub_class != PCI_SUBCLASS_BRIDGE_HOST)) continue; domain = xf86GetPciDomain(pPCI->tag); linuxGetSizes(pPCI->tag, &io_size, &mem_size); /* * At minimum, the top and bottom resources must be claimed, so * that resources that are (or appear to be) unallocated can be * relocated. */ RANGE(range, 0x00000000u, 0x0009ffffu, RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, 0x000c0000u, 0x000effffu, RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, 0x000f0000u, 0x000fffffu, RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, (ADDRESS)(mem_size - 1), (ADDRESS)(mem_size - 1), RANGE_TYPE(ResExcMemBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, 0x00000000u, 0x00000000u, RANGE_TYPE(ResExcIoBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); RANGE(range, (IOADDRESS)(io_size - 1), (IOADDRESS)(io_size - 1), RANGE_TYPE(ResExcIoBlock, domain)); pRes = xf86AddResToList(pRes, &range, -1); if (domain <= 0) break; } } return pRes; }