]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/PcRtc/Ia32/RealTimeClock.c
Porting Duet module from EDKI to EDKII
[mirror_edk2.git] / DuetPkg / PcRtc / Ia32 / 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 Ia32PcRtc.c
14
15 Abstract:
16
17 --*/
18 #include "RealTimeClock.h"
19
20 static PC_RTC_MODULE_GLOBALS mModuleGlobal;
21
22 EFI_STATUS
23 EFIAPI
24 PcRtcEfiGetTime (
25 OUT EFI_TIME *Time,
26 OUT EFI_TIME_CAPABILITIES *Capabilities
27 )
28 /*++
29
30 Routine Description:
31
32 TODO: Add function description
33
34 Arguments:
35
36 Time - TODO: add argument description
37 Capabilities - TODO: add argument description
38
39 Returns:
40
41 TODO: add return values
42
43 --*/
44 {
45 return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);
46 }
47
48 EFI_STATUS
49 EFIAPI
50 PcRtcEfiSetTime (
51 IN EFI_TIME *Time
52 )
53 /*++
54
55 Routine Description:
56
57 TODO: Add function description
58
59 Arguments:
60
61 Time - TODO: add argument description
62
63 Returns:
64
65 TODO: add return values
66
67 --*/
68 {
69 return PcRtcSetTime (Time, &mModuleGlobal);
70 }
71
72 EFI_STATUS
73 EFIAPI
74 PcRtcEfiGetWakeupTime (
75 OUT BOOLEAN *Enabled,
76 OUT BOOLEAN *Pending,
77 OUT EFI_TIME *Time
78 )
79 /*++
80
81 Routine Description:
82
83 TODO: Add function description
84
85 Arguments:
86
87 Enabled - TODO: add argument description
88 Pending - TODO: add argument description
89 Time - TODO: add argument description
90
91 Returns:
92
93 TODO: add return values
94
95 --*/
96 {
97 return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);
98 }
99
100 EFI_STATUS
101 EFIAPI
102 PcRtcEfiSetWakeupTime (
103 IN BOOLEAN Enabled,
104 OUT EFI_TIME *Time
105 )
106 /*++
107
108 Routine Description:
109
110 TODO: Add function description
111
112 Arguments:
113
114 Enabled - TODO: add argument description
115 Time - TODO: add argument description
116
117 Returns:
118
119 TODO: add return values
120
121 --*/
122 {
123 return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);
124 }
125
126 EFI_STATUS
127 EFIAPI
128 InitializeRealTimeClock (
129 IN EFI_HANDLE ImageHandle,
130 IN EFI_SYSTEM_TABLE *SystemTable
131 )
132 /*++
133
134 Routine Description:
135
136 Arguments:
137
138
139
140 Returns:
141 --*/
142 // TODO: ImageHandle - add argument and description to function comment
143 // TODO: SystemTable - add argument and description to function comment
144 {
145 EFI_STATUS Status;
146 EFI_HANDLE NewHandle;
147
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 }