X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=PcAtChipsetPkg%2FPcatRealTimeClockRuntimeDxe%2FPcRtc.h;h=47293ce44c5a1f4792892892f7da40d7f0a5a001;hp=7fc19f90434efb71e6f72822c602d663cdb1c2cb;hb=HEAD;hpb=41628cbc7cb267f35db4ba2efca833aa39198cba
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index 7fc19f9043..7e0e98fbcc 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -1,22 +1,16 @@
/** @file
Header file for real time clock driver.
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
-This program and the accompanying materials
-are licensed and made available under the terms and conditions of the BSD License
-which accompanies this distribution. The full text of the license may be found at
-http://opensource.org/licenses/bsd-license.php
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2017, AMD Inc. All rights reserved.
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#ifndef _RTC_H_
#define _RTC_H_
-
#include
#include
@@ -37,17 +31,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include
typedef struct {
- EFI_LOCK RtcLock;
- INT16 SavedTimeZone;
- UINT8 Daylight;
- UINT8 CenturyRtcAddress;
+ EFI_LOCK RtcLock;
+ INT16 SavedTimeZone;
+ UINT8 Daylight;
+ UINT8 CenturyRtcAddress;
} PC_RTC_MODULE_GLOBALS;
extern PC_RTC_MODULE_GLOBALS mModuleGlobal;
-#define PCAT_RTC_ADDRESS_REGISTER 0x70
-#define PCAT_RTC_DATA_REGISTER 0x71
-
//
// Dallas DS12C887 Real Time Clock
//
@@ -69,80 +60,73 @@ extern PC_RTC_MODULE_GLOBALS mModuleGlobal;
// Date and time initial values.
// They are used if the RTC values are invalid during driver initialization
//
-#define RTC_INIT_SECOND 0
-#define RTC_INIT_MINUTE 0
-#define RTC_INIT_HOUR 0
-#define RTC_INIT_DAY 1
-#define RTC_INIT_MONTH 1
-
-//
-// Register initial values
-//
-#define RTC_INIT_REGISTER_A 0x26
-#define RTC_INIT_REGISTER_B 0x02
-#define RTC_INIT_REGISTER_D 0x0
+#define RTC_INIT_SECOND 0
+#define RTC_INIT_MINUTE 0
+#define RTC_INIT_HOUR 0
+#define RTC_INIT_DAY 1
+#define RTC_INIT_MONTH 1
#pragma pack(1)
//
// Register A
//
typedef struct {
- UINT8 Rs : 4; // Rate Selection Bits
- UINT8 Dv : 3; // Divisor
- UINT8 Uip : 1; // Update in progress
+ UINT8 Rs : 4; // Rate Selection Bits
+ UINT8 Dv : 3; // Divisor
+ UINT8 Uip : 1; // Update in progress
} RTC_REGISTER_A_BITS;
typedef union {
- RTC_REGISTER_A_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_A_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_A;
//
// Register B
//
typedef struct {
- UINT8 Dse : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled
- UINT8 Mil : 1; // 0 - 12 hour mode 1 - 24 hour mode
- UINT8 Dm : 1; // 0 - BCD Format 1 - Binary Format
- UINT8 Sqwe : 1; // 0 - Disable SQWE output 1 - Enable SQWE output
- UINT8 Uie : 1; // 0 - Update INT disabled 1 - Update INT enabled
- UINT8 Aie : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled
- UINT8 Pie : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled
- UINT8 Set : 1; // 0 - Normal operation. 1 - Updates inhibited
+ UINT8 Dse : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled
+ UINT8 Mil : 1; // 0 - 12 hour mode 1 - 24 hour mode
+ UINT8 Dm : 1; // 0 - BCD Format 1 - Binary Format
+ UINT8 Sqwe : 1; // 0 - Disable SQWE output 1 - Enable SQWE output
+ UINT8 Uie : 1; // 0 - Update INT disabled 1 - Update INT enabled
+ UINT8 Aie : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled
+ UINT8 Pie : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled
+ UINT8 Set : 1; // 0 - Normal operation. 1 - Updates inhibited
} RTC_REGISTER_B_BITS;
typedef union {
- RTC_REGISTER_B_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_B_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_B;
//
// Register C
//
typedef struct {
- UINT8 Reserved : 4; // Read as zero. Can not be written.
- UINT8 Uf : 1; // Update End Interrupt Flag
- UINT8 Af : 1; // Alarm Interrupt Flag
- UINT8 Pf : 1; // Periodic Interrupt Flag
- UINT8 Irqf : 1; // Iterrupt Request Flag = PF & PIE | AF & AIE | UF & UIE
+ UINT8 Reserved : 4; // Read as zero. Can not be written.
+ UINT8 Uf : 1; // Update End Interrupt Flag
+ UINT8 Af : 1; // Alarm Interrupt Flag
+ UINT8 Pf : 1; // Periodic Interrupt Flag
+ UINT8 Irqf : 1; // Interrupt Request Flag = PF & PIE | AF & AIE | UF & UIE
} RTC_REGISTER_C_BITS;
typedef union {
- RTC_REGISTER_C_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_C_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_C;
//
// Register D
//
typedef struct {
- UINT8 Reserved : 7; // Read as zero. Can not be written.
- UINT8 Vrt : 1; // Valid RAM and Time
+ UINT8 Reserved : 7; // Read as zero. Can not be written.
+ UINT8 Vrt : 1; // Valid RAM and Time
} RTC_REGISTER_D_BITS;
typedef union {
- RTC_REGISTER_D_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_D_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_D;
#pragma pack()
@@ -194,9 +178,9 @@ PcRtcSetTime (
**/
EFI_STATUS
PcRtcGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities, OPTIONAL
- IN PC_RTC_MODULE_GLOBALS *Global
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL,
+ IN PC_RTC_MODULE_GLOBALS *Global
);
/**
@@ -217,7 +201,7 @@ PcRtcGetTime (
EFI_STATUS
PcRtcSetWakeupTime (
IN BOOLEAN Enable,
- IN EFI_TIME *Time, OPTIONAL
+ IN EFI_TIME *Time OPTIONAL,
IN PC_RTC_MODULE_GLOBALS *Global
);
@@ -239,16 +223,16 @@ PcRtcSetWakeupTime (
**/
EFI_STATUS
PcRtcGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time,
- IN PC_RTC_MODULE_GLOBALS *Global
+ OUT BOOLEAN *Enabled,
+ OUT BOOLEAN *Pending,
+ OUT EFI_TIME *Time,
+ IN PC_RTC_MODULE_GLOBALS *Global
);
/**
The user Entry Point for PcRTC module.
- This is the entrhy point for PcRTC module. It installs the UEFI runtime service
+ This is the entry point for PcRTC module. It installs the UEFI runtime service
including GetTime(),SetTime(),GetWakeupTime(),and SetWakeupTime().
@param ImageHandle The firmware allocated handle for the EFI image.
@@ -261,8 +245,8 @@ PcRtcGetWakeupTime (
EFI_STATUS
EFIAPI
InitializePcRtc (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -276,13 +260,13 @@ InitializePcRtc (
**/
EFI_STATUS
RtcTimeFieldsValid (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
);
/**
- Converts time from EFI_TIME format defined by UEFI spec to RTC's.
+ Converts time from EFI_TIME format defined by UEFI spec to RTC format.
- This function converts time from EFI_TIME format defined by UEFI spec to RTC's.
+ This function converts time from EFI_TIME format defined by UEFI spec to RTC format.
If data mode of RTC is BCD, then converts EFI_TIME to it.
If RTC is in 12-hour format, then converts EFI_TIME to it.
@@ -296,7 +280,6 @@ ConvertEfiTimeToRtcTime (
IN RTC_REGISTER_B RegisterB
);
-
/**
Converts time read from RTC to EFI_TIME format defined by UEFI spec.
@@ -326,11 +309,11 @@ ConvertRtcTimeToEfiTime (
@param Timeout Tell how long it should take to wait.
@retval EFI_DEVICE_ERROR RTC device error.
- @retval EFI_SUCCESS RTC is updated and ready.
+ @retval EFI_SUCCESS RTC is updated and ready.
**/
EFI_STATUS
RtcWaitToUpdate (
- UINTN Timeout
+ UINTN Timeout
);
/**
@@ -356,7 +339,17 @@ DayValid (
**/
BOOLEAN
IsLeapYear (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
+ );
+
+/**
+ Get the century RTC address from the ACPI FADT table.
+
+ @return The century RTC address or 0 if not found.
+**/
+UINT8
+GetCenturyRtcAddress (
+ VOID
);
/**
@@ -372,7 +365,8 @@ IsLeapYear (
VOID
EFIAPI
PcRtcAcpiTableChangeCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
);
+
#endif