mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-20 12:14:27 +02:00
PcAtChipsetPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the PcAtChipsetPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
This commit is contained in:
parent
ac0a286f4d
commit
5220bd211d
@ -230,7 +230,8 @@ IdeControllerStart (
|
||||
//
|
||||
return gBS->InstallMultipleProtocolInterfaces (
|
||||
&Controller,
|
||||
&gEfiIdeControllerInitProtocolGuid, &gEfiIdeControllerInit,
|
||||
&gEfiIdeControllerInitProtocolGuid,
|
||||
&gEfiIdeControllerInit,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
@ -285,7 +286,8 @@ IdeControllerStop (
|
||||
//
|
||||
Status = gBS->UninstallMultipleProtocolInterfaces (
|
||||
Controller,
|
||||
&gEfiIdeControllerInitProtocolGuid, &gEfiIdeControllerInit,
|
||||
&gEfiIdeControllerInitProtocolGuid,
|
||||
&gEfiIdeControllerInit,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
@ -306,6 +308,7 @@ IdeControllerStop (
|
||||
//
|
||||
// Interface functions of IDE_CONTROLLER_INIT protocol
|
||||
//
|
||||
|
||||
/**
|
||||
Returns the information about the specified IDE channel.
|
||||
|
||||
@ -565,7 +568,7 @@ IdeInitCalculateMode (
|
||||
OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
|
||||
)
|
||||
{
|
||||
if (Channel >= ICH_IDE_MAX_CHANNEL || Device >= ICH_IDE_MAX_DEVICES) {
|
||||
if ((Channel >= ICH_IDE_MAX_CHANNEL) || (Device >= ICH_IDE_MAX_DEVICES)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -44,6 +44,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
|
||||
//
|
||||
// Driver binding functions declaration
|
||||
//
|
||||
|
||||
/**
|
||||
Register Driver Binding protocol for this driver.
|
||||
|
||||
@ -110,6 +111,7 @@ IdeControllerStop (
|
||||
//
|
||||
// IDE controller init functions declaration
|
||||
//
|
||||
|
||||
/**
|
||||
Returns the information about the specified IDE channel.
|
||||
|
||||
@ -388,6 +390,7 @@ IdeInitSetTiming (
|
||||
//
|
||||
// Forward reference declaration
|
||||
//
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the EFI Driver.
|
||||
|
||||
|
@ -300,7 +300,9 @@ TimerInterruptHandler (
|
||||
//
|
||||
// Count number of ticks
|
||||
//
|
||||
DEBUG_CODE (mNumTicks++;);
|
||||
DEBUG_CODE (
|
||||
mNumTicks++;
|
||||
);
|
||||
|
||||
//
|
||||
// Clear HPET timer interrupt status
|
||||
@ -376,6 +378,7 @@ TimerInterruptHandler (
|
||||
//
|
||||
Delta = (mCounterMask - mPreviousMainCounter) + MainCounter;
|
||||
}
|
||||
|
||||
TimerPeriod = DivU64x32 (
|
||||
MultU64x32 (
|
||||
Delta & mCounterMask,
|
||||
@ -437,10 +440,11 @@ TimerDriverRegisterHandler (
|
||||
//
|
||||
// Check for invalid parameters
|
||||
//
|
||||
if (NotifyFunction == NULL && mTimerNotifyFunction == NULL) {
|
||||
if ((NotifyFunction == NULL) && (mTimerNotifyFunction == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
if (NotifyFunction != NULL && mTimerNotifyFunction != NULL) {
|
||||
|
||||
if ((NotifyFunction != NULL) && (mTimerNotifyFunction != NULL)) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
@ -513,6 +517,7 @@ TimerDriverSetTimerPeriod (
|
||||
} else {
|
||||
Delta = MainCounter - mPreviousMainCounter;
|
||||
}
|
||||
|
||||
if ((Delta & mCounterMask) >= mTimerCount) {
|
||||
//
|
||||
// Interrupt still happens after disable HPET, wait to be processed
|
||||
@ -530,7 +535,7 @@ TimerDriverSetTimerPeriod (
|
||||
// If TimerPeriod is 0, then mask HPET Timer interrupts
|
||||
//
|
||||
|
||||
if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
if ((mTimerConfiguration.Bits.MsiInterruptCapability != 0) && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
//
|
||||
// Disable HPET MSI interrupt generation
|
||||
//
|
||||
@ -567,6 +572,7 @@ TimerDriverSetTimerPeriod (
|
||||
} else {
|
||||
Delta = (mCounterMask - mPreviousMainCounter) + MainCounter;
|
||||
}
|
||||
|
||||
if ((Delta & mCounterMask) >= mTimerCount) {
|
||||
HpetWrite (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE, (MainCounter + 1) & mCounterMask);
|
||||
} else {
|
||||
@ -576,7 +582,7 @@ TimerDriverSetTimerPeriod (
|
||||
//
|
||||
// Enable HPET Timer interrupt generation
|
||||
//
|
||||
if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
if ((mTimerConfiguration.Bits.MsiInterruptCapability != 0) && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
//
|
||||
// Program MSI Address and MSI Data values in the selected HPET Timer
|
||||
// Program HPET register with APIC ID of current BSP in case BSP has been switched
|
||||
@ -787,7 +793,7 @@ TimerDriverInitialize (
|
||||
//
|
||||
ASSERT (mHpetGeneralCapabilities.Uint64 != 0);
|
||||
ASSERT (mHpetGeneralCapabilities.Uint64 != 0xFFFFFFFFFFFFFFFFULL);
|
||||
if (mHpetGeneralCapabilities.Uint64 == 0 || mHpetGeneralCapabilities.Uint64 == 0xFFFFFFFFFFFFFFFFULL) {
|
||||
if ((mHpetGeneralCapabilities.Uint64 == 0) || (mHpetGeneralCapabilities.Uint64 == 0xFFFFFFFFFFFFFFFFULL)) {
|
||||
DEBUG ((DEBUG_ERROR, "HPET device is not present. Unload HPET driver.\n"));
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
@ -812,6 +818,7 @@ TimerDriverInitialize (
|
||||
DEBUG ((DEBUG_INFO, " HPET_TIMER%d_COMPARATOR = 0x%016lx\n", TimerIndex, HpetRead (HPET_TIMER_COMPARATOR_OFFSET + TimerIndex * HPET_TIMER_STRIDE)));
|
||||
DEBUG ((DEBUG_INFO, " HPET_TIMER%d_MSI_ROUTE = 0x%016lx\n", TimerIndex, HpetRead (HPET_TIMER_MSI_ROUTE_OFFSET + TimerIndex * HPET_TIMER_STRIDE)));
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
//
|
||||
@ -857,7 +864,7 @@ TimerDriverInitialize (
|
||||
}
|
||||
}
|
||||
|
||||
if (FeaturePcdGet (PcdHpetMsiEnable) && MsiTimerIndex != HPET_INVALID_TIMER_INDEX) {
|
||||
if (FeaturePcdGet (PcdHpetMsiEnable) && (MsiTimerIndex != HPET_INVALID_TIMER_INDEX)) {
|
||||
//
|
||||
// Use MSI interrupt if supported
|
||||
//
|
||||
@ -959,12 +966,13 @@ TimerDriverInitialize (
|
||||
// Show state of enabled HPET timer
|
||||
//
|
||||
DEBUG_CODE_BEGIN ();
|
||||
if (mTimerConfiguration.Bits.MsiInterruptCapability != 0 && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
if ((mTimerConfiguration.Bits.MsiInterruptCapability != 0) && FeaturePcdGet (PcdHpetMsiEnable)) {
|
||||
DEBUG ((DEBUG_INFO, "HPET Interrupt Mode MSI\n"));
|
||||
} else {
|
||||
DEBUG ((DEBUG_INFO, "HPET Interrupt Mode I/O APIC\n"));
|
||||
DEBUG ((DEBUG_INFO, "HPET I/O APIC IRQ = 0x%02x\n", mTimerIrq));
|
||||
}
|
||||
|
||||
DEBUG ((DEBUG_INFO, "HPET Interrupt Vector = 0x%02x\n", PcdGet8 (PcdHpetLocalApicVector)));
|
||||
DEBUG ((DEBUG_INFO, "HPET Counter Mask = 0x%016lx\n", mCounterMask));
|
||||
DEBUG ((DEBUG_INFO, "HPET Timer Period = %d\n", mTimerPeriod));
|
||||
@ -976,7 +984,9 @@ TimerDriverInitialize (
|
||||
//
|
||||
// Wait for a few timer interrupts to fire before continuing
|
||||
//
|
||||
while (mNumTicks < 10);
|
||||
while (mNumTicks < 10) {
|
||||
}
|
||||
|
||||
DEBUG_CODE_END ();
|
||||
|
||||
//
|
||||
@ -984,7 +994,8 @@ TimerDriverInitialize (
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mTimerHandle,
|
||||
&gEfiTimerArchProtocolGuid, &mTimer,
|
||||
&gEfiTimerArchProtocolGuid,
|
||||
&mTimer,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
@ -8,6 +8,7 @@
|
||||
SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
#ifndef __IO_APIC_LIB_H__
|
||||
#define __IO_APIC_LIB_H__
|
||||
|
||||
@ -96,4 +97,5 @@ IoApicConfigureInterrupt (
|
||||
IN BOOLEAN LevelTriggered,
|
||||
IN BOOLEAN AssertionLevel
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include <Library/DebugLib.h>
|
||||
#include <IndustryStandard/Acpi.h>
|
||||
|
||||
GUID mFrequencyHobGuid = { 0x3fca54f6, 0xe1a2, 0x4b20, { 0xbe, 0x76, 0x92, 0x6b, 0x4b, 0x48, 0xbf, 0xaa }};
|
||||
GUID mFrequencyHobGuid = {
|
||||
0x3fca54f6, 0xe1a2, 0x4b20, { 0xbe, 0x76, 0x92, 0x6b, 0x4b, 0x48, 0xbf, 0xaa }
|
||||
};
|
||||
|
||||
/**
|
||||
Internal function to retrieves the 64-bit frequency in Hz.
|
||||
@ -122,12 +124,14 @@ InternalAcpiGetAcpiTimerIoPort (
|
||||
// value other than PcdAcpiIoPortBaseAddress
|
||||
//
|
||||
if (PcdGet16 (PcdAcpiIoPciBarRegisterOffset) != 0x0000) {
|
||||
Port = PciRead16 (PCI_LIB_ADDRESS (
|
||||
Port = PciRead16 (
|
||||
PCI_LIB_ADDRESS (
|
||||
PcdGet8 (PcdAcpiIoPciBusNumber),
|
||||
PcdGet8 (PcdAcpiIoPciDeviceNumber),
|
||||
PcdGet8 (PcdAcpiIoPciFunctionNumber),
|
||||
PcdGet16 (PcdAcpiIoPciBarRegisterOffset)
|
||||
));
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return (Port & PcdGet16 (PcdAcpiIoPortBaseAddressMask)) + PcdGet16 (PcdAcpiPm1TmrOffset);
|
||||
@ -285,6 +289,7 @@ GetPerformanceCounterProperties (
|
||||
if (EndValue != NULL) {
|
||||
*EndValue = 0xffffffffffffffffULL;
|
||||
}
|
||||
|
||||
return InternalGetPerformanceCounterFrequency ();
|
||||
}
|
||||
|
||||
@ -379,6 +384,7 @@ InternalCalculateTscFrequency (
|
||||
while (((Ticks - IoBitFieldRead32 (TimerAddr, 0, 23)) & BIT23) == 0) {
|
||||
CpuPause ();
|
||||
}
|
||||
|
||||
EndTSC = AsmReadTsc (); // TSC value 101.4 us later
|
||||
|
||||
TscFrequency = MultU64x32 (
|
||||
|
@ -6,7 +6,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _DXE_STANDALONE_MM_ACPI_TIMER_LIB_H_
|
||||
#define _DXE_STANDALONE_MM_ACPI_TIMER_LIB_H_
|
||||
|
||||
|
@ -64,7 +64,6 @@ ResetShutdown (
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This function causes a systemwide reset. The exact type of the reset is
|
||||
defined by the EFI_GUID that follows the Null-terminated Unicode string passed
|
||||
|
@ -144,13 +144,13 @@ SerialPortWrite (
|
||||
do {
|
||||
Data = IoRead8 ((UINT16)gUartBase + LSR_OFFSET);
|
||||
} while ((Data & LSR_TXRDY) == 0);
|
||||
|
||||
IoWrite8 ((UINT16)gUartBase, *Buffer++);
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reads data from a serial device into a buffer.
|
||||
|
||||
@ -480,4 +480,3 @@ SerialPortSetAttributes (
|
||||
|
||||
return RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -216,6 +216,7 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize RTC Register
|
||||
//
|
||||
@ -254,8 +255,10 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Get the Time/Date/Daylight Savings values.
|
||||
//
|
||||
@ -307,6 +310,7 @@ PcRtcInit (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = RtcTimeFieldsValid (&Time);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
//
|
||||
// Report Status Code to indicate that the RTC has bad date and time
|
||||
@ -356,7 +360,7 @@ PcRtcInit (
|
||||
Time.Year = PcdGet16 (PcdMinimalValidYear);
|
||||
Time.Nanosecond = 0;
|
||||
Time.TimeZone = Global->SavedTimeZone;
|
||||
Time.Daylight = Global->Daylight;;
|
||||
Time.Daylight = Global->Daylight;
|
||||
|
||||
//
|
||||
// Acquire RTC Lock to make access to RTC atomic
|
||||
@ -364,6 +368,7 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be updated
|
||||
//
|
||||
@ -372,6 +377,7 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -391,6 +397,7 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -419,6 +426,7 @@ PcRtcInit (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@ -451,14 +459,15 @@ PcRtcGetTime (
|
||||
//
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Acquire RTC Lock to make access to RTC atomic
|
||||
//
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be updated
|
||||
//
|
||||
@ -467,8 +476,10 @@ PcRtcGetTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// Read Register B
|
||||
//
|
||||
@ -504,6 +515,7 @@ PcRtcGetTime (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = RtcTimeFieldsValid (Time);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
@ -551,6 +563,7 @@ PcRtcSetTime (
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure that the time fields are valid
|
||||
//
|
||||
@ -567,6 +580,7 @@ PcRtcSetTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be updated
|
||||
//
|
||||
@ -575,6 +589,7 @@ PcRtcSetTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
@ -608,6 +623,7 @@ PcRtcSetTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -646,6 +662,7 @@ PcRtcSetTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Set the variable that contains the TimeZone and Daylight fields
|
||||
//
|
||||
@ -690,14 +707,15 @@ PcRtcGetWakeupTime (
|
||||
//
|
||||
if ((Enabled == NULL) || (Pending == NULL) || (Time == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Acquire RTC Lock to make access to RTC atomic
|
||||
//
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be updated
|
||||
//
|
||||
@ -706,8 +724,10 @@ PcRtcGetWakeupTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Read Register B and Register C
|
||||
//
|
||||
@ -763,6 +783,7 @@ PcRtcGetWakeupTime (
|
||||
if (!EFI_ERROR (Status)) {
|
||||
Status = RtcTimeFieldsValid (Time);
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
@ -800,10 +821,10 @@ PcRtcSetWakeupTime (
|
||||
ZeroMem (&RtcTime, sizeof (RtcTime));
|
||||
|
||||
if (Enable) {
|
||||
|
||||
if (Time == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure that the time fields are valid
|
||||
//
|
||||
@ -811,6 +832,7 @@ PcRtcSetWakeupTime (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Just support set alarm time within 24 hours
|
||||
//
|
||||
@ -819,21 +841,24 @@ PcRtcSetWakeupTime (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
if (!IsWithinOneDay (&RtcTime, Time)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Make a local copy of the time and date
|
||||
//
|
||||
CopyMem (&RtcTime, Time, sizeof (EFI_TIME));
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
// Acquire RTC Lock to make access to RTC atomic
|
||||
//
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiAcquireLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be updated
|
||||
//
|
||||
@ -842,8 +867,10 @@ PcRtcSetWakeupTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Read Register B
|
||||
//
|
||||
@ -879,6 +906,7 @@ PcRtcSetWakeupTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -897,10 +925,10 @@ PcRtcSetWakeupTime (
|
||||
RtcWrite (RTC_ADDRESS_HOURS_ALARM, RtcTime.Hour);
|
||||
|
||||
RegisterB.Bits.Aie = 1;
|
||||
|
||||
} else {
|
||||
RegisterB.Bits.Aie = 0;
|
||||
}
|
||||
|
||||
//
|
||||
// Allow updates of the RTC registers
|
||||
//
|
||||
@ -913,10 +941,10 @@ PcRtcSetWakeupTime (
|
||||
if (!EfiAtRuntime ()) {
|
||||
EfiReleaseLock (&Global->RtcLock);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Checks an 8-bit BCD value, and converts to an 8-bit value if valid.
|
||||
|
||||
@ -984,8 +1012,9 @@ ConvertRtcTimeToEfiTime (
|
||||
Time->Second = CheckAndConvertBcd8ToDecimal8 (Time->Second);
|
||||
}
|
||||
|
||||
if (Time->Year == 0xff || Time->Month == 0xff || Time->Day == 0xff ||
|
||||
Time->Hour == 0xff || Time->Minute == 0xff || Time->Second == 0xff) {
|
||||
if ((Time->Year == 0xff) || (Time->Month == 0xff) || (Time->Day == 0xff) ||
|
||||
(Time->Hour == 0xff) || (Time->Minute == 0xff) || (Time->Second == 0xff))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -998,17 +1027,18 @@ ConvertRtcTimeToEfiTime (
|
||||
if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
|
||||
Century++;
|
||||
}
|
||||
|
||||
Time->Year = (UINT16)(Century * 100 + Time->Year);
|
||||
|
||||
//
|
||||
// If time is in 12 hour format, convert it to 24 hour format
|
||||
//
|
||||
if (RegisterB.Bits.Mil == 0) {
|
||||
if (IsPM && Time->Hour < 12) {
|
||||
if (IsPM && (Time->Hour < 12)) {
|
||||
Time->Hour = (UINT8)(Time->Hour + 12);
|
||||
}
|
||||
|
||||
if (!IsPM && Time->Hour == 12) {
|
||||
if (!IsPM && (Time->Hour == 12)) {
|
||||
Time->Hour = 0;
|
||||
}
|
||||
}
|
||||
@ -1042,6 +1072,7 @@ RtcWaitToUpdate (
|
||||
if (RegisterD.Bits.Vrt == 0) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
//
|
||||
// Wait for up to 0.1 seconds for the RTC to be ready.
|
||||
//
|
||||
@ -1054,7 +1085,7 @@ RtcWaitToUpdate (
|
||||
}
|
||||
|
||||
RegisterD.Data = RtcRead (RTC_ADDRESS_REGISTER_D);
|
||||
if (Timeout == 0 || RegisterD.Bits.Vrt == 0) {
|
||||
if ((Timeout == 0) || (RegisterD.Bits.Vrt == 0)) {
|
||||
return EFI_DEVICE_ERROR;
|
||||
}
|
||||
|
||||
@ -1075,17 +1106,18 @@ RtcTimeFieldsValid (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
{
|
||||
if (Time->Year < PcdGet16 (PcdMinimalValidYear) ||
|
||||
Time->Year > PcdGet16 (PcdMaximalValidYear) ||
|
||||
Time->Month < 1 ||
|
||||
Time->Month > 12 ||
|
||||
if ((Time->Year < PcdGet16 (PcdMinimalValidYear)) ||
|
||||
(Time->Year > PcdGet16 (PcdMaximalValidYear)) ||
|
||||
(Time->Month < 1) ||
|
||||
(Time->Month > 12) ||
|
||||
(!DayValid (Time)) ||
|
||||
Time->Hour > 23 ||
|
||||
Time->Minute > 59 ||
|
||||
Time->Second > 59 ||
|
||||
Time->Nanosecond > 999999999 ||
|
||||
(!(Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE || (Time->TimeZone >= -1440 && Time->TimeZone <= 1440))) ||
|
||||
((Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT))) != 0)) {
|
||||
(Time->Hour > 23) ||
|
||||
(Time->Minute > 59) ||
|
||||
(Time->Second > 59) ||
|
||||
(Time->Nanosecond > 999999999) ||
|
||||
(!((Time->TimeZone == EFI_UNSPECIFIED_TIMEZONE) || ((Time->TimeZone >= -1440) && (Time->TimeZone <= 1440)))) ||
|
||||
((Time->Daylight & (~(EFI_TIME_ADJUST_DAYLIGHT | EFI_TIME_IN_DAYLIGHT))) != 0))
|
||||
{
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
@ -1110,10 +1142,11 @@ DayValid (
|
||||
//
|
||||
ASSERT (Time->Month >= 1);
|
||||
ASSERT (Time->Month <= 12);
|
||||
if (Time->Day < 1 ||
|
||||
Time->Day > mDayOfMonth[Time->Month - 1] ||
|
||||
(Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28))
|
||||
) {
|
||||
if ((Time->Day < 1) ||
|
||||
(Time->Day > mDayOfMonth[Time->Month - 1]) ||
|
||||
((Time->Month == 2) && (!IsLeapYear (Time) && (Time->Day > 28)))
|
||||
)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -1182,6 +1215,7 @@ ConvertEfiTimeToRtcTime (
|
||||
Time->Hour = 12;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Set the Time/Date values.
|
||||
//
|
||||
@ -1195,10 +1229,11 @@ ConvertEfiTimeToRtcTime (
|
||||
Time->Minute = DecimalToBcd8 (Time->Minute);
|
||||
Time->Second = DecimalToBcd8 (Time->Second);
|
||||
}
|
||||
|
||||
//
|
||||
// If we are in 12 hour mode and PM is set, then set bit 7 of the Hour field.
|
||||
//
|
||||
if (RegisterB.Bits.Mil == 0 && IsPM) {
|
||||
if ((RegisterB.Bits.Mil == 0) && IsPM) {
|
||||
Time->Hour = (UINT8)(Time->Hour | 0x80);
|
||||
}
|
||||
}
|
||||
@ -1223,7 +1258,8 @@ CompareHMS (
|
||||
{
|
||||
if ((From->Hour > To->Hour) ||
|
||||
((From->Hour == To->Hour) && (From->Minute > To->Minute)) ||
|
||||
((From->Hour == To->Hour) && (From->Minute == To->Minute) && (From->Second > To->Second))) {
|
||||
((From->Hour == To->Hour) && (From->Minute == To->Minute) && (From->Second > To->Second)))
|
||||
{
|
||||
return 1;
|
||||
} else if ((From->Hour == To->Hour) && (From->Minute == To->Minute) && (From->Second == To->Second)) {
|
||||
return 0;
|
||||
@ -1285,7 +1321,8 @@ IsWithinOneDay (
|
||||
(From->Month == 12) &&
|
||||
(From->Day == 31) &&
|
||||
(To->Month == 1) &&
|
||||
(To->Day == 1)) {
|
||||
(To->Day == 1))
|
||||
{
|
||||
if ((CompareHMS (From, To) >= 0)) {
|
||||
Adjacent = TRUE;
|
||||
}
|
||||
@ -1312,7 +1349,8 @@ GetCenturyRtcAddress (
|
||||
|
||||
if ((Fadt != NULL) &&
|
||||
(Fadt->Century > RTC_ADDRESS_REGISTER_D) && (Fadt->Century < 0x80)
|
||||
) {
|
||||
)
|
||||
{
|
||||
return Fadt->Century;
|
||||
} else {
|
||||
return 0;
|
||||
|
@ -8,11 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#ifndef _RTC_H_
|
||||
#define _RTC_H_
|
||||
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Guid/Acpi.h>
|
||||
@ -282,7 +280,6 @@ ConvertEfiTimeToRtcTime (
|
||||
IN RTC_REGISTER_B RegisterB
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Converts time read from RTC to EFI_TIME format defined by UEFI spec.
|
||||
|
||||
@ -371,4 +368,5 @@ PcRtcAcpiTableChangeCallback (
|
||||
IN EFI_EVENT Event,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
#endif
|
||||
|
@ -87,7 +87,6 @@ PcRtcEfiGetWakeupTime (
|
||||
return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Sets the system wakeup alarm clock time.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user