]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg/AcpiPlatformDxe/Xen.c: reuse CalculateSum8
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 18 Jul 2012 22:33:48 +0000 (22:33 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 18 Jul 2012 22:33:48 +0000 (22:33 +0000)
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

OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
OvmfPkg/AcpiPlatformDxe/Xen.c

index 7d978524f18d128ac804b48f6767ac484bf17124..b43b8ac403f6a3ecd50a4a2bbefbf539cdf3de0e 100644 (file)
@@ -47,6 +47,7 @@
   HobLib\r
   QemuFwCfgLib\r
   MemoryAllocationLib\r
+  BaseLib\r
 \r
 [Protocols]\r
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED\r
index d9bd2ef9d1311da0653fc875ff4dba25220e1a57..02ab8402eb4ea0b386d972dc1921f0a514dcbe4e 100644 (file)
 #include "AcpiPlatform.h"\r
 #include <Library/HobLib.h>\r
 #include <Guid/XenInfo.h>\r
+#include <Library/BaseLib.h>\r
 \r
 #define XEN_ACPI_PHYSICAL_ADDRESS         0x000EA020\r
 #define XEN_BIOS_PHYSICAL_END             0x000FFFFF\r
 \r
 EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER  *XenAcpiRsdpStructurePtr = NULL;\r
 \r
-/**\r
-  Calculates the checksum of the ACPI tables.\r
-\r
-  @param  Buffer    Address of the ACPI table.\r
-  @param  Size      Size of the ACPI table need to check.\r
-\r
-**/\r
-UINT8\r
-CalculateTableChecksum (\r
-  IN VOID       *Buffer,\r
-  IN UINTN      Size\r
-  )\r
-{\r
-  UINT8 Sum;\r
-  UINT8 *Ptr;\r
-\r
-  Sum = 0;\r
-  //\r
-  // Initialize pointer\r
-  //\r
-  Ptr = Buffer;\r
-\r
-  //\r
-  // Add all content of buffer\r
-  //\r
-  while ((Size--) != 0) {\r
-    Sum = (UINT8) (Sum + (*Ptr++));\r
-  }\r
-\r
-  return Sum;\r
-}\r
-\r
 /**\r
   This function detects if OVMF is running on Xen.\r
 \r
@@ -113,8 +82,8 @@ GetXenAcpiRsdp (
       // RSDP ACPI 1.0 checksum for 1.0/2.0/3.0 table.\r
       // This is only the first 20 bytes of the structure\r
       //\r
-      Sum = CalculateTableChecksum (\r
-              RsdpStructurePtr,\r
+      Sum = CalculateSum8 (\r
+              (CONST UINT8 *)RsdpStructurePtr,\r
               sizeof (EFI_ACPI_1_0_ROOT_SYSTEM_DESCRIPTION_POINTER)\r
               );\r
       if (Sum != 0) {\r
@@ -125,8 +94,8 @@ GetXenAcpiRsdp (
         //\r
         // RSDP ACPI 2.0/3.0 checksum, this is the entire table\r
         //\r
-        Sum = CalculateTableChecksum (\r
-                RsdpStructurePtr,\r
+        Sum = CalculateSum8 (\r
+                (CONST UINT8 *)RsdpStructurePtr,\r
                 sizeof (EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER)\r
                 );\r
         if (Sum != 0) {\r