TianoCore EDK2 master
Loading...
Searching...
No Matches
DeviceIo.h File Reference

Go to the source code of this file.

Data Structures

struct  EFI_IO_ACCESS
 
struct  _EFI_DEVICE_IO_PROTOCOL
 

Macros

#define EFI_DEVICE_IO_PROTOCOL_GUID
 
#define DEVICE_IO_PROTOCOL   EFI_DEVICE_IO_PROTOCOL_GUID
 

Typedefs

typedef struct _EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_PROTOCOL
 
typedef EFI_DEVICE_IO_PROTOCOL EFI_DEVICE_IO_INTERFACE
 
typedef EFI_STATUS(EFIAPI * EFI_DEVICE_IO) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_IO_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)
 
typedef EFI_STATUS(EFIAPI * EFI_PCI_DEVICE_PATH) (IN EFI_DEVICE_IO_PROTOCOL *This, IN UINT64 PciAddress, IN OUT EFI_DEVICE_PATH_PROTOCOL **PciDevicePath)
 
typedef EFI_STATUS(EFIAPI * EFI_IO_MAP) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_IO_OPERATION_TYPE Operation, IN EFI_PHYSICAL_ADDRESS *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
 
typedef EFI_STATUS(EFIAPI * EFI_IO_UNMAP) (IN EFI_DEVICE_IO_PROTOCOL *This, IN VOID *Mapping)
 
typedef EFI_STATUS(EFIAPI * EFI_IO_ALLOCATE_BUFFER) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *HostAddress)
 
typedef EFI_STATUS(EFIAPI * EFI_IO_FLUSH) (IN EFI_DEVICE_IO_PROTOCOL *This)
 
typedef EFI_STATUS(EFIAPI * EFI_IO_FREE_BUFFER) (IN EFI_DEVICE_IO_PROTOCOL *This, IN UINTN Pages, IN EFI_PHYSICAL_ADDRESS HostAddress)
 

Enumerations

enum  EFI_IO_WIDTH {
  IO_UINT8 = 0 , IO_UINT16 = 1 , IO_UINT32 = 2 , IO_UINT64 = 3 ,
  MMIO_COPY_UINT8 = 4 , MMIO_COPY_UINT16 = 5 , MMIO_COPY_UINT32 = 6 , MMIO_COPY_UINT64 = 7
}
 
enum  EFI_IO_OPERATION_TYPE { EfiBusMasterRead , EfiBusMasterWrite , EfiBusMasterCommonBuffer }
 

Variables

EFI_GUID gEfiDeviceIoProtocolGuid
 

Detailed Description

Device IO protocol as defined in the EFI 1.10 specification.

Device IO is used to abstract hardware access to devices. It includes memory mapped IO, IO, PCI Config space, and DMA.

Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file DeviceIo.h.

Macro Definition Documentation

◆ DEVICE_IO_PROTOCOL

#define DEVICE_IO_PROTOCOL   EFI_DEVICE_IO_PROTOCOL_GUID

Protocol GUID name defined in EFI1.1.

Definition at line 25 of file DeviceIo.h.

◆ EFI_DEVICE_IO_PROTOCOL_GUID

#define EFI_DEVICE_IO_PROTOCOL_GUID
Value:
{ \
0xaf6ac311, 0x84c3, 0x11d2, {0x8e, 0x3c, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \
}

Definition at line 15 of file DeviceIo.h.

Typedef Documentation

◆ EFI_DEVICE_IO

typedef EFI_STATUS(EFIAPI * EFI_DEVICE_IO) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_IO_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN OUT VOID *Buffer)

Enables a driver to access device registers in the appropriate memory or I/O space.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
WidthSignifies the width of the I/O operations.
AddressThe base address of the I/O operations.
CountThe number of I/O operations to perform.
BufferFor read operations, the destination buffer to store the results. For write operations, the source buffer to write data from. If Width is MMIO_COPY_UINT8, MMIO_COPY_UINT16, MMIO_COPY_UINT32, or MMIO_COPY_UINT64, then Buffer is interpreted as a base address of an I/O operation such as Address.
Return values
EFI_SUCCESSThe data was read from or written to the device.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_INVALID_PARAMETERWidth is invalid.

Definition at line 69 of file DeviceIo.h.

◆ EFI_DEVICE_IO_INTERFACE

Protocol defined in EFI1.1.

Definition at line 30 of file DeviceIo.h.

◆ EFI_DEVICE_IO_PROTOCOL

Definition at line 20 of file DeviceIo.h.

◆ EFI_IO_ALLOCATE_BUFFER

typedef EFI_STATUS(EFIAPI * EFI_IO_ALLOCATE_BUFFER) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, IN OUT EFI_PHYSICAL_ADDRESS *HostAddress)

Allocates pages that are suitable for an EFIBusMasterCommonBuffer mapping.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
TypeThe type allocation to perform.
MemoryTypeThe type of memory to allocate, EfiBootServicesData or EfiRuntimeServicesData.
PagesThe number of pages to allocate.
HostAddressA pointer to store the base address of the allocated range.
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_OUT_OF_RESOURCESThe memory pages could not be allocated.
EFI_INVALID_PARAMETERThe requested memory type is invalid.
EFI_UNSUPPORTEDThe requested HostAddress is not supported on this platform.

Definition at line 190 of file DeviceIo.h.

◆ EFI_IO_FLUSH

typedef EFI_STATUS(EFIAPI * EFI_IO_FLUSH) (IN EFI_DEVICE_IO_PROTOCOL *This)

Flushes any posted write data to the device.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
Return values
EFI_SUCCESSThe buffers were flushed.
EFI_DEVICE_ERRORThe buffers were not flushed due to a hardware error.

Definition at line 209 of file DeviceIo.h.

◆ EFI_IO_FREE_BUFFER

typedef EFI_STATUS(EFIAPI * EFI_IO_FREE_BUFFER) (IN EFI_DEVICE_IO_PROTOCOL *This, IN UINTN Pages, IN EFI_PHYSICAL_ADDRESS HostAddress)

Frees pages that were allocated with AllocateBuffer().

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
PagesThe number of pages to free.
HostAddressThe base address of the range to free.
Return values
EFI_SUCCESSThe requested memory pages were allocated.
EFI_NOT_FOUNDThe requested memory pages were not allocated with AllocateBuffer().
EFI_INVALID_PARAMETERHostAddress is not page aligned or Pages is invalid.

Definition at line 228 of file DeviceIo.h.

◆ EFI_IO_MAP

typedef EFI_STATUS(EFIAPI * EFI_IO_MAP) (IN EFI_DEVICE_IO_PROTOCOL *This, IN EFI_IO_OPERATION_TYPE Operation, IN EFI_PHYSICAL_ADDRESS *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)

Provides the device-specific addresses needed to access system memory.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
OperationIndicates if the bus master is going to read or write to system memory.
HostAddressThe system memory address to map to the device.
NumberOfBytesOn input, the number of bytes to map. On output, the number of bytes that were mapped.
DeviceAddressThe resulting map address for the bus master device to use to access the hosts HostAddress.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe range was mapped for the returned NumberOfBytes.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_UNSUPPORTEDThe HostAddress cannot be mapped as a common buffer.
EFI_INVALID_PARAMETERThe Operation or HostAddress is undefined.
EFI_DEVICE_ERRORThe system hardware could not map the requested address.

Definition at line 145 of file DeviceIo.h.

◆ EFI_IO_UNMAP

typedef EFI_STATUS(EFIAPI * EFI_IO_UNMAP) (IN EFI_DEVICE_IO_PROTOCOL *This, IN VOID *Mapping)

Completes the Map() operation and releases any corresponding resources.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
MappingA resulting value to pass to Unmap().
Return values
EFI_SUCCESSThe range was mapped for the returned NumberOfBytes.
EFI_DEVICE_ERRORThe system hardware could not map the requested address.

Definition at line 166 of file DeviceIo.h.

◆ EFI_PCI_DEVICE_PATH

typedef EFI_STATUS(EFIAPI * EFI_PCI_DEVICE_PATH) (IN EFI_DEVICE_IO_PROTOCOL *This, IN UINT64 PciAddress, IN OUT EFI_DEVICE_PATH_PROTOCOL **PciDevicePath)

Provides an EFI Device Path for a PCI device with the given PCI configuration space address.

Parameters
ThisA pointer to the EFI_DEVICE_IO_INTERFACE instance.
PciAddressThe PCI configuration space address of the device whose Device Path is going to be returned.
PciDevicePathA pointer to the pointer for the EFI Device Path for PciAddress. Memory for the Device Path is allocated from the pool.
Return values
EFI_SUCCESSThe PciDevicePath returns a pointer to a valid EFI Device Path.
EFI_OUT_OF_RESOURCESThe request could not be completed due to a lack of resources.
EFI_UNSUPPORTEDThe PciAddress does not map to a valid EFI Device Path.

Definition at line 98 of file DeviceIo.h.

Enumeration Type Documentation

◆ EFI_IO_OPERATION_TYPE

Enumerator
EfiBusMasterRead 

A read operation from system memory by a bus master.

EfiBusMasterWrite 

A write operation to system memory by a bus master.

EfiBusMasterCommonBuffer 

Provides both read and write access to system memory by both the processor and a bus master. The buffer is coherent from both the processor's and the bus master's point of view.

Definition at line 105 of file DeviceIo.h.

◆ EFI_IO_WIDTH

Device IO Access Width

Definition at line 35 of file DeviceIo.h.