diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsBoot.c b/MdeModulePkg/Library/GenericBdsLib/BdsBoot.c index 6a1c92139f..faa371b7b7 100644 --- a/MdeModulePkg/Library/GenericBdsLib/BdsBoot.c +++ b/MdeModulePkg/Library/GenericBdsLib/BdsBoot.c @@ -218,7 +218,7 @@ BdsLibBootViaBootOption ( // machinename is ia32, ia64, x64, ... // FilePath = FileDevicePath (Handle, DEFAULT_REMOVABLE_FILE_NAME); - if (FilePath) { + if (FilePath != NULL) { Status = gBS->LoadImage ( TRUE, mBdsImageHandle, @@ -582,7 +582,7 @@ MatchPartitionDevicePathNode ( /** - Delete the boot option associated with the handle passed in + Delete the boot option associated with the handle passed in. @param Handle The handle which present the device path to create boot option @@ -944,7 +944,7 @@ BdsLibEnumerateAllBootOption ( } } - if (NumberBlockIoHandles) { + if (NumberBlockIoHandles != 0) { gBS->FreePool (BlockIoHandles); } @@ -1006,7 +1006,7 @@ BdsLibEnumerateAllBootOption ( } } - if (NumberFileSystemHandles) { + if (NumberFileSystemHandles != 0) { gBS->FreePool (FileSystemHandles); } @@ -1029,7 +1029,7 @@ BdsLibEnumerateAllBootOption ( BdsLibBuildOptionFromHandle (SimpleNetworkHandles[Index], BdsBootOptionList, Buffer); } - if (NumberSimpleNetworkHandles) { + if (NumberSimpleNetworkHandles != 0) { gBS->FreePool (SimpleNetworkHandles); } @@ -1083,7 +1083,7 @@ BdsLibEnumerateAllBootOption ( BdsLibBuildOptionFromShell (FvHandleBuffer[Index], BdsBootOptionList); } - if (FvHandleCount) { + if (FvHandleCount != 0) { gBS->FreePool (FvHandleBuffer); } // @@ -1098,14 +1098,13 @@ BdsLibEnumerateAllBootOption ( /** - Build the boot option with the handle parsed in + Build the boot option with the handle parsed in. @param Handle The handle which present the device path to create boot option @param BdsBootOptionList The header of the link list which indexed all current boot options - - @return VOID + @param String Boot option name. **/ VOID @@ -1128,15 +1127,13 @@ BdsLibBuildOptionFromHandle ( /** - Build the on flash shell boot option with the handle parsed in + Build the on flash shell boot option with the handle parsed in. @param Handle The handle which present the device path to create on flash shell boot option @param BdsBootOptionList The header of the link list which indexed all current boot options - @return None - **/ VOID EFIAPI @@ -1459,7 +1456,7 @@ BdsLibNetworkBootWithMediaPresent ( /** - For a bootable Device path, return its boot type + For a bootable Device path, return its boot type. @param DevicePath The bootable device Path to check @@ -1547,8 +1544,8 @@ BdsGetBootTypeFromDevicePath ( Check whether the Device path in a boot option point to a valide bootable device, And if CheckMedia is true, check the device is ready to boot now. - DevPath -- the Device path in a boot option - CheckMedia -- if true, check the device is ready to boot now. + @param DevPath -- the Device path in a boot option + @param CheckMedia -- if true, check the device is ready to boot now. @return TRUE -- the Device path is valide @return FALSE -- the Device path is invalide . diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsConnect.c b/MdeModulePkg/Library/GenericBdsLib/BdsConnect.c index 50675429c3..07d5c38320 100644 --- a/MdeModulePkg/Library/GenericBdsLib/BdsConnect.c +++ b/MdeModulePkg/Library/GenericBdsLib/BdsConnect.c @@ -309,7 +309,7 @@ BdsLibConnectAllDriversToAllControllers ( /** Connect the specific Usb device which match the short form device path, - and whose bus is determined by Host Controller (Uhci or Ehci) + and whose bus is determined by Host Controller (Uhci or Ehci). @param HostControllerPI Uhci (0x00) or Ehci (0x20) or Both uhci and ehci (0xFF) diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsConsole.c b/MdeModulePkg/Library/GenericBdsLib/BdsConsole.c index bd55156169..9f77553ec2 100644 --- a/MdeModulePkg/Library/GenericBdsLib/BdsConsole.c +++ b/MdeModulePkg/Library/GenericBdsLib/BdsConsole.c @@ -14,6 +14,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "InternalBdsLib.h" +/** + Check if we need to save the EFI variable with "ConVarName" as name + as NV type + + @param ConVarName The name of the EFI variable. + + @retval TRUE Set the EFI variabel as NV type. + @retval FALSE EFI variabel as NV type can be set NonNV. +**/ BOOLEAN IsNvNeed ( IN CHAR16 *ConVarName @@ -27,7 +36,7 @@ IsNvNeed ( // If the variable includes "Dev" at last, we consider // it does not support NV attribute. // - while (*Ptr) { + while (*Ptr != L'\0') { Ptr++; } diff --git a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c index 084fa0de4b..c96aa23cab 100644 --- a/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c +++ b/MdeModulePkg/Library/GenericBdsLib/BdsMisc.c @@ -17,8 +17,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #define MAX_STRING_LEN 200 -static BOOLEAN mFeaturerSwitch = TRUE; -static BOOLEAN mResetRequired = FALSE; +BOOLEAN mFeaturerSwitch = TRUE; +BOOLEAN mResetRequired = FALSE; extern UINT16 gPlatformBootTimeOutDefault; @@ -174,8 +174,8 @@ BdsLibLoadDrivers ( /** - Get the Option Number that does not used - Try to locate the specific option variable one by one untile find a free number + Get the Option Number that does not used. + Try to locate the specific option variable one by one untile find a free number. @param VariableName Indicate if the boot#### or driver#### option @@ -432,7 +432,7 @@ BdsLibRegisterNewOption ( /** Build the boot#### or driver#### option from the VariableName, the - build boot#### or driver#### will also be linked to BdsCommonOptionList + build boot#### or driver#### will also be linked to BdsCommonOptionList. @param BdsCommonOptionList The header of the boot#### or driver#### option link list @@ -774,7 +774,7 @@ BdsLibMatchDevicePaths ( EFI_DEVICE_PATH_PROTOCOL *DevicePathInst; UINTN Size; - if (!Multi || !Single) { + if (Multi != NULL || Single != NULL) { return FALSE; } @@ -820,19 +820,19 @@ BdsLibOutputStrings ( ... ) { - VA_LIST args; + VA_LIST Args; EFI_STATUS Status; CHAR16 *String; Status = EFI_SUCCESS; - VA_START (args, ConOut); + VA_START (Args, ConOut); while (!EFI_ERROR (Status)) { // // If String is NULL, then it's the end of the list // - String = VA_ARG (args, CHAR16 *); - if (!String) { + String = VA_ARG (Args, CHAR16 *); + if (String != NULL) { break; } @@ -992,13 +992,12 @@ SetupResetReminder ( /** - Get the headers (dos, image, optional header) from an image + Get the headers (dos, image, optional header) from an image. @param Device SimpleFileSystem device handle @param FileName File name for the image @param DosHeader Pointer to dos header - @param ImageHeader Pointer to image header - @param OptionalHeader Pointer to optional header + @param Hdr Pointer to optional header @retval EFI_SUCCESS Successfully get the machine type. @retval EFI_NOT_FOUND The file is not found. @@ -1130,30 +1129,25 @@ BdsLibGetImageHeader ( return Status; } +/** + + This routine is a notification function for legayc boot or exit boot + service event. It will adjust the memory information for different + memory type and save them into the variables for next boot. + + + @param Event The event that triggered this notification function. + @param Context Pointer to the notification functions context. + + EDES_TODO: Incomplete Descriptions None. + +**/ VOID EFIAPI BdsSetMemoryTypeInformationVariable ( EFI_EVENT Event, VOID *Context ) -/*++ - -Routine Description: - - This routine is a notification function for legayc boot or exit boot - service event. It will adjust the memory information for different - memory type and save them into the variables for next boot - -Arguments: - - Event - The event that triggered this notification function - Context - Pointer to the notification functions context - -Returns: - - None. - ---*/ { EFI_STATUS Status; EFI_MEMORY_TYPE_INFORMATION *PreviousMemoryTypeInformation; @@ -1253,7 +1247,7 @@ Returns: /** This routine register a function to adjust the different type memory page number just before booting - and save the updated info into the variable for next boot to use + and save the updated info into the variable for next boot to use. **/ VOID diff --git a/MdeModulePkg/Library/GenericBdsLib/DevicePath.c b/MdeModulePkg/Library/GenericBdsLib/DevicePath.c index 7801def6b6..fc6d420d5c 100644 --- a/MdeModulePkg/Library/GenericBdsLib/DevicePath.c +++ b/MdeModulePkg/Library/GenericBdsLib/DevicePath.c @@ -21,45 +21,34 @@ EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UAR EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS; +/** + + Adjusts the size of a previously allocated buffer. + + + @param OldPool A pointer to the buffer whose size is being adjusted. + @param OldSize The size of the current buffer. + @param NewSize The size of the new buffer. + + @return The new buffer allocated. If allocatio failed, NULL will be returned. + +**/ VOID * ReallocatePool ( IN VOID *OldPool, IN UINTN OldSize, IN UINTN NewSize ) -/*++ - -Routine Description: - - Adjusts the size of a previously allocated buffer. - -Arguments: - - OldPool - A pointer to the buffer whose size is being adjusted. - - OldSize - The size of the current buffer. - - NewSize - The size of the new buffer. - -Returns: - - EFI_SUCEESS - The requested number of bytes were allocated. - - EFI_OUT_OF_RESOURCES - The pool requested could not be allocated. - - EFI_INVALID_PARAMETER - The buffer was invalid. - ---*/ { VOID *NewPool; NewPool = NULL; - if (NewSize) { + if (NewSize != 0) { NewPool = AllocateZeroPool (NewSize); } - if (OldPool) { - if (NewPool) { + if (OldPool != NULL) { + if (NewPool != NULL) { CopyMem (NewPool, OldPool, OldSize < NewSize ? OldSize : NewSize); } @@ -78,9 +67,11 @@ Returns: allocated. @param fmt The format string + @param ... Variable argument list. + @return Allocated buffer with the formatted string printed in it. - @return The caller must free the allocated buffer. The buffer - @return allocation is not packed. + The caller must free the allocated buffer. The buffer + allocation is not packed. **/ CHAR16 * @@ -92,37 +83,37 @@ CatPrint ( ) { UINT16 *AppendStr; - VA_LIST args; - UINTN strsize; + VA_LIST Args; + UINTN StringSize; AppendStr = AllocateZeroPool (0x1000); if (AppendStr == NULL) { return Str->str; } - VA_START (args, fmt); - UnicodeVSPrint (AppendStr, 0x1000, fmt, args); - VA_END (args); + VA_START (Args, fmt); + UnicodeVSPrint (AppendStr, 0x1000, fmt, Args); + VA_END (Args); if (NULL == Str->str) { - strsize = StrSize (AppendStr); - Str->str = AllocateZeroPool (strsize); + StringSize = StrSize (AppendStr); + Str->str = AllocateZeroPool (StringSize); ASSERT (Str->str != NULL); } else { - strsize = StrSize (AppendStr); - strsize += (StrSize (Str->str) - sizeof (UINT16)); + StringSize = StrSize (AppendStr); + StringSize += (StrSize (Str->str) - sizeof (UINT16)); Str->str = ReallocatePool ( Str->str, StrSize (Str->str), - strsize + StringSize ); ASSERT (Str->str != NULL); } Str->maxlen = MAX_CHAR * sizeof (UINT16); - if (strsize < Str->maxlen) { + if (StringSize < Str->maxlen) { StrCat (Str->str, AppendStr); - Str->len = strsize - sizeof (UINT16); + Str->len = StringSize - sizeof (UINT16); } gBS->FreePool (AppendStr); @@ -170,7 +161,7 @@ BdsLibUnpackDevicePath ( // Allocate space for the unpacked path // NewPath = AllocateZeroPool (Size); - if (NewPath) { + if (NewPath != NULL) { ASSERT (((UINTN) NewPath) % MIN_ALIGNMENT_SIZE == 0); @@ -198,6 +189,16 @@ BdsLibUnpackDevicePath ( return NewPath; } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathPci ( IN OUT POOL_PRINT *Str, @@ -210,6 +211,16 @@ DevPathPci ( CatPrint (Str, L"Pci(%x|%x)", (UINTN) Pci->Device, (UINTN) Pci->Function); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathPccard ( IN OUT POOL_PRINT *Str, @@ -222,6 +233,16 @@ DevPathPccard ( CatPrint (Str, L"Pcmcia(Function%x)", (UINTN) Pccard->FunctionNumber); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathMemMap ( IN OUT POOL_PRINT *Str, @@ -240,6 +261,16 @@ DevPathMemMap ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathController ( IN OUT POOL_PRINT *Str, @@ -254,12 +285,13 @@ DevPathController ( /** - Convert Vendor device path to device name + Convert Device Path to a Unicode string for printing. - @param Str The buffer store device name - @param DevPath Pointer to vendor device path - - @return When it return, the device name have been stored in *Str. + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. **/ VOID @@ -350,9 +382,9 @@ DevPathVendor ( CatPrint ( Str, L"%s,%s,%s,", - (Info & (0x1 << 4)) ? L"SATA" : L"SAS", - (Info & (0x1 << 5)) ? L"External" : L"Internal", - (Info & (0x1 << 6)) ? L"Expanded" : L"Direct" + ((Info & (0x1 << 4)) != 0) ? L"SATA" : L"SAS", + ((Info & (0x1 << 5)) != 0) ? L"External" : L"Internal", + ((Info & (0x1 << 6)) != 0) ? L"Expanded" : L"Direct" ); if ((Info & 0x0f) == 1) { CatPrint (Str, L"0,"); @@ -393,6 +425,16 @@ DevPathVendor ( } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathAcpi ( IN OUT POOL_PRINT *Str, @@ -409,6 +451,16 @@ DevPathAcpi ( } } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathExtendedAcpi ( IN OUT POOL_PRINT *Str, @@ -443,7 +495,7 @@ DevPathExtendedAcpi ( // find HIDSTR // Anchor = 16; - for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) { ; } if (Index > Anchor) { @@ -453,7 +505,7 @@ DevPathExtendedAcpi ( // find UIDSTR // Anchor = (UINT16) (Index + 1); - for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) { ; } if (Index > Anchor) { @@ -463,7 +515,7 @@ DevPathExtendedAcpi ( // find CIDSTR // Anchor = (UINT16) (Index + 1); - for (Index = Anchor; Index < Length && AsChar8Array[Index]; Index++) { + for (Index = Anchor; Index < Length && AsChar8Array[Index] != '\0'; Index++) { ; } if (Index > Anchor) { @@ -520,6 +572,16 @@ DevPathExtendedAcpi ( } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathAdrAcpi ( IN OUT POOL_PRINT *Str, @@ -542,6 +604,16 @@ DevPathAdrAcpi ( CatPrint (Str, L")"); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathAtapi ( IN OUT POOL_PRINT *Str, @@ -559,6 +631,16 @@ DevPathAtapi ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathScsi ( IN OUT POOL_PRINT *Str, @@ -571,6 +653,16 @@ DevPathScsi ( CatPrint (Str, L"Scsi(Pun%x,Lun%x)", (UINTN) Scsi->Pun, (UINTN) Scsi->Lun); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathFibre ( IN OUT POOL_PRINT *Str, @@ -583,18 +675,38 @@ DevPathFibre ( CatPrint (Str, L"Fibre(Wwn%lx,Lun%x)", Fibre->WWN, Fibre->Lun); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPath1394 ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - F1394_DEVICE_PATH *F1394; + F1394_DEVICE_PATH *F1394Path; - F1394 = DevPath; - CatPrint (Str, L"1394(%g)", &F1394->Guid); + F1394Path = DevPath; + CatPrint (Str, L"1394(%g)", &F1394Path->Guid); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathUsb ( IN OUT POOL_PRINT *Str, @@ -607,6 +719,16 @@ DevPathUsb ( CatPrint (Str, L"Usb(%x,%x)", (UINTN) Usb->ParentPortNumber, (UINTN) Usb->InterfaceNumber); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathUsbWWID ( IN OUT POOL_PRINT *Str, @@ -625,6 +747,16 @@ DevPathUsbWWID ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathLogicalUnit ( IN OUT POOL_PRINT *Str, @@ -637,6 +769,16 @@ DevPathLogicalUnit ( CatPrint (Str, L"Unit(%x)", (UINTN) LogicalUnit->Lun); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathUsbClass ( IN OUT POOL_PRINT *Str, @@ -657,6 +799,16 @@ DevPathUsbClass ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathSata ( IN OUT POOL_PRINT *Str, @@ -675,95 +827,145 @@ DevPathSata ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathI2O ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - I2O_DEVICE_PATH *I2O; + I2O_DEVICE_PATH *I2OPath; - I2O = DevPath; - CatPrint (Str, L"I2O(%x)", (UINTN) I2O->Tid); + I2OPath = DevPath; + CatPrint (Str, L"I2O(%x)", (UINTN) I2OPath->Tid); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathMacAddr ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - MAC_ADDR_DEVICE_PATH *MAC; + MAC_ADDR_DEVICE_PATH *MACDevPath; UINTN HwAddressSize; UINTN Index; - MAC = DevPath; + MACDevPath = DevPath; HwAddressSize = sizeof (EFI_MAC_ADDRESS); - if (MAC->IfType == 0x01 || MAC->IfType == 0x00) { + if (MACDevPath->IfType == 0x01 || MACDevPath->IfType == 0x00) { HwAddressSize = 6; } CatPrint (Str, L"Mac("); for (Index = 0; Index < HwAddressSize; Index++) { - CatPrint (Str, L"%02x", (UINTN) MAC->MacAddress.Addr[Index]); + CatPrint (Str, L"%02x", (UINTN) MACDevPath->MacAddress.Addr[Index]); } CatPrint (Str, L")"); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathIPv4 ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - IPv4_DEVICE_PATH *IP; + IPv4_DEVICE_PATH *IPDevPath; - IP = DevPath; + IPDevPath = DevPath; CatPrint ( Str, L"IPv4(%d.%d.%d.%d:%d)", - (UINTN) IP->RemoteIpAddress.Addr[0], - (UINTN) IP->RemoteIpAddress.Addr[1], - (UINTN) IP->RemoteIpAddress.Addr[2], - (UINTN) IP->RemoteIpAddress.Addr[3], - (UINTN) IP->RemotePort + (UINTN) IPDevPath->RemoteIpAddress.Addr[0], + (UINTN) IPDevPath->RemoteIpAddress.Addr[1], + (UINTN) IPDevPath->RemoteIpAddress.Addr[2], + (UINTN) IPDevPath->RemoteIpAddress.Addr[3], + (UINTN) IPDevPath->RemotePort ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathIPv6 ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - IPv6_DEVICE_PATH *IP; + IPv6_DEVICE_PATH *IPv6DevPath; - IP = DevPath; + IPv6DevPath = DevPath; CatPrint ( Str, L"IPv6(%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x:%02x%02x)", - (UINTN) IP->RemoteIpAddress.Addr[0], - (UINTN) IP->RemoteIpAddress.Addr[1], - (UINTN) IP->RemoteIpAddress.Addr[2], - (UINTN) IP->RemoteIpAddress.Addr[3], - (UINTN) IP->RemoteIpAddress.Addr[4], - (UINTN) IP->RemoteIpAddress.Addr[5], - (UINTN) IP->RemoteIpAddress.Addr[6], - (UINTN) IP->RemoteIpAddress.Addr[7], - (UINTN) IP->RemoteIpAddress.Addr[8], - (UINTN) IP->RemoteIpAddress.Addr[9], - (UINTN) IP->RemoteIpAddress.Addr[10], - (UINTN) IP->RemoteIpAddress.Addr[11], - (UINTN) IP->RemoteIpAddress.Addr[12], - (UINTN) IP->RemoteIpAddress.Addr[13], - (UINTN) IP->RemoteIpAddress.Addr[14], - (UINTN) IP->RemoteIpAddress.Addr[15] + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[0], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[1], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[2], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[3], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[4], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[5], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[6], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[7], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[8], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[9], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[10], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[11], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[12], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[13], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[14], + (UINTN) IPv6DevPath->RemoteIpAddress.Addr[15] ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathInfiniBand ( IN OUT POOL_PRINT *Str, @@ -784,6 +986,16 @@ DevPathInfiniBand ( ); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathUart ( IN OUT POOL_PRINT *Str, @@ -859,42 +1071,62 @@ DevPathUart ( } } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathiSCSI ( IN OUT POOL_PRINT *Str, IN VOID *DevPath ) { - ISCSI_DEVICE_PATH_WITH_NAME *iSCSI; + ISCSI_DEVICE_PATH_WITH_NAME *IScsi; UINT16 Options; ASSERT (Str != NULL); ASSERT (DevPath != NULL); - iSCSI = DevPath; + IScsi = DevPath; CatPrint ( Str, L"iSCSI(%s,%x,%lx,", - iSCSI->iSCSITargetName, - iSCSI->TargetPortalGroupTag, - iSCSI->Lun + IScsi->iSCSITargetName, + IScsi->TargetPortalGroupTag, + IScsi->Lun ); - Options = iSCSI->LoginOption; - CatPrint (Str, L"%s,", ((Options >> 1) & 0x0001) ? L"CRC32C" : L"None"); - CatPrint (Str, L"%s,", ((Options >> 3) & 0x0001) ? L"CRC32C" : L"None"); - if ((Options >> 11) & 0x0001) { + Options = IScsi->LoginOption; + CatPrint (Str, L"%s,", (((Options >> 1) & 0x0001) != 0) ? L"CRC32C" : L"None"); + CatPrint (Str, L"%s,", (((Options >> 3) & 0x0001) != 0) ? L"CRC32C" : L"None"); + if (((Options >> 11) & 0x0001) != 0) { CatPrint (Str, L"%s,", L"None"); - } else if ((Options >> 12) & 0x0001) { + } else if (((Options >> 12) & 0x0001) != 0) { CatPrint (Str, L"%s,", L"CHAP_UNI"); } else { CatPrint (Str, L"%s,", L"CHAP_BI"); } - CatPrint (Str, L"%s)", (iSCSI->NetworkProtocol == 0) ? L"TCP" : L"reserved"); + CatPrint (Str, L"%s)", (IScsi->NetworkProtocol == 0) ? L"TCP" : L"reserved"); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathHardDrive ( IN OUT POOL_PRINT *Str, @@ -935,6 +1167,16 @@ DevPathHardDrive ( } } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathCDROM ( IN OUT POOL_PRINT *Str, @@ -947,6 +1189,16 @@ DevPathCDROM ( CatPrint (Str, L"CDROM(Entry%x)", (UINTN) Cd->BootEntry); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathFilePath ( IN OUT POOL_PRINT *Str, @@ -959,6 +1211,16 @@ DevPathFilePath ( CatPrint (Str, L"%s", Fp->PathName); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathMediaProtocol ( IN OUT POOL_PRINT *Str, @@ -971,6 +1233,16 @@ DevPathMediaProtocol ( CatPrint (Str, L"Media(%g)", &MediaProt->Protocol); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathFvFilePath ( IN OUT POOL_PRINT *Str, @@ -983,6 +1255,16 @@ DevPathFvFilePath ( CatPrint (Str, L"%g", &FvFilePath->FvFileName); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathBssBss ( IN OUT POOL_PRINT *Str, @@ -1029,6 +1311,16 @@ DevPathBssBss ( CatPrint (Str, L"Legacy-%s", Type); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathEndInstance ( IN OUT POOL_PRINT *Str, @@ -1038,6 +1330,16 @@ DevPathEndInstance ( CatPrint (Str, L","); } +/** + Convert Device Path to a Unicode string for printing. + + @param Str The buffer holding the output string. + This buffer contains the length of the + string and the maixmum length reserved + for the string buffer. + @param DevPath The device path. + +**/ VOID DevPathNodeUnknown ( IN OUT POOL_PRINT *Str, @@ -1289,12 +1591,12 @@ LibDuplicateDevicePathInstance ( // Make a copy // NewDevPath = NULL; - if (Size) { + if (Size != 0) { NewDevPath = AllocateZeroPool (Size); ASSERT (NewDevPath != NULL); } - if (NewDevPath) { + if (NewDevPath != NULL) { CopyMem (NewDevPath, DevicePathInst, Size); } diff --git a/MdeModulePkg/Library/GenericBdsLib/Ebc/BmMachine.h b/MdeModulePkg/Library/GenericBdsLib/Ebc/BmMachine.h index 55245ac6ee..c0469d098b 100644 --- a/MdeModulePkg/Library/GenericBdsLib/Ebc/BmMachine.h +++ b/MdeModulePkg/Library/GenericBdsLib/Ebc/BmMachine.h @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _BM_MACHINE_H -#define _BM_MACHINE_H +#ifndef _BM_MACHINE_H_ +#define _BM_MACHINE_H_ // // NOTE: This is not defined in UEFI spec. diff --git a/MdeModulePkg/Library/GenericBdsLib/Ia32/BmMachine.h b/MdeModulePkg/Library/GenericBdsLib/Ia32/BmMachine.h index aee7f761f0..057717e00e 100644 --- a/MdeModulePkg/Library/GenericBdsLib/Ia32/BmMachine.h +++ b/MdeModulePkg/Library/GenericBdsLib/Ia32/BmMachine.h @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _BM_MACHINE_H -#define _BM_MACHINE_H +#ifndef _BM_MACHINE_H_ +#define _BM_MACHINE_H_ #define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA32.EFI" diff --git a/MdeModulePkg/Library/GenericBdsLib/InternalBdsLib.h b/MdeModulePkg/Library/GenericBdsLib/InternalBdsLib.h index 9619c31e7a..0ee38eee97 100644 --- a/MdeModulePkg/Library/GenericBdsLib/InternalBdsLib.h +++ b/MdeModulePkg/Library/GenericBdsLib/InternalBdsLib.h @@ -85,6 +85,12 @@ typedef struct { UINT32 Signiture; } PERF_HEADER; +/** + + Allocates a block of memory and writes performance data of booting into it. + OS can processing these record. + +**/ VOID WriteBootToOsPerformanceData ( VOID diff --git a/MdeModulePkg/Library/GenericBdsLib/Ipf/BmMachine.h b/MdeModulePkg/Library/GenericBdsLib/Ipf/BmMachine.h index e9e99ad4c5..06ae3dc5c0 100644 --- a/MdeModulePkg/Library/GenericBdsLib/Ipf/BmMachine.h +++ b/MdeModulePkg/Library/GenericBdsLib/Ipf/BmMachine.h @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _BM_MACHINE_H -#define _BM_MACHINE_H +#ifndef _BM_MACHINE_H_ +#define _BM_MACHINE_H_ #define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTIA64.EFI" diff --git a/MdeModulePkg/Library/GenericBdsLib/Ipf/ShadowRom.c b/MdeModulePkg/Library/GenericBdsLib/Ipf/ShadowRom.c index e6f46ee667..10e8f55c55 100644 --- a/MdeModulePkg/Library/GenericBdsLib/Ipf/ShadowRom.c +++ b/MdeModulePkg/Library/GenericBdsLib/Ipf/ShadowRom.c @@ -12,18 +12,17 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -//@MT:#include "Tiano.h" -//@MT:#include "EfiDriverLib.h" - -//@MT:#include EFI_PROTOCOL_DEFINITION (LegacyBios) - #include "InternalBdsLib.h" UINT8 mShadowRomFlag = 0; +/** + Shadow all opton ROM if the it is not done. +**/ VOID -EFIAPI -ShadowAllOptionRom() +ShadowAllOptionRom( + VOID + ) { EFI_STATUS Status; EFI_LEGACY_BIOS_PROTOCOL *LegacyBios; diff --git a/MdeModulePkg/Library/GenericBdsLib/Performance.c b/MdeModulePkg/Library/GenericBdsLib/Performance.c index 29547a3b42..3b58351495 100644 --- a/MdeModulePkg/Library/GenericBdsLib/Performance.c +++ b/MdeModulePkg/Library/GenericBdsLib/Performance.c @@ -19,21 +19,19 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. STATIC PERF_HEADER mPerfHeader; STATIC PERF_DATA mPerfData; -STATIC +/** + Get the short verion of PDB file name to be + used in performance data logging. + + @param PdbFileName The long PDB file name. + @param GaugeString The output string to be logged by performance logger. + +**/ VOID GetShortPdbFileName ( - CHAR8 *PdbFileName, - CHAR8 *GaugeString + IN CONST CHAR8 *PdbFileName, + OUT CHAR8 *GaugeString ) -/*++ - -Routine Description: - -Arguments: - -Returns: - ---*/ { UINTN Index; UINTN Index1; @@ -72,7 +70,15 @@ Returns: return ; } -STATIC +/** + Get the name from the Driver handle, which can be a handle with + EFI_LOADED_IMAGE_PROTOCOL or EFI_DRIVER_BINDING_PROTOCOL installed. + This name can be used in performance data logging. + + @param Handle Driver handle. + @param GaugeString The output string to be logged by performance logger. + +**/ VOID GetNameFromHandle ( IN EFI_HANDLE Handle, @@ -126,25 +132,16 @@ GetNameFromHandle ( return ; } +/** + + Allocates a block of memory and writes performance data of booting into it. + OS can processing these record. + +**/ VOID WriteBootToOsPerformanceData ( VOID ) -/*++ - -Routine Description: - - Allocates a block of memory and writes performance data of booting to OS into it. - -Arguments: - - None - -Returns: - - None - ---*/ { EFI_STATUS Status; EFI_PHYSICAL_ADDRESS AcpiLowMemoryBase; diff --git a/MdeModulePkg/Library/GenericBdsLib/x64/BmMachine.h b/MdeModulePkg/Library/GenericBdsLib/x64/BmMachine.h index 7008cb4b4f..5e218df8ac 100644 --- a/MdeModulePkg/Library/GenericBdsLib/x64/BmMachine.h +++ b/MdeModulePkg/Library/GenericBdsLib/x64/BmMachine.h @@ -12,8 +12,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ -#ifndef _BM_MACHINE_H -#define _BM_MACHINE_H +#ifndef _BM_MACHINE_H_ +#define _BM_MACHINE_H_ #define DEFAULT_REMOVABLE_FILE_NAME L"\\EFI\\BOOT\\BOOTX64.EFI"