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
This commit is contained in:
qhuang8 2009-02-03 00:58:26 +00:00
parent abae655fd2
commit 269c0ba2d5
8 changed files with 6 additions and 458 deletions

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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;
}

View File

@ -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

View File

@ -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:
--*/

View File

@ -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