mirror of https://github.com/acidanthera/audk.git
PcAtChipsetPkg/PcRtc: move ACPI parsing code to GetCenturyRtcAddress
The patch moves ACPI parsing code to a separate function GetCenturyRtcAddress() and the next patch will call this function in driver entry point. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com> Cc: Anbazhagan Baraneedharan <anbazhagan@hp.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Cc: Star Zeng <star.zeng@intel.com>
This commit is contained in:
parent
6f6bf5c772
commit
9e11e9225a
|
@ -1239,20 +1239,13 @@ ScanTableInSDT (
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Notification function of ACPI Table change.
|
Get the century RTC address from the ACPI FADT table.
|
||||||
|
|
||||||
This is a notification function registered on ACPI Table change event.
|
|
||||||
It saves the Century address stored in ACPI FADT table.
|
|
||||||
|
|
||||||
@param Event Event whose notification function is being invoked.
|
|
||||||
@param Context Pointer to the notification function's context.
|
|
||||||
|
|
||||||
|
@return The century RTC address or 0 if not found.
|
||||||
**/
|
**/
|
||||||
VOID
|
UINT8
|
||||||
EFIAPI
|
GetCenturyRtcAddress (
|
||||||
PcRtcAcpiTableChangeCallback (
|
VOID
|
||||||
IN EFI_EVENT Event,
|
|
||||||
IN VOID *Context
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
@ -1260,8 +1253,6 @@ PcRtcAcpiTableChangeCallback (
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
|
EFI_ACPI_DESCRIPTION_HEADER *Rsdt;
|
||||||
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
EFI_ACPI_DESCRIPTION_HEADER *Xsdt;
|
||||||
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
|
||||||
EFI_TIME Time;
|
|
||||||
UINT8 Century;
|
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
|
Status = EfiGetSystemConfigurationTable (&gEfiAcpiTableGuid, (VOID **) &Rsdp);
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
|
@ -1269,7 +1260,7 @@ PcRtcAcpiTableChangeCallback (
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT (Rsdp != NULL);
|
ASSERT (Rsdp != NULL);
|
||||||
|
@ -1292,10 +1283,39 @@ PcRtcAcpiTableChangeCallback (
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((Fadt != NULL) &&
|
if ((Fadt != NULL) &&
|
||||||
(Fadt->Century > RTC_ADDRESS_REGISTER_D) && (Fadt->Century < 0x80) &&
|
(Fadt->Century > RTC_ADDRESS_REGISTER_D) && (Fadt->Century < 0x80)
|
||||||
(mModuleGlobal.CenturyRtcAddress != Fadt->Century)
|
|
||||||
) {
|
) {
|
||||||
mModuleGlobal.CenturyRtcAddress = Fadt->Century;
|
return Fadt->Century;
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Notification function of ACPI Table change.
|
||||||
|
|
||||||
|
This is a notification function registered on ACPI Table change event.
|
||||||
|
It saves the Century address stored in ACPI FADT table.
|
||||||
|
|
||||||
|
@param Event Event whose notification function is being invoked.
|
||||||
|
@param Context Pointer to the notification function's context.
|
||||||
|
|
||||||
|
**/
|
||||||
|
VOID
|
||||||
|
EFIAPI
|
||||||
|
PcRtcAcpiTableChangeCallback (
|
||||||
|
IN EFI_EVENT Event,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_TIME Time;
|
||||||
|
UINT8 CenturyRtcAddress;
|
||||||
|
UINT8 Century;
|
||||||
|
|
||||||
|
CenturyRtcAddress = GetCenturyRtcAddress ();
|
||||||
|
if ((CenturyRtcAddress != 0) && (mModuleGlobal.CenturyRtcAddress != CenturyRtcAddress)) {
|
||||||
|
mModuleGlobal.CenturyRtcAddress = CenturyRtcAddress;
|
||||||
Status = PcRtcGetTime (&Time, NULL, &mModuleGlobal);
|
Status = PcRtcGetTime (&Time, NULL, &mModuleGlobal);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Century = (UINT8) (Time.Year / 100);
|
Century = (UINT8) (Time.Year / 100);
|
||||||
|
|
Loading…
Reference in New Issue