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