Changeset 58459 in vbox for trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library
- Timestamp:
- Oct 28, 2015 8:17:18 PM (9 years ago)
- Location:
- trunk/src/VBox/Devices/EFI/Firmware
- Files:
-
- 6 deleted
- 110 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/Firmware
-
Property svn:mergeinfo
set to (toggle deleted branches)
/vendor/edk2/current 103735-103757
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/BasePathLib/BasePathLib.c
r48674 r58459 2 2 Provides interface to path manipulation functions. 3 3 4 Copyright (c) 2011 , Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 16 16 #include <Library/PathLib.h> 17 17 #include <Library/BaseLib.h> 18 #include <Protocol/SimpleTextIn.h> 18 19 19 20 /** … … 116 117 } 117 118 118 119 while ((TempString = StrStr(Path, L"\\\\")) != NULL) { 120 *TempString = CHAR_NULL; 121 TempString += 1; 122 TempSize = StrSize(TempString); 123 CopyMem(Path+StrLen(Path), TempString, TempSize); 124 } 125 if ((TempString = StrStr(Path, L"\\\\")) != NULL && *(TempString + 1) == CHAR_NULL) { 126 *(TempString) = CHAR_NULL; 127 } 119 128 120 129 return (Path); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.c
r48674 r58459 2 2 Provides interface to EFI_FILE_HANDLE functionality. 3 3 4 Copyright (c) 2006 - 201 2, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 85 85 // if we got an error free the memory and return NULL 86 86 // 87 if (EFI_ERROR(Status) ) {87 if (EFI_ERROR(Status) && (FileInfo != NULL)) { 88 88 FreePool(FileInfo); 89 returnNULL;89 FileInfo = NULL; 90 90 } 91 91 } … … 120 120 { 121 121 122 // 123 // ASSERT if the FileHandle or FileInfo is NULL 124 // 125 ASSERT (FileHandle != NULL); 126 ASSERT (FileInfo != NULL); 122 if (FileHandle == NULL || FileInfo == NULL) { 123 return (EFI_INVALID_PARAMETER); 124 } 127 125 128 126 // … … 172 170 ) 173 171 { 174 // 175 // ASSERT if FileHandle is NULL 176 // 177 ASSERT (FileHandle != NULL); 172 if (FileHandle == NULL) { 173 return (EFI_INVALID_PARAMETER); 174 } 178 175 179 176 // … … 216 213 ) 217 214 { 218 //219 // ASSERT if FileHandle is NULL220 //221 ASSERT (FileHandle != NULL); 215 if (FileHandle == NULL) { 216 return (EFI_INVALID_PARAMETER); 217 } 218 222 219 // 223 220 // Perform the write based on EFI_FILE_PROTOCOL … … 244 241 { 245 242 EFI_STATUS Status; 246 // 247 // ASSERT if FileHandle is NULL 248 // 249 ASSERT (FileHandle != NULL); 243 244 if (FileHandle == NULL) { 245 return (EFI_INVALID_PARAMETER); 246 } 247 250 248 // 251 249 // Perform the Close based on EFI_FILE_PROTOCOL … … 276 274 { 277 275 EFI_STATUS Status; 278 // 279 // ASSERT if FileHandle is NULL 280 // 281 ASSERT (FileHandle != NULL); 276 277 if (FileHandle == NULL) { 278 return (EFI_INVALID_PARAMETER); 279 } 280 282 281 // 283 282 // Perform the Delete based on EFI_FILE_PROTOCOL … … 313 312 ) 314 313 { 315 //316 // ASSERT if FileHandle is NULL317 //318 ASSERT (FileHandle != NULL); 314 if (FileHandle == NULL) { 315 return (EFI_INVALID_PARAMETER); 316 } 317 319 318 // 320 319 // Perform the SetPosition based on EFI_FILE_PROTOCOL … … 345 344 ) 346 345 { 347 if (Position == NULL) { 348 return (EFI_INVALID_PARAMETER); 349 } 350 // 351 // ASSERT if FileHandle is NULL 352 // 353 ASSERT (FileHandle != NULL); 346 if (Position == NULL || FileHandle == NULL) { 347 return (EFI_INVALID_PARAMETER); 348 } 349 354 350 // 355 351 // Perform the GetPosition based on EFI_FILE_PROTOCOL … … 377 373 ) 378 374 { 379 //380 // ASSERT if FileHandle is NULL381 //382 ASSERT (FileHandle != NULL); 375 if (FileHandle == NULL) { 376 return (EFI_INVALID_PARAMETER); 377 } 378 383 379 // 384 380 // Perform the Flush based on EFI_FILE_PROTOCOL … … 390 386 function to determine if a given handle is a directory handle 391 387 392 if DirHandle is NULL then ASSERT()388 if DirHandle is NULL then return error 393 389 394 390 open the file information on the DirHandle and verify that the Attribute … … 409 405 EFI_FILE_INFO *DirInfo; 410 406 411 // 412 // ASSERT if DirHandle is NULL 413 // 414 ASSERT(DirHandle != NULL); 407 if (DirHandle == NULL) { 408 return (EFI_INVALID_PARAMETER); 409 } 415 410 416 411 // … … 510 505 Status = FileHandleRead (DirHandle, &BufferSize, *Buffer); 511 506 ASSERT(Status != EFI_BUFFER_TOO_SMALL); 512 if (EFI_ERROR(Status) ) {507 if (EFI_ERROR(Status) || BufferSize == 0) { 513 508 FreePool(*Buffer); 514 509 *Buffer = NULL; 510 if (BufferSize == 0) { 511 return (EFI_NOT_FOUND); 512 } 515 513 return (Status); 516 514 } … … 547 545 UINTN BufferSize; 548 546 549 // 550 // ASSERTs for DirHandle or Buffer or NoFile poitners being NULL 551 // 552 ASSERT (DirHandle != NULL); 553 ASSERT (Buffer != NULL); 554 ASSERT (NoFile != NULL); 547 if (DirHandle == NULL || Buffer == NULL || NoFile == NULL) { 548 return (EFI_INVALID_PARAMETER); 549 } 555 550 556 551 // … … 582 577 Retrieve the size of a file. 583 578 584 if FileHandle is NULL then ASSERT()585 if Size is NULL then ASSERT()579 if FileHandle is NULL then return error 580 if Size is NULL then return error 586 581 587 582 This function extracts the file size info from the FileHandle's EFI_FILE_INFO … … 603 598 EFI_FILE_INFO *FileInfo; 604 599 605 // 606 // ASSERT for FileHandle or Size being NULL 607 // 608 ASSERT (FileHandle != NULL); 609 ASSERT (Size != NULL); 600 if (FileHandle == NULL || Size == NULL) { 601 return (EFI_INVALID_PARAMETER); 602 } 610 603 611 604 // … … 633 626 Set the size of a file. 634 627 635 If FileHandle is NULL then ASSERT().628 If FileHandle is NULL then return error. 636 629 637 630 This function changes the file size info from the FileHandle's EFI_FILE_INFO … … 654 647 EFI_STATUS Status; 655 648 656 // 657 // ASSERT for FileHandle or Size being NULL 658 // 659 ASSERT (FileHandle != NULL); 649 if (FileHandle == NULL) { 650 return (EFI_INVALID_PARAMETER); 651 } 660 652 661 653 // … … 699 691 Destination. 700 692 701 if Destination is NULL, then ASSERT()693 if Destination is NULL, then return error 702 694 if Destination's current length (including NULL terminator) is already more then 703 695 CurrentSize, then ASSERT() … … 726 718 UINTN CopySize; 727 719 728 // 729 // ASSERTs 730 // 731 ASSERT(Destination != NULL); 720 if (Destination == NULL) { 721 return (NULL); 722 } 732 723 733 724 // … … 962 953 if (Handle == NULL 963 954 ||Size == NULL 955 ||(Buffer==NULL&&*Size!=0) 964 956 ){ 965 957 return (EFI_INVALID_PARAMETER); 966 958 } 967 if (Buffer == NULL) { 968 ASSERT(*Size == 0); 969 } else { 959 if (Buffer != NULL) { 970 960 *Buffer = CHAR_NULL; 971 961 } … … 1030 1020 function to write a line of unicode text to a file. 1031 1021 1032 if Handle is NULL, ASSERT.1022 if Handle is NULL, return error. 1033 1023 if Buffer is NULL, do nothing. (return SUCCESS) 1034 1024 … … 1051 1041 UINTN Size; 1052 1042 1053 ASSERT(Handle != NULL);1054 1055 1043 if (Buffer == NULL) { 1056 1044 return (EFI_SUCCESS); 1045 } 1046 1047 if (Handle == NULL) { 1048 return (EFI_INVALID_PARAMETER); 1057 1049 } 1058 1050 … … 1094 1086 // 1095 1087 Buffer = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); 1096 ASSERT (Buffer != NULL); 1088 if (Buffer == NULL) { 1089 return (EFI_OUT_OF_RESOURCES); 1090 } 1097 1091 1098 1092 // … … 1120 1114 This will NOT work on directories. 1121 1115 1122 If Handle is NULL, then ASSERT.1116 If Handle is NULL, then return False. 1123 1117 1124 1118 @param[in] Handle the file handle … … 1137 1131 BOOLEAN RetVal; 1138 1132 1139 // 1140 // ASSERT if Handle is NULL 1141 // 1142 ASSERT(Handle != NULL); 1133 if (Handle == NULL) { 1134 return (FALSE); 1135 } 1143 1136 1144 1137 FileHandleGetPosition(Handle, &Pos); 1145 1138 Info = FileHandleGetInfo (Handle); 1146 ASSERT(Info != NULL);1147 FileHandleSetPosition(Handle, Pos);1148 1139 1149 1140 if (Info == NULL) { 1150 1141 return (FALSE); 1151 1142 } 1143 1144 FileHandleSetPosition(Handle, Pos); 1152 1145 1153 1146 if (Pos == Info->FileSize) { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
r48674 r58459 2 2 # Provides interface to shell functionality for shell commands and applications. 3 3 # 4 # Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 20 20 MODULE_TYPE = DXE_DRIVER 21 21 VERSION_STRING = 1.0 22 LIBRARY_CLASS = FileHandleLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER 22 LIBRARY_CLASS = FileHandleLib|DXE_DRIVER UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER 23 23 24 24 # … … 42 42 43 43 [Protocols] 44 gEfiSimpleFileSystemProtocolGuid # ALWAYS_USED44 gEfiSimpleFileSystemProtocolGuid ## SOMETIMES_CONSUMES 45 45 46 46 [Guids] 47 gEfiFileInfoGuid # ALWAYS_CONSUMED47 gEfiFileInfoGuid ## SOMETIMES_CONSUMES ## GUID 48 48 49 49 [Pcd.common] 50 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize # ALWAYS_CONSUMED50 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.c
r48674 r58459 2 2 Provides interface to advanced shell functionality for parsing both handle and protocol database. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 14 15 15 16 #include "UefiHandleParsingLib.h" 16 17 EFI_HANDLE mHandleParsingHiiHandle; 17 #include "IndustryStandard/Acpi10.h" 18 19 EFI_HANDLE mHandleParsingHiiHandle = NULL; 18 20 HANDLE_INDEX_LIST mHandleList = {{{NULL,NULL},0,0},0}; 21 GUID_INFO_BLOCK *GuidList; 22 UINTN GuidListCount; 23 /** 24 Function to translate the EFI_MEMORY_TYPE into a string. 25 26 @param[in] Memory The memory type. 27 28 @retval A string representation of the type allocated from BS Pool. 29 **/ 30 CHAR16* 31 EFIAPI 32 ConvertMemoryType ( 33 IN CONST EFI_MEMORY_TYPE Memory 34 ) 35 { 36 CHAR16 *RetVal; 37 RetVal = NULL; 38 39 switch (Memory) { 40 case EfiReservedMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiReservedMemoryType", 0); break; 41 case EfiLoaderCode: StrnCatGrow(&RetVal, NULL, L"EfiLoaderCode", 0); break; 42 case EfiLoaderData: StrnCatGrow(&RetVal, NULL, L"EfiLoaderData", 0); break; 43 case EfiBootServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesCode", 0); break; 44 case EfiBootServicesData: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesData", 0); break; 45 case EfiRuntimeServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesCode", 0); break; 46 case EfiRuntimeServicesData: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesData", 0); break; 47 case EfiConventionalMemory: StrnCatGrow(&RetVal, NULL, L"EfiConventionalMemory", 0); break; 48 case EfiUnusableMemory: StrnCatGrow(&RetVal, NULL, L"EfiUnusableMemory", 0); break; 49 case EfiACPIReclaimMemory: StrnCatGrow(&RetVal, NULL, L"EfiACPIReclaimMemory", 0); break; 50 case EfiACPIMemoryNVS: StrnCatGrow(&RetVal, NULL, L"EfiACPIMemoryNVS", 0); break; 51 case EfiMemoryMappedIO: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIO", 0); break; 52 case EfiMemoryMappedIOPortSpace: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0); break; 53 case EfiPalCode: StrnCatGrow(&RetVal, NULL, L"EfiPalCode", 0); break; 54 case EfiMaxMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiMaxMemoryType", 0); break; 55 default: ASSERT(FALSE); 56 } 57 return (RetVal); 58 } 59 60 /** 61 Function to translate the EFI_GRAPHICS_PIXEL_FORMAT into a string. 62 63 @param[in] Fmt The format type. 64 65 @retval A string representation of the type allocated from BS Pool. 66 **/ 67 CHAR16* 68 EFIAPI 69 ConvertPixelFormat ( 70 IN CONST EFI_GRAPHICS_PIXEL_FORMAT Fmt 71 ) 72 { 73 CHAR16 *RetVal; 74 RetVal = NULL; 75 76 switch (Fmt) { 77 case PixelRedGreenBlueReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelRedGreenBlueReserved8BitPerColor", 0); break; 78 case PixelBlueGreenRedReserved8BitPerColor: StrnCatGrow(&RetVal, NULL, L"PixelBlueGreenRedReserved8BitPerColor", 0); break; 79 case PixelBitMask: StrnCatGrow(&RetVal, NULL, L"PixelBitMask", 0); break; 80 case PixelBltOnly: StrnCatGrow(&RetVal, NULL, L"PixelBltOnly", 0); break; 81 case PixelFormatMax: StrnCatGrow(&RetVal, NULL, L"PixelFormatMax", 0); break; 82 default: ASSERT(FALSE); 83 } 84 return (RetVal); 85 } 19 86 20 87 /** … … 33 100 ) 34 101 { 35 mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL); 102 GuidListCount = 0; 103 GuidList = NULL; 104 105 // 106 // Do nothing with mHandleParsingHiiHandle. Initialize HII as needed. 107 // 108 return (EFI_SUCCESS); 109 } 110 111 /** 112 Initialization function for HII packages. 113 114 **/ 115 VOID 116 HandleParsingHiiInit (VOID) 117 { 36 118 if (mHandleParsingHiiHandle == NULL) { 37 return (EFI_DEVICE_ERROR); 38 } 39 40 return (EFI_SUCCESS); 119 mHandleParsingHiiHandle = HiiAddPackages (&gHandleParsingHiiGuid, gImageHandle, UefiHandleParsingLibStrings, NULL); 120 ASSERT (mHandleParsingHiiHandle != NULL); 121 } 41 122 } 42 123 … … 56 137 ) 57 138 { 139 UINTN LoopCount; 140 141 for (LoopCount = 0; GuidList != NULL && LoopCount < GuidListCount; LoopCount++) { 142 SHELL_FREE_NON_NULL(GuidList[LoopCount].GuidId); 143 } 144 145 SHELL_FREE_NON_NULL(GuidList); 58 146 if (mHandleParsingHiiHandle != NULL) { 59 147 HiiRemovePackages(mHandleParsingHiiHandle); … … 62 150 } 63 151 64 /* 152 /** 153 Function to dump information about LoadedImage. 154 155 This will allocate the return buffer from boot services pool. 156 157 @param[in] TheHandle The handle that has LoadedImage installed. 158 @param[in] Verbose TRUE for additional information, FALSE otherwise. 159 160 @retval A poitner to a string containing the information. 161 **/ 65 162 CHAR16* 66 163 EFIAPI … … 70 167 ) 71 168 { 72 EFI_LOADED_IMAGE_PROTOCOL * Image;169 EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; 73 170 EFI_STATUS Status; 74 EFI_DEVICE_PATH_PROTOCOL *DevPath; 75 EFI_DEVICE_PATH_PROTOCOL *DevPathNode; 76 VOID *Buffer; 77 UINTN BufferSize; 78 UINT32 AuthenticationStatus; 79 EFI_GUID *NameGuid; 80 EFI_FIRMWARE_VOLUME_PROTOCOL *FV; 81 EFI_FIRMWARE_VOLUME2_PROTOCOL *FV2; 82 83 FV = NULL; 84 FV2 = NULL; 85 Buffer = NULL; 86 BufferSize = 0; 87 88 Status = HandleProtocol ( 171 CHAR16 *RetVal; 172 CHAR16 *Temp; 173 CHAR16 *CodeType; 174 CHAR16 *DataType; 175 176 if (!Verbose) { 177 return (CatSPrint(NULL, L"LoadedImage")); 178 } 179 180 HandleParsingHiiInit(); 181 182 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_LI_DUMP_MAIN), NULL); 183 RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); 184 if (Temp == NULL || RetVal == NULL) { 185 SHELL_FREE_NON_NULL(Temp); 186 SHELL_FREE_NON_NULL(RetVal); 187 return NULL; 188 } 189 190 Status = gBS->OpenProtocol ( 191 TheHandle, 192 &gEfiLoadedImageProtocolGuid, 193 (VOID**)&LoadedImage, 194 gImageHandle, 195 NULL, 196 EFI_OPEN_PROTOCOL_GET_PROTOCOL 197 ); 198 199 if (EFI_ERROR (Status)) { 200 SHELL_FREE_NON_NULL (Temp); 201 SHELL_FREE_NON_NULL (RetVal); 202 return NULL; 203 } 204 205 DataType = ConvertMemoryType(LoadedImage->ImageDataType); 206 CodeType = ConvertMemoryType(LoadedImage->ImageCodeType); 207 208 RetVal = CatSPrint(RetVal, 209 Temp, 210 LoadedImage->Revision, 211 LoadedImage->ParentHandle, 212 LoadedImage->SystemTable, 213 LoadedImage->DeviceHandle, 214 LoadedImage->FilePath, 215 LoadedImage->LoadOptionsSize, 216 LoadedImage->LoadOptions, 217 LoadedImage->ImageBase, 218 LoadedImage->ImageSize, 219 CodeType, 220 DataType, 221 LoadedImage->Unload); 222 223 224 SHELL_FREE_NON_NULL(Temp); 225 SHELL_FREE_NON_NULL(CodeType); 226 SHELL_FREE_NON_NULL(DataType); 227 228 return RetVal; 229 } 230 231 /** 232 Function to dump information about GOP. 233 234 This will allocate the return buffer from boot services pool. 235 236 @param[in] TheHandle The handle that has LoadedImage installed. 237 @param[in] Verbose TRUE for additional information, FALSE otherwise. 238 239 @retval A poitner to a string containing the information. 240 **/ 241 CHAR16* 242 EFIAPI 243 GraphicsOutputProtocolDumpInformation( 244 IN CONST EFI_HANDLE TheHandle, 245 IN CONST BOOLEAN Verbose 246 ) 247 { 248 EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; 249 EFI_STATUS Status; 250 CHAR16 *RetVal; 251 CHAR16 *Temp; 252 CHAR16 *Fmt; 253 254 if (!Verbose) { 255 return (CatSPrint(NULL, L"GraphicsOutput")); 256 } 257 258 HandleParsingHiiInit(); 259 260 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_GOP_DUMP_MAIN), NULL); 261 RetVal = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize)); 262 if (Temp == NULL || RetVal == NULL) { 263 SHELL_FREE_NON_NULL(Temp); 264 SHELL_FREE_NON_NULL(RetVal); 265 return NULL; 266 } 267 268 Status = gBS->OpenProtocol ( 269 TheHandle, 270 &gEfiGraphicsOutputProtocolGuid, 271 (VOID**)&GraphicsOutput, 272 gImageHandle, 273 NULL, 274 EFI_OPEN_PROTOCOL_GET_PROTOCOL 275 ); 276 277 if (EFI_ERROR (Status)) { 278 SHELL_FREE_NON_NULL (Temp); 279 SHELL_FREE_NON_NULL (RetVal); 280 return NULL; 281 } 282 283 Fmt = ConvertPixelFormat(GraphicsOutput->Mode->Info->PixelFormat); 284 285 RetVal = CatSPrint(RetVal, 286 Temp, 287 GraphicsOutput->Mode->MaxMode, 288 GraphicsOutput->Mode->Mode, 289 GraphicsOutput->Mode->FrameBufferBase, 290 (UINT64)GraphicsOutput->Mode->FrameBufferSize, 291 (UINT64)GraphicsOutput->Mode->SizeOfInfo, 292 GraphicsOutput->Mode->Info->Version, 293 GraphicsOutput->Mode->Info->HorizontalResolution, 294 GraphicsOutput->Mode->Info->VerticalResolution, 295 Fmt, 296 GraphicsOutput->Mode->Info->PixelsPerScanLine, 297 GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.RedMask, 298 GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.GreenMask, 299 GraphicsOutput->Mode->Info->PixelFormat!=PixelBitMask?0:GraphicsOutput->Mode->Info->PixelInformation.BlueMask 300 ); 301 302 SHELL_FREE_NON_NULL(Temp); 303 SHELL_FREE_NON_NULL(Fmt); 304 305 return RetVal; 306 } 307 308 /** 309 Function to dump information about PciRootBridgeIo. 310 311 This will allocate the return buffer from boot services pool. 312 313 @param[in] TheHandle The handle that has PciRootBridgeIo installed. 314 @param[in] Verbose TRUE for additional information, FALSE otherwise. 315 316 @retval A poitner to a string containing the information. 317 **/ 318 CHAR16* 319 EFIAPI 320 PciRootBridgeIoDumpInformation( 321 IN CONST EFI_HANDLE TheHandle, 322 IN CONST BOOLEAN Verbose 323 ) 324 { 325 EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo; 326 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Configuration; 327 UINT64 Supports; 328 UINT64 Attributes; 329 CHAR16 *Temp; 330 CHAR16 *Temp2; 331 CHAR16 *RetVal; 332 EFI_STATUS Status; 333 334 RetVal = NULL; 335 336 if (!Verbose) { 337 return (CatSPrint(NULL, L"PciRootBridgeIo")); 338 } 339 340 HandleParsingHiiInit(); 341 342 Status = gBS->HandleProtocol( 89 343 TheHandle, 90 &gEfiLoadedImageProtocolGuid, 91 &Image); 92 ASSERT_EFI_ERROR(Status); 93 94 DevPath = UnpackDevicePath (Image->FilePath); 95 96 if (DevPath == NULL) { 344 &gEfiPciRootBridgeIoProtocolGuid, 345 (VOID**)&PciRootBridgeIo); 346 347 if (EFI_ERROR(Status)) { 97 348 return NULL; 98 349 } 99 350 100 DevPathNode = DevPath; 101 102 while (!IsDevicePathEnd (DevPathNode)) { 103 // 104 // Find the Fv File path 105 // 106 NameGuid = GetNameGuidFromFwVolDevicePathNode ((MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)DevPathNode); 107 if (NameGuid != NULL) { 108 Status = BS->HandleProtocol ( 109 Image->DeviceHandle, 110 &gEfiFirmwareVolumeProtocolGuid, 111 &FV 112 ); 113 if (!EFI_ERROR (Status)) { 114 Status = FV->ReadSection ( 115 FV, 116 NameGuid, 117 EFI_SECTION_USER_INTERFACE, 118 0, 119 &Buffer, 120 &BufferSize, 121 &AuthenticationStatus 122 ); 123 if (!EFI_ERROR (Status)) { 124 break; 125 } 126 127 Buffer = NULL; 128 } else { 129 Status = BS->HandleProtocol ( 130 Image->DeviceHandle, 131 &gEfiFirmwareVolume2ProtocolGuid, 132 &FV2 133 ); 134 if (!EFI_ERROR (Status)) { 135 Status = FV2->ReadSection ( 136 FV2, 137 NameGuid, 138 EFI_SECTION_USER_INTERFACE, 139 0, 140 &Buffer, 141 &BufferSize, 142 &AuthenticationStatus 143 ); 144 if (!EFI_ERROR (Status)) { 145 break; 146 } 147 148 Buffer = NULL; 149 } 351 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_PH), NULL); 352 ASSERT (Temp != NULL); 353 Temp2 = CatSPrint(L"\r\n", Temp, PciRootBridgeIo->ParentHandle); 354 FreePool(Temp); 355 RetVal = Temp2; 356 Temp2 = NULL; 357 358 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SEG), NULL); 359 ASSERT (Temp != NULL); 360 Temp2 = CatSPrint(RetVal, Temp, PciRootBridgeIo->SegmentNumber); 361 FreePool(Temp); 362 FreePool(RetVal); 363 RetVal = Temp2; 364 Temp2 = NULL; 365 366 Supports = 0; 367 Attributes = 0; 368 Status = PciRootBridgeIo->GetAttributes (PciRootBridgeIo, &Supports, &Attributes); 369 if (!EFI_ERROR(Status)) { 370 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_ATT), NULL); 371 ASSERT (Temp != NULL); 372 Temp2 = CatSPrint(RetVal, Temp, Attributes); 373 FreePool(Temp); 374 FreePool(RetVal); 375 RetVal = Temp2; 376 Temp2 = NULL; 377 378 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_SUPPORTS), NULL); 379 ASSERT (Temp != NULL); 380 Temp2 = CatSPrint(RetVal, Temp, Supports); 381 FreePool(Temp); 382 FreePool(RetVal); 383 RetVal = Temp2; 384 Temp2 = NULL; 385 } 386 387 Configuration = NULL; 388 Status = PciRootBridgeIo->Configuration (PciRootBridgeIo, (VOID **) &Configuration); 389 if (!EFI_ERROR(Status) && Configuration != NULL) { 390 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_TITLE), NULL); 391 ASSERT (Temp != NULL); 392 Temp2 = CatSPrint(RetVal, Temp, Supports); 393 FreePool(Temp); 394 FreePool(RetVal); 395 RetVal = Temp2; 396 Temp2 = NULL; 397 while (Configuration->Desc == ACPI_ADDRESS_SPACE_DESCRIPTOR) { 398 Temp = NULL; 399 switch (Configuration->ResType) { 400 case ACPI_ADDRESS_SPACE_TYPE_MEM: 401 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_MEM), NULL); 402 break; 403 case ACPI_ADDRESS_SPACE_TYPE_IO: 404 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_IO), NULL); 405 break; 406 case ACPI_ADDRESS_SPACE_TYPE_BUS: 407 Temp = HiiGetString(mHandleParsingHiiHandle, STRING_TOKEN(STR_PCIRB_DUMP_BUS), NULL); 408 break; 150 409 } 151 } 152 // 153 // Next device path node 154 // 155 DevPathNode = NextDevicePathNode (DevPathNode); 156 } 157 158 FreePool (DevPath); 159 return Buffer; 160 } 161 */ 410 if (Temp != NULL) { 411 Temp2 = CatSPrint(RetVal, L"%s", Temp); 412 FreePool(Temp); 413 FreePool(RetVal); 414 RetVal = Temp2; 415 Temp2 = NULL; 416 } 417 418 Temp2 = CatSPrint(RetVal, 419 L"%H%02x %016lx %016lx %02x%N\r\n", 420 Configuration->SpecificFlag, 421 Configuration->AddrRangeMin, 422 Configuration->AddrRangeMax, 423 Configuration->AddrSpaceGranularity 424 ); 425 FreePool(RetVal); 426 RetVal = Temp2; 427 Temp2 = NULL; 428 Configuration++; 429 } 430 } 431 return (RetVal); 432 } 162 433 163 434 /** … … 191 462 return (NULL); 192 463 } 464 465 HandleParsingHiiInit(); 193 466 194 467 RetVal = NULL; … … 225 498 Index == Dev->Mode->Mode ? L'*' : L' ', 226 499 Index, 227 !EFI_ERROR(Status)? Col:-1,228 !EFI_ERROR(Status)? Row:-1500 !EFI_ERROR(Status)?(INTN)Col:-1, 501 !EFI_ERROR(Status)?(INTN)Row:-1 229 502 ); 230 503 } … … 290 563 CHAR16 *Temp2; 291 564 EFI_STATUS Status; 292 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;293 565 Temp = NULL; 294 566 295 Status = gBS-> LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&DevPathToText);567 Status = gBS->OpenProtocol(TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); 296 568 if (!EFI_ERROR(Status)) { 297 Status = gBS->OpenProtocol(TheHandle, &gEfiDevicePathProtocolGuid, (VOID**)&DevPath, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); 298 if (!EFI_ERROR(Status)) { 299 // 300 // I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line) 301 // 302 Temp = DevPathToText->ConvertDevicePathToText(DevPath, TRUE, TRUE); 303 gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL); 304 } 569 // 570 // I cannot decide whether to allow shortcuts here (the second BOOLEAN on the next line) 571 // 572 Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE); 573 gBS->CloseProtocol(TheHandle, &gEfiDevicePathProtocolGuid, gImageHandle, NULL); 305 574 } 306 575 if (!Verbose && Temp != NULL && StrLen(Temp) > 30) { … … 318 587 #define LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID \ 319 588 { \ 320 0x58c518b1, 0x76f3, 0x11d4, 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\589 0x58c518b1, 0x76f3, 0x11d4, { 0xbc, 0xea, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ 321 590 } 322 591 323 592 #define LOCAL_EFI_WIN_NT_BUS_DRIVER_IO_PROTOCOL_GUID \ 324 593 { \ 325 0x96eb4ad6, 0xa32a, 0x11d4, 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\594 0x96eb4ad6, 0xa32a, 0x11d4, { 0xbc, 0xfd, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ 326 595 } 327 596 328 597 #define LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID \ 329 598 { \ 330 0xc95a93d, 0xa006, 0x11d4, 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81\599 0xc95a93d, 0xa006, 0x11d4, { 0xbc, 0xfa, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } \ 331 600 } 332 601 STATIC CONST EFI_GUID WinNtThunkProtocolGuid = LOCAL_EFI_WIN_NT_THUNK_PROTOCOL_GUID; … … 334 603 STATIC CONST EFI_GUID WinNtSerialPortGuid = LOCAL_EFI_WIN_NT_SERIAL_PORT_GUID; 335 604 336 STATIC CONST PROTOCOL_INFO_BLOCK mGuidStringListNT[] = {605 STATIC CONST GUID_INFO_BLOCK mGuidStringListNT[] = { 337 606 {STRING_TOKEN(STR_WINNT_THUNK), (EFI_GUID*)&WinNtThunkProtocolGuid, NULL}, 338 607 {STRING_TOKEN(STR_WINNT_DRIVER_IO), (EFI_GUID*)&WinNtIoProtocolGuid, NULL}, … … 341 610 }; 342 611 343 STATIC CONST PROTOCOL_INFO_BLOCK mGuidStringList[] = {344 {STRING_TOKEN(STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, NULL},612 STATIC CONST GUID_INFO_BLOCK mGuidStringList[] = { 613 {STRING_TOKEN(STR_LOADED_IMAGE), &gEfiLoadedImageProtocolGuid, LoadedImageProtocolDumpInformation}, 345 614 {STRING_TOKEN(STR_DEVICE_PATH), &gEfiDevicePathProtocolGuid, DevicePathProtocolDumpInformation}, 346 615 {STRING_TOKEN(STR_IMAGE_PATH), &gEfiLoadedImageDevicePathProtocolGuid, DevicePathProtocolDumpInformation}, … … 367 636 {STRING_TOKEN(STR_ABS_POINTER), &gEfiAbsolutePointerProtocolGuid, NULL}, 368 637 {STRING_TOKEN(STR_SERIAL_IO), &gEfiSerialIoProtocolGuid, NULL}, 369 {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, NULL},638 {STRING_TOKEN(STR_GRAPHICS_OUTPUT), &gEfiGraphicsOutputProtocolGuid, GraphicsOutputProtocolDumpInformation}, 370 639 {STRING_TOKEN(STR_EDID_DISCOVERED), &gEfiEdidDiscoveredProtocolGuid, NULL}, 371 640 {STRING_TOKEN(STR_EDID_ACTIVE), &gEfiEdidActiveProtocolGuid, NULL}, … … 377 646 {STRING_TOKEN(STR_LOAD_FILE2), &gEfiLoadFile2ProtocolGuid, NULL}, 378 647 {STRING_TOKEN(STR_SIMPLE_FILE_SYS), &gEfiSimpleFileSystemProtocolGuid, NULL}, 379 {STRING_TOKEN(STR_FILE_INFO), &gEfiFileInfoGuid, NULL},380 {STRING_TOKEN(STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL},381 648 {STRING_TOKEN(STR_TAPE_IO), &gEfiTapeIoProtocolGuid, NULL}, 382 649 {STRING_TOKEN(STR_DISK_IO), &gEfiDiskIoProtocolGuid, NULL}, … … 384 651 {STRING_TOKEN(STR_UC), &gEfiUnicodeCollationProtocolGuid, NULL}, 385 652 {STRING_TOKEN(STR_UC2), &gEfiUnicodeCollation2ProtocolGuid, NULL}, 386 {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, NULL},653 {STRING_TOKEN(STR_PCIRB_IO), &gEfiPciRootBridgeIoProtocolGuid, PciRootBridgeIoDumpInformation}, 387 654 {STRING_TOKEN(STR_PCI_IO), &gEfiPciIoProtocolGuid, NULL}, 388 655 {STRING_TOKEN(STR_SCSI_PT), &gEfiScsiPassThruProtocolGuid, NULL}, … … 415 682 {STRING_TOKEN(STR_IPV4), &gEfiIp4ProtocolGuid, NULL}, 416 683 {STRING_TOKEN(STR_IPV4_CFG), &gEfiIp4ConfigProtocolGuid, NULL}, 417 {STRING_TOKEN(STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL},418 {STRING_TOKEN(STR_SHELL), &gEfiShellProtocolGuid, NULL},419 {STRING_TOKEN(STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL},420 684 {STRING_TOKEN(STR_UDPV4_SB), &gEfiUdp4ServiceBindingProtocolGuid, NULL}, 421 685 {STRING_TOKEN(STR_UDPV4), &gEfiUdp4ProtocolGuid, NULL}, … … 432 696 {STRING_TOKEN(STR_HII_CONFIG_ACC), &gEfiHiiConfigAccessProtocolGuid, NULL}, 433 697 {STRING_TOKEN(STR_HII_FORM_BROWSER2), &gEfiFormBrowser2ProtocolGuid, NULL}, 698 {STRING_TOKEN(STR_DRIVER_FAM_OVERRIDE), &gEfiDriverFamilyOverrideProtocolGuid, NULL}, 699 {STRING_TOKEN(STR_PCD), &gPcdProtocolGuid, NULL}, 700 {STRING_TOKEN(STR_TCG), &gEfiTcgProtocolGuid, NULL}, 701 {STRING_TOKEN(STR_HII_PACKAGE_LIST), &gEfiHiiPackageListProtocolGuid, NULL}, 702 703 // 704 // the ones under this are deprecated by the current UEFI Spec, but may be found anyways... 705 // 434 706 {STRING_TOKEN(STR_SHELL_INTERFACE), &gEfiShellInterfaceGuid, NULL}, 435 707 {STRING_TOKEN(STR_SHELL_ENV2), &gEfiShellEnvironment2Guid, NULL}, … … 442 714 {STRING_TOKEN(STR_DRIVER_CONFIG), &gEfiDriverConfigurationProtocolGuid, NULL}, 443 715 {STRING_TOKEN(STR_DRIVER_CONFIG2), &gEfiDriverConfiguration2ProtocolGuid, NULL}, 716 717 // 718 // the ones under this are GUID identified structs, not protocols 719 // 720 {STRING_TOKEN(STR_FILE_INFO), &gEfiFileInfoGuid, NULL}, 721 {STRING_TOKEN(STR_FILE_SYS_INFO), &gEfiFileSystemInfoGuid, NULL}, 722 723 // 724 // the ones under this are misc GUIDS. 725 // 726 {STRING_TOKEN(STR_EFI_GLOBAL_VARIABLE), &gEfiGlobalVariableGuid, NULL}, 727 728 // 729 // UEFI 2.2 730 // 731 {STRING_TOKEN(STR_IP6_SB), &gEfiIp6ServiceBindingProtocolGuid, NULL}, 732 {STRING_TOKEN(STR_IP6), &gEfiIp6ProtocolGuid, NULL}, 733 {STRING_TOKEN(STR_IP6_CONFIG), &gEfiIp6ConfigProtocolGuid, NULL}, 734 {STRING_TOKEN(STR_MTFTP6_SB), &gEfiMtftp6ServiceBindingProtocolGuid, NULL}, 735 {STRING_TOKEN(STR_MTFTP6), &gEfiMtftp6ProtocolGuid, NULL}, 736 {STRING_TOKEN(STR_DHCP6_SB), &gEfiDhcp6ServiceBindingProtocolGuid, NULL}, 737 {STRING_TOKEN(STR_DHCP6), &gEfiDhcp6ProtocolGuid, NULL}, 738 {STRING_TOKEN(STR_UDP6_SB), &gEfiUdp6ServiceBindingProtocolGuid, NULL}, 739 {STRING_TOKEN(STR_UDP6), &gEfiUdp6ProtocolGuid, NULL}, 740 {STRING_TOKEN(STR_TCP6_SB), &gEfiTcp6ServiceBindingProtocolGuid, NULL}, 741 {STRING_TOKEN(STR_TCP6), &gEfiTcp6ProtocolGuid, NULL}, 742 {STRING_TOKEN(STR_VLAN_CONFIG), &gEfiVlanConfigProtocolGuid, NULL}, 743 {STRING_TOKEN(STR_EAP), &gEfiEapProtocolGuid, NULL}, 744 {STRING_TOKEN(STR_EAP_MGMT), &gEfiEapManagementProtocolGuid, NULL}, 745 {STRING_TOKEN(STR_FTP4_SB), &gEfiFtp4ServiceBindingProtocolGuid, NULL}, 746 {STRING_TOKEN(STR_FTP4), &gEfiFtp4ProtocolGuid, NULL}, 747 {STRING_TOKEN(STR_IP_SEC_CONFIG), &gEfiIpSecConfigProtocolGuid, NULL}, 748 {STRING_TOKEN(STR_DH), &gEfiDriverHealthProtocolGuid, NULL}, 749 {STRING_TOKEN(STR_DEF_IMG_LOAD), &gEfiDeferredImageLoadProtocolGuid, NULL}, 750 {STRING_TOKEN(STR_USER_CRED), &gEfiUserCredentialProtocolGuid, NULL}, 751 {STRING_TOKEN(STR_USER_MNGR), &gEfiUserManagerProtocolGuid, NULL}, 752 {STRING_TOKEN(STR_ATA_PASS_THRU), &gEfiAtaPassThruProtocolGuid, NULL}, 753 754 // 755 // UEFI 2.3 756 // 757 {STRING_TOKEN(STR_FW_MGMT), &gEfiFirmwareManagementProtocolGuid, NULL}, 758 {STRING_TOKEN(STR_IP_SEC), &gEfiIpSecProtocolGuid, NULL}, 759 {STRING_TOKEN(STR_IP_SEC2), &gEfiIpSec2ProtocolGuid, NULL}, 760 761 // 762 // UEFI 2.3.1 763 // 764 {STRING_TOKEN(STR_KMS), &gEfiKmsProtocolGuid, NULL}, 765 {STRING_TOKEN(STR_BLK_IO2), &gEfiBlockIo2ProtocolGuid, NULL}, 766 {STRING_TOKEN(STR_SSC), &gEfiStorageSecurityCommandProtocolGuid, NULL}, 767 {STRING_TOKEN(STR_UCRED2), &gEfiUserCredential2ProtocolGuid, NULL}, 768 769 // 770 // UEFI 2.4 771 // 772 {STRING_TOKEN(STR_DISK_IO2), &gEfiDiskIo2ProtocolGuid, NULL}, 773 {STRING_TOKEN(STR_ADAPTER_INFO), &gEfiAdapterInformationProtocolGuid, NULL}, 774 775 // 776 // PI Spec ones 777 // 778 {STRING_TOKEN(STR_IDE_CONT_INIT), &gEfiIdeControllerInitProtocolGuid, NULL}, 779 780 // 781 // UEFI Shell Spec 2.0 782 // 783 {STRING_TOKEN(STR_SHELL_PARAMETERS), &gEfiShellParametersProtocolGuid, NULL}, 784 {STRING_TOKEN(STR_SHELL), &gEfiShellProtocolGuid, NULL}, 785 786 // 787 // UEFI Shell Spec 2.1 788 // 789 {STRING_TOKEN(STR_SHELL_DYNAMIC), &gEfiShellDynamicCommandProtocolGuid, NULL}, 790 791 // 792 // terminator 793 // 444 794 {STRING_TOKEN(STR_UNKNOWN_DEVICE), NULL, NULL}, 445 795 }; … … 454 804 @return The node. 455 805 **/ 456 CONST PROTOCOL_INFO_BLOCK *806 CONST GUID_INFO_BLOCK * 457 807 EFIAPI 458 808 InternalShellGetNodeFromGuid( … … 460 810 ) 461 811 { 462 CONST PROTOCOL_INFO_BLOCK *ListWalker; 812 CONST GUID_INFO_BLOCK *ListWalker; 813 UINTN LoopCount; 463 814 464 815 ASSERT(Guid != NULL); 816 817 for (LoopCount = 0, ListWalker = GuidList; GuidList != NULL && LoopCount < GuidListCount; LoopCount++, ListWalker++) { 818 if (CompareGuid(ListWalker->GuidId, Guid)) { 819 return (ListWalker); 820 } 821 } 465 822 466 823 if (PcdGetBool(PcdShellIncludeNtGuids)) { … … 476 833 } 477 834 } 478 return (ListWalker); 835 return (NULL); 836 } 837 838 /** 839 Function to add a new GUID/Name mapping. 840 841 @param[in] Guid The Guid 842 @param[in] NameID The STRING id of the HII string to use 843 @param[in] DumpFunc The pointer to the dump function 844 845 846 @retval EFI_SUCCESS The operation was sucessful 847 @retval EFI_OUT_OF_RESOURCES A memory allocation failed 848 @retval EFI_INVALID_PARAMETER Guid NameId was invalid 849 **/ 850 EFI_STATUS 851 EFIAPI 852 InsertNewGuidNameMapping( 853 IN CONST EFI_GUID *Guid, 854 IN CONST EFI_STRING_ID NameID, 855 IN CONST DUMP_PROTOCOL_INFO DumpFunc OPTIONAL 856 ) 857 { 858 ASSERT(Guid != NULL); 859 ASSERT(NameID != 0); 860 861 GuidList = ReallocatePool(GuidListCount * sizeof(GUID_INFO_BLOCK), GuidListCount+1 * sizeof(GUID_INFO_BLOCK), GuidList); 862 if (GuidList == NULL) { 863 GuidListCount = 0; 864 return (EFI_OUT_OF_RESOURCES); 865 } 866 GuidListCount++; 867 868 GuidList[GuidListCount - 1].GuidId = AllocateCopyPool(sizeof(EFI_GUID), Guid); 869 GuidList[GuidListCount - 1].StringId = NameID; 870 GuidList[GuidListCount - 1].DumpInfo = DumpFunc; 871 872 if (GuidList[GuidListCount - 1].GuidId == NULL) { 873 return (EFI_OUT_OF_RESOURCES); 874 } 875 876 return (EFI_SUCCESS); 877 } 878 879 /** 880 Function to add a new GUID/Name mapping. 881 882 This cannot overwrite an existing mapping. 883 884 @param[in] Guid The Guid 885 @param[in] TheName The Guid's name 886 @param[in] Lang RFC4646 language code list or NULL 887 888 @retval EFI_SUCCESS The operation was sucessful 889 @retval EFI_ACCESS_DENIED There was a duplicate 890 @retval EFI_OUT_OF_RESOURCES A memory allocation failed 891 @retval EFI_INVALID_PARAMETER Guid or TheName was NULL 892 **/ 893 EFI_STATUS 894 EFIAPI 895 AddNewGuidNameMapping( 896 IN CONST EFI_GUID *Guid, 897 IN CONST CHAR16 *TheName, 898 IN CONST CHAR8 *Lang OPTIONAL 899 ) 900 { 901 CONST GUID_INFO_BLOCK *Temp; 902 EFI_STRING_ID NameID; 903 904 HandleParsingHiiInit(); 905 906 if (Guid == NULL || TheName == NULL){ 907 return (EFI_INVALID_PARAMETER); 908 } 909 910 if ((Temp = InternalShellGetNodeFromGuid(Guid)) != NULL) { 911 return (EFI_ACCESS_DENIED); 912 } 913 914 NameID = HiiSetString(mHandleParsingHiiHandle, 0, (CHAR16*)TheName, Lang); 915 if (NameID == 0) { 916 return (EFI_OUT_OF_RESOURCES); 917 } 918 919 return (InsertNewGuidNameMapping(Guid, NameID, NULL)); 479 920 } 480 921 … … 497 938 ) 498 939 { 499 CONST PROTOCOL_INFO_BLOCK *Id; 940 CONST GUID_INFO_BLOCK *Id; 941 942 HandleParsingHiiInit(); 500 943 501 944 Id = InternalShellGetNodeFromGuid(Guid); 502 return (HiiGetString(mHandleParsingHiiHandle, Id ->StringId, Lang));945 return (HiiGetString(mHandleParsingHiiHandle, Id==NULL?STRING_TOKEN(STR_UNKNOWN_DEVICE):Id->StringId, Lang)); 503 946 } 504 947 … … 527 970 ) 528 971 { 529 CONST PROTOCOL_INFO_BLOCK *Id;972 CONST GUID_INFO_BLOCK *Id; 530 973 531 974 ASSERT(TheHandle != NULL); … … 546 989 Function to get the Guid for a protocol or struct based on it's string name. 547 990 991 do not modify the returned Guid. 992 548 993 @param[in] Name The pointer to the string name. 549 994 @param[in] Lang The pointer to the language code. 550 @param[ in] GuidThe pointer to the Guid.995 @param[out] Guid The pointer to the Guid. 551 996 552 997 @retval EFI_SUCCESS The operation was sucessful. … … 557 1002 IN CONST CHAR16 *Name, 558 1003 IN CONST CHAR8 *Lang OPTIONAL, 559 IN EFI_GUID**Guid560 ) 561 { 562 CONST PROTOCOL_INFO_BLOCK *ListWalker;1004 OUT EFI_GUID **Guid 1005 ) 1006 { 1007 CONST GUID_INFO_BLOCK *ListWalker; 563 1008 CHAR16 *String; 1009 UINTN LoopCount; 1010 1011 HandleParsingHiiInit(); 564 1012 565 1013 ASSERT(Guid != NULL); … … 572 1020 for (ListWalker = mGuidStringListNT ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { 573 1021 String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); 574 if (Name != NULL && String != NULL && Str Cmp(Name, String)==0) {1022 if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { 575 1023 *Guid = ListWalker->GuidId; 576 1024 } … … 583 1031 for (ListWalker = mGuidStringList ; ListWalker != NULL && ListWalker->GuidId != NULL ; ListWalker++) { 584 1032 String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); 585 if (Name != NULL && String != NULL && Str Cmp(Name, String)==0) {1033 if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { 586 1034 *Guid = ListWalker->GuidId; 587 1035 } … … 591 1039 } 592 1040 } 1041 1042 for (LoopCount = 0, ListWalker = GuidList; GuidList != NULL && LoopCount < GuidListCount; LoopCount++, ListWalker++) { 1043 String = HiiGetString(mHandleParsingHiiHandle, ListWalker->StringId, Lang); 1044 if (Name != NULL && String != NULL && StringNoCaseCompare (&Name, &String) == 0) { 1045 *Guid = ListWalker->GuidId; 1046 } 1047 SHELL_FREE_NON_NULL(String); 1048 if (*Guid != NULL) { 1049 return (EFI_SUCCESS); 1050 } 1051 } 1052 593 1053 return (EFI_NOT_FOUND); 1054 } 1055 1056 /** 1057 Get best support language for this driver. 1058 1059 First base on the user input language to search, second base on the current 1060 platform used language to search, third get the first language from the 1061 support language list. The caller need to free the buffer of the best language. 1062 1063 @param[in] SupportedLanguages The support languages for this driver. 1064 @param[in] InputLanguage The user input language. 1065 @param[in] Iso639Language Whether get language for ISO639. 1066 1067 @return The best support language for this driver. 1068 **/ 1069 CHAR8 * 1070 EFIAPI 1071 GetBestLanguageForDriver ( 1072 IN CONST CHAR8 *SupportedLanguages, 1073 IN CONST CHAR8 *InputLanguage, 1074 IN BOOLEAN Iso639Language 1075 ) 1076 { 1077 CHAR8 *LanguageVariable; 1078 CHAR8 *BestLanguage; 1079 1080 LanguageVariable = GetVariable (Iso639Language ? L"Lang" : L"PlatformLang", &gEfiGlobalVariableGuid); 1081 1082 BestLanguage = GetBestLanguage( 1083 SupportedLanguages, 1084 Iso639Language, 1085 (InputLanguage != NULL) ? InputLanguage : "", 1086 (LanguageVariable != NULL) ? LanguageVariable : "", 1087 SupportedLanguages, 1088 NULL 1089 ); 1090 1091 if (LanguageVariable != NULL) { 1092 FreePool (LanguageVariable); 1093 } 1094 1095 return BestLanguage; 594 1096 } 595 1097 … … 614 1116 EFI_STATUS Status; 615 1117 CHAR16 *RetVal; 1118 CHAR8 *BestLang; 1119 1120 BestLang = NULL; 616 1121 617 1122 Status = gBS->OpenProtocol( … … 623 1128 EFI_OPEN_PROTOCOL_GET_PROTOCOL); 624 1129 if (!EFI_ERROR(Status)) { 625 Status = CompNameStruct->GetDriverName(CompNameStruct, (CHAR8*)Language, &RetVal); 1130 BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE); 1131 Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal); 1132 if (BestLang != NULL) { 1133 FreePool (BestLang); 1134 BestLang = NULL; 1135 } 626 1136 if (!EFI_ERROR(Status)) { 627 1137 return (RetVal); … … 636 1146 EFI_OPEN_PROTOCOL_GET_PROTOCOL); 637 1147 if (!EFI_ERROR(Status)) { 638 Status = CompNameStruct->GetDriverName(CompNameStruct, (CHAR8*)Language, &RetVal); 1148 BestLang = GetBestLanguageForDriver (CompNameStruct->SupportedLanguages, Language, FALSE); 1149 Status = CompNameStruct->GetDriverName(CompNameStruct, BestLang, &RetVal); 1150 if (BestLang != NULL) { 1151 FreePool (BestLang); 1152 } 639 1153 if (!EFI_ERROR(Status)) { 640 1154 return (RetVal); … … 705 1219 ) 706 1220 { 707 HANDLE_LIST *ListWalker; 1221 EFI_STATUS Status; 1222 EFI_GUID **ProtocolBuffer; 1223 UINTN ProtocolCount; 1224 HANDLE_LIST *ListWalker; 1225 708 1226 if (TheHandle == NULL) { 709 1227 return 0; … … 717 1235 ){ 718 1236 if (ListWalker->TheHandle == TheHandle) { 1237 // 1238 // Verify that TheHandle is still present in the Handle Database 1239 // 1240 Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount); 1241 if (EFI_ERROR (Status)) { 1242 // 1243 // TheHandle is not present in the Handle Database, so delete from the handle list 1244 // 1245 RemoveEntryList (&ListWalker->Link); 1246 return 0; 1247 } 1248 FreePool (ProtocolBuffer); 719 1249 return (ListWalker->TheIndex); 720 1250 } 721 1251 } 1252 1253 // 1254 // Verify that TheHandle is valid handle 1255 // 1256 Status = gBS->ProtocolsPerHandle(TheHandle, &ProtocolBuffer, &ProtocolCount); 1257 if (EFI_ERROR (Status)) { 1258 // 1259 // TheHandle is not valid, so do not add to handle list 1260 // 1261 return 0; 1262 } 1263 FreePool (ProtocolBuffer); 1264 722 1265 ListWalker = AllocateZeroPool(sizeof(HANDLE_LIST)); 723 1266 ASSERT(ListWalker != NULL); … … 745 1288 ) 746 1289 { 1290 EFI_STATUS Status; 1291 EFI_GUID **ProtocolBuffer; 1292 UINTN ProtocolCount; 747 1293 HANDLE_LIST *ListWalker; 748 1294 … … 750 1296 751 1297 if (TheIndex >= mHandleList.NextIndex) { 752 return (NULL);1298 return NULL; 753 1299 } 754 1300 … … 757 1303 ; ListWalker = (HANDLE_LIST*)GetNextNode(&mHandleList.List.Link,&ListWalker->Link) 758 1304 ){ 759 if (ListWalker->TheIndex == TheIndex) { 1305 if (ListWalker->TheIndex == TheIndex && ListWalker->TheHandle != NULL) { 1306 // 1307 // Verify that LinkWalker->TheHandle is valid handle 1308 // 1309 Status = gBS->ProtocolsPerHandle(ListWalker->TheHandle, &ProtocolBuffer, &ProtocolCount); 1310 if (EFI_ERROR (Status)) { 1311 // 1312 // TheHandle is not valid, so do not add to handle list 1313 // 1314 ListWalker->TheHandle = NULL; 1315 } 760 1316 return (ListWalker->TheHandle); 761 1317 } 762 1318 } 763 return (NULL);1319 return NULL; 764 1320 } 765 1321 … … 809 1365 UINTN OpenInfoIndex; 810 1366 UINTN ChildIndex; 1367 INTN DriverBindingHandleIndex; 811 1368 812 1369 ASSERT(HandleCount != NULL); … … 836 1393 ASSERT(*HandleType != NULL); 837 1394 1395 DriverBindingHandleIndex = -1; 1396 for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) { 1397 if (DriverBindingHandle != NULL && (*HandleBuffer)[HandleIndex] == DriverBindingHandle) { 1398 DriverBindingHandleIndex = (INTN)HandleIndex; 1399 } 1400 } 1401 838 1402 for (HandleIndex = 0; HandleIndex < *HandleCount; HandleIndex++) { 839 1403 // … … 845 1409 &ArrayCount 846 1410 ); 847 if (!EFI_ERROR (Status)) { 848 849 for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { 850 851 // 852 // Set the bit describing what this handle has 853 // 854 if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) ) { 855 (*HandleType)[HandleIndex] |= HR_IMAGE_HANDLE; 856 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) ) { 857 (*HandleType)[HandleIndex] |= HR_DRIVER_BINDING_HANDLE; 858 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid)) { 859 (*HandleType)[HandleIndex] |= HR_DRIVER_CONFIGURATION_HANDLE; 860 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) ) { 861 (*HandleType)[HandleIndex] |= HR_DRIVER_CONFIGURATION_HANDLE; 862 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid) ) { 863 (*HandleType)[HandleIndex] |= HR_DRIVER_DIAGNOSTICS_HANDLE; 864 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) ) { 865 (*HandleType)[HandleIndex] |= HR_DRIVER_DIAGNOSTICS_HANDLE; 866 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid) ) { 867 (*HandleType)[HandleIndex] |= HR_COMPONENT_NAME_HANDLE; 868 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) ) { 869 (*HandleType)[HandleIndex] |= HR_COMPONENT_NAME_HANDLE; 870 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) ) { 871 (*HandleType)[HandleIndex] |= HR_DEVICE_HANDLE; 872 } else { 873 DEBUG_CODE_BEGIN(); 874 ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]); 875 DEBUG_CODE_END(); 876 } 877 // 878 // Retrieve the list of agents that have opened each protocol 879 // 880 Status = gBS->OpenProtocolInformation ( 1411 if (EFI_ERROR (Status)) { 1412 continue; 1413 } 1414 1415 for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) { 1416 1417 // 1418 // Set the bit describing what this handle has 1419 // 1420 if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiLoadedImageProtocolGuid) ) { 1421 (*HandleType)[HandleIndex] |= (UINTN)HR_IMAGE_HANDLE; 1422 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverBindingProtocolGuid) ) { 1423 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_BINDING_HANDLE; 1424 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfiguration2ProtocolGuid)) { 1425 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE; 1426 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverConfigurationProtocolGuid) ) { 1427 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_CONFIGURATION_HANDLE; 1428 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnostics2ProtocolGuid) ) { 1429 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE; 1430 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDriverDiagnosticsProtocolGuid) ) { 1431 (*HandleType)[HandleIndex] |= (UINTN)HR_DRIVER_DIAGNOSTICS_HANDLE; 1432 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentName2ProtocolGuid) ) { 1433 (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE; 1434 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiComponentNameProtocolGuid) ) { 1435 (*HandleType)[HandleIndex] |= (UINTN)HR_COMPONENT_NAME_HANDLE; 1436 } else if (CompareGuid (ProtocolGuidArray[ProtocolIndex], &gEfiDevicePathProtocolGuid) ) { 1437 (*HandleType)[HandleIndex] |= (UINTN)HR_DEVICE_HANDLE; 1438 } else { 1439 DEBUG_CODE_BEGIN(); 1440 ASSERT((*HandleType)[HandleIndex] == (*HandleType)[HandleIndex]); 1441 DEBUG_CODE_END(); 1442 } 1443 // 1444 // Retrieve the list of agents that have opened each protocol 1445 // 1446 Status = gBS->OpenProtocolInformation ( 881 1447 (*HandleBuffer)[HandleIndex], 882 1448 ProtocolGuidArray[ProtocolIndex], … … 884 1450 &OpenInfoCount 885 1451 ); 886 if (!EFI_ERROR (Status)) { 1452 if (EFI_ERROR (Status)) { 1453 continue; 1454 } 1455 1456 if (ControllerHandle == NULL) { 1457 // 1458 // ControllerHandle == NULL and DriverBindingHandle != NULL. 1459 // Return information on all the controller handles that the driver specified by DriverBindingHandle is managing 1460 // 1461 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { 1462 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { 1463 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); 1464 if (DriverBindingHandleIndex != -1) { 1465 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER; 1466 } 1467 } 1468 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle && (OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { 1469 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); 1470 if (DriverBindingHandleIndex != -1) { 1471 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); 1472 } 1473 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 1474 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { 1475 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); 1476 } 1477 } 1478 } 1479 } 1480 } 1481 if (DriverBindingHandle == NULL && ControllerHandle != NULL) { 1482 if (ControllerHandle == (*HandleBuffer)[HandleIndex]) { 1483 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); 887 1484 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { 888 if (DriverBindingHandle != NULL && OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) { 889 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) { 890 (*HandleType)[HandleIndex] |= (HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); 891 } 892 if (ControllerHandle != NULL && (*HandleBuffer)[HandleIndex] == ControllerHandle) { 893 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) { 894 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 895 if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].ControllerHandle) { 896 (*HandleType)[ChildIndex] |= (HR_DEVICE_HANDLE | HR_CHILD_HANDLE); 897 } 898 } 1485 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { 1486 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 1487 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { 1488 (*HandleType)[ChildIndex] |= (UINTN)HR_DEVICE_DRIVER; 899 1489 } 900 1490 } 901 1491 } 902 if (DriverBindingHandle == NULL && OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) { 903 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) == EFI_OPEN_PROTOCOL_BY_DRIVER) { 904 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 905 if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].AgentHandle) { 906 (*HandleType)[ChildIndex] |= HR_DEVICE_DRIVER; 907 } 1492 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { 1493 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 1494 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { 1495 (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); 908 1496 } 909 } 910 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) == EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) { 911 (*HandleType)[HandleIndex] |= HR_PARENT_HANDLE; 912 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 913 if ((*HandleBuffer)[ChildIndex] == OpenInfo[OpenInfoIndex].AgentHandle) { 914 (*HandleType)[ChildIndex] |= HR_BUS_DRIVER; 915 } 1497 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { 1498 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); 916 1499 } 917 1500 } 918 1501 } 919 1502 } 920 921 FreePool (OpenInfo); 1503 } else { 1504 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { 1505 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { 1506 if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) { 1507 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE); 1508 } 1509 } 1510 } 922 1511 } 923 1512 } 924 925 FreePool (ProtocolGuidArray); 926 } 927 } 928 929 if (EFI_ERROR(Status)) { 930 if (*HandleType != NULL) { 931 FreePool (*HandleType); 932 } 933 if (*HandleBuffer != NULL) { 934 FreePool (*HandleBuffer); 935 } 936 937 *HandleCount = 0; 938 *HandleBuffer = NULL; 939 *HandleType = NULL; 940 } 941 942 return Status; 1513 if (DriverBindingHandle != NULL && ControllerHandle != NULL) { 1514 if (ControllerHandle == (*HandleBuffer)[HandleIndex]) { 1515 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CONTROLLER_HANDLE); 1516 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { 1517 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_DRIVER) != 0) { 1518 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) { 1519 if (DriverBindingHandleIndex != -1) { 1520 (*HandleType)[DriverBindingHandleIndex] |= (UINTN)HR_DEVICE_DRIVER; 1521 } 1522 } 1523 } 1524 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { 1525 if (OpenInfo[OpenInfoIndex].AgentHandle == DriverBindingHandle) { 1526 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 1527 if (OpenInfo[OpenInfoIndex].ControllerHandle == (*HandleBuffer)[ChildIndex]) { 1528 (*HandleType)[ChildIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_CHILD_HANDLE); 1529 } 1530 } 1531 } 1532 1533 for (ChildIndex = 0; ChildIndex < *HandleCount; ChildIndex++) { 1534 if (OpenInfo[OpenInfoIndex].AgentHandle == (*HandleBuffer)[ChildIndex]) { 1535 (*HandleType)[ChildIndex] |= (UINTN)(HR_BUS_DRIVER | HR_DEVICE_DRIVER); 1536 } 1537 } 1538 } 1539 } 1540 } else { 1541 for (OpenInfoIndex = 0; OpenInfoIndex < OpenInfoCount; OpenInfoIndex++) { 1542 if ((OpenInfo[OpenInfoIndex].Attributes & EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER) != 0) { 1543 if (OpenInfo[OpenInfoIndex].ControllerHandle == ControllerHandle) { 1544 (*HandleType)[HandleIndex] |= (UINTN)(HR_DEVICE_HANDLE | HR_PARENT_HANDLE); 1545 } 1546 } 1547 } 1548 } 1549 } 1550 FreePool (OpenInfo); 1551 } 1552 FreePool (ProtocolGuidArray); 1553 } 1554 return EFI_SUCCESS; 943 1555 } 944 1556 … … 1095 1707 { 1096 1708 EFI_STATUS Status; 1097 //UINTN HandleIndex;1709 UINTN HandleIndex; 1098 1710 UINTN DriverBindingHandleCount; 1099 1711 EFI_HANDLE *DriverBindingHandleBuffer; … … 1102 1714 EFI_HANDLE *ChildControllerHandleBuffer; 1103 1715 UINTN ChildControllerHandleIndex; 1104 // BOOLEAN Found;1105 1716 EFI_HANDLE *HandleBufferForReturn; 1106 1717 … … 1122 1733 // Get a buffer big enough for all the controllers. 1123 1734 // 1124 HandleBufferForReturn = GetHandleListByProtocol( &gEfiDevicePathProtocolGuid);1735 HandleBufferForReturn = GetHandleListByProtocol(NULL); 1125 1736 if (HandleBufferForReturn == NULL) { 1126 1737 FreePool (DriverBindingHandleBuffer); … … 1143 1754 ChildControllerHandleIndex++ 1144 1755 ) { 1145 // Found = FALSE; 1146 HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex]; 1147 // for (HandleIndex = 0; HandleBufferForReturn[HandleIndex] != NULL; HandleIndex++) { 1148 // if (HandleBufferForReturn[HandleIndex] == ChildControllerHandleBuffer[ChildControllerHandleIndex]) { 1149 // Found = TRUE; 1150 // break; 1151 // } 1152 // } 1153 1154 // if (Found) { 1155 // HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex]; 1156 // } 1756 for (HandleIndex = 0; HandleIndex < *MatchingHandleCount; HandleIndex++) { 1757 if (HandleBufferForReturn[HandleIndex] == ChildControllerHandleBuffer[ChildControllerHandleIndex]) { 1758 break; 1759 } 1760 } 1761 if (HandleIndex >= *MatchingHandleCount) { 1762 HandleBufferForReturn[(*MatchingHandleCount)++] = ChildControllerHandleBuffer[ChildControllerHandleIndex]; 1763 } 1157 1764 } 1158 1765 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.h
r48674 r58459 2 2 Provides interface to advanced shell functionality for parsing both handle and protocol database. 3 3 4 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 105 106 //#include <Protocol/FirmwareVolume.h> 106 107 //#include <Protocol/FirmwareVolume2.h> 108 #include <Protocol/DriverFamilyOverride.h> 109 #include <Protocol/Pcd.h> 110 #include <Protocol/TcgService.h> 111 #include <Protocol/HiiPackageList.h> 112 #include <Protocol/Ip6.h> 113 #include <Protocol/Ip6Config.h> 114 #include <Protocol/Mtftp6.h> 115 #include <Protocol/Dhcp6.h> 116 #include <Protocol/Udp6.h> 117 #include <Protocol/Tcp6.h> 118 #include <Protocol/VlanConfig.h> 119 #include <Protocol/Eap.h> 120 #include <Protocol/EapManagement.h> 121 #include <Protocol/Ftp4.h> 122 #include <Protocol/IpSecConfig.h> 123 #include <Protocol/DriverHealth.h> 124 #include <Protocol/DeferredImageLoad.h> 125 #include <Protocol/UserCredential.h> 126 #include <Protocol/UserManager.h> 127 #include <Protocol/AtaPassThru.h> 128 #include <Protocol/FirmwareManagement.h> 129 #include <Protocol/IpSec.h> 130 #include <Protocol/Kms.h> 131 #include <Protocol/BlockIo2.h> 132 #include <Protocol/StorageSecurityCommand.h> 133 #include <Protocol/UserCredential2.h> 134 #include <Protocol/IdeControllerInit.h> 135 #include <Protocol/DiskIo2.h> 136 #include <Protocol/AdapterInformation.h> 137 #include <Protocol/EfiShellDynamicCommand.h> 107 138 108 139 #include <Library/HandleParsingLib.h> … … 118 149 #include <Library/HiiLib.h> 119 150 #include <Library/ShellLib.h> 151 #include <Library/SortLib.h> 120 152 121 153 typedef struct { … … 137 169 ); 138 170 139 140 typedef struct { 171 typedef struct _GUID_INFO_BLOCK{ 141 172 EFI_STRING_ID StringId; 142 173 EFI_GUID *GuidId; 143 174 DUMP_PROTOCOL_INFO DumpInfo; 144 } PROTOCOL_INFO_BLOCK;175 } GUID_INFO_BLOCK; 145 176 146 177 #endif -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
r48674 r58459 1 1 ## @file 2 2 # Provides interface to advanced shell functionality for parsing both handle and protocol database. 3 # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved. <BR> 3 # Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR> 4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved. <BR> 4 5 # 5 6 # This program and the accompanying materials … … 19 20 MODULE_TYPE = UEFI_DRIVER 20 21 VERSION_STRING = 1.0 21 LIBRARY_CLASS = HandleParsingLib|UEFI_APPLICATION UEFI_DRIVER 22 LIBRARY_CLASS = HandleParsingLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER 22 23 CONSTRUCTOR = HandleParsingLibConstructor 23 24 DESTRUCTOR = HandleParsingLibDestructor … … 48 49 UefiLib 49 50 HiiLib 51 SortLib 50 52 51 53 [Protocols] 52 gEfiSimpleFileSystemProtocolGuid # ALWAYS_CONSUMED54 gEfiSimpleFileSystemProtocolGuid ## CONSUMES 53 55 54 56 # shell 2.0 55 gEfiShellProtocolGuid # SOMETIMES_CONSUMED56 gEfiShellParametersProtocolGuid # SOMETIMES_CONSUMED57 gEfiShellProtocolGuid ## SOMETIMES_CONSUMES 58 gEfiShellParametersProtocolGuid ## SOMETIMES_CONSUMES 57 59 58 60 # 'old' shell 59 gEfiShellEnvironment2Guid # SOMETIMES_CONSUMED60 gEfiShellInterfaceGuid # SOMETIMES_CONSUMED61 gEfiShellEnvironment2Guid ## SOMETIMES_CONSUMES 62 gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES 61 63 62 gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED 63 gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED 64 gEfiBusSpecificDriverOverrideProtocolGuid # ALWAYS_CONSUMED 65 gEfiDevicePathUtilitiesProtocolGuid # ALWAYS_CONSUMED 66 gEfiDevicePathFromTextProtocolGuid # ALWAYS_CONSUMED 67 gEfiPlatformDriverOverrideProtocolGuid # ALWAYS_CONSUMED 68 gEfiSimpleTextInProtocolGuid # ALWAYS_CONSUMED 69 gEfiPlatformToDriverConfigurationProtocolGuid # ALWAYS_CONSUMED 70 gEfiDriverSupportedEfiVersionProtocolGuid # ALWAYS_CONSUMED 71 gEfiLoadedImageProtocolGuid # ALWAYS_CONSUMED 72 gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED 73 gEfiLoadedImageDevicePathProtocolGuid # ALWAYS_CONSUMED 74 gEfiSimpleTextOutProtocolGuid 75 gEfiSimplePointerProtocolGuid 76 gEfiAbsolutePointerProtocolGuid 77 gEfiSerialIoProtocolGuid 78 gEfiEdidDiscoveredProtocolGuid 79 gEfiEdidActiveProtocolGuid 80 gEfiEdidOverrideProtocolGuid 81 gEfiLoadFileProtocolGuid 82 gEfiLoadFile2ProtocolGuid 83 gEfiTapeIoProtocolGuid 84 gEfiDiskIoProtocolGuid 85 gEfiBlockIoProtocolGuid 86 gEfiUnicodeCollationProtocolGuid 87 gEfiPciRootBridgeIoProtocolGuid 88 gEfiPciIoProtocolGuid 89 gEfiScsiPassThruProtocolGuid 90 gEfiScsiIoProtocolGuid 91 gEfiExtScsiPassThruProtocolGuid 92 gEfiIScsiInitiatorNameProtocolGuid 93 gEfiUsbIoProtocolGuid 94 gEfiUsbHcProtocolGuid 95 gEfiUsb2HcProtocolGuid 96 gEfiDebugSupportProtocolGuid 97 gEfiDebugPortProtocolGuid 98 gEfiDecompressProtocolGuid 99 gEfiAcpiTableProtocolGuid 100 gEfiEbcProtocolGuid 101 gEfiSimpleNetworkProtocolGuid 102 gEfiNetworkInterfaceIdentifierProtocolGuid 103 gEfiNetworkInterfaceIdentifierProtocolGuid_31 104 gEfiPxeBaseCodeProtocolGuid 105 gEfiPxeBaseCodeCallbackProtocolGuid 106 gEfiBisProtocolGuid 107 gEfiManagedNetworkServiceBindingProtocolGuid 108 gEfiManagedNetworkProtocolGuid 109 gEfiArpServiceBindingProtocolGuid 110 gEfiArpProtocolGuid 111 gEfiDhcp4ServiceBindingProtocolGuid 112 gEfiDhcp4ProtocolGuid 113 gEfiTcp4ServiceBindingProtocolGuid 114 gEfiTcp4ProtocolGuid 115 gEfiIp4ServiceBindingProtocolGuid 116 gEfiIp4ProtocolGuid 117 gEfiIp4ConfigProtocolGuid 118 gEfiUdp4ServiceBindingProtocolGuid 119 gEfiUdp4ProtocolGuid 120 gEfiMtftp4ServiceBindingProtocolGuid 121 gEfiMtftp4ProtocolGuid 122 gEfiAuthenticationInfoProtocolGuid 123 gEfiHashServiceBindingProtocolGuid 124 gEfiHashProtocolGuid 125 gEfiHiiFontProtocolGuid 126 gEfiHiiStringProtocolGuid 127 gEfiHiiImageProtocolGuid 128 gEfiHiiConfigRoutingProtocolGuid 129 gEfiHiiConfigAccessProtocolGuid 130 gEfiFormBrowser2ProtocolGuid 131 gEfiDeviceIoProtocolGuid 132 gEfiUgaDrawProtocolGuid 133 gEfiUgaIoProtocolGuid 134 gEfiDriverConfigurationProtocolGuid 135 gEfiDriverConfiguration2ProtocolGuid 136 gEfiSimpleTextInputExProtocolGuid 64 gEfiUnicodeCollation2ProtocolGuid ## CONSUMES 65 gEfiDevicePathToTextProtocolGuid ## CONSUMES 66 gEfiBusSpecificDriverOverrideProtocolGuid ## CONSUMES 67 gEfiDevicePathUtilitiesProtocolGuid ## CONSUMES 68 gEfiDevicePathFromTextProtocolGuid ## CONSUMES 69 gEfiPlatformDriverOverrideProtocolGuid ## CONSUMES 70 gEfiSimpleTextInProtocolGuid ## CONSUMES 71 gEfiPlatformToDriverConfigurationProtocolGuid ## CONSUMES 72 gEfiDriverSupportedEfiVersionProtocolGuid ## CONSUMES 73 gEfiLoadedImageProtocolGuid ## CONSUMES 74 gEfiDevicePathProtocolGuid ## CONSUMES 75 gEfiLoadedImageDevicePathProtocolGuid ## CONSUMES 76 gEfiSimpleTextOutProtocolGuid ## UNDEFINED 77 gEfiSimplePointerProtocolGuid ## UNDEFINED 78 gEfiAbsolutePointerProtocolGuid ## UNDEFINED 79 gEfiSerialIoProtocolGuid ## UNDEFINED 80 gEfiEdidDiscoveredProtocolGuid ## UNDEFINED 81 gEfiEdidActiveProtocolGuid ## UNDEFINED 82 gEfiEdidOverrideProtocolGuid ## UNDEFINED 83 gEfiLoadFileProtocolGuid ## UNDEFINED 84 gEfiLoadFile2ProtocolGuid ## UNDEFINED 85 gEfiTapeIoProtocolGuid ## UNDEFINED 86 gEfiDiskIoProtocolGuid ## UNDEFINED 87 gEfiBlockIoProtocolGuid ## UNDEFINED 88 gEfiUnicodeCollationProtocolGuid ## UNDEFINED 89 gEfiPciRootBridgeIoProtocolGuid ## UNDEFINED 90 gEfiPciIoProtocolGuid ## UNDEFINED 91 gEfiScsiPassThruProtocolGuid ## UNDEFINED 92 gEfiScsiIoProtocolGuid ## UNDEFINED 93 gEfiExtScsiPassThruProtocolGuid ## UNDEFINED 94 gEfiIScsiInitiatorNameProtocolGuid ## UNDEFINED 95 gEfiUsbIoProtocolGuid ## UNDEFINED 96 gEfiUsbHcProtocolGuid ## UNDEFINED 97 gEfiUsb2HcProtocolGuid ## UNDEFINED 98 gEfiDebugSupportProtocolGuid ## UNDEFINED 99 gEfiDebugPortProtocolGuid ## UNDEFINED 100 gEfiDecompressProtocolGuid ## UNDEFINED 101 gEfiAcpiTableProtocolGuid ## UNDEFINED 102 gEfiEbcProtocolGuid ## UNDEFINED 103 gEfiSimpleNetworkProtocolGuid ## UNDEFINED 104 gEfiNetworkInterfaceIdentifierProtocolGuid ## UNDEFINED 105 gEfiNetworkInterfaceIdentifierProtocolGuid_31 ## UNDEFINED 106 gEfiPxeBaseCodeProtocolGuid ## UNDEFINED 107 gEfiPxeBaseCodeCallbackProtocolGuid ## UNDEFINED 108 gEfiBisProtocolGuid ## UNDEFINED 109 gEfiManagedNetworkServiceBindingProtocolGuid ## UNDEFINED 110 gEfiManagedNetworkProtocolGuid ## UNDEFINED 111 gEfiArpServiceBindingProtocolGuid ## UNDEFINED 112 gEfiArpProtocolGuid ## UNDEFINED 113 gEfiDhcp4ServiceBindingProtocolGuid ## UNDEFINED 114 gEfiDhcp4ProtocolGuid ## UNDEFINED 115 gEfiTcp4ServiceBindingProtocolGuid ## UNDEFINED 116 gEfiTcp4ProtocolGuid ## UNDEFINED 117 gEfiIp4ServiceBindingProtocolGuid ## UNDEFINED 118 gEfiIp4ProtocolGuid ## UNDEFINED 119 gEfiIp4ConfigProtocolGuid ## UNDEFINED 120 gEfiUdp4ServiceBindingProtocolGuid ## UNDEFINED 121 gEfiUdp4ProtocolGuid ## UNDEFINED 122 gEfiMtftp4ServiceBindingProtocolGuid ## UNDEFINED 123 gEfiMtftp4ProtocolGuid ## UNDEFINED 124 gEfiAuthenticationInfoProtocolGuid ## UNDEFINED 125 gEfiHashServiceBindingProtocolGuid ## UNDEFINED 126 gEfiHashProtocolGuid ## UNDEFINED 127 gEfiHiiFontProtocolGuid ## UNDEFINED 128 gEfiHiiStringProtocolGuid ## UNDEFINED 129 gEfiHiiImageProtocolGuid ## UNDEFINED 130 gEfiHiiConfigRoutingProtocolGuid ## UNDEFINED 131 gEfiHiiConfigAccessProtocolGuid ## UNDEFINED 132 gEfiFormBrowser2ProtocolGuid ## UNDEFINED 133 gEfiDeviceIoProtocolGuid ## UNDEFINED 134 gEfiUgaDrawProtocolGuid ## UNDEFINED 135 gEfiUgaIoProtocolGuid ## UNDEFINED 136 gEfiDriverConfigurationProtocolGuid ## UNDEFINED 137 gEfiDriverConfiguration2ProtocolGuid ## UNDEFINED 138 gEfiSimpleTextInputExProtocolGuid ## UNDEFINED 139 gEfiIp6ServiceBindingProtocolGuid ## UNDEFINED 140 gEfiIp6ProtocolGuid ## UNDEFINED 141 gEfiIp6ConfigProtocolGuid ## UNDEFINED 142 gEfiMtftp6ServiceBindingProtocolGuid ## UNDEFINED 143 gEfiMtftp6ProtocolGuid ## UNDEFINED 144 gEfiDhcp6ServiceBindingProtocolGuid ## UNDEFINED 145 gEfiDhcp6ProtocolGuid ## UNDEFINED 146 gEfiUdp6ServiceBindingProtocolGuid ## UNDEFINED 147 gEfiUdp6ProtocolGuid ## UNDEFINED 148 gEfiTcp6ServiceBindingProtocolGuid ## UNDEFINED 149 gEfiTcp6ProtocolGuid ## UNDEFINED 150 gEfiVlanConfigProtocolGuid ## UNDEFINED 151 gEfiEapProtocolGuid ## UNDEFINED 152 gEfiEapManagementProtocolGuid ## UNDEFINED 153 gEfiFtp4ServiceBindingProtocolGuid ## UNDEFINED 154 gEfiFtp4ProtocolGuid ## UNDEFINED 155 gEfiIpSecConfigProtocolGuid ## UNDEFINED 156 gEfiDriverHealthProtocolGuid ## UNDEFINED 157 gEfiDeferredImageLoadProtocolGuid ## UNDEFINED 158 gEfiUserCredentialProtocolGuid ## UNDEFINED 159 gEfiUserManagerProtocolGuid ## UNDEFINED 160 gEfiAtaPassThruProtocolGuid ## UNDEFINED 161 gEfiFirmwareManagementProtocolGuid ## UNDEFINED 162 gEfiIpSecProtocolGuid ## UNDEFINED 163 gEfiIpSec2ProtocolGuid ## UNDEFINED 164 gEfiKmsProtocolGuid ## UNDEFINED 165 gEfiBlockIo2ProtocolGuid ## UNDEFINED 166 gEfiStorageSecurityCommandProtocolGuid ## UNDEFINED 167 gEfiUserCredential2ProtocolGuid ## UNDEFINED 168 gPcdProtocolGuid ## UNDEFINED 169 gEfiTcgProtocolGuid ## UNDEFINED 170 gEfiHiiPackageListProtocolGuid ## UNDEFINED 171 gEfiDriverFamilyOverrideProtocolGuid ## UNDEFINED 172 gEfiIdeControllerInitProtocolGuid ## UNDEFINED 173 gEfiDiskIo2ProtocolGuid ## UNDEFINED 174 gEfiAdapterInformationProtocolGuid ## UNDEFINED 175 gEfiShellDynamicCommandProtocolGuid ## UNDEFINED 137 176 138 177 [Guids] 139 gEfiFileInfoGuid # ALWAYS_CONSUMED140 gEfiShellEnvironment2ExtGuid # ALWAYS_CONSUMED141 gEfiPcAnsiGuid 142 gEfiVT100Guid 143 gEfiVT100PlusGuid 144 gEfiVTUTF8Guid 145 gEfiStandardErrorDeviceGuid 146 gEfiConsoleInDeviceGuid 147 gEfiConsoleOutDeviceGuid 148 gEfiFileSystemInfoGuid 149 gEfiGlobalVariableGuid 150 gEfiPartTypeSystemPartGuid 151 gEfiPartTypeLegacyMbrGuid 152 gHandleParsingHiiGuid 178 gEfiFileInfoGuid ## CONSUMES ## GUID 179 gEfiShellEnvironment2ExtGuid ## CONSUMES ## GUID 180 gEfiPcAnsiGuid ## UNDEFINED 181 gEfiVT100Guid ## UNDEFINED 182 gEfiVT100PlusGuid ## UNDEFINED 183 gEfiVTUTF8Guid ## UNDEFINED 184 gEfiStandardErrorDeviceGuid ## UNDEFINED 185 gEfiConsoleInDeviceGuid ## UNDEFINED 186 gEfiConsoleOutDeviceGuid ## UNDEFINED 187 gEfiFileSystemInfoGuid ## UNDEFINED 188 gEfiGlobalVariableGuid ## UNDEFINED 189 gEfiPartTypeSystemPartGuid ## UNDEFINED 190 gEfiPartTypeLegacyMbrGuid ## UNDEFINED 191 gHandleParsingHiiGuid ## UNDEFINED 153 192 154 193 [Pcd.common] 155 gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize # ALWAYS_CONSUMED156 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize # ALWAYS_CONSUMED157 gEfiShellPkgTokenSpaceGuid.PcdShellIncludeNtGuids # ALWAYS_CONSUMED194 gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize ## CONSUMES 195 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ## CONSUMES 196 gEfiShellPkgTokenSpaceGuid.PcdShellIncludeNtGuids ## CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.c
r48674 r58459 2 2 Provides application point extension for "C" style main funciton 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 30 30 An application that uses UefiShellCEntryLib must have a ShellAppMain 31 31 function as prototyped in Include/Library/ShellCEntryLib.h. 32 33 Note that the Shell uses POSITIVE integers for error values, while UEFI 34 uses NEGATIVE values. If the application is to be used within a script, 35 it needs to return one of the SHELL_STATUS values defined in ShellBase.h. 32 36 33 37 @param ImageHandle The image handle of the UEFI Application. … … 92 96 } 93 97 } 94 if (ReturnFromMain == 0) { 95 return (EFI_SUCCESS); 96 } else { 97 return (EFI_UNSUPPORTED); 98 } 98 return ReturnFromMain; 99 99 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf
r48674 r58459 2 2 # Provides interface to shell functionality for shell commands and applications. 3 3 # 4 # Copyright (c) 2006 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 39 39 40 40 [Protocols] 41 gEfiShellParametersProtocolGuid # ALWAYS_CONSUMED42 gEfiShellInterfaceGuid # SOMETIMES_CONSUMED41 gEfiShellParametersProtocolGuid ## CONSUMES 42 gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES 43 43 44 44 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCommandLib/ConsistMapping.c
r48674 r58459 2 2 Main file for support of shell consist mapping. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 99 99 } 100 100 101 Str Cat (Str->Str, AppendStr);101 StrnCat (Str->Str, AppendStr, StringSize/sizeof(CHAR16) - 1 - StrLen(Str->Str)); 102 102 Str->Len = StringSize; 103 103 … … 951 951 952 952 DEV_PATH_CONSIST_MAPPING_TABLE DevPathConsistMappingTable[] = { 953 HARDWARE_DEVICE_PATH, 954 HW_PCI_DP, 955 DevPathSerialDefault, 956 DevPathComparePci, 957 ACPI_DEVICE_PATH, 958 ACPI_DP, 959 DevPathSerialAcpi, 960 DevPathCompareAcpi, 961 MESSAGING_DEVICE_PATH, 962 MSG_ATAPI_DP, 963 DevPathSerialAtapi, 964 DevPathCompareDefault, 965 MESSAGING_DEVICE_PATH, 966 MSG_SCSI_DP, 967 DevPathSerialScsi, 968 DevPathCompareDefault, 969 MESSAGING_DEVICE_PATH, 970 MSG_FIBRECHANNEL_DP, 971 DevPathSerialFibre, 972 DevPathCompareDefault, 973 MESSAGING_DEVICE_PATH, 974 MSG_1394_DP, 975 DevPathSerial1394, 976 DevPathCompareDefault, 977 MESSAGING_DEVICE_PATH, 978 MSG_USB_DP, 979 DevPathSerialUsb, 980 DevPathCompareDefault, 981 MESSAGING_DEVICE_PATH, 982 MSG_I2O_DP, 983 DevPathSerialI2O, 984 DevPathCompareDefault, 985 MESSAGING_DEVICE_PATH, 986 MSG_MAC_ADDR_DP, 987 DevPathSerialMacAddr, 988 DevPathCompareDefault, 989 MESSAGING_DEVICE_PATH, 990 MSG_IPv4_DP, 991 DevPathSerialIPv4, 992 DevPathCompareDefault, 993 MESSAGING_DEVICE_PATH, 994 MSG_IPv6_DP, 995 DevPathSerialIPv6, 996 DevPathCompareDefault, 997 MESSAGING_DEVICE_PATH, 998 MSG_INFINIBAND_DP, 999 DevPathSerialInfiniBand, 1000 DevPathCompareDefault, 1001 MESSAGING_DEVICE_PATH, 1002 MSG_UART_DP, 1003 DevPathSerialUart, 1004 DevPathCompareDefault, 1005 MESSAGING_DEVICE_PATH, 1006 MSG_VENDOR_DP, 1007 DevPathSerialVendor, 1008 DevPathCompareDefault, 1009 MESSAGING_DEVICE_PATH, 1010 MSG_DEVICE_LOGICAL_UNIT_DP, 1011 DevPathSerialLun, 1012 DevPathCompareDefault, 1013 MESSAGING_DEVICE_PATH, 1014 MSG_SATA_DP, 1015 DevPathSerialSata, 1016 DevPathCompareDefault, 1017 MESSAGING_DEVICE_PATH, 1018 MSG_ISCSI_DP, 1019 DevPathSerialIScsi, 1020 DevPathCompareDefault, 1021 MEDIA_DEVICE_PATH, 1022 MEDIA_HARDDRIVE_DP, 1023 DevPathSerialHardDrive, 1024 DevPathCompareDefault, 1025 MEDIA_DEVICE_PATH, 1026 MEDIA_CDROM_DP, 1027 DevPathSerialCdRom, 1028 DevPathCompareDefault, 1029 MEDIA_DEVICE_PATH, 1030 MEDIA_VENDOR_DP, 1031 DevPathSerialVendor, 1032 DevPathCompareDefault, 1033 0, 1034 0, 1035 NULL, 1036 NULL 953 { 954 HARDWARE_DEVICE_PATH, 955 HW_PCI_DP, 956 DevPathSerialDefault, 957 DevPathComparePci 958 }, 959 { 960 ACPI_DEVICE_PATH, 961 ACPI_DP, 962 DevPathSerialAcpi, 963 DevPathCompareAcpi 964 }, 965 { 966 MESSAGING_DEVICE_PATH, 967 MSG_ATAPI_DP, 968 DevPathSerialAtapi, 969 DevPathCompareDefault 970 }, 971 { 972 MESSAGING_DEVICE_PATH, 973 MSG_SCSI_DP, 974 DevPathSerialScsi, 975 DevPathCompareDefault 976 }, 977 { 978 MESSAGING_DEVICE_PATH, 979 MSG_FIBRECHANNEL_DP, 980 DevPathSerialFibre, 981 DevPathCompareDefault 982 }, 983 { 984 MESSAGING_DEVICE_PATH, 985 MSG_1394_DP, 986 DevPathSerial1394, 987 DevPathCompareDefault 988 }, 989 { 990 MESSAGING_DEVICE_PATH, 991 MSG_USB_DP, 992 DevPathSerialUsb, 993 DevPathCompareDefault 994 }, 995 { 996 MESSAGING_DEVICE_PATH, 997 MSG_I2O_DP, 998 DevPathSerialI2O, 999 DevPathCompareDefault 1000 }, 1001 { 1002 MESSAGING_DEVICE_PATH, 1003 MSG_MAC_ADDR_DP, 1004 DevPathSerialMacAddr, 1005 DevPathCompareDefault 1006 }, 1007 { 1008 MESSAGING_DEVICE_PATH, 1009 MSG_IPv4_DP, 1010 DevPathSerialIPv4, 1011 DevPathCompareDefault 1012 }, 1013 { 1014 MESSAGING_DEVICE_PATH, 1015 MSG_IPv6_DP, 1016 DevPathSerialIPv6, 1017 DevPathCompareDefault 1018 }, 1019 { 1020 MESSAGING_DEVICE_PATH, 1021 MSG_INFINIBAND_DP, 1022 DevPathSerialInfiniBand, 1023 DevPathCompareDefault 1024 }, 1025 { 1026 MESSAGING_DEVICE_PATH, 1027 MSG_UART_DP, 1028 DevPathSerialUart, 1029 DevPathCompareDefault 1030 }, 1031 { 1032 MESSAGING_DEVICE_PATH, 1033 MSG_VENDOR_DP, 1034 DevPathSerialVendor, 1035 DevPathCompareDefault 1036 }, 1037 { 1038 MESSAGING_DEVICE_PATH, 1039 MSG_DEVICE_LOGICAL_UNIT_DP, 1040 DevPathSerialLun, 1041 DevPathCompareDefault 1042 }, 1043 { 1044 MESSAGING_DEVICE_PATH, 1045 MSG_SATA_DP, 1046 DevPathSerialSata, 1047 DevPathCompareDefault 1048 }, 1049 { 1050 MESSAGING_DEVICE_PATH, 1051 MSG_ISCSI_DP, 1052 DevPathSerialIScsi, 1053 DevPathCompareDefault 1054 }, 1055 { 1056 MEDIA_DEVICE_PATH, 1057 MEDIA_HARDDRIVE_DP, 1058 DevPathSerialHardDrive, 1059 DevPathCompareDefault 1060 }, 1061 { 1062 MEDIA_DEVICE_PATH, 1063 MEDIA_CDROM_DP, 1064 DevPathSerialCdRom, 1065 DevPathCompareDefault 1066 }, 1067 { 1068 MEDIA_DEVICE_PATH, 1069 MEDIA_VENDOR_DP, 1070 DevPathSerialVendor, 1071 DevPathCompareDefault 1072 }, 1073 { 1074 0, 1075 0, 1076 NULL, 1077 NULL 1078 } 1037 1079 }; 1038 1080 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.c
r48674 r58459 2 2 Provides interface to shell internal functions for shell commands. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2013-2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 14 15 15 16 #include "UefiShellCommandLib.h" 16 17 /// The tag for use in identifying UNICODE files.18 /// If the file is UNICODE, the first 16 bits of the file will equal this value.19 enum {20 gUnicodeFileTag = 0xFEFF21 };22 17 23 18 // STATIC local variables … … 37 32 // global variables required by library class. 38 33 EFI_UNICODE_COLLATION_PROTOCOL *gUnicodeCollation = NULL; 39 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gDevPathToText = NULL;40 34 SHELL_MAP_LIST gShellMapList; 41 35 SHELL_MAP_LIST *gShellCurDir = NULL; … … 61 55 if (gUnicodeCollation == NULL) { 62 56 Status = gBS->LocateProtocol(&gEfiUnicodeCollation2ProtocolGuid, NULL, (VOID**)&gUnicodeCollation); 63 if (EFI_ERROR(Status)) {64 return (EFI_DEVICE_ERROR);65 }66 }67 if (gDevPathToText == NULL) {68 Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid, NULL, (VOID**)&gDevPathToText);69 57 if (EFI_ERROR(Status)) { 70 58 return (EFI_DEVICE_ERROR); … … 115 103 116 104 /** 105 Frees list of file handles. 106 107 @param[in] List The list to free. 108 **/ 109 VOID 110 EFIAPI 111 FreeFileHandleList ( 112 IN BUFFER_LIST *List 113 ) 114 { 115 BUFFER_LIST *BufferListEntry; 116 117 if (List == NULL){ 118 return; 119 } 120 // 121 // enumerate through the buffer list and free all memory 122 // 123 for ( BufferListEntry = ( BUFFER_LIST *)GetFirstNode(&List->Link) 124 ; !IsListEmpty (&List->Link) 125 ; BufferListEntry = (BUFFER_LIST *)GetFirstNode(&List->Link) 126 ){ 127 RemoveEntryList(&BufferListEntry->Link); 128 ASSERT(BufferListEntry->Buffer != NULL); 129 SHELL_FREE_NON_NULL(((SHELL_COMMAND_FILE_HANDLE*)(BufferListEntry->Buffer))->Path); 130 SHELL_FREE_NON_NULL(BufferListEntry->Buffer); 131 SHELL_FREE_NON_NULL(BufferListEntry); 132 } 133 } 134 135 /** 117 136 Destructor for the library. free any resources. 118 137 … … 130 149 { 131 150 SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; 132 COMMAND_LIST*Node2;151 ALIAS_LIST *Node2; 133 152 SCRIPT_FILE_LIST *Node3; 134 153 SHELL_MAP_LIST *MapNode; … … 145 164 146 165 // 147 // enumerate through the init commandlist and free all memory166 // enumerate through the alias list and free all memory 148 167 // 149 168 while (!IsListEmpty (&mAliasList.Link)) { 150 Node2 = ( COMMAND_LIST *)GetFirstNode(&mAliasList.Link);169 Node2 = (ALIAS_LIST *)GetFirstNode(&mAliasList.Link); 151 170 RemoveEntryList(&Node2->Link); 152 171 SHELL_FREE_NON_NULL(Node2->CommandString); 153 FreePool(Node2); 172 SHELL_FREE_NON_NULL(Node2->Alias); 173 SHELL_FREE_NON_NULL(Node2); 154 174 DEBUG_CODE(Node2 = NULL;); 155 175 } … … 182 202 } 183 203 if (!IsListEmpty(&mFileHandleList.Link)){ 184 Free BufferList(&mFileHandleList);204 FreeFileHandleList(&mFileHandleList); 185 205 } 186 206 … … 190 210 191 211 gUnicodeCollation = NULL; 192 gDevPathToText = NULL;193 212 gShellCurDir = NULL; 194 213 … … 197 216 198 217 /** 199 Checks if a command is already on the list. 218 Find a dynamic command protocol instance given a command name string. 219 220 @param CommandString the command name string 221 222 @return instance the command protocol instance, if dynamic command instance found 223 @retval NULL no dynamic command protocol instance found for name 224 **/ 225 CONST EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL * 226 EFIAPI 227 ShellCommandFindDynamicCommand ( 228 IN CONST CHAR16 *CommandString 229 ) 230 { 231 EFI_STATUS Status; 232 EFI_HANDLE *CommandHandleList; 233 EFI_HANDLE *NextCommand; 234 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; 235 236 CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid); 237 if (CommandHandleList == NULL) { 238 // 239 // not found or out of resources 240 // 241 return NULL; 242 } 243 244 for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) { 245 Status = gBS->HandleProtocol( 246 *NextCommand, 247 &gEfiShellDynamicCommandProtocolGuid, 248 (VOID **)&DynamicCommand 249 ); 250 251 if (EFI_ERROR(Status)) { 252 continue; 253 } 254 255 if (gUnicodeCollation->StriColl( 256 gUnicodeCollation, 257 (CHAR16*)CommandString, 258 (CHAR16*)DynamicCommand->CommandName) == 0 259 ){ 260 FreePool(CommandHandleList); 261 return (DynamicCommand); 262 } 263 } 264 265 FreePool(CommandHandleList); 266 return (NULL); 267 } 268 269 /** 270 Checks if a command exists as a dynamic command protocol instance 200 271 201 272 @param[in] CommandString The command string to check for on the list. … … 203 274 BOOLEAN 204 275 EFIAPI 205 ShellCommandIsCommandOnList ( 206 IN CONST CHAR16 *CommandString 276 ShellCommandDynamicCommandExists ( 277 IN CONST CHAR16 *CommandString 278 ) 279 { 280 return (BOOLEAN) ((ShellCommandFindDynamicCommand(CommandString) != NULL)); 281 } 282 283 /** 284 Checks if a command is already on the internal command list. 285 286 @param[in] CommandString The command string to check for on the list. 287 **/ 288 BOOLEAN 289 EFIAPI 290 ShellCommandIsCommandOnInternalList( 291 IN CONST CHAR16 *CommandString 207 292 ) 208 293 { … … 234 319 235 320 /** 236 Get the help text for a command. 321 Checks if a command exists, either internally or through the dynamic command protocol. 322 323 @param[in] CommandString The command string to check for on the list. 324 **/ 325 BOOLEAN 326 EFIAPI 327 ShellCommandIsCommandOnList( 328 IN CONST CHAR16 *CommandString 329 ) 330 { 331 if (ShellCommandIsCommandOnInternalList(CommandString)) { 332 return TRUE; 333 } 334 335 return ShellCommandDynamicCommandExists(CommandString); 336 } 337 338 /** 339 Get the help text for a dynamic command. 340 341 @param[in] CommandString The command name. 342 343 @retval NULL No help text was found. 344 @return String of help text. Caller required to free. 345 **/ 346 CHAR16* 347 EFIAPI 348 ShellCommandGetDynamicCommandHelp( 349 IN CONST CHAR16 *CommandString 350 ) 351 { 352 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; 353 354 DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString); 355 if (DynamicCommand == NULL) { 356 return (NULL); 357 } 358 359 // 360 // TODO: how to get proper language? 361 // 362 return DynamicCommand->GetHelp(DynamicCommand, "en"); 363 } 364 365 /** 366 Get the help text for an internal command. 237 367 238 368 @param[in] CommandString The command name. … … 243 373 CHAR16* 244 374 EFIAPI 245 ShellCommandGet CommandHelp(375 ShellCommandGetInternalCommandHelp( 246 376 IN CONST CHAR16 *CommandString 247 377 ) … … 272 402 return (NULL); 273 403 } 404 405 /** 406 Get the help text for a command. 407 408 @param[in] CommandString The command name. 409 410 @retval NULL No help text was found. 411 @return String of help text.Caller reuiqred to free. 412 **/ 413 CHAR16* 414 EFIAPI 415 ShellCommandGetCommandHelp ( 416 IN CONST CHAR16 *CommandString 417 ) 418 { 419 CHAR16 *HelpStr; 420 HelpStr = ShellCommandGetInternalCommandHelp(CommandString); 421 422 if (HelpStr == NULL) { 423 HelpStr = ShellCommandGetDynamicCommandHelp(CommandString); 424 } 425 426 return HelpStr; 427 } 428 274 429 275 430 /** … … 334 489 { 335 490 SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; 491 SHELL_COMMAND_INTERNAL_LIST_ENTRY *Command; 492 SHELL_COMMAND_INTERNAL_LIST_ENTRY *PrevCommand; 493 INTN LexicalMatchValue; 494 495 // 496 // Initialize local variables. 497 // 498 Command = NULL; 499 PrevCommand = NULL; 500 LexicalMatchValue = 0; 336 501 337 502 // … … 362 527 Node = AllocateZeroPool(sizeof(SHELL_COMMAND_INTERNAL_LIST_ENTRY)); 363 528 ASSERT(Node != NULL); 364 Node->CommandString = Allocate ZeroPool(StrSize(CommandString));529 Node->CommandString = AllocateCopyPool(StrSize(CommandString), CommandString); 365 530 ASSERT(Node->CommandString != NULL); 366 367 //368 // populate the new struct369 //370 StrCpy(Node->CommandString, CommandString);371 531 372 532 Node->GetManFileName = GetManFileName; … … 392 552 393 553 // 394 // add the new struct to the list 395 // 396 InsertTailList (&mCommandList.Link, &Node->Link); 554 // Insert a new entry on top of the list 555 // 556 InsertHeadList (&mCommandList.Link, &Node->Link); 557 558 // 559 // Move a new registered command to its sorted ordered location in the list 560 // 561 for (Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link), 562 PrevCommand = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetFirstNode (&mCommandList.Link) 563 ; !IsNull (&mCommandList.Link, &Command->Link) 564 ; Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *)GetNextNode (&mCommandList.Link, &Command->Link)) { 565 566 // 567 // Get Lexical Comparison Value between PrevCommand and Command list entry 568 // 569 LexicalMatchValue = gUnicodeCollation->StriColl ( 570 gUnicodeCollation, 571 PrevCommand->CommandString, 572 Command->CommandString 573 ); 574 575 // 576 // Swap PrevCommand and Command list entry if PrevCommand list entry 577 // is alphabetically greater than Command list entry 578 // 579 if (LexicalMatchValue > 0){ 580 Command = (SHELL_COMMAND_INTERNAL_LIST_ENTRY *) SwapListEntries (&PrevCommand->Link, &Command->Link); 581 } else if (LexicalMatchValue < 0) { 582 // 583 // PrevCommand entry is lexically lower than Command entry 584 // 585 break; 586 } 587 } 397 588 398 589 return (RETURN_SUCCESS); … … 446 637 ) 447 638 { 448 SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; 639 SHELL_COMMAND_INTERNAL_LIST_ENTRY *Node; 640 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; 449 641 450 642 // … … 465 657 (CHAR16*)CommandString, 466 658 Node->CommandString) == 0 467 659 ){ 468 660 if (CanAffectLE != NULL) { 469 661 *CanAffectLE = Node->LastError; … … 477 669 } 478 670 } 671 672 // 673 // An internal command was not found, try to find a dynamic command 674 // 675 DynamicCommand = (EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *)ShellCommandFindDynamicCommand(CommandString); 676 if (DynamicCommand != NULL) { 677 if (RetVal != NULL) { 678 *RetVal = DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol); 679 } else { 680 DynamicCommand->Handler(DynamicCommand, gST, gEfiShellParametersProtocol, gEfiShellProtocol); 681 } 682 return (RETURN_SUCCESS); 683 } 684 479 685 return (RETURN_NOT_FOUND); 480 686 } … … 567 773 { 568 774 ALIAS_LIST *Node; 775 ALIAS_LIST *CommandAlias; 776 ALIAS_LIST *PrevCommandAlias; 777 INTN LexicalMatchValue; 569 778 570 779 // … … 579 788 Node = AllocateZeroPool(sizeof(ALIAS_LIST)); 580 789 ASSERT(Node != NULL); 581 Node->CommandString = Allocate ZeroPool(StrSize(Command));582 Node->Alias = Allocate ZeroPool(StrSize(Alias));790 Node->CommandString = AllocateCopyPool(StrSize(Command), Command); 791 Node->Alias = AllocateCopyPool(StrSize(Alias), Alias); 583 792 ASSERT(Node->CommandString != NULL); 584 793 ASSERT(Node->Alias != NULL); 585 794 586 // 587 // populate the new struct 588 // 589 StrCpy(Node->CommandString, Command); 590 StrCpy(Node->Alias , Alias ); 591 592 // 593 // add the new struct to the list 594 // 595 InsertTailList (&mAliasList.Link, &Node->Link); 795 InsertHeadList (&mAliasList.Link, &Node->Link); 796 797 // 798 // Move a new pre-defined registered alias to its sorted ordered location in the list 799 // 800 for ( CommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link), 801 PrevCommandAlias = (ALIAS_LIST *)GetFirstNode (&mAliasList.Link) 802 ; !IsNull (&mAliasList.Link, &CommandAlias->Link) 803 ; CommandAlias = (ALIAS_LIST *) GetNextNode (&mAliasList.Link, &CommandAlias->Link) ) { 804 // 805 // Get Lexical comparison value between PrevCommandAlias and CommandAlias List Entry 806 // 807 LexicalMatchValue = gUnicodeCollation->StriColl ( 808 gUnicodeCollation, 809 PrevCommandAlias->Alias, 810 CommandAlias->Alias 811 ); 812 813 // 814 // Swap PrevCommandAlias and CommandAlias list entry if PrevCommandAlias list entry 815 // is alphabetically greater than CommandAlias list entry 816 // 817 if (LexicalMatchValue > 0) { 818 CommandAlias = (ALIAS_LIST *) SwapListEntries (&PrevCommandAlias->Link, &CommandAlias->Link); 819 } else if (LexicalMatchValue < 0) { 820 // 821 // PrevCommandAlias entry is lexically lower than CommandAlias entry 822 // 823 break; 824 } 825 } 596 826 597 827 return (RETURN_SUCCESS); … … 663 893 664 894 /** 665 Function to determine current state of ECHO. Echo determin s if lines from scripts895 Function to determine current state of ECHO. Echo determines if lines from scripts 666 896 and ECHO commands are enabled. 667 897 … … 679 909 680 910 /** 681 Function to set current state of ECHO. Echo determin s if lines from scripts911 Function to set current state of ECHO. Echo determines if lines from scripts 682 912 and ECHO commands are enabled. 683 913 … … 936 1166 } else { 937 1167 MapListNode->Flags = Flags; 938 MapListNode->MapName = Allocate ZeroPool(StrSize(Name));1168 MapListNode->MapName = AllocateCopyPool(StrSize(Name), Name); 939 1169 MapListNode->DevicePath = DuplicateDevicePath(DevicePath); 940 1170 if ((MapListNode->MapName == NULL) || (MapListNode->DevicePath == NULL)){ 941 1171 Status = EFI_OUT_OF_RESOURCES; 942 1172 } else { 943 StrCpy(MapListNode->MapName, Name);944 1173 InsertTailList(&gShellMapList.Link, &MapListNode->Link); 945 1174 } … … 1143 1372 1144 1373 /** 1374 Add mappings for any devices without one. Do not change any existing maps. 1375 1376 @retval EFI_SUCCESS The operation was successful. 1377 **/ 1378 EFI_STATUS 1379 EFIAPI 1380 ShellCommandUpdateMapping ( 1381 VOID 1382 ) 1383 { 1384 EFI_STATUS Status; 1385 EFI_HANDLE *HandleList; 1386 UINTN Count; 1387 EFI_DEVICE_PATH_PROTOCOL **DevicePathList; 1388 CHAR16 *NewDefaultName; 1389 CHAR16 *NewConsistName; 1390 EFI_DEVICE_PATH_PROTOCOL **ConsistMappingTable; 1391 1392 HandleList = NULL; 1393 Status = EFI_SUCCESS; 1394 1395 // 1396 // remove mappings that represent removed devices. 1397 // 1398 1399 // 1400 // Find each handle with Simple File System 1401 // 1402 HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid); 1403 if (HandleList != NULL) { 1404 // 1405 // Do a count of the handles 1406 // 1407 for (Count = 0 ; HandleList[Count] != NULL ; Count++); 1408 1409 // 1410 // Get all Device Paths 1411 // 1412 DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count); 1413 if (DevicePathList == NULL) { 1414 return (EFI_OUT_OF_RESOURCES); 1415 } 1416 1417 for (Count = 0 ; HandleList[Count] != NULL ; Count++) { 1418 DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]); 1419 } 1420 1421 // 1422 // Sort all DevicePaths 1423 // 1424 PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare); 1425 1426 ShellCommandConsistMappingInitialize(&ConsistMappingTable); 1427 1428 // 1429 // Assign new Mappings to remainders 1430 // 1431 for (Count = 0 ; !EFI_ERROR(Status) && HandleList[Count] != NULL && !EFI_ERROR(Status); Count++) { 1432 // 1433 // Skip ones that already have 1434 // 1435 if (gEfiShellProtocol->GetMapFromDevicePath(&DevicePathList[Count]) != NULL) { 1436 continue; 1437 } 1438 // 1439 // Get default name 1440 // 1441 NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem); 1442 if (NewDefaultName == NULL) { 1443 Status = EFI_OUT_OF_RESOURCES; 1444 break; 1445 } 1446 1447 // 1448 // Call shell protocol SetMap function now... 1449 // 1450 Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewDefaultName); 1451 1452 if (!EFI_ERROR(Status)) { 1453 // 1454 // Now do consistent name 1455 // 1456 NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable); 1457 if (NewConsistName != NULL) { 1458 Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewConsistName); 1459 FreePool(NewConsistName); 1460 } 1461 } 1462 1463 FreePool(NewDefaultName); 1464 } 1465 ShellCommandConsistMappingUnInitialize(ConsistMappingTable); 1466 SHELL_FREE_NON_NULL(HandleList); 1467 SHELL_FREE_NON_NULL(DevicePathList); 1468 1469 HandleList = NULL; 1470 } else { 1471 Count = (UINTN)-1; 1472 } 1473 // 1474 // Do it all over again for gEfiBlockIoProtocolGuid 1475 // 1476 1477 return (Status); 1478 } 1479 1480 /** 1145 1481 Converts a SHELL_FILE_HANDLE to an EFI_FILE_PROTOCOL*. 1146 1482 … … 1184 1520 NewNode = AllocateZeroPool(sizeof(BUFFER_LIST)); 1185 1521 if (NewNode == NULL) { 1522 SHELL_FREE_NON_NULL(Buffer); 1186 1523 return (NULL); 1187 1524 } … … 1189 1526 Buffer->Path = StrnCatGrow(&Buffer->Path, NULL, Path, 0); 1190 1527 if (Buffer->Path == NULL) { 1528 SHELL_FREE_NON_NULL(NewNode); 1529 SHELL_FREE_NON_NULL(Buffer); 1191 1530 return (NULL); 1192 1531 } … … 1326 1665 ){ 1327 1666 RemoveEntryList(&BufferListEntry->Link); 1328 ASSERT(BufferListEntry->Buffer != NULL);1329 1667 if (BufferListEntry->Buffer != NULL) { 1330 1668 FreePool(BufferListEntry->Buffer); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.h
r48674 r58459 2 2 Provides interface to shell internal functions for shell commands. 3 3 4 Copyright (c) 2006 - 201 0, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 29 29 #include <Protocol/UnicodeCollation.h> 30 30 #include <Protocol/BlockIo.h> 31 #include <Protocol/EfiShellDynamicCommand.h> 31 32 32 33 #include <Library/DevicePathLib.h> -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
r48674 r58459 2 2 # Provides interface to shell internal functions for shell commands. 3 3 # 4 # Copyright (c) 2006 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 20 20 MODULE_TYPE = UEFI_DRIVER 21 21 VERSION_STRING = 1.0 22 LIBRARY_CLASS = ShellCommandLib|UEFI_APPLICATION UEFI_DRIVER 22 LIBRARY_CLASS = ShellCommandLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER 23 23 CONSTRUCTOR = ShellCommandLibConstructor 24 24 DESTRUCTOR = ShellCommandLibDestructor … … 47 47 ShellLib 48 48 HiiLib 49 HandleParsingLib 49 50 50 51 [Protocols] 51 gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED52 gEfiShellProtocolGuid # ALWAYS_CONSUMED53 gEfiShellParametersProtocolGuid # ALWAYS_CONSUMED54 gEfi DevicePathToTextProtocolGuid # ALWAYS_CONSUMED52 gEfiUnicodeCollation2ProtocolGuid ## CONSUMES 53 gEfiShellProtocolGuid ## CONSUMES 54 gEfiShellParametersProtocolGuid ## CONSUMES 55 gEfiShellDynamicCommandProtocolGuid ## SOMETIMES_CONSUMES 55 56 56 57 [Guids] 57 gEfiSasDevicePathGuid # ALWAYS_CONSUMED58 gEfiSasDevicePathGuid ## CONSUMES ## GUID 58 59 59 60 [Pcd.common] 60 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## ALWAYS_CONSUMED 61 gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength ## ALWAYS_CONSUMED 61 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES 62 gEfiShellPkgTokenSpaceGuid.PcdShellMapNameLength ## CONSUMES 63 64 [Depex] 65 gEfiUnicodeCollation2ProtocolGuid -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Comp.c
r48674 r58459 2 2 Main file for Comp shell Debug1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 51 51 CHAR16 *FileName2; 52 52 CONST CHAR16 *TempParam; 53 UINTN ErrorAddress; 53 54 54 55 ErrorCount = 0; … … 137 138 ASSERT_EFI_ERROR(Status); 138 139 if (DataFromFile1 != DataFromFile2) { 140 ErrorAddress = LoopVar; 139 141 ADF_File11 = 0; 140 142 ADF_File12 = 0; … … 143 145 ADF_File22 = 0; 144 146 ADF_File23 = 0; 147 148 // 149 // Now check the next 3 bytes if possible. This will make output 150 // cleaner when there are a sequence of differences. 151 // 145 152 if (LoopVar + 1 < Size1) { 146 153 LoopVar++; … … 170 177 } 171 178 } 179 180 // 181 // Print out based on highest of the 4 bytes that are different. 182 // 172 183 if (ADF_File13 != ADF_File23) { 173 184 ShellPrintHiiEx( … … 179 190 ++ErrorCount, 180 191 FileName1, 181 LoopVar,192 ErrorAddress, 182 193 DataFromFile1, ADF_File11, ADF_File12, ADF_File13, 183 194 DataFromFile1, ADF_File11, ADF_File12, ADF_File13, 184 195 FileName2, 185 LoopVar,196 ErrorAddress, 186 197 DataFromFile2, ADF_File21, ADF_File22, ADF_File23, 187 198 DataFromFile2, ADF_File21, ADF_File22, ADF_File23 … … 196 207 ++ErrorCount, 197 208 FileName1, 198 LoopVar,209 ErrorAddress, 199 210 DataFromFile1, ADF_File11, ADF_File12, 200 211 DataFromFile1, ADF_File11, ADF_File12, 201 212 FileName2, 202 LoopVar,213 ErrorAddress, 203 214 DataFromFile2, ADF_File21, ADF_File22, 204 215 DataFromFile2, ADF_File21, ADF_File22 … … 213 224 ++ErrorCount, 214 225 FileName1, 215 LoopVar,226 ErrorAddress, 216 227 DataFromFile1, ADF_File11, 217 228 DataFromFile1, ADF_File11, 218 229 FileName2, 219 LoopVar,230 ErrorAddress, 220 231 DataFromFile2, ADF_File21, 221 232 DataFromFile2, ADF_File21 … … 230 241 ++ErrorCount, 231 242 FileName1, 232 LoopVar,243 ErrorAddress, 233 244 DataFromFile1, 234 245 DataFromFile1, 235 246 FileName2, 236 LoopVar,247 ErrorAddress, 237 248 DataFromFile2, 238 249 DataFromFile2 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Compress.c
r48674 r58459 8 8 are applied to each Block. 9 9 10 Copyright (c) 2007 - 201 1, Intel Corporation. All rights reserved.<BR>10 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR> 11 11 This program and the accompanying materials 12 12 are licensed and made available under the terms and conditions of the BSD License … … 23 23 #include <Library/DebugLib.h> 24 24 #include <ShellBase.h> 25 #include <Uefi.h> 25 26 26 27 // -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Dmem.c
r48674 r58459 75 75 } else { 76 76 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size); 77 DumpHex(2, 0,Size,Buffer);77 DumpHex(2, (UINTN)Address, Size, Buffer); 78 78 } 79 79 … … 169 169 if (!ShellCommandLineGetFlag(Package, L"-mmio")) { 170 170 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)(UINTN)Address, Size); 171 DumpHex(2, 0,(UINTN)Size,Address);171 DumpHex(2, (UINTN)Address, (UINTN)Size, Address); 172 172 if (Address == (VOID*)gST) { 173 173 Acpi20TableAddress = 0; -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
r48674 r58459 1 1 /** @file 2 2 Main file for DmpStore shell Debug1 function. 3 4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> 3 4 (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 15 16 #include "UefiShellDebug1CommandsLib.h" 16 17 17 STATIC CHAR16 *AttrType[] = { 18 L"invalid", // 000 19 L"invalid", // 001 20 L"BS", // 010 21 L"NV+BS", // 011 22 L"RT+BS", // 100 23 L"NV+RT+BS", // 101 24 L"RT+BS", // 110 25 L"NV+RT+BS", // 111 26 }; 18 typedef enum { 19 DmpStoreDisplay, 20 DmpStoreDelete, 21 DmpStoreSave, 22 DmpStoreLoad 23 } DMP_STORE_TYPE; 24 25 typedef struct { 26 UINT32 Signature; 27 CHAR16 *Name; 28 EFI_GUID Guid; 29 UINT32 Attributes; 30 UINT32 DataSize; 31 UINT8 *Data; 32 LIST_ENTRY Link; 33 } DMP_STORE_VARIABLE; 34 35 #define DMP_STORE_VARIABLE_SIGNATURE SIGNATURE_32 ('_', 'd', 's', 's') 27 36 28 37 /** 29 Function to display or delete variables. 30 31 @param[in] VariableName The variable name of the EFI variable (or NULL). 38 Base on the input attribute value to return the attribute string. 39 40 @param[in] Atts The input attribute value 41 42 @retval The attribute string info. 43 **/ 44 CHAR16 * 45 EFIAPI 46 GetAttrType ( 47 IN CONST UINT32 Atts 48 ) 49 { 50 UINTN BufLen; 51 CHAR16 *RetString; 52 53 BufLen = 0; 54 RetString = NULL; 55 56 if ((Atts & EFI_VARIABLE_NON_VOLATILE) != 0) { 57 StrnCatGrow (&RetString, &BufLen, L"+NV", 0); 58 } 59 if ((Atts & EFI_VARIABLE_RUNTIME_ACCESS) != 0) { 60 StrnCatGrow (&RetString, &BufLen, L"+RT+BS", 0); 61 } else if ((Atts & EFI_VARIABLE_BOOTSERVICE_ACCESS) != 0) { 62 StrnCatGrow (&RetString, &BufLen, L"+BS", 0); 63 } 64 if ((Atts & EFI_VARIABLE_HARDWARE_ERROR_RECORD) != 0) { 65 StrnCatGrow (&RetString, &BufLen, L"+HR", 0); 66 } 67 if ((Atts & EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) != 0) { 68 StrnCatGrow (&RetString, &BufLen, L"+AW", 0); 69 } 70 if ((Atts & EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS) != 0) { 71 StrnCatGrow (&RetString, &BufLen, L"+AT", 0); 72 } 73 74 if (RetString == NULL) { 75 RetString = StrnCatGrow(&RetString, &BufLen, L"Invalid", 0); 76 } 77 78 if ((RetString != NULL) && (RetString[0] == L'+')) { 79 CopyMem(RetString, RetString + 1, StrSize(RetString + 1)); 80 } 81 82 return RetString; 83 } 84 85 /** 86 Load the variable data from file and set to variable data base. 87 88 @param[in] FileHandle The file to be read. 89 @param[in] Name The name of the variables to be loaded. 90 @param[in] Guid The guid of the variables to be loaded. 91 @param[out] Found TRUE when at least one variable was loaded and set. 92 93 @retval SHELL_DEVICE_ERROR Cannot access the file. 94 @retval SHELL_VOLUME_CORRUPTED The file is in bad format. 95 @retval SHELL_OUT_OF_RESOURCES There is not enough memory to perform the operation. 96 @retval SHELL_SUCCESS Successfully load and set the variables. 97 **/ 98 SHELL_STATUS 99 LoadVariablesFromFile ( 100 IN SHELL_FILE_HANDLE FileHandle, 101 IN CONST CHAR16 *Name, 102 IN CONST EFI_GUID *Guid, 103 OUT BOOLEAN *Found 104 ) 105 { 106 EFI_STATUS Status; 107 SHELL_STATUS ShellStatus; 108 UINT32 NameSize; 109 UINT32 DataSize; 110 UINTN BufferSize; 111 UINTN RemainingSize; 112 UINT64 Position; 113 UINT64 FileSize; 114 LIST_ENTRY List; 115 DMP_STORE_VARIABLE *Variable; 116 LIST_ENTRY *Link; 117 CHAR16 *Attributes; 118 UINT8 *Buffer; 119 UINT32 Crc32; 120 121 Status = ShellGetFileSize (FileHandle, &FileSize); 122 if (EFI_ERROR (Status)) { 123 return SHELL_DEVICE_ERROR; 124 } 125 126 ShellStatus = SHELL_SUCCESS; 127 128 InitializeListHead (&List); 129 130 Position = 0; 131 while (Position < FileSize) { 132 // 133 // NameSize 134 // 135 BufferSize = sizeof (NameSize); 136 Status = ShellReadFile (FileHandle, &BufferSize, &NameSize); 137 if (EFI_ERROR (Status) || (BufferSize != sizeof (NameSize))) { 138 ShellStatus = SHELL_VOLUME_CORRUPTED; 139 break; 140 } 141 142 // 143 // DataSize 144 // 145 BufferSize = sizeof (DataSize); 146 Status = ShellReadFile (FileHandle, &BufferSize, &DataSize); 147 if (EFI_ERROR (Status) || (BufferSize != sizeof (DataSize))) { 148 ShellStatus = SHELL_VOLUME_CORRUPTED; 149 break; 150 } 151 152 // 153 // Name, Guid, Attributes, Data, Crc32 154 // 155 RemainingSize = NameSize + sizeof (EFI_GUID) + sizeof (UINT32) + DataSize + sizeof (Crc32); 156 BufferSize = sizeof (NameSize) + sizeof (DataSize) + RemainingSize; 157 Buffer = AllocatePool (BufferSize); 158 if (Buffer == NULL) { 159 ShellStatus = SHELL_OUT_OF_RESOURCES; 160 break; 161 } 162 BufferSize = RemainingSize; 163 Status = ShellReadFile (FileHandle, &BufferSize, (UINT32 *) Buffer + 2); 164 if (EFI_ERROR (Status) || (BufferSize != RemainingSize)) { 165 ShellStatus = SHELL_VOLUME_CORRUPTED; 166 FreePool (Buffer); 167 break; 168 } 169 170 // 171 // Check Crc32 172 // 173 * (UINT32 *) Buffer = NameSize; 174 * ((UINT32 *) Buffer + 1) = DataSize; 175 BufferSize = RemainingSize + sizeof (NameSize) + sizeof (DataSize) - sizeof (Crc32); 176 gBS->CalculateCrc32 ( 177 Buffer, 178 BufferSize, 179 &Crc32 180 ); 181 if (Crc32 != * (UINT32 *) (Buffer + BufferSize)) { 182 FreePool (Buffer); 183 ShellStatus = SHELL_VOLUME_CORRUPTED; 184 break; 185 } 186 187 Position += BufferSize + sizeof (Crc32); 188 189 Variable = AllocateZeroPool (sizeof (*Variable) + NameSize + DataSize); 190 if (Variable == NULL) { 191 FreePool (Buffer); 192 ShellStatus = SHELL_OUT_OF_RESOURCES; 193 break; 194 } 195 Variable->Signature = DMP_STORE_VARIABLE_SIGNATURE; 196 Variable->Name = (CHAR16 *) (Variable + 1); 197 Variable->DataSize = DataSize; 198 Variable->Data = (UINT8 *) Variable->Name + NameSize; 199 CopyMem (Variable->Name, Buffer + sizeof (NameSize) + sizeof (DataSize), NameSize); 200 CopyMem (&Variable->Guid, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize, sizeof (EFI_GUID)); 201 CopyMem (&Variable->Attributes, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID), sizeof (UINT32)); 202 CopyMem (Variable->Data, Buffer + sizeof (NameSize) + sizeof (DataSize) + NameSize + sizeof (EFI_GUID) + sizeof (UINT32), DataSize); 203 204 InsertTailList (&List, &Variable->Link); 205 FreePool (Buffer); 206 } 207 208 if ((Position != FileSize) || (ShellStatus != SHELL_SUCCESS)) { 209 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_BAD_FILE), gShellDebug1HiiHandle); 210 if (Position != FileSize) { 211 ShellStatus = SHELL_VOLUME_CORRUPTED; 212 } 213 } 214 215 for ( Link = GetFirstNode (&List) 216 ; !IsNull (&List, Link) && (ShellStatus == SHELL_SUCCESS) 217 ; Link = GetNextNode (&List, Link) 218 ) { 219 Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE); 220 221 if (((Name == NULL) || gUnicodeCollation->MetaiMatch (gUnicodeCollation, Variable->Name, (CHAR16 *) Name)) && 222 ((Guid == NULL) || CompareGuid (&Variable->Guid, Guid)) 223 ) { 224 Attributes = GetAttrType (Variable->Attributes); 225 ShellPrintHiiEx ( 226 -1, -1, NULL, STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), gShellDebug1HiiHandle, 227 Attributes, &Variable->Guid, Variable->Name, Variable->DataSize 228 ); 229 SHELL_FREE_NON_NULL(Attributes); 230 231 *Found = TRUE; 232 Status = gRT->SetVariable ( 233 Variable->Name, 234 &Variable->Guid, 235 Variable->Attributes, 236 Variable->DataSize, 237 Variable->Data 238 ); 239 if (EFI_ERROR (Status)) { 240 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD_GEN_FAIL), gShellDebug1HiiHandle, Variable->Name, Status); 241 } 242 } 243 } 244 245 for (Link = GetFirstNode (&List); !IsNull (&List, Link); ) { 246 Variable = CR (Link, DMP_STORE_VARIABLE, Link, DMP_STORE_VARIABLE_SIGNATURE); 247 Link = RemoveEntryList (&Variable->Link); 248 FreePool (Variable); 249 } 250 251 return ShellStatus; 252 } 253 254 /** 255 Append one variable to file. 256 257 @param[in] FileHandle The file to be appended. 258 @param[in] Name The variable name. 259 @param[in] Guid The variable GUID. 260 @param[in] Attributes The variable attributes. 261 @param[in] DataSize The variable data size. 262 @param[in] Data The variable data. 263 264 @retval EFI_OUT_OF_RESOURCES There is not enough memory to perform the operation. 265 @retval EFI_SUCCESS The variable is appended to file successfully. 266 @retval others Failed to append the variable to file. 267 **/ 268 EFI_STATUS 269 AppendSingleVariableToFile ( 270 IN SHELL_FILE_HANDLE FileHandle, 271 IN CONST CHAR16 *Name, 272 IN CONST EFI_GUID *Guid, 273 IN UINT32 Attributes, 274 IN UINT32 DataSize, 275 IN CONST UINT8 *Data 276 ) 277 { 278 UINT32 NameSize; 279 UINT8 *Buffer; 280 UINT8 *Ptr; 281 UINTN BufferSize; 282 EFI_STATUS Status; 283 284 NameSize = (UINT32) StrSize (Name); 285 BufferSize = sizeof (NameSize) + sizeof (DataSize) 286 + sizeof (*Guid) 287 + sizeof (Attributes) 288 + NameSize + DataSize 289 + sizeof (UINT32); 290 291 Buffer = AllocatePool (BufferSize); 292 if (Buffer == NULL) { 293 return EFI_OUT_OF_RESOURCES; 294 } 295 296 Ptr = Buffer; 297 // 298 // NameSize and DataSize 299 // 300 * (UINT32 *) Ptr = NameSize; 301 Ptr += sizeof (NameSize); 302 *(UINT32 *) Ptr = DataSize; 303 Ptr += sizeof (DataSize); 304 305 // 306 // Name 307 // 308 CopyMem (Ptr, Name, NameSize); 309 Ptr += NameSize; 310 311 // 312 // Guid 313 // 314 CopyMem (Ptr, Guid, sizeof (*Guid)); 315 Ptr += sizeof (*Guid); 316 317 // 318 // Attributes 319 // 320 * (UINT32 *) Ptr = Attributes; 321 Ptr += sizeof (Attributes); 322 323 // 324 // Data 325 // 326 CopyMem (Ptr, Data, DataSize); 327 Ptr += DataSize; 328 329 // 330 // Crc32 331 // 332 gBS->CalculateCrc32 (Buffer, (UINTN) (Ptr - Buffer), (UINT32 *) Ptr); 333 334 Status = ShellWriteFile (FileHandle, &BufferSize, Buffer); 335 FreePool (Buffer); 336 337 if (!EFI_ERROR (Status) && 338 (BufferSize != sizeof (NameSize) + sizeof (DataSize) + sizeof (*Guid) + sizeof (Attributes) + NameSize + DataSize) 339 ) { 340 Status = EFI_DEVICE_ERROR; 341 } 342 343 return Status; 344 } 345 346 /** 347 Recursive function to display or delete variables. 348 349 This function will call itself to create a stack-based list of allt he variables to process, 350 then fromt he last to the first, they will do either printing or deleting. 351 352 This is necessary since once a delete happens GetNextVariableName() will work. 353 354 @param[in] Name The variable name of the EFI variable (or NULL). 32 355 @param[in] Guid The GUID of the variable set (or NULL). 33 @param[in] Delete TRUE to delete, FALSE otherwise. 356 @param[in] Type The operation type. 357 @param[in] FileHandle The file to operate on (or NULL). 358 @param[in] PrevName The previous variable name from GetNextVariableName. L"" to start. 359 @param[in] FoundVarGuid The previous GUID from GetNextVariableName. ignored at start. 360 @param[in] FoundOne If a VariableName or Guid was specified and one was printed or 361 deleted, then set this to TRUE, otherwise ignored. 362 363 @retval SHELL_SUCCESS The operation was successful. 364 @retval SHELL_OUT_OF_RESOURCES A memorty allocation failed. 365 @retval SHELL_ABORTED The abort message was received. 366 @retval SHELL_DEVICE_ERROR UEFI Variable Services returned an error. 367 @retval SHELL_NOT_FOUND the Name/Guid pair could not be found. 368 **/ 369 SHELL_STATUS 370 EFIAPI 371 CascadeProcessVariables ( 372 IN CONST CHAR16 *Name OPTIONAL, 373 IN CONST EFI_GUID *Guid OPTIONAL, 374 IN DMP_STORE_TYPE Type, 375 IN EFI_FILE_PROTOCOL *FileHandle OPTIONAL, 376 IN CONST CHAR16 * CONST PrevName, 377 IN EFI_GUID FoundVarGuid, 378 IN BOOLEAN *FoundOne 379 ) 380 { 381 EFI_STATUS Status; 382 CHAR16 *FoundVarName; 383 UINT8 *DataBuffer; 384 UINTN DataSize; 385 UINT32 Atts; 386 SHELL_STATUS ShellStatus; 387 UINTN NameSize; 388 CHAR16 *RetString; 389 390 if (ShellGetExecutionBreakFlag()) { 391 return (SHELL_ABORTED); 392 } 393 394 NameSize = 0; 395 FoundVarName = NULL; 396 397 if (PrevName!=NULL) { 398 StrnCatGrow(&FoundVarName, &NameSize, PrevName, 0); 399 } else { 400 FoundVarName = AllocateZeroPool(sizeof(CHAR16)); 401 } 402 403 Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid); 404 if (Status == EFI_BUFFER_TOO_SMALL) { 405 SHELL_FREE_NON_NULL(FoundVarName); 406 FoundVarName = AllocateZeroPool (NameSize); 407 if (FoundVarName != NULL) { 408 if (PrevName != NULL) { 409 StrnCpy(FoundVarName, PrevName, NameSize/sizeof(CHAR16)-1); 410 } 411 412 Status = gRT->GetNextVariableName (&NameSize, FoundVarName, &FoundVarGuid); 413 } else { 414 Status = EFI_OUT_OF_RESOURCES; 415 } 416 } 417 418 // 419 // No more is fine. 420 // 421 if (Status == EFI_NOT_FOUND) { 422 SHELL_FREE_NON_NULL(FoundVarName); 423 return (SHELL_SUCCESS); 424 } else if (EFI_ERROR(Status)) { 425 SHELL_FREE_NON_NULL(FoundVarName); 426 return (SHELL_DEVICE_ERROR); 427 } 428 429 // 430 // Recurse to the next iteration. We know "our" variable's name. 431 // 432 ShellStatus = CascadeProcessVariables(Name, Guid, Type, FileHandle, FoundVarName, FoundVarGuid, FoundOne); 433 434 if (ShellGetExecutionBreakFlag() || (ShellStatus == SHELL_ABORTED)) { 435 SHELL_FREE_NON_NULL(FoundVarName); 436 return (SHELL_ABORTED); 437 } 438 439 // 440 // No matter what happened we process our own variable 441 // Only continue if Guid and VariableName are each either NULL or a match 442 // 443 if ( ( Name == NULL 444 || gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*) Name) ) 445 && ( Guid == NULL 446 || CompareGuid(&FoundVarGuid, Guid) ) 447 ) { 448 DataSize = 0; 449 DataBuffer = NULL; 450 // 451 // do the print or delete 452 // 453 *FoundOne = TRUE; 454 Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer); 455 if (Status == EFI_BUFFER_TOO_SMALL) { 456 SHELL_FREE_NON_NULL (DataBuffer); 457 DataBuffer = AllocatePool (DataSize); 458 if (DataBuffer == NULL) { 459 Status = EFI_OUT_OF_RESOURCES; 460 } else { 461 Status = gRT->GetVariable (FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer); 462 } 463 } 464 if ((Type == DmpStoreDisplay) || (Type == DmpStoreSave)) { 465 // 466 // Last error check then print this variable out. 467 // 468 if (!EFI_ERROR(Status) && (DataBuffer != NULL) && (FoundVarName != NULL)) { 469 RetString = GetAttrType(Atts); 470 ShellPrintHiiEx( 471 -1, 472 -1, 473 NULL, 474 STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), 475 gShellDebug1HiiHandle, 476 RetString, 477 &FoundVarGuid, 478 FoundVarName, 479 DataSize); 480 if (Type == DmpStoreDisplay) { 481 DumpHex(2, 0, DataSize, DataBuffer); 482 } else { 483 Status = AppendSingleVariableToFile ( 484 FileHandle, 485 FoundVarName, 486 &FoundVarGuid, 487 Atts, 488 (UINT32) DataSize, 489 DataBuffer 490 ); 491 } 492 SHELL_FREE_NON_NULL(RetString); 493 } 494 } else if (Type == DmpStoreDelete) { 495 // 496 // We only need name to delete it... 497 // 498 ShellPrintHiiEx ( 499 -1, 500 -1, 501 NULL, 502 STRING_TOKEN(STR_DMPSTORE_DELETE_LINE), 503 gShellDebug1HiiHandle, 504 &FoundVarGuid, 505 FoundVarName, 506 gRT->SetVariable (FoundVarName, &FoundVarGuid, Atts, 0, NULL) 507 ); 508 } 509 SHELL_FREE_NON_NULL(DataBuffer); 510 } 511 512 SHELL_FREE_NON_NULL(FoundVarName); 513 514 if (Status == EFI_DEVICE_ERROR) { 515 ShellStatus = SHELL_DEVICE_ERROR; 516 } else if (Status == EFI_SECURITY_VIOLATION) { 517 ShellStatus = SHELL_SECURITY_VIOLATION; 518 } else if (EFI_ERROR(Status)) { 519 ShellStatus = SHELL_NOT_READY; 520 } 521 522 return (ShellStatus); 523 } 524 525 /** 526 Function to display or delete variables. This will set up and call into the recursive function. 527 528 @param[in] Name The variable name of the EFI variable (or NULL). 529 @param[in] Guid The GUID of the variable set (or NULL). 530 @param[in] Type The operation type. 531 @param[in] FileHandle The file to save or load variables. 34 532 35 533 @retval SHELL_SUCCESS The operation was successful. … … 42 540 EFIAPI 43 541 ProcessVariables ( 44 IN CONST CHAR16 *VariableName OPTIONAL, 45 IN CONST EFI_GUID *Guid OPTIONAL, 46 IN BOOLEAN Delete 542 IN CONST CHAR16 *Name OPTIONAL, 543 IN CONST EFI_GUID *Guid OPTIONAL, 544 IN DMP_STORE_TYPE Type, 545 IN SHELL_FILE_HANDLE FileHandle OPTIONAL 47 546 ) 48 547 { 49 EFI_STATUS Status;50 UINT64 MaxStorSize;51 UINT64 RemStorSize;52 UINT64 MaxVarSize;53 CHAR16 *FoundVarName;54 UINTN Size;55 EFI_GUID FoundVarGuid;56 UINT8 *DataBuffer;57 UINTN DataSize;58 UINT32 Atts;59 548 SHELL_STATUS ShellStatus; 60 549 BOOLEAN Found; 61 62 Status = gRT->QueryVariableInfo(EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS|EFI_VARIABLE_NON_VOLATILE, &MaxStorSize, &RemStorSize, &MaxVarSize); 63 if (EFI_ERROR(Status)) { 64 return (SHELL_DEVICE_ERROR); 65 } 550 EFI_GUID FoundVarGuid; 66 551 67 552 Found = FALSE; 68 553 ShellStatus = SHELL_SUCCESS; 69 Size = PcdGet16(PcdShellFileOperationSize); 70 FoundVarName = AllocateZeroPool(Size); 71 72 if (FoundVarName == NULL) { 73 return (SHELL_OUT_OF_RESOURCES); 74 } 75 FoundVarName[0] = CHAR_NULL; 76 77 78 DataSize = (UINTN)MaxVarSize; 79 DataBuffer = AllocateZeroPool(DataSize); 80 if (DataBuffer == NULL) { 81 FreePool(FoundVarName); 82 return (SHELL_OUT_OF_RESOURCES); 83 } 84 85 for (;;){ 86 if (ShellGetExecutionBreakFlag()) { 87 ShellStatus = SHELL_ABORTED; 88 break; 89 } 90 Size = (UINTN)PcdGet16(PcdShellFileOperationSize); 91 DataSize = (UINTN)MaxVarSize; 92 93 Status = gRT->GetNextVariableName(&Size, FoundVarName, &FoundVarGuid); 94 if (Status == EFI_NOT_FOUND) { 95 break; 96 } 97 ASSERT_EFI_ERROR(Status); 98 99 Status = gRT->GetVariable(FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer); 100 ASSERT_EFI_ERROR(Status); 101 102 // 103 // Check if it matches 104 // 105 if (VariableName != NULL) { 106 if (!gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*)VariableName)) { 107 continue; 108 } 109 } 110 if (Guid != NULL) { 111 if (!CompareGuid(&FoundVarGuid, Guid)) { 112 continue; 113 } 114 } 115 116 // 117 // do the print or delete 118 // 119 Found = TRUE; 120 if (!Delete) { 121 ShellPrintHiiEx( 122 -1, 123 -1, 124 NULL, 125 STRING_TOKEN(STR_DMPSTORE_HEADER_LINE), 126 gShellDebug1HiiHandle, 127 AttrType[Atts & 7], 128 &FoundVarGuid, 129 FoundVarName, 130 DataSize); 131 DumpHex(2, 0, DataSize, DataBuffer); 132 } else { 133 ShellPrintHiiEx( 134 -1, 135 -1, 136 NULL, 137 STRING_TOKEN(STR_DMPSTORE_DELETE_LINE), 138 gShellDebug1HiiHandle, 139 &FoundVarGuid, 140 FoundVarName); 141 ShellPrintHiiEx( 142 -1, 143 -1, 144 NULL, 145 STRING_TOKEN(STR_DMPSTORE_DELETE_DONE), 146 gShellDebug1HiiHandle, 147 gRT->SetVariable(FoundVarName, &FoundVarGuid, Atts, 0, NULL)); 148 } 149 } 150 151 if (FoundVarName != NULL) { 152 FreePool(FoundVarName); 153 } 154 if (DataBuffer != NULL) { 155 FreePool(DataBuffer); 156 } 554 ZeroMem (&FoundVarGuid, sizeof(EFI_GUID)); 555 556 if (Type == DmpStoreLoad) { 557 ShellStatus = LoadVariablesFromFile (FileHandle, Name, Guid, &Found); 558 } else { 559 ShellStatus = CascadeProcessVariables(Name, Guid, Type, FileHandle, NULL, FoundVarGuid, &Found); 560 } 561 157 562 if (!Found) { 158 if (VariableName != NULL && Guid == NULL) { 159 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, VariableName); 160 } else if (VariableName != NULL && Guid != NULL) { 161 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, Guid, VariableName); 162 } else if (VariableName == NULL && Guid == NULL) { 563 if (ShellStatus == SHELL_OUT_OF_RESOURCES) { 564 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle); 565 return (ShellStatus); 566 } else if (Name != NULL && Guid == NULL) { 567 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_N), gShellDebug1HiiHandle, Name); 568 } else if (Name != NULL && Guid != NULL) { 569 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_GN), gShellDebug1HiiHandle, Guid, Name); 570 } else if (Name == NULL && Guid == NULL) { 163 571 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND), gShellDebug1HiiHandle); 164 } else if ( VariableName == NULL && Guid != NULL) {572 } else if (Name == NULL && Guid != NULL) { 165 573 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_NO_VAR_FOUND_G), gShellDebug1HiiHandle, Guid); 166 574 } 167 575 return (SHELL_NOT_FOUND); 168 576 } 169 return (S HELL_SUCCESS);577 return (ShellStatus); 170 578 } 171 579 172 580 STATIC CONST SHELL_PARAM_ITEM ParamList[] = { 173 581 {L"-d", TypeFlag}, 174 {L"-l", Type Flag},175 {L"-s", Type Flag},582 {L"-l", TypeValue}, 583 {L"-s", TypeValue}, 176 584 {L"-all", TypeFlag}, 177 585 {L"-guid", TypeValue}, … … 192 600 ) 193 601 { 194 EFI_STATUS Status; 195 LIST_ENTRY *Package; 196 CHAR16 *ProblemParam; 197 SHELL_STATUS ShellStatus; 198 CONST CHAR16 *Temp; 199 EFI_GUID *Guid; 200 EFI_GUID GuidData; 201 CONST CHAR16 *VariableName; 602 EFI_STATUS Status; 603 LIST_ENTRY *Package; 604 CHAR16 *ProblemParam; 605 SHELL_STATUS ShellStatus; 606 CONST CHAR16 *GuidStr; 607 CONST CHAR16 *File; 608 EFI_GUID *Guid; 609 EFI_GUID GuidData; 610 CONST CHAR16 *Name; 611 DMP_STORE_TYPE Type; 612 SHELL_FILE_HANDLE FileHandle; 613 EFI_FILE_INFO *FileInfo; 202 614 203 615 ShellStatus = SHELL_SUCCESS; 204 616 Package = NULL; 617 FileHandle = NULL; 618 File = NULL; 619 Type = DmpStoreDisplay; 205 620 206 621 Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE); … … 220 635 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-all", L"-guid"); 221 636 ShellStatus = SHELL_INVALID_PARAMETER; 637 } else if (ShellCommandLineGetFlag(Package, L"-s") && ShellCommandLineGetFlag(Package, L"-l")) { 638 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-l", L"-s"); 639 ShellStatus = SHELL_INVALID_PARAMETER; 222 640 } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-d")) { 223 641 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-l or -s", L"-d"); 224 642 ShellStatus = SHELL_INVALID_PARAMETER; 225 643 } else { 644 // 645 // Determine the GUID to search for based on -all and -guid parameters 646 // 226 647 if (!ShellCommandLineGetFlag(Package, L"-all")) { 227 Temp= ShellCommandLineGetValue(Package, L"-guid");228 if ( Temp!= NULL) {229 Status = ConvertStringToGuid( Temp, &GuidData);648 GuidStr = ShellCommandLineGetValue(Package, L"-guid"); 649 if (GuidStr != NULL) { 650 Status = ConvertStringToGuid(GuidStr, &GuidData); 230 651 if (EFI_ERROR(Status)) { 231 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);652 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, GuidStr); 232 653 ShellStatus = SHELL_INVALID_PARAMETER; 233 654 } … … 236 657 Guid = &gEfiGlobalVariableGuid; 237 658 } 238 VariableName = ShellCommandLineGetRawValue(Package, 1);239 659 } else { 240 VariableName = NULL; 241 Guid = NULL; 660 Guid = NULL; 242 661 } 662 663 // 664 // Get the Name of the variable to find 665 // 666 Name = ShellCommandLineGetRawValue(Package, 1); 667 243 668 if (ShellStatus == SHELL_SUCCESS) { 244 if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) { 245 ///@todo fix this after Jordan makes lib... 246 ShellPrintEx(-1, -1, L"Not implemeneted yet.\r\n"); 247 ShellStatus = SHELL_UNSUPPORTED; 248 } else { 249 ShellStatus = ProcessVariables (VariableName, Guid, ShellCommandLineGetFlag(Package, L"-d")); 669 if (ShellCommandLineGetFlag(Package, L"-s")) { 670 Type = DmpStoreSave; 671 File = ShellCommandLineGetValue(Package, L"-s"); 672 if (File == NULL) { 673 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"-s"); 674 ShellStatus = SHELL_INVALID_PARAMETER; 675 } else { 676 Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0); 677 if (!EFI_ERROR (Status)) { 678 // 679 // Delete existing file, but do not delete existing directory 680 // 681 FileInfo = ShellGetFileInfo (FileHandle); 682 if (FileInfo == NULL) { 683 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, File); 684 Status = EFI_DEVICE_ERROR; 685 } else { 686 if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { 687 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, File); 688 Status = EFI_INVALID_PARAMETER; 689 } else { 690 Status = ShellDeleteFile (&FileHandle); 691 if (EFI_ERROR (Status)) { 692 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_DELETE_FAIL), gShellDebug1HiiHandle, File); 693 } 694 } 695 FreePool (FileInfo); 696 } 697 } else if (Status == EFI_NOT_FOUND) { 698 // 699 // Good when file doesn't exist 700 // 701 Status = EFI_SUCCESS; 702 } else { 703 // 704 // Otherwise it's bad. 705 // 706 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, File); 707 } 708 709 if (!EFI_ERROR (Status)) { 710 Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_CREATE | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_READ, 0); 711 if (EFI_ERROR (Status)) { 712 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, File); 713 } 714 } 715 716 if (EFI_ERROR (Status)) { 717 ShellStatus = SHELL_INVALID_PARAMETER; 718 } 719 } 720 } else if (ShellCommandLineGetFlag(Package, L"-l")) { 721 Type = DmpStoreLoad; 722 File = ShellCommandLineGetValue(Package, L"-l"); 723 if (File == NULL) { 724 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDebug1HiiHandle, L"-l"); 725 ShellStatus = SHELL_INVALID_PARAMETER; 726 } else { 727 Status = ShellOpenFileByName (File, &FileHandle, EFI_FILE_MODE_READ, 0); 728 if (EFI_ERROR (Status)) { 729 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, File); 730 ShellStatus = SHELL_INVALID_PARAMETER; 731 } else { 732 FileInfo = ShellGetFileInfo (FileHandle); 733 if (FileInfo == NULL) { 734 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellDebug1HiiHandle, File); 735 ShellStatus = SHELL_DEVICE_ERROR; 736 } else { 737 if ((FileInfo->Attribute & EFI_FILE_DIRECTORY) == EFI_FILE_DIRECTORY) { 738 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_IS_DIRECTORY), gShellDebug1HiiHandle, File); 739 ShellStatus = SHELL_INVALID_PARAMETER; 740 } 741 FreePool (FileInfo); 742 } 743 } 744 } 745 } else if (ShellCommandLineGetFlag(Package, L"-d")) { 746 Type = DmpStoreDelete; 250 747 } 251 748 } 749 750 if (ShellStatus == SHELL_SUCCESS) { 751 if (Type == DmpStoreSave) { 752 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_SAVE), gShellDebug1HiiHandle, File); 753 } else if (Type == DmpStoreLoad) { 754 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DMPSTORE_LOAD), gShellDebug1HiiHandle, File); 755 } 756 ShellStatus = ProcessVariables (Name, Guid, Type, FileHandle); 757 if ((Type == DmpStoreLoad) || (Type == DmpStoreSave)) { 758 ShellCloseFile (&FileHandle); 759 } 760 } 252 761 } 253 762 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/FileBuffer.c
r48674 r58459 2 2 Implements filebuffer interface functions. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 301 301 // 302 302 Orig = MainEditor.ColorAttributes; 303 New.Colors.Foreground = Orig.Colors.Background; 304 New.Colors.Background = Orig.Colors.Foreground; 303 New.Data = 0; 304 New.Colors.Foreground = Orig.Colors.Background & 0xF; 305 New.Colors.Background = Orig.Colors.Foreground & 0x7; 305 306 306 307 // … … 343 344 // set the new mouse position 344 345 // 345 gST->ConOut->SetAttribute (gST->ConOut, New.Data );346 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 346 347 347 348 // … … 489 490 CHAR16 *Buffer; 490 491 UINTN Limit; 491 CHAR16 PrintLine[200]; 492 CHAR16 *PrintLine; 493 CHAR16 *PrintLine2; 494 UINTN BufLen; 492 495 493 496 // … … 501 504 } 502 505 503 StrnCpy (PrintLine, Buffer, MIN(MIN(Limit,MainEditor.ScreenSize.Column), 200)); 506 BufLen = (MainEditor.ScreenSize.Column + 1) * sizeof (CHAR16); 507 PrintLine = AllocatePool (BufLen); 508 ASSERT (PrintLine != NULL); 509 510 StrnCpy (PrintLine, Buffer, MIN(Limit, MainEditor.ScreenSize.Column)); 504 511 for (; Limit < MainEditor.ScreenSize.Column; Limit++) { 505 512 PrintLine[Limit] = L' '; … … 507 514 508 515 PrintLine[MainEditor.ScreenSize.Column] = CHAR_NULL; 516 517 PrintLine2 = AllocatePool (BufLen * 2); 518 ASSERT (PrintLine2 != NULL); 519 520 ShellCopySearchAndReplace(PrintLine, PrintLine2, BufLen * 2, L"%", L"^%", FALSE, FALSE); 509 521 510 522 ShellPrintEx ( … … 512 524 (INT32)Row - 1, 513 525 L"%s", 514 PrintLine 526 PrintLine2 515 527 ); 528 529 FreePool (PrintLine); 530 FreePool (PrintLine2); 516 531 517 532 return EFI_SUCCESS; -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Edit/MainTextEditor.c
r48674 r58459 2 2 Implements editor interface functions. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 490 490 // "Nothing to Cut". 491 491 // 492 Line = NULL; 492 493 Status = FileBufferCutLine (&Line); 493 494 if (Status == EFI_NOT_FOUND) { … … 1400 1401 &FileBuffer, 1401 1402 { 1402 0, 1403 0 1403 {0, 0} 1404 1404 }, 1405 1405 { … … 1504 1504 // below will call the five components' init function 1505 1505 // 1506 Status = MainTitleBarInit (L"UEFI EDIT 2.0");1506 Status = MainTitleBarInit (L"UEFI EDIT"); 1507 1507 if (EFI_ERROR (Status)) { 1508 1508 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBEDITOR_TITLEBAR), gShellDebug1HiiHandle); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/EditInputBar.c
r48674 r58459 2 2 Implements inputbar interface functions. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 104 104 typedef struct { 105 105 UINT32 Foreground : 4; 106 UINT32 Background : 4;106 UINT32 Background : 3; 107 107 } INPUT_BAR_COLOR_ATTRIBUTES; 108 108 … … 134 134 EFI_STATUS Status; 135 135 BOOLEAN NoDisplay; 136 UINTN Limit;137 UINTN mPromptLen;138 136 UINTN EventIndex; 139 137 UINTN CursorRow; … … 152 150 CursorRow = gST->ConOut->Mode->CursorRow; 153 151 Orig.Data = gST->ConOut->Mode->Attribute; 154 New.Colors.Foreground = Orig.Colors.Background; 155 New.Colors.Background = Orig.Colors.Foreground; 156 157 gST->ConOut->SetAttribute (gST->ConOut, New.Data); 152 New.Data = 0; 153 New.Colors.Foreground = Orig.Colors.Background & 0xF; 154 New.Colors.Background = Orig.Colors.Foreground & 0x7; 155 156 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 158 157 159 158 // … … 164 163 gST->ConOut->SetCursorPosition (gST->ConOut, 0, LastRow - 1); 165 164 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_EDIT_LIBINPUTBAR_MAININPUTBAR), gShellDebug1HiiHandle, mPrompt); 166 167 //168 // that's the maximum input length that can be displayed on screen169 //170 mPromptLen = StrLen (mPrompt);171 Limit = LastColumn - mPromptLen;172 165 173 166 // -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/EditStatusBar.c
r48674 r58459 2 2 Implements statusbar interface functions. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 63 63 typedef struct { 64 64 UINT32 Foreground : 4; 65 UINT32 Background : 4;65 UINT32 Background : 3; 66 66 } STATUS_BAR_COLOR_ATTRIBUTES; 67 67 … … 112 112 // 113 113 Orig.Data = gST->ConOut->Mode->Attribute; 114 New.Colors.Foreground = Orig.Colors.Background; 115 New.Colors.Background = Orig.Colors.Foreground; 114 New.Data = 0; 115 New.Colors.Foreground = Orig.Colors.Background & 0xF; 116 New.Colors.Background = Orig.Colors.Foreground & 0x7; 116 117 117 118 gST->ConOut->EnableCursor (gST->ConOut, FALSE); 118 gST->ConOut->SetAttribute (gST->ConOut, New.Data );119 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 119 120 120 121 // -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/EditTitleBar.c
r48674 r58459 2 2 Implements titlebar interface functions. 3 3 4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR> 4 Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 108 109 // 109 110 Orig.Data = gST->ConOut->Mode->Attribute; 110 New.Colors.Foreground = Orig.Colors.Background; 111 New.Colors.Background = Orig.Colors.Foreground; 112 113 gST->ConOut->SetAttribute (gST->ConOut, New.Data); 111 New.Data = 0; 112 New.Colors.Foreground = Orig.Colors.Background & 0xF; 113 New.Colors.Background = Orig.Colors.Foreground & 0x7; 114 115 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 114 116 115 117 // … … 170 172 case FileTypeUnicode: 171 173 if (FileType == FileTypeAscii){ 174 ShellPrintEx (-1,-1, L" ASCII "); 175 } else { 172 176 ShellPrintEx (-1,-1, L" UNICODE "); 173 177 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/EfiDecompress.c
r48674 r58459 2 2 Main file for EfiDecompress shell Debug1 function. 3 3 4 Copyright (c) 2005 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 111 111 ShellStatus = SHELL_NOT_FOUND; 112 112 } 113 Status = ShellOpenFileByName(OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);114 if (EFI_ERROR(Status)) {115 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);116 ShellStatus = SHELL_NOT_FOUND;117 }118 113 } 119 114 … … 132 127 133 128 Status = Decompress->GetInfo(Decompress, InBuffer, (UINT32)InSize, &OutSize, &ScratchSize); 134 ASSERT_EFI_ERROR(Status); 129 if (EFI_ERROR(Status) || OutSize == 0) { 130 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_NOPE), gShellDebug1HiiHandle, InFileName); 131 ShellStatus = SHELL_NOT_FOUND; 132 } else { 133 Status = ShellOpenFileByName(OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); 134 if (EFI_ERROR(Status)) { 135 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status); 136 ShellStatus = SHELL_NOT_FOUND; 137 } else { 138 OutBuffer = AllocateZeroPool(OutSize); 139 ScratchBuffer = AllocateZeroPool(ScratchSize); 140 ASSERT(OutBuffer != NULL); 141 ASSERT(ScratchBuffer != NULL); 135 142 136 OutBuffer = AllocateZeroPool(OutSize); 137 ScratchBuffer = AllocateZeroPool(ScratchSize); 138 ASSERT(OutBuffer != NULL); 139 ASSERT(ScratchBuffer != NULL); 143 Status = Decompress->Decompress(Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize); 144 ASSERT_EFI_ERROR(Status); 140 145 141 Status = Decompress->Decompress(Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize); 142 ASSERT_EFI_ERROR(Status); 143 144 if (EFI_ERROR(Status)) { 145 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_FAIL), gShellDebug1HiiHandle, Status); 146 ShellStatus = SHELL_DEVICE_ERROR; 147 } else { 148 OutSizeTemp = OutSize; 149 Status = gEfiShellProtocol->WriteFile(OutFileHandle, &OutSizeTemp, OutBuffer); 150 OutSize = (UINT32)OutSizeTemp; 151 if (EFI_ERROR(Status)) { 152 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, OutFileName, Status); 153 ShellStatus = SHELL_DEVICE_ERROR; 154 } 146 if (EFI_ERROR(Status)) { 147 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_FAIL), gShellDebug1HiiHandle, Status); 148 ShellStatus = SHELL_DEVICE_ERROR; 149 } else { 150 OutSizeTemp = OutSize; 151 Status = gEfiShellProtocol->WriteFile(OutFileHandle, &OutSizeTemp, OutBuffer); 152 OutSize = (UINT32)OutSizeTemp; 153 if (EFI_ERROR(Status)) { 154 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, OutFileName, Status); 155 ShellStatus = SHELL_DEVICE_ERROR; 156 } 157 } 158 } 155 159 } 156 160 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/BufferImage.c
r48674 r58459 3 3 as well as the event handlers for editing the file 4 4 5 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>5 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR> 6 6 This program and the accompanying materials 7 7 are licensed and made available under the terms and conditions of the BSD License … … 319 319 320 320 if (BeNewColor) { 321 gST->ConOut->SetAttribute (gST->ConOut, New.Data );321 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 322 322 } else { 323 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data );323 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); 324 324 } 325 325 … … 338 338 } 339 339 340 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data );340 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); 341 341 while (Index < 0x08) { 342 342 Pos = 10 + (Index * 3); … … 356 356 357 357 if (BeNewColor) { 358 gST->ConOut->SetAttribute (gST->ConOut, New.Data );358 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 359 359 } else { 360 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data );360 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); 361 361 } 362 362 … … 371 371 } 372 372 373 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data );373 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); 374 374 while (Index < 0x10) { 375 375 Pos = 10 + (Index * 3) + 1; … … 380 380 // restore the original color 381 381 // 382 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data );382 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data & 0x7F); 383 383 384 384 // … … 581 581 // 582 582 Orig = HMainEditor.ColorAttributes; 583 New.Colors.Foreground = Orig.Colors.Background; 584 New.Colors.Background = Orig.Colors.Foreground; 583 New.Data = 0; 584 New.Colors.Foreground = Orig.Colors.Background & 0xF; 585 New.Colors.Background = Orig.Colors.Foreground & 0x7; 585 586 586 587 // … … 594 595 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); 595 596 } else { 596 gST->ConOut->SetAttribute (gST->ConOut, New.Data );597 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 597 598 } 598 599 // … … 646 647 HBufferImage.MousePosition.Column 647 648 )) { 648 gST->ConOut->SetAttribute (gST->ConOut, New.Data );649 gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F); 649 650 } else { 650 651 gST->ConOut->SetAttribute (gST->ConOut, Orig.Data); … … 753 754 UINTN EndRow; 754 755 UINTN FStartRow; 755 UINTN FEndRow;756 756 UINTN Tmp; 757 757 758 758 Orig = HMainEditor.ColorAttributes; 759 New.Data = 0; 759 760 New.Colors.Foreground = Orig.Colors.Background; 760 761 New.Colors.Background = Orig.Colors.Foreground; … … 822 823 823 824 FStartRow = StartRow; 824 FEndRow = EndRow;825 825 826 826 StartRow = 2 + StartRow - HBufferImage.LowVisibleRow; … … 1751 1751 ) 1752 1752 { 1753 HEFI_EDITOR_LINE *Line;1754 1753 UINTN FRow; 1755 1754 UINTN FCol; … … 1757 1756 INTN Retreat; 1758 1757 1759 Line = HBufferImage.CurrentLine;1760 1761 1758 FRow = HBufferImage.BufferPosition.Row; 1762 1759 FCol = HBufferImage.BufferPosition.Column; … … 1777 1774 Retreat = -Retreat; 1778 1775 1779 //1780 // get correct line1781 //1782 Line = HMoveLine (Retreat);1783 1784 1776 FRow -= Gap; 1785 1777 … … 1799 1791 ) 1800 1792 { 1801 HEFI_EDITOR_LINE *Line;1802 1793 UINTN FRow; 1803 1794 UINTN FCol; 1804 1795 BOOLEAN HighBits; 1805 1806 Line = HBufferImage.CurrentLine;1807 1796 1808 1797 // … … 1919 1908 HEFI_EDITOR_LINE *Line; 1920 1909 LIST_ENTRY *Link; 1921 UINTN StartRow;1922 1910 1923 1911 UINTN OldFCol; … … 1928 1916 1929 1917 EFI_STATUS Status; 1930 1931 //1932 // get the line that start position is at1933 //1934 StartRow = Pos / 0x10;1935 1918 1936 1919 Size = HBufferImageGetTotalSize (); … … 2055 2038 2056 2039 LIST_ENTRY *Link; 2057 UINTN StartRow;2058 2040 2059 2041 UINTN OldFCol; … … 2062 2044 2063 2045 UINTN NewPos; 2064 2065 //2066 // get the line that start position is at2067 //2068 StartRow = Pos / 0x10;2069 2046 2070 2047 Size = HBufferImageGetTotalSize (); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/DiskImage.c
r48674 r58459 182 182 183 183 HEFI_EDITOR_LINE *Line; 184 UINT64 ByteOffset; 185 186 EDIT_FILE_TYPE BufferTypeBackup; 187 188 BufferTypeBackup = HBufferImage.BufferType; 184 189 185 HBufferImage.BufferType = FileTypeDiskBuffer; 190 186 … … 226 222 return EFI_OUT_OF_RESOURCES; 227 223 } 228 229 ByteOffset = MultU64x32 (Offset, BlkIo->Media->BlockSize);230 224 231 225 // … … 356 350 UINTN Bytes; 357 351 358 UINT64 ByteOffset;359 360 EDIT_FILE_TYPE BufferTypeBackup;361 362 352 // 363 353 // if not modified, directly return … … 367 357 } 368 358 369 BufferTypeBackup = HBufferImage.BufferType;370 359 HBufferImage.BufferType = FileTypeDiskBuffer; 371 360 … … 406 395 return Status; 407 396 } 408 409 ByteOffset = MultU64x32 (Offset, BlkIo->Media->BlockSize);410 397 411 398 // -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEdit.c
r48674 r58459 44 44 SHELL_STATUS ShellStatus; 45 45 LIST_ENTRY *Package; 46 CONST CHAR16 *Cwd;47 46 CHAR16 *NewName; 48 CHAR16 *Spot;49 47 CONST CHAR16 *Name; 50 48 UINTN Offset; 51 49 UINTN Size; 52 UINT64 LastOffset;53 50 EDIT_FILE_TYPE WhatToDo; 54 51 … … 56 53 ShellStatus = SHELL_SUCCESS; 57 54 NewName = NULL; 58 Cwd = NULL;59 55 Buffer = NULL; 60 56 Name = NULL; 61 Spot = NULL;62 57 Offset = 0; 63 58 Size = 0; 64 LastOffset = 0;65 59 WhatToDo = FileTypeNone; 66 60 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditorTypes.h
r48674 r58459 61 61 typedef union { 62 62 HEFI_EDITOR_COLOR_ATTRIBUTES Colors; 63 UINT 8Data;63 UINTN Data; 64 64 } HEFI_EDITOR_COLOR_UNION; 65 65 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MainHexEditor.c
r48674 r58459 5 5 - Main Interfaces 6 6 7 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved. <BR>7 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved. <BR> 8 8 This program and the accompanying materials 9 9 are licensed and made available under the terms and conditions of the BSD License … … 51 51 &HBufferImage, 52 52 { 53 0, 54 0 53 {0, 0} 55 54 }, 56 55 { … … 292 291 // 293 292 return EFI_SUCCESS; 294 break;295 293 296 294 case L'c': … … 600 598 { 601 599 UINTN Index; 602 HEFI_EDITOR_LINE *Line;603 600 LIST_ENTRY *Link; 604 601 UINT8 *Buffer; … … 624 621 Link = Link->ForwardLink; 625 622 } 626 627 Line = CR (Link, HEFI_EDITOR_LINE, Link, EFI_EDITOR_LINE_LIST);628 623 629 624 Count = HMainEditor.SelectEnd - HMainEditor.SelectStart + 1; … … 1689 1684 // below will call the five components' init function 1690 1685 // 1691 Status = MainTitleBarInit ( NULL);1686 Status = MainTitleBarInit (L"UEFI HEXEDIT"); 1692 1687 if (EFI_ERROR (Status)) { 1693 1688 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HEXEDIT_LIBEDITOR_MAINEDITOR_TITLE), gShellDebug1HiiHandle); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/MemImage.c
r48674 r58459 191 191 HEFI_EDITOR_LINE *Line; 192 192 193 EDIT_FILE_TYPE BufferTypeBackup;194 195 BufferTypeBackup = HBufferImage.BufferType;196 193 HBufferImage.BufferType = FileTypeMemBuffer; 197 194 … … 302 299 VOID *Buffer; 303 300 304 EDIT_FILE_TYPE BufferTypeBackup;305 306 301 // 307 302 // not modified, so directly return … … 311 306 } 312 307 313 BufferTypeBackup = HBufferImage.BufferType;314 308 HBufferImage.BufferType = FileTypeMemBuffer; 315 309 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/MemMap.c
r48674 r58459 2 2 Main file for Mode shell Debug1 function. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 5 This program and the acModeanying materials 4 (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License 7 8 which acModeanies this distribution. The full text of the license may be found at … … 13 14 **/ 14 15 16 // 17 // Need full names for Standard-Format Output 18 // 15 19 STATIC CONST CHAR16 NameEfiReservedMemoryType[] = L"Reserved"; 16 20 STATIC CONST CHAR16 NameEfiLoaderCode[] = L"LoaderCode"; 17 21 STATIC CONST CHAR16 NameEfiLoaderData[] = L"LoaderData"; 18 STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"B S_Code";19 STATIC CONST CHAR16 NameEfiBootServicesData[] = L"B S_Data";20 STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"R T_Code";21 STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"R T_Data";22 STATIC CONST CHAR16 NameEfiBootServicesCode[] = L"BootServiceCode"; 23 STATIC CONST CHAR16 NameEfiBootServicesData[] = L"BootServiceData"; 24 STATIC CONST CHAR16 NameEfiRuntimeServicesCode[] = L"RuntimeCode"; 25 STATIC CONST CHAR16 NameEfiRuntimeServicesData[] = L"RuntimeData"; 22 26 STATIC CONST CHAR16 NameEfiConventionalMemory[] = L"Available"; 23 STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"Unusable"; 24 STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIRec"; 25 STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPI_NVS"; 26 STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MMIO"; 27 STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MMIOPort"; 27 STATIC CONST CHAR16 NameEfiPersistentMemory[] = L"Persistent"; 28 STATIC CONST CHAR16 NameEfiUnusableMemory[] = L"UnusableMemory"; 29 STATIC CONST CHAR16 NameEfiACPIReclaimMemory[] = L"ACPIReclaimMemory"; 30 STATIC CONST CHAR16 NameEfiACPIMemoryNVS[] = L"ACPIMemoryNVS"; 31 STATIC CONST CHAR16 NameEfiMemoryMappedIO[] = L"MemoryMappedIO"; 32 STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpace[] = L"MemoryMappedIOPortSpace"; 28 33 STATIC CONST CHAR16 NameEfiPalCode[] = L"PalCode"; 34 35 // 36 // Need short names for some memory types 37 // 38 STATIC CONST CHAR16 NameEfiBootServicesCodeShort[] = L"BS_Code"; 39 STATIC CONST CHAR16 NameEfiBootServicesDataShort[] = L"BS_Data"; 40 STATIC CONST CHAR16 NameEfiRuntimeServicesCodeShort[] = L"RT_Code"; 41 STATIC CONST CHAR16 NameEfiRuntimeServicesDataShort[] = L"RT_Data"; 42 STATIC CONST CHAR16 NameEfiUnusableMemoryShort[] = L"Unusable"; 43 STATIC CONST CHAR16 NameEfiACPIReclaimMemoryShort[] = L"ACPI_Recl"; 44 STATIC CONST CHAR16 NameEfiACPIMemoryNVSShort[] = L"ACPI_NVS"; 45 STATIC CONST CHAR16 NameEfiMemoryMappedIOShort[] = L"MMIO"; 46 STATIC CONST CHAR16 NameEfiMemoryMappedIOPortSpaceShort[] = L"MMIO_Port"; 29 47 30 48 #include "UefiShellDebug1CommandsLib.h" … … 77 95 UINT64 AcpiNvsPagesSize; 78 96 UINT64 MmioSpacePagesSize; 97 UINT64 MmioPortPages; 98 UINT64 MmioPortPagesSize; 99 UINT64 UnusableMemoryPages; 100 UINT64 UnusableMemoryPagesSize; 101 UINT64 PalCodePages; 102 UINT64 PalCodePagesSize; 79 103 BOOLEAN Sfo; 80 104 … … 91 115 RTCodePages = 0; 92 116 AvailPages = 0; 117 MmioPortPages = 0; 118 UnusableMemoryPages = 0; 119 PalCodePages = 0; 93 120 Size = 0; 94 121 Buffer = NULL; … … 133 160 } else { 134 161 ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION); 162 135 163 Sfo = ShellCommandLineGetFlag(Package, L"-sfo"); 136 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle); 164 if (!Sfo) { 165 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle); 166 } else { 167 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDebug1HiiHandle, L"memmap"); 168 } 169 137 170 for (Walker = (UINT8*)Buffer; Walker < (((UINT8*)Buffer)+Size) && Walker != NULL; Walker += ItemSize){ 138 171 switch (((EFI_MEMORY_DESCRIPTOR*)Walker)->Type) { 139 // replaced ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages) with 0000140 172 case EfiReservedMemoryType: 141 173 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiReservedMemoryType, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 142 174 ReservedPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 143 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;144 175 break; 145 176 case EfiLoaderCode: … … 154 185 break; 155 186 case EfiBootServicesCode: 156 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiBootServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);187 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesCodeShort:NameEfiBootServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 157 188 BSCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 158 189 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 159 190 break; 160 191 case EfiBootServicesData: 161 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiBootServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);192 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiBootServicesDataShort:NameEfiBootServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 162 193 BSDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 163 194 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 164 195 break; 165 196 case EfiRuntimeServicesCode: 166 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiRuntimeServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);197 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesCodeShort:NameEfiRuntimeServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 167 198 RTCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 168 199 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 169 200 break; 170 201 case EfiRuntimeServicesData: 171 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiRuntimeServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);202 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiRuntimeServicesDataShort:NameEfiRuntimeServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 172 203 RTDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 173 204 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; … … 178 209 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 179 210 break; 211 case EfiPersistentMemory: 212 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPersistentMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 213 AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 214 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 215 break; 180 216 case EfiUnusableMemory: 181 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiUnusableMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);182 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;217 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiUnusableMemoryShort:NameEfiUnusableMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 218 UnusableMemoryPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 183 219 break; 184 220 case EfiACPIReclaimMemory: 185 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiACPIReclaimMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);221 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIReclaimMemoryShort:NameEfiACPIReclaimMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 186 222 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 187 223 AcpiReclaimPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 188 224 break; 189 225 case EfiACPIMemoryNVS: 190 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiACPIMemoryNVS, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);226 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiACPIMemoryNVSShort:NameEfiACPIMemoryNVS, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 191 227 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 192 228 AcpiNvsPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 193 229 break; 194 230 case EfiMemoryMappedIO: 195 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiMemoryMappedIO, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 196 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 231 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOShort:NameEfiMemoryMappedIO, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 197 232 MmioSpacePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 198 233 break; 199 234 case EfiMemoryMappedIOPortSpace: 200 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiMemoryMappedIOPortSpace, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);201 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;235 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, !Sfo?NameEfiMemoryMappedIOPortSpaceShort:NameEfiMemoryMappedIOPortSpace, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 236 MmioPortPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 202 237 break; 203 238 case EfiPalCode: 204 239 ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, NameEfiPalCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages)-1, ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute); 205 240 TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 241 PalCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages; 206 242 break; 207 243 default: … … 212 248 // print the summary 213 249 // 214 ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages); 215 LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages); 216 LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages); 217 BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages); 218 BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages); 219 RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages); 220 RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages); 221 AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages); 222 TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages); 223 AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages); 224 AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages); 225 MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages); 250 ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages); 251 LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages); 252 LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages); 253 BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages); 254 BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages); 255 RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages); 256 RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages); 257 AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages); 258 TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages); 259 AcpiReclaimPagesSize = MultU64x64(SIZE_4KB,AcpiReclaimPages); 260 AcpiNvsPagesSize = MultU64x64(SIZE_4KB,AcpiNvsPages); 261 MmioSpacePagesSize = MultU64x64(SIZE_4KB,MmioSpacePages); 262 MmioPortPagesSize = MultU64x64(SIZE_4KB,MmioPortPages); 263 PalCodePagesSize = MultU64x64(SIZE_4KB,PalCodePages); 264 UnusableMemoryPagesSize = MultU64x64(SIZE_4KB,UnusableMemoryPages); 226 265 if (!Sfo) { 227 266 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle, … … 236 275 AcpiNvsPages, AcpiNvsPagesSize, 237 276 MmioSpacePages, MmioSpacePagesSize, 277 MmioPortPages, MmioPortPagesSize, 278 PalCodePages, PalCodePagesSize, 238 279 AvailPages, AvailPagesSize, 239 280 DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize … … 242 283 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle, 243 284 TotalPagesSize, 244 MultU64x64(SIZE_4KB,ReservedPages),285 ReservedPagesSize, 245 286 BSCodePagesSize, 246 287 BSDataPagesSize, … … 249 290 LoadCodePagesSize, 250 291 LoadDataPagesSize, 251 AvailPages, AvailPagesSize 292 AvailPagesSize, 293 MmioSpacePagesSize, 294 MmioPortPagesSize, 295 UnusableMemoryPagesSize, 296 AcpiReclaimPagesSize, 297 AcpiNvsPagesSize, 298 PalCodePagesSize 252 299 ); 253 300 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Mm.c
r48674 r58459 2 2 Main file for Mm shell Debug1 function. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 218 218 UINTN Index; 219 219 UINTN Size; 220 CHAR16 *AddressStr;221 220 // CHAR16 *ValueStr; 222 221 BOOLEAN Complete; … … 231 230 CONST CHAR16 *Temp; 232 231 232 Value = 0; 233 233 Address = 0; 234 234 PciEAddress = 0; … … 246 246 Size = 1; 247 247 AccessType = EfiMemory; 248 AddressStr = NULL;249 248 // ValueStr = NULL; 250 249 Interactive = TRUE; … … 318 317 } 319 318 320 if (ShellCommandLineGetFlag (Package, L"-n")) { 319 // 320 // Non interactive for a script file or for the specific parameter 321 // 322 if (gEfiShellProtocol->BatchIsActive() || ShellCommandLineGetFlag (Package, L"-n")) { 321 323 Interactive = FALSE; 322 324 } … … 363 365 Temp = ShellCommandLineGetRawValue(Package, 2); 364 366 if (Temp != NULL) { 367 // 368 // Per spec if value is specified, then -n is assumed. 369 // 370 Interactive = FALSE; 371 365 372 if (!ShellIsHexOrDecimalNumber(Temp, TRUE, FALSE) || EFI_ERROR(ShellConvertStringToUint64(Temp, &Value, TRUE, FALSE))) { 366 373 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp); … … 490 497 // 491 498 if (!Interactive) { 499 Buffer = 0; 500 if (AccessType == EFIMemoryMappedIo) { 501 if (!gEfiShellProtocol->BatchIsActive()) { 502 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle); 503 } 504 IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer); 505 } else if (AccessType == EfiIo) { 506 if (!gEfiShellProtocol->BatchIsActive()) { 507 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle); 508 } 509 IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer); 510 } else if (AccessType == EfiPciConfig) { 511 if (!gEfiShellProtocol->BatchIsActive()) { 512 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle); 513 } 514 IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer); 515 } else if (AccessType == EfiPciEConfig) { 516 if (!gEfiShellProtocol->BatchIsActive()) { 517 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle); 518 } 519 IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer); 520 } else { 521 if (!gEfiShellProtocol->BatchIsActive()) { 522 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle); 523 } 524 ReadMem (Width, Address, 1, &Buffer); 525 } 526 if (!gEfiShellProtocol->BatchIsActive()) { 527 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address); 528 } 529 if (Size == 1) { 530 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer); 531 } else if (Size == 2) { 532 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, (UINTN)Buffer); 533 } else if (Size == 4) { 534 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, (UINTN)Buffer); 535 } else if (Size == 8) { 536 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF16), gShellDebug1HiiHandle, Buffer); 537 } 538 539 ShellPrintEx(-1, -1, L"\r\n"); 540 541 ASSERT(ShellStatus == SHELL_SUCCESS); 542 goto Done; 543 } 544 // 545 // interactive mode 546 // 547 Complete = FALSE; 548 do { 549 if (AccessType == EfiIo && Address + Size > 0x10000) { 550 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle); 551 break; 552 } 553 492 554 Buffer = 0; 493 555 if (AccessType == EFIMemoryMappedIo) { … … 509 571 510 572 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address); 573 511 574 if (Size == 1) { 512 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, Buffer);575 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, (UINTN)Buffer); 513 576 } else if (Size == 2) { 514 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, Buffer);577 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, (UINTN)Buffer); 515 578 } else if (Size == 4) { 516 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, Buffer); 517 } else if (Size == 8) { 518 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF16), gShellDebug1HiiHandle, Buffer); 519 } 520 521 ShellPrintEx(-1, -1, L"\r\n"); 522 523 ASSERT(ShellStatus == SHELL_SUCCESS); 524 goto Done; 525 } 526 // 527 // interactive mode 528 // 529 Complete = FALSE; 530 do { 531 if (AccessType == EfiIo && Address + Size > 0x10000) { 532 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle); 533 break; 534 } 535 536 Buffer = 0; 537 if (AccessType == EFIMemoryMappedIo) { 538 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle); 539 IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer); 540 } else if (AccessType == EfiIo) { 541 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle); 542 IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer); 543 } else if (AccessType == EfiPciConfig) { 544 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle); 545 IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer); 546 } else if (AccessType == EfiPciEConfig) { 547 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle); 548 IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer); 549 } else { 550 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle); 551 ReadMem (Width, Address, 1, &Buffer); 552 } 553 554 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address); 555 556 if (Size == 1) { 557 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, Buffer); 558 } else if (Size == 2) { 559 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, Buffer); 560 } else if (Size == 4) { 561 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, Buffer); 579 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, (UINTN)Buffer); 562 580 } else if (Size == 8) { 563 581 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF16), gShellDebug1HiiHandle, Buffer); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Mode.c
r48674 r58459 2 2 Main file for Mode shell Debug1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>5 This program and the ac Modeanying materials4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License 7 7 which acModeanies this distribution. The full text of the license may be found at -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c
r48674 r58459 2 2 Main file for Pci shell Debug1 function. 3 3 4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> 4 (C) Copyright 2013-2014 Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 20 21 #include "Pci.h" 21 22 22 #define PCI_CLASS_STRING_LIMIT 5423 23 // 24 24 // Printable strings for Pci class code … … 63 63 PCI_CLASS_ENTRY PCISubClass_10[]; 64 64 PCI_CLASS_ENTRY PCISubClass_11[]; 65 PCI_CLASS_ENTRY PCISubClass_12[]; 66 PCI_CLASS_ENTRY PCISubClass_13[]; 67 PCI_CLASS_ENTRY PCIPIFClass_0100[]; 65 68 PCI_CLASS_ENTRY PCIPIFClass_0101[]; 69 PCI_CLASS_ENTRY PCIPIFClass_0105[]; 70 PCI_CLASS_ENTRY PCIPIFClass_0106[]; 71 PCI_CLASS_ENTRY PCIPIFClass_0107[]; 72 PCI_CLASS_ENTRY PCIPIFClass_0108[]; 73 PCI_CLASS_ENTRY PCIPIFClass_0109[]; 66 74 PCI_CLASS_ENTRY PCIPIFClass_0300[]; 67 75 PCI_CLASS_ENTRY PCIPIFClass_0604[]; 76 PCI_CLASS_ENTRY PCIPIFClass_0609[]; 77 PCI_CLASS_ENTRY PCIPIFClass_060b[]; 68 78 PCI_CLASS_ENTRY PCIPIFClass_0700[]; 69 79 PCI_CLASS_ENTRY PCIPIFClass_0701[]; … … 76 86 PCI_CLASS_ENTRY PCIPIFClass_0c00[]; 77 87 PCI_CLASS_ENTRY PCIPIFClass_0c03[]; 88 PCI_CLASS_ENTRY PCIPIFClass_0c07[]; 89 PCI_CLASS_ENTRY PCIPIFClass_0d01[]; 78 90 PCI_CLASS_ENTRY PCIPIFClass_0e00[]; 79 91 … … 173 185 }, 174 186 { 187 0x12, 188 L"Processing Accelerators", 189 PCISubClass_12 190 }, 191 { 192 0x13, 193 L"Non-Essential Instrumentation", 194 PCISubClass_13 195 }, 196 { 175 197 0xff, 176 198 L"Device does not fit in any defined classes", … … 221 243 { 222 244 0x00, 223 L"SCSI controller",224 PCI BlankEntry245 L"SCSI", 246 PCIPIFClass_0100 225 247 }, 226 248 { … … 245 267 }, 246 268 { 269 0x05, 270 L"ATA controller with ADMA interface", 271 PCIPIFClass_0105 272 }, 273 { 274 0x06, 275 L"Serial ATA controller", 276 PCIPIFClass_0106 277 }, 278 { 279 0x07, 280 L"Serial Attached SCSI (SAS) controller ", 281 PCIPIFClass_0107 282 }, 283 { 284 0x08, 285 L"Non-volatile memory subsystem", 286 PCIPIFClass_0108 287 }, 288 { 289 0x09, 290 L"Universal Flash Storage (UFS) controller ", 291 PCIPIFClass_0109 292 }, 293 { 247 294 0x80, 248 295 L"Other mass storage controller", … … 283 330 }, 284 331 { 332 0x05, 333 L"WorldFip controller", 334 PCIBlankEntry 335 }, 336 { 337 0x06, 338 L"PICMG 2.14 Multi Computing", 339 PCIBlankEntry 340 }, 341 { 342 0x07, 343 L"InfiniBand controller", 344 PCIBlankEntry 345 }, 346 { 285 347 0x80, 286 348 L"Other network controller", … … 336 398 0x02, 337 399 L"Computer Telephony device", 400 PCIBlankEntry 401 }, 402 { 403 0x03, 404 L"Mixed mode device", 338 405 PCIBlankEntry 339 406 }, … … 420 487 }, 421 488 { 489 0x09, 490 L"Semi-transparent PCI-to-PCI bridge", 491 PCIPIFClass_0609 492 }, 493 { 494 0x0A, 495 L"InfiniBand-to-PCI host bridge", 496 PCIBlankEntry 497 }, 498 { 499 0x0B, 500 L"Advanced Switching to PCI host bridge", 501 PCIPIFClass_060b 502 }, 503 { 422 504 0x80, 423 505 L"Other bridge type", … … 453 535 }, 454 536 { 537 0x04, 538 L"GPIB (IEEE 488.1/2) controller", 539 PCIBlankEntry 540 }, 541 { 542 0x05, 543 L"Smart Card", 544 PCIBlankEntry 545 }, 546 { 455 547 0x80, 456 548 L"Other communication device", … … 491 583 }, 492 584 { 585 0x05, 586 L"SD Host controller", 587 PCIBlankEntry 588 }, 589 { 590 0x06, 591 L"IOMMU", 592 PCIBlankEntry 593 }, 594 { 595 0x07, 596 L"Root Complex Event Collector", 597 PCIBlankEntry 598 }, 599 { 493 600 0x80, 494 601 L"Other system peripheral", … … 609 716 { 610 717 0x00, 611 L" Firewire(IEEE 1394)",612 PCIPIFClass_0c0 3718 L"IEEE 1394", 719 PCIPIFClass_0c00 613 720 }, 614 721 { … … 625 732 0x03, 626 733 L"USB", 627 PCIPIFClass_0c0 0734 PCIPIFClass_0c03 628 735 }, 629 736 { … … 638 745 }, 639 746 { 747 0x06, 748 L"InfiniBand", 749 PCIBlankEntry 750 }, 751 { 752 0x07, 753 L"IPMI", 754 PCIPIFClass_0c07 755 }, 756 { 757 0x08, 758 L"SERCOS Interface Standard (IEC 61491)", 759 PCIBlankEntry 760 }, 761 { 762 0x09, 763 L"CANbus", 764 PCIBlankEntry 765 }, 766 { 640 767 0x80, 641 768 L"Other bus type", … … 657 784 { 658 785 0x01, 659 L" Consumer IR controller",660 PCI BlankEntry786 L"", 787 PCIPIFClass_0d01 661 788 }, 662 789 { … … 666 793 }, 667 794 { 795 0x11, 796 L"Bluetooth", 797 PCIBlankEntry 798 }, 799 { 800 0x12, 801 L"Broadband", 802 PCIBlankEntry 803 }, 804 { 805 0x20, 806 L"Ethernet (802.11a - 5 GHz)", 807 PCIBlankEntry 808 }, 809 { 810 0x21, 811 L"Ethernet (802.11b - 2.4 GHz)", 812 PCIBlankEntry 813 }, 814 { 668 815 0x80, 669 816 L"Other type of wireless controller", … … 692 839 PCI_CLASS_ENTRY PCISubClass_0f[] = { 693 840 { 694 0x0 0,841 0x01, 695 842 L"TV", 696 843 PCIBlankEntry 697 844 }, 698 845 { 699 0x0 1,846 0x02, 700 847 L"Audio", 701 848 PCIBlankEntry 702 849 }, 703 850 { 704 0x0 2,851 0x03, 705 852 L"Voice", 706 853 PCIBlankEntry 707 854 }, 708 855 { 709 0x0 3,856 0x04, 710 857 L"Data", 858 PCIBlankEntry 859 }, 860 { 861 0x80, 862 L"Other satellite communication controller", 711 863 PCIBlankEntry 712 864 }, … … 748 900 }, 749 901 { 902 0x01, 903 L"Performance Counters", 904 PCIBlankEntry 905 }, 906 { 907 0x10, 908 L"Communications synchronization plus time and frequency test/measurement ", 909 PCIBlankEntry 910 }, 911 { 912 0x20, 913 L"Management card", 914 PCIBlankEntry 915 }, 916 { 750 917 0x80, 751 918 L"Other DAQ & SP controllers", 919 PCIBlankEntry 920 }, 921 { 922 0x00, 923 NULL, 924 /* null string ends the list */NULL 925 } 926 }; 927 928 PCI_CLASS_ENTRY PCISubClass_12[] = { 929 { 930 0x00, 931 L"Processing Accelerator", 932 PCIBlankEntry 933 }, 934 { 935 0x00, 936 NULL, 937 /* null string ends the list */NULL 938 } 939 }; 940 941 PCI_CLASS_ENTRY PCISubClass_13[] = { 942 { 943 0x00, 944 L"Non-Essential Instrumentation Function", 752 945 PCIBlankEntry 753 946 }, … … 762 955 // Programming Interface entries 763 956 // 957 PCI_CLASS_ENTRY PCIPIFClass_0100[] = { 958 { 959 0x00, 960 L"SCSI controller", 961 PCIBlankEntry 962 }, 963 { 964 0x11, 965 L"SCSI storage device SOP using PQI", 966 PCIBlankEntry 967 }, 968 { 969 0x12, 970 L"SCSI controller SOP using PQI", 971 PCIBlankEntry 972 }, 973 { 974 0x13, 975 L"SCSI storage device and controller SOP using PQI", 976 PCIBlankEntry 977 }, 978 { 979 0x21, 980 L"SCSI storage device SOP using NVMe", 981 PCIBlankEntry 982 }, 983 { 984 0x00, 985 NULL, 986 /* null string ends the list */NULL 987 } 988 }; 989 764 990 PCI_CLASS_ENTRY PCIPIFClass_0101[] = { 765 991 { … … 930 1156 }; 931 1157 1158 PCI_CLASS_ENTRY PCIPIFClass_0105[] = { 1159 { 1160 0x20, 1161 L"Single stepping", 1162 PCIBlankEntry 1163 }, 1164 { 1165 0x30, 1166 L"Continuous operation", 1167 PCIBlankEntry 1168 }, 1169 { 1170 0x00, 1171 NULL, 1172 /* null string ends the list */NULL 1173 } 1174 }; 1175 1176 PCI_CLASS_ENTRY PCIPIFClass_0106[] = { 1177 { 1178 0x00, 1179 L"", 1180 PCIBlankEntry 1181 }, 1182 { 1183 0x01, 1184 L"AHCI", 1185 PCIBlankEntry 1186 }, 1187 { 1188 0x02, 1189 L"Serial Storage Bus", 1190 PCIBlankEntry 1191 }, 1192 { 1193 0x00, 1194 NULL, 1195 /* null string ends the list */NULL 1196 } 1197 }; 1198 1199 PCI_CLASS_ENTRY PCIPIFClass_0107[] = { 1200 { 1201 0x00, 1202 L"", 1203 PCIBlankEntry 1204 }, 1205 { 1206 0x01, 1207 L"Obsolete", 1208 PCIBlankEntry 1209 }, 1210 { 1211 0x00, 1212 NULL, 1213 /* null string ends the list */NULL 1214 } 1215 }; 1216 1217 PCI_CLASS_ENTRY PCIPIFClass_0108[] = { 1218 { 1219 0x00, 1220 L"", 1221 PCIBlankEntry 1222 }, 1223 { 1224 0x01, 1225 L"NVMHCI", 1226 PCIBlankEntry 1227 }, 1228 { 1229 0x02, 1230 L"NVM Express", 1231 PCIBlankEntry 1232 }, 1233 { 1234 0x00, 1235 NULL, 1236 /* null string ends the list */NULL 1237 } 1238 }; 1239 1240 PCI_CLASS_ENTRY PCIPIFClass_0109[] = { 1241 { 1242 0x00, 1243 L"", 1244 PCIBlankEntry 1245 }, 1246 { 1247 0x01, 1248 L"UFSHCI", 1249 PCIBlankEntry 1250 }, 1251 { 1252 0x00, 1253 NULL, 1254 /* null string ends the list */NULL 1255 } 1256 }; 1257 932 1258 PCI_CLASS_ENTRY PCIPIFClass_0300[] = { 933 1259 { … … 966 1292 }; 967 1293 1294 PCI_CLASS_ENTRY PCIPIFClass_0609[] = { 1295 { 1296 0x40, 1297 L"Primary PCI bus side facing the system host processor", 1298 PCIBlankEntry 1299 }, 1300 { 1301 0x80, 1302 L"Secondary PCI bus side facing the system host processor", 1303 PCIBlankEntry 1304 }, 1305 { 1306 0x00, 1307 NULL, 1308 /* null string ends the list */NULL 1309 } 1310 }; 1311 1312 PCI_CLASS_ENTRY PCIPIFClass_060b[] = { 1313 { 1314 0x00, 1315 L"Custom", 1316 PCIBlankEntry 1317 }, 1318 { 1319 0x01, 1320 L"ASI-SIG Defined Portal", 1321 PCIBlankEntry 1322 }, 1323 { 1324 0x00, 1325 NULL, 1326 /* null string ends the list */NULL 1327 } 1328 }; 1329 968 1330 PCI_CLASS_ENTRY PCIPIFClass_0700[] = { 969 1331 { … … 1198 1560 { 1199 1561 0x00, 1200 L" Universal Host Controller spec",1562 L"", 1201 1563 PCIBlankEntry 1202 1564 }, 1203 1565 { 1204 1566 0x10, 1205 L"Open Host Controller spec", 1567 L"Using 1394 OpenHCI spec", 1568 PCIBlankEntry 1569 }, 1570 { 1571 0x00, 1572 NULL, 1573 /* null string ends the list */NULL 1574 } 1575 }; 1576 1577 PCI_CLASS_ENTRY PCIPIFClass_0c03[] = { 1578 { 1579 0x00, 1580 L"UHCI", 1581 PCIBlankEntry 1582 }, 1583 { 1584 0x10, 1585 L"OHCI", 1586 PCIBlankEntry 1587 }, 1588 { 1589 0x20, 1590 L"EHCI", 1591 PCIBlankEntry 1592 }, 1593 { 1594 0x30, 1595 L"xHCI", 1206 1596 PCIBlankEntry 1207 1597 }, … … 1223 1613 }; 1224 1614 1225 PCI_CLASS_ENTRY PCIPIFClass_0c03[] = { 1226 { 1227 0x00, 1228 L"", 1615 PCI_CLASS_ENTRY PCIPIFClass_0c07[] = { 1616 { 1617 0x00, 1618 L"SMIC", 1619 PCIBlankEntry 1620 }, 1621 { 1622 0x01, 1623 L"Keyboard Controller Style", 1624 PCIBlankEntry 1625 }, 1626 { 1627 0x02, 1628 L"Block Transfer", 1629 PCIBlankEntry 1630 }, 1631 { 1632 0x00, 1633 NULL, 1634 /* null string ends the list */NULL 1635 } 1636 }; 1637 1638 PCI_CLASS_ENTRY PCIPIFClass_0d01[] = { 1639 { 1640 0x00, 1641 L"Consumer IR controller", 1229 1642 PCIBlankEntry 1230 1643 }, 1231 1644 { 1232 1645 0x10, 1233 L"U sing 1394 OpenHCI spec",1646 L"UWB Radio controller", 1234 1647 PCIBlankEntry 1235 1648 }, … … 1378 1791 1379 1792 @param[in] ClassCodePtr Points to the memory which stores register Class Code in PCI 1380 configuation space.1793 configuration space. 1381 1794 @param[in] IncludePIF If the printed string should include the programming I/F part 1382 1795 **/ … … 1389 1802 UINT32 ClassCode; 1390 1803 PCI_CLASS_STRINGS ClassStrings; 1391 CHAR16 OutputString[PCI_CLASS_STRING_LIMIT + 1];1392 1804 1393 1805 ClassCode = 0; 1394 ClassCode |= ClassCodePtr[0];1395 ClassCode |= ( ClassCodePtr[1] << 8);1396 ClassCode |= ( ClassCodePtr[2] << 16);1806 ClassCode |= (UINT32)ClassCodePtr[0]; 1807 ClassCode |= (UINT32)(ClassCodePtr[1] << 8); 1808 ClassCode |= (UINT32)(ClassCodePtr[2] << 16); 1397 1809 1398 1810 // … … 1403 1815 if (IncludePIF) { 1404 1816 // 1405 // Only print base class and sub classname1817 // Print base class, sub class, and programming inferface name 1406 1818 // 1407 ShellPrintEx (-1,-1, L"%s - %s - %s",1819 ShellPrintEx (-1, -1, L"%s - %s - %s", 1408 1820 ClassStrings.BaseClass, 1409 1821 ClassStrings.SubClass, … … 1413 1825 } else { 1414 1826 // 1415 // Print base class, sub class, and programming inferfacename1827 // Only print base class and sub class name 1416 1828 // 1417 UnicodeSPrint ( 1418 OutputString, 1419 PCI_CLASS_STRING_LIMIT * sizeof (CHAR16), 1420 L"%s - %s", 1829 ShellPrintEx (-1, -1, L"%s - %s", 1421 1830 ClassStrings.BaseClass, 1422 1831 ClassStrings.SubClass 1423 ); 1424 1425 OutputString[PCI_CLASS_STRING_LIMIT] = 0; 1426 ShellPrintEx(-1,-1, L"%s", OutputString); 1832 ); 1427 1833 } 1428 1834 } … … 1499 1905 @param[in] Address Address used to access configuration space of this PCI device. 1500 1906 @param[in] IoDev Handle used to access configuration space of PCI device. 1907 @param[in] EnhancedDump The print format for the dump data. 1501 1908 1502 1909 @retval EFI_SUCCESS The command completed successfully. … … 1506 1913 IN PCI_CONFIG_SPACE *ConfigSpace, 1507 1914 IN UINT64 Address, 1508 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev 1915 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 1916 IN CONST UINT16 EnhancedDump 1509 1917 ); 1510 1918 … … 1624 2032 Print each capability structure. 1625 2033 1626 @param[in] IoDev The pointer to the deivce. 1627 @param[in] Address The address to start at. 1628 @param[in] CapPtr The offset from the address. 1629 1630 @retval EFI_SUCCESS The operation was successful. 2034 @param[in] IoDev The pointer to the deivce. 2035 @param[in] Address The address to start at. 2036 @param[in] CapPtr The offset from the address. 2037 @param[in] EnhancedDump The print format for the dump data. 2038 2039 @retval EFI_SUCCESS The operation was successful. 1631 2040 **/ 1632 2041 EFI_STATUS … … 1634 2043 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 1635 2044 IN UINT64 Address, 1636 IN UINT8 CapPtr 2045 IN UINT8 CapPtr, 2046 IN CONST UINT16 EnhancedDump 1637 2047 ); 1638 2048 … … 1640 2050 Display Pcie device structure. 1641 2051 1642 @param[in] IoDev The pointer to the root pci protocol. 1643 @param[in] Address The Address to start at. 1644 @param[in] CapabilityPtr The offset from the address to start. 2052 @param[in] IoDev The pointer to the root pci protocol. 2053 @param[in] Address The Address to start at. 2054 @param[in] CapabilityPtr The offset from the address to start. 2055 @param[in] EnhancedDump The print format for the dump data. 2056 2057 @retval EFI_SUCCESS The command completed successfully. 2058 @retval @retval EFI_SUCCESS Pci express extend space IO is not suppoted. 1645 2059 **/ 1646 2060 EFI_STATUS … … 1648 2062 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 1649 2063 IN UINT64 Address, 1650 IN UINT8 CapabilityPtr 2064 IN UINT8 CapabilityPtr, 2065 IN CONST UINT16 EnhancedDump 1651 2066 ); 1652 2067 … … 1660 2075 EFI_STATUS 1661 2076 ExplainPcieCapReg ( 1662 IN PCIE_CAP_ST URCTURE *PciExpressCap2077 IN PCIE_CAP_STRUCTURE *PciExpressCap 1663 2078 ); 1664 2079 … … 1672 2087 EFI_STATUS 1673 2088 ExplainPcieDeviceCap ( 1674 IN PCIE_CAP_ST URCTURE *PciExpressCap2089 IN PCIE_CAP_STRUCTURE *PciExpressCap 1675 2090 ); 1676 2091 … … 1684 2099 EFI_STATUS 1685 2100 ExplainPcieDeviceControl ( 1686 IN PCIE_CAP_ST URCTURE *PciExpressCap2101 IN PCIE_CAP_STRUCTURE *PciExpressCap 1687 2102 ); 1688 2103 … … 1696 2111 EFI_STATUS 1697 2112 ExplainPcieDeviceStatus ( 1698 IN PCIE_CAP_ST URCTURE *PciExpressCap2113 IN PCIE_CAP_STRUCTURE *PciExpressCap 1699 2114 ); 1700 2115 … … 1708 2123 EFI_STATUS 1709 2124 ExplainPcieLinkCap ( 1710 IN PCIE_CAP_ST URCTURE *PciExpressCap2125 IN PCIE_CAP_STRUCTURE *PciExpressCap 1711 2126 ); 1712 2127 … … 1720 2135 EFI_STATUS 1721 2136 ExplainPcieLinkControl ( 1722 IN PCIE_CAP_ST URCTURE *PciExpressCap2137 IN PCIE_CAP_STRUCTURE *PciExpressCap 1723 2138 ); 1724 2139 … … 1732 2147 EFI_STATUS 1733 2148 ExplainPcieLinkStatus ( 1734 IN PCIE_CAP_ST URCTURE *PciExpressCap2149 IN PCIE_CAP_STRUCTURE *PciExpressCap 1735 2150 ); 1736 2151 … … 1744 2159 EFI_STATUS 1745 2160 ExplainPcieSlotCap ( 1746 IN PCIE_CAP_ST URCTURE *PciExpressCap2161 IN PCIE_CAP_STRUCTURE *PciExpressCap 1747 2162 ); 1748 2163 … … 1756 2171 EFI_STATUS 1757 2172 ExplainPcieSlotControl ( 1758 IN PCIE_CAP_ST URCTURE *PciExpressCap2173 IN PCIE_CAP_STRUCTURE *PciExpressCap 1759 2174 ); 1760 2175 … … 1768 2183 EFI_STATUS 1769 2184 ExplainPcieSlotStatus ( 1770 IN PCIE_CAP_ST URCTURE *PciExpressCap2185 IN PCIE_CAP_STRUCTURE *PciExpressCap 1771 2186 ); 1772 2187 … … 1780 2195 EFI_STATUS 1781 2196 ExplainPcieRootControl ( 1782 IN PCIE_CAP_ST URCTURE *PciExpressCap2197 IN PCIE_CAP_STRUCTURE *PciExpressCap 1783 2198 ); 1784 2199 … … 1792 2207 EFI_STATUS 1793 2208 ExplainPcieRootCap ( 1794 IN PCIE_CAP_ST URCTURE *PciExpressCap2209 IN PCIE_CAP_STRUCTURE *PciExpressCap 1795 2210 ); 1796 2211 … … 1804 2219 EFI_STATUS 1805 2220 ExplainPcieRootStatus ( 1806 IN PCIE_CAP_ST URCTURE *PciExpressCap2221 IN PCIE_CAP_STRUCTURE *PciExpressCap 1807 2222 ); 1808 2223 1809 typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCIE_CAP_ST URCTURE *PciExpressCap);2224 typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCIE_CAP_STRUCTURE *PciExpressCap); 1810 2225 1811 2226 typedef enum { … … 2055 2470 CHAR16 *ProblemParam; 2056 2471 SHELL_STATUS ShellStatus; 2057 UINTN Size;2058 2472 CONST CHAR16 *Temp; 2473 UINT64 RetVal; 2474 UINT16 EnhancedDump; 2059 2475 2060 2476 ShellStatus = SHELL_SUCCESS; 2061 2477 Status = EFI_SUCCESS; 2062 2478 Address = 0; 2063 Size = 0;2064 2479 IoDev = NULL; 2065 2480 HandleBuf = NULL; … … 2311 2726 Temp = ShellCommandLineGetValue(Package, L"-s"); 2312 2727 if (Temp != NULL) { 2313 Segment = (UINT16) ShellStrToUintn (Temp); 2728 // 2729 // Input converted to hexadecimal number. 2730 // 2731 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { 2732 Segment = (UINT16) RetVal; 2733 } else { 2734 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle); 2735 ShellStatus = SHELL_INVALID_PARAMETER; 2736 goto Done; 2737 } 2314 2738 } 2315 2739 … … 2320 2744 Temp = ShellCommandLineGetRawValue(Package, 1); 2321 2745 if (Temp != NULL) { 2322 Bus = (UINT16)ShellStrToUintn(Temp); 2746 // 2747 // Input converted to hexadecimal number. 2748 // 2749 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { 2750 Bus = (UINT16) RetVal; 2751 } else { 2752 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle); 2753 ShellStatus = SHELL_INVALID_PARAMETER; 2754 goto Done; 2755 } 2756 2323 2757 if (Bus > MAX_BUS_NUMBER) { 2324 2758 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp); … … 2329 2763 Temp = ShellCommandLineGetRawValue(Package, 2); 2330 2764 if (Temp != NULL) { 2331 Device = (UINT16) ShellStrToUintn(Temp); 2765 // 2766 // Input converted to hexadecimal number. 2767 // 2768 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { 2769 Device = (UINT16) RetVal; 2770 } else { 2771 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle); 2772 ShellStatus = SHELL_INVALID_PARAMETER; 2773 goto Done; 2774 } 2775 2332 2776 if (Device > MAX_DEVICE_NUMBER){ 2333 2777 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp); … … 2339 2783 Temp = ShellCommandLineGetRawValue(Package, 3); 2340 2784 if (Temp != NULL) { 2341 Func = (UINT16) ShellStrToUintn(Temp); 2785 // 2786 // Input converted to hexadecimal number. 2787 // 2788 if (!EFI_ERROR (ShellConvertStringToUint64 (Temp, &RetVal, TRUE, TRUE))) { 2789 Func = (UINT16) RetVal; 2790 } else { 2791 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV_HEX), gShellDebug1HiiHandle); 2792 ShellStatus = SHELL_INVALID_PARAMETER; 2793 goto Done; 2794 } 2795 2342 2796 if (Func > MAX_FUNCTION_NUMBER){ 2343 2797 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp); … … 2362 2816 ShellPrintHiiEx( 2363 2817 -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle, 2364 gShellDebug1HiiHandle,2365 2818 Segment, 2366 2819 Bus … … 2424 2877 // 2425 2878 if (ExplainData) { 2426 Status = PciExplainData (&ConfigSpace, Address, IoDev); 2879 EnhancedDump = 0; 2880 if (ShellCommandLineGetFlag(Package, L"-_e")) { 2881 EnhancedDump = 0xFFFF; 2882 Temp = ShellCommandLineGetValue(Package, L"-_e"); 2883 if (Temp != NULL) { 2884 EnhancedDump = (UINT16) ShellHexStrToUintn (Temp); 2885 } 2886 } 2887 Status = PciExplainData (&ConfigSpace, Address, IoDev, EnhancedDump); 2427 2888 } 2428 2889 } … … 2465 2926 UINTN Index; 2466 2927 EFI_STATUS Status; 2467 BOOLEAN FoundInterface;2468 2928 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors; 2469 2929 UINT16 MinBus; … … 2471 2931 BOOLEAN IsEnd; 2472 2932 2473 FoundInterface = FALSE;2474 2933 // 2475 2934 // Go through all handles, until the one meets the criteria is found … … 2503 2962 2504 2963 if (MinBus <= Bus && MaxBus >= Bus) { 2505 FoundInterface = TRUE; 2506 break; 2964 return EFI_SUCCESS; 2507 2965 } 2508 2966 } 2509 2967 } 2510 2968 2511 if (FoundInterface) { 2512 return EFI_SUCCESS; 2513 } else { 2514 return EFI_INVALID_PARAMETER; 2515 } 2969 return EFI_NOT_FOUND; 2516 2970 } 2517 2971 … … 2625 3079 @param[in] Address Address used to access configuration space of this PCI device. 2626 3080 @param[in] IoDev Handle used to access configuration space of PCI device. 3081 @param[in] EnhancedDump The print format for the dump data. 2627 3082 2628 3083 @retval EFI_SUCCESS The command completed successfully. … … 2632 3087 IN PCI_CONFIG_SPACE *ConfigSpace, 2633 3088 IN UINT64 Address, 2634 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev 3089 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 3090 IN CONST UINT16 EnhancedDump 2635 3091 ) 2636 3092 { … … 2642 3098 Common = &(ConfigSpace->Common); 2643 3099 2644 Print (L"\n");3100 ShellPrintEx (-1, -1, L"\r\n"); 2645 3101 2646 3102 // … … 2667 3123 // Print register Revision ID 2668 3124 // 2669 ShellPrintEx(-1, -1, L" /r/n");3125 ShellPrintEx(-1, -1, L"\r\n"); 2670 3126 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle, 2671 3127 INDEX_OF (&(Common->RevisionId)), … … 2743 3199 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle); 2744 3200 PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE); 2745 Print (L"\n");3201 ShellPrintEx (-1, -1, L"\r\n"); 2746 3202 2747 3203 if (ShellGetExecutionBreakFlag()) { … … 2790 3246 // 2791 3247 if ((Common->Status) & EFI_PCI_STATUS_CAPABILITY) { 2792 PciExplainCapabilityStruct (IoDev, Address, CapPtr );3248 PciExplainCapabilityStruct (IoDev, Address, CapPtr, EnhancedDump); 2793 3249 } 2794 3250 … … 2834 3290 BarExist = TRUE; 2835 3291 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle); 2836 Print (L" --------------------------------------------------------------------------");3292 ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------"); 2837 3293 } 2838 3294 … … 2854 3310 2855 3311 } else { 2856 Print (L"\n --------------------------------------------------------------------------");3312 ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------"); 2857 3313 } 2858 3314 … … 2985 3441 BarExist = TRUE; 2986 3442 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle); 2987 Print (L" --------------------------------------------------------------------------");3443 ShellPrintEx (-1, -1, L" --------------------------------------------------------------------------"); 2988 3444 } 2989 3445 … … 3004 3460 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle); 3005 3461 } else { 3006 Print (L"\n --------------------------------------------------------------------------");3462 ShellPrintEx (-1, -1, L"\r\n --------------------------------------------------------------------------"); 3007 3463 } 3008 3464 … … 3032 3488 ); 3033 3489 3034 Print (L" ------------------------------------------------------\n");3490 ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n"); 3035 3491 3036 3492 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus); … … 3059 3515 // 3060 3516 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle); 3061 Print (L"----------------------------------------------------------------------\n");3517 ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n"); 3062 3518 3063 3519 // … … 3200 3656 Bar64 = 0x0; 3201 3657 CopyMem (&Bar64, Bar, sizeof (UINT64)); 3202 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32));3658 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, (UINT32) RShiftU64 ((Bar64 & 0xfffffffffffffff0ULL), 32)); 3203 3659 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0ULL)); 3204 3660 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle); … … 3228 3684 IsMem = FALSE; 3229 3685 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc); 3230 Print (L"I/O ");3686 ShellPrintEx (-1, -1, L"I/O "); 3231 3687 } 3232 3688 … … 3300 3756 3301 3757 } else { 3302 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, RShiftU64 (NewBar64, 32));3758 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) RShiftU64 (NewBar64, 32)); 3303 3759 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) NewBar64); 3304 Print (L" ");3760 ShellPrintEx (-1, -1, L" "); 3305 3761 ShellPrintHiiEx(-1, -1, NULL, 3306 3762 STRING_TOKEN (STR_PCI2_RSHIFT), 3307 3763 gShellDebug1HiiHandle, 3308 RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32)3764 (UINT32) RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1), 32) 3309 3765 ); 3310 3766 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0ULL) - 1)); … … 3362 3818 ); 3363 3819 3364 Print (L" ------------------------------------------------------\n");3820 ShellPrintEx (-1, -1, L" ------------------------------------------------------\r\n"); 3365 3821 3366 3822 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber); … … 3382 3838 // 3383 3839 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle); 3384 Print (L"----------------------------------------------------------------------\n");3840 ShellPrintEx (-1, -1, L"----------------------------------------------------------------------\r\n"); 3385 3841 3386 3842 ShellPrintHiiEx(-1, -1, NULL, … … 3754 4210 Print each capability structure. 3755 4211 3756 @param[in] IoDev The pointer to the deivce. 3757 @param[in] Address The address to start at. 3758 @param[in] CapPtr The offset from the address. 4212 @param[in] IoDev The pointer to the deivce. 4213 @param[in] Address The address to start at. 4214 @param[in] CapPtr The offset from the address. 4215 @param[in] EnhancedDump The print format for the dump data. 3759 4216 3760 4217 @retval EFI_SUCCESS The operation was successful. … … 3764 4221 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 3765 4222 IN UINT64 Address, 3766 IN UINT8 CapPtr 4223 IN UINT8 CapPtr, 4224 IN CONST UINT16 EnhancedDump 3767 4225 ) 3768 4226 { … … 3787 4245 // 3788 4246 if (EFI_PCI_CAPABILITY_ID_PCIEXP == CapabilityID) { 3789 PciExplainPciExpress (IoDev, Address, CapabilityPtr );4247 PciExplainPciExpress (IoDev, Address, CapabilityPtr, EnhancedDump); 3790 4248 return EFI_SUCCESS; 3791 4249 } … … 3808 4266 EFI_STATUS 3809 4267 ExplainPcieCapReg ( 3810 IN PCIE_CAP_ST URCTURE *PciExpressCap4268 IN PCIE_CAP_STRUCTURE *PciExpressCap 3811 4269 ) 3812 4270 { … … 3815 4273 3816 4274 PcieCapReg = PciExpressCap->PcieCapReg; 3817 Print (3818 L" Capability Version(3:0): %E0x%04x%N\ n",4275 ShellPrintEx (-1, -1, 4276 L" Capability Version(3:0): %E0x%04x%N\r\n", 3819 4277 PCIE_CAP_VERSION (PcieCapReg) 3820 4278 ); … … 3824 4282 DevicePortType = L"Unknown Type"; 3825 4283 } 3826 Print (3827 L" Device/PortType(7:4): %E%s%N\ n",4284 ShellPrintEx (-1, -1, 4285 L" Device/PortType(7:4): %E%s%N\r\n", 3828 4286 DevicePortType 3829 4287 ); … … 3835 4293 if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_ROOT_COMPLEX_ROOT_PORT || 3836 4294 PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_SWITCH_DOWNSTREAM_PORT) { 3837 Print (3838 L" Slot Implemented(8): %E%d%N\ n",4295 ShellPrintEx (-1, -1, 4296 L" Slot Implemented(8): %E%d%N\r\n", 3839 4297 PCIE_CAP_SLOT_IMPLEMENTED (PcieCapReg) 3840 4298 ); 3841 4299 } 3842 Print (3843 L" Interrupt Message Number(13:9): %E0x%05x%N\ n",4300 ShellPrintEx (-1, -1, 4301 L" Interrupt Message Number(13:9): %E0x%05x%N\r\n", 3844 4302 PCIE_CAP_INT_MSG_NUM (PcieCapReg) 3845 4303 ); … … 3856 4314 EFI_STATUS 3857 4315 ExplainPcieDeviceCap ( 3858 IN PCIE_CAP_ST URCTURE *PciExpressCap4316 IN PCIE_CAP_STRUCTURE *PciExpressCap 3859 4317 ) 3860 4318 { … … 3868 4326 PcieDeviceCap = PciExpressCap->PcieDeviceCap; 3869 4327 DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg); 3870 Print (L" Max_Payload_Size Supported(2:0): ");4328 ShellPrintEx (-1, -1, L" Max_Payload_Size Supported(2:0): "); 3871 4329 if (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap) < 6) { 3872 Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap) + 7));4330 ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap) + 7)); 3873 4331 } else { 3874 Print (L"%EUnknown%N\n");3875 } 3876 Print (3877 L" Phantom Functions Supported(4:3): %E%d%N\ n",4332 ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); 4333 } 4334 ShellPrintEx (-1, -1, 4335 L" Phantom Functions Supported(4:3): %E%d%N\r\n", 3878 4336 PCIE_CAP_PHANTOM_FUNC (PcieDeviceCap) 3879 4337 ); 3880 Print (3881 L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\ n",4338 ShellPrintEx (-1, -1, 4339 L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\r\n", 3882 4340 PCIE_CAP_EXTENDED_TAG (PcieDeviceCap) ? 8 : 5 3883 4341 ); … … 3888 4346 L0sLatency = (UINT8) PCIE_CAP_L0SLATENCY (PcieDeviceCap); 3889 4347 L1Latency = (UINT8) PCIE_CAP_L1LATENCY (PcieDeviceCap); 3890 Print (L" Endpoint L0s Acceptable Latency(8:6): ");4348 ShellPrintEx (-1, -1, L" Endpoint L0s Acceptable Latency(8:6): "); 3891 4349 if (L0sLatency < 4) { 3892 Print (L"%EMaximum of %d ns%N\n", 1 << (L0sLatency + 6));4350 ShellPrintEx (-1, -1, L"%EMaximum of %d ns%N\r\n", 1 << (L0sLatency + 6)); 3893 4351 } else { 3894 4352 if (L0sLatency < 7) { 3895 Print (L"%EMaximum of %d us%N\n", 1 << (L0sLatency - 3));4353 ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L0sLatency - 3)); 3896 4354 } else { 3897 Print (L"%ENo limit%N\n");4355 ShellPrintEx (-1, -1, L"%ENo limit%N\r\n"); 3898 4356 } 3899 4357 } 3900 Print (L" Endpoint L1 Acceptable Latency(11:9): ");4358 ShellPrintEx (-1, -1, L" Endpoint L1 Acceptable Latency(11:9): "); 3901 4359 if (L1Latency < 7) { 3902 Print (L"%EMaximum of %d us%N\n", 1 << (L1Latency + 1));4360 ShellPrintEx (-1, -1, L"%EMaximum of %d us%N\r\n", 1 << (L1Latency + 1)); 3903 4361 } else { 3904 Print (L"%ENo limit%N\n");4362 ShellPrintEx (-1, -1, L"%ENo limit%N\r\n"); 3905 4363 } 3906 4364 } 3907 Print (3908 L" Role-based Error Reporting(15): %E%d%N\ n",4365 ShellPrintEx (-1, -1, 4366 L" Role-based Error Reporting(15): %E%d%N\r\n", 3909 4367 PCIE_CAP_ERR_REPORTING (PcieDeviceCap) 3910 4368 ); … … 3915 4373 // 3916 4374 if (DevicePortType == PCIE_SWITCH_UPSTREAM_PORT) { 3917 Print (3918 L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\ n",4375 ShellPrintEx (-1, -1, 4376 L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\r\n", 3919 4377 PCIE_CAP_SLOT_POWER_VALUE (PcieDeviceCap) 3920 4378 ); 3921 Print (3922 L" Captured Slot Power Limit Scale(27:26): %E%s%N\ n",4379 ShellPrintEx (-1, -1, 4380 L" Captured Slot Power Limit Scale(27:26): %E%s%N\r\n", 3923 4381 SlotPwrLmtScaleTable[PCIE_CAP_SLOT_POWER_SCALE (PcieDeviceCap)] 3924 4382 ); … … 3928 4386 // 3929 4387 if (IS_PCIE_ENDPOINT (DevicePortType)) { 3930 Print (3931 L" Function Level Reset Capability(28): %E%d%N\ n",4388 ShellPrintEx (-1, -1, 4389 L" Function Level Reset Capability(28): %E%d%N\r\n", 3932 4390 PCIE_CAP_FUNC_LEVEL_RESET (PcieDeviceCap) 3933 4391 ); … … 3945 4403 EFI_STATUS 3946 4404 ExplainPcieDeviceControl ( 3947 IN PCIE_CAP_ST URCTURE *PciExpressCap4405 IN PCIE_CAP_STRUCTURE *PciExpressCap 3948 4406 ) 3949 4407 { … … 3953 4411 PcieCapReg = PciExpressCap->PcieCapReg; 3954 4412 PcieDeviceControl = PciExpressCap->DeviceControl; 3955 Print (3956 L" Correctable Error Reporting Enable(0): %E%d%N\ n",4413 ShellPrintEx (-1, -1, 4414 L" Correctable Error Reporting Enable(0): %E%d%N\r\n", 3957 4415 PCIE_CAP_COR_ERR_REPORTING_ENABLE (PcieDeviceControl) 3958 4416 ); 3959 Print (3960 L" Non-Fatal Error Reporting Enable(1): %E%d%N\ n",4417 ShellPrintEx (-1, -1, 4418 L" Non-Fatal Error Reporting Enable(1): %E%d%N\r\n", 3961 4419 PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE (PcieDeviceControl) 3962 4420 ); 3963 Print (3964 L" Fatal Error Reporting Enable(2): %E%d%N\ n",4421 ShellPrintEx (-1, -1, 4422 L" Fatal Error Reporting Enable(2): %E%d%N\r\n", 3965 4423 PCIE_CAP_FATAL_ERR_REPORTING_ENABLE (PcieDeviceControl) 3966 4424 ); 3967 Print (3968 L" Unsupported Request Reporting Enable(3): %E%d%N\ n",4425 ShellPrintEx (-1, -1, 4426 L" Unsupported Request Reporting Enable(3): %E%d%N\r\n", 3969 4427 PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE (PcieDeviceControl) 3970 4428 ); 3971 Print (3972 L" Enable Relaxed Ordering(4): %E%d%N\ n",4429 ShellPrintEx (-1, -1, 4430 L" Enable Relaxed Ordering(4): %E%d%N\r\n", 3973 4431 PCIE_CAP_RELAXED_ORDERING_ENABLE (PcieDeviceControl) 3974 4432 ); 3975 Print (L" Max_Payload_Size(7:5): ");4433 ShellPrintEx (-1, -1, L" Max_Payload_Size(7:5): "); 3976 4434 if (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl) < 6) { 3977 Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl) + 7));4435 ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl) + 7)); 3978 4436 } else { 3979 Print (L"%EUnknown%N\n");3980 } 3981 Print (3982 L" Extended Tag Field Enable(8): %E%d%N\ n",4437 ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); 4438 } 4439 ShellPrintEx (-1, -1, 4440 L" Extended Tag Field Enable(8): %E%d%N\r\n", 3983 4441 PCIE_CAP_EXTENDED_TAG_ENABLE (PcieDeviceControl) 3984 4442 ); 3985 Print (3986 L" Phantom Functions Enable(9): %E%d%N\ n",4443 ShellPrintEx (-1, -1, 4444 L" Phantom Functions Enable(9): %E%d%N\r\n", 3987 4445 PCIE_CAP_PHANTOM_FUNC_ENABLE (PcieDeviceControl) 3988 4446 ); 3989 Print (3990 L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\ n",4447 ShellPrintEx (-1, -1, 4448 L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\r\n", 3991 4449 PCIE_CAP_AUX_PM_ENABLE (PcieDeviceControl) 3992 4450 ); 3993 Print (3994 L" Enable No Snoop(11): %E%d%N\ n",4451 ShellPrintEx (-1, -1, 4452 L" Enable No Snoop(11): %E%d%N\r\n", 3995 4453 PCIE_CAP_NO_SNOOP_ENABLE (PcieDeviceControl) 3996 4454 ); 3997 Print (L" Max_Read_Request_Size(14:12): ");4455 ShellPrintEx (-1, -1, L" Max_Read_Request_Size(14:12): "); 3998 4456 if (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl) < 6) { 3999 Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl) + 7));4457 ShellPrintEx (-1, -1, L"%E%d bytes%N\r\n", 1 << (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl) + 7)); 4000 4458 } else { 4001 Print (L"%EUnknown%N\n");4459 ShellPrintEx (-1, -1, L"%EUnknown%N\r\n"); 4002 4460 } 4003 4461 // … … 4005 4463 // 4006 4464 if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_PCIE_TO_PCIX_BRIDGE) { 4007 Print (4008 L" Bridge Configuration Retry Enable(15): %E%d%N\ n",4465 ShellPrintEx (-1, -1, 4466 L" Bridge Configuration Retry Enable(15): %E%d%N\r\n", 4009 4467 PCIE_CAP_BRG_CONF_RETRY (PcieDeviceControl) 4010 4468 ); … … 4022 4480 EFI_STATUS 4023 4481 ExplainPcieDeviceStatus ( 4024 IN PCIE_CAP_ST URCTURE *PciExpressCap4482 IN PCIE_CAP_STRUCTURE *PciExpressCap 4025 4483 ) 4026 4484 { … … 4028 4486 4029 4487 PcieDeviceStatus = PciExpressCap->DeviceStatus; 4030 Print (4031 L" Correctable Error Detected(0): %E%d%N\ n",4488 ShellPrintEx (-1, -1, 4489 L" Correctable Error Detected(0): %E%d%N\r\n", 4032 4490 PCIE_CAP_COR_ERR_DETECTED (PcieDeviceStatus) 4033 4491 ); 4034 Print (4035 L" Non-Fatal Error Detected(1): %E%d%N\ n",4492 ShellPrintEx (-1, -1, 4493 L" Non-Fatal Error Detected(1): %E%d%N\r\n", 4036 4494 PCIE_CAP_NONFAT_ERR_DETECTED (PcieDeviceStatus) 4037 4495 ); 4038 Print (4039 L" Fatal Error Detected(2): %E%d%N\ n",4496 ShellPrintEx (-1, -1, 4497 L" Fatal Error Detected(2): %E%d%N\r\n", 4040 4498 PCIE_CAP_FATAL_ERR_DETECTED (PcieDeviceStatus) 4041 4499 ); 4042 Print (4043 L" Unsupported Request Detected(3): %E%d%N\ n",4500 ShellPrintEx (-1, -1, 4501 L" Unsupported Request Detected(3): %E%d%N\r\n", 4044 4502 PCIE_CAP_UNSUP_REQ_DETECTED (PcieDeviceStatus) 4045 4503 ); 4046 Print (4047 L" AUX Power Detected(4): %E%d%N\ n",4504 ShellPrintEx (-1, -1, 4505 L" AUX Power Detected(4): %E%d%N\r\n", 4048 4506 PCIE_CAP_AUX_POWER_DETECTED (PcieDeviceStatus) 4049 4507 ); 4050 Print (4051 L" Transactions Pending(5): %E%d%N\ n",4508 ShellPrintEx (-1, -1, 4509 L" Transactions Pending(5): %E%d%N\r\n", 4052 4510 PCIE_CAP_TRANSACTION_PENDING (PcieDeviceStatus) 4053 4511 ); … … 4064 4522 EFI_STATUS 4065 4523 ExplainPcieLinkCap ( 4066 IN PCIE_CAP_ST URCTURE *PciExpressCap4524 IN PCIE_CAP_STRUCTURE *PciExpressCap 4067 4525 ) 4068 4526 { 4069 4527 UINT32 PcieLinkCap; 4070 CHAR16 * SupLinkSpeeds;4528 CHAR16 *MaxLinkSpeed; 4071 4529 CHAR16 *AspmValue; 4072 4530 4073 4531 PcieLinkCap = PciExpressCap->LinkCap; 4074 switch (PCIE_CAP_ SUP_LINK_SPEEDS(PcieLinkCap)) {4532 switch (PCIE_CAP_MAX_LINK_SPEED (PcieLinkCap)) { 4075 4533 case 1: 4076 SupLinkSpeeds= L"2.5 GT/s";4534 MaxLinkSpeed = L"2.5 GT/s"; 4077 4535 break; 4078 4536 case 2: 4079 SupLinkSpeeds = L"5.0 GT/s and 2.5 GT/s"; 4537 MaxLinkSpeed = L"5.0 GT/s"; 4538 break; 4539 case 3: 4540 MaxLinkSpeed = L"8.0 GT/s"; 4080 4541 break; 4081 4542 default: 4082 SupLinkSpeeds= L"Unknown";4543 MaxLinkSpeed = L"Unknown"; 4083 4544 break; 4084 4545 } 4085 Print (4086 L" Supported Link Speeds(3:0): %E%s supported%N\n",4087 SupLinkSpeeds4088 ); 4089 Print (4090 L" Maximum Link Width(9:4): %Ex%d%N\ n",4546 ShellPrintEx (-1, -1, 4547 L" Maximum Link Speed(3:0): %E%s%N\r\n", 4548 MaxLinkSpeed 4549 ); 4550 ShellPrintEx (-1, -1, 4551 L" Maximum Link Width(9:4): %Ex%d%N\r\n", 4091 4552 PCIE_CAP_MAX_LINK_WIDTH (PcieLinkCap) 4092 4553 ); 4093 4554 switch (PCIE_CAP_ASPM_SUPPORT (PcieLinkCap)) { 4555 case 0: 4556 AspmValue = L"Not"; 4557 break; 4094 4558 case 1: 4095 AspmValue = L"L0s Entry"; 4559 AspmValue = L"L0s"; 4560 break; 4561 case 2: 4562 AspmValue = L"L1"; 4096 4563 break; 4097 4564 case 3: … … 4102 4569 break; 4103 4570 } 4104 Print (4105 L" Active State Power Management Support(11:10): %E%s Supported%N\ n",4571 ShellPrintEx (-1, -1, 4572 L" Active State Power Management Support(11:10): %E%s Supported%N\r\n", 4106 4573 AspmValue 4107 4574 ); 4108 Print (4109 L" L0s Exit Latency(14:12): %E%s%N\ n",4575 ShellPrintEx (-1, -1, 4576 L" L0s Exit Latency(14:12): %E%s%N\r\n", 4110 4577 L0sLatencyStrTable[PCIE_CAP_L0S_LATENCY (PcieLinkCap)] 4111 4578 ); 4112 Print (4113 L" L1 Exit Latency(17:15): %E%s%N\ n",4579 ShellPrintEx (-1, -1, 4580 L" L1 Exit Latency(17:15): %E%s%N\r\n", 4114 4581 L1LatencyStrTable[PCIE_CAP_L0S_LATENCY (PcieLinkCap)] 4115 4582 ); 4116 Print (4117 L" Clock Power Management(18): %E%d%N\ n",4583 ShellPrintEx (-1, -1, 4584 L" Clock Power Management(18): %E%d%N\r\n", 4118 4585 PCIE_CAP_CLOCK_PM (PcieLinkCap) 4119 4586 ); 4120 Print (4121 L" Surprise Down Error Reporting Capable(19): %E%d%N\ n",4587 ShellPrintEx (-1, -1, 4588 L" Surprise Down Error Reporting Capable(19): %E%d%N\r\n", 4122 4589 PCIE_CAP_SUP_DOWN_ERR_REPORTING (PcieLinkCap) 4123 4590 ); 4124 Print (4125 L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\ n",4591 ShellPrintEx (-1, -1, 4592 L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\r\n", 4126 4593 PCIE_CAP_LINK_ACTIVE_REPORTING (PcieLinkCap) 4127 4594 ); 4128 Print (4129 L" Link Bandwidth Notification Capability(21): %E%d%N\ n",4595 ShellPrintEx (-1, -1, 4596 L" Link Bandwidth Notification Capability(21): %E%d%N\r\n", 4130 4597 PCIE_CAP_LINK_BWD_NOTIF_CAP (PcieLinkCap) 4131 4598 ); 4132 Print (4133 L" Port Number(31:24): %E0x%02x%N\ n",4599 ShellPrintEx (-1, -1, 4600 L" Port Number(31:24): %E0x%02x%N\r\n", 4134 4601 PCIE_CAP_PORT_NUMBER (PcieLinkCap) 4135 4602 ); … … 4146 4613 EFI_STATUS 4147 4614 ExplainPcieLinkControl ( 4148 IN PCIE_CAP_ST URCTURE *PciExpressCap4615 IN PCIE_CAP_STRUCTURE *PciExpressCap 4149 4616 ) 4150 4617 { … … 4154 4621 PcieLinkControl = PciExpressCap->LinkControl; 4155 4622 DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap->PcieCapReg); 4156 Print (4157 L" Active State Power Management Control(1:0): %E%s%N\ n",4623 ShellPrintEx (-1, -1, 4624 L" Active State Power Management Control(1:0): %E%s%N\r\n", 4158 4625 ASPMCtrlStrTable[PCIE_CAP_ASPM_CONTROL (PcieLinkControl)] 4159 4626 ); … … 4162 4629 // 4163 4630 if (!IS_PCIE_SWITCH(DevicePortType)) { 4164 Print (4165 L" Read Completion Boundary (RCB)(3): %E%d byte%N\ n",4631 ShellPrintEx (-1, -1, 4632 L" Read Completion Boundary (RCB)(3): %E%d byte%N\r\n", 4166 4633 1 << (PCIE_CAP_RCB (PcieLinkControl) + 6) 4167 4634 ); … … 4176 4643 DevicePortType != PCIE_SWITCH_UPSTREAM_PORT && 4177 4644 DevicePortType != PCIE_PCIE_TO_PCIX_BRIDGE) { 4178 Print (4179 L" Link Disable(4): %E%d%N\ n",4645 ShellPrintEx (-1, -1, 4646 L" Link Disable(4): %E%d%N\r\n", 4180 4647 PCIE_CAP_LINK_DISABLE (PcieLinkControl) 4181 4648 ); 4182 4649 } 4183 Print (4184 L" Common Clock Configuration(6): %E%d%N\ n",4650 ShellPrintEx (-1, -1, 4651 L" Common Clock Configuration(6): %E%d%N\r\n", 4185 4652 PCIE_CAP_COMMON_CLK_CONF (PcieLinkControl) 4186 4653 ); 4187 Print (4188 L" Extended Synch(7): %E%d%N\ n",4654 ShellPrintEx (-1, -1, 4655 L" Extended Synch(7): %E%d%N\r\n", 4189 4656 PCIE_CAP_EXT_SYNC (PcieLinkControl) 4190 4657 ); 4191 Print (4192 L" Enable Clock Power Management(8): %E%d%N\ n",4658 ShellPrintEx (-1, -1, 4659 L" Enable Clock Power Management(8): %E%d%N\r\n", 4193 4660 PCIE_CAP_CLK_PWR_MNG (PcieLinkControl) 4194 4661 ); 4195 Print (4196 L" Hardware Autonomous Width Disable(9): %E%d%N\ n",4662 ShellPrintEx (-1, -1, 4663 L" Hardware Autonomous Width Disable(9): %E%d%N\r\n", 4197 4664 PCIE_CAP_HW_AUTO_WIDTH_DISABLE (PcieLinkControl) 4198 4665 ); 4199 Print (4200 L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\ n",4666 ShellPrintEx (-1, -1, 4667 L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\r\n", 4201 4668 PCIE_CAP_LINK_BDW_MNG_INT_EN (PcieLinkControl) 4202 4669 ); 4203 Print (4204 L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\ n",4670 ShellPrintEx (-1, -1, 4671 L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\r\n", 4205 4672 PCIE_CAP_LINK_AUTO_BDW_INT_EN (PcieLinkControl) 4206 4673 ); … … 4217 4684 EFI_STATUS 4218 4685 ExplainPcieLinkStatus ( 4219 IN PCIE_CAP_ST URCTURE *PciExpressCap4686 IN PCIE_CAP_STRUCTURE *PciExpressCap 4220 4687 ) 4221 4688 { 4222 4689 UINT16 PcieLinkStatus; 4223 CHAR16 * SupLinkSpeeds;4690 CHAR16 *CurLinkSpeed; 4224 4691 4225 4692 PcieLinkStatus = PciExpressCap->LinkStatus; 4226 4693 switch (PCIE_CAP_CUR_LINK_SPEED (PcieLinkStatus)) { 4227 4694 case 1: 4228 SupLinkSpeeds= L"2.5 GT/s";4695 CurLinkSpeed = L"2.5 GT/s"; 4229 4696 break; 4230 4697 case 2: 4231 SupLinkSpeeds = L"5.0 GT/s"; 4698 CurLinkSpeed = L"5.0 GT/s"; 4699 break; 4700 case 3: 4701 CurLinkSpeed = L"8.0 GT/s"; 4232 4702 break; 4233 4703 default: 4234 SupLinkSpeeds= L"Reserved";4704 CurLinkSpeed = L"Reserved"; 4235 4705 break; 4236 4706 } 4237 Print (4238 L" Current Link Speed(3:0): %E%s%N\ n",4239 SupLinkSpeeds4240 ); 4241 Print (4242 L" Negotiated Link Width(9:4): %Ex%d%N\ n",4707 ShellPrintEx (-1, -1, 4708 L" Current Link Speed(3:0): %E%s%N\r\n", 4709 CurLinkSpeed 4710 ); 4711 ShellPrintEx (-1, -1, 4712 L" Negotiated Link Width(9:4): %Ex%d%N\r\n", 4243 4713 PCIE_CAP_NEGO_LINK_WIDTH (PcieLinkStatus) 4244 4714 ); 4245 Print (4246 L" Link Training(11): %E%d%N\ n",4715 ShellPrintEx (-1, -1, 4716 L" Link Training(11): %E%d%N\r\n", 4247 4717 PCIE_CAP_LINK_TRAINING (PcieLinkStatus) 4248 4718 ); 4249 Print (4250 L" Slot Clock Configuration(12): %E%d%N\ n",4719 ShellPrintEx (-1, -1, 4720 L" Slot Clock Configuration(12): %E%d%N\r\n", 4251 4721 PCIE_CAP_SLOT_CLK_CONF (PcieLinkStatus) 4252 4722 ); 4253 Print (4254 L" Data Link Layer Link Active(13): %E%d%N\ n",4723 ShellPrintEx (-1, -1, 4724 L" Data Link Layer Link Active(13): %E%d%N\r\n", 4255 4725 PCIE_CAP_DATA_LINK_ACTIVE (PcieLinkStatus) 4256 4726 ); 4257 Print (4258 L" Link Bandwidth Management Status(14): %E%d%N\ n",4727 ShellPrintEx (-1, -1, 4728 L" Link Bandwidth Management Status(14): %E%d%N\r\n", 4259 4729 PCIE_CAP_LINK_BDW_MNG_STAT (PcieLinkStatus) 4260 4730 ); 4261 Print (4262 L" Link Autonomous Bandwidth Status(15): %E%d%N\ n",4731 ShellPrintEx (-1, -1, 4732 L" Link Autonomous Bandwidth Status(15): %E%d%N\r\n", 4263 4733 PCIE_CAP_LINK_AUTO_BDW_STAT (PcieLinkStatus) 4264 4734 ); … … 4275 4745 EFI_STATUS 4276 4746 ExplainPcieSlotCap ( 4277 IN PCIE_CAP_ST URCTURE *PciExpressCap4747 IN PCIE_CAP_STRUCTURE *PciExpressCap 4278 4748 ) 4279 4749 { … … 4282 4752 PcieSlotCap = PciExpressCap->SlotCap; 4283 4753 4284 Print (4285 L" Attention Button Present(0): %E%d%N\ n",4754 ShellPrintEx (-1, -1, 4755 L" Attention Button Present(0): %E%d%N\r\n", 4286 4756 PCIE_CAP_ATT_BUT_PRESENT (PcieSlotCap) 4287 4757 ); 4288 Print (4289 L" Power Controller Present(1): %E%d%N\ n",4758 ShellPrintEx (-1, -1, 4759 L" Power Controller Present(1): %E%d%N\r\n", 4290 4760 PCIE_CAP_PWR_CTRLLER_PRESENT (PcieSlotCap) 4291 4761 ); 4292 Print (4293 L" MRL Sensor Present(2): %E%d%N\ n",4762 ShellPrintEx (-1, -1, 4763 L" MRL Sensor Present(2): %E%d%N\r\n", 4294 4764 PCIE_CAP_MRL_SENSOR_PRESENT (PcieSlotCap) 4295 4765 ); 4296 Print (4297 L" Attention Indicator Present(3): %E%d%N\ n",4766 ShellPrintEx (-1, -1, 4767 L" Attention Indicator Present(3): %E%d%N\r\n", 4298 4768 PCIE_CAP_ATT_IND_PRESENT (PcieSlotCap) 4299 4769 ); 4300 Print (4301 L" Power Indicator Present(4): %E%d%N\ n",4770 ShellPrintEx (-1, -1, 4771 L" Power Indicator Present(4): %E%d%N\r\n", 4302 4772 PCIE_CAP_PWD_IND_PRESENT (PcieSlotCap) 4303 4773 ); 4304 Print (4305 L" Hot-Plug Surprise(5): %E%d%N\ n",4774 ShellPrintEx (-1, -1, 4775 L" Hot-Plug Surprise(5): %E%d%N\r\n", 4306 4776 PCIE_CAP_HOTPLUG_SUPPRISE (PcieSlotCap) 4307 4777 ); 4308 Print (4309 L" Hot-Plug Capable(6): %E%d%N\ n",4778 ShellPrintEx (-1, -1, 4779 L" Hot-Plug Capable(6): %E%d%N\r\n", 4310 4780 PCIE_CAP_HOTPLUG_CAPABLE (PcieSlotCap) 4311 4781 ); 4312 Print (4313 L" Slot Power Limit Value(14:7): %E0x%02x%N\ n",4782 ShellPrintEx (-1, -1, 4783 L" Slot Power Limit Value(14:7): %E0x%02x%N\r\n", 4314 4784 PCIE_CAP_SLOT_PWR_LIMIT_VALUE (PcieSlotCap) 4315 4785 ); 4316 Print (4317 L" Slot Power Limit Scale(16:15): %E%s%N\ n",4786 ShellPrintEx (-1, -1, 4787 L" Slot Power Limit Scale(16:15): %E%s%N\r\n", 4318 4788 SlotPwrLmtScaleTable[PCIE_CAP_SLOT_PWR_LIMIT_SCALE (PcieSlotCap)] 4319 4789 ); 4320 Print (4321 L" Electromechanical Interlock Present(17): %E%d%N\ n",4790 ShellPrintEx (-1, -1, 4791 L" Electromechanical Interlock Present(17): %E%d%N\r\n", 4322 4792 PCIE_CAP_ELEC_INTERLOCK_PRESENT (PcieSlotCap) 4323 4793 ); 4324 Print (4325 L" No Command Completed Support(18): %E%d%N\ n",4794 ShellPrintEx (-1, -1, 4795 L" No Command Completed Support(18): %E%d%N\r\n", 4326 4796 PCIE_CAP_NO_COMM_COMPLETED_SUP (PcieSlotCap) 4327 4797 ); 4328 Print (4329 L" Physical Slot Number(31:19): %E%d%N\ n",4798 ShellPrintEx (-1, -1, 4799 L" Physical Slot Number(31:19): %E%d%N\r\n", 4330 4800 PCIE_CAP_PHY_SLOT_NUM (PcieSlotCap) 4331 4801 ); … … 4343 4813 EFI_STATUS 4344 4814 ExplainPcieSlotControl ( 4345 IN PCIE_CAP_ST URCTURE *PciExpressCap4815 IN PCIE_CAP_STRUCTURE *PciExpressCap 4346 4816 ) 4347 4817 { … … 4349 4819 4350 4820 PcieSlotControl = PciExpressCap->SlotControl; 4351 Print (4352 L" Attention Button Pressed Enable(0): %E%d%N\ n",4821 ShellPrintEx (-1, -1, 4822 L" Attention Button Pressed Enable(0): %E%d%N\r\n", 4353 4823 PCIE_CAP_ATT_BUT_ENABLE (PcieSlotControl) 4354 4824 ); 4355 Print (4356 L" Power Fault Detected Enable(1): %E%d%N\ n",4825 ShellPrintEx (-1, -1, 4826 L" Power Fault Detected Enable(1): %E%d%N\r\n", 4357 4827 PCIE_CAP_PWR_FLT_DETECT_ENABLE (PcieSlotControl) 4358 4828 ); 4359 Print (4360 L" MRL Sensor Changed Enable(2): %E%d%N\ n",4829 ShellPrintEx (-1, -1, 4830 L" MRL Sensor Changed Enable(2): %E%d%N\r\n", 4361 4831 PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE (PcieSlotControl) 4362 4832 ); 4363 Print (4364 L" Presence Detect Changed Enable(3): %E%d%N\ n",4833 ShellPrintEx (-1, -1, 4834 L" Presence Detect Changed Enable(3): %E%d%N\r\n", 4365 4835 PCIE_CAP_PRES_DETECT_CHANGE_ENABLE (PcieSlotControl) 4366 4836 ); 4367 Print (4368 L" Command Completed Interrupt Enable(4): %E%d%N\ n",4837 ShellPrintEx (-1, -1, 4838 L" Command Completed Interrupt Enable(4): %E%d%N\r\n", 4369 4839 PCIE_CAP_COMM_CMPL_INT_ENABLE (PcieSlotControl) 4370 4840 ); 4371 Print (4372 L" Hot-Plug Interrupt Enable(5): %E%d%N\ n",4841 ShellPrintEx (-1, -1, 4842 L" Hot-Plug Interrupt Enable(5): %E%d%N\r\n", 4373 4843 PCIE_CAP_HOTPLUG_INT_ENABLE (PcieSlotControl) 4374 4844 ); 4375 Print (4376 L" Attention Indicator Control(7:6): %E%s%N\ n",4845 ShellPrintEx (-1, -1, 4846 L" Attention Indicator Control(7:6): %E%s%N\r\n", 4377 4847 IndicatorTable[PCIE_CAP_ATT_IND_CTRL (PcieSlotControl)] 4378 4848 ); 4379 Print (4380 L" Power Indicator Control(9:8): %E%s%N\ n",4849 ShellPrintEx (-1, -1, 4850 L" Power Indicator Control(9:8): %E%s%N\r\n", 4381 4851 IndicatorTable[PCIE_CAP_PWR_IND_CTRL (PcieSlotControl)] 4382 4852 ); 4383 Print (L" Power Controller Control(10): %EPower ");4853 ShellPrintEx (-1, -1, L" Power Controller Control(10): %EPower "); 4384 4854 if (PCIE_CAP_PWR_CTRLLER_CTRL (PcieSlotControl)) { 4385 Print (L"Off%N\n");4855 ShellPrintEx (-1, -1, L"Off%N\r\n"); 4386 4856 } else { 4387 Print (L"On%N\n");4388 } 4389 Print (4390 L" Electromechanical Interlock Control(11): %E%d%N\ n",4857 ShellPrintEx (-1, -1, L"On%N\r\n"); 4858 } 4859 ShellPrintEx (-1, -1, 4860 L" Electromechanical Interlock Control(11): %E%d%N\r\n", 4391 4861 PCIE_CAP_ELEC_INTERLOCK_CTRL (PcieSlotControl) 4392 4862 ); 4393 Print (4394 L" Data Link Layer State Changed Enable(12): %E%d%N\ n",4863 ShellPrintEx (-1, -1, 4864 L" Data Link Layer State Changed Enable(12): %E%d%N\r\n", 4395 4865 PCIE_CAP_DLINK_STAT_CHANGE_ENABLE (PcieSlotControl) 4396 4866 ); … … 4407 4877 EFI_STATUS 4408 4878 ExplainPcieSlotStatus ( 4409 IN PCIE_CAP_ST URCTURE *PciExpressCap4879 IN PCIE_CAP_STRUCTURE *PciExpressCap 4410 4880 ) 4411 4881 { … … 4414 4884 PcieSlotStatus = PciExpressCap->SlotStatus; 4415 4885 4416 Print (4417 L" Attention Button Pressed(0): %E%d%N\ n",4886 ShellPrintEx (-1, -1, 4887 L" Attention Button Pressed(0): %E%d%N\r\n", 4418 4888 PCIE_CAP_ATT_BUT_PRESSED (PcieSlotStatus) 4419 4889 ); 4420 Print (4421 L" Power Fault Detected(1): %E%d%N\ n",4890 ShellPrintEx (-1, -1, 4891 L" Power Fault Detected(1): %E%d%N\r\n", 4422 4892 PCIE_CAP_PWR_FLT_DETECTED (PcieSlotStatus) 4423 4893 ); 4424 Print (4425 L" MRL Sensor Changed(2): %E%d%N\ n",4894 ShellPrintEx (-1, -1, 4895 L" MRL Sensor Changed(2): %E%d%N\r\n", 4426 4896 PCIE_CAP_MRL_SENSOR_CHANGED (PcieSlotStatus) 4427 4897 ); 4428 Print (4429 L" Presence Detect Changed(3): %E%d%N\ n",4898 ShellPrintEx (-1, -1, 4899 L" Presence Detect Changed(3): %E%d%N\r\n", 4430 4900 PCIE_CAP_PRES_DETECT_CHANGED (PcieSlotStatus) 4431 4901 ); 4432 Print (4433 L" Command Completed(4): %E%d%N\ n",4902 ShellPrintEx (-1, -1, 4903 L" Command Completed(4): %E%d%N\r\n", 4434 4904 PCIE_CAP_COMM_COMPLETED (PcieSlotStatus) 4435 4905 ); 4436 Print (L" MRL Sensor State(5): %EMRL ");4906 ShellPrintEx (-1, -1, L" MRL Sensor State(5): %EMRL "); 4437 4907 if (PCIE_CAP_MRL_SENSOR_STATE (PcieSlotStatus)) { 4438 Print (L" Opened%N\n");4908 ShellPrintEx (-1, -1, L" Opened%N\r\n"); 4439 4909 } else { 4440 Print (L" Closed%N\n");4441 } 4442 Print (L" Presence Detect State(6): ");4910 ShellPrintEx (-1, -1, L" Closed%N\r\n"); 4911 } 4912 ShellPrintEx (-1, -1, L" Presence Detect State(6): "); 4443 4913 if (PCIE_CAP_PRES_DETECT_STATE (PcieSlotStatus)) { 4444 Print (L"%ECard Present in slot%N\n");4914 ShellPrintEx (-1, -1, L"%ECard Present in slot%N\r\n"); 4445 4915 } else { 4446 Print (L"%ESlot Empty%N\n");4447 } 4448 Print (L" Electromechanical Interlock Status(7): %EElectromechanical Interlock ");4916 ShellPrintEx (-1, -1, L"%ESlot Empty%N\r\n"); 4917 } 4918 ShellPrintEx (-1, -1, L" Electromechanical Interlock Status(7): %EElectromechanical Interlock "); 4449 4919 if (PCIE_CAP_ELEC_INTERLOCK_STATE (PcieSlotStatus)) { 4450 Print (L"Engaged%N\n");4920 ShellPrintEx (-1, -1, L"Engaged%N\r\n"); 4451 4921 } else { 4452 Print (L"Disengaged%N\n");4453 } 4454 Print (4455 L" Data Link Layer State Changed(8): %E%d%N\ n",4922 ShellPrintEx (-1, -1, L"Disengaged%N\r\n"); 4923 } 4924 ShellPrintEx (-1, -1, 4925 L" Data Link Layer State Changed(8): %E%d%N\r\n", 4456 4926 PCIE_CAP_DLINK_STAT_CHANGED (PcieSlotStatus) 4457 4927 ); … … 4468 4938 EFI_STATUS 4469 4939 ExplainPcieRootControl ( 4470 IN PCIE_CAP_ST URCTURE *PciExpressCap4940 IN PCIE_CAP_STRUCTURE *PciExpressCap 4471 4941 ) 4472 4942 { … … 4475 4945 PcieRootControl = PciExpressCap->RootControl; 4476 4946 4477 Print (4478 L" System Error on Correctable Error Enable(0): %E%d%N\ n",4947 ShellPrintEx (-1, -1, 4948 L" System Error on Correctable Error Enable(0): %E%d%N\r\n", 4479 4949 PCIE_CAP_SYSERR_ON_CORERR_EN (PcieRootControl) 4480 4950 ); 4481 Print (4482 L" System Error on Non-Fatal Error Enable(1): %E%d%N\ n",4951 ShellPrintEx (-1, -1, 4952 L" System Error on Non-Fatal Error Enable(1): %E%d%N\r\n", 4483 4953 PCIE_CAP_SYSERR_ON_NONFATERR_EN (PcieRootControl) 4484 4954 ); 4485 Print (4486 L" System Error on Fatal Error Enable(2): %E%d%N\ n",4955 ShellPrintEx (-1, -1, 4956 L" System Error on Fatal Error Enable(2): %E%d%N\r\n", 4487 4957 PCIE_CAP_SYSERR_ON_FATERR_EN (PcieRootControl) 4488 4958 ); 4489 Print (4490 L" PME Interrupt Enable(3): %E%d%N\ n",4959 ShellPrintEx (-1, -1, 4960 L" PME Interrupt Enable(3): %E%d%N\r\n", 4491 4961 PCIE_CAP_PME_INT_ENABLE (PcieRootControl) 4492 4962 ); 4493 Print (4494 L" CRS Software Visibility Enable(4): %E%d%N\ n",4963 ShellPrintEx (-1, -1, 4964 L" CRS Software Visibility Enable(4): %E%d%N\r\n", 4495 4965 PCIE_CAP_CRS_SW_VIS_ENABLE (PcieRootControl) 4496 4966 ); … … 4508 4978 EFI_STATUS 4509 4979 ExplainPcieRootCap ( 4510 IN PCIE_CAP_ST URCTURE *PciExpressCap4980 IN PCIE_CAP_STRUCTURE *PciExpressCap 4511 4981 ) 4512 4982 { … … 4515 4985 PcieRootCap = PciExpressCap->RsvdP; 4516 4986 4517 Print (4518 L" CRS Software Visibility(0): %E%d%N\ n",4987 ShellPrintEx (-1, -1, 4988 L" CRS Software Visibility(0): %E%d%N\r\n", 4519 4989 PCIE_CAP_CRS_SW_VIS (PcieRootCap) 4520 4990 ); … … 4532 5002 EFI_STATUS 4533 5003 ExplainPcieRootStatus ( 4534 IN PCIE_CAP_ST URCTURE *PciExpressCap5004 IN PCIE_CAP_STRUCTURE *PciExpressCap 4535 5005 ) 4536 5006 { … … 4539 5009 PcieRootStatus = PciExpressCap->RootStatus; 4540 5010 4541 Print (4542 L" PME Requester ID(15:0): %E0x%04x%N\ n",5011 ShellPrintEx (-1, -1, 5012 L" PME Requester ID(15:0): %E0x%04x%N\r\n", 4543 5013 PCIE_CAP_PME_REQ_ID (PcieRootStatus) 4544 5014 ); 4545 Print (4546 L" PME Status(16): %E%d%N\ n",5015 ShellPrintEx (-1, -1, 5016 L" PME Status(16): %E%d%N\r\n", 4547 5017 PCIE_CAP_PME_STATUS (PcieRootStatus) 4548 5018 ); 4549 Print (4550 L" PME Pending(17): %E%d%N\ n",5019 ShellPrintEx (-1, -1, 5020 L" PME Pending(17): %E%d%N\r\n", 4551 5021 PCIE_CAP_PME_PENDING (PcieRootStatus) 4552 5022 ); 4553 5023 return EFI_SUCCESS; 5024 } 5025 5026 /** 5027 Function to interpret and print out the link control structure 5028 5029 @param[in] HeaderAddress The Address of this capability header. 5030 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5031 **/ 5032 EFI_STATUS 5033 EFIAPI 5034 PrintInterpretedExtendedCompatibilityLinkControl ( 5035 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5036 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5037 ) 5038 { 5039 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL *Header; 5040 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL*)HeaderAddress; 5041 5042 ShellPrintHiiEx( 5043 -1, -1, NULL, 5044 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_CONTROL), 5045 gShellDebug1HiiHandle, 5046 Header->RootComplexLinkCapabilities, 5047 Header->RootComplexLinkControl, 5048 Header->RootComplexLinkStatus 5049 ); 5050 DumpHex ( 5051 4, 5052 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5053 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_INTERNAL_LINK_CONTROL), 5054 (VOID *) (HeaderAddress) 5055 ); 5056 return (EFI_SUCCESS); 5057 } 5058 5059 /** 5060 Function to interpret and print out the power budgeting structure 5061 5062 @param[in] HeaderAddress The Address of this capability header. 5063 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5064 **/ 5065 EFI_STATUS 5066 EFIAPI 5067 PrintInterpretedExtendedCompatibilityPowerBudgeting ( 5068 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5069 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5070 ) 5071 { 5072 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING *Header; 5073 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING*)HeaderAddress; 5074 5075 ShellPrintHiiEx( 5076 -1, -1, NULL, 5077 STRING_TOKEN (STR_PCI_EXT_CAP_POWER), 5078 gShellDebug1HiiHandle, 5079 Header->DataSelect, 5080 Header->Data, 5081 Header->PowerBudgetCapability 5082 ); 5083 DumpHex ( 5084 4, 5085 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5086 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_POWER_BUDGETING), 5087 (VOID *) (HeaderAddress) 5088 ); 5089 return (EFI_SUCCESS); 5090 } 5091 5092 /** 5093 Function to interpret and print out the ACS structure 5094 5095 @param[in] HeaderAddress The Address of this capability header. 5096 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5097 **/ 5098 EFI_STATUS 5099 EFIAPI 5100 PrintInterpretedExtendedCompatibilityAcs ( 5101 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5102 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5103 ) 5104 { 5105 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED *Header; 5106 UINT16 VectorSize; 5107 UINT16 LoopCounter; 5108 5109 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED*)HeaderAddress; 5110 VectorSize = 0; 5111 5112 ShellPrintHiiEx( 5113 -1, -1, NULL, 5114 STRING_TOKEN (STR_PCI_EXT_CAP_ACS), 5115 gShellDebug1HiiHandle, 5116 Header->AcsCapability, 5117 Header->AcsControl 5118 ); 5119 if (PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_CONTROL(Header)) { 5120 VectorSize = PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_GET_EGRES_VECTOR_SIZE(Header); 5121 if (VectorSize == 0) { 5122 VectorSize = 256; 5123 } 5124 for (LoopCounter = 0 ; LoopCounter * 8 < VectorSize ; LoopCounter++) { 5125 ShellPrintHiiEx( 5126 -1, -1, NULL, 5127 STRING_TOKEN (STR_PCI_EXT_CAP_ACS2), 5128 gShellDebug1HiiHandle, 5129 LoopCounter + 1, 5130 Header->EgressControlVectorArray[LoopCounter] 5131 ); 5132 } 5133 } 5134 DumpHex ( 5135 4, 5136 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5137 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ACS_EXTENDED) + (VectorSize / 8) - 1, 5138 (VOID *) (HeaderAddress) 5139 ); 5140 return (EFI_SUCCESS); 5141 } 5142 5143 /** 5144 Function to interpret and print out the latency tolerance reporting structure 5145 5146 @param[in] HeaderAddress The Address of this capability header. 5147 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5148 **/ 5149 EFI_STATUS 5150 EFIAPI 5151 PrintInterpretedExtendedCompatibilityLatencyToleranceReporting ( 5152 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5153 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5154 ) 5155 { 5156 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING *Header; 5157 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING*)HeaderAddress; 5158 5159 ShellPrintHiiEx( 5160 -1, -1, NULL, 5161 STRING_TOKEN (STR_PCI_EXT_CAP_LAT), 5162 gShellDebug1HiiHandle, 5163 Header->MaxSnoopLatency, 5164 Header->MaxNoSnoopLatency 5165 ); 5166 DumpHex ( 5167 4, 5168 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5169 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LATENCE_TOLERANCE_REPORTING), 5170 (VOID *) (HeaderAddress) 5171 ); 5172 return (EFI_SUCCESS); 5173 } 5174 5175 /** 5176 Function to interpret and print out the serial number structure 5177 5178 @param[in] HeaderAddress The Address of this capability header. 5179 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5180 **/ 5181 EFI_STATUS 5182 EFIAPI 5183 PrintInterpretedExtendedCompatibilitySerialNumber ( 5184 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5185 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5186 ) 5187 { 5188 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER *Header; 5189 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER*)HeaderAddress; 5190 5191 ShellPrintHiiEx( 5192 -1, -1, NULL, 5193 STRING_TOKEN (STR_PCI_EXT_CAP_SN), 5194 gShellDebug1HiiHandle, 5195 Header->SerialNumber 5196 ); 5197 DumpHex ( 5198 4, 5199 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5200 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_SERIAL_NUMBER), 5201 (VOID *) (HeaderAddress) 5202 ); 5203 return (EFI_SUCCESS); 5204 } 5205 5206 /** 5207 Function to interpret and print out the RCRB structure 5208 5209 @param[in] HeaderAddress The Address of this capability header. 5210 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5211 **/ 5212 EFI_STATUS 5213 EFIAPI 5214 PrintInterpretedExtendedCompatibilityRcrb ( 5215 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5216 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5217 ) 5218 { 5219 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER *Header; 5220 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER*)HeaderAddress; 5221 5222 ShellPrintHiiEx( 5223 -1, -1, NULL, 5224 STRING_TOKEN (STR_PCI_EXT_CAP_RCRB), 5225 gShellDebug1HiiHandle, 5226 Header->VendorId, 5227 Header->DeviceId, 5228 Header->RcrbCapabilities, 5229 Header->RcrbControl 5230 ); 5231 DumpHex ( 5232 4, 5233 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5234 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RCRB_HEADER), 5235 (VOID *) (HeaderAddress) 5236 ); 5237 return (EFI_SUCCESS); 5238 } 5239 5240 /** 5241 Function to interpret and print out the vendor specific structure 5242 5243 @param[in] HeaderAddress The Address of this capability header. 5244 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5245 **/ 5246 EFI_STATUS 5247 EFIAPI 5248 PrintInterpretedExtendedCompatibilityVendorSpecific ( 5249 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5250 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5251 ) 5252 { 5253 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC *Header; 5254 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VENDOR_SPECIFIC*)HeaderAddress; 5255 5256 ShellPrintHiiEx( 5257 -1, -1, NULL, 5258 STRING_TOKEN (STR_PCI_EXT_CAP_VEN), 5259 gShellDebug1HiiHandle, 5260 Header->VendorSpecificHeader 5261 ); 5262 DumpHex ( 5263 4, 5264 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5265 PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_GET_SIZE(Header), 5266 (VOID *) (HeaderAddress) 5267 ); 5268 return (EFI_SUCCESS); 5269 } 5270 5271 /** 5272 Function to interpret and print out the Event Collector Endpoint Association structure 5273 5274 @param[in] HeaderAddress The Address of this capability header. 5275 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5276 **/ 5277 EFI_STATUS 5278 EFIAPI 5279 PrintInterpretedExtendedCompatibilityECEA ( 5280 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5281 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5282 ) 5283 { 5284 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION *Header; 5285 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION*)HeaderAddress; 5286 5287 ShellPrintHiiEx( 5288 -1, -1, NULL, 5289 STRING_TOKEN (STR_PCI_EXT_CAP_ECEA), 5290 gShellDebug1HiiHandle, 5291 Header->AssociationBitmap 5292 ); 5293 DumpHex ( 5294 4, 5295 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5296 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION), 5297 (VOID *) (HeaderAddress) 5298 ); 5299 return (EFI_SUCCESS); 5300 } 5301 5302 /** 5303 Function to interpret and print out the ARI structure 5304 5305 @param[in] HeaderAddress The Address of this capability header. 5306 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5307 **/ 5308 EFI_STATUS 5309 EFIAPI 5310 PrintInterpretedExtendedCompatibilityAri ( 5311 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5312 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5313 ) 5314 { 5315 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY *Header; 5316 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY*)HeaderAddress; 5317 5318 ShellPrintHiiEx( 5319 -1, -1, NULL, 5320 STRING_TOKEN (STR_PCI_EXT_CAP_ARI), 5321 gShellDebug1HiiHandle, 5322 Header->AriCapability, 5323 Header->AriControl 5324 ); 5325 DumpHex ( 5326 4, 5327 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5328 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ARI_CAPABILITY), 5329 (VOID *) (HeaderAddress) 5330 ); 5331 return (EFI_SUCCESS); 5332 } 5333 5334 /** 5335 Function to interpret and print out the DPA structure 5336 5337 @param[in] HeaderAddress The Address of this capability header. 5338 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5339 **/ 5340 EFI_STATUS 5341 EFIAPI 5342 PrintInterpretedExtendedCompatibilityDynamicPowerAllocation ( 5343 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5344 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5345 ) 5346 { 5347 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION *Header; 5348 UINT8 LinkCount; 5349 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION*)HeaderAddress; 5350 5351 ShellPrintHiiEx( 5352 -1, -1, NULL, 5353 STRING_TOKEN (STR_PCI_EXT_CAP_DPA), 5354 gShellDebug1HiiHandle, 5355 Header->DpaCapability, 5356 Header->DpaLatencyIndicator, 5357 Header->DpaStatus, 5358 Header->DpaControl 5359 ); 5360 for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header) + 1 ; LinkCount++) { 5361 ShellPrintHiiEx( 5362 -1, -1, NULL, 5363 STRING_TOKEN (STR_PCI_EXT_CAP_DPA2), 5364 gShellDebug1HiiHandle, 5365 LinkCount+1, 5366 Header->DpaPowerAllocationArray[LinkCount] 5367 ); 5368 } 5369 DumpHex ( 5370 4, 5371 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5372 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_DYNAMIC_POWER_ALLOCATION) - 1 + PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_GET_SUBSTATE_MAX(Header), 5373 (VOID *) (HeaderAddress) 5374 ); 5375 return (EFI_SUCCESS); 5376 } 5377 5378 /** 5379 Function to interpret and print out the link declaration structure 5380 5381 @param[in] HeaderAddress The Address of this capability header. 5382 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5383 **/ 5384 EFI_STATUS 5385 EFIAPI 5386 PrintInterpretedExtendedCompatibilityLinkDeclaration ( 5387 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5388 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5389 ) 5390 { 5391 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION *Header; 5392 UINT8 LinkCount; 5393 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION*)HeaderAddress; 5394 5395 ShellPrintHiiEx( 5396 -1, -1, NULL, 5397 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR), 5398 gShellDebug1HiiHandle, 5399 Header->ElementSelfDescription 5400 ); 5401 5402 for (LinkCount = 0 ; LinkCount < PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header) ; LinkCount++) { 5403 ShellPrintHiiEx( 5404 -1, -1, NULL, 5405 STRING_TOKEN (STR_PCI_EXT_CAP_LINK_DECLAR2), 5406 gShellDebug1HiiHandle, 5407 LinkCount+1, 5408 Header->LinkEntry[LinkCount] 5409 ); 5410 } 5411 DumpHex ( 5412 4, 5413 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5414 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_LINK_DECLARATION) + (PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_GET_LINK_COUNT(Header)-1)*sizeof(UINT32), 5415 (VOID *) (HeaderAddress) 5416 ); 5417 return (EFI_SUCCESS); 5418 } 5419 5420 /** 5421 Function to interpret and print out the Advanced Error Reporting structure 5422 5423 @param[in] HeaderAddress The Address of this capability header. 5424 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5425 **/ 5426 EFI_STATUS 5427 EFIAPI 5428 PrintInterpretedExtendedCompatibilityAer ( 5429 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5430 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5431 ) 5432 { 5433 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING *Header; 5434 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING*)HeaderAddress; 5435 5436 ShellPrintHiiEx( 5437 -1, -1, NULL, 5438 STRING_TOKEN (STR_PCI_EXT_CAP_AER), 5439 gShellDebug1HiiHandle, 5440 Header->UncorrectableErrorStatus, 5441 Header->UncorrectableErrorMask, 5442 Header->UncorrectableErrorSeverity, 5443 Header->CorrectableErrorStatus, 5444 Header->CorrectableErrorMask, 5445 Header->AdvancedErrorCapabilitiesAndControl, 5446 Header->HeaderLog, 5447 Header->RootErrorCommand, 5448 Header->RootErrorStatus, 5449 Header->ErrorSourceIdentification, 5450 Header->CorrectableErrorSourceIdentification, 5451 Header->TlpPrefixLog[0], 5452 Header->TlpPrefixLog[1], 5453 Header->TlpPrefixLog[2], 5454 Header->TlpPrefixLog[3] 5455 ); 5456 DumpHex ( 5457 4, 5458 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5459 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_ADVANCED_ERROR_REPORTING), 5460 (VOID *) (HeaderAddress) 5461 ); 5462 return (EFI_SUCCESS); 5463 } 5464 5465 /** 5466 Function to interpret and print out the multicast structure 5467 5468 @param[in] HeaderAddress The Address of this capability header. 5469 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5470 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. 5471 **/ 5472 EFI_STATUS 5473 EFIAPI 5474 PrintInterpretedExtendedCompatibilityMulticast ( 5475 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5476 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, 5477 IN CONST PCIE_CAP_STRUCTURE *PciExpressCapPtr 5478 ) 5479 { 5480 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST *Header; 5481 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST*)HeaderAddress; 5482 5483 ShellPrintHiiEx( 5484 -1, -1, NULL, 5485 STRING_TOKEN (STR_PCI_EXT_CAP_MULTICAST), 5486 gShellDebug1HiiHandle, 5487 Header->MultiCastCapability, 5488 Header->MulticastControl, 5489 Header->McBaseAddress, 5490 Header->McReceiveAddress, 5491 Header->McBlockAll, 5492 Header->McBlockUntranslated, 5493 Header->McOverlayBar 5494 ); 5495 5496 DumpHex ( 5497 4, 5498 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5499 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_MULTICAST), 5500 (VOID *) (HeaderAddress) 5501 ); 5502 5503 return (EFI_SUCCESS); 5504 } 5505 5506 /** 5507 Function to interpret and print out the virtual channel and multi virtual channel structure 5508 5509 @param[in] HeaderAddress The Address of this capability header. 5510 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5511 **/ 5512 EFI_STATUS 5513 EFIAPI 5514 PrintInterpretedExtendedCompatibilityVirtualChannel ( 5515 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5516 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5517 ) 5518 { 5519 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY *Header; 5520 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC *CapabilityItem; 5521 UINT32 ItemCount; 5522 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY*)HeaderAddress; 5523 5524 ShellPrintHiiEx( 5525 -1, -1, NULL, 5526 STRING_TOKEN (STR_PCI_EXT_CAP_VC_BASE), 5527 gShellDebug1HiiHandle, 5528 Header->ExtendedVcCount, 5529 Header->PortVcCapability1, 5530 Header->PortVcCapability2, 5531 Header->VcArbTableOffset, 5532 Header->PortVcControl, 5533 Header->PortVcStatus 5534 ); 5535 for (ItemCount = 0 ; ItemCount < Header->ExtendedVcCount ; ItemCount++) { 5536 CapabilityItem = &Header->Capability[ItemCount]; 5537 ShellPrintHiiEx( 5538 -1, -1, NULL, 5539 STRING_TOKEN (STR_PCI_EXT_CAP_VC_ITEM), 5540 gShellDebug1HiiHandle, 5541 ItemCount+1, 5542 CapabilityItem->VcResourceCapability, 5543 CapabilityItem->PortArbTableOffset, 5544 CapabilityItem->VcResourceControl, 5545 CapabilityItem->VcResourceStatus 5546 ); 5547 } 5548 5549 DumpHex ( 5550 4, 5551 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5552 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_VC) + (Header->ExtendedVcCount - 1) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_VIRTUAL_CHANNEL_CAPABILITY), 5553 (VOID *) (HeaderAddress) 5554 ); 5555 5556 return (EFI_SUCCESS); 5557 } 5558 5559 /** 5560 Function to interpret and print out the resizeable bar structure 5561 5562 @param[in] HeaderAddress The Address of this capability header. 5563 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5564 **/ 5565 EFI_STATUS 5566 EFIAPI 5567 PrintInterpretedExtendedCompatibilityResizeableBar ( 5568 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5569 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5570 ) 5571 { 5572 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR *Header; 5573 UINT32 ItemCount; 5574 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR*)HeaderAddress; 5575 5576 for (ItemCount = 0 ; ItemCount < (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) ; ItemCount++) { 5577 ShellPrintHiiEx( 5578 -1, -1, NULL, 5579 STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR), 5580 gShellDebug1HiiHandle, 5581 ItemCount+1, 5582 Header->Capability[ItemCount].ResizableBarCapability, 5583 Header->Capability[ItemCount].ResizableBarControl 5584 ); 5585 } 5586 5587 DumpHex ( 5588 4, 5589 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5590 (UINT32)GET_NUMBER_RESIZABLE_BARS(Header) * sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY), 5591 (VOID *) (HeaderAddress) 5592 ); 5593 5594 return (EFI_SUCCESS); 5595 } 5596 5597 /** 5598 Function to interpret and print out the TPH structure 5599 5600 @param[in] HeaderAddress The Address of this capability header. 5601 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5602 **/ 5603 EFI_STATUS 5604 EFIAPI 5605 PrintInterpretedExtendedCompatibilityTph ( 5606 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5607 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress 5608 ) 5609 { 5610 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH *Header; 5611 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH*)HeaderAddress; 5612 5613 ShellPrintHiiEx( 5614 -1, -1, NULL, 5615 STRING_TOKEN (STR_PCI_EXT_CAP_TPH), 5616 gShellDebug1HiiHandle, 5617 Header->TphRequesterCapability, 5618 Header->TphRequesterControl 5619 ); 5620 DumpHex ( 5621 8, 5622 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->TphStTable - (UINT8*)HeadersBaseAddress), 5623 GET_TPH_TABLE_SIZE(Header), 5624 (VOID *)Header->TphStTable 5625 ); 5626 5627 DumpHex ( 5628 4, 5629 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5630 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) + GET_TPH_TABLE_SIZE(Header) - sizeof(UINT16), 5631 (VOID *) (HeaderAddress) 5632 ); 5633 5634 return (EFI_SUCCESS); 5635 } 5636 5637 /** 5638 Function to interpret and print out the secondary PCIe capability structure 5639 5640 @param[in] HeaderAddress The Address of this capability header. 5641 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5642 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. 5643 **/ 5644 EFI_STATUS 5645 EFIAPI 5646 PrintInterpretedExtendedCompatibilitySecondary ( 5647 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5648 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, 5649 IN CONST PCIE_CAP_STRUCTURE *PciExpressCapPtr 5650 ) 5651 { 5652 CONST PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE *Header; 5653 Header = (PCI_EXPRESS_EXTENDED_CAPABILITIES_SECONDARY_PCIE*)HeaderAddress; 5654 5655 ShellPrintHiiEx( 5656 -1, -1, NULL, 5657 STRING_TOKEN (STR_PCI_EXT_CAP_SECONDARY), 5658 gShellDebug1HiiHandle, 5659 Header->LinkControl3, 5660 Header->LaneErrorStatus 5661 ); 5662 DumpHex ( 5663 8, 5664 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)Header->EqualizationControl - (UINT8*)HeadersBaseAddress), 5665 PCIE_CAP_MAX_LINK_WIDTH(PciExpressCapPtr->LinkCap), 5666 (VOID *)Header->EqualizationControl 5667 ); 5668 5669 DumpHex ( 5670 4, 5671 EFI_PCIE_CAPABILITY_BASE_OFFSET + ((UINT8*)HeaderAddress - (UINT8*)HeadersBaseAddress), 5672 sizeof(PCI_EXPRESS_EXTENDED_CAPABILITIES_TPH) - sizeof(Header->EqualizationControl) + PCIE_CAP_MAX_LINK_WIDTH(PciExpressCapPtr->LinkCap), 5673 (VOID *) (HeaderAddress) 5674 ); 5675 5676 return (EFI_SUCCESS); 5677 } 5678 5679 /** 5680 Display Pcie extended capability details 5681 5682 @param[in] HeadersBaseAddress The address of all the extended capability headers. 5683 @param[in] HeaderAddress The address of this capability header. 5684 @param[in] PciExpressCapPtr The address of the PCIe capabilities structure. 5685 **/ 5686 EFI_STATUS 5687 EFIAPI 5688 PrintPciExtendedCapabilityDetails( 5689 IN CONST PCI_EXP_EXT_HDR *HeadersBaseAddress, 5690 IN CONST PCI_EXP_EXT_HDR *HeaderAddress, 5691 IN CONST PCIE_CAP_STRUCTURE *PciExpressCapPtr 5692 ) 5693 { 5694 switch (HeaderAddress->CapabilityId){ 5695 case PCI_EXPRESS_EXTENDED_CAPABILITY_ADVANCED_ERROR_REPORTING_ID: 5696 return PrintInterpretedExtendedCompatibilityAer(HeaderAddress, HeadersBaseAddress); 5697 case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_CONTROL_ID: 5698 return PrintInterpretedExtendedCompatibilityLinkControl(HeaderAddress, HeadersBaseAddress); 5699 case PCI_EXPRESS_EXTENDED_CAPABILITY_LINK_DECLARATION_ID: 5700 return PrintInterpretedExtendedCompatibilityLinkDeclaration(HeaderAddress, HeadersBaseAddress); 5701 case PCI_EXPRESS_EXTENDED_CAPABILITY_SERIAL_NUMBER_ID: 5702 return PrintInterpretedExtendedCompatibilitySerialNumber(HeaderAddress, HeadersBaseAddress); 5703 case PCI_EXPRESS_EXTENDED_CAPABILITY_POWER_BUDGETING_ID: 5704 return PrintInterpretedExtendedCompatibilityPowerBudgeting(HeaderAddress, HeadersBaseAddress); 5705 case PCI_EXPRESS_EXTENDED_CAPABILITY_ACS_EXTENDED_ID: 5706 return PrintInterpretedExtendedCompatibilityAcs(HeaderAddress, HeadersBaseAddress); 5707 case PCI_EXPRESS_EXTENDED_CAPABILITY_LATENCE_TOLERANCE_REPORTING_ID: 5708 return PrintInterpretedExtendedCompatibilityLatencyToleranceReporting(HeaderAddress, HeadersBaseAddress); 5709 case PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID: 5710 return PrintInterpretedExtendedCompatibilityAri(HeaderAddress, HeadersBaseAddress); 5711 case PCI_EXPRESS_EXTENDED_CAPABILITY_RCRB_HEADER_ID: 5712 return PrintInterpretedExtendedCompatibilityRcrb(HeaderAddress, HeadersBaseAddress); 5713 case PCI_EXPRESS_EXTENDED_CAPABILITY_VENDOR_SPECIFIC_ID: 5714 return PrintInterpretedExtendedCompatibilityVendorSpecific(HeaderAddress, HeadersBaseAddress); 5715 case PCI_EXPRESS_EXTENDED_CAPABILITY_DYNAMIC_POWER_ALLOCATION_ID: 5716 return PrintInterpretedExtendedCompatibilityDynamicPowerAllocation(HeaderAddress, HeadersBaseAddress); 5717 case PCI_EXPRESS_EXTENDED_CAPABILITY_EVENT_COLLECTOR_ENDPOINT_ASSOCIATION_ID: 5718 return PrintInterpretedExtendedCompatibilityECEA(HeaderAddress, HeadersBaseAddress); 5719 case PCI_EXPRESS_EXTENDED_CAPABILITY_VIRTUAL_CHANNEL_ID: 5720 case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTI_FUNCTION_VIRTUAL_CHANNEL_ID: 5721 return PrintInterpretedExtendedCompatibilityVirtualChannel(HeaderAddress, HeadersBaseAddress); 5722 case PCI_EXPRESS_EXTENDED_CAPABILITY_MULTICAST_ID: 5723 // 5724 // should only be present if PCIE_CAP_DEVICEPORT_TYPE(PciExpressCapPtr->PcieCapReg) == 0100b, 0101b, or 0110b 5725 // 5726 return PrintInterpretedExtendedCompatibilityMulticast(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr); 5727 case PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID: 5728 return PrintInterpretedExtendedCompatibilityResizeableBar(HeaderAddress, HeadersBaseAddress); 5729 case PCI_EXPRESS_EXTENDED_CAPABILITY_TPH_ID: 5730 return PrintInterpretedExtendedCompatibilityTph(HeaderAddress, HeadersBaseAddress); 5731 case PCI_EXPRESS_EXTENDED_CAPABILITY_SECONDARY_PCIE_ID: 5732 return PrintInterpretedExtendedCompatibilitySecondary(HeaderAddress, HeadersBaseAddress, PciExpressCapPtr); 5733 default: 5734 ShellPrintEx (-1, -1, 5735 L"Unknown PCIe extended capability ID (%04xh). No interpretation available.\r\n", 5736 HeaderAddress->CapabilityId 5737 ); 5738 return EFI_SUCCESS; 5739 }; 5740 4554 5741 } 4555 5742 … … 4560 5747 @param[in] Address The Address to start at. 4561 5748 @param[in] CapabilityPtr The offset from the address to start. 5749 @param[in] EnhancedDump The print format for the dump data. 5750 4562 5751 **/ 4563 5752 EFI_STATUS … … 4565 5754 IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev, 4566 5755 IN UINT64 Address, 4567 IN UINT8 CapabilityPtr 5756 IN UINT8 CapabilityPtr, 5757 IN CONST UINT16 EnhancedDump 4568 5758 ) 4569 5759 { 4570 5760 4571 PCIE_CAP_ST URCTURE PciExpressCap;5761 PCIE_CAP_STRUCTURE PciExpressCap; 4572 5762 EFI_STATUS Status; 4573 5763 UINT64 CapRegAddress; … … 4582 5772 UINT8 *RegAddr; 4583 5773 UINTN RegValue; 5774 PCI_EXP_EXT_HDR *ExtHdr; 4584 5775 4585 5776 CapRegAddress = Address + CapabilityPtr; … … 4594 5785 DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap.PcieCapReg); 4595 5786 4596 Print (L"\nPci Express device capability structure:\n");5787 ShellPrintEx (-1, -1, L"\r\nPci Express device capability structure:\r\n"); 4597 5788 4598 5789 for (Index = 0; PcieExplainList[Index].Type < PcieExplainTypeMax; Index++) { … … 4668 5859 Func = (UINT8) (RShiftU64 (Address, 8)); 4669 5860 4670 Pciex_Address = CALC_EFI_PCIEX_ADDRESS (Bus, Dev, Func, 0x100);4671 4672 ExtendRegSize = 0x1000 - 0x100;5861 Pciex_Address = CALC_EFI_PCIEX_ADDRESS (Bus, Dev, Func, EFI_PCIE_CAPABILITY_BASE_OFFSET); 5862 5863 ExtendRegSize = 0x1000 - EFI_PCIE_CAPABILITY_BASE_OFFSET; 4673 5864 4674 5865 ExRegBuffer = (UINT8 *) AllocateZeroPool (ExtendRegSize); … … 4676 5867 // 4677 5868 // PciRootBridgeIo protocol should support pci express extend space IO 4678 // (Begins at offset 0x100)5869 // (Begins at offset EFI_PCIE_CAPABILITY_BASE_OFFSET) 4679 5870 // 4680 5871 Status = IoDev->Pci.Read ( … … 4685 5876 (VOID *) (ExRegBuffer) 4686 5877 ); 4687 if (EFI_ERROR (Status) ) {4688 FreePool ((VOID *)ExRegBuffer);5878 if (EFI_ERROR (Status) || ExRegBuffer == NULL) { 5879 SHELL_FREE_NON_NULL(ExRegBuffer); 4689 5880 return EFI_UNSUPPORTED; 4690 5881 } 4691 // 4692 // Start outputing PciEx extend space( 0xFF-0xFFF) 4693 // 4694 Print (L"\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\n\n"); 4695 4696 if (ExRegBuffer != NULL) { 5882 5883 if (EnhancedDump == 0) { 5884 // 5885 // Print the PciEx extend space in raw bytes ( 0xFF-0xFFF) 5886 // 5887 ShellPrintEx (-1, -1, L"\r\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\r\n\r\n"); 5888 4697 5889 DumpHex ( 4698 5890 2, 4699 0x100,5891 EFI_PCIE_CAPABILITY_BASE_OFFSET, 4700 5892 ExtendRegSize, 4701 5893 (VOID *) (ExRegBuffer) 4702 ); 4703 4704 FreePool ((VOID *) ExRegBuffer); 4705 } 5894 ); 5895 } else { 5896 ExtHdr = (PCI_EXP_EXT_HDR*)ExRegBuffer; 5897 while (ExtHdr->CapabilityId != 0 && ExtHdr->CapabilityVersion != 0) { 5898 // 5899 // Process this item 5900 // 5901 if (EnhancedDump == 0xFFFF || EnhancedDump == ExtHdr->CapabilityId) { 5902 // 5903 // Print this item 5904 // 5905 PrintPciExtendedCapabilityDetails((PCI_EXP_EXT_HDR*)ExRegBuffer, ExtHdr, &PciExpressCap); 5906 } 5907 5908 // 5909 // Advance to the next item if it exists 5910 // 5911 if (ExtHdr->NextCapabilityOffset != 0) { 5912 ExtHdr = (PCI_EXP_EXT_HDR*)((UINT8*)ExRegBuffer + ExtHdr->NextCapabilityOffset); 5913 } else { 5914 break; 5915 } 5916 } 5917 } 5918 SHELL_FREE_NON_NULL(ExRegBuffer); 4706 5919 4707 5920 Done: -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.h
r48674 r58459 2 2 Header file for Pci shell Debug1 function. 3 3 4 Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 158 159 // Link Capabilities Register 159 160 // 160 #define PCIE_CAP_ SUP_LINK_SPEEDS(PcieLinkCap) \161 #define PCIE_CAP_MAX_LINK_SPEED(PcieLinkCap) \ 161 162 ((PcieLinkCap) & 0x0f) 162 163 #define PCIE_CAP_MAX_LINK_WIDTH(PcieLinkCap) \ … … 453 454 UINT16 SlotControl; 454 455 UINT16 SlotStatus; 456 UINT16 RootControl; 455 457 UINT16 RsvdP; 456 UINT16 RootControl;457 458 UINT32 RootStatus; 458 } PCIE_CAP_ST URCTURE;459 } PCIE_CAP_STRUCTURE; 459 460 460 461 #pragma pack() -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SetVar.c
r48674 r58459 2 2 Main file for SetVar shell Debug1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 50 50 UINTN LoopVar; 51 51 EFI_DEVICE_PATH_PROTOCOL *DevPath; 52 EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *DevPathFromText;53 52 54 53 ShellStatus = SHELL_SUCCESS; … … 141 140 } 142 141 if (ShellCommandLineGetFlag(Package, L"-rt")) { 143 Attributes |= EFI_VARIABLE_RUNTIME_ACCESS; 142 Attributes |= EFI_VARIABLE_RUNTIME_ACCESS | 143 EFI_VARIABLE_BOOTSERVICE_ACCESS; 144 144 } 145 145 if (ShellCommandLineGetFlag(Package, L"-nv")) { … … 178 178 Buffer = AllocateZeroPool(Size); 179 179 Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes2, &Size, Buffer); 180 FreePool(Buffer); 180 if (Buffer != NULL) { 181 FreePool(Buffer); 182 } 181 183 Attributes = Attributes2; 182 184 } … … 227 229 Data++; 228 230 Data++; 229 Status = gBS->LocateProtocol(&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID**)&DevPathFromText); 230 ASSERT_EFI_ERROR(Status); 231 DevPath = DevPathFromText->ConvertTextToDevicePath(Data); 231 DevPath = ConvertTextToDevicePath(Data); 232 232 if (DevPath == NULL) { 233 233 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, Status); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.c
r48674 r58459 2 2 API for SMBIOS table. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 16 16 #include "../UefiShellDebug1CommandsLib.h" 17 17 #include <Guid/SmBios.h> 18 #include "LibSmbios.h"19 18 #include "LibSmbiosView.h" 20 19 #include "SmbiosView.h" 21 20 22 21 STATIC UINT8 mInit = 0; 23 STATIC SMBIOS_ STRUCTURE_TABLE*mSmbiosTable = NULL;22 STATIC SMBIOS_TABLE_ENTRY_POINT *mSmbiosTable = NULL; 24 23 STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct; 25 24 STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct; … … 91 90 VOID 92 91 LibSmbiosGetEPS ( 93 OUT SMBIOS_ STRUCTURE_TABLE**EntryPointStructure92 OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure 94 93 ) 95 94 { … … 101 100 102 101 /** 103 Get SMBIOS structure given the Handle,copy data to the Buffer, 102 Return SMBIOS string for the given string number. 103 104 @param[in] Smbios Pointer to SMBIOS structure. 105 @param[in] StringNumber String number to return. -1 is used to skip all strings and 106 point to the next SMBIOS structure. 107 108 @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 109 **/ 110 CHAR8* 111 LibGetSmbiosString ( 112 IN SMBIOS_STRUCTURE_POINTER *Smbios, 113 IN UINT16 StringNumber 114 ) 115 { 116 UINT16 Index; 117 CHAR8 *String; 118 119 ASSERT (Smbios != NULL); 120 121 // 122 // Skip over formatted section 123 // 124 String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length); 125 126 // 127 // Look through unformated section 128 // 129 for (Index = 1; Index <= StringNumber; Index++) { 130 if (StringNumber == Index) { 131 return String; 132 } 133 // 134 // Skip string 135 // 136 for (; *String != 0; String++); 137 String++; 138 139 if (*String == 0) { 140 // 141 // If double NULL then we are done. 142 // Return pointer to next structure in Smbios. 143 // if you pass in a -1 you will always get here 144 // 145 Smbios->Raw = (UINT8 *)++String; 146 return NULL; 147 } 148 } 149 150 return NULL; 151 } 152 153 /** 154 Get SMBIOS structure for the given Handle, 104 155 Handle is changed to the next handle or 0xFFFF when the end is 105 156 reached or the handle is not found. … … 107 158 @param[in, out] Handle 0xFFFF: get the first structure 108 159 Others: get a structure according to this value. 109 @param[in, out] Buffer The pointer to the caller's memory buffer. 110 @param[out] Length Length of return buffer in bytes. 111 112 @retval DMI_SUCCESS Buffer contains the required structure data 113 Handle is updated with next structure handle or 160 @param[out] Buffer The pointer to the pointer to the structure. 161 @param[out] Length Length of the structure. 162 163 @retval DMI_SUCCESS Handle is updated with next structure handle or 114 164 0xFFFF(end-of-list). 115 165 116 @retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data. 117 Handle is updated with next structure handle or 166 @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or 118 167 0xFFFF(end-of-list). 119 168 **/ … … 121 170 LibGetSmbiosStructure ( 122 171 IN OUT UINT16 *Handle, 123 IN OUT UINT8*Buffer,172 OUT UINT8 **Buffer, 124 173 OUT UINT16 *Length 125 174 ) … … 129 178 UINT8 *Raw; 130 179 131 if (*Handle == INVALID E_HANDLE) {180 if (*Handle == INVALID_HANDLE) { 132 181 *Handle = mSmbiosStruct->Hdr->Handle; 133 182 return DMI_INVALID_HANDLE; 134 183 } 135 184 136 if ( Buffer == NULL) {137 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_ SPEC), gShellDebug1HiiHandle);185 if ((Buffer == NULL) || (Length == NULL)) { 186 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle); 138 187 return DMI_INVALID_HANDLE; 139 188 } … … 153 202 // 154 203 *Length = (UINT16) (Smbios.Raw - Raw); 155 CopyMem (Buffer, Raw, *Length);204 *Buffer = Raw; 156 205 // 157 206 // update with the next structure handle. … … 160 209 *Handle = Smbios.Hdr->Handle; 161 210 } else { 162 *Handle = INVALID E_HANDLE;211 *Handle = INVALID_HANDLE; 163 212 } 164 213 return DMI_SUCCESS; … … 170 219 } 171 220 172 *Handle = INVALID E_HANDLE;221 *Handle = INVALID_HANDLE; 173 222 return DMI_INVALID_HANDLE; 174 223 } 175 224 176 /**177 Check the structure to see if it is legal.178 179 @param[in] Smbios - Pointer to the structure that will be checked.180 181 @retval DMI_SUCCESS Structure data is legal.182 @retval DMI_BAD_PARAMETER Structure data contains bad parameter.183 **/184 EFI_STATUS185 SmbiosCheckStructure (186 IN SMBIOS_STRUCTURE_POINTER *Smbios187 )188 {189 //190 // If key != value, then error.191 //192 #define CHECK_VALUE(key, value) (((key) == (value)) ? EFI_SUCCESS : DMI_BAD_PARAMETER)193 194 EFI_STATUS Status;195 //196 // Assume staus is EFI_SUCCESS,197 // but if check is error, then EFI_ERROR.198 //199 Status = EFI_SUCCESS;200 201 switch (Smbios->Hdr->Type) {202 case 0:203 break;204 205 case 1:206 if (Smbios->Type1->Hdr.Length == 0x08 || Smbios->Type0->Hdr.Length == 0x19) {207 Status = EFI_SUCCESS;208 } else {209 Status = DMI_BAD_PARAMETER;210 }211 break;212 213 case 2:214 Status = CHECK_VALUE (Smbios->Type2->Hdr.Length, 0x08);215 break;216 217 case 6:218 Status = CHECK_VALUE (Smbios->Type6->Hdr.Length, 0x0C);219 break;220 221 case 11:222 Status = CHECK_VALUE (Smbios->Type11->Hdr.Length, 0x05);223 break;224 225 case 12:226 Status = CHECK_VALUE (Smbios->Type12->Hdr.Length, 0x05);227 break;228 229 case 13:230 Status = CHECK_VALUE (Smbios->Type13->Hdr.Length, 0x16);231 break;232 233 case 16:234 Status = CHECK_VALUE (Smbios->Type16->Hdr.Length, 0x0F);235 break;236 237 case 19:238 Status = CHECK_VALUE (Smbios->Type19->Hdr.Length, 0x0F);239 break;240 241 case 20:242 Status = CHECK_VALUE (Smbios->Type20->Hdr.Length, 0x13);243 break;244 245 case 32:246 //247 // Because EFI_SUCCESS == 0,248 // So errors added up is also error.249 //250 Status = CHECK_VALUE (Smbios->Type32->Reserved[0], 0x00) +251 CHECK_VALUE (Smbios->Type32->Reserved[1], 0x00) +252 CHECK_VALUE (Smbios->Type32->Reserved[2], 0x00) +253 CHECK_VALUE (Smbios->Type32->Reserved[3], 0x00) +254 CHECK_VALUE (Smbios->Type32->Reserved[4], 0x00) +255 CHECK_VALUE (Smbios->Type32->Reserved[5], 0x00);256 break;257 258 default:259 Status = DMI_BAD_PARAMETER;260 }261 262 return Status;263 }264 265 /**266 Get a string from the smbios information.267 268 @param[in] Smbios The pointer to the smbios information.269 @param[in] StringNumber The index to the string to get.270 @param[out] Buffer The buffer to fill with the string when retrieved.271 **/272 VOID273 SmbiosGetPendingString (274 IN SMBIOS_STRUCTURE_POINTER *Smbios,275 IN UINT16 StringNumber,276 OUT CHAR8 *Buffer277 )278 {279 CHAR8 *String;280 if (Buffer == NULL) {281 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT), gShellDebug1HiiHandle);282 return ;283 }284 //285 // Get string and copy to buffer.286 // Caller should provide the buffer.287 //288 String = LibGetSmbiosString (Smbios, StringNumber);289 if (String != NULL) {290 CopyMem (Buffer, String, AsciiStrLen(String));291 } else {292 Buffer = NULL;293 }294 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/LibSmbiosView.h
r48674 r58459 2 2 API for SMBIOS Plug and Play functions, access to SMBIOS table and structures. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 16 16 #define _LIB_SMBIOS_VIEW_H_ 17 17 18 #include "LibSmbios.h"18 #include <IndustryStandard/SmBios.h> 19 19 20 20 #define DMI_SUCCESS 0x00 … … 31 31 #define DMI_INVALID_LOCK 0x92 32 32 33 #define INVALID E_HANDLE(UINT16) (-1)33 #define INVALID_HANDLE (UINT16) (-1) 34 34 35 35 #define EFI_SMBIOSERR(val) EFIERR (0x30000 | val) … … 65 65 VOID 66 66 LibSmbiosGetEPS ( 67 OUT SMBIOS_ STRUCTURE_TABLE**EntryPointStructure67 OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure 68 68 ); 69 69 70 70 /** 71 Get SMBIOS structure given the Handle,copy data to the Buffer, 71 Return SMBIOS string for the given string number. 72 73 @param[in] Smbios Pointer to SMBIOS structure. 74 @param[in] StringNumber String number to return. -1 is used to skip all strings and 75 point to the next SMBIOS structure. 76 77 @return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1 78 **/ 79 CHAR8* 80 LibGetSmbiosString ( 81 IN SMBIOS_STRUCTURE_POINTER *Smbios, 82 IN UINT16 StringNumber 83 ); 84 85 /** 86 Get SMBIOS structure for the given Handle, 72 87 Handle is changed to the next handle or 0xFFFF when the end is 73 88 reached or the handle is not found. … … 75 90 @param[in, out] Handle 0xFFFF: get the first structure 76 91 Others: get a structure according to this value. 77 @param[ in, out] Buffer The pointer to the caller's memory buffer.78 @param[out] Length Length of return buffer in bytes.92 @param[out] Buffer The pointer to the pointer to the structure. 93 @param[out] Length Length of the structure. 79 94 80 @retval DMI_SUCCESS Buffer contains the required structure data 81 Handle is updated with next structure handle or 95 @retval DMI_SUCCESS Handle is updated with next structure handle or 82 96 0xFFFF(end-of-list). 83 97 84 @retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data. 85 Handle is updated with next structure handle or 98 @retval DMI_INVALID_HANDLE Handle is updated with first structure handle or 86 99 0xFFFF(end-of-list). 87 100 **/ … … 89 102 LibGetSmbiosStructure ( 90 103 IN OUT UINT16 *Handle, 91 IN OUT UINT8*Buffer,104 OUT UINT8 **Buffer, 92 105 OUT UINT16 *Length 93 106 ); 94 107 95 /**96 Get a string from the smbios information.97 98 @param[in] Smbios The pointer to the smbios information.99 @param[in] StringNumber The index to the string to get.100 @param[out] Buffer The buffer to fill with the string when retrieved.101 **/102 VOID103 SmbiosGetPendingString (104 IN SMBIOS_STRUCTURE_POINTER *Smbios,105 IN UINT16 StringNumber,106 OUT CHAR8 *Buffer107 );108 109 /**110 Check the structure to see if it is legal.111 112 @param[in] Smbios - Pointer to the structure that will be checked.113 114 @retval DMI_SUCCESS Structure data is legal.115 @retval DMI_BAD_PARAMETER Structure data contains bad parameter.116 **/117 EFI_STATUS118 SmbiosCheckStructure (119 IN SMBIOS_STRUCTURE_POINTER *Smbios120 );121 122 108 #endif -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
r48674 r58459 2 2 Module for clarifying the content of the smbios structure element information. 3 3 4 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR> 5 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 24 25 // 25 26 #define BIT(value, bit) ((value) & ((UINT64) 1) << (bit)) 27 28 // 29 // Check if above or equal to version 30 // 31 #define AE_SMBIOS_VERSION(MajorVersion, MinorVersion) \ 32 (SmbiosMajorVersion > (MajorVersion) || (SmbiosMajorVersion == (MajorVersion) && SmbiosMinorVersion >= (MinorVersion))) 26 33 27 34 // … … 31 38 #define PRINT_PENDING_STRING(pStruct, type, element) \ 32 39 do { \ 33 CHAR8 StringBuf[64]; \ 34 SetMem (StringBuf, sizeof (StringBuf), 0x00); \ 35 SmbiosGetPendingString ((pStruct), (pStruct->type->element), StringBuf); \ 40 CHAR8 *StringBuf; \ 41 StringBuf = LibGetSmbiosString ((pStruct), (pStruct->type->element)); \ 36 42 ShellPrintEx(-1,-1,L"%a",#element); \ 37 ShellPrintEx(-1,-1,L": %a\n", StringBuf); \43 ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \ 38 44 } while (0); 39 45 40 46 #define PRINT_SMBIOS_STRING(pStruct, stringnumber, element) \ 41 47 do { \ 42 CHAR8 StringBuf[64]; \ 43 SetMem (StringBuf, sizeof (StringBuf), 0x00); \ 44 SmbiosGetPendingString ((pStruct), (stringnumber), StringBuf); \ 48 CHAR8 *StringBuf; \ 49 StringBuf = LibGetSmbiosString ((pStruct), (stringnumber)); \ 45 50 ShellPrintEx(-1,-1,L"%a",#element); \ 46 ShellPrintEx(-1,-1,L": %a\n", StringBuf); \51 ShellPrintEx(-1,-1,L": %a\n", (StringBuf != NULL) ? StringBuf: ""); \ 47 52 } while (0); 48 53 … … 57 62 ShellPrintEx(-1,-1,L"%a",#element); \ 58 63 ShellPrintEx(-1,-1,L": 0x%x\n", (pStruct->type->element)); \ 64 } while (0); 65 66 #define PRINT_STRUCT_VALUE_LH(pStruct, type, element) \ 67 do { \ 68 ShellPrintEx(-1,-1,L"%a",#element); \ 69 ShellPrintEx(-1,-1,L": 0x%lx\n", (pStruct->type->element)); \ 59 70 } while (0); 60 71 … … 124 135 VOID 125 136 SmbiosPrintEPSInfo ( 126 IN SMBIOS_ STRUCTURE_TABLE*SmbiosTable,127 IN UINT8 Option137 IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable, 138 IN UINT8 Option 128 139 ) 129 140 { … … 208 219 UINT8 *Buffer; 209 220 210 Buffer = (UINT8 *) (UINTN) (Struct->Raw);211 212 221 if (Struct == NULL) { 213 222 return EFI_INVALID_PARAMETER; … … 217 226 return EFI_SUCCESS; 218 227 } 228 229 Buffer = (UINT8 *) (UINTN) (Struct->Raw); 230 219 231 // 220 232 // Display structure header … … 230 242 switch (Struct->Hdr->Type) { 231 243 // 232 // 244 // BIOS Information (Type 0) 233 245 // 234 246 case 0: … … 239 251 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (Struct->Type0->BiosSize + 1)); 240 252 241 if (Option < SHOW_DETAIL) { 242 PRINT_STRUCT_VALUE_H (Struct, Type0, BiosCharacteristics); 243 } else { 244 DisplayBiosCharacteristics (Struct->Type0->BiosCharacteristics, Option); 245 246 // 247 // The length of above format part is 0x12 bytes, 248 // Ext bytes are following, size = 'len-0x12'. 249 // If len-0x12 > 0, then 250 // there are extension bytes (Byte1, byte2, byte3...) 251 // And byte3 not stated in spec, so dump all extension bytes(1, 2, 3..) 252 // 253 if ((Buffer[1] - (CHAR8) 0x12) > 0) { 254 DisplayBiosCharacteristicsExt1 (Buffer[0x12], Option); 255 } 256 257 if ((Buffer[1] - (CHAR8) 0x12) > 1) { 258 DisplayBiosCharacteristicsExt2 (Buffer[0x13], Option); 259 } 260 261 if ((Buffer[1] - (CHAR8) 0x12) > 2) { 262 PRINT_BIT_FIELD ( 263 Struct, 264 Type0, 265 BiosCharacteristics, 266 Buffer[1] - (CHAR8) 0x12 267 ); 268 } 269 } 253 DisplayBiosCharacteristics (ReadUnaligned64 ((UINT64 *) (UINTN) &(Struct->Type0->BiosCharacteristics)), Option); 254 255 if (Struct->Hdr->Length > 0x12) { 256 DisplayBiosCharacteristicsExt1 (Struct->Type0->BIOSCharacteristicsExtensionBytes[0], Option); 257 } 258 if (Struct->Hdr->Length > 0x13) { 259 DisplayBiosCharacteristicsExt2 (Struct->Type0->BIOSCharacteristicsExtensionBytes[1], Option); 260 } 261 262 if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x14)) { 263 PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMajorRelease); 264 PRINT_STRUCT_VALUE (Struct, Type0, SystemBiosMinorRelease); 265 PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMajorRelease); 266 PRINT_STRUCT_VALUE (Struct, Type0, EmbeddedControllerFirmwareMinorRelease); 267 } 268 270 269 break; 271 270 … … 280 279 PRINT_BIT_FIELD (Struct, Type1, Uuid, 16); 281 280 DisplaySystemWakeupType (Struct->Type1->WakeUpType, Option); 282 break; 283 281 if (AE_SMBIOS_VERSION (0x2, 0x4) && (Struct->Hdr->Length > 0x19)) { 282 PRINT_PENDING_STRING (Struct, Type1, SKUNumber); 283 PRINT_PENDING_STRING (Struct, Type1, Family); 284 } 285 286 break; 287 288 // 289 // Baseboard Information (Type 2) 290 // 284 291 case 2: 285 292 PRINT_PENDING_STRING (Struct, Type2, Manufacturer); … … 287 294 PRINT_PENDING_STRING (Struct, Type2, Version); 288 295 PRINT_PENDING_STRING (Struct, Type2, SerialNumber); 296 if (Struct->Hdr->Length > 0x8) { 297 PRINT_PENDING_STRING (Struct, Type2, AssetTag); 298 DisplayBaseBoardFeatureFlags (*(UINT8 *) &Struct->Type2->FeatureFlag, Option); 299 PRINT_PENDING_STRING (Struct, Type2, LocationInChassis); 300 PRINT_STRUCT_VALUE_H (Struct, Type2, ChassisHandle); 301 DisplayBaseBoardBoardType (Struct->Type2->BoardType, Option); 302 } 289 303 break; 290 304 … … 307 321 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle); 308 322 DisplaySESecurityStatus (Struct->Type3->SecurityStatus, Option); 309 PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4); 323 if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0xD)) { 324 PRINT_BIT_FIELD (Struct, Type3, OemDefined, 4); 325 } 310 326 break; 311 327 … … 316 332 PRINT_PENDING_STRING (Struct, Type4, Socket); 317 333 DisplayProcessorType (Struct->Type4->ProcessorType, Option); 318 if ( (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) &&334 if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x28) && 319 335 (Struct->Type4->ProcessorFamily == 0xFE)) { 320 336 // … … 328 344 PRINT_BIT_FIELD (Struct, Type4, ProcessorId, 8); 329 345 PRINT_PENDING_STRING (Struct, Type4, ProcessorVersion); 330 DisplayProcessorVoltage ( Struct->Type4->Voltage, Option);346 DisplayProcessorVoltage (*(UINT8 *) &(Struct->Type4->Voltage), Option); 331 347 PRINT_STRUCT_VALUE (Struct, Type4, ExternalClock); 332 348 PRINT_STRUCT_VALUE (Struct, Type4, MaxSpeed); … … 337 353 PRINT_STRUCT_VALUE_H (Struct, Type4, L2CacheHandle); 338 354 PRINT_STRUCT_VALUE_H (Struct, Type4, L3CacheHandle); 339 PRINT_PENDING_STRING (Struct, Type4, SerialNumber); 340 PRINT_PENDING_STRING (Struct, Type4, AssetTag); 341 PRINT_PENDING_STRING (Struct, Type4, PartNumber); 342 if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x5)) { 355 if (AE_SMBIOS_VERSION (0x2, 0x3) && (Struct->Hdr->Length > 0x20)) { 356 PRINT_PENDING_STRING (Struct, Type4, SerialNumber); 357 PRINT_PENDING_STRING (Struct, Type4, AssetTag); 358 PRINT_PENDING_STRING (Struct, Type4, PartNumber); 359 } 360 if (AE_SMBIOS_VERSION (0x2, 0x5) && (Struct->Hdr->Length > 0x23)) { 343 361 PRINT_STRUCT_VALUE (Struct, Type4, CoreCount); 344 362 PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount); 345 363 PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount); 346 PRINT_STRUCT_VALUE_H (Struct, Type4, ProcessorCharacteristics); 364 DisplayProcessorCharacteristics (Struct->Type4->ProcessorCharacteristics, Option); 365 } 366 if ((SmbiosMajorVersion >= 0x3) && (Struct->Hdr->Length > 0x2A)) { 367 PRINT_STRUCT_VALUE (Struct, Type4, CoreCount2); 368 PRINT_STRUCT_VALUE (Struct, Type4, EnabledCoreCount2); 369 PRINT_STRUCT_VALUE (Struct, Type4, ThreadCount2); 347 370 } 348 371 break; … … 357 380 358 381 DisplayMcErrorDetectMethod (Struct->Type5->ErrDetectMethod, Option); 359 DisplayMcErrorCorrectCapability ( Struct->Type5->ErrCorrectCapability, Option);382 DisplayMcErrorCorrectCapability (*(UINT8 *) &(Struct->Type5->ErrCorrectCapability), Option); 360 383 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle); 361 384 DisplayMcInterleaveSupport (Struct->Type5->SupportInterleave, Option); … … 363 386 DisplayMcInterleaveSupport (Struct->Type5->CurrentInterleave, Option); 364 387 DisplayMaxMemoryModuleSize (Struct->Type5->MaxMemoryModuleSize, SlotNum, Option); 365 DisplayMcMemorySpeeds ( Struct->Type5->SupportSpeed, Option);388 DisplayMcMemorySpeeds (*(UINT16 *) &(Struct->Type5->SupportSpeed), Option); 366 389 DisplayMmMemoryType (Struct->Type5->SupportMemoryType, Option); 367 390 DisplayMemoryModuleVoltage (Struct->Type5->MemoryModuleVoltage, Option); … … 382 405 DisplayMmBankConnections (Struct->Type6->BankConnections, Option); 383 406 PRINT_STRUCT_VALUE (Struct, Type6, CurrentSpeed); 384 DisplayMmMemoryType ( Struct->Type6->CurrentMemoryType, Option);407 DisplayMmMemoryType (*(UINT16 *) &(Struct->Type6->CurrentMemoryType), Option); 385 408 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle); 386 DisplayMmMemorySize ( Struct->Type6->InstalledSize, Option);409 DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->InstalledSize), Option); 387 410 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle); 388 DisplayMmMemorySize ( Struct->Type6->EnabledSize, Option);411 DisplayMmMemorySize (*(UINT8 *) &(Struct->Type6->EnabledSize), Option); 389 412 DisplayMmErrorStatus (Struct->Type6->ErrorStatus, Option); 390 413 break; … … 395 418 case 7: 396 419 PRINT_PENDING_STRING (Struct, Type7, SocketDesignation); 397 PRINT_STRUCT_VALUE_H (Struct, Type7, CacheConfiguration);420 DisplayCacheConfiguration (Struct->Type7->CacheConfiguration, Option); 398 421 PRINT_STRUCT_VALUE_H (Struct, Type7, MaximumCacheSize); 399 422 PRINT_STRUCT_VALUE_H (Struct, Type7, InstalledSize); 400 423 PRINT_STRUCT_VALUE_H (Struct, Type7, SupportedSRAMType); 401 424 PRINT_STRUCT_VALUE_H (Struct, Type7, CurrentSRAMType); 402 DisplayCacheSRAMType ( Struct->Type7->CurrentSRAMType, Option);425 DisplayCacheSRAMType (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type7->CurrentSRAMType)), Option); 403 426 PRINT_STRUCT_VALUE_H (Struct, Type7, CacheSpeed); 404 427 DisplayCacheErrCorrectingType (Struct->Type7->ErrorCorrectionType, Option); … … 434 457 Option 435 458 ); 436 DisplaySlotCharacteristics1 ( Struct->Type9->SlotCharacteristics1, Option);437 DisplaySlotCharacteristics2 ( Struct->Type9->SlotCharacteristics2, Option);438 if ( SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) {459 DisplaySlotCharacteristics1 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics1), Option); 460 DisplaySlotCharacteristics2 (*(UINT8 *) &(Struct->Type9->SlotCharacteristics2), Option); 461 if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0xD)) { 439 462 PRINT_STRUCT_VALUE_H (Struct, Type9, SegmentGroupNum); 440 463 PRINT_STRUCT_VALUE_H (Struct, Type9, BusNum); … … 449 472 { 450 473 UINTN NumOfDevice; 451 NumOfDevice = (Struct->Type10->Hdr.Length - sizeof (SMBIOS_ HEADER)) / (2 * sizeof (UINT8));474 NumOfDevice = (Struct->Type10->Hdr.Length - sizeof (SMBIOS_STRUCTURE)) / (2 * sizeof (UINT8)); 452 475 for (Index = 0; Index < NumOfDevice; Index++) { 453 476 DisplayOnboardDeviceTypes (Struct->Type10->Device[Index].DeviceType, Option); 454 477 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle); 455 ShellPrintEx(-1,-1,L"%a ",LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString));478 ShellPrintEx(-1,-1,L"%a\n",LibGetSmbiosString (Struct, Struct->Type10->Device[Index].DescriptionString)); 456 479 } 457 480 } 458 481 break; 459 482 483 // 484 // Oem Strings (Type 11) 485 // 460 486 case 11: 461 487 PRINT_STRUCT_VALUE (Struct, Type11, StringCount); … … 465 491 break; 466 492 493 // 494 // System Configuration Options (Type 12) 495 // 467 496 case 12: 468 497 PRINT_STRUCT_VALUE (Struct, Type12, StringCount); … … 472 501 break; 473 502 503 // 504 // BIOS Language Information (Type 13) 505 // 474 506 case 13: 475 507 PRINT_STRUCT_VALUE (Struct, Type13, InstallableLanguages); … … 479 511 break; 480 512 513 // 514 // Group Associations (Type 14) 515 // 481 516 case 14: 482 PRINT_PENDING_STRING (Struct, Type14, GroupName); 483 PRINT_STRUCT_VALUE (Struct, Type14, ItemType); 484 PRINT_STRUCT_VALUE (Struct, Type14, ItemHandle); 517 { 518 UINT8 NumOfItem; 519 NumOfItem = (Struct->Type14->Hdr.Length - 5) / 3; 520 PRINT_PENDING_STRING (Struct, Type14, GroupName); 521 for (Index = 0; Index < NumOfItem; Index++) { 522 ShellPrintEx(-1,-1,L"ItemType %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemType); 523 ShellPrintEx(-1,-1,L"ItemHandle %d: %d\n", Index + 1, Struct->Type14->Group[Index].ItemHandle); 524 } 525 } 485 526 break; 486 527 … … 490 531 case 15: 491 532 { 492 EVENT LOGTYPE *Ptr;493 UINT8 Count;494 UINT8 *AccessMethodAddress;533 EVENT_LOG_TYPE *Ptr; 534 UINT8 Count; 535 UINT8 *AccessMethodAddress; 495 536 496 537 PRINT_STRUCT_VALUE_H (Struct, Type15, LogAreaLength); … … 557 598 (UINT16) 558 599 ( 559 Struct->Type15->LogAreaLength -560 (Struct->Type15->LogDataStartOffset - Struct->Type15->LogDataStartOffset)561 )600 Struct->Type15->LogAreaLength - 601 (Struct->Type15->LogDataStartOffset - Struct->Type15->LogHeaderStartOffset) 602 ) 562 603 ); 563 604 } … … 580 621 PRINT_STRUCT_VALUE_H (Struct, Type16, MemoryErrorInformationHandle); 581 622 PRINT_STRUCT_VALUE_H (Struct, Type16, NumberOfMemoryDevices); 623 if (AE_SMBIOS_VERSION (0x2, 0x7) && Struct->Hdr->Length > 0xF) { 624 PRINT_STRUCT_VALUE_LH (Struct, Type16, ExtendedMaximumCapacity); 625 } 582 626 break; 583 627 … … 596 640 PRINT_PENDING_STRING (Struct, Type17, BankLocator); 597 641 DisplayMemoryDeviceType (Struct->Type17->MemoryType, Option); 598 DisplayMemoryDeviceTypeDetail ( Struct->Type17->TypeDetail, Option);642 DisplayMemoryDeviceTypeDetail (ReadUnaligned16 ((UINT16 *) (UINTN) &(Struct->Type17->TypeDetail)), Option); 599 643 PRINT_STRUCT_VALUE_H (Struct, Type17, Speed); 600 644 PRINT_PENDING_STRING (Struct, Type17, Manufacturer); … … 602 646 PRINT_PENDING_STRING (Struct, Type17, AssetTag); 603 647 PRINT_PENDING_STRING (Struct, Type17, PartNumber); 604 if ( SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) {648 if (AE_SMBIOS_VERSION (0x2, 0x6) && (Struct->Hdr->Length > 0x1B)) { 605 649 PRINT_STRUCT_VALUE_H (Struct, Type17, Attributes); 650 } 651 if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x1C)) { 652 PRINT_STRUCT_VALUE (Struct, Type17, ExtendedSize); 653 PRINT_STRUCT_VALUE (Struct, Type17, ConfiguredMemoryClockSpeed); 606 654 } 607 655 break; … … 631 679 PRINT_STRUCT_VALUE_H (Struct, Type19, MemoryArrayHandle); 632 680 PRINT_STRUCT_VALUE_H (Struct, Type19, PartitionWidth); 633 break; 634 635 // 636 // Memory Device Mapped Address (Type 20) 681 if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xF)) { 682 PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress); 683 PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress); 684 } 685 break; 686 687 // 688 // Memory Device Mapped Address (Type 20) 637 689 // 638 690 case 20: … … 644 696 PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavePosition); 645 697 PRINT_STRUCT_VALUE_H (Struct, Type20, InterleavedDataDepth); 646 break; 647 648 // 649 // Built-in Pointing Device (Type 21) 698 if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0x13)) { 699 PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedStartingAddress); 700 PRINT_STRUCT_VALUE_LH (Struct, Type19, ExtendedEndingAddress); 701 } 702 break; 703 704 // 705 // Built-in Pointing Device (Type 21) 650 706 // 651 707 case 21: … … 656 712 657 713 // 658 // Portable Battery 714 // Portable Battery (Type 22) 659 715 // 660 716 case 22: … … 682 738 break; 683 739 740 // 741 // System Reset (Type 23) 742 // 684 743 case 23: 685 744 DisplaySystemResetCapabilities ( … … 693 752 break; 694 753 754 // 755 // Hardware Security (Type 24) 756 // 695 757 case 24: 696 758 DisplayHardwareSecuritySettings ( … … 700 762 break; 701 763 764 // 765 // System Power Controls (Type 25) 766 // 702 767 case 25: 703 768 PRINT_STRUCT_VALUE_H (Struct, Type25, NextScheduledPowerOnMonth); … … 708 773 break; 709 774 775 // 776 // Voltage Probe (Type 26) 777 // 710 778 case 26: 711 779 PRINT_PENDING_STRING (Struct, Type26, Description); 712 DisplayVPLocation ( Struct->Type26->LocationAndStatus, Option);713 DisplayVPStatus ( Struct->Type26->LocationAndStatus, Option);780 DisplayVPLocation (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option); 781 DisplayVPStatus (*(UINT8 *) &(Struct->Type26->LocationAndStatus), Option); 714 782 PRINT_STRUCT_VALUE_H (Struct, Type26, MaximumValue); 715 783 PRINT_STRUCT_VALUE_H (Struct, Type26, MinimumValue); … … 721 789 break; 722 790 791 // 792 // Cooling Device (Type 27) 793 // 723 794 case 27: 724 795 PRINT_STRUCT_VALUE_H (Struct, Type27, TemperatureProbeHandle); 725 DisplayCoolingDeviceStatus ( Struct->Type27->DeviceTypeAndStatus, Option);726 DisplayCoolingDeviceType ( Struct->Type27->DeviceTypeAndStatus, Option);796 DisplayCoolingDeviceStatus (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option); 797 DisplayCoolingDeviceType (*(UINT8 *) &(Struct->Type27->DeviceTypeAndStatus), Option); 727 798 PRINT_STRUCT_VALUE_H (Struct, Type27, CoolingUnitGroup); 728 799 PRINT_STRUCT_VALUE_H (Struct, Type27, OEMDefined); 729 800 PRINT_STRUCT_VALUE_H (Struct, Type27, NominalSpeed); 730 break; 731 801 if (AE_SMBIOS_VERSION (0x2, 0x7) && (Struct->Hdr->Length > 0xE)) { 802 PRINT_PENDING_STRING (Struct, Type27, Description); 803 } 804 break; 805 806 // 807 // Temperature Probe (Type 28) 808 // 732 809 case 28: 733 810 PRINT_PENDING_STRING (Struct, Type28, Description); 734 DisplayTemperatureProbeStatus ( Struct->Type28->LocationAndStatus, Option);735 DisplayTemperatureProbeLoc ( Struct->Type28->LocationAndStatus, Option);811 DisplayTemperatureProbeStatus (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option); 812 DisplayTemperatureProbeLoc (*(UINT8 *) &(Struct->Type28->LocationAndStatus), Option); 736 813 PRINT_STRUCT_VALUE_H (Struct, Type28, MaximumValue); 737 814 PRINT_STRUCT_VALUE_H (Struct, Type28, MinimumValue); … … 743 820 break; 744 821 822 // 823 // Electrical Current Probe (Type 29) 824 // 745 825 case 29: 746 826 PRINT_PENDING_STRING (Struct, Type29, Description); 747 DisplayECPStatus ( Struct->Type29->LocationAndStatus, Option);748 DisplayECPLoc ( Struct->Type29->LocationAndStatus, Option);827 DisplayECPStatus (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option); 828 DisplayECPLoc (*(UINT8 *) &(Struct->Type29->LocationAndStatus), Option); 749 829 PRINT_STRUCT_VALUE_H (Struct, Type29, MaximumValue); 750 830 PRINT_STRUCT_VALUE_H (Struct, Type29, MinimumValue); … … 756 836 break; 757 837 838 // 839 // Out-of-Band Remote Access (Type 30) 840 // 758 841 case 30: 759 842 PRINT_PENDING_STRING (Struct, Type30, ManufacturerName); … … 761 844 break; 762 845 846 // 847 // Boot Integrity Services (BIS) Entry Point (Type 31) 848 // 763 849 case 31: 764 850 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle); 765 851 break; 766 852 853 // 854 // System Boot Information (Type 32) 855 // 767 856 case 32: 768 857 PRINT_BIT_FIELD (Struct, Type32, Reserved, 6); 769 DisplaySystemBootStatus (Struct->Type32->BootStatus[0], Option); 770 break; 771 858 DisplaySystemBootStatus (Struct->Type32->BootStatus, Option); 859 break; 860 861 // 862 // 64-Bit Memory Error Information (Type 33) 863 // 772 864 case 33: 773 865 DisplayMemoryErrorType (Struct->Type33->ErrorType, Option); … … 778 870 DisplayMemoryErrorOperation (Struct->Type33->ErrorOperation, Option); 779 871 PRINT_STRUCT_VALUE_H (Struct, Type33, VendorSyndrome); 780 PRINT_STRUCT_VALUE_ H (Struct, Type33, MemoryArrayErrorAddress);781 PRINT_STRUCT_VALUE_ H (Struct, Type33, DeviceErrorAddress);872 PRINT_STRUCT_VALUE_LH (Struct, Type33, MemoryArrayErrorAddress); 873 PRINT_STRUCT_VALUE_LH (Struct, Type33, DeviceErrorAddress); 782 874 PRINT_STRUCT_VALUE_H (Struct, Type33, ErrorResolution); 783 875 break; 784 876 785 877 // 786 // Management Device 878 // Management Device (Type 34) 787 879 // 788 880 case 34: … … 790 882 DisplayMDType (Struct->Type34->Type, Option); 791 883 PRINT_STRUCT_VALUE_H (Struct, Type34, Address); 792 PRINT_STRUCT_VALUE_H (Struct, Type34, AddressType); 793 break; 794 884 DisplayMDAddressType (Struct->Type34->AddressType, Option); 885 break; 886 887 // 888 // Management Device Component (Type 35) 889 // 795 890 case 35: 796 891 PRINT_PENDING_STRING (Struct, Type35, Description); … … 800 895 break; 801 896 897 // 898 // Management Device Threshold Data (Type 36) 899 // 802 900 case 36: 803 901 PRINT_STRUCT_VALUE_H (Struct, Type36, LowerThresholdNonCritical); … … 810 908 811 909 // 812 // Memory Channel 910 // Memory Channel (Type 37) 813 911 // 814 912 case 37: 815 913 { 816 UINT8 Count;817 MEMORY DEVICE *Ptr;914 UINT8 Count; 915 MEMORY_DEVICE *Ptr; 818 916 DisplayMemoryChannelType (Struct->Type37->ChannelType, Option); 819 917 PRINT_STRUCT_VALUE_H (Struct, Type37, MaximumChannelLoad); … … 824 922 for (Index = 0; Index < Count; Index++) { 825 923 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1); 826 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr ->DeviceLoad);827 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr ->DeviceHandle);924 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr[Index].DeviceLoad); 925 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr[Index].DeviceHandle); 828 926 } 829 927 } … … 831 929 832 930 // 833 // IPMI Device Information 931 // IPMI Device Information (Type 38) 834 932 // 835 933 case 38: … … 838 936 PRINT_STRUCT_VALUE_H (Struct, Type38, I2CSlaveAddress); 839 937 PRINT_STRUCT_VALUE_H (Struct, Type38, NVStorageDeviceAddress); 840 PRINT_STRUCT_VALUE_ H (Struct, Type38, BaseAddress);938 PRINT_STRUCT_VALUE_LH (Struct, Type38, BaseAddress); 841 939 break; 842 940 … … 855 953 PRINT_STRUCT_VALUE_H (Struct, Type39, MaxPowerCapacity); 856 954 DisplaySPSCharacteristics ( 857 Struct->Type39->PowerSupplyCharacteristics,955 *(UINT16 *) &(Struct->Type39->PowerSupplyCharacteristics), 858 956 Option 859 957 ); … … 895 993 case 41: 896 994 PRINT_PENDING_STRING (Struct, Type41, ReferenceDesignation); 897 PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceType); 995 ShellPrintEx(-1,-1,(((Struct->Type41->DeviceType) & 0x80) != 0) ? L"Device Enabled\n": L"Device Disabled\n"); 996 DisplayOnboardDeviceTypes ((Struct->Type41->DeviceType) & 0x7F, Option); 898 997 PRINT_STRUCT_VALUE_H (Struct, Type41, DeviceTypeInstance); 899 998 PRINT_STRUCT_VALUE_H (Struct, Type41, SegmentGroupNum); … … 902 1001 break; 903 1002 1003 // 1004 // Management Controller Host Interface (Type 42) 1005 // 1006 case 42: 1007 PRINT_STRUCT_VALUE_H (Struct, Type42, InterfaceType); 1008 break; 1009 1010 // 1011 // Inactive (Type 126) 1012 // 904 1013 case 126: 905 1014 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle); 906 1015 break; 907 1016 1017 // 1018 // End-of-Table (Type 127) 1019 // 908 1020 case 127: 909 1021 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle); … … 1158 1270 } 1159 1271 1160 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle); 1272 if (AE_SMBIOS_VERSION (0x2, 0x4)) { 1273 if (BIT (byte2, 2) != 0) { 1274 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLE_TAR_CONT_DIST), gShellDebug1HiiHandle); 1275 } 1276 if (AE_SMBIOS_VERSION (0x2, 0x7)) { 1277 if (BIT (byte2, 3) != 0) { 1278 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UEFI_SPEC_SUPPORT), gShellDebug1HiiHandle); 1279 } 1280 if (BIT (byte2, 4) != 0) { 1281 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VIRTUAL_MACHINE), gShellDebug1HiiHandle); 1282 } 1283 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 5); 1284 } else { 1285 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 3); 1286 } 1287 } else { 1288 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle, 2); 1289 } 1161 1290 } 1162 1291 … … 1258 1387 break; 1259 1388 1389 case 0x13: 1390 Print (L"M2 Family\n"); 1391 break; 1392 1393 case 0x14: 1394 Print (L"Intel Celeron M\n"); 1395 break; 1396 1397 case 0x15: 1398 Print (L"Intel Pentium 4 HT\n"); 1399 break; 1400 1260 1401 case 0x18: 1261 1402 Print (L"AMD Duron\n"); … … 1266 1407 break; 1267 1408 1409 case 0x1A: 1410 Print (L"K6 Family\n"); 1411 break; 1412 1413 case 0x1B: 1414 Print (L"K6-2\n"); 1415 break; 1416 1417 case 0x1C: 1418 Print (L"K6-3\n"); 1419 break; 1420 1421 case 0x1D: 1422 Print (L"AMD Althon Processor Family\n"); 1423 break; 1424 1425 case 0x1E: 1426 Print (L"AMD 29000 Family\n"); 1427 break; 1428 1429 case 0x1F: 1430 Print (L"K6-2+\n"); 1431 break; 1432 1268 1433 case 0x20: 1269 1434 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle); … … 1346 1511 break; 1347 1512 1513 case 0x38: 1514 Print (L"AMD Turion II Ultra Dual-Core Mobile M Processor Family\n"); 1515 break; 1516 1517 case 0x39: 1518 Print (L"AMD Turion II Dual-Core Mobile M Processor Family\n"); 1519 break; 1520 1521 case 0x3A: 1522 Print (L"AMD Althon II Dual-Core M Processor Family\n"); 1523 break; 1524 1525 case 0x3B: 1526 Print (L"AMD Opteron 6100 Series Processor\n"); 1527 break; 1528 1529 case 0x3C: 1530 Print (L"AMD Opteron 4100 Series Processor\n"); 1531 break; 1532 1533 case 0x3D: 1534 Print (L"AMD Opteron 6200 Series Processor\n"); 1535 break; 1536 1537 case 0x3E: 1538 Print (L"AMD Opteron 4200 Series Processor\n"); 1539 break; 1540 1541 case 0x3F: 1542 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_FX_SERIES), gShellDebug1HiiHandle); 1543 break; 1544 1348 1545 case 0x40: 1349 1546 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle); … … 1370 1567 break; 1371 1568 1569 case 0x46: 1570 Print (L"AMD C-Series Processor\n"); 1571 break; 1572 1573 case 0x47: 1574 Print (L"AMD E-Series Processor\n"); 1575 break; 1576 1577 case 0x48: 1578 Print (L"AMD A-Series Processor\n"); 1579 break; 1580 1581 case 0x49: 1582 Print (L"AMD G-Series Processor\n"); 1583 break; 1584 1585 case 0x4A: 1586 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_Z_SERIES), gShellDebug1HiiHandle); 1587 break; 1588 1589 case 0x4B: 1590 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_R_SERIES), gShellDebug1HiiHandle); 1591 break; 1592 1593 case 0x4C: 1594 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_4300_SERIES), gShellDebug1HiiHandle); 1595 break; 1596 1597 case 0x4D: 1598 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_6300_SERIES), gShellDebug1HiiHandle); 1599 break; 1600 1601 case 0x4E: 1602 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3300_SERIES), gShellDebug1HiiHandle); 1603 break; 1604 1605 case 0x4F: 1606 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_FIREPRO_SERIES), gShellDebug1HiiHandle); 1607 break; 1608 1372 1609 case 0x50: 1373 1610 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle); … … 1510 1747 break; 1511 1748 1749 case 0x91: 1750 Print (L"PA-RISC 8500\n"); 1751 break; 1752 1753 case 0x92: 1754 Print (L"PA-RISC 8000\n"); 1755 break; 1756 1757 case 0x93: 1758 Print (L"PA-RISC 7300LC\n"); 1759 break; 1760 1761 case 0x94: 1762 Print (L"PA-RISC 7200\n"); 1763 break; 1764 1765 case 0x95: 1766 Print (L"PA-RISC 7100LC\n"); 1767 break; 1768 1769 case 0x96: 1770 Print (L"PA-RISC 7100\n"); 1771 break; 1772 1512 1773 case 0xA0: 1513 1774 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle); … … 1578 1839 break; 1579 1840 1841 case 0xB1: 1842 Print (L"Pentium III Processorwith Intel SpeedStep Technology\n"); 1843 break; 1844 1845 case 0xB2: 1846 Print (L"Pentium 4 processor\n"); 1847 break; 1848 1849 case 0xB3: 1850 Print (L"Intel Xeon Processor\n"); 1851 break; 1852 1853 case 0xB4: 1854 Print (L"AS400 Family\n"); 1855 break; 1856 1857 case 0xB5: 1858 Print (L"Intel Xeon processor MP\n"); 1859 break; 1860 1861 case 0xB6: 1862 Print (L"AMD Althon XP Processor Family\n"); 1863 break; 1864 1865 case 0xB7: 1866 Print (L"AMD Althon MP Promcessor Family\n"); 1867 break; 1868 1869 case 0xB8: 1870 Print (L"Intel Itanium 2 processor\n"); 1871 break; 1872 1873 case 0xB9: 1874 Print (L"Intel Penium M processor\n"); 1875 break; 1876 1877 case 0xBA: 1878 Print (L"Intel Celeron D processor\n"); 1879 break; 1880 1881 case 0xBB: 1882 Print (L"Intel Pentium D processor\n"); 1883 break; 1884 1885 case 0xBC: 1886 Print (L"Intel Pentium Processor Extreme Edition\n"); 1887 break; 1888 1889 case 0xBD: 1890 Print (L"Intel Core Solo Processor\n"); 1891 break; 1892 1893 case 0xBF: 1894 Print (L"Intel Core 2 Duo Processor\n"); 1895 break; 1896 1580 1897 case 0xC0: 1581 1898 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle); … … 1627 1944 1628 1945 case 0xCC: 1629 Print (L"zArchitectur\n"); 1946 Print (L"zArchitecture\n"); 1947 break; 1948 1949 case 0xCD: 1950 Print (L"Intel Core i5 processor\n"); 1951 break; 1952 1953 case 0xCE: 1954 Print (L"Intel Core i3 processor\n"); 1630 1955 break; 1631 1956 … … 1678 2003 break; 1679 2004 2005 case 0xE0: 2006 Print (L"Multi-Core Intel Xeon processor 3400 Series\n"); 2007 break; 2008 2009 case 0xE4: 2010 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_3000_SERIES), gShellDebug1HiiHandle); 2011 break; 2012 2013 case 0xE5: 2014 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_II), gShellDebug1HiiHandle); 2015 break; 2016 2017 1680 2018 case 0xE6: 1681 2019 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle); … … 1702 2040 break; 1703 2041 2042 case 0xEC: 2043 Print (L"AMD Phenom II Processor Family\n"); 2044 break; 2045 2046 case 0xED: 2047 Print (L"AMD Althon II Processor Family\n"); 2048 break; 2049 2050 case 0xEE: 2051 Print (L"Six-Core AMD Opteron Processor Family\n"); 2052 break; 2053 2054 case 0xEF: 2055 Print (L"AMD Sempron M Processor Family\n"); 2056 break; 2057 1704 2058 case 0xFA: 1705 2059 Print (L"i860\n"); … … 1711 2065 1712 2066 default: 1713 // 1714 // In order to reduce code quality notice of 1715 // case & break not pair, so 1716 // move multiple case into the else part and 1717 // use if/else to check value. 1718 // 1719 if (Family >= 0x13 && Family <= 0x17) { 1720 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_M1), gShellDebug1HiiHandle); 1721 } else if (Family >= 0x1A && Family <= 0x1F) { 1722 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_K5), gShellDebug1HiiHandle); 1723 } else if (Family >= 0xB1 && Family <= 0xBF) { 1724 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_PENTIUM), gShellDebug1HiiHandle); 1725 } else { 1726 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); 1727 } 2067 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle); 1728 2068 } 1729 2069 // … … 1878 2218 @param[in] Status The status. 1879 2219 Bit 7 Reserved, must be 0 1880 Bit 6 1881 1 - CPU Socket Populated1882 0 - CPU Socket UnpopulatedBits1883 5:3Reserved, must be zero1884 2220 Bit 6 CPU Socket Populated 2221 1 - CPU Socket Populated 2222 0 - CPU Socket Unpopulated 2223 Bits 5:3 Reserved, must be zero 2224 Bits 2:0 CPU Status 1885 2225 0h - Unknown 1886 2226 1h - CPU Enabled … … 1903 2243 1904 2244 if (BIT (Status, 7) != 0) { 1905 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ ERROR_BIT7), gShellDebug1HiiHandle);2245 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT7_NOT_ZERO), gShellDebug1HiiHandle); 1906 2246 } else if (BIT (Status, 5) != 0) { 1907 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ ERROR_BIT5), gShellDebug1HiiHandle);2247 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle); 1908 2248 } else if (BIT (Status, 4) != 0) { 1909 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ ERROR_BIT4), gShellDebug1HiiHandle);2249 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); 1910 2250 } else if (BIT (Status, 3) != 0) { 1911 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ ERROR_BIT3), gShellDebug1HiiHandle);2251 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle); 1912 2252 } 1913 2253 // … … 2102 2442 2103 2443 /** 2444 Display Cache Configuration. 2445 2446 @param[in] CacheConfiguration Cache Configuration. 2447 Bits 15:10 Reserved, must be 0 2448 Bits 9:8 Operational Mode 2449 0h - Write Through 2450 1h - Write Back 2451 2h - Varies with Memory Address 2452 3h - Unknown 2453 Bit 7 Enabled/Disabled 2454 1 - Enabled 2455 0 - Disabled 2456 Bits 6:5 Location 2457 0h - Internal 2458 1h - External 2459 2h - Reserved 2460 3h - Unknown 2461 Bit 4 Reserved, must be zero 2462 Bit 3 Cache Socketed 2463 1 - Socketed 2464 0 - Unsocketed 2465 Bits 2:0 Cache Level 2466 1 through 8 (For example, an L1 cache would 2467 use value 000b and an L3 cache would use 010b.) 2468 2469 @param[in] Option The option 2470 **/ 2471 VOID 2472 DisplayCacheConfiguration ( 2473 IN UINT16 CacheConfiguration, 2474 IN UINT8 Option 2475 ) 2476 { 2477 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_CONFIGURATION), gShellDebug1HiiHandle); 2478 PRINT_INFO_OPTION (CacheConfiguration, Option); 2479 2480 if (BIT (CacheConfiguration, 15) != 0) { 2481 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT15_NOT_ZERO), gShellDebug1HiiHandle); 2482 } else if (BIT (CacheConfiguration, 14) != 0) { 2483 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT14_NOT_ZERO), gShellDebug1HiiHandle); 2484 } else if (BIT (CacheConfiguration, 13) != 0) { 2485 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT13_NOT_ZERO), gShellDebug1HiiHandle); 2486 } else if (BIT (CacheConfiguration, 12) != 0) { 2487 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT12_NOT_ZERO), gShellDebug1HiiHandle); 2488 } else if (BIT (CacheConfiguration, 11) != 0) { 2489 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT11_NOT_ZERO), gShellDebug1HiiHandle); 2490 } else if (BIT (CacheConfiguration, 10) != 0) { 2491 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT10_NOT_ZERO), gShellDebug1HiiHandle); 2492 } else if (BIT (CacheConfiguration, 4) != 0) { 2493 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle); 2494 } 2495 2496 // 2497 // Check BITs 9:8 2498 // 2499 switch ((CacheConfiguration & 0x300) >> 8) { 2500 case 0: 2501 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_THROUGH), gShellDebug1HiiHandle); 2502 break; 2503 2504 case 1: 2505 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_WRITE_BACK), gShellDebug1HiiHandle); 2506 break; 2507 2508 case 2: 2509 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_VARIES_WITH_MEM_ADDR), gShellDebug1HiiHandle); 2510 break; 2511 2512 case 3: 2513 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); 2514 break; 2515 } 2516 2517 // 2518 // Check BIT 7 2519 // 2520 if (BIT (CacheConfiguration, 7) != 0) { 2521 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle); 2522 } else { 2523 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle); 2524 } 2525 2526 // 2527 // Check BITs 6:5 2528 // 2529 switch ((CacheConfiguration & 0x60) >> 5) { 2530 case 0: 2531 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_INTERNAL), gShellDebug1HiiHandle); 2532 break; 2533 2534 case 1: 2535 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_EXTERNAL), gShellDebug1HiiHandle); 2536 break; 2537 2538 case 2: 2539 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle); 2540 break; 2541 2542 case 3: 2543 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle); 2544 break; 2545 } 2546 2547 // 2548 // Check BIT 3 2549 // 2550 if (BIT (CacheConfiguration, 3) != 0) { 2551 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_SOCKETED), gShellDebug1HiiHandle); 2552 } else { 2553 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_NOT_SOCKETED), gShellDebug1HiiHandle); 2554 } 2555 2556 2557 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CACHE_LEVEL), gShellDebug1HiiHandle, (CacheConfiguration & 0x07) + 1); 2558 } 2559 2560 /** 2104 2561 The Slot ID field of the System Slot structure provides a mechanism to 2105 2562 correlate the physical attributes of the slot to its logical access method … … 2175 2632 2176 2633 default: 2177 if ( SlotType >= 0x0E && SlotType <= 0x12){2634 if ((SlotType >= 0x0E && SlotType <= 0x12) || (SlotType >= 0xA6 && SlotType <= 0xB6)){ 2178 2635 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId); 2179 2636 } else { … … 2262 2719 // 2263 2720 Day = Date & 0x001F; 2264 Month = (Date & 0x0 0E0) >> 5;2265 Year = ((Date & 0xF F00) >> 8) + 1980;2721 Month = (Date & 0x01E0) >> 5; 2722 Year = ((Date & 0xFE00) >> 9) + 1980; 2266 2723 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year); 2267 2724 … … 2269 2726 2270 2727 /** 2271 Display System Reset 2728 Display System Reset (Type 23) information. 2272 2729 2273 2730 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.h
r48674 r58459 2 2 Module to clarify the element info of the smbios structure. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 16 16 #define _SMBIOS_PRINT_INFO_H_ 17 17 18 #include "LibSmbios.h"18 #include <IndustryStandard/SmBios.h> 19 19 20 20 extern UINT8 SmbiosMajorVersion; … … 43 43 VOID 44 44 SmbiosPrintEPSInfo ( 45 IN SMBIOS_ STRUCTURE_TABLE*SmbiosTable,46 IN UINT8 Option45 IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable, 46 IN UINT8 Option 47 47 ); 48 48 … … 155 155 156 156 @param[in] Status The status. 157 158 Bit 6CPU Socket Populated159 160 0 - CPU Socket UnpopulatedBits161 5:3Reserved, must be zero162 163 164 165 166 167 168 169 157 Bit 7 Reserved, must be 0 158 Bit 6 CPU Socket Populated 159 1 - CPU Socket Populated 160 0 - CPU Socket Unpopulated 161 Bits 5:3 Reserved, must be zero 162 Bits 2:0 CPU Status 163 0h - Unknown 164 1h - CPU Enabled 165 2h - CPU Disabled by User via BIOS Setup 166 3h - CPU Disabled By BIOS (POST Error) 167 4h - CPU is Idle, waiting to be enabled. 168 5-6h - Reserved 169 7h - Other 170 170 171 171 @param[in] Option The option … … 234 234 DisplayMmMemorySize ( 235 235 IN UINT8 Size, 236 IN UINT8 Option 237 ); 238 239 /** 240 Display Cache Configuration. 241 242 @param[in] CacheConfiguration Cache Configuration. 243 Bits 15:10 Reserved, must be 0 244 Bits 9:8 Operational Mode 245 0h - Write Through 246 1h - Write Back 247 2h - Varies with Memory Address 248 3h - Unknown 249 Bit 7 Enabled/Disabled 250 1 - Enabled 251 0 - Disabled 252 Bits 6:5 Location 253 0h - Internal 254 1h - External 255 2h - Reserved 256 3h - Unknown 257 Bit 4 Reserved, must be zero 258 Bit 3 Cache Socketed 259 1 - Socketed 260 0 - Unsocketed 261 Bits 2:0 Cache Level 262 1 through 8 (For example, an L1 cache would 263 use value 000b and an L3 cache would use 010b.) 264 265 @param[in] Option The option 266 **/ 267 VOID 268 DisplayCacheConfiguration ( 269 IN UINT16 CacheConfiguration, 236 270 IN UINT8 Option 237 271 ); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
r48674 r58459 3 3 And give a interface of query a string out of a table. 4 4 5 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR> 6 6 This program and the accompanying materials 7 7 are licensed and made available under the terms and conditions of the BSD License … … 53 53 }; 54 54 55 TABLE_ITEM BaseBoardFeatureFlagsTable[] = { 56 { 57 0, 58 L" Hosting board" 59 }, 60 { 61 1, 62 L" Requires at least one daughter board or auxiliary card" 63 }, 64 { 65 2, 66 L" Removable" 67 }, 68 { 69 3, 70 L" Replaceable" 71 }, 72 { 73 4, 74 L" Hot swappable" 75 } 76 }; 77 78 TABLE_ITEM BaseBoardBoardTypeTable[] = { 79 { 80 0x01, 81 L" Unknown" 82 }, 83 { 84 0x02, 85 L" Other" 86 }, 87 { 88 0x03, 89 L" Server Blade" 90 }, 91 { 92 0x04, 93 L" Connectivity Switch" 94 }, 95 { 96 0x05, 97 L" System Management Module" 98 }, 99 { 100 0x06, 101 L" Processor Module" 102 }, 103 { 104 0x07, 105 L" I/O Module" 106 }, 107 { 108 0x08, 109 L" Memory Module" 110 }, 111 { 112 0x09, 113 L" Daughter board" 114 }, 115 { 116 0x0A, 117 L" Motherboard" 118 }, 119 { 120 0x0B, 121 L" Processor/Memory Module" 122 }, 123 { 124 0x0C, 125 L" Processor/IO Module" 126 }, 127 { 128 0x0D, 129 L" Interconnect Board" 130 } 131 }; 132 55 133 TABLE_ITEM SystemEnclosureTypeTable[] = { 56 134 { 57 135 0x01, 58 L" None"136 L" Other" 59 137 }, 60 138 { … … 349 427 0x19, 350 428 L"Socket LGA1366" 351 }\ 352 }; 429 }, 430 { 431 0x1A, 432 L"Socket G34" 433 }, 434 { 435 0x1B, 436 L"Socket AM3" 437 }, 438 { 439 0x1C, 440 L"Socket C32" 441 }, 442 { 443 0x1D, 444 L"Socket LGA1156" 445 }, 446 { 447 0x1E, 448 L"Socket LGA1567" 449 }, 450 { 451 0x1F, 452 L"Socket PGA988A" 453 }, 454 { 455 0x20, 456 L"Socket BGA1288" 457 }, 458 { 459 0x21, 460 L"Socket rPGA988B" 461 }, 462 { 463 0x22, 464 L"Socket BGA1023" 465 }, 466 { 467 0x23, 468 L"Socket BGA1224" 469 }, 470 { 471 0x24, 472 L"Socket LGA1155" 473 }, 474 { 475 0x25, 476 L"Socket LGA1356" 477 }, 478 { 479 0x26, 480 L"Socket LGA2011" 481 }, 482 { 483 0x27, 484 L"Socket FS1" 485 }, 486 { 487 0x28, 488 L"Socket FS2" 489 }, 490 { 491 0x29, 492 L"Socket FM1" 493 }, 494 { 495 0x2A, 496 L"Socket FM2" 497 }, 498 { 499 0x2B, 500 L"Socket LGA2011-3" 501 }, 502 { 503 0x2C, 504 L"Socket LGA1356-3" 505 } 506 }; 507 508 TABLE_ITEM ProcessorCharacteristicsTable[] = { 509 { 510 1, 511 L" Unknown" 512 }, 513 { 514 2, 515 L" 64-bit Capable" 516 }, 517 { 518 3, 519 L" Multi-Core" 520 }, 521 { 522 4, 523 L" Hardware Thread" 524 }, 525 { 526 5, 527 L" Execute Protection" 528 }, 529 { 530 6, 531 L" Enhanced Virtualization" 532 }, 533 { 534 7, 535 L" Power/Performance Control" 536 } 537 }; 538 353 539 354 540 TABLE_ITEM McErrorDetectMethodTable[] = { … … 600 786 0x06, 601 787 L"Multi-bit ECC" 602 },603 {604 0x07,605 L"Sixteen Way Interleave"606 788 } 607 789 }; … … 682 864 0x0D, 683 865 L"64-way Set-Associative" 866 }, 867 { 868 0x0E, 869 L"20-way Set-Associative" 684 870 } 685 871 }; … … 1122 1308 { 1123 1309 0xAB, 1124 L"PCI Express Gen 2 6"1310 L"PCI Express Gen 2" 1125 1311 }, 1126 1312 { … … 1143 1329 0xB0, 1144 1330 L"PCI Express Gen 2 X16" 1331 }, 1332 { 1333 0xB1, 1334 L"PCI Express Gen 3" 1335 }, 1336 { 1337 0xB2, 1338 L"PCI Express Gen 3 X1" 1339 }, 1340 { 1341 0xB3, 1342 L"PCI Express Gen 3 X2" 1343 }, 1344 { 1345 0xB4, 1346 L"PCI Express Gen 3 X4" 1347 }, 1348 { 1349 0xB5, 1350 L"PCI Express Gen 3 X8" 1351 }, 1352 { 1353 0xB6, 1354 L"PCI Express Gen 3 X16" 1145 1355 } 1146 1356 }; … … 1175 1385 L" 128 bit" 1176 1386 }, 1387 { 1388 0x08, 1389 L" 1x or x1" 1390 }, 1391 { 1392 0x09, 1393 L" 2x or x2" 1394 }, 1395 { 1396 0x0A, 1397 L" 4x or x4" 1398 }, 1399 { 1400 0x0B, 1401 L" 8x or x8" 1402 }, 1403 { 1404 0x0C, 1405 L" 12x or x12" 1406 }, 1407 { 1408 0x0D, 1409 L" 16x or x16" 1410 }, 1411 { 1412 0x0E, 1413 L" 32x or x32" 1414 } 1177 1415 }; 1178 1416 … … 2118 2356 L" Non-volatile" 2119 2357 }, 2358 { 2359 13, 2360 L" Registered(Buffered)" 2361 }, 2362 { 2363 14, 2364 L" Unbuffered(Unregistered)" 2365 } 2120 2366 }; 2121 2367 … … 2473 2719 }, 2474 2720 { 2475 0x 0A,2721 0x10, 2476 2722 L" Active Cooling " 2477 2723 }, 2478 2724 { 2479 0x 0B,2725 0x11, 2480 2726 L" Passive Cooling " 2481 2727 }, … … 2910 3156 39, 2911 3157 L" System Power Supply" 3158 }, 3159 { 3160 40, 3161 L" Additional Information" 3162 }, 3163 { 3164 41, 3165 L" Onboard Devices Extended Information" 3166 }, 3167 { 3168 42, 3169 L" Management Controller Host Interface" 2912 3170 }, 2913 3171 { … … 2965 3223 High = (UINT8) (Table[Index].Key >> 8); 2966 3224 Low = (UINT8) (Table[Index].Key & 0x00FF); 3225 2967 3226 // 2968 3227 // Check if Key is in the range 3228 // or if Key == Value in the table 2969 3229 // 2970 if (High > Low && Key >= Low && Key <= High) { 3230 if ((High > Low && Key >= Low && Key <= High) 3231 || (Table[Index].Key == Key)) { 2971 3232 StrnCpy (Info, Table[Index].Info, InfoLen-1); 2972 StrnCat (Info, L"\n", InfoLen - StrLen(Info)); 2973 return Key; 2974 } 2975 // 2976 // Check if Key == Value in the table 2977 // 2978 if (Table[Index].Key == Key) { 2979 StrnCpy (Info, Table[Index].Info, InfoLen-1); 2980 StrnCat (Info, L"\n", InfoLen - StrLen(Info)); 3233 StrnCat (Info, L"\n", InfoLen - 1 - StrLen(Info)); 2981 3234 return Key; 2982 3235 } 2983 3236 } 2984 3237 2985 StrnCpy (Info, L"Undefined Value\n", InfoLen );3238 StrnCpy (Info, L"Undefined Value\n", InfoLen - 1); 2986 3239 return QUERY_TABLE_UNFOUND; 2987 3240 } … … 3088 3341 3089 3342 /** 3343 Display Base Board (Type 2) Feature Flags. 3344 3345 @param[in] FeatureFlags The key of the structure. 3346 @param[in] Option The optional information. 3347 **/ 3348 VOID 3349 DisplayBaseBoardFeatureFlags ( 3350 IN UINT8 FeatureFlags, 3351 IN UINT8 Option 3352 ) 3353 { 3354 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS), gShellDebug1HiiHandle); 3355 PRINT_INFO_OPTION (FeatureFlags, Option); 3356 PRINT_BITS_INFO (BaseBoardFeatureFlagsTable, FeatureFlags); 3357 } 3358 3359 /** 3360 Display Base Board (Type 2) Board Type. 3361 3362 @param[in] Type The key of the structure. 3363 @param[in] Option The optional information. 3364 **/ 3365 VOID 3366 DisplayBaseBoardBoardType( 3367 IN UINT8 Type, 3368 IN UINT8 Option 3369 ) 3370 { 3371 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE), gShellDebug1HiiHandle); 3372 PRINT_INFO_OPTION (Type, Option); 3373 PRINT_TABLE_ITEM (BaseBoardBoardTypeTable, Type); 3374 } 3375 3376 /** 3090 3377 Display System Enclosure (Type 3) Enclosure Type. 3091 3378 … … 3177 3464 PRINT_INFO_OPTION (Upgrade, Option); 3178 3465 PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade); 3466 } 3467 3468 /** 3469 Display Processor Information (Type 4) Characteristics. 3470 3471 @param[in] Type The key of the structure. 3472 @param[in] Option The optional information. 3473 **/ 3474 VOID 3475 DisplayProcessorCharacteristics ( 3476 IN UINT16 Type, 3477 IN UINT8 Option 3478 ) 3479 { 3480 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS), gShellDebug1HiiHandle); 3481 PRINT_INFO_OPTION (Type, Option); 3482 PRINT_BITS_INFO (ProcessorCharacteristicsTable, Type); 3179 3483 } 3180 3484 … … 3653 3957 ) 3654 3958 { 3655 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ LOCATION), gShellDebug1HiiHandle);3959 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_USE), gShellDebug1HiiHandle); 3656 3960 PRINT_INFO_OPTION (Use, Option); 3657 3961 PRINT_TABLE_ITEM (PMAUseTable, Use); … … 3989 4293 3990 4294 /** 3991 Display Management Device (Type 34) information.4295 Display Management Device (Type 34) Type. 3992 4296 3993 4297 @param[in] Key The key of the structure. … … 4003 4307 PRINT_INFO_OPTION (Key, Option); 4004 4308 PRINT_TABLE_ITEM (MDTypeTable, Key); 4309 } 4310 4311 /** 4312 Display Management Device (Type 34) Address Type. 4313 4314 @param[in] Key The key of the structure. 4315 @param[in] Option The optional information. 4316 **/ 4317 VOID 4318 DisplayMDAddressType ( 4319 IN UINT8 Key, 4320 IN UINT8 Option 4321 ) 4322 { 4323 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle); 4324 PRINT_INFO_OPTION (Key, Option); 4325 PRINT_TABLE_ITEM (MDAddressTypeTable, Key); 4005 4326 } 4006 4327 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.h
r48674 r58459 3 3 and give a interface of query a string out of a table. 4 4 5 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>5 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 6 6 This program and the accompanying materials 7 7 are licensed and made available under the terms and conditions of the BSD License … … 96 96 97 97 /** 98 Display Base Board (Type 2) Feature Flags. 99 100 @param[in] FeatureFlags The key of the structure. 101 @param[in] Option The optional information. 102 **/ 103 VOID 104 DisplayBaseBoardFeatureFlags ( 105 IN UINT8 FeatureFlags, 106 IN UINT8 Option 107 ); 108 109 /** 110 Display Base Board (Type 2) Board Type. 111 112 @param[in] Type The key of the structure. 113 @param[in] Option The optional information. 114 **/ 115 VOID 116 DisplayBaseBoardBoardType( 117 IN UINT8 Type, 118 IN UINT8 Option 119 ); 120 121 /** 98 122 Display System Enclosure (Type 3) Enclosure Type. 99 123 … … 153 177 DisplayProcessorUpgrade ( 154 178 IN UINT8 Upgrade, 179 IN UINT8 Option 180 ); 181 182 /** 183 Display Processor Information (Type 4) Characteristics. 184 185 @param[in] Type The key of the structure. 186 @param[in] Option The optional information. 187 **/ 188 VOID 189 DisplayProcessorCharacteristics ( 190 IN UINT16 Type, 155 191 IN UINT8 Option 156 192 ); … … 697 733 698 734 /** 699 Display Management Device (Type 34) information.735 Display Management Device (Type 34) Type. 700 736 701 737 @param[in] Key The key of the structure. … … 709 745 710 746 /** 747 Display Management Device (Type 34) Address Type. 748 749 @param[in] Key The key of the structure. 750 @param[in] Option The optional information. 751 **/ 752 VOID 753 DisplayMDAddressType ( 754 IN UINT8 Key, 755 IN UINT8 Option 756 ); 757 758 /** 711 759 Display Memory Channel (Type 37) information. 712 760 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.c
r48674 r58459 2 2 Tools of clarify the content of the smbios table. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 112 112 // Initialize the StructHandle to be the first handle 113 113 // 114 StructHandle = STRUCTURE_HANDLE_INVALID;114 StructHandle = INVALID_HANDLE; 115 115 LibGetSmbiosStructure (&StructHandle, NULL, NULL); 116 116 … … 189 189 { 190 190 UINT16 Handle; 191 UINT8 Buffer[1024]; 192 // 193 // bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize 194 // 191 UINT8 *Buffer; 195 192 UINT16 Length; 196 193 UINTN Index; 197 UINT16 Offset;198 //199 // address offset from structure table head.200 //201 UINT32 TableHead;202 //203 // structure table head.204 //205 194 206 195 SMBIOS_STRUCTURE_POINTER SmbiosStruct; 207 SMBIOS_ STRUCTURE_TABLE*SMBiosTable;196 SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; 208 197 209 198 SMBiosTable = NULL; … … 216 205 if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) { 217 206 // 218 // Have g et SMBIOS table207 // Have got SMBIOS table 219 208 // 220 209 SmbiosPrintEPSInfo (SMBiosTable, Option); … … 260 249 // 261 250 Handle = QueryHandle; 262 TableHead = SMBiosTable->TableAddress;263 Offset = 0;264 251 for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) { 265 252 // 266 253 // if reach the end of table, break.. 267 254 // 268 if (Handle == STRUCTURE_HANDLE_INVALID) {255 if (Handle == INVALID_HANDLE) { 269 256 break; 270 257 } … … 272 259 // handle then point to the next! 273 260 // 274 if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {261 if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { 275 262 break; 276 263 } 277 Offset = (UINT16) (Offset + Length); 264 278 265 SmbiosStruct.Raw = Buffer; 279 266 … … 298 285 // Addr of structure in structure in table 299 286 // 300 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset);287 ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer); 301 288 DumpHex (0, 0, Length, Buffer); 302 289 … … 316 303 317 304 if (gShowType != SHOW_NONE) { 318 //319 // check structure legality320 //321 SmbiosCheckStructure (&SmbiosStruct);322 323 305 // 324 306 // Print structure information … … 344 326 break; 345 327 } 328 // 329 // Support Execution Interrupt. 330 // 331 if (ShellGetExecutionBreakFlag ()) { 332 return EFI_ABORTED; 333 } 346 334 } 347 335 … … 365 353 { 366 354 UINT16 Handle; 367 UINT8 Buffer[1024];355 UINT8 *Buffer; 368 356 UINT16 Length; 369 357 UINT16 Offset; … … 371 359 372 360 SMBIOS_STRUCTURE_POINTER SmbiosStruct; 373 SMBIOS_ STRUCTURE_TABLE*SMBiosTable;361 SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; 374 362 STRUCTURE_STATISTICS *StatisticsPointer; 375 363 … … 406 394 // search from the first one 407 395 // 408 Handle = STRUCTURE_HANDLE_INVALID;396 Handle = INVALID_HANDLE; 409 397 LibGetSmbiosStructure (&Handle, NULL, NULL); 410 398 for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) { … … 412 400 // If reach the end of table, break.. 413 401 // 414 if (Handle == STRUCTURE_HANDLE_INVALID) {402 if (Handle == INVALID_HANDLE) { 415 403 break; 416 404 } … … 418 406 // After LibGetSmbiosStructure(), handle then point to the next! 419 407 // 420 if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {408 if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) { 421 409 break; 422 410 } 423 411 424 412 SmbiosStruct.Raw = Buffer; 425 Offset = (UINT16) (Offset + Length);426 413 427 414 // … … 433 420 StatisticsPointer->Length = Length; 434 421 StatisticsPointer->Addr = Offset; 422 423 Offset = (UINT16) (Offset + Length); 435 424 436 425 StatisticsPointer = &mStatisticsTable[Index]; … … 453 442 ) 454 443 { 455 UINTN Index;456 UINTN Num;457 STRUCTURE_STATISTICS *StatisticsPointer;458 SMBIOS_ STRUCTURE_TABLE*SMBiosTable;444 UINTN Index; 445 UINTN Num; 446 STRUCTURE_STATISTICS *StatisticsPointer; 447 SMBIOS_TABLE_ENTRY_POINT *SMBiosTable; 459 448 460 449 SMBiosTable = NULL; … … 559 548 } 560 549 561 /*562 EFI_STATUS563 InitializeSmbiosViewApplicationGetLineHelp (564 OUT CHAR16 **Str565 )566 {567 return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str);568 }569 */ -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/SmbiosView.h
r48674 r58459 2 2 Tools of clarify the content of the smbios table. 3 3 4 Copyright (c) 2005 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2005 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 18 18 #define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE 19 19 #define STRUCTURE_TYPE_INVALID (UINT8) 0xFF 20 21 #define STRUCTURE_HANDLE_INVALID (UINT16) 0xFFFF22 20 23 21 typedef struct { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.c
r48674 r58459 14 14 15 15 #include "UefiShellDebug1CommandsLib.h" 16 #include <Library/BcfgCommandLib.h> 16 17 17 18 STATIC CONST CHAR16 mFileName[] = L"Debug1Commands"; … … 85 86 ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT) ); 86 87 87 //88 // check install profile bit of the profiles mask is set89 //90 if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {91 ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG) );92 }93 94 95 96 97 88 ShellCommandRegisterAlias(L"dmem", L"mem"); 89 90 BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Debug1"); 98 91 99 92 return (EFI_SUCCESS); … … 116 109 HiiRemovePackages(gShellDebug1HiiHandle); 117 110 } 111 112 BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable); 118 113 return (EFI_SUCCESS); 119 114 } … … 181 176 Val[Index * 3] = 0; 182 177 Str[Index] = 0; 183 ShellPrintEx(-1, -1, L"%*a%0 2X: %-.48a *%a*\r\n", Indent, "", Offset, Val, Str);178 ShellPrintEx(-1, -1, L"%*a%08X: %-48a *%a*\r\n", Indent, "", Offset, Val, Str); 184 179 185 180 Data += Size; … … 491 486 EFI_STATUS Status; 492 487 UINTN Suffix; 493 BOOLEAN FoundNewFile;494 488 CHAR16 *FileNameTmp; 495 489 496 490 Suffix = 0; 497 FoundNewFile = FALSE;498 491 499 492 do { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.h
r48674 r58459 2 2 Main file for NULL named library for Profile1 shell command functions. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 30 30 #include <Protocol/LoadedImage.h> 31 31 #include <Protocol/UnicodeCollation.h> 32 #include <Protocol/DevicePathToText.h>33 32 #include <Protocol/DriverDiagnostics2.h> 34 33 #include <Protocol/DriverDiagnostics.h> … … 39 38 #include <Protocol/DriverFamilyOverride.h> 40 39 #include <Protocol/DriverHealth.h> 41 #include <Protocol/DevicePathFromText.h>42 40 #include <Protocol/SimplePointer.h> 43 41 #include <Protocol/PciRootBridgeIo.h> -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
r48674 r58459 2 2 # Provides shell Debug1 profile functions 3 3 # 4 # Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> 5 5 # 6 6 # This program and the accompanying materials … … 37 37 SetVar.c 38 38 SerMode.c 39 Bcfg.c40 39 Pci.c 41 40 Pci.h … … 47 46 SmbiosView/QueryTable.c 48 47 SmbiosView/SmbiosView.c 49 SmbiosView/Smbios.c50 48 SmbiosView/SmbiosViewStrings.uni 51 49 SmbiosView/LibSmbiosView.c 52 50 SmbiosView/PrintInfo.h 53 51 SmbiosView/LibSmbiosView.h 54 SmbiosView/LibSmbios.h55 52 SmbiosView/QueryTable.h 56 53 SmbiosView/SmbiosView.h … … 118 115 SortLib 119 116 PrintLib 117 BcfgCommandLib 120 118 121 119 [Pcd] 122 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED123 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize # ALWAYS_CONSUMED124 gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength # ALWAYS_CONSUMED120 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES 121 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## CONSUMES 122 gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength ## CONSUMES 125 123 126 124 [Protocols] 127 gEfiPciRootBridgeIoProtocolGuid 128 gEfiBlockIoProtocolGuid 129 gEfiSimplePointerProtocolGuid 125 gEfiPciRootBridgeIoProtocolGuid ## CONSUMES 126 gEfiBlockIoProtocolGuid ## CONSUMES 127 gEfiSimplePointerProtocolGuid ## CONSUMES 130 128 131 129 [Guids] 132 gEfiGlobalVariableGuid 133 gEfiSmbiosTableGuid 134 gEfiMpsTableGuid 135 gEfiSalSystemTableGuid 136 gEfiAcpi10TableGuid 137 gEfiAcpi20TableGuid 138 gShellDebug1HiiGuid 130 gEfiGlobalVariableGuid ## SOMETIMES_CONSUMES ## GUID 131 gEfiSmbiosTableGuid ## SOMETIMES_CONSUMES ## SystemTable 132 gEfiMpsTableGuid ## SOMETIMES_CONSUMES ## SystemTable 133 gEfiSalSystemTableGuid ## SOMETIMES_CONSUMES ## SystemTable 134 gEfiAcpi10TableGuid ## SOMETIMES_CONSUMES ## SystemTable 135 gEfiAcpi20TableGuid ## SOMETIMES_CONSUMES ## SystemTable 136 gShellDebug1HiiGuid ## SOMETIMES_CONSUMES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Connect.c
r48674 r58459 2 2 Main file for connect shell Driver1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 16 16 17 17 /** 18 Create all handles associate with every device path node. 19 20 @param DevicePathToConnect The device path which will be connected. 21 22 @retval EFI_SUCCESS All handles associate with every device path node 23 have been created. 24 @retval EFI_INVALID_PARAMETER DevicePathToConnect is NULL. 25 @retval EFI_NOT_FOUND Create the handle associate with one device path 26 node failed 27 28 **/ 29 EFI_STATUS 30 ShellConnectDevicePath ( 31 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect 32 ) 33 { 34 EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath; 35 EFI_STATUS Status; 36 EFI_HANDLE Handle; 37 EFI_HANDLE PreviousHandle; 38 39 if (DevicePathToConnect == NULL) { 40 return EFI_INVALID_PARAMETER; 41 } 42 43 PreviousHandle = NULL; 44 do{ 45 RemainingDevicePath = DevicePathToConnect; 46 Status = gBS->LocateDevicePath (&gEfiDevicePathProtocolGuid, &RemainingDevicePath, &Handle); 47 48 if (!EFI_ERROR (Status) && (Handle != NULL)) { 49 if (PreviousHandle == Handle) { 50 Status = EFI_NOT_FOUND; 51 } else { 52 PreviousHandle = Handle; 53 Status = gBS->ConnectController (Handle, NULL, RemainingDevicePath, FALSE); 54 } 55 } 56 57 } while (!EFI_ERROR (Status) && !IsDevicePathEnd (RemainingDevicePath) ); 58 59 return Status; 60 61 } 62 63 /** 64 Connect drivers for PCI root bridge. 65 66 @retval EFI_SUCCESS Connect drivers successfully. 67 @retval EFI_NOT_FOUND Cannot find PCI root bridge device. 68 69 **/ 70 EFI_STATUS 71 ShellConnectPciRootBridge ( 72 VOID 73 ) 74 { 75 UINTN RootBridgeHandleCount; 76 EFI_HANDLE *RootBridgeHandleBuffer; 77 UINTN RootBridgeIndex; 78 EFI_STATUS Status; 79 80 RootBridgeHandleCount = 0; 81 82 Status = gBS->LocateHandleBuffer ( 83 ByProtocol, 84 &gEfiPciRootBridgeIoProtocolGuid, 85 NULL, 86 &RootBridgeHandleCount, 87 &RootBridgeHandleBuffer 88 ); 89 if (EFI_ERROR (Status)) { 90 return Status; 91 } 92 93 for (RootBridgeIndex = 0; RootBridgeIndex < RootBridgeHandleCount; RootBridgeIndex++) { 94 gBS->ConnectController (RootBridgeHandleBuffer[RootBridgeIndex], NULL, NULL, FALSE); 95 } 96 97 return EFI_SUCCESS; 98 } 99 100 101 /** 18 102 Connect controller(s) and driver(s). 19 103 20 @param[in] ControllerHandle The handle to the controller. 21 @param[in] DriverHandle The handle to the driver. 104 @param[in] ControllerHandle The handle to the controller. Should have driver binding on it. 105 @param[in] DriverHandle The handle to the driver. Should have driver binding. 22 106 @param[in] Recursive TRUE to connect recursively, FALSE otherwise. 23 107 @param[in] Output TRUE to have info on the screen, FALSE otherwise. … … 114 198 { 115 199 EFI_DEVICE_PATH_PROTOCOL *DevPath; 116 EFI_DEVICE_PATH_PROTOCOL *DevPathWalker; 200 EFI_DEVICE_PATH_PROTOCOL *CopyOfDevPath; 201 EFI_DEVICE_PATH_PROTOCOL *Instance; 202 EFI_DEVICE_PATH_PROTOCOL *Next; 117 203 UINTN Length; 118 EFI_HANDLE Handle; 204 UINTN Index; 205 UINTN HandleArrayCount; 206 UINTN Size; 207 EFI_HANDLE *HandleArray; 119 208 EFI_STATUS Status; 120 209 BOOLEAN AtLeastOneConnected; 210 EFI_PCI_IO_PROTOCOL *PciIo; 211 UINT8 Class[3]; 212 121 213 DevPath = NULL; 122 214 Length = 0; 215 AtLeastOneConnected = FALSE; 123 216 124 217 // … … 128 221 if (Status == EFI_BUFFER_TOO_SMALL) { 129 222 DevPath = AllocateZeroPool(Length); 223 if (DevPath == NULL) { 224 return EFI_OUT_OF_RESOURCES; 225 } 130 226 Status = gRT->GetVariable((CHAR16*)Key, (EFI_GUID*)&gEfiGlobalVariableGuid, NULL, &Length, DevPath); 227 if (EFI_ERROR (Status)) { 228 if (DevPath != NULL) { 229 FreePool (DevPath); 230 } 231 return Status; 232 } 233 } else if (EFI_ERROR (Status)) { 234 return Status; 131 235 } 132 236 133 237 Status = EFI_NOT_FOUND; 238 239 CopyOfDevPath = DevPath; 134 240 // 135 241 // walk the list of devices and connect them 136 242 // 137 for (DevPathWalker = DevPath 138 ; DevPathWalker < (DevPath + Length) && EFI_ERROR(Status) && DevPath != NULL 139 ; DevPathWalker += GetDevicePathSize(DevPathWalker) 140 ){ 141 // 142 // get the correct handle from a given device path 143 // 144 if ((StrCmp(Key, L"ConInDev") == 0) 145 ||(StrCmp(Key, L"ConIn") == 0) 146 ){ 147 Status = gBS->LocateDevicePath((EFI_GUID*)&gEfiConsoleInDeviceGuid, &DevPathWalker, &Handle); 148 if (!EFI_ERROR(Status)) { 149 Status = ConnectControllers(NULL, Handle, FALSE, TRUE, FALSE); 150 } 151 } else if ((StrCmp(Key, L"ConOutDev") == 0) 152 || (StrCmp(Key, L"ConErrDev") == 0) 153 || (StrCmp(Key, L"ConOut") == 0) 154 || (StrCmp(Key, L"ConErr") == 0) 155 ){ 156 Status = gBS->LocateDevicePath((EFI_GUID*)&gEfiConsoleOutDeviceGuid, &DevPathWalker, &Handle); 157 if (!EFI_ERROR(Status)) { 158 Status = ConnectControllers(NULL, Handle, FALSE, TRUE, FALSE); 159 } 160 } 161 } 162 243 do { 244 // 245 // Check every instance of the console variable 246 // 247 Instance = GetNextDevicePathInstance (&CopyOfDevPath, &Size); 248 if (Instance == NULL) { 249 if (DevPath != NULL) { 250 FreePool (DevPath); 251 } 252 return EFI_UNSUPPORTED; 253 } 254 255 Next = Instance; 256 while (!IsDevicePathEndType (Next)) { 257 Next = NextDevicePathNode (Next); 258 } 259 260 SetDevicePathEndNode (Next); 261 // 262 // connect short form device path 263 // 264 if ((DevicePathType (Instance) == MESSAGING_DEVICE_PATH) && 265 ((DevicePathSubType (Instance) == MSG_USB_CLASS_DP) 266 || (DevicePathSubType (Instance) == MSG_USB_WWID_DP) 267 )) { 268 269 Status = ShellConnectPciRootBridge (); 270 if (EFI_ERROR(Status)) { 271 FreePool(Instance); 272 FreePool(DevPath); 273 return Status; 274 } 275 276 Status = gBS->LocateHandleBuffer ( 277 ByProtocol, 278 &gEfiPciIoProtocolGuid, 279 NULL, 280 &HandleArrayCount, 281 &HandleArray 282 ); 283 284 if (!EFI_ERROR (Status)) { 285 for (Index = 0; Index < HandleArrayCount; Index++) { 286 Status = gBS->HandleProtocol ( 287 HandleArray[Index], 288 &gEfiPciIoProtocolGuid, 289 (VOID **)&PciIo 290 ); 291 292 if (!EFI_ERROR (Status)) { 293 Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0x09, 3, &Class); 294 if (!EFI_ERROR (Status)) { 295 if ((PCI_CLASS_SERIAL == Class[2]) && 296 (PCI_CLASS_SERIAL_USB == Class[1])) { 297 Status = gBS->ConnectController ( 298 HandleArray[Index], 299 NULL, 300 Instance, 301 FALSE 302 ); 303 if (!EFI_ERROR(Status)) { 304 AtLeastOneConnected = TRUE; 305 } 306 } 307 } 308 } 309 } 310 } 311 312 if (HandleArray != NULL) { 313 FreePool (HandleArray); 314 } 315 } else { 316 // 317 // connect the entire device path 318 // 319 Status = ShellConnectDevicePath (Instance); 320 if (!EFI_ERROR (Status)) { 321 AtLeastOneConnected = TRUE; 322 } 323 } 324 FreePool (Instance); 325 326 } while (CopyOfDevPath != NULL); 327 163 328 if (DevPath != NULL) { 164 329 FreePool(DevPath); 165 330 } 166 return (Status); 331 332 if (AtLeastOneConnected) { 333 return EFI_SUCCESS; 334 } else { 335 return EFI_NOT_FOUND; 336 } 337 167 338 } 168 339 … … 252 423 253 424 ShellStatus = SHELL_SUCCESS; 254 255 425 // 256 426 // initialize the shell lib (we must be in non-auto-init...) … … 300 470 } 301 471 if (EFI_ERROR(Status)) { 302 ConnectFromDevPaths(L" ConErrDev");303 } else { 304 Status = ConnectFromDevPaths(L" ConErrDev");305 } 306 if (EFI_ERROR(Status)) { 307 ConnectFromDevPaths(L" ConErr");308 } else { 309 Status = ConnectFromDevPaths(L" ConErr");472 ConnectFromDevPaths(L"ErrOutDev"); 473 } else { 474 Status = ConnectFromDevPaths(L"ErrOutDev"); 475 } 476 if (EFI_ERROR(Status)) { 477 ConnectFromDevPaths(L"ErrOut"); 478 } else { 479 Status = ConnectFromDevPaths(L"ErrOut"); 310 480 } 311 481 if (EFI_ERROR(Status)) { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/DevTree.c
r48674 r58459 2 2 Main file for DevTree shell Driver1 function. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 58 59 59 60 ASSERT(TheHandle != NULL); 61 62 if (ShellGetExecutionBreakFlag()) { 63 ShellStatus = SHELL_ABORTED; 64 return ShellStatus; 65 } 66 60 67 // 61 68 // We want controller handles. they will not have LoadedImage or DriverBinding (or others...) … … 83 90 if (!EFI_ERROR (Status)) { 84 91 return SHELL_SUCCESS; 85 }86 87 //88 // If we are at the begining then we want root handles they have no parents and do have device path.89 //90 if (IndentCharCount == 0) {91 Status = gBS->OpenProtocol (92 TheHandle,93 &gEfiDevicePathProtocolGuid,94 NULL,95 NULL,96 NULL,97 EFI_OPEN_PROTOCOL_TEST_PROTOCOL98 );99 if (EFI_ERROR (Status)) {100 return SHELL_SUCCESS;101 }102 92 } 103 93 … … 137 127 for (LoopVar = 0 ; LoopVar < ChildCount && ShellStatus == SHELL_SUCCESS; LoopVar++){ 138 128 ShellStatus = DoDevTreeForHandle(ChildHandleBuffer[LoopVar], Lang, UseDevPaths, IndentCharCount+2, HiiString); 129 if (ShellStatus == SHELL_ABORTED) { 130 break; 131 } 139 132 } 140 133 … … 170 163 BOOLEAN FlagD; 171 164 UINT64 Intermediate; 165 UINTN ParentControllerHandleCount; 166 EFI_HANDLE *ParentControllerHandleBuffer; 172 167 173 168 ShellStatus = SHELL_SUCCESS; … … 227 222 break; 228 223 } 224 225 // 226 // Skip handles that do not have device path protocol 227 // 228 Status = gBS->OpenProtocol ( 229 TheHandle, 230 &gEfiDevicePathProtocolGuid, 231 NULL, 232 NULL, 233 NULL, 234 EFI_OPEN_PROTOCOL_TEST_PROTOCOL 235 ); 236 if (EFI_ERROR (Status)) { 237 continue; 238 } 239 240 // 241 // Skip handles that do have parents 242 // 243 ParentControllerHandleBuffer = NULL; 244 Status = PARSE_HANDLE_DATABASE_PARENTS ( 245 TheHandle, 246 &ParentControllerHandleCount, 247 &ParentControllerHandleBuffer 248 ); 249 SHELL_FREE_NON_NULL (ParentControllerHandleBuffer); 250 if (ParentControllerHandleCount > 0) { 251 continue; 252 } 253 254 // 255 // Start a devtree from TheHandle that has a device path and no parents 256 // 229 257 ShellStatus = DoDevTreeForHandle(TheHandle, Language, FlagD, 0, HiiString); 230 258 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Devices.c
r48674 r58459 2 2 Main file for devices shell Driver1 function. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2012-2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 115 116 116 117 STATIC CONST SHELL_PARAM_ITEM ParamList[] = { 118 {L"-sfo", TypeFlag}, 117 119 {L"-l", TypeValue}, 118 120 {NULL, TypeMax} … … 147 149 CHAR16 *Name; 148 150 CONST CHAR16 *Lang; 151 BOOLEAN SfoFlag; 149 152 150 153 ShellStatus = SHELL_SUCCESS; 151 154 Language = NULL; 155 SfoFlag = FALSE; 152 156 153 157 // … … 204 208 // 205 209 // Print Header 206 // 207 ShellPrintHiiEx(-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle); 210 211 // 212 if (ShellCommandLineGetFlag (Package, L"-sfo")) { 213 ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellDriver1HiiHandle, L"devices"); 214 SfoFlag = TRUE; 215 } else { 216 ShellPrintHiiEx (-1, -1, Language, STRING_TOKEN (STR_DEVICES_HEADER_LINES), gShellDriver1HiiHandle); 217 } 208 218 209 219 // … … 223 233 Status = GetDeviceHandleInfo(*HandleListWalker, &Type, &Cfg, &Diag, &Parents, &Devices, &Children, &Name, Language); 224 234 if (Name != NULL && (Parents != 0 || Devices != 0 || Children != 0)) { 225 ShellPrintHiiEx (235 ShellPrintHiiEx ( 226 236 -1, 227 237 -1, 228 238 Language, 229 S TRING_TOKEN (STR_DEVICES_ITEM_LINE),239 SfoFlag?STRING_TOKEN (STR_DEVICES_ITEM_LINE_SFO):STRING_TOKEN (STR_DEVICES_ITEM_LINE), 230 240 gShellDriver1HiiHandle, 231 ConvertHandleToHandleIndex (*HandleListWalker),241 ConvertHandleToHandleIndex (*HandleListWalker), 232 242 Type, 233 Cfg? L'X':L'-',234 Diag? L'X':L'-',243 Cfg?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'), 244 Diag?(SfoFlag?L'Y':L'X'):(SfoFlag?L'N':L'-'), 235 245 Parents, 236 246 Devices, … … 241 251 FreePool(Name); 242 252 } 253 if (ShellGetExecutionBreakFlag ()) { 254 ShellStatus = SHELL_ABORTED; 255 break; 256 } 257 243 258 } 244 259 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Dh.c
r48674 r58459 2 2 Main file for Dh shell Driver1 function. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 61 62 { 62 63 CHAR8 *Lang; 63 CHAR8 *TempChar;64 64 EFI_STATUS Status; 65 65 EFI_COMPONENT_NAME2_PROTOCOL *CompName2; … … 88 88 return (EFI_NOT_FOUND); 89 89 } 90 if (Language == NULL) { 91 Lang = AllocateZeroPool(AsciiStrSize(CompName2->SupportedLanguages)); 92 if (Lang == NULL) { 93 return (EFI_OUT_OF_RESOURCES); 94 } 95 AsciiStrCpy(Lang, CompName2->SupportedLanguages); 96 TempChar = AsciiStrStr(Lang, ";"); 97 if (TempChar != NULL){ 98 *TempChar = CHAR_NULL; 99 } 100 } else { 101 Lang = AllocateZeroPool(AsciiStrSize(Language)); 102 if (Lang == NULL) { 103 return (EFI_OUT_OF_RESOURCES); 104 } 105 AsciiStrCpy(Lang, Language); 106 } 90 Lang = GetBestLanguageForDriver (CompName2->SupportedLanguages, Language, FALSE); 107 91 Status = CompName2->GetDriverName(CompName2, Lang, &NameToReturn); 108 92 FreePool(Lang); … … 203 187 StrnCatGrow(&RetVal, &Size, L"(", 0); 204 188 StrnCatGrow(&RetVal, &Size, Temp, 0); 205 StrnCatGrow(&RetVal, &Size, L") ", 0);189 StrnCatGrow(&RetVal, &Size, L")\r\n", 0); 206 190 } else { 207 191 StrnCatGrow(&RetVal, &Size, Seperator, 0); … … 261 245 } 262 246 DevicePath = LoadedImage->FilePath; 263 *Name = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);247 *Name = ConvertDevicePathToText(DevicePath, TRUE, TRUE); 264 248 return (EFI_SUCCESS); 265 249 } … … 301 285 BOOLEAN Image; 302 286 287 DriverName = NULL; 288 303 289 // 304 290 // See if Handle is a device handle and display its details. … … 355 341 SHELL_FREE_NON_NULL(TempStringPointer); 356 342 357 TempStringPointer = gDevPathToText->ConvertDevicePathToText(DevicePath, TRUE, FALSE);343 TempStringPointer = ConvertDevicePathToText(DevicePath, TRUE, FALSE); 358 344 ShellPrintHiiEx( 359 345 -1, … … 395 381 &DriverName 396 382 ); 397 if ( DriverName == NULL) {383 if (EFI_ERROR (Status)) { 398 384 Status = GetDriverImageName ( 399 385 DriverBindingHandleBuffer[Index], 400 386 &DriverName 401 387 ); 388 if (EFI_ERROR (Status)) { 389 DriverName = NULL; 390 } 402 391 } 403 392 … … 538 527 539 528 Status = GetDriverName (Handle, Language, &DriverName); 529 if (EFI_ERROR (Status)) { 530 DriverName = NULL; 531 } 540 532 541 533 ShellPrintHiiEx( … … 549 541 ); 550 542 SHELL_FREE_NON_NULL(DriverName); 551 DriverName = NULL;552 543 Status = GetDriverImageName ( 553 544 Handle, 554 545 &DriverName 555 546 ); 547 if (EFI_ERROR (Status)) { 548 DriverName = NULL; 549 } 556 550 ShellPrintHiiEx( 557 551 -1, … … 667 661 CHAR16 *ProtocolInfoString; 668 662 SHELL_STATUS ShellStatus; 669 EFI_STATUS Status; 670 671 Status = EFI_SUCCESS; 663 672 664 ShellStatus = SHELL_SUCCESS; 673 665 ProtocolInfoString = NULL; … … 729 721 730 722 @param[in] HandleList The NULL-terminated list of handles. 723 @param[in] Verbose TRUE for extra info, FALSE otherwise. 731 724 @param[in] Sfo TRUE to output in standard format output (spec). 732 725 @param[in] Language Language string per UEFI specification. … … 740 733 DoDhForHandleList( 741 734 IN CONST EFI_HANDLE *HandleList, 735 IN CONST BOOLEAN Verbose, 742 736 IN CONST BOOLEAN Sfo, 743 737 IN CONST CHAR8 *Language, … … 753 747 ShellStatus = DoDhByHandle( 754 748 *HandleWalker, 755 FALSE,749 Verbose, 756 750 Sfo, 757 751 Language, … … 759 753 TRUE 760 754 ); 755 if (ShellGetExecutionBreakFlag ()) { 756 ShellStatus = SHELL_ABORTED; 757 break; 758 } 761 759 } 762 760 return (ShellStatus); … … 767 765 768 766 @param[in] Sfo TRUE to output in standard format output (spec). 767 @param[in] Verbose TRUE for extra info, FALSE otherwise. 769 768 @param[in] Language Language string per UEFI specification. 770 769 @param[in] DriverInfo TRUE to show all info about the handle. … … 777 776 DoDhForAll( 778 777 IN CONST BOOLEAN Sfo, 778 IN CONST BOOLEAN Verbose, 779 779 IN CONST CHAR8 *Language, 780 780 IN CONST BOOLEAN DriverInfo … … 788 788 ShellStatus = DoDhForHandleList( 789 789 HandleList, 790 Verbose, 790 791 Sfo, 791 792 Language, … … 801 802 802 803 @param[in] ProtocolName The pointer to the name of the protocol. 804 @param[in] Verbose TRUE for extra info, FALSE otherwise. 803 805 @param[in] Sfo TRUE to output in standard format output (spec). 804 806 @param[in] Language Language string per UEFI specification. … … 812 814 DoDhByProtocol( 813 815 IN CONST CHAR16 *ProtocolName, 816 IN CONST BOOLEAN Verbose, 814 817 IN CONST BOOLEAN Sfo, 815 818 IN CONST CHAR8 *Language, … … 836 839 ShellStatus = DoDhForHandleList( 837 840 HandleList, 841 Verbose, 838 842 Sfo, 839 843 Language, … … 933 937 ShellStatus = DoDhByProtocol( 934 938 ShellCommandLineGetValue(Package, L"-p"), 939 Verbose, 935 940 SfoMode, 936 941 Lang==NULL?NULL:Language, … … 946 951 ShellStatus = DoDhForAll( 947 952 SfoMode, 953 Verbose, 948 954 Lang==NULL?NULL:Language, 949 955 FlagD -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Disconnect.c
r48674 r58459 2 2 Main file for Disconnect shell Driver1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 164 164 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_INV_HANDLE), gShellDriver1HiiHandle, Param3); 165 165 ShellStatus = SHELL_INVALID_PARAMETER; 166 } else if (EFI_ERROR(gBS->OpenProtocol(Handle1, &gEfiDevicePathProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) {167 ASSERT(Param1 != NULL);168 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_HANDLE_NOT), gShellDriver1HiiHandle, ShellStrToUintn(Param1), L"controller handle");169 ShellStatus = SHELL_INVALID_PARAMETER;170 166 } else if (Handle2 != NULL && EFI_ERROR(gBS->OpenProtocol(Handle2, &gEfiDriverBindingProtocolGuid, NULL, gImageHandle, NULL, EFI_OPEN_PROTOCOL_TEST_PROTOCOL))) { 171 167 ASSERT(Param2 != NULL); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
r48674 r58459 2 2 Main file for Drivers shell Driver1 function. 3 3 4 Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2012-2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 14 15 15 16 #include "UefiShellDriver1CommandsLib.h" 17 18 #define MAX_LEN_DRIVER_NAME 35 16 19 17 20 STATIC CONST SHELL_PARAM_ITEM ParamList[] = { … … 81 84 RetVal = gEfiShellProtocol->GetFilePathFromDevicePath(FinalPath); 82 85 if (RetVal == NULL) { 83 RetVal = gDevPathToText->ConvertDevicePathToText(FinalPath, TRUE, TRUE);86 RetVal = ConvertDevicePathToText(FinalPath, TRUE, TRUE); 84 87 } 85 88 FreePool(FinalPath); … … 186 189 UINTN DeviceCount; 187 190 CHAR16 *Temp2; 191 CONST CHAR16 *FullDriverName; 192 CHAR16 *TruncatedDriverName; 188 193 CHAR16 *FormatString; 189 194 UINT32 DriverVersion; 190 195 BOOLEAN DriverConfig; 191 196 BOOLEAN DriverDiag; 197 BOOLEAN SfoFlag; 192 198 193 199 ShellStatus = SHELL_SUCCESS; … … 195 201 Language = NULL; 196 202 FormatString = NULL; 203 SfoFlag = FALSE; 197 204 198 205 // … … 222 229 ShellStatus = SHELL_INVALID_PARAMETER; 223 230 } else { 224 Lang = ShellCommandLineGetValue(Package, L"-l"); 225 if (Lang != NULL) { 226 Language = AllocateZeroPool(StrSize(Lang)); 227 AsciiSPrint(Language, StrSize(Lang), "%S", Lang); 228 } else if (!ShellCommandLineGetFlag(Package, L"-l")){ 229 ASSERT(Language == NULL); 230 // Language = AllocateZeroPool(10); 231 // AsciiSPrint(Language, 10, "en-us"); 231 if (ShellCommandLineGetFlag(Package, L"-l")){ 232 Lang = ShellCommandLineGetValue(Package, L"-l"); 233 if (Lang != NULL) { 234 Language = AllocateZeroPool(StrSize(Lang)); 235 AsciiSPrint(Language, StrSize(Lang), "%S", Lang); 236 } else { 237 ASSERT(Language == NULL); 238 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"-l"); 239 ShellCommandLineFreeVarList (Package); 240 return (SHELL_INVALID_PARAMETER); 241 } 242 } 243 244 if (ShellCommandLineGetFlag (Package, L"-sfo")) { 245 SfoFlag = TRUE; 246 FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE_SFO), Language); 247 // 248 // print the SFO header 249 // 250 ShellPrintHiiEx ( 251 -1, 252 -1, 253 Language, 254 STRING_TOKEN (STR_GEN_SFO_HEADER), 255 gShellDriver1HiiHandle, 256 L"drivers"); 232 257 } else { 233 ASSERT(Language == NULL); 234 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_VALUE), gShellDriver1HiiHandle, L"-l"); 235 ShellCommandLineFreeVarList (Package); 236 return (SHELL_INVALID_PARAMETER); 237 } 238 239 if (ShellCommandLineGetFlag(Package, L"-sfo")) { 240 FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE_SFO), Language); 241 } else { 242 FormatString = HiiGetString(gShellDriver1HiiHandle, STRING_TOKEN(STR_DRIVERS_ITEM_LINE), Language); 258 FormatString = HiiGetString (gShellDriver1HiiHandle, STRING_TOKEN (STR_DRIVERS_ITEM_LINE), Language); 243 259 // 244 260 // print the header row … … 248 264 -1, 249 265 Language, 250 STRING_TOKEN (STR_DRIVERS_HEADER_LINES),266 STRING_TOKEN (STR_DRIVERS_HEADER_LINES), 251 267 gShellDriver1HiiHandle); 252 268 } … … 254 270 HandleList = GetHandleListByProtocol(&gEfiDriverBindingProtocolGuid); 255 271 for (HandleWalker = HandleList ; HandleWalker != NULL && *HandleWalker != NULL ; HandleWalker++){ 256 ChildCount = 0; 257 DeviceCount = 0; 258 Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL); 259 Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL); 260 Temp2 = GetDevicePathTextForHandle(*HandleWalker); 261 DriverVersion = ReturnDriverVersion(*HandleWalker); 262 DriverConfig = ReturnDriverConfig(*HandleWalker); 263 DriverDiag = ReturnDriverDiag (*HandleWalker); 264 Lang = GetStringNameFromHandle(*HandleWalker, Language==NULL?"en":Language); 272 ChildCount = 0; 273 DeviceCount = 0; 274 Status = ParseHandleDatabaseForChildDevices (*HandleWalker, &ChildCount , NULL); 275 Status = PARSE_HANDLE_DATABASE_DEVICES (*HandleWalker, &DeviceCount, NULL); 276 Temp2 = GetDevicePathTextForHandle(*HandleWalker); 277 DriverVersion = ReturnDriverVersion(*HandleWalker); 278 DriverConfig = ReturnDriverConfig(*HandleWalker); 279 DriverDiag = ReturnDriverDiag (*HandleWalker); 280 FullDriverName = GetStringNameFromHandle(*HandleWalker, Language); 281 282 TruncatedDriverName = NULL; 283 if (!SfoFlag && (FullDriverName != NULL)) { 284 TruncatedDriverName = AllocateZeroPool ((MAX_LEN_DRIVER_NAME + 1) * sizeof (CHAR16)); 285 StrnCpy (TruncatedDriverName, FullDriverName, MAX_LEN_DRIVER_NAME); 286 } 265 287 266 288 ShellPrintEx( … … 275 297 DeviceCount, 276 298 ChildCount, 277 Lang,299 SfoFlag?FullDriverName:TruncatedDriverName, 278 300 Temp2==NULL?L"":Temp2 279 301 ); 302 if (TruncatedDriverName != NULL) { 303 FreePool (TruncatedDriverName); 304 } 280 305 if (Temp2 != NULL) { 281 306 FreePool(Temp2); 307 } 308 309 if (ShellGetExecutionBreakFlag ()) { 310 ShellStatus = SHELL_ABORTED; 311 break; 282 312 } 283 313 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvCfg.c
r48674 r58459 2 2 Main file for DrvCfg shell Driver1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 407 407 // print out an error. 408 408 // 409 TempDevPathString = gDevPathToText->ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE);409 TempDevPathString = ConvertDevicePathToText((EFI_DEVICE_PATH_PROTOCOL*)(((CHAR8*)PackageHeader) + sizeof(EFI_HII_PACKAGE_HEADER)), TRUE, TRUE); 410 410 ShellPrintHiiEx( 411 411 -1, … … 515 515 default: 516 516 return (EFI_INVALID_PARAMETER); 517 break;518 517 } 519 518 … … 1096 1095 1097 1096 if (!Found) { 1098 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE ), gShellDriver1HiiHandle);1097 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DRVCFG_NONE_FOUND), gShellDriver1HiiHandle); 1099 1098 return (SHELL_SUCCESS); 1100 1099 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/DrvDiag.c
r48674 r58459 2 2 Main file for DrvDiag shell Driver1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 72 72 UINTN HandleIndex2; 73 73 CHAR8 *Language; 74 CHAR8 *TempChar;75 74 BOOLEAN Found; 76 75 … … 181 180 NULL, 182 181 EFI_OPEN_PROTOCOL_GET_PROTOCOL); 183 if (!EFI_ERROR(Status)) { 184 if (Lang == NULL) { 185 Language = AllocateZeroPool(AsciiStrSize(DriverDiagnostics2->SupportedLanguages)); 186 if (Language == NULL) { 187 return (EFI_OUT_OF_RESOURCES); 188 } 189 AsciiStrCpy(Language, DriverDiagnostics2->SupportedLanguages); 190 TempChar = AsciiStrStr(Language, ";"); 191 if (TempChar != NULL){ 192 *TempChar = CHAR_NULL; 193 } 194 } else { 195 Language = AllocateZeroPool(AsciiStrSize(Lang)); 196 if (Language == NULL) { 197 return (EFI_OUT_OF_RESOURCES); 198 } 199 AsciiStrCpy(Language, Lang); 200 } 182 if (!EFI_ERROR(Status) && (DriverDiagnostics2 != NULL)) { 183 Language = GetBestLanguageForDriver(DriverDiagnostics2->SupportedLanguages, Lang, FALSE); 201 184 Found = TRUE; 202 185 Status = DriverDiagnostics2->RunDiagnostics( … … 221 204 EFI_OPEN_PROTOCOL_GET_PROTOCOL); 222 205 if (!EFI_ERROR(Status)) { 223 if (Lang == NULL) { 224 Language = AllocateZeroPool(AsciiStrSize(DriverDiagnostics2->SupportedLanguages)); 225 if (Language == NULL) { 226 return (EFI_OUT_OF_RESOURCES); 227 } 228 AsciiStrCpy(Language, DriverDiagnostics2->SupportedLanguages); 229 TempChar = AsciiStrStr(Language, ";"); 230 if (TempChar != NULL){ 231 *TempChar = CHAR_NULL; 232 } 233 } else { 234 Language = AllocateZeroPool(AsciiStrSize(Lang)); 235 if (Language == NULL) { 236 return (EFI_OUT_OF_RESOURCES); 237 } 238 AsciiStrCpy(Language, Lang); 239 } 206 Language = GetBestLanguageForDriver(DriverDiagnostics->SupportedLanguages, Lang, FALSE); 240 207 Status = DriverDiagnostics->RunDiagnostics( 241 208 DriverDiagnostics, -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/OpenInfo.c
r48674 r58459 49 49 UINTN HandleIndex; 50 50 CONST CHAR16 *Name; 51 UINTN ControllerIndex; 51 52 52 53 if (TheHandle == NULL) { … … 99 100 default: OpenTypeString = StringUnknown; break; 100 101 } 101 HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle); 102 Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, "en"); 103 if (OpenInfo[OpenInfoIndex].ControllerHandle!=NULL) { 102 HandleIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].AgentHandle); 103 Name = GetStringNameFromHandle(OpenInfo[OpenInfoIndex].AgentHandle, NULL); 104 ControllerIndex = ConvertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle); 105 if (ControllerIndex != 0) { 104 106 ShellPrintHiiEx( 105 107 -1, … … 109 111 gShellDriver1HiiHandle, 110 112 HandleIndex, 111 Con vertHandleToHandleIndex(OpenInfo[OpenInfoIndex].ControllerHandle),113 ControllerIndex, 112 114 OpenInfo[OpenInfoIndex].OpenCount, 113 115 OpenTypeString, -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.c
r48674 r58459 2 2 Main file for NULL named library for level 1 shell command functions. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.h
r48674 r58459 2 2 Main file for NULL named library for Profile1 shell command functions. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 23 23 #include <Guid/ConsoleOutDevice.h> 24 24 #include <Guid/ShellLibHiiGuid.h> 25 26 #include <IndustryStandard/Pci.h> 25 27 26 28 #include <Protocol/EfiShell.h> … … 29 31 #include <Protocol/LoadedImage.h> 30 32 #include <Protocol/UnicodeCollation.h> 31 #include <Protocol/DevicePathToText.h>32 33 #include <Protocol/DriverDiagnostics2.h> 33 34 #include <Protocol/DriverDiagnostics.h> … … 38 39 #include <Protocol/DriverFamilyOverride.h> 39 40 #include <Protocol/DriverHealth.h> 41 #include <Protocol/PciIo.h> 42 #include <Protocol/PciRootBridgeIo.h> 40 43 41 44 #include <Library/BaseLib.h> … … 56 59 #include <Library/HandleParsingLib.h> 57 60 #include <Library/PeCoffGetEntryPointLib.h> 61 #include <Library/HandleParsingLib.h> 58 62 59 63 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
r48674 r58459 2 2 # Provides shell driver1 profile functions 3 3 # 4 # Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR> 5 5 # 6 6 # This program and the accompanying materials … … 59 59 60 60 [Pcd] 61 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED61 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES 62 62 63 63 [Protocols] 64 gEfiDriverHealthProtocolGuid # ALWAYS_CONSUMED65 gEfiDriverFamilyOverrideProtocolGuid # ALWAYS_CONSUMED66 gEfiHiiConfigAccessProtocolGuid # ALWAYS_CONSUMED67 gEfiHiiDatabaseProtocolGuid # ALWAYS_CONSUMED64 gEfiDriverHealthProtocolGuid ## CONSUMES 65 gEfiDriverFamilyOverrideProtocolGuid ## CONSUMES 66 gEfiHiiConfigAccessProtocolGuid ## CONSUMES 67 gEfiHiiDatabaseProtocolGuid ## CONSUMES 68 68 69 69 [Guids] 70 gEfiGlobalVariableGuid # ALWAYS_CONSUMED71 gEfiConsoleInDeviceGuid # ALWAYS_CONSUMED72 gEfiConsoleOutDeviceGuid # ALWAYS_CONSUMED73 gShellDriver1HiiGuid ## PRODUCES 70 gEfiGlobalVariableGuid ## CONSUMES ## GUID 71 gEfiConsoleInDeviceGuid ## CONSUMES ## GUID 72 gEfiConsoleOutDeviceGuid ## CONSUMES ## GUID 73 gShellDriver1HiiGuid ## PRODUCES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellDriver1CommandsLib/Unload.c
r48674 r58459 2 2 Main file for Unload shell Driver1 function. 3 3 4 Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 14 14 15 15 #include "UefiShellDriver1CommandsLib.h" 16 17 /**18 Function to translate the EFI_MEMORY_TYPE into a string.19 20 @param[in] Memory The memory type.21 22 @retval A string representation of the type allocated from BS Pool.23 **/24 CHAR16*25 EFIAPI26 ConvertMemoryType (27 IN CONST EFI_MEMORY_TYPE Memory28 )29 {30 CHAR16 *RetVal;31 RetVal = NULL;32 33 switch (Memory) {34 case EfiReservedMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiReservedMemoryType", 0); break;35 case EfiLoaderCode: StrnCatGrow(&RetVal, NULL, L"EfiLoaderCode", 0); break;36 case EfiLoaderData: StrnCatGrow(&RetVal, NULL, L"EfiLoaderData", 0); break;37 case EfiBootServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesCode", 0); break;38 case EfiBootServicesData: StrnCatGrow(&RetVal, NULL, L"EfiBootServicesData", 0); break;39 case EfiRuntimeServicesCode: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesCode", 0); break;40 case EfiRuntimeServicesData: StrnCatGrow(&RetVal, NULL, L"EfiRuntimeServicesData", 0); break;41 case EfiConventionalMemory: StrnCatGrow(&RetVal, NULL, L"EfiConventionalMemory", 0); break;42 case EfiUnusableMemory: StrnCatGrow(&RetVal, NULL, L"EfiUnusableMemory", 0); break;43 case EfiACPIReclaimMemory: StrnCatGrow(&RetVal, NULL, L"EfiACPIReclaimMemory", 0); break;44 case EfiACPIMemoryNVS: StrnCatGrow(&RetVal, NULL, L"EfiACPIMemoryNVS", 0); break;45 case EfiMemoryMappedIO: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIO", 0); break;46 case EfiMemoryMappedIOPortSpace: StrnCatGrow(&RetVal, NULL, L"EfiMemoryMappedIOPortSpace", 0); break;47 case EfiPalCode: StrnCatGrow(&RetVal, NULL, L"EfiPalCode", 0); break;48 case EfiMaxMemoryType: StrnCatGrow(&RetVal, NULL, L"EfiMaxMemoryType", 0); break;49 default: ASSERT(FALSE);50 }51 return (RetVal);52 }53 16 54 17 /** … … 66 29 ) 67 30 { 68 EFI_LOADED_IMAGE_PROTOCOL *Image; 69 EFI_STATUS Status; 70 EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText; 71 CHAR16 *DevicePathText; 72 CHAR16 *CodeTypeText; 73 CHAR16 *DataTypeText; 74 CHAR8 *PdbPointer; 31 CHAR16 *TheString; 75 32 76 Image = NULL; 33 TheString = GetProtocolInformationDump(TheHandle, &gEfiLoadedImageProtocolGuid, TRUE); 34 35 ShellPrintEx(-1, -1, L"%s", TheString); 77 36 78 Status = gBS->OpenProtocol(TheHandle, &gEfiLoadedImageProtocolGuid, (VOID**)&Image, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); 79 if (EFI_ERROR(Status)) { 80 return (EFI_INVALID_PARAMETER); 81 } 82 83 Status = gBS->LocateProtocol( 84 &gEfiDevicePathToTextProtocolGuid, 85 NULL, 86 (VOID**)&DevicePathToText); 87 // 88 // we now have the device path to text protocol 89 // 90 if (!EFI_ERROR(Status)) { 91 DevicePathText = DevicePathToText->ConvertDevicePathToText(Image->FilePath, TRUE, TRUE); 92 } else { 93 DevicePathText = NULL; 94 } 95 96 CodeTypeText = ConvertMemoryType(Image->ImageCodeType); 97 DataTypeText = ConvertMemoryType(Image->ImageDataType); 98 PdbPointer = (CHAR8*)PeCoffLoaderGetPdbPointer(Image->ImageBase); 99 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_UNLOAD_VERBOSE), gShellDriver1HiiHandle, 100 ConvertHandleToHandleIndex(TheHandle), 101 TheHandle, 102 Image, 103 Image->ParentHandle, 104 Image->SystemTable, 105 Image->DeviceHandle, 106 DevicePathText, 107 PdbPointer, 108 Image->ImageBase, 109 Image->ImageSize, 110 CodeTypeText, 111 DataTypeText 112 ); 113 114 SHELL_FREE_NON_NULL(DevicePathText); 115 SHELL_FREE_NON_NULL(CodeTypeText); 116 SHELL_FREE_NON_NULL(DataTypeText); 117 37 SHELL_FREE_NON_NULL(TheString); 38 118 39 return (EFI_SUCCESS); 119 40 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.c
r48674 r58459 13 13 **/ 14 14 15 #include "UefiShellInstall1CommandsLib.h" 16 17 STATIC CONST CHAR16 mFileName[] = L"ShellCommands"; 18 EFI_HANDLE gShellInstall1HiiHandle = NULL; 19 20 /** 21 Function to get the filename with help context if HII will not be used. 22 23 @return The filename with help text in it. 24 **/ 25 CONST CHAR16* 26 EFIAPI 27 ShellCommandGetManFileNameInstall1 ( 28 VOID 29 ) 30 { 31 return (mFileName); 32 } 15 #include <Library/BcfgCommandLib.h> 33 16 34 17 /** … … 57 40 } 58 41 59 gShellInstall1HiiHandle = HiiAddPackages (&gShellInstall1HiiGuid, gImageHandle, UefiShellInstall1CommandsLibStrings, NULL); 60 if (gShellInstall1HiiHandle == NULL) { 61 return (EFI_DEVICE_ERROR); 62 } 63 64 // 65 // install our shell command handlers that are always installed 66 // 67 ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfgInstall , ShellCommandGetManFileNameInstall1, 0, L"Install", FALSE, gShellInstall1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG)); 68 69 return (EFI_SUCCESS); 42 return (BcfgLibraryRegisterBcfgCommand(ImageHandle, SystemTable, L"Install1")); 70 43 } 71 44 … … 83 56 ) 84 57 { 85 if (gShellInstall1HiiHandle != NULL) { 86 HiiRemovePackages(gShellInstall1HiiHandle); 87 } 88 return (EFI_SUCCESS); 58 return (BcfgLibraryUnregisterBcfgCommand(ImageHandle, SystemTable)); 89 59 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
r48674 r58459 2 2 # Provides shell install1 functions 3 3 # 4 # Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 25 25 [Sources.common] 26 26 UefiShellInstall1CommandsLib.c 27 UefiShellInstall1CommandsLib.h28 UefiShellInstall1CommandsLib.uni29 Bcfg.c30 27 31 28 [Packages] … … 46 43 SortLib 47 44 PrintLib 45 BcfgCommandLib 48 46 49 47 [Pcd] 50 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED48 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES 51 49 52 50 [Guids] 53 gShellInstall1HiiGuid 51 gShellInstall1HiiGuid ## UNDEFINED -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/For.c
r48674 r58459 2 2 Main file for endfor and for shell level 1 functions. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 252 252 } 253 253 return (FALSE); 254 } 255 256 /** 257 Function to determine whether a string is decimal or hex representation of a number 258 and return the number converted from the string. 259 260 @param[in] String String representation of a number 261 262 @return the number 263 @retval (UINTN)(-1) An error ocurred. 264 **/ 265 UINTN 266 EFIAPI 267 ReturnUintn( 268 IN CONST CHAR16 *String 269 ) 270 { 271 UINT64 RetVal; 272 273 if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, FALSE, TRUE))) { 274 return ((UINTN)RetVal); 275 } 276 return ((UINTN)(-1)); 254 277 } 255 278 … … 272 295 CHAR16 *ArgSet; 273 296 CHAR16 *ArgSetWalker; 297 CHAR16 *Parameter; 274 298 UINTN ArgSize; 275 299 UINTN LoopVar; … … 287 311 ArgSetWalker = NULL; 288 312 TempString = NULL; 313 Parameter = NULL; 289 314 FirstPass = FALSE; 290 315 … … 311 336 ASSERT(CurrentScriptFile != NULL); 312 337 313 if ( CurrentScriptFile->CurrentCommand->Data == NULL) {338 if ((CurrentScriptFile->CurrentCommand != NULL) && (CurrentScriptFile->CurrentCommand->Data == NULL)) { 314 339 FirstPass = TRUE; 315 340 … … 326 351 L"EndFor", 327 352 L"For", 328 CurrentScriptFile->CurrentCommand!=NULL 329 ?CurrentScriptFile->CurrentCommand->Line:0); 353 CurrentScriptFile->CurrentCommand->Line); 330 354 return (SHELL_DEVICE_ERROR); 331 355 } … … 348 372 for (LoopVar = 0x3 ; LoopVar < gEfiShellParametersProtocol->Argc ; LoopVar++) { 349 373 ASSERT((ArgSet == NULL && ArgSize == 0) || (ArgSet != NULL)); 350 if (ArgSet == NULL) {351 // ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0);352 } else {353 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0);354 }355 374 if (StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"*") != NULL 356 375 ||StrStr(gEfiShellParametersProtocol->Argv[LoopVar], L"?") != NULL … … 360 379 Status = ShellOpenFileMetaArg ((CHAR16*)gEfiShellParametersProtocol->Argv[LoopVar], EFI_FILE_MODE_READ, &FileList); 361 380 if (EFI_ERROR(Status) || FileList == NULL || IsListEmpty(&FileList->Link)) { 381 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); 362 382 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0); 383 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); 363 384 } else { 364 385 for (Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&FileList->Link) … … 373 394 } 374 395 } else { 375 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, gEfiShellParametersProtocol->Argv[LoopVar], 0); 376 } 377 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); 396 Parameter = gEfiShellParametersProtocol->Argv[LoopVar]; 397 if (Parameter[0] == L'\"' && Parameter[StrLen(Parameter)-1] == L'\"') { 398 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" ", 0); 399 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0); 400 } else { 401 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L" \"", 0); 402 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, Parameter, 0); 403 ArgSet = StrnCatGrow(&ArgSet, &ArgSize, L"\"", 0); 404 } 405 } 378 406 } 379 407 if (ArgSet == NULL) { … … 426 454 Info = AllocateZeroPool(sizeof(SHELL_FOR_INFO)+StrSize(gEfiShellParametersProtocol->Argv[1])); 427 455 ASSERT(Info != NULL); 456 Info->Signature = SHELL_FOR_INFO_SIGNATURE; 428 457 CopyMem(Info->Set, gEfiShellParametersProtocol->Argv[1], StrSize(gEfiShellParametersProtocol->Argv[1])); 429 458 Info->ReplacementName = Info->Set; … … 438 467 gShellLevel1HiiHandle, 439 468 ArgSet, 440 CurrentScriptFile!=NULL 441 && CurrentScriptFile->CurrentCommand!=NULL 442 ? CurrentScriptFile->CurrentCommand->Line:0); 469 CurrentScriptFile->CurrentCommand->Line); 443 470 ShellStatus = SHELL_INVALID_PARAMETER; 444 471 } else { … … 462 489 STRING_TOKEN (STR_GEN_PROBLEM_SCRIPT), 463 490 gShellLevel1HiiHandle, 464 CurrentScriptFile!=NULL 465 && CurrentScriptFile->CurrentCommand!=NULL 466 ? CurrentScriptFile->CurrentCommand->Line:0); 491 CurrentScriptFile->CurrentCommand->Line); 467 492 ShellStatus = SHELL_INVALID_PARAMETER; 468 493 } else { … … 480 505 gShellLevel1HiiHandle, 481 506 ArgSet, 482 CurrentScriptFile!=NULL 483 && CurrentScriptFile->CurrentCommand!=NULL 484 ? CurrentScriptFile->CurrentCommand->Line:0); 507 CurrentScriptFile->CurrentCommand->Line); 485 508 ShellStatus = SHELL_INVALID_PARAMETER; 486 509 } else { 487 510 if (ArgSetWalker[0] == L'-') { 488 Info->Current = 0 - (INTN) ShellStrToUintn(ArgSetWalker+1);511 Info->Current = 0 - (INTN)ReturnUintn(ArgSetWalker+1); 489 512 } else { 490 Info->Current = (INTN) ShellStrToUintn(ArgSetWalker);513 Info->Current = (INTN)ReturnUintn(ArgSetWalker); 491 514 } 492 515 ArgSetWalker = StrStr(ArgSetWalker, L" "); … … 502 525 gShellLevel1HiiHandle, 503 526 ArgSet, 504 CurrentScriptFile!=NULL 505 && CurrentScriptFile->CurrentCommand!=NULL 506 ? CurrentScriptFile->CurrentCommand->Line:0); 527 CurrentScriptFile->CurrentCommand->Line); 507 528 ShellStatus = SHELL_INVALID_PARAMETER; 508 529 } else { 509 530 if (ArgSetWalker[0] == L'-') { 510 Info->End = 0 - (INTN) ShellStrToUintn(ArgSetWalker+1);531 Info->End = 0 - (INTN)ReturnUintn(ArgSetWalker+1); 511 532 } else { 512 Info->End = (INTN) ShellStrToUintn(ArgSetWalker);533 Info->End = (INTN)ReturnUintn(ArgSetWalker); 513 534 } 514 535 if (Info->Current < Info->End) { … … 531 552 gShellLevel1HiiHandle, 532 553 ArgSet, 533 CurrentScriptFile!=NULL 534 && CurrentScriptFile->CurrentCommand!=NULL 535 ? CurrentScriptFile->CurrentCommand->Line:0); 554 CurrentScriptFile->CurrentCommand->Line); 536 555 ShellStatus = SHELL_INVALID_PARAMETER; 537 556 } else { … … 540 559 } else { 541 560 if (ArgSetWalker[0] == L'-') { 542 Info->Step = 0 - (INTN) ShellStrToUintn(ArgSetWalker+1);561 Info->Step = 0 - (INTN)ReturnUintn(ArgSetWalker+1); 543 562 } else { 544 Info->Step = (INTN) ShellStrToUintn(ArgSetWalker);563 Info->Step = (INTN)ReturnUintn(ArgSetWalker); 545 564 } 546 565 … … 553 572 gShellLevel1HiiHandle, 554 573 ArgSet, 555 CurrentScriptFile!=NULL 556 && CurrentScriptFile->CurrentCommand!=NULL 557 ? CurrentScriptFile->CurrentCommand->Line:0); 574 CurrentScriptFile->CurrentCommand->Line); 558 575 ShellStatus = SHELL_INVALID_PARAMETER; 559 576 } … … 660 677 ASSERT(Info->Set != NULL); 661 678 if (Info->CurrentValue != NULL && *Info->CurrentValue != CHAR_NULL) { 662 if (Info->CurrentValue[0] == L' \"') {679 if (Info->CurrentValue[0] == L' ') { 663 680 Info->CurrentValue++; 664 681 } 665 // while (Info->CurrentValue[0] == L' ') {666 // Info->CurrentValue++;667 // }668 682 if (Info->CurrentValue[0] == L'\"') { 669 683 Info->CurrentValue++; … … 690 704 Info->CurrentValue++; 691 705 } 692 while (Info->CurrentValue[0] == L' ') {693 Info->CurrentValue++;694 }695 if (Info->CurrentValue[0] == L'\"') {696 Info->CurrentValue++;697 }698 706 FreePool(TempString); 699 707 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/If.c
r48674 r58459 2 2 Main file for If and else shell level 1 function. 3 3 4 Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 167 168 } 168 169 return (FALSE); 169 break;170 170 case OperatorUnsignedLessThan: 171 171 case OperatorLessThan: … … 203 203 } 204 204 return (FALSE); 205 break;206 205 case OperatorEqual: 207 206 if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { … … 231 230 } 232 231 return (FALSE); 233 break;234 232 case OperatorNotEqual: 235 233 if (ForceStringCompare || !ShellIsHexOrDecimalNumber(Compare1, FALSE, FALSE) || !ShellIsHexOrDecimalNumber(Compare2, FALSE, FALSE)) { … … 259 257 } 260 258 return (FALSE); 261 break;262 259 case OperatorUnsignedGreaterOrEqual: 263 260 case OperatorGreatorOrEqual: … … 294 291 } 295 292 return (FALSE); 296 break;297 293 case OperatorLessOrEqual: 298 294 case OperatorUnsignedLessOrEqual: … … 329 325 } 330 326 return (FALSE); 331 break;332 327 default: 333 328 ASSERT(FALSE); … … 663 658 ) 664 659 { 665 CHAR16 *Buffer;666 UINTN BufferSize;667 668 660 *EndTag = EndTagMax; 669 661 670 for( Buffer = NULL, BufferSize = 0662 for( 671 663 ; ParameterNumber < gEfiShellParametersProtocol->Argc 672 664 ; ParameterNumber++ … … 744 736 } 745 737 CommandWalker = CommandName; 746 while (CommandWalker[0] == L' ') { 738 739 // 740 // Skip leading spaces and tabs. 741 // 742 while ((CommandWalker[0] == L' ') || (CommandWalker[0] == L'\t')) { 747 743 CommandWalker++; 748 744 } … … 857 853 STRING_TOKEN (STR_SYNTAX_NO_MATCHING), 858 854 gShellLevel1HiiHandle, 859 L"En fIf",855 L"EndIf", 860 856 L"If", 861 857 CurrentScriptFile!=NULL -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.c
r48674 r58459 2 2 Main file for NULL named library for level 1 shell command functions. 3 3 4 Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 151 152 152 153 CommandNameWalker = CommandName; 153 while(CommandNameWalker[0] == L' ') { 154 155 // 156 // Skip leading spaces and tabs. 157 // 158 while ((CommandNameWalker[0] == L' ') || (CommandNameWalker[0] == L'\t')) { 154 159 CommandNameWalker++; 155 160 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.h
r48674 r58459 2 2 Main file for NULL named library for level 1 shell command functions. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 26 26 #include <Protocol/LoadedImage.h> 27 27 #include <Protocol/UnicodeCollation.h> 28 #include <Protocol/DevicePathToText.h>29 28 30 29 #include <Library/BaseLib.h> -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
r48674 r58459 2 2 # Provides shell level 1 functions 3 3 # 4 # Copyright (c) 2009-201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2009-2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 54 54 55 55 [Pcd.common] 56 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel # ALWAYS_CONSUMED56 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES 57 57 58 58 [Guids] 59 gShellLevel1HiiGuid 59 gShellLevel1HiiGuid ## SOMETIMES_CONSUMES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Attrib.c
r48674 r58459 2 2 Main file for attrib shell level 2 function. 3 3 4 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> 4 5 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 153 154 FileNode->FileName 154 155 ); 156 157 if (ShellGetExecutionBreakFlag()) { 158 ShellStatus = SHELL_ABORTED; 159 break; 160 } 155 161 } 156 162 Status = ShellCloseFileMetaArg(&ListOfFiles); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Cd.c
r48674 r58459 2 2 Main file for attrib shell level 2 function. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 39 39 CONST CHAR16 *Param1; 40 40 CHAR16 *Param1Copy; 41 CHAR16* Walker; 41 42 42 43 ProblemParam = NULL; … … 97 98 } else { 98 99 Param1Copy = CatSPrint(NULL, L"%s", Param1, NULL); 100 for (Walker = Param1Copy; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { 101 if (*Walker == L'\"') { 102 CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); 103 } 104 } 105 99 106 if (Param1Copy != NULL) { 100 107 Param1Copy = PathCleanUpDirectories(Param1Copy); … … 150 157 } 151 158 } else if (StrStr(Param1Copy, L":") == NULL) { 159 // 160 // change directory without a drive identifier 161 // 152 162 if (ShellGetCurrentDir(NULL) == NULL) { 153 163 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle); … … 190 200 } else { 191 201 // 192 // change directory on otherdrive letter193 // 194 Drive = Allocate ZeroPool(StrSize(Param1Copy));202 // change directory with a drive letter 203 // 204 Drive = AllocateCopyPool(StrSize(Param1Copy), Param1Copy); 195 205 if (Drive == NULL) { 196 206 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle); 197 207 ShellStatus = SHELL_OUT_OF_RESOURCES; 198 208 } else { 199 Drive = StrCpy(Drive, Param1Copy);200 209 Path = StrStr(Drive, L":"); 201 210 ASSERT(Path != NULL); 202 if (*(Path+1) == CHAR_NULL) { 211 if (EFI_ERROR(ShellIsDirectory(Param1Copy))) { 212 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, Param1Copy); 213 ShellStatus = SHELL_NOT_FOUND; 214 } else if (*(Path+1) == CHAR_NULL) { 203 215 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle); 204 216 ShellStatus = SHELL_NOT_FOUND; -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
r48674 r58459 2 2 Main file for cp shell level 2 function. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 14 14 15 15 #include "UefiShellLevel2CommandsLib.h" 16 #include <Guid/FileSystemInfo.h> 17 #include <Guid/FileSystemVolumeLabelInfo.h> 16 18 17 19 /** … … 63 65 ) 64 66 { 65 VOID *Response; 66 UINTN ReadSize; 67 SHELL_FILE_HANDLE SourceHandle; 68 SHELL_FILE_HANDLE DestHandle; 69 EFI_STATUS Status; 70 VOID *Buffer; 71 CHAR16 *TempName; 72 UINTN Size; 73 EFI_SHELL_FILE_INFO *List; 74 SHELL_STATUS ShellStatus; 75 67 VOID *Response; 68 UINTN ReadSize; 69 SHELL_FILE_HANDLE SourceHandle; 70 SHELL_FILE_HANDLE DestHandle; 71 EFI_STATUS Status; 72 VOID *Buffer; 73 CHAR16 *TempName; 74 UINTN Size; 75 EFI_SHELL_FILE_INFO *List; 76 SHELL_STATUS ShellStatus; 77 UINT64 SourceFileSize; 78 UINT64 DestFileSize; 79 EFI_FILE_PROTOCOL *DestVolumeFP; 80 EFI_FILE_SYSTEM_INFO *DestVolumeInfo; 81 UINTN DestVolumeInfoSize; 76 82 77 83 ASSERT(Resp != NULL); 78 84 79 SourceHandle = NULL; 80 DestHandle = NULL; 81 Response = *Resp; 82 List = NULL; 83 84 ReadSize = PcdGet16(PcdShellFileOperationSize); 85 SourceHandle = NULL; 86 DestHandle = NULL; 87 Response = *Resp; 88 List = NULL; 89 DestVolumeInfo = NULL; 90 ShellStatus = SHELL_SUCCESS; 91 92 ReadSize = PcdGet32(PcdShellFileOperationSize); 85 93 // Why bother copying a file to itself 86 94 if (StrCmp(Source, Dest) == 0) { … … 89 97 90 98 // 91 // Open destination file without create92 //93 Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE, 0);94 95 //96 // close file97 //98 if (DestHandle != NULL) {99 ShellCloseFile(&DestHandle);100 DestHandle = NULL;101 }102 103 //104 99 // if the destination file existed check response and possibly prompt user 105 100 // 106 if ( !EFI_ERROR(Status)) {101 if (ShellFileExists(Dest) == EFI_SUCCESS) { 107 102 if (Response == NULL && !SilentMode) { 108 103 Status = ShellPromptForResponseHii(ShellPromptResponseTypeYesNoAllCancel, STRING_TOKEN (STR_GEN_DEST_EXIST_OVR), gShellLevel2HiiHandle, &Response); … … 137 132 Status = ShellCreateDirectory(Dest, &DestHandle); 138 133 if (EFI_ERROR(Status)) { 134 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_DIR_FAIL), gShellLevel2HiiHandle, Dest); 139 135 return (SHELL_ACCESS_DENIED); 140 136 } … … 144 140 // 145 141 TempName = NULL; 146 Size 142 Size = 0; 147 143 StrnCatGrow(&TempName, &Size, Source, 0); 148 144 StrnCatGrow(&TempName, &Size, L"\\*", 0); 149 ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List); 150 TempName = NULL; 151 StrnCatGrow(&TempName, &Size, Dest, 0); 152 StrnCatGrow(&TempName, &Size, L"\\", 0); 153 ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp); 154 ShellCloseFileMetaArg(&List); 155 FreePool(TempName); 156 Size = 0; 145 if (TempName != NULL) { 146 ShellOpenFileMetaArg((CHAR16*)TempName, EFI_FILE_MODE_READ, &List); 147 *TempName = CHAR_NULL; 148 StrnCatGrow(&TempName, &Size, Dest, 0); 149 StrnCatGrow(&TempName, &Size, L"\\", 0); 150 ShellStatus = ValidateAndCopyFiles(List, TempName, SilentMode, TRUE, Resp); 151 ShellCloseFileMetaArg(&List); 152 SHELL_FREE_NON_NULL(TempName); 153 Size = 0; 154 } 157 155 } else { 156 Status = ShellDeleteFileByName(Dest); 157 158 158 // 159 159 // open file with create enabled … … 161 161 Status = ShellOpenFileByName(Dest, &DestHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0); 162 162 if (EFI_ERROR(Status)) { 163 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_OPEN_FAIL), gShellLevel2HiiHandle, Dest); 163 164 return (SHELL_ACCESS_DENIED); 164 165 } … … 171 172 172 173 // 173 // copy data between files 174 // 175 Buffer = AllocateZeroPool(ReadSize); 176 ASSERT(Buffer != NULL); 177 while (ReadSize == PcdGet16(PcdShellFileOperationSize) && !EFI_ERROR(Status)) { 178 Status = ShellReadFile(SourceHandle, &ReadSize, Buffer); 179 ASSERT_EFI_ERROR(Status); 180 Status = ShellWriteFile(DestHandle, &ReadSize, Buffer); 181 } 182 } 183 174 //get file size of source file and freespace available on destination volume 175 // 176 ShellGetFileSize(SourceHandle, &SourceFileSize); 177 ShellGetFileSize(DestHandle, &DestFileSize); 178 179 // 180 //if the destination file already exists then it will be replaced, meaning the sourcefile effectively needs less storage space 181 // 182 if(DestFileSize < SourceFileSize){ 183 SourceFileSize -= DestFileSize; 184 } else { 185 SourceFileSize = 0; 186 } 187 188 // 189 //get the system volume info to check the free space 190 // 191 DestVolumeFP = ConvertShellHandleToEfiFileProtocol(DestHandle); 192 DestVolumeInfo = NULL; 193 DestVolumeInfoSize = 0; 194 Status = DestVolumeFP->GetInfo( 195 DestVolumeFP, 196 &gEfiFileSystemInfoGuid, 197 &DestVolumeInfoSize, 198 DestVolumeInfo 199 ); 200 201 if (Status == EFI_BUFFER_TOO_SMALL) { 202 DestVolumeInfo = AllocateZeroPool(DestVolumeInfoSize); 203 Status = DestVolumeFP->GetInfo( 204 DestVolumeFP, 205 &gEfiFileSystemInfoGuid, 206 &DestVolumeInfoSize, 207 DestVolumeInfo 208 ); 209 } 210 211 // 212 //check if enough space available on destination drive to complete copy 213 // 214 if (DestVolumeInfo!= NULL && (DestVolumeInfo->FreeSpace < SourceFileSize)) { 215 // 216 //not enough space on destination directory to copy file 217 // 218 SHELL_FREE_NON_NULL(DestVolumeInfo); 219 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_FAIL), gShellLevel2HiiHandle); 220 return(SHELL_VOLUME_FULL); 221 } else { 222 // 223 // copy data between files 224 // 225 Buffer = AllocateZeroPool(ReadSize); 226 ASSERT(Buffer != NULL); 227 while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) { 228 Status = ShellReadFile(SourceHandle, &ReadSize, Buffer); 229 if (!EFI_ERROR(Status)) { 230 Status = ShellWriteFile(DestHandle, &ReadSize, Buffer); 231 if (EFI_ERROR(Status)) { 232 ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); 233 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, Dest); 234 break; 235 } 236 } else { 237 ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT)); 238 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, Source); 239 break; 240 } 241 } 242 } 243 SHELL_FREE_NON_NULL(DestVolumeInfo); 244 } 245 184 246 // 185 247 // close files … … 197 259 // return 198 260 // 199 return (SHELL_SUCCESS);261 return ShellStatus; 200 262 } 201 263 … … 234 296 CONST EFI_SHELL_FILE_INFO *Node; 235 297 SHELL_STATUS ShellStatus; 298 EFI_STATUS Status; 236 299 CHAR16 *DestPath; 237 300 VOID *Response; 238 UINTN Path Len;301 UINTN PathSize; 239 302 CONST CHAR16 *Cwd; 240 CONST CHAR16 *TempLocation;241 303 UINTN NewSize; 304 CHAR16 *CleanFilePathStr; 242 305 243 306 if (Resp == NULL) { … … 247 310 } 248 311 249 DestPath = NULL; 250 ShellStatus = SHELL_SUCCESS; 251 PathLen = 0; 252 Cwd = ShellGetCurrentDir(NULL); 312 DestPath = NULL; 313 ShellStatus = SHELL_SUCCESS; 314 PathSize = 0; 315 Cwd = ShellGetCurrentDir(NULL); 316 CleanFilePathStr = NULL; 253 317 254 318 ASSERT(FileList != NULL); 255 319 ASSERT(DestDir != NULL); 256 320 257 // 258 // We already verified that this was present. 259 // 260 ASSERT(Cwd != NULL); 321 322 Status = ShellLevel2StripQuotes (DestDir, &CleanFilePathStr); 323 if (EFI_ERROR (Status)) { 324 if (Status == EFI_OUT_OF_RESOURCES) { 325 return SHELL_OUT_OF_RESOURCES; 326 } else { 327 return SHELL_INVALID_PARAMETER; 328 } 329 } 330 331 ASSERT (CleanFilePathStr != NULL); 261 332 262 333 // 263 334 // If we are trying to copy multiple files... make sure we got a directory for the target... 264 335 // 265 if (EFI_ERROR(ShellIsDirectory( DestDir)) && FileList->Link.ForwardLink != FileList->Link.BackLink) {336 if (EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) && FileList->Link.ForwardLink != FileList->Link.BackLink) { 266 337 // 267 338 // Error for destination not a directory 268 339 // 269 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, DestDir); 340 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, CleanFilePathStr); 341 FreePool (CleanFilePathStr); 270 342 return (SHELL_INVALID_PARAMETER); 271 343 } … … 273 345 ; !IsNull(&FileList->Link, &Node->Link) 274 346 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) 275 ){347 ){ 276 348 // 277 349 // skip the directory traversing stuff... … … 281 353 } 282 354 283 NewSize = StrSize( DestDir);355 NewSize = StrSize(CleanFilePathStr); 284 356 NewSize += StrSize(Node->FullName); 285 NewSize += StrSize(Cwd);286 if (NewSize > Path Len) {287 Path Len= NewSize;357 NewSize += (Cwd == NULL)? 0 : StrSize(Cwd); 358 if (NewSize > PathSize) { 359 PathSize = NewSize; 288 360 } 289 361 … … 293 365 if (!RecursiveMode && !EFI_ERROR(ShellIsDirectory(Node->FullName))) { 294 366 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DIR_REQ), gShellLevel2HiiHandle); 367 FreePool (CleanFilePathStr); 295 368 return (SHELL_INVALID_PARAMETER); 296 369 } … … 299 372 // make sure got dest as dir if needed 300 373 // 301 if (!EFI_ERROR(ShellIsDirectory(Node->FullName)) && EFI_ERROR(ShellIsDirectory( DestDir))) {374 if (!EFI_ERROR(ShellIsDirectory(Node->FullName)) && EFI_ERROR(ShellIsDirectory(CleanFilePathStr))) { 302 375 // 303 376 // Error for destination not a directory 304 377 // 305 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, DestDir); 378 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_DIR), gShellLevel2HiiHandle, CleanFilePathStr); 379 FreePool (CleanFilePathStr); 306 380 return (SHELL_INVALID_PARAMETER); 307 381 } … … 310 384 HiiOutput = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_CP_OUTPUT), NULL); 311 385 HiiResultOk = HiiGetString (gShellLevel2HiiHandle, STRING_TOKEN (STR_GEN_RES_OK), NULL); 312 DestPath = AllocateZeroPool(Path Len);386 DestPath = AllocateZeroPool(PathSize); 313 387 314 388 if (DestPath == NULL || HiiOutput == NULL || HiiResultOk == NULL) { … … 316 390 SHELL_FREE_NON_NULL(HiiOutput); 317 391 SHELL_FREE_NON_NULL(HiiResultOk); 392 FreePool (CleanFilePathStr); 318 393 return (SHELL_OUT_OF_RESOURCES); 319 394 } … … 325 400 ; !IsNull(&FileList->Link, &Node->Link) 326 401 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&FileList->Link, &Node->Link) 327 ){402 ){ 328 403 if (ShellGetExecutionBreakFlag()) { 329 404 break; … … 340 415 341 416 if (FileList->Link.ForwardLink == FileList->Link.BackLink // 1 item 342 && EFI_ERROR(ShellIsDirectory( DestDir)) // not an existing directory343 ) {344 if (StrStr( DestDir, L":") == NULL) {417 && EFI_ERROR(ShellIsDirectory(CleanFilePathStr)) // not an existing directory 418 ) { 419 if (StrStr(CleanFilePathStr, L":") == NULL) { 345 420 // 346 421 // simple copy of a single file 347 422 // 348 StrCpy(DestPath, Cwd); 349 if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') { 350 StrCat(DestPath, L"\\"); 351 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') { 423 if (Cwd != NULL) { 424 StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16)-1); 425 } else { 426 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, CleanFilePathStr); 427 FreePool (CleanFilePathStr); 428 return (SHELL_INVALID_PARAMETER); 429 } 430 if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') { 431 StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 432 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') { 352 433 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; 353 434 } 354 Str Cat(DestPath, DestDir);435 StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 355 436 } else { 356 Str Cpy(DestPath, DestDir);437 StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1); 357 438 } 358 439 } else { … … 364 445 // Check for leading slash 365 446 // 366 if ( DestDir[0] == L'\\') {447 if (CleanFilePathStr[0] == L'\\') { 367 448 // 368 449 // Copy to the root of CWD 369 450 // 370 StrCpy(DestPath, Cwd); 451 if (Cwd != NULL) { 452 StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1); 453 } else { 454 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, CleanFilePathStr); 455 FreePool(CleanFilePathStr); 456 return (SHELL_INVALID_PARAMETER); 457 } 371 458 while (PathRemoveLastItem(DestPath)); 372 StrCat(DestPath, DestDir+1); 373 StrCat(DestPath, Node->FileName); 374 } else if (StrStr(DestDir, L":") == NULL) { 375 StrCpy(DestPath, Cwd); 376 if (DestPath[StrLen(DestPath)-1] != L'\\' && DestDir[0] != L'\\') { 377 StrCat(DestPath, L"\\"); 378 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && DestDir[0] == L'\\') { 459 StrnCat(DestPath, CleanFilePathStr+1, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 460 StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 461 } else if (StrStr(CleanFilePathStr, L":") == NULL) { 462 if (Cwd != NULL) { 463 StrnCpy(DestPath, Cwd, PathSize/sizeof(CHAR16) -1); 464 } else { 465 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_DIR_NF), gShellLevel2HiiHandle, CleanFilePathStr); 466 FreePool(CleanFilePathStr); 467 return (SHELL_INVALID_PARAMETER); 468 } 469 if (DestPath[StrLen(DestPath)-1] != L'\\' && CleanFilePathStr[0] != L'\\') { 470 StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 471 } else if (DestPath[StrLen(DestPath)-1] == L'\\' && CleanFilePathStr[0] == L'\\') { 379 472 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; 380 473 } 381 Str Cat(DestPath, DestDir);382 if ( DestDir[StrLen(DestDir)-1] != L'\\' && Node->FileName[0] != L'\\') {383 Str Cat(DestPath, L"\\");384 } else if ( DestDir[StrLen(DestDir)-1] == L'\\' && Node->FileName[0] == L'\\') {474 StrnCat(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 475 if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') { 476 StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 477 } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') { 385 478 ((CHAR16*)DestPath)[StrLen(DestPath)-1] = CHAR_NULL; 386 479 } 387 Str Cat(DestPath, Node->FileName);480 StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 388 481 389 482 } else { 390 Str Cpy(DestPath, DestDir);391 if ( DestDir[StrLen(DestDir)-1] != L'\\' && Node->FileName[0] != L'\\') {392 Str Cat(DestPath, L"\\");393 } else if ( DestDir[StrLen(DestDir)-1] == L'\\' && Node->FileName[0] == L'\\') {394 ((CHAR16*) DestDir)[StrLen(DestDir)-1] = CHAR_NULL;395 } 396 Str Cat(DestPath, Node->FileName);483 StrnCpy(DestPath, CleanFilePathStr, PathSize/sizeof(CHAR16) -1); 484 if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] != L'\\' && Node->FileName[0] != L'\\') { 485 StrnCat(DestPath, L"\\", PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 486 } else if (CleanFilePathStr[StrLen(CleanFilePathStr)-1] == L'\\' && Node->FileName[0] == L'\\') { 487 ((CHAR16*)CleanFilePathStr)[StrLen(CleanFilePathStr)-1] = CHAR_NULL; 488 } 489 StrnCat(DestPath, Node->FileName, PathSize/sizeof(CHAR16) - StrLen(DestPath) -1); 397 490 } 398 491 } 399 492 400 493 // 401 494 // Make sure the path exists … … 410 503 && !EFI_ERROR(ShellIsDirectory(DestPath)) 411 504 && StrniCmp(Node->FullName, DestPath, StrLen(DestPath)) == NULL 412 ){505 ){ 413 506 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_PARENT), gShellLevel2HiiHandle); 414 507 ShellStatus = SHELL_INVALID_PARAMETER; … … 421 514 } 422 515 423 if (( TempLocation = StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName))) == 0516 if ((StrniCmp(Node->FullName, DestPath, StrLen(Node->FullName)) == 0) 424 517 && (DestPath[StrLen(Node->FullName)] == CHAR_NULL || DestPath[StrLen(Node->FullName)] == L'\\') 425 ) {518 ) { 426 519 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_SD_SAME), gShellLevel2HiiHandle); 427 520 ShellStatus = SHELL_INVALID_PARAMETER; … … 431 524 PathCleanUpDirectories(DestPath); 432 525 433 ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath); 526 if (!SilentMode) { 527 ShellPrintEx(-1, -1, HiiOutput, Node->FullName, DestPath); 528 } 434 529 435 530 // … … 448 543 SHELL_FREE_NON_NULL(HiiOutput); 449 544 SHELL_FREE_NON_NULL(HiiResultOk); 545 SHELL_FREE_NON_NULL(CleanFilePathStr); 450 546 if (Resp == NULL) { 451 547 SHELL_FREE_NON_NULL(Response); … … 453 549 454 550 return (ShellStatus); 551 455 552 } 456 553 … … 478 575 SHELL_STATUS ShellStatus; 479 576 EFI_SHELL_FILE_INFO *List; 480 EFI_STATUS Status;481 577 EFI_FILE_INFO *FileInfo; 482 483 List = NULL; 484 485 Status = ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List); 578 CHAR16 *FullName; 579 580 List = NULL; 581 FullName = NULL; 582 FileInfo = NULL; 583 584 ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_READ, &List); 486 585 if (List != NULL && List->Link.ForwardLink != List->Link.BackLink) { 487 586 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_MARG_ERROR), gShellLevel2HiiHandle, DestDir); … … 491 590 ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink) != NULL); 492 591 ASSERT(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName != NULL); 493 FileInfo = NULL;494 592 FileInfo = gEfiShellProtocol->GetFileInfo(((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->Handle); 495 593 ASSERT(FileInfo != NULL); 594 StrnCatGrow(&FullName, NULL, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, 0); 595 ShellCloseFileMetaArg(&List); 496 596 if ((FileInfo->Attribute & EFI_FILE_READ_ONLY) == 0) { 497 ShellStatus = ValidateAndCopyFiles(FileList, ((EFI_SHELL_FILE_INFO *)List->Link.ForwardLink)->FullName, SilentMode, RecursiveMode, NULL);597 ShellStatus = ValidateAndCopyFiles(FileList, FullName, SilentMode, RecursiveMode, NULL); 498 598 } else { 499 599 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_CP_DEST_ERROR), gShellLevel2HiiHandle); 500 600 ShellStatus = SHELL_ACCESS_DENIED; 501 601 } 502 SHELL_FREE_NON_NULL(FileInfo);602 } else { 503 603 ShellCloseFileMetaArg(&List); 504 } else { 505 ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL); 506 } 507 604 ShellStatus = ValidateAndCopyFiles(FileList, DestDir, SilentMode, RecursiveMode, NULL); 605 } 606 607 SHELL_FREE_NON_NULL(FileInfo); 608 SHELL_FREE_NON_NULL(FullName); 508 609 return (ShellStatus); 509 610 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Load.c
r48674 r58459 82 82 EFI_HANDLE LoadedDriverHandle; 83 83 EFI_STATUS Status; 84 EFI_DEVICE_PATH_PROTOCOL *Node;85 84 EFI_DEVICE_PATH_PROTOCOL *FilePath; 86 85 EFI_LOADED_IMAGE_PROTOCOL *LoadedDriverImage; … … 88 87 LoadedDriverImage = NULL; 89 88 FilePath = NULL; 90 Node = NULL;91 89 LoadedDriverHandle = NULL; 92 90 Status = EFI_SUCCESS; -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
r48674 r58459 2 2 Main file for ls shell level 2 function. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2013 - 2014, Hewlett-Packard Development Company, L.P.<BR> 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 15 16 #include "UefiShellLevel2CommandsLib.h" 16 17 #include <Guid/FileSystemInfo.h> 18 19 /** 20 print out the standard format output volume entry. 21 22 @param[in] TheList a list of files from the volume. 23 **/ 24 EFI_STATUS 25 EFIAPI 26 PrintSfoVolumeInfoTableEntry( 27 IN CONST EFI_SHELL_FILE_INFO *TheList 28 ) 29 { 30 EFI_STATUS Status; 31 EFI_SHELL_FILE_INFO *Node; 32 CHAR16 *DirectoryName; 33 EFI_FILE_SYSTEM_INFO *SysInfo; 34 UINTN SysInfoSize; 35 SHELL_FILE_HANDLE ShellFileHandle; 36 EFI_FILE_PROTOCOL *EfiFpHandle; 37 38 // 39 // Get the first valid handle (directories) 40 // 41 for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link) 42 ; !IsNull(&TheList->Link, &Node->Link) && Node->Handle == NULL 43 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&TheList->Link, &Node->Link) 44 ); 45 46 if (Node->Handle == NULL) { 47 DirectoryName = GetFullyQualifiedPath(((EFI_SHELL_FILE_INFO *)GetFirstNode(&TheList->Link))->FullName); 48 49 // 50 // We need to open something up to get system information 51 // 52 Status = gEfiShellProtocol->OpenFileByName( 53 DirectoryName, 54 &ShellFileHandle, 55 EFI_FILE_MODE_READ 56 ); 57 58 ASSERT_EFI_ERROR(Status); 59 FreePool(DirectoryName); 60 61 // 62 // Get the Volume Info from ShellFileHandle 63 // 64 SysInfo = NULL; 65 SysInfoSize = 0; 66 EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle); 67 Status = EfiFpHandle->GetInfo( 68 EfiFpHandle, 69 &gEfiFileSystemInfoGuid, 70 &SysInfoSize, 71 SysInfo 72 ); 73 74 if (Status == EFI_BUFFER_TOO_SMALL) { 75 SysInfo = AllocateZeroPool(SysInfoSize); 76 Status = EfiFpHandle->GetInfo( 77 EfiFpHandle, 78 &gEfiFileSystemInfoGuid, 79 &SysInfoSize, 80 SysInfo 81 ); 82 } 83 84 ASSERT_EFI_ERROR(Status); 85 86 gEfiShellProtocol->CloseFile(ShellFileHandle); 87 } else { 88 // 89 // Get the Volume Info from Node->Handle 90 // 91 SysInfo = NULL; 92 SysInfoSize = 0; 93 EfiFpHandle = ConvertShellHandleToEfiFileProtocol(Node->Handle); 94 Status = EfiFpHandle->GetInfo( 95 EfiFpHandle, 96 &gEfiFileSystemInfoGuid, 97 &SysInfoSize, 98 SysInfo 99 ); 100 101 if (Status == EFI_BUFFER_TOO_SMALL) { 102 SysInfo = AllocateZeroPool(SysInfoSize); 103 Status = EfiFpHandle->GetInfo( 104 EfiFpHandle, 105 &gEfiFileSystemInfoGuid, 106 &SysInfoSize, 107 SysInfo 108 ); 109 } 110 111 ASSERT_EFI_ERROR(Status); 112 } 113 114 ShellPrintHiiEx ( 115 -1, 116 -1, 117 NULL, 118 STRING_TOKEN (STR_GEN_SFO_HEADER), 119 gShellLevel2HiiHandle, 120 L"ls" 121 ); 122 // 123 // print VolumeInfo table 124 // 125 ASSERT(SysInfo != NULL); 126 ShellPrintHiiEx ( 127 0, 128 gST->ConOut->Mode->CursorRow, 129 NULL, 130 STRING_TOKEN (STR_LS_SFO_VOLINFO), 131 gShellLevel2HiiHandle, 132 SysInfo->VolumeLabel, 133 SysInfo->VolumeSize, 134 SysInfo->ReadOnly?L"TRUE":L"FALSE", 135 SysInfo->FreeSpace, 136 SysInfo->BlockSize 137 ); 138 139 SHELL_FREE_NON_NULL(SysInfo); 140 141 return (Status); 142 } 143 144 /** 145 print out the info on a single file. 146 147 @param[in] Sfo TRUE if in SFO, false otherwise. 148 @param[in] TheNode the EFI_SHELL_FILE_INFO node to print out information on. 149 @param[in] Files incremented if a file is printed. 150 @param[in] Size incremented by file size. 151 @param[in] Dirs incremented if a directory is printed. 152 153 **/ 154 VOID 155 EFIAPI 156 PrintFileInformation( 157 IN CONST BOOLEAN Sfo, 158 IN CONST EFI_SHELL_FILE_INFO *TheNode, 159 IN UINT64 *Files, 160 IN UINT64 *Size, 161 IN UINT64 *Dirs 162 ) 163 { 164 ASSERT(Files != NULL); 165 ASSERT(Size != NULL); 166 ASSERT(Dirs != NULL); 167 ASSERT(TheNode != NULL); 168 169 if (Sfo) { 170 // 171 // Print the FileInfo Table 172 // 173 ShellPrintHiiEx ( 174 0, 175 gST->ConOut->Mode->CursorRow, 176 NULL, 177 STRING_TOKEN (STR_LS_SFO_FILEINFO), 178 gShellLevel2HiiHandle, 179 TheNode->FullName, 180 TheNode->Info->FileSize, 181 TheNode->Info->PhysicalSize, 182 (TheNode->Info->Attribute & EFI_FILE_ARCHIVE) != 0?L"a":L"", 183 (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"d":L"", 184 (TheNode->Info->Attribute & EFI_FILE_HIDDEN) != 0?L"h":L"", 185 (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L"r":L"", 186 (TheNode->Info->Attribute & EFI_FILE_SYSTEM) != 0?L"s":L"", 187 TheNode->Info->CreateTime.Hour, 188 TheNode->Info->CreateTime.Minute, 189 TheNode->Info->CreateTime.Second, 190 TheNode->Info->CreateTime.Day, 191 TheNode->Info->CreateTime.Month, 192 TheNode->Info->CreateTime.Year, 193 TheNode->Info->LastAccessTime.Hour, 194 TheNode->Info->LastAccessTime.Minute, 195 TheNode->Info->LastAccessTime.Second, 196 TheNode->Info->LastAccessTime.Day, 197 TheNode->Info->LastAccessTime.Month, 198 TheNode->Info->LastAccessTime.Year, 199 TheNode->Info->ModificationTime.Hour, 200 TheNode->Info->ModificationTime.Minute, 201 TheNode->Info->ModificationTime.Second, 202 TheNode->Info->ModificationTime.Day, 203 TheNode->Info->ModificationTime.Month, 204 TheNode->Info->ModificationTime.Year 205 ); 206 } else { 207 // 208 // print this one out... 209 // first print the universal start, next print the type specific name format, last print the CRLF 210 // 211 ShellPrintHiiEx ( 212 -1, 213 -1, 214 NULL, 215 STRING_TOKEN (STR_LS_LINE_START_ALL), 216 gShellLevel2HiiHandle, 217 &TheNode->Info->ModificationTime, 218 (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"<DIR>":L"", 219 (TheNode->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L'r':L' ', 220 TheNode->Info->FileSize 221 ); 222 if (TheNode->Info->Attribute & EFI_FILE_DIRECTORY) { 223 (*Dirs)++; 224 ShellPrintHiiEx ( 225 -1, 226 -1, 227 NULL, 228 STRING_TOKEN (STR_LS_LINE_END_DIR), 229 gShellLevel2HiiHandle, 230 TheNode->FileName 231 ); 232 } else { 233 (*Files)++; 234 (*Size) += TheNode->Info->FileSize; 235 if ( (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".nsh", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0) 236 || (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".efi", (CHAR16*)&(TheNode->FileName[StrLen (TheNode->FileName) - 4])) == 0) 237 ){ 238 ShellPrintHiiEx ( 239 -1, 240 -1, 241 NULL, 242 STRING_TOKEN (STR_LS_LINE_END_EXE), 243 gShellLevel2HiiHandle, 244 TheNode->FileName 245 ); 246 } else { 247 ShellPrintHiiEx ( 248 -1, 249 -1, 250 NULL, 251 STRING_TOKEN (STR_LS_LINE_END_FILE), 252 gShellLevel2HiiHandle, 253 TheNode->FileName 254 ); 255 } 256 } 257 } 258 } 259 260 /** 261 print out the header when not using standard format output. 262 263 @param[in] Path String with starting path. 264 **/ 265 VOID 266 EFIAPI 267 PrintNonSfoHeader( 268 IN CONST CHAR16 *Path 269 ) 270 { 271 CHAR16 *DirectoryName; 272 273 // 274 // get directory name from path... 275 // 276 DirectoryName = GetFullyQualifiedPath(Path); 277 278 if (DirectoryName != NULL) { 279 // 280 // print header 281 // 282 ShellPrintHiiEx ( 283 0, 284 gST->ConOut->Mode->CursorRow, 285 NULL, 286 STRING_TOKEN (STR_LS_HEADER_LINE1), 287 gShellLevel2HiiHandle, 288 DirectoryName 289 ); 290 291 SHELL_FREE_NON_NULL(DirectoryName); 292 } 293 } 294 295 /** 296 print out the footer when not using standard format output. 297 298 @param[in] Files The number of files. 299 @param[in] Size The size of files in bytes. 300 @param[in] Dirs The number of directories. 301 **/ 302 VOID 303 EFIAPI 304 PrintNonSfoFooter( 305 IN UINT64 Files, 306 IN UINT64 Size, 307 IN UINT64 Dirs 308 ) 309 { 310 // 311 // print footer 312 // 313 ShellPrintHiiEx ( 314 -1, 315 -1, 316 NULL, 317 STRING_TOKEN (STR_LS_FOOTER_LINE), 318 gShellLevel2HiiHandle, 319 Files, 320 Size, 321 Dirs 322 ); 323 } 17 324 18 325 /** … … 24 331 If 0 then all non-system and non-hidden files will be printed. 25 332 @param[in] Sfo TRUE to use Standard Format Output, FALSE otherwise 26 @param[in] Path String with starting path. 27 @param[in] First TRUE for the original and FALSE for any recursion spawned instances. 333 @param[in] RootPath String with starting path to search in. 334 @param[in] SearchString String with search string. 335 @param[in] Found Set to TRUE, if anyone were found. 28 336 @param[in] Count The count of bits enabled in Attribs. 29 337 @param[in] TimeZone The current time zone offset. … … 37 345 IN CONST UINT64 Attribs, 38 346 IN CONST BOOLEAN Sfo, 39 IN CONST CHAR16 *Path, 40 IN CONST BOOLEAN First, 347 IN CONST CHAR16 *RootPath, 348 IN CONST CHAR16 *SearchString, 349 IN BOOLEAN *Found, 41 350 IN CONST UINTN Count, 42 351 IN CONST INT16 TimeZone … … 50 359 UINT64 DirCount; 51 360 UINT64 FileSize; 52 CHAR16 *DirectoryName;53 361 UINTN LongestPath; 54 EFI_FILE_SYSTEM_INFO *SysInfo;55 UINTN SysInfoSize;56 SHELL_FILE_HANDLE ShellFileHandle;57 362 CHAR16 *CorrectedPath; 58 EFI_FILE_PROTOCOL *EfiFpHandle; 59 363 BOOLEAN FoundOne; 364 BOOLEAN HeaderPrinted; 365 366 HeaderPrinted = FALSE; 60 367 FileCount = 0; 61 368 DirCount = 0; … … 66 373 CorrectedPath = NULL; 67 374 68 CorrectedPath = StrnCatGrow(&CorrectedPath, NULL, Path, 0); 69 ASSERT(CorrectedPath != NULL); 375 if (Found != NULL) { 376 FoundOne = *Found; 377 } else { 378 FoundOne = FALSE; 379 } 380 381 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0); 382 if (CorrectedPath == NULL) { 383 return SHELL_OUT_OF_RESOURCES; 384 } 385 if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\' 386 &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') { 387 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0); 388 } 389 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, SearchString, 0); 390 if (CorrectedPath == NULL) { 391 return (SHELL_OUT_OF_RESOURCES); 392 } 393 70 394 PathCleanUpDirectories(CorrectedPath); 71 395 72 396 Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead); 73 if (EFI_ERROR(Status)) { 74 return (SHELL_DEVICE_ERROR); 75 } 76 if (ListHead == NULL || IsListEmpty(&ListHead->Link)) { 77 // 78 // On the first one only we expect to find something... 79 // do we find the . and .. directories otherwise? 80 // 81 if (First) { 82 return (SHELL_NOT_FOUND); 83 } 84 return (SHELL_SUCCESS); 85 } 86 87 if (Sfo && First) { 88 // 89 // Get the first valid handle (directories) 90 // 91 for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link) 92 ; !IsNull(&ListHead->Link, &Node->Link) && Node->Handle == NULL 397 if (!EFI_ERROR(Status)) { 398 if (ListHead == NULL || IsListEmpty(&ListHead->Link)) { 399 SHELL_FREE_NON_NULL(CorrectedPath); 400 return (SHELL_SUCCESS); 401 } 402 403 if (Sfo && Found == NULL) { 404 PrintSfoVolumeInfoTableEntry(ListHead); 405 } 406 407 for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link), LongestPath = 0 408 ; !IsNull(&ListHead->Link, &Node->Link) 93 409 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) 94 ); 95 96 if (Node->Handle == NULL) { 97 DirectoryName = GetFullyQualifiedPath(((EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link))->FullName); 98 99 // 100 // We need to open something up to get system information 101 // 102 Status = gEfiShellProtocol->OpenFileByName( 103 DirectoryName, 104 &ShellFileHandle, 105 EFI_FILE_MODE_READ); 106 107 ASSERT_EFI_ERROR(Status); 108 FreePool(DirectoryName); 109 110 // 111 // Get the Volume Info from ShellFileHandle 112 // 113 SysInfo = NULL; 114 SysInfoSize = 0; 115 EfiFpHandle = ConvertShellHandleToEfiFileProtocol(ShellFileHandle); 116 Status = EfiFpHandle->GetInfo( 117 EfiFpHandle, 118 &gEfiFileSystemInfoGuid, 119 &SysInfoSize, 120 SysInfo); 121 122 if (Status == EFI_BUFFER_TOO_SMALL) { 123 SysInfo = AllocateZeroPool(SysInfoSize); 124 Status = EfiFpHandle->GetInfo( 125 EfiFpHandle, 126 &gEfiFileSystemInfoGuid, 127 &SysInfoSize, 128 SysInfo); 410 ){ 411 if (ShellGetExecutionBreakFlag ()) { 412 ShellStatus = SHELL_ABORTED; 413 break; 129 414 } 130 131 ASSERT_EFI_ERROR(Status); 132 133 gEfiShellProtocol->CloseFile(ShellFileHandle); 134 } else { 135 // 136 // Get the Volume Info from Node->Handle 137 // 138 SysInfo = NULL; 139 SysInfoSize = 0; 140 EfiFpHandle = ConvertShellHandleToEfiFileProtocol(Node->Handle); 141 Status = EfiFpHandle->GetInfo( 142 EfiFpHandle, 143 &gEfiFileSystemInfoGuid, 144 &SysInfoSize, 145 SysInfo); 146 147 if (Status == EFI_BUFFER_TOO_SMALL) { 148 SysInfo = AllocateZeroPool(SysInfoSize); 149 Status = EfiFpHandle->GetInfo( 150 EfiFpHandle, 151 &gEfiFileSystemInfoGuid, 152 &SysInfoSize, 153 SysInfo); 415 ASSERT(Node != NULL); 416 if (LongestPath < StrSize(Node->FullName)) { 417 LongestPath = StrSize(Node->FullName); 154 418 } 155 156 ASSERT_EFI_ERROR(Status); 157 } 158 159 ShellPrintHiiEx ( 160 -1, 161 -1, 162 NULL, 163 STRING_TOKEN (STR_GEN_SFO_HEADER), 164 gShellLevel2HiiHandle, 165 L"ls"); 166 // 167 // print VolumeInfo table 168 // 169 ASSERT(SysInfo != NULL); 170 ShellPrintHiiEx ( 171 0, 172 gST->ConOut->Mode->CursorRow, 173 NULL, 174 STRING_TOKEN (STR_LS_SFO_VOLINFO), 175 gShellLevel2HiiHandle, 176 SysInfo->VolumeLabel, 177 SysInfo->VolumeSize, 178 SysInfo->ReadOnly?L"TRUE":L"FALSE", 179 SysInfo->FreeSpace, 180 SysInfo->BlockSize 181 ); 182 if (SysInfo != NULL) { 183 FreePool(SysInfo); 184 } 185 } 186 187 if (!Sfo) { 188 // 189 // get directory name from path... 190 // 191 DirectoryName = GetFullyQualifiedPath(CorrectedPath); 192 193 // 194 // print header 195 // 196 ShellPrintHiiEx ( 197 0, 198 gST->ConOut->Mode->CursorRow, 199 NULL, 200 STRING_TOKEN (STR_LS_HEADER_LINE1), 201 gShellLevel2HiiHandle, 202 DirectoryName 203 ); 204 FreePool(DirectoryName); 205 } 206 for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link) 207 ; !IsNull(&ListHead->Link, &Node->Link) 208 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) 209 ){ 210 ASSERT(Node != NULL); 211 if (LongestPath < StrSize(Node->FullName)) { 212 LongestPath = StrSize(Node->FullName); 213 } 214 ASSERT(Node->Info != NULL); 215 ASSERT((Node->Info->Attribute & EFI_FILE_VALID_ATTR) == Node->Info->Attribute); 216 if (Attribs == 0) { 217 // 218 // NOT system & NOT hidden 219 // 220 if ( (Node->Info->Attribute & EFI_FILE_SYSTEM) 221 || (Node->Info->Attribute & EFI_FILE_HIDDEN) 222 ){ 223 continue; 224 } 225 } else if (Attribs != EFI_FILE_VALID_ATTR) { 226 if (Count == 1) { 419 ASSERT(Node->Info != NULL); 420 ASSERT((Node->Info->Attribute & EFI_FILE_VALID_ATTR) == Node->Info->Attribute); 421 if (Attribs == 0) { 227 422 // 228 // the bit must match 423 // NOT system & NOT hidden 424 // 425 if ( (Node->Info->Attribute & EFI_FILE_SYSTEM) 426 || (Node->Info->Attribute & EFI_FILE_HIDDEN) 427 ){ 428 continue; 429 } 430 } else if ((Attribs != EFI_FILE_VALID_ATTR) || 431 (Count == 5)) { 432 // 433 // Only matches the bits which "Attribs" contains, not 434 // all files/directories with any of the bits. 435 // Count == 5 is used to tell the difference between a user 436 // specifying all bits (EX: -arhsda) and just specifying 437 // -a (means display all files with any attribute). 229 438 // 230 439 if ( (Node->Info->Attribute & Attribs) != Attribs) { 231 440 continue; 232 441 } 233 } else {234 //235 // exact match on all bits236 //237 if ( (Node->Info->Attribute|EFI_FILE_ARCHIVE) != (Attribs|EFI_FILE_ARCHIVE)) {238 continue;239 }240 442 } 241 } 242 243 if (Sfo) { 244 // 245 // Print the FileInfo Table 246 // 247 ShellPrintHiiEx ( 248 0, 249 gST->ConOut->Mode->CursorRow, 250 NULL, 251 STRING_TOKEN (STR_LS_SFO_FILEINFO), 252 gShellLevel2HiiHandle, 253 Node->FullName, 254 Node->Info->FileSize, 255 Node->Info->PhysicalSize, 256 (Node->Info->Attribute & EFI_FILE_ARCHIVE) != 0?L"a":L"", 257 (Node->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"d":L"", 258 (Node->Info->Attribute & EFI_FILE_HIDDEN) != 0?L"h":L"", 259 (Node->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L"r":L"", 260 (Node->Info->Attribute & EFI_FILE_SYSTEM) != 0?L"s":L"", 261 Node->Info->CreateTime.Hour, 262 Node->Info->CreateTime.Minute, 263 Node->Info->CreateTime.Second, 264 Node->Info->CreateTime.Day, 265 Node->Info->CreateTime.Month, 266 Node->Info->CreateTime.Year, 267 Node->Info->LastAccessTime.Hour, 268 Node->Info->LastAccessTime.Minute, 269 Node->Info->LastAccessTime.Second, 270 Node->Info->LastAccessTime.Day, 271 Node->Info->LastAccessTime.Month, 272 Node->Info->LastAccessTime.Year, 273 Node->Info->ModificationTime.Hour, 274 Node->Info->ModificationTime.Minute, 275 Node->Info->ModificationTime.Second, 276 Node->Info->ModificationTime.Day, 277 Node->Info->ModificationTime.Month, 278 Node->Info->ModificationTime.Year 279 ); 280 } else { 281 // 282 // print this one out... 283 // first print the universal start, next print the type specific name format, last print the CRLF 284 // 285 ShellPrintHiiEx ( 286 -1, 287 -1, 288 NULL, 289 STRING_TOKEN (STR_LS_LINE_START_ALL), 290 gShellLevel2HiiHandle, 291 &Node->Info->ModificationTime, 292 (Node->Info->Attribute & EFI_FILE_DIRECTORY) != 0?L"<DIR>":L"", 293 (Node->Info->Attribute & EFI_FILE_READ_ONLY) != 0?L'r':L' ', 294 Node->Info->FileSize 295 ); 296 if (Node->Info->Attribute & EFI_FILE_DIRECTORY) { 297 DirCount++; 298 ShellPrintHiiEx ( 299 -1, 300 -1, 301 NULL, 302 STRING_TOKEN (STR_LS_LINE_END_DIR), 303 gShellLevel2HiiHandle, 304 Node->FileName 305 ); 306 } else { 307 FileCount++; 308 FileSize += Node->Info->FileSize; 309 if ( (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".nsh", (CHAR16*)&(Node->FileName[StrLen (Node->FileName) - 4])) == 0) 310 || (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)L".efi", (CHAR16*)&(Node->FileName[StrLen (Node->FileName) - 4])) == 0) 311 ){ 312 ShellPrintHiiEx ( 313 -1, 314 -1, 315 NULL, 316 STRING_TOKEN (STR_LS_LINE_END_EXE), 317 gShellLevel2HiiHandle, 318 Node->FileName 319 ); 320 } else { 321 ShellPrintHiiEx ( 322 -1, 323 -1, 324 NULL, 325 STRING_TOKEN (STR_LS_LINE_END_FILE), 326 gShellLevel2HiiHandle, 327 Node->FileName 328 ); 329 } 443 444 if (!Sfo && !HeaderPrinted) { 445 PrintNonSfoHeader(CorrectedPath); 330 446 } 331 } 332 } 333 334 if (!Sfo) { 335 // 336 // print footer 337 // 338 ShellPrintHiiEx ( 339 -1, 340 -1, 341 NULL, 342 STRING_TOKEN (STR_LS_FOOTER_LINE), 343 gShellLevel2HiiHandle, 344 FileCount, 345 FileSize, 346 DirCount 347 ); 348 } 349 350 if (Rec){ 351 DirectoryName = AllocateZeroPool(LongestPath + 2*sizeof(CHAR16)); 352 if (DirectoryName == NULL) { 353 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_MEM), gShellLevel2HiiHandle); 354 ShellStatus = SHELL_OUT_OF_RESOURCES; 355 } else { 447 PrintFileInformation(Sfo, Node, &FileCount, &FileSize, &DirCount); 448 FoundOne = TRUE; 449 HeaderPrinted = TRUE; 450 } 451 452 if (!Sfo && ShellStatus != SHELL_ABORTED) { 453 PrintNonSfoFooter(FileCount, FileSize, DirCount); 454 } 455 } 456 457 if (Rec && ShellStatus != SHELL_ABORTED) { 458 // 459 // Re-Open all the files under the starting path for directories that didnt necessarily match our file filter 460 // 461 ShellCloseFileMetaArg(&ListHead); 462 CorrectedPath[0] = CHAR_NULL; 463 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, RootPath, 0); 464 if (CorrectedPath == NULL) { 465 return SHELL_OUT_OF_RESOURCES; 466 } 467 if (CorrectedPath[StrLen(CorrectedPath)-1] != L'\\' 468 &&CorrectedPath[StrLen(CorrectedPath)-1] != L'/') { 469 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"\\", 0); 470 } 471 CorrectedPath = StrnCatGrow(&CorrectedPath, &LongestPath, L"*", 0); 472 Status = ShellOpenFileMetaArg((CHAR16*)CorrectedPath, EFI_FILE_MODE_READ, &ListHead); 473 474 if (!EFI_ERROR(Status)) { 356 475 for ( Node = (EFI_SHELL_FILE_INFO *)GetFirstNode(&ListHead->Link) 357 ; !IsNull(&ListHead->Link, &Node->Link) 476 ; !IsNull(&ListHead->Link, &Node->Link) && ShellStatus == SHELL_SUCCESS 358 477 ; Node = (EFI_SHELL_FILE_INFO *)GetNextNode(&ListHead->Link, &Node->Link) 359 478 ){ 479 if (ShellGetExecutionBreakFlag ()) { 480 ShellStatus = SHELL_ABORTED; 481 break; 482 } 483 360 484 // 361 485 // recurse on any directory except the traversing ones... … … 365 489 && StrCmp(Node->FileName, L"..") != 0 366 490 ){ 367 StrCpy(DirectoryName, Node->FullName); 368 StrCat(DirectoryName, L"\\*"); 369 PrintLsOutput( 491 ShellStatus = PrintLsOutput( 370 492 Rec, 371 493 Attribs, 372 494 Sfo, 373 DirectoryName, 374 FALSE, 495 Node->FullName, 496 SearchString, 497 &FoundOne, 375 498 Count, 376 499 TimeZone); 500 501 // 502 // Since it's running recursively, we have to break immediately when returned SHELL_ABORTED 503 // 504 if (ShellStatus == SHELL_ABORTED) { 505 break; 506 } 377 507 } 378 508 } 379 FreePool(DirectoryName); 380 } 381 } 382 383 FreePool(CorrectedPath); 509 } 510 } 511 512 SHELL_FREE_NON_NULL(CorrectedPath); 384 513 ShellCloseFileMetaArg(&ListHead); 385 FreePool(ListHead); 514 515 if (Found == NULL && !FoundOne) { 516 return (SHELL_NOT_FOUND); 517 } 518 519 if (Found != NULL) { 520 *Found = FoundOne; 521 } 522 386 523 return (ShellStatus); 387 524 } … … 419 556 UINTN Size; 420 557 EFI_TIME TheTime; 421 BOOLEAN SfoMode;558 CHAR16 *SearchString; 422 559 423 560 Size = 0; … … 428 565 RequiredAttributes = 0; 429 566 PathName = NULL; 567 SearchString = NULL; 430 568 CurDir = NULL; 431 569 Count = 0; … … 517 655 PathName = ShellCommandLineGetRawValue(Package, 1); 518 656 if (PathName == NULL) { 657 // 658 // Nothing specified... must start from current directory 659 // 519 660 CurDir = gEfiShellProtocol->GetCurDir(NULL); 520 661 if (CurDir == NULL) { … … 522 663 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle); 523 664 } 524 } 525 if (PathName != NULL) { 665 // 666 // Copy to the 2 strings for starting path and file search string 667 // 668 ASSERT(SearchString == NULL); 669 ASSERT(FullPath == NULL); 670 StrnCatGrow(&SearchString, NULL, L"*", 0); 671 StrnCatGrow(&FullPath, NULL, CurDir, 0); 672 } else { 526 673 if (StrStr(PathName, L":") == NULL && gEfiShellProtocol->GetCurDir(NULL) == NULL) { 674 // 675 // If we got something and it doesnt have a fully qualified path, then we needed to have a CWD. 676 // 527 677 ShellStatus = SHELL_NOT_FOUND; 528 678 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_CWD), gShellLevel2HiiHandle); 529 679 } else { 680 // 681 // We got a valid fully qualified path or we have a CWD 682 // 530 683 ASSERT((FullPath == NULL && Size == 0) || (FullPath != NULL)); 684 if (StrStr(PathName, L":") == NULL) { 685 StrnCatGrow(&FullPath, &Size, gEfiShellProtocol->GetCurDir(NULL), 0); 686 if (FullPath == NULL) { 687 ShellCommandLineFreeVarList (Package); 688 return SHELL_OUT_OF_RESOURCES; 689 } 690 } 531 691 StrnCatGrow(&FullPath, &Size, PathName, 0); 692 if (FullPath == NULL) { 693 ShellCommandLineFreeVarList (Package); 694 return SHELL_OUT_OF_RESOURCES; 695 } 696 532 697 if (ShellIsDirectory(PathName) == EFI_SUCCESS) { 533 StrnCatGrow(&FullPath, &Size, L"\\*", 0); 698 // 699 // is listing ends with a directory, then we list all files in that directory 700 // 701 StrnCatGrow(&SearchString, NULL, L"*", 0); 702 } else { 703 // 704 // must split off the search part that applies to files from the end of the directory part 705 // 706 for (StrnCatGrow(&SearchString, NULL, PathName, 0) 707 ; SearchString != NULL && StrStr(SearchString, L"\\") != NULL 708 ; CopyMem(SearchString, StrStr(SearchString, L"\\") + 1, 1 + StrSize(StrStr(SearchString, L"\\") + 1))) ; 709 FullPath[StrLen(FullPath) - StrLen(SearchString)] = CHAR_NULL; 534 710 } 535 711 } 536 } else {537 ASSERT(FullPath == NULL);538 StrnCatGrow(&FullPath, NULL, L"*", 0);539 712 } 540 713 Status = gRT->GetTime(&TheTime, NULL); … … 544 717 } 545 718 546 SfoMode = ShellCommandLineGetFlag(Package, L"-sfo");547 719 if (ShellStatus == SHELL_SUCCESS) { 548 720 ShellStatus = PrintLsOutput( 549 721 ShellCommandLineGetFlag(Package, L"-r"), 550 722 RequiredAttributes, 551 S foMode,723 ShellCommandLineGetFlag(Package, L"-sfo"), 552 724 FullPath, 553 TRUE, 725 SearchString, 726 NULL, 554 727 Count, 555 728 (INT16)(TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:TheTime.TimeZone) 556 729 ); 557 730 if (ShellStatus == SHELL_NOT_FOUND) { 558 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_ GEN_NO_FILES), gShellLevel2HiiHandle);731 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LS_FILE_NOT_FOUND), gShellLevel2HiiHandle); 559 732 } else if (ShellStatus == SHELL_INVALID_PARAMETER) { 560 733 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle); 734 } else if (ShellStatus == SHELL_ABORTED) { 735 // 736 // Ignore aborting. 737 // 561 738 } else if (ShellStatus != SHELL_SUCCESS) { 562 739 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellLevel2HiiHandle); … … 567 744 } 568 745 569 if (FullPath != NULL) { 570 FreePool(FullPath); 571 } 572 // 573 // free the command line package 574 // 746 // 747 // Free memory allocated 748 // 749 SHELL_FREE_NON_NULL(SearchString); 750 SHELL_FREE_NON_NULL(FullPath); 575 751 ShellCommandLineFreeVarList (Package); 576 752 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c
r48674 r58459 2 2 Main file for map shell level 2 command. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 119 120 120 121 /** 121 Add mappings for any devices without one. Do not change any existing maps.122 123 @retval EFI_SUCCESS The operation was successful.124 **/125 EFI_STATUS126 EFIAPI127 UpdateMapping (128 VOID129 )130 {131 EFI_STATUS Status;132 EFI_HANDLE *HandleList;133 UINTN Count;134 EFI_DEVICE_PATH_PROTOCOL **DevicePathList;135 CHAR16 *NewDefaultName;136 CHAR16 *NewConsistName;137 EFI_DEVICE_PATH_PROTOCOL **ConsistMappingTable;138 139 HandleList = NULL;140 Status = EFI_SUCCESS;141 142 //143 // remove mappings that represent removed devices.144 //145 146 //147 // Find each handle with Simple File System148 //149 HandleList = GetHandleListByProtocol(&gEfiSimpleFileSystemProtocolGuid);150 if (HandleList != NULL) {151 //152 // Do a count of the handles153 //154 for (Count = 0 ; HandleList[Count] != NULL ; Count++);155 156 //157 // Get all Device Paths158 //159 DevicePathList = AllocateZeroPool(sizeof(EFI_DEVICE_PATH_PROTOCOL*) * Count);160 ASSERT(DevicePathList != NULL);161 162 for (Count = 0 ; HandleList[Count] != NULL ; Count++) {163 DevicePathList[Count] = DevicePathFromHandle(HandleList[Count]);164 }165 166 //167 // Sort all DevicePaths168 //169 PerformQuickSort(DevicePathList, Count, sizeof(EFI_DEVICE_PATH_PROTOCOL*), DevicePathCompare);170 171 ShellCommandConsistMappingInitialize(&ConsistMappingTable);172 173 //174 // Assign new Mappings to remainders175 //176 for (Count = 0 ; HandleList[Count] != NULL && !EFI_ERROR(Status); Count++) {177 //178 // Skip ones that already have179 //180 if (gEfiShellProtocol->GetMapFromDevicePath(&DevicePathList[Count]) != NULL) {181 continue;182 }183 //184 // Get default name185 //186 NewDefaultName = ShellCommandCreateNewMappingName(MappingTypeFileSystem);187 ASSERT(NewDefaultName != NULL);188 189 //190 // Call shell protocol SetMap function now...191 //192 Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewDefaultName);193 194 if (!EFI_ERROR(Status)) {195 //196 // Now do consistent name197 //198 NewConsistName = ShellCommandConsistMappingGenMappingName(DevicePathList[Count], ConsistMappingTable);199 if (NewConsistName != NULL) {200 Status = gEfiShellProtocol->SetMap(DevicePathList[Count], NewConsistName);201 FreePool(NewConsistName);202 }203 }204 205 FreePool(NewDefaultName);206 }207 ShellCommandConsistMappingUnInitialize(ConsistMappingTable);208 SHELL_FREE_NON_NULL(HandleList);209 SHELL_FREE_NON_NULL(DevicePathList);210 211 HandleList = NULL;212 } else {213 Count = (UINTN)-1;214 }215 //216 // Do it all over again for gEfiBlockIoProtocolGuid217 //218 219 return (Status);220 }221 222 /**223 122 Determine what type of device is represented and return it's string. The 224 123 string is in allocated memory and must be callee freed. The HII is is listed below. … … 330 229 // 331 230 if (Specific != NULL) { 332 NewSpecific = Allocate ZeroPool(StrSize(Specific) + sizeof(CHAR16));231 NewSpecific = AllocateCopyPool(StrSize(Specific) + sizeof(CHAR16), Specific); 333 232 if (NewSpecific == NULL){ 334 233 return FALSE; 335 234 } 336 StrCpy(NewSpecific, Specific);337 235 if (NewSpecific[StrLen(NewSpecific)-1] != L':') { 338 Str Cat(NewSpecific, L":");236 StrnCat(NewSpecific, L":", 2); 339 237 } 340 238 … … 346 244 } 347 245 if ( Consist 246 && Specific == NULL 348 247 && (SearchList(MapList, L"HD*", NULL, TRUE, TRUE, L";") 349 248 ||SearchList(MapList, L"CD*", NULL, TRUE, TRUE, L";") … … 354 253 355 254 if ( Normal 255 && Specific == NULL 356 256 && (SearchList(MapList, L"FS", NULL, FALSE, TRUE, L";") 357 257 ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){ … … 398 298 CHAR16 *DevPathString; 399 299 CHAR16 *TempSpot; 300 CHAR16 *Alias; 400 301 UINTN TempLen; 401 302 BOOLEAN Removable; 402 303 CONST CHAR16 *TempSpot2; 403 304 305 Alias = NULL; 306 TempSpot2 = NULL; 307 CurrentName = NULL; 404 308 DevPath = DevicePathFromHandle(Handle); 405 309 DevPathCopy = DevPath; … … 413 317 } 414 318 415 CurrentName = NULL; 416 CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0); 417 if (CurrentName == NULL) { 418 return (EFI_OUT_OF_RESOURCES); 419 } 420 TempSpot = StrStr(CurrentName, L";"); 421 if (TempSpot != NULL) { 422 *TempSpot = CHAR_NULL; 423 } 424 DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE); 319 if (Normal || !Consist) { 320 // 321 // need the Normal here since people can use both on command line. otherwise unused. 322 // 323 324 // 325 // Allocate a name 326 // 327 CurrentName = NULL; 328 CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0); 329 if (CurrentName == NULL) { 330 return (EFI_OUT_OF_RESOURCES); 331 } 332 333 // 334 // Chop off the other names that become "Alias(s)" 335 // leaving just the normal name 336 // 337 TempSpot = StrStr(CurrentName, L";"); 338 if (TempSpot != NULL) { 339 *TempSpot = CHAR_NULL; 340 } 341 } else { 342 CurrentName = NULL; 343 344 // 345 // Skip the first name. This is the standard name. 346 // 347 TempSpot = StrStr(MapList, L";"); 348 if (TempSpot != NULL) { 349 TempSpot++; 350 } 351 SearchList(TempSpot, L"HD*", &CurrentName, TRUE, FALSE, L";"); 352 if (CurrentName == NULL) { 353 SearchList(TempSpot, L"CD*", &CurrentName, TRUE, FALSE, L";"); 354 } 355 if (CurrentName == NULL) { 356 SearchList(TempSpot, L"FP*", &CurrentName, TRUE, FALSE, L";"); 357 } 358 if (CurrentName == NULL) { 359 SearchList(TempSpot, L"F*", &CurrentName, TRUE, FALSE, L";"); 360 } 361 if (CurrentName == NULL) { 362 // 363 // We didnt find anything, so just the first one in the list... 364 // 365 CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0); 366 if (CurrentName == NULL) { 367 return (EFI_OUT_OF_RESOURCES); 368 } 369 TempSpot = StrStr(CurrentName, L";"); 370 if (TempSpot != NULL) { 371 *TempSpot = CHAR_NULL; 372 } 373 } else { 374 Alias = StrnCatGrow(&Alias, 0, MapList, 0); 375 if (Alias == NULL) { 376 return EFI_OUT_OF_RESOURCES; 377 } 378 TempSpot = StrStr(Alias, CurrentName); 379 if (TempSpot != NULL) { 380 TempSpot2 = StrStr(TempSpot, L";"); 381 if (TempSpot2 != NULL) { 382 TempSpot2++; // Move past ";" from CurrentName 383 CopyMem(TempSpot, TempSpot2, StrSize(TempSpot2)); 384 } else { 385 *TempSpot = CHAR_NULL; 386 } 387 } 388 if (Alias[StrLen(Alias)-1] == L';') { 389 Alias[StrLen(Alias)-1] = CHAR_NULL; 390 } 391 } 392 } 393 DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE); 394 TempLen = StrLen(CurrentName); 425 395 if (!SFO) { 426 TempLen = StrLen(CurrentName);427 396 ShellPrintHiiEx ( 428 397 -1, … … 432 401 gShellLevel2HiiHandle, 433 402 CurrentName, 434 TempLen < StrLen(MapList)?MapList + TempLen+1:L"",403 Alias!=NULL?Alias:(TempLen < StrLen(MapList)?MapList + TempLen+1:L""), 435 404 DevPathString 436 405 ); … … 455 424 ); 456 425 } 457 FreePool(MediaType);426 SHELL_FREE_NON_NULL(MediaType); 458 427 } 459 428 } else { 460 TempLen = StrLen(CurrentName);461 429 ShellPrintHiiEx ( 462 430 -1, … … 467 435 CurrentName, 468 436 DevPathString, 469 TempLen < StrLen(MapList)?MapList + TempLen+1:L""437 Consist?L"":(TempLen < StrLen(MapList)?MapList + TempLen+1:L"") 470 438 ); 471 439 } 472 FreePool(DevPathString); 473 FreePool(CurrentName); 440 SHELL_FREE_NON_NULL(DevPathString); 441 SHELL_FREE_NON_NULL(CurrentName); 442 SHELL_FREE_NON_NULL(Alias); 474 443 return EFI_SUCCESS; 475 444 } … … 908 877 CHAR16 *NewSName; 909 878 910 NewSName = Allocate ZeroPool(StrSize(SName) + sizeof(CHAR16));879 NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName); 911 880 if (NewSName == NULL) { 912 881 return (SHELL_OUT_OF_RESOURCES); 913 882 } 914 StrCpy(NewSName, SName);915 883 if (NewSName[StrLen(NewSName)-1] != L':') { 916 Str Cat(NewSName, L":");884 StrnCat(NewSName, L":", 2); 917 885 } 918 886 … … 961 929 CHAR16 *NewSName; 962 930 963 NewSName = Allocate ZeroPool(StrSize(SName) + sizeof(CHAR16));931 NewSName = AllocateCopyPool(StrSize(SName) + sizeof(CHAR16), SName); 964 932 if (NewSName == NULL) { 965 933 return (SHELL_OUT_OF_RESOURCES); 966 934 } 967 StrCpy(NewSName, SName);968 935 if (NewSName[StrLen(NewSName)-1] != L':') { 969 Str Cat(NewSName, L":");936 StrnCat(NewSName, L":", 2); 970 937 } 971 938 … … 1026 993 CONST CHAR16 *Mapping; 1027 994 EFI_HANDLE MapAsHandle; 1028 CONST EFI_DEVICE_PATH_PROTOCOL *DevPath;1029 995 SHELL_STATUS ShellStatus; 1030 996 BOOLEAN SfoMode; … … 1038 1004 Mapping = NULL; 1039 1005 SName = NULL; 1040 DevPath = NULL;1041 1006 ShellStatus = SHELL_SUCCESS; 1042 1007 MapAsHandle = NULL; … … 1094 1059 Status = PerformMappingDelete(SName); 1095 1060 if (EFI_ERROR(Status)) { 1096 switch (Status) { 1097 case EFI_ACCESS_DENIED: 1098 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle); 1099 ShellStatus = SHELL_ACCESS_DENIED; 1100 break; 1101 case EFI_NOT_FOUND: 1102 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, SName); 1103 ShellStatus = SHELL_INVALID_PARAMETER; 1104 break; 1105 default: 1106 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status); 1107 ShellStatus = SHELL_UNSUPPORTED; 1061 if (Status == EFI_ACCESS_DENIED) { 1062 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle); 1063 ShellStatus = SHELL_ACCESS_DENIED; 1064 } else if (Status == EFI_NOT_FOUND) { 1065 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, SName); 1066 ShellStatus = SHELL_INVALID_PARAMETER; 1067 } else { 1068 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status); 1069 ShellStatus = SHELL_UNSUPPORTED; 1108 1070 } 1109 1071 } … … 1134 1096 // Do the Update 1135 1097 // 1136 Status = UpdateMapping();1098 Status = ShellCommandUpdateMapping (); 1137 1099 if (EFI_ERROR(Status)) { 1138 1100 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Mv.c
r48674 r58459 2 2 Main file for mv shell level 2 function. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 29 30 @param DestPath [in] The target location to move to 30 31 @param Attribute[in] The Attribute of the file 32 @param FileStatus[in] The Status of the file when opened 31 33 32 34 @retval TRUE The move is valid … … 36 38 EFIAPI 37 39 IsValidMove( 38 IN CONST CHAR16 *FullName, 39 IN CONST CHAR16 *Cwd, 40 IN CONST CHAR16 *DestPath, 41 IN CONST UINT64 Attribute 40 IN CONST CHAR16 *FullName, 41 IN CONST CHAR16 *Cwd, 42 IN CONST CHAR16 *DestPath, 43 IN CONST UINT64 Attribute, 44 IN CONST EFI_STATUS FileStatus 42 45 ) 43 46 { … … 87 90 return (FALSE); 88 91 } 89 if (( Attribute & EFI_FILE_READ_ONLY) != 0) {92 if (((Attribute & EFI_FILE_READ_ONLY) != 0) || (FileStatus == EFI_WRITE_PROTECTED)) { 90 93 // 91 94 // invalid to move read only 92 95 // 93 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_RO), gShellLevel2HiiHandle );96 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MV_INV_RO), gShellLevel2HiiHandle, FullName); 94 97 return (FALSE); 95 98 } … … 136 139 EFI_SHELL_FILE_INFO *DestList; 137 140 EFI_SHELL_FILE_INFO *Node; 138 EFI_STATUS Status;139 141 CHAR16 *DestPath; 140 CHAR16 *TempLocation;141 142 UINTN NewSize; 143 UINTN CurrentSize; 142 144 143 145 DestList = NULL; … … 154 156 StrCpy(DestPath, Cwd); 155 157 while (PathRemoveLastItem(DestPath)) ; 158 159 // 160 // Append DestDir beyond '\' which may be present 161 // 162 CurrentSize = StrSize(DestPath); 163 StrnCatGrow(&DestPath, &CurrentSize, &DestDir[1], 0); 164 156 165 *DestPathPointer = DestPath; 157 166 return (SHELL_SUCCESS); … … 160 169 // get the destination path 161 170 // 162 S tatus = ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList);171 ShellOpenFileMetaArg((CHAR16*)DestDir, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ|EFI_FILE_MODE_CREATE, &DestList); 163 172 if (DestList == NULL || IsListEmpty(&DestList->Link)) { 164 173 // 165 174 // Not existing... must be renaming 166 175 // 167 if ( (TempLocation = StrStr(DestDir, L":")) == NULL) {176 if (StrStr(DestDir, L":") == NULL) { 168 177 if (Cwd == NULL) { 169 178 ShellCloseFileMetaArg(&DestList); … … 262 271 VOID *Response; 263 272 SHELL_FILE_HANDLE DestHandle; 273 CHAR16 *CleanFilePathStr; 264 274 265 275 ASSERT(FileList != NULL); 266 276 ASSERT(DestDir != NULL); 267 277 268 DestPath = NULL; 269 Cwd = ShellGetCurrentDir(NULL); 270 Response = *Resp; 278 DestPath = NULL; 279 Cwd = ShellGetCurrentDir(NULL); 280 Response = *Resp; 281 CleanFilePathStr = NULL; 282 283 Status = ShellLevel2StripQuotes (DestDir, &CleanFilePathStr); 284 if (EFI_ERROR (Status)) { 285 if (Status == EFI_OUT_OF_RESOURCES) { 286 return SHELL_OUT_OF_RESOURCES; 287 } else { 288 return SHELL_INVALID_PARAMETER; 289 } 290 } 291 292 ASSERT (CleanFilePathStr != NULL); 271 293 272 294 // 273 295 // Get and validate the destination location 274 296 // 275 ShellStatus = GetDestinationLocation(DestDir, &DestPath, Cwd); 297 ShellStatus = GetDestinationLocation(CleanFilePathStr, &DestPath, Cwd); 298 FreePool (CleanFilePathStr); 276 299 if (ShellStatus != SHELL_SUCCESS) { 277 300 return (ShellStatus); … … 284 307 ASSERT (HiiResultOk != NULL); 285 308 ASSERT (HiiOutput != NULL); 286 // ASSERT (Cwd != NULL);287 309 288 310 // … … 296 318 break; 297 319 } 320 321 // 322 // These should never be NULL 323 // 298 324 ASSERT(Node->FileName != NULL); 299 325 ASSERT(Node->FullName != NULL); 326 ASSERT(Node->Info != NULL); 300 327 301 328 // … … 309 336 // Validate that the move is valid 310 337 // 311 if (!IsValidMove(Node->FullName, Cwd, DestPath, Node->Info->Attribute )) {338 if (!IsValidMove(Node->FullName, Cwd, DestPath, Node->Info->Attribute, Node->Status)) { 312 339 ShellStatus = SHELL_INVALID_PARAMETER; 313 340 continue; … … 406 433 if (EFI_ERROR(Status)) { 407 434 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status); 408 // 409 // move failed 410 // 411 switch(Status){ 412 default: 413 ShellStatus = SHELL_INVALID_PARAMETER; 414 case EFI_SECURITY_VIOLATION: 415 ShellStatus = SHELL_SECURITY_VIOLATION; 416 case EFI_WRITE_PROTECTED: 417 ShellStatus = SHELL_WRITE_PROTECTED; 418 case EFI_OUT_OF_RESOURCES: 419 ShellStatus = SHELL_OUT_OF_RESOURCES; 420 case EFI_DEVICE_ERROR: 421 ShellStatus = SHELL_DEVICE_ERROR; 422 case EFI_ACCESS_DENIED: 423 ShellStatus = SHELL_ACCESS_DENIED; 424 } // switch 435 ShellStatus = SHELL_INVALID_PARAMETER; 436 if (Status == EFI_SECURITY_VIOLATION) { 437 ShellStatus = SHELL_SECURITY_VIOLATION; 438 } else if (Status == EFI_WRITE_PROTECTED) { 439 ShellStatus = SHELL_WRITE_PROTECTED; 440 } else if (Status == EFI_OUT_OF_RESOURCES) { 441 ShellStatus = SHELL_OUT_OF_RESOURCES; 442 } else if (Status == EFI_DEVICE_ERROR) { 443 ShellStatus = SHELL_DEVICE_ERROR; 444 } else if (Status == EFI_ACCESS_DENIED) { 445 ShellStatus = SHELL_ACCESS_DENIED; 446 } 425 447 } else { 426 448 ShellPrintEx(-1, -1, L"%s", HiiResultOk); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Parse.c
r48674 r58459 2 2 Main file for Parse shell level 2 function. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 4 (C) Copyright 2013-2014, Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 57 58 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_FILE_OPEN_FAIL), gShellLevel2HiiHandle, FileName); 58 59 ShellStatus = SHELL_NOT_FOUND; 60 } else if (!EFI_ERROR (FileHandleIsDirectory (FileHandle))) { 61 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_NOT_FILE), gShellLevel2HiiHandle, FileName); 62 ShellStatus = SHELL_NOT_FOUND; 59 63 } else { 60 64 for (LoopVariable = 0 ; LoopVariable < ShellCommandInstance && !ShellFileHandleEof(FileHandle);) { … … 63 67 break; 64 68 } 65 if (StrStr(TempLine, L"ShellCommand, \"") == TempLine) { 69 70 // 71 // Search for "ShellCommand," in the file to start the SFO table 72 // for a given ShellCommand. The UEFI Shell spec does not specify 73 // a space after the comma. 74 // 75 if (StrStr (TempLine, L"ShellCommand,") == TempLine) { 66 76 LoopVariable++; 67 77 } … … 72 82 while(1) { 73 83 TempLine = ShellFileHandleReturnLine(FileHandle, &Ascii); 74 if ( TempLine == NULL 75 || *TempLine == CHAR_NULL 76 || StrStr(TempLine, L"ShellCommand, \"") == TempLine 77 ){ 84 if (TempLine == NULL 85 || *TempLine == CHAR_NULL 86 || StrStr (TempLine, L"ShellCommand,") == TempLine) { 78 87 SHELL_FREE_NON_NULL(TempLine); 79 88 break; 80 89 } 81 if (StrStr (TempLine, TableName) == TempLine) {90 if (StrStr (TempLine, TableName) == TempLine) { 82 91 LoopVariable++; 83 } 84 if ( LoopVariable == TableNameInstance 85 || (TableNameInstance == (UINTN)-1 && StrStr(TempLine, TableName) == TempLine) 86 ){ 87 for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) { 88 ColumnPointer = StrStr(ColumnPointer, L","); 89 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){ 90 ColumnPointer++; 92 if (LoopVariable == TableNameInstance 93 || (TableNameInstance == (UINTN)-1)) { 94 for (ColumnLoop = 1, ColumnPointer = TempLine; ColumnLoop < ColumnIndex && ColumnPointer != NULL && *ColumnPointer != CHAR_NULL; ColumnLoop++) { 95 ColumnPointer = StrStr (ColumnPointer, L","); 96 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL){ 97 ColumnPointer++; 98 } 91 99 } 92 } 93 if (ColumnLoop == ColumnIndex) { 94 ASSERT(ColumnPointer != NULL); 95 TempSpot = StrStr(ColumnPointer, L","); 96 if (TempSpot != NULL) { 97 *TempSpot = CHAR_NULL; 100 if (ColumnLoop == ColumnIndex) { 101 if (ColumnPointer == NULL) { 102 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"Column Index"); 103 ShellStatus = SHELL_INVALID_PARAMETER; 104 } else { 105 TempSpot = StrStr (ColumnPointer, L","); 106 if (TempSpot != NULL) { 107 *TempSpot = CHAR_NULL; 108 } 109 while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){ 110 ColumnPointer++; 111 } 112 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){ 113 ColumnPointer++; 114 } 115 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen (ColumnPointer) - 1] == L'\"'){ 116 ColumnPointer[StrLen (ColumnPointer) - 1] = CHAR_NULL; 117 } 118 119 ShellPrintEx (-1, -1, L"%s\r\n", ColumnPointer); 120 } 98 121 } 99 while (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L' '){100 ColumnPointer++;101 }102 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[0] == L'\"'){103 ColumnPointer++;104 }105 if (ColumnPointer != NULL && *ColumnPointer != CHAR_NULL && ColumnPointer[StrLen(ColumnPointer)-1] == L'\"'){106 ColumnPointer[StrLen(ColumnPointer)-1] = CHAR_NULL;107 }108 109 ShellPrintEx(-1, -1, L"%s\r\n", ColumnPointer);110 122 } 111 123 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Reset.c
r48674 r58459 2 2 Main file for attrib shell level 2 function. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 82 82 String = ShellCommandLineGetValue(Package, L"-w"); 83 83 if (String != NULL) { 84 gRT->ResetSystem(EfiReset Cold, EFI_SUCCESS, StrSize(String), (VOID*)String);84 gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, StrSize(String), (VOID*)String); 85 85 } else { 86 gRT->ResetSystem(EfiReset Cold, EFI_SUCCESS, 0, NULL);86 gRT->ResetSystem(EfiResetWarm, EFI_SUCCESS, 0, NULL); 87 87 } 88 88 } … … 106 106 String = ShellCommandLineGetValue(Package, L"-c"); 107 107 if (String != NULL) { 108 gRT->ResetSystem(EfiReset Warm, EFI_SUCCESS, StrSize(String), (VOID*)String);108 gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, StrSize(String), (VOID*)String); 109 109 } else { 110 gRT->ResetSystem(EfiReset Warm, EFI_SUCCESS, 0, NULL);110 gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); 111 111 } 112 112 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
r48674 r58459 2 2 Main file for attrib shell level 2 function. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 34 34 ) 35 35 { 36 EFI_STATUS Status;37 36 EFI_FILE_INFO *FileInfo; 38 37 BOOLEAN NoFile; … … 41 40 RetVal = TRUE; 42 41 NoFile = FALSE; 43 44 for (Status = FileHandleFindFirstFile(FileHandle, &FileInfo) 42 FileInfo = NULL; 43 44 for (FileHandleFindFirstFile(FileHandle, &FileInfo) 45 45 ; !NoFile 46 ; Status =FileHandleFindNextFile(FileHandle, FileInfo, &NoFile)46 ; FileHandleFindNextFile(FileHandle, FileInfo, &NoFile) 47 47 ){ 48 48 if (StrStr(FileInfo->FileName, L".") != FileInfo->FileName … … 77 77 EFI_STATUS Status; 78 78 SHELL_PROMPT_RESPONSE *Resp; 79 CHAR16 *TempName; 80 UINTN NewSize; 79 81 80 82 Resp = NULL; … … 93 95 Status = ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN(STR_RM_LOG_DELETE_CONF), gShellLevel2HiiHandle, Node->FullName); 94 96 Status = ShellPromptForResponse(ShellPromptResponseTypeYesNo, NULL, (VOID**)&Resp); 95 ASSERT_EFI_ERROR(Status);96 97 ASSERT(Resp != NULL); 97 98 if (EFI_ERROR(Status) || *Resp != ShellPromptResponseYes) { … … 122 123 } 123 124 Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE); 124 ShellStatus = CascadeDelete(Node2, Quiet); 125 if (EFI_ERROR(Node2->Status) && StrStr(Node2->FileName, L":") == NULL) { 126 // 127 // Update the node filename to have full path with file system identifier 128 // 129 NewSize = StrSize(Node->FullName) + StrSize(Node2->FullName); 130 TempName = AllocateZeroPool(NewSize); 131 if (TempName == NULL) { 132 ShellStatus = SHELL_OUT_OF_RESOURCES; 133 } else { 134 StrnCpy(TempName, Node->FullName, NewSize/sizeof(CHAR16) -1); 135 TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL; 136 StrnCat(TempName, Node2->FullName, NewSize/sizeof(CHAR16) -1 - StrLen(TempName)); 137 FreePool((VOID*)Node2->FullName); 138 Node2->FullName = TempName; 139 140 // 141 // Now try again to open the file 142 // 143 Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE); 144 } 145 } 146 if (!EFI_ERROR(Node2->Status)) { 147 ShellStatus = CascadeDelete(Node2, Quiet); 148 } else if (ShellStatus == SHELL_SUCCESS) { 149 ShellStatus = (SHELL_STATUS)(Node2->Status&(~0x80000000)); 150 } 125 151 if (ShellStatus != SHELL_SUCCESS) { 126 152 if (List!=NULL) { … … 140 166 // now delete the current node... 141 167 // 142 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE), gShellLevel2HiiHandle, Node->FullName); 168 if (!Quiet) { 169 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE), gShellLevel2HiiHandle, Node->FullName); 170 } 143 171 Status = gEfiShellProtocol->DeleteFile(Node->Handle); 144 172 Node->Handle = NULL; … … 152 180 return (SHELL_ACCESS_DENIED); 153 181 } else { 154 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_COMP), gShellLevel2HiiHandle); 182 if (!Quiet) { 183 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_RM_LOG_DELETE_COMP), gShellLevel2HiiHandle); 184 } 155 185 return (SHELL_SUCCESS); 156 186 } … … 158 188 159 189 /** 160 Determin s if a Node is a valid delete target. Will prevent deleting the root directory.190 Determines if a Node is a valid delete target. Will prevent deleting the root directory. 161 191 162 192 @param[in] List RESERVED. Not used. … … 203 233 Pattern = StrnCatGrow(&Pattern , NULL, TempLocation , 0); 204 234 SearchString = StrnCatGrow(&SearchString, &Size, Node->FullName, 0); 205 SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0); 235 if (!EFI_ERROR(ShellIsDirectory(SearchString))) { 236 SearchString = StrnCatGrow(&SearchString, &Size, L"\\", 0); 237 SearchString = StrnCatGrow(&SearchString, &Size, L"*", 0); 238 } 206 239 207 240 if (Pattern == NULL || SearchString == NULL) { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/TimeDate.c
r48674 r58459 2 2 Main file for time, timezone, and date shell level 2 and shell level 3 functions. 3 3 4 (C) Copyright 2012-2014, Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 222 223 // 223 224 Status = gRT->GetTime(&TheTime, NULL); 224 ASSERT_EFI_ERROR(Status); 225 if (EFI_ERROR(Status)) { 226 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 227 return (SHELL_DEVICE_ERROR); 228 } 225 229 226 230 // … … 228 232 // 229 233 if (ShellCommandLineGetFlag(Package, L"-sfo")) { 230 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DATE_SFO_FORMAT), gShellLevel2HiiHandle, TheTime.Month, TheTime.Day, TheTime.Year); 234 // 235 // Match UEFI Shell spec: 236 // ShellCommand,"date" 237 // Date,"DD","MM","YYYY" 238 // 239 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_SFO_HEADER), gShellLevel2HiiHandle, L"date"); 240 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_DATE_SFO_FORMAT), gShellLevel2HiiHandle, TheTime.Day, TheTime.Month, TheTime.Year); 231 241 } else { 232 242 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DATE_FORMAT), gShellLevel2HiiHandle, TheTime.Month, TheTime.Day, TheTime.Year); … … 313 323 314 324 Status = gRT->GetTime(&TheTime, NULL); 315 ASSERT_EFI_ERROR(Status); 325 if (EFI_ERROR(Status)) { 326 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 327 return (SHELL_DEVICE_ERROR); 328 } 316 329 317 330 if (TimeString != NULL) { … … 333 346 if (Walker2 != NULL && *Walker2 == L':') { 334 347 *Walker2 = CHAR_NULL; 348 TheTime.Second = (UINT8)0; 349 } 350 else if (Walker2 == NULL) { 351 TheTime.Second = (UINT8)0; 335 352 } 336 353 if (Walker1 != NULL && Walker1[0] != CHAR_NULL) { … … 338 355 if (Walker2 != NULL) { 339 356 Walker1 = Walker2 + 1; 357 if (Walker1 != NULL && Walker1[0] != CHAR_NULL) { 358 TheTime.Second = (UINT8)ShellStrToUintn (Walker1); 359 } 340 360 } 341 if (Walker1 != NULL && Walker1[0] != CHAR_NULL) {342 TheTime.Second = (UINT8)ShellStrToUintn (Walker1);343 }344 361 } 345 362 SHELL_FREE_NON_NULL(TimeStringCopy); … … 347 364 348 365 349 if ((Tz >= -1440 && Tz <= 1440)||(Tz == 0x7FF)) { 366 if (Tz >= -1440 && Tz <= 1440) { 367 // 368 // EFI_TIME TimeZone is stored to meet the following calculation (see UEFI Spec): 369 // Localtime = UTC - TimeZone 370 // This means the sign must be changed for the user provided Tz. 371 // EX: User wants to set TimeZone to Pacific Standard Time, so runs 372 // time -tz -480 # set to UTC-08:00 373 // To meet the calculation, the sign must be changed. 374 // 375 TheTime.TimeZone = -Tz; 376 } else if (Tz == EFI_UNSPECIFIED_TIMEZONE) { 350 377 TheTime.TimeZone = Tz; 351 378 } … … 379 406 EFI_STATUS Status; 380 407 LIST_ENTRY *Package; 381 CHAR16 *Message;382 408 EFI_TIME TheTime; 383 409 CHAR16 *ProblemParam; … … 388 414 UINTN TzMinutes; 389 415 416 // 417 // Initialize variables 418 // 390 419 ShellStatus = SHELL_SUCCESS; 391 420 ProblemParam = NULL; 392 393 //394 // Initialize variables395 //396 Message = NULL;397 421 398 422 // … … 424 448 // 425 449 Status = gRT->GetTime(&TheTime, NULL); 426 ASSERT_EFI_ERROR(Status); 450 if (EFI_ERROR(Status)) { 451 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 452 return (SHELL_DEVICE_ERROR); 453 } 454 427 455 if (ShellCommandLineGetFlag(Package, L"-?")) { 428 456 ASSERT(FALSE); … … 446 474 } 447 475 448 ShellPrintHiiEx ( 449 -1, 450 -1, 451 NULL, 452 STRING_TOKEN (STR_TIME_FORMAT), 453 gShellLevel2HiiHandle, 454 TheTime.Hour, 455 TheTime.Minute, 456 TheTime.Second, 457 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), 458 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, 459 TzMinutes 460 ); 461 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); 476 if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { 477 ShellPrintHiiEx ( 478 -1, 479 -1, 480 NULL, 481 STRING_TOKEN (STR_TIME_FORMAT), 482 gShellLevel2HiiHandle, 483 TheTime.Hour, 484 TheTime.Minute, 485 TheTime.Second, 486 (TheTime.TimeZone > 0?L"-":L"+"), 487 ((ABS(TheTime.TimeZone)) / 60), 488 TzMinutes 489 ); 490 } else { 491 ShellPrintHiiEx ( 492 -1, 493 -1, 494 NULL, 495 STRING_TOKEN (STR_TIME_FORMAT_LOCAL), 496 gShellLevel2HiiHandle, 497 TheTime.Hour, 498 TheTime.Minute, 499 TheTime.Second 500 ); 501 } 502 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel2HiiHandle); 462 503 } else if (ShellCommandLineGetFlag(Package, L"-d") && ShellCommandLineGetValue(Package, L"-d") == NULL) { 463 504 if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { 464 TzMinutes = 0; 505 ShellPrintHiiEx ( 506 -1, 507 -1, 508 NULL, 509 STRING_TOKEN (STR_TIME_FORMAT_LOCAL), 510 gShellLevel2HiiHandle, 511 TheTime.Hour, 512 TheTime.Minute, 513 TheTime.Second 514 ); 465 515 } else { 466 516 TzMinutes = (ABS(TheTime.TimeZone)) % 60; 467 } 468 469 ShellPrintHiiEx ( 470 -1, 471 -1, 472 NULL, 473 STRING_TOKEN (STR_TIME_FORMAT), 474 gShellLevel2HiiHandle, 475 TheTime.Hour, 476 TheTime.Minute, 477 TheTime.Second, 478 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?L" ":(TheTime.TimeZone > 0?L"-":L"+"), 479 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60, 480 TzMinutes 481 ); 517 ShellPrintHiiEx ( 518 -1, 519 -1, 520 NULL, 521 STRING_TOKEN (STR_TIME_FORMAT), 522 gShellLevel2HiiHandle, 523 TheTime.Hour, 524 TheTime.Minute, 525 TheTime.Second, 526 (TheTime.TimeZone > 0?L"-":L"+"), 527 ((ABS(TheTime.TimeZone)) / 60), 528 TzMinutes 529 ); 530 } 482 531 switch (TheTime.Daylight) { 483 532 case 0: … … 505 554 // 506 555 if ((TempLocation = ShellCommandLineGetValue(Package, L"-tz")) != NULL) { 507 if (TempLocation[0] == L'-') { 508 Tz = (INT16)(0 - ShellStrToUintn(++TempLocation)); 556 if (StrniCmp (TempLocation, L"_local", StrLen (TempLocation)) == NULL) { 557 Tz = EFI_UNSPECIFIED_TIMEZONE; 558 } else if (TempLocation[0] == L'-') { 559 560 Tz = (INT16) ShellStrToUintn (++TempLocation); 561 // 562 // When the argument of "time [-tz tz]" is not numeric, ShellStrToUintn() returns "-1". 563 // Here we can detect the argument error by checking the return of ShellStrToUintn(). 564 // 565 if (Tz == -1) { 566 Tz = 1441; //make it to be out of bounds value 567 } else { 568 Tz *= (-1); //sign convert 569 } 509 570 } else { 510 Tz = (INT16)ShellStrToUintn(TempLocation); 571 if (TempLocation[0] == L'+') { 572 Tz = (INT16)ShellStrToUintn (++TempLocation); 573 } else { 574 Tz = (INT16)ShellStrToUintn (TempLocation); 575 } 576 // 577 // Detect the return of ShellStrToUintn() to make sure the argument is valid. 578 // 579 if (Tz == -1) { 580 Tz = 1441; //make it to be out of bounds value 581 } 511 582 } 512 583 if (!(Tz >= -1440 && Tz <= 1440) && Tz != EFI_UNSPECIFIED_TIMEZONE) { … … 523 594 if (TempLocation != NULL) { 524 595 Daylight = (UINT8)ShellStrToUintn(TempLocation); 596 // 597 // The argument of "time [-d dl]" is unsigned, if the first character is '-', 598 // the argument is incorrect. That's because ShellStrToUintn() will skip past 599 // any '-' sign and convert what's next, forgetting the sign is here. 600 // 601 if (TempLocation[0] == '-') { 602 Daylight = 0xff; //make it invalid = will not use 603 } 525 604 if (Daylight != 0 && Daylight != 1 && Daylight != 3) { 526 605 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM_VAL), gShellLevel2HiiHandle, L"-d"); … … 608 687 {-720 , STRING_TOKEN (STR_TIMEZONE_P12)}, 609 688 {-780 , STRING_TOKEN (STR_TIMEZONE_P13)}, 610 {-840 , STRING_TOKEN (STR_TIMEZONE_P14)} 689 {-840 , STRING_TOKEN (STR_TIMEZONE_P14)}, 690 {EFI_UNSPECIFIED_TIMEZONE, STRING_TOKEN (STR_TIMEZONE_LOCAL)} 611 691 }; 612 692 … … 638 718 } 639 719 720 if (StrniCmp (TimeZoneString, L"_local", StrLen (TimeZoneString)) == NULL) { 721 Status = gRT->GetTime (&TheTime, NULL); 722 if (EFI_ERROR (Status)) { 723 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 724 return (SHELL_DEVICE_ERROR); 725 } 726 727 TheTime.TimeZone = EFI_UNSPECIFIED_TIMEZONE; 728 Status = gRT->SetTime (&TheTime); 729 if (!EFI_ERROR(Status)){ 730 return (SHELL_SUCCESS); 731 } 732 return (SHELL_INVALID_PARAMETER); 733 } 640 734 if (TimeZoneString != NULL && !InternalIsTimeLikeString(TimeZoneString, L':', 1, 1, TRUE)) { 641 735 return (SHELL_INVALID_PARAMETER); … … 644 738 Status = gRT->GetTime(&TheTime, NULL); 645 739 if (EFI_ERROR(Status)) { 740 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 646 741 return (SHELL_DEVICE_ERROR); 647 742 } … … 660 755 TheTime.TimeZone = (INT16)((ShellStrToUintn (++Walker)) * 60); 661 756 } else { 662 TheTime.TimeZone = (INT16)(( ShellStrToUintn (Walker)) * -60);757 TheTime.TimeZone = (INT16)((INT16)(ShellStrToUintn (Walker)) * -60); 663 758 } 664 759 if (Walker2 != NULL) { … … 789 884 // 790 885 Status = gRT->GetTime(&TheTime, NULL); 791 ASSERT_EFI_ERROR(Status); 886 if (EFI_ERROR(Status)) { 887 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_UEFI_FUNC_WARN), gShellLevel2HiiHandle, L"gRT->GetTime", Status); 888 return (SHELL_DEVICE_ERROR); 889 } 792 890 793 891 if (TheTime.TimeZone != EFI_UNSPECIFIED_TIMEZONE) { … … 807 905 // Print basic info only 808 906 // 809 if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { 810 TzMinutes = 0; 811 } else { 812 TzMinutes = (ABS(TheTime.TimeZone)) % 60; 813 } 907 TzMinutes = (ABS(TheTime.TimeZone)) % 60; 814 908 815 909 ShellPrintHiiEx ( … … 819 913 STRING_TOKEN(STR_TIMEZONE_SIMPLE), 820 914 gShellLevel2HiiHandle, 821 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"),822 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,915 (TheTime.TimeZone > 0?L"-":L"+"), 916 (ABS(TheTime.TimeZone)) / 60, 823 917 TzMinutes); 824 918 } … … 831 925 // Print basic info only 832 926 // 833 if (TheTime.TimeZone == EFI_UNSPECIFIED_TIMEZONE) { 834 TzMinutes = 0; 835 } else { 836 TzMinutes = (ABS(TheTime.TimeZone)) % 60; 837 } 927 TzMinutes = (ABS(TheTime.TimeZone)) % 60; 928 838 929 ShellPrintHiiEx ( 839 930 -1, … … 842 933 STRING_TOKEN(STR_TIMEZONE_SIMPLE), 843 934 gShellLevel2HiiHandle, 844 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(TheTime.TimeZone > 0?L"-":L"+"),845 TheTime.TimeZone==EFI_UNSPECIFIED_TIMEZONE?0:(ABS(TheTime.TimeZone)) / 60,935 (TheTime.TimeZone > 0?L"-":L"+"), 936 (ABS(TheTime.TimeZone)) / 60, 846 937 TzMinutes); 938 847 939 if (ShellCommandLineGetFlag(Package, L"-f")) { 848 940 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN(STR_TIMEZONE_NI), gShellLevel2HiiHandle); … … 851 943 } else { 852 944 // 853 // TimeZone was EFI_UNSPECIFIED_TIMEZONE ( unknown) from GetTime()945 // TimeZone was EFI_UNSPECIFIED_TIMEZONE (local) from GetTime() 854 946 // 947 if (ShellCommandLineGetFlag (Package, L"-f")) { 948 for ( LoopVar = 0 949 ; LoopVar < sizeof (TimeZoneList) / sizeof (TimeZoneList[0]) 950 ; LoopVar++ 951 ){ 952 if (TheTime.TimeZone == TimeZoneList[LoopVar].TimeZone) { 953 // 954 // Print all info about current time zone 955 // 956 ShellPrintHiiEx (-1, -1, NULL, TimeZoneList[LoopVar].StringId, gShellLevel2HiiHandle); 957 break; 958 } 959 } 960 } else { 961 // 962 // Print basic info only 963 // 964 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_TIMEZONE_SIMPLE_LOCAL), gShellLevel2HiiHandle); 965 } 855 966 } 856 967 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.c
r48674 r58459 22 22 * functions are non-interactive only 23 23 24 25 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>24 Copyright (c) 2014 Hewlett-Packard Development Company, L.P. 25 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR> 26 26 This program and the accompanying materials 27 27 are licensed and made available under the terms and conditions of the BSD License … … 94 94 ShellCommandRegisterCommandName(L"parse", ShellCommandRunParse , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_PARSE) ); 95 95 ShellCommandRegisterCommandName(L"reset", ShellCommandRunReset , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RESET) ); 96 ShellCommandRegisterCommandName(L"set", ShellCommandRunSet , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET) );96 ShellCommandRegisterCommandName(L"set", ShellCommandRunSet , ShellCommandGetManFileNameLevel2, 2, L"",FALSE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_SET) ); 97 97 ShellCommandRegisterCommandName(L"ls", ShellCommandRunLs , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_LS) ); 98 98 ShellCommandRegisterCommandName(L"rm", ShellCommandRunRm , ShellCommandGetManFileNameLevel2, 2, L"", TRUE, gShellLevel2HiiHandle, STRING_TOKEN(STR_GET_HELP_RM) ); … … 108 108 ShellCommandRegisterAlias(L"cd ..", L"cd.."); 109 109 ShellCommandRegisterAlias(L"cd \\", L"cd\\"); 110 ShellCommandRegisterAlias(L"ren", L"mv"); 110 ShellCommandRegisterAlias(L"mv", L"ren"); 111 ShellCommandRegisterAlias(L"mv", L"move"); 112 ShellCommandRegisterAlias(L"map", L"mount"); 111 113 // 112 114 // These are installed in level 2 or 3... … … 308 310 } 309 311 312 313 /** 314 Cleans off all the quotes in the string. 315 316 @param[in] OriginalString pointer to the string to be cleaned. 317 @param[out] CleanString The new string with all quotes removed. 318 Memory allocated in the function and free 319 by caller. 320 321 @retval EFI_SUCCESS The operation was successful. 322 **/ 323 EFI_STATUS 324 EFIAPI 325 ShellLevel2StripQuotes ( 326 IN CONST CHAR16 *OriginalString, 327 OUT CHAR16 **CleanString 328 ) 329 { 330 CHAR16 *Walker; 331 332 if (OriginalString == NULL || CleanString == NULL) { 333 return EFI_INVALID_PARAMETER; 334 } 335 336 *CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString); 337 if (*CleanString == NULL) { 338 return EFI_OUT_OF_RESOURCES; 339 } 340 341 for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { 342 if (*Walker == L'\"') { 343 CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); 344 } 345 } 346 347 return EFI_SUCCESS; 348 } 349 350 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.h
r48674 r58459 10 10 11 11 12 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>12 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR> 13 13 This program and the accompanying materials 14 14 are licensed and made available under the terms and conditions of the BSD License … … 34 34 #include <Protocol/LoadedImage.h> 35 35 #include <Protocol/UnicodeCollation.h> 36 #include <Protocol/DevicePathToText.h>37 36 38 37 #include <Library/BaseLib.h> … … 303 302 304 303 /** 304 Cleans off all the quotes in the string. 305 306 @param[in] OriginalString pointer to the string to be cleaned. 307 @param[out] CleanString The new string with all quotes removed. 308 Memory allocated in the function and free 309 by caller. 310 311 @retval EFI_SUCCESS The operation was successful. 312 **/ 313 EFI_STATUS 314 EFIAPI 315 ShellLevel2StripQuotes ( 316 IN CONST CHAR16 *OriginalString, 317 OUT CHAR16 **CleanString 318 ); 319 320 /** 305 321 Function for 'Vol' command. 306 322 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
r48674 r58459 2 2 # Provides shell level 2 functions 3 3 # 4 # Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 66 66 HandleParsingLib 67 67 PathLib 68 DevicePathLib 68 69 69 70 [Protocols] 70 gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED 71 gEfiShellProtocolGuid # ALWAYS_CONSUMED 72 gEfiShellParametersProtocolGuid # ALWAYS_CONSUMED 73 gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED 74 gEfiLoadedImageProtocolGuid # ALWAYS_CONSUMED 75 gEfiSimpleFileSystemProtocolGuid # ALWAYS_CONSUMED 76 gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED 71 gEfiUnicodeCollation2ProtocolGuid ## CONSUMES 72 gEfiShellProtocolGuid ## CONSUMES 73 gEfiShellParametersProtocolGuid ## CONSUMES 74 gEfiDevicePathProtocolGuid ## CONSUMES 75 gEfiLoadedImageProtocolGuid ## CONSUMES 76 gEfiSimpleFileSystemProtocolGuid ## CONSUMES 77 77 78 78 [Pcd.common] 79 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel # ALWAYS_CONSUMED80 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize # ALWAYS_CONSUMED79 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES 80 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## CONSUMES 81 81 82 82 [Guids] 83 gEfiFileSystemInfoGuid 84 gEfiFileInfoGuid 85 gShellLevel2HiiGuid 83 gEfiFileSystemInfoGuid ## CONSUMES ## GUID 84 gEfiFileInfoGuid ## UNDEFINED 85 gShellLevel2HiiGuid ## SOMETIMES_CONSUMES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel2CommandsLib/Vol.c
r48674 r58459 2 2 Main file for vol shell level 2 function. 3 3 4 Copyright (c) 2011 , Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 102 102 103 103 if (Delete) { 104 StrCpy ((CHAR16 *) SysInfo->VolumeLabel, L"");104 *((CHAR16 *) SysInfo->VolumeLabel) = CHAR_NULL; 105 105 SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize(SysInfo->VolumeLabel); 106 106 Status = EfiFpHandle->SetInfo( … … 120 120 } 121 121 if (SysInfo != NULL) { 122 Str Cpy ((CHAR16 *) SysInfo->VolumeLabel, Name);122 StrnCpy ((CHAR16 *) SysInfo->VolumeLabel, Name, (Size1 > Size2?Size1/sizeof(CHAR16):Size2/sizeof(CHAR16))-1); 123 123 SysInfo->Size = SIZE_OF_EFI_FILE_SYSTEM_INFO + Size1; 124 124 Status = EfiFpHandle->SetInfo( -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Alias.c
r48674 r58459 2 2 Main file for Alias shell level 3 function. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 91 91 CONST CHAR16 *Param1; 92 92 CONST CHAR16 *Param2; 93 CHAR16 *CleanParam2; 93 94 94 95 ProblemParam = NULL; 95 96 ShellStatus = SHELL_SUCCESS; 97 CleanParam2 = NULL; 96 98 97 99 // … … 119 121 Param1 = ShellCommandLineGetRawValue(Package, 1); 120 122 Param2 = ShellCommandLineGetRawValue(Package, 2); 123 124 if (Param2 != NULL) { 125 CleanParam2 = AllocateCopyPool (StrSize(Param2), Param2); 126 if (CleanParam2 == NULL) { 127 return SHELL_OUT_OF_RESOURCES; 128 } 129 130 if (CleanParam2[0] == L'\"' && CleanParam2[StrLen(CleanParam2)-1] == L'\"') { 131 CleanParam2[StrLen(CleanParam2)-1] = L'\0'; 132 CopyMem (CleanParam2, CleanParam2 + 1, StrSize(CleanParam2) - sizeof(CleanParam2[0])); 133 } 134 } 135 121 136 // 122 137 // check for "-?" … … 139 154 // must be adding an alias 140 155 // 141 Status = gEfiShellProtocol->SetAlias( Param2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v"));156 Status = gEfiShellProtocol->SetAlias(CleanParam2, Param1, FALSE, ShellCommandLineGetFlag(Package, L"-v")); 142 157 if (EFI_ERROR(Status)) { 143 158 if (Status == EFI_ACCESS_DENIED) { … … 162 177 } 163 178 179 SHELL_FREE_NON_NULL (CleanParam2); 164 180 return (ShellStatus); 165 181 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Cls.c
r48674 r58459 2 2 Main file for attrib shell level 2 function. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 30 30 EFI_STATUS Status; 31 31 LIST_ENTRY *Package; 32 CHAR16 *Message;33 32 UINTN Background; 34 33 UINTN ForeColor; … … 37 36 CONST CHAR16 *Param1; 38 37 38 // 39 // Initialize variables 40 // 39 41 ShellStatus = SHELL_SUCCESS; 40 42 ProblemParam = NULL; 41 43 Background = 0; 42 43 //44 // Initialize variables45 //46 Message = NULL;47 44 48 45 // … … 115 112 } 116 113 ForeColor = (~ShellStrToUintn(Param1)) & 0xF; 117 Status = gST->ConOut->SetAttribute (gST->ConOut, ForeColor | Background);114 Status = gST->ConOut->SetAttribute (gST->ConOut, (ForeColor | Background) & 0x7F ); 118 115 ASSERT_EFI_ERROR(Status); 119 116 Status = gST->ConOut->ClearScreen (gST->ConOut); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Echo.c
r48674 r58459 2 2 Main file for Echo shell level 3 function. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 41 41 UINTN ParamCount; 42 42 CHAR16 *ProblemParam; 43 UINTN Size; 44 CHAR16 *PrintString; 43 45 46 Size = 0; 44 47 ProblemParam = NULL; 48 PrintString = NULL; 45 49 ShellStatus = SHELL_SUCCESS; 46 50 … … 97 101 ; ParamCount++ 98 102 ) { 103 StrnCatGrow(&PrintString, &Size, ShellCommandLineGetRawValue(Package, ParamCount), 0); 99 104 if (ShellCommandLineGetRawValue(Package, ParamCount+1) != NULL) { 100 ShellPrintEx(-1, -1, L"%s ", ShellCommandLineGetRawValue(Package, ParamCount)); 101 } else { 102 ShellPrintEx(-1, -1, L"%s", ShellCommandLineGetRawValue(Package, ParamCount)); 103 } 105 StrnCatGrow(&PrintString, &Size, L" ", 0); 106 } 104 107 } 105 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CRLF), gShellLevel3HiiHandle); 108 ShellPrintEx(-1, -1, L"%s\r\n", PrintString); 109 SHELL_FREE_NON_NULL(PrintString); 106 110 } 107 111 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/GetMtc.c
r48674 r58459 2 2 Main file for GetMtc shell level 3 function. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 71 71 // 72 72 Status = gBS->GetNextMonotonicCount(&Mtc); 73 switch(Status) { 74 case EFI_DEVICE_ERROR: 75 ShellStatus = SHELL_DEVICE_ERROR; 76 break; 77 case EFI_SECURITY_VIOLATION: 78 ShellStatus = SHELL_SECURITY_VIOLATION; 79 break; 80 default: 81 if (EFI_ERROR(Status)) { 82 ShellStatus = SHELL_DEVICE_ERROR; 83 } 73 if (Status == EFI_DEVICE_ERROR) { 74 ShellStatus = SHELL_DEVICE_ERROR; 75 } else if (Status == EFI_SECURITY_VIOLATION) { 76 ShellStatus = SHELL_SECURITY_VIOLATION; 77 } else if (EFI_ERROR(Status)) { 78 ShellStatus = SHELL_DEVICE_ERROR; 84 79 } 85 80 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Help.c
r48674 r58459 2 2 Main file for Help shell level 3 function. 3 3 4 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR> 4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> 5 Copyright (c) 2014, ARM Limited. All rights reserved. <BR> 5 6 This program and the accompanying materials 6 7 are licensed and made available under the terms and conditions of the BSD License … … 16 17 17 18 #include <Library/ShellLib.h> 19 #include <Library/HandleParsingLib.h> 20 21 #include <Protocol/EfiShellDynamicCommand.h> 22 23 /** 24 Attempt to print help from a dynamically added command. 25 26 @param[in] CommandToGetHelpOn The unicode name of the command that help is 27 requested on. 28 @param[in] SectionToGetHelpOn Pointer to the section specifier(s). 29 @param[in] PrintCommandText Print the command followed by the help content 30 or just help. 31 32 @retval EFI_SUCCESS The help was displayed 33 @retval EFI_NOT_FOUND The command name could not be found 34 @retval EFI_DEVICE_ERROR The help data format was incorrect. 35 **/ 36 EFI_STATUS 37 EFIAPI 38 PrintDynamicCommandHelp( 39 IN CHAR16 *CommandToGetHelpOn, 40 IN CHAR16 *SectionToGetHelpOn, 41 IN BOOLEAN PrintCommandText 42 ) 43 { 44 EFI_STATUS Status; 45 BOOLEAN Found; 46 EFI_HANDLE *CommandHandleList; 47 EFI_HANDLE *NextCommand; 48 EFI_SHELL_DYNAMIC_COMMAND_PROTOCOL *DynamicCommand; 49 50 Status = EFI_NOT_FOUND; 51 Found = FALSE; 52 CommandHandleList = NULL; 53 54 CommandHandleList = GetHandleListByProtocol(&gEfiShellDynamicCommandProtocolGuid); 55 56 if (CommandHandleList == NULL) { 57 // 58 // not found or out of resources 59 // 60 return Status; 61 } 62 63 for (NextCommand = CommandHandleList; *NextCommand != NULL; NextCommand++) { 64 Status = gBS->HandleProtocol( 65 *NextCommand, 66 &gEfiShellDynamicCommandProtocolGuid, 67 (VOID **)&DynamicCommand 68 ); 69 70 if (EFI_ERROR(Status)) { 71 continue; 72 } 73 74 // 75 // Check execution break flag when printing multiple command help information. 76 // 77 if (ShellGetExecutionBreakFlag ()) { 78 break; 79 } 80 81 if ((gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, CommandToGetHelpOn)) || 82 (gEfiShellProtocol->GetAlias (CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)DynamicCommand->CommandName, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) { 83 // Print as Shell Help if in ManPage format. 84 Status = ShellPrintHelp (DynamicCommand->CommandName, SectionToGetHelpOn, 85 PrintCommandText); 86 if (Status == EFI_DEVICE_ERROR) { 87 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), 88 gShellLevel3HiiHandle, DynamicCommand->CommandName); 89 } else if (EFI_ERROR(Status)) { 90 ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), 91 gShellLevel3HiiHandle, DynamicCommand->CommandName); 92 } else { 93 Found = TRUE; 94 } 95 } 96 } 97 98 return (Found ? EFI_SUCCESS : Status); 99 100 } 18 101 19 102 STATIC CONST SHELL_PARAM_ITEM ParamList[] = { … … 42 125 CHAR16 *ProblemParam; 43 126 SHELL_STATUS ShellStatus; 44 CHAR16 *OutText;45 127 CONST COMMAND_LIST *CommandList; 46 128 CONST COMMAND_LIST *Node; … … 49 131 CHAR16 *HiiString; 50 132 BOOLEAN Found; 51 133 BOOLEAN PrintCommandText; 134 135 PrintCommandText = TRUE; 52 136 ProblemParam = NULL; 53 137 ShellStatus = SHELL_SUCCESS; 54 OutText = NULL;55 138 CommandToGetHelpOn = NULL; 56 139 SectionToGetHelpOn = NULL; … … 110 193 StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0); 111 194 } else { 195 PrintCommandText = FALSE; 112 196 ASSERT(SectionToGetHelpOn == NULL); 113 197 // … … 120 204 } else if (ShellCommandLineGetFlag(Package, L"-verbose") || ShellCommandLineGetFlag(Package, L"-v")) { 121 205 } else { 122 StrnCatGrow(&SectionToGetHelpOn, NULL, L"NAME", 0); 206 // 207 // The output of help <command> will display NAME, SYNOPSIS, OPTIONS, DESCRIPTION, and EXAMPLES sections. 208 // 209 StrnCatGrow (&SectionToGetHelpOn, NULL, L"NAME,SYNOPSIS,OPTIONS,DESCRIPTION,EXAMPLES", 0); 123 210 } 124 211 } … … 140 227 ; Node = (COMMAND_LIST*)GetNextNode(&CommandList->Link, &Node->Link) 141 228 ){ 229 // 230 // Checking execution break flag when print multiple command help information. 231 // 232 if (ShellGetExecutionBreakFlag ()) { 233 break; 234 } 142 235 if ((gUnicodeCollation->MetaiMatch(gUnicodeCollation, Node->CommandString, CommandToGetHelpOn)) || 143 236 (gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL) != NULL && (gUnicodeCollation->MetaiMatch(gUnicodeCollation, Node->CommandString, (CHAR16*)(gEfiShellProtocol->GetAlias(CommandToGetHelpOn, NULL)))))) { … … 145 238 // We have a command to look for help on. 146 239 // 147 Status = gEfiShellProtocol->GetHelpText(Node->CommandString, SectionToGetHelpOn, &OutText); 148 if (EFI_ERROR(Status) || OutText == NULL) { 149 if (Status == EFI_DEVICE_ERROR) { 240 Status = ShellPrintHelp(Node->CommandString, SectionToGetHelpOn, PrintCommandText); 241 if (Status == EFI_DEVICE_ERROR) { 150 242 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, Node->CommandString); 151 } else{243 } else if (EFI_ERROR(Status)) { 152 244 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, Node->CommandString); 153 }154 ShellStatus = SHELL_NOT_FOUND;155 245 } else { 156 while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') { 157 OutText[StrLen(OutText)-1] = CHAR_NULL; 158 } 159 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_COMMAND), gShellLevel3HiiHandle, Node->CommandString, OutText); 160 FreePool(OutText); 161 OutText = NULL; 162 Found = TRUE; 246 Found = TRUE; 163 247 } 164 248 } 165 249 } 166 } 167 168 if (!Found && ShellStatus == SHELL_SUCCESS) { 169 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn); 250 251 // 252 // now try to match against the dynamic command list and print help 253 // 254 Status = PrintDynamicCommandHelp (CommandToGetHelpOn, SectionToGetHelpOn, 255 PrintCommandText); 256 if (!EFI_ERROR(Status)) { 257 Found = TRUE; 258 } 259 260 // 261 // Search the .man file for Shell applications (Shell external commands). 262 // 263 if (!Found) { 264 Status = ShellPrintHelp(CommandToGetHelpOn, SectionToGetHelpOn, FALSE); 265 if (Status == EFI_DEVICE_ERROR) { 266 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_INV), gShellLevel3HiiHandle, CommandToGetHelpOn); 267 } else if (EFI_ERROR(Status)) { 268 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_NF), gShellLevel3HiiHandle, CommandToGetHelpOn); 269 } else { 270 Found = TRUE; 271 } 272 } 273 } 274 275 if (!Found) { 170 276 ShellStatus = SHELL_NOT_FOUND; 171 277 } … … 177 283 } 178 284 } 285 286 if (CommandToGetHelpOn != NULL && StrCmp(CommandToGetHelpOn, L"*") == 0){ 287 // 288 // If '*' then the command entered was 'Help' without qualifiers, This footer 289 // provides additional info on help switches 290 // 291 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_HELP_FOOTER), gShellLevel3HiiHandle); 292 } 179 293 if (CommandToGetHelpOn != NULL) { 180 294 FreePool(CommandToGetHelpOn); … … 186 300 return (ShellStatus); 187 301 } 188 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Pause.c
r48674 r58459 2 2 Main file for Pause shell level 3 function. 3 3 4 Copyright (c) 2009 - 201 0, Intel Corporation. All rights reserved. <BR>4 Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved. <BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 41 41 ProblemParam = NULL; 42 42 ShellStatus = SHELL_SUCCESS; 43 Resp = NULL; 43 44 44 45 // -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Touch.c
r48674 r58459 39 39 } 40 40 Status = gRT->GetTime(&FileInfo->ModificationTime, NULL); 41 ASSERT_EFI_ERROR(Status); 41 if (EFI_ERROR(Status)) { 42 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellLevel3HiiHandle, L"gRT->GetTime", Status); 43 return (SHELL_DEVICE_ERROR); 44 } 45 42 46 CopyMem(&FileInfo->LastAccessTime, &FileInfo->ModificationTime, sizeof(EFI_TIME)); 43 47 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Type.c
r48674 r58459 2 2 Main file for Type shell level 3 function. 3 3 4 Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR> 5 6 This program and the accompanying materials … … 32 33 EFIAPI 33 34 TypeFileByHandle ( 34 IN EFI_HANDLE Handle,35 BOOLEAN Ascii,36 BOOLEAN UCS235 IN SHELL_FILE_HANDLE Handle, 36 IN BOOLEAN Ascii, 37 IN BOOLEAN UCS2 37 38 ) 38 39 { 39 40 UINTN ReadSize; 40 41 VOID *Buffer; 42 VOID *AllocatedBuffer; 41 43 EFI_STATUS Status; 42 44 UINTN LoopVar; 45 UINTN LoopSize; 43 46 CHAR16 AsciiChar; 44 45 ReadSize = PcdGet16(PcdShellFileOperationSize); 46 Buffer = AllocateZeroPool(ReadSize); 47 if (Buffer == NULL) { 47 CHAR16 Ucs2Char; 48 49 ReadSize = PcdGet32(PcdShellFileOperationSize); 50 AllocatedBuffer = AllocateZeroPool(ReadSize); 51 if (AllocatedBuffer == NULL) { 48 52 return (EFI_OUT_OF_RESOURCES); 49 53 } … … 52 56 ASSERT_EFI_ERROR(Status); 53 57 54 while (ReadSize == ((UINTN)PcdGet16(PcdShellFileOperationSize))){ 58 while (ReadSize == ((UINTN)PcdGet32(PcdShellFileOperationSize))) { 59 Buffer = AllocatedBuffer; 55 60 ZeroMem(Buffer, ReadSize); 56 61 Status = ShellReadFile(Handle, &ReadSize, Buffer); … … 59 64 } 60 65 61 if (!(Ascii|UCS2)) {66 if (!(Ascii|UCS2)) { 62 67 if (*(UINT16*)Buffer == gUnicodeFileTag) { 63 68 UCS2 = TRUE; 64 Buffer = ((UINT16*)Buffer) + 1;65 69 } else { 66 70 Ascii = TRUE; … … 68 72 } 69 73 70 // 71 // We want to use plain Print function here! (no color support for files) 72 // 73 if (Ascii){ 74 for (LoopVar = 0 ; LoopVar < ReadSize ; LoopVar++) { 75 AsciiChar = CHAR_NULL; 76 AsciiChar = ((CHAR8*)Buffer)[LoopVar]; 77 if (AsciiChar == CHAR_NULL) { 78 AsciiChar = '.'; 79 } 80 Print(L"%c", AsciiChar); 74 if (Ascii) { 75 LoopSize = ReadSize; 76 for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) { 77 // 78 // The valid range of ASCII characters is 0x20-0x7E. 79 // Display "." when there is an invalid character. 80 // 81 AsciiChar = CHAR_NULL; 82 AsciiChar = ((CHAR8*)Buffer)[LoopVar]; 83 if (AsciiChar == '\r' || AsciiChar == '\n') { 84 // 85 // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD) 86 // characters to be displayed as is. 87 // 88 if (AsciiChar == '\n' && ((CHAR8*)Buffer)[LoopVar-1] != '\r') { 89 // 90 // In case Line Feed (0xA) is encountered & Carriage Return (0xD) 91 // was not the previous character, print CR and LF. This is because 92 // Shell 2.0 requires carriage return with line feed for displaying 93 // each new line from left. 94 // 95 ShellPrintEx (-1, -1, L"\r\n"); 96 continue; 97 } 98 } else { 99 // 100 // For all other characters which are not printable, display '.' 101 // 102 if (AsciiChar < 0x20 || AsciiChar >= 0x7F) { 103 AsciiChar = '.'; 104 } 105 } 106 ShellPrintEx (-1, -1, L"%c", AsciiChar); 81 107 } 82 108 } else { 83 Print(L"%s", Buffer); 109 if (*(UINT16*)Buffer == gUnicodeFileTag) { 110 // 111 // For unicode files, skip displaying the byte order marker. 112 // 113 Buffer = ((UINT16*)Buffer) + 1; 114 LoopSize = (ReadSize / (sizeof (CHAR16))) - 1; 115 } else { 116 LoopSize = ReadSize / (sizeof (CHAR16)); 117 } 118 119 for (LoopVar = 0 ; LoopVar < LoopSize ; LoopVar++) { 120 // 121 // An invalid range of characters is 0x0-0x1F. 122 // Display "." when there is an invalid character. 123 // 124 Ucs2Char = CHAR_NULL; 125 Ucs2Char = ((CHAR16*)Buffer)[LoopVar]; 126 if (Ucs2Char == '\r' || Ucs2Char == '\n') { 127 // 128 // Allow Line Feed (LF) (0xA) & Carriage Return (CR) (0xD) 129 // characters to be displayed as is. 130 // 131 if (Ucs2Char == '\n' && ((CHAR16*)Buffer)[LoopVar-1] != '\r') { 132 // 133 // In case Line Feed (0xA) is encountered & Carriage Return (0xD) 134 // was not the previous character, print CR and LF. This is because 135 // Shell 2.0 requires carriage return with line feed for displaying 136 // each new line from left. 137 // 138 ShellPrintEx (-1, -1, L"\r\n"); 139 continue; 140 } 141 } 142 else if (Ucs2Char < 0x20) { 143 // 144 // For all other characters which are not printable, display '.' 145 // 146 Ucs2Char = L'.'; 147 } 148 ShellPrintEx (-1, -1, L"%c", Ucs2Char); 149 } 150 } 151 152 if (ShellGetExecutionBreakFlag()) { 153 break; 84 154 } 85 155 } 86 Print(L"\r\n", Buffer); 156 FreePool (AllocatedBuffer); 157 ShellPrintEx (-1, -1, L"\r\n"); 87 158 return (Status); 88 159 } … … 197 268 ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link) 198 269 ){ 270 271 if (ShellGetExecutionBreakFlag()) { 272 break; 273 } 274 199 275 // 200 276 // make sure the file opened ok … … 218 294 // do it 219 295 // 220 Status = TypeFileByHandle (Node->Handle, AsciiMode, UnicodeMode);296 Status = TypeFileByHandle (Node->Handle, AsciiMode, UnicodeMode); 221 297 if (EFI_ERROR(Status)) { 222 298 ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_TYP_ERROR), gShellLevel3HiiHandle, Node->FileName, Status); -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.c
r48674 r58459 2 2 Main file for NULL named library for level 3 shell command functions. 3 3 4 Copyright (c) 2014, Hewlett-Packard Development Company, L.P.<BR> 4 5 Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved. <BR> 5 6 This program and the accompanying materials … … 76 77 ShellCommandRegisterCommandName(L"help", ShellCommandRunHelp , ShellCommandGetManFileNameLevel3, 3, L"", TRUE , gShellLevel3HiiHandle, STRING_TOKEN(STR_GET_HELP_HELP)); 77 78 79 ShellCommandRegisterAlias(L"type", L"cat"); 80 78 81 return (EFI_SUCCESS); 79 82 } -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.h
r48674 r58459 26 26 #include <Protocol/LoadedImage.h> 27 27 #include <Protocol/UnicodeCollation.h> 28 #include <Protocol/DevicePathToText.h>29 28 30 29 #include <Library/BaseLib.h> -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
r48674 r58459 3 3 # Note that the interactive versions of the time, date, and timezone functions are handled in the level 2 library. 4 4 # 5 # Copyright (c) 2009-2011, Intel Corporation. All rights reserved. <BR> 5 # Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 6 # Copyright (c) 2009-2015, Intel Corporation. All rights reserved. <BR> 6 7 # 7 8 # This program and the accompanying materials … … 60 61 HiiLib 61 62 FileHandleLib 63 HandleParsingLib 62 64 63 65 [Guids] 64 gEfiFileInfoGuid 65 gShellLevel3HiiGuid 66 gEfiFileInfoGuid ## UNDEFINED 67 gShellLevel3HiiGuid ## SOMETIMES_CONSUMES ## HII 66 68 67 69 [Pcd.common] 68 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel 69 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize 70 gEfiShellPkgTokenSpaceGuid.PcdShellSupportLevel ## CONSUMES 71 gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize ## SOMETIMES_CONSUMES 72 gEfiShellPkgTokenSpaceGuid.PcdShellSupplier ## SOMETIMES_CONSUMES 70 73 74 [Protocols] 75 gEfiShellDynamicCommandProtocolGuid ## SOMETIMES_CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLevel3CommandsLib/Ver.c
r48674 r58459 2 2 Main file for Ver shell level 3 function. 3 3 4 Copyright (c) 2013, Hewlett-Packard Development Company, L.P. 4 5 Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> 5 6 This program and the accompanying materials … … 115 116 -1, 116 117 NULL, 117 STRING_TOKEN (STR_VER_EXTRA_STRING), 118 gShellLevel3HiiHandle 118 STRING_TOKEN (STR_VER_OUTPUT_SUPPLIER), 119 gShellLevel3HiiHandle, 120 (CHAR16 *) PcdGetPtr (PcdShellSupplier) 119 121 ); 120 122 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLib/UefiShellLib.c
r48674 r58459 2 2 Provides interface to shell functionality for shell commands and applications. 3 3 4 Copyright (c) 2006 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR> 5 5 This program and the accompanying materials 6 6 are licensed and made available under the terms and conditions of the BSD License … … 487 487 EFI_FILE_PROTOCOL *Handle1; 488 488 EFI_FILE_PROTOCOL *Handle2; 489 CHAR16 *FnafPathName; 490 UINTN PathLen; 489 491 490 492 if (FilePath == NULL || FileHandle == NULL || DeviceHandle == NULL) { … … 553 555 554 556 // 557 // File Name Alignment Fix (FNAF) 558 // Handle2->Open may be incapable of handling a unaligned CHAR16 data. 559 // The structure pointed to by FilePath may be not CHAR16 aligned. 560 // This code copies the potentially unaligned PathName data from the 561 // FilePath structure to the aligned FnafPathName for use in the 562 // calls to Handl2->Open. 563 // 564 565 // 566 // Determine length of PathName, in bytes. 567 // 568 PathLen = DevicePathNodeLength (*FilePath) - SIZE_OF_FILEPATH_DEVICE_PATH; 569 570 // 571 // Allocate memory for the aligned copy of the string Extra allocation is to allow for forced alignment 572 // Copy bytes from possibly unaligned location to aligned location 573 // 574 FnafPathName = AllocateCopyPool(PathLen, (UINT8 *)((FILEPATH_DEVICE_PATH*)*FilePath)->PathName); 575 if (FnafPathName == NULL) { 576 return EFI_OUT_OF_RESOURCES; 577 } 578 579 // 555 580 // Try to test opening an existing file 556 581 // … … 558 583 Handle2, 559 584 &Handle1, 560 ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName,585 FnafPathName, 561 586 OpenMode &~EFI_FILE_MODE_CREATE, 562 587 0 … … 570 595 Handle2, 571 596 &Handle1, 572 ((FILEPATH_DEVICE_PATH*)*FilePath)->PathName,597 FnafPathName, 573 598 OpenMode, 574 599 Attributes 575 600 ); 576 601 } 602 603 // 604 // Free the alignment buffer 605 // 606 FreePool(FnafPathName); 607 577 608 // 578 609 // Close the last node … … 1145 1176 device. 1146 1177 1147 The EnvironmentVariables and Status parameters areignored in a pre-UEFI Shell 2.01178 The EnvironmentVariables pararemeter is ignored in a pre-UEFI Shell 2.0 1148 1179 environment. The values pointed to by the parameters will be unchanged by the 1149 1180 ShellExecute() function. The Output parameter has no effect in a … … 1173 1204 ) 1174 1205 { 1206 EFI_STATUS CmdStatus; 1175 1207 // 1176 1208 // Check for UEFI Shell 2.0 protocols … … 1191 1223 if (mEfiShellEnvironment2 != NULL) { 1192 1224 // 1193 // Call EFI Shell version (not using EnvironmentVariables or Status parameters)1225 // Call EFI Shell version. 1194 1226 // Due to oddity in the EFI shell we want to dereference the ParentHandle here 1195 1227 // 1196 return(mEfiShellEnvironment2->Execute(*ParentHandle,1228 CmdStatus = (mEfiShellEnvironment2->Execute(*ParentHandle, 1197 1229 CommandLine, 1198 1230 Output)); 1231 // 1232 // No Status output parameter so just use the returned status 1233 // 1234 if (Status != NULL) { 1235 *Status = CmdStatus; 1236 } 1237 // 1238 // If there was an error, we can't tell if it was from the command or from 1239 // the Execute() function, so we'll just assume the shell ran successfully 1240 // and the error came from the command. 1241 // 1242 return EFI_SUCCESS; 1199 1243 } 1200 1244 1201 1245 return (EFI_UNSUPPORTED); 1202 1246 } 1247 1203 1248 /** 1204 1249 Retreives the current directory path … … 1386 1431 // allocate new space to copy strings and structure 1387 1432 // 1388 NewInfo->FullName = Allocate ZeroPool(StrSize(OldInfo->FullName));1389 NewInfo->FileName = Allocate ZeroPool(StrSize(OldInfo->FileName));1390 NewInfo->Info = Allocate ZeroPool((UINTN)OldInfo->Info->Size);1433 NewInfo->FullName = AllocateCopyPool(StrSize(OldInfo->FullName), OldInfo->FullName); 1434 NewInfo->FileName = AllocateCopyPool(StrSize(OldInfo->FileName), OldInfo->FileName); 1435 NewInfo->Info = AllocateCopyPool((UINTN)OldInfo->Info->Size, OldInfo->Info); 1391 1436 1392 1437 // … … 1394 1439 // 1395 1440 if (NULL == NewInfo->FullName || NewInfo->FileName == NULL || NewInfo->Info == NULL) { 1441 // 1442 // Free the partially allocated new node 1443 // 1444 SHELL_FREE_NON_NULL(NewInfo->FullName); 1445 SHELL_FREE_NON_NULL(NewInfo->FileName); 1446 SHELL_FREE_NON_NULL(NewInfo->Info); 1447 SHELL_FREE_NON_NULL(NewInfo); 1448 1449 // 1450 // Free the previously converted stuff 1451 // 1396 1452 ShellCloseFileMetaArg((EFI_SHELL_FILE_INFO**)(&ListHead)); 1397 1453 ListHead = NULL; … … 1400 1456 1401 1457 // 1402 // Copt the strings and structure1403 //1404 StrCpy(NewInfo->FullName, OldInfo->FullName);1405 StrCpy(NewInfo->FileName, OldInfo->FileName);1406 gBS->CopyMem (NewInfo->Info, OldInfo->Info, (UINTN)OldInfo->Info->Size);1407 1408 //1409 1458 // add that to the list 1410 1459 // … … 1417 1466 1418 1467 This function uses the Arg to open all the matching files. Each matched 1419 file has a SHELL_FILE_ ARGstructure to record the file information. These1420 structures are placed on the list ListHead. Users can get the SHELL_FILE_ ARG1468 file has a SHELL_FILE_INFO structure to record the file information. These 1469 structures are placed on the list ListHead. Users can get the SHELL_FILE_INFO 1421 1470 structures from ListHead to access each file. This function supports wildcards 1422 1471 and will process '?' and '*' as such. the list must be freed with a call to … … 1446 1495 EFI_STATUS Status; 1447 1496 LIST_ENTRY mOldStyleFileList; 1497 CHAR16 *CleanFilePathStr; 1448 1498 1449 1499 // … … 1452 1502 ASSERT(Arg != NULL); 1453 1503 ASSERT(ListHead != NULL); 1504 1505 CleanFilePathStr = NULL; 1506 1507 Status = InternalShellStripQuotes (Arg, &CleanFilePathStr); 1508 if (EFI_ERROR (Status)) { 1509 return Status; 1510 } 1454 1511 1455 1512 // … … 1460 1517 *ListHead = (EFI_SHELL_FILE_INFO*)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); 1461 1518 if (*ListHead == NULL) { 1519 FreePool(CleanFilePathStr); 1462 1520 return (EFI_OUT_OF_RESOURCES); 1463 1521 } 1464 1522 InitializeListHead(&((*ListHead)->Link)); 1465 1523 } 1466 Status = gEfiShellProtocol->OpenFileList( Arg,1524 Status = gEfiShellProtocol->OpenFileList(CleanFilePathStr, 1467 1525 OpenMode, 1468 1526 ListHead); … … 1474 1532 if (*ListHead != NULL && IsListEmpty(&(*ListHead)->Link)) { 1475 1533 FreePool(*ListHead); 1534 FreePool(CleanFilePathStr); 1476 1535 *ListHead = NULL; 1477 1536 return (EFI_NOT_FOUND); 1478 1537 } 1538 FreePool(CleanFilePathStr); 1479 1539 return (Status); 1480 1540 } … … 1492 1552 // Get the EFI Shell list of files 1493 1553 // 1494 Status = mEfiShellEnvironment2->FileMetaArg( Arg, &mOldStyleFileList);1554 Status = mEfiShellEnvironment2->FileMetaArg(CleanFilePathStr, &mOldStyleFileList); 1495 1555 if (EFI_ERROR(Status)) { 1496 1556 *ListHead = NULL; 1557 FreePool(CleanFilePathStr); 1497 1558 return (Status); 1498 1559 } … … 1501 1562 *ListHead = (EFI_SHELL_FILE_INFO *)AllocateZeroPool(sizeof(EFI_SHELL_FILE_INFO)); 1502 1563 if (*ListHead == NULL) { 1564 FreePool(CleanFilePathStr); 1503 1565 return (EFI_OUT_OF_RESOURCES); 1504 1566 } … … 1521 1583 Status = EFI_NOT_FOUND; 1522 1584 } 1585 FreePool(CleanFilePathStr); 1523 1586 return (Status); 1524 1587 } 1525 1588 1589 FreePool(CleanFilePathStr); 1526 1590 return (EFI_UNSUPPORTED); 1527 1591 } … … 1568 1632 FreePool((EFI_SHELL_FILE_INFO_NO_CONST*)Node); 1569 1633 } 1634 SHELL_FREE_NON_NULL(*ListHead); 1570 1635 return EFI_SUCCESS; 1571 1636 } … … 1626 1691 return (NULL); 1627 1692 } 1628 Str Cpy(TestPath, Path);1629 Str Cat(TestPath, FileName);1693 StrnCpy(TestPath, Path, Size/sizeof(CHAR16) - 1); 1694 StrnCat(TestPath, FileName, Size/sizeof(CHAR16) - 1 - StrLen(TestPath)); 1630 1695 Status = ShellOpenFileByName(TestPath, &Handle, EFI_FILE_MODE_READ, 0); 1631 1696 if (!EFI_ERROR(Status)){ … … 1659 1724 } 1660 1725 if (TestPath[StrLen(TestPath)-1] != L'\\') { 1661 Str Cat(TestPath, L"\\");1726 StrnCat(TestPath, L"\\", Size/sizeof(CHAR16) - 1 - StrLen(TestPath)); 1662 1727 } 1663 1728 if (FileName[0] == L'\\') { 1664 1729 FileName++; 1665 1730 } 1666 Str Cat(TestPath, FileName);1731 StrnCat(TestPath, FileName, Size/sizeof(CHAR16) - 1 - StrLen(TestPath)); 1667 1732 if (StrStr(Walker, L";") != NULL) { 1668 1733 Walker = StrStr(Walker, L";") + 1; … … 1733 1798 } 1734 1799 for (ExtensionWalker = FileExtension, TempChar2 = (CHAR16*)FileExtension; TempChar2 != NULL ; ExtensionWalker = TempChar2 + 1){ 1735 Str Cpy(TestPath, FileName);1800 StrnCpy(TestPath, FileName, Size/sizeof(CHAR16) - 1); 1736 1801 if (ExtensionWalker != NULL) { 1737 Str Cat(TestPath, ExtensionWalker);1802 StrnCat(TestPath, ExtensionWalker, Size/sizeof(CHAR16) - 1 - StrLen(TestPath)); 1738 1803 } 1739 1804 TempChar = StrStr(TestPath, L";"); … … 1858 1923 // If we accept numbers then dont return TRUE. (they will be values) 1859 1924 // 1860 if (((Name[0] == L'-' || Name[0] == L'+') && ShellIsHexaDecimalDigitCharacter(Name[1])) && AlwaysAllowNumbers) {1925 if (((Name[0] == L'-' || Name[0] == L'+') && InternalShellIsHexOrDecimalNumber(Name+1, FALSE, FALSE)) && AlwaysAllowNumbers) { 1861 1926 return (FALSE); 1862 1927 } … … 1918 1983 UINTN Count; 1919 1984 CONST CHAR16 *TempPointer; 1985 UINTN CurrentValueSize; 1920 1986 1921 1987 CurrentItemPackage = NULL; … … 1973 2039 return (EFI_OUT_OF_RESOURCES); 1974 2040 } 1975 CurrentItemPackage->Name = Allocate ZeroPool(StrSize(Argv[LoopCounter]));2041 CurrentItemPackage->Name = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]); 1976 2042 if (CurrentItemPackage->Name == NULL) { 1977 2043 ShellCommandLineFreeVarList(*CheckPackage); … … 1979 2045 return (EFI_OUT_OF_RESOURCES); 1980 2046 } 1981 StrCpy(CurrentItemPackage->Name, Argv[LoopCounter]);1982 2047 CurrentItemPackage->Type = CurrentItemType; 1983 2048 CurrentItemPackage->OriginalPosition = (UINTN)(-1); … … 2016 2081 // get the item VALUE for a previous flag 2017 2082 // 2018 CurrentItemPackage->Value = ReallocatePool(ValueSize, ValueSize + StrSize(Argv[LoopCounter]) + sizeof(CHAR16), CurrentItemPackage->Value); 2019 ASSERT(CurrentItemPackage->Value != NULL); 2020 if (ValueSize == 0) { 2021 StrCpy(CurrentItemPackage->Value, Argv[LoopCounter]); 2083 if (StrStr(Argv[LoopCounter], L" ") == NULL) { 2084 CurrentValueSize = ValueSize + StrSize(Argv[LoopCounter]) + sizeof(CHAR16); 2085 CurrentItemPackage->Value = ReallocatePool(ValueSize, CurrentValueSize, CurrentItemPackage->Value); 2086 ASSERT(CurrentItemPackage->Value != NULL); 2087 if (ValueSize == 0) { 2088 StrnCpy(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1); 2089 } else { 2090 StrnCat(CurrentItemPackage->Value, L" ", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2091 StrnCat(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2092 } 2093 ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16); 2022 2094 } else { 2023 StrCat(CurrentItemPackage->Value, L" "); 2024 StrCat(CurrentItemPackage->Value, Argv[LoopCounter]); 2025 } 2026 ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16); 2095 // 2096 // the parameter has spaces. must be quoted. 2097 // 2098 CurrentValueSize = ValueSize + StrSize(Argv[LoopCounter]) + sizeof(CHAR16) + sizeof(CHAR16) + sizeof(CHAR16); 2099 CurrentItemPackage->Value = ReallocatePool(ValueSize, CurrentValueSize, CurrentItemPackage->Value); 2100 ASSERT(CurrentItemPackage->Value != NULL); 2101 if (ValueSize == 0) { 2102 StrnCpy(CurrentItemPackage->Value, L"\"", CurrentValueSize/sizeof(CHAR16) - 1); 2103 StrnCat(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2104 StrnCat(CurrentItemPackage->Value, L"\"", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2105 } else { 2106 StrnCat(CurrentItemPackage->Value, L" ", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2107 StrnCat(CurrentItemPackage->Value, L"\"", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2108 StrnCat(CurrentItemPackage->Value, Argv[LoopCounter], CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2109 StrnCat(CurrentItemPackage->Value, L"\"", CurrentValueSize/sizeof(CHAR16) - 1 - StrLen(CurrentItemPackage->Value)); 2110 } 2111 ValueSize += StrSize(Argv[LoopCounter]) + sizeof(CHAR16); 2112 } 2027 2113 GetItemValue--; 2028 2114 if (GetItemValue == 0) { … … 2049 2135 CurrentItemPackage->Name = NULL; 2050 2136 CurrentItemPackage->Type = TypePosition; 2051 CurrentItemPackage->Value = Allocate ZeroPool(StrSize(TempPointer));2137 CurrentItemPackage->Value = AllocateCopyPool(StrSize(TempPointer), TempPointer); 2052 2138 if (CurrentItemPackage->Value == NULL) { 2053 2139 ShellCommandLineFreeVarList(*CheckPackage); … … 2055 2141 return (EFI_OUT_OF_RESOURCES); 2056 2142 } 2057 StrCpy(CurrentItemPackage->Value, TempPointer);2058 2143 CurrentItemPackage->OriginalPosition = Count++; 2059 2144 InsertHeadList(*CheckPackage, &CurrentItemPackage->Link); … … 2063 2148 // 2064 2149 if (ProblemParam != NULL) { 2065 *ProblemParam = AllocateZeroPool(StrSize(Argv[LoopCounter])); 2066 if (*ProblemParam != NULL) { 2067 StrCpy(*ProblemParam, Argv[LoopCounter]); 2068 } 2150 *ProblemParam = AllocateCopyPool(StrSize(Argv[LoopCounter]), Argv[LoopCounter]); 2069 2151 } 2070 2152 ShellCommandLineFreeVarList(*CheckPackage); … … 2425 2507 2426 2508 /** 2427 Determin s if a parameter is duplicated.2509 Determines if a parameter is duplicated. 2428 2510 2429 2511 If Param is not NULL then it will point to a callee allocated string buffer … … 2533 2615 return (EFI_OUT_OF_RESOURCES); 2534 2616 } 2535 NewString = SetMem16(NewString, NewSize, CHAR_NULL);2617 NewString = ZeroMem(NewString, NewSize); 2536 2618 while (*SourceString != CHAR_NULL) { 2537 2619 // … … 2548 2630 return (EFI_BUFFER_TOO_SMALL); 2549 2631 } 2550 Str Cat(NewString, Replace);2632 StrnCat(NewString, Replace, NewSize/sizeof(CHAR16) - 1 - StrLen(NewString)); 2551 2633 } else { 2552 2634 Size = StrSize(NewString); … … 2588 2670 } 2589 2671 if (mEfiShellInterface != NULL) { 2672 if (mEfiShellInterface->RedirArgc == 0) { 2590 2673 // 2591 2674 // Divide in half for old shell. Must be string length not size. 2592 // 2593 Size /= 2; 2675 // 2676 Size /=2; // Divide in half only when no redirection. 2677 } 2594 2678 return (mEfiShellInterface->StdOut->Write(mEfiShellInterface->StdOut, &Size, (VOID*)String)); 2595 2679 } … … 2702 2786 if (ResumeLocation != NULL) { 2703 2787 if (*(ResumeLocation-1) == L'^') { 2788 // 2789 // Move cursor back 1 position to overwrite the ^ 2790 // 2791 gST->ConOut->SetCursorPosition(gST->ConOut, gST->ConOut->Mode->CursorColumn - 1, gST->ConOut->Mode->CursorRow); 2792 2704 2793 // 2705 2794 // Print a simple '%' symbol … … 3001 3090 3002 3091 /** 3092 Function return the number converted from a hex representation of a number. 3093 3094 Note: this function cannot be used when (UINTN)(-1), (0xFFFFFFFF) may be a valid 3095 result. Use ShellConvertStringToUint64 instead. 3096 3097 @param[in] String String representation of a number. 3098 3099 @return The unsigned integer result of the conversion. 3100 @retval (UINTN)(-1) An error occured. 3101 **/ 3102 UINTN 3103 EFIAPI 3104 ShellHexStrToUintn( 3105 IN CONST CHAR16 *String 3106 ) 3107 { 3108 UINT64 RetVal; 3109 3110 if (!EFI_ERROR(ShellConvertStringToUint64(String, &RetVal, TRUE, TRUE))) { 3111 return ((UINTN)RetVal); 3112 } 3113 3114 return ((UINTN)(-1)); 3115 } 3116 3117 /** 3003 3118 Function to determine whether a string is decimal or hex representation of a number 3004 and return the number converted from the string. 3119 and return the number converted from the string. Spaces are always skipped. 3005 3120 3006 3121 @param[in] String String representation of a number … … 3117 3232 if (CurrentSize != NULL) { 3118 3233 NewSize = *CurrentSize; 3119 while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) { 3120 NewSize += 2 * Count * sizeof(CHAR16); 3121 } 3122 *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination); 3123 *CurrentSize = NewSize; 3234 if (NewSize < DestinationStartSize + (Count * sizeof(CHAR16))) { 3235 while (NewSize < (DestinationStartSize + (Count*sizeof(CHAR16)))) { 3236 NewSize += 2 * Count * sizeof(CHAR16); 3237 } 3238 *Destination = ReallocatePool(*CurrentSize, NewSize, *Destination); 3239 *CurrentSize = NewSize; 3240 } 3124 3241 } else { 3125 3242 *Destination = AllocateZeroPool((Count+1)*sizeof(CHAR16)); … … 3195 3312 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3196 3313 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3197 ASSERT_EFI_ERROR(Status); 3314 if (EFI_ERROR(Status)) { 3315 break; 3316 } 3198 3317 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3199 3318 if (Key.UnicodeChar == L'Q' || Key.UnicodeChar ==L'q') { … … 3212 3331 *Resp = ShellPromptResponseMax; 3213 3332 while (*Resp == ShellPromptResponseMax) { 3333 if (ShellGetExecutionBreakFlag()) { 3334 Status = EFI_ABORTED; 3335 break; 3336 } 3214 3337 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3215 3338 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3216 ASSERT_EFI_ERROR(Status); 3339 if (EFI_ERROR(Status)) { 3340 break; 3341 } 3217 3342 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3218 3343 switch (Key.UnicodeChar) { … … 3240 3365 *Resp = ShellPromptResponseMax; 3241 3366 while (*Resp == ShellPromptResponseMax) { 3367 if (ShellGetExecutionBreakFlag()) { 3368 Status = EFI_ABORTED; 3369 break; 3370 } 3242 3371 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3243 3372 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3244 ASSERT_EFI_ERROR(Status); 3373 if (EFI_ERROR(Status)) { 3374 break; 3375 } 3245 3376 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3246 3377 switch (Key.UnicodeChar) { … … 3274 3405 *Resp = ShellPromptResponseMax; 3275 3406 while (*Resp == ShellPromptResponseMax) { 3407 if (ShellGetExecutionBreakFlag()) { 3408 Status = EFI_ABORTED; 3409 break; 3410 } 3276 3411 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3277 3412 if (Type == ShellPromptResponseTypeEnterContinue) { 3278 3413 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3279 ASSERT_EFI_ERROR(Status); 3414 if (EFI_ERROR(Status)) { 3415 break; 3416 } 3280 3417 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3281 3418 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { … … 3301 3438 *Resp = ShellPromptResponseMax; 3302 3439 while (*Resp == ShellPromptResponseMax) { 3440 if (ShellGetExecutionBreakFlag()) { 3441 Status = EFI_ABORTED; 3442 break; 3443 } 3303 3444 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3304 3445 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3305 ASSERT_EFI_ERROR(Status); 3446 if (EFI_ERROR(Status)) { 3447 break; 3448 } 3306 3449 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3307 3450 switch (Key.UnicodeChar) { … … 3322 3465 } 3323 3466 while(1) { 3467 if (ShellGetExecutionBreakFlag()) { 3468 Status = EFI_ABORTED; 3469 break; 3470 } 3324 3471 gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &EventIndex); 3325 3472 Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); 3326 ASSERT_EFI_ERROR(Status); 3473 if (EFI_ERROR(Status)) { 3474 break; 3475 } 3327 3476 ShellPrintEx(-1, -1, L"%c", Key.UnicodeChar); 3328 3477 if (Key.UnicodeChar == CHAR_CARRIAGE_RETURN) { … … 3335 3484 // 3336 3485 // This is the location to add new prompt types. 3486 // If your new type loops remember to add ExecutionBreak support. 3337 3487 // 3338 3488 default: … … 3646 3796 3647 3797 // 3648 // Skipspaces if requested3649 // 3650 while(StopAtSpace && *String == L' ') {3651 String++;3798 // stop at spaces if requested 3799 // 3800 if (StopAtSpace && *String == L' ') { 3801 break; 3652 3802 } 3653 3803 } … … 4001 4151 return (Status); 4002 4152 } 4153 4154 /** 4155 Function to print help file / man page content in the spec from the UEFI Shell protocol GetHelpText function. 4156 4157 @param[in] CommandToGetHelpOn Pointer to a string containing the command name of help file to be printed. 4158 @param[in] SectionToGetHelpOn Pointer to the section specifier(s). 4159 @param[in] PrintCommandText If TRUE, prints the command followed by the help content, otherwise prints 4160 the help content only. 4161 @retval EFI_DEVICE_ERROR The help data format was incorrect. 4162 @retval EFI_NOT_FOUND The help data could not be found. 4163 @retval EFI_SUCCESS The operation was successful. 4164 **/ 4165 EFI_STATUS 4166 EFIAPI 4167 ShellPrintHelp ( 4168 IN CONST CHAR16 *CommandToGetHelpOn, 4169 IN CONST CHAR16 *SectionToGetHelpOn, 4170 IN BOOLEAN PrintCommandText 4171 ) 4172 { 4173 EFI_STATUS Status; 4174 CHAR16 *OutText; 4175 4176 OutText = NULL; 4177 4178 // 4179 // Get the string to print based 4180 // 4181 Status = gEfiShellProtocol->GetHelpText (CommandToGetHelpOn, SectionToGetHelpOn, &OutText); 4182 4183 // 4184 // make sure we got a valid string 4185 // 4186 if (EFI_ERROR(Status)){ 4187 return Status; 4188 } 4189 if (OutText == NULL || StrLen(OutText) == 0) { 4190 return EFI_NOT_FOUND; 4191 } 4192 4193 // 4194 // Chop off trailing stuff we dont need 4195 // 4196 while (OutText[StrLen(OutText)-1] == L'\r' || OutText[StrLen(OutText)-1] == L'\n' || OutText[StrLen(OutText)-1] == L' ') { 4197 OutText[StrLen(OutText)-1] = CHAR_NULL; 4198 } 4199 4200 // 4201 // Print this out to the console 4202 // 4203 if (PrintCommandText) { 4204 ShellPrintEx(-1, -1, L"%H%-14s%N- %s\r\n", CommandToGetHelpOn, OutText); 4205 } else { 4206 ShellPrintEx(-1, -1, L"%N%s\r\n", OutText); 4207 } 4208 4209 SHELL_FREE_NON_NULL(OutText); 4210 4211 return EFI_SUCCESS; 4212 } 4213 4214 /** 4215 Function to delete a file by name 4216 4217 @param[in] FileName Pointer to file name to delete. 4218 4219 @retval EFI_SUCCESS the file was deleted sucessfully 4220 @retval EFI_WARN_DELETE_FAILURE the handle was closed, but the file was not 4221 deleted 4222 @retval EFI_INVALID_PARAMETER One of the parameters has an invalid value. 4223 @retval EFI_NOT_FOUND The specified file could not be found on the 4224 device or the file system could not be found 4225 on the device. 4226 @retval EFI_NO_MEDIA The device has no medium. 4227 @retval EFI_MEDIA_CHANGED The device has a different medium in it or the 4228 medium is no longer supported. 4229 @retval EFI_DEVICE_ERROR The device reported an error. 4230 @retval EFI_VOLUME_CORRUPTED The file system structures are corrupted. 4231 @retval EFI_WRITE_PROTECTED The file or medium is write protected. 4232 @retval EFI_ACCESS_DENIED The file was opened read only. 4233 @retval EFI_OUT_OF_RESOURCES Not enough resources were available to open the 4234 file. 4235 @retval other The file failed to open 4236 **/ 4237 EFI_STATUS 4238 EFIAPI 4239 ShellDeleteFileByName( 4240 IN CONST CHAR16 *FileName 4241 ) 4242 { 4243 EFI_STATUS Status; 4244 SHELL_FILE_HANDLE FileHandle; 4245 4246 Status = ShellFileExists(FileName); 4247 4248 if (Status == EFI_SUCCESS){ 4249 Status = ShellOpenFileByName(FileName, &FileHandle, EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0x0); 4250 if (Status == EFI_SUCCESS){ 4251 Status = ShellDeleteFile(&FileHandle); 4252 } 4253 } 4254 4255 return(Status); 4256 4257 } 4258 4259 /** 4260 Cleans off all the quotes in the string. 4261 4262 @param[in] OriginalString pointer to the string to be cleaned. 4263 @param[out] CleanString The new string with all quotes removed. 4264 Memory allocated in the function and free 4265 by caller. 4266 4267 @retval EFI_SUCCESS The operation was successful. 4268 **/ 4269 EFI_STATUS 4270 EFIAPI 4271 InternalShellStripQuotes ( 4272 IN CONST CHAR16 *OriginalString, 4273 OUT CHAR16 **CleanString 4274 ) 4275 { 4276 CHAR16 *Walker; 4277 4278 if (OriginalString == NULL || CleanString == NULL) { 4279 return EFI_INVALID_PARAMETER; 4280 } 4281 4282 *CleanString = AllocateCopyPool (StrSize (OriginalString), OriginalString); 4283 if (*CleanString == NULL) { 4284 return EFI_OUT_OF_RESOURCES; 4285 } 4286 4287 for (Walker = *CleanString; Walker != NULL && *Walker != CHAR_NULL ; Walker++) { 4288 if (*Walker == L'\"') { 4289 CopyMem(Walker, Walker+1, StrSize(Walker) - sizeof(Walker[0])); 4290 } 4291 } 4292 4293 return EFI_SUCCESS; 4294 } 4295 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLib/UefiShellLib.h
r48674 r58459 73 73 ); 74 74 75 /** 76 Cleans off all the quotes in the string. 77 78 @param[in] OriginalString pointer to the string to be cleaned. 79 @param[out] CleanString The new string with all quotes removed. 80 Memory allocated in the function and free 81 by caller. 82 83 @retval EFI_SUCCESS The operation was successful. 84 **/ 85 EFI_STATUS 86 EFIAPI 87 InternalShellStripQuotes ( 88 IN CONST CHAR16 *OriginalString, 89 OUT CHAR16 **CleanString 90 ); 91 92 75 93 #endif 76 94 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellLib/UefiShellLib.inf
r48674 r58459 20 20 MODULE_TYPE = UEFI_DRIVER 21 21 VERSION_STRING = 1.0 22 LIBRARY_CLASS = ShellLib|UEFI_APPLICATION UEFI_DRIVER 22 LIBRARY_CLASS = ShellLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER DXE_DRIVER 23 23 CONSTRUCTOR = ShellLibConstructor 24 24 DESTRUCTOR = ShellLibDestructor … … 51 51 52 52 [Protocols] 53 gEfiSimpleFileSystemProtocolGuid # ALWAYS_CONSUMED53 gEfiSimpleFileSystemProtocolGuid ## CONSUMES 54 54 55 55 # shell 2.0 56 gEfiShellProtocolGuid # SOMETIMES_CONSUMED57 gEfiShellParametersProtocolGuid # SOMETIMES_CONSUMED56 gEfiShellProtocolGuid ## SOMETIMES_CONSUMES 57 gEfiShellParametersProtocolGuid ## SOMETIMES_CONSUMES 58 58 59 59 # 'old' shell 60 gEfiShellEnvironment2Guid # SOMETIMES_CONSUMED61 gEfiShellInterfaceGuid # SOMETIMES_CONSUMED60 gEfiShellEnvironment2Guid ## SOMETIMES_CONSUMES 61 gEfiShellInterfaceGuid ## SOMETIMES_CONSUMES 62 62 63 63 [Guids] 64 gEfiFileInfoGuid # ALWAYS_CONSUMED65 gEfiShellEnvironment2ExtGuid # ALWAYS_CONSUMED64 gEfiFileInfoGuid ## CONSUMES ## GUID 65 gEfiShellEnvironment2ExtGuid ## CONSUMES ## GUID 66 66 67 67 [Pcd.common] 68 gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize # ALWAYS_CONSUMED69 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize # ALWAYS_CONSUMED68 gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize ## CONSUMES 69 gEfiShellPkgTokenSpaceGuid.PcdShellPrintBufferSize ## CONSUMES -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ifconfig.c
r48674 r58459 2 2 The implementation for ifcommand shell command. 3 3 4 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR> 4 Copyright (c) 2013 Hewlett-Packard Development Company, L.P. 5 Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR> 5 6 6 7 This program and the accompanying materials … … 271 272 OriString = String; 272 273 273 Str Cpy (String, L"&OFFSET=");274 StrnCpy (String, L"&OFFSET=", 9); 274 275 String += StrLen (L"&OFFSET="); 275 276 String += UnicodeSPrint (String, 20, L"%x", Offset); 276 277 277 Str Cpy (String,L"&WIDTH=");278 StrnCpy (String,L"&WIDTH=", 8); 278 279 String += StrLen (L"&WIDTH="); 279 280 String += UnicodeSPrint (String, 20, L"%x", Width); 280 281 281 282 if (Block != NULL) { 282 Str Cpy (String,L"&VALUE=");283 StrnCpy (String,L"&VALUE=", 8); 283 284 String += StrLen (L"&VALUE="); 284 285 while ((Width--) != 0) { … … 369 370 370 371 String = ConfigHdr; 371 Str Cpy (String, L"GUID=");372 StrnCpy (String, L"GUID=", 6); 372 373 String += StrLen (L"GUID="); 373 374 … … 382 383 // Append L"&NAME=" 383 384 // 384 Str Cpy (String, L"&NAME=");385 StrnCpy (String, L"&NAME=", 7); 385 386 String += StrLen (L"&NAME="); 386 387 for (Index = 0; Index < NameLength ; Index++) { … … 391 392 // Append L"&PATH=" 392 393 // 393 Str Cpy (String, L"&PATH=");394 StrnCpy (String, L"&PATH=", 7); 394 395 String += StrLen (L"&PATH="); 395 396 for (Index = 0, Buffer = (UINT8 *) DevicePath; Index < DevicePathLength; Index++) { … … 618 619 } 619 620 if (ConfigHdr != NULL) { 620 Str Cpy (ConfigResp, ConfigHdr);621 StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1); 621 622 } 622 623 … … 791 792 } 792 793 if (ConfigHdr != NULL) { 793 Str Cpy (ConfigResp, ConfigHdr);794 StrnCpy (ConfigResp, ConfigHdr, Length + NIC_ITEM_CONFIG_SIZE * 2 + 100 - 1); 794 795 } 795 796 … … 1043 1044 1044 1045 /** 1045 Create an IP child, use it to start the auto configuration, then dest ory it.1046 Create an IP child, use it to start the auto configuration, then destroy it. 1046 1047 1047 1048 @param[in] NicInfo The pointer to the NIC_INFO of the Nic to be configured. … … 1116 1117 Status = gBS->CreateEvent ( 1117 1118 EVT_NOTIFY_SIGNAL | EVT_TIMER, 1118 TPL_CALLBACK - 1,1119 TPL_CALLBACK, 1119 1120 TimeoutToGetMap, 1120 1121 NULL, … … 1250 1251 if (StringNoCaseCompare(&Temp, &DhcpTemp) == 0) { 1251 1252 // 1252 // Validate the parameter for DHCP, two valid forms: eth0 DHCP and eth0 DHCP perm ent1253 // Validate the parameter for DHCP, two valid forms: eth0 DHCP and eth0 DHCP permanent 1253 1254 // 1254 1255 if ((Argc != 2) && (Argc!= 3)) { … … 1275 1276 1276 1277 if ((OldConfig != NULL) && (OldConfig->Source == IP4_CONFIG_SOURCE_DHCP) && 1277 (OldConfig->Perm ent == Permanent)) {1278 (OldConfig->Permanent == Permanent)) { 1278 1279 1279 1280 ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_IFCONFIG_INTERFACE_CONFIGURED), gShellNetwork1HiiHandle, Info->Name); … … 1286 1287 // 1287 1288 // validate the parameter, two forms: eth0 static IP NETMASK GATEWAY and 1288 // eth0 static IP NETMASK GATEWAY perm ent1289 // eth0 static IP NETMASK GATEWAY permanent 1289 1290 // 1290 1291 if ((Argc != 5) && (Argc != 6)) { … … 1389 1390 1390 1391 CopyMem (&Config->NicAddr, &Info->NicAddress, sizeof (NIC_ADDR)); 1391 Config->Perm ent = Permanent;1392 Config->Permanent = Permanent; 1392 1393 1393 1394 // … … 1475 1476 1476 1477 ShellPrintHiiEx(-1, -1, NULL, 1477 STRING_TOKEN (STR_IFCONFIG_PERM ENT_STATUS),1478 STRING_TOKEN (STR_IFCONFIG_PERMANENT_STATUS), 1478 1479 gShellNetwork1HiiHandle, 1479 (NicInfo->ConfigInfo->Perm ent? L"TRUE":L"FALSE")1480 (NicInfo->ConfigInfo->Permanent? L"TRUE":L"FALSE") 1480 1481 ); 1481 1482 … … 1717 1718 // 1718 1719 // The correct command line arguments for setting address are: 1719 // IfConfig -s eth0 DHCP [perm ent]1720 // IfConfig -s eth0 static ip netmask gateway [perm ent]1720 // IfConfig -s eth0 DHCP [permanent] 1721 // IfConfig -s eth0 static ip netmask gateway [permanent] 1721 1722 // 1722 1723 if (Item == NULL || (CountSubItems(Item) < 2) || (CountSubItems(Item) > 6) || (CountSubItems(Item) == 4)) { -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellNetwork1CommandsLib/Ping.c
r48674 r58459 2 2 The implementation for Ping shell command. 3 3 4 Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved.<BR>4 Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR> 5 5 6 6 This program and the accompanying materials … … 1191 1191 1192 1192 /** 1193 Dest ory the IP instance.1193 Destroy the IP instance. 1194 1194 1195 1195 @param[in] Private The pointer of PING_PRIVATE_DATA. … … 1198 1198 VOID 1199 1199 EFIAPI 1200 Ping6Dest oryIp6Instance (1200 Ping6DestroyIp6Instance ( 1201 1201 IN PING_PRIVATE_DATA *Private 1202 1202 ) … … 1415 1415 1416 1416 if (Private->IpChildHandle != NULL) { 1417 Ping6Dest oryIp6Instance (Private);1417 Ping6DestroyIp6Instance (Private); 1418 1418 } 1419 1419 -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
r48674 r58459 2 2 # Provides shell network1 functions 3 3 # 4 # Copyright (c) 2010 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 52 52 53 53 [Pcd] 54 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED54 gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask ## CONSUMES 55 55 56 56 [Protocols] 57 gEfiCpuArchProtocolGuid # ALWAYS_CONSUMED58 gEfiIp6ProtocolGuid # SOMETIMES_CONSUMED59 gEfiIp6ServiceBindingProtocolGuid # SOMETIMES_CONSUMED60 gEfiIp6ConfigProtocolGuid # SOMETIMES_CONSUMED57 gEfiCpuArchProtocolGuid ## CONSUMES 58 gEfiIp6ProtocolGuid ## SOMETIMES_CONSUMES 59 gEfiIp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 60 gEfiIp6ConfigProtocolGuid ## SOMETIMES_CONSUMES 61 61 62 gEfiIp6ProtocolGuid # SOMETIMES_CONSUMED63 gEfiIp6ServiceBindingProtocolGuid # SOMETIMES_CONSUMED64 gEfiIp6ConfigProtocolGuid # SOMETIMES_CONSUMED62 gEfiIp6ProtocolGuid ## SOMETIMES_CONSUMES 63 gEfiIp6ServiceBindingProtocolGuid ## SOMETIMES_CONSUMES 64 gEfiIp6ConfigProtocolGuid ## SOMETIMES_CONSUMES 65 65 66 66 [Guids] 67 gShellNetwork1HiiGuid 67 gShellNetwork1HiiGuid ## SOMETIMES_CONSUMES ## HII -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiSortLib/UefiSortLib.c
r48674 r58459 18 18 #include <Protocol/UnicodeCollation.h> 19 19 #include <Protocol/DevicePath.h> 20 #include <Protocol/DevicePathToText.h>21 20 22 21 #include <Library/UefiBootServicesTableLib.h> … … 26 25 #include <Library/MemoryAllocationLib.h> 27 26 #include <Library/SortLib.h> 28 29 STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDevicePathToText = NULL; 27 #include <Library/DevicePathLib.h> 28 30 29 STATIC EFI_UNICODE_COLLATION_PROTOCOL *mUnicodeCollation = NULL; 31 30 … … 225 224 } 226 225 227 if (mDevicePathToText == NULL) {228 Status = gBS->LocateProtocol(229 &gEfiDevicePathToTextProtocolGuid,230 NULL,231 (VOID**)&mDevicePathToText);232 233 ASSERT_EFI_ERROR(Status);234 }235 236 226 if (mUnicodeCollation == NULL) { 237 227 Status = gBS->LocateProtocol( … … 243 233 } 244 234 245 TextPath1 = mDevicePathToText->ConvertDevicePathToText(235 TextPath1 = ConvertDevicePathToText( 246 236 DevicePath1, 247 237 FALSE, 248 238 FALSE); 249 239 250 TextPath2 = mDevicePathToText->ConvertDevicePathToText(240 TextPath2 = ConvertDevicePathToText( 251 241 DevicePath2, 252 242 FALSE, -
trunk/src/VBox/Devices/EFI/Firmware/ShellPkg/Library/UefiSortLib/UefiSortLib.inf
r48674 r58459 2 2 # Library used for sorting routines. 3 3 # 4 # Copyright (c) 2009 - 201 1, Intel Corporation. All rights reserved. <BR>4 # Copyright (c) 2009 - 2015, Intel Corporation. All rights reserved. <BR> 5 5 # 6 6 # This program and the accompanying materials … … 20 20 MODULE_TYPE = UEFI_DRIVER 21 21 VERSION_STRING = 1.0 22 LIBRARY_CLASS = SortLib|UEFI_APPLICATION UEFI_DRIVER UEFI_DRIVER 22 LIBRARY_CLASS = SortLib|UEFI_APPLICATION UEFI_DRIVER UEFI_DRIVER DXE_RUNTIME_DRIVER DXE_DRIVER 23 23 24 24 # … … 39 39 DebugLib 40 40 UefiBootServicesTableLib 41 DevicePathLib 41 42 42 43 [Protocols] 43 gEfiUnicodeCollation2ProtocolGuid # ALWAYS_CONSUMED 44 gEfiDevicePathProtocolGuid # ALWAYS_CONSUMED 45 gEfiDevicePathToTextProtocolGuid # ALWAYS_CONSUMED 44 gEfiUnicodeCollation2ProtocolGuid ## CONSUMES 45 gEfiDevicePathProtocolGuid ## CONSUMES 46 46
Note:
See TracChangeset
for help on using the changeset viewer.