Move PcatCompatible/RealTimeClockRuntimeDxe module to MdeModulePkg from IntelFramewor...
[mirror_edk2.git] / MdeModulePkg / Universal / PcatCompatible / RealTimeClockRuntimeDxe / Ia32 / Ia32PcRtc.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved. <BR>
4 This software and associated documentation (if any) is furnished
5 under a license and may only be used or copied in accordance
6 with the terms of the license. Except as permitted by such
7 license, no part of this software or documentation may be
8 reproduced, stored in a retrieval system, or transmitted in any
9 form or by any means without the express written consent of
10 Intel Corporation.
11
12
13
14 Module Name:
15
16 Ia32PcRtc.c
17
18 Abstract:
19
20 --*/
21
22 #include "PcRtc.h"
23
24 static PC_RTC_MODULE_GLOBALS mModuleGlobal;
25
26 EFI_STATUS
27 EFIAPI
28 PcRtcEfiGetTime (
29 OUT EFI_TIME *Time,
30 OUT EFI_TIME_CAPABILITIES *Capabilities
31 )
32 /*++
33
34 Routine Description:
35
36 GC_TODO: Add function description
37
38 Arguments:
39
40 Time - GC_TODO: add argument description
41 Capabilities - GC_TODO: add argument description
42
43 Returns:
44
45 GC_TODO: add return values
46
47 --*/
48 {
49 return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);
50 }
51
52 EFI_STATUS
53 EFIAPI
54 PcRtcEfiSetTime (
55 IN EFI_TIME *Time
56 )
57 /*++
58
59 Routine Description:
60
61 GC_TODO: Add function description
62
63 Arguments:
64
65 Time - GC_TODO: add argument description
66
67 Returns:
68
69 GC_TODO: add return values
70
71 --*/
72 {
73 return PcRtcSetTime (Time, &mModuleGlobal);
74 }
75
76 EFI_STATUS
77 EFIAPI
78 PcRtcEfiGetWakeupTime (
79 OUT BOOLEAN *Enabled,
80 OUT BOOLEAN *Pending,
81 OUT EFI_TIME *Time
82 )
83 /*++
84
85 Routine Description:
86
87 GC_TODO: Add function description
88
89 Arguments:
90
91 Enabled - GC_TODO: add argument description
92 Pending - GC_TODO: add argument description
93 Time - GC_TODO: add argument description
94
95 Returns:
96
97 GC_TODO: add return values
98
99 --*/
100 {
101 return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);
102 }
103
104 EFI_STATUS
105 EFIAPI
106 PcRtcEfiSetWakeupTime (
107 IN BOOLEAN Enabled,
108 OUT EFI_TIME *Time
109 )
110 /*++
111
112 Routine Description:
113
114 GC_TODO: Add function description
115
116 Arguments:
117
118 Enabled - GC_TODO: add argument description
119 Time - GC_TODO: add argument description
120
121 Returns:
122
123 GC_TODO: add return values
124
125 --*/
126 {
127 return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);
128 }
129
130 EFI_STATUS
131 EFIAPI
132 InitializePcRtc (
133 IN EFI_HANDLE ImageHandle,
134 IN EFI_SYSTEM_TABLE *SystemTable
135 )
136 /*++
137
138 Routine Description:
139
140 Arguments:
141
142
143
144 Returns:
145 --*/
146 // GC_TODO: ImageHandle - add argument and description to function comment
147 // GC_TODO: SystemTable - add argument and description to function comment
148 {
149 EFI_STATUS Status;
150 EFI_HANDLE NewHandle;
151
152 EfiInitializeLock (&mModuleGlobal.RtcLock, TPL_HIGH_LEVEL);
153
154 Status = PcRtcInit (&mModuleGlobal);
155 if (EFI_ERROR (Status)) {
156 return Status;
157 }
158
159 gRT->GetTime = PcRtcEfiGetTime;
160 gRT->SetTime = PcRtcEfiSetTime;
161 gRT->GetWakeupTime = PcRtcEfiGetWakeupTime;
162 gRT->SetWakeupTime = PcRtcEfiSetWakeupTime;
163
164 NewHandle = NULL;
165 Status = gBS->InstallMultipleProtocolInterfaces (
166 &NewHandle,
167 &gEfiRealTimeClockArchProtocolGuid,
168 NULL,
169 NULL
170 );
171
172 return Status;
173 }