-}\r
-\r
-\r
-EFI_STATUS\r
-PciIoPollMem (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINT64 Mask,\r
- IN UINT64 Value,\r
- IN UINT64 Delay,\r
- OUT UINT64 *Result\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-PciIoPollIo (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINT64 Mask,\r
- IN UINT64 Value,\r
- IN UINT64 Delay,\r
- OUT UINT64 *Result\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-PciIoMemRead (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS(This);\r
-\r
- return PciRootBridgeIoMemRead (&Private->RootBridge.Io,\r
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
- Private->ConfigSpace->Device.Bar[BarIndex] + Offset,\r
- Count,\r
- Buffer\r
- );\r
-}\r
-\r
-EFI_STATUS\r
-PciIoMemWrite (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS(This);\r
-\r
- return PciRootBridgeIoMemWrite (&Private->RootBridge.Io,\r
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
- Private->ConfigSpace->Device.Bar[BarIndex] + Offset,\r
- Count,\r
- Buffer\r
- );\r
-}\r
-\r
-EFI_STATUS\r
-PciIoIoRead (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-PciIoIoWrite (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 BarIndex,\r
- IN UINT64 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-/**\r
- Enable a PCI driver to read PCI controller registers in PCI configuration space.\r
-\r
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
- @param[in] Width Signifies the width of the memory operations.\r
- @param[in] Offset The offset within the PCI configuration space for\r
- the PCI controller.\r
- @param[in] Count The number of PCI configuration operations to\r
- perform. Bytes moved is Width size * Count,\r
- starting at Offset.\r
-\r
- @param[in out] Buffer The destination buffer to store the results.\r
-\r
- @retval EFI_SUCCESS The data was read from the PCI controller.\r
- @retval EFI_INVALID_PARAMETER "Width" is invalid.\r
- @retval EFI_INVALID_PARAMETER "Buffer" is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-PciIoPciRead (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT32 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);\r
- EFI_STATUS Status;\r
-\r
- if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- Status = PciRootBridgeIoMemRW (\r
- (EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH)Width,\r
- Count,\r
- TRUE,\r
- (PTR)(UINTN)Buffer,\r
- TRUE,\r
- (PTR)(UINTN)(((UINT8 *)Private->ConfigSpace) + Offset) //Fix me ConfigSpace\r
- );\r
-\r
- return Status;\r
-}\r
-\r
-/**\r
- Enable a PCI driver to write PCI controller registers in PCI configuration space.\r
-\r
- @param[in] This A pointer to the EFI_PCI_IO_PROTOCOL instance.\r
- @param[in] Width Signifies the width of the memory operations.\r
- @param[in] Offset The offset within the PCI configuration space for\r
- the PCI controller.\r
- @param[in] Count The number of PCI configuration operations to\r
- perform. Bytes moved is Width size * Count,\r
- starting at Offset.\r
-\r
- @param[in out] Buffer The source buffer to write data from.\r
-\r
- @retval EFI_SUCCESS The data was read from the PCI controller.\r
- @retval EFI_INVALID_PARAMETER "Width" is invalid.\r
- @retval EFI_INVALID_PARAMETER "Buffer" is NULL.\r
-\r
-**/\r
-EFI_STATUS\r
-PciIoPciWrite (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT32 Offset,\r
- IN UINTN Count,\r
- IN OUT VOID *Buffer\r
- )\r
-{\r
- EFI_PCI_IO_PRIVATE_DATA *Private = EFI_PCI_IO_PRIVATE_DATA_FROM_THIS (This);\r
-\r
- if ((Width < 0) || (Width >= EfiPciIoWidthMaximum) || (Buffer == NULL)) {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
-\r
- return PciRootBridgeIoMemRW ((EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH) Width,\r
- Count,\r
- TRUE,\r
- (PTR)(UINTN)(((UINT8 *)Private->ConfigSpace) + Offset),\r
- TRUE,\r
- (PTR)(UINTN)Buffer\r
- );\r
-}\r
-\r
-EFI_STATUS\r
-PciIoCopyMem (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_WIDTH Width,\r
- IN UINT8 DestBarIndex,\r
- IN UINT64 DestOffset,\r
- IN UINT8 SrcBarIndex,\r
- IN UINT64 SrcOffset,\r
- IN UINTN Count\r
- )\r
-{\r
- ASSERT (FALSE);\r
- return EFI_UNSUPPORTED;\r
-}\r
-\r
-EFI_STATUS\r
-PciIoMap (\r
- IN EFI_PCI_IO_PROTOCOL *This,\r
- IN EFI_PCI_IO_PROTOCOL_OPERATION Operation,\r
- IN VOID *HostAddress,\r
- IN OUT UINTN *NumberOfBytes,\r
- OUT EFI_PHYSICAL_ADDRESS *DeviceAddress,\r
- OUT VOID **Mapping\r
- )\r
-{\r
- DMA_MAP_OPERATION DmaOperation;\r
-\r
- if (Operation == EfiPciIoOperationBusMasterRead) {\r
- DmaOperation = MapOperationBusMasterRead;\r
- } else if (Operation == EfiPciIoOperationBusMasterWrite) {\r
- DmaOperation = MapOperationBusMasterWrite;\r
- } else if (Operation == EfiPciIoOperationBusMasterCommonBuffer) {\r
- DmaOperation = MapOperationBusMasterCommonBuffer;\r
- } else {\r
- return EFI_INVALID_PARAMETER;\r
- }\r
- return DmaMap (DmaOperation, HostAddress, NumberOfBytes, DeviceAddress, Mapping);\r
-}\r