Revision: 13542
          http://edk2.svn.sourceforge.net/edk2/?rev=13542&view=rev
Author:   jljusten
Date:     2012-07-18 22:33:48 +0000 (Wed, 18 Jul 2012)
Log Message:
-----------
OvmfPkg/AcpiPlatformDxe/Xen.c: reuse CalculateSum8

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
    trunk/edk2/OvmfPkg/AcpiPlatformDxe/Xen.c

Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf      2012-07-18 
22:33:33 UTC (rev 13541)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/AcpiPlatformDxe.inf      2012-07-18 
22:33:48 UTC (rev 13542)
@@ -47,6 +47,7 @@
   HobLib
   QemuFwCfgLib
   MemoryAllocationLib
+  BaseLib
 
 [Protocols]
   gEfiAcpiTableProtocolGuid                     # PROTOCOL ALWAYS_CONSUMED

Modified: trunk/edk2/OvmfPkg/AcpiPlatformDxe/Xen.c
===================================================================
--- trunk/edk2/OvmfPkg/AcpiPlatformDxe/Xen.c    2012-07-18 22:33:33 UTC (rev 
13541)
+++ trunk/edk2/OvmfPkg/AcpiPlatformDxe/Xen.c    2012-07-18 22:33:48 UTC (rev 
13542)
@@ -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 @@
       // 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 @@
         //
         // 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) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to