summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:54:10 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commit5220bd211df890f2672c23c050082862cd1e82d6 (patch)
treeef9ce787723fcb52a0e8812d7ce335f9f6614e86
parentac0a286f4d747a4c6c603a7b225917293cbe1e9f (diff)
downloadedk2-5220bd211df890f2672c23c050082862cd1e82d6.tar.gz
edk2-5220bd211df890f2672c23c050082862cd1e82d6.tar.bz2
edk2-5220bd211df890f2672c23c050082862cd1e82d6.zip
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>
-rw-r--r--PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/ComponentName.c34
-rw-r--r--PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.c107
-rw-r--r--PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h53
-rw-r--r--PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c115
-rw-r--r--PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h2
-rw-r--r--PcAtChipsetPkg/Include/Library/IoApicLib.h2
-rw-r--r--PcAtChipsetPkg/Include/Register/Hpet.h72
-rw-r--r--PcAtChipsetPkg/Include/Register/IoApic.h46
-rw-r--r--PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c68
-rw-r--r--PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c8
-rw-r--r--PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h1
-rw-r--r--PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.c14
-rw-r--r--PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c6
-rw-r--r--PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c45
-rw-r--r--PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c153
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c406
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h102
-rw-r--r--PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c39
18 files changed, 665 insertions, 608 deletions
diff --git a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/ComponentName.c b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/ComponentName.c
index 4f08ec1598..e5231a5914 100644
--- a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/ComponentName.c
+++ b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/ComponentName.c
@@ -21,16 +21,16 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gIdeControllerCompone
//
/// EFI Component Name 2 Protocol
///
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2 = {
- (EFI_COMPONENT_NAME2_GET_DRIVER_NAME) IdeControllerComponentNameGetDriverName,
- (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) IdeControllerComponentNameGetControllerName,
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2 = {
+ (EFI_COMPONENT_NAME2_GET_DRIVER_NAME)IdeControllerComponentNameGetDriverName,
+ (EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)IdeControllerComponentNameGetControllerName,
"en"
};
//
/// Driver Name Strings
///
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerDriverNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerDriverNameTable[] = {
{
"eng;en",
(CHAR16 *)L"IDE Controller Init Driver"
@@ -44,7 +44,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerDriverNameT
///
/// Controller Name Strings
///
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerControllerNameTable[] = {
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mIdeControllerControllerNameTable[] = {
{
"eng;en",
(CHAR16 *)L"PCAT IDE Controller"
@@ -136,14 +136,14 @@ IdeControllerComponentNameGetDriverName (
EFI_STATUS
EFIAPI
IdeControllerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// Make sure this driver is currently managing ControllHandle
@@ -162,10 +162,10 @@ IdeControllerComponentNameGetControllerName (
}
return LookupUnicodeString2 (
- Language,
- This->SupportedLanguages,
- mIdeControllerControllerNameTable,
- ControllerName,
- (BOOLEAN)(This == &gIdeControllerComponentName)
- );
+ Language,
+ This->SupportedLanguages,
+ mIdeControllerControllerNameTable,
+ ControllerName,
+ (BOOLEAN)(This == &gIdeControllerComponentName)
+ );
}
diff --git a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.c b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.c
index 8f41c7c3f4..da54433186 100644
--- a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.c
+++ b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.c
@@ -13,7 +13,7 @@
///
/// EFI_DRIVER_BINDING_PROTOCOL instance
///
-EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding = {
+EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding = {
IdeControllerSupported,
IdeControllerStart,
IdeControllerStop,
@@ -73,8 +73,8 @@ EFI_ATA_COLLECTIVE_MODE gEfiAtaCollectiveModeTemplate = {
EFI_STATUS
EFIAPI
InitializeIdeControllerDriver (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -109,15 +109,15 @@ InitializeIdeControllerDriver (
EFI_STATUS
EFIAPI
IdeControllerSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
- EFI_STATUS Status;
- EFI_PCI_IO_PROTOCOL *PciIo;
- UINT8 PciClass;
- UINT8 PciSubClass;
+ EFI_STATUS Status;
+ EFI_PCI_IO_PROTOCOL *PciIo;
+ UINT8 PciClass;
+ UINT8 PciSubClass;
//
// Attempt to Open PCI I/O Protocol
@@ -125,7 +125,7 @@ IdeControllerSupported (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ (VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -169,11 +169,11 @@ IdeControllerSupported (
Done:
gBS->CloseProtocol (
- Controller,
- &gEfiPciIoProtocolGuid,
- This->DriverBindingHandle,
- Controller
- );
+ Controller,
+ &gEfiPciIoProtocolGuid,
+ This->DriverBindingHandle,
+ Controller
+ );
return Status;
}
@@ -194,9 +194,9 @@ Done:
EFI_STATUS
EFIAPI
IdeControllerStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
{
EFI_STATUS Status;
@@ -208,7 +208,7 @@ IdeControllerStart (
Status = gBS->OpenProtocol (
Controller,
&gEfiPciIoProtocolGuid,
- (VOID **) &PciIo,
+ (VOID **)&PciIo,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_BY_DRIVER
@@ -230,7 +230,8 @@ IdeControllerStart (
//
return gBS->InstallMultipleProtocolInterfaces (
&Controller,
- &gEfiIdeControllerInitProtocolGuid, &gEfiIdeControllerInit,
+ &gEfiIdeControllerInitProtocolGuid,
+ &gEfiIdeControllerInit,
NULL
);
}
@@ -249,10 +250,10 @@ IdeControllerStart (
EFI_STATUS
EFIAPI
IdeControllerStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
{
EFI_STATUS Status;
@@ -264,13 +265,13 @@ IdeControllerStop (
Status = gBS->OpenProtocol (
Controller,
&gEfiIdeControllerInitProtocolGuid,
- (VOID **) &IdeControllerInit,
+ (VOID **)&IdeControllerInit,
This->DriverBindingHandle,
Controller,
EFI_OPEN_PROTOCOL_GET_PROTOCOL
);
if (EFI_ERROR (Status)) {
- return EFI_UNSUPPORTED;
+ return EFI_UNSUPPORTED;
}
//
@@ -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.
@@ -345,10 +348,10 @@ IdeControllerStop (
EFI_STATUS
EFIAPI
IdeInitGetChannelInfo (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- OUT BOOLEAN *Enabled,
- OUT UINT8 *MaxDevices
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
)
{
//
@@ -391,9 +394,9 @@ IdeInitGetChannelInfo (
EFI_STATUS
EFIAPI
IdeInitNotifyPhase (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
- IN UINT8 Channel
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
+ IN UINT8 Channel
)
{
return EFI_SUCCESS;
@@ -441,10 +444,10 @@ IdeInitNotifyPhase (
EFI_STATUS
EFIAPI
IdeInitSubmitData (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- IN UINT8 Device,
- IN EFI_IDENTIFY_DATA *IdentifyData
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_IDENTIFY_DATA *IdentifyData
)
{
return EFI_SUCCESS;
@@ -493,10 +496,10 @@ IdeInitSubmitData (
EFI_STATUS
EFIAPI
IdeInitDisqualifyMode (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- IN UINT8 Device,
- IN EFI_ATA_COLLECTIVE_MODE *BadModes
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *BadModes
)
{
return EFI_SUCCESS;
@@ -559,13 +562,13 @@ IdeInitDisqualifyMode (
EFI_STATUS
EFIAPI
IdeInitCalculateMode (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- IN UINT8 Device,
- OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ 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;
}
@@ -603,10 +606,10 @@ IdeInitCalculateMode (
EFI_STATUS
EFIAPI
IdeInitSetTiming (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- IN UINT8 Device,
- IN EFI_ATA_COLLECTIVE_MODE *Modes
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ IN UINT8 Device,
+ IN EFI_ATA_COLLECTIVE_MODE *Modes
)
{
return EFI_SUCCESS;
diff --git a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h
index a5bbbcc4e1..978a8f709c 100644
--- a/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h
+++ b/PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h
@@ -26,24 +26,25 @@
//
// Global Variables definitions
//
-extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;
-extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
///
/// Supports 2 channel max
///
-#define ICH_IDE_MAX_CHANNEL 0x02
+#define ICH_IDE_MAX_CHANNEL 0x02
///
/// Supports 2 devices max
///
-#define ICH_IDE_MAX_DEVICES 0x02
-#define ICH_IDE_ENUMER_ALL FALSE
+#define ICH_IDE_MAX_DEVICES 0x02
+#define ICH_IDE_ENUMER_ALL FALSE
//
// Driver binding functions declaration
//
+
/**
Register Driver Binding protocol for this driver.
@@ -58,9 +59,9 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
EFI_STATUS
EFIAPI
IdeControllerSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
;
@@ -80,9 +81,9 @@ IdeControllerSupported (
EFI_STATUS
EFIAPI
IdeControllerStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
)
;
@@ -100,16 +101,17 @@ IdeControllerStart (
EFI_STATUS
EFIAPI
IdeControllerStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN UINTN NumberOfChildren,
+ IN EFI_HANDLE *ChildHandleBuffer
)
;
//
// IDE controller init functions declaration
//
+
/**
Returns the information about the specified IDE channel.
@@ -149,10 +151,10 @@ IdeControllerStop (
EFI_STATUS
EFIAPI
IdeInitGetChannelInfo (
- IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
- IN UINT8 Channel,
- OUT BOOLEAN *Enabled,
- OUT UINT8 *MaxDevices
+ IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
+ IN UINT8 Channel,
+ OUT BOOLEAN *Enabled,
+ OUT UINT8 *MaxDevices
)
;
@@ -388,6 +390,7 @@ IdeInitSetTiming (
//
// Forward reference declaration
//
+
/**
Retrieves a Unicode string that is the user readable name of the EFI Driver.
@@ -461,11 +464,11 @@ IdeControllerComponentNameGetDriverName (
EFI_STATUS
EFIAPI
IdeControllerComponentNameGetControllerName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN EFI_HANDLE ControllerHandle,
- IN EFI_HANDLE ChildHandle OPTIONAL,
- IN CHAR8 *Language,
- OUT CHAR16 **ControllerName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
)
;
diff --git a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
index 3adc6d2365..427572c2ff 100644
--- a/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
+++ b/PcAtChipsetPkg/HpetTimerDxe/HpetTimer.c
@@ -120,8 +120,8 @@ TimerDriverSetTimerPeriod (
EFI_STATUS
EFIAPI
TimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
);
/**
@@ -149,7 +149,7 @@ TimerDriverGenerateSoftInterrupt (
///
/// The handle onto which the Timer Architectural Protocol will be installed.
///
-EFI_HANDLE mTimerHandle = NULL;
+EFI_HANDLE mTimerHandle = NULL;
///
/// The Timer Architectural Protocol that this driver produces.
@@ -288,8 +288,8 @@ HpetEnable (
VOID
EFIAPI
TimerInterruptHandler (
- IN EFI_EXCEPTION_TYPE InterruptType,
- IN EFI_SYSTEM_CONTEXT SystemContext
+ IN EFI_EXCEPTION_TYPE InterruptType,
+ IN EFI_SYSTEM_CONTEXT SystemContext
)
{
UINT64 MainCounter;
@@ -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
@@ -521,7 +526,7 @@ TimerDriverSetTimerPeriod (
CurrentComparator = HpetRead (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
while (CurrentComparator == mPreviousComparator) {
CurrentComparator = HpetRead (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
- CpuPause();
+ CpuPause ();
}
}
}
@@ -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
@@ -642,8 +648,8 @@ TimerDriverSetTimerPeriod (
EFI_STATUS
EFIAPI
TimerDriverGetTimerPeriod (
- IN EFI_TIMER_ARCH_PROTOCOL *This,
- OUT UINT64 *TimerPeriod
+ IN EFI_TIMER_ARCH_PROTOCOL *This,
+ OUT UINT64 *TimerPeriod
)
{
if (TimerPeriod == NULL) {
@@ -757,10 +763,10 @@ TimerDriverInitialize (
IN EFI_SYSTEM_TABLE *SystemTable
)
{
- EFI_STATUS Status;
- UINTN TimerIndex;
- UINTN MsiTimerIndex;
- HPET_TIMER_MSI_ROUTE_REGISTER HpetTimerMsiRoute;
+ EFI_STATUS Status;
+ UINTN TimerIndex;
+ UINTN MsiTimerIndex;
+ HPET_TIMER_MSI_ROUTE_REGISTER HpetTimerMsiRoute;
DEBUG ((DEBUG_INFO, "Init HPET Timer Driver\n"));
@@ -772,7 +778,7 @@ TimerDriverInitialize (
//
// Find the CPU architectural protocol.
//
- Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **) &mCpu);
+ Status = gBS->LocateProtocol (&gEfiCpuArchProtocolGuid, NULL, (VOID **)&mCpu);
ASSERT_EFI_ERROR (Status);
//
@@ -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;
}
@@ -801,17 +807,18 @@ TimerDriverInitialize (
// Dump HPET Configuration Information
//
DEBUG_CODE_BEGIN ();
- DEBUG ((DEBUG_INFO, "HPET Base Address = 0x%08x\n", PcdGet32 (PcdHpetBaseAddress)));
- DEBUG ((DEBUG_INFO, " HPET_GENERAL_CAPABILITIES_ID = 0x%016lx\n", mHpetGeneralCapabilities));
- DEBUG ((DEBUG_INFO, " HPET_GENERAL_CONFIGURATION = 0x%016lx\n", mHpetGeneralConfiguration.Uint64));
- DEBUG ((DEBUG_INFO, " HPET_GENERAL_INTERRUPT_STATUS = 0x%016lx\n", HpetRead (HPET_GENERAL_INTERRUPT_STATUS_OFFSET)));
- DEBUG ((DEBUG_INFO, " HPET_MAIN_COUNTER = 0x%016lx\n", HpetRead (HPET_MAIN_COUNTER_OFFSET)));
- DEBUG ((DEBUG_INFO, " HPET Main Counter Period = %d (fs)\n", mHpetGeneralCapabilities.Bits.CounterClockPeriod));
- for (TimerIndex = 0; TimerIndex <= mHpetGeneralCapabilities.Bits.NumberOfTimers; TimerIndex++) {
- DEBUG ((DEBUG_INFO, " HPET_TIMER%d_CONFIGURATION = 0x%016lx\n", TimerIndex, HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + TimerIndex * HPET_TIMER_STRIDE)));
- 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 ((DEBUG_INFO, "HPET Base Address = 0x%08x\n", PcdGet32 (PcdHpetBaseAddress)));
+ DEBUG ((DEBUG_INFO, " HPET_GENERAL_CAPABILITIES_ID = 0x%016lx\n", mHpetGeneralCapabilities));
+ DEBUG ((DEBUG_INFO, " HPET_GENERAL_CONFIGURATION = 0x%016lx\n", mHpetGeneralConfiguration.Uint64));
+ DEBUG ((DEBUG_INFO, " HPET_GENERAL_INTERRUPT_STATUS = 0x%016lx\n", HpetRead (HPET_GENERAL_INTERRUPT_STATUS_OFFSET)));
+ DEBUG ((DEBUG_INFO, " HPET_MAIN_COUNTER = 0x%016lx\n", HpetRead (HPET_MAIN_COUNTER_OFFSET)));
+ DEBUG ((DEBUG_INFO, " HPET Main Counter Period = %d (fs)\n", mHpetGeneralCapabilities.Bits.CounterClockPeriod));
+ for (TimerIndex = 0; TimerIndex <= mHpetGeneralCapabilities.Bits.NumberOfTimers; TimerIndex++) {
+ DEBUG ((DEBUG_INFO, " HPET_TIMER%d_CONFIGURATION = 0x%016lx\n", TimerIndex, HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + TimerIndex * HPET_TIMER_STRIDE)));
+ 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,11 +864,11 @@ TimerDriverInitialize (
}
}
- if (FeaturePcdGet (PcdHpetMsiEnable) && MsiTimerIndex != HPET_INVALID_TIMER_INDEX) {
+ if (FeaturePcdGet (PcdHpetMsiEnable) && (MsiTimerIndex != HPET_INVALID_TIMER_INDEX)) {
//
// Use MSI interrupt if supported
//
- mTimerIndex = MsiTimerIndex;
+ mTimerIndex = MsiTimerIndex;
//
// Program MSI Address and MSI Data values in the selected HPET Timer
@@ -874,7 +881,7 @@ TimerDriverInitialize (
// Read the HPET Timer Capabilities and Configuration register and initialize for MSI mode
// Clear LevelTriggeredInterrupt to use edge triggered interrupts when in MSI mode
//
- mTimerConfiguration.Uint64 = HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
+ mTimerConfiguration.Uint64 = HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
mTimerConfiguration.Bits.LevelTriggeredInterrupt = 0;
} else {
//
@@ -898,7 +905,7 @@ TimerDriverInitialize (
// Set LevelTriggeredInterrupt to use level triggered interrupts when in I/O APIC mode
// Set InterruptRoute field based in mTimerIrq
//
- mTimerConfiguration.Uint64 = HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
+ mTimerConfiguration.Uint64 = HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE);
mTimerConfiguration.Bits.LevelTriggeredInterrupt = 1;
mTimerConfiguration.Bits.InterruptRoute = mTimerIrq;
}
@@ -959,24 +966,27 @@ TimerDriverInitialize (
// Show state of enabled HPET timer
//
DEBUG_CODE_BEGIN ();
- 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));
- DEBUG ((DEBUG_INFO, "HPET Timer Count = 0x%016lx\n", mTimerCount));
- DEBUG ((DEBUG_INFO, "HPET_TIMER%d_CONFIGURATION = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
- DEBUG ((DEBUG_INFO, "HPET_TIMER%d_COMPARATOR = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
- DEBUG ((DEBUG_INFO, "HPET_TIMER%d_MSI_ROUTE = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_MSI_ROUTE_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
+ 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));
+ DEBUG ((DEBUG_INFO, "HPET Timer Count = 0x%016lx\n", mTimerCount));
+ DEBUG ((DEBUG_INFO, "HPET_TIMER%d_CONFIGURATION = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_CONFIGURATION_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
+ DEBUG ((DEBUG_INFO, "HPET_TIMER%d_COMPARATOR = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_COMPARATOR_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
+ DEBUG ((DEBUG_INFO, "HPET_TIMER%d_MSI_ROUTE = 0x%016lx\n", mTimerIndex, HpetRead (HPET_TIMER_MSI_ROUTE_OFFSET + mTimerIndex * HPET_TIMER_STRIDE)));
+
+ //
+ // Wait for a few timer interrupts to fire before continuing
+ //
+ while (mNumTicks < 10) {
+ }
- //
- // Wait for a few timer interrupts to fire before continuing
- //
- while (mNumTicks < 10);
DEBUG_CODE_END ();
//
@@ -984,7 +994,8 @@ TimerDriverInitialize (
//
Status = gBS->InstallMultipleProtocolInterfaces (
&mTimerHandle,
- &gEfiTimerArchProtocolGuid, &mTimer,
+ &gEfiTimerArchProtocolGuid,
+ &mTimer,
NULL
);
ASSERT_EFI_ERROR (Status);
diff --git a/PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h b/PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h
index f58c31383e..55647508af 100644
--- a/PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h
+++ b/PcAtChipsetPkg/Include/Guid/PcAtChipsetTokenSpace.h
@@ -14,6 +14,6 @@
0x326ae723, 0xae32, 0x4589, { 0x98, 0xb8, 0xca, 0xc2, 0x3c, 0xdc, 0xc1, 0xb1 } \
}
-extern EFI_GUID gPcAtChipsetPkgTokenSpaceGuid;
+extern EFI_GUID gPcAtChipsetPkgTokenSpaceGuid;
#endif
diff --git a/PcAtChipsetPkg/Include/Library/IoApicLib.h b/PcAtChipsetPkg/Include/Library/IoApicLib.h
index 4ee092c0f2..e92198fa28 100644
--- a/PcAtChipsetPkg/Include/Library/IoApicLib.h
+++ b/PcAtChipsetPkg/Include/Library/IoApicLib.h
@@ -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
diff --git a/PcAtChipsetPkg/Include/Register/Hpet.h b/PcAtChipsetPkg/Include/Register/Hpet.h
index 8437ec1f2d..9a69f5efc0 100644
--- a/PcAtChipsetPkg/Include/Register/Hpet.h
+++ b/PcAtChipsetPkg/Include/Register/Hpet.h
@@ -20,15 +20,15 @@
///
/// HPET Timer Register Offsets
///
-#define HPET_MAIN_COUNTER_OFFSET 0x0F0
-#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
-#define HPET_TIMER_COMPARATOR_OFFSET 0x108
-#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
+#define HPET_MAIN_COUNTER_OFFSET 0x0F0
+#define HPET_TIMER_CONFIGURATION_OFFSET 0x100
+#define HPET_TIMER_COMPARATOR_OFFSET 0x108
+#define HPET_TIMER_MSI_ROUTE_OFFSET 0x110
///
/// Stride between sets of HPET Timer Registers
///
-#define HPET_TIMER_STRIDE 0x20
+#define HPET_TIMER_STRIDE 0x20
#pragma pack(1)
@@ -37,15 +37,15 @@
///
typedef union {
struct {
- UINT32 Revision:8;
- UINT32 NumberOfTimers:5;
- UINT32 CounterSize:1;
- UINT32 Reserved0:1;
- UINT32 LegacyRoute:1;
- UINT32 VendorId:16;
- UINT32 CounterClockPeriod:32;
+ UINT32 Revision : 8;
+ UINT32 NumberOfTimers : 5;
+ UINT32 CounterSize : 1;
+ UINT32 Reserved0 : 1;
+ UINT32 LegacyRoute : 1;
+ UINT32 VendorId : 16;
+ UINT32 CounterClockPeriod : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_GENERAL_CAPABILITIES_ID_REGISTER;
///
@@ -53,12 +53,12 @@ typedef union {
///
typedef union {
struct {
- UINT32 MainCounterEnable:1;
- UINT32 LegacyRouteEnable:1;
- UINT32 Reserved0:30;
- UINT32 Reserved1:32;
+ UINT32 MainCounterEnable : 1;
+ UINT32 LegacyRouteEnable : 1;
+ UINT32 Reserved0 : 30;
+ UINT32 Reserved1 : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_GENERAL_CONFIGURATION_REGISTER;
///
@@ -66,22 +66,22 @@ typedef union {
///
typedef union {
struct {
- UINT32 Reserved0:1;
- UINT32 LevelTriggeredInterrupt:1;
- UINT32 InterruptEnable:1;
- UINT32 PeriodicInterruptEnable:1;
- UINT32 PeriodicInterruptCapability:1;
- UINT32 CounterSizeCapability:1;
- UINT32 ValueSetEnable:1;
- UINT32 Reserved1:1;
- UINT32 CounterSizeEnable:1;
- UINT32 InterruptRoute:5;
- UINT32 MsiInterruptEnable:1;
- UINT32 MsiInterruptCapability:1;
- UINT32 Reserved2:16;
- UINT32 InterruptRouteCapability;
+ UINT32 Reserved0 : 1;
+ UINT32 LevelTriggeredInterrupt : 1;
+ UINT32 InterruptEnable : 1;
+ UINT32 PeriodicInterruptEnable : 1;
+ UINT32 PeriodicInterruptCapability : 1;
+ UINT32 CounterSizeCapability : 1;
+ UINT32 ValueSetEnable : 1;
+ UINT32 Reserved1 : 1;
+ UINT32 CounterSizeEnable : 1;
+ UINT32 InterruptRoute : 5;
+ UINT32 MsiInterruptEnable : 1;
+ UINT32 MsiInterruptCapability : 1;
+ UINT32 Reserved2 : 16;
+ UINT32 InterruptRouteCapability;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_TIMER_CONFIGURATION_REGISTER;
///
@@ -89,10 +89,10 @@ typedef union {
///
typedef union {
struct {
- UINT32 Value:32;
- UINT32 Address:32;
+ UINT32 Value : 32;
+ UINT32 Address : 32;
} Bits;
- UINT64 Uint64;
+ UINT64 Uint64;
} HPET_TIMER_MSI_ROUTE_REGISTER;
#pragma pack()
diff --git a/PcAtChipsetPkg/Include/Register/IoApic.h b/PcAtChipsetPkg/Include/Register/IoApic.h
index f9f70b21ec..b6f5a899d2 100644
--- a/PcAtChipsetPkg/Include/Register/IoApic.h
+++ b/PcAtChipsetPkg/Include/Register/IoApic.h
@@ -37,42 +37,42 @@
typedef union {
struct {
- UINT32 Reserved0:24;
- UINT32 Identification:4;
- UINT32 Reserved1:4;
+ UINT32 Reserved0 : 24;
+ UINT32 Identification : 4;
+ UINT32 Reserved1 : 4;
} Bits;
- UINT32 Uint32;
+ UINT32 Uint32;
} IO_APIC_IDENTIFICATION_REGISTER;
typedef union {
struct {
- UINT32 Version:8;
- UINT32 Reserved0:8;
- UINT32 MaximumRedirectionEntry:8;
- UINT32 Reserved1:8;
+ UINT32 Version : 8;
+ UINT32 Reserved0 : 8;
+ UINT32 MaximumRedirectionEntry : 8;
+ UINT32 Reserved1 : 8;
} Bits;
- UINT32 Uint32;
+ UINT32 Uint32;
} IO_APIC_VERSION_REGISTER;
typedef union {
struct {
- UINT32 Vector: 8;
- UINT32 DeliveryMode: 3;
- UINT32 DestinationMode: 1;
- UINT32 DeliveryStatus: 1;
- UINT32 Polarity: 1;
- UINT32 RemoteIRR: 1;
- UINT32 TriggerMode: 1;
- UINT32 Mask: 1;
- UINT32 Reserved0: 15;
- UINT32 Reserved1: 24;
- UINT32 DestinationID: 8;
+ UINT32 Vector : 8;
+ UINT32 DeliveryMode : 3;
+ UINT32 DestinationMode : 1;
+ UINT32 DeliveryStatus : 1;
+ UINT32 Polarity : 1;
+ UINT32 RemoteIRR : 1;
+ UINT32 TriggerMode : 1;
+ UINT32 Mask : 1;
+ UINT32 Reserved0 : 15;
+ UINT32 Reserved1 : 24;
+ UINT32 DestinationID : 8;
} Bits;
struct {
- UINT32 Low;
- UINT32 High;
+ UINT32 Low;
+ UINT32 High;
} Uint32;
- UINT64 Uint64;
+ UINT64 Uint64;
} IO_APIC_REDIRECTION_TABLE_ENTRY;
#pragma pack()
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c b/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c
index bcb32545f3..d68eaccf1f 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/AcpiTimerLib.c
@@ -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.
@@ -45,11 +47,11 @@ AcpiTimerLibConstructor (
VOID
)
{
- UINTN Bus;
- UINTN Device;
- UINTN Function;
- UINTN EnableRegister;
- UINT8 EnableMask;
+ UINTN Bus;
+ UINTN Device;
+ UINTN Function;
+ UINTN EnableRegister;
+ UINT8 EnableMask;
//
// ASSERT for the invalid PCD values. They must be configured to the real value.
@@ -69,18 +71,18 @@ AcpiTimerLibConstructor (
//
// ASSERT for the invalid PCD values. They must be configured to the real value.
//
- ASSERT (PcdGet8 (PcdAcpiIoPciDeviceNumber) != 0xFF);
- ASSERT (PcdGet8 (PcdAcpiIoPciFunctionNumber) != 0xFF);
+ ASSERT (PcdGet8 (PcdAcpiIoPciDeviceNumber) != 0xFF);
+ ASSERT (PcdGet8 (PcdAcpiIoPciFunctionNumber) != 0xFF);
ASSERT (PcdGet16 (PcdAcpiIoPciEnableRegisterOffset) != 0xFFFF);
//
// Retrieve the PCD values for the PCI configuration space required to program the ACPI I/O Port Base Address
//
- Bus = PcdGet8 (PcdAcpiIoPciBusNumber);
- Device = PcdGet8 (PcdAcpiIoPciDeviceNumber);
- Function = PcdGet8 (PcdAcpiIoPciFunctionNumber);
+ Bus = PcdGet8 (PcdAcpiIoPciBusNumber);
+ Device = PcdGet8 (PcdAcpiIoPciDeviceNumber);
+ Function = PcdGet8 (PcdAcpiIoPciFunctionNumber);
EnableRegister = PcdGet16 (PcdAcpiIoPciEnableRegisterOffset);
- EnableMask = PcdGet8 (PcdAcpiIoBarEnableMask);
+ EnableMask = PcdGet8 (PcdAcpiIoBarEnableMask);
//
// If ACPI I/O space is not enabled yet, program ACPI I/O base address and enable it.
@@ -122,12 +124,14 @@ InternalAcpiGetAcpiTimerIoPort (
// value other than PcdAcpiIoPortBaseAddress
//
if (PcdGet16 (PcdAcpiIoPciBarRegisterOffset) != 0x0000) {
- Port = PciRead16 (PCI_LIB_ADDRESS (
- PcdGet8 (PcdAcpiIoPciBusNumber),
- PcdGet8 (PcdAcpiIoPciDeviceNumber),
- PcdGet8 (PcdAcpiIoPciFunctionNumber),
- PcdGet16 (PcdAcpiIoPciBarRegisterOffset)
- ));
+ Port = PciRead16 (
+ PCI_LIB_ADDRESS (
+ PcdGet8 (PcdAcpiIoPciBusNumber),
+ PcdGet8 (PcdAcpiIoPciDeviceNumber),
+ PcdGet8 (PcdAcpiIoPciFunctionNumber),
+ PcdGet16 (PcdAcpiIoPciBarRegisterOffset)
+ )
+ );
}
return (Port & PcdGet16 (PcdAcpiIoPortBaseAddressMask)) + PcdGet16 (PcdAcpiPm1TmrOffset);
@@ -147,9 +151,9 @@ InternalAcpiDelay (
IN UINT32 Delay
)
{
- UINT16 Port;
- UINT32 Ticks;
- UINT32 Times;
+ UINT16 Port;
+ UINT32 Ticks;
+ UINT32 Times;
Port = InternalAcpiGetAcpiTimerIoPort ();
Times = Delay >> 22;
@@ -285,6 +289,7 @@ GetPerformanceCounterProperties (
if (EndValue != NULL) {
*EndValue = 0xffffffffffffffffULL;
}
+
return InternalGetPerformanceCounterFrequency ();
}
@@ -324,9 +329,9 @@ GetTimeInNanoSecond (
// Since 2^29 < 1,000,000,000 = 0x3B9ACA00 < 2^30, Remainder should < 2^(64-30) = 2^34,
// i.e. highest bit set in Remainder should <= 33.
//
- Shift = MAX (0, HighBitSet64 (Remainder) - 33);
- Remainder = RShiftU64 (Remainder, (UINTN) Shift);
- Frequency = RShiftU64 (Frequency, (UINTN) Shift);
+ Shift = MAX (0, HighBitSet64 (Remainder) - 33);
+ Remainder = RShiftU64 (Remainder, (UINTN)Shift);
+ Frequency = RShiftU64 (Frequency, (UINTN)Shift);
NanoSeconds += DivU64x64Remainder (MultU64x32 (Remainder, 1000000000u), Frequency, NULL);
return NanoSeconds;
@@ -352,12 +357,12 @@ InternalCalculateTscFrequency (
VOID
)
{
- UINT64 StartTSC;
- UINT64 EndTSC;
- UINT16 TimerAddr;
- UINT32 Ticks;
- UINT64 TscFrequency;
- BOOLEAN InterruptState;
+ UINT64 StartTSC;
+ UINT64 EndTSC;
+ UINT16 TimerAddr;
+ UINT32 Ticks;
+ UINT64 TscFrequency;
+ BOOLEAN InterruptState;
InterruptState = SaveAndDisableInterrupts ();
@@ -377,8 +382,9 @@ InternalCalculateTscFrequency (
// the while loop will exit.
//
while (((Ticks - IoBitFieldRead32 (TimerAddr, 0, 23)) & BIT23) == 0) {
- CpuPause();
+ CpuPause ();
}
+
EndTSC = AsmReadTsc (); // TSC value 101.4 us later
TscFrequency = MultU64x32 (
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
index 0e401194d0..16ac48938f 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.c
@@ -11,7 +11,7 @@
#include <Library/BaseLib.h>
#include <Library/HobLib.h>
-extern GUID mFrequencyHobGuid;
+extern GUID mFrequencyHobGuid;
/**
The constructor function enables ACPI IO space.
@@ -66,7 +66,7 @@ InternalGetPerformanceCounterFrequency (
VOID
)
{
- return mPerformanceCounterFrequency;
+ return mPerformanceCounterFrequency;
}
/**
@@ -80,7 +80,7 @@ CommonAcpiTimerLibConstructor (
VOID
)
{
- EFI_HOB_GUID_TYPE *GuidHob;
+ EFI_HOB_GUID_TYPE *GuidHob;
//
// Enable ACPI IO space.
@@ -92,7 +92,7 @@ CommonAcpiTimerLibConstructor (
//
GuidHob = GetFirstGuidHob (&mFrequencyHobGuid);
if (GuidHob != NULL) {
- mPerformanceCounterFrequency = *(UINT64*)GET_GUID_HOB_DATA (GuidHob);
+ mPerformanceCounterFrequency = *(UINT64 *)GET_GUID_HOB_DATA (GuidHob);
} else {
mPerformanceCounterFrequency = InternalCalculateTscFrequency ();
}
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h
index 6015d684e5..455d82a840 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/DxeStandaloneMmAcpiTimerLib.h
@@ -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_
diff --git a/PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.c b/PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.c
index a669794c3b..c2f629486d 100644
--- a/PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.c
+++ b/PcAtChipsetPkg/Library/AcpiTimerLib/PeiAcpiTimerLib.c
@@ -12,7 +12,7 @@
#include <Library/HobLib.h>
#include <Library/DebugLib.h>
-extern GUID mFrequencyHobGuid;
+extern GUID mFrequencyHobGuid;
/**
Calculate TSC frequency.
@@ -47,18 +47,18 @@ InternalGetPerformanceCounterFrequency (
VOID
)
{
- UINT64 *PerformanceCounterFrequency;
- EFI_HOB_GUID_TYPE *GuidHob;
+ UINT64 *PerformanceCounterFrequency;
+ EFI_HOB_GUID_TYPE *GuidHob;
PerformanceCounterFrequency = NULL;
- GuidHob = GetFirstGuidHob (&mFrequencyHobGuid);
+ GuidHob = GetFirstGuidHob (&mFrequencyHobGuid);
if (GuidHob == NULL) {
- PerformanceCounterFrequency = (UINT64*)BuildGuidHob(&mFrequencyHobGuid, sizeof (*PerformanceCounterFrequency));
+ PerformanceCounterFrequency = (UINT64 *)BuildGuidHob (&mFrequencyHobGuid, sizeof (*PerformanceCounterFrequency));
ASSERT (PerformanceCounterFrequency != NULL);
*PerformanceCounterFrequency = InternalCalculateTscFrequency ();
} else {
- PerformanceCounterFrequency = (UINT64*)GET_GUID_HOB_DATA (GuidHob);
+ PerformanceCounterFrequency = (UINT64 *)GET_GUID_HOB_DATA (GuidHob);
}
- return *PerformanceCounterFrequency;
+ return *PerformanceCounterFrequency;
}
diff --git a/PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c b/PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c
index 9e4a58049e..53ce15c4e0 100644
--- a/PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c
+++ b/PcAtChipsetPkg/Library/BaseIoApicLib/IoApicLib.c
@@ -86,7 +86,7 @@ IoApicEnableInterrupt (
ASSERT (Irq <= Version.Bits.MaximumRedirectionEntry);
Entry.Uint32.Low = IoApicRead (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2);
- Entry.Bits.Mask = Enable ? 0 : 1;
+ Entry.Bits.Mask = Enable ? 0 : 1;
IoApicWrite (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2, Entry.Uint32.Low);
}
@@ -137,7 +137,7 @@ IoApicConfigureInterrupt (
ASSERT (Vector <= 0xFF);
ASSERT (DeliveryMode < 8 && DeliveryMode != 6 && DeliveryMode != 3);
- Entry.Uint32.Low = IoApicRead (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2);
+ Entry.Uint32.Low = IoApicRead (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2);
Entry.Bits.Vector = (UINT8)Vector;
Entry.Bits.DeliveryMode = (UINT32)DeliveryMode;
Entry.Bits.DestinationMode = 0;
@@ -146,7 +146,7 @@ IoApicConfigureInterrupt (
Entry.Bits.Mask = 1;
IoApicWrite (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2, Entry.Uint32.Low);
- Entry.Uint32.High = IoApicRead (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2 + 1);
+ Entry.Uint32.High = IoApicRead (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2 + 1);
Entry.Bits.DestinationID = GetApicId ();
IoApicWrite (IO_APIC_REDIRECTION_TABLE_ENTRY_INDEX + Irq * 2 + 1, Entry.Uint32.High);
}
diff --git a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
index e42c41c48e..4f3cb46d6e 100644
--- a/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/PcAtChipsetPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -29,7 +29,7 @@ ResetCold (
VOID
)
{
- IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
+ IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
}
/**
@@ -45,7 +45,7 @@ ResetWarm (
VOID
)
{
- IoWrite8 ((UINTN) PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
+ IoWrite8 ((UINTN)PcdGet64 (PcdResetControlRegister), PcdGet8 (PcdResetControlValueColdReset));
}
/**
@@ -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
@@ -79,8 +78,8 @@ ResetShutdown (
VOID
EFIAPI
ResetPlatformSpecific (
- IN UINTN DataSize,
- IN VOID *ResetData
+ IN UINTN DataSize,
+ IN VOID *ResetData
)
{
ResetCold ();
@@ -101,30 +100,30 @@ ResetPlatformSpecific (
VOID
EFIAPI
ResetSystem (
- IN EFI_RESET_TYPE ResetType,
- IN EFI_STATUS ResetStatus,
- IN UINTN DataSize,
- IN VOID *ResetData OPTIONAL
+ IN EFI_RESET_TYPE ResetType,
+ IN EFI_STATUS ResetStatus,
+ IN UINTN DataSize,
+ IN VOID *ResetData OPTIONAL
)
{
switch (ResetType) {
- case EfiResetWarm:
- ResetWarm ();
- break;
+ case EfiResetWarm:
+ ResetWarm ();
+ break;
- case EfiResetCold:
- ResetCold ();
- break;
+ case EfiResetCold:
+ ResetCold ();
+ break;
- case EfiResetShutdown:
- ResetShutdown ();
- return;
+ case EfiResetShutdown:
+ ResetShutdown ();
+ return;
- case EfiResetPlatformSpecific:
- ResetPlatformSpecific (DataSize, ResetData);
- return;
+ case EfiResetPlatformSpecific:
+ ResetPlatformSpecific (DataSize, ResetData);
+ return;
- default:
- return;
+ default:
+ return;
}
}
diff --git a/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c b/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
index aa5657a7fd..11537ec276 100644
--- a/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
+++ b/PcAtChipsetPkg/Library/SerialIoLib/SerialPortLib.c
@@ -10,39 +10,39 @@
#include <Library/IoLib.h>
#include <Library/SerialPortLib.h>
-//---------------------------------------------
+// ---------------------------------------------
// UART Register Offsets
-//---------------------------------------------
-#define BAUD_LOW_OFFSET 0x00
-#define BAUD_HIGH_OFFSET 0x01
-#define IER_OFFSET 0x01
-#define LCR_SHADOW_OFFSET 0x01
-#define FCR_SHADOW_OFFSET 0x02
-#define IR_CONTROL_OFFSET 0x02
-#define FCR_OFFSET 0x02
-#define EIR_OFFSET 0x02
-#define BSR_OFFSET 0x03
-#define LCR_OFFSET 0x03
-#define MCR_OFFSET 0x04
-#define LSR_OFFSET 0x05
-#define MSR_OFFSET 0x06
-
-//---------------------------------------------
+// ---------------------------------------------
+#define BAUD_LOW_OFFSET 0x00
+#define BAUD_HIGH_OFFSET 0x01
+#define IER_OFFSET 0x01
+#define LCR_SHADOW_OFFSET 0x01
+#define FCR_SHADOW_OFFSET 0x02
+#define IR_CONTROL_OFFSET 0x02
+#define FCR_OFFSET 0x02
+#define EIR_OFFSET 0x02
+#define BSR_OFFSET 0x03
+#define LCR_OFFSET 0x03
+#define MCR_OFFSET 0x04
+#define LSR_OFFSET 0x05
+#define MSR_OFFSET 0x06
+
+// ---------------------------------------------
// UART Register Bit Defines
-//---------------------------------------------
-#define LSR_TXRDY 0x20
-#define LSR_RXDA 0x01
-#define DLAB 0x01
-#define MCR_DTRC 0x01
-#define MCR_RTS 0x02
-#define MSR_CTS 0x10
-#define MSR_DSR 0x20
-#define MSR_RI 0x40
-#define MSR_DCD 0x80
-
-//---------------------------------------------
+// ---------------------------------------------
+#define LSR_TXRDY 0x20
+#define LSR_RXDA 0x01
+#define DLAB 0x01
+#define MCR_DTRC 0x01
+#define MCR_RTS 0x02
+#define MSR_CTS 0x10
+#define MSR_DSR 0x20
+#define MSR_RI 0x40
+#define MSR_DCD 0x80
+
+// ---------------------------------------------
// UART Settings
-//---------------------------------------------
+// ---------------------------------------------
UINT16 gUartBase = 0x3F8;
UINTN gBps = 115200;
UINT8 gData = 8;
@@ -74,7 +74,7 @@ SerialPortInitialize (
//
// Map 5..8 to 0..3
//
- Data = (UINT8) (gData - (UINT8) 5);
+ Data = (UINT8)(gData - (UINT8)5);
//
// Calculate divisor for baud generator
@@ -84,19 +84,19 @@ SerialPortInitialize (
//
// Set communications format
//
- OutputData = (UINT8) ((DLAB << 7) | (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
+ OutputData = (UINT8)((DLAB << 7) | (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
//
// Configure baud rate
//
- IoWrite8 (gUartBase + BAUD_HIGH_OFFSET, (UINT8) (Divisor >> 8));
- IoWrite8 (gUartBase + BAUD_LOW_OFFSET, (UINT8) (Divisor & 0xff));
+ IoWrite8 (gUartBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8));
+ IoWrite8 (gUartBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff));
//
// Switch back to bank 0
//
- OutputData = (UINT8) ( (gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
+ OutputData = (UINT8)((gBreakSet << 6) | (gParity << 3) | (gStop << 2) | Data);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
return RETURN_SUCCESS;
@@ -124,9 +124,9 @@ SerialPortInitialize (
UINTN
EFIAPI
SerialPortWrite (
- IN UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
+ IN UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
{
UINTN Result;
UINT8 Data;
@@ -142,15 +142,15 @@ SerialPortWrite (
// Wait for the serial port to be ready.
//
do {
- Data = IoRead8 ((UINT16) gUartBase + LSR_OFFSET);
+ Data = IoRead8 ((UINT16)gUartBase + LSR_OFFSET);
} while ((Data & LSR_TXRDY) == 0);
- IoWrite8 ((UINT16) gUartBase, *Buffer++);
+
+ IoWrite8 ((UINT16)gUartBase, *Buffer++);
}
return Result;
}
-
/**
Reads data from a serial device into a buffer.
@@ -165,9 +165,9 @@ SerialPortWrite (
UINTN
EFIAPI
SerialPortRead (
- OUT UINT8 *Buffer,
- IN UINTN NumberOfBytes
-)
+ OUT UINT8 *Buffer,
+ IN UINTN NumberOfBytes
+ )
{
UINTN Result;
UINT8 Data;
@@ -183,10 +183,10 @@ SerialPortRead (
// Wait for the serial port to be ready.
//
do {
- Data = IoRead8 ((UINT16) gUartBase + LSR_OFFSET);
+ Data = IoRead8 ((UINT16)gUartBase + LSR_OFFSET);
} while ((Data & LSR_RXDA) == 0);
- *Buffer++ = IoRead8 ((UINT16) gUartBase);
+ *Buffer++ = IoRead8 ((UINT16)gUartBase);
}
return Result;
@@ -214,9 +214,9 @@ SerialPortPoll (
//
// Read the serial port status.
//
- Data = IoRead8 ((UINT16) gUartBase + LSR_OFFSET);
+ Data = IoRead8 ((UINT16)gUartBase + LSR_OFFSET);
- return (BOOLEAN) ((Data & LSR_RXDA) != 0);
+ return (BOOLEAN)((Data & LSR_RXDA) != 0);
}
/**
@@ -232,10 +232,10 @@ SerialPortPoll (
RETURN_STATUS
EFIAPI
SerialPortSetControl (
- IN UINT32 Control
+ IN UINT32 Control
)
{
- UINT8 Mcr;
+ UINT8 Mcr;
//
// First determine the parameter is invalid.
@@ -247,7 +247,7 @@ SerialPortSetControl (
//
// Read the Modem Control Register.
//
- Mcr = IoRead8 ((UINT16) gUartBase + MCR_OFFSET);
+ Mcr = IoRead8 ((UINT16)gUartBase + MCR_OFFSET);
Mcr &= (~(MCR_DTRC | MCR_RTS));
if ((Control & EFI_SERIAL_DATA_TERMINAL_READY) == EFI_SERIAL_DATA_TERMINAL_READY) {
@@ -261,7 +261,7 @@ SerialPortSetControl (
//
// Write the Modem Control Register.
//
- IoWrite8 ((UINT16) gUartBase + MCR_OFFSET, Mcr);
+ IoWrite8 ((UINT16)gUartBase + MCR_OFFSET, Mcr);
return RETURN_SUCCESS;
}
@@ -279,19 +279,19 @@ SerialPortSetControl (
RETURN_STATUS
EFIAPI
SerialPortGetControl (
- OUT UINT32 *Control
+ OUT UINT32 *Control
)
{
- UINT8 Msr;
- UINT8 Mcr;
- UINT8 Lsr;
+ UINT8 Msr;
+ UINT8 Mcr;
+ UINT8 Lsr;
*Control = 0;
//
// Read the Modem Status Register.
//
- Msr = IoRead8 ((UINT16) gUartBase + MSR_OFFSET);
+ Msr = IoRead8 ((UINT16)gUartBase + MSR_OFFSET);
if ((Msr & MSR_CTS) == MSR_CTS) {
*Control |= EFI_SERIAL_CLEAR_TO_SEND;
@@ -312,7 +312,7 @@ SerialPortGetControl (
//
// Read the Modem Control Register.
//
- Mcr = IoRead8 ((UINT16) gUartBase + MCR_OFFSET);
+ Mcr = IoRead8 ((UINT16)gUartBase + MCR_OFFSET);
if ((Mcr & MCR_DTRC) == MCR_DTRC) {
*Control |= EFI_SERIAL_DATA_TERMINAL_READY;
@@ -325,7 +325,7 @@ SerialPortGetControl (
//
// Read the Line Status Register.
//
- Lsr = IoRead8 ((UINT16) gUartBase + LSR_OFFSET);
+ Lsr = IoRead8 ((UINT16)gUartBase + LSR_OFFSET);
if ((Lsr & LSR_TXRDY) == LSR_TXRDY) {
*Control |= EFI_SERIAL_OUTPUT_BUFFER_EMPTY;
@@ -374,19 +374,19 @@ SerialPortGetControl (
RETURN_STATUS
EFIAPI
SerialPortSetAttributes (
- IN OUT UINT64 *BaudRate,
- IN OUT UINT32 *ReceiveFifoDepth,
- IN OUT UINT32 *Timeout,
- IN OUT EFI_PARITY_TYPE *Parity,
- IN OUT UINT8 *DataBits,
- IN OUT EFI_STOP_BITS_TYPE *StopBits
+ IN OUT UINT64 *BaudRate,
+ IN OUT UINT32 *ReceiveFifoDepth,
+ IN OUT UINT32 *Timeout,
+ IN OUT EFI_PARITY_TYPE *Parity,
+ IN OUT UINT8 *DataBits,
+ IN OUT EFI_STOP_BITS_TYPE *StopBits
)
{
- UINTN Divisor;
- UINT8 OutputData;
- UINT8 LcrData;
- UINT8 LcrParity;
- UINT8 LcrStop;
+ UINTN Divisor;
+ UINT8 OutputData;
+ UINT8 LcrData;
+ UINT8 LcrParity;
+ UINT8 LcrStop;
//
// Check for default settings and fill in actual values.
@@ -414,7 +414,7 @@ SerialPortSetAttributes (
//
// Map 5..8 to 0..3
//
- LcrData = (UINT8) (*DataBits - (UINT8) 5);
+ LcrData = (UINT8)(*DataBits - (UINT8)5);
switch (*Parity) {
case NoParity:
@@ -458,26 +458,25 @@ SerialPortSetAttributes (
//
// Calculate divisor for baud generator
//
- Divisor = 115200 / (UINTN) *BaudRate;
+ Divisor = 115200 / (UINTN)*BaudRate;
//
// Set communications format
//
- OutputData = (UINT8) ((DLAB << 7) | (gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
+ OutputData = (UINT8)((DLAB << 7) | (gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
//
// Configure baud rate
//
- IoWrite8 (gUartBase + BAUD_HIGH_OFFSET, (UINT8) (Divisor >> 8));
- IoWrite8 (gUartBase + BAUD_LOW_OFFSET, (UINT8) (Divisor & 0xff));
+ IoWrite8 (gUartBase + BAUD_HIGH_OFFSET, (UINT8)(Divisor >> 8));
+ IoWrite8 (gUartBase + BAUD_LOW_OFFSET, (UINT8)(Divisor & 0xff));
//
// Switch back to bank 0
//
- OutputData = (UINT8) ((gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
+ OutputData = (UINT8)((gBreakSet << 6) | (LcrParity << 3) | (LcrStop << 2) | LcrData);
IoWrite8 (gUartBase + LCR_OFFSET, OutputData);
return RETURN_SUCCESS;
}
-
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index ebc2f3aa8b..0fbfa4bcee 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -17,12 +17,12 @@ extern UINTN mRtcTargetRegister;
//
// Days of month.
//
-UINTN mDayOfMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+UINTN mDayOfMonth[] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
//
// The name of NV variable to store the timezone and daylight saving information.
//
-CHAR16 mTimeZoneVariableName[] = L"RTC";
+CHAR16 mTimeZoneVariableName[] = L"RTC";
/**
Compare the Hour, Minute and Second of the From time and the To time.
@@ -38,8 +38,8 @@ CHAR16 mTimeZoneVariableName[] = L"RTC";
**/
INTN
CompareHMS (
- IN EFI_TIME *From,
- IN EFI_TIME *To
+ IN EFI_TIME *From,
+ IN EFI_TIME *To
);
/**
@@ -53,8 +53,8 @@ CompareHMS (
**/
BOOLEAN
IsWithinOneDay (
- IN EFI_TIME *From,
- IN EFI_TIME *To
+ IN EFI_TIME *From,
+ IN EFI_TIME *To
);
/**
@@ -68,7 +68,7 @@ IsWithinOneDay (
STATIC
UINT8
IoRtcRead (
- IN UINTN Address
+ IN UINTN Address
)
{
IoWrite8 (
@@ -89,8 +89,8 @@ IoRtcRead (
STATIC
VOID
IoRtcWrite (
- IN UINTN Address,
- IN UINT8 Data
+ IN UINTN Address,
+ IN UINT8 Data
)
{
IoWrite8 (
@@ -111,7 +111,7 @@ IoRtcWrite (
STATIC
UINT8
MmioRtcRead (
- IN UINTN Address
+ IN UINTN Address
)
{
MmioWrite8 (
@@ -132,8 +132,8 @@ MmioRtcRead (
STATIC
VOID
MmioRtcWrite (
- IN UINTN Address,
- IN UINT8 Data
+ IN UINTN Address,
+ IN UINT8 Data
)
{
MmioWrite8 (
@@ -154,7 +154,7 @@ MmioRtcWrite (
STATIC
UINT8
RtcRead (
- IN UINTN Address
+ IN UINTN Address
)
{
if (FeaturePcdGet (PcdRtcUseMmio)) {
@@ -175,8 +175,8 @@ RtcRead (
STATIC
VOID
RtcWrite (
- IN UINTN Address,
- IN UINT8 Data
+ IN UINTN Address,
+ IN UINT8 Data
)
{
if (FeaturePcdGet (PcdRtcUseMmio)) {
@@ -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.
//
@@ -285,16 +288,16 @@ PcRtcInit (
// stored in NV variable during previous boot.
//
DataSize = sizeof (UINT32);
- Status = EfiGetVariable (
- mTimeZoneVariableName,
- &gEfiCallerIdGuid,
- NULL,
- &DataSize,
- &TimerVar
- );
+ Status = EfiGetVariable (
+ mTimeZoneVariableName,
+ &gEfiCallerIdGuid,
+ NULL,
+ &DataSize,
+ &TimerVar
+ );
if (!EFI_ERROR (Status)) {
- Time.TimeZone = (INT16) TimerVar;
- Time.Daylight = (UINT8) (TimerVar >> 16);
+ Time.TimeZone = (INT16)TimerVar;
+ Time.Daylight = (UINT8)(TimerVar >> 16);
} else {
Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
Time.Daylight = 0;
@@ -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
@@ -315,15 +319,15 @@ PcRtcInit (
EFI_ERROR_CODE | EFI_ERROR_MINOR,
(EFI_SOFTWARE_DXE_RT_DRIVER | EFI_SW_EC_BAD_DATE_TIME)
);
- Time.Second = RTC_INIT_SECOND;
- Time.Minute = RTC_INIT_MINUTE;
- Time.Hour = RTC_INIT_HOUR;
- Time.Day = RTC_INIT_DAY;
- Time.Month = RTC_INIT_MONTH;
- Time.Year = PcdGet16 (PcdMinimalValidYear);
- Time.Nanosecond = 0;
- Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
- Time.Daylight = 0;
+ Time.Second = RTC_INIT_SECOND;
+ Time.Minute = RTC_INIT_MINUTE;
+ Time.Hour = RTC_INIT_HOUR;
+ Time.Day = RTC_INIT_DAY;
+ Time.Month = RTC_INIT_MONTH;
+ Time.Year = PcdGet16 (PcdMinimalValidYear);
+ Time.Nanosecond = 0;
+ Time.TimeZone = EFI_UNSPECIFIED_TIMEZONE;
+ Time.Daylight = 0;
}
//
@@ -348,15 +352,15 @@ PcRtcInit (
// When wakeup time is disabled and invalid, reset wakeup time register to valid state
// but keep wakeup alarm disabled.
//
- Time.Second = RTC_INIT_SECOND;
- Time.Minute = RTC_INIT_MINUTE;
- Time.Hour = RTC_INIT_HOUR;
- Time.Day = RTC_INIT_DAY;
- Time.Month = RTC_INIT_MONTH;
- Time.Year = PcdGet16 (PcdMinimalValidYear);
- Time.Nanosecond = 0;
- Time.TimeZone = Global->SavedTimeZone;
- Time.Daylight = Global->Daylight;;
+ Time.Second = RTC_INIT_SECOND;
+ Time.Minute = RTC_INIT_MINUTE;
+ Time.Hour = RTC_INIT_HOUR;
+ Time.Day = RTC_INIT_DAY;
+ Time.Month = RTC_INIT_MONTH;
+ Time.Year = PcdGet16 (PcdMinimalValidYear);
+ Time.Nanosecond = 0;
+ Time.TimeZone = Global->SavedTimeZone;
+ Time.Daylight = Global->Daylight;
//
// Acquire RTC Lock to make access to RTC atomic
@@ -364,14 +368,16 @@ PcRtcInit (
if (!EfiAtRuntime ()) {
EfiAcquireLock (&Global->RtcLock);
}
+
//
// Wait for up to 0.1 seconds for the RTC to be updated
//
Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));
if (EFI_ERROR (Status)) {
if (!EfiAtRuntime ()) {
- EfiReleaseLock (&Global->RtcLock);
+ EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
@@ -391,13 +397,14 @@ PcRtcInit (
if (!EfiAtRuntime ()) {
EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
//
// Inhibit updates of the RTC
//
- RegisterB.Bits.Set = 1;
+ RegisterB.Bits.Set = 1;
RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
//
@@ -419,6 +426,7 @@ PcRtcInit (
if (!EfiAtRuntime ()) {
EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_SUCCESS;
}
@@ -451,24 +459,27 @@ 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
//
Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));
if (EFI_ERROR (Status)) {
- if (!EfiAtRuntime ()) {
- EfiReleaseLock (&Global->RtcLock);
- }
+ if (!EfiAtRuntime ()) {
+ EfiReleaseLock (&Global->RtcLock);
+ }
+
return Status;
}
+
//
// Read Register B
//
@@ -477,12 +488,12 @@ PcRtcGetTime (
//
// Get the Time/Date/Daylight Savings values.
//
- Time->Second = RtcRead (RTC_ADDRESS_SECONDS);
- Time->Minute = RtcRead (RTC_ADDRESS_MINUTES);
- Time->Hour = RtcRead (RTC_ADDRESS_HOURS);
- Time->Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
- Time->Month = RtcRead (RTC_ADDRESS_MONTH);
- Time->Year = RtcRead (RTC_ADDRESS_YEAR);
+ Time->Second = RtcRead (RTC_ADDRESS_SECONDS);
+ Time->Minute = RtcRead (RTC_ADDRESS_MINUTES);
+ Time->Hour = RtcRead (RTC_ADDRESS_HOURS);
+ Time->Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
+ Time->Month = RtcRead (RTC_ADDRESS_MONTH);
+ Time->Year = RtcRead (RTC_ADDRESS_YEAR);
//
// Release RTC Lock.
@@ -494,8 +505,8 @@ PcRtcGetTime (
//
// Get the variable that contains the TimeZone and Daylight fields
//
- Time->TimeZone = Global->SavedTimeZone;
- Time->Daylight = Global->Daylight;
+ Time->TimeZone = Global->SavedTimeZone;
+ Time->Daylight = Global->Daylight;
//
// Make sure all field values are in correct range
@@ -504,6 +515,7 @@ PcRtcGetTime (
if (!EFI_ERROR (Status)) {
Status = RtcTimeFieldsValid (Time);
}
+
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
@@ -539,8 +551,8 @@ PcRtcGetTime (
**/
EFI_STATUS
PcRtcSetTime (
- IN EFI_TIME *Time,
- IN PC_RTC_MODULE_GLOBALS *Global
+ IN EFI_TIME *Time,
+ IN PC_RTC_MODULE_GLOBALS *Global
)
{
EFI_STATUS Status;
@@ -551,6 +563,7 @@ PcRtcSetTime (
if (Time == NULL) {
return EFI_INVALID_PARAMETER;
}
+
//
// Make sure that the time fields are valid
//
@@ -567,14 +580,16 @@ PcRtcSetTime (
if (!EfiAtRuntime ()) {
EfiAcquireLock (&Global->RtcLock);
}
+
//
// Wait for up to 0.1 seconds for the RTC to be updated
//
Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));
if (EFI_ERROR (Status)) {
- if (!EfiAtRuntime ()) {
- EfiReleaseLock (&Global->RtcLock);
- }
+ if (!EfiAtRuntime ()) {
+ EfiReleaseLock (&Global->RtcLock);
+ }
+
return Status;
}
@@ -594,35 +609,36 @@ PcRtcSetTime (
}
} else {
TimerVar = Time->Daylight;
- TimerVar = (UINT32) ((TimerVar << 16) | (UINT16)(Time->TimeZone));
- Status = EfiSetVariable (
- mTimeZoneVariableName,
- &gEfiCallerIdGuid,
- EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
- sizeof (TimerVar),
- &TimerVar
- );
+ TimerVar = (UINT32)((TimerVar << 16) | (UINT16)(Time->TimeZone));
+ Status = EfiSetVariable (
+ mTimeZoneVariableName,
+ &gEfiCallerIdGuid,
+ EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
+ sizeof (TimerVar),
+ &TimerVar
+ );
}
if (EFI_ERROR (Status)) {
if (!EfiAtRuntime ()) {
EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
//
// Read Register B, and inhibit updates of the RTC
//
- RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B);
- RegisterB.Bits.Set = 1;
+ RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B);
+ RegisterB.Bits.Set = 1;
RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
//
// Store the century value to RTC before converting to BCD format.
//
if (Global->CenturyRtcAddress != 0) {
- RtcWrite (Global->CenturyRtcAddress, DecimalToBcd8 ((UINT8) (RtcTime.Year / 100)));
+ RtcWrite (Global->CenturyRtcAddress, DecimalToBcd8 ((UINT8)(RtcTime.Year / 100)));
}
ConvertEfiTimeToRtcTime (&RtcTime, RegisterB);
@@ -632,7 +648,7 @@ PcRtcSetTime (
RtcWrite (RTC_ADDRESS_HOURS, RtcTime.Hour);
RtcWrite (RTC_ADDRESS_DAY_OF_THE_MONTH, RtcTime.Day);
RtcWrite (RTC_ADDRESS_MONTH, RtcTime.Month);
- RtcWrite (RTC_ADDRESS_YEAR, (UINT8) RtcTime.Year);
+ RtcWrite (RTC_ADDRESS_YEAR, (UINT8)RtcTime.Year);
//
// Allow updates of the RTC registers
@@ -646,6 +662,7 @@ PcRtcSetTime (
if (!EfiAtRuntime ()) {
EfiReleaseLock (&Global->RtcLock);
}
+
//
// Set the variable that contains the TimeZone and Daylight fields
//
@@ -690,29 +707,32 @@ 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
//
Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));
if (EFI_ERROR (Status)) {
if (!EfiAtRuntime ()) {
- EfiReleaseLock (&Global->RtcLock);
+ EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
+
//
// Read Register B and Register C
//
- RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B);
- RegisterC.Data = RtcRead (RTC_ADDRESS_REGISTER_C);
+ RegisterB.Data = RtcRead (RTC_ADDRESS_REGISTER_B);
+ RegisterC.Data = RtcRead (RTC_ADDRESS_REGISTER_C);
//
// Get the Time/Date/Daylight Savings values.
@@ -720,12 +740,12 @@ PcRtcGetWakeupTime (
*Enabled = RegisterB.Bits.Aie;
*Pending = RegisterC.Bits.Af;
- Time->Second = RtcRead (RTC_ADDRESS_SECONDS_ALARM);
- Time->Minute = RtcRead (RTC_ADDRESS_MINUTES_ALARM);
- Time->Hour = RtcRead (RTC_ADDRESS_HOURS_ALARM);
- Time->Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
- Time->Month = RtcRead (RTC_ADDRESS_MONTH);
- Time->Year = RtcRead (RTC_ADDRESS_YEAR);
+ Time->Second = RtcRead (RTC_ADDRESS_SECONDS_ALARM);
+ Time->Minute = RtcRead (RTC_ADDRESS_MINUTES_ALARM);
+ Time->Hour = RtcRead (RTC_ADDRESS_HOURS_ALARM);
+ Time->Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
+ Time->Month = RtcRead (RTC_ADDRESS_MONTH);
+ Time->Year = RtcRead (RTC_ADDRESS_YEAR);
Time->TimeZone = Global->SavedTimeZone;
Time->Daylight = Global->Daylight;
@@ -733,13 +753,13 @@ PcRtcGetWakeupTime (
// Get the alarm info from variable
//
DataSize = sizeof (EFI_TIME);
- Status = EfiGetVariable (
- L"RTCALARM",
- &gEfiCallerIdGuid,
- NULL,
- &DataSize,
- &RtcTime
- );
+ Status = EfiGetVariable (
+ L"RTCALARM",
+ &gEfiCallerIdGuid,
+ NULL,
+ &DataSize,
+ &RtcTime
+ );
if (!EFI_ERROR (Status)) {
//
// The alarm variable exists. In this case, we read variable to get info.
@@ -763,6 +783,7 @@ PcRtcGetWakeupTime (
if (!EFI_ERROR (Status)) {
Status = RtcTimeFieldsValid (Time);
}
+
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
@@ -792,18 +813,18 @@ PcRtcSetWakeupTime (
IN PC_RTC_MODULE_GLOBALS *Global
)
{
- EFI_STATUS Status;
- EFI_TIME RtcTime;
- RTC_REGISTER_B RegisterB;
- EFI_TIME_CAPABILITIES Capabilities;
+ EFI_STATUS Status;
+ EFI_TIME RtcTime;
+ RTC_REGISTER_B RegisterB;
+ EFI_TIME_CAPABILITIES Capabilities;
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,31 +841,36 @@ 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
//
Status = RtcWaitToUpdate (PcdGet32 (PcdRealTimeClockUpdateTimeout));
if (EFI_ERROR (Status)) {
if (!EfiAtRuntime ()) {
- EfiReleaseLock (&Global->RtcLock);
+ EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
+
//
// Read Register B
//
@@ -855,12 +882,12 @@ PcRtcSetWakeupTime (
//
// if the alarm is disable, record the current setting.
//
- RtcTime.Second = RtcRead (RTC_ADDRESS_SECONDS_ALARM);
- RtcTime.Minute = RtcRead (RTC_ADDRESS_MINUTES_ALARM);
- RtcTime.Hour = RtcRead (RTC_ADDRESS_HOURS_ALARM);
- RtcTime.Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
- RtcTime.Month = RtcRead (RTC_ADDRESS_MONTH);
- RtcTime.Year = RtcRead (RTC_ADDRESS_YEAR);
+ RtcTime.Second = RtcRead (RTC_ADDRESS_SECONDS_ALARM);
+ RtcTime.Minute = RtcRead (RTC_ADDRESS_MINUTES_ALARM);
+ RtcTime.Hour = RtcRead (RTC_ADDRESS_HOURS_ALARM);
+ RtcTime.Day = RtcRead (RTC_ADDRESS_DAY_OF_THE_MONTH);
+ RtcTime.Month = RtcRead (RTC_ADDRESS_MONTH);
+ RtcTime.Year = RtcRead (RTC_ADDRESS_YEAR);
RtcTime.TimeZone = Global->SavedTimeZone;
RtcTime.Daylight = Global->Daylight;
}
@@ -879,13 +906,14 @@ PcRtcSetWakeupTime (
if (!EfiAtRuntime ()) {
EfiReleaseLock (&Global->RtcLock);
}
+
return EFI_DEVICE_ERROR;
}
//
// Inhibit updates of the RTC
//
- RegisterB.Bits.Set = 1;
+ RegisterB.Bits.Set = 1;
RtcWrite (RTC_ADDRESS_REGISTER_B, RegisterB.Data);
if (Enable) {
@@ -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.
@@ -964,8 +992,8 @@ ConvertRtcTimeToEfiTime (
IN RTC_REGISTER_B RegisterB
)
{
- BOOLEAN IsPM;
- UINT8 Century;
+ BOOLEAN IsPM;
+ UINT8 Century;
if ((Time->Hour & 0x80) != 0) {
IsPM = TRUE;
@@ -973,19 +1001,20 @@ ConvertRtcTimeToEfiTime (
IsPM = FALSE;
}
- Time->Hour = (UINT8) (Time->Hour & 0x7f);
+ Time->Hour = (UINT8)(Time->Hour & 0x7f);
if (RegisterB.Bits.Dm == 0) {
- Time->Year = CheckAndConvertBcd8ToDecimal8 ((UINT8) Time->Year);
- Time->Month = CheckAndConvertBcd8ToDecimal8 (Time->Month);
- Time->Day = CheckAndConvertBcd8ToDecimal8 (Time->Day);
- Time->Hour = CheckAndConvertBcd8ToDecimal8 (Time->Hour);
- Time->Minute = CheckAndConvertBcd8ToDecimal8 (Time->Minute);
- Time->Second = CheckAndConvertBcd8ToDecimal8 (Time->Second);
+ Time->Year = CheckAndConvertBcd8ToDecimal8 ((UINT8)Time->Year);
+ Time->Month = CheckAndConvertBcd8ToDecimal8 (Time->Month);
+ Time->Day = CheckAndConvertBcd8ToDecimal8 (Time->Day);
+ Time->Hour = CheckAndConvertBcd8ToDecimal8 (Time->Hour);
+ Time->Minute = CheckAndConvertBcd8ToDecimal8 (Time->Minute);
+ 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;
}
@@ -994,26 +1023,27 @@ ConvertRtcTimeToEfiTime (
// Century is 19 if RTC year >= 70,
// Century is 20 otherwise.
//
- Century = (UINT8) (PcdGet16 (PcdMinimalValidYear) / 100);
+ Century = (UINT8)(PcdGet16 (PcdMinimalValidYear) / 100);
if (Time->Year < PcdGet16 (PcdMinimalValidYear) % 100) {
Century++;
}
- Time->Year = (UINT16) (Century * 100 + Time->Year);
+
+ 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) {
- Time->Hour = (UINT8) (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;
}
}
- Time->Nanosecond = 0;
+ Time->Nanosecond = 0;
return EFI_SUCCESS;
}
@@ -1028,7 +1058,7 @@ ConvertRtcTimeToEfiTime (
**/
EFI_STATUS
RtcWaitToUpdate (
- UINTN Timeout
+ UINTN Timeout
)
{
RTC_REGISTER_A RegisterA;
@@ -1042,11 +1072,12 @@ RtcWaitToUpdate (
if (RegisterD.Bits.Vrt == 0) {
return EFI_DEVICE_ERROR;
}
+
//
// Wait for up to 0.1 seconds for the RTC to be ready.
//
- Timeout = (Timeout / 10) + 1;
- RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A);
+ Timeout = (Timeout / 10) + 1;
+ RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A);
while (RegisterA.Bits.Uip == 1 && Timeout > 0) {
MicroSecondDelay (10);
RegisterA.Data = RtcRead (RTC_ADDRESS_REGISTER_A);
@@ -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;
}
@@ -1072,20 +1103,21 @@ RtcWaitToUpdate (
**/
EFI_STATUS
RtcTimeFieldsValid (
- IN EFI_TIME *Time
+ 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;
}
@@ -1108,12 +1140,13 @@ DayValid (
//
// The validity of Time->Month field should be checked before
//
- 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))
- ) {
+ 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)))
+ )
+ {
return FALSE;
}
@@ -1130,7 +1163,7 @@ DayValid (
**/
BOOLEAN
IsLeapYear (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
{
if (Time->Year % 4 == 0) {
@@ -1165,7 +1198,7 @@ ConvertEfiTimeToRtcTime (
IN RTC_REGISTER_B RegisterB
)
{
- BOOLEAN IsPM;
+ BOOLEAN IsPM;
IsPM = TRUE;
//
@@ -1177,29 +1210,31 @@ ConvertEfiTimeToRtcTime (
}
if (Time->Hour >= 13) {
- Time->Hour = (UINT8) (Time->Hour - 12);
+ Time->Hour = (UINT8)(Time->Hour - 12);
} else if (Time->Hour == 0) {
Time->Hour = 12;
}
}
+
//
// Set the Time/Date values.
//
- Time->Year = (UINT16) (Time->Year % 100);
+ Time->Year = (UINT16)(Time->Year % 100);
if (RegisterB.Bits.Dm == 0) {
- Time->Year = DecimalToBcd8 ((UINT8) Time->Year);
- Time->Month = DecimalToBcd8 (Time->Month);
- Time->Day = DecimalToBcd8 (Time->Day);
- Time->Hour = DecimalToBcd8 (Time->Hour);
- Time->Minute = DecimalToBcd8 (Time->Minute);
- Time->Second = DecimalToBcd8 (Time->Second);
+ Time->Year = DecimalToBcd8 ((UINT8)Time->Year);
+ Time->Month = DecimalToBcd8 (Time->Month);
+ Time->Day = DecimalToBcd8 (Time->Day);
+ Time->Hour = DecimalToBcd8 (Time->Hour);
+ 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) {
- Time->Hour = (UINT8) (Time->Hour | 0x80);
+ if ((RegisterB.Bits.Mil == 0) && IsPM) {
+ Time->Hour = (UINT8)(Time->Hour | 0x80);
}
}
@@ -1217,13 +1252,14 @@ ConvertEfiTimeToRtcTime (
**/
INTN
CompareHMS (
- IN EFI_TIME *From,
- IN EFI_TIME *To
+ IN EFI_TIME *From,
+ IN EFI_TIME *To
)
{
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->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;
@@ -1247,37 +1283,37 @@ IsWithinOneDay (
IN EFI_TIME *To
)
{
- BOOLEAN Adjacent;
+ BOOLEAN Adjacent;
Adjacent = FALSE;
//
// The validity of From->Month field should be checked before
//
- ASSERT (From->Month >=1);
- ASSERT (From->Month <=12);
+ ASSERT (From->Month >= 1);
+ ASSERT (From->Month <= 12);
if (From->Year == To->Year) {
if (From->Month == To->Month) {
if ((From->Day + 1) == To->Day) {
- if ((CompareHMS(From, To) >= 0)) {
+ if ((CompareHMS (From, To) >= 0)) {
Adjacent = TRUE;
}
} else if (From->Day == To->Day) {
- if ((CompareHMS(From, To) <= 0)) {
+ if ((CompareHMS (From, To) <= 0)) {
Adjacent = TRUE;
}
}
} else if (((From->Month + 1) == To->Month) && (To->Day == 1)) {
- if ((From->Month == 2) && !IsLeapYear(From)) {
+ if ((From->Month == 2) && !IsLeapYear (From)) {
if (From->Day == 28) {
- if ((CompareHMS(From, To) >= 0)) {
+ if ((CompareHMS (From, To) >= 0)) {
Adjacent = TRUE;
}
}
} else if (From->Day == mDayOfMonth[From->Month - 1]) {
- if ((CompareHMS(From, To) >= 0)) {
- Adjacent = TRUE;
+ if ((CompareHMS (From, To) >= 0)) {
+ Adjacent = TRUE;
}
}
}
@@ -1285,8 +1321,9 @@ IsWithinOneDay (
(From->Month == 12) &&
(From->Day == 31) &&
(To->Month == 1) &&
- (To->Day == 1)) {
- if ((CompareHMS(From, To) >= 0)) {
+ (To->Day == 1))
+ {
+ if ((CompareHMS (From, To) >= 0)) {
Adjacent = TRUE;
}
}
@@ -1304,15 +1341,16 @@ GetCenturyRtcAddress (
VOID
)
{
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *Fadt;
- Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *) EfiLocateFirstAcpiTable (
- EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
- );
+ Fadt = (EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE *)EfiLocateFirstAcpiTable (
+ EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE
+ );
if ((Fadt != NULL) &&
(Fadt->Century > RTC_ADDRESS_REGISTER_D) && (Fadt->Century < 0x80)
- ) {
+ )
+ {
return Fadt->Century;
} else {
return 0;
@@ -1332,21 +1370,21 @@ GetCenturyRtcAddress (
VOID
EFIAPI
PcRtcAcpiTableChangeCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- EFI_TIME Time;
- UINT8 CenturyRtcAddress;
- UINT8 Century;
+ 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)) {
- Century = (UINT8) (Time.Year / 100);
+ Century = (UINT8)(Time.Year / 100);
Century = DecimalToBcd8 (Century);
DEBUG ((DEBUG_INFO, "PcRtc: Write 0x%x to CMOS location 0x%x\n", Century, mModuleGlobal.CenturyRtcAddress));
RtcWrite (mModuleGlobal.CenturyRtcAddress, Century);
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
index d5fe17965c..7e0e98fbcc 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.h
@@ -8,11 +8,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
**/
-
#ifndef _RTC_H_
#define _RTC_H_
-
#include <Uefi.h>
#include <Guid/Acpi.h>
@@ -33,10 +31,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/ReportStatusCodeLib.h>
typedef struct {
- EFI_LOCK RtcLock;
- INT16 SavedTimeZone;
- UINT8 Daylight;
- UINT8 CenturyRtcAddress;
+ EFI_LOCK RtcLock;
+ INT16 SavedTimeZone;
+ UINT8 Daylight;
+ UINT8 CenturyRtcAddress;
} PC_RTC_MODULE_GLOBALS;
extern PC_RTC_MODULE_GLOBALS mModuleGlobal;
@@ -62,73 +60,73 @@ extern PC_RTC_MODULE_GLOBALS mModuleGlobal;
// Date and time initial values.
// They are used if the RTC values are invalid during driver initialization
//
-#define RTC_INIT_SECOND 0
-#define RTC_INIT_MINUTE 0
-#define RTC_INIT_HOUR 0
-#define RTC_INIT_DAY 1
-#define RTC_INIT_MONTH 1
+#define RTC_INIT_SECOND 0
+#define RTC_INIT_MINUTE 0
+#define RTC_INIT_HOUR 0
+#define RTC_INIT_DAY 1
+#define RTC_INIT_MONTH 1
#pragma pack(1)
//
// Register A
//
typedef struct {
- UINT8 Rs : 4; // Rate Selection Bits
- UINT8 Dv : 3; // Divisor
- UINT8 Uip : 1; // Update in progress
+ UINT8 Rs : 4; // Rate Selection Bits
+ UINT8 Dv : 3; // Divisor
+ UINT8 Uip : 1; // Update in progress
} RTC_REGISTER_A_BITS;
typedef union {
- RTC_REGISTER_A_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_A_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_A;
//
// Register B
//
typedef struct {
- UINT8 Dse : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled
- UINT8 Mil : 1; // 0 - 12 hour mode 1 - 24 hour mode
- UINT8 Dm : 1; // 0 - BCD Format 1 - Binary Format
- UINT8 Sqwe : 1; // 0 - Disable SQWE output 1 - Enable SQWE output
- UINT8 Uie : 1; // 0 - Update INT disabled 1 - Update INT enabled
- UINT8 Aie : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled
- UINT8 Pie : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled
- UINT8 Set : 1; // 0 - Normal operation. 1 - Updates inhibited
+ UINT8 Dse : 1; // 0 - Daylight saving disabled 1 - Daylight savings enabled
+ UINT8 Mil : 1; // 0 - 12 hour mode 1 - 24 hour mode
+ UINT8 Dm : 1; // 0 - BCD Format 1 - Binary Format
+ UINT8 Sqwe : 1; // 0 - Disable SQWE output 1 - Enable SQWE output
+ UINT8 Uie : 1; // 0 - Update INT disabled 1 - Update INT enabled
+ UINT8 Aie : 1; // 0 - Alarm INT disabled 1 - Alarm INT Enabled
+ UINT8 Pie : 1; // 0 - Periodic INT disabled 1 - Periodic INT Enabled
+ UINT8 Set : 1; // 0 - Normal operation. 1 - Updates inhibited
} RTC_REGISTER_B_BITS;
typedef union {
- RTC_REGISTER_B_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_B_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_B;
//
// Register C
//
typedef struct {
- UINT8 Reserved : 4; // Read as zero. Can not be written.
- UINT8 Uf : 1; // Update End Interrupt Flag
- UINT8 Af : 1; // Alarm Interrupt Flag
- UINT8 Pf : 1; // Periodic Interrupt Flag
- UINT8 Irqf : 1; // Interrupt Request Flag = PF & PIE | AF & AIE | UF & UIE
+ UINT8 Reserved : 4; // Read as zero. Can not be written.
+ UINT8 Uf : 1; // Update End Interrupt Flag
+ UINT8 Af : 1; // Alarm Interrupt Flag
+ UINT8 Pf : 1; // Periodic Interrupt Flag
+ UINT8 Irqf : 1; // Interrupt Request Flag = PF & PIE | AF & AIE | UF & UIE
} RTC_REGISTER_C_BITS;
typedef union {
- RTC_REGISTER_C_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_C_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_C;
//
// Register D
//
typedef struct {
- UINT8 Reserved : 7; // Read as zero. Can not be written.
- UINT8 Vrt : 1; // Valid RAM and Time
+ UINT8 Reserved : 7; // Read as zero. Can not be written.
+ UINT8 Vrt : 1; // Valid RAM and Time
} RTC_REGISTER_D_BITS;
typedef union {
- RTC_REGISTER_D_BITS Bits;
- UINT8 Data;
+ RTC_REGISTER_D_BITS Bits;
+ UINT8 Data;
} RTC_REGISTER_D;
#pragma pack()
@@ -180,9 +178,9 @@ PcRtcSetTime (
**/
EFI_STATUS
PcRtcGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL,
- IN PC_RTC_MODULE_GLOBALS *Global
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL,
+ IN PC_RTC_MODULE_GLOBALS *Global
);
/**
@@ -225,10 +223,10 @@ PcRtcSetWakeupTime (
**/
EFI_STATUS
PcRtcGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time,
- IN PC_RTC_MODULE_GLOBALS *Global
+ OUT BOOLEAN *Enabled,
+ OUT BOOLEAN *Pending,
+ OUT EFI_TIME *Time,
+ IN PC_RTC_MODULE_GLOBALS *Global
);
/**
@@ -247,8 +245,8 @@ PcRtcGetWakeupTime (
EFI_STATUS
EFIAPI
InitializePcRtc (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
);
/**
@@ -262,7 +260,7 @@ InitializePcRtc (
**/
EFI_STATUS
RtcTimeFieldsValid (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
);
/**
@@ -282,7 +280,6 @@ ConvertEfiTimeToRtcTime (
IN RTC_REGISTER_B RegisterB
);
-
/**
Converts time read from RTC to EFI_TIME format defined by UEFI spec.
@@ -316,7 +313,7 @@ ConvertRtcTimeToEfiTime (
**/
EFI_STATUS
RtcWaitToUpdate (
- UINTN Timeout
+ UINTN Timeout
);
/**
@@ -342,7 +339,7 @@ DayValid (
**/
BOOLEAN
IsLeapYear (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
);
/**
@@ -368,7 +365,8 @@ GetCenturyRtcAddress (
VOID
EFIAPI
PcRtcAcpiTableChangeCallback (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
);
+
#endif
diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
index 606b88adaf..e6e9458d75 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtcEntry.c
@@ -12,12 +12,12 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
PC_RTC_MODULE_GLOBALS mModuleGlobal;
-EFI_HANDLE mHandle = NULL;
+EFI_HANDLE mHandle = NULL;
-STATIC EFI_EVENT mVirtualAddrChangeEvent;
+STATIC EFI_EVENT mVirtualAddrChangeEvent;
-UINTN mRtcIndexRegister;
-UINTN mRtcTargetRegister;
+UINTN mRtcIndexRegister;
+UINTN mRtcTargetRegister;
/**
Returns the current time and date information, and the time-keeping capabilities
@@ -35,8 +35,8 @@ UINTN mRtcTargetRegister;
EFI_STATUS
EFIAPI
PcRtcEfiGetTime (
- OUT EFI_TIME *Time,
- OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
+ OUT EFI_TIME *Time,
+ OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
)
{
return PcRtcGetTime (Time, Capabilities, &mModuleGlobal);
@@ -55,7 +55,7 @@ PcRtcEfiGetTime (
EFI_STATUS
EFIAPI
PcRtcEfiSetTime (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
{
return PcRtcSetTime (Time, &mModuleGlobal);
@@ -79,15 +79,14 @@ PcRtcEfiSetTime (
EFI_STATUS
EFIAPI
PcRtcEfiGetWakeupTime (
- OUT BOOLEAN *Enabled,
- OUT BOOLEAN *Pending,
- OUT EFI_TIME *Time
+ OUT BOOLEAN *Enabled,
+ OUT BOOLEAN *Pending,
+ OUT EFI_TIME *Time
)
{
return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal);
}
-
/**
Sets the system wakeup alarm clock time.
@@ -105,8 +104,8 @@ PcRtcEfiGetWakeupTime (
EFI_STATUS
EFIAPI
PcRtcEfiSetWakeupTime (
- IN BOOLEAN Enabled,
- IN EFI_TIME *Time OPTIONAL
+ IN BOOLEAN Enabled,
+ IN EFI_TIME *Time OPTIONAL
)
{
return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal);
@@ -123,8 +122,8 @@ PcRtcEfiSetWakeupTime (
VOID
EFIAPI
LibRtcVirtualNotifyEvent (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
// Only needed if you are going to support the OS calling RTC functions in
@@ -132,8 +131,8 @@ LibRtcVirtualNotifyEvent (
// stored physical addresses to virtual address. After the OS transitions to
// calling in virtual mode, all future runtime calls will be made in virtual
// mode.
- EfiConvertPointer (0x0, (VOID**)&mRtcIndexRegister);
- EfiConvertPointer (0x0, (VOID**)&mRtcTargetRegister);
+ EfiConvertPointer (0x0, (VOID **)&mRtcIndexRegister);
+ EfiConvertPointer (0x0, (VOID **)&mRtcTargetRegister);
}
/**
@@ -152,8 +151,8 @@ LibRtcVirtualNotifyEvent (
EFI_STATUS
EFIAPI
InitializePcRtc (
- IN EFI_HANDLE ImageHandle,
- IN EFI_SYSTEM_TABLE *SystemTable
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
)
{
EFI_STATUS Status;
@@ -163,7 +162,7 @@ InitializePcRtc (
mModuleGlobal.CenturyRtcAddress = GetCenturyRtcAddress ();
if (FeaturePcdGet (PcdRtcUseMmio)) {
- mRtcIndexRegister = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
+ mRtcIndexRegister = (UINTN)PcdGet64 (PcdRtcIndexRegister64);
mRtcTargetRegister = (UINTN)PcdGet64 (PcdRtcTargetRegister64);
}