diff options
author | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-07-18 22:33:48 +0000 |
---|---|---|
committer | jljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524> | 2012-07-18 22:33:48 +0000 |
commit | 4804ef4943d6b22a4d86e5d05f717af28d4ca82e (patch) | |
tree | 24846271a776bffb44e5db5c643daf7d83b8ad0e /OvmfPkg | |
parent | 377e758c3f10216c2638a3ae4bc75fd4d70fbfef (diff) | |
download | edk2-4804ef4943d6b22a4d86e5d05f717af28d4ca82e.tar.gz edk2-4804ef4943d6b22a4d86e5d05f717af28d4ca82e.tar.bz2 edk2-4804ef4943d6b22a4d86e5d05f717af28d4ca82e.zip |
OvmfPkg/AcpiPlatformDxe/Xen.c: reuse CalculateSum8
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13542 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'OvmfPkg')
-rw-r--r-- | OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf | 1 | ||||
-rw-r--r-- | OvmfPkg/AcpiPlatformDxe/Xen.c | 41 |
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) {
|