39 VOID *DataInHob =
NULL;
45 DataInHob = GET_GUID_HOB_DATA (GuidHob);
46 mRtcBase = (UINT64)(*(
UINTN *)DataInHob);
48 Val |= TOY_ENABLE_BIT | OSC_ENABLE_BIT;
52 DebugPrint (DEBUG_INFO,
"RTC register address not found!\n");
82 return EFI_INVALID_PARAMETER;
86 Time->Year = Val + 1900;
89 Time->Month = (Val >> TOY_MON_SHIFT) & TOY_MON_MASK;
90 Time->Day = (Val >> TOY_DAY_SHIFT) & TOY_DAY_MASK;
91 Time->Hour = (Val >> TOY_HOUR_SHIFT) & TOY_HOUR_MASK;
92 Time->Minute = (Val >> TOY_MIN_SHIFT) & TOY_MIN_MASK;
93 Time->Second = (Val >> TOY_SEC_SHIFT) & TOY_SEC_MASK;
118 Val |= (Time->Second << TOY_SEC_SHIFT);
119 Val |= (Time->Minute << TOY_MIN_SHIFT);
120 Val |= (Time->Hour << TOY_HOUR_SHIFT);
121 Val |= (Time->Day << TOY_DAY_SHIFT);
122 Val |= (Time->Month << TOY_MON_SHIFT);
125 Val = Time->Year - 1900;
144 OUT BOOLEAN *Enabled,
145 OUT BOOLEAN *Pending,
150 return EFI_UNSUPPORTED;
173 return EFI_UNSUPPORTED;
220 Status =
gDS->AddMemorySpace (
224 EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
226 if (EFI_ERROR (Status)) {
229 "Failed to add memory space. Status = %r\n",
235 Status =
gDS->AllocateMemorySpace (
244 if (EFI_ERROR (Status)) {
247 "Failed to allocate memory space. Status = %r\n",
250 gDS->RemoveMemorySpace (
257 Status =
gDS->SetMemorySpaceAttributes (
260 EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
262 if (EFI_ERROR (Status)) {
265 "Failed to set memory attributes. Status = %r\n",
269 gDS->FreeMemorySpace (
274 gDS->RemoveMemorySpace (
303 if (EFI_ERROR (Status)) {
306 "Failed to map memory for loongson 7A RTC. Status = %r\n",
315 Status =
gBS->CreateEventEx (
320 &gEfiEventVirtualAddressChangeGuid,
321 &mRtcVirtualAddrChangeEvent
VOID EFIAPI DebugPrint(IN UINTN ErrorLevel, IN CONST CHAR8 *Format,...)
VOID *EFIAPI GetFirstGuidHob(IN CONST EFI_GUID *Guid)
UINT32 EFIAPI MmioRead32(IN UINTN Address)
UINT32 EFIAPI MmioWrite32(IN UINTN Address, IN UINT32 Value)
STATIC VOID EFIAPI VirtualNotifyEvent(IN EFI_EVENT Event, IN VOID *Context)
EFI_STATUS EFIAPI LibSetWakeupTime(IN BOOLEAN Enabled, OUT EFI_TIME *Time)
STATIC EFI_STATUS MapRtcResources(IN EFI_HANDLE ImageHandle, IN EFI_PHYSICAL_ADDRESS RtcPageBase)
EFI_STATUS EFIAPI LibRtcInitialize(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI LibGetWakeupTime(OUT BOOLEAN *Enabled, OUT BOOLEAN *Pending, OUT EFI_TIME *Time)
EFI_STATUS EFIAPI LibSetTime(IN EFI_TIME *Time)
EFI_STATUS EFIAPI LibGetTime(OUT EFI_TIME *Time, OUT EFI_TIME_CAPABILITIES *Capabilities)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
@ EfiGcdMemoryTypeMemoryMappedIo
UINT64 EFI_PHYSICAL_ADDRESS
EFI_STATUS EFIAPI EfiConvertPointer(IN UINTN DebugDisposition, IN OUT VOID **Address)