]>
Commit | Line | Data |
---|---|---|
2ef2b01e A |
1 | /** @file\r |
2 | Implement EFI RealTimeClock runtime services via RTC Lib.\r | |
3402aac7 | 3 | \r |
2ef2b01e A |
4 | Currently this driver does not support runtime virtual calling.\r |
5 | \r | |
60274cca | 6 | Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
3402aac7 | 7 | \r |
878b807a | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
2ef2b01e A |
9 | \r |
10 | **/\r | |
11 | \r | |
12 | #include <PiDxe.h>\r | |
13 | #include <Library/BaseLib.h>\r | |
14 | #include <Library/DebugLib.h>\r | |
15 | #include <Library/IoLib.h>\r | |
16 | #include <Library/RealTimeClockLib.h>\r | |
17 | \r | |
2ef2b01e A |
18 | /**\r |
19 | Returns the current time and date information, and the time-keeping capabilities\r | |
20 | of the hardware platform.\r | |
21 | \r | |
22 | @param Time A pointer to storage to receive a snapshot of the current time.\r | |
23 | @param Capabilities An optional pointer to a buffer to receive the real time clock\r | |
24 | device's capabilities.\r | |
25 | \r | |
26 | @retval EFI_SUCCESS The operation completed successfully.\r | |
27 | @retval EFI_INVALID_PARAMETER Time is NULL.\r | |
28 | @retval EFI_DEVICE_ERROR The time could not be retrieved due to hardware error.\r | |
29 | \r | |
30 | **/\r | |
31 | EFI_STATUS\r | |
32 | EFIAPI\r | |
33 | LibGetTime (\r | |
34 | OUT EFI_TIME *Time,\r | |
35 | OUT EFI_TIME_CAPABILITIES *Capabilities\r | |
36 | )\r | |
37 | {\r | |
38 | //\r | |
39 | // Fill in Time and Capabilities via data from you RTC\r | |
40 | //\r | |
41 | return EFI_DEVICE_ERROR;\r | |
42 | }\r | |
43 | \r | |
2ef2b01e A |
44 | /**\r |
45 | Sets the current local time and date information.\r | |
46 | \r | |
47 | @param Time A pointer to the current time.\r | |
48 | \r | |
49 | @retval EFI_SUCCESS The operation completed successfully.\r | |
50 | @retval EFI_INVALID_PARAMETER A time field is out of range.\r | |
51 | @retval EFI_DEVICE_ERROR The time could not be set due due to hardware error.\r | |
52 | \r | |
53 | **/\r | |
54 | EFI_STATUS\r | |
55 | EFIAPI\r | |
56 | LibSetTime (\r | |
e7108d0e | 57 | IN EFI_TIME *Time\r |
2ef2b01e A |
58 | )\r |
59 | {\r | |
60 | //\r | |
61 | // Use Time, to set the time in your RTC hardware\r | |
62 | //\r | |
63 | return EFI_DEVICE_ERROR;\r | |
64 | }\r | |
65 | \r | |
2ef2b01e A |
66 | /**\r |
67 | Returns the current wakeup alarm clock setting.\r | |
68 | \r | |
69 | @param Enabled Indicates if the alarm is currently enabled or disabled.\r | |
70 | @param Pending Indicates if the alarm signal is pending and requires acknowledgement.\r | |
71 | @param Time The current alarm setting.\r | |
72 | \r | |
73 | @retval EFI_SUCCESS The alarm settings were returned.\r | |
74 | @retval EFI_INVALID_PARAMETER Any parameter is NULL.\r | |
75 | @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due to a hardware error.\r | |
76 | \r | |
77 | **/\r | |
78 | EFI_STATUS\r | |
79 | EFIAPI\r | |
80 | LibGetWakeupTime (\r | |
e7108d0e MK |
81 | OUT BOOLEAN *Enabled,\r |
82 | OUT BOOLEAN *Pending,\r | |
83 | OUT EFI_TIME *Time\r | |
2ef2b01e A |
84 | )\r |
85 | {\r | |
86 | // Not a required feature\r | |
87 | return EFI_UNSUPPORTED;\r | |
88 | }\r | |
89 | \r | |
2ef2b01e A |
90 | /**\r |
91 | Sets the system wakeup alarm clock time.\r | |
92 | \r | |
93 | @param Enabled Enable or disable the wakeup alarm.\r | |
94 | @param Time If Enable is TRUE, the time to set the wakeup alarm for.\r | |
95 | \r | |
96 | @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm was enabled. If\r | |
97 | Enable is FALSE, then the wakeup alarm was disabled.\r | |
98 | @retval EFI_INVALID_PARAMETER A time field is out of range.\r | |
99 | @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a hardware error.\r | |
100 | @retval EFI_UNSUPPORTED A wakeup timer is not supported on this platform.\r | |
101 | \r | |
102 | **/\r | |
103 | EFI_STATUS\r | |
104 | EFIAPI\r | |
105 | LibSetWakeupTime (\r | |
e7108d0e MK |
106 | IN BOOLEAN Enabled,\r |
107 | OUT EFI_TIME *Time\r | |
2ef2b01e A |
108 | )\r |
109 | {\r | |
110 | // Not a required feature\r | |
111 | return EFI_UNSUPPORTED;\r | |
112 | }\r | |
113 | \r | |
2ef2b01e A |
114 | /**\r |
115 | This is the declaration of an EFI image entry point. This can be the entry point to an application\r | |
116 | written to this specification, an EFI boot service driver, or an EFI runtime driver.\r | |
117 | \r | |
118 | @param ImageHandle Handle that identifies the loaded image.\r | |
119 | @param SystemTable System Table for this image.\r | |
120 | \r | |
121 | @retval EFI_SUCCESS The operation completed successfully.\r | |
122 | \r | |
123 | **/\r | |
124 | EFI_STATUS\r | |
125 | EFIAPI\r | |
126 | LibRtcInitialize (\r | |
e7108d0e MK |
127 | IN EFI_HANDLE ImageHandle,\r |
128 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
2ef2b01e A |
129 | )\r |
130 | {\r | |
131 | //\r | |
c6a72cd7 | 132 | // Do some initialization if required to turn on the RTC\r |
2ef2b01e A |
133 | //\r |
134 | return EFI_SUCCESS;\r | |
135 | }\r | |
136 | \r | |
2ef2b01e A |
137 | /**\r |
138 | Fixup internal data so that EFI can be call in virtual mode.\r | |
139 | Call the passed in Child Notify event and convert any pointers in\r | |
140 | lib to virtual mode.\r | |
141 | \r | |
142 | @param[in] Event The Event that is being processed\r | |
143 | @param[in] Context Event Context\r | |
144 | **/\r | |
145 | VOID\r | |
146 | EFIAPI\r | |
147 | LibRtcVirtualNotifyEvent (\r | |
e7108d0e MK |
148 | IN EFI_EVENT Event,\r |
149 | IN VOID *Context\r | |
2ef2b01e A |
150 | )\r |
151 | {\r | |
152 | //\r | |
153 | // Only needed if you are going to support the OS calling RTC functions in virtual mode.\r | |
3402aac7 | 154 | // You will need to call EfiConvertPointer (). To convert any stored physical addresses\r |
c6a72cd7 | 155 | // to virtual address. After the OS transitions to calling in virtual mode, all future\r |
2ef2b01e A |
156 | // runtime calls will be made in virtual mode.\r |
157 | //\r | |
158 | return;\r | |
159 | }\r |