mirror of https://github.com/acidanthera/audk.git
1. Enhance the RTC driver to not reserve the CMOS century register MSB.
2. Replace BcdToDecimal with library BcdToDecimal8 and remove it's definition. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8477 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
a47b308ad4
commit
aa4d03f7fb
|
@ -212,11 +212,7 @@ Returns:
|
||||||
|
|
||||||
ConvertRtcTimeToEfiTime (&Time, RegisterB);
|
ConvertRtcTimeToEfiTime (&Time, RegisterB);
|
||||||
|
|
||||||
if (RtcTestCenturyRegister () == EFI_SUCCESS) {
|
Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY));
|
||||||
Century = BcdToDecimal ((UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f));
|
|
||||||
} else {
|
|
||||||
Century = BcdToDecimal (RtcRead (RTC_ADDRESS_CENTURY));
|
|
||||||
}
|
|
||||||
|
|
||||||
Time.Year = (UINT16) (Century * 100 + Time.Year);
|
Time.Year = (UINT16) (Century * 100 + Time.Year);
|
||||||
|
|
||||||
|
@ -313,11 +309,7 @@ Routine Description:
|
||||||
|
|
||||||
ConvertRtcTimeToEfiTime (Time, RegisterB);
|
ConvertRtcTimeToEfiTime (Time, RegisterB);
|
||||||
|
|
||||||
if (RtcTestCenturyRegister () == EFI_SUCCESS) {
|
Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY));
|
||||||
Century = BcdToDecimal ((UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f));
|
|
||||||
} else {
|
|
||||||
Century = BcdToDecimal (RtcRead (RTC_ADDRESS_CENTURY));
|
|
||||||
}
|
|
||||||
|
|
||||||
Time->Year = (UINT16) (Century * 100 + Time->Year);
|
Time->Year = (UINT16) (Century * 100 + Time->Year);
|
||||||
|
|
||||||
|
@ -422,10 +414,6 @@ Routine Description:
|
||||||
RtcWrite (RTC_ADDRESS_DAY_OF_THE_MONTH, RtcTime.Day);
|
RtcWrite (RTC_ADDRESS_DAY_OF_THE_MONTH, RtcTime.Day);
|
||||||
RtcWrite (RTC_ADDRESS_MONTH, RtcTime.Month);
|
RtcWrite (RTC_ADDRESS_MONTH, RtcTime.Month);
|
||||||
RtcWrite (RTC_ADDRESS_YEAR, (UINT8) RtcTime.Year);
|
RtcWrite (RTC_ADDRESS_YEAR, (UINT8) RtcTime.Year);
|
||||||
if (RtcTestCenturyRegister () == EFI_SUCCESS) {
|
|
||||||
Century = (UINT8) ((Century & 0x7f) | (RtcRead (RTC_ADDRESS_CENTURY) & 0x80));
|
|
||||||
}
|
|
||||||
|
|
||||||
RtcWrite (RTC_ADDRESS_CENTURY, Century);
|
RtcWrite (RTC_ADDRESS_CENTURY, Century);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -527,11 +515,7 @@ Returns:
|
||||||
|
|
||||||
ConvertRtcTimeToEfiTime (Time, RegisterB);
|
ConvertRtcTimeToEfiTime (Time, RegisterB);
|
||||||
|
|
||||||
if (RtcTestCenturyRegister () == EFI_SUCCESS) {
|
Century = BcdToDecimal8 (RtcRead (RTC_ADDRESS_CENTURY));
|
||||||
Century = BcdToDecimal ((UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f));
|
|
||||||
} else {
|
|
||||||
Century = BcdToDecimal (RtcRead (RTC_ADDRESS_CENTURY));
|
|
||||||
}
|
|
||||||
|
|
||||||
Time->Year = (UINT16) (Century * 100 + Time->Year);
|
Time->Year = (UINT16) (Century * 100 + Time->Year);
|
||||||
|
|
||||||
|
@ -660,64 +644,6 @@ Returns:
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
UINT8
|
|
||||||
BcdToDecimal (
|
|
||||||
IN UINT8 BcdValue
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
--*/
|
|
||||||
// TODO: BcdValue - add argument and description to function comment
|
|
||||||
{
|
|
||||||
UINTN High;
|
|
||||||
UINTN Low;
|
|
||||||
|
|
||||||
High = BcdValue >> 4;
|
|
||||||
Low = BcdValue - (High << 4);
|
|
||||||
|
|
||||||
return (UINT8) (Low + (High * 10));
|
|
||||||
}
|
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
RtcTestCenturyRegister (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
--*/
|
|
||||||
// TODO: EFI_SUCCESS - add return value to function comment
|
|
||||||
// TODO: EFI_DEVICE_ERROR - add return value to function comment
|
|
||||||
{
|
|
||||||
UINT8 Century;
|
|
||||||
UINT8 Temp;
|
|
||||||
|
|
||||||
Century = RtcRead (RTC_ADDRESS_CENTURY);
|
|
||||||
//
|
|
||||||
// RtcWrite (RTC_ADDRESS_CENTURY, 0x00);
|
|
||||||
//
|
|
||||||
Temp = (UINT8) (RtcRead (RTC_ADDRESS_CENTURY) & 0x7f);
|
|
||||||
RtcWrite (RTC_ADDRESS_CENTURY, Century);
|
|
||||||
if (Temp == 0x19 || Temp == 0x20) {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_DEVICE_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ConvertRtcTimeToEfiTime (
|
ConvertRtcTimeToEfiTime (
|
||||||
IN EFI_TIME *Time,
|
IN EFI_TIME *Time,
|
||||||
|
@ -747,12 +673,12 @@ Returns:
|
||||||
Time->Hour = (UINT8) (Time->Hour & 0x7f);
|
Time->Hour = (UINT8) (Time->Hour & 0x7f);
|
||||||
|
|
||||||
if (RegisterB.Bits.DM == 0) {
|
if (RegisterB.Bits.DM == 0) {
|
||||||
Time->Year = BcdToDecimal ((UINT8) Time->Year);
|
Time->Year = BcdToDecimal8 ((UINT8) Time->Year);
|
||||||
Time->Month = BcdToDecimal (Time->Month);
|
Time->Month = BcdToDecimal8 (Time->Month);
|
||||||
Time->Day = BcdToDecimal (Time->Day);
|
Time->Day = BcdToDecimal8 (Time->Day);
|
||||||
Time->Hour = BcdToDecimal (Time->Hour);
|
Time->Hour = BcdToDecimal8 (Time->Hour);
|
||||||
Time->Minute = BcdToDecimal (Time->Minute);
|
Time->Minute = BcdToDecimal8 (Time->Minute);
|
||||||
Time->Second = BcdToDecimal (Time->Second);
|
Time->Second = BcdToDecimal8 (Time->Second);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// If time is in 12 hour format, convert it to 24 hour format
|
// If time is in 12 hour format, convert it to 24 hour format
|
||||||
|
|
|
@ -291,27 +291,6 @@ Returns:
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
UINT8
|
|
||||||
BcdToDecimal (
|
|
||||||
IN UINT8 BcdValue
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
TODO: Add function description
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
BcdValue - TODO: add argument description
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
TODO: add return values
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
RtcTimeFieldsValid (
|
RtcTimeFieldsValid (
|
||||||
IN EFI_TIME *Time
|
IN EFI_TIME *Time
|
||||||
|
@ -379,27 +358,6 @@ Returns:
|
||||||
--*/
|
--*/
|
||||||
;
|
;
|
||||||
|
|
||||||
EFI_STATUS
|
|
||||||
RtcTestCenturyRegister (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
/*++
|
|
||||||
|
|
||||||
Routine Description:
|
|
||||||
|
|
||||||
TODO: Add function description
|
|
||||||
|
|
||||||
Arguments:
|
|
||||||
|
|
||||||
None
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
|
|
||||||
TODO: add return values
|
|
||||||
|
|
||||||
--*/
|
|
||||||
;
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ConvertRtcTimeToEfiTime (
|
ConvertRtcTimeToEfiTime (
|
||||||
IN EFI_TIME *Time,
|
IN EFI_TIME *Time,
|
||||||
|
|
Loading…
Reference in New Issue