]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/PcRtc/X64/RealTimeClock.c
4f4410eb21bb0aa325355ea9cb204239087f3f9f
[mirror_edk2.git] / DuetPkg / PcRtc / X64 / RealTimeClock.c
1 /*++
2
3 Copyright (c) 2005, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13 x64PcRtc.c
14
15 Abstract:
16
17 --*/
18
19 #include "RealTimeClock.h"
20
21 static PC_RTC_MODULE_GLOBALS mModuleGlobal;
22
23 EFI_STATUS
24 EFIAPI
25 PcRtcEfiGetTime (
26 OUT EFI_TIME *Time,
27 OUT EFI_TIME_CAPABILITIES *Capabilities
28 )
29 /*++
30
31 Routine Description:
32
33 TODO: Add function description
34
35 Arguments:
36
37 Time - TODO: add argument description
38 Capabilities - TODO: add argument description
39
40 Returns:
41
42 TODO: add return values
43
44 --*/
45 {
46 return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);
47 }
48
49 EFI_STATUS
50 EFIAPI
51 PcRtcEfiSetTime (
52 IN EFI_TIME *Time
53 )
54 /*++
55
56 Routine Description:
57
58 TODO: Add function description
59
60 Arguments:
61
62 Time - TODO: add argument description
63
64 Returns:
65
66 TODO: add return values
67
68 --*/
69 {
70 return PcRtcSetTime (Time, &mModuleGlobal);
71 }
72
73 EFI_STATUS
74 EFIAPI
75 PcRtcEfiGetWakeupTime (
76 OUT BOOLEAN *Enabled,
77 OUT BOOLEAN *Pending,
78 OUT EFI_TIME *Time
79 )
80 /*++
81
82 Routine Description:
83
84 TODO: Add function description
85
86 Arguments:
87
88 Enabled - TODO: add argument description
89 Pending - TODO: add argument description
90 Time - TODO: add argument description
91
92 Returns:
93
94 TODO: add return values
95
96 --*/
97 {
98 return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);
99 }
100
101 EFI_STATUS
102 EFIAPI
103 PcRtcEfiSetWakeupTime (
104 IN BOOLEAN Enabled,
105 OUT EFI_TIME *Time
106 )
107 /*++
108
109 Routine Description:
110
111 TODO: Add function description
112
113 Arguments:
114
115 Enabled - TODO: add argument description
116 Time - TODO: add argument description
117
118 Returns:
119
120 TODO: add return values
121
122 --*/
123 {
124 return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);
125 }
126
127 EFI_STATUS
128 EFIAPI
129 InitializeRealTimeClock (
130 IN EFI_HANDLE ImageHandle,
131 IN EFI_SYSTEM_TABLE *SystemTable
132 )
133 /*++
134
135 Routine Description:
136
137 Arguments:
138
139
140
141 Returns:
142 --*/
143 // TODO: ImageHandle - add argument and description to function comment
144 // TODO: SystemTable - add argument and description to function comment
145 {
146 EFI_STATUS Status;
147 EFI_HANDLE NewHandle;
148
149 EfiInitializeLock (&mModuleGlobal.RtcLock, TPL_HIGH_LEVEL);
150
151 Status = PcRtcInit (&mModuleGlobal);
152 if (EFI_ERROR (Status)) {
153 return Status;
154 }
155
156 SystemTable->RuntimeServices->GetTime = PcRtcEfiGetTime;
157 SystemTable->RuntimeServices->SetTime = PcRtcEfiSetTime;
158 SystemTable->RuntimeServices->GetWakeupTime = PcRtcEfiGetWakeupTime;
159 SystemTable->RuntimeServices->SetWakeupTime = PcRtcEfiSetWakeupTime;
160
161 NewHandle = NULL;
162 Status = gBS->InstallMultipleProtocolInterfaces (
163 &NewHandle,
164 &gEfiRealTimeClockArchProtocolGuid,
165 NULL,
166 NULL
167 );
168
169 return Status;
170 }