From aa75dfeccdd9c88bd64431b1290faf7574854337 Mon Sep 17 00:00:00 2001 From: rsun3 Date: Fri, 15 Jan 2010 08:03:23 +0000 Subject: [PATCH] Fix some coding style issues in MdeModulePkg. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9774 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c | 2 +- .../Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 6 +++--- .../Bus/Pci/PciBusDxe/PciResourceSupport.h | 15 +++++++++------ MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c | 9 +++++---- MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h | 6 +++--- MdeModulePkg/Core/Pei/FwVol/FwVol.c | 2 +- MdeModulePkg/Core/Pei/PeiMain.h | 8 ++++---- .../Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c | 1 - .../Console/GraphicsConsoleDxe/GraphicsConsole.c | 8 ++++++++ .../Universal/Console/TerminalDxe/Terminal.h | 2 +- .../Universal/Console/TerminalDxe/TerminalConIn.c | 4 ++-- .../FaultTolerantWriteDxe/FaultTolerantWrite.c | 8 ++++++++ .../Universal/HiiDatabaseDxe/ConfigRouting.c | 8 ++++---- .../Variable/EmuRuntimeDxe/EmuVariable.c | 3 +-- MdeModulePkg/Universal/Variable/Pei/Variable.c | 4 ++-- .../Universal/Variable/RuntimeDxe/Variable.c | 12 ++++++++++-- 16 files changed, 62 insertions(+), 36 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c index 25387bd257..81a79e6c86 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c @@ -267,7 +267,7 @@ RegisterPciDevice ( ParrentPciIoDevice = PciIoDevice->Parent; ParrentPciIo = &(ParrentPciIoDevice->PciIo); ParrentPciIo->Pci.Read (PciIo, EfiPciIoWidthUint32, ParrentPciIoDevice->PciExpressCapabilityOffset + EFI_PCIE_CAPABILITY_DEVICE_CAPABILITIES_2_OFFSET, 1, &Data32); - if (Data32 & EFI_PCIE_CAPABILITY_DEVICE_CAPABILITIES_2_ARI_FORWARDING) { + if ((Data32 & EFI_PCIE_CAPABILITY_DEVICE_CAPABILITIES_2_ARI_FORWARDING) != 0) { // // ARI forward support in bridge, so enable it. // diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index ef0a5a2d39..bf0e67e521 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -1420,7 +1420,7 @@ PciIovParseVfBar ( } PciIoDevice->VfPciBar[BarIndex].Offset = (UINT8) Offset; - if (Value & 0x01) { + if ((Value & 0x01) != 0) { // // Device I/Os. Impossible // @@ -1439,7 +1439,7 @@ PciIovParseVfBar ( //memory space; anywhere in 32 bit address space // case 0x00: - if (Value & 0x08) { + if ((Value & 0x08) != 0) { PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypePMem32; } else { PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeMem32; @@ -1465,7 +1465,7 @@ PciIovParseVfBar ( // memory space; anywhere in 64 bit address space // case 0x04: - if (Value & 0x08) { + if ((Value & 0x08) != 0) { PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypePMem64; } else { PciIoDevice->VfPciBar[BarIndex].BarType = PciBarTypeMem64; diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h index faa6c0d60c..7a123b6553 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciResourceSupport.h @@ -179,12 +179,15 @@ CreateResourceNode ( This function is used to extract resource request from IOV VF device node list. - @param Bridge Pci device instance. - @param IoNode Resource info node for IO. - @param Mem32Node Resource info node for 32-bit memory. - @param PMem32Node Resource info node for 32-bit Prefetchable Memory. - @param Mem64Node Resource info node for 64-bit memory. - @param PMem64Node Resource info node for 64-bit Prefetchable Memory. + @param PciDev Pci device instance. + @param Length Length of Io/Memory resource. + @param Alignment Alignment of resource. + @param Bar Bar index. + @param ResType Type of resource: IO/Memory. + @param ResUsage Resource usage. + + @return PCI resource node created for given PCI device. + NULL means PCI resource node is not created. **/ PCI_RESOURCE_NODE * diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c index 8f9a6256e9..4b835fc27f 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c @@ -1491,14 +1491,15 @@ ScsiDiskRequestSenseKeys ( Get information from media read capacity command. @param ScsiDiskDevice The pointer of SCSI_DISK_DEV - @param Capacity The pointer of EFI_SCSI_DISK_CAPACITY_DATA + @param Capacity10 The pointer of EFI_SCSI_DISK_CAPACITY_DATA + @param Capacity16 The pointer of EFI_SCSI_DISK_CAPACITY_DATA16 **/ VOID GetMediaInfo ( - IN OUT SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_DISK_CAPACITY_DATA *Capacity10, - EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16 + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10, + IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16 ) { UINT8 ScsiVersion; diff --git a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h index a7bc94313a..2a5c0d0667 100644 --- a/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h +++ b/MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.h @@ -773,9 +773,9 @@ ScsiDiskWrite10 ( **/ VOID GetMediaInfo ( - SCSI_DISK_DEV *ScsiDiskDevice, - EFI_SCSI_DISK_CAPACITY_DATA *Capacity10, - EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16 + IN OUT SCSI_DISK_DEV *ScsiDiskDevice, + IN EFI_SCSI_DISK_CAPACITY_DATA *Capacity10, + IN EFI_SCSI_DISK_CAPACITY_DATA16 *Capacity16 ); /** diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c b/MdeModulePkg/Core/Pei/FwVol/FwVol.c index 88eb2b2a15..cab1cdb001 100644 --- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c +++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c @@ -634,7 +634,7 @@ PeiFfsFindSectionData ( @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param SearchType Filter to find only files of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done. - @param VolumeHandle Handle of firmware volume in which to search. + @param FvHandle Handle of firmware volume in which to search. @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start at the beginning of the firmware volume. On exit, points the file handle of the next file in the volume or NULL if there are no more files. diff --git a/MdeModulePkg/Core/Pei/PeiMain.h b/MdeModulePkg/Core/Pei/PeiMain.h index 705bd72e3f..130a16d526 100644 --- a/MdeModulePkg/Core/Pei/PeiMain.h +++ b/MdeModulePkg/Core/Pei/PeiMain.h @@ -656,7 +656,7 @@ PeiCoreBuildHobHandoffInfoTable ( @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation. @param SearchType Filter to find only files of this type. Type EFI_FV_FILETYPE_ALL causes no filtering to be done. - @param VolumeHandle Handle of firmware volume in which to search. + @param FvHandle Handle of firmware volume in which to search. @param FileHandle On entry, points to the current handle from which to begin searching or NULL to start at the beginning of the firmware volume. On exit, points the file handle of the next file in the volume or NULL if there are no more files. @@ -715,7 +715,7 @@ EFIAPI PeiFfsFindNextVolume ( IN CONST EFI_PEI_SERVICES **PeiServices, IN UINTN Instance, - IN OUT EFI_PEI_FV_HANDLE *FwVolHeader + IN OUT EFI_PEI_FV_HANDLE *VolumeHandle ); // @@ -934,7 +934,7 @@ PeiFfsFindFileByName ( Returns information about a specific file. @param FileHandle Handle of the file. - @param FileInfo Upon exit, points to the file’s information. + @param FileInfo Upon exit, points to the file's information. @retval EFI_INVALID_PARAMETER If FileInfo is NULL. @retval EFI_INVALID_PARAMETER If FileHandle does not represent a valid file. @@ -952,7 +952,7 @@ PeiFfsGetFileInfo ( Returns information about the specified volume. @param VolumeHandle Handle of the volume. - @param VolumeInfo Upon exit, points to the volume’s information. + @param VolumeInfo Upon exit, points to the volume's information. @retval EFI_INVALID_PARAMETER If VolumeHandle does not represent a valid volume. @retval EFI_INVALID_PARAMETER If VolumeInfo is NULL. diff --git a/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c b/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c index 951222a428..f6ad7c8eb6 100755 --- a/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c +++ b/MdeModulePkg/Universal/Acpi/AcpiPlatformDxe/AcpiPlatform.c @@ -29,7 +29,6 @@ FV protocol, then it will return the first FV that contains the ACPI table storage file. - @param Protocol The protocol to find. @param Instance Return pointer to the first instance of the protocol @return EFI_SUCCESS The function completed successfully. diff --git a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c index 14a1913879..0d0293da19 100644 --- a/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c +++ b/MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsole.c @@ -1847,6 +1847,14 @@ EraseCursor ( return EFI_SUCCESS; } +/** + HII Database Protocol notification event handler. + + Register font package when HII Database Protocol has been installed. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ VOID EFIAPI RegisterFontPackage ( diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h index 4f4e4eb60c..ac8ddca875 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h +++ b/MdeModulePkg/Universal/Console/TerminalDxe/Terminal.h @@ -111,7 +111,7 @@ typedef struct { #define RESET_STATE_DEFAULT 0x00 #define RESET_STATE_ESC_R 0x01 -#define RESET_STATE_ESC_R_ESC_r 0x02 +#define RESET_STATE_ESC_R_ESC_R 0x02 #define TERMINAL_CON_IN_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleInput, TERMINAL_DEV_SIGNATURE) #define TERMINAL_CON_OUT_DEV_FROM_THIS(a) CR (a, TERMINAL_DEV, SimpleTextOutput, TERMINAL_DEV_SIGNATURE) diff --git a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c index ec97420f37..a3104ddc5a 100644 --- a/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c +++ b/MdeModulePkg/Universal/Console/TerminalDxe/TerminalConIn.c @@ -1346,14 +1346,14 @@ UnicodeToEfiKey ( if (TerminalDevice->ResetState == RESET_STATE_DEFAULT) { TerminalDevice->ResetState = RESET_STATE_ESC_R; SetDefaultResetState = FALSE; - } else if (TerminalDevice->ResetState == RESET_STATE_ESC_R_ESC_r) { + } else if (TerminalDevice->ResetState == RESET_STATE_ESC_R_ESC_R) { gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL); } Key.ScanCode = SCAN_NULL; break; case 'r': if (TerminalDevice->ResetState == RESET_STATE_ESC_R) { - TerminalDevice->ResetState = RESET_STATE_ESC_R_ESC_r; + TerminalDevice->ResetState = RESET_STATE_ESC_R_ESC_R; SetDefaultResetState = FALSE; } Key.ScanCode = SCAN_NULL; diff --git a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c index 0a003ad721..15a12d70fe 100644 --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWrite.c @@ -863,6 +863,14 @@ FtwGetLastWrite ( return Status; } +/** + Firmware Volume Block Protocol notification event handler. + + Initialization for Fault Tolerant Write is done in this handler. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ VOID EFIAPI FvbNotificationEvent ( diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c index e377fc4ce0..2f38b56e2b 100644 --- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c +++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c @@ -168,7 +168,7 @@ GetDevicePath ( Converts the unicode character of the string from uppercase to lowercase. This is a internal function. - @param Str String to be converted + @param ConfigString String to be converted **/ VOID @@ -773,7 +773,7 @@ InsertBlockData ( /** This function checks VarOffset and VarWidth is in the block range. - @param BlockArray The block array is to be checked. + @param RequestBlockArray The block array is to be checked. @param VarOffset Offset of var to the structure @param VarWidth Width of var. @@ -831,7 +831,7 @@ EFI_STATUS EFIAPI ParseIfrData ( IN UINT8 *Package, - IN UINT32 PackageLenth, + IN UINT32 PackageLength, IN EFI_STRING ConfigHdr, IN IFR_BLOCK_DATA *RequestBlockArray, IN OUT IFR_VARSTORAGE_DATA *VarStorageData, @@ -874,7 +874,7 @@ ParseIfrData ( // Go through the form package to parse OpCode one by one. // IfrOffset = sizeof (EFI_HII_PACKAGE_HEADER); - while (IfrOffset < PackageLenth) { + while (IfrOffset < PackageLength) { IfrOpHdr = (EFI_IFR_OP_HEADER *) (Package + IfrOffset); switch (IfrOpHdr->OpCode) { diff --git a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c index 6bf1d6ec7c..622fe530b3 100644 --- a/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c +++ b/MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariable.c @@ -1363,8 +1363,7 @@ EmuQueryVariableInfo ( This function allocates memory space for variable store area and initializes its attributes. - @param VariableBase Base of the variable store area created - @param LastVariableOffset Size of VARIABLE_STORE_HEADER + @param VolatileStore Indicates if the variable store is volatile. **/ EFI_STATUS diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c b/MdeModulePkg/Universal/Variable/Pei/Variable.c index b2fa201c74..aa428cac49 100644 --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c @@ -465,7 +465,7 @@ FindVariable ( // // Record Variable in VariableIndex HOB // - if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME && StopRecord != TRUE) { + if (IndexTable->Length < VARIABLE_INDEX_TABLE_VOLUME && !StopRecord) { Offset = (UINT32)((UINTN)Variable - (UINTN)LastVariable); // // The distance of two neighbouring VAR_ADDED variable is larger than 2^16, @@ -476,7 +476,7 @@ FindVariable ( StopRecord = TRUE; } - if (StopRecord != TRUE) { + if (!StopRecord) { IndexTable->Index[IndexTable->Length++] = (UINT16) Offset; } LastVariable = Variable; diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c index 4f0ea3c4b7..50c1cca82a 100644 --- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c +++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c @@ -2215,7 +2215,7 @@ ReclaimForOS( /** Initializes variable store area for non-volatile and volatile variable. - @param SystemTable The pointer of EFI_SYSTEM_TABLE. + @param FvbProtocol Pointer to an instance of EFI Firmware Volume Block Protocol. @retval EFI_SUCCESS Function successfully executed. @retval EFI_OUT_OF_RESOURCES Fail to allocate enough memory resource. @@ -2240,6 +2240,7 @@ VariableCommonInitialize ( UINT64 VariableStoreLength; EFI_EVENT ReadyToBootEvent; UINTN ScratchSize; + UINTN VariableSize; Status = EFI_SUCCESS; // @@ -2353,7 +2354,6 @@ VariableCommonInitialize ( Status = EFI_SUCCESS; while (IsValidVariableHeader (NextVariable)) { - UINTN VariableSize = 0; VariableSize = NextVariable->NameSize + NextVariable->DataSize + sizeof (VARIABLE_HEADER); if ((NextVariable->Attributes & (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) == (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_HARDWARE_ERROR_RECORD)) { mVariableModuleGlobal->HwErrVariableTotalSize += HEADER_ALIGN (VariableSize); @@ -2449,6 +2449,14 @@ VariableClassAddressChangeEvent ( EfiConvertPointer (0x0, (VOID **) &mVariableModuleGlobal); } +/** + Firmware Volume Block Protocol notification event handler. + + Discover NV Variable Store and install Variable Arch Protocol. + + @param[in] Event Event whose notification function is being invoked. + @param[in] Context Pointer to the notification function's context. +**/ VOID EFIAPI FvbNotificationEvent ( -- 2.39.2