From 269c0ba2d5d445424e7a039a0a34b3181d6e467f Mon Sep 17 00:00:00 2001 From: qhuang8 Date: Tue, 3 Feb 2009 00:58:26 +0000 Subject: [PATCH] Clean up PcRtc: 1. Remove the architecture subdirectory (IPF architecture is not supported any more 2. Merge IA32 source with x64 source to ResetEntry.c in the upper level directory) 3. Pass CYGWIN GCC tool chain. 4. Remove the used DXS file git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7412 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/PcRtc/Ia32/RealTimeClock.c | 170 ---------------- DuetPkg/PcRtc/Ia32RealTimeClock.dxs | 29 --- DuetPkg/PcRtc/Ipf/IpfPcRtc.c | 185 ------------------ DuetPkg/PcRtc/IpfRealTimeClock.dxs | 28 --- DuetPkg/PcRtc/RealTimeClock.c | 8 +- DuetPkg/PcRtc/RealTimeClock.inf | 9 +- .../RealTimeClock.c => RealTimeClockEntry.c} | 6 +- DuetPkg/PcRtc/X64RealTimeClock.dxs | 29 --- 8 files changed, 6 insertions(+), 458 deletions(-) delete mode 100644 DuetPkg/PcRtc/Ia32/RealTimeClock.c delete mode 100644 DuetPkg/PcRtc/Ia32RealTimeClock.dxs delete mode 100644 DuetPkg/PcRtc/Ipf/IpfPcRtc.c delete mode 100644 DuetPkg/PcRtc/IpfRealTimeClock.dxs rename DuetPkg/PcRtc/{X64/RealTimeClock.c => RealTimeClockEntry.c} (92%) delete mode 100644 DuetPkg/PcRtc/X64RealTimeClock.dxs diff --git a/DuetPkg/PcRtc/Ia32/RealTimeClock.c b/DuetPkg/PcRtc/Ia32/RealTimeClock.c deleted file mode 100644 index 0a43ab667d..0000000000 --- a/DuetPkg/PcRtc/Ia32/RealTimeClock.c +++ /dev/null @@ -1,170 +0,0 @@ -/*++ - -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - Ia32PcRtc.c - -Abstract: - ---*/ -#include "RealTimeClock.h" - -PC_RTC_MODULE_GLOBALS mModuleGlobal; - -EFI_STATUS -EFIAPI -PcRtcEfiGetTime ( - OUT EFI_TIME *Time, - OUT EFI_TIME_CAPABILITIES *Capabilities - ) -/*++ - -Routine Description: - - TODO: Add function description - -Arguments: - - Time - TODO: add argument description - Capabilities - TODO: add argument description - -Returns: - - TODO: add return values - ---*/ -{ - return PcRtcGetTime (Time, Capabilities, &mModuleGlobal); -} - -EFI_STATUS -EFIAPI -PcRtcEfiSetTime ( - IN EFI_TIME *Time - ) -/*++ - -Routine Description: - - TODO: Add function description - -Arguments: - - Time - TODO: add argument description - -Returns: - - TODO: add return values - ---*/ -{ - return PcRtcSetTime (Time, &mModuleGlobal); -} - -EFI_STATUS -EFIAPI -PcRtcEfiGetWakeupTime ( - OUT BOOLEAN *Enabled, - OUT BOOLEAN *Pending, - OUT EFI_TIME *Time - ) -/*++ - -Routine Description: - - TODO: Add function description - -Arguments: - - Enabled - TODO: add argument description - Pending - TODO: add argument description - Time - TODO: add argument description - -Returns: - - TODO: add return values - ---*/ -{ - return PcRtcGetWakeupTime (Enabled, Pending, Time, &mModuleGlobal); -} - -EFI_STATUS -EFIAPI -PcRtcEfiSetWakeupTime ( - IN BOOLEAN Enabled, - OUT EFI_TIME *Time - ) -/*++ - -Routine Description: - - TODO: Add function description - -Arguments: - - Enabled - TODO: add argument description - Time - TODO: add argument description - -Returns: - - TODO: add return values - ---*/ -{ - return PcRtcSetWakeupTime (Enabled, Time, &mModuleGlobal); -} - -EFI_STATUS -EFIAPI -InitializeRealTimeClock ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - - Arguments: - - - -Returns: ---*/ -// TODO: ImageHandle - add argument and description to function comment -// TODO: SystemTable - add argument and description to function comment -{ - EFI_STATUS Status; - EFI_HANDLE NewHandle; - - - EfiInitializeLock (&mModuleGlobal.RtcLock, TPL_HIGH_LEVEL); - - Status = PcRtcInit (&mModuleGlobal); - if (EFI_ERROR (Status)) { - return Status; - } - - SystemTable->RuntimeServices->GetTime = PcRtcEfiGetTime; - SystemTable->RuntimeServices->SetTime = PcRtcEfiSetTime; - SystemTable->RuntimeServices->GetWakeupTime = PcRtcEfiGetWakeupTime; - SystemTable->RuntimeServices->SetWakeupTime = PcRtcEfiSetWakeupTime; - - NewHandle = NULL; - Status = gBS->InstallMultipleProtocolInterfaces ( - &NewHandle, - &gEfiRealTimeClockArchProtocolGuid, - NULL, - NULL - ); - - return Status; -} diff --git a/DuetPkg/PcRtc/Ia32RealTimeClock.dxs b/DuetPkg/PcRtc/Ia32RealTimeClock.dxs deleted file mode 100644 index ff9f52fb7a..0000000000 --- a/DuetPkg/PcRtc/Ia32RealTimeClock.dxs +++ /dev/null @@ -1,29 +0,0 @@ -/*++ - -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - Ia32PcRtc.dxs - -Abstract: - Dependency expression source file. - ---*/ - - -#include "EfiDepex.h" - -#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu) -#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome) -#include EFI_PROTOCOL_DEFINITION (CpuIo) - -DEPENDENCY_START - EFI_CPU_ARCH_PROTOCOL_GUID AND EFI_METRONOME_ARCH_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID -DEPENDENCY_END diff --git a/DuetPkg/PcRtc/Ipf/IpfPcRtc.c b/DuetPkg/PcRtc/Ipf/IpfPcRtc.c deleted file mode 100644 index 7b4064326a..0000000000 --- a/DuetPkg/PcRtc/Ipf/IpfPcRtc.c +++ /dev/null @@ -1,185 +0,0 @@ -/*++ - -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - IpfPcRtc.c - -Abstract: - Register the extended SAL infrastructure. - - Make the EFI RT APIs call extended SAL calls via the RT lib wrappers. - We can not do this on IA-32 as RT lib wrappers call via rRT. - ---*/ - -#include "RealTimeClock.h" - -// -// Don't use directly after virtual address have been registered. -// -PC_RTC_MODULE_GLOBALS mModuleGlobal; - -SAL_RETURN_REGS -PcRtcEsalServicesClassCommonEntry ( - IN UINT64 FunctionId, - IN UINT64 Arg2, - IN UINT64 Arg3, - IN UINT64 Arg4, - IN UINT64 Arg5, - IN UINT64 Arg6, - IN UINT64 Arg7, - IN UINT64 Arg8, - IN SAL_EXTENDED_SAL_PROC ExtendedSalProc, - IN BOOLEAN VirtualMode, - IN PC_RTC_MODULE_GLOBALS *Global - ) -/*++ - -Routine Description: - - Main entry for Extended SAL Reset Services - -Arguments: - - FunctionId Function Id which needed to be called. - Arg2 EFI_RESET_TYPE, whether WARM of COLD reset - Arg3 Last EFI_STATUS - Arg4 Data Size of UNICODE STRING passed in ARG5 - Arg5 Unicode String which CHAR16* - -Returns: - - SAL_RETURN_REGS - ---*/ -// TODO: Arg6 - add argument and description to function comment -// TODO: Arg7 - add argument and description to function comment -// TODO: Arg8 - add argument and description to function comment -// TODO: ExtendedSalProc - add argument and description to function comment -// TODO: VirtualMode - add argument and description to function comment -// TODO: Global - add argument and description to function comment -{ - EFI_STATUS EfiStatus; - SAL_RETURN_REGS ReturnVal; - - switch (FunctionId) { - case GetTime: - EfiStatus = PcRtcGetTime ((EFI_TIME *) Arg2, (EFI_TIME_CAPABILITIES *) Arg3, Global); - break; - - case SetTime: - EfiStatus = PcRtcSetTime ((EFI_TIME *) Arg2, Global); - break; - - case GetWakeupTime: - EfiStatus = PcRtcGetWakeupTime ((BOOLEAN *) Arg2, (BOOLEAN *) Arg3, (EFI_TIME *) Arg4, Global); - break; - - case SetWakeupTime: - EfiStatus = PcRtcSetWakeupTime ((BOOLEAN) Arg2, (EFI_TIME *) Arg3, Global); - break; - - case InitializeThreshold: - EfiStatus = EFI_SAL_NOT_IMPLEMENTED; - break; - - case BumpThresholdCount: - EfiStatus = EFI_SAL_NOT_IMPLEMENTED; - break; - - case GetThresholdCount: - EfiStatus = EFI_SAL_NOT_IMPLEMENTED; - break; - - case GetRtcFreq: - EfiStatus = EFI_SAL_NOT_IMPLEMENTED; - break; - - default: - EfiStatus = EFI_SAL_INVALID_ARGUMENT; - break;; - } - - ReturnVal.Status = EfiStatus; - return ReturnVal; -} - -EFI_STATUS -EFIAPI -InitializePcRtc ( - IN EFI_HANDLE ImageHandle, - IN EFI_SYSTEM_TABLE *SystemTable - ) -/*++ - -Routine Description: - - Arguments: - - - -Returns: ---*/ -// TODO: ImageHandle - add argument and description to function comment -// TODO: SystemTable - add argument and description to function comment -// TODO: EFI_SUCCESS - add return value to function comment -{ - EFI_TIME Time; - EFI_TIME_CAPABILITIES Capabilities; - EFI_STATUS EfiStatus; - - EfiInitializeRuntimeDriverLib (ImageHandle, SystemTable, NULL); - - EfiInitializeLock (&mModuleGlobal.RtcLock, EFI_TPL_HIGH_LEVEL); - - EfiStatus = PcRtcInit (&mModuleGlobal); - if (EFI_ERROR (EfiStatus)) { - return EfiStatus; - } - - RegisterEsalClass ( - &gEfiExtendedSalRtcServicesProtocolGuid, - &mModuleGlobal, - PcRtcEsalServicesClassCommonEntry, - GetTime, - PcRtcEsalServicesClassCommonEntry, - SetTime, - PcRtcEsalServicesClassCommonEntry, - GetWakeupTime, - PcRtcEsalServicesClassCommonEntry, - SetWakeupTime, - PcRtcEsalServicesClassCommonEntry, - GetRtcFreq, - PcRtcEsalServicesClassCommonEntry, - InitializeThreshold, - PcRtcEsalServicesClassCommonEntry, - BumpThresholdCount, - PcRtcEsalServicesClassCommonEntry, - GetThresholdCount, - NULL - ); - // - // the following code is to initialize the RTC fields in case the values read - // back from CMOS are invalid at the first time. - // - EfiStatus = PcRtcGetTime (&Time, &Capabilities, &mModuleGlobal); - if (EFI_ERROR (EfiStatus)) { - 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 = RTC_INIT_YEAR; - PcRtcSetTime (&Time, &mModuleGlobal); - } - - return EFI_SUCCESS; -} diff --git a/DuetPkg/PcRtc/IpfRealTimeClock.dxs b/DuetPkg/PcRtc/IpfRealTimeClock.dxs deleted file mode 100644 index 4d05b4f8a3..0000000000 --- a/DuetPkg/PcRtc/IpfRealTimeClock.dxs +++ /dev/null @@ -1,28 +0,0 @@ -/*++ - -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - IpfPcRtc.dxs - -Abstract: - Dependency expression source file. - ---*/ - - -#include "EfiDepex.h" - -#include EFI_PROTOCOL_DEFINITION (ExtendedSalGuid) -#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome) - -DEPENDENCY_START - EFI_EXTENDED_SAL_BASE_IO_SERVICES_PROTOCOL_GUID AND EFI_METRONOME_ARCH_PROTOCOL_GUID -DEPENDENCY_END diff --git a/DuetPkg/PcRtc/RealTimeClock.c b/DuetPkg/PcRtc/RealTimeClock.c index d3c5f31c4d..6666d48a37 100644 --- a/DuetPkg/PcRtc/RealTimeClock.c +++ b/DuetPkg/PcRtc/RealTimeClock.c @@ -41,6 +41,8 @@ CompareHMS ( IN EFI_TIME *From, IN EFI_TIME *To ); + +INTN mDayOfMonth[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; UINT8 RtcRead ( @@ -873,10 +875,9 @@ Returns: --*/ { - INTN DayOfMonth[12] = { 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; if (Time->Day < 1 || - Time->Day > DayOfMonth[Time->Month - 1] || + Time->Day > mDayOfMonth[Time->Month - 1] || (Time->Month == 2 && (!IsLeapYear (Time) && Time->Day > 28)) ) { return FALSE; @@ -1002,7 +1003,6 @@ Returns: --*/ { - UINT8 DayOfMonth[12] = {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; BOOLEAN Adjacent = FALSE; if (From->Year == To->Year) { @@ -1023,7 +1023,7 @@ Returns: Adjacent = TRUE; } } - } else if (From->Day == DayOfMonth[From->Month - 1]) { + } else if (From->Day == mDayOfMonth[From->Month - 1]) { if ((CompareHMS(From, To) >= 0)) { Adjacent = TRUE; } diff --git a/DuetPkg/PcRtc/RealTimeClock.inf b/DuetPkg/PcRtc/RealTimeClock.inf index d02ae7642c..e854f1c8cf 100644 --- a/DuetPkg/PcRtc/RealTimeClock.inf +++ b/DuetPkg/PcRtc/RealTimeClock.inf @@ -43,15 +43,8 @@ [Sources.common] RealTimeClock.c RealTimeClock.h + RealTimeClockEntry.c -[Sources.ia32] - Ia32/RealTimeClock.c - -[Sources.x64] - X64/RealTimeClock.c - -[Sources.ipf] - Ipf/RealTimeClock.c [Protocols] gEfiCpuArchProtocolGuid diff --git a/DuetPkg/PcRtc/X64/RealTimeClock.c b/DuetPkg/PcRtc/RealTimeClockEntry.c similarity index 92% rename from DuetPkg/PcRtc/X64/RealTimeClock.c rename to DuetPkg/PcRtc/RealTimeClockEntry.c index 63abe0b7d0..7c5354835c 100644 --- a/DuetPkg/PcRtc/X64/RealTimeClock.c +++ b/DuetPkg/PcRtc/RealTimeClockEntry.c @@ -1,6 +1,6 @@ /*++ -Copyright (c) 2005, Intel Corporation +Copyright (c) 2009, Intel Corporation All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -9,10 +9,6 @@ http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -Module Name: - x64PcRtc.c - -Abstract: --*/ diff --git a/DuetPkg/PcRtc/X64RealTimeClock.dxs b/DuetPkg/PcRtc/X64RealTimeClock.dxs deleted file mode 100644 index 3497da0635..0000000000 --- a/DuetPkg/PcRtc/X64RealTimeClock.dxs +++ /dev/null @@ -1,29 +0,0 @@ -/*++ - -Copyright (c) 2005, Intel Corporation -All rights reserved. This program and the accompanying materials -are licensed and made available under the terms and conditions of the BSD License -which accompanies this distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -Module Name: - x64PcRtc.dxs - -Abstract: - Dependency expression source file. - ---*/ - - -#include "EfiDepex.h" - -#include EFI_ARCH_PROTOCOL_DEFINITION (Cpu) -#include EFI_ARCH_PROTOCOL_DEFINITION (Metronome) -#include EFI_PROTOCOL_DEFINITION (CpuIo) - -DEPENDENCY_START - EFI_CPU_ARCH_PROTOCOL_GUID AND EFI_METRONOME_ARCH_PROTOCOL_GUID AND EFI_CPU_IO_PROTOCOL_GUID -DEPENDENCY_END