From 19bf20e11acd88a02922201f97e6d64edcd16390 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Tue, 21 Jul 2009 07:57:29 +0000 Subject: [PATCH] Clean up code git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8975 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf | 2 - .../Bus/Isa/IsaSerialDxe/Serial.c | 11 +-- .../Bus/Isa/IsaSerialDxe/Serial.h | 1 - .../Universal/BdsDxe/Bds.h | 41 +++++++++++ .../Universal/BdsDxe/BdsEntry.c | 5 +- .../Universal/BdsDxe/BootMaint/UpdatePage.c | 10 +-- .../Universal/BdsDxe/Capsules.c | 2 +- .../Universal/LegacyRegionDxe/LegacyRegion.c | 73 +++++-------------- 8 files changed, 68 insertions(+), 77 deletions(-) diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf index 3429b8f8b8..81f02ecd10 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/IsaSerialDxe.inf @@ -39,7 +39,6 @@ [Packages] MdePkg/MdePkg.dec - MdeModulePkg/MdeModulePkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec @@ -51,7 +50,6 @@ BaseMemoryLib DevicePathLib UefiLib - BaseLib UefiDriverEntryPoint DebugLib diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c index 4a86257e73..cf895c8802 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.c @@ -882,7 +882,7 @@ IsaSerialReceiveTransmit ( // TimeOut = 0; Msr.Data = READ_MSR (SerialDevice->IsaIo, SerialDevice->BaseAddress); - while (Msr.Bits.Dcd == 1 && (!Msr.Bits.Cts ^ FeaturePcdGet(PcdIsaBusSerialUseHalfHandshake))) { + while ((Msr.Bits.Dcd == 1) && ((Msr.Bits.Cts == 0) || FeaturePcdGet(PcdIsaBusSerialUseHalfHandshake))) { gBS->Stall (TIMEOUT_STALL_INTERVAL); TimeOut++; if (TimeOut > 5) { @@ -892,7 +892,7 @@ IsaSerialReceiveTransmit ( Msr.Data = READ_MSR (SerialDevice->IsaIo, SerialDevice->BaseAddress); } - if (Msr.Bits.Dcd== 0 || (Msr.Bits.Cts ^ FeaturePcdGet(PcdIsaBusSerialUseHalfHandshake))) { + if ((Msr.Bits.Dcd == 0) && ((Msr.Bits.Cts == 1) || FeaturePcdGet(PcdIsaBusSerialUseHalfHandshake))) { IsaSerialFifoRemove (&SerialDevice->Transmit, &Data); WRITE_THR (SerialDevice->IsaIo, SerialDevice->BaseAddress, Data); } @@ -1188,12 +1188,7 @@ IsaSerialSetAttributes ( if ((StopBits < OneStopBit) || (StopBits > TwoStopBits)) { return EFI_INVALID_PARAMETER; } - // - // for DataBits = 5, StopBits can not set TwoStopBits - // - // if ((DataBits == 5) && (StopBits == TwoStopBits)) { - // return EFI_INVALID_PARAMETER; - // } + // // for DataBits = 6,7,8, StopBits can not set OneFiveStopBits // diff --git a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h index 68569991bc..deb7926526 100644 --- a/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h +++ b/IntelFrameworkModulePkg/Bus/Isa/IsaSerialDxe/Serial.h @@ -24,7 +24,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -#include #include #include #include diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h index 31d6df5705..d4539d47ba 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Bds.h @@ -138,4 +138,45 @@ BdsEntry ( IN EFI_BDS_ARCH_PROTOCOL *This ); + +/** + Perform the memory test base on the memory test intensive level, + and update the memory resource. + + @param Level The memory test intensive level. + + @retval EFI_STATUS Success test all the system memory and update + the memory resource + +**/ +EFI_STATUS +BdsMemoryTest ( + IN EXTENDMEM_COVERAGE_LEVEL Level + ); + +/** + + This routine is called to see if there are any capsules we need to process. + If the boot mode is not UPDATE, then we do nothing. Otherwise find the + capsule HOBS and produce firmware volumes for them via the DXE service. + Then call the dispatcher to dispatch drivers from them. Finally, check + the status of the updates. + + This function should be called by BDS in case we need to do some + sort of processing even if there is no capsule to process. We + need to do this if an earlier update went away and we need to + clear the capsule variable so on the next reset PEI does not see it and + think there is a capsule available. + + @param BootMode the current boot mode + + @retval EFI_INVALID_PARAMETER boot mode is not correct for an update + @retval EFI_SUCCESS There is no error when processing capsule + +**/ +EFI_STATUS +BdsProcessCapsules ( + EFI_BOOT_MODE BootMode + ); + #endif diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c index dcaa488894..d671c1ea38 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BdsEntry.c @@ -40,9 +40,6 @@ UINT16 *mBootNext = NULL; EFI_HANDLE mBdsImageHandle; -extern EFI_STATUS BdsMemoryTest (EXTENDMEM_COVERAGE_LEVEL Level); -extern EFI_STATUS ProcessCapsules (EFI_BOOT_MODE BootMode); - /** Install Boot Device Selection Protocol @@ -350,7 +347,7 @@ BdsEntry ( // // Setup some platform policy here // - PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, ProcessCapsules, BdsMemoryTest); + PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest); PERF_END (NULL, "PlatformBds", "BDS", 0); // diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c index b6ea7ae8b2..790fe51d44 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c @@ -756,7 +756,7 @@ UpdateConModePage ( UINTN Row; CHAR16 RowString[50]; CHAR16 ModeString[50]; - CHAR16 *pStr; + CHAR16 *PStr; UINTN MaxMode; UINTN ValidMode; EFI_STRING_ID *ModeToken; @@ -812,11 +812,11 @@ UpdateConModePage ( // Build mode string Column x Row // UnicodeValueToString (ModeString, 0, Col, 0); - pStr = &ModeString[0]; - StrnCat (pStr, L" x ", StrLen(L" x ")); + PStr = &ModeString[0]; + StrnCat (PStr, L" x ", StrLen(L" x ")); UnicodeValueToString (RowString, 0, Row, 0); - pStr = &ModeString[0]; - StrnCat (pStr, RowString, StrLen(RowString)); + PStr = &ModeString[0]; + StrnCat (PStr, RowString, StrLen(RowString)); ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL); diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c b/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c index 3a998c6df6..47082f57d3 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/Capsules.c @@ -34,7 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ EFI_STATUS -ProcessCapsules ( +BdsProcessCapsules ( EFI_BOOT_MODE BootMode ) { diff --git a/IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegion.c b/IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegion.c index c5467b222f..2a17fe7847 100644 --- a/IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegion.c +++ b/IntelFrameworkModulePkg/Universal/LegacyRegionDxe/LegacyRegion.c @@ -1,4 +1,4 @@ -/** +/** @file Produces the Legacy Region Protocol. This generic implementation of the Legacy Region Protocol does not actually @@ -23,61 +23,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include #include -// -// Function prototypes of the Legacy Region Protocol services this module produces -// -EFI_STATUS -EFIAPI -LegacyRegionDecode ( - IN EFI_LEGACY_REGION_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - IN BOOLEAN *On - ); - -EFI_STATUS -EFIAPI -LegacyRegionLock ( - IN EFI_LEGACY_REGION_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity OPTIONAL - ); - -EFI_STATUS -EFIAPI -LegacyRegionBootLock ( - IN EFI_LEGACY_REGION_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity OPTIONAL - ); - -EFI_STATUS -EFIAPI -LegacyRegionUnlock ( - IN EFI_LEGACY_REGION_PROTOCOL *This, - IN UINT32 Start, - IN UINT32 Length, - OUT UINT32 *Granularity OPTIONAL - ); - -// -// Module global for the handle the Legacy Region Protocol is installed -// -EFI_HANDLE mLegacyRegionHandle = NULL; - -// -// Module global for the Legacy Region Protocol instance that is installed onto -// mLegacyRegionHandle -// -EFI_LEGACY_REGION_PROTOCOL mLegacyRegion = { - LegacyRegionDecode, - LegacyRegionLock, - LegacyRegionBootLock, - LegacyRegionUnlock -}; - /** Sets hardware to decode or not decode a region. @@ -171,6 +116,22 @@ LegacyRegionUnlock ( return EFI_SUCCESS; } +// +// Module global for the handle the Legacy Region Protocol is installed +// +EFI_HANDLE mLegacyRegionHandle = NULL; + +// +// Module global for the Legacy Region Protocol instance that is installed onto +// mLegacyRegionHandle +// +EFI_LEGACY_REGION_PROTOCOL mLegacyRegion = { + LegacyRegionDecode, + LegacyRegionLock, + LegacyRegionBootLock, + LegacyRegionUnlock +}; + /** The user Entry Point for module LegacyRegionDxe. The user code starts with this function. -- 2.39.2