Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 674 of file pci.c.
Referenced by BootMain(), HalpInitializePciBus(), and HalReportResourceUsage().
{ PPCI_REGISTRY_INFO_INTERNAL PciRegistryInfo; UCHAR PciType; PPCIPBUSDATA BusData = (PPCIPBUSDATA)HalpFakePciBusHandler.BusData; ULONG i; PCI_SLOT_NUMBER j; ULONG VendorId = 0; /* Query registry information */ PciRegistryInfo = HalpQueryPciRegistryInfo(); if (!PciRegistryInfo) { /* Assume type 1 */ PciType = 1; } else { /* Get the type and free the info structure */ PciType = PciRegistryInfo->HardwareMechanism & 0xF; ExFreePool(PciRegistryInfo); } /* Initialize the PCI lock */ KeInitializeSpinLock(&HalpPCIConfigLock); /* Check the type of PCI bus */ switch (PciType) { /* Type 1 PCI Bus */ case 1: /* Copy the Type 1 handler data */ RtlCopyMemory(&PCIConfigHandler, &PCIConfigHandlerType1, sizeof(PCIConfigHandler)); /* Set correct I/O Ports */ BusData->Config.Type1.Address = PCI_TYPE1_ADDRESS_PORT; BusData->Config.Type1.Data = PCI_TYPE1_DATA_PORT; break; /* Type 2 PCI Bus */ case 2: /* Copy the Type 1 handler data */ RtlCopyMemory(&PCIConfigHandler, &PCIConfigHandlerType2, sizeof (PCIConfigHandler)); /* Set correct I/O Ports */ BusData->Config.Type2.CSE = PCI_TYPE2_CSE_PORT; BusData->Config.Type2.Forward = PCI_TYPE2_FORWARD_PORT; BusData->Config.Type2.Base = PCI_TYPE2_ADDRESS_BASE; /* Only 16 devices supported, not 32 */ BusData->MaxDevice = 16; break; default: /* Invalid type */ DbgPrint("HAL: Unnkown PCI type\n"); } /* Loop all possible buses */ for (i = 0; i < 256; i++) { /* Loop all devices */ for (j.u.AsULONG = 0; j.u.AsULONG < 32; j.u.AsULONG++) { /* Query the interface */ if (HaliPciInterfaceReadConfig(NULL, i, j, &VendorId, 0, sizeof(ULONG))) { /* Validate the vendor ID */ if ((USHORT)VendorId != PCI_INVALID_VENDORID) { /* Set this as the maximum ID */ HalpMaxPciBus = i; break; } } } } /* We're done */ HalpPCIConfigInitialized = TRUE; }