19#define RTC_INDEX_REG_OFFSET 0x0ULL
23#define RTC_TARGET_REG_OFFSET 0x1ULL
43 Status =
gDS->AddMemorySpace (
47 EFI_MEMORY_UC | EFI_MEMORY_RUNTIME | EFI_MEMORY_XP
49 if (EFI_ERROR (Status)) {
52 "Failed to add memory space. Status = %r\n",
58 Status =
gDS->AllocateMemorySpace (
67 if (EFI_ERROR (Status)) {
70 "Failed to allocate memory space. Status = %r\n",
73 gDS->RemoveMemorySpace (
80 Status =
gDS->SetMemorySpaceAttributes (
83 EFI_MEMORY_UC | EFI_MEMORY_RUNTIME | EFI_MEMORY_XP
85 if (EFI_ERROR (Status)) {
88 "Failed to set memory attributes. Status = %r\n",
91 gDS->FreeMemorySpace (
95 gDS->RemoveMemorySpace (
132 RETURN_STATUS PcdStatus;
134 Status =
gBS->LocateProtocol (
135 &gFdtClientProtocolGuid,
141 Status = FdtClient->FindCompatibleNode (
146 if (EFI_ERROR (Status)) {
149 "%a: No 'motorola,mc146818' compatible DT node found\n",
155 Status = FdtClient->GetNodeProperty (
162 if (EFI_ERROR (Status)) {
165 "%a: No 'reg' property found in 'motorola,mc146818' compatible DT node\n",
171 ASSERT (RegSize == 16);
177 "Found motorola,mc146818 RTC @ 0x%Lx Range = 0x%x\n",
183 ASSERT (Range >= 0x2);
187 PcdRtcIndexRegister64,
194 PcdRtcTargetRegister64,
200 if (EFI_ERROR (Status)) {
203 "Failed to map memory for motorola,mc146818. Status = %r\n",
215 Status = FdtClient->SetNodeProperty (
222 if (EFI_ERROR (Status)) {
225 "Failed to set motorola,mc146818 status to 'disabled', Status = %r\n",
UINT64 EFIAPI ReadUnaligned64(IN CONST UINT64 *Buffer)
UINT64 EFIAPI SwapBytes64(IN UINT64 Value)
#define ASSERT_EFI_ERROR(StatusParameter)
#define ASSERT_RETURN_ERROR(StatusParameter)
#define DEBUG(Expression)
#define PcdSet64S(TokenName, Value)
@ EfiGcdMemoryTypeMemoryMappedIo
UINT64 EFI_PHYSICAL_ADDRESS