Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 409 of file pci.c.
Referenced by HalpAllocateAndInitPciBusHandler(), and HalSetBusDataByOffset().
{ UCHAR PciBuffer[PCI_COMMON_HDR_LENGTH]; PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer; ULONG Len = 0; /* Normalize the length */ if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG); /* Check if this is a vendor-specific read */ if (Offset >= PCI_COMMON_HDR_LENGTH) { /* Read the header */ HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, sizeof(ULONG)); /* Make sure the vendor is valid */ if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0; } else { /* Read the entire header and validate the vendor ID */ Len = PCI_COMMON_HDR_LENGTH; HalpReadPCIConfig(BusHandler, Slot, PciConfig, 0, Len); if (PciConfig->VendorID == PCI_INVALID_VENDORID) return 0; /* Return what's after the offset and normalize */ Len -= Offset; if (Len > Length) Len = Length; /* Copy the specific caller data */ RtlMoveMemory(PciBuffer + Offset, Buffer, Len); /* Write the actual configuration data */ HalpWritePCIConfig(BusHandler, Slot, PciBuffer + Offset, Offset, Len); /* Update buffer and offset, decrement total length */ Offset += Len; Buffer += Len; Length -= Len; } /* Now we still have something to copy */ if (Length) { /* Check if it's vendor-specific data */ if (Offset >= PCI_COMMON_HDR_LENGTH) { /* Read it now */ HalpWritePCIConfig(BusHandler, Slot, Buffer, Offset, Length); Len += Length; } } /* Update the total length read */ return Len; }