]> git.proxmox.com Git - mirror_edk2.git/blobdiff - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe: Replace RTC macros
[mirror_edk2.git] / PcAtChipsetPkg / PcatRealTimeClockRuntimeDxe / PcRtc.h
index d38c8e1464a4e88c644f57a19e99b87347b24c95..8aeb12c88ad1d92a337c940f9123c4c95811946a 100644 (file)
@@ -1,7 +1,9 @@
 /** @file\r
   Header file for real time clock driver.\r
 \r
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\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
@@ -19,6 +21,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include <Uefi.h>\r
 \r
+#include <Guid/Acpi.h>\r
+\r
 #include <Protocol/RealTimeClock.h>\r
 \r
 #include <Library/BaseLib.h>\r
@@ -32,14 +36,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiRuntimeLib.h>\r
 #include <Library/UefiRuntimeServicesTableLib.h>\r
 #include <Library/PcdLib.h>\r
-\r
+#include <Library/ReportStatusCodeLib.h>\r
 \r
 typedef struct {\r
   EFI_LOCK  RtcLock;\r
   INT16     SavedTimeZone;\r
   UINT8     Daylight;\r
+  UINT8     CenturyRtcAddress;\r
 } PC_RTC_MODULE_GLOBALS;\r
 \r
+extern PC_RTC_MODULE_GLOBALS  mModuleGlobal;\r
+\r
 #define PCAT_RTC_ADDRESS_REGISTER 0x70\r
 #define PCAT_RTC_DATA_REGISTER    0x71\r
 \r
@@ -60,7 +67,6 @@ typedef struct {
 #define RTC_ADDRESS_REGISTER_B        11  // R/W\r
 #define RTC_ADDRESS_REGISTER_C        12  // RO\r
 #define RTC_ADDRESS_REGISTER_D        13  // RO\r
-#define RTC_ADDRESS_CENTURY           50  // R/W  Range 19..20 Bit 8 is R/W\r
 //\r
 // Date and time initial values.\r
 // They are used if the RTC values are invalid during driver initialization\r
@@ -70,14 +76,6 @@ typedef struct {
 #define RTC_INIT_HOUR   0\r
 #define RTC_INIT_DAY    1\r
 #define RTC_INIT_MONTH  1\r
-#define RTC_INIT_YEAR   2001\r
-\r
-//\r
-// Register initial values\r
-//\r
-#define RTC_INIT_REGISTER_A 0x26\r
-#define RTC_INIT_REGISTER_B 0x02\r
-#define RTC_INIT_REGISTER_D 0x0\r
 \r
 #pragma pack(1)\r
 //\r
@@ -286,14 +284,11 @@ RtcTimeFieldsValid (
   @param   Time       On input, the time data read from UEFI to convert\r
                       On output, the time converted to RTC format\r
   @param   RegisterB  Value of Register B of RTC, indicating data mode\r
-  @param   Century    It is set according to EFI_TIME Time.\r
-\r
 **/\r
 VOID\r
 ConvertEfiTimeToRtcTime (\r
   IN OUT EFI_TIME        *Time,\r
-  IN     RTC_REGISTER_B  RegisterB,\r
-  OUT    UINT8           *Century\r
+  IN     RTC_REGISTER_B  RegisterB\r
   );\r
 \r
 \r
@@ -307,7 +302,6 @@ ConvertEfiTimeToRtcTime (
 \r
   @param   Time       On input, the time data read from RTC to convert\r
                       On output, the time converted to UEFI format\r
-  @param   Century    Value of century read from RTC.\r
   @param   RegisterB  Value of Register B of RTC, indicating data mode\r
                       and hour format.\r
 \r
@@ -318,7 +312,6 @@ ConvertEfiTimeToRtcTime (
 EFI_STATUS\r
 ConvertRtcTimeToEfiTime (\r
   IN OUT EFI_TIME        *Time,\r
-  IN     UINT8           Century,\r
   IN     RTC_REGISTER_B  RegisterB\r
   );\r
 \r
@@ -361,4 +354,30 @@ IsLeapYear (
   IN EFI_TIME   *Time\r
   );\r
 \r
+/**\r
+  Get the century RTC address from the ACPI FADT table.\r
+\r
+  @return  The century RTC address or 0 if not found.\r
+**/\r
+UINT8\r
+GetCenturyRtcAddress (\r
+  VOID\r
+  );\r
+\r
+/**\r
+  Notification function of ACPI Table change.\r
+\r
+  This is a notification function registered on ACPI Table change event.\r
+  It saves the Century address stored in ACPI FADT table.\r
+\r
+  @param  Event        Event whose notification function is being invoked.\r
+  @param  Context      Pointer to the notification function's context.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+PcRtcAcpiTableChangeCallback (\r
+  IN EFI_EVENT        Event,\r
+  IN VOID             *Context\r
+  );\r
 #endif\r