]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros
[mirror_edk2.git] / PcAtChipsetPkg / PcatRealTimeClockRuntimeDxe / PcRtc.c
index 2bb41e7e81a45d1e64ae9124068ca51778a8d093..c032e16217c3d858b93186a5cf49eae8bd21833e 100644 (file)
@@ -2,6 +2,8 @@
   RTC Architectural Protocol GUID as defined in DxeCis 0.96.\r
 \r
 Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2017, AMD Inc. All rights reserved.<BR>\r
+\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -128,7 +130,7 @@ PcRtcInit (
   // Make sure Division Chain is properly configured,\r
   // or RTC clock won't "tick" -- time won't increment\r
   //\r
-  RegisterA.Data = RTC_INIT_REGISTER_A;\r
+  RegisterA.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterA);\r
   RtcWrite (RTC_ADDRESS_REGISTER_A, RegisterA.Data);\r
 \r
   //\r
@@ -144,7 +146,7 @@ PcRtcInit (
   //\r
   // Clear RTC register D\r
   //\r
-  RegisterD.Data = RTC_INIT_REGISTER_D;\r
+  RegisterD.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterD);\r
   RtcWrite (RTC_ADDRESS_REGISTER_D, RegisterD.Data);\r
 \r
   //\r
@@ -176,7 +178,7 @@ PcRtcInit (
   // Set RTC configuration after get original time\r
   // The value of bit AIE should be reserved.\r
   //\r
-  RegisterB.Data = RTC_INIT_REGISTER_B | (RegisterB.Data & BIT5);\r
+  RegisterB.Data = FixedPcdGet8 (PcdInitialValueRtcRegisterB) | (RegisterB.Data & BIT5);\r
   RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);\r
 \r
   //\r
@@ -1230,6 +1232,11 @@ ScanTableInSDT (
     //\r
     Table = 0;\r
     CopyMem (&Table, (VOID *) (EntryBase + Index * TablePointerSize), TablePointerSize);\r
+\r
+    if (Table == NULL) {\r
+      continue;\r
+    }\r
+\r
     if (Table->Signature == Signature) {\r
       return Table;\r
     }\r