Clean up code

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8975 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4 2009-07-21 07:57:29 +00:00
parent ccd4b7dade
commit 19bf20e11a
8 changed files with 68 additions and 77 deletions

View File

@ -39,7 +39,6 @@
[Packages] [Packages]
MdePkg/MdePkg.dec MdePkg/MdePkg.dec
MdeModulePkg/MdeModulePkg.dec
IntelFrameworkPkg/IntelFrameworkPkg.dec IntelFrameworkPkg/IntelFrameworkPkg.dec
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
@ -51,7 +50,6 @@
BaseMemoryLib BaseMemoryLib
DevicePathLib DevicePathLib
UefiLib UefiLib
BaseLib
UefiDriverEntryPoint UefiDriverEntryPoint
DebugLib DebugLib

View File

@ -882,7 +882,7 @@ IsaSerialReceiveTransmit (
// //
TimeOut = 0; TimeOut = 0;
Msr.Data = READ_MSR (SerialDevice->IsaIo, SerialDevice->BaseAddress); 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); gBS->Stall (TIMEOUT_STALL_INTERVAL);
TimeOut++; TimeOut++;
if (TimeOut > 5) { if (TimeOut > 5) {
@ -892,7 +892,7 @@ IsaSerialReceiveTransmit (
Msr.Data = READ_MSR (SerialDevice->IsaIo, SerialDevice->BaseAddress); 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); IsaSerialFifoRemove (&SerialDevice->Transmit, &Data);
WRITE_THR (SerialDevice->IsaIo, SerialDevice->BaseAddress, Data); WRITE_THR (SerialDevice->IsaIo, SerialDevice->BaseAddress, Data);
} }
@ -1188,12 +1188,7 @@ IsaSerialSetAttributes (
if ((StopBits < OneStopBit) || (StopBits > TwoStopBits)) { if ((StopBits < OneStopBit) || (StopBits > TwoStopBits)) {
return EFI_INVALID_PARAMETER; 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 // for DataBits = 6,7,8, StopBits can not set OneFiveStopBits
// //

View File

@ -24,7 +24,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/UefiDriverEntryPoint.h> #include <Library/UefiDriverEntryPoint.h>
#include <Library/BaseLib.h>
#include <Library/UefiLib.h> #include <Library/UefiLib.h>
#include <Library/DevicePathLib.h> #include <Library/DevicePathLib.h>
#include <Library/BaseMemoryLib.h> #include <Library/BaseMemoryLib.h>

View File

@ -138,4 +138,45 @@ BdsEntry (
IN EFI_BDS_ARCH_PROTOCOL *This 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 #endif

View File

@ -40,9 +40,6 @@ UINT16 *mBootNext = NULL;
EFI_HANDLE mBdsImageHandle; EFI_HANDLE mBdsImageHandle;
extern EFI_STATUS BdsMemoryTest (EXTENDMEM_COVERAGE_LEVEL Level);
extern EFI_STATUS ProcessCapsules (EFI_BOOT_MODE BootMode);
/** /**
Install Boot Device Selection Protocol Install Boot Device Selection Protocol
@ -350,7 +347,7 @@ BdsEntry (
// //
// Setup some platform policy here // Setup some platform policy here
// //
PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, ProcessCapsules, BdsMemoryTest); PlatformBdsPolicyBehavior (&DriverOptionList, &BootOptionList, BdsProcessCapsules, BdsMemoryTest);
PERF_END (NULL, "PlatformBds", "BDS", 0); PERF_END (NULL, "PlatformBds", "BDS", 0);
// //

View File

@ -756,7 +756,7 @@ UpdateConModePage (
UINTN Row; UINTN Row;
CHAR16 RowString[50]; CHAR16 RowString[50];
CHAR16 ModeString[50]; CHAR16 ModeString[50];
CHAR16 *pStr; CHAR16 *PStr;
UINTN MaxMode; UINTN MaxMode;
UINTN ValidMode; UINTN ValidMode;
EFI_STRING_ID *ModeToken; EFI_STRING_ID *ModeToken;
@ -812,11 +812,11 @@ UpdateConModePage (
// Build mode string Column x Row // Build mode string Column x Row
// //
UnicodeValueToString (ModeString, 0, Col, 0); UnicodeValueToString (ModeString, 0, Col, 0);
pStr = &ModeString[0]; PStr = &ModeString[0];
StrnCat (pStr, L" x ", StrLen(L" x ")); StrnCat (PStr, L" x ", StrLen(L" x "));
UnicodeValueToString (RowString, 0, Row, 0); UnicodeValueToString (RowString, 0, Row, 0);
pStr = &ModeString[0]; PStr = &ModeString[0];
StrnCat (pStr, RowString, StrLen(RowString)); StrnCat (PStr, RowString, StrLen(RowString));
ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL); ModeToken[Index] = HiiSetString (CallbackData->BmmHiiHandle, 0, ModeString, NULL);

View File

@ -34,7 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/ **/
EFI_STATUS EFI_STATUS
ProcessCapsules ( BdsProcessCapsules (
EFI_BOOT_MODE BootMode EFI_BOOT_MODE BootMode
) )
{ {

View File

@ -1,4 +1,4 @@
/** /** @file
Produces the Legacy Region Protocol. Produces the Legacy Region Protocol.
This generic implementation of the Legacy Region Protocol does not actually 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 <Library/DebugLib.h> #include <Library/DebugLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
//
// 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. Sets hardware to decode or not decode a region.
@ -171,6 +116,22 @@ LegacyRegionUnlock (
return EFI_SUCCESS; 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. The user Entry Point for module LegacyRegionDxe. The user code starts with this function.