add assertion to ensure ACPI table is checksumed.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8650 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
eric_tian 2009-06-24 09:44:32 +00:00
parent 35c290c580
commit 2fd3009fb2
1 changed files with 8 additions and 0 deletions

View File

@ -288,6 +288,8 @@ PublishTables (
/**
Installs an ACPI table into the RSDT/XSDT.
Note that the ACPI table should be checksumed before installing it.
Otherwise it will assert.
@param This Protocol instance pointer.
@param AcpiTableBuffer A pointer to a buffer containing the ACPI table to be installed.
@ -313,6 +315,8 @@ InstallAcpiTable (
EFI_ACPI_TABLE_INSTANCE *AcpiTableInstance;
EFI_STATUS Status;
VOID *AcpiTableBufferConst;
UINT32 Length;
UINT8 Checksum;
//
// Check for invalid input parameters
@ -322,6 +326,10 @@ InstallAcpiTable (
return EFI_INVALID_PARAMETER;
}
Length = ((EFI_ACPI_COMMON_HEADER *) AcpiTableBuffer)->Length;
Checksum = CalculateCheckSum8 ((UINT8 *)AcpiTableBuffer, Length);
ASSERT (Checksum == 0);
//
// Get the instance of the ACPI table protocol
//