-/**\r
- Read a slice from conventional PCI config space at the given offset, then\r
- advance the offset.\r
-\r
- @param[in] PciAddress The address of the PCI Device -- Bus, Device, Function\r
- -- in UEFI (not PciLib) encoding.\r
-\r
- @param[in,out] Offset On input, the offset in conventional PCI config space\r
- to start reading from. On output, the offset of the\r
- first byte that was not read.\r
-\r
- @param[in] Size The number of bytes to read.\r
-\r
- @param[out] Buffer On output, the bytes read from PCI config space are\r
- stored in this object.\r
-**/\r
-STATIC\r
-VOID\r
-ReadConfigSpace (\r
- IN CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS *PciAddress,\r
- IN OUT UINT8 *Offset,\r
- IN UINT8 Size,\r
- OUT VOID *Buffer\r
- )\r
-{\r
- PciReadBuffer (\r
- PCI_LIB_ADDRESS (\r
- PciAddress->Bus,\r
- PciAddress->Device,\r
- PciAddress->Function,\r
- *Offset\r
- ),\r
- Size,\r
- Buffer\r
- );\r
- *Offset += Size;\r
-}\r
-\r
-\r
-/**\r
- Convenience wrapper macro for ReadConfigSpace().\r
-\r
- Given the following conditions:\r
-\r
- - HeaderField is the first field in the structure pointed-to by Struct,\r
-\r
- - Struct->HeaderField has been populated from the conventional PCI config\r
- space of the PCI device identified by PciAddress,\r
-\r
- - *Offset points one past HeaderField in the conventional PCI config space of\r
- the PCI device identified by PciAddress,\r
-\r
- populate the rest of *Struct from conventional PCI config space, starting at\r
- *Offset. Finally, increment *Offset so that it point one past *Struct.\r
-\r
- @param[in] PciAddress The address of the PCI Device -- Bus, Device, Function\r
- -- in UEFI (not PciLib) encoding. Type: pointer to\r
- CONST EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_PCI_ADDRESS.\r
-\r
- @param[in,out] Offset On input, the offset in conventional PCI config space\r
- to start reading from; one past Struct->HeaderField.\r
- On output, the offset of the first byte that was not\r
- read; one past *Struct. Type: pointer to UINT8.\r
-\r
- @param[out] Struct The structure to complete. Type: pointer to structure\r
- object.\r
-\r
- @param[in] HeaderField The name of the first field in *Struct, after which\r
- *Struct should be populated. Type: structure member\r
- identifier.\r
-**/\r
-#define COMPLETE_CONFIG_SPACE_STRUCT(PciAddress, Offset, Struct, HeaderField) \\r
- ReadConfigSpace ( \\r
- (PciAddress), \\r
- (Offset), \\r
- (UINT8)(sizeof *(Struct) - sizeof ((Struct)->HeaderField)), \\r
- &((Struct)->HeaderField) + 1 \\r
- )\r
-\r
-\r