]> git.proxmox.com Git - mirror_edk2.git/commitdiff
add assertion to ensure ACPI table is checksumed.
authoreric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Jun 2009 09:44:32 +0000 (09:44 +0000)
committereric_tian <eric_tian@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 24 Jun 2009 09:44:32 +0000 (09:44 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8650 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableProtocol.c

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