21#define MAX_IO_PORT_ADDRESS 0xFFFF
92 IN BOOLEAN MmioOperation,
105 if (Buffer ==
NULL) {
106 return EFI_INVALID_PARAMETER;
112 if ((UINT32)Width >= EfiCpuIoWidthMaximum) {
113 return EFI_INVALID_PARAMETER;
120 if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
128 if (!MmioOperation && (Width == EfiCpuIoWidthUint64)) {
129 return EFI_INVALID_PARAMETER;
135 if ((Address & (UINT64)(mInStride[Width] - 1)) != 0) {
136 return EFI_UNSUPPORTED;
154 Limit = (MmioOperation ?
MAX_ADDRESS : MAX_IO_PORT_ADDRESS);
156 if (Address > Limit) {
157 return EFI_UNSUPPORTED;
161 if (MaxCount < (Count - 1)) {
162 return EFI_UNSUPPORTED;
165 if (Address >
LShiftU64 (MaxCount - Count + 1, Width)) {
166 return EFI_UNSUPPORTED;
173 if (((
UINTN)Buffer & ((
MIN (
sizeof (
UINTN), mInStride[Width]) - 1))) != 0) {
174 return EFI_UNSUPPORTED;
237 if (EFI_ERROR (Status)) {
244 InStride = mInStride[Width];
245 OutStride = mOutStride[Width];
247 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
248 if (OperationWidth == EfiCpuIoWidthUint8) {
250 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
252 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
254 }
else if (OperationWidth == EfiCpuIoWidthUint64) {
319 if (EFI_ERROR (Status)) {
326 InStride = mInStride[Width];
327 OutStride = mOutStride[Width];
329 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
330 if (OperationWidth == EfiCpuIoWidthUint8) {
332 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
334 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
336 }
else if (OperationWidth == EfiCpuIoWidthUint64) {
401 if (EFI_ERROR (Status)) {
405 Address +=
PcdGet64 (PcdPciIoTranslation);
410 InStride = mInStride[Width];
411 OutStride = mOutStride[Width];
414 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
415 if (OperationWidth == EfiCpuIoWidthUint8) {
417 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
419 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
487 if (EFI_ERROR (Status)) {
491 Address +=
PcdGet64 (PcdPciIoTranslation);
496 InStride = mInStride[Width];
497 OutStride = mOutStride[Width];
500 for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
501 if (OperationWidth == EfiCpuIoWidthUint8) {
503 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
505 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
547 Status =
gBS->InstallMultipleProtocolInterfaces (
549 &gEfiCpuIo2ProtocolGuid,
STATIC EFI_STATUS EFIAPI CpuMemoryServiceRead(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
STATIC EFI_STATUS EFIAPI CpuIoServiceWrite(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
EFI_STATUS EFIAPI ArmPciCpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS EFIAPI CpuMemoryServiceWrite(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
STATIC EFI_STATUS EFIAPI CpuIoServiceRead(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
STATIC EFI_STATUS CpuIoCheckParameter(IN BOOLEAN MmioOperation, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
EFI_CPU_IO_PROTOCOL_WIDTH
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
UINT64 EFIAPI MmioRead64(IN UINTN Address)
UINT16 EFIAPI MmioRead16(IN UINTN Address)
UINT8 EFIAPI MmioRead8(IN UINTN Address)
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)
#define PcdGet64(TokenName)