95 IN BOOLEAN MmioOperation,
108 if (Buffer ==
NULL) {
109 return EFI_INVALID_PARAMETER;
115 if ((UINT32)Width >= EfiCpuIoWidthMaximum) {
116 return EFI_INVALID_PARAMETER;
123 if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
131 if (!MmioOperation && (Width == EfiCpuIoWidthUint64)) {
132 return EFI_INVALID_PARAMETER;
138 if ((Address & ((UINT64)mInStride[Width] - 1)) != 0) {
139 return EFI_UNSUPPORTED;
157 Limit = (MmioOperation ?
MAX_ADDRESS : MAX_IO_PORT_ADDRESS);
159 if (Address > Limit) {
160 return EFI_UNSUPPORTED;
164 if (MaxCount < (Count - 1)) {
165 return EFI_UNSUPPORTED;
168 if (Address >
LShiftU64 (MaxCount - Count + 1, Width)) {
169 return EFI_UNSUPPORTED;
177 if (((
UINTN)Buffer & ((
MIN (
sizeof (
UINTN), mInStride[Width]) - 1))) != 0) {
178 return EFI_UNSUPPORTED;
240 if (EFI_ERROR (Status)) {
247 InStride = mInStride[Width];
248 OutStride = mOutStride[Width];
250 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
251 if (OperationWidth == EfiCpuIoWidthUint8) {
253 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
255 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
257 }
else if (OperationWidth == EfiCpuIoWidthUint64) {
321 if (EFI_ERROR (Status)) {
328 InStride = mInStride[Width];
329 OutStride = mOutStride[Width];
331 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
332 if (OperationWidth == EfiCpuIoWidthUint8) {
334 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
336 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
338 }
else if (OperationWidth == EfiCpuIoWidthUint64) {
402 if (EFI_ERROR (Status)) {
409 InStride = mInStride[Width];
410 OutStride = mOutStride[Width];
417 switch (OperationWidth) {
418 case EfiCpuIoWidthUint8:
421 case EfiCpuIoWidthUint16:
424 case EfiCpuIoWidthUint32:
437 for (Uint8Buffer = Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
438 if (OperationWidth == EfiCpuIoWidthUint8) {
440 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
442 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
509 if (EFI_ERROR (Status)) {
516 InStride = mInStride[Width];
517 OutStride = mOutStride[Width];
524 switch (OperationWidth) {
525 case EfiCpuIoWidthUint8:
528 case EfiCpuIoWidthUint16:
531 case EfiCpuIoWidthUint32:
544 for (Uint8Buffer = (UINT8 *)Buffer; Count > 0; Address += InStride, Uint8Buffer += OutStride, Count--) {
545 if (OperationWidth == EfiCpuIoWidthUint8) {
547 }
else if (OperationWidth == EfiCpuIoWidthUint16) {
549 }
else if (OperationWidth == EfiCpuIoWidthUint32) {
577 Status =
gBS->InstallMultipleProtocolInterfaces (
579 &gEfiCpuIo2ProtocolGuid,
UINT64 EFIAPI RShiftU64(IN UINT64 Operand, IN UINTN Count)
UINT64 EFIAPI LShiftU64(IN UINT64 Operand, IN UINTN Count)
EFI_CPU_IO_PROTOCOL_WIDTH
EFI_STATUS CpuIoCheckParameter(IN BOOLEAN MmioOperation, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, IN VOID *Buffer)
EFI_STATUS EFIAPI CpuIo2Initialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
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 CpuMemoryServiceWrite(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 CpuMemoryServiceRead(IN EFI_CPU_IO2_PROTOCOL *This, IN EFI_CPU_IO_PROTOCOL_WIDTH Width, IN UINT64 Address, IN UINTN Count, OUT VOID *Buffer)
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)
UINT8 EFIAPI IoWrite8(IN UINTN Port, IN UINT8 Value)
UINT64 EFIAPI MmioWrite64(IN UINTN Address, IN UINT64 Value)
VOID EFIAPI IoWriteFifo32(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
VOID EFIAPI IoReadFifo8(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
VOID EFIAPI IoReadFifo16(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
VOID EFIAPI IoWriteFifo16(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
UINT64 EFIAPI MmioRead64(IN UINTN Address)
VOID EFIAPI IoReadFifo32(IN UINTN Port, IN UINTN Count, OUT VOID *Buffer)
UINT16 EFIAPI MmioRead16(IN UINTN Address)
UINT8 EFIAPI MmioRead8(IN UINTN Address)
UINT8 EFIAPI MmioWrite8(IN UINTN Address, IN UINT8 Value)
UINT8 EFIAPI IoRead8(IN UINTN Port)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
VOID EFIAPI IoWriteFifo8(IN UINTN Port, IN UINTN Count, IN VOID *Buffer)
UINT16 EFIAPI IoRead16(IN UINTN Port)
UINT16 EFIAPI MmioWrite16(IN UINTN Address, IN UINT16 Value)
UINT32 EFIAPI IoRead32(IN UINTN Port)
UINT32 EFIAPI IoWrite32(IN UINTN Port, IN UINT32 Value)
UINT16 EFIAPI IoWrite16(IN UINTN Port, IN UINT16 Value)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_PROTOCOL_ALREADY_INSTALLED(Handle, Guid)