summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf1
-rw-r--r--OvmfPkg/AcpiPlatformDxe/Xen.c41
2 files changed, 6 insertions, 36 deletions
diff --git a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
index 7d978524f1..b43b8ac403 100644
--- a/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
+++ b/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
@@ -47,6 +47,7 @@
HobLib
QemuFwCfgLib
MemoryAllocationLib
+ BaseLib
[Protocols]
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
diff --git a/OvmfPkg/AcpiPlatformDxe/Xen.c b/OvmfPkg/AcpiPlatformDxe/Xen.c
index d9bd2ef9d1..02ab8402eb 100644
--- a/OvmfPkg/AcpiPlatformDxe/Xen.c
+++ b/OvmfPkg/AcpiPlatformDxe/Xen.c
@@ -17,6 +17,7 @@
#include "AcpiPlatform.h"
#include <Library/HobLib.h>
#include <Guid/XenInfo.h>
+#include <Library/BaseLib.h>
#define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020
#define XEN_BIOS_PHYSICAL_END 0x000FFFFF
@@ -24,38 +25,6 @@
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr = NULL;
/**
- Calculates the checksum of the ACPI tables.
-
- @param Buffer Address of the ACPI table.
- @param Size Size of the ACPI table need to check.
-
-**/
-UINT8
-CalculateTableChecksum (
- IN VOID *Buffer,
- IN UINTN Size
- )
-{
- UINT8 Sum;
- UINT8 *Ptr;
-
- Sum = 0;
- //
- // Initialize pointer
- //
- Ptr = Buffer;
-
- //
- // Add all content of buffer
- //
- while ((Size--) != 0) {
- Sum = (UINT8) (Sum + (*Ptr++));
- }
-
- return Sum;
-}
-
-/**
This function detects if OVMF is running on Xen.
**/
@@ -113,8 +82,8 @@ GetXenAcpiRsdp (
// RSDP ACPI 1.0 checksum for 1.0/2.0/3.0 table.
// This is only the first 20 bytes of the structure
//
- Sum = CalculateTableChecksum (
- RsdpStructurePtr,
+ Sum = CalculateSum8 (
+ (CONST UINT8 *)RsdpStructurePtr,
sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
);
if (Sum != 0) {
@@ -125,8 +94,8 @@ GetXenAcpiRsdp (
//
// RSDP ACPI 2.0/3.0 checksum, this is the entire table
//
- Sum = CalculateTableChecksum (
- RsdpStructurePtr,
+ Sum = CalculateSum8 (
+ (CONST UINT8 *)RsdpStructurePtr,
sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
);
if (Sum != 0) {