summaryrefslogtreecommitdiffstats
path: root/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
diff options
context:
space:
mode:
Diffstat (limited to 'EmulatorPkg/CpuRuntimeDxe/CpuIo.c')
-rw-r--r--EmulatorPkg/CpuRuntimeDxe/CpuIo.c77
1 files changed, 39 insertions, 38 deletions
diff --git a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c b/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
index 152c260451..417b225b7e 100644
--- a/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
+++ b/EmulatorPkg/CpuRuntimeDxe/CpuIo.c
@@ -31,22 +31,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS
CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer,
+ IN UINT64 Limit
);
EFI_STATUS
EFIAPI
CpuMemoryServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
)
+
/*++
Routine Description:
@@ -95,12 +96,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuMemoryServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN OUT VOID *Buffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN OUT VOID *Buffer
)
+
/*++
Routine Description:
@@ -148,12 +150,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuIoServiceRead (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
)
+
/*++
Routine Description:
@@ -186,7 +189,7 @@ Returns:
return EFI_INVALID_PARAMETER;
}
- Address = (UINTN) UserAddress;
+ Address = (UINTN)UserAddress;
if (Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER;
@@ -206,12 +209,13 @@ Returns:
EFI_STATUS
EFIAPI
CpuIoServiceWrite (
- IN EFI_CPU_IO2_PROTOCOL *This,
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 UserAddress,
- IN UINTN Count,
- IN OUT VOID *UserBuffer
+ IN EFI_CPU_IO2_PROTOCOL *This,
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 UserAddress,
+ IN UINTN Count,
+ IN OUT VOID *UserBuffer
)
+
/*++
Routine Description:
@@ -248,7 +252,7 @@ Returns:
return EFI_INVALID_PARAMETER;
}
- Address = (UINTN) UserAddress;
+ Address = (UINTN)UserAddress;
if (Width >= EfiCpuIoWidthMaximum) {
return EFI_INVALID_PARAMETER;
@@ -265,7 +269,6 @@ Returns:
return EFI_SUCCESS;
}
-
/*++
Routine Description:
@@ -288,14 +291,14 @@ Returns:
**/
EFI_STATUS
CpuIoCheckAddressRange (
- IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
- IN UINT64 Address,
- IN UINTN Count,
- IN VOID *Buffer,
- IN UINT64 Limit
+ IN EFI_CPU_IO_PROTOCOL_WIDTH Width,
+ IN UINT64 Address,
+ IN UINTN Count,
+ IN VOID *Buffer,
+ IN UINT64 Limit
)
{
- UINTN AlignMask;
+ UINTN AlignMask;
if (Address > Limit) {
return EFI_UNSUPPORTED;
@@ -304,7 +307,7 @@ CpuIoCheckAddressRange (
//
// For FiFo type, the target address won't increase during the access, so treat count as 1
//
- if (Width >= EfiCpuIoWidthFifoUint8 && Width <= EfiCpuIoWidthFifoUint64) {
+ if ((Width >= EfiCpuIoWidthFifoUint8) && (Width <= EfiCpuIoWidthFifoUint64)) {
Count = 1;
}
@@ -314,11 +317,9 @@ CpuIoCheckAddressRange (
}
AlignMask = (1 << Width) - 1;
- if ((UINTN) Buffer & AlignMask) {
+ if ((UINTN)Buffer & AlignMask) {
return EFI_UNSUPPORTED;
}
return EFI_SUCCESS;
}
-
-