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
This commit is contained in:
parent
377e758c3f
commit
4804ef4943
|
@ -47,6 +47,7 @@
|
||||||
HobLib
|
HobLib
|
||||||
QemuFwCfgLib
|
QemuFwCfgLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
|
BaseLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiAcpiTableProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
|
@ -17,44 +17,13 @@
|
||||||
#include "AcpiPlatform.h"
|
#include "AcpiPlatform.h"
|
||||||
#include <Library/HobLib.h>
|
#include <Library/HobLib.h>
|
||||||
#include <Guid/XenInfo.h>
|
#include <Guid/XenInfo.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
|
||||||
#define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020
|
#define XEN_ACPI_PHYSICAL_ADDRESS 0x000EA020
|
||||||
#define XEN_BIOS_PHYSICAL_END 0x000FFFFF
|
#define XEN_BIOS_PHYSICAL_END 0x000FFFFF
|
||||||
|
|
||||||
EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER *XenAcpiRsdpStructurePtr = NULL;
|
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.
|
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.
|
// RSDP ACPI 1.0 checksum for 1.0/2.0/3.0 table.
|
||||||
// This is only the first 20 bytes of the structure
|
// This is only the first 20 bytes of the structure
|
||||||
//
|
//
|
||||||
Sum = CalculateTableChecksum (
|
Sum = CalculateSum8 (
|
||||||
RsdpStructurePtr,
|
(CONST UINT8 *)RsdpStructurePtr,
|
||||||
sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
|
sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
|
||||||
);
|
);
|
||||||
if (Sum != 0) {
|
if (Sum != 0) {
|
||||||
|
@ -125,8 +94,8 @@ GetXenAcpiRsdp (
|
||||||
//
|
//
|
||||||
// RSDP ACPI 2.0/3.0 checksum, this is the entire table
|
// RSDP ACPI 2.0/3.0 checksum, this is the entire table
|
||||||
//
|
//
|
||||||
Sum = CalculateTableChecksum (
|
Sum = CalculateSum8 (
|
||||||
RsdpStructurePtr,
|
(CONST UINT8 *)RsdpStructurePtr,
|
||||||
sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
|
sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)
|
||||||
);
|
);
|
||||||
if (Sum != 0) {
|
if (Sum != 0) {
|
||||||
|
|
Loading…
Reference in New Issue