]> git.proxmox.com Git - mirror_edk2.git/blame - PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
PcAtChipsetPkg: Fix spelling errors
[mirror_edk2.git] / PcAtChipsetPkg / PcatRealTimeClockRuntimeDxe / PcRtcEntry.c
CommitLineData
fb0b259e 1/** @file\r
2 Provides Set/Get time operations.\r
8cd4d17c 3\r
5a702acd 4Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
e1d302e5 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
8cd4d17c 6\r
fb0b259e 7**/\r
8cd4d17c 8\r
9#include "PcRtc.h"\r
10\r
689b78c8 11PC_RTC_MODULE_GLOBALS mModuleGlobal;\r
8cd4d17c 12\r
8d85dc31 13EFI_HANDLE mHandle = NULL;\r
8cd4d17c 14\r
8d85dc31 15/**\r
16 Returns the current time and date information, and the time-keeping capabilities\r
17 of the hardware platform.\r
8cd4d17c 18\r
8d85dc31 19 @param Time A pointer to storage to receive a snapshot of the current time.\r
20 @param Capabilities An optional pointer to a buffer to receive the real time\r
21 clock device's capabilities.\r
8cd4d17c 22\r
8d85dc31 23 @retval EFI_SUCCESS The operation completed successfully.\r
24 @retval EFI_INVALID_PARAMETER Time is NULL.\r
25 @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.\r
8cd4d17c 26\r
8d85dc31 27**/\r
28EFI_STATUS\r
29EFIAPI\r
30PcRtcEfiGetTime (\r
31 OUT EFI_TIME *Time,\r
32 OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL\r
33 )\r
8cd4d17c 34{\r
35 return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);\r
36}\r
37\r
8d85dc31 38/**\r
39 Sets the current local time and date information.\r
40\r
41 @param Time A pointer to the current time.\r
42\r
43 @retval EFI_SUCCESS The operation completed successfully.\r
44 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
45 @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.\r
46\r
47**/\r
8cd4d17c 48EFI_STATUS\r
49EFIAPI\r
50PcRtcEfiSetTime (\r
51 IN EFI_TIME *Time\r
52 )\r
8cd4d17c 53{\r
54 return PcRtcSetTime (Time, &mModuleGlobal);\r
55}\r
56\r
8d85dc31 57/**\r
58 Returns the current wakeup alarm clock setting.\r
59\r
60 @param Enabled Indicates if the alarm is currently enabled or disabled.\r
61 @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r
62 @param Time The current alarm setting.\r
63\r
64 @retval EFI_SUCCESS The alarm settings were returned.\r
65 @retval EFI_INVALID_PARAMETER Enabled is NULL.\r
66 @retval EFI_INVALID_PARAMETER Pending is NULL.\r
67 @retval EFI_INVALID_PARAMETER Time is NULL.\r
68 @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r
69 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
70\r
71**/\r
8cd4d17c 72EFI_STATUS\r
73EFIAPI\r
74PcRtcEfiGetWakeupTime (\r
75 OUT BOOLEAN *Enabled,\r
76 OUT BOOLEAN *Pending,\r
77 OUT EFI_TIME *Time\r
78 )\r
8d85dc31 79{\r
80 return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);\r
81}\r
8cd4d17c 82\r
8cd4d17c 83\r
8d85dc31 84/**\r
85 Sets the system wakeup alarm clock time.\r
8cd4d17c 86\r
8d85dc31 87 @param Enabled Enable or disable the wakeup alarm.\r
88 @param Time If Enable is TRUE, the time to set the wakeup alarm for.\r
89 If Enable is FALSE, then this parameter is optional, and may be NULL.\r
8cd4d17c 90\r
8d85dc31 91 @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled.\r
92 If Enable is FALSE, then the wakeup alarm was disabled.\r
93 @retval EFI_INVALID_PARAMETER A time field is out of range.\r
94 @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r
95 @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r
8cd4d17c 96\r
8d85dc31 97**/\r
8cd4d17c 98EFI_STATUS\r
99EFIAPI\r
100PcRtcEfiSetWakeupTime (\r
101 IN BOOLEAN Enabled,\r
8d85dc31 102 IN EFI_TIME *Time OPTIONAL\r
8cd4d17c 103 )\r
8d85dc31 104{\r
105 return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);\r
106}\r
8cd4d17c 107\r
8d85dc31 108/**\r
109 The user Entry Point for PcRTC module.\r
8cd4d17c 110\r
53b1dd10 111 This is the entry point for PcRTC module. It installs the UEFI runtime service\r
8d85dc31 112 including GetTime(),SetTime(),GetWakeupTime(),and SetWakeupTime().\r
8cd4d17c 113\r
8d85dc31 114 @param ImageHandle The firmware allocated handle for the EFI image.\r
115 @param SystemTable A pointer to the EFI System Table.\r
8cd4d17c 116\r
8d85dc31 117 @retval EFI_SUCCESS The entry point is executed successfully.\r
118 @retval Others Some error occurs when executing this entry point.\r
8cd4d17c 119\r
8d85dc31 120**/\r
8cd4d17c 121EFI_STATUS\r
122EFIAPI\r
123InitializePcRtc (\r
124 IN EFI_HANDLE ImageHandle,\r
125 IN EFI_SYSTEM_TABLE *SystemTable\r
126 )\r
8cd4d17c 127{\r
128 EFI_STATUS Status;\r
41628cbc 129 EFI_EVENT Event;\r
8cd4d17c 130\r
7018623c 131 EfiInitializeLock (&mModuleGlobal.RtcLock, TPL_CALLBACK);\r
e38ab18a 132 mModuleGlobal.CenturyRtcAddress = GetCenturyRtcAddress ();\r
8cd4d17c 133\r
134 Status = PcRtcInit (&mModuleGlobal);\r
6ff84d99 135 ASSERT_EFI_ERROR (Status);\r
5a702acd 136\r
41628cbc
RN
137 Status = gBS->CreateEventEx (\r
138 EVT_NOTIFY_SIGNAL,\r
139 TPL_CALLBACK,\r
140 PcRtcAcpiTableChangeCallback,\r
141 NULL,\r
142 &gEfiAcpi10TableGuid,\r
143 &Event\r
144 );\r
145 ASSERT_EFI_ERROR (Status);\r
5a702acd 146\r
41628cbc
RN
147 Status = gBS->CreateEventEx (\r
148 EVT_NOTIFY_SIGNAL,\r
149 TPL_CALLBACK,\r
150 PcRtcAcpiTableChangeCallback,\r
151 NULL,\r
152 &gEfiAcpiTableGuid,\r
153 &Event\r
154 );\r
155 ASSERT_EFI_ERROR (Status);\r
8cd4d17c 156\r
157 gRT->GetTime = PcRtcEfiGetTime;\r
158 gRT->SetTime = PcRtcEfiSetTime;\r
159 gRT->GetWakeupTime = PcRtcEfiGetWakeupTime;\r
160 gRT->SetWakeupTime = PcRtcEfiSetWakeupTime;\r
161\r
8cd4d17c 162 Status = gBS->InstallMultipleProtocolInterfaces (\r
8d85dc31 163 &mHandle,\r
8cd4d17c 164 &gEfiRealTimeClockArchProtocolGuid,\r
165 NULL,\r
166 NULL\r
167 );\r
8d85dc31 168 ASSERT_EFI_ERROR (Status);\r
8cd4d17c 169\r
170 return Status;\r
171}\r