--- /dev/null
+/** @file\r
+ Main file for bcfg shell install1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Guid/GlobalVariable.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/HandleParsingLib.h>\r
+#include <Library/DevicePathLib.h>\r
+\r
+typedef enum {\r
+ BCFG_TARGET_BOOT_ORDER = 0,\r
+ BCFG_TARGET_DRIVER_ORDER = 1,\r
+ BCFG_TARGET_MAX = 2\r
+} BCFG_OPERATION_TARGET;\r
+\r
+typedef enum {\r
+ BCFG_TYPE_DUMP = 0,\r
+ BCFG_TYPE_ADD = 1,\r
+ BCFG_TYPE_ADDP = 2,\r
+ BCFG_TYPE_ADDH = 3,\r
+ BCFG_TYPE_RM = 4,\r
+ BCFG_TYPE_MV = 5,\r
+ BCFG_TYPE_OPT = 6,\r
+ BCFG_TYPE_MAX = 7\r
+} BCFG_OPERATION_TYPE;\r
+\r
+typedef struct {\r
+ BCFG_OPERATION_TARGET Target;\r
+ BCFG_OPERATION_TYPE Type;\r
+ UINT16 Number1;\r
+ UINT16 Number2;\r
+ UINTN HandleIndex;\r
+ CHAR16 *FileName;\r
+ CHAR16 *Description;\r
+ UINT16 *Order;\r
+ CONST CHAR16 *OptData;\r
+} BGFG_OPERATION;\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+BcfgAdd (\r
+ IN UINTN Position,\r
+ IN CONST CHAR16 *File,\r
+ IN CONST CHAR16 *Desc,\r
+ IN CONST UINT16 *CurrentOrder,\r
+ IN CONST UINTN OrderCount,\r
+ IN CONST BCFG_OPERATION_TARGET Target,\r
+ IN CONST BOOLEAN UseHandle,\r
+ IN CONST BOOLEAN UsePath,\r
+ IN CONST UINTN HandleNumber\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath, *FilePath, *FileNode, *DevPath;\r
+ CHAR16 *Str;\r
+ CONST CHAR16 *p;\r
+ UINT8 *p8;\r
+ EFI_SHELL_FILE_INFO *Arg;\r
+ EFI_SHELL_FILE_INFO *FileList;\r
+ CHAR16 OptionStr[40];\r
+ UINTN DescSize, FilePathSize;\r
+ BOOLEAN Found;\r
+ UINTN TargetLocation;\r
+ UINTN Index;\r
+ EFI_HANDLE *Handles;\r
+ EFI_HANDLE CurHandle;\r
+ UINTN DriverBindingHandleCount;\r
+ UINTN ParentControllerHandleCount;\r
+ UINTN ChildControllerHandleCount;\r
+ SHELL_STATUS ShellStatus;\r
+ UINT16 *NewOrder;\r
+\r
+ if (!UseHandle) {\r
+ ASSERT(File != NULL);\r
+ ASSERT(Desc != NULL);\r
+ } else {\r
+ ASSERT(HandleNumber != 0);\r
+ }\r
+\r
+ ASSERT(Position <= (OrderCount+1));\r
+\r
+ Str = NULL;\r
+ FilePath = NULL;\r
+ FileNode = NULL;\r
+ FileList = NULL;\r
+ Handles = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ TargetLocation = 0xFFFF;\r
+\r
+// if (Position > 0) {\r
+// Position--;\r
+// }\r
+\r
+ if (UseHandle) {\r
+ CurHandle = ConvertHandleIndexToHandle(StrHexToUintn(File));\r
+ if (CurHandle == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, File);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ //\r
+ //Make sure that the handle should point to a real controller\r
+ //\r
+ Status = PARSE_HANDLE_DATABASE_UEFI_DRIVERS (\r
+ CurHandle,\r
+ &DriverBindingHandleCount,\r
+ NULL);\r
+\r
+ Status = PARSE_HANDLE_DATABASE_PARENTS (\r
+ CurHandle,\r
+ &ParentControllerHandleCount,\r
+ NULL);\r
+\r
+ Status = ParseHandleDatabaseForChildControllers (\r
+ CurHandle,\r
+ &ChildControllerHandleCount,\r
+ NULL);\r
+\r
+ if (DriverBindingHandleCount > 0\r
+ || ParentControllerHandleCount > 0\r
+ || ChildControllerHandleCount > 0) {\r
+ FilePath = NULL;\r
+ Status = gBS->HandleProtocol (\r
+ CurHandle,\r
+ &gEfiDevicePathProtocolGuid,\r
+ (VOID**)&FilePath);\r
+ }\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_HANDLE), gShellDebug1HiiHandle, StrHexToUintn(File));\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ } else {\r
+ //\r
+ // Get file info\r
+ //\r
+ ShellOpenFileMetaArg ((CHAR16*)File, EFI_FILE_MODE_READ, &FileList);\r
+\r
+ //\r
+ // If filename expanded to multiple names, fail\r
+ //\r
+ if (FileList == NULL || FileList->Link.ForwardLink != FileList->Link.BackLink) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE), gShellDebug1HiiHandle, File);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Arg = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link);\r
+ if (EFI_ERROR(Arg->Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_OPEN), gShellDebug1HiiHandle, File, Arg->Status);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ //\r
+ // Build FilePath to the filename\r
+ //\r
+\r
+ //\r
+ // get the device path\r
+ //\r
+ DevicePath = mEfiShellProtocol->GetDevicePathFromFilePath(Arg->FullName);\r
+ if (DevicePath != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_FILE_DP), gShellDebug1HiiHandle, Arg->FullName);\r
+ ShellStatus = SHELL_UNSUPPORTED;\r
+ } else {\r
+ if (UsePath) {\r
+ DevPath = DevicePath;\r
+ while (!IsDevicePathEnd(DevPath)) {\r
+ if ((DevicePathType(DevPath) == MEDIA_DEVICE_PATH) &&\r
+ (DevicePathSubType(DevPath) == MEDIA_HARDDRIVE_DP)) {\r
+\r
+ //\r
+ // If we find it use it instead\r
+ //\r
+ DevicePath = DevPath;\r
+ break;\r
+ }\r
+ DevPath = NextDevicePathNode(DevPath);\r
+ }\r
+ //\r
+ // append the file\r
+ //\r
+ for(p=Arg->FullName; *p != CHAR_NULL && *p != ':'; p++);\r
+ FileNode = FileDevicePath(NULL, p+1);\r
+ FilePath = AppendDevicePath(DevicePath, FileNode);\r
+ FreePool(FileNode);\r
+ } else {\r
+ FilePath = DuplicateDevicePath(DevicePath);\r
+ }\r
+\r
+ FreePool(DevicePath);\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ //\r
+ // Find a free target ,a brute force implementation\r
+ //\r
+ Found = FALSE;\r
+ for (TargetLocation=1; TargetLocation < 0xFFFF; TargetLocation++) {\r
+ Found = TRUE;\r
+ for (Index=0; Index < OrderCount; Index++) {\r
+ if (CurrentOrder[Index] == TargetLocation) {\r
+ Found = FALSE;\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (Found) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (TargetLocation == 0xFFFF) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET_NF), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_TARGET), gShellDebug1HiiHandle, TargetLocation);\r
+ }\r
+ }\r
+\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ //\r
+ // Add the option\r
+ //\r
+ DescSize = StrSize(Desc);\r
+ FilePathSize = GetDevicePathSize (FilePath);\r
+\r
+ p8 = AllocatePool(sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize);\r
+ *((UINT32 *) p8) = LOAD_OPTION_ACTIVE; // Attributes\r
+ p8 += sizeof (UINT32);\r
+\r
+ *((UINT16 *) p8) = (UINT16)FilePathSize; // FilePathListLength\r
+ p8 += sizeof (UINT16);\r
+\r
+ CopyMem (p8, Desc, DescSize);\r
+ p8 += DescSize;\r
+ CopyMem (p8, FilePath, FilePathSize);\r
+\r
+ UnicodeSPrint (OptionStr, sizeof(OptionStr), L"%s%04x", Target == BCFG_TARGET_BOOT_ORDER?L"Boot":L"Driver", TargetLocation);\r
+ Status = gRT->SetVariable (\r
+ OptionStr,\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
+ sizeof(UINT32) + sizeof(UINT16) + DescSize + FilePathSize,\r
+ p8\r
+ );\r
+\r
+ FreePool(p8);\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_SET_VAR_FAIL), gShellDebug1HiiHandle, OptionStr, Status);\r
+ } else {\r
+ NewOrder = AllocatePool((OrderCount+1)*sizeof(NewOrder[0]));\r
+ ASSERT(NewOrder != NULL);\r
+ CopyMem(NewOrder, CurrentOrder, (OrderCount)*sizeof(NewOrder[0]));\r
+\r
+ //\r
+ // Insert target into order list\r
+ //\r
+ for (Index=OrderCount; Index > Position; Index--) {\r
+ NewOrder[Index] = NewOrder[Index-1];\r
+ }\r
+\r
+ NewOrder[Position] = (UINT16) TargetLocation;\r
+ Status = gRT->SetVariable (\r
+ Target == BCFG_TARGET_BOOT_ORDER?L"BootOrder":L"DriverOrder",\r
+ &gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
+ (OrderCount+1) * sizeof(UINT16),\r
+ NewOrder\r
+ );\r
+\r
+ FreePool(NewOrder);\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellDebug1HiiHandle, Target == BCFG_TARGET_BOOT_ORDER?L"BootOrder":L"DriverOrder", Status);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Print (L"bcfg: Add %s as %x\n", OptionStr, Position);\r
+ }\r
+ }\r
+ }\r
+ if (FileNode != NULL) {\r
+ FreePool (FileNode);\r
+ }\r
+\r
+//\r
+//If always Free FilePath, will free devicepath in system when use "addh"\r
+//\r
+\r
+ if (FilePath!=NULL && !UseHandle) {\r
+ FreePool (FilePath);\r
+ }\r
+\r
+ if (Str != NULL) {\r
+ FreePool(Str);\r
+ }\r
+\r
+ if (Handles != NULL) {\r
+ FreePool (Handles);\r
+ }\r
+\r
+ if (FileList != NULL) {\r
+ ShellCloseFileMetaArg (&FileList);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+BcfgRemove(\r
+ IN CONST BCFG_OPERATION_TARGET Target,\r
+ IN CONST UINT16 *CurrentOrder,\r
+ IN CONST UINTN OrderCount,\r
+ IN CONST UINT16 Location\r
+ )\r
+{\r
+ CHAR16 VariableName[12];\r
+ UINT16 *NewOrder;\r
+ EFI_STATUS Status;\r
+ UINTN LoopVar;\r
+ UINTN NewCount;\r
+\r
+ UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Target == BCFG_TARGET_BOOT_ORDER?L"Boot":L"Driver", Location);\r
+ Status = gRT->SetVariable(\r
+ VariableName,\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
+ 0,\r
+ NULL);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellDebug1HiiHandle, VariableName, Status);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
+ NewOrder = AllocatePool(OrderCount*sizeof(CurrentOrder[0]));\r
+ NewCount = OrderCount;\r
+ CopyMem(NewOrder, CurrentOrder, OrderCount*sizeof(CurrentOrder[0]));\r
+ for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++){\r
+ if (NewOrder[LoopVar] == Location) {\r
+ CopyMem(NewOrder+LoopVar, NewOrder+LoopVar+1, (OrderCount - LoopVar - 1)*sizeof(CurrentOrder[0]));\r
+ NewCount--;\r
+ }\r
+ }\r
+ Status = gRT->SetVariable(\r
+ Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
+ NewCount*sizeof(NewOrder[0]),\r
+ NewOrder);\r
+ FreePool(NewOrder);\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellDebug1HiiHandle, Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", Status);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
+ return (SHELL_SUCCESS);\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+BcfgMove(\r
+ IN CONST BCFG_OPERATION_TARGET Target,\r
+ IN CONST UINT16 *CurrentOrder,\r
+ IN CONST UINTN OrderCount,\r
+ IN CONST UINT16 OldLocation,\r
+ IN CONST UINT16 NewLocation\r
+ )\r
+{\r
+ UINT16 *NewOrder;\r
+ EFI_STATUS Status;\r
+ UINT16 Temp;\r
+\r
+ NewOrder = AllocatePool(OrderCount*sizeof(CurrentOrder[0]));\r
+ ASSERT(NewOrder != NULL);\r
+\r
+ Temp = CurrentOrder[OldLocation];\r
+ CopyMem(NewOrder, CurrentOrder, OrderCount*sizeof(CurrentOrder[0]));\r
+ CopyMem(NewOrder+OldLocation, NewOrder+OldLocation+1, (OrderCount - OldLocation - 1)*sizeof(CurrentOrder[0]));\r
+ CopyMem(NewOrder+NewLocation+1, NewOrder+NewLocation, (OrderCount - NewLocation - 1)*sizeof(CurrentOrder[0]));\r
+ NewOrder[NewLocation] = Temp;\r
+\r
+\r
+ Status = gRT->SetVariable(\r
+ Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ EFI_VARIABLE_NON_VOLATILE|EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS,\r
+ OrderCount*sizeof(CurrentOrder[0]),\r
+ NewOrder);\r
+\r
+ FreePool(NewOrder);\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_WRITE_FAIL), gShellDebug1HiiHandle, Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder", Status);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
+ return (SHELL_SUCCESS);\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+BcfgDisplayDump(\r
+ IN CONST CHAR16 *Op,\r
+ IN CONST UINTN OrderCount,\r
+ IN CONST BOOLEAN VerboseOutput\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINT8 *Buffer;\r
+ UINTN BufferSize;\r
+ CHAR16 VariableName[12];\r
+ UINTN LoopVar;\r
+ UINTN LoopVar2;\r
+ CHAR16 *DevPathString;\r
+ VOID *DevPath;\r
+\r
+ for (LoopVar = 0 ; LoopVar < OrderCount ; LoopVar++) {\r
+ Buffer = NULL;\r
+ BufferSize = 0;\r
+ UnicodeSPrint(VariableName, sizeof(VariableName), L"%s%04x", Op, LoopVar);\r
+\r
+ Status = gRT->GetVariable(\r
+ VariableName,\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ Buffer);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ Buffer = AllocatePool(BufferSize);\r
+ Status = gRT->GetVariable(\r
+ VariableName,\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ Buffer);\r
+ }\r
+\r
+ if (EFI_ERROR(Status) || Buffer == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_READ_FAIL), gShellDebug1HiiHandle, VariableName, Status);\r
+ return (SHELL_INVALID_PARAMETER);\r
+ }\r
+\r
+ DevPath = AllocatePool(*(UINT16*)(Buffer+4));\r
+ CopyMem(DevPath, Buffer+6+StrSize((CHAR16*)(Buffer+6)), *(UINT16*)(Buffer+4));\r
+ DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN(STR_BCFG_LOAD_OPTIONS),\r
+ gShellDebug1HiiHandle,\r
+ VariableName,\r
+ (CHAR16*)(Buffer+6),\r
+ DevPathString,\r
+ (StrSize((CHAR16*)(Buffer+6)) + *(UINT16*)(Buffer+4) + 6) <= BufferSize?L'N':L'Y');\r
+ if (VerboseOutput) {\r
+ for (LoopVar2 = (StrSize((CHAR16*)(Buffer+6)) + *(UINT16*)(Buffer+4) + 6);LoopVar2<BufferSize;LoopVar2++){\r
+ ShellPrintEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ L"%02x",\r
+ Buffer[LoopVar2]);\r
+ }\r
+ ShellPrintEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ L"\r\n");\r
+ }\r
+\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r
+ if (DevPath != NULL) {\r
+ FreePool(DevPath);\r
+ }\r
+ if (DevPathString != NULL) {\r
+ FreePool(DevPathString);\r
+ }\r
+ }\r
+ return (SHELL_SUCCESS);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InitBcfgStruct(\r
+ IN BGFG_OPERATION *Struct\r
+ )\r
+{\r
+ ASSERT(Struct != NULL);\r
+ Struct->Target = BCFG_TARGET_MAX;\r
+ Struct->Type = BCFG_TYPE_MAX;\r
+ Struct->Number1 = 0;\r
+ Struct->Number2 = 0;\r
+ Struct->HandleIndex = 0;\r
+ Struct->FileName = NULL;\r
+ Struct->Description = NULL;\r
+ Struct->Order = NULL;\r
+ Struct->OptData = NULL;\r
+}\r
+\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-v", TypeFlag},\r
+ {L"-opt", TypeMaxValue},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+/**\r
+ Function for 'bcfg' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunBcfg (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN ParamNumber;\r
+ CONST CHAR16 *CurrentParam;\r
+ BGFG_OPERATION CurrentOperation;\r
+ UINTN Length;\r
+\r
+ Length = 0;\r
+ ProblemParam = NULL;\r
+ Package = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
+\r
+ InitBcfgStruct(&CurrentOperation);\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ //\r
+ // small block to read the target of the operation\r
+ //\r
+ if (ShellCommandLineGetCount(Package) < 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"driver") == 0) {\r
+ CurrentOperation.Target = BCFG_TARGET_DRIVER_ORDER;\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)ShellCommandLineGetRawValue(Package, 1), L"boot") == 0) {\r
+ CurrentOperation.Target = BCFG_TARGET_BOOT_ORDER;\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_NO_DRIVER_BOOT), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+\r
+ //\r
+ // Read in if we are doing -OPT\r
+ //\r
+ if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BCFG_TARGET_MAX && ShellCommandLineGetFlag(Package, L"-opt")) {\r
+ CurrentOperation.OptData = ShellCommandLineGetValue(Package, L"-opt");\r
+ CurrentOperation.Type = BCFG_TYPE_OPT;\r
+ }\r
+\r
+ //\r
+ // Read in the boot or driver order environment variable (not needed for opt)\r
+ //\r
+ if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BCFG_TARGET_MAX && CurrentOperation.Type != BCFG_TYPE_OPT) {\r
+ Length = 0;\r
+ Status = gRT->GetVariable(\r
+ CurrentOperation.Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &Length,\r
+ CurrentOperation.Order);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ CurrentOperation.Order = AllocatePool(Length+(4*sizeof(CurrentOperation.Order[0])));\r
+ Status = gRT->GetVariable(\r
+ CurrentOperation.Target == BCFG_TARGET_BOOT_ORDER?(CHAR16*)L"BootOrder":(CHAR16*)L"DriverOrder",\r
+ (EFI_GUID*)&gEfiGlobalVariableGuid,\r
+ NULL,\r
+ &Length,\r
+ CurrentOperation.Order);\r
+ }\r
+ }\r
+\r
+ //\r
+ // large block to read the type of operation and verify parameter types for the info.\r
+ //\r
+ if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BCFG_TARGET_MAX) {\r
+ for (ParamNumber = 2 ; ParamNumber < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS; ParamNumber++) {\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ParamNumber);\r
+ if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"dump") == 0) {\r
+ CurrentOperation.Type = BCFG_TYPE_DUMP;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-v")) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"-v (without dump)");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"add") == 0) {\r
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentOperation.Type = BCFG_TYPE_ADD;\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number1 = (UINT16)StrHexToUintn(CurrentParam);\r
+ ASSERT(CurrentOperation.FileName == NULL);\r
+ CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);\r
+ ASSERT(CurrentOperation.Description == NULL);\r
+ CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);\r
+ }\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addp") == 0) {\r
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentOperation.Type = BCFG_TYPE_ADDP;\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number1 = (UINT16)StrHexToUintn(CurrentParam);\r
+ ASSERT(CurrentOperation.FileName == NULL);\r
+ CurrentOperation.FileName = StrnCatGrow(&CurrentOperation.FileName , NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);\r
+ ASSERT(CurrentOperation.Description == NULL);\r
+ CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);\r
+ }\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"addh") == 0) {\r
+ if ((ParamNumber + 3) >= ShellCommandLineGetCount(Package)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentOperation.Type = BCFG_TYPE_ADDH;\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number1 = (UINT16)StrHexToUintn(CurrentParam);\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.HandleIndex = (UINT16)StrHexToUintn(CurrentParam);\r
+ ASSERT(CurrentOperation.Description == NULL);\r
+ CurrentOperation.Description = StrnCatGrow(&CurrentOperation.Description, NULL, ShellCommandLineGetRawValue(Package, ++ParamNumber), 0);\r
+ }\r
+ }\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"rm") == 0) {\r
+ if ((ParamNumber + 1) >= ShellCommandLineGetCount(Package)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentOperation.Type = BCFG_TYPE_RM;\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number1 = (UINT16)StrHexToUintn(CurrentParam);\r
+ if (CurrentOperation.Number1 > (Length / sizeof(CurrentOperation.Order[0]))){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellDebug1HiiHandle, Length / sizeof(CurrentOperation.Order[0]));\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ } else if (gUnicodeCollation->StriColl(gUnicodeCollation, (CHAR16*)CurrentParam, L"mv") == 0) {\r
+ if ((ParamNumber + 2) >= ShellCommandLineGetCount(Package)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentOperation.Type = BCFG_TYPE_MV;\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number1 = (UINT16)StrHexToUintn(CurrentParam);\r
+ if (CurrentOperation.Number1 > (Length / sizeof(CurrentOperation.Order[0]))){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellDebug1HiiHandle, Length / sizeof(CurrentOperation.Order[0]));\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ CurrentParam = ShellCommandLineGetRawValue(Package, ++ParamNumber);\r
+ if (CurrentParam == NULL || !ShellIsHexOrDecimalNumber(CurrentParam, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ CurrentOperation.Number2 = (UINT16)StrHexToUintn(CurrentParam);\r
+ }\r
+ if (CurrentOperation.Number2 == CurrentOperation.Number1\r
+ ||CurrentOperation.Number1 > (Length / sizeof(CurrentOperation.Order[0]))\r
+ ||CurrentOperation.Number2 > (Length / sizeof(CurrentOperation.Order[0]))\r
+ ){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_BCFG_NUMB_RANGE), gShellDebug1HiiHandle, Length / sizeof(CurrentOperation.Order[0]));\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, CurrentParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ }\r
+ if (ShellStatus == SHELL_SUCCESS && CurrentOperation.Target < BCFG_TARGET_MAX && CurrentOperation.Type < BCFG_TYPE_MAX) {\r
+ //\r
+ // we have all the info. Do the work\r
+ //\r
+ switch (CurrentOperation.Type) {\r
+ case BCFG_TYPE_DUMP:\r
+ ShellStatus = BcfgDisplayDump(\r
+ CurrentOperation.Target == BCFG_TARGET_BOOT_ORDER?L"Boot":L"Driver",\r
+ Length / sizeof(CurrentOperation.Order[0]),\r
+ ShellCommandLineGetFlag(Package, L"-v"));\r
+ break;\r
+ case BCFG_TYPE_MV:\r
+ ShellStatus = BcfgMove(\r
+ CurrentOperation.Target,\r
+ CurrentOperation.Order,\r
+ Length / sizeof(CurrentOperation.Order[0]),\r
+ CurrentOperation.Number1,\r
+ CurrentOperation.Number2);\r
+ break;\r
+ case BCFG_TYPE_RM:\r
+ ShellStatus = BcfgRemove(\r
+ CurrentOperation.Target,\r
+ CurrentOperation.Order,\r
+ Length / sizeof(CurrentOperation.Order[0]),\r
+ CurrentOperation.Number1);\r
+ break;\r
+ case BCFG_TYPE_ADD:\r
+ case BCFG_TYPE_ADDP:\r
+ case BCFG_TYPE_ADDH:\r
+ ShellStatus = BcfgAdd(\r
+ CurrentOperation.Number1,\r
+ CurrentOperation.FileName,\r
+ CurrentOperation.Description,\r
+ CurrentOperation.Order,\r
+ Length,\r
+ CurrentOperation.Target,\r
+ (BOOLEAN)(CurrentOperation.Type == BCFG_TYPE_ADDH),\r
+ (BOOLEAN)(CurrentOperation.Type == BCFG_TYPE_ADDP),\r
+ CurrentOperation.HandleIndex);\r
+ break;\r
+ case BCFG_TYPE_OPT:\r
+ default:\r
+ ASSERT(FALSE);\r
+ }\r
+ }\r
+ }\r
+\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ if (CurrentOperation.FileName != NULL) {\r
+ FreePool(CurrentOperation.FileName);\r
+ }\r
+ if (CurrentOperation.Description != NULL) {\r
+ FreePool(CurrentOperation.Description);\r
+ }\r
+ if (CurrentOperation.Order != NULL) {\r
+ FreePool(CurrentOperation.Order);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for Comp shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunComp (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN LoopVar;\r
+ SHELL_FILE_HANDLE FileHandle1;\r
+ SHELL_FILE_HANDLE FileHandle2;\r
+ UINT8 ErrorCount;\r
+ UINT64 Size1;\r
+ UINT64 Size2;\r
+ UINT8 DataFromFile1;\r
+ UINT8 DataFromFile2;\r
+ UINT8 ADF_File11;\r
+ UINT8 ADF_File12;\r
+ UINT8 ADF_File13;\r
+ UINT8 ADF_File21;\r
+ UINT8 ADF_File22;\r
+ UINT8 ADF_File23;\r
+ UINTN DataSizeFromFile1;\r
+ UINTN DataSizeFromFile2;\r
+ CHAR16 *FileName1;\r
+ CHAR16 *FileName2;\r
+\r
+ ErrorCount = 0;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ FileName1 = NULL;\r
+ FileName2 = NULL;\r
+ FileHandle1 = NULL;\r
+ FileHandle2 = NULL;\r
+ Size1 = 0;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) < 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ FileName1 = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 1));\r
+ FileName2 = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 2));\r
+ Status = ShellOpenFileByName(FileName1, &FileHandle1, EFI_FILE_MODE_READ, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 1), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ Status = ShellOpenFileByName(FileName2, &FileHandle2, EFI_FILE_MODE_READ, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ if (FileHandleIsDirectory(FileHandle1) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, FileName1);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ if (FileHandleIsDirectory(FileHandle2) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, FileName2);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_HEADER), gShellDebug1HiiHandle, FileName1, FileName2);\r
+ Status = gEfiShellProtocol->GetFileSize(FileHandle1, &Size1);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = gEfiShellProtocol->GetFileSize(FileHandle2, &Size2);\r
+ ASSERT_EFI_ERROR(Status);\r
+ if (Size1 != Size2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_SIZE_FAIL), gShellDebug1HiiHandle);\r
+ ErrorCount++;\r
+ ShellStatus = SHELL_NOT_EQUAL;\r
+ }\r
+ }\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ for (LoopVar = 0 ; LoopVar < Size1 && ErrorCount <= 10 ; LoopVar++) {\r
+ DataSizeFromFile1 = 1;\r
+ DataSizeFromFile2 = 1;\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle1, &DataSizeFromFile1, &DataFromFile1);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &DataFromFile2);\r
+ ASSERT_EFI_ERROR(Status);\r
+ if (DataFromFile1 != DataFromFile2) {\r
+ ADF_File11 = 0;\r
+ ADF_File12 = 0;\r
+ ADF_File13 = 0;\r
+ ADF_File21 = 0;\r
+ ADF_File22 = 0;\r
+ ADF_File23 = 0;\r
+ if (LoopVar + 1 < Size1) {\r
+ LoopVar++;\r
+ DataSizeFromFile1 = 1;\r
+ DataSizeFromFile2 = 1;\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle1, &DataSizeFromFile1, &ADF_File11);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &ADF_File21);\r
+ ASSERT_EFI_ERROR(Status);\r
+ if (LoopVar + 1 < Size1) {\r
+ LoopVar++;\r
+ DataSizeFromFile1 = 1;\r
+ DataSizeFromFile2 = 1;\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle1, &DataSizeFromFile1, &ADF_File12);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &ADF_File22);\r
+ ASSERT_EFI_ERROR(Status);\r
+ if (LoopVar + 1 < Size1) {\r
+ LoopVar++;\r
+ DataSizeFromFile1 = 1;\r
+ DataSizeFromFile2 = 1;\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle1, &DataSizeFromFile1, &ADF_File13);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = gEfiShellProtocol->ReadFile(FileHandle2, &DataSizeFromFile2, &ADF_File23);\r
+ ASSERT_EFI_ERROR(Status);\r
+ }\r
+ }\r
+ }\r
+ if (ADF_File13 != ADF_File23) {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_COMP_SPOT_FAIL4),\r
+ gShellDebug1HiiHandle,\r
+ ++ErrorCount,\r
+ FileName1,\r
+ LoopVar,\r
+ DataFromFile1, ADF_File11, ADF_File12, ADF_File13,\r
+ DataFromFile1, ADF_File11, ADF_File12, ADF_File13,\r
+ FileName2,\r
+ LoopVar,\r
+ DataFromFile2, ADF_File21, ADF_File22, ADF_File23,\r
+ DataFromFile2, ADF_File21, ADF_File22, ADF_File23\r
+ );\r
+ } else if (ADF_File12 != ADF_File22) {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_COMP_SPOT_FAIL3),\r
+ gShellDebug1HiiHandle,\r
+ ++ErrorCount,\r
+ FileName1,\r
+ LoopVar,\r
+ DataFromFile1, ADF_File11, ADF_File12,\r
+ DataFromFile1, ADF_File11, ADF_File12,\r
+ FileName2,\r
+ LoopVar,\r
+ DataFromFile2, ADF_File21, ADF_File22,\r
+ DataFromFile2, ADF_File21, ADF_File22\r
+ );\r
+ } else if (ADF_File11 != ADF_File21) {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_COMP_SPOT_FAIL2),\r
+ gShellDebug1HiiHandle,\r
+ ++ErrorCount,\r
+ FileName1,\r
+ LoopVar,\r
+ DataFromFile1, ADF_File11,\r
+ DataFromFile1, ADF_File11,\r
+ FileName2,\r
+ LoopVar,\r
+ DataFromFile2, ADF_File21,\r
+ DataFromFile2, ADF_File21\r
+ );\r
+ } else {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_COMP_SPOT_FAIL1),\r
+ gShellDebug1HiiHandle,\r
+ ++ErrorCount,\r
+ FileName1,\r
+ LoopVar,\r
+ DataFromFile1,\r
+ DataFromFile1,\r
+ FileName2,\r
+ LoopVar,\r
+ DataFromFile2,\r
+ DataFromFile2\r
+ );\r
+ }\r
+ ShellStatus = SHELL_NOT_EQUAL;\r
+ }\r
+ }\r
+ }\r
+ if (ErrorCount == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_PASS), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_COMP_FOOTER_FAIL), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ if (FileName1 != NULL) {\r
+ FreePool(FileName1);\r
+ }\r
+ if (FileName2 != NULL) {\r
+ FreePool(FileName2);\r
+ }\r
+ if (FileHandle1 != NULL) {\r
+ gEfiShellProtocol->CloseFile(FileHandle1);\r
+ }\r
+ if (FileHandle2 != NULL) {\r
+ gEfiShellProtocol->CloseFile(FileHandle2);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for compression routine.\r
+\r
+ Compression routine. The compression algorithm is a mixture of\r
+ LZ77 and Huffman coding. LZ77 transforms the source data into a\r
+ sequence of Original Characters and Pointers to repeated strings.\r
+ This sequence is further divided into Blocks and Huffman codings\r
+ are applied to each Block.\r
+\r
+ Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <ShellBase.h>\r
+\r
+//\r
+// Macro Definitions\r
+//\r
+typedef INT16 NODE;\r
+#define UINT8_MAX 0xff\r
+#define UINT8_BIT 8\r
+#define THRESHOLD 3\r
+#define INIT_CRC 0\r
+#define WNDBIT 13\r
+#define WNDSIZ (1U << WNDBIT)\r
+#define MAXMATCH 256\r
+#define BLKSIZ (1U << 14) // 16 * 1024U\r
+#define PERC_FLAG 0x8000U\r
+#define CODE_BIT 16\r
+#define NIL 0\r
+#define MAX_HASH_VAL (3 * WNDSIZ + (WNDSIZ / 512 + 1) * UINT8_MAX)\r
+#define HASH(p, c) ((p) + ((c) << (WNDBIT - 9)) + WNDSIZ * 2)\r
+#define CRCPOLY 0xA001\r
+#define UPDATE_CRC(c) mCrc = mCrcTable[(mCrc ^ (c)) & 0xFF] ^ (mCrc >> UINT8_BIT)\r
+\r
+//\r
+// C: the Char&Len Set; P: the Position Set; T: the exTra Set\r
+//\r
+#define NC (UINT8_MAX + MAXMATCH + 2 - THRESHOLD)\r
+#define CBIT 9\r
+#define NP (WNDBIT + 1)\r
+#define PBIT 4\r
+#define NT (CODE_BIT + 3)\r
+#define TBIT 5\r
+#if NT > NP\r
+ #define NPT NT\r
+#else\r
+ #define NPT NP\r
+#endif\r
+//\r
+// Function Prototypes\r
+//\r
+\r
+/**\r
+ Put a dword to output stream\r
+\r
+ @param[in] Data The dword to put.\r
+**/\r
+VOID\r
+EFIAPI\r
+PutDword(\r
+ IN UINT32 Data\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+AllocateMemory (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+FreeMemory (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+InitSlide (\r
+ VOID\r
+ );\r
+\r
+NODE\r
+EFIAPI\r
+Child (\r
+ IN NODE q,\r
+ IN UINT8 c\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+MakeChild (\r
+ IN NODE q,\r
+ IN UINT8 c,\r
+ IN NODE r\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+Split (\r
+ IN NODE Old\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+InsertNode (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+DeleteNode (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+GetNextMatch (\r
+ VOID\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+Encode (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+CountTFreq (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+WritePTLen (\r
+ IN INT32 n,\r
+ IN INT32 nbit,\r
+ IN INT32 Special\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+WriteCLen (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+EncodeC (\r
+ IN INT32 c\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+EncodeP (\r
+ IN UINT32 p\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+SendBlock (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+CompressOutput (\r
+ IN UINT32 c,\r
+ IN UINT32 p\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+HufEncodeStart (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+HufEncodeEnd (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+MakeCrcTable (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+PutBits (\r
+ IN INT32 n,\r
+ IN UINT32 x\r
+ );\r
+\r
+INT32\r
+EFIAPI\r
+FreadCrc (\r
+ OUT UINT8 *p,\r
+ IN INT32 n\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+InitPutBits (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+CountLen (\r
+ IN INT32 i\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+MakeLen (\r
+ IN INT32 Root\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+DownHeap (\r
+ IN INT32 i\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+MakeCode (\r
+ IN INT32 n,\r
+ IN UINT8 Len[ ],\r
+ OUT UINT16 Code[ ]\r
+ );\r
+\r
+INT32\r
+EFIAPI\r
+MakeTree (\r
+ IN INT32 NParm,\r
+ IN UINT16 FreqParm[ ],\r
+ OUT UINT8 LenParm[ ],\r
+ OUT UINT16 CodeParm[ ]\r
+ );\r
+\r
+//\r
+// Global Variables\r
+//\r
+STATIC UINT8 *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;\r
+\r
+STATIC UINT8 *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;\r
+STATIC INT16 mHeap[NC + 1];\r
+STATIC INT32 mRemainder, mMatchLen, mBitCount, mHeapSize, mN;\r
+STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc;\r
+STATIC UINT32 mCompSize, mOrigSize;\r
+\r
+STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC - 1],\r
+ mCrcTable[UINT8_MAX + 1], mCFreq[2 * NC - 1], mCTable[4096], mCCode[NC],\r
+ mPFreq[2 * NP - 1], mPTCode[NPT], mTFreq[2 * NT - 1];\r
+\r
+STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;\r
+\r
+//\r
+// functions\r
+//\r
+/**\r
+ The compression routine.\r
+\r
+ @param[in] SrcBuffer The buffer containing the source data.\r
+ @param[in] SrcSizae Number of bytes in SrcBuffer.\r
+ @param[in] DstBuffer The buffer to put the compressed image in.\r
+ @param[in,out] DstSize On input the size (in bytes) of DstBuffer, on\r
+ return the number of bytes placed in DstBuffer.\r
+\r
+ @retval EFI_SUCCESS The compression was sucessful.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer was too small. DstSize is required.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Compress (\r
+ IN VOID *SrcBuffer,\r
+ IN UINT64 SrcSize,\r
+ IN VOID *DstBuffer,\r
+ IN OUT UINT64 *DstSize\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Initializations\r
+ //\r
+ mBufSiz = 0;\r
+ mBuf = NULL;\r
+ mText = NULL;\r
+ mLevel = NULL;\r
+ mChildCount = NULL;\r
+ mPosition = NULL;\r
+ mParent = NULL;\r
+ mPrev = NULL;\r
+ mNext = NULL;\r
+\r
+ mSrc = SrcBuffer;\r
+ mSrcUpperLimit = mSrc + SrcSize;\r
+ mDst = DstBuffer;\r
+ mDstUpperLimit = mDst +*DstSize;\r
+\r
+ PutDword (0L);\r
+ PutDword (0L);\r
+\r
+ MakeCrcTable ();\r
+\r
+ mOrigSize = mCompSize = 0;\r
+ mCrc = INIT_CRC;\r
+\r
+ //\r
+ // Compress it\r
+ //\r
+ Status = Encode ();\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+ //\r
+ // Null terminate the compressed data\r
+ //\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = 0;\r
+ }\r
+ //\r
+ // Fill in compressed size and original size\r
+ //\r
+ mDst = DstBuffer;\r
+ PutDword (mCompSize + 1);\r
+ PutDword (mOrigSize);\r
+\r
+ //\r
+ // Return\r
+ //\r
+ if (mCompSize + 1 + 8 > *DstSize) {\r
+ *DstSize = mCompSize + 1 + 8;\r
+ return EFI_BUFFER_TOO_SMALL;\r
+ } else {\r
+ *DstSize = mCompSize + 1 + 8;\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+}\r
+\r
+/**\r
+ Put a dword to output stream\r
+\r
+ @param[in] Data The dword to put.\r
+**/\r
+VOID\r
+EFIAPI\r
+PutDword (\r
+ IN UINT32 Data\r
+ )\r
+{\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = (UINT8) (((UINT8) (Data)) & 0xff);\r
+ }\r
+\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x08)) & 0xff);\r
+ }\r
+\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x10)) & 0xff);\r
+ }\r
+\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = (UINT8) (((UINT8) (Data >> 0x18)) & 0xff);\r
+ }\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+AllocateMemory (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Allocate memory spaces for data structures used in compression process\r
+\r
+Arguments:\r
+\r
+ None\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - Memory is allocated successfully\r
+ EFI_OUT_OF_RESOURCES - Allocation fails\r
+\r
+**/\r
+{\r
+ mText = AllocateZeroPool (WNDSIZ * 2 + MAXMATCH);\r
+ mLevel = AllocatePool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mLevel));\r
+ mChildCount = AllocatePool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mChildCount));\r
+ mPosition = AllocatePool ((WNDSIZ + UINT8_MAX + 1) * sizeof (*mPosition));\r
+ mParent = AllocatePool (WNDSIZ * 2 * sizeof (*mParent));\r
+ mPrev = AllocatePool (WNDSIZ * 2 * sizeof (*mPrev));\r
+ mNext = AllocatePool ((MAX_HASH_VAL + 1) * sizeof (*mNext));\r
+\r
+ mBufSiz = BLKSIZ;\r
+ mBuf = AllocatePool (mBufSiz);\r
+ while (mBuf == NULL) {\r
+ mBufSiz = (mBufSiz / 10U) * 9U;\r
+ if (mBufSiz < 4 * 1024U) {\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ mBuf = AllocatePool (mBufSiz);\r
+ }\r
+\r
+ mBuf[0] = 0;\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+FreeMemory (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Called when compression is completed to free memory previously allocated.\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ SHELL_FREE_NON_NULL (mText);\r
+ SHELL_FREE_NON_NULL (mLevel);\r
+ SHELL_FREE_NON_NULL (mChildCount);\r
+ SHELL_FREE_NON_NULL (mPosition);\r
+ SHELL_FREE_NON_NULL (mParent);\r
+ SHELL_FREE_NON_NULL (mPrev);\r
+ SHELL_FREE_NON_NULL (mNext);\r
+ SHELL_FREE_NON_NULL (mBuf);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InitSlide (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Initialize String Info Log data structures\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ NODE i;\r
+\r
+ SetMem (mLevel + WNDSIZ, (UINT8_MAX + 1) * sizeof (UINT8), 1);\r
+ SetMem (mPosition + WNDSIZ, (UINT8_MAX + 1) * sizeof (NODE), 0);\r
+\r
+ SetMem (mParent + WNDSIZ, WNDSIZ * sizeof (NODE), 0);\r
+\r
+ mAvail = 1;\r
+ for (i = 1; i < WNDSIZ - 1; i++) {\r
+ mNext[i] = (NODE) (i + 1);\r
+ }\r
+\r
+ mNext[WNDSIZ - 1] = NIL;\r
+ SetMem (mNext + WNDSIZ * 2, (MAX_HASH_VAL - WNDSIZ * 2 + 1) * sizeof (NODE), 0);\r
+}\r
+\r
+NODE\r
+EFIAPI\r
+Child (\r
+ IN NODE q,\r
+ IN UINT8 c\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Find child node given the parent node and the edge character\r
+\r
+Arguments:\r
+\r
+ q - the parent node\r
+ c - the edge character\r
+\r
+Returns:\r
+\r
+ The child node (NIL if not found)\r
+\r
+**/\r
+{\r
+ NODE r;\r
+\r
+ r = mNext[HASH (q, c)];\r
+ mParent[NIL] = q; /* sentinel */\r
+ while (mParent[r] != q) {\r
+ r = mNext[r];\r
+ }\r
+\r
+ return r;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+MakeChild (\r
+ IN NODE q,\r
+ IN UINT8 c,\r
+ IN NODE r\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create a new child for a given parent node.\r
+\r
+Arguments:\r
+\r
+ q - the parent node\r
+ c - the edge character\r
+ r - the child node\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ NODE h;\r
+\r
+ NODE t;\r
+\r
+ h = (NODE) HASH (q, c);\r
+ t = mNext[h];\r
+ mNext[h] = r;\r
+ mNext[r] = t;\r
+ mPrev[t] = r;\r
+ mPrev[r] = h;\r
+ mParent[r] = q;\r
+ mChildCount[q]++;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+Split (\r
+ NODE Old\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Split a node.\r
+\r
+Arguments:\r
+\r
+ Old - the node to split\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ NODE New;\r
+\r
+ NODE t;\r
+\r
+ New = mAvail;\r
+ mAvail = mNext[New];\r
+ mChildCount[New] = 0;\r
+ t = mPrev[Old];\r
+ mPrev[New] = t;\r
+ mNext[t] = New;\r
+ t = mNext[Old];\r
+ mNext[New] = t;\r
+ mPrev[t] = New;\r
+ mParent[New] = mParent[Old];\r
+ mLevel[New] = (UINT8) mMatchLen;\r
+ mPosition[New] = mPos;\r
+ MakeChild (New, mText[mMatchPos + mMatchLen], Old);\r
+ MakeChild (New, mText[mPos + mMatchLen], mPos);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InsertNode (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Insert string info for current position into the String Info Log\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ NODE q;\r
+\r
+ NODE r;\r
+\r
+ NODE j;\r
+\r
+ NODE t;\r
+ UINT8 c;\r
+ UINT8 *t1;\r
+ UINT8 *t2;\r
+\r
+ if (mMatchLen >= 4) {\r
+ //\r
+ // We have just got a long match, the target tree\r
+ // can be located by MatchPos + 1. Travese the tree\r
+ // from bottom up to get to a proper starting point.\r
+ // The usage of PERC_FLAG ensures proper node deletion\r
+ // in DeleteNode() later.\r
+ //\r
+ mMatchLen--;\r
+ r = (NODE) ((mMatchPos + 1) | WNDSIZ);\r
+ q = mParent[r];\r
+ while (q == NIL) {\r
+ r = mNext[r];\r
+ q = mParent[r];\r
+ }\r
+\r
+ while (mLevel[q] >= mMatchLen) {\r
+ r = q;\r
+ q = mParent[q];\r
+ }\r
+\r
+ t = q;\r
+ while (mPosition[t] < 0) {\r
+ mPosition[t] = mPos;\r
+ t = mParent[t];\r
+ }\r
+\r
+ if (t < WNDSIZ) {\r
+ mPosition[t] = (NODE) (mPos | PERC_FLAG);\r
+ }\r
+ } else {\r
+ //\r
+ // Locate the target tree\r
+ //\r
+ q = (NODE) (mText[mPos] + WNDSIZ);\r
+ c = mText[mPos + 1];\r
+ r = Child (q, c);\r
+ if (r == NIL) {\r
+ MakeChild (q, c, mPos);\r
+ mMatchLen = 1;\r
+ return ;\r
+ }\r
+\r
+ mMatchLen = 2;\r
+ }\r
+ //\r
+ // Traverse down the tree to find a match.\r
+ // Update Position value along the route.\r
+ // Node split or creation is involved.\r
+ //\r
+ for (;;) {\r
+ if (r >= WNDSIZ) {\r
+ j = MAXMATCH;\r
+ mMatchPos = r;\r
+ } else {\r
+ j = mLevel[r];\r
+ mMatchPos = (NODE) (mPosition[r] & ~PERC_FLAG);\r
+ }\r
+\r
+ if (mMatchPos >= mPos) {\r
+ mMatchPos -= WNDSIZ;\r
+ }\r
+\r
+ t1 = &mText[mPos + mMatchLen];\r
+ t2 = &mText[mMatchPos + mMatchLen];\r
+ while (mMatchLen < j) {\r
+ if (*t1 != *t2) {\r
+ Split (r);\r
+ return ;\r
+ }\r
+\r
+ mMatchLen++;\r
+ t1++;\r
+ t2++;\r
+ }\r
+\r
+ if (mMatchLen >= MAXMATCH) {\r
+ break;\r
+ }\r
+\r
+ mPosition[r] = mPos;\r
+ q = r;\r
+ r = Child (q, *t1);\r
+ if (r == NIL) {\r
+ MakeChild (q, *t1, mPos);\r
+ return ;\r
+ }\r
+\r
+ mMatchLen++;\r
+ }\r
+\r
+ t = mPrev[r];\r
+ mPrev[mPos] = t;\r
+ mNext[t] = mPos;\r
+ t = mNext[r];\r
+ mNext[mPos] = t;\r
+ mPrev[t] = mPos;\r
+ mParent[mPos] = q;\r
+ mParent[r] = NIL;\r
+\r
+ //\r
+ // Special usage of 'next'\r
+ //\r
+ mNext[r] = mPos;\r
+\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+DeleteNode (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Delete outdated string info. (The Usage of PERC_FLAG\r
+ ensures a clean deletion)\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ NODE q;\r
+\r
+ NODE r;\r
+\r
+ NODE s;\r
+\r
+ NODE t;\r
+\r
+ NODE u;\r
+\r
+ if (mParent[mPos] == NIL) {\r
+ return ;\r
+ }\r
+\r
+ r = mPrev[mPos];\r
+ s = mNext[mPos];\r
+ mNext[r] = s;\r
+ mPrev[s] = r;\r
+ r = mParent[mPos];\r
+ mParent[mPos] = NIL;\r
+ if (r >= WNDSIZ) {\r
+ return ;\r
+ }\r
+\r
+ mChildCount[r]--;\r
+ if (mChildCount[r] > 1) {\r
+ return ;\r
+ }\r
+\r
+ t = (NODE) (mPosition[r] & ~PERC_FLAG);\r
+ if (t >= mPos) {\r
+ t -= WNDSIZ;\r
+ }\r
+\r
+ s = t;\r
+ q = mParent[r];\r
+ u = mPosition[q];\r
+ while ((u & PERC_FLAG) != 0){\r
+ u &= ~PERC_FLAG;\r
+ if (u >= mPos) {\r
+ u -= WNDSIZ;\r
+ }\r
+\r
+ if (u > s) {\r
+ s = u;\r
+ }\r
+\r
+ mPosition[q] = (NODE) (s | WNDSIZ);\r
+ q = mParent[q];\r
+ u = mPosition[q];\r
+ }\r
+\r
+ if (q < WNDSIZ) {\r
+ if (u >= mPos) {\r
+ u -= WNDSIZ;\r
+ }\r
+\r
+ if (u > s) {\r
+ s = u;\r
+ }\r
+\r
+ mPosition[q] = (NODE) (s | WNDSIZ | PERC_FLAG);\r
+ }\r
+\r
+ s = Child (r, mText[t + mLevel[r]]);\r
+ t = mPrev[s];\r
+ u = mNext[s];\r
+ mNext[t] = u;\r
+ mPrev[u] = t;\r
+ t = mPrev[r];\r
+ mNext[t] = s;\r
+ mPrev[s] = t;\r
+ t = mNext[r];\r
+ mPrev[t] = s;\r
+ mNext[s] = t;\r
+ mParent[s] = mParent[r];\r
+ mParent[r] = NIL;\r
+ mNext[r] = mAvail;\r
+ mAvail = r;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+GetNextMatch (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Advance the current position (read in new data if needed).\r
+ Delete outdated string info. Find a match string for current position.\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ INT32 n;\r
+ VOID *Temp;\r
+\r
+ mRemainder--;\r
+ mPos++;\r
+ if (mPos == WNDSIZ * 2) {\r
+ Temp = AllocatePool (WNDSIZ + MAXMATCH);\r
+ CopyMem (Temp, &mText[WNDSIZ], WNDSIZ + MAXMATCH);\r
+ CopyMem (&mText[0], Temp, WNDSIZ + MAXMATCH);\r
+ FreePool (Temp);\r
+ n = FreadCrc (&mText[WNDSIZ + MAXMATCH], WNDSIZ);\r
+ mRemainder += n;\r
+ mPos = WNDSIZ;\r
+ }\r
+\r
+ DeleteNode ();\r
+ InsertNode ();\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+Encode (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ The main controlling routine for compression process.\r
+\r
+Arguments: (VOID)\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The compression is successful\r
+ EFI_OUT_0F_RESOURCES - Not enough memory for compression process\r
+\r
+**/\r
+{\r
+ EFI_STATUS Status;\r
+ INT32 LastMatchLen;\r
+ NODE LastMatchPos;\r
+\r
+ Status = AllocateMemory ();\r
+ if (EFI_ERROR (Status)) {\r
+ FreeMemory ();\r
+ return Status;\r
+ }\r
+\r
+ InitSlide ();\r
+\r
+ HufEncodeStart ();\r
+\r
+ mRemainder = FreadCrc (&mText[WNDSIZ], WNDSIZ + MAXMATCH);\r
+\r
+ mMatchLen = 0;\r
+ mPos = WNDSIZ;\r
+ InsertNode ();\r
+ if (mMatchLen > mRemainder) {\r
+ mMatchLen = mRemainder;\r
+ }\r
+\r
+ while (mRemainder > 0) {\r
+ LastMatchLen = mMatchLen;\r
+ LastMatchPos = mMatchPos;\r
+ GetNextMatch ();\r
+ if (mMatchLen > mRemainder) {\r
+ mMatchLen = mRemainder;\r
+ }\r
+\r
+ if (mMatchLen > LastMatchLen || LastMatchLen < THRESHOLD) {\r
+ //\r
+ // Not enough benefits are gained by outputting a pointer,\r
+ // so just output the original character\r
+ //\r
+ CompressOutput(mText[mPos - 1], 0);\r
+ } else {\r
+ //\r
+ // Outputting a pointer is beneficial enough, do it.\r
+ //\r
+\r
+ CompressOutput(LastMatchLen + (UINT8_MAX + 1 - THRESHOLD),\r
+ (mPos - LastMatchPos - 2) & (WNDSIZ - 1));\r
+ LastMatchLen--;\r
+ while (LastMatchLen > 0) {\r
+ GetNextMatch ();\r
+ LastMatchLen--;\r
+ }\r
+\r
+ if (mMatchLen > mRemainder) {\r
+ mMatchLen = mRemainder;\r
+ }\r
+ }\r
+ }\r
+\r
+ HufEncodeEnd ();\r
+ FreeMemory ();\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+CountTFreq (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Count the frequencies for the Extra Set\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ INT32 k;\r
+\r
+ INT32 n;\r
+\r
+ INT32 Count;\r
+\r
+ for (i = 0; i < NT; i++) {\r
+ mTFreq[i] = 0;\r
+ }\r
+\r
+ n = NC;\r
+ while (n > 0 && mCLen[n - 1] == 0) {\r
+ n--;\r
+ }\r
+\r
+ i = 0;\r
+ while (i < n) {\r
+ k = mCLen[i++];\r
+ if (k == 0) {\r
+ Count = 1;\r
+ while (i < n && mCLen[i] == 0) {\r
+ i++;\r
+ Count++;\r
+ }\r
+\r
+ if (Count <= 2) {\r
+ mTFreq[0] = (UINT16) (mTFreq[0] + Count);\r
+ } else if (Count <= 18) {\r
+ mTFreq[1]++;\r
+ } else if (Count == 19) {\r
+ mTFreq[0]++;\r
+ mTFreq[1]++;\r
+ } else {\r
+ mTFreq[2]++;\r
+ }\r
+ } else {\r
+ ASSERT((k+2)<(2 * NT - 1));\r
+ mTFreq[k + 2]++;\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+WritePTLen (\r
+ IN INT32 n,\r
+ IN INT32 nbit,\r
+ IN INT32 Special\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Outputs the code length array for the Extra Set or the Position Set.\r
+\r
+Arguments:\r
+\r
+ n - the number of symbols\r
+ nbit - the number of bits needed to represent 'n'\r
+ Special - the special symbol that needs to be take care of\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ INT32 k;\r
+\r
+ while (n > 0 && mPTLen[n - 1] == 0) {\r
+ n--;\r
+ }\r
+\r
+ PutBits (nbit, n);\r
+ i = 0;\r
+ while (i < n) {\r
+ k = mPTLen[i++];\r
+ if (k <= 6) {\r
+ PutBits (3, k);\r
+ } else {\r
+ PutBits (k - 3, (1U << (k - 3)) - 2);\r
+ }\r
+\r
+ if (i == Special) {\r
+ while (i < 6 && mPTLen[i] == 0) {\r
+ i++;\r
+ }\r
+\r
+ PutBits (2, (i - 3) & 3);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+WriteCLen (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Outputs the code length array for Char&Length Set\r
+\r
+Arguments: (VOID)\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ INT32 k;\r
+\r
+ INT32 n;\r
+\r
+ INT32 Count;\r
+\r
+ n = NC;\r
+ while (n > 0 && mCLen[n - 1] == 0) {\r
+ n--;\r
+ }\r
+\r
+ PutBits (CBIT, n);\r
+ i = 0;\r
+ while (i < n) {\r
+ k = mCLen[i++];\r
+ if (k == 0) {\r
+ Count = 1;\r
+ while (i < n && mCLen[i] == 0) {\r
+ i++;\r
+ Count++;\r
+ }\r
+\r
+ if (Count <= 2) {\r
+ for (k = 0; k < Count; k++) {\r
+ PutBits (mPTLen[0], mPTCode[0]);\r
+ }\r
+ } else if (Count <= 18) {\r
+ PutBits (mPTLen[1], mPTCode[1]);\r
+ PutBits (4, Count - 3);\r
+ } else if (Count == 19) {\r
+ PutBits (mPTLen[0], mPTCode[0]);\r
+ PutBits (mPTLen[1], mPTCode[1]);\r
+ PutBits (4, 15);\r
+ } else {\r
+ PutBits (mPTLen[2], mPTCode[2]);\r
+ PutBits (CBIT, Count - 20);\r
+ }\r
+ } else {\r
+ ASSERT((k+2)<NPT);\r
+ PutBits (mPTLen[k + 2], mPTCode[k + 2]);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+EncodeC (\r
+ IN INT32 c\r
+ )\r
+{\r
+ PutBits (mCLen[c], mCCode[c]);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+EncodeP (\r
+ IN UINT32 p\r
+ )\r
+{\r
+ UINT32 c;\r
+\r
+ UINT32 q;\r
+\r
+ c = 0;\r
+ q = p;\r
+ while (q != 0) {\r
+ q >>= 1;\r
+ c++;\r
+ }\r
+\r
+ PutBits (mPTLen[c], mPTCode[c]);\r
+ if (c > 1) {\r
+ PutBits(c - 1, p & (0xFFFFU >> (17 - c)));\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+SendBlock (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Huffman code the block and output it.\r
+\r
+Arguments:\r
+\r
+ None\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+**/\r
+{\r
+ UINT32 i;\r
+\r
+ UINT32 k;\r
+\r
+ UINT32 Flags;\r
+\r
+ UINT32 Root;\r
+\r
+ UINT32 Pos;\r
+\r
+ UINT32 Size;\r
+ Flags = 0;\r
+\r
+ Root = MakeTree (NC, mCFreq, mCLen, mCCode);\r
+ Size = mCFreq[Root];\r
+ PutBits (16, Size);\r
+ if (Root >= NC) {\r
+ CountTFreq ();\r
+ Root = MakeTree (NT, mTFreq, mPTLen, mPTCode);\r
+ if (Root >= NT) {\r
+ WritePTLen (NT, TBIT, 3);\r
+ } else {\r
+ PutBits (TBIT, 0);\r
+ PutBits (TBIT, Root);\r
+ }\r
+\r
+ WriteCLen ();\r
+ } else {\r
+ PutBits (TBIT, 0);\r
+ PutBits (TBIT, 0);\r
+ PutBits (CBIT, 0);\r
+ PutBits (CBIT, Root);\r
+ }\r
+\r
+ Root = MakeTree (NP, mPFreq, mPTLen, mPTCode);\r
+ if (Root >= NP) {\r
+ WritePTLen (NP, PBIT, -1);\r
+ } else {\r
+ PutBits (PBIT, 0);\r
+ PutBits (PBIT, Root);\r
+ }\r
+\r
+ Pos = 0;\r
+ for (i = 0; i < Size; i++) {\r
+ if (i % UINT8_BIT == 0) {\r
+ Flags = mBuf[Pos++];\r
+ } else {\r
+ Flags <<= 1;\r
+ }\r
+ if ((Flags & (1U << (UINT8_BIT - 1))) != 0){\r
+ EncodeC(mBuf[Pos++] + (1U << UINT8_BIT));\r
+ k = mBuf[Pos++] << UINT8_BIT;\r
+ k += mBuf[Pos++];\r
+\r
+ EncodeP (k);\r
+ } else {\r
+ EncodeC (mBuf[Pos++]);\r
+ }\r
+ }\r
+\r
+ SetMem (mCFreq, NC * sizeof (UINT16), 0);\r
+ SetMem (mPFreq, NP * sizeof (UINT16), 0);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+CompressOutput (\r
+ IN UINT32 c,\r
+ IN UINT32 p\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Outputs an Original Character or a Pointer\r
+\r
+Arguments:\r
+\r
+ c - The original character or the 'String Length' element of a Pointer\r
+ p - The 'Position' field of a Pointer\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ STATIC UINT32 CPos;\r
+\r
+ if ((mOutputMask >>= 1) == 0) {\r
+ mOutputMask = 1U << (UINT8_BIT - 1);\r
+ if (mOutputPos >= mBufSiz - 3 * UINT8_BIT) {\r
+ SendBlock ();\r
+ mOutputPos = 0;\r
+ }\r
+\r
+ CPos = mOutputPos++;\r
+ mBuf[CPos] = 0;\r
+ }\r
+ mBuf[mOutputPos++] = (UINT8) c;\r
+ mCFreq[c]++;\r
+ if (c >= (1U << UINT8_BIT)) {\r
+ mBuf[CPos] = (UINT8)(mBuf[CPos]|mOutputMask);\r
+ mBuf[mOutputPos++] = (UINT8)(p >> UINT8_BIT);\r
+ mBuf[mOutputPos++] = (UINT8) p;\r
+ c = 0;\r
+ while (p!=0) {\r
+ p >>= 1;\r
+ c++;\r
+ }\r
+ mPFreq[c]++;\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+HufEncodeStart (\r
+ VOID\r
+ )\r
+{\r
+ SetMem (mCFreq, NC * sizeof (UINT16), 0);\r
+ SetMem (mPFreq, NP * sizeof (UINT16), 0);\r
+\r
+ mOutputPos = mOutputMask = 0;\r
+ InitPutBits ();\r
+ return ;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+HufEncodeEnd (\r
+ VOID\r
+ )\r
+{\r
+ SendBlock ();\r
+\r
+ //\r
+ // Flush remaining bits\r
+ //\r
+ PutBits (UINT8_BIT - 1, 0);\r
+\r
+ return ;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+MakeCrcTable (\r
+ VOID\r
+ )\r
+{\r
+ UINT32 i;\r
+\r
+ UINT32 j;\r
+\r
+ UINT32 r;\r
+\r
+ for (i = 0; i <= UINT8_MAX; i++) {\r
+ r = i;\r
+ for (j = 0; j < UINT8_BIT; j++) {\r
+ if ((r & 1) != 0) {\r
+ r = (r >> 1) ^ CRCPOLY;\r
+ } else {\r
+ r >>= 1;\r
+ }\r
+ }\r
+\r
+ mCrcTable[i] = (UINT16) r;\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+PutBits (\r
+ IN INT32 n,\r
+ IN UINT32 x\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Outputs rightmost n bits of x\r
+\r
+Arguments:\r
+\r
+ n - the rightmost n bits of the data is used\r
+ x - the data\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+**/\r
+{\r
+ UINT8 Temp;\r
+\r
+ if (n < mBitCount) {\r
+ mSubBitBuf |= x << (mBitCount -= n);\r
+ } else {\r
+\r
+ Temp = (UINT8)(mSubBitBuf | (x >> (n -= mBitCount)));\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = Temp;\r
+ }\r
+ mCompSize++;\r
+\r
+ if (n < UINT8_BIT) {\r
+ mSubBitBuf = x << (mBitCount = UINT8_BIT - n);\r
+ } else {\r
+\r
+ Temp = (UINT8)(x >> (n - UINT8_BIT));\r
+ if (mDst < mDstUpperLimit) {\r
+ *mDst++ = Temp;\r
+ }\r
+ mCompSize++;\r
+\r
+ mSubBitBuf = x << (mBitCount = 2 * UINT8_BIT - n);\r
+ }\r
+ }\r
+}\r
+\r
+INT32\r
+EFIAPI\r
+FreadCrc (\r
+ OUT UINT8 *p,\r
+ IN INT32 n\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Read in source data\r
+\r
+Arguments:\r
+\r
+ p - the buffer to hold the data\r
+ n - number of bytes to read\r
+\r
+Returns:\r
+\r
+ number of bytes actually read\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ for (i = 0; mSrc < mSrcUpperLimit && i < n; i++) {\r
+ *p++ = *mSrc++;\r
+ }\r
+\r
+ n = i;\r
+\r
+ p -= n;\r
+ mOrigSize += n;\r
+ i--;\r
+ while (i >= 0) {\r
+ UPDATE_CRC (*p++);\r
+ i--;\r
+ }\r
+\r
+ return n;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+InitPutBits (\r
+ VOID\r
+ )\r
+{\r
+ mBitCount = UINT8_BIT;\r
+ mSubBitBuf = 0;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+CountLen (\r
+ IN INT32 i\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Count the number of each code length for a Huffman tree.\r
+\r
+Arguments:\r
+\r
+ i - the top node\r
+\r
+Returns: (VOID)\r
+\r
+**/\r
+{\r
+ STATIC INT32 Depth = 0;\r
+\r
+ if (i < mN) {\r
+ mLenCnt[(Depth < 16) ? Depth : 16]++;\r
+ } else {\r
+ Depth++;\r
+ CountLen (mLeft[i]);\r
+ CountLen (mRight[i]);\r
+ Depth--;\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+MakeLen (\r
+ IN INT32 Root\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Create code length array for a Huffman tree\r
+\r
+Arguments:\r
+\r
+ Root - the root of the tree\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ INT32 k;\r
+ UINT32 Cum;\r
+\r
+ for (i = 0; i <= 16; i++) {\r
+ mLenCnt[i] = 0;\r
+ }\r
+\r
+ CountLen (Root);\r
+\r
+ //\r
+ // Adjust the length count array so that\r
+ // no code will be generated longer than its designated length\r
+ //\r
+ Cum = 0;\r
+ for (i = 16; i > 0; i--) {\r
+ Cum += mLenCnt[i] << (16 - i);\r
+ }\r
+\r
+ while (Cum != (1U << 16)) {\r
+ mLenCnt[16]--;\r
+ for (i = 15; i > 0; i--) {\r
+ if (mLenCnt[i] != 0) {\r
+ mLenCnt[i]--;\r
+ mLenCnt[i + 1] += 2;\r
+ break;\r
+ }\r
+ }\r
+\r
+ Cum--;\r
+ }\r
+\r
+ for (i = 16; i > 0; i--) {\r
+ k = mLenCnt[i];\r
+ k--;\r
+ while (k >= 0) {\r
+ mLen[*mSortPtr++] = (UINT8) i;\r
+ k--;\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+DownHeap (\r
+ IN INT32 i\r
+ )\r
+{\r
+ INT32 j;\r
+\r
+ INT32 k;\r
+\r
+ //\r
+ // priority queue: send i-th entry down heap\r
+ //\r
+ k = mHeap[i];\r
+ j = 2 * i;\r
+ while (j <= mHeapSize) {\r
+ if (j < mHeapSize && mFreq[mHeap[j]] > mFreq[mHeap[j + 1]]) {\r
+ j++;\r
+ }\r
+\r
+ if (mFreq[k] <= mFreq[mHeap[j]]) {\r
+ break;\r
+ }\r
+\r
+ mHeap[i] = mHeap[j];\r
+ i = j;\r
+ j = 2 * i;\r
+ }\r
+\r
+ mHeap[i] = (INT16) k;\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+MakeCode (\r
+ IN INT32 n,\r
+ IN UINT8 Len[ ],\r
+ OUT UINT16 Code[ ]\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Assign code to each symbol based on the code length array\r
+\r
+Arguments:\r
+\r
+ n - number of symbols\r
+ Len - the code length array\r
+ Code - stores codes for each symbol\r
+\r
+Returns:\r
+\r
+ None\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+ UINT16 Start[18];\r
+\r
+ Start[1] = 0;\r
+ for (i = 1; i <= 16; i++) {\r
+ Start[i + 1] = (UINT16) ((Start[i] + mLenCnt[i]) << 1);\r
+ }\r
+\r
+ for (i = 0; i < n; i++) {\r
+ Code[i] = Start[Len[i]]++;\r
+ }\r
+}\r
+\r
+INT32\r
+EFIAPI\r
+MakeTree (\r
+ IN INT32 NParm,\r
+ IN UINT16 FreqParm[ ],\r
+ OUT UINT8 LenParm[ ],\r
+ OUT UINT16 CodeParm[ ]\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Generates Huffman codes given a frequency distribution of symbols\r
+\r
+Arguments:\r
+\r
+ NParm - number of symbols\r
+ FreqParm - frequency of each symbol\r
+ LenParm - code length for each symbol\r
+ CodeParm - code for each symbol\r
+\r
+Returns:\r
+\r
+ Root of the Huffman tree.\r
+\r
+**/\r
+{\r
+ INT32 i;\r
+\r
+ INT32 j;\r
+\r
+ INT32 k;\r
+\r
+ INT32 Avail;\r
+\r
+ //\r
+ // make tree, calculate len[], return root\r
+ //\r
+ mN = NParm;\r
+ mFreq = FreqParm;\r
+ mLen = LenParm;\r
+ Avail = mN;\r
+ mHeapSize = 0;\r
+ mHeap[1] = 0;\r
+ for (i = 0; i < mN; i++) {\r
+ mLen[i] = 0;\r
+ if ((mFreq[i]) != 0) {\r
+ mHeapSize++;\r
+ mHeap[mHeapSize] = (INT16) i;\r
+ }\r
+ }\r
+\r
+ if (mHeapSize < 2) {\r
+ CodeParm[mHeap[1]] = 0;\r
+ return mHeap[1];\r
+ }\r
+\r
+ for (i = mHeapSize / 2; i >= 1; i--) {\r
+ //\r
+ // make priority queue\r
+ //\r
+ DownHeap (i);\r
+ }\r
+\r
+ mSortPtr = CodeParm;\r
+ do {\r
+ i = mHeap[1];\r
+ if (i < mN) {\r
+ *mSortPtr++ = (UINT16) i;\r
+ }\r
+\r
+ mHeap[1] = mHeap[mHeapSize--];\r
+ DownHeap (1);\r
+ j = mHeap[1];\r
+ if (j < mN) {\r
+ *mSortPtr++ = (UINT16) j;\r
+ }\r
+\r
+ k = Avail++;\r
+ mFreq[k] = (UINT16) (mFreq[i] + mFreq[j]);\r
+ mHeap[1] = (INT16) k;\r
+ DownHeap (1);\r
+ mLeft[k] = (UINT16) i;\r
+ mRight[k] = (UINT16) j;\r
+ } while (mHeapSize > 1);\r
+\r
+ mSortPtr = CodeParm;\r
+ MakeLen (k);\r
+ MakeCode (NParm, LenParm, CodeParm);\r
+\r
+ //\r
+ // return root\r
+ //\r
+ return k;\r
+}\r
--- /dev/null
+/** @file\r
+ Header file for compression routine.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _EFI_SHELL_COMPRESS_H_\r
+#define _EFI_SHELL_COMPRESS_H_\r
+\r
+/**\r
+ The compression routine.\r
+\r
+ @param[in] SrcBuffer The buffer containing the source data.\r
+ @param[in] SrcSizae Number of bytes in SrcBuffer.\r
+ @param[in] DstBuffer The buffer to put the compressed image in.\r
+ @param[in,out] DstSize On input the size (in bytes) of DstBuffer, on\r
+ return the number of bytes placed in DstBuffer.\r
+\r
+ @retval EFI_SUCCESS The compression was sucessful.\r
+ @retval EFI_BUFFER_TOO_SMALL The buffer was too small. DstSize is required.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+Compress (\r
+ IN VOID *SrcBuffer,\r
+ IN UINT64 SrcSize,\r
+ IN VOID *DstBuffer,\r
+ IN OUT UINT64 *DstSize\r
+ );\r
+\r
+#endif\r
+\r
--- /dev/null
+/** @file\r
+ Main file for Dblk shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Protocol/BlockIo.h>\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+DisplayTheBlocks(\r
+ IN CONST EFI_DEVICE_PATH_PROTOCOL *DevPath,\r
+ IN CONST UINT64 Lba,\r
+ IN CONST UINT8 BlockCount\r
+ )\r
+{\r
+ EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
+ EFI_DEVICE_PATH_PROTOCOL *Copy;\r
+ EFI_HANDLE BlockIoHandle;\r
+ EFI_STATUS Status;\r
+ SHELL_STATUS ShellStatus;\r
+ UINT8 *Buffer;\r
+ UINTN BufferSize;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Copy = (EFI_DEVICE_PATH_PROTOCOL *)DevPath;\r
+\r
+ Status = gBS->LocateDevicePath(&gEfiBlockIoProtocolGuid, &Copy, &BlockIoHandle);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = gBS->OpenProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, (VOID**)&BlockIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ BufferSize = BlockIo->Media->BlockSize * BlockCount;\r
+ if (BufferSize > 0) {\r
+ Buffer = AllocatePool(BufferSize);\r
+ } else {\r
+ Buffer = NULL;\r
+ }\r
+\r
+ Status = BlockIo->ReadBlocks(BlockIo, BlockIo->Media->MediaId, Lba, BufferSize, Buffer);\r
+ if (!EFI_ERROR(Status) && Buffer != NULL) {\r
+ DumpHex(2,0,BufferSize,Buffer);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_READ_FAIL), gShellDebug1HiiHandle, L"BlockIo", Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ }\r
+\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r
+\r
+ gBS->CloseProtocol(BlockIoHandle, &gEfiBlockIoProtocolGuid, gImageHandle, NULL);\r
+ return (ShellStatus);\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDblk (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *BlockName;\r
+ CONST CHAR16 *LbaString;\r
+ CONST CHAR16 *BlockCountString;\r
+ UINT64 Lba;\r
+ UINT8 BlockCount;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 4) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) < 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ //\r
+ // Parse the params\r
+ //\r
+ BlockName = ShellCommandLineGetRawValue(Package, 1);\r
+ LbaString = ShellCommandLineGetRawValue(Package, 2);\r
+ BlockCountString = ShellCommandLineGetRawValue(Package, 3);\r
+\r
+ if (LbaString == NULL) {\r
+ Lba = 0;\r
+ } else {\r
+ Lba = (UINT64)StrHexToUintn(LbaString);\r
+ }\r
+\r
+ if (BlockCountString == NULL) {\r
+ BlockCount = 1;\r
+ } else {\r
+ BlockCount = (UINT8)StrHexToUintn(BlockCountString);\r
+ if (BlockCount > 0x10) {\r
+ BlockCount = 0x10;\r
+ }\r
+ }\r
+\r
+ //\r
+ // do the work if we have a valid block identifier\r
+ //\r
+ if (mEfiShellProtocol->GetDevicePathFromMap(BlockName) == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, BlockName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ShellStatus = DisplayTheBlocks(mEfiShellProtocol->GetDevicePathFromMap(BlockName), Lba, BlockCount);\r
+ }\r
+ }\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for Dmem shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Protocol/PciRootBridgeIo.h>\r
+\r
+CHAR16\r
+MakePrintable(\r
+ IN CONST CHAR16 Char\r
+ )\r
+{\r
+ if ((Char < 0x20 && Char > 0)||(Char > 126)) {\r
+ return (L'?');\r
+ }\r
+ return (Char);\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+DisplayMmioMemory(\r
+ IN CONST VOID *Address,\r
+ IN CONST UINTN Size\r
+ )\r
+{\r
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRbIo;\r
+ EFI_STATUS Status;\r
+ VOID *Buffer;\r
+ SHELL_STATUS ShellStatus;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+\r
+ Status = gBS->LocateProtocol(&gEfiPciRootBridgeIoProtocolGuid, NULL, (VOID**)&PciRbIo);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle);\r
+ return (SHELL_NOT_FOUND);\r
+ }\r
+ Buffer = AllocateZeroPool(Size);\r
+ ASSERT(Buffer != NULL);\r
+\r
+ Status = PciRbIo->Mem.Read(PciRbIo, EfiPciWidthUint8, (UINT64)Address, Size, Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_ER), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_MMIO_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)Address, Size);\r
+ DumpHex(2,0,Size,Buffer);\r
+ }\r
+\r
+ FreePool(Buffer);\r
+ return (ShellStatus);\r
+}\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-mmio", TypeFlag},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDmem (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ VOID *Address;\r
+ UINTN Size;\r
+ CONST CHAR16 *Temp1;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ Address = NULL;\r
+ Size = 0;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ Temp1 = ShellCommandLineGetRawValue(Package, 1);\r
+ if (Temp1 == NULL) {\r
+ Address = gST;\r
+ Size = 512;\r
+ } else {\r
+ if (!ShellIsHexOrDecimalNumber(Temp1, TRUE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp1);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Address = (VOID*)StrHexToUintn(Temp1);\r
+ }\r
+ Temp1 = ShellCommandLineGetRawValue(Package, 2);\r
+ if (Temp1 == NULL) {\r
+ Size = 512;\r
+ } else {\r
+ if (!ShellIsHexOrDecimalNumber(Temp1, FALSE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp1);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Size = ShellStrToUintn(Temp1);\r
+ }\r
+ }\r
+ }\r
+\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ if (!ShellCommandLineGetFlag(Package, L"-mmio")) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_DMEM_HEADER_ROW), gShellDebug1HiiHandle, (UINT64)Address, Size);\r
+ DumpHex(2,0,Size,Address);\r
+ } else {\r
+ ShellStatus = DisplayMmioMemory(Address, Size);\r
+ }\r
+ }\r
+\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for DmpStore shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+STATIC CHAR16 *AttrType[] = {\r
+ L"invalid", // 000\r
+ L"invalid", // 001\r
+ L"BS", // 010\r
+ L"NV+BS", // 011\r
+ L"RT+BS", // 100\r
+ L"NV+RT+BS", // 101\r
+ L"RT+BS", // 110\r
+ L"NV+RT+BS", // 111\r
+};\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ProcessVariables (\r
+ IN CONST CHAR16 *VariableName OPTIONAL,\r
+ IN CONST EFI_GUID *Guid OPTIONAL,\r
+ IN BOOLEAN Delete\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ UINT64 MaxStorSize;\r
+ UINT64 RemStorSize;\r
+ UINT64 MaxVarSize;\r
+ CHAR16 *FoundVarName;\r
+ UINTN Size;\r
+ EFI_GUID FoundVarGuid;\r
+ UINT8 *DataBuffer;\r
+ UINTN DataSize;\r
+ UINT32 Atts;\r
+ SHELL_STATUS ShellStatus;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Size = PcdGet16(PcdShellFileOperationSize);\r
+ FoundVarName = AllocatePool(Size);\r
+\r
+ if (FoundVarName == NULL) {\r
+ return (SHELL_OUT_OF_RESOURCES);\r
+ }\r
+ FoundVarName[0] = CHAR_NULL;\r
+\r
+ Status = gRT->QueryVariableInfo(EFI_VARIABLE_BOOTSERVICE_ACCESS|EFI_VARIABLE_RUNTIME_ACCESS|EFI_VARIABLE_NON_VOLATILE, &MaxStorSize, &RemStorSize, &MaxVarSize);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ DataSize = (UINTN)MaxVarSize;\r
+ DataBuffer = AllocatePool(DataSize);\r
+ if (DataBuffer == NULL) {\r
+ FreePool(FoundVarName);\r
+ return (SHELL_OUT_OF_RESOURCES);\r
+ }\r
+\r
+ for (;;){\r
+ if (ShellGetExecutionBreakFlag()) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ break;\r
+ }\r
+ Size = (UINTN)PcdGet16(PcdShellFileOperationSize);\r
+ DataSize = (UINTN)MaxVarSize;\r
+\r
+ Status = gRT->GetNextVariableName(&Size, FoundVarName, &FoundVarGuid);\r
+ if (Status == EFI_NOT_FOUND) {\r
+ break;\r
+ }\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = gRT->GetVariable(FoundVarName, &FoundVarGuid, &Atts, &DataSize, DataBuffer);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // Check if it matches\r
+ //\r
+ if (VariableName != NULL) {\r
+ if (!gUnicodeCollation->MetaiMatch(gUnicodeCollation, FoundVarName, (CHAR16*)VariableName)) {\r
+ continue;\r
+ }\r
+ }\r
+ if (Guid != NULL) {\r
+ if (!CompareGuid(&FoundVarGuid, Guid)) {\r
+ continue;\r
+ }\r
+ }\r
+\r
+ //\r
+ // do the print or delete\r
+ //\r
+ if (!Delete) {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN(STR_DMPSTORE_HEADER_LINE),\r
+ gShellDebug1HiiHandle,\r
+ AttrType[Atts & 7],\r
+ &FoundVarGuid,\r
+ FoundVarName,\r
+ DataSize);\r
+ DumpHex(2, 0, DataSize, DataBuffer);\r
+ } else {\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN(STR_DMPSTORE_DELETE_LINE),\r
+ gShellDebug1HiiHandle,\r
+ &FoundVarGuid,\r
+ FoundVarName);\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN(STR_DMPSTORE_DELETE_DONE),\r
+ gShellDebug1HiiHandle,\r
+ gRT->SetVariable(FoundVarName, &FoundVarGuid, Atts, 0, NULL));\r
+ }\r
+ }\r
+\r
+ if (FoundVarName != NULL) {\r
+ FreePool(FoundVarName);\r
+ }\r
+ if (DataBuffer != NULL) {\r
+ FreePool(DataBuffer);\r
+ }\r
+\r
+ return (SHELL_UNSUPPORTED);\r
+}\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-d", TypeFlag},\r
+ {L"-l", TypeFlag},\r
+ {L"-s", TypeFlag},\r
+ {L"-all", TypeFlag},\r
+ {L"-guid", TypeValue},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDmpStore (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *Temp;\r
+ EFI_GUID *Guid;\r
+ EFI_GUID GuidData;\r
+ CONST CHAR16 *VariableName;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Package = NULL;\r
+\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) < 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) > 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-all") && ShellCommandLineGetFlag(Package, L"-guid")) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-all", L"-guid");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if ((ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) && ShellCommandLineGetFlag(Package, L"-d")) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_CONFLICT), gShellDebug1HiiHandle, L"-l or -s", L"-d");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ if (!ShellCommandLineGetFlag(Package, L"-all")) {\r
+ Temp = ShellCommandLineGetValue(Package, L"-guid");\r
+ if (Temp != NULL) {\r
+ Status = ConvertStringToGuid(Temp, &GuidData);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"-guid");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ Guid = &GuidData;\r
+ } else {\r
+ Guid = &gEfiGlobalVariableGuid;\r
+ }\r
+ VariableName = ShellCommandLineGetRawValue(Package, 2);\r
+ } else {\r
+ VariableName = NULL;\r
+ Guid = NULL;\r
+ }\r
+ if (ShellStatus == SHELL_SUCCESS) {\r
+ if (ShellCommandLineGetFlag(Package, L"-s") || ShellCommandLineGetFlag(Package, L"-l")) {\r
+ ///@todo fix this after Jordan makes lib...\r
+ ShellPrintEx(-1, -1, L"Not implemeneted yet (ASSERT follows).\r\n");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ ASSERT(FALSE);\r
+ } else {\r
+ ShellStatus = ProcessVariables (VariableName, Guid, ShellCommandLineGetFlag(Package, L"-d"));\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ return ShellStatus;\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ Main file for EfiCompress shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include "Compress.h"\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunEfiCompress (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ SHELL_FILE_HANDLE InShellFileHandle;\r
+ SHELL_FILE_HANDLE OutShellFileHandle;\r
+ UINT64 OutSize;\r
+ VOID *OutBuffer;\r
+ UINT64 InSize;\r
+ VOID *InBuffer;\r
+ CHAR16 *InFileName;\r
+ CONST CHAR16 *OutFileName;\r
+\r
+ InFileName = NULL;\r
+ OutFileName = NULL;\r
+ OutSize = 0;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ OutBuffer = NULL;\r
+ InShellFileHandle = NULL;\r
+ OutShellFileHandle = NULL;\r
+ InBuffer = NULL;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) < 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ InFileName = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 1));\r
+ OutFileName = ShellCommandLineGetRawValue(Package, 2);\r
+ Status = ShellOpenFileByName(InFileName, &InShellFileHandle, EFI_FILE_MODE_READ, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 1), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ Status = ShellOpenFileByName(OutFileName, &OutShellFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ if (FileHandleIsDirectory(InShellFileHandle) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, InFileName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ if (FileHandleIsDirectory(OutShellFileHandle) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, OutFileName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ Status = gEfiShellProtocol->GetFileSize(InShellFileHandle, &InSize);\r
+ ASSERT_EFI_ERROR(Status);\r
+ InBuffer = AllocateZeroPool((UINTN)InSize);\r
+ ASSERT(InBuffer != NULL);\r
+ Status = gEfiShellProtocol->ReadFile(InShellFileHandle, &((UINTN)InSize), InBuffer);\r
+ ASSERT_EFI_ERROR(Status);\r
+ Status = Compress(InBuffer, InSize, OutBuffer, &OutSize);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ OutBuffer = AllocateZeroPool((UINTN)OutSize);\r
+ ASSERT(OutBuffer != NULL);\r
+ Status = Compress(InBuffer, InSize, OutBuffer, &OutSize);\r
+ }\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_COMPRESS_FAIL), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ } else {\r
+ Status = gEfiShellProtocol->WriteFile(OutShellFileHandle, &((UINTN)OutSize), OutBuffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, OutFileName, Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ }\r
+ }\r
+ }\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ if (InFileName != NULL) {\r
+ FreePool(InFileName);\r
+ }\r
+ if (InShellFileHandle != NULL) {\r
+ gEfiShellProtocol->CloseFile(InShellFileHandle);\r
+ }\r
+ if (OutShellFileHandle != NULL) {\r
+ gEfiShellProtocol->CloseFile(OutShellFileHandle);\r
+ }\r
+ if (InBuffer != NULL) {\r
+ FreePool(InBuffer);\r
+ }\r
+ if (OutBuffer != NULL) {\r
+ FreePool(OutBuffer);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for EfiDecompress shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Protocol/Decompress.h>\r
+\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunEfiDecompress (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ SHELL_FILE_HANDLE InFileHandle;\r
+ SHELL_FILE_HANDLE OutFileHandle;\r
+ UINT32 OutSize;\r
+ UINTN OutSizeTemp;\r
+ VOID *OutBuffer;\r
+ UINTN InSize;\r
+ VOID *InBuffer;\r
+ CHAR16 *InFileName;\r
+ CONST CHAR16 *OutFileName;\r
+ UINT64 temp;\r
+ UINT32 ScratchSize;\r
+ VOID *ScratchBuffer;\r
+ EFI_DECOMPRESS_PROTOCOL *Decompress;\r
+\r
+ InFileName = NULL;\r
+ OutFileName = NULL;\r
+ OutSize = 0;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ OutBuffer = NULL;\r
+ InBuffer = NULL;\r
+ ScratchBuffer = NULL;\r
+ InFileHandle = NULL;\r
+ OutFileHandle = NULL;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) < 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ InFileName = ShellFindFilePath(ShellCommandLineGetRawValue(Package, 1));\r
+ OutFileName = ShellCommandLineGetRawValue(Package, 2);\r
+ Status = ShellOpenFileByName(InFileName, &InFileHandle, EFI_FILE_MODE_READ, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 1), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ Status = ShellOpenFileByName(OutFileName, &OutFileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, 2), Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ if (FileHandleIsDirectory(InFileHandle) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, InFileName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ if (FileHandleIsDirectory(OutFileHandle) == EFI_SUCCESS){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, OutFileName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ Status = FileHandleGetSize(InFileHandle, &temp);\r
+ ASSERT(temp <= (UINT32)(-1));\r
+ InSize = (UINTN)temp;\r
+ ASSERT_EFI_ERROR(Status);\r
+ InBuffer = AllocatePool(InSize);\r
+ ASSERT(InBuffer != NULL);\r
+ Status = gEfiShellProtocol->ReadFile(InFileHandle, &InSize, InBuffer);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = gBS->LocateProtocol(&gEfiDecompressProtocolGuid, NULL, (VOID**)&Decompress);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = Decompress->GetInfo(Decompress, InBuffer, (UINT32)InSize, &OutSize, &ScratchSize);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ OutBuffer = AllocatePool(OutSize);\r
+ ScratchBuffer = AllocatePool(ScratchSize);\r
+ ASSERT(OutBuffer != NULL);\r
+ ASSERT(ScratchBuffer != NULL);\r
+\r
+ Status = Decompress->Decompress(Decompress, InBuffer, (UINT32)InSize, OutBuffer, OutSize, ScratchBuffer, ScratchSize);\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_EFI_DECOMPRESS_FAIL), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ } else {\r
+ OutSizeTemp = OutSize;\r
+ Status = gEfiShellProtocol->WriteFile(OutFileHandle, &OutSizeTemp, OutBuffer);\r
+ OutSize = (UINT32)OutSizeTemp;\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_WRITE_FAIL), gShellDebug1HiiHandle, OutFileName, Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ }\r
+ }\r
+ }\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ if (InFileName != NULL) {\r
+ FreePool(InFileName);\r
+ }\r
+ if (InFileHandle != NULL) {\r
+ gEfiShellProtocol->CloseFile(InFileHandle);\r
+ }\r
+ if (OutFileHandle != NULL) {\r
+ gEfiShellProtocol->CloseFile(OutFileHandle);\r
+ }\r
+ if (InBuffer != NULL) {\r
+ FreePool(InBuffer);\r
+ }\r
+ if (OutBuffer != NULL) {\r
+ FreePool(OutBuffer);\r
+ }\r
+ if (ScratchBuffer != NULL) {\r
+ FreePool(ScratchBuffer);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for LoadPciRom shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <IndustryStandard/Pci22.h>\r
+#include <IndustryStandard/Pci23.h>\r
+#include <IndustryStandard/PeImage.h>\r
+#include <Protocol/Decompress.h>\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+LoadPciRomConnectAllDriversToAllControllers (\r
+ VOID\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+InitializeLoadPciRom (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+LoadEfiDriversFromRomImage (\r
+ VOID *RomBar,\r
+ UINTN RomSize,\r
+ CONST CHAR16 *FileName\r
+ );\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-nc", TypeFlag},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunLoadPciRom (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_SHELL_FILE_INFO *FileList;\r
+ UINTN SourceSize;\r
+ UINT8 *File1Buffer;\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ BOOLEAN Connect;\r
+ CONST CHAR16 *Param;\r
+ UINTN ParamCount;\r
+ EFI_SHELL_FILE_INFO *Node;\r
+ //\r
+ // Local variable initializations\r
+ //\r
+ File1Buffer = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ FileList = NULL;\r
+\r
+\r
+ //\r
+ // verify number of arguments\r
+ //\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) < 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ if (!ShellCommandLineGetFlag(Package, L"-nc")) {\r
+ Connect = FALSE;\r
+ } else {\r
+ Connect = TRUE;\r
+ }\r
+\r
+ //\r
+ // get a list with each file specified by parameters\r
+ // if parameter is a directory then add all the files below it to the list\r
+ //\r
+ for ( ParamCount = 1, Param = ShellCommandLineGetRawValue(Package, ParamCount)\r
+ ; Param != NULL\r
+ ; ParamCount++, Param = ShellCommandLineGetRawValue(Package, ParamCount)\r
+ ){\r
+ Status = ShellOpenFileMetaArg((CHAR16*)Param, EFI_FILE_MODE_WRITE|EFI_FILE_MODE_READ, &FileList);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ break;\r
+ }\r
+ }\r
+ if (FileList == NULL || IsListEmpty(&FileList->Link)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PARAM_INV), gShellDebug1HiiHandle);\r
+ } else if (ShellStatus == SHELL_SUCCESS) {\r
+\r
+\r
+ //\r
+ // loop through the list and make sure we are not aborting...\r
+ //\r
+ for ( Node = (EFI_SHELL_FILE_INFO*)GetFirstNode(&FileList->Link)\r
+ ; !IsNull(&FileList->Link, &Node->Link) && !ShellGetExecutionBreakFlag()\r
+ ; Node = (EFI_SHELL_FILE_INFO*)GetNextNode(&FileList->Link, &Node->Link)\r
+ ){\r
+ if (EFI_ERROR(Node->Status)){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_OPEN_FAIL), gShellDebug1HiiHandle, Node->FullName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ continue;\r
+ }\r
+ if (FileHandleIsDirectory(Node->Handle) == EFI_SUCCESS) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_DIR), gShellDebug1HiiHandle, Node->FullName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ continue;\r
+ }\r
+ SourceSize = (UINTN) Node->Info->FileSize;\r
+ File1Buffer = AllocatePool (SourceSize);\r
+ ASSERT(File1Buffer != NULL);\r
+ Status = gEfiShellProtocol->ReadFile(Node->Handle, &SourceSize, File1Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_READ_FAIL), gShellDebug1HiiHandle, Node->FullName);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Status = LoadEfiDriversFromRomImage (\r
+ File1Buffer,\r
+ SourceSize,\r
+ Node->FullName\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOAD_PCI_ROM_RES), gShellDebug1HiiHandle, Node->FullName, Status);\r
+ }\r
+ FreePool(File1Buffer);\r
+ }\r
+ }\r
+ if (FileList != NULL && !IsListEmpty(&FileList->Link)) {\r
+ Status = ShellCloseFileMetaArg(&FileList);\r
+ }\r
+ FileList = NULL;\r
+\r
+ if (Connect) {\r
+ Status = LoadPciRomConnectAllDriversToAllControllers ();\r
+ }\r
+ }\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
+\r
+EFI_STATUS\r
+LoadEfiDriversFromRomImage (\r
+ VOID *RomBar,\r
+ UINTN RomSize,\r
+ CONST CHAR16 *FileName\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Command entry point.\r
+\r
+Arguments:\r
+\r
+ RomBar - Rom\r
+ RomSize - Rom size\r
+ FileName - The file name\r
+\r
+Returns:\r
+ EFI_SUCCESS - The command completed successfully\r
+ EFI_INVALID_PARAMETER - Command usage error\r
+ EFI_UNSUPPORTED - Protocols unsupported\r
+ EFI_OUT_OF_RESOURCES - Out of memory\r
+ Other value - Unknown error\r
+\r
+**/\r
+{\r
+ EFI_PCI_EXPANSION_ROM_HEADER *EfiRomHeader;\r
+ PCI_DATA_STRUCTURE *Pcir;\r
+ UINTN ImageIndex;\r
+ UINTN RomBarOffset;\r
+ UINT32 ImageSize;\r
+ UINT16 ImageOffset;\r
+ EFI_HANDLE ImageHandle;\r
+ EFI_STATUS Status;\r
+ EFI_STATUS retStatus;\r
+ CHAR16 RomFileName[280];\r
+ EFI_DEVICE_PATH_PROTOCOL *FilePath;\r
+ BOOLEAN SkipImage;\r
+ UINT32 DestinationSize;\r
+ UINT32 ScratchSize;\r
+ UINT8 *Scratch;\r
+ VOID *ImageBuffer;\r
+ VOID *DecompressedImageBuffer;\r
+ UINT32 ImageLength;\r
+ EFI_DECOMPRESS_PROTOCOL *Decompress;\r
+\r
+ ImageIndex = 0;\r
+ retStatus = EFI_NOT_FOUND;\r
+ RomBarOffset = (UINTN) RomBar;\r
+\r
+ do {\r
+\r
+ EfiRomHeader = (EFI_PCI_EXPANSION_ROM_HEADER *) (UINTN) RomBarOffset;\r
+\r
+ if (EfiRomHeader->Signature != 0xaa55) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_CORRUPT), gShellDebug1HiiHandle, FileName, ImageIndex);\r
+// PrintToken (STRING_TOKEN (STR_LOADPCIROM_IMAGE_CORRUPT), HiiHandle, ImageIndex);\r
+ return retStatus;\r
+ }\r
+\r
+ Pcir = (PCI_DATA_STRUCTURE *) (UINTN) (RomBarOffset + EfiRomHeader->PcirOffset);\r
+ ImageSize = Pcir->ImageLength * 512;\r
+\r
+ if ((Pcir->CodeType == PCI_CODE_TYPE_EFI_IMAGE) &&\r
+ (EfiRomHeader->EfiSignature == EFI_PCI_EXPANSION_ROM_HEADER_EFISIGNATURE)\r
+ ) {\r
+\r
+ if ((EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER) ||\r
+ (EfiRomHeader->EfiSubsystem == EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER)\r
+ ) {\r
+ ImageOffset = EfiRomHeader->EfiImageHeaderOffset;\r
+ ImageSize = EfiRomHeader->InitializationSize * 512;\r
+\r
+ ImageBuffer = (VOID *) (UINTN) (RomBarOffset + ImageOffset);\r
+ ImageLength = ImageSize - ImageOffset;\r
+ DecompressedImageBuffer = NULL;\r
+\r
+ //\r
+ // decompress here if needed\r
+ //\r
+ SkipImage = FALSE;\r
+ if (EfiRomHeader->CompressionType > EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {\r
+ SkipImage = TRUE;\r
+ }\r
+\r
+ if (EfiRomHeader->CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {\r
+ Status = gBS->LocateProtocol (&gEfiDecompressProtocolGuid, NULL, (VOID**)&Decompress);\r
+ ASSERT_EFI_ERROR(Status);\r
+ if (EFI_ERROR (Status)) {\r
+ SkipImage = TRUE;\r
+ } else {\r
+ SkipImage = TRUE;\r
+ Status = Decompress->GetInfo (\r
+ Decompress,\r
+ ImageBuffer,\r
+ ImageLength,\r
+ &DestinationSize,\r
+ &ScratchSize\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ DecompressedImageBuffer = AllocatePool (DestinationSize);\r
+ if (ImageBuffer != NULL) {\r
+ Scratch = AllocatePool (ScratchSize);\r
+ if (Scratch != NULL) {\r
+ Status = Decompress->Decompress (\r
+ Decompress,\r
+ ImageBuffer,\r
+ ImageLength,\r
+ DecompressedImageBuffer,\r
+ DestinationSize,\r
+ Scratch,\r
+ ScratchSize\r
+ );\r
+ if (!EFI_ERROR (Status)) {\r
+ ImageBuffer = DecompressedImageBuffer;\r
+ ImageLength = DestinationSize;\r
+ SkipImage = FALSE;\r
+ }\r
+\r
+ FreePool (Scratch);\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (!SkipImage) {\r
+ //\r
+ // load image and start image\r
+ //\r
+ UnicodeSPrint (RomFileName, sizeof (RomFileName), L"%s[%d]", FileName, ImageIndex);\r
+ FilePath = FileDevicePath (NULL, RomFileName);\r
+\r
+ Status = gBS->LoadImage (\r
+ TRUE,\r
+ gImageHandle,\r
+ FilePath,\r
+ ImageBuffer,\r
+ ImageLength,\r
+ &ImageHandle\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_LOAD_FAIL), gShellDebug1HiiHandle, FileName, ImageIndex, Status);\r
+// PrintToken (STRING_TOKEN (STR_LOADPCIROM_LOAD_IMAGE_ERROR), HiiHandle, ImageIndex, Status);\r
+ } else {\r
+ Status = gBS->StartImage (ImageHandle, NULL, NULL);\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_LOADPCIROM_START_FAIL), gShellDebug1HiiHandle, FileName, ImageIndex, Status);\r
+// PrintToken (STRING_TOKEN (STR_LOADPCIROM_START_IMAGE), HiiHandle, ImageIndex, Status);\r
+ } else {\r
+ retStatus = Status;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (DecompressedImageBuffer != NULL) {\r
+ FreePool (DecompressedImageBuffer);\r
+ }\r
+\r
+ }\r
+ }\r
+\r
+ RomBarOffset = RomBarOffset + ImageSize;\r
+ ImageIndex++;\r
+ } while (((Pcir->Indicator & 0x80) == 0x00) && ((RomBarOffset - (UINTN) RomBar) < RomSize));\r
+\r
+ return retStatus;\r
+}\r
+\r
+EFI_STATUS\r
+LoadPciRomConnectAllDriversToAllControllers (\r
+ VOID\r
+ )\r
+\r
+{\r
+ EFI_STATUS Status;\r
+ UINTN AllHandleCount;\r
+ EFI_HANDLE *AllHandleBuffer;\r
+ UINTN Index;\r
+ UINTN HandleCount;\r
+ EFI_HANDLE *HandleBuffer;\r
+ UINTN *HandleType;\r
+ UINTN HandleIndex;\r
+ BOOLEAN Parent;\r
+ BOOLEAN Device;\r
+\r
+ Status = gBS->LocateHandleBuffer(\r
+ AllHandles,\r
+ NULL,\r
+ NULL,\r
+ &AllHandleCount,\r
+ &AllHandleBuffer\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ for (Index = 0; Index < AllHandleCount; Index++) {\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ Status = EFI_ABORTED;\r
+ goto Done;\r
+ }\r
+ //\r
+ // Scan the handle database\r
+ //\r
+ Status = ParseHandleDatabaseByRelationshipWithType(\r
+ NULL,\r
+ AllHandleBuffer[Index],\r
+ &HandleCount,\r
+ &HandleBuffer,\r
+ &HandleType\r
+ );\r
+/*\r
+ Status = LibScanHandleDatabase (\r
+ NULL,\r
+ NULL,\r
+ AllHandleBuffer[Index],\r
+ NULL,\r
+ &HandleCount,\r
+ &HandleBuffer,\r
+ &HandleType\r
+ );\r
+*/\r
+ if (EFI_ERROR (Status)) {\r
+ goto Done;\r
+ }\r
+\r
+ Device = TRUE;\r
+ if ((HandleType[Index] & HR_DRIVER_BINDING_HANDLE) != 0) {\r
+ Device = FALSE;\r
+ }\r
+\r
+ if ((HandleType[Index] & HR_IMAGE_HANDLE) != 0) {\r
+ Device = FALSE;\r
+ }\r
+\r
+ if (Device) {\r
+ Parent = FALSE;\r
+ for (HandleIndex = 0; HandleIndex < HandleCount; HandleIndex++) {\r
+ if ((HandleType[HandleIndex] & HR_PARENT_HANDLE) != 0) {\r
+ Parent = TRUE;\r
+ }\r
+ }\r
+\r
+ if (!Parent) {\r
+ if ((HandleType[Index] & HR_DEVICE_HANDLE) != 0) {\r
+ Status = gBS->ConnectController (\r
+ AllHandleBuffer[Index],\r
+ NULL,\r
+ NULL,\r
+ TRUE\r
+ );\r
+ }\r
+ }\r
+ }\r
+\r
+ FreePool (HandleBuffer);\r
+ FreePool (HandleType);\r
+ }\r
+\r
+Done:\r
+ FreePool (AllHandleBuffer);\r
+ return Status;\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for Mode shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the acModeanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which acModeanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+STATIC CONST CHAR16 strNameEfiReservedMemoryType[] = L"Reserved";\r
+STATIC CONST CHAR16 strNameEfiLoaderCode[] = L"LoadCode";\r
+STATIC CONST CHAR16 strNameEfiLoaderData[] = L"LoadData";\r
+STATIC CONST CHAR16 strNameEfiBootServicesCode[] = L"BSCode";\r
+STATIC CONST CHAR16 strNameEfiBootServicesData[] = L"BSData";\r
+STATIC CONST CHAR16 strNameEfiRuntimeServicesCode[] = L"RTCode";\r
+STATIC CONST CHAR16 strNameEfiRuntimeServicesData[] = L"RTData";\r
+STATIC CONST CHAR16 strNameEfiConventionalMemory[] = L"Conv";\r
+STATIC CONST CHAR16 strNameEfiUnusableMemory[] = L"Unusable";\r
+STATIC CONST CHAR16 strNameEfiACPIReclaimMemory[] = L"ACPIRec";\r
+STATIC CONST CHAR16 strNameEfiACPIMemoryNVS[] = L"ACPI_NVS";\r
+STATIC CONST CHAR16 strNameEfiMemoryMappedIO[] = L"MMIO";\r
+STATIC CONST CHAR16 strNameEfiMemoryMappedIOPortSpace[] = L"MMIOPort";\r
+STATIC CONST CHAR16 strNameEfiPalCode[] = L"PalCode";\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMemMap (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN Size;\r
+ EFI_MEMORY_DESCRIPTOR *Buffer;\r
+ UINTN MapKey;\r
+ UINTN ItemSize;\r
+ UINT32 Version;\r
+ UINT8 *Walker;\r
+ UINT64 ReservedPages;\r
+ UINT64 LoadCodePages;\r
+ UINT64 LoadDataPages;\r
+ UINT64 BSCodePages;\r
+ UINT64 BSDataPages;\r
+ UINT64 RTDataPages;\r
+ UINT64 RTCodePages;\r
+ UINT64 AvailPages;\r
+ UINT64 TotalPages;\r
+ UINT64 ReservedPagesSize;\r
+ UINT64 LoadCodePagesSize;\r
+ UINT64 LoadDataPagesSize;\r
+ UINT64 BSCodePagesSize;\r
+ UINT64 BSDataPagesSize;\r
+ UINT64 RTDataPagesSize;\r
+ UINT64 RTCodePagesSize;\r
+ UINT64 AvailPagesSize;\r
+ UINT64 TotalPagesSize;\r
+ BOOLEAN Sfo;\r
+\r
+ TotalPages = 0;\r
+ ReservedPages = 0;\r
+ LoadCodePages = 0;\r
+ LoadDataPages = 0;\r
+ BSCodePages = 0;\r
+ BSDataPages = 0;\r
+ RTDataPages = 0;\r
+ RTCodePages = 0;\r
+ AvailPages = 0;\r
+ Size = 0;\r
+ Buffer = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (SfoParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);\r
+ if (Status == EFI_BUFFER_TOO_SMALL){\r
+ Size += SIZE_1KB;\r
+ Buffer = AllocatePool(Size);\r
+ Status = gBS->GetMemoryMap(&Size, Buffer, &MapKey, &ItemSize, &Version);\r
+ }\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_GET_FAILED), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(Version == EFI_MEMORY_DESCRIPTOR_VERSION);\r
+ Sfo = ShellCommandLineGetFlag(Package, L"-sfo");\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_HEAD), gShellDebug1HiiHandle);\r
+ for (Walker = (UINT8*)Buffer; Walker < (((UINT8*)Buffer)+Size) && Walker != NULL; Walker += ItemSize){\r
+ switch (((EFI_MEMORY_DESCRIPTOR*)Walker)->Type) {\r
+ // replaced ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages) with 0000\r
+ case EfiReservedMemoryType:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiReservedMemoryType, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ ReservedPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiLoaderCode:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiLoaderCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ LoadCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiLoaderData:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiLoaderData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ LoadDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiBootServicesCode:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiBootServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ BSCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiBootServicesData:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiBootServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ BSDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiRuntimeServicesCode:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiRuntimeServicesCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ RTCodePages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiRuntimeServicesData:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiRuntimeServicesData, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ RTDataPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiConventionalMemory:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiConventionalMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ AvailPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiUnusableMemory:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiUnusableMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiACPIReclaimMemory:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiACPIReclaimMemory, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiACPIMemoryNVS:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiACPIMemoryNVS, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiMemoryMappedIO:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiMemoryMappedIO, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiMemoryMappedIOPortSpace:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiMemoryMappedIOPortSpace, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ case EfiPalCode:\r
+ ShellPrintHiiEx(-1, -1, NULL, (EFI_STRING_ID)(!Sfo?STRING_TOKEN (STR_MEMMAP_LIST_ITEM):STRING_TOKEN (STR_MEMMAP_LIST_ITEM_SFO)), gShellDebug1HiiHandle, strNameEfiPalCode, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart, ((EFI_MEMORY_DESCRIPTOR*)Walker)->PhysicalStart+MultU64x64(SIZE_4KB,((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages), ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages, ((EFI_MEMORY_DESCRIPTOR*)Walker)->Attribute);\r
+ TotalPages += ((EFI_MEMORY_DESCRIPTOR*)Walker)->NumberOfPages;\r
+ break;\r
+ default:\r
+ ASSERT(FALSE);\r
+ }\r
+ }\r
+ //\r
+ // print the summary\r
+ //\r
+ ReservedPagesSize = MultU64x64(SIZE_4KB,ReservedPages);\r
+ LoadCodePagesSize = MultU64x64(SIZE_4KB,LoadCodePages);\r
+ LoadDataPagesSize = MultU64x64(SIZE_4KB,LoadDataPages);\r
+ BSCodePagesSize = MultU64x64(SIZE_4KB,BSCodePages);\r
+ BSDataPagesSize = MultU64x64(SIZE_4KB,BSDataPages);\r
+ RTDataPagesSize = MultU64x64(SIZE_4KB,RTDataPages);\r
+ RTCodePagesSize = MultU64x64(SIZE_4KB,RTCodePages);\r
+ AvailPagesSize = MultU64x64(SIZE_4KB,AvailPages);\r
+ TotalPagesSize = MultU64x64(SIZE_4KB,TotalPages);\r
+ if (!Sfo) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM), gShellDebug1HiiHandle,\r
+ ReservedPages, ReservedPagesSize,\r
+ LoadCodePages, LoadCodePagesSize,\r
+ LoadDataPages, LoadDataPagesSize,\r
+ BSCodePages, BSCodePagesSize,\r
+ BSDataPages, BSDataPagesSize,\r
+ RTDataPages, RTDataPagesSize,\r
+ AvailPages, AvailPagesSize,\r
+ DivU64x32(MultU64x64(SIZE_4KB,TotalPages), SIZE_1MB), TotalPagesSize\r
+ );\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MEMMAP_LIST_SUMM_SFO), gShellDebug1HiiHandle,\r
+ TotalPagesSize,\r
+ MultU64x64(SIZE_4KB,ReservedPages),\r
+ BSCodePagesSize,\r
+ BSDataPagesSize,\r
+ RTCodePagesSize,\r
+ RTDataPagesSize,\r
+ LoadCodePagesSize,\r
+ LoadDataPagesSize,\r
+ AvailPages, AvailPagesSize\r
+ );\r
+ }\r
+ }\r
+ }\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ Main file for Mm shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Library/ShellLib.h>\r
+#include <Protocol/PciRootBridgeIo.h>\r
+#include <Protocol/DeviceIo.h>\r
+\r
+typedef enum {\r
+ EfiMemory,\r
+ EFIMemoryMappedIo,\r
+ EfiIo,\r
+ EfiPciConfig,\r
+ EfiPciEConfig\r
+} EFI_ACCESS_TYPE;\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+DumpIoModify (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+ReadMem (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Size,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+VOID\r
+EFIAPI\r
+WriteMem (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Size,\r
+ IN VOID *Buffer\r
+ );\r
+\r
+BOOLEAN\r
+EFIAPI\r
+GetHex (\r
+ IN UINT16 *str,\r
+ OUT UINT64 *data\r
+ );\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-mmio", TypeFlag},\r
+ {L"-mem", TypeFlag},\r
+ {L"-io", TypeFlag},\r
+ {L"-pci", TypeFlag},\r
+ {L"-pcie", TypeFlag},\r
+ {L"-n", TypeFlag},\r
+ {L"-w", TypeValue},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+STATIC CONST UINT64 MaxNum[9] = { 0xff, 0xffff, 0xffffffff, 0xffffffffffffffff };\r
+\r
+/**\r
+ Get the PCI-E Address from a PCI address format 0x0000ssbbddffrrr\r
+ where ss is SEGMENT, bb is BUS, dd is DEVICE, ff is FUNCTION\r
+ and rrr is REGISTER (extension format for PCI-E).\r
+\r
+ @param[in] InputAddress PCI address format on input.\r
+ @param[out]PciEAddress PCI-E address extention format.\r
+**/\r
+VOID\r
+EFIAPI\r
+GetPciEAddressFromInputAddress (\r
+ IN UINT64 InputAddress,\r
+ OUT UINT64 *PciEAddress\r
+ )\r
+{\r
+ *PciEAddress = RShiftU64(InputAddress & ~(UINT64) 0xFFF, 4);\r
+ *PciEAddress += LShiftU64((UINT16) InputAddress & 0x0FFF, 32);\r
+}\r
+\r
+/**\r
+ Function for 'mm' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMm (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;\r
+ UINT64 Address;\r
+ UINT64 PciEAddress;\r
+ UINT64 Value;\r
+ UINT32 SegmentNumber;\r
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width;\r
+ EFI_ACCESS_TYPE AccessType;\r
+ UINT64 Buffer;\r
+ UINTN Index;\r
+ UINTN Size;\r
+ CHAR16 *AddressStr;\r
+// CHAR16 *ValueStr;\r
+ BOOLEAN Complete;\r
+ CHAR16 *InputStr;\r
+ BOOLEAN Interactive;\r
+ EFI_HANDLE *HandleBuffer;\r
+ UINTN BufferSize;\r
+ UINTN ItemValue;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *Temp;\r
+\r
+ Address = 0;\r
+ PciEAddress = 0;\r
+ IoDev = NULL;\r
+ HandleBuffer = NULL;\r
+ BufferSize = 0;\r
+ SegmentNumber = 0;\r
+ ShellStatus = SHELL_SUCCESS;\r
+ InputStr = NULL;\r
+\r
+ //\r
+ // Parse arguments\r
+ //\r
+ Width = EfiPciWidthUint8;\r
+ Size = 1;\r
+ AccessType = EfiMemory;\r
+ AddressStr = NULL;\r
+// ValueStr = NULL;\r
+ Interactive = TRUE;\r
+ Package = NULL;\r
+\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) < 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ } else if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ } else {\r
+ if (ShellCommandLineGetFlag(Package, L"-mmio")) {\r
+ AccessType = EFIMemoryMappedIo;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-mem")) {\r
+ AccessType = EfiMemory;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-io")) {\r
+ AccessType = EfiIo;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-pci")) {\r
+ AccessType = EfiPciConfig;\r
+ } else if (ShellCommandLineGetFlag(Package, L"-pcie")) {\r
+ AccessType = EfiPciEConfig;\r
+ }\r
+ }\r
+\r
+ if (ShellCommandLineGetFlag (Package, L"-n")) {\r
+ Interactive = FALSE;\r
+ }\r
+\r
+ Temp = ShellCommandLineGetValue(Package, L"-w");\r
+ if (Temp != NULL) {\r
+ ItemValue = StrDecimalToUintn (Temp);\r
+\r
+ switch (ItemValue) {\r
+ case 1:\r
+ Width = EfiPciWidthUint8;\r
+ Size = 1;\r
+ break;\r
+\r
+ case 2:\r
+ Width = EfiPciWidthUint16;\r
+ Size = 2;\r
+ break;\r
+\r
+ case 4:\r
+ Width = EfiPciWidthUint32;\r
+ Size = 4;\r
+ break;\r
+\r
+ case 8:\r
+ Width = EfiPciWidthUint64;\r
+ Size = 8;\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, L"-w");\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+ Temp = ShellCommandLineGetRawValue(Package, 1);\r
+ if (Temp != NULL) {\r
+ Address = StrHexToUint64(Temp);\r
+ }\r
+\r
+ Temp = ShellCommandLineGetRawValue(Package, 2);\r
+ if (Temp != NULL) {\r
+ Value = StrHexToUint64(Temp);\r
+ switch (Size) {\r
+ case 1:\r
+ if (Value > 0xFF) {\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ break;\r
+\r
+ case 2:\r
+ if (Value > 0xFFFF) {\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ break;\r
+\r
+ case 4:\r
+ if (Value > 0xFFFFFFFF) {\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ break;\r
+\r
+ default:\r
+ break;\r
+ }\r
+\r
+ if (ShellStatus != SHELL_SUCCESS) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+ if ((Address & (Size - 1)) != 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_NOT_ALIGNED), gShellDebug1HiiHandle, Address);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ //\r
+ // locate DeviceIO protocol interface\r
+ //\r
+ if (AccessType != EfiMemory) {\r
+ Status = gBS->LocateHandleBuffer (\r
+ ByProtocol,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ NULL,\r
+ &BufferSize,\r
+ &HandleBuffer\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+ //\r
+ // In the case of PCI or PCIE\r
+ // Get segment number and mask the segment bits in Address\r
+ //\r
+ if (AccessType == EfiPciEConfig) {\r
+ SegmentNumber = (UINT32) RShiftU64 (Address, 36) & 0xff;\r
+ Address &= 0xfffffffff;\r
+ } else {\r
+ if (AccessType == EfiPciConfig) {\r
+ SegmentNumber = (UINT32) RShiftU64 (Address, 32) & 0xff;\r
+ Address &= 0xffffffff;\r
+ }\r
+ }\r
+ //\r
+ // Find the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL of the specified segment number\r
+ //\r
+ for (Index = 0; Index < BufferSize; Index++) {\r
+ Status = gBS->HandleProtocol (\r
+ HandleBuffer[Index],\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ (VOID *) &IoDev\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ continue;\r
+ }\r
+ if (IoDev->SegmentNumber != SegmentNumber) {\r
+ IoDev = NULL;\r
+ }\r
+ }\r
+ if (IoDev == NULL) {\r
+ // TODO add token\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_SEGMENT_NOT_FOUND), gShellDebug1HiiHandle, SegmentNumber);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+ if (AccessType == EfiIo && Address + Size > 0x10000) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS_RANGE), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+\r
+ if (AccessType == EfiPciEConfig) {\r
+ GetPciEAddressFromInputAddress (Address, &PciEAddress);\r
+ }\r
+\r
+// //\r
+// // Set value\r
+// //\r
+// if (ValueStr != NULL) {\r
+// if (AccessType == EFIMemoryMappedIo) {\r
+// IoDev->Mem.Write (IoDev, Width, Address, 1, &Value);\r
+// } else if (AccessType == EfiIo) {\r
+// IoDev->Io.Write (IoDev, Width, Address, 1, &Value);\r
+// } else if (AccessType == EfiPciConfig) {\r
+// IoDev->Pci.Write (IoDev, Width, Address, 1, &Value);\r
+// } else if (AccessType == EfiPciEConfig) {\r
+// IoDev->Pci.Write (IoDev, Width, PciEAddress, 1, &Buffer);\r
+// } else {\r
+// WriteMem (Width, Address, 1, &Value);\r
+// }\r
+//\r
+// ASSERT(ShellStatus == SHELL_SUCCESS);\r
+// goto Done;\r
+// }\r
+\r
+\r
+ //\r
+ // non-interactive mode\r
+ //\r
+ if (!Interactive) {\r
+ Buffer = 0;\r
+ if (AccessType == EFIMemoryMappedIo) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);\r
+ IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiIo) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);\r
+ IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciConfig) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);\r
+ IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciEConfig) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);\r
+ IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);\r
+ ReadMem (Width, Address, 1, &Buffer);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);\r
+ if (Size == 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, Buffer);\r
+ } else if (Size == 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, Buffer);\r
+ } else if (Size == 4) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, Buffer);\r
+ } else if (Size == 8) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF16), gShellDebug1HiiHandle, Buffer);\r
+ }\r
+\r
+ ShellPrintEx(-1, -1, L"\r\n");\r
+\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ goto Done;\r
+ }\r
+ //\r
+ // interactive mode\r
+ //\r
+ Complete = FALSE;\r
+ do {\r
+ if (AccessType == EfiIo && Address + Size > 0x10000) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS_RANGE2), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_IO_ADDRESS_2), HiiHandle, L"mm");\r
+ break;\r
+ }\r
+\r
+ Buffer = 0;\r
+ if (AccessType == EFIMemoryMappedIo) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MMIO), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_HMMIO), HiiHandle);\r
+ IoDev->Mem.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiIo) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_IO), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_HIO), HiiHandle);\r
+ IoDev->Io.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciConfig) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCI), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_HPCI), HiiHandle);\r
+ IoDev->Pci.Read (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciEConfig) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_PCIE), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_HPCIE), HiiHandle);\r
+ IoDev->Pci.Read (IoDev, Width, PciEAddress, 1, &Buffer);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_MEM), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_HMEM), HiiHandle);\r
+ ReadMem (Width, Address, 1, &Buffer);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ADDRESS), gShellDebug1HiiHandle, Address);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_ADDRESS), HiiHandle, Address);\r
+\r
+ if (Size == 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF2), gShellDebug1HiiHandle, Buffer);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_BUFFER_2), HiiHandle, Buffer);\r
+ } else if (Size == 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF4), gShellDebug1HiiHandle, Buffer);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_BUFFER_4), HiiHandle, Buffer);\r
+ } else if (Size == 4) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF8), gShellDebug1HiiHandle, Buffer);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_BUFFER_8), HiiHandle, Buffer);\r
+ } else if (Size == 8) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_BUF16), gShellDebug1HiiHandle, Buffer);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_BUFFER_16), HiiHandle, Buffer);\r
+ }\r
+ //\r
+ // wait user input to modify\r
+ //\r
+ if (InputStr != NULL) {\r
+ FreePool(InputStr);\r
+ }\r
+ ShellPromptForResponse(ShellPromptResponseTypeFreeform, NULL, (VOID**)&InputStr);\r
+\r
+ //\r
+ // skip space characters\r
+ //\r
+ for (Index = 0; InputStr[Index] == ' '; Index++);\r
+\r
+ //\r
+ // parse input string\r
+ //\r
+ if (InputStr[Index] == '.' || InputStr[Index] == 'q' || InputStr[Index] == 'Q') {\r
+ Complete = TRUE;\r
+ } else if (InputStr[Index] == CHAR_NULL) {\r
+ //\r
+ // Continue to next address\r
+ //\r
+ } else if (GetHex (InputStr + Index, &Buffer) && Buffer <= MaxNum[Width]) {\r
+ if (AccessType == EFIMemoryMappedIo) {\r
+ IoDev->Mem.Write (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiIo) {\r
+ IoDev->Io.Write (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciConfig) {\r
+ IoDev->Pci.Write (IoDev, Width, Address, 1, &Buffer);\r
+ } else if (AccessType == EfiPciEConfig) {\r
+ IoDev->Pci.Write (IoDev, Width, PciEAddress, 1, &Buffer);\r
+ } else {\r
+ WriteMem (Width, Address, 1, &Buffer);\r
+ }\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_ERROR), gShellDebug1HiiHandle);\r
+ // PrintToken (STRING_TOKEN (STR_IOMOD_ERROR), HiiHandle);\r
+ continue;\r
+ }\r
+\r
+ Address += Size;\r
+ if (AccessType == EfiPciEConfig) {\r
+ GetPciEAddressFromInputAddress (Address, &PciEAddress);\r
+ }\r
+ ShellPrintEx(-1, -1, L"\r\n");\r
+ // Print (L"\n");\r
+ } while (!Complete);\r
+ }\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+Done:\r
+\r
+ if (InputStr != NULL) {\r
+ FreePool(InputStr);\r
+ }\r
+ if (HandleBuffer != NULL) {\r
+ FreePool (HandleBuffer);\r
+ }\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ return ShellStatus;\r
+}\r
+\r
+\r
+VOID\r
+EFIAPI\r
+ReadMem (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Size,\r
+ IN VOID *Buffer\r
+ )\r
+{\r
+ do {\r
+ if (Width == EfiPciWidthUint8) {\r
+ *(UINT8 *) Buffer = *(UINT8 *) (UINTN) Address;\r
+ Address -= 1;\r
+ } else if (Width == EfiPciWidthUint16) {\r
+ *(UINT16 *) Buffer = *(UINT16 *) (UINTN) Address;\r
+ Address -= 2;\r
+ } else if (Width == EfiPciWidthUint32) {\r
+ *(UINT32 *) Buffer = *(UINT32 *) (UINTN) Address;\r
+ Address -= 4;\r
+ } else if (Width == EfiPciWidthUint64) {\r
+ *(UINT64 *) Buffer = *(UINT64 *) (UINTN) Address;\r
+ Address -= 8;\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MM_READ_ERROR), gShellDebug1HiiHandle);\r
+// PrintToken (STRING_TOKEN (STR_IOMOD_READ_MEM_ERROR), HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ //\r
+ //\r
+ Size--;\r
+ } while (Size > 0);\r
+}\r
+\r
+VOID\r
+EFIAPI\r
+WriteMem (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH Width,\r
+ IN UINT64 Address,\r
+ IN UINTN Size,\r
+ IN VOID *Buffer\r
+ )\r
+{\r
+ do {\r
+ if (Width == EfiPciWidthUint8) {\r
+ *(UINT8 *) (UINTN) Address = *(UINT8 *) Buffer;\r
+ Address += 1;\r
+ } else if (Width == EfiPciWidthUint16) {\r
+ *(UINT16 *) (UINTN) Address = *(UINT16 *) Buffer;\r
+ Address += 2;\r
+ } else if (Width == EfiPciWidthUint32) {\r
+ *(UINT32 *) (UINTN) Address = *(UINT32 *) Buffer;\r
+ Address += 4;\r
+ } else if (Width == EfiPciWidthUint64) {\r
+ *(UINT64 *) (UINTN) Address = *(UINT64 *) Buffer;\r
+ Address += 8;\r
+ } else {\r
+ ASSERT (FALSE);\r
+ }\r
+ //\r
+ //\r
+ //\r
+ Size--;\r
+ } while (Size > 0);\r
+}\r
+\r
+BOOLEAN\r
+EFIAPI\r
+GetHex (\r
+ IN UINT16 *str,\r
+ OUT UINT64 *data\r
+ )\r
+{\r
+ UINTN u;\r
+ CHAR16 c;\r
+ BOOLEAN Find;\r
+\r
+ Find = FALSE;\r
+ //\r
+ // convert hex digits\r
+ //\r
+ u = 0;\r
+ c = *(str++);\r
+ while (c != CHAR_NULL) {\r
+ if (c >= 'a' && c <= 'f') {\r
+ c -= 'a' - 'A';\r
+ }\r
+\r
+ if (c == ' ') {\r
+ break;\r
+ }\r
+\r
+ if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'F')) {\r
+ u = u << 4 | c - (c >= 'A' ? 'A' - 10 : '0');\r
+\r
+ Find = TRUE;\r
+ } else {\r
+ return FALSE;\r
+ }\r
+\r
+ c = *(str++);\r
+ }\r
+\r
+ *data = u;\r
+ return Find;\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for Mode shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the acModeanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which acModeanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMode (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN NewCol;\r
+ UINTN NewRow;\r
+ UINTN Col;\r
+ UINTN Row;\r
+ CONST CHAR16 *Temp;\r
+ BOOLEAN Done;\r
+ INT32 LoopVar;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) == 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) == 3) {\r
+ Temp = ShellCommandLineGetRawValue(Package, 1);\r
+ if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ NewCol = ShellStrToUintn(Temp);\r
+ Temp = ShellCommandLineGetRawValue(Package, 2);\r
+ if (!ShellIsHexOrDecimalNumber(Temp, FALSE, FALSE)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ NewRow = ShellStrToUintn(Temp);\r
+\r
+ for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {\r
+ Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);\r
+ if (EFI_ERROR(Status)) {\r
+ continue;\r
+ }\r
+ if (Col == NewCol && Row == NewRow) {\r
+ Status = gST->ConOut->SetMode(gST->ConOut, LoopVar);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_SET_FAIL), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_DEVICE_ERROR;\r
+ } else {\r
+ // worked fine...\r
+ Done = TRUE;\r
+ }\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (!Done) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_NO_MATCH), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+\r
+ } else if (ShellCommandLineGetCount(Package) == 1) {\r
+ //\r
+ // print out valid\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_HEAD), gShellDebug1HiiHandle);\r
+ for (LoopVar = 0, Done = FALSE; LoopVar < gST->ConOut->Mode->MaxMode && ShellStatus == SHELL_SUCCESS ; LoopVar++) {\r
+ Status = gST->ConOut->QueryMode(gST->ConOut, LoopVar, &Col, &Row);\r
+ if (EFI_ERROR(Status)) {\r
+ continue;\r
+ }\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MODE_LIST_ITEM), gShellDebug1HiiHandle, Col, Row, LoopVar == gST->ConOut->Mode->Mode?L'*':L' ');\r
+ }\r
+ }\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for Pci shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Protocol/PciRootBridgeIo.h>\r
+#include <Library/ShellLib.h>\r
+#include <IndustryStandard/Pci.h>\r
+#include <IndustryStandard/Acpi.h>\r
+#include "Pci.h"\r
+\r
+#define PCI_CLASS_STRING_LIMIT 54\r
+//\r
+// Printable strings for Pci class code\r
+//\r
+typedef struct {\r
+ CHAR16 *BaseClass; // Pointer to the PCI base class string\r
+ CHAR16 *SubClass; // Pointer to the PCI sub class string\r
+ CHAR16 *PIFClass; // Pointer to the PCI programming interface string\r
+} PCI_CLASS_STRINGS;\r
+\r
+//\r
+// a structure holding a single entry, which also points to its lower level\r
+// class\r
+//\r
+typedef struct PCI_CLASS_ENTRY_TAG {\r
+ UINT8 Code; // Class, subclass or I/F code\r
+ CHAR16 *DescText; // Description string\r
+ struct PCI_CLASS_ENTRY_TAG *LowerLevelClass; // Subclass or I/F if any\r
+} PCI_CLASS_ENTRY;\r
+\r
+//\r
+// Declarations of entries which contain printable strings for class codes\r
+// in PCI configuration space\r
+//\r
+PCI_CLASS_ENTRY PCIBlankEntry[];\r
+PCI_CLASS_ENTRY PCISubClass_00[];\r
+PCI_CLASS_ENTRY PCISubClass_01[];\r
+PCI_CLASS_ENTRY PCISubClass_02[];\r
+PCI_CLASS_ENTRY PCISubClass_03[];\r
+PCI_CLASS_ENTRY PCISubClass_04[];\r
+PCI_CLASS_ENTRY PCISubClass_05[];\r
+PCI_CLASS_ENTRY PCISubClass_06[];\r
+PCI_CLASS_ENTRY PCISubClass_07[];\r
+PCI_CLASS_ENTRY PCISubClass_08[];\r
+PCI_CLASS_ENTRY PCISubClass_09[];\r
+PCI_CLASS_ENTRY PCISubClass_0a[];\r
+PCI_CLASS_ENTRY PCISubClass_0b[];\r
+PCI_CLASS_ENTRY PCISubClass_0c[];\r
+PCI_CLASS_ENTRY PCISubClass_0d[];\r
+PCI_CLASS_ENTRY PCISubClass_0e[];\r
+PCI_CLASS_ENTRY PCISubClass_0f[];\r
+PCI_CLASS_ENTRY PCISubClass_10[];\r
+PCI_CLASS_ENTRY PCISubClass_11[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0101[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0300[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0604[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0700[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0701[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0703[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0800[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0801[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0802[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0803[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0904[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0c00[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0c03[];\r
+PCI_CLASS_ENTRY PCIPIFClass_0e00[];\r
+\r
+//\r
+// Base class strings entries\r
+//\r
+PCI_CLASS_ENTRY gClassStringList[] = {\r
+ {\r
+ 0x00,\r
+ L"Pre 2.0 device",\r
+ PCISubClass_00\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Mass Storage Controller",\r
+ PCISubClass_01\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Network Controller",\r
+ PCISubClass_02\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Display Controller",\r
+ PCISubClass_03\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Multimedia Device",\r
+ PCISubClass_04\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Memory Controller",\r
+ PCISubClass_05\r
+ },\r
+ {\r
+ 0x06,\r
+ L"Bridge Device",\r
+ PCISubClass_06\r
+ },\r
+ {\r
+ 0x07,\r
+ L"Simple Communications Controllers",\r
+ PCISubClass_07\r
+ },\r
+ {\r
+ 0x08,\r
+ L"Base System Peripherals",\r
+ PCISubClass_08\r
+ },\r
+ {\r
+ 0x09,\r
+ L"Input Devices",\r
+ PCISubClass_09\r
+ },\r
+ {\r
+ 0x0a,\r
+ L"Docking Stations",\r
+ PCISubClass_0a\r
+ },\r
+ {\r
+ 0x0b,\r
+ L"Processors",\r
+ PCISubClass_0b\r
+ },\r
+ {\r
+ 0x0c,\r
+ L"Serial Bus Controllers",\r
+ PCISubClass_0c\r
+ },\r
+ {\r
+ 0x0d,\r
+ L"Wireless Controllers",\r
+ PCISubClass_0d\r
+ },\r
+ {\r
+ 0x0e,\r
+ L"Intelligent IO Controllers",\r
+ PCISubClass_0e\r
+ },\r
+ {\r
+ 0x0f,\r
+ L"Satellite Communications Controllers",\r
+ PCISubClass_0f\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Encryption/Decryption Controllers",\r
+ PCISubClass_10\r
+ },\r
+ {\r
+ 0x11,\r
+ L"Data Acquisition & Signal Processing Controllers",\r
+ PCISubClass_11\r
+ },\r
+ {\r
+ 0xff,\r
+ L"Device does not fit in any defined classes",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+//\r
+// Subclass strings entries\r
+//\r
+PCI_CLASS_ENTRY PCIBlankEntry[] = {\r
+ {\r
+ 0x00,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_00[] = {\r
+ {\r
+ 0x00,\r
+ L"All devices other than VGA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"VGA-compatible devices",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_01[] = {\r
+ {\r
+ 0x00,\r
+ L"SCSI controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"IDE controller",\r
+ PCIPIFClass_0101\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Floppy disk controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"IPI controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"RAID controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other mass storage controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_02[] = {\r
+ {\r
+ 0x00,\r
+ L"Ethernet controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Token ring controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"FDDI controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"ATM controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"ISDN controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other network controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_03[] = {\r
+ {\r
+ 0x00,\r
+ L"VGA/8514 controller",\r
+ PCIPIFClass_0300\r
+ },\r
+ {\r
+ 0x01,\r
+ L"XGA controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"3D controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other display controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */PCIBlankEntry\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_04[] = {\r
+ {\r
+ 0x00,\r
+ L"Video device",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Audio device",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Computer Telephony device",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other multimedia device",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_05[] = {\r
+ {\r
+ 0x00,\r
+ L"RAM memory controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Flash memory controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other memory controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_06[] = {\r
+ {\r
+ 0x00,\r
+ L"Host/PCI bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"PCI/ISA bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"PCI/EISA bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"PCI/Micro Channel bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"PCI/PCI bridge",\r
+ PCIPIFClass_0604\r
+ },\r
+ {\r
+ 0x05,\r
+ L"PCI/PCMCIA bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x06,\r
+ L"NuBus bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x07,\r
+ L"CardBus bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x08,\r
+ L"RACEway bridge",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other bridge type",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_07[] = {\r
+ {\r
+ 0x00,\r
+ L"Serial controller",\r
+ PCIPIFClass_0700\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Parallel port",\r
+ PCIPIFClass_0701\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Multiport serial controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Modem",\r
+ PCIPIFClass_0703\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other communication device",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_08[] = {\r
+ {\r
+ 0x00,\r
+ L"PIC",\r
+ PCIPIFClass_0800\r
+ },\r
+ {\r
+ 0x01,\r
+ L"DMA controller",\r
+ PCIPIFClass_0801\r
+ },\r
+ {\r
+ 0x02,\r
+ L"System timer",\r
+ PCIPIFClass_0802\r
+ },\r
+ {\r
+ 0x03,\r
+ L"RTC controller",\r
+ PCIPIFClass_0803\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Generic PCI Hot-Plug controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other system peripheral",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_09[] = {\r
+ {\r
+ 0x00,\r
+ L"Keyboard controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Digitizer (pen)",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Mouse controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Scanner controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Gameport controller",\r
+ PCIPIFClass_0904\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other input controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0a[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic docking station",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other type of docking station",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0b[] = {\r
+ {\r
+ 0x00,\r
+ L"386",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"486",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Pentium",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Alpha",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x20,\r
+ L"PowerPC",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x30,\r
+ L"MIPS",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x40,\r
+ L"Co-processor",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other processor",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0c[] = {\r
+ {\r
+ 0x00,\r
+ L"Firewire(IEEE 1394)",\r
+ PCIPIFClass_0c03\r
+ },\r
+ {\r
+ 0x01,\r
+ L"ACCESS.bus",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"SSA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"USB",\r
+ PCIPIFClass_0c00\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Fibre Channel",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x05,\r
+ L"System Management Bus",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other bus type",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0d[] = {\r
+ {\r
+ 0x00,\r
+ L"iRDA compatible controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Consumer IR controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"RF controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other type of wireless controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0e[] = {\r
+ {\r
+ 0x00,\r
+ L"I2O Architecture",\r
+ PCIPIFClass_0e00\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_0f[] = {\r
+ {\r
+ 0x00,\r
+ L"TV",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Audio",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Voice",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Data",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_10[] = {\r
+ {\r
+ 0x00,\r
+ L"Network & computing Encrypt/Decrypt",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Entertainment Encrypt/Decrypt",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other Encrypt/Decrypt",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCISubClass_11[] = {\r
+ {\r
+ 0x00,\r
+ L"DPIO modules",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Other DAQ & SP controllers",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+//\r
+// Programming Interface entries\r
+//\r
+PCI_CLASS_ENTRY PCIPIFClass_0101[] = {\r
+ {\r
+ 0x00,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"OM-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"PI-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"OM/PI-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x05,\r
+ L"OM-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x06,\r
+ L"PI-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x07,\r
+ L"OM/PI-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x08,\r
+ L"OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x09,\r
+ L"OM-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0a,\r
+ L"PI-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0b,\r
+ L"OM/PI-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0c,\r
+ L"OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0d,\r
+ L"OM-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0e,\r
+ L"PI-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x0f,\r
+ L"OM/PI-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"Master",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x81,\r
+ L"Master, OM-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x82,\r
+ L"Master, PI-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x83,\r
+ L"Master, OM/PI-primary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x84,\r
+ L"Master, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x85,\r
+ L"Master, OM-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x86,\r
+ L"Master, PI-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x87,\r
+ L"Master, OM/PI-primary, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x88,\r
+ L"Master, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x89,\r
+ L"Master, OM-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8a,\r
+ L"Master, PI-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8b,\r
+ L"Master, OM/PI-primary, PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8c,\r
+ L"Master, OM-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8d,\r
+ L"Master, OM-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8e,\r
+ L"Master, PI-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x8f,\r
+ L"Master, OM/PI-primary, OM/PI-secondary",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0300[] = {\r
+ {\r
+ 0x00,\r
+ L"VGA compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"8514 compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0604[] = {\r
+ {\r
+ 0x00,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Subtractive decode",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0700[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic XT-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"16450-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"16550-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"16650-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"16750-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x05,\r
+ L"16850-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x06,\r
+ L"16950-compatible",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0701[] = {\r
+ {\r
+ 0x00,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Bi-directional",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"ECP 1.X-compliant",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"IEEE 1284",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0xfe,\r
+ L"IEEE 1284 target (not a controller)",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0703[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Hayes-compatible 16450",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Hayes-compatible 16550",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Hayes-compatible 16650",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Hayes-compatible 16750",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0800[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic 8259",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"ISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"EISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"IO APIC",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x20,\r
+ L"IO(x) APIC interrupt controller",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0801[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic 8237",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"ISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"EISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0802[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic 8254",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"ISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"EISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0803[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"ISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x02,\r
+ L"EISA",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0904[] = {\r
+ {\r
+ 0x00,\r
+ L"Generic",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0c00[] = {\r
+ {\r
+ 0x00,\r
+ L"Universal Host Controller spec",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Open Host Controller spec",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x80,\r
+ L"No specific programming interface",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0xfe,\r
+ L"(Not Host Controller)",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0c03[] = {\r
+ {\r
+ 0x00,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Using 1394 OpenHCI spec",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+PCI_CLASS_ENTRY PCIPIFClass_0e00[] = {\r
+ {\r
+ 0x00,\r
+ L"Message FIFO at offset 40h",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x01,\r
+ L"",\r
+ PCIBlankEntry\r
+ },\r
+ {\r
+ 0x00,\r
+ NULL,\r
+ /* null string ends the list */NULL\r
+ }\r
+};\r
+\r
+#define EFI_HEX_DISP_SIZE 32\r
+BOOLEAN\r
+PrivateDumpHex (\r
+ IN UINTN Indent,\r
+ IN UINTN Offset,\r
+ IN UINTN DataSize,\r
+ IN VOID *UserData\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Add page break feature to the DumpHex\r
+\r
+Arguments:\r
+ Indent - The indent space\r
+\r
+ Offset - The offset\r
+\r
+ DataSize - The data size\r
+\r
+ UserData - The data\r
+\r
+Returns:\r
+\r
+ TRUE - The dump is broke\r
+ FALSE - The dump is completed\r
+\r
+**/\r
+{\r
+ UINTN DispSize;\r
+ UINT8 *DispData;\r
+\r
+ DispSize = EFI_HEX_DISP_SIZE;\r
+ DispData = (UINT8 *) UserData;\r
+\r
+ while (DataSize!=0) {\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ return TRUE;\r
+ }\r
+\r
+ if (DataSize > EFI_HEX_DISP_SIZE) {\r
+ DataSize -= EFI_HEX_DISP_SIZE;\r
+ } else {\r
+ DispSize = DataSize;\r
+ DataSize = 0;\r
+ }\r
+\r
+ DumpHex (Indent, Offset + DispData - (UINT8 *) UserData, DispSize, DispData);\r
+ DispData += DispSize;\r
+ }\r
+\r
+ return FALSE;\r
+}\r
+\r
+//\r
+// Implemetations\r
+//\r
+VOID\r
+PciGetClassStrings (\r
+ IN UINT32 ClassCode,\r
+ IN OUT PCI_CLASS_STRINGS *ClassStrings\r
+ )\r
+/*++\r
+Routine Description:\r
+\r
+ Generates printable Unicode strings that represent PCI device class,\r
+ subclass and programmed I/F based on a value passed to the function.\r
+\r
+Arguments:\r
+\r
+ ClassCode Value representing the PCI "Class Code" register read from a\r
+ PCI device. The encodings are:\r
+ bits 23:16 - Base Class Code\r
+ bits 15:8 - Sub-Class Code\r
+ bits 7:0 - Programming Interface\r
+ ClassStrings Pointer of PCI_CLASS_STRINGS structure, which contains\r
+ printable class strings corresponding to ClassCode. The\r
+ caller must not modify the strings that are pointed by\r
+ the fields in ClassStrings.\r
+Returns:\r
+\r
+ None\r
+**/\r
+{\r
+ INTN Index;\r
+ UINT8 Code;\r
+ PCI_CLASS_ENTRY *CurrentClass;\r
+\r
+ //\r
+ // Assume no strings found\r
+ //\r
+ ClassStrings->BaseClass = L"UNDEFINED";\r
+ ClassStrings->SubClass = L"UNDEFINED";\r
+ ClassStrings->PIFClass = L"UNDEFINED";\r
+\r
+ CurrentClass = gClassStringList;\r
+ Code = (UINT8) (ClassCode >> 16);\r
+ Index = 0;\r
+\r
+ //\r
+ // Go through all entries of the base class, until the entry with a matching\r
+ // base class code is found. If reaches an entry with a null description\r
+ // text, the last entry is met, which means no text for the base class was\r
+ // found, so no more action is needed.\r
+ //\r
+ while (Code != CurrentClass[Index].Code) {\r
+ if (NULL == CurrentClass[Index].DescText) {\r
+ return ;\r
+ }\r
+\r
+ Index++;\r
+ }\r
+ //\r
+ // A base class was found. Assign description, and check if this class has\r
+ // sub-class defined. If sub-class defined, no more action is needed,\r
+ // otherwise, continue to find description for the sub-class code.\r
+ //\r
+ ClassStrings->BaseClass = CurrentClass[Index].DescText;\r
+ if (NULL == CurrentClass[Index].LowerLevelClass) {\r
+ return ;\r
+ }\r
+ //\r
+ // find Subclass entry\r
+ //\r
+ CurrentClass = CurrentClass[Index].LowerLevelClass;\r
+ Code = (UINT8) (ClassCode >> 8);\r
+ Index = 0;\r
+\r
+ //\r
+ // Go through all entries of the sub-class, until the entry with a matching\r
+ // sub-class code is found. If reaches an entry with a null description\r
+ // text, the last entry is met, which means no text for the sub-class was\r
+ // found, so no more action is needed.\r
+ //\r
+ while (Code != CurrentClass[Index].Code) {\r
+ if (NULL == CurrentClass[Index].DescText) {\r
+ return ;\r
+ }\r
+\r
+ Index++;\r
+ }\r
+ //\r
+ // A class was found for the sub-class code. Assign description, and check if\r
+ // this sub-class has programming interface defined. If no, no more action is\r
+ // needed, otherwise, continue to find description for the programming\r
+ // interface.\r
+ //\r
+ ClassStrings->SubClass = CurrentClass[Index].DescText;\r
+ if (NULL == CurrentClass[Index].LowerLevelClass) {\r
+ return ;\r
+ }\r
+ //\r
+ // Find programming interface entry\r
+ //\r
+ CurrentClass = CurrentClass[Index].LowerLevelClass;\r
+ Code = (UINT8) ClassCode;\r
+ Index = 0;\r
+\r
+ //\r
+ // Go through all entries of the I/F entries, until the entry with a\r
+ // matching I/F code is found. If reaches an entry with a null description\r
+ // text, the last entry is met, which means no text was found, so no more\r
+ // action is needed.\r
+ //\r
+ while (Code != CurrentClass[Index].Code) {\r
+ if (NULL == CurrentClass[Index].DescText) {\r
+ return ;\r
+ }\r
+\r
+ Index++;\r
+ }\r
+ //\r
+ // A class was found for the I/F code. Assign description, done!\r
+ //\r
+ ClassStrings->PIFClass = CurrentClass[Index].DescText;\r
+ return ;\r
+}\r
+\r
+VOID\r
+PciPrintClassCode (\r
+ IN UINT8 *ClassCodePtr,\r
+ IN BOOLEAN IncludePIF\r
+ )\r
+/*++\r
+Routine Description:\r
+\r
+ Print strings that represent PCI device class, subclass and programmed I/F\r
+\r
+Arguments:\r
+\r
+ ClassCodePtr Points to the memory which stores register Class Code in PCI\r
+ configuation space.\r
+ IncludePIF If the printed string should include the programming I/F part\r
+Returns:\r
+\r
+ None\r
+**/\r
+{\r
+ UINT32 ClassCode;\r
+ PCI_CLASS_STRINGS ClassStrings;\r
+ CHAR16 OutputString[PCI_CLASS_STRING_LIMIT + 1];\r
+\r
+ ClassCode = 0;\r
+ ClassCode |= ClassCodePtr[0];\r
+ ClassCode |= (ClassCodePtr[1] << 8);\r
+ ClassCode |= (ClassCodePtr[2] << 16);\r
+\r
+ //\r
+ // Get name from class code\r
+ //\r
+ PciGetClassStrings (ClassCode, &ClassStrings);\r
+\r
+ if (IncludePIF) {\r
+ //\r
+ // Only print base class and sub class name\r
+ //\r
+ ShellPrintEx(-1,-1, L"%s - %s - %s",\r
+ ClassStrings.BaseClass,\r
+ ClassStrings.SubClass,\r
+ ClassStrings.PIFClass\r
+ );\r
+\r
+ } else {\r
+ //\r
+ // Print base class, sub class, and programming inferface name\r
+ //\r
+ UnicodeSPrint (\r
+ OutputString,\r
+ PCI_CLASS_STRING_LIMIT * sizeof (CHAR16),\r
+ L"%s - %s",\r
+ ClassStrings.BaseClass,\r
+ ClassStrings.SubClass\r
+ );\r
+\r
+ OutputString[PCI_CLASS_STRING_LIMIT] = 0;\r
+ ShellPrintEx(-1,-1, L"%s", OutputString);\r
+ }\r
+}\r
+\r
+EFI_STATUS\r
+PciDump (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+EFI_STATUS\r
+PciFindProtocolInterface (\r
+ IN EFI_HANDLE *HandleBuf,\r
+ IN UINTN HandleCount,\r
+ IN UINT16 Segment,\r
+ IN UINT16 Bus,\r
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r
+ );\r
+\r
+EFI_STATUS\r
+PciGetProtocolAndResource (\r
+ IN EFI_HANDLE Handle,\r
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r
+ OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r
+ );\r
+\r
+EFI_STATUS\r
+PciGetNextBusRange (\r
+ IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r
+ OUT UINT16 *MinBus,\r
+ OUT UINT16 *MaxBus,\r
+ OUT BOOLEAN *IsEnd\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainData (\r
+ IN PCI_CONFIG_SPACE *ConfigSpace,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainDeviceData (\r
+ IN PCI_DEVICE_HEADER *Device,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainBridgeData (\r
+ IN PCI_BRIDGE_HEADER *Bridge,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainBar (\r
+ IN UINT32 *Bar,\r
+ IN UINT16 *Command,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN OUT UINTN *Index\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainCardBusData (\r
+ IN PCI_CARDBUS_HEADER *CardBus,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainStatus (\r
+ IN UINT16 *Status,\r
+ IN BOOLEAN MainStatus,\r
+ IN PCI_HEADER_TYPE HeaderType\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainCommand (\r
+ IN UINT16 *Command\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainBridgeControl (\r
+ IN UINT16 *BridgeControl,\r
+ IN PCI_HEADER_TYPE HeaderType\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainCapabilityStruct (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN UINT64 Address,\r
+ IN UINT8 CapPtr\r
+ );\r
+\r
+EFI_STATUS\r
+PciExplainPciExpress (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN UINT64 Address,\r
+ IN UINT8 CapabilityPtr\r
+ );\r
+\r
+EFI_STATUS\r
+ExplainPcieCapReg (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieRootControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieRootCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+EFI_STATUS\r
+ExplainPcieRootStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+);\r
+\r
+typedef EFI_STATUS (*PCIE_EXPLAIN_FUNCTION) (IN PCIE_CAP_STURCTURE *PciExpressCap);\r
+\r
+typedef enum {\r
+ FieldWidthUINT8,\r
+ FieldWidthUINT16,\r
+ FieldWidthUINT32\r
+} PCIE_CAPREG_FIELD_WIDTH;\r
+\r
+typedef enum {\r
+ PcieExplainTypeCommon,\r
+ PcieExplainTypeDevice,\r
+ PcieExplainTypeLink,\r
+ PcieExplainTypeSlot,\r
+ PcieExplainTypeRoot,\r
+ PcieExplainTypeMax\r
+} PCIE_EXPLAIN_TYPE;\r
+\r
+typedef struct\r
+{\r
+ UINT16 Token;\r
+ UINTN Offset;\r
+ PCIE_CAPREG_FIELD_WIDTH Width;\r
+ PCIE_EXPLAIN_FUNCTION Func;\r
+ PCIE_EXPLAIN_TYPE Type;\r
+} PCIE_EXPLAIN_STRUCT;\r
+\r
+PCIE_EXPLAIN_STRUCT PcieExplainList[] = {\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_CAPABILITY_CAPID),\r
+ 0x00,\r
+ FieldWidthUINT8,\r
+ NULL,\r
+ PcieExplainTypeCommon\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_NEXTCAP_PTR),\r
+ 0x01,\r
+ FieldWidthUINT8,\r
+ NULL,\r
+ PcieExplainTypeCommon\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_CAP_REGISTER),\r
+ 0x02,\r
+ FieldWidthUINT16,\r
+ ExplainPcieCapReg,\r
+ PcieExplainTypeCommon\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_DEVICE_CAP),\r
+ 0x04,\r
+ FieldWidthUINT32,\r
+ ExplainPcieDeviceCap,\r
+ PcieExplainTypeDevice\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_DEVICE_CONTROL),\r
+ 0x08,\r
+ FieldWidthUINT16,\r
+ ExplainPcieDeviceControl,\r
+ PcieExplainTypeDevice\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_DEVICE_STATUS),\r
+ 0x0a,\r
+ FieldWidthUINT16,\r
+ ExplainPcieDeviceStatus,\r
+ PcieExplainTypeDevice\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_LINK_CAPABILITIES),\r
+ 0x0c,\r
+ FieldWidthUINT32,\r
+ ExplainPcieLinkCap,\r
+ PcieExplainTypeLink\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_LINK_CONTROL),\r
+ 0x10,\r
+ FieldWidthUINT16,\r
+ ExplainPcieLinkControl,\r
+ PcieExplainTypeLink\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_LINK_STATUS),\r
+ 0x12,\r
+ FieldWidthUINT16,\r
+ ExplainPcieLinkStatus,\r
+ PcieExplainTypeLink\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_SLOT_CAPABILITIES),\r
+ 0x14,\r
+ FieldWidthUINT32,\r
+ ExplainPcieSlotCap,\r
+ PcieExplainTypeSlot\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_SLOT_CONTROL),\r
+ 0x18,\r
+ FieldWidthUINT16,\r
+ ExplainPcieSlotControl,\r
+ PcieExplainTypeSlot\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_SLOT_STATUS),\r
+ 0x1a,\r
+ FieldWidthUINT16,\r
+ ExplainPcieSlotStatus,\r
+ PcieExplainTypeSlot\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_ROOT_CONTROL),\r
+ 0x1c,\r
+ FieldWidthUINT16,\r
+ ExplainPcieRootControl,\r
+ PcieExplainTypeRoot\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_RSVDP),\r
+ 0x1e,\r
+ FieldWidthUINT16,\r
+ ExplainPcieRootCap,\r
+ PcieExplainTypeRoot\r
+ },\r
+ {\r
+ STRING_TOKEN (STR_PCIEX_ROOT_STATUS),\r
+ 0x20,\r
+ FieldWidthUINT32,\r
+ ExplainPcieRootStatus,\r
+ PcieExplainTypeRoot\r
+ },\r
+ {\r
+ 0,\r
+ 0,\r
+ (PCIE_CAPREG_FIELD_WIDTH)0,\r
+ NULL,\r
+ PcieExplainTypeMax\r
+ }\r
+};\r
+\r
+//\r
+// Global Variables\r
+//\r
+PCI_CONFIG_SPACE *mConfigSpace = NULL;\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-s", TypeValue},\r
+ {L"-i", TypeFlag},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+CHAR16 *DevicePortTypeTable[] = {\r
+ L"PCI Express Endpoint",\r
+ L"Legacy PCI Express Endpoint",\r
+ L"Unknown Type",\r
+ L"Unknonw Type",\r
+ L"Root Port of PCI Express Root Complex",\r
+ L"Upstream Port of PCI Express Switch",\r
+ L"Downstream Port of PCI Express Switch",\r
+ L"PCI Express to PCI/PCI-X Bridge",\r
+ L"PCI/PCI-X to PCI Express Bridge",\r
+ L"Root Complex Integrated Endpoint",\r
+ L"Root Complex Event Collector"\r
+};\r
+\r
+CHAR16 *L0sLatencyStrTable[] = {\r
+ L"Less than 64ns",\r
+ L"64ns to less than 128ns",\r
+ L"128ns to less than 256ns",\r
+ L"256ns to less than 512ns",\r
+ L"512ns to less than 1us",\r
+ L"1us to less than 2us",\r
+ L"2us-4us",\r
+ L"More than 4us"\r
+};\r
+\r
+CHAR16 *L1LatencyStrTable[] = {\r
+ L"Less than 1us",\r
+ L"1us to less than 2us",\r
+ L"2us to less than 4us",\r
+ L"4us to less than 8us",\r
+ L"8us to less than 16us",\r
+ L"16us to less than 32us",\r
+ L"32us-64us",\r
+ L"More than 64us"\r
+};\r
+\r
+CHAR16 *ASPMCtrlStrTable[] = {\r
+ L"Disabled",\r
+ L"L0s Entry Enabled",\r
+ L"L1 Entry Enabled",\r
+ L"L0s and L1 Entry Enabled"\r
+};\r
+\r
+CHAR16 *SlotPwrLmtScaleTable[] = {\r
+ L"1.0x",\r
+ L"0.1x",\r
+ L"0.01x",\r
+ L"0.001x"\r
+};\r
+\r
+CHAR16 *IndicatorTable[] = {\r
+ L"Reserved",\r
+ L"On",\r
+ L"Blink",\r
+ L"Off"\r
+};\r
+\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunPci (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ UINT16 Segment;\r
+ UINT16 Bus;\r
+ UINT16 Device;\r
+ UINT16 Func;\r
+ UINT64 Address;\r
+ EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev;\r
+ EFI_STATUS Status;\r
+ PCI_COMMON_HEADER PciHeader;\r
+ PCI_CONFIG_SPACE ConfigSpace;\r
+ UINTN ScreenCount;\r
+ UINTN TempColumn;\r
+ UINTN ScreenSize;\r
+ BOOLEAN ExplainData;\r
+ UINTN Index;\r
+ UINTN SizeOfHeader;\r
+ BOOLEAN PrintTitle;\r
+ UINTN HandleBufSize;\r
+ EFI_HANDLE *HandleBuf;\r
+ UINTN HandleCount;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r
+ UINT16 MinBus;\r
+ UINT16 MaxBus;\r
+ BOOLEAN IsEnd;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN Size;\r
+ CONST CHAR16 *Temp;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ Address = 0;\r
+ Size = 0;\r
+ IoDev = NULL;\r
+ HandleBuf = NULL;\r
+ Package = NULL;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+\r
+\r
+ //\r
+ // Get all instances of PciRootBridgeIo. Allocate space for 1 EFI_HANDLE and\r
+ // call LibLocateHandle(), if EFI_BUFFER_TOO_SMALL is returned, allocate enough\r
+ // space for handles and call it again.\r
+ //\r
+ HandleBufSize = sizeof (EFI_HANDLE);\r
+ HandleBuf = (EFI_HANDLE *) AllocatePool (HandleBufSize);\r
+ if (HandleBuf == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto Done;\r
+ }\r
+\r
+ Status = gBS->LocateHandle (\r
+ ByProtocol,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ NULL,\r
+ &HandleBufSize,\r
+ HandleBuf\r
+ );\r
+\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ HandleBuf = ReallocatePool (sizeof (EFI_HANDLE), HandleBufSize, HandleBuf);\r
+ if (HandleBuf == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_OUT_MEM), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_OUT_OF_RESOURCES;\r
+ goto Done;\r
+ }\r
+\r
+ Status = gBS->LocateHandle (\r
+ ByProtocol,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ NULL,\r
+ &HandleBufSize,\r
+ HandleBuf\r
+ );\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PCIRBIO_NF), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+\r
+ HandleCount = HandleBufSize / sizeof (EFI_HANDLE);\r
+ //\r
+ // Argument Count == 1(no other argument): enumerate all pci functions\r
+ //\r
+ if (ShellCommandLineGetCount(Package) == 0) {\r
+ gST->ConOut->QueryMode (\r
+ gST->ConOut,\r
+ gST->ConOut->Mode->Mode,\r
+ &TempColumn,\r
+ &ScreenSize\r
+ );\r
+\r
+ ScreenCount = 0;\r
+ ScreenSize -= 4;\r
+ if ((ScreenSize & 1) == 1) {\r
+ ScreenSize -= 1;\r
+ }\r
+\r
+ PrintTitle = TRUE;\r
+\r
+ //\r
+ // For each handle, which decides a segment and a bus number range,\r
+ // enumerate all devices on it.\r
+ //\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ Status = PciGetProtocolAndResource (\r
+ HandleBuf[Index],\r
+ &IoDev,\r
+ &Descriptors\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_HANDLE_CFG_ERR), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+ //\r
+ // No document say it's impossible for a RootBridgeIo protocol handle\r
+ // to have more than one address space descriptors, so find out every\r
+ // bus range and for each of them do device enumeration.\r
+ //\r
+ while (TRUE) {\r
+ Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_BUS_RANGE_ERR), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+\r
+ if (IsEnd) {\r
+ break;\r
+ }\r
+\r
+ for (Bus = MinBus; Bus <= MaxBus; Bus++) {\r
+ //\r
+ // For each devices, enumerate all functions it contains\r
+ //\r
+ for (Device = 0; Device <= PCI_MAX_DEVICE; Device++) {\r
+ //\r
+ // For each function, read its configuration space and print summary\r
+ //\r
+ for (Func = 0; Func <= PCI_MAX_FUNC; Func++) {\r
+ if (ShellGetExecutionBreakFlag ()) {\r
+ ShellStatus = SHELL_ABORTED;\r
+ goto Done;\r
+ }\r
+ Address = CALC_EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r
+ IoDev->Pci.Read (\r
+ IoDev,\r
+ EfiPciWidthUint16,\r
+ Address,\r
+ 1,\r
+ &PciHeader.VendorId\r
+ );\r
+\r
+ //\r
+ // If VendorId = 0xffff, there does not exist a device at this\r
+ // location. For each device, if there is any function on it,\r
+ // there must be 1 function at Function 0. So if Func = 0, there\r
+ // will be no more functions in the same device, so we can break\r
+ // loop to deal with the next device.\r
+ //\r
+ if (PciHeader.VendorId == 0xffff && Func == 0) {\r
+ break;\r
+ }\r
+\r
+ if (PciHeader.VendorId != 0xffff) {\r
+\r
+ if (PrintTitle) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_TITLE), gShellDebug1HiiHandle);\r
+ PrintTitle = FALSE;\r
+ }\r
+\r
+ IoDev->Pci.Read (\r
+ IoDev,\r
+ EfiPciWidthUint32,\r
+ Address,\r
+ sizeof (PciHeader) / sizeof (UINT32),\r
+ &PciHeader\r
+ );\r
+\r
+ ShellPrintHiiEx(\r
+ -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P1), gShellDebug1HiiHandle,\r
+ IoDev->SegmentNumber,\r
+ Bus,\r
+ Device,\r
+ Func\r
+ );\r
+\r
+ PciPrintClassCode (PciHeader.ClassCode, FALSE);\r
+ ShellPrintHiiEx(\r
+ -1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_P2), gShellDebug1HiiHandle,\r
+ PciHeader.VendorId,\r
+ PciHeader.DeviceId,\r
+ PciHeader.ClassCode[0]\r
+ );\r
+\r
+ ScreenCount += 2;\r
+ if (ScreenCount >= ScreenSize && ScreenSize != 0) {\r
+ //\r
+ // If ScreenSize == 0 we have the console redirected so don't\r
+ // block updates\r
+ //\r
+ ScreenCount = 0;\r
+ }\r
+ //\r
+ // If this is not a multi-function device, we can leave the loop\r
+ // to deal with the next device.\r
+ //\r
+ if (Func == 0 && ((PciHeader.HeaderType & HEADER_TYPE_MULTI_FUNCTION) == 0x00)) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ //\r
+ // If Descriptor is NULL, Configuration() returns EFI_UNSUPPRORED,\r
+ // we assume the bus range is 0~PCI_MAX_BUS. After enumerated all\r
+ // devices on all bus, we can leave loop.\r
+ //\r
+ if (Descriptors == NULL) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ Status = EFI_SUCCESS;\r
+ goto Done;\r
+ }\r
+\r
+ if (ShellCommandLineGetCount(Package) == 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ //\r
+ // Arg count >= 3, dump binary of specified function, interpret if necessary\r
+ //\r
+ if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+\r
+ ExplainData = FALSE;\r
+ Segment = 0;\r
+ Bus = 0;\r
+ Device = 0;\r
+ Func = 0;\r
+ if (ShellCommandLineGetFlag(Package, L"-i")) {\r
+ ExplainData = TRUE;\r
+ }\r
+\r
+ Temp = ShellCommandLineGetValue(Package, L"-s");\r
+ if (Temp != NULL) {\r
+ Segment = (UINT16) StrHexToUintn (Temp);\r
+ }\r
+\r
+ //\r
+ // The first Argument(except "-i") is assumed to be Bus number, second\r
+ // to be Device number, and third to be Func number.\r
+ //\r
+ Temp = ShellCommandLineGetRawValue(Package, 1);\r
+ if (Temp != NULL) {\r
+ Bus = (UINT16)StrHexToUintn(Temp);\r
+ if (Bus > MAX_BUS_NUMBER) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+ Temp = ShellCommandLineGetRawValue(Package, 2);\r
+ if (Temp != NULL) {\r
+ Device = (UINT16) StrHexToUintn(Temp);\r
+ if (Device > MAX_DEVICE_NUMBER){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+ Temp = ShellCommandLineGetRawValue(Package, 3);\r
+ if (Temp != NULL) {\r
+ Func = (UINT16) StrHexToUintn(Temp);\r
+ if (Func > MAX_FUNCTION_NUMBER){\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+\r
+ //\r
+ // Find the protocol interface who's in charge of current segment, and its\r
+ // bus range covers the current bus\r
+ //\r
+ Status = PciFindProtocolInterface (\r
+ HandleBuf,\r
+ HandleCount,\r
+ Segment,\r
+ Bus,\r
+ &IoDev\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(\r
+ -1, -1, NULL, STRING_TOKEN (STR_PCI_NO_FIND), gShellDebug1HiiHandle,\r
+ gShellDebug1HiiHandle,\r
+ Segment,\r
+ Bus\r
+ );\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+\r
+ Address = CALC_EFI_PCI_ADDRESS (Bus, Device, Func, 0);\r
+ Status = IoDev->Pci.Read (\r
+ IoDev,\r
+ EfiPciWidthUint8,\r
+ Address,\r
+ sizeof (ConfigSpace),\r
+ &ConfigSpace\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_NO_CFG), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ goto Done;\r
+ }\r
+\r
+ mConfigSpace = &ConfigSpace;\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_PCI_INFO),\r
+ gShellDebug1HiiHandle,\r
+ Segment,\r
+ Bus,\r
+ Device,\r
+ Func,\r
+ Segment,\r
+ Bus,\r
+ Device,\r
+ Func\r
+ );\r
+\r
+ //\r
+ // Dump standard header of configuration space\r
+ //\r
+ SizeOfHeader = sizeof (ConfigSpace.Common) + sizeof (ConfigSpace.NonCommon);\r
+\r
+ PrivateDumpHex (2, 0, SizeOfHeader, &ConfigSpace);\r
+ ShellPrintEx(-1,-1, L"\r\n");\r
+\r
+ //\r
+ // Dump device dependent Part of configuration space\r
+ //\r
+ PrivateDumpHex (\r
+ 2,\r
+ SizeOfHeader,\r
+ sizeof (ConfigSpace) - SizeOfHeader,\r
+ ConfigSpace.Data\r
+ );\r
+\r
+ //\r
+ // If "-i" appears in command line, interpret data in configuration space\r
+ //\r
+ if (ExplainData) {\r
+ Status = PciExplainData (&ConfigSpace, Address, IoDev);\r
+ }\r
+ }\r
+Done:\r
+ if (HandleBuf != NULL) {\r
+ FreePool (HandleBuf);\r
+ }\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ mConfigSpace = NULL;\r
+ return ShellStatus;\r
+}\r
+\r
+EFI_STATUS\r
+PciFindProtocolInterface (\r
+ IN EFI_HANDLE *HandleBuf,\r
+ IN UINTN HandleCount,\r
+ IN UINT16 Segment,\r
+ IN UINT16 Bus,\r
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function finds out the protocol which is in charge of the given\r
+ segment, and its bus range covers the current bus number. It lookes\r
+ each instances of RootBridgeIoProtocol handle, until the one meets the\r
+ criteria is found.\r
+\r
+Arguments:\r
+\r
+ HandleBuf Buffer which holds all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles\r
+ HandleCount Count of all PCI_ROOT_BRIDIGE_IO_PROTOCOL handles\r
+ Segment Segment number of device we are dealing with\r
+ Bus Bus number of device we are dealing with\r
+ IoDev Handle used to access configuration space of PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS - The command completed successfully\r
+ EFI_INVALID_PARAMETER - Invalid parameter\r
+\r
+**/\r
+{\r
+ UINTN Index;\r
+ EFI_STATUS Status;\r
+ BOOLEAN FoundInterface;\r
+ EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR *Descriptors;\r
+ UINT16 MinBus;\r
+ UINT16 MaxBus;\r
+ BOOLEAN IsEnd;\r
+\r
+ FoundInterface = FALSE;\r
+ //\r
+ // Go through all handles, until the one meets the criteria is found\r
+ //\r
+ for (Index = 0; Index < HandleCount; Index++) {\r
+ Status = PciGetProtocolAndResource (HandleBuf[Index], IoDev, &Descriptors);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // When Descriptors == NULL, the Configuration() is not implemented,\r
+ // so we only check the Segment number\r
+ //\r
+ if (Descriptors == NULL && Segment == (*IoDev)->SegmentNumber) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if ((*IoDev)->SegmentNumber != Segment) {\r
+ continue;\r
+ }\r
+\r
+ while (TRUE) {\r
+ Status = PciGetNextBusRange (&Descriptors, &MinBus, &MaxBus, &IsEnd);\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+\r
+ if (IsEnd) {\r
+ break;\r
+ }\r
+\r
+ if (MinBus <= Bus && MaxBus >= Bus) {\r
+ FoundInterface = TRUE;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+\r
+ if (FoundInterface) {\r
+ return EFI_SUCCESS;\r
+ } else {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+}\r
+\r
+EFI_STATUS\r
+PciGetProtocolAndResource (\r
+ IN EFI_HANDLE Handle,\r
+ OUT EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL **IoDev,\r
+ OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function gets the protocol interface from the given handle, and\r
+ obtains its address space descriptors.\r
+\r
+Arguments:\r
+\r
+ Handle The PCI_ROOT_BRIDIGE_IO_PROTOCOL handle\r
+ IoDev Handle used to access configuration space of PCI device\r
+ Descriptors Points to the address space descriptors\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Get inferface from protocol\r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ Handle,\r
+ &gEfiPciRootBridgeIoProtocolGuid,\r
+ (VOID**)IoDev\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ return Status;\r
+ }\r
+ //\r
+ // Call Configuration() to get address space descriptors\r
+ //\r
+ Status = (*IoDev)->Configuration (*IoDev, (VOID**)Descriptors);\r
+ if (Status == EFI_UNSUPPORTED) {\r
+ *Descriptors = NULL;\r
+ return EFI_SUCCESS;\r
+\r
+ } else {\r
+ return Status;\r
+ }\r
+}\r
+\r
+EFI_STATUS\r
+PciGetNextBusRange (\r
+ IN OUT EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR **Descriptors,\r
+ OUT UINT16 *MinBus,\r
+ OUT UINT16 *MaxBus,\r
+ OUT BOOLEAN *IsEnd\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ This function get the next bus range of given address space descriptors.\r
+ It also moves the pointer backward a node, to get prepared to be called\r
+ again.\r
+\r
+Arguments:\r
+\r
+ Descriptors points to current position of a serial of address space\r
+ descriptors\r
+ MinBus The lower range of bus number\r
+ ManBus The upper range of bus number\r
+ IsEnd Meet end of the serial of descriptors\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ *IsEnd = FALSE;\r
+\r
+ //\r
+ // When *Descriptors is NULL, Configuration() is not implemented, so assume\r
+ // range is 0~PCI_MAX_BUS\r
+ //\r
+ if ((*Descriptors) == NULL) {\r
+ *MinBus = 0;\r
+ *MaxBus = PCI_MAX_BUS;\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // *Descriptors points to one or more address space descriptors, which\r
+ // ends with a end tagged descriptor. Examine each of the descriptors,\r
+ // if a bus typed one is found and its bus range covers bus, this handle\r
+ // is the handle we are looking for.\r
+ //\r
+ if ((*Descriptors)->Desc == ACPI_END_TAG_DESCRIPTOR) {\r
+ *IsEnd = TRUE;\r
+ }\r
+\r
+ while ((*Descriptors)->Desc != ACPI_END_TAG_DESCRIPTOR) {\r
+ if ((*Descriptors)->ResType == ACPI_ADDRESS_SPACE_TYPE_BUS) {\r
+ *MinBus = (UINT16) (*Descriptors)->AddrRangeMin;\r
+ *MaxBus = (UINT16) (*Descriptors)->AddrRangeMax;\r
+ (*Descriptors)++;\r
+ break;\r
+ }\r
+\r
+ (*Descriptors)++;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainData (\r
+ IN PCI_CONFIG_SPACE *ConfigSpace,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain the data in PCI configuration space. The part which is common for\r
+ PCI device and bridge is interpreted in this function. It calls other\r
+ functions to interpret data unique for device or bridge.\r
+\r
+Arguments:\r
+\r
+ ConfigSpace Data in PCI configuration space\r
+ Address Address used to access configuration space of this PCI device\r
+ IoDev Handle used to access configuration space of PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ PCI_COMMON_HEADER *Common;\r
+ PCI_HEADER_TYPE HeaderType;\r
+ EFI_STATUS Status;\r
+ UINT8 CapPtr;\r
+\r
+ Common = &(ConfigSpace->Common);\r
+\r
+ Print (L"\n");\r
+\r
+ //\r
+ // Print Vendor Id and Device Id\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_VID_DID), gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Common->VendorId)),\r
+ Common->VendorId,\r
+ INDEX_OF (&(Common->DeviceId)),\r
+ Common->DeviceId\r
+ );\r
+\r
+ //\r
+ // Print register Command\r
+ //\r
+ PciExplainCommand (&(Common->Command));\r
+\r
+ //\r
+ // Print register Status\r
+ //\r
+ PciExplainStatus (&(Common->Status), TRUE, PciUndefined);\r
+\r
+ //\r
+ // Print register Revision ID\r
+ //\r
+ ShellPrintEx(-1, -1, L"/r/n");\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_RID), gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Common->RevisionId)),\r
+ Common->RevisionId\r
+ );\r
+\r
+ //\r
+ // Print register BIST\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_BIST), gShellDebug1HiiHandle, INDEX_OF (&(Common->BIST)));\r
+ if ((Common->BIST & PCI_BIT_7) != 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP), gShellDebug1HiiHandle, 0x0f & Common->BIST);\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_PCI_LINE_CAP_NO), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Print register Cache Line Size\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CACHE_LINE_SIZE),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Common->CacheLineSize)),\r
+ Common->CacheLineSize\r
+ );\r
+\r
+ //\r
+ // Print register Latency Timer\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_LATENCY_TIMER),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Common->PrimaryLatencyTimer)),\r
+ Common->PrimaryLatencyTimer\r
+ );\r
+\r
+ //\r
+ // Print register Header Type\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_HEADER_TYPE),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Common->HeaderType)),\r
+ Common->HeaderType\r
+ );\r
+\r
+ if ((Common->HeaderType & PCI_BIT_7) != 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MULTI_FUNCTION), gShellDebug1HiiHandle);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SINGLE_FUNCTION), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ HeaderType = (PCI_HEADER_TYPE)(UINT8) (Common->HeaderType & 0x7f);\r
+ switch (HeaderType) {\r
+ case PciDevice:\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_PCI_DEVICE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case PciP2pBridge:\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_P2P_BRIDGE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case PciCardBusBridge:\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_BRIDGE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED), gShellDebug1HiiHandle);\r
+ HeaderType = PciUndefined;\r
+ }\r
+\r
+ //\r
+ // Print register Class Code\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CLASS), gShellDebug1HiiHandle);\r
+ PciPrintClassCode ((UINT8 *) Common->ClassCode, TRUE);\r
+ Print (L"\n");\r
+\r
+ if (ShellGetExecutionBreakFlag()) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ //\r
+ // Interpret remaining part of PCI configuration header depending on\r
+ // HeaderType\r
+ //\r
+ CapPtr = 0;\r
+ Status = EFI_SUCCESS;\r
+ switch (HeaderType) {\r
+ case PciDevice:\r
+ Status = PciExplainDeviceData (\r
+ &(ConfigSpace->NonCommon.Device),\r
+ Address,\r
+ IoDev\r
+ );\r
+ CapPtr = ConfigSpace->NonCommon.Device.CapabilitiesPtr;\r
+ break;\r
+\r
+ case PciP2pBridge:\r
+ Status = PciExplainBridgeData (\r
+ &(ConfigSpace->NonCommon.Bridge),\r
+ Address,\r
+ IoDev\r
+ );\r
+ CapPtr = ConfigSpace->NonCommon.Bridge.CapabilitiesPtr;\r
+ break;\r
+\r
+ case PciCardBusBridge:\r
+ Status = PciExplainCardBusData (\r
+ &(ConfigSpace->NonCommon.CardBus),\r
+ Address,\r
+ IoDev\r
+ );\r
+ CapPtr = ConfigSpace->NonCommon.CardBus.CapabilitiesPtr;\r
+ break;\r
+ }\r
+ //\r
+ // If Status bit4 is 1, dump or explain capability structure\r
+ //\r
+ if ((Common->Status) & EFI_PCI_STATUS_CAPABILITY) {\r
+ PciExplainCapabilityStruct (IoDev, Address, CapPtr);\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainDeviceData (\r
+ IN PCI_DEVICE_HEADER *Device,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain the device specific part of data in PCI configuration space.\r
+\r
+Arguments:\r
+\r
+ Device Data in PCI configuration space\r
+ Address Address used to access configuration space of this PCI device\r
+ IoDev Handle used to access configuration space of PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ UINTN Index;\r
+ BOOLEAN BarExist;\r
+ EFI_STATUS Status;\r
+ UINTN BarCount;\r
+\r
+ //\r
+ // Print Base Address Registers(Bar). When Bar = 0, this Bar does not\r
+ // exist. If these no Bar for this function, print "none", otherwise\r
+ // list detail information about this Bar.\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDR), gShellDebug1HiiHandle, INDEX_OF (Device->Bar));\r
+\r
+ BarExist = FALSE;\r
+ BarCount = sizeof (Device->Bar) / sizeof (Device->Bar[0]);\r
+ for (Index = 0; Index < BarCount; Index++) {\r
+ if (Device->Bar[Index] == 0) {\r
+ continue;\r
+ }\r
+\r
+ if (!BarExist) {\r
+ BarExist = TRUE;\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE), gShellDebug1HiiHandle);\r
+ Print (L" --------------------------------------------------------------------------");\r
+ }\r
+\r
+ Status = PciExplainBar (\r
+ &(Device->Bar[Index]),\r
+ &(mConfigSpace->Common.Command),\r
+ Address,\r
+ IoDev,\r
+ &Index\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (!BarExist) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r
+\r
+ } else {\r
+ Print (L"\n --------------------------------------------------------------------------");\r
+ }\r
+\r
+ //\r
+ // Print register Expansion ROM Base Address\r
+ //\r
+ if ((Device->ROMBar & PCI_BIT_0) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_EXPANSION_ROM_DISABLED), gShellDebug1HiiHandle, INDEX_OF (&(Device->ROMBar)));\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->ROMBar)),\r
+ Device->ROMBar\r
+ );\r
+ }\r
+ //\r
+ // Print register Cardbus CIS ptr\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CARDBUS_CIS),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->CardBusCISPtr)),\r
+ Device->CardBusCISPtr\r
+ );\r
+\r
+ //\r
+ // Print register Sub-vendor ID and subsystem ID\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->SubVendorId)),\r
+ Device->SubVendorId\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SUBSYSTEM_ID),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->SubSystemId)),\r
+ Device->SubSystemId\r
+ );\r
+\r
+ //\r
+ // Print register Capabilities Ptr\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->CapabilitiesPtr)),\r
+ Device->CapabilitiesPtr\r
+ );\r
+\r
+ //\r
+ // Print register Interrupt Line and interrupt pin\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_INTERRUPT_LINE),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->InterruptLine)),\r
+ Device->InterruptLine\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->InterruptPin)),\r
+ Device->InterruptPin\r
+ );\r
+\r
+ //\r
+ // Print register Min_Gnt and Max_Lat\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MIN_GNT),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->MinGnt)),\r
+ Device->MinGnt\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MAX_LAT),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Device->MaxLat)),\r
+ Device->MaxLat\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainBridgeData (\r
+ IN PCI_BRIDGE_HEADER *Bridge,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain the bridge specific part of data in PCI configuration space.\r
+\r
+Arguments:\r
+\r
+ Bridge Bridge specific data region in PCI configuration space\r
+ Address Address used to access configuration space of this PCI device\r
+ IoDev Handle used to access configuration space of PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ UINTN Index;\r
+ BOOLEAN BarExist;\r
+ UINTN BarCount;\r
+ UINT32 IoAddress32;\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Print Base Address Registers. When Bar = 0, this Bar does not\r
+ // exist. If these no Bar for this function, print "none", otherwise\r
+ // list detail information about this Bar.\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BASE_ADDRESS), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->Bar)));\r
+\r
+ BarExist = FALSE;\r
+ BarCount = sizeof (Bridge->Bar) / sizeof (Bridge->Bar[0]);\r
+\r
+ for (Index = 0; Index < BarCount; Index++) {\r
+ if (Bridge->Bar[Index] == 0) {\r
+ continue;\r
+ }\r
+\r
+ if (!BarExist) {\r
+ BarExist = TRUE;\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_START_TYPE_2), gShellDebug1HiiHandle);\r
+ Print (L" --------------------------------------------------------------------------");\r
+ }\r
+\r
+ Status = PciExplainBar (\r
+ &(Bridge->Bar[Index]),\r
+ &(mConfigSpace->Common.Command),\r
+ Address,\r
+ IoDev,\r
+ &Index\r
+ );\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (!BarExist) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NONE), gShellDebug1HiiHandle);\r
+ } else {\r
+ Print (L"\n --------------------------------------------------------------------------");\r
+ }\r
+\r
+ //\r
+ // Expansion register ROM Base Address\r
+ //\r
+ if ((Bridge->ROMBar & PCI_BIT_0) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO_EXPANSION_ROM), gShellDebug1HiiHandle, INDEX_OF (&(Bridge->ROMBar)));\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_EXPANSION_ROM_BASE_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->ROMBar)),\r
+ Bridge->ROMBar\r
+ );\r
+ }\r
+ //\r
+ // Print Bus Numbers(Primary, Secondary, and Subordinate\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_BUS_NUMBERS),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->PrimaryBus)),\r
+ INDEX_OF (&(Bridge->SecondaryBus)),\r
+ INDEX_OF (&(Bridge->SubordinateBus))\r
+ );\r
+\r
+ Print (L" ------------------------------------------------------\n");\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->PrimaryBus);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SecondaryBus);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BRIDGE), gShellDebug1HiiHandle, Bridge->SubordinateBus);\r
+\r
+ //\r
+ // Print register Secondary Latency Timer\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SECONDARY_TIMER),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->SecondaryLatencyTimer)),\r
+ Bridge->SecondaryLatencyTimer\r
+ );\r
+\r
+ //\r
+ // Print register Secondary Status\r
+ //\r
+ PciExplainStatus (&(Bridge->SecondaryStatus), FALSE, PciP2pBridge);\r
+\r
+ //\r
+ // Print I/O and memory ranges this bridge forwards. There are 3 resource\r
+ // types: I/O, memory, and pre-fetchable memory. For each resource type,\r
+ // base and limit address are listed.\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE), gShellDebug1HiiHandle);\r
+ Print (L"----------------------------------------------------------------------\n");\r
+\r
+ //\r
+ // IO Base & Limit\r
+ //\r
+ IoAddress32 = (Bridge->IoBaseUpper << 16 | Bridge->IoBase << 8);\r
+ IoAddress32 &= 0xfffff000;\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_TWO_VARS),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->IoBase)),\r
+ IoAddress32\r
+ );\r
+\r
+ IoAddress32 = (Bridge->IoLimitUpper << 16 | Bridge->IoLimit << 8);\r
+ IoAddress32 |= 0x00000fff;\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR), gShellDebug1HiiHandle, IoAddress32);\r
+\r
+ //\r
+ // Memory Base & Limit\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MEMORY),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->MemoryBase)),\r
+ (Bridge->MemoryBase << 16) & 0xfff00000\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_ONE_VAR),\r
+ gShellDebug1HiiHandle,\r
+ (Bridge->MemoryLimit << 16) | 0x000fffff\r
+ );\r
+\r
+ //\r
+ // Pre-fetch-able Memory Base & Limit\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_PREFETCHABLE),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->PrefetchableMemBase)),\r
+ Bridge->PrefetchableBaseUpper,\r
+ (Bridge->PrefetchableMemBase << 16) & 0xfff00000\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_TWO_VARS_2),\r
+ gShellDebug1HiiHandle,\r
+ Bridge->PrefetchableLimitUpper,\r
+ (Bridge->PrefetchableMemLimit << 16) | 0x000fffff\r
+ );\r
+\r
+ //\r
+ // Print register Capabilities Pointer\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CAPABILITIES_PTR_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->CapabilitiesPtr)),\r
+ Bridge->CapabilitiesPtr\r
+ );\r
+\r
+ //\r
+ // Print register Bridge Control\r
+ //\r
+ PciExplainBridgeControl (&(Bridge->BridgeControl), PciP2pBridge);\r
+\r
+ //\r
+ // Print register Interrupt Line & PIN\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->InterruptLine)),\r
+ Bridge->InterruptLine\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_INTERRUPT_PIN),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(Bridge->InterruptPin)),\r
+ Bridge->InterruptPin\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainBar (\r
+ IN UINT32 *Bar,\r
+ IN UINT16 *Command,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN OUT UINTN *Index\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain the Base Address Register(Bar) in PCI configuration space.\r
+\r
+Arguments:\r
+\r
+ Bar Points to the Base Address Register intended to interpret\r
+ Command Points to the register Command\r
+ Address Address used to access configuration space of this PCI device\r
+ IoDev Handle used to access configuration space of PCI device\r
+ Index The Index\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ UINT16 OldCommand;\r
+ UINT16 NewCommand;\r
+ UINT64 Bar64;\r
+ UINT32 OldBar32;\r
+ UINT32 NewBar32;\r
+ UINT64 OldBar64;\r
+ UINT64 NewBar64;\r
+ BOOLEAN IsMem;\r
+ BOOLEAN IsBar32;\r
+ UINT64 RegAddress;\r
+\r
+ IsBar32 = TRUE;\r
+ Bar64 = 0;\r
+ NewBar32 = 0;\r
+ NewBar64 = 0;\r
+\r
+ //\r
+ // According the bar type, list detail about this bar, for example: 32 or\r
+ // 64 bits; pre-fetchable or not.\r
+ //\r
+ if ((*Bar & PCI_BIT_0) == 0) {\r
+ //\r
+ // This bar is of memory type\r
+ //\r
+ IsMem = TRUE;\r
+\r
+ if ((*Bar & PCI_BIT_1) == 0 && (*Bar & PCI_BIT_2) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_32_BITS), gShellDebug1HiiHandle);\r
+\r
+ } else if ((*Bar & PCI_BIT_1) == 0 && (*Bar & PCI_BIT_2) != 0) {\r
+ Bar64 = 0x0;\r
+ CopyMem (&Bar64, Bar, sizeof (UINT64));\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_2), gShellDebug1HiiHandle, RShiftU64 ((Bar64 & 0xfffffffffffffff0), 32));\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_3), gShellDebug1HiiHandle, (UINT32) (Bar64 & 0xfffffffffffffff0));\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_64_BITS), gShellDebug1HiiHandle);\r
+ IsBar32 = FALSE;\r
+ *Index += 1;\r
+\r
+ } else {\r
+ //\r
+ // Reserved\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_BAR), gShellDebug1HiiHandle, *Bar & 0xfffffff0);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEM_2), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if ((*Bar & PCI_BIT_3) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NO), gShellDebug1HiiHandle);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_YES), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ } else {\r
+ //\r
+ // This bar is of io type\r
+ //\r
+ IsMem = FALSE;\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_ONE_VAR_4), gShellDebug1HiiHandle, *Bar & 0xfffffffc);\r
+ Print (L"I/O ");\r
+ }\r
+\r
+ //\r
+ // Get BAR length(or the amount of resource this bar demands for). To get\r
+ // Bar length, first we should temporarily disable I/O and memory access\r
+ // of this function(by set bits in the register Command), then write all\r
+ // "1"s to this bar. The bar value read back is the amount of resource\r
+ // this bar demands for.\r
+ //\r
+ //\r
+ // Disable io & mem access\r
+ //\r
+ OldCommand = *Command;\r
+ NewCommand = (UINT16) (OldCommand & 0xfffc);\r
+ RegAddress = Address | INDEX_OF (Command);\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &NewCommand);\r
+\r
+ RegAddress = Address | INDEX_OF (Bar);\r
+\r
+ //\r
+ // Read after write the BAR to get the size\r
+ //\r
+ if (IsBar32) {\r
+ OldBar32 = *Bar;\r
+ NewBar32 = 0xffffffff;\r
+\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);\r
+ IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 1, &NewBar32);\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 1, &OldBar32);\r
+\r
+ if (IsMem) {\r
+ NewBar32 = NewBar32 & 0xfffffff0;\r
+ NewBar32 = (~NewBar32) + 1;\r
+\r
+ } else {\r
+ NewBar32 = NewBar32 & 0xfffffffc;\r
+ NewBar32 = (~NewBar32) + 1;\r
+ NewBar32 = NewBar32 & 0x0000ffff;\r
+ }\r
+ } else {\r
+\r
+ OldBar64 = 0x0;\r
+ CopyMem (&OldBar64, Bar, sizeof (UINT64));\r
+ NewBar64 = 0xffffffffffffffff;\r
+\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);\r
+ IoDev->Pci.Read (IoDev, EfiPciWidthUint32, RegAddress, 2, &NewBar64);\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint32, RegAddress, 2, &OldBar64);\r
+\r
+ if (IsMem) {\r
+ NewBar64 = NewBar64 & 0xfffffffffffffff0;\r
+ NewBar64 = (~NewBar64) + 1;\r
+\r
+ } else {\r
+ NewBar64 = NewBar64 & 0xfffffffffffffffc;\r
+ NewBar64 = (~NewBar64) + 1;\r
+ NewBar64 = NewBar64 & 0x000000000000ffff;\r
+ }\r
+ }\r
+ //\r
+ // Enable io & mem access\r
+ //\r
+ RegAddress = Address | INDEX_OF (Command);\r
+ IoDev->Pci.Write (IoDev, EfiPciWidthUint16, RegAddress, 1, &OldCommand);\r
+\r
+ if (IsMem) {\r
+ if (IsBar32) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32), gShellDebug1HiiHandle, NewBar32);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_2), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffff0) - 1);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, RShiftU64 (NewBar64, 32));\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) NewBar64);\r
+ Print (L" ");\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_RSHIFT),\r
+ gShellDebug1HiiHandle,\r
+ RShiftU64 ((NewBar64 + (Bar64 & 0xfffffffffffffff0) - 1), 32)\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RSHIFT), gShellDebug1HiiHandle, (UINT32) (NewBar64 + (Bar64 & 0xfffffffffffffff0) - 1));\r
+\r
+ }\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_3), gShellDebug1HiiHandle, NewBar32);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEWBAR_32_4), gShellDebug1HiiHandle, NewBar32 + (*Bar & 0xfffffffc) - 1);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainCardBusData (\r
+ IN PCI_CARDBUS_HEADER *CardBus,\r
+ IN UINT64 Address,\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain the cardbus specific part of data in PCI configuration space.\r
+\r
+Arguments:\r
+\r
+ CardBus CardBus specific region of PCI configuration space\r
+ Address Address used to access configuration space of this PCI device\r
+ IoDev Handle used to access configuration space of PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ BOOLEAN Io32Bit;\r
+ PCI_CARDBUS_DATA *CardBusData;\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CARDBUS_SOCKET),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->CardBusSocketReg)),\r
+ CardBus->CardBusSocketReg\r
+ );\r
+\r
+ //\r
+ // Print Secondary Status\r
+ //\r
+ PciExplainStatus (&(CardBus->SecondaryStatus), FALSE, PciCardBusBridge);\r
+\r
+ //\r
+ // Print Bus Numbers(Primary bus number, CardBus bus number, and\r
+ // Subordinate bus number\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_BUS_NUMBERS_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->PciBusNumber)),\r
+ INDEX_OF (&(CardBus->CardBusBusNumber)),\r
+ INDEX_OF (&(CardBus->SubordinateBusNumber))\r
+ );\r
+\r
+ Print (L" ------------------------------------------------------\n");\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS), gShellDebug1HiiHandle, CardBus->PciBusNumber);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_2), gShellDebug1HiiHandle, CardBus->CardBusBusNumber);\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_CARDBUS_3), gShellDebug1HiiHandle, CardBus->SubordinateBusNumber);\r
+\r
+ //\r
+ // Print CardBus Latency Timer\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CARDBUS_LATENCY),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->CardBusLatencyTimer)),\r
+ CardBus->CardBusLatencyTimer\r
+ );\r
+\r
+ //\r
+ // Print Memory/Io ranges this cardbus bridge forwards\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESOURCE_TYPE_2), gShellDebug1HiiHandle);\r
+ Print (L"----------------------------------------------------------------------\n");\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MEM_3),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->MemoryBase0)),\r
+ CardBus->BridgeControl & PCI_BIT_8 ? L" Prefetchable" : L"Non-Prefetchable",\r
+ CardBus->MemoryBase0 & 0xfffff000,\r
+ CardBus->MemoryLimit0 | 0x00000fff\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MEM_3),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->MemoryBase1)),\r
+ CardBus->BridgeControl & PCI_BIT_9 ? L" Prefetchable" : L"Non-Prefetchable",\r
+ CardBus->MemoryBase1 & 0xfffff000,\r
+ CardBus->MemoryLimit1 | 0x00000fff\r
+ );\r
+\r
+ Io32Bit = (BOOLEAN) (CardBus->IoBase0 & PCI_BIT_0);\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_IO_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->IoBase0)),\r
+ Io32Bit ? L" 32 bit" : L" 16 bit",\r
+ CardBus->IoBase0 & (Io32Bit ? 0xfffffffc : 0x0000fffc),\r
+ CardBus->IoLimit0 & (Io32Bit ? 0xffffffff : 0x0000ffff) | 0x00000003\r
+ );\r
+\r
+ Io32Bit = (BOOLEAN) (CardBus->IoBase1 & PCI_BIT_0);\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_IO_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->IoBase1)),\r
+ Io32Bit ? L" 32 bit" : L" 16 bit",\r
+ CardBus->IoBase1 & (Io32Bit ? 0xfffffffc : 0x0000fffc),\r
+ CardBus->IoLimit1 & (Io32Bit ? 0xffffffff : 0x0000ffff) | 0x00000003\r
+ );\r
+\r
+ //\r
+ // Print register Interrupt Line & PIN\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_INTERRUPT_LINE_3),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBus->InterruptLine)),\r
+ CardBus->InterruptLine,\r
+ INDEX_OF (&(CardBus->InterruptPin)),\r
+ CardBus->InterruptPin\r
+ );\r
+\r
+ //\r
+ // Print register Bridge Control\r
+ //\r
+ PciExplainBridgeControl (&(CardBus->BridgeControl), PciCardBusBridge);\r
+\r
+ //\r
+ // Print some registers in data region of PCI configuration space for cardbus\r
+ // bridge. Fields include: Sub VendorId, Subsystem ID, and Legacy Mode Base\r
+ // Address.\r
+ //\r
+ CardBusData = (PCI_CARDBUS_DATA *) ((UINT8 *) CardBus + sizeof (PCI_CARDBUS_HEADER));\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SUB_VENDOR_ID_2),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBusData->SubVendorId)),\r
+ CardBusData->SubVendorId,\r
+ INDEX_OF (&(CardBusData->SubSystemId)),\r
+ CardBusData->SubSystemId\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_OPTIONAL),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (&(CardBusData->LegacyBase)),\r
+ CardBusData->LegacyBase\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainStatus (\r
+ IN UINT16 *Status,\r
+ IN BOOLEAN MainStatus,\r
+ IN PCI_HEADER_TYPE HeaderType\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain each meaningful bit of register Status. The definition of Status is\r
+ slightly different depending on the PCI header type.\r
+\r
+Arguments:\r
+\r
+ Status Points to the content of register Status\r
+ MainStatus Indicates if this register is main status(not secondary\r
+ status)\r
+ HeaderType Header type of this PCI device\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ if (MainStatus) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SECONDARY_STATUS), gShellDebug1HiiHandle, INDEX_OF (Status), *Status);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_NEW_CAPABILITIES), gShellDebug1HiiHandle, (*Status & PCI_BIT_4) != 0);\r
+\r
+ //\r
+ // Bit 5 is meaningless for CardBus Bridge\r
+ //\r
+ if (HeaderType == PciCardBusBridge) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE), gShellDebug1HiiHandle, (*Status & PCI_BIT_5) != 0);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_66_CAPABLE_2), gShellDebug1HiiHandle, (*Status & PCI_BIT_5) != 0);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST_BACK), gShellDebug1HiiHandle, (*Status & PCI_BIT_7) != 0);\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MASTER_DATA), gShellDebug1HiiHandle, (*Status & PCI_BIT_8) != 0);\r
+ //\r
+ // Bit 9 and bit 10 together decides the DEVSEL timing\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_DEVSEL_TIMING), gShellDebug1HiiHandle);\r
+ if ((*Status & PCI_BIT_9) == 0 && (*Status & PCI_BIT_10) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_FAST), gShellDebug1HiiHandle);\r
+\r
+ } else if ((*Status & PCI_BIT_9) != 0 && (*Status & PCI_BIT_10) == 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_MEDIUM), gShellDebug1HiiHandle);\r
+\r
+ } else if ((*Status & PCI_BIT_9) == 0 && (*Status & PCI_BIT_10) != 0) {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_SLOW), gShellDebug1HiiHandle);\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_RESERVED_2), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SIGNALED_TARGET),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_11) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_RECEIVED_TARGET),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_12) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_RECEIVED_MASTER),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_13) != 0\r
+ );\r
+\r
+ if (MainStatus) {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SIGNALED_ERROR),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_14) != 0\r
+ );\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_RECEIVED_ERROR),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_14) != 0\r
+ );\r
+ }\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_DETECTED_ERROR),\r
+ gShellDebug1HiiHandle,\r
+ (*Status & PCI_BIT_15) != 0\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainCommand (\r
+ IN UINT16 *Command\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain each meaningful bit of register Command.\r
+\r
+Arguments:\r
+\r
+ Command Points to the content of register Command\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ //\r
+ // Print the binary value of register Command\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,STRING_TOKEN (STR_PCI2_COMMAND), gShellDebug1HiiHandle, INDEX_OF (Command), *Command);\r
+\r
+ //\r
+ // Explain register Command bit by bit\r
+ //\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SPACE_ACCESS_DENIED),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_0) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MEMORY_SPACE),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_1) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_BEHAVE_BUS_MASTER),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_2) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MONITOR_SPECIAL_CYCLE),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_3) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MEM_WRITE_INVALIDATE),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_4) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_PALETTE_SNOOPING),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_5) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_ASSERT_PERR),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_6) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_DO_ADDR_STEPPING),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_7) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SERR_DRIVER),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_8) != 0\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_FAST_BACK_2),\r
+ gShellDebug1HiiHandle,\r
+ (*Command & PCI_BIT_9) != 0\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainBridgeControl (\r
+ IN UINT16 *BridgeControl,\r
+ IN PCI_HEADER_TYPE HeaderType\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+\r
+ Explain each meaningful bit of register Bridge Control.\r
+\r
+Arguments:\r
+\r
+ BridgeControl Points to the content of register Bridge Control\r
+ HeaderType The headertype\r
+\r
+Returns:\r
+\r
+ EFI_SUCCESS The command completed successfully\r
+\r
+**/\r
+{\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_BRIDGE_CONTROL),\r
+ gShellDebug1HiiHandle,\r
+ INDEX_OF (BridgeControl),\r
+ *BridgeControl\r
+ );\r
+\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_PARITY_ERROR),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_0) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SERR_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_1) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_ISA_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_2) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_VGA_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_3) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_MASTER_ABORT),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_5) != 0\r
+ );\r
+\r
+ //\r
+ // Register Bridge Control has some slight differences between P2P bridge\r
+ // and Cardbus bridge from bit 6 to bit 11.\r
+ //\r
+ if (HeaderType == PciP2pBridge) {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SECONDARY_BUS_RESET),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_6) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_FAST_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_7) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_PRIMARY_DISCARD_TIMER),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_8)!=0 ? L"2^10" : L"2^15"\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_SECONDARY_DISCARD_TIMER),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_9)!=0 ? L"2^10" : L"2^15"\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_DISCARD_TIMER_STATUS),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_10) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_DISCARD_TIMER_SERR),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_11) != 0\r
+ );\r
+\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_CARDBUS_RESET),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_6) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_IREQ_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_7) != 0\r
+ );\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ STRING_TOKEN (STR_PCI2_WRITE_POSTING_ENABLE),\r
+ gShellDebug1HiiHandle,\r
+ (*BridgeControl & PCI_BIT_10) != 0\r
+ );\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainCapabilityStruct (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN UINT64 Address,\r
+ IN UINT8 CapPtr\r
+ )\r
+{\r
+ UINT8 CapabilityPtr;\r
+ UINT16 CapabilityEntry;\r
+ UINT8 CapabilityID;\r
+ UINT64 RegAddress;\r
+\r
+ CapabilityPtr = CapPtr;\r
+\r
+ //\r
+ // Go through the Capability list\r
+ //\r
+ while ((CapabilityPtr >= 0x40) && ((CapabilityPtr & 0x03) == 0x00)) {\r
+ RegAddress = Address + CapabilityPtr;\r
+ IoDev->Pci.Read (IoDev, EfiPciWidthUint16, RegAddress, 1, &CapabilityEntry);\r
+\r
+ CapabilityID = (UINT8) CapabilityEntry;\r
+\r
+ //\r
+ // Explain PciExpress data\r
+ //\r
+ if (EFI_PCI_CAPABILITY_ID_PCIEXP == CapabilityID) {\r
+ PciExplainPciExpress (IoDev, Address, CapabilityPtr);\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Explain other capabilities here\r
+ //\r
+ CapabilityPtr = (UINT8) (CapabilityEntry >> 8);\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieCapReg (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieCapReg;\r
+ CHAR16 *DevicePortType;\r
+\r
+ PcieCapReg = PciExpressCap->PcieCapReg;\r
+ Print (\r
+ L" Capability Version(3:0): %E0x%04x%N\n",\r
+ PCIE_CAP_VERSION (PcieCapReg)\r
+ );\r
+ if ((UINT8) PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) < PCIE_DEVICE_PORT_TYPE_MAX) {\r
+ DevicePortType = DevicePortTypeTable[PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg)];\r
+ } else {\r
+ DevicePortType = L"Unknown Type";\r
+ }\r
+ Print (\r
+ L" Device/PortType(7:4): %E%s%N\n",\r
+ DevicePortType\r
+ );\r
+ //\r
+ // 'Slot Implemented' is only valid for:\r
+ // a) Root Port of PCI Express Root Complex, or\r
+ // b) Downstream Port of PCI Express Switch\r
+ //\r
+ if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_ROOT_COMPLEX_ROOT_PORT ||\r
+ PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_SWITCH_DOWNSTREAM_PORT) {\r
+ Print (\r
+ L" Slot Implemented(8): %E%d%N\n",\r
+ PCIE_CAP_SLOT_IMPLEMENTED (PcieCapReg)\r
+ );\r
+ }\r
+ Print (\r
+ L" Interrupt Message Number(13:9): %E0x%05x%N\n",\r
+ PCIE_CAP_INT_MSG_NUM (PcieCapReg)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieCapReg;\r
+ UINT32 PcieDeviceCap;\r
+ UINT8 DevicePortType;\r
+ UINT8 L0sLatency;\r
+ UINT8 L1Latency;\r
+\r
+ PcieCapReg = PciExpressCap->PcieCapReg;\r
+ PcieDeviceCap = PciExpressCap->PcieDeviceCap;\r
+ DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg);\r
+ Print (L" Max_Payload_Size Supported(2:0): ");\r
+ if (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap) < 6) {\r
+ Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_PAYLOAD (PcieDeviceCap) + 7));\r
+ } else {\r
+ Print (L"%EUnknown%N\n");\r
+ }\r
+ Print (\r
+ L" Phantom Functions Supported(4:3): %E%d%N\n",\r
+ PCIE_CAP_PHANTOM_FUNC (PcieDeviceCap)\r
+ );\r
+ Print (\r
+ L" Extended Tag Field Supported(5): %E%d-bit Tag field supported%N\n",\r
+ PCIE_CAP_EXTENDED_TAG (PcieDeviceCap) ? 8 : 5\r
+ );\r
+ //\r
+ // Endpoint L0s and L1 Acceptable Latency is only valid for Endpoint\r
+ //\r
+ if (IS_PCIE_ENDPOINT (DevicePortType)) {\r
+ L0sLatency = (UINT8) PCIE_CAP_L0sLatency (PcieDeviceCap);\r
+ L1Latency = (UINT8) PCIE_CAP_L1Latency (PcieDeviceCap);\r
+ Print (L" Endpoint L0s Acceptable Latency(8:6): ");\r
+ if (L0sLatency < 4) {\r
+ Print (L"%EMaximum of %d ns%N\n", 1 << (L0sLatency + 6));\r
+ } else {\r
+ if (L0sLatency < 7) {\r
+ Print (L"%EMaximum of %d us%N\n", 1 << (L0sLatency - 3));\r
+ } else {\r
+ Print (L"%ENo limit%N\n");\r
+ }\r
+ }\r
+ Print (L" Endpoint L1 Acceptable Latency(11:9): ");\r
+ if (L1Latency < 7) {\r
+ Print (L"%EMaximum of %d us%N\n", 1 << (L1Latency + 1));\r
+ } else {\r
+ Print (L"%ENo limit%N\n");\r
+ }\r
+ }\r
+ Print (\r
+ L" Role-based Error Reporting(15): %E%d%N\n",\r
+ PCIE_CAP_ERR_REPORTING (PcieDeviceCap)\r
+ );\r
+ //\r
+ // Only valid for Upstream Port:\r
+ // a) Captured Slot Power Limit Value\r
+ // b) Captured Slot Power Scale\r
+ //\r
+ if (DevicePortType == PCIE_SWITCH_UPSTREAM_PORT) {\r
+ Print (\r
+ L" Captured Slot Power Limit Value(25:18): %E0x%02x%N\n",\r
+ PCIE_CAP_SLOT_POWER_VALUE (PcieDeviceCap)\r
+ );\r
+ Print (\r
+ L" Captured Slot Power Limit Scale(27:26): %E%s%N\n",\r
+ SlotPwrLmtScaleTable[PCIE_CAP_SLOT_POWER_SCALE (PcieDeviceCap)]\r
+ );\r
+ }\r
+ //\r
+ // Function Level Reset Capability is only valid for Endpoint\r
+ //\r
+ if (IS_PCIE_ENDPOINT (DevicePortType)) {\r
+ Print (\r
+ L" Function Level Reset Capability(28): %E%d%N\n",\r
+ PCIE_CAP_FUNC_LEVEL_RESET (PcieDeviceCap)\r
+ );\r
+ }\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieCapReg;\r
+ UINT16 PcieDeviceControl;\r
+\r
+ PcieCapReg = PciExpressCap->PcieCapReg;\r
+ PcieDeviceControl = PciExpressCap->DeviceControl;\r
+ Print (\r
+ L" Correctable Error Reporting Enable(0): %E%d%N\n",\r
+ PCIE_CAP_COR_ERR_REPORTING_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Non-Fatal Error Reporting Enable(1): %E%d%N\n",\r
+ PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Fatal Error Reporting Enable(2): %E%d%N\n",\r
+ PCIE_CAP_FATAL_ERR_REPORTING_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Unsupported Request Reporting Enable(3): %E%d%N\n",\r
+ PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Enable Relaxed Ordering(4): %E%d%N\n",\r
+ PCIE_CAP_RELAXED_ORDERING_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (L" Max_Payload_Size(7:5): ");\r
+ if (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl) < 6) {\r
+ Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_PAYLOAD_SIZE (PcieDeviceControl) + 7));\r
+ } else {\r
+ Print (L"%EUnknown%N\n");\r
+ }\r
+ Print (\r
+ L" Extended Tag Field Enable(8): %E%d%N\n",\r
+ PCIE_CAP_EXTENDED_TAG_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Phantom Functions Enable(9): %E%d%N\n",\r
+ PCIE_CAP_PHANTOM_FUNC_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Auxiliary (AUX) Power PM Enable(10): %E%d%N\n",\r
+ PCIE_CAP_AUX_PM_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (\r
+ L" Enable No Snoop(11): %E%d%N\n",\r
+ PCIE_CAP_NO_SNOOP_ENABLE (PcieDeviceControl)\r
+ );\r
+ Print (L" Max_Read_Request_Size(14:12): ");\r
+ if (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl) < 6) {\r
+ Print (L"%E%d bytes%N\n", 1 << (PCIE_CAP_MAX_READ_REQ_SIZE (PcieDeviceControl) + 7));\r
+ } else {\r
+ Print (L"%EUnknown%N\n");\r
+ }\r
+ //\r
+ // Read operation is only valid for PCI Express to PCI/PCI-X Bridges\r
+ //\r
+ if (PCIE_CAP_DEVICEPORT_TYPE (PcieCapReg) == PCIE_PCIE_TO_PCIX_BRIDGE) {\r
+ Print (\r
+ L" Bridge Configuration Retry Enable(15): %E%d%N\n",\r
+ PCIE_CAP_BRG_CONF_RETRY (PcieDeviceControl)\r
+ );\r
+ }\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieDeviceStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieDeviceStatus;\r
+\r
+ PcieDeviceStatus = PciExpressCap->DeviceStatus;\r
+ Print (\r
+ L" Correctable Error Detected(0): %E%d%N\n",\r
+ PCIE_CAP_COR_ERR_DETECTED (PcieDeviceStatus)\r
+ );\r
+ Print (\r
+ L" Non-Fatal Error Detected(1): %E%d%N\n",\r
+ PCIE_CAP_NONFAT_ERR_DETECTED (PcieDeviceStatus)\r
+ );\r
+ Print (\r
+ L" Fatal Error Detected(2): %E%d%N\n",\r
+ PCIE_CAP_FATAL_ERR_DETECTED (PcieDeviceStatus)\r
+ );\r
+ Print (\r
+ L" Unsupported Request Detected(3): %E%d%N\n",\r
+ PCIE_CAP_UNSUP_REQ_DETECTED (PcieDeviceStatus)\r
+ );\r
+ Print (\r
+ L" AUX Power Detected(4): %E%d%N\n",\r
+ PCIE_CAP_AUX_POWER_DETECTED (PcieDeviceStatus)\r
+ );\r
+ Print (\r
+ L" Transactions Pending(5): %E%d%N\n",\r
+ PCIE_CAP_TRANSACTION_PENDING (PcieDeviceStatus)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT32 PcieLinkCap;\r
+ CHAR16 *SupLinkSpeeds;\r
+ CHAR16 *ASPM;\r
+\r
+ PcieLinkCap = PciExpressCap->LinkCap;\r
+ switch (PCIE_CAP_SUP_LINK_SPEEDS (PcieLinkCap)) {\r
+ case 1:\r
+ SupLinkSpeeds = L"2.5 GT/s";\r
+ break;\r
+ case 2:\r
+ SupLinkSpeeds = L"5.0 GT/s and 2.5 GT/s";\r
+ break;\r
+ default:\r
+ SupLinkSpeeds = L"Unknown";\r
+ break;\r
+ }\r
+ Print (\r
+ L" Supported Link Speeds(3:0): %E%s supported%N\n",\r
+ SupLinkSpeeds\r
+ );\r
+ Print (\r
+ L" Maximum Link Width(9:4): %Ex%d%N\n",\r
+ PCIE_CAP_MAX_LINK_WIDTH (PcieLinkCap)\r
+ );\r
+ switch (PCIE_CAP_ASPM_SUPPORT (PcieLinkCap)) {\r
+ case 1:\r
+ ASPM = L"L0s Entry";\r
+ break;\r
+ case 3:\r
+ ASPM = L"L0s and L1";\r
+ break;\r
+ default:\r
+ ASPM = L"Reserved";\r
+ break;\r
+ }\r
+ Print (\r
+ L" Active State Power Management Support(11:10): %E%s Supported%N\n",\r
+ ASPM\r
+ );\r
+ Print (\r
+ L" L0s Exit Latency(14:12): %E%s%N\n",\r
+ L0sLatencyStrTable[PCIE_CAP_L0s_LATENCY (PcieLinkCap)]\r
+ );\r
+ Print (\r
+ L" L1 Exit Latency(17:15): %E%s%N\n",\r
+ L1LatencyStrTable[PCIE_CAP_L0s_LATENCY (PcieLinkCap)]\r
+ );\r
+ Print (\r
+ L" Clock Power Management(18): %E%d%N\n",\r
+ PCIE_CAP_CLOCK_PM (PcieLinkCap)\r
+ );\r
+ Print (\r
+ L" Surprise Down Error Reporting Capable(19): %E%d%N\n",\r
+ PCIE_CAP_SUP_DOWN_ERR_REPORTING (PcieLinkCap)\r
+ );\r
+ Print (\r
+ L" Data Link Layer Link Active Reporting Capable(20): %E%d%N\n",\r
+ PCIE_CAP_LINK_ACTIVE_REPORTING (PcieLinkCap)\r
+ );\r
+ Print (\r
+ L" Link Bandwidth Notification Capability(21): %E%d%N\n",\r
+ PCIE_CAP_LINK_BWD_NOTIF_CAP (PcieLinkCap)\r
+ );\r
+ Print (\r
+ L" Port Number(31:24): %E0x%02x%N\n",\r
+ PCIE_CAP_PORT_NUMBER (PcieLinkCap)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieLinkControl;\r
+ UINT8 DevicePortType;\r
+\r
+ PcieLinkControl = PciExpressCap->LinkControl;\r
+ DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap->PcieCapReg);\r
+ Print (\r
+ L" Active State Power Management Control(1:0): %E%s%N\n",\r
+ ASPMCtrlStrTable[PCIE_CAP_ASPM_CONTROL (PcieLinkControl)]\r
+ );\r
+ //\r
+ // RCB is not applicable to switches\r
+ //\r
+ if (!IS_PCIE_SWITCH(DevicePortType)) {\r
+ Print (\r
+ L" Read Completion Boundary (RCB)(3): %E%d byte%N\n",\r
+ 1 << (PCIE_CAP_RCB (PcieLinkControl) + 6)\r
+ );\r
+ }\r
+ //\r
+ // Link Disable is reserved on\r
+ // a) Endpoints\r
+ // b) PCI Express to PCI/PCI-X bridges\r
+ // c) Upstream Ports of Switches\r
+ //\r
+ if (!IS_PCIE_ENDPOINT (DevicePortType) &&\r
+ DevicePortType != PCIE_SWITCH_UPSTREAM_PORT &&\r
+ DevicePortType != PCIE_PCIE_TO_PCIX_BRIDGE) {\r
+ Print (\r
+ L" Link Disable(4): %E%d%N\n",\r
+ PCIE_CAP_LINK_DISABLE (PcieLinkControl)\r
+ );\r
+ }\r
+ Print (\r
+ L" Common Clock Configuration(6): %E%d%N\n",\r
+ PCIE_CAP_COMMON_CLK_CONF (PcieLinkControl)\r
+ );\r
+ Print (\r
+ L" Extended Synch(7): %E%d%N\n",\r
+ PCIE_CAP_EXT_SYNC (PcieLinkControl)\r
+ );\r
+ Print (\r
+ L" Enable Clock Power Management(8): %E%d%N\n",\r
+ PCIE_CAP_CLK_PWR_MNG (PcieLinkControl)\r
+ );\r
+ Print (\r
+ L" Hardware Autonomous Width Disable(9): %E%d%N\n",\r
+ PCIE_CAP_HW_AUTO_WIDTH_DISABLE (PcieLinkControl)\r
+ );\r
+ Print (\r
+ L" Link Bandwidth Management Interrupt Enable(10): %E%d%N\n",\r
+ PCIE_CAP_LINK_BDW_MNG_INT_EN (PcieLinkControl)\r
+ );\r
+ Print (\r
+ L" Link Autonomous Bandwidth Interrupt Enable(11): %E%d%N\n",\r
+ PCIE_CAP_LINK_AUTO_BDW_INT_EN (PcieLinkControl)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieLinkStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieLinkStatus;\r
+ CHAR16 *SupLinkSpeeds;\r
+\r
+ PcieLinkStatus = PciExpressCap->LinkStatus;\r
+ switch (PCIE_CAP_CUR_LINK_SPEED (PcieLinkStatus)) {\r
+ case 1:\r
+ SupLinkSpeeds = L"2.5 GT/s";\r
+ break;\r
+ case 2:\r
+ SupLinkSpeeds = L"5.0 GT/s";\r
+ break;\r
+ default:\r
+ SupLinkSpeeds = L"Reserved";\r
+ break;\r
+ }\r
+ Print (\r
+ L" Current Link Speed(3:0): %E%s%N\n",\r
+ SupLinkSpeeds\r
+ );\r
+ Print (\r
+ L" Negotiated Link Width(9:4): %Ex%d%N\n",\r
+ PCIE_CAP_NEGO_LINK_WIDTH (PcieLinkStatus)\r
+ );\r
+ Print (\r
+ L" Link Training(11): %E%d%N\n",\r
+ PCIE_CAP_LINK_TRAINING (PcieLinkStatus)\r
+ );\r
+ Print (\r
+ L" Slot Clock Configuration(12): %E%d%N\n",\r
+ PCIE_CAP_SLOT_CLK_CONF (PcieLinkStatus)\r
+ );\r
+ Print (\r
+ L" Data Link Layer Link Active(13): %E%d%N\n",\r
+ PCIE_CAP_DATA_LINK_ACTIVE (PcieLinkStatus)\r
+ );\r
+ Print (\r
+ L" Link Bandwidth Management Status(14): %E%d%N\n",\r
+ PCIE_CAP_LINK_BDW_MNG_STAT (PcieLinkStatus)\r
+ );\r
+ Print (\r
+ L" Link Autonomous Bandwidth Status(15): %E%d%N\n",\r
+ PCIE_CAP_LINK_AUTO_BDW_STAT (PcieLinkStatus)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT32 PcieSlotCap;\r
+\r
+ PcieSlotCap = PciExpressCap->SlotCap;\r
+\r
+ Print (\r
+ L" Attention Button Present(0): %E%d%N\n",\r
+ PCIE_CAP_ATT_BUT_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Power Controller Present(1): %E%d%N\n",\r
+ PCIE_CAP_PWR_CTRLLER_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" MRL Sensor Present(2): %E%d%N\n",\r
+ PCIE_CAP_MRL_SENSOR_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Attention Indicator Present(3): %E%d%N\n",\r
+ PCIE_CAP_ATT_IND_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Power Indicator Present(4): %E%d%N\n",\r
+ PCIE_CAP_PWD_IND_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Hot-Plug Surprise(5): %E%d%N\n",\r
+ PCIE_CAP_HOTPLUG_SUPPRISE (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Hot-Plug Capable(6): %E%d%N\n",\r
+ PCIE_CAP_HOTPLUG_CAPABLE (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Slot Power Limit Value(14:7): %E0x%02x%N\n",\r
+ PCIE_CAP_SLOT_PWR_LIMIT_VALUE (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Slot Power Limit Scale(16:15): %E%s%N\n",\r
+ SlotPwrLmtScaleTable[PCIE_CAP_SLOT_PWR_LIMIT_SCALE (PcieSlotCap)]\r
+ );\r
+ Print (\r
+ L" Electromechanical Interlock Present(17): %E%d%N\n",\r
+ PCIE_CAP_ELEC_INTERLOCK_PRESENT (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" No Command Completed Support(18): %E%d%N\n",\r
+ PCIE_CAP_NO_COMM_COMPLETED_SUP (PcieSlotCap)\r
+ );\r
+ Print (\r
+ L" Physical Slot Number(31:19): %E%d%N\n",\r
+ PCIE_CAP_PHY_SLOT_NUM (PcieSlotCap)\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieSlotControl;\r
+\r
+ PcieSlotControl = PciExpressCap->SlotControl;\r
+ Print (\r
+ L" Attention Button Pressed Enable(0): %E%d%N\n",\r
+ PCIE_CAP_ATT_BUT_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Power Fault Detected Enable(1): %E%d%N\n",\r
+ PCIE_CAP_PWR_FLT_DETECT_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" MRL Sensor Changed Enable(2): %E%d%N\n",\r
+ PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Presence Detect Changed Enable(3): %E%d%N\n",\r
+ PCIE_CAP_PRES_DETECT_CHANGE_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Command Completed Interrupt Enable(4): %E%d%N\n",\r
+ PCIE_CAP_COMM_CMPL_INT_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Hot-Plug Interrupt Enable(5): %E%d%N\n",\r
+ PCIE_CAP_HOTPLUG_INT_ENABLE (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Attention Indicator Control(7:6): %E%s%N\n",\r
+ IndicatorTable[PCIE_CAP_ATT_IND_CTRL (PcieSlotControl)]\r
+ );\r
+ Print (\r
+ L" Power Indicator Control(9:8): %E%s%N\n",\r
+ IndicatorTable[PCIE_CAP_PWR_IND_CTRL (PcieSlotControl)]\r
+ );\r
+ Print (L" Power Controller Control(10): %EPower ");\r
+ if (PCIE_CAP_PWR_CTRLLER_CTRL (PcieSlotControl)) {\r
+ Print (L"Off%N\n");\r
+ } else {\r
+ Print (L"On%N\n");\r
+ }\r
+ Print (\r
+ L" Electromechanical Interlock Control(11): %E%d%N\n",\r
+ PCIE_CAP_ELEC_INTERLOCK_CTRL (PcieSlotControl)\r
+ );\r
+ Print (\r
+ L" Data Link Layer State Changed Enable(12): %E%d%N\n",\r
+ PCIE_CAP_DLINK_STAT_CHANGE_ENABLE (PcieSlotControl)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieSlotStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieSlotStatus;\r
+\r
+ PcieSlotStatus = PciExpressCap->SlotStatus;\r
+\r
+ Print (\r
+ L" Attention Button Pressed(0): %E%d%N\n",\r
+ PCIE_CAP_ATT_BUT_PRESSED (PcieSlotStatus)\r
+ );\r
+ Print (\r
+ L" Power Fault Detected(1): %E%d%N\n",\r
+ PCIE_CAP_PWR_FLT_DETECTED (PcieSlotStatus)\r
+ );\r
+ Print (\r
+ L" MRL Sensor Changed(2): %E%d%N\n",\r
+ PCIE_CAP_MRL_SENSOR_CHANGED (PcieSlotStatus)\r
+ );\r
+ Print (\r
+ L" Presence Detect Changed(3): %E%d%N\n",\r
+ PCIE_CAP_PRES_DETECT_CHANGED (PcieSlotStatus)\r
+ );\r
+ Print (\r
+ L" Command Completed(4): %E%d%N\n",\r
+ PCIE_CAP_COMM_COMPLETED (PcieSlotStatus)\r
+ );\r
+ Print (L" MRL Sensor State(5): %EMRL ");\r
+ if (PCIE_CAP_MRL_SENSOR_STATE (PcieSlotStatus)) {\r
+ Print (L" Opened%N\n");\r
+ } else {\r
+ Print (L" Closed%N\n");\r
+ }\r
+ Print (L" Presence Detect State(6): ");\r
+ if (PCIE_CAP_PRES_DETECT_STATE (PcieSlotStatus)) {\r
+ Print (L"%ECard Present in slot%N\n");\r
+ } else {\r
+ Print (L"%ESlot Empty%N\n");\r
+ }\r
+ Print (L" Electromechanical Interlock Status(7): %EElectromechanical Interlock ");\r
+ if (PCIE_CAP_ELEC_INTERLOCK_STATE (PcieSlotStatus)) {\r
+ Print (L"Engaged%N\n");\r
+ } else {\r
+ Print (L"Disengaged%N\n");\r
+ }\r
+ Print (\r
+ L" Data Link Layer State Changed(8): %E%d%N\n",\r
+ PCIE_CAP_DLINK_STAT_CHANGED (PcieSlotStatus)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieRootControl (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieRootControl;\r
+\r
+ PcieRootControl = PciExpressCap->RootControl;\r
+\r
+ Print (\r
+ L" System Error on Correctable Error Enable(0): %E%d%N\n",\r
+ PCIE_CAP_SYSERR_ON_CORERR_EN (PcieRootControl)\r
+ );\r
+ Print (\r
+ L" System Error on Non-Fatal Error Enable(1): %E%d%N\n",\r
+ PCIE_CAP_SYSERR_ON_NONFATERR_EN (PcieRootControl)\r
+ );\r
+ Print (\r
+ L" System Error on Fatal Error Enable(2): %E%d%N\n",\r
+ PCIE_CAP_SYSERR_ON_FATERR_EN (PcieRootControl)\r
+ );\r
+ Print (\r
+ L" PME Interrupt Enable(3): %E%d%N\n",\r
+ PCIE_CAP_PME_INT_ENABLE (PcieRootControl)\r
+ );\r
+ Print (\r
+ L" CRS Software Visibility Enable(4): %E%d%N\n",\r
+ PCIE_CAP_CRS_SW_VIS_ENABLE (PcieRootControl)\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieRootCap (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT16 PcieRootCap;\r
+\r
+ PcieRootCap = PciExpressCap->RsvdP;\r
+\r
+ Print (\r
+ L" CRS Software Visibility(0): %E%d%N\n",\r
+ PCIE_CAP_CRS_SW_VIS (PcieRootCap)\r
+ );\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+ExplainPcieRootStatus (\r
+ IN PCIE_CAP_STURCTURE *PciExpressCap\r
+)\r
+{\r
+ UINT32 PcieRootStatus;\r
+\r
+ PcieRootStatus = PciExpressCap->RootStatus;\r
+\r
+ Print (\r
+ L" PME Requester ID(15:0): %E0x%04x%N\n",\r
+ PCIE_CAP_PME_REQ_ID (PcieRootStatus)\r
+ );\r
+ Print (\r
+ L" PME Status(16): %E%d%N\n",\r
+ PCIE_CAP_PME_STATUS (PcieRootStatus)\r
+ );\r
+ Print (\r
+ L" PME Pending(17): %E%d%N\n",\r
+ PCIE_CAP_PME_PENDING (PcieRootStatus)\r
+ );\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+PciExplainPciExpress (\r
+ IN EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *IoDev,\r
+ IN UINT64 Address,\r
+ IN UINT8 CapabilityPtr\r
+ )\r
+{\r
+\r
+ PCIE_CAP_STURCTURE PciExpressCap;\r
+ EFI_STATUS Status;\r
+ UINT64 CapRegAddress;\r
+ UINT8 Bus;\r
+ UINT8 Dev;\r
+ UINT8 Func;\r
+ UINT8 *ExRegBuffer;\r
+ UINTN ExtendRegSize;\r
+ UINT64 Pciex_Address;\r
+ UINT8 DevicePortType;\r
+ UINTN Index;\r
+ UINT8 *RegAddr;\r
+ UINTN RegValue;\r
+\r
+ CapRegAddress = Address + CapabilityPtr;\r
+ IoDev->Pci.Read (\r
+ IoDev,\r
+ EfiPciWidthUint32,\r
+ CapRegAddress,\r
+ sizeof (PciExpressCap) / sizeof (UINT32),\r
+ &PciExpressCap\r
+ );\r
+\r
+ DevicePortType = (UINT8) PCIE_CAP_DEVICEPORT_TYPE (PciExpressCap.PcieCapReg);\r
+\r
+ Print (L"\nPci Express device capability structure:\n");\r
+\r
+ for (Index = 0; PcieExplainList[Index].Type < PcieExplainTypeMax; Index++) {\r
+ if (ShellGetExecutionBreakFlag()) {\r
+ goto Done;\r
+ }\r
+ RegAddr = ((UINT8 *) &PciExpressCap) + PcieExplainList[Index].Offset;\r
+ switch (PcieExplainList[Index].Width) {\r
+ case FieldWidthUINT8:\r
+ RegValue = *(UINT8 *) RegAddr;\r
+ break;\r
+ case FieldWidthUINT16:\r
+ RegValue = *(UINT16 *) RegAddr;\r
+ break;\r
+ case FieldWidthUINT32:\r
+ RegValue = *(UINT32 *) RegAddr;\r
+ break;\r
+ default:\r
+ RegValue = 0;\r
+ break;\r
+ }\r
+ ShellPrintHiiEx(-1, -1, NULL,\r
+ PcieExplainList[Index].Token,\r
+ gShellDebug1HiiHandle,\r
+ PcieExplainList[Index].Offset,\r
+ RegValue\r
+ );\r
+ if (PcieExplainList[Index].Func == NULL) {\r
+ continue;\r
+ }\r
+ switch (PcieExplainList[Index].Type) {\r
+ case PcieExplainTypeLink:\r
+ //\r
+ // Link registers should not be used by\r
+ // a) Root Complex Integrated Endpoint\r
+ // b) Root Complex Event Collector\r
+ //\r
+ if (DevicePortType == PCIE_ROOT_COMPLEX_INTEGRATED_PORT ||\r
+ DevicePortType == PCIE_ROOT_COMPLEX_EVENT_COLLECTOR) {\r
+ continue;\r
+ }\r
+ break;\r
+ case PcieExplainTypeSlot:\r
+ //\r
+ // Slot registers are only valid for\r
+ // a) Root Port of PCI Express Root Complex\r
+ // b) Downstream Port of PCI Express Switch\r
+ // and when SlotImplemented bit is set in PCIE cap register.\r
+ //\r
+ if ((DevicePortType != PCIE_ROOT_COMPLEX_ROOT_PORT &&\r
+ DevicePortType != PCIE_SWITCH_DOWNSTREAM_PORT) ||\r
+ !PCIE_CAP_SLOT_IMPLEMENTED (PciExpressCap.PcieCapReg)) {\r
+ continue;\r
+ }\r
+ break;\r
+ case PcieExplainTypeRoot:\r
+ //\r
+ // Root registers are only valid for\r
+ // Root Port of PCI Express Root Complex\r
+ //\r
+ if (DevicePortType != PCIE_ROOT_COMPLEX_ROOT_PORT) {\r
+ continue;\r
+ }\r
+ break;\r
+ default:\r
+ break;\r
+ }\r
+ PcieExplainList[Index].Func (&PciExpressCap);\r
+ }\r
+\r
+ Bus = (UINT8) (RShiftU64 (Address, 24));\r
+ Dev = (UINT8) (RShiftU64 (Address, 16));\r
+ Func = (UINT8) (RShiftU64 (Address, 8));\r
+\r
+ Pciex_Address = CALC_EFI_PCIEX_ADDRESS (Bus, Dev, Func, 0x100);\r
+\r
+ ExtendRegSize = 0x1000 - 0x100;\r
+\r
+ ExRegBuffer = (UINT8 *) AllocatePool (ExtendRegSize);\r
+\r
+ //\r
+ // PciRootBridgeIo protocol should support pci express extend space IO\r
+ // (Begins at offset 0x100)\r
+ //\r
+ Status = IoDev->Pci.Read (\r
+ IoDev,\r
+ EfiPciWidthUint32,\r
+ Pciex_Address,\r
+ (ExtendRegSize) / sizeof (UINT32),\r
+ (VOID *) (ExRegBuffer)\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ FreePool ((VOID *) ExRegBuffer);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Start outputing PciEx extend space( 0xFF-0xFFF)\r
+ //\r
+ Print (L"\n%HStart dumping PCIex extended configuration space (0x100 - 0xFFF).%N\n\n");\r
+\r
+ PrivateDumpHex (\r
+ 2,\r
+ 0x100,\r
+ ExtendRegSize,\r
+ (VOID *) (ExRegBuffer)\r
+ );\r
+\r
+ FreePool ((VOID *) ExRegBuffer);\r
+\r
+Done:\r
+ return EFI_SUCCESS;\r
+}\r
--- /dev/null
+/** @file\r
+ Header file for Pci shell Debug1 function.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _EFI_SHELL_PCI_H_\r
+#define _EFI_SHELL_PCI_H_\r
+\r
+typedef enum {\r
+ PciDevice,\r
+ PciP2pBridge,\r
+ PciCardBusBridge,\r
+ PciUndefined\r
+} PCI_HEADER_TYPE;\r
+\r
+#define HEADER_TYPE_MULTI_FUNCTION 0x80\r
+\r
+#define MAX_BUS_NUMBER 255\r
+#define MAX_DEVICE_NUMBER 31\r
+#define MAX_FUNCTION_NUMBER 7\r
+\r
+#define EFI_PCI_CAPABILITY_ID_PCIEXP 0x10\r
+#define EFI_PCI_CAPABILITY_ID_PCIX 0x07\r
+\r
+#define CALC_EFI_PCI_ADDRESS(Bus, Dev, Func, Reg) \\r
+ ((UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + ((UINTN) Reg)))\r
+\r
+#define CALC_EFI_PCIEX_ADDRESS(Bus, Dev, Func, ExReg) ( \\r
+ (UINT64) ((((UINTN) Bus) << 24) + (((UINTN) Dev) << 16) + (((UINTN) Func) << 8) + (LShiftU64 ((UINT64) ExReg, 32))) \\r
+ );\r
+\r
+#define INDEX_OF(Field) ((UINT8 *) (Field) - (UINT8 *) mConfigSpace)\r
+\r
+#define PCI_BIT_0 0x00000001\r
+#define PCI_BIT_1 0x00000002\r
+#define PCI_BIT_2 0x00000004\r
+#define PCI_BIT_3 0x00000008\r
+#define PCI_BIT_4 0x00000010\r
+#define PCI_BIT_5 0x00000020\r
+#define PCI_BIT_6 0x00000040\r
+#define PCI_BIT_7 0x00000080\r
+#define PCI_BIT_8 0x00000100\r
+#define PCI_BIT_9 0x00000200\r
+#define PCI_BIT_10 0x00000400\r
+#define PCI_BIT_11 0x00000800\r
+#define PCI_BIT_12 0x00001000\r
+#define PCI_BIT_13 0x00002000\r
+#define PCI_BIT_14 0x00004000\r
+#define PCI_BIT_15 0x00008000\r
+\r
+//\r
+// PCIE device/port types\r
+//\r
+#define PCIE_PCIE_ENDPOINT 0\r
+#define PCIE_LEGACY_PCIE_ENDPOINT 1\r
+#define PCIE_ROOT_COMPLEX_ROOT_PORT 4\r
+#define PCIE_SWITCH_UPSTREAM_PORT 5\r
+#define PCIE_SWITCH_DOWNSTREAM_PORT 6\r
+#define PCIE_PCIE_TO_PCIX_BRIDGE 7\r
+#define PCIE_PCIX_TO_PCIE_BRIDGE 8\r
+#define PCIE_ROOT_COMPLEX_INTEGRATED_PORT 9\r
+#define PCIE_ROOT_COMPLEX_EVENT_COLLECTOR 10\r
+#define PCIE_DEVICE_PORT_TYPE_MAX 11\r
+\r
+#define IS_PCIE_ENDPOINT(DevicePortType) \\r
+ ((DevicePortType) == PCIE_PCIE_ENDPOINT || \\r
+ (DevicePortType) == PCIE_LEGACY_PCIE_ENDPOINT || \\r
+ (DevicePortType) == PCIE_ROOT_COMPLEX_INTEGRATED_PORT)\r
+\r
+#define IS_PCIE_SWITCH(DevicePortType) \\r
+ ((DevicePortType == PCIE_SWITCH_UPSTREAM_PORT) || \\r
+ (DevicePortType == PCIE_SWITCH_DOWNSTREAM_PORT))\r
+\r
+//\r
+// Capabilities Register\r
+//\r
+#define PCIE_CAP_VERSION(PcieCapReg) \\r
+ ((PcieCapReg) & 0x0f)\r
+#define PCIE_CAP_DEVICEPORT_TYPE(PcieCapReg) \\r
+ (((PcieCapReg) >> 4) & 0x0f)\r
+#define PCIE_CAP_SLOT_IMPLEMENTED(PcieCapReg) \\r
+ (((PcieCapReg) >> 8) & 0x1)\r
+#define PCIE_CAP_INT_MSG_NUM(PcieCapReg) \\r
+ (((PcieCapReg) >> 9) & 0x1f)\r
+//\r
+// Device Capabilities Register\r
+//\r
+#define PCIE_CAP_MAX_PAYLOAD(PcieDeviceCap) \\r
+ ((PcieDeviceCap) & 0x7)\r
+#define PCIE_CAP_PHANTOM_FUNC(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 3) & 0x3)\r
+#define PCIE_CAP_EXTENDED_TAG(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 5) & 0x1)\r
+#define PCIE_CAP_L0sLatency(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 6) & 0x7)\r
+#define PCIE_CAP_L1Latency(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 9) & 0x7)\r
+#define PCIE_CAP_ERR_REPORTING(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 15) & 0x1)\r
+#define PCIE_CAP_SLOT_POWER_VALUE(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 18) & 0x0ff)\r
+#define PCIE_CAP_SLOT_POWER_SCALE(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 26) & 0x3)\r
+#define PCIE_CAP_FUNC_LEVEL_RESET(PcieDeviceCap) \\r
+ (((PcieDeviceCap) >> 28) & 0x1)\r
+//\r
+// Device Control Register\r
+//\r
+#define PCIE_CAP_COR_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
+ ((PcieDeviceControl) & 0x1)\r
+#define PCIE_CAP_NONFAT_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 1) & 0x1)\r
+#define PCIE_CAP_FATAL_ERR_REPORTING_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 2) & 0x1)\r
+#define PCIE_CAP_UNSUP_REQ_REPORTING_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 3) & 0x1)\r
+#define PCIE_CAP_RELAXED_ORDERING_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 4) & 0x1)\r
+#define PCIE_CAP_MAX_PAYLOAD_SIZE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 5) & 0x7)\r
+#define PCIE_CAP_EXTENDED_TAG_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 8) & 0x1)\r
+#define PCIE_CAP_PHANTOM_FUNC_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 9) & 0x1)\r
+#define PCIE_CAP_AUX_PM_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 10) & 0x1)\r
+#define PCIE_CAP_NO_SNOOP_ENABLE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 11) & 0x1)\r
+#define PCIE_CAP_MAX_READ_REQ_SIZE(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 12) & 0x7)\r
+#define PCIE_CAP_BRG_CONF_RETRY(PcieDeviceControl) \\r
+ (((PcieDeviceControl) >> 15) & 0x1)\r
+//\r
+// Device Status Register\r
+//\r
+#define PCIE_CAP_COR_ERR_DETECTED(PcieDeviceStatus) \\r
+ ((PcieDeviceStatus) & 0x1)\r
+#define PCIE_CAP_NONFAT_ERR_DETECTED(PcieDeviceStatus) \\r
+ (((PcieDeviceStatus) >> 1) & 0x1)\r
+#define PCIE_CAP_FATAL_ERR_DETECTED(PcieDeviceStatus) \\r
+ (((PcieDeviceStatus) >> 2) & 0x1)\r
+#define PCIE_CAP_UNSUP_REQ_DETECTED(PcieDeviceStatus) \\r
+ (((PcieDeviceStatus) >> 3) & 0x1)\r
+#define PCIE_CAP_AUX_POWER_DETECTED(PcieDeviceStatus) \\r
+ (((PcieDeviceStatus) >> 4) & 0x1)\r
+#define PCIE_CAP_TRANSACTION_PENDING(PcieDeviceStatus) \\r
+ (((PcieDeviceStatus) >> 5) & 0x1)\r
+//\r
+// Link Capabilities Register\r
+//\r
+#define PCIE_CAP_SUP_LINK_SPEEDS(PcieLinkCap) \\r
+ ((PcieLinkCap) & 0x0f)\r
+#define PCIE_CAP_MAX_LINK_WIDTH(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 4) & 0x3f)\r
+#define PCIE_CAP_ASPM_SUPPORT(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 10) & 0x3)\r
+#define PCIE_CAP_L0s_LATENCY(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 12) & 0x7)\r
+#define PCIE_CAP_L1_LATENCY(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 15) & 0x7)\r
+#define PCIE_CAP_CLOCK_PM(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 18) & 0x1)\r
+#define PCIE_CAP_SUP_DOWN_ERR_REPORTING(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 19) & 0x1)\r
+#define PCIE_CAP_LINK_ACTIVE_REPORTING(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 20) & 0x1)\r
+#define PCIE_CAP_LINK_BWD_NOTIF_CAP(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 21) & 0x1)\r
+#define PCIE_CAP_PORT_NUMBER(PcieLinkCap) \\r
+ (((PcieLinkCap) >> 24) & 0x0ff)\r
+//\r
+// Link Control Register\r
+//\r
+#define PCIE_CAP_ASPM_CONTROL(PcieLinkControl) \\r
+ ((PcieLinkControl) & 0x3)\r
+#define PCIE_CAP_RCB(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 3) & 0x1)\r
+#define PCIE_CAP_LINK_DISABLE(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 4) & 0x1)\r
+#define PCIE_CAP_COMMON_CLK_CONF(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 6) & 0x1)\r
+#define PCIE_CAP_EXT_SYNC(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 7) & 0x1)\r
+#define PCIE_CAP_CLK_PWR_MNG(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 8) & 0x1)\r
+#define PCIE_CAP_HW_AUTO_WIDTH_DISABLE(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 9) & 0x1)\r
+#define PCIE_CAP_LINK_BDW_MNG_INT_EN(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 10) & 0x1)\r
+#define PCIE_CAP_LINK_AUTO_BDW_INT_EN(PcieLinkControl) \\r
+ (((PcieLinkControl) >> 11) & 0x1)\r
+//\r
+// Link Status Register\r
+//\r
+#define PCIE_CAP_CUR_LINK_SPEED(PcieLinkStatus) \\r
+ ((PcieLinkStatus) & 0x0f)\r
+#define PCIE_CAP_NEGO_LINK_WIDTH(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 4) & 0x3f)\r
+#define PCIE_CAP_LINK_TRAINING(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 11) & 0x1)\r
+#define PCIE_CAP_SLOT_CLK_CONF(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 12) & 0x1)\r
+#define PCIE_CAP_DATA_LINK_ACTIVE(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 13) & 0x1)\r
+#define PCIE_CAP_LINK_BDW_MNG_STAT(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 14) & 0x1)\r
+#define PCIE_CAP_LINK_AUTO_BDW_STAT(PcieLinkStatus) \\r
+ (((PcieLinkStatus) >> 15) & 0x1)\r
+//\r
+// Slot Capabilities Register\r
+//\r
+#define PCIE_CAP_ATT_BUT_PRESENT(PcieSlotCap) \\r
+ ((PcieSlotCap) & 0x1)\r
+#define PCIE_CAP_PWR_CTRLLER_PRESENT(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 1) & 0x1)\r
+#define PCIE_CAP_MRL_SENSOR_PRESENT(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 2) & 0x1)\r
+#define PCIE_CAP_ATT_IND_PRESENT(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 3) & 0x1)\r
+#define PCIE_CAP_PWD_IND_PRESENT(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 4) & 0x1)\r
+#define PCIE_CAP_HOTPLUG_SUPPRISE(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 5) & 0x1)\r
+#define PCIE_CAP_HOTPLUG_CAPABLE(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 6) & 0x1)\r
+#define PCIE_CAP_SLOT_PWR_LIMIT_VALUE(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 7) & 0x0ff)\r
+#define PCIE_CAP_SLOT_PWR_LIMIT_SCALE(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 15) & 0x3)\r
+#define PCIE_CAP_ELEC_INTERLOCK_PRESENT(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 17) & 0x1)\r
+#define PCIE_CAP_NO_COMM_COMPLETED_SUP(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 18) & 0x1)\r
+#define PCIE_CAP_PHY_SLOT_NUM(PcieSlotCap) \\r
+ (((PcieSlotCap) >> 19) & 0x1fff)\r
+//\r
+// Slot Control Register\r
+//\r
+#define PCIE_CAP_ATT_BUT_ENABLE(PcieSlotControl) \\r
+ ((PcieSlotControl) & 0x1)\r
+#define PCIE_CAP_PWR_FLT_DETECT_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 1) & 0x1)\r
+#define PCIE_CAP_MRL_SENSOR_CHANGE_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 2) & 0x1)\r
+#define PCIE_CAP_PRES_DETECT_CHANGE_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 3) & 0x1)\r
+#define PCIE_CAP_COMM_CMPL_INT_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 4) & 0x1)\r
+#define PCIE_CAP_HOTPLUG_INT_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 5) & 0x1)\r
+#define PCIE_CAP_ATT_IND_CTRL(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 6) & 0x3)\r
+#define PCIE_CAP_PWR_IND_CTRL(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 8) & 0x3)\r
+#define PCIE_CAP_PWR_CTRLLER_CTRL(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 10) & 0x1)\r
+#define PCIE_CAP_ELEC_INTERLOCK_CTRL(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 11) & 0x1)\r
+#define PCIE_CAP_DLINK_STAT_CHANGE_ENABLE(PcieSlotControl) \\r
+ (((PcieSlotControl) >> 12) & 0x1)\r
+//\r
+// Slot Status Register\r
+//\r
+#define PCIE_CAP_ATT_BUT_PRESSED(PcieSlotStatus) \\r
+ ((PcieSlotStatus) & 0x1)\r
+#define PCIE_CAP_PWR_FLT_DETECTED(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 1) & 0x1)\r
+#define PCIE_CAP_MRL_SENSOR_CHANGED(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 2) & 0x1)\r
+#define PCIE_CAP_PRES_DETECT_CHANGED(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 3) & 0x1)\r
+#define PCIE_CAP_COMM_COMPLETED(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 4) & 0x1)\r
+#define PCIE_CAP_MRL_SENSOR_STATE(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 5) & 0x1)\r
+#define PCIE_CAP_PRES_DETECT_STATE(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 6) & 0x1)\r
+#define PCIE_CAP_ELEC_INTERLOCK_STATE(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 7) & 0x1)\r
+#define PCIE_CAP_DLINK_STAT_CHANGED(PcieSlotStatus) \\r
+ (((PcieSlotStatus) >> 8) & 0x1)\r
+//\r
+// Root Control Register\r
+//\r
+#define PCIE_CAP_SYSERR_ON_CORERR_EN(PcieRootControl) \\r
+ ((PcieRootControl) & 0x1)\r
+#define PCIE_CAP_SYSERR_ON_NONFATERR_EN(PcieRootControl) \\r
+ (((PcieRootControl) >> 1) & 0x1)\r
+#define PCIE_CAP_SYSERR_ON_FATERR_EN(PcieRootControl) \\r
+ (((PcieRootControl) >> 2) & 0x1)\r
+#define PCIE_CAP_PME_INT_ENABLE(PcieRootControl) \\r
+ (((PcieRootControl) >> 3) & 0x1)\r
+#define PCIE_CAP_CRS_SW_VIS_ENABLE(PcieRootControl) \\r
+ (((PcieRootControl) >> 4) & 0x1)\r
+//\r
+// Root Capabilities Register\r
+//\r
+#define PCIE_CAP_CRS_SW_VIS(PcieRootCap) \\r
+ ((PcieRootCap) & 0x1)\r
+//\r
+// Root Status Register\r
+//\r
+#define PCIE_CAP_PME_REQ_ID(PcieRootStatus) \\r
+ ((PcieRootStatus) & 0x0ffff)\r
+#define PCIE_CAP_PME_STATUS(PcieRootStatus) \\r
+ (((PcieRootStatus) >> 16) & 0x1)\r
+#define PCIE_CAP_PME_PENDING(PcieRootStatus) \\r
+ (((PcieRootStatus) >> 17) & 0x1)\r
+\r
+#pragma pack(1)\r
+//\r
+// Common part of the PCI configuration space header for devices, P2P bridges,\r
+// and cardbus bridges\r
+//\r
+typedef struct {\r
+ UINT16 VendorId;\r
+ UINT16 DeviceId;\r
+\r
+ UINT16 Command;\r
+ UINT16 Status;\r
+\r
+ UINT8 RevisionId;\r
+ UINT8 ClassCode[3];\r
+\r
+ UINT8 CacheLineSize;\r
+ UINT8 PrimaryLatencyTimer;\r
+ UINT8 HeaderType;\r
+ UINT8 BIST;\r
+\r
+} PCI_COMMON_HEADER;\r
+\r
+//\r
+// PCI configuration space header for devices(after the common part)\r
+//\r
+typedef struct {\r
+ UINT32 Bar[6]; // Base Address Registers\r
+ UINT32 CardBusCISPtr; // CardBus CIS Pointer\r
+ UINT16 SubVendorId; // Subsystem Vendor ID\r
+ UINT16 SubSystemId; // Subsystem ID\r
+ UINT32 ROMBar; // Expansion ROM Base Address\r
+ UINT8 CapabilitiesPtr; // Capabilities Pointer\r
+ UINT8 Reserved[3];\r
+\r
+ UINT32 Reserved1;\r
+\r
+ UINT8 InterruptLine; // Interrupt Line\r
+ UINT8 InterruptPin; // Interrupt Pin\r
+ UINT8 MinGnt; // Min_Gnt\r
+ UINT8 MaxLat; // Max_Lat\r
+} PCI_DEVICE_HEADER;\r
+\r
+//\r
+// PCI configuration space header for pci-to-pci bridges(after the common part)\r
+//\r
+typedef struct {\r
+ UINT32 Bar[2]; // Base Address Registers\r
+ UINT8 PrimaryBus; // Primary Bus Number\r
+ UINT8 SecondaryBus; // Secondary Bus Number\r
+ UINT8 SubordinateBus; // Subordinate Bus Number\r
+ UINT8 SecondaryLatencyTimer; // Secondary Latency Timer\r
+ UINT8 IoBase; // I/O Base\r
+ UINT8 IoLimit; // I/O Limit\r
+ UINT16 SecondaryStatus; // Secondary Status\r
+ UINT16 MemoryBase; // Memory Base\r
+ UINT16 MemoryLimit; // Memory Limit\r
+ UINT16 PrefetchableMemBase; // Pre-fetchable Memory Base\r
+ UINT16 PrefetchableMemLimit; // Pre-fetchable Memory Limit\r
+ UINT32 PrefetchableBaseUpper; // Pre-fetchable Base Upper 32 bits\r
+ UINT32 PrefetchableLimitUpper; // Pre-fetchable Limit Upper 32 bits\r
+ UINT16 IoBaseUpper; // I/O Base Upper 16 bits\r
+ UINT16 IoLimitUpper; // I/O Limit Upper 16 bits\r
+ UINT8 CapabilitiesPtr; // Capabilities Pointer\r
+ UINT8 Reserved[3];\r
+\r
+ UINT32 ROMBar; // Expansion ROM Base Address\r
+ UINT8 InterruptLine; // Interrupt Line\r
+ UINT8 InterruptPin; // Interrupt Pin\r
+ UINT16 BridgeControl; // Bridge Control\r
+} PCI_BRIDGE_HEADER;\r
+\r
+//\r
+// PCI configuration space header for cardbus bridges(after the common part)\r
+//\r
+typedef struct {\r
+ UINT32 CardBusSocketReg; // Cardus Socket/ExCA Base\r
+ // Address Register\r
+ //\r
+ UINT8 CapabilitiesPtr; // 14h in pci-cardbus bridge.\r
+ UINT8 Reserved;\r
+ UINT16 SecondaryStatus; // Secondary Status\r
+ UINT8 PciBusNumber; // PCI Bus Number\r
+ UINT8 CardBusBusNumber; // CardBus Bus Number\r
+ UINT8 SubordinateBusNumber; // Subordinate Bus Number\r
+ UINT8 CardBusLatencyTimer; // CardBus Latency Timer\r
+ UINT32 MemoryBase0; // Memory Base Register 0\r
+ UINT32 MemoryLimit0; // Memory Limit Register 0\r
+ UINT32 MemoryBase1;\r
+ UINT32 MemoryLimit1;\r
+ UINT32 IoBase0;\r
+ UINT32 IoLimit0; // I/O Base Register 0\r
+ UINT32 IoBase1; // I/O Limit Register 0\r
+ UINT32 IoLimit1;\r
+\r
+ UINT8 InterruptLine; // Interrupt Line\r
+ UINT8 InterruptPin; // Interrupt Pin\r
+ UINT16 BridgeControl; // Bridge Control\r
+} PCI_CARDBUS_HEADER;\r
+\r
+//\r
+// Data region after PCI configuration header(for cardbus bridge)\r
+//\r
+typedef struct {\r
+ UINT16 SubVendorId; // Subsystem Vendor ID\r
+ UINT16 SubSystemId; // Subsystem ID\r
+ UINT32 LegacyBase; // Optional 16-Bit PC Card Legacy\r
+ // Mode Base Address\r
+ //\r
+ UINT32 Data[46];\r
+} PCI_CARDBUS_DATA;\r
+\r
+typedef struct {\r
+ PCI_COMMON_HEADER Common;\r
+ union {\r
+ PCI_DEVICE_HEADER Device;\r
+ PCI_BRIDGE_HEADER Bridge;\r
+ PCI_CARDBUS_HEADER CardBus;\r
+ } NonCommon;\r
+ UINT32 Data[48];\r
+} PCI_CONFIG_SPACE;\r
+\r
+typedef struct {\r
+ UINT8 PcieCapId;\r
+ UINT8 NextCapPtr;\r
+ UINT16 PcieCapReg;\r
+ UINT32 PcieDeviceCap;\r
+ UINT16 DeviceControl;\r
+ UINT16 DeviceStatus;\r
+ UINT32 LinkCap;\r
+ UINT16 LinkControl;\r
+ UINT16 LinkStatus;\r
+ UINT32 SlotCap;\r
+ UINT16 SlotControl;\r
+ UINT16 SlotStatus;\r
+ UINT16 RsvdP;\r
+ UINT16 RootControl;\r
+ UINT32 RootStatus;\r
+} PCIE_CAP_STURCTURE;\r
+\r
+#pragma pack()\r
+\r
+#endif // _PCI_H_\r
--- /dev/null
+/** @file\r
+ Main file for SerMode shell Debug1 function.\r
+\r
+ Copyright (c) 20052010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+#include <Library/ShellLib.h>\r
+#include <Protocol/SerialIo.h>\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+iDisplaySettings (\r
+ IN UINTN HandleIdx,\r
+ IN BOOLEAN HandleValid\r
+ )\r
+{\r
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;\r
+ UINTN NoHandles;\r
+ EFI_HANDLE *Handles;\r
+ EFI_STATUS Status;\r
+ UINTN Index;\r
+ CHAR16 *StopBits;\r
+ CHAR16 Parity;\r
+ SHELL_STATUS ShellStatus;\r
+\r
+ Handles = NULL;\r
+ StopBits = NULL;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+\r
+ Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle);\r
+ return SHELL_INVALID_PARAMETER;\r
+ }\r
+\r
+ for (Index = 0; Index < NoHandles; Index++) {\r
+ if (HandleValid) {\r
+ if (ConvertHandleIndexToHandle(HandleIdx) != Handles[Index]) {\r
+ continue;\r
+ }\r
+ }\r
+\r
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo);\r
+ if (!EFI_ERROR (Status)) {\r
+ switch (SerialIo->Mode->Parity) {\r
+ case DefaultParity:\r
+\r
+ Parity = 'D';\r
+ break;\r
+\r
+ case NoParity:\r
+\r
+ Parity = 'N';\r
+ break;\r
+\r
+ case EvenParity:\r
+\r
+ Parity = 'E';\r
+ break;\r
+\r
+ case OddParity:\r
+\r
+ Parity = 'O';\r
+ break;\r
+\r
+ case MarkParity:\r
+\r
+ Parity = 'M';\r
+ break;\r
+\r
+ case SpaceParity:\r
+\r
+ Parity = 'S';\r
+ break;\r
+\r
+ default:\r
+\r
+ Parity = 'U';\r
+ }\r
+\r
+ switch (SerialIo->Mode->StopBits) {\r
+ case DefaultStopBits:\r
+\r
+ StopBits = L"Default";\r
+ break;\r
+\r
+ case OneStopBit:\r
+\r
+ StopBits = L"1";\r
+ break;\r
+\r
+ case TwoStopBits:\r
+\r
+ StopBits = L"2";\r
+ break;\r
+\r
+ case OneFiveStopBits:\r
+\r
+ StopBits = L"1.5";\r
+ break;\r
+\r
+ default:\r
+\r
+ StopBits = L"Unknown";\r
+ }\r
+ ShellPrintHiiEx(\r
+ -1,\r
+ -1,\r
+ NULL,\r
+ STRING_TOKEN (STR_SERMODE_DISPLAY),\r
+ gShellDebug1HiiHandle,\r
+ ConvertHandleToHandleIndex (Handles[Index]),\r
+ Handles[Index],\r
+ SerialIo->Mode->BaudRate,\r
+ Parity,\r
+ SerialIo->Mode->DataBits,\r
+ StopBits\r
+ );\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ break;\r
+ }\r
+\r
+ if (HandleValid) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ if (Index == NoHandles) {\r
+ if ((NoHandles != 0 && HandleValid) || 0 == NoHandles) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NOT_FOUND), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ }\r
+\r
+ return ShellStatus;\r
+}\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSerMode (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ SHELL_STATUS ShellStatus;\r
+ UINTN Index;\r
+ UINTN NoHandles;\r
+ EFI_HANDLE *Handles;\r
+ EFI_PARITY_TYPE Parity;\r
+ EFI_STOP_BITS_TYPE StopBits;\r
+ UINTN HandleIdx;\r
+ UINTN BaudRate;\r
+ UINTN DataBits;\r
+ UINTN Value;\r
+ EFI_SERIAL_IO_PROTOCOL *SerialIo;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ CONST CHAR16 *Temp;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ HandleIdx = 0;\r
+ Parity = DefaultParity;\r
+ Handles = NULL;\r
+ NoHandles = 0;\r
+ Index = 0;\r
+ Package = NULL;\r
+\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) < 5 && ShellCommandLineGetCount(Package) > 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) > 5) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Temp = ShellCommandLineGetRawValue(Package, 1);\r
+ if (Temp != NULL) {\r
+ HandleIdx = StrHexToUintn(Temp);\r
+ Temp = ShellCommandLineGetRawValue(Package, 2);\r
+ if (Temp == NULL) {\r
+ ShellStatus = iDisplaySettings (HandleIdx, TRUE);\r
+ goto Done;\r
+ }\r
+ } else {\r
+ ShellStatus = iDisplaySettings (0, FALSE);\r
+ goto Done;\r
+ }\r
+ Temp = ShellCommandLineGetRawValue(Package, 2);\r
+ if (Temp != NULL) {\r
+ BaudRate = StrHexToUintn(Temp);\r
+ } else {\r
+ ASSERT(FALSE);\r
+ BaudRate = 0;\r
+ }\r
+ Temp = ShellCommandLineGetRawValue(Package, 3);\r
+ if (Temp == NULL || StrLen(Temp)>1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ switch(Temp[0]){\r
+ case 'd':\r
+ case 'D':\r
+ Parity = DefaultParity;\r
+ break;\r
+ case 'n':\r
+ case 'N':\r
+ Parity = NoParity;\r
+ break;\r
+ case 'e':\r
+ case 'E':\r
+ Parity = EvenParity;\r
+ break;\r
+ case 'o':\r
+ case 'O':\r
+ Parity = OddParity;\r
+ break;\r
+ case 'm':\r
+ case 'M':\r
+ Parity = MarkParity;\r
+ break;\r
+ case 's':\r
+ case 'S':\r
+ Parity = SpaceParity;\r
+ break;\r
+ default:\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ }\r
+ Temp = ShellCommandLineGetRawValue(Package, 4);\r
+ if (Temp != NULL) {\r
+ DataBits = StrHexToUintn(Temp);\r
+ } else {\r
+ //\r
+ // make sure this is some number not in the list below.\r
+ //\r
+ DataBits = 0;\r
+ }\r
+ switch (DataBits) {\r
+ case 4:\r
+ case 7:\r
+ case 8:\r
+ break;\r
+ default:\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ Temp = ShellCommandLineGetRawValue(Package, 5);\r
+ Value = StrHexToUintn(Temp);\r
+ switch (Value) {\r
+ case 0:\r
+ StopBits = DefaultStopBits;\r
+ break;\r
+\r
+ case 1:\r
+ StopBits = OneStopBit;\r
+ break;\r
+\r
+ case 2:\r
+ StopBits = TwoStopBits;\r
+ break;\r
+\r
+ case 15:\r
+ StopBits = OneFiveStopBits;\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Temp);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+ Status = gBS->LocateHandleBuffer(ByProtocol, &gEfiSerialIoProtocolGuid, NULL, &NoHandles, &Handles);\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_NO_FOUND), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ goto Done;\r
+ }\r
+\r
+ for (Index = 0; Index < NoHandles; Index++) {\r
+ if (ConvertHandleIndexToHandle (HandleIdx) != Handles[Index]) {\r
+ continue;\r
+ }\r
+\r
+ Status = gBS->HandleProtocol (Handles[Index], &gEfiSerialIoProtocolGuid, (VOID**)&SerialIo);\r
+ if (!EFI_ERROR (Status)) {\r
+ Status = SerialIo->SetAttributes (\r
+ SerialIo,\r
+ (UINT64) BaudRate,\r
+ SerialIo->Mode->ReceiveFifoDepth,\r
+ SerialIo->Mode->Timeout,\r
+ Parity,\r
+ (UINT8) DataBits,\r
+ StopBits\r
+ );\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_FAIL), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]), Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_SET_HANDLE), gShellDebug1HiiHandle, ConvertHandleToHandleIndex(Handles[Index]));\r
+ }\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+\r
+ if (Index == NoHandles) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SERMODE_BAD_HANDLE), gShellDebug1HiiHandle, HandleIdx);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+\r
+Done:\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+ if (Handles != NULL) {\r
+ FreePool (Handles);\r
+ }\r
+ return ShellStatus;\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for SetSize shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSetSize (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *Temp1;\r
+ UINTN NewSize;\r
+ UINTN LoopVar;\r
+ SHELL_FILE_HANDLE FileHandle;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ Temp1 = ShellCommandLineGetRawValue(Package, 1);\r
+ if (Temp1 == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SIZE_NOT_SPEC), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ NewSize = 0;\r
+ } else {\r
+ NewSize = ShellStrToUintn(Temp1);\r
+ }\r
+ for (LoopVar = 2 ; LoopVar < ShellCommandLineGetCount(Package) && ShellStatus == SHELL_SUCCESS ; LoopVar++) {\r
+ Status = ShellOpenFileByName(ShellCommandLineGetRawValue(Package, LoopVar), &FileHandle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE|EFI_FILE_MODE_CREATE, 0);\r
+ if (EFI_ERROR(Status) && LoopVar == 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_FILE_NOT_SPEC), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (EFI_ERROR(Status)) {\r
+ break;\r
+ } else {\r
+ Status = FileHandleSetSize(FileHandle, NewSize);\r
+ if (Status == EFI_VOLUME_FULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_VOLUME_FULL), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_VOLUME_FULL;\r
+ } else if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SET_SIZE_FAIL), gShellDebug1HiiHandle, ShellCommandLineGetRawValue(Package, LoopVar), Status);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ ShellCloseFile(&FileHandle);\r
+ }\r
+ }\r
+\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/** @file\r
+ Main file for SetVar shell Debug1 function.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-guid", TypeValue},\r
+ {L"-bs", TypeFlag},\r
+ {L"-rt", TypeFlag},\r
+ {L"-nv", TypeFlag},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSetVar (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *VariableName;\r
+ CONST CHAR16 *Data;\r
+ EFI_GUID Guid;\r
+ CONST CHAR16 *StringGuid;\r
+ UINT32 Attributes;\r
+ VOID *Buffer;\r
+ UINTN Size;\r
+ UINTN LoopVar;\r
+ EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
+ EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *DevPathFromText;\r
+\r
+ ShellStatus = SHELL_SUCCESS;\r
+ Status = EFI_SUCCESS;\r
+ Buffer = NULL;\r
+ Size = 0;\r
+ Attributes = 0;\r
+ DevPath = NULL;\r
+\r
+ //\r
+ // initialize the shell lib (we must be in non-auto-init...)\r
+ //\r
+ Status = ShellInitialize();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ Status = CommandInit();\r
+ ASSERT_EFI_ERROR(Status);\r
+\r
+ //\r
+ // parse the command line\r
+ //\r
+ Status = ShellCommandLineParse (ParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) < 2) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_FEW), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else if (ShellCommandLineGetCount(Package) > 3) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ VariableName = ShellCommandLineGetRawValue(Package, 1);\r
+ Data = ShellCommandLineGetRawValue(Package, 2);\r
+ if (!ShellCommandLineGetFlag(Package, L"-guid")){\r
+ CopyGuid(&Guid, &gEfiGlobalVariableGuid);\r
+ } else {\r
+ StringGuid = ShellCommandLineGetValue(Package, L"-guid");\r
+ Status = ConvertStringToGuid(StringGuid, &Guid);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ }\r
+ if (Data == NULL) {\r
+ //\r
+ // Display what's there\r
+ //\r
+ Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);\r
+ if (Status == EFI_BUFFER_TOO_SMALL) {\r
+ Buffer = AllocatePool(Size);\r
+ Status = gRT->GetVariable((CHAR16*)VariableName, &Guid, &Attributes, &Size, Buffer);\r
+ }\r
+ if (!EFI_ERROR(Status)&& Buffer != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_PRINT), gShellDebug1HiiHandle, &Guid, VariableName, Size);\r
+ for (LoopVar = 0 ; LoopVar < Size ; LoopVar++) {\r
+ ShellPrintEx(-1, -1, L"%02x ", ((UINT8*)Buffer)[LoopVar]);\r
+ }\r
+ ShellPrintEx(-1, -1, L"\r\n");\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_GET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ }\r
+ } else if (StrCmp(Data, L"=") == 0) {\r
+ //\r
+ // Delete what's there!\r
+ //\r
+ Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, 0, NULL);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ }\r
+ } else {\r
+ if (Data[0] == L'=') {\r
+ Data++;\r
+ }\r
+ //\r
+ // Change what's there\r
+ //\r
+ if (ShellCommandLineGetFlag(Package, L"-bs")) {\r
+ Attributes |= EFI_VARIABLE_BOOTSERVICE_ACCESS;\r
+ }\r
+ if (ShellCommandLineGetFlag(Package, L"-rt")) {\r
+ Attributes |= EFI_VARIABLE_RUNTIME_ACCESS;\r
+ }\r
+ if (ShellCommandLineGetFlag(Package, L"-nv")) {\r
+ Attributes |= EFI_VARIABLE_NON_VOLATILE;\r
+ }\r
+ if (ShellIsHexOrDecimalNumber(Data, TRUE, FALSE)) {\r
+ //\r
+ // arbitrary buffer\r
+ //\r
+ Buffer = AllocateZeroPool((StrLen(Data) / 2));\r
+ for (LoopVar = 0 ; LoopVar < (StrLen(Data) / 2) ; LoopVar++) {\r
+ ((UINT8*)Buffer)[LoopVar] = (UINT8)(HexCharToUintn(Data[LoopVar*2]) * 16);\r
+ ((UINT8*)Buffer)[LoopVar] = (UINT8)(((UINT8*)Buffer)[LoopVar] + HexCharToUintn(Data[LoopVar*2+1]));\r
+ }\r
+ Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, StrLen(Data) / 2, Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ }\r
+ } else if (StrnCmp(Data, L"\"", 1) == 0) {\r
+ //\r
+ // ascii text\r
+ //\r
+ Data++;\r
+ Buffer = AllocateZeroPool(StrSize(Data) / 2);\r
+ AsciiSPrint(Buffer, StrSize(Data) / 2, "%s", Data);\r
+ ((CHAR8*)Buffer)[AsciiStrLen(Buffer)-1] = CHAR_NULL;\r
+\r
+ Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, AsciiStrSize(Buffer)-sizeof(CHAR8), Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ }\r
+ } else if (StrnCmp(Data, L"L\"", 2) == 0) {\r
+ //\r
+ // ucs2 text\r
+ //\r
+ Data++;\r
+ Data++;\r
+ Buffer = AllocateZeroPool(StrSize(Data));\r
+ UnicodeSPrint(Buffer, StrSize(Data), L"%s", Data);\r
+ ((CHAR16*)Buffer)[StrLen(Buffer)-1] = CHAR_NULL;\r
+\r
+ Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, StrSize(Buffer)-sizeof(CHAR16), Buffer);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ }\r
+ } else if (StrnCmp(Data, L"--", 2) == 0) {\r
+ //\r
+ // device path in text format\r
+ //\r
+ Data++;\r
+ Data++;\r
+ Status = gBS->LocateProtocol(&gEfiDevicePathFromTextProtocolGuid, NULL, (VOID**)&DevPathFromText);\r
+ ASSERT_EFI_ERROR(Status);\r
+ DevPath = DevPathFromText->ConvertTextToDevicePath(Data);\r
+ if (DevPath == NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_DPFT), gShellDebug1HiiHandle, Status);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ Status = gRT->SetVariable((CHAR16*)VariableName, &Guid, Attributes, GetDevicePathSize(DevPath), DevPath);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_SETVAR_ERROR_SET), gShellDebug1HiiHandle, &Guid, VariableName, Status);\r
+ ShellStatus = SHELL_ACCESS_DENIED;\r
+ } else {\r
+ ASSERT(ShellStatus == SHELL_SUCCESS);\r
+ }\r
+ }\r
+ } else {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, Data);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ }\r
+ }\r
+ }\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ if (Buffer != NULL) {\r
+ FreePool(Buffer);\r
+ }\r
+\r
+ if (DevPath != NULL) {\r
+ FreePool(DevPath);\r
+ }\r
+\r
+ return (ShellStatus);\r
+}\r
--- /dev/null
+/**\r
+ Module for clarifying the content of the smbios structure element info.\r
+\r
+ Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include "PrintInfo.h"\r
+#include "QueryTable.h"\r
+#include "EventLogInfo.h"\r
+\r
+/**\r
+ Function to display system event log access information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySELAccessMethod (\r
+ IN CONST UINT8 Key,\r
+ IN CONST UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print prompt\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+\r
+ //\r
+ // Print value info\r
+ //\r
+ switch (Key) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ if (Key <= 0x7f) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ Function to display system event log status information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySELLogStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print prompt\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+\r
+ //\r
+ // Print value info\r
+ //\r
+ if ((Key & 0x01) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if ((Key & 0x02) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if ((Key & 0xFC) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);\r
+ }\r
+}\r
+\r
+/**\r
+ Function to display system event log header format information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogHeaderFormat (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print prompt\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+\r
+ //\r
+ // Print value info\r
+ //\r
+ if (Key == 0x00) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);\r
+ } else if (Key == 0x01) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);\r
+ } else if (Key <= 0x7f) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplaySELLogHeaderLen (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);\r
+\r
+ //\r
+ // The most-significant bit of the field specifies\r
+ // whether (0) or not (1) the record has been read\r
+ //\r
+ if ((Key & 0x80) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplaySysEventLogHeaderType1 (\r
+ UINT8 *LogHeader\r
+ )\r
+{\r
+ LOG_HEADER_TYPE1_FORMAT *Header;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);\r
+\r
+ //\r
+ // Print Log Header Type1 Format info\r
+ //\r
+ Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader);\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED),\r
+ gShellDebug1HiiHandle,\r
+ Header->OEMReserved[0],\r
+ Header->OEMReserved[1],\r
+ Header->OEMReserved[2],\r
+ Header->OEMReserved[3],\r
+ Header->OEMReserved[4]\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->METW);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->MECI);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED),\r
+ gShellDebug1HiiHandle,\r
+ Header->OEMReserved[0],\r
+ Header->OEMReserved[1],\r
+ Header->OEMReserved[2]\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);\r
+}\r
+\r
+/**\r
+ Function to display system event log header information.\r
+\r
+ @param[in] LogHeaderFormat Format identifier.\r
+ @param[in] LogHeader Format informcation.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogHeader (\r
+ UINT8 LogHeaderFormat,\r
+ UINT8 *LogHeader\r
+ )\r
+{\r
+ //\r
+ // Print prompt\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);\r
+\r
+ //\r
+ // Print value info\r
+ //\r
+ if (LogHeaderFormat == 0x00) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);\r
+ } else if (LogHeaderFormat == 0x01) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);\r
+ DisplaySysEventLogHeaderType1 (LogHeader);\r
+ } else if (LogHeaderFormat <= 0x7f) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayElVdfInfo (\r
+ UINT8 ElVdfType,\r
+ UINT8 *VarData\r
+ )\r
+{\r
+ UINT16 *Word;\r
+ UINT32 *Dword;\r
+\r
+ //\r
+ // Display Type Name\r
+ //\r
+ DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL);\r
+\r
+ //\r
+ // Display Type description\r
+ //\r
+ switch (ElVdfType) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ Word = (UINT16 *) (VarData + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);\r
+ break;\r
+\r
+ case 2:\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r
+ break;\r
+\r
+ case 3:\r
+ Word = (UINT16 *) (VarData + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);\r
+ //\r
+ // Followed by a multiple-event counter\r
+ //\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r
+ break;\r
+\r
+ case 4:\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);\r
+ Dword++;\r
+ DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);\r
+ break;\r
+\r
+ case 5:\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);\r
+ break;\r
+\r
+ case 6:\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);\r
+ //\r
+ // Followed by a multiple-event counter\r
+ //\r
+ Dword = (UINT32 *) (VarData + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);\r
+ break;\r
+\r
+ default:\r
+ if (ElVdfType <= 0x7F) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+}\r
+\r
+/**\r
+ Function to display system event log data.\r
+\r
+ @param[in] LogData The data information.\r
+ @param[in] LogAreaLength Length of the data.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogData (\r
+ UINT8 *LogData,\r
+ UINT16 LogAreaLength\r
+ )\r
+{\r
+ LOG_RECORD_FORMAT *Log;\r
+ UINT8 ElVdfType;\r
+ //\r
+ // Event Log Variable Data Format Types\r
+ //\r
+ UINTN Offset;\r
+\r
+ //\r
+ // Print prompt\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);\r
+\r
+ //\r
+ // Print Log info\r
+ //\r
+ Offset = 0;\r
+ Log = (LOG_RECORD_FORMAT *) LogData;\r
+ while (Log->Type != END_OF_LOG && Offset < LogAreaLength) {\r
+ //\r
+ // Get a Event Log Record\r
+ //\r
+ Log = (LOG_RECORD_FORMAT *) (LogData + Offset);\r
+\r
+ //\r
+ // Display Event Log Record Information\r
+ //\r
+ DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);\r
+ DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);\r
+\r
+ Offset += Log->Length;\r
+\r
+ //\r
+ // Display Log Header Date/Time Fields\r
+ // These fields contain the BCD representation of the date and time\r
+ // (as read from CMOS) of the occurrence of the event\r
+ // So Print as hex and represent decimal\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);\r
+ if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {\r
+ Print (L"19");\r
+ } else if (Log != NULL && Log->Year <= 79) {\r
+ Print (L"20");\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);\r
+ continue;\r
+ }\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),\r
+ gShellDebug1HiiHandle,\r
+ Log->Year,\r
+ Log->Month,\r
+ Log->Day,\r
+ Log->Hour,\r
+ Log->Minute,\r
+ Log->Second\r
+ );\r
+\r
+ //\r
+ // Display Variable Data Format\r
+ //\r
+ if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {\r
+ continue;\r
+ }\r
+\r
+ ElVdfType = Log->LogVariableData[0];\r
+ DisplayElVdfInfo (ElVdfType, Log->LogVariableData);\r
+ }\r
+}\r
--- /dev/null
+/**\r
+ Module to clarify system event log of smbios structure.\r
+\r
+ Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _SMBIOS_EVENT_LOG_INFO_H\r
+#define _SMBIOS_EVENT_LOG_INFO_H\r
+\r
+#define END_OF_LOG 0xFF\r
+\r
+#pragma pack(1)\r
+\r
+typedef struct {\r
+ UINT8 Type;\r
+ UINT8 Length;\r
+ UINT8 Year;\r
+ UINT8 Month;\r
+ UINT8 Day;\r
+ UINT8 Hour;\r
+ UINT8 Minute;\r
+ UINT8 Second;\r
+ UINT8 LogVariableData[1];\r
+} LOG_RECORD_FORMAT;\r
+\r
+typedef struct {\r
+ UINT8 OEMReserved[5];\r
+ UINT8 METW; // Multiple Event Time Window\r
+ UINT8 MECI; // Multiple Event Count Increment\r
+ UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address\r
+ UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index\r
+ UINT8 StartingOffset; // CMOS Checksum - Starting Offset\r
+ UINT8 ByteCount; // CMOS Checksum - Byte Count\r
+ UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset\r
+ UINT8 Reserved[3];\r
+ UINT8 HeaderRevision;\r
+} LOG_HEADER_TYPE1_FORMAT;\r
+\r
+#pragma pack()\r
+//\r
+// System Event Log (Type 15)\r
+//\r
+\r
+/**\r
+ Function to display system event log access information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySELAccessMethod (\r
+ IN CONST UINT8 Key,\r
+ IN CONST UINT8 Option\r
+ );\r
+\r
+/**\r
+ Function to display system event log status information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySELLogStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+/**\r
+ Function to display system event log header format information.\r
+\r
+ @param[in] Key Additional information to print.\r
+ @param[in] Option Whether to print the additional information.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogHeaderFormat (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+/**\r
+ Function to display system event log header information.\r
+\r
+ @param[in] LogHeaderFormat Format identifier.\r
+ @param[in] LogHeader Format informcation.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogHeader (\r
+ UINT8 LogHeaderFormat,\r
+ UINT8 *LogHeader\r
+ );\r
+\r
+/**\r
+ Function to display system event log data.\r
+\r
+ @param[in] LogData The data information.\r
+ @param[in] LogAreaLength Length of the data.\r
+**/\r
+VOID\r
+EFIAPI\r
+DisplaySysEventLogData (\r
+ UINT8 *LogData,\r
+ UINT16 LogAreaLength\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Lib include for SMBIOS services. Used to get system serial number and GUID\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _LIB_SMBIOS_H\r
+#define _LIB_SMBIOS_H\r
+\r
+//\r
+// Define SMBIOS tables.\r
+//\r
+#pragma pack(1)\r
+\r
+typedef UINT8 SMBIOS_STRING;\r
+\r
+typedef struct {\r
+ UINT8 AnchorString[4];\r
+ UINT8 EntryPointStructureChecksum;\r
+ UINT8 EntryPointLength;\r
+ UINT8 MajorVersion;\r
+ UINT8 MinorVersion;\r
+ UINT16 MaxStructureSize;\r
+ UINT8 EntryPointRevision;\r
+ UINT8 FormattedArea[5];\r
+ UINT8 IntermediateAnchorString[5];\r
+ UINT8 IntermediateChecksum;\r
+ UINT16 TableLength;\r
+ UINT32 TableAddress;\r
+ UINT16 NumberOfSmbiosStructures;\r
+ UINT8 SmbiosBcdRevision;\r
+} SMBIOS_STRUCTURE_TABLE;\r
+\r
+//\r
+// Please note that SMBIOS structures can be odd byte aligned since the\r
+// unformated section of each record is a set of arbitrary size strings.\r
+//\r
+typedef struct {\r
+ UINT8 Type;\r
+ UINT8 Length;\r
+ UINT16 Handle;\r
+} SMBIOS_HEADER;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Vendor;\r
+ SMBIOS_STRING BiosVersion;\r
+ UINT16 BiosSegment;\r
+ SMBIOS_STRING BiosReleaseDate;\r
+ UINT8 BiosSize;\r
+ UINT64 BiosCharacteristics;\r
+ UINT8 BIOSCharacteristicsExtensionBytes[2];\r
+ UINT8 SystemBiosMajorRelease;\r
+ UINT8 SystemBiosMinorRelease;\r
+ UINT8 EmbeddedControllerFirmwareMajorRelease;\r
+ UINT8 EmbeddedControllerFirmwareMinorRelease;\r
+} SMBIOS_TYPE0;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Manufacturer;\r
+ SMBIOS_STRING ProductName;\r
+ SMBIOS_STRING Version;\r
+ SMBIOS_STRING SerialNumber;\r
+ EFI_GUID Uuid;\r
+ UINT8 WakeUpType;\r
+ SMBIOS_STRING SKUNumber;\r
+ SMBIOS_STRING Family;\r
+} SMBIOS_TYPE1;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Manufacturer;\r
+ SMBIOS_STRING ProductName;\r
+ SMBIOS_STRING Version;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING AssetTag;\r
+ UINT8 FeatureFlag;\r
+ SMBIOS_STRING LocationInChassis;\r
+ UINT16 ChassisHandle;\r
+ UINT8 BoardType;\r
+ UINT8 NumberOfContainedObjectHandles;\r
+ UINT16 ContainedObjectHandles[1];\r
+} SMBIOS_TYPE2;\r
+\r
+typedef struct {\r
+ UINT8 ContainedElementType;\r
+ UINT8 ContainedElementMinimum;\r
+ UINT8 ContainedElementMaximum;\r
+} CONTAINED_ELEMENT;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Manufacturer;\r
+ UINT8 Type;\r
+ SMBIOS_STRING Version;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING AssetTag;\r
+ UINT8 BootupState;\r
+ UINT8 PowerSupplyState;\r
+ UINT8 ThermalState;\r
+ UINT8 SecurityStatus;\r
+ UINT8 OemDefined[4];\r
+ UINT8 Height;\r
+ UINT8 NumberofPowerCords;\r
+ UINT8 ContainedElementCount;\r
+ UINT8 ContainedElementRecordLength;\r
+ CONTAINED_ELEMENT ContainedElements[1];\r
+} SMBIOS_TYPE3;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Socket;\r
+ UINT8 ProcessorType;\r
+ UINT8 ProcessorFamily;\r
+ SMBIOS_STRING ProcessorManufacture;\r
+ UINT8 ProcessorId[8];\r
+ SMBIOS_STRING ProcessorVersion;\r
+ UINT8 Voltage;\r
+ UINT16 ExternalClock;\r
+ UINT16 MaxSpeed;\r
+ UINT16 CurrentSpeed;\r
+ UINT8 Status;\r
+ UINT8 ProcessorUpgrade;\r
+ UINT16 L1CacheHandle;\r
+ UINT16 L2CacheHandle;\r
+ UINT16 L3CacheHandle;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING AssetTag;\r
+ SMBIOS_STRING PartNumber;\r
+ //\r
+ // Add for smbios 2.5\r
+ //\r
+ UINT8 CoreCount;\r
+ UINT8 EnabledCoreCount;\r
+ UINT8 ThreadCount;\r
+ UINT16 ProcessorCharacteristics;\r
+ //\r
+ // Add for smbios 2.6\r
+ //\r
+ UINT16 ProcessorFamily2;\r
+} SMBIOS_TYPE4;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 ErrDetectMethod;\r
+ UINT8 ErrCorrectCapability;\r
+ UINT8 SupportInterleave;\r
+ UINT8 CurrentInterleave;\r
+ UINT8 MaxMemoryModuleSize;\r
+ UINT16 SupportSpeed;\r
+ UINT16 SupportMemoryType;\r
+ UINT8 MemoryModuleVoltage;\r
+ UINT8 AssociatedMemorySlotNum;\r
+ UINT16 MemoryModuleConfigHandles[1];\r
+} SMBIOS_TYPE5;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING SocketDesignation;\r
+ UINT8 BankConnections;\r
+ UINT8 CurrentSpeed;\r
+ UINT16 CurrentMemoryType;\r
+ UINT8 InstalledSize;\r
+ UINT8 EnabledSize;\r
+ UINT8 ErrorStatus;\r
+} SMBIOS_TYPE6;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING SocketDesignation;\r
+ UINT16 CacheConfiguration;\r
+ UINT16 MaximumCacheSize;\r
+ UINT16 InstalledSize;\r
+ UINT16 SupportedSRAMType;\r
+ UINT16 CurrentSRAMType;\r
+ UINT8 CacheSpeed;\r
+ UINT8 ErrorCorrectionType;\r
+ UINT8 SystemCacheType;\r
+ UINT8 Associativity;\r
+} SMBIOS_TYPE7;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING InternalReferenceDesignator;\r
+ UINT8 InternalConnectorType;\r
+ SMBIOS_STRING ExternalReferenceDesignator;\r
+ UINT8 ExternalConnectorType;\r
+ UINT8 PortType;\r
+} SMBIOS_TYPE8;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING SlotDesignation;\r
+ UINT8 SlotType;\r
+ UINT8 SlotDataBusWidth;\r
+ UINT8 CurrentUsage;\r
+ UINT8 SlotLength;\r
+ UINT16 SlotID;\r
+ UINT8 SlotCharacteristics1;\r
+ UINT8 SlotCharacteristics2;\r
+ //\r
+ // Add for smbios 2.6\r
+ //\r
+ UINT16 SegmentGroupNum;\r
+ UINT8 BusNum;\r
+ UINT8 DevFuncNum;\r
+} SMBIOS_TYPE9;\r
+\r
+typedef struct DeviceStruct {\r
+ UINT8 DeviceType;\r
+ SMBIOS_STRING DescriptionString;\r
+} DeviceStruct;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ DeviceStruct Device[1];\r
+} SMBIOS_TYPE10;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 StringCount;\r
+} SMBIOS_TYPE11;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 StringCount;\r
+} SMBIOS_TYPE12;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 InstallableLanguages;\r
+ UINT8 Flags;\r
+ UINT8 reserved[15];\r
+ SMBIOS_STRING CurrentLanguages;\r
+} SMBIOS_TYPE13;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING GroupName;\r
+ UINT8 ItemType;\r
+ UINT16 ItemHandle;\r
+} SMBIOS_TYPE14;\r
+\r
+typedef struct EVENTLOGTYPE {\r
+ UINT8 LogType;\r
+ UINT8 DataFormatType;\r
+} EVENTLOGTYPE;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT16 LogAreaLength;\r
+ UINT16 LogHeaderStartOffset;\r
+ UINT16 LogDataStartOffset;\r
+ UINT8 AccessMethod;\r
+ UINT8 LogStatus;\r
+ UINT32 LogChangeToken;\r
+ UINT32 AccessMethodAddress;\r
+ UINT8 LogHeaderFormat;\r
+ UINT8 NumberOfSupportedLogTypeDescriptors;\r
+ UINT8 LengthOfLogTypeDescriptor;\r
+ EVENTLOGTYPE EventLogTypeDescriptors[1];\r
+} SMBIOS_TYPE15;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Location;\r
+ UINT8 Use;\r
+ UINT8 MemoryErrorCorrection;\r
+ UINT32 MaximumCapacity;\r
+ UINT16 MemoryErrorInformationHandle;\r
+ UINT16 NumberOfMemoryDevices;\r
+} SMBIOS_TYPE16;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT16 MemoryArrayHandle;\r
+ UINT16 MemoryErrorInformationHandle;\r
+ UINT16 TotalWidth;\r
+ UINT16 DataWidth;\r
+ UINT16 Size;\r
+ UINT8 FormFactor;\r
+ UINT8 DeviceSet;\r
+ SMBIOS_STRING DeviceLocator;\r
+ SMBIOS_STRING BankLocator;\r
+ UINT8 MemoryType;\r
+ UINT16 TypeDetail;\r
+ UINT16 Speed;\r
+ SMBIOS_STRING Manufacturer;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING AssetTag;\r
+ SMBIOS_STRING PartNumber;\r
+ //\r
+ // Add for smbios 2.6\r
+ //\r
+ UINT8 Attributes;\r
+} SMBIOS_TYPE17;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 ErrorType;\r
+ UINT8 ErrorGranularity;\r
+ UINT8 ErrorOperation;\r
+ UINT32 VendorSyndrome;\r
+ UINT32 MemoryArrayErrorAddress;\r
+ UINT32 DeviceErrorAddress;\r
+ UINT32 ErrorResolution;\r
+} SMBIOS_TYPE18;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT32 StartingAddress;\r
+ UINT32 EndingAddress;\r
+ UINT16 MemoryArrayHandle;\r
+ UINT8 PartitionWidth;\r
+} SMBIOS_TYPE19;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT32 StartingAddress;\r
+ UINT32 EndingAddress;\r
+ UINT16 MemoryDeviceHandle;\r
+ UINT16 MemoryArrayMappedAddressHandle;\r
+ UINT8 PartitionRowPosition;\r
+ UINT8 InterleavePosition;\r
+ UINT8 InterleavedDataDepth;\r
+} SMBIOS_TYPE20;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Type;\r
+ UINT8 Interface;\r
+ UINT8 NumberOfButtons;\r
+} SMBIOS_TYPE21;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Location;\r
+ SMBIOS_STRING Manufacturer;\r
+ SMBIOS_STRING ManufactureDate;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING DeviceName;\r
+ UINT8 DeviceChemistry;\r
+ UINT16 DeviceCapacity;\r
+ UINT16 DesignVoltage;\r
+ SMBIOS_STRING SBDSVersionNumber;\r
+ UINT8 MaximumErrorInBatteryData;\r
+ UINT16 SBDSSerialNumber;\r
+ UINT16 SBDSManufactureDate;\r
+ SMBIOS_STRING SBDSDeviceChemistry;\r
+ UINT8 DesignCapacityMultiplier;\r
+ UINT32 OEMSpecific;\r
+} SMBIOS_TYPE22;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Capabilities;\r
+ UINT16 ResetCount;\r
+ UINT16 ResetLimit;\r
+ UINT16 TimerInterval;\r
+ UINT16 Timeout;\r
+} SMBIOS_TYPE23;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 HardwareSecuritySettings;\r
+} SMBIOS_TYPE24;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 NextScheduledPowerOnMonth;\r
+ UINT8 NextScheduledPowerOnDayOfMonth;\r
+ UINT8 NextScheduledPowerOnHour;\r
+ UINT8 NextScheduledPowerOnMinute;\r
+ UINT8 NextScheduledPowerOnSecond;\r
+} SMBIOS_TYPE25;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Description;\r
+ UINT8 LocationAndStatus;\r
+ UINT16 MaximumValue;\r
+ UINT16 MinimumValue;\r
+ UINT16 Resolution;\r
+ UINT16 Tolerance;\r
+ UINT16 Accuracy;\r
+ UINT32 OEMDefined;\r
+ UINT16 NominalValue;\r
+} SMBIOS_TYPE26;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT16 TemperatureProbeHandle;\r
+ UINT8 DeviceTypeAndStatus;\r
+ UINT8 CoolingUnitGroup;\r
+ UINT32 OEMDefined;\r
+ UINT16 NominalSpeed;\r
+} SMBIOS_TYPE27;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Description;\r
+ UINT8 LocationAndStatus;\r
+ UINT16 MaximumValue;\r
+ UINT16 MinimumValue;\r
+ UINT16 Resolution;\r
+ UINT16 Tolerance;\r
+ UINT16 Accuracy;\r
+ UINT32 OEMDefined;\r
+ UINT16 NominalValue;\r
+} SMBIOS_TYPE28;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Description;\r
+ UINT8 LocationAndStatus;\r
+ UINT16 MaximumValue;\r
+ UINT16 MinimumValue;\r
+ UINT16 Resolution;\r
+ UINT16 Tolerance;\r
+ UINT16 Accuracy;\r
+ UINT32 OEMDefined;\r
+ UINT16 NominalValue;\r
+} SMBIOS_TYPE29;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING ManufacturerName;\r
+ UINT8 Connections;\r
+} SMBIOS_TYPE30;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Checksum;\r
+ UINT8 Reserved1;\r
+ UINT16 Reserved2;\r
+ UINT32 BisEntry16;\r
+ UINT32 BisEntry32;\r
+ UINT64 Reserved3;\r
+ UINT32 Reserved4;\r
+} SMBIOS_TYPE31;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 Reserved[6];\r
+ UINT8 BootStatus[1];\r
+} SMBIOS_TYPE32;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 ErrorType;\r
+ UINT8 ErrorGranularity;\r
+ UINT8 ErrorOperation;\r
+ UINT32 VendorSyndrome;\r
+ UINT64 MemoryArrayErrorAddress;\r
+ UINT64 DeviceErrorAddress;\r
+ UINT32 ErrorResolution;\r
+} SMBIOS_TYPE33;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Description;\r
+ UINT8 Type;\r
+ UINT32 Address;\r
+ UINT8 AddressType;\r
+} SMBIOS_TYPE34;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING Description;\r
+ UINT16 ManagementDeviceHandle;\r
+ UINT16 ComponentHandle;\r
+ UINT16 ThresholdHandle;\r
+} SMBIOS_TYPE35;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT16 LowerThresholdNonCritical;\r
+ UINT16 UpperThresholdNonCritical;\r
+ UINT16 LowerThresholdCritical;\r
+ UINT16 UpperThresholdCritical;\r
+ UINT16 LowerThresholdNonRecoverable;\r
+ UINT16 UpperThresholdNonRecoverable;\r
+} SMBIOS_TYPE36;\r
+\r
+typedef struct MEMORYDEVICE {\r
+ UINT8 DeviceLoad;\r
+ UINT16 DeviceHandle;\r
+} MEMORYDEVICE;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 ChannelType;\r
+ UINT8 MaximumChannelLoad;\r
+ UINT8 MemoryDeviceCount;\r
+ MEMORYDEVICE MemoryDevice[1];\r
+} SMBIOS_TYPE37;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 InterfaceType;\r
+ UINT8 IPMISpecificationRevision;\r
+ UINT8 I2CSlaveAddress;\r
+ UINT8 NVStorageDeviceAddress;\r
+ UINT64 BaseAddress;\r
+} SMBIOS_TYPE38;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 PowerUnitGroup;\r
+ SMBIOS_STRING Location;\r
+ SMBIOS_STRING DeviceName;\r
+ SMBIOS_STRING Manufacturer;\r
+ SMBIOS_STRING SerialNumber;\r
+ SMBIOS_STRING AssetTagNumber;\r
+ SMBIOS_STRING ModelPartNumber;\r
+ SMBIOS_STRING RevisionLevel;\r
+ UINT16 MaxPowerCapacity;\r
+ UINT16 PowerSupplyCharacteristics;\r
+ UINT16 InputVoltageProbeHandle;\r
+ UINT16 CoolingDeviceHandle;\r
+ UINT16 InputCurrentProbeHandle;\r
+} SMBIOS_TYPE39;\r
+\r
+//\r
+// Add type 40 and type 41 for smbios 2.6\r
+//\r
+typedef struct {\r
+ UINT8 EntryLength;\r
+ UINT16 ReferencedHandle;\r
+ UINT8 ReferencedOffset;\r
+ SMBIOS_STRING EntryString;\r
+ UINT8 Value[1];\r
+} ADDITIONAL_INFORMATION_ENTRY;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ UINT8 NumberOfAdditionalInformationEntries;\r
+ ADDITIONAL_INFORMATION_ENTRY AdditionalInfoEntries[1];\r
+} SMBIOS_TYPE40;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+ SMBIOS_STRING ReferenceDesignation;\r
+ UINT8 DeviceType;\r
+ UINT8 DeviceTypeInstance;\r
+ UINT16 SegmentGroupNum;\r
+ UINT8 BusNum;\r
+ UINT8 DevFuncNum;\r
+} SMBIOS_TYPE41;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+} SMBIOS_TYPE126;\r
+\r
+typedef struct {\r
+ SMBIOS_HEADER Hdr;\r
+} SMBIOS_TYPE127;\r
+\r
+/*\r
+ Notes:\r
+ Among the following 42 type of structues for SMBIOS Stucture table,\r
+ There are only 11 Types(0,1,3,4,7,9,16,17,19,20,32) are required,\r
+ The other types is optional.\r
+*/\r
+typedef union {\r
+ SMBIOS_HEADER *Hdr;\r
+ SMBIOS_TYPE0 *Type0;\r
+ SMBIOS_TYPE1 *Type1;\r
+ SMBIOS_TYPE2 *Type2;\r
+ SMBIOS_TYPE3 *Type3;\r
+ SMBIOS_TYPE4 *Type4;\r
+ SMBIOS_TYPE5 *Type5;\r
+ SMBIOS_TYPE6 *Type6;\r
+ SMBIOS_TYPE7 *Type7;\r
+ SMBIOS_TYPE8 *Type8;\r
+ SMBIOS_TYPE9 *Type9;\r
+ SMBIOS_TYPE10 *Type10;\r
+ SMBIOS_TYPE11 *Type11;\r
+ SMBIOS_TYPE12 *Type12;\r
+ SMBIOS_TYPE13 *Type13;\r
+ SMBIOS_TYPE14 *Type14;\r
+ SMBIOS_TYPE15 *Type15;\r
+ SMBIOS_TYPE16 *Type16;\r
+ SMBIOS_TYPE17 *Type17;\r
+ SMBIOS_TYPE18 *Type18;\r
+ SMBIOS_TYPE19 *Type19;\r
+ SMBIOS_TYPE20 *Type20;\r
+ SMBIOS_TYPE21 *Type21;\r
+ SMBIOS_TYPE22 *Type22;\r
+ SMBIOS_TYPE23 *Type23;\r
+ SMBIOS_TYPE24 *Type24;\r
+ SMBIOS_TYPE25 *Type25;\r
+ SMBIOS_TYPE26 *Type26;\r
+ SMBIOS_TYPE27 *Type27;\r
+ SMBIOS_TYPE28 *Type28;\r
+ SMBIOS_TYPE29 *Type29;\r
+ SMBIOS_TYPE30 *Type30;\r
+ SMBIOS_TYPE31 *Type31;\r
+ SMBIOS_TYPE32 *Type32;\r
+ SMBIOS_TYPE33 *Type33;\r
+ SMBIOS_TYPE34 *Type34;\r
+ SMBIOS_TYPE35 *Type35;\r
+ SMBIOS_TYPE36 *Type36;\r
+ SMBIOS_TYPE37 *Type37;\r
+ SMBIOS_TYPE38 *Type38;\r
+ SMBIOS_TYPE39 *Type39;\r
+ SMBIOS_TYPE40 *Type40;\r
+ SMBIOS_TYPE41 *Type41;\r
+ SMBIOS_TYPE126 *Type126;\r
+ SMBIOS_TYPE127 *Type127;\r
+ UINT8 *Raw;\r
+} SMBIOS_STRUCTURE_POINTER;\r
+\r
+#pragma pack()\r
+\r
+CHAR8 *\r
+LibGetSmbiosString (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,\r
+ IN UINT16 StringNumber\r
+ );\r
+\r
+EFI_STATUS\r
+LibGetSmbiosSystemGuidAndSerialNumber (\r
+ IN EFI_GUID *SystemGuid,\r
+ OUT CHAR8 **SystemSerialNumber\r
+ );\r
+\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ API for SMBIOS table.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+ \r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include <Guid/Smbios.h>\r
+#include "LIbSmbios.h"\r
+#include "LibSmbiosView.h"\r
+#include "smbiosview.h"\r
+\r
+STATIC UINT8 mInit = 0;\r
+STATIC SMBIOS_STRUCTURE_TABLE *mSmbiosTable = NULL;\r
+STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;\r
+STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;\r
+\r
+EFI_STATUS\r
+LibSmbiosInit (\r
+ VOID\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Init the SMBIOS VIEW API's environment.\r
+\r
+ Arguments:\r
+ None\r
+\r
+Returns:\r
+ EFI_SUCCESS - Successful to init the SMBIOS VIEW Lib\r
+ Others - Cannot get SMBIOS Table\r
+\r
+**/\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ //\r
+ // Init only once\r
+ //\r
+ if (mInit == 1) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Get SMBIOS table from System Configure table\r
+ //\r
+ Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID**)&mSmbiosTable);\r
+\r
+ if (mSmbiosTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ if (EFI_ERROR (Status)) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);\r
+ return Status;\r
+ }\r
+ //\r
+ // Init SMBIOS structure table address\r
+ //\r
+ mSmbiosStruct->Raw = (UINT8 *) (UINTN) (mSmbiosTable->TableAddress);\r
+\r
+ mInit = 1;\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+LibSmbiosCleanup (\r
+ VOID\r
+ )\r
+{\r
+ //\r
+ // Release resources\r
+ //\r
+ if (mSmbiosTable != NULL) {\r
+ mSmbiosTable = NULL;\r
+ }\r
+\r
+ mInit = 0;\r
+}\r
+\r
+VOID\r
+LibSmbiosGetEPS (\r
+ SMBIOS_STRUCTURE_TABLE **pEntryPointStructure\r
+ )\r
+{\r
+ //\r
+ // return SMBIOS Table address\r
+ //\r
+ *pEntryPointStructure = mSmbiosTable;\r
+}\r
+\r
+VOID\r
+LibSmbiosGetStructHead (\r
+ SMBIOS_STRUCTURE_POINTER *pHead\r
+ )\r
+{\r
+ //\r
+ // return SMBIOS structure table address\r
+ //\r
+ pHead = mSmbiosStruct;\r
+}\r
+\r
+EFI_STATUS\r
+LibGetSmbiosInfo (\r
+ OUT CHAR8 *dmiBIOSRevision,\r
+ OUT UINT16 *NumStructures,\r
+ OUT UINT16 *StructureSize,\r
+ OUT UINT32 *dmiStorageBase,\r
+ OUT UINT16 *dmiStorageSize\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Get SMBIOS Information.\r
+\r
+ Arguments:\r
+ dmiBIOSRevision - Revision of the SMBIOS Extensions.\r
+ NumStructures - Max. Number of Structures the BIOS will return.\r
+ StructureSize - Size of largest SMBIOS Structure.\r
+ dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.\r
+ dmiStorageSize - Size of the memory-mapped SMBIOS data.\r
+\r
+ Returns:\r
+ DMI_SUCCESS - successful.\r
+ DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.\r
+\r
+**/\r
+{\r
+ //\r
+ // If no SMIBOS table, unsupported.\r
+ //\r
+ if (mSmbiosTable == NULL) {\r
+ return DMI_FUNCTION_NOT_SUPPORTED;\r
+ }\r
+\r
+ *dmiBIOSRevision = mSmbiosTable->SmbiosBcdRevision;\r
+ *NumStructures = mSmbiosTable->NumberOfSmbiosStructures;\r
+ *StructureSize = mSmbiosTable->MaxStructureSize;\r
+ *dmiStorageBase = mSmbiosTable->TableAddress;\r
+ *dmiStorageSize = mSmbiosTable->TableLength;\r
+\r
+ return DMI_SUCCESS;\r
+}\r
+\r
+EFI_STATUS\r
+LibGetSmbiosStructure (\r
+ IN OUT UINT16 *Handle,\r
+ IN OUT UINT8 *Buffer,\r
+ OUT UINT16 *Length\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Get SMBIOS structure given the Handle,copy data to the Buffer,\r
+ Handle is changed to the next handle or 0xFFFF when the end is\r
+ reached or the handle is not found.\r
+\r
+ Arguments:\r
+ Handle: - 0xFFFF: get the first structure\r
+ - Others: get a structure according to this value.\r
+ Buffter: - The pointer to the caller's memory buffer.\r
+ Length: - Length of return buffer in bytes.\r
+\r
+ Returns:\r
+ DMI_SUCCESS - Buffer contains the required structure data\r
+ - Handle is updated with next structure handle or\r
+ 0xFFFF(end-of-list).\r
+\r
+ DMI_INVALID_HANDLE - Buffer not contain the requiring structure data\r
+ - Handle is updated with next structure handle or\r
+ 0xFFFF(end-of-list).\r
+**/\r
+{\r
+ SMBIOS_STRUCTURE_POINTER Smbios;\r
+ SMBIOS_STRUCTURE_POINTER SmbiosEnd;\r
+ UINT8 *Raw;\r
+\r
+ if (*Handle == INVALIDE_HANDLE) {\r
+ *Handle = mSmbiosStruct->Hdr->Handle;\r
+ return DMI_INVALID_HANDLE;\r
+ }\r
+\r
+ if (Buffer == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_SPEC), gShellDebug1HiiHandle);\r
+ return DMI_INVALID_HANDLE;\r
+ }\r
+\r
+ *Length = 0;\r
+ Smbios.Hdr = mSmbiosStruct->Hdr;\r
+ SmbiosEnd.Raw = Smbios.Raw + mSmbiosTable->TableLength;\r
+ while (Smbios.Raw < SmbiosEnd.Raw) {\r
+ if (Smbios.Hdr->Handle == *Handle) {\r
+ Raw = Smbios.Raw;\r
+ //\r
+ // Walk to next structure\r
+ //\r
+ LibGetSmbiosString (&Smbios, (UINT16) (-1));\r
+ //\r
+ // Length = Next structure head - this structure head\r
+ //\r
+ *Length = (UINT16) (Smbios.Raw - Raw);\r
+ CopyMem (Buffer, Raw, *Length);\r
+ //\r
+ // update with the next structure handle.\r
+ //\r
+ if (Smbios.Raw < SmbiosEnd.Raw) {\r
+ *Handle = Smbios.Hdr->Handle;\r
+ } else {\r
+ *Handle = INVALIDE_HANDLE;\r
+ }\r
+ return DMI_SUCCESS;\r
+ }\r
+ //\r
+ // Walk to next structure\r
+ //\r
+ LibGetSmbiosString (&Smbios, (UINT16) (-1));\r
+ }\r
+\r
+ *Handle = INVALIDE_HANDLE;\r
+ return DMI_INVALID_HANDLE;\r
+}\r
+\r
+EFI_STATUS\r
+SmbiosCheckStructure (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Check the structure to see if it is legal.\r
+\r
+ Arguments:\r
+ Smbios - Pointer to the structure that will be checked.\r
+\r
+ Returns:\r
+ DMI_SUCCESS - Structure data is legal.\r
+ DMI_BAD_PARAMETER - Structure data contains bad parameter\r
+\r
+**/\r
+{\r
+ //\r
+ // If key != value, then error.\r
+ //\r
+#define CHECK_VALUE(key, value) (((key) == (value)) ? EFI_SUCCESS : DMI_BAD_PARAMETER)\r
+\r
+ EFI_STATUS Status;\r
+ //\r
+ // Assume staus is EFI_SUCCESS,\r
+ // but if check is error, then EFI_ERROR.\r
+ //\r
+ Status = EFI_SUCCESS;\r
+\r
+ switch (Smbios->Hdr->Type) {\r
+ case 0:\r
+ break;\r
+\r
+ case 1:\r
+ if (Smbios->Type1->Hdr.Length == 0x08 || Smbios->Type0->Hdr.Length == 0x19) {\r
+ Status = EFI_SUCCESS;\r
+ } else {\r
+ Status = DMI_BAD_PARAMETER;\r
+ }\r
+ break;\r
+\r
+ case 2:\r
+ Status = CHECK_VALUE (Smbios->Type2->Hdr.Length, 0x08);\r
+ break;\r
+\r
+ case 6:\r
+ Status = CHECK_VALUE (Smbios->Type6->Hdr.Length, 0x0C);\r
+ break;\r
+\r
+ case 11:\r
+ Status = CHECK_VALUE (Smbios->Type11->Hdr.Length, 0x05);\r
+ break;\r
+\r
+ case 12:\r
+ Status = CHECK_VALUE (Smbios->Type12->Hdr.Length, 0x05);\r
+ break;\r
+\r
+ case 13:\r
+ Status = CHECK_VALUE (Smbios->Type13->Hdr.Length, 0x16);\r
+ break;\r
+\r
+ case 16:\r
+ Status = CHECK_VALUE (Smbios->Type16->Hdr.Length, 0x0F);\r
+ break;\r
+\r
+ case 19:\r
+ Status = CHECK_VALUE (Smbios->Type19->Hdr.Length, 0x0F);\r
+ break;\r
+\r
+ case 20:\r
+ Status = CHECK_VALUE (Smbios->Type20->Hdr.Length, 0x13);\r
+ break;\r
+\r
+ case 32:\r
+ //\r
+ // Because EFI_SUCCESS == 0,\r
+ // So errors added up is also error.\r
+ //\r
+ Status = CHECK_VALUE (Smbios->Type32->Reserved[0], 0x00) +\r
+ CHECK_VALUE (Smbios->Type32->Reserved[1], 0x00) +\r
+ CHECK_VALUE (Smbios->Type32->Reserved[2], 0x00) +\r
+ CHECK_VALUE (Smbios->Type32->Reserved[3], 0x00) +\r
+ CHECK_VALUE (Smbios->Type32->Reserved[4], 0x00) +\r
+ CHECK_VALUE (Smbios->Type32->Reserved[5], 0x00);\r
+ break;\r
+\r
+ default:\r
+ Status = DMI_BAD_PARAMETER;\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r
+VOID\r
+SmbiosGetPendingString (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,\r
+ IN UINT16 StringNumber,\r
+ OUT CHAR8 *Buffer\r
+ )\r
+{\r
+ CHAR8 *String;\r
+ if (Buffer == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT), gShellDebug1HiiHandle);\r
+ return ;\r
+ }\r
+ //\r
+ // Get string and copy to buffer.\r
+ // Caller should provide the buffer.\r
+ //\r
+ String = LibGetSmbiosString (Smbios, StringNumber);\r
+ if (String != NULL) {\r
+ CopyMem (Buffer, String, AsciiStrLen(String));\r
+ } else {\r
+ Buffer = NULL;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ API for SMBIOS Plug and Play functions, access to SMBIOS table and structures.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _LIB_SMBIOS_VIEW_H\r
+#define _LIB_SMBIOS_VIEW_H\r
+\r
+#include "LibSmbios.h"\r
+\r
+#define DMI_SUCCESS 0x00\r
+#define DMI_UNKNOWN_FUNCTION 0x81\r
+#define DMI_FUNCTION_NOT_SUPPORTED 0x82\r
+#define DMI_INVALID_HANDLE 0x83\r
+#define DMI_BAD_PARAMETER 0x84\r
+#define DMI_INVALID_SUBFUNCTION 0x85\r
+#define DMI_NO_CHANGE 0x86\r
+#define DMI_ADD_STRUCTURE_FAILED 0x87\r
+#define DMI_READ_ONLY 0x8D\r
+#define DMI_LOCK_NOT_SUPPORTED 0x90\r
+#define DMI_CURRENTLY_LOCKED 0x91\r
+#define DMI_INVALID_LOCK 0x92\r
+\r
+#define INVALIDE_HANDLE (UINT16) (-1)\r
+\r
+#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val)\r
+\r
+#define EFI_SMBIOSERR_FAILURE EFI_SMBIOSERR (1)\r
+#define EFI_SMBIOSERR_STRUCT_NOT_FOUND EFI_SMBIOSERR (2)\r
+#define EFI_SMBIOSERR_TYPE_UNKNOWN EFI_SMBIOSERR (3)\r
+#define EFI_SMBIOSERR_UNSUPPORTED EFI_SMBIOSERR (4)\r
+\r
+EFI_STATUS\r
+LibSmbiosInit (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+LibSmbiosCleanup (\r
+ VOID\r
+ );\r
+\r
+VOID\r
+LibSmbiosGetEPS (\r
+ SMBIOS_STRUCTURE_TABLE **pEntryPointStructure\r
+ );\r
+\r
+VOID\r
+LibSmbiosGetStructHead (\r
+ SMBIOS_STRUCTURE_POINTER *pHead\r
+ );\r
+\r
+EFI_STATUS\r
+LibGetSmbiosInfo (\r
+ OUT CHAR8 *dmiBIOSRevision,\r
+ OUT UINT16 *NumStructures,\r
+ OUT UINT16 *StructureSize,\r
+ OUT UINT32 *dmiStorageBase,\r
+ OUT UINT16 *dmiStorageSize\r
+ );\r
+\r
+/*++\r
+ Description:\r
+ Get SMBIOS Information.\r
+\r
+ Arguments:\r
+ dmiBIOSRevision - Revision of the SMBIOS Extensions.\r
+ NumStructures - Max. Number of Structures the BIOS will return.\r
+ StructureSize - Size of largest SMBIOS Structure.\r
+ dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.\r
+ dmiStorageSize - Size of the memory-mapped SMBIOS data.\r
+\r
+ Returns:\r
+ DMI_SUCCESS - successful.\r
+ DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.\r
+**/\r
+EFI_STATUS\r
+LibGetSmbiosStructure (\r
+ IN OUT UINT16 *Handle,\r
+ IN OUT UINT8 *Buffer,\r
+ OUT UINT16 *Length\r
+ );\r
+\r
+/*++\r
+ Description:\r
+ Get SMBIOS structure given the Handle,copy data to the Buffer,Handle is then the next.\r
+\r
+ Arguments:\r
+ Handle: - 0x0: get the first structure\r
+ - Others: get a certain structure according to this value.\r
+ Buffter: - contains the pointer to the caller's memory buffer.\r
+\r
+ Returns:\r
+ DMI_SUCCESS - Buffer contains the required structure data\r
+ - Handle is updated with next structure handle or 0xFFFF(end-of-list).\r
+ DMI_INVALID_HANDLE - Buffer not contain the requiring structure data\r
+ - Handle is updated with next structure handle or 0xFFFF(end-of-list).\r
+**/\r
+VOID\r
+SmbiosGetPendingString (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,\r
+ IN UINT16 StringNumber,\r
+ OUT CHAR8 *Buffer\r
+ );\r
+\r
+EFI_STATUS\r
+SmbiosCheckStructure (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Module for clarifying the content of the smbios structure element information.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include "PrintInfo.h"\r
+#include "LibSmbiosView.h"\r
+#include "QueryTable.h"\r
+#include "EventLogInfo.h"\r
+\r
+\r
+//\r
+// Get the certain bit of 'value'\r
+//\r
+#define BIT(value, bit) ((value) & ((UINT64) 1) << (bit))\r
+\r
+//\r
+//////////////////////////////////////////////////////////\r
+// Macros of print structure element, simplify coding.\r
+//\r
+#define PrintPendingString(pStruct, type, element) \\r
+ do { \\r
+ CHAR8 StringBuf[64]; \\r
+ SetMem (StringBuf, sizeof (StringBuf), 0x00); \\r
+ SmbiosGetPendingString ((pStruct), (pStruct->type->element), StringBuf); \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintEx(-1,-1,L": %a\n", StringBuf); \\r
+ } while (0);\r
+\r
+#define PrintSmbiosString(pStruct, stringnumber, element) \\r
+ do { \\r
+ CHAR8 StringBuf[64]; \\r
+ SetMem (StringBuf, sizeof (StringBuf), 0x00); \\r
+ SmbiosGetPendingString ((pStruct), (stringnumber), StringBuf); \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintEx(-1,-1,L": %a\n", StringBuf); \\r
+ } while (0);\r
+\r
+#define PrintStructValue(pStruct, type, element) \\r
+ do { \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintEx(-1,-1,L": %d\n", (pStruct->type->element)); \\r
+ } while (0);\r
+\r
+#define PrintStructValueH(pStruct, type, element) \\r
+ do { \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintEx(-1,-1,L": 0x%x\n", (pStruct->type->element)); \\r
+ } while (0);\r
+\r
+#define PrintBitField(pStruct, type, element, size) \\r
+ do { \\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \\r
+ DumpHex (0, 0, size, &(pStruct->type->element)); \\r
+ } while (0);\r
+\r
+#define PrintSmbiosBitField(pStruct, startaddress, element, size) \\r
+ do { \\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DUMP), gShellDebug1HiiHandle); \\r
+ ShellPrintEx(-1,-1,L"%a",#element); \\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE), gShellDebug1HiiHandle, size); \\r
+ DumpHex (0, 0, size, startaddress); \\r
+ } while (0);\r
+\r
+//\r
+/////////////////////////////////////////\r
+//\r
+VOID\r
+MemToString (\r
+ IN OUT VOID *Dest,\r
+ IN VOID *Src,\r
+ IN UINTN Length\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Copy Length of Src buffer to Dest buffer,\r
+ add a NULL termination to Dest buffer.\r
+\r
+Arguments:\r
+ Dest - Destination buffer head\r
+ Src - Source buffer head\r
+ Length - Length of buffer to be copied\r
+\r
+Returns:\r
+ None.\r
+\r
+**/\r
+{\r
+ UINT8 *SrcBuffer;\r
+ UINT8 *DestBuffer;\r
+ SrcBuffer = (UINT8 *) Src;\r
+ DestBuffer = (UINT8 *) Dest;\r
+ //\r
+ // copy byte by byte\r
+ //\r
+ while ((Length--)!=0) {\r
+ *DestBuffer++ = *SrcBuffer++;\r
+ }\r
+ //\r
+ // append a NULL terminator\r
+ //\r
+ *DestBuffer = '\0';\r
+}\r
+\r
+//\r
+//////////////////////////////////////////////\r
+//\r
+// Functions below is to show the information\r
+//\r
+VOID\r
+SmbiosPrintEPSInfo (\r
+ IN SMBIOS_STRUCTURE_TABLE *SmbiosTable,\r
+ IN UINT8 Option\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ Print the info of EPS(Entry Point Structure)\r
+\r
+Arguments:\r
+ SmbiosTable - Pointer to the SMBIOS table entry point\r
+ Option - Display option\r
+\r
+Returns: None\r
+\r
+**/\r
+{\r
+ UINT8 Anchor[5];\r
+ UINT8 InAnchor[6];\r
+\r
+ if (SmbiosTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMBIOSTABLE_NULL), gShellDebug1HiiHandle);\r
+ return ;\r
+ }\r
+\r
+ if (Option == SHOW_NONE) {\r
+ return ;\r
+ }\r
+\r
+ if (Option >= SHOW_NORMAL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_SIGN), gShellDebug1HiiHandle);\r
+ MemToString (Anchor, SmbiosTable->AnchorString, 4);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ANCHOR_STR), gShellDebug1HiiHandle, Anchor);\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EPS_CHECKSUM),\r
+ gShellDebug1HiiHandle,\r
+ SmbiosTable->EntryPointStructureChecksum\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_LEN), gShellDebug1HiiHandle, SmbiosTable->EntryPointLength);\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VERSION),\r
+ gShellDebug1HiiHandle,\r
+ SmbiosTable->MajorVersion,\r
+ SmbiosTable->MinorVersion\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NUMBER_STRUCT),\r
+ gShellDebug1HiiHandle,\r
+ SmbiosTable->NumberOfSmbiosStructures\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_STRUCT_SIZE), gShellDebug1HiiHandle, SmbiosTable->MaxStructureSize);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_ADDR), gShellDebug1HiiHandle, SmbiosTable->TableAddress);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TABLE_LENGTH), gShellDebug1HiiHandle, SmbiosTable->TableLength);\r
+\r
+ }\r
+ //\r
+ // If SHOW_ALL, also print followings.\r
+ //\r
+ if (Option >= SHOW_DETAIL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENTRY_POINT_REVISION),\r
+ gShellDebug1HiiHandle,\r
+ SmbiosTable->EntryPointRevision\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BCD_REVISION), gShellDebug1HiiHandle, SmbiosTable->SmbiosBcdRevision);\r
+ //\r
+ // Since raw data is not string, add a NULL terminater.\r
+ //\r
+ MemToString (InAnchor, SmbiosTable->IntermediateAnchorString, 5);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_ACHOR), gShellDebug1HiiHandle, InAnchor);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTER_CHECKSUM), gShellDebug1HiiHandle, SmbiosTable->IntermediateChecksum);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMATTED_AREA), gShellDebug1HiiHandle);\r
+ DumpHex (2, 0, 5, SmbiosTable->FormattedArea);\r
+ }\r
+\r
+ Print (L"\n");\r
+}\r
+\r
+EFI_STATUS\r
+SmbiosPrintStructure (\r
+ IN SMBIOS_STRUCTURE_POINTER *pStruct,\r
+ IN UINT8 Option\r
+ )\r
+/*++\r
+\r
+Routine Description:\r
+ This function print the content of the structure pointed by pStruct\r
+\r
+Arguments:\r
+ pStruct - point to the structure to be printed\r
+ Option - print option of information detail\r
+\r
+Returns:\r
+ EFI_SUCCESS - Successfully Printing this function\r
+ EFI_INVALID_PARAMETER - Invalid Structure\r
+ EFI_UNSUPPORTED - Unsupported\r
+\r
+**/\r
+{\r
+ UINT8 Index;\r
+ UINT8 *Buffer;\r
+\r
+ Buffer = (UINT8 *) (UINTN) (pStruct->Raw);\r
+\r
+ if (pStruct == NULL) {\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+\r
+ if (Option == SHOW_NONE) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Display structure header\r
+ //\r
+ DisplayStructureTypeInfo (pStruct->Hdr->Type, SHOW_DETAIL);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FORMAT_PART_LEN), gShellDebug1HiiHandle, pStruct->Hdr->Length);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, pStruct->Hdr->Handle);\r
+\r
+ if (Option == SHOW_OUTLINE) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ switch (pStruct->Hdr->Type) {\r
+ //\r
+ //\r
+ //\r
+ case 0:\r
+ PrintPendingString (pStruct, Type0, Vendor);\r
+ PrintPendingString (pStruct, Type0, BiosVersion);\r
+ PrintStructValue (pStruct, Type0, BiosSegment);\r
+ PrintPendingString (pStruct, Type0, BiosReleaseDate);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SIZE), gShellDebug1HiiHandle, 64 * (pStruct->Type0->BiosSize + 1));\r
+\r
+ if (Option < SHOW_DETAIL) {\r
+ PrintStructValueH (pStruct, Type0, BiosCharacteristics);\r
+ } else {\r
+ DisplayBiosCharacteristics (pStruct->Type0->BiosCharacteristics, Option);\r
+\r
+ //\r
+ // The length of above format part is 0x12 bytes,\r
+ // Ext bytes are following, size = 'len-0x12'.\r
+ // If len-0x12 > 0, then\r
+ // there are extension bytes (byte1, byte2, byte3...)\r
+ // And byte3 not stated in spec, so dump all extension bytes(1, 2, 3..)\r
+ //\r
+ if ((Buffer[1] - (CHAR8) 0x12) > 0) {\r
+ DisplayBiosCharacteristicsExt1 (Buffer[0x12], Option);\r
+ }\r
+\r
+ if ((Buffer[1] - (CHAR8) 0x12) > 1) {\r
+ DisplayBiosCharacteristicsExt2 (Buffer[0x13], Option);\r
+ }\r
+\r
+ if ((Buffer[1] - (CHAR8) 0x12) > 2) {\r
+ PrintBitField (\r
+ pStruct,\r
+ Type0,\r
+ BiosCharacteristics,\r
+ Buffer[1] - (CHAR8) 0x12\r
+ );\r
+ }\r
+ }\r
+ break;\r
+\r
+ //\r
+ // System Information (Type 1)\r
+ //\r
+ case 1:\r
+ PrintPendingString (pStruct, Type1, Manufacturer);\r
+ PrintPendingString (pStruct, Type1, ProductName);\r
+ PrintPendingString (pStruct, Type1, Version);\r
+ PrintPendingString (pStruct, Type1, SerialNumber);\r
+ PrintBitField (pStruct, Type1, Uuid, 16);\r
+ DisplaySystemWakeupType (pStruct->Type1->WakeUpType, Option);\r
+ break;\r
+\r
+ case 2:\r
+ PrintPendingString (pStruct, Type2, Manufacturer);\r
+ PrintPendingString (pStruct, Type2, ProductName);\r
+ PrintPendingString (pStruct, Type2, Version);\r
+ PrintPendingString (pStruct, Type2, SerialNumber);\r
+ break;\r
+\r
+ //\r
+ // System Enclosure (Type 3)\r
+ //\r
+ case 3:\r
+ PrintPendingString (pStruct, Type3, Manufacturer);\r
+ PrintStructValue (pStruct, Type3, Type);\r
+ DisplaySystemEnclosureType (pStruct->Type3->Type, Option);\r
+ PrintPendingString (pStruct, Type3, Version);\r
+ PrintPendingString (pStruct, Type3, SerialNumber);\r
+ PrintPendingString (pStruct, Type3, AssetTag);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOTUP_STATE), gShellDebug1HiiHandle);\r
+ DisplaySystemEnclosureStatus (pStruct->Type3->BootupState, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_STATE), gShellDebug1HiiHandle);\r
+ DisplaySystemEnclosureStatus (pStruct->Type3->PowerSupplyState, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THERMAL_STATE), gShellDebug1HiiHandle);\r
+ DisplaySystemEnclosureStatus (pStruct->Type3->ThermalState, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SECURITY_STATUS), gShellDebug1HiiHandle);\r
+ DisplaySESecurityStatus (pStruct->Type3->SecurityStatus, Option);\r
+ PrintBitField (pStruct, Type3, OemDefined, 4);\r
+ break;\r
+\r
+ //\r
+ // Processor Information (Type 4)\r
+ //\r
+ case 4:\r
+ PrintStructValue (pStruct, Type4, Socket);\r
+ DisplayProcessorType (pStruct->Type4->ProcessorType, Option);\r
+ if ((SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) &&\r
+ (pStruct->Type4->ProcessorFamily == 0xFE)) {\r
+ //\r
+ // Get family from ProcessorFamily2 field\r
+ //\r
+ DisplayProcessorFamily2 (pStruct->Type4->ProcessorFamily2, Option);\r
+ } else {\r
+ DisplayProcessorFamily (pStruct->Type4->ProcessorFamily, Option);\r
+ }\r
+ PrintPendingString (pStruct, Type4, ProcessorManufacture);\r
+ PrintBitField (pStruct, Type4, ProcessorId, 8);\r
+ PrintPendingString (pStruct, Type4, ProcessorVersion);\r
+ DisplayProcessorVoltage (pStruct->Type4->Voltage, Option);\r
+ PrintStructValue (pStruct, Type4, ExternalClock);\r
+ PrintStructValue (pStruct, Type4, MaxSpeed);\r
+ PrintStructValue (pStruct, Type4, CurrentSpeed);\r
+ DisplayProcessorStatus (pStruct->Type4->Status, Option);\r
+ DisplayProcessorUpgrade (pStruct->Type4->ProcessorUpgrade, Option);\r
+ PrintStructValueH (pStruct, Type4, L1CacheHandle);\r
+ PrintStructValueH (pStruct, Type4, L2CacheHandle);\r
+ PrintStructValueH (pStruct, Type4, L3CacheHandle);\r
+ PrintPendingString (pStruct, Type4, SerialNumber);\r
+ PrintPendingString (pStruct, Type4, AssetTag);\r
+ PrintPendingString (pStruct, Type4, PartNumber);\r
+ if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x5)) {\r
+ PrintStructValue (pStruct, Type4, CoreCount);\r
+ PrintStructValue (pStruct, Type4, EnabledCoreCount);\r
+ PrintStructValue (pStruct, Type4, ThreadCount);\r
+ PrintStructValueH (pStruct, Type4, ProcessorCharacteristics);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // Memory Controller Information (Type 5)\r
+ //\r
+ case 5:\r
+ {\r
+ UINT8 SlotNum;\r
+ SlotNum = pStruct->Type5->AssociatedMemorySlotNum;\r
+\r
+ DisplayMcErrorDetectMethod (pStruct->Type5->ErrDetectMethod, Option);\r
+ DisplayMcErrorCorrectCapability (pStruct->Type5->ErrCorrectCapability, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRT), gShellDebug1HiiHandle);\r
+ DisplayMcInterleaveSupport (pStruct->Type5->SupportInterleave, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CURRENT), gShellDebug1HiiHandle);\r
+ DisplayMcInterleaveSupport (pStruct->Type5->CurrentInterleave, Option);\r
+ DisplayMaxMemoryModuleSize (pStruct->Type5->MaxMemoryModuleSize, SlotNum, Option);\r
+ DisplayMcMemorySpeeds (pStruct->Type5->SupportSpeed, Option);\r
+ DisplayMmMemoryType (pStruct->Type5->SupportMemoryType, Option);\r
+ DisplayMemoryModuleVoltage (pStruct->Type5->MemoryModuleVoltage, Option);\r
+ PrintStructValue (pStruct, Type5, AssociatedMemorySlotNum);\r
+ //\r
+ // According to SMBIOS Specification, offset 0x0F\r
+ //\r
+ DisplayMemoryModuleConfigHandles ((UINT16 *) (&Buffer[0x0F]), SlotNum, Option);\r
+ DisplayMcErrorCorrectCapability (Buffer[0x0F + 2 * SlotNum], Option);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // Memory Module Information (Type 6)\r
+ //\r
+ case 6:\r
+ PrintPendingString (pStruct, Type6, SocketDesignation);\r
+ DisplayMmBankConnections (pStruct->Type6->BankConnections, Option);\r
+ PrintStructValue (pStruct, Type6, CurrentSpeed);\r
+ DisplayMmMemoryType (pStruct->Type6->CurrentMemoryType, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INSTALLED), gShellDebug1HiiHandle);\r
+ DisplayMmMemorySize (pStruct->Type6->InstalledSize, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED), gShellDebug1HiiHandle);\r
+ DisplayMmMemorySize (pStruct->Type6->EnabledSize, Option);\r
+ DisplayMmErrorStatus (pStruct->Type6->ErrorStatus, Option);\r
+ break;\r
+\r
+ //\r
+ // Cache Information (Type 7)\r
+ //\r
+ case 7:\r
+ PrintPendingString (pStruct, Type7, SocketDesignation);\r
+ PrintStructValueH (pStruct, Type7, CacheConfiguration);\r
+ PrintStructValueH (pStruct, Type7, MaximumCacheSize);\r
+ PrintStructValueH (pStruct, Type7, InstalledSize);\r
+ PrintStructValueH (pStruct, Type7, SupportedSRAMType);\r
+ PrintStructValueH (pStruct, Type7, CurrentSRAMType);\r
+ DisplayCacheSRAMType (pStruct->Type7->CurrentSRAMType, Option);\r
+ PrintStructValueH (pStruct, Type7, CacheSpeed);\r
+ DisplayCacheErrCorrectingType (pStruct->Type7->ErrorCorrectionType, Option);\r
+ DisplayCacheSystemCacheType (pStruct->Type7->SystemCacheType, Option);\r
+ DisplayCacheAssociativity (pStruct->Type7->Associativity, Option);\r
+ break;\r
+\r
+ //\r
+ // Port Connector Information (Type 8)\r
+ //\r
+ case 8:\r
+ PrintPendingString (pStruct, Type8, InternalReferenceDesignator);\r
+ Print (L"Internal ");\r
+ DisplayPortConnectorType (pStruct->Type8->InternalConnectorType, Option);\r
+ PrintPendingString (pStruct, Type8, ExternalReferenceDesignator);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EXTERNAL), gShellDebug1HiiHandle);\r
+ DisplayPortConnectorType (pStruct->Type8->ExternalConnectorType, Option);\r
+ DisplayPortType (pStruct->Type8->PortType, Option);\r
+ break;\r
+\r
+ //\r
+ // System Slots (Type 9)\r
+ //\r
+ case 9:\r
+ PrintPendingString (pStruct, Type9, SlotDesignation);\r
+ DisplaySystemSlotType (pStruct->Type9->SlotType, Option);\r
+ DisplaySystemSlotDataBusWidth (pStruct->Type9->SlotDataBusWidth, Option);\r
+ DisplaySystemSlotCurrentUsage (pStruct->Type9->CurrentUsage, Option);\r
+ DisplaySystemSlotLength (pStruct->Type9->SlotLength, Option);\r
+ DisplaySystemSlotId (\r
+ pStruct->Type9->SlotID,\r
+ pStruct->Type9->SlotType,\r
+ Option\r
+ );\r
+ DisplaySlotCharacteristics1 (pStruct->Type9->SlotCharacteristics1, Option);\r
+ DisplaySlotCharacteristics2 (pStruct->Type9->SlotCharacteristics2, Option);\r
+ if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) {\r
+ PrintStructValueH (pStruct, Type9, SegmentGroupNum);\r
+ PrintStructValueH (pStruct, Type9, BusNum);\r
+ PrintStructValueH (pStruct, Type9, DevFuncNum);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // On Board Devices Information (Type 10)\r
+ //\r
+ case 10:\r
+ {\r
+ UINTN NumOfDevice;\r
+ NumOfDevice = (pStruct->Type10->Hdr.Length - sizeof (SMBIOS_HEADER)) / (2 * sizeof (UINT8));\r
+ for (Index = 0; Index < NumOfDevice; Index++) {\r
+ DisplayOnboardDeviceTypes (pStruct->Type10->Device[Index].DeviceType, Option);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DESC_STRING), gShellDebug1HiiHandle);\r
+ ShellPrintEx(-1,-1,L"%a",LibGetSmbiosString (pStruct, pStruct->Type10->Device[Index].DescriptionString));\r
+ }\r
+ }\r
+ break;\r
+\r
+ case 11:\r
+ PrintStructValue (pStruct, Type11, StringCount);\r
+ for (Index = 1; Index <= pStruct->Type11->StringCount; Index++) {\r
+ ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (pStruct, Index));\r
+ }\r
+ break;\r
+\r
+ case 12:\r
+ PrintStructValue (pStruct, Type12, StringCount);\r
+ for (Index = 1; Index <= pStruct->Type12->StringCount; Index++) {\r
+ ShellPrintEx(-1,-1,L"%a\n", LibGetSmbiosString (pStruct, Index));\r
+ }\r
+ break;\r
+\r
+ case 13:\r
+ PrintStructValue (pStruct, Type13, InstallableLanguages);\r
+ PrintStructValue (pStruct, Type13, Flags);\r
+ PrintBitField (pStruct, Type13, reserved, 15);\r
+ PrintPendingString (pStruct, Type13, CurrentLanguages);\r
+ break;\r
+\r
+ case 14:\r
+ PrintPendingString (pStruct, Type14, GroupName);\r
+ PrintStructValue (pStruct, Type14, ItemType);\r
+ PrintStructValue (pStruct, Type14, ItemHandle);\r
+ break;\r
+\r
+ //\r
+ // System Event Log (Type 15)\r
+ //\r
+ case 15:\r
+ {\r
+ EVENTLOGTYPE *Ptr;\r
+ UINT8 Count;\r
+ UINT8 *AccessMethodAddress;\r
+\r
+ PrintStructValueH (pStruct, Type15, LogAreaLength);\r
+ PrintStructValueH (pStruct, Type15, LogHeaderStartOffset);\r
+ PrintStructValueH (pStruct, Type15, LogDataStartOffset);\r
+ DisplaySELAccessMethod (pStruct->Type15->AccessMethod, Option);\r
+ PrintStructValueH (pStruct, Type15, AccessMethodAddress);\r
+ DisplaySELLogStatus (pStruct->Type15->LogStatus, Option);\r
+ PrintStructValueH (pStruct, Type15, LogChangeToken);\r
+ DisplaySysEventLogHeaderFormat (pStruct->Type15->LogHeaderFormat, Option);\r
+ PrintStructValueH (pStruct, Type15, NumberOfSupportedLogTypeDescriptors);\r
+ PrintStructValueH (pStruct, Type15, LengthOfLogTypeDescriptor);\r
+\r
+ Count = pStruct->Type15->NumberOfSupportedLogTypeDescriptors;\r
+ if (Count > 0) {\r
+ Ptr = pStruct->Type15->EventLogTypeDescriptors;\r
+\r
+ //\r
+ // Display all Event Log type descriptors supported by system\r
+ //\r
+ for (Index = 0; Index < Count; Index++, Ptr++) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SUPOPRTED_EVENT), gShellDebug1HiiHandle, Index + 1);\r
+ DisplaySELTypes (Ptr->LogType, Option);\r
+ DisplaySELVarDataFormatType (Ptr->DataFormatType, Option);\r
+ }\r
+\r
+ if (Option >= SHOW_DETAIL) {\r
+ switch (pStruct->Type15->AccessMethod) {\r
+ case 03:\r
+ AccessMethodAddress = (UINT8 *) (UINTN) (pStruct->Type15->AccessMethodAddress);\r
+ break;\r
+\r
+ case 00:\r
+ case 01:\r
+ case 02:\r
+ case 04:\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACCESS_METHOD_NOT_SUPOPRTED),\r
+ gShellDebug1HiiHandle,\r
+ pStruct->Type15->AccessMethod\r
+ );\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+ //\r
+ // Display Event Log Header\r
+ //\r
+ // Starting offset (or index) within the nonvolatile storage\r
+ // of the event-log's header, from the Access Method Address\r
+ //\r
+ DisplaySysEventLogHeader (\r
+ pStruct->Type15->LogHeaderFormat,\r
+ AccessMethodAddress + pStruct->Type15->LogHeaderStartOffset\r
+ );\r
+\r
+ //\r
+ // Display all Event Log data\r
+ //\r
+ // Starting offset (or index) within the nonvolatile storage\r
+ // of the event-log's first data byte, from the Access Method Address(0x14)\r
+ //\r
+ DisplaySysEventLogData (\r
+ AccessMethodAddress + pStruct->Type15->LogDataStartOffset,\r
+ (UINT16)\r
+ (\r
+ pStruct->Type15->LogAreaLength -\r
+ (pStruct->Type15->LogDataStartOffset - pStruct->Type15->LogDataStartOffset)\r
+ )\r
+ );\r
+ }\r
+\r
+ }\r
+ }\r
+ break;\r
+\r
+ //\r
+ // Physical Memory Array (Type 16)\r
+ //\r
+ case 16:\r
+ DisplayPMALocation (pStruct->Type16->Location, Option);\r
+ DisplayPMAUse (pStruct->Type16->Use, Option);\r
+ DisplayPMAErrorCorrectionTypes (\r
+ pStruct->Type16->MemoryErrorCorrection,\r
+ Option\r
+ );\r
+ PrintStructValueH (pStruct, Type16, MaximumCapacity);\r
+ PrintStructValueH (pStruct, Type16, MemoryErrorInformationHandle);\r
+ PrintStructValueH (pStruct, Type16, NumberOfMemoryDevices);\r
+ break;\r
+\r
+ //\r
+ // Memory Device (Type 17)\r
+ //\r
+ case 17:\r
+ PrintStructValueH (pStruct, Type17, MemoryArrayHandle);\r
+ PrintStructValueH (pStruct, Type17, MemoryErrorInformationHandle);\r
+ PrintStructValue (pStruct, Type17, TotalWidth);\r
+ PrintStructValue (pStruct, Type17, DataWidth);\r
+ PrintStructValue (pStruct, Type17, Size);\r
+ DisplayMemoryDeviceFormFactor (pStruct->Type17->FormFactor, Option);\r
+ PrintStructValueH (pStruct, Type17, DeviceSet);\r
+ PrintPendingString (pStruct, Type17, DeviceLocator);\r
+ PrintPendingString (pStruct, Type17, BankLocator);\r
+ DisplayMemoryDeviceType (pStruct->Type17->MemoryType, Option);\r
+ DisplayMemoryDeviceTypeDetail (pStruct->Type17->TypeDetail, Option);\r
+ PrintStructValueH (pStruct, Type17, Speed);\r
+ PrintPendingString (pStruct, Type17, Manufacturer);\r
+ PrintPendingString (pStruct, Type17, SerialNumber);\r
+ PrintPendingString (pStruct, Type17, AssetTag);\r
+ PrintPendingString (pStruct, Type17, PartNumber);\r
+ if (SmbiosMajorVersion > 0x2 || (SmbiosMajorVersion == 0x2 && SmbiosMinorVersion >= 0x6)) {\r
+ PrintStructValueH (pStruct, Type17, Attributes);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // 32-bit Memory Error Information (Type 18)\r
+ //\r
+ case 18:\r
+ DisplayMemoryErrorType (pStruct->Type18->ErrorType, Option);\r
+ DisplayMemoryErrorGranularity (\r
+ pStruct->Type18->ErrorGranularity,\r
+ Option\r
+ );\r
+ DisplayMemoryErrorOperation (pStruct->Type18->ErrorOperation, Option);\r
+ PrintStructValueH (pStruct, Type18, VendorSyndrome);\r
+ PrintStructValueH (pStruct, Type18, MemoryArrayErrorAddress);\r
+ PrintStructValueH (pStruct, Type18, DeviceErrorAddress);\r
+ PrintStructValueH (pStruct, Type18, ErrorResolution);\r
+ break;\r
+\r
+ //\r
+ // Memory Array Mapped Address (Type 19)\r
+ //\r
+ case 19:\r
+ PrintStructValueH (pStruct, Type19, StartingAddress);\r
+ PrintStructValueH (pStruct, Type19, EndingAddress);\r
+ PrintStructValueH (pStruct, Type19, MemoryArrayHandle);\r
+ PrintStructValueH (pStruct, Type19, PartitionWidth);\r
+ break;\r
+\r
+ //\r
+ // Memory Device Mapped Address (Type 20)\r
+ //\r
+ case 20:\r
+ PrintStructValueH (pStruct, Type20, StartingAddress);\r
+ PrintStructValueH (pStruct, Type20, EndingAddress);\r
+ PrintStructValueH (pStruct, Type20, MemoryDeviceHandle);\r
+ PrintStructValueH (pStruct, Type20, MemoryArrayMappedAddressHandle);\r
+ PrintStructValueH (pStruct, Type20, PartitionRowPosition);\r
+ PrintStructValueH (pStruct, Type20, InterleavePosition);\r
+ PrintStructValueH (pStruct, Type20, InterleavedDataDepth);\r
+ break;\r
+\r
+ //\r
+ // Built-in Pointing Device (Type 21)\r
+ //\r
+ case 21:\r
+ DisplayPointingDeviceType (pStruct->Type21->Type, Option);\r
+ DisplayPointingDeviceInterface (pStruct->Type21->Interface, Option);\r
+ PrintStructValue (pStruct, Type21, NumberOfButtons);\r
+ break;\r
+\r
+ //\r
+ // Portable Battery (Type 22)\r
+ //\r
+ case 22:\r
+ PrintPendingString (pStruct, Type22, Location);\r
+ PrintPendingString (pStruct, Type22, Manufacturer);\r
+ PrintPendingString (pStruct, Type22, ManufactureDate);\r
+ PrintPendingString (pStruct, Type22, SerialNumber);\r
+ PrintPendingString (pStruct, Type22, DeviceName);\r
+ DisplayPBDeviceChemistry (\r
+ pStruct->Type22->DeviceChemistry,\r
+ Option\r
+ );\r
+ PrintStructValueH (pStruct, Type22, DeviceCapacity);\r
+ PrintStructValueH (pStruct, Type22, DesignVoltage);\r
+ PrintPendingString (pStruct, Type22, SBDSVersionNumber);\r
+ PrintStructValueH (pStruct, Type22, MaximumErrorInBatteryData);\r
+ PrintStructValueH (pStruct, Type22, SBDSSerialNumber);\r
+ DisplaySBDSManufactureDate (\r
+ pStruct->Type22->SBDSManufactureDate,\r
+ Option\r
+ );\r
+ PrintPendingString (pStruct, Type22, SBDSDeviceChemistry);\r
+ PrintStructValueH (pStruct, Type22, DesignCapacityMultiplier);\r
+ PrintStructValueH (pStruct, Type22, OEMSpecific);\r
+ break;\r
+\r
+ case 23:\r
+ DisplaySystemResetCapabilities (\r
+ pStruct->Type23->Capabilities,\r
+ Option\r
+ );\r
+ PrintStructValueH (pStruct, Type23, ResetCount);\r
+ PrintStructValueH (pStruct, Type23, ResetLimit);\r
+ PrintStructValueH (pStruct, Type23, TimerInterval);\r
+ PrintStructValueH (pStruct, Type23, Timeout);\r
+ break;\r
+\r
+ case 24:\r
+ DisplayHardwareSecuritySettings (\r
+ pStruct->Type24->HardwareSecuritySettings,\r
+ Option\r
+ );\r
+ break;\r
+\r
+ case 25:\r
+ PrintStructValueH (pStruct, Type25, NextScheduledPowerOnMonth);\r
+ PrintStructValueH (pStruct, Type25, NextScheduledPowerOnDayOfMonth);\r
+ PrintStructValueH (pStruct, Type25, NextScheduledPowerOnHour);\r
+ PrintStructValueH (pStruct, Type25, NextScheduledPowerOnMinute);\r
+ PrintStructValueH (pStruct, Type25, NextScheduledPowerOnSecond);\r
+ break;\r
+\r
+ case 26:\r
+ PrintPendingString (pStruct, Type26, Description);\r
+ DisplayVPLocation (pStruct->Type26->LocationAndStatus, Option);\r
+ DisplayVPStatus (pStruct->Type26->LocationAndStatus, Option);\r
+ PrintStructValueH (pStruct, Type26, MaximumValue);\r
+ PrintStructValueH (pStruct, Type26, MinimumValue);\r
+ PrintStructValueH (pStruct, Type26, Resolution);\r
+ PrintStructValueH (pStruct, Type26, Tolerance);\r
+ PrintStructValueH (pStruct, Type26, Accuracy);\r
+ PrintStructValueH (pStruct, Type26, OEMDefined);\r
+ PrintStructValueH (pStruct, Type26, NominalValue);\r
+ break;\r
+\r
+ case 27:\r
+ PrintStructValueH (pStruct, Type27, TemperatureProbeHandle);\r
+ DisplayCoolingDeviceStatus (pStruct->Type27->DeviceTypeAndStatus, Option);\r
+ DisplayCoolingDeviceType (pStruct->Type27->DeviceTypeAndStatus, Option);\r
+ PrintStructValueH (pStruct, Type27, CoolingUnitGroup);\r
+ PrintStructValueH (pStruct, Type27, OEMDefined);\r
+ PrintStructValueH (pStruct, Type27, NominalSpeed);\r
+ break;\r
+\r
+ case 28:\r
+ PrintPendingString (pStruct, Type28, Description);\r
+ DisplayTemperatureProbeStatus (pStruct->Type28->LocationAndStatus, Option);\r
+ DisplayTemperatureProbeLoc (pStruct->Type28->LocationAndStatus, Option);\r
+ PrintStructValueH (pStruct, Type28, MaximumValue);\r
+ PrintStructValueH (pStruct, Type28, MinimumValue);\r
+ PrintStructValueH (pStruct, Type28, Resolution);\r
+ PrintStructValueH (pStruct, Type28, Tolerance);\r
+ PrintStructValueH (pStruct, Type28, Accuracy);\r
+ PrintStructValueH (pStruct, Type28, OEMDefined);\r
+ PrintStructValueH (pStruct, Type28, NominalValue);\r
+ break;\r
+\r
+ case 29:\r
+ PrintPendingString (pStruct, Type29, Description);\r
+ DisplayECPStatus (pStruct->Type29->LocationAndStatus, Option);\r
+ DisplayECPLoc (pStruct->Type29->LocationAndStatus, Option);\r
+ PrintStructValueH (pStruct, Type29, MaximumValue);\r
+ PrintStructValueH (pStruct, Type29, MinimumValue);\r
+ PrintStructValueH (pStruct, Type29, Resolution);\r
+ PrintStructValueH (pStruct, Type29, Tolerance);\r
+ PrintStructValueH (pStruct, Type29, Accuracy);\r
+ PrintStructValueH (pStruct, Type29, OEMDefined);\r
+ PrintStructValueH (pStruct, Type29, NominalValue);\r
+ break;\r
+\r
+ case 30:\r
+ PrintPendingString (pStruct, Type30, ManufacturerName);\r
+ DisplayOBRAConnections (pStruct->Type30->Connections, Option);\r
+ break;\r
+\r
+ case 31:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE31), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 32:\r
+ PrintBitField (pStruct, Type32, Reserved, 6);\r
+ DisplaySystemBootStatus (pStruct->Type32->BootStatus[0], Option);\r
+ break;\r
+\r
+ case 33:\r
+ DisplayMemoryErrorType (pStruct->Type33->ErrorType, Option);\r
+ DisplayMemoryErrorGranularity (\r
+ pStruct->Type33->ErrorGranularity,\r
+ Option\r
+ );\r
+ DisplayMemoryErrorOperation (pStruct->Type33->ErrorOperation, Option);\r
+ PrintStructValueH (pStruct, Type33, VendorSyndrome);\r
+ PrintStructValueH (pStruct, Type33, MemoryArrayErrorAddress);\r
+ PrintStructValueH (pStruct, Type33, DeviceErrorAddress);\r
+ PrintStructValueH (pStruct, Type33, ErrorResolution);\r
+ break;\r
+\r
+ //\r
+ // Management Device (Type 34)\r
+ //\r
+ case 34:\r
+ PrintPendingString (pStruct, Type34, Description);\r
+ DisplayMDType (pStruct->Type34->Type, Option);\r
+ PrintStructValueH (pStruct, Type34, Address);\r
+ PrintStructValueH (pStruct, Type34, AddressType);\r
+ break;\r
+\r
+ case 35:\r
+ PrintPendingString (pStruct, Type35, Description);\r
+ PrintStructValueH (pStruct, Type35, ManagementDeviceHandle);\r
+ PrintStructValueH (pStruct, Type35, ComponentHandle);\r
+ PrintStructValueH (pStruct, Type35, ThresholdHandle);\r
+ break;\r
+\r
+ case 36:\r
+ PrintStructValueH (pStruct, Type36, LowerThresholdNonCritical);\r
+ PrintStructValueH (pStruct, Type36, UpperThresholdNonCritical);\r
+ PrintStructValueH (pStruct, Type36, LowerThresholdCritical);\r
+ PrintStructValueH (pStruct, Type36, UpperThresholdCritical);\r
+ PrintStructValueH (pStruct, Type36, LowerThresholdNonRecoverable);\r
+ PrintStructValueH (pStruct, Type36, UpperThresholdNonRecoverable);\r
+ break;\r
+\r
+ //\r
+ // Memory Channel (Type 37)\r
+ //\r
+ case 37:\r
+ {\r
+ UINT8 Count;\r
+ MEMORYDEVICE *Ptr;\r
+ DisplayMemoryChannelType (pStruct->Type37->ChannelType, Option);\r
+ PrintStructValueH (pStruct, Type37, MaximumChannelLoad);\r
+ PrintStructValueH (pStruct, Type37, MemoryDeviceCount);\r
+\r
+ Count = pStruct->Type37->MemoryDeviceCount;\r
+ Ptr = pStruct->Type37->MemoryDevice;\r
+ for (Index = 0; Index < Count; Index++) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_DEVICE), gShellDebug1HiiHandle, Index + 1);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_LOAD), gShellDebug1HiiHandle, Ptr->DeviceLoad);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DEV_HANDLE), gShellDebug1HiiHandle, Ptr->DeviceHandle);\r
+ }\r
+ }\r
+ break;\r
+\r
+ //\r
+ // IPMI Device Information (Type 38)\r
+ //\r
+ case 38:\r
+ DisplayIPMIDIBMCInterfaceType (pStruct->Type38->InterfaceType, Option);\r
+ PrintStructValueH (pStruct, Type38, IPMISpecificationRevision);\r
+ PrintStructValueH (pStruct, Type38, I2CSlaveAddress);\r
+ PrintStructValueH (pStruct, Type38, NVStorageDeviceAddress);\r
+ PrintStructValueH (pStruct, Type38, BaseAddress);\r
+ break;\r
+\r
+ //\r
+ // System Power Supply (Type 39)\r
+ //\r
+ case 39:\r
+ PrintStructValueH (pStruct, Type39, PowerUnitGroup);\r
+ PrintPendingString (pStruct, Type39, Location);\r
+ PrintPendingString (pStruct, Type39, DeviceName);\r
+ PrintPendingString (pStruct, Type39, Manufacturer);\r
+ PrintPendingString (pStruct, Type39, SerialNumber);\r
+ PrintPendingString (pStruct, Type39, AssetTagNumber);\r
+ PrintPendingString (pStruct, Type39, ModelPartNumber);\r
+ PrintPendingString (pStruct, Type39, RevisionLevel);\r
+ PrintStructValueH (pStruct, Type39, MaxPowerCapacity);\r
+ DisplaySPSCharacteristics (\r
+ pStruct->Type39->PowerSupplyCharacteristics,\r
+ Option\r
+ );\r
+ PrintStructValueH (pStruct, Type39, InputVoltageProbeHandle);\r
+ PrintStructValueH (pStruct, Type39, CoolingDeviceHandle);\r
+ PrintStructValueH (pStruct, Type39, InputCurrentProbeHandle);\r
+ break;\r
+\r
+ //\r
+ // Additional Information (Type 40)\r
+ //\r
+ case 40:\r
+ {\r
+ UINT8 NumberOfEntries;\r
+ UINT8 EntryLength;\r
+ ADDITIONAL_INFORMATION_ENTRY *Entries;\r
+\r
+ EntryLength = 0;\r
+ Entries = pStruct->Type40->AdditionalInfoEntries;\r
+ NumberOfEntries = pStruct->Type40->NumberOfAdditionalInformationEntries;\r
+\r
+ PrintStructValueH (pStruct, Type40, NumberOfAdditionalInformationEntries);\r
+\r
+ for (Index = 0; Index < NumberOfEntries; Index++) {\r
+ EntryLength = Entries->EntryLength;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTRYLEN), gShellDebug1HiiHandle, EntryLength);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDHANDLE), gShellDebug1HiiHandle, Entries->ReferencedHandle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_REFERENCEDOFFSET), gShellDebug1HiiHandle, Entries->ReferencedOffset);\r
+ PrintSmbiosString (pStruct, Entries->EntryString, String);\r
+ PrintSmbiosBitField (pStruct, Entries->Value, Value, EntryLength - 5);\r
+ Entries = (ADDITIONAL_INFORMATION_ENTRY *) ((UINT8 *)Entries + EntryLength);\r
+ }\r
+ }\r
+ break;\r
+\r
+ //\r
+ // Onboard Devices Extended Information (Type 41)\r
+ //\r
+ case 41:\r
+ PrintPendingString (pStruct, Type41, ReferenceDesignation);\r
+ PrintStructValueH (pStruct, Type41, DeviceType);\r
+ PrintStructValueH (pStruct, Type41, DeviceTypeInstance);\r
+ PrintStructValueH (pStruct, Type41, SegmentGroupNum);\r
+ PrintStructValueH (pStruct, Type41, BusNum);\r
+ PrintStructValueH (pStruct, Type41, DevFuncNum);\r
+ break;\r
+\r
+ case 126:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INACTIVE_STRUCT), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 127:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_THIS_STRUCT_END_TABLE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STRUCT_TYPE_UNDEFINED), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+VOID\r
+DisplayBiosCharacteristics (\r
+ UINT64 chara,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print header\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR), gShellDebug1HiiHandle);\r
+ //\r
+ // print option\r
+ //\r
+ PRINT_INFO_OPTION (chara, Option);\r
+\r
+ //\r
+ // Check all the bits and print information\r
+ // This function does not use Table because table of bits\r
+ // are designed not to deal with UINT64\r
+ //\r
+ if (BIT (chara, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_BIT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 2) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN_BIT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 3) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_NOT_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 4) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ISA_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 5) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MSA_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 6) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EISA_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PCI_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 8) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PC_CARD_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 9) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PLUG_PLAY_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 10) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_APM_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 11) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_UPGRADEABLE), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 12) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_SHADOWING), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 13) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VESA_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 14) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ECSD_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 15) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FORM_CD_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 16) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SELECTED_BOOT_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 17) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_ROM_SOCKETED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 18) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_FROM_PC_CARD), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 19) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_EDD_ENHANCED_DRIVER), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 20) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_NEC), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 21) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_JAPANESE_FLOPPY_TOSHIBA), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 22) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FLOPPY_SERVICES_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 23) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_POINT_TWO_MB), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 24) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_720_KB), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 25) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TWO_POINT_EIGHT_EIGHT_MB), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 26) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINT_SCREEN_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 27) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_SERV_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 28) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SERIAL_SERVICES_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 29) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRINTER_SERVICES_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 30) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONO_VIDEO_SUPPORT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (chara, 31) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NEC_PC_98), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Just print the reserved\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_32_47), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_48_64), gShellDebug1HiiHandle);\r
+}\r
+\r
+VOID\r
+DisplayBiosCharacteristicsExt1 (\r
+ UINT8 byte1,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (byte1, Option);\r
+\r
+ //\r
+ // check bit and print\r
+ //\r
+ if (BIT (byte1, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ACPI_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USB_LEGACY_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 2) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AGP_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 3) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_I2O_BOOT_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 4) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LS_120_BOOT_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 5) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ATAPI_ZIP_DRIVE), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 6) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_1394_BOOT_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte1, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SMART_BATTERY_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayBiosCharacteristicsExt2 (\r
+ UINT8 byte2,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_CHAR_EXTENSION_2), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (byte2, Option);\r
+\r
+ if (BIT (byte2, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIOS_BOOT_SPEC_SUPP), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (byte2, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FUNCTION_KEY_INIT), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RSVD_FOR_FUTURE), gShellDebug1HiiHandle);\r
+}\r
+\r
+VOID\r
+DisplayProcessorFamily (\r
+ UINT8 Family,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print prompt message\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (Family, Option);\r
+\r
+ //\r
+ // Use switch to check\r
+ //\r
+ switch (Family) {\r
+ case 0x01:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x02:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x03:\r
+ Print (L"8086\n");\r
+ break;\r
+\r
+ case 0x04:\r
+ Print (L"80286\n");\r
+ break;\r
+\r
+ case 0x05:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL386_PROCESSOR), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x06:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL486_PROCESSOR), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x07:\r
+ Print (L"8087\n");\r
+ break;\r
+\r
+ case 0x08:\r
+ Print (L"80287\n");\r
+ break;\r
+\r
+ case 0x09:\r
+ Print (L"80387\n");\r
+ break;\r
+\r
+ case 0x0A:\r
+ Print (L"80487\n");\r
+ break;\r
+\r
+ case 0x0B:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x0C:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PRO_PROC), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x0D:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_II_PROC), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x0E:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_PROC_MMX), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x0F:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CELERON_PROC), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x10:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_XEON_PROC), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x11:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_PROC), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x12:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_M1_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x18:\r
+ Print (L"AMD Duron\n");\r
+ break;\r
+\r
+ case 0x19:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_K5_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x20:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x21:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_601), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x22:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x23:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_603_PLUS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x24:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_PC_604), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x25:\r
+ Print (L"Power PC 620\n");\r
+ break;\r
+\r
+ case 0x26:\r
+ Print (L"Power PC 704\n");\r
+ break;\r
+\r
+ case 0x27:\r
+ Print (L"Power PC 750\n");\r
+ break;\r
+\r
+ case 0x28:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x29:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_DUO_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x2A:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_SOLO_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x2B:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_ATOM), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x30:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ALPHA_FAMILY_2), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x31:\r
+ Print (L"Alpha 21064\n");\r
+ break;\r
+\r
+ case 0x32:\r
+ Print (L"Alpha 21066\n");\r
+ break;\r
+\r
+ case 0x33:\r
+ Print (L"Alpha 21164\n");\r
+ break;\r
+\r
+ case 0x34:\r
+ Print (L"Alpha 21164PC\n");\r
+ break;\r
+\r
+ case 0x35:\r
+ Print (L"Alpha 21164a\n");\r
+ break;\r
+\r
+ case 0x36:\r
+ Print (L"Alpha 21264\n");\r
+ break;\r
+\r
+ case 0x37:\r
+ Print (L"Alpha 21364\n");\r
+ break;\r
+\r
+ case 0x40:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MIPS_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x41:\r
+ Print (L"MIPS R4000\n");\r
+ break;\r
+\r
+ case 0x42:\r
+ Print (L"MIPS R4200\n");\r
+ break;\r
+\r
+ case 0x43:\r
+ Print (L"MIPS R4400\n");\r
+ break;\r
+\r
+ case 0x44:\r
+ Print (L"MIPS R4600\n");\r
+ break;\r
+\r
+ case 0x45:\r
+ Print (L"MIPS R10000\n");\r
+ break;\r
+\r
+ case 0x50:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SPARC_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x51:\r
+ Print (L"SuperSparc\n");\r
+ break;\r
+\r
+ case 0x52:\r
+ Print (L"microSparc II\n");\r
+ break;\r
+\r
+ case 0x53:\r
+ Print (L"microSparc IIep\n");\r
+ break;\r
+\r
+ case 0x54:\r
+ Print (L"UltraSparc\n");\r
+ break;\r
+\r
+ case 0x55:\r
+ Print (L"UltraSparc II\n");\r
+ break;\r
+\r
+ case 0x56:\r
+ Print (L"UltraSparcIIi\n");\r
+ break;\r
+\r
+ case 0x57:\r
+ Print (L"UltraSparcIII\n");\r
+ break;\r
+\r
+ case 0x58:\r
+ Print (L"UltraSparcIIIi\n");\r
+ break;\r
+\r
+ case 0x60:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_68040_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x61:\r
+ Print (L"68xx\n");\r
+ break;\r
+\r
+ case 0x62:\r
+ Print (L"68000\n");\r
+ break;\r
+\r
+ case 0x63:\r
+ Print (L"68010\n");\r
+ break;\r
+\r
+ case 0x64:\r
+ Print (L"68020\n");\r
+ break;\r
+\r
+ case 0x65:\r
+ Print (L"68030\n");\r
+ break;\r
+\r
+ case 0x70:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HOBBIT_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x78:\r
+ Print (L"Crusoe TM5000\n");\r
+ break;\r
+\r
+ case 0x79:\r
+ Print (L"Crusoe TM3000\n");\r
+ break;\r
+\r
+ case 0x7A:\r
+ Print (L"Efficeon TM8000\n");\r
+ break;\r
+\r
+ case 0x80:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WEITEK), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x82:\r
+ Print (L"Itanium\n");\r
+ break;\r
+\r
+ case 0x83:\r
+ Print (L"AMD Athlon64\n");\r
+ break;\r
+\r
+ case 0x84:\r
+ Print (L"AMD Opteron\n");\r
+ break;\r
+\r
+ case 0x85:\r
+ Print (L"AMD Sempron\n");\r
+ break;\r
+\r
+ case 0x86:\r
+ Print (L"AMD Turion64 Mobile\n");\r
+ break;\r
+\r
+ case 0x87:\r
+ Print (L"Dual-Core AMD Opteron\n");\r
+ break;\r
+\r
+ case 0x88:\r
+ Print (L"AMD Athlon 64X2 DualCore\n");\r
+ break;\r
+\r
+ case 0x89:\r
+ Print (L"AMD Turion 64X2 Mobile\n");\r
+ break;\r
+\r
+ case 0x8A:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x8B:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_OPTERON_THIRD_GENERATION), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x8C:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_FX_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x8D:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X4_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x8E:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_X2_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x8F:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_X2_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0x90:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PA_RISC_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_V30_FAMILY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3200_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5000_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_LV_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_ULV_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA8:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7100_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xA9:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAA:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAB:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAC:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7200_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAD:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7300_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAE:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xAF:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7400_SERIES_MULTI_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xB0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PENTIUM_III_XEON), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_QUAD), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_EXTREME), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_DUO_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE2_SOLO_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CORE_I7), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_CELERON_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xC8:\r
+ Print (L"IBM 390\n");\r
+ break;\r
+\r
+ case 0xC9:\r
+ Print (L"G4\n");\r
+ break;\r
+\r
+ case 0xCA:\r
+ Print (L"G5\n");\r
+ break;\r
+\r
+ case 0xCB:\r
+ Print (L"G6\n");\r
+ break;\r
+\r
+ case 0xCC:\r
+ Print (L"zArchitectur\n");\r
+ break;\r
+\r
+ case 0xD2:\r
+ Print (L"ViaC7M\n");\r
+ break;\r
+\r
+ case 0xD3:\r
+ Print (L"ViaC7D\n");\r
+ break;\r
+\r
+ case 0xD4:\r
+ Print (L"ViaC7\n");\r
+ break;\r
+\r
+ case 0xD5:\r
+ Print (L"Eden\n");\r
+ break;\r
+\r
+ case 0xD6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_MULTI_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xD7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xD8:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_3_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xDA:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xDB:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_5_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xDD:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xDE:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xDF:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INTEL_XEON_7_SERIES_MULTI_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xE6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_EMBEDDED_OPTERON_QUAD_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xE7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_PHENOM_TRIPLE_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xE8:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_ULTRA_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xE9:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_TURION_DUAL_CORE_MOBILE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xEA:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_ATHLON_DUAL_CORE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xEB:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AMD_SEMPRON_SI), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 0xFA:\r
+ Print (L"i860\n");\r
+ break;\r
+\r
+ case 0xFB:\r
+ Print (L"i960\n");\r
+ break;\r
+\r
+ default:\r
+ //\r
+ // In order to reduce code quality notice of\r
+ // case & break not pair, so\r
+ // move multiple case into the else part and\r
+ // use if/else to check value.\r
+ //\r
+ if (Family >= 0x13 && Family <= 0x17) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_M1), gShellDebug1HiiHandle);\r
+ } else if (Family >= 0x1A && Family <= 0x1F) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_K5), gShellDebug1HiiHandle);\r
+ } else if (Family >= 0xB1 && Family <= 0xBF) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FOR_SPEC_PENTIUM), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+ //\r
+ // end switch\r
+ //\r
+}\r
+\r
+VOID\r
+DisplayProcessorFamily2 (\r
+ UINT16 Family2,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // Print prompt message\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROCESSOR_FAMILY), gShellDebug1HiiHandle);\r
+\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (Family2, Option);\r
+\r
+ //\r
+ // Use switch to check\r
+ //\r
+ switch (Family2) {\r
+ case 0x104:\r
+ Print (L"SH-3\n");\r
+ break;\r
+\r
+ case 0x105:\r
+ Print (L"SH-4\n");\r
+ break;\r
+\r
+ case 0x118:\r
+ Print (L"ARM\n");\r
+ break;\r
+\r
+ case 0x119:\r
+ Print (L"StrongARM\n");\r
+ break;\r
+\r
+ case 0x12C:\r
+ Print (L"6x86\n");\r
+ break;\r
+\r
+ case 0x12D:\r
+ Print (L"MediaGX\n");\r
+ break;\r
+\r
+ case 0x12E:\r
+ Print (L"MII\n");\r
+ break;\r
+\r
+ case 0x140:\r
+ Print (L"WinChip\n");\r
+ break;\r
+\r
+ case 0x15E:\r
+ Print (L"DSP\n");\r
+ break;\r
+\r
+ case 0x1F4:\r
+ Print (L"Video Processor\n");\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_PROC_FAMILY), gShellDebug1HiiHandle);\r
+ }\r
+\r
+}\r
+\r
+VOID\r
+DisplayProcessorVoltage (\r
+ UINT8 Voltage,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+ Bit 7 Set to 0, indicating 'legacy' mode for processor voltage\r
+ Bits 6:4 Reserved, must be zero\r
+ Bits 3:0 Voltage Capability.\r
+ A Set bit indicates that the voltage is supported.\r
+ Bit 0 - 5V\r
+ Bit 1 - 3.3V\r
+ Bit 2 - 2.9V\r
+ Bit 3 - Reserved, must be zero.\r
+\r
+ Note:\r
+ Setting of multiple bits indicates the socket is configurable\r
+ If bit 7 is set to 1, the remaining seven bits of the field are set to\r
+ contain the processor's current voltage times 10.\r
+ For example, the field value for a processor voltage of 1.8 volts would be\r
+ 92h = 80h + (1.8 * 10) = 80h + 18 = 80h +12h.\r
+\r
+Arguments:\r
+ Voltage - The Voltage\r
+ Option - The option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_INFO), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (Voltage, Option);\r
+\r
+ if (BIT (Voltage, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_CURRENT_VOLTAGE), gShellDebug1HiiHandle, (Voltage - 0x80));\r
+ } else {\r
+ if (BIT (Voltage, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_5V_SUPOPRTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (Voltage, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_33V_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (Voltage, 2) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_29V_SUPPORTED), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // check the reserved zero bits:\r
+ //\r
+ if (BIT (Voltage, 3) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT3_NOT_ZERO), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (Voltage, 4) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT4_NOT_ZERO), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (Voltage, 5) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT5_NOT_ZERO), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (BIT (Voltage, 6) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BIT6_NOT_ZERO), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayProcessorStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+\r
+Bit 7 Reserved, must be 0\r
+Bit 6 CPU Socket Populated\r
+ 1 - CPU Socket Populated\r
+ 0 - CPU Socket UnpopulatedBits\r
+ 5:3 Reserved, must be zero\r
+ Bits 2:0 CPU Status\r
+ 0h - Unknown\r
+ 1h - CPU Enabled\r
+ 2h - CPU Disabled by User via BIOS Setup\r
+ 3h - CPU Disabled By BIOS (POST Error)\r
+ 4h - CPU is Idle, waiting to be enabled.\r
+ 5-6h - Reserved\r
+ 7h - Other\r
+\r
+Arguments:\r
+ Status - The status\r
+ Option - The option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PROC_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+\r
+ if (BIT (Status, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT7), gShellDebug1HiiHandle);\r
+ } else if (BIT (Status, 5) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT5), gShellDebug1HiiHandle);\r
+ } else if (BIT (Status, 4) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT4), gShellDebug1HiiHandle);\r
+ } else if (BIT (Status, 3) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_BIT3), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Check BIT 6\r
+ //\r
+ if (BIT (Status, 6) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_POPULATED), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_SOCKET_UNPOPULATED), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Check BITs 2:0\r
+ //\r
+ switch (Status & 0x07) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_ENABLED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DISABLED_BY_USER), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_DIABLED_BY_BIOS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CPU_IDLE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHERS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayMaxMemoryModuleSize (\r
+ UINT8 Size,\r
+ UINT8 SlotNum,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINTN MaxSize;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SIZE_LARGEST_MEM), gShellDebug1HiiHandle);\r
+ //\r
+ // MaxSize is determined by follow formula\r
+ //\r
+ MaxSize = (UINTN) 1 << Size;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize);\r
+\r
+ if (Option >= SHOW_DETAIL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MAX_AMOUNT_MEM), gShellDebug1HiiHandle);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_MB), gShellDebug1HiiHandle, MaxSize, SlotNum, MaxSize * SlotNum);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayMemoryModuleConfigHandles (\r
+ UINT16 *Handles,\r
+ UINT8 SlotNum,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Index;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_CONTROLLED), gShellDebug1HiiHandle, SlotNum);\r
+\r
+ if (Option >= SHOW_DETAIL) {\r
+ //\r
+ // No handle, Handles is INVALID.\r
+ //\r
+ if (SlotNum == 0) {\r
+ return ;\r
+ }\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLES_LIST_CONTROLLED), gShellDebug1HiiHandle);\r
+ for (Index = 0; Index < SlotNum; Index++) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HANDLE), gShellDebug1HiiHandle, Index + 1, Handles[Index]);\r
+ }\r
+ }\r
+}\r
+//\r
+// Memory Module Information (Type 6)\r
+//\r
+VOID\r
+DisplayMmBankConnections (\r
+ UINT8 BankConnections,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 High;\r
+ UINT8 Low;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_CONNECTIONS), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (BankConnections, Option);\r
+\r
+ //\r
+ // Divide it to high and low\r
+ //\r
+ High = (UINT8) (BankConnections & 0xF0);\r
+ Low = (UINT8) (BankConnections & 0x0F);\r
+ if (High != 0xF) {\r
+ if (Low != 0xF) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS), gShellDebug1HiiHandle, High, Low, High, Low);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, High, High);\r
+ }\r
+ } else {\r
+ if (Low != 0xF) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BANK_RAS_2), gShellDebug1HiiHandle, Low, Low);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BANKS_CONNECTED), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+DisplayMmMemorySize (\r
+ UINT8 Size,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+ Bits 0:6 Size (n),\r
+ where 2**n is the size in MB with three special-case values:\r
+ 7Dh Not determinable (Installed Size only)\r
+ 7Eh Module is installed, but no memory has been enabled\r
+ 7Fh Not installed\r
+ Bit 7 Defines whether the memory module has a single- (0)\r
+ or double-bank (1) connection.\r
+\r
+Arguments:\r
+ Size - The size\r
+ Option - The option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ UINT8 Value;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEMORY_SIZE), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (Size, Option);\r
+\r
+ //\r
+ // Get the low bits(0-6 bit)\r
+ //\r
+ Value = (UINT8) (Size & 0x7F);\r
+ if (Value == 0x7D) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE_NOT_DETERMINABLE), gShellDebug1HiiHandle);\r
+ } else if (Value == 0x7E) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MODULE_INSTALLED), gShellDebug1HiiHandle);\r
+ } else if (Value == 0x7F) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_INSTALLED), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_SIZE), gShellDebug1HiiHandle, 1 << Value);\r
+ }\r
+\r
+ if (BIT (Size, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_DOUBLE_BANK), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MEM_MODULE_SINGLE_BANK), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplaySystemSlotId (\r
+ UINT16 SlotId,\r
+ UINT8 SlotType,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+\r
+ The Slot ID field of the System Slot structure provides a mechanism to\r
+ correlate the physical attributes of the slot to its logical access method\r
+ (which varies based on the Slot Type field).\r
+\r
+Arguments:\r
+\r
+ SlotId - The slot ID\r
+ SlotType - The slot type\r
+ Option - The Option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ //\r
+ // Display slot type first\r
+ //\r
+ DisplaySystemSlotType (SlotType, Option);\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SLOT_ID), gShellDebug1HiiHandle);\r
+ //\r
+ // print option\r
+ //\r
+ PRINT_INFO_OPTION (SlotType, Option);\r
+\r
+ switch (SlotType) {\r
+ //\r
+ // Slot Type: MCA\r
+ //\r
+ case 0x04:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_MICRO_CHAN), gShellDebug1HiiHandle);\r
+ if (SlotId > 0 && SlotId < 15) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // EISA\r
+ //\r
+ case 0x05:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LOGICAL_EISA_NUM), gShellDebug1HiiHandle);\r
+ if (SlotId > 0 && SlotId < 15) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ONE_VAR_D), gShellDebug1HiiHandle, SlotId);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_NOT_1_15), gShellDebug1HiiHandle);\r
+ }\r
+ break;\r
+\r
+ //\r
+ // Slot Type: PCI\r
+ //\r
+ case 0x06:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);\r
+ break;\r
+\r
+ //\r
+ // PCMCIA\r
+ //\r
+ case 0x07:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_IDENTIFIES_ADAPTER_NUM), gShellDebug1HiiHandle, SlotId);\r
+ break;\r
+\r
+ //\r
+ // Slot Type: PCI-E\r
+ //\r
+ case 0xA5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);\r
+ break;\r
+\r
+ default:\r
+ if (SlotType >= 0x0E && SlotType <= 0x12) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VALUE_PRESENT), gShellDebug1HiiHandle, SlotId);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED_SLOT_ID), gShellDebug1HiiHandle);\r
+ }\r
+ }\r
+}\r
+\r
+VOID\r
+DisplaySystemBootStatus (\r
+ UINT8 Parameter,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_BOOT_STATUS), gShellDebug1HiiHandle);\r
+ //\r
+ // Print option\r
+ //\r
+ PRINT_INFO_OPTION (Parameter, Option);\r
+\r
+ //\r
+ // Check value and print\r
+ //\r
+ if (Parameter == 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_ERRORS_DETECTED), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 1) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NO_BOOTABLE_MEDIA), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 2) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NORMAL_OP_SYSTEM), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 3) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FIRMWARE_DETECTED), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 4) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 5) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_USER_REQUESTED_BOOT), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 6) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_SECURITY_VIOLATION), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 7) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PREV_REQ_IMAGE), gShellDebug1HiiHandle);\r
+ } else if (Parameter == 8) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER), gShellDebug1HiiHandle);\r
+ } else if (Parameter >= 9 && Parameter <= 127) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RSVD_FUTURE_ASSIGNMENT), gShellDebug1HiiHandle);\r
+ } else if (Parameter >= 128 && Parameter <= 191) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_VENDOR_OEM_SPECIFIC), gShellDebug1HiiHandle);\r
+ } else if (Parameter >= 192 && Parameter <= 255) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_PRODUCT_SPEC_IMPLMENTATION), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ERROR_VALUE), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+//\r
+// Portable Battery (Type 22)\r
+//\r
+VOID\r
+DisplaySBDSManufactureDate (\r
+ UINT16 Date,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+ The date the cell pack was manufactured, in packed format:\r
+ Bits 15:9 Year, biased by 1980, in the range 0 to 127.\r
+ Bits 8:5 Month, in the range 1 to 12.\r
+ Bits 4:0 Date, in the range 1 to 31.\r
+ For example, 01 February 2000 would be identified as\r
+ 0010 1000 0100 0001b (0x2841).\r
+\r
+Arguments:\r
+ Date - The date\r
+ Option - The option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ UINTN Day;\r
+ UINTN Month;\r
+ UINTN Year;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SBDS_MANUFACTURE_DATE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Date, Option);\r
+ //\r
+ // Print date\r
+ //\r
+ Day = Date & 0x001F;\r
+ Month = (Date & 0x00E0) >> 5;\r
+ Year = ((Date & 0xFF00) >> 8) + 1980;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MONTH_DAY_YEAR), gShellDebug1HiiHandle, Day, Month, Year);\r
+\r
+}\r
+//\r
+// System Reset (Type 23)\r
+//\r
+VOID\r
+DisplaySystemResetCapabilities (\r
+ UINT8 Reset,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+Identifies the system-reset capabilities for the system.\r
+ Bits 7:6 Reserved for future assignment via this specification, set to 00b.\r
+ Bit 5 System contains a watchdog timer, either True (1) or False (0).\r
+ Bits 4:3 Boot Option on Limit.\r
+ Identifies the system action to be taken when the Reset Limit is reached, one of:\r
+ 00b Reserved, do not use.\r
+ 01b Operating system\r
+ 10b System utilities\r
+ 11b Do not rebootBits\r
+ 2:1 Boot Option. Indicates the action to be taken following a watchdog reset, one of:\r
+ 00b Reserved, do not use.\r
+ 01b Operating system\r
+ 10b System utilities\r
+ 11b Do not reboot\r
+ Bit 0 Status.\r
+ 1b The system reset is enabled by the user\r
+ 0b The system reset is not enabled by the user\r
+\r
+Arguments:\r
+ Reset - Reset\r
+ Option - The option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ UINTN Temp;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_RESET_CAPABILITIES), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Reset, Option);\r
+\r
+ //\r
+ // Check reserved bits 7:6\r
+ //\r
+ if ((Reset & 0xC0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Watch dog\r
+ //\r
+ if (BIT (Reset, 5) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WATCHDOG_TIMER_2), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_NOT_CONTAIN_TIMER), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Boot Option on Limit\r
+ //\r
+ Temp = (Reset & 0x18) >> 3;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION_LIMIT), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT_BITS), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Boot Option\r
+ //\r
+ Temp = (Reset & 0x06) >> 1;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BOOT_OPTION), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OP_SYSTEM_2), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SYSTEM_UTIL), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DO_NOT_REBOOT), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Reset enable flag\r
+ //\r
+ if ((Reset & 0x01) != 0) {\r
+ Print (L"The system reset is enabled by the user\n");\r
+ } else {\r
+ Print (L"The system reset is disabled by the user\n");\r
+ }\r
+}\r
+//\r
+// Hardware Security (Type 24)\r
+//\r
+VOID\r
+DisplayHardwareSecuritySettings (\r
+ UINT8 Settings,\r
+ UINT8 Option\r
+ )\r
+/*++\r
+Routine Description:\r
+Identifies the password and reset status for the system:\r
+\r
+Bits 7:6 Power-on Password Status, one of:\r
+ 00b Disabled\r
+ 01b Enabled\r
+ 10b Not Implemented\r
+ 11b Unknown\r
+Bits 5:4 Keyboard Password Status, one of:\r
+ 00b Disabled\r
+ 01b Enabled\r
+ 10b Not Implemented\r
+ 11b Unknown\r
+Bits 3:2 Administrator Password Status, one of:\r
+ 00b Disabled\r
+ 01b Enabled\r
+ 10b Not Implemented\r
+ 11b Unknown\r
+Bits 1:0 Front Panel Reset Status, one of:\r
+ 00b Disabled\r
+ 01b Enabled\r
+ 10b Not Implemented\r
+ 11b Unknown\r
+\r
+Arguments:\r
+ Settings - The settings\r
+ Option - the option\r
+\r
+Returns:\r
+\r
+**/\r
+{\r
+ UINTN Temp;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_HARDWARE_SECURITY_SET), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Settings, Option);\r
+\r
+ //\r
+ // Power-on Password Status\r
+ //\r
+ Temp = (Settings & 0xC0) >> 6;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_ON_PASSWORD), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Keyboard Password Status\r
+ //\r
+ Temp = (Settings & 0x30) >> 4;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_KEYBOARD_PASSWORD), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Administrator Password Status\r
+ //\r
+ Temp = (Settings & 0x0C) >> 2;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ADMIN_PASSWORD_STATUS), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Front Panel Reset Status\r
+ //\r
+ Temp = Settings & 0x3;\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_FRONT_PANEL_RESET), gShellDebug1HiiHandle);\r
+ switch (Temp) {\r
+ case 0:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_DISABLED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_ENABLED_NEWLINE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_IMPLEMENTED), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+}\r
+//\r
+// Out-of-Band Remote Access (Type 30)\r
+//\r
+VOID\r
+DisplayOBRAConnections (\r
+ UINT8 Connections,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONNECTIONS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Connections, Option);\r
+\r
+ //\r
+ // Check reserved bits 7:2\r
+ //\r
+ if ((Connections & 0xFC) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_RESERVED_ZERO_2), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Outbound Connection\r
+ //\r
+ if (BIT (Connections, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OUTBOUND_CONN_ENABLED), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTUBOUND_CONN_DISABLED), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Inbound Connection\r
+ //\r
+ if (BIT (Connections, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOIUND_CONN_ENABLED), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INBOUND_CONN_DISABLED), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+//\r
+// System Power Supply (Type 39)\r
+//\r
+VOID\r
+DisplaySPSCharacteristics (\r
+ UINT16 Characteristics,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINTN Temp;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_CHAR), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Characteristics, Option);\r
+\r
+ //\r
+ // Check reserved bits 15:14\r
+ //\r
+ if ((Characteristics & 0xC000) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BITS_15_14_RSVD), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Bits 13:10 - DMTF Power Supply Type\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_TYPE), gShellDebug1HiiHandle);\r
+ Temp = (Characteristics & 0x1C00) << 10;\r
+ switch (Temp) {\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_LINEAR), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_SWITCHING), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_BATTERY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UPS), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 7:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CONVERTER), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 8:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_REGULATOR), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_2), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Bits 9:7 - Status\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_STATUS_DASH), gShellDebug1HiiHandle);\r
+ Temp = (Characteristics & 0x380) << 7;\r
+ switch (Temp) {\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OK), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NON_CRITICAL), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_CRITICAL_POWER_SUPPLY), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNDEFINED), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Bits 6:3 - DMTF Input Voltage Range Switching\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_INPUT_VOLTAGE_RANGE), gShellDebug1HiiHandle);\r
+ Temp = (Characteristics & 0x78) << 3;\r
+ switch (Temp) {\r
+ case 1:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_OTHER_SPACE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 2:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_UNKNOWN), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 3:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_MANUAL), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 4:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_AUTO_SWITCH), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 5:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_WIDE_RANGE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ case 6:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_NOT_APPLICABLE), gShellDebug1HiiHandle);\r
+ break;\r
+\r
+ default:\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_RESERVED_3), gShellDebug1HiiHandle);\r
+ break;\r
+ }\r
+ //\r
+ // Power supply is unplugged from the wall\r
+ //\r
+ if (BIT (Characteristics, 2) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_UNPLUGGED), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PLUGGED), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // Power supply is present\r
+ //\r
+ if (BIT (Characteristics, 1) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_PRESENT), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_PRESENT), gShellDebug1HiiHandle);\r
+ }\r
+ //\r
+ // hot replaceable\r
+ //\r
+ if (BIT (Characteristics, 0) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_REPLACE), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_PRINTINFO_POWER_SUPPLY_NOT_REPLACE), gShellDebug1HiiHandle);\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ Module to clarify the element info of the smbios structure.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _SMBIOS_PRINT_INFO_H\r
+#define _SMBIOS_PRINT_INFO_H\r
+\r
+#include "LibSmbios.h"\r
+\r
+extern UINT8 SmbiosMajorVersion;\r
+extern UINT8 SmbiosMinorVersion;\r
+\r
+#define SHOW_NONE 0x00\r
+#define SHOW_OUTLINE 0x01\r
+#define SHOW_NORMAL 0x02\r
+#define SHOW_DETAIL 0x03\r
+//\r
+// SHOW_ALL: WaitEnter() not wait input.\r
+//\r
+#define SHOW_ALL 0x04\r
+#define SHOW_STATISTICS 0x05\r
+\r
+#define AS_UINT16(pData) (*((UINT16 *) pData))\r
+#define AS_UINT32(pData) (*((UINT32 *) pData))\r
+#define AS_UINT64(pData) (*((UINT64 *) pData))\r
+\r
+VOID\r
+SmbiosPrintEPSInfo (\r
+ IN SMBIOS_STRUCTURE_TABLE *pSmbiosTable,\r
+ IN UINT8 Option\r
+ );\r
+\r
+EFI_STATUS\r
+SmbiosPrintStructure (\r
+ IN SMBIOS_STRUCTURE_POINTER *pStruct,\r
+ IN UINT8 Option\r
+ );\r
+\r
+//\r
+// BIOS Information (Type 0)\r
+//\r
+VOID\r
+DisplayBiosCharacteristics (\r
+ UINT64 chara,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayBiosCharacteristicsExt1 (\r
+ UINT8 byte1,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayBiosCharacteristicsExt2 (\r
+ UINT8 byte2,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Processor Information (Type 4)\r
+//\r
+VOID\r
+DisplayProcessorFamily (\r
+ UINT8 Family,\r
+ UINT8 Option\r
+ );\r
+\r
+VOID\r
+DisplayProcessorFamily2 (\r
+ UINT16 Family2,\r
+ UINT8 Option\r
+ );\r
+\r
+VOID\r
+DisplayProcessorVoltage (\r
+ UINT8 Voltage,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayProcessorStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Controller Information (Type 5)\r
+//\r
+VOID\r
+DisplayMaxMemoryModuleSize (\r
+ UINT8 Size,\r
+ UINT8 SlotNum,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryModuleConfigHandles (\r
+ UINT16 *pHandles,\r
+ UINT8 SlotNum,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Module Information (Type 6)\r
+//\r
+VOID\r
+DisplayMmBankConnections (\r
+ UINT8 BankConnections,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMmMemorySize (\r
+ UINT8 Size,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Slots (Type 9)\r
+//\r
+VOID\r
+DisplaySystemSlotId (\r
+ UINT16 SlotId,\r
+ UINT8 SlotType,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Physical Memory Array (Type 16)\r
+// Memory Device (Type 17)\r
+// Memory Array Mapped Address (Type 19)\r
+// Memory Device Mapped Address (Type 20)\r
+// Portable Battery (Type 22)\r
+//\r
+VOID\r
+DisplaySBDSManufactureDate (\r
+ UINT16 Date,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Reset (Type 23)\r
+//\r
+VOID\r
+DisplaySystemResetCapabilities (\r
+ UINT8 Reset,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Hardware Security (Type 24)\r
+//\r
+VOID\r
+DisplayHardwareSecuritySettings (\r
+ UINT8 Settings,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Out-of-Band Remote Access (Type 30)\r
+//\r
+VOID\r
+DisplayOBRAConnections (\r
+ UINT8 Connections,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Boot Information (Type 32)\r
+//\r
+VOID\r
+DisplaySystemBootStatus (\r
+ UINT8 Parameter,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Power Supply (Type 39)\r
+//\r
+VOID\r
+DisplaySPSCharacteristics (\r
+ UINT16 Characteristics,\r
+ UINT8 Option\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Build a table, each item is (Key, Info) pair.\r
+ And give a interface of query a string out of a table.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include "QueryTable.h"\r
+#include "PrintInfo.h"\r
+\r
+TABLE_ITEM SystemWakeupTypeTable[] = {\r
+ {\r
+ 0x0,\r
+ L" Reserved"\r
+ },\r
+ {\r
+ 0x1,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x2,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x3,\r
+ L" APM Timer"\r
+ },\r
+ {\r
+ 0x4,\r
+ L" Modem Ring"\r
+ },\r
+ {\r
+ 0x5,\r
+ L" LAN Remote"\r
+ },\r
+ {\r
+ 0x6,\r
+ L" Power Switch"\r
+ },\r
+ {\r
+ 0x7,\r
+ L" AC Power Restored"\r
+ }\r
+};\r
+\r
+TABLE_ITEM SystemEnclosureTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" None"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Desktop"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Low Profile Desktop"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Pizza Box"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Mini Tower"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Tower"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Portable"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" LapTop"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Notebook"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Hand Held"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" Docking Station"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" All in One"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L" Sub Notebook"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L" Space-saving"\r
+ },\r
+ {\r
+ 0x10,\r
+ L" Main Server Chassis"\r
+ },\r
+ {\r
+ 0x11,\r
+ L" Expansion Chassis"\r
+ },\r
+ {\r
+ 0x12,\r
+ L" SubChassis"\r
+ },\r
+ {\r
+ 0x13,\r
+ L" Sub Notebook"\r
+ },\r
+ {\r
+ 0x14,\r
+ L" Bus Expansion Chassis"\r
+ },\r
+ {\r
+ 0x15,\r
+ L" Peripheral Chassis"\r
+ },\r
+ {\r
+ 0x16,\r
+ L" RAID Chassis"\r
+ },\r
+ {\r
+ 0x17,\r
+ L" Rack Mount Chassis"\r
+ },\r
+ {\r
+ 0x18,\r
+ L" Sealed-case PC"\r
+ },\r
+ {\r
+ 0x19,\r
+ L" Multi-system Chassis"\r
+ },\r
+ {\r
+ 0x1A,\r
+ L" CompactPCI"\r
+ },\r
+ {\r
+ 0x1B,\r
+ L" AdvancedTCA"\r
+ },\r
+ {\r
+ 0x1C,\r
+ L" Blade"\r
+ },\r
+ {\r
+ 0x1D,\r
+ L" Blade Enclosure"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SystemEnclosureStatusTable[] = {\r
+ {\r
+ 0x1,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x2,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x3,\r
+ L" Safe"\r
+ },\r
+ {\r
+ 0x4,\r
+ L" Warning"\r
+ },\r
+ {\r
+ 0x5,\r
+ L" Critical"\r
+ },\r
+ {\r
+ 0x6,\r
+ L" Non-recoverable"\r
+ }\r
+};\r
+\r
+TABLE_ITEM SESecurityStatusTable[] = {\r
+ {\r
+ 0x1,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x2,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x3,\r
+ L" None"\r
+ },\r
+ {\r
+ 0x4,\r
+ L" External interface locked out"\r
+ },\r
+ {\r
+ 0x5,\r
+ L" External interface enabled"\r
+ }\r
+};\r
+\r
+TABLE_ITEM ProcessorTypeTable[] = {\r
+ {\r
+ 0x1,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x2,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x3,\r
+ L" Central Processor"\r
+ },\r
+ {\r
+ 0x4,\r
+ L" Math Processor"\r
+ },\r
+ {\r
+ 0x5,\r
+ L" DSP Processor"\r
+ },\r
+ {\r
+ 0x6,\r
+ L" Video Processor "\r
+ },\r
+};\r
+\r
+TABLE_ITEM ProcessorUpgradeTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Daughter Board"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"ZIF Socket"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Replaceable Piggy Back"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"None"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"LIF Socket"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"Slot 1"\r
+ },\r
+ {\r
+ 0x09,\r
+ L"Slot 2"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L"370-pin socket"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L"Slot A"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L"Slot M"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L"Socket 423"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L"Socket A"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L"Socket 478"\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Socket 754"\r
+ },\r
+ {\r
+ 0x11,\r
+ L"Socket 940"\r
+ },\r
+ {\r
+ 0x12,\r
+ L"Socket 939"\r
+ },\r
+ {\r
+ 0x13,\r
+ L"Socket mPGA604"\r
+ },\r
+ {\r
+ 0x14,\r
+ L"Socket LGA771"\r
+ },\r
+ {\r
+ 0x15,\r
+ L"Socket LGA775"\r
+ },\r
+ {\r
+ 0x16,\r
+ L"Socket S1"\r
+ },\r
+ {\r
+ 0x17,\r
+ L"Socket AM2"\r
+ },\r
+ {\r
+ 0x18,\r
+ L"Socket F"\r
+ },\r
+ {\r
+ 0x19,\r
+ L"Socket LGA1366"\r
+ }\\r
+};\r
+\r
+TABLE_ITEM McErrorDetectMethodTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"None"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"8-bit Parity"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"32-bit ECC"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"64-bit ECC"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"128-bit ECC"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"CRC"\r
+ },\r
+};\r
+\r
+TABLE_ITEM McErrorCorrectCapabilityTable[] = {\r
+ {\r
+ 0,\r
+ L"Other"\r
+ },\r
+ {\r
+ 1,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 2,\r
+ L"None"\r
+ },\r
+ {\r
+ 3,\r
+ L"Single Bit Error Correcting"\r
+ },\r
+ {\r
+ 4,\r
+ L"Double Bit Error Correcting"\r
+ },\r
+ {\r
+ 5,\r
+ L"Error Scrubbing"\r
+ },\r
+};\r
+\r
+TABLE_ITEM McInterleaveSupportTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"One Way Interleave"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Two Way Interleave"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Four Way Interleave"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"Eight Way Interleave"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"Sixteen Way Interleave"\r
+ }\r
+};\r
+\r
+TABLE_ITEM McMemorySpeedsTable[] = {\r
+ {\r
+ 0,\r
+ L" Other"\r
+ },\r
+ {\r
+ 1,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 2,\r
+ L" 70ns"\r
+ },\r
+ {\r
+ 3,\r
+ L" 60ns"\r
+ },\r
+ {\r
+ 4,\r
+ L" 50ns"\r
+ },\r
+};\r
+\r
+TABLE_ITEM MemoryModuleVoltageTable[] = {\r
+ {\r
+ 0,\r
+ L" 5V"\r
+ },\r
+ {\r
+ 1,\r
+ L" 3.3V"\r
+ },\r
+ {\r
+ 2,\r
+ L" 2.9V"\r
+ },\r
+};\r
+\r
+TABLE_ITEM MmMemoryTypeTable[] = {\r
+ {\r
+ 0,\r
+ L" Other"\r
+ },\r
+ {\r
+ 1,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 2,\r
+ L" Standard"\r
+ },\r
+ {\r
+ 3,\r
+ L" Fast Page Mode"\r
+ },\r
+ {\r
+ 4,\r
+ L" EDO"\r
+ },\r
+ {\r
+ 5,\r
+ L" Parity"\r
+ },\r
+ {\r
+ 6,\r
+ L" ECC "\r
+ },\r
+ {\r
+ 7,\r
+ L" SIMM"\r
+ },\r
+ {\r
+ 8,\r
+ L" DIMM"\r
+ },\r
+ {\r
+ 9,\r
+ L" Burst EDO"\r
+ },\r
+ {\r
+ 10,\r
+ L" SDRAM"\r
+ }\r
+};\r
+\r
+TABLE_ITEM MmErrorStatusTable[] = {\r
+ {\r
+ 0,\r
+ L" Uncorrectable errors received"\r
+ },\r
+ {\r
+ 1,\r
+ L" Correctable errors received"\r
+ },\r
+ {\r
+ 2,\r
+ L" Error Status obtained from the event log"\r
+ }\r
+};\r
+\r
+TABLE_ITEM CacheSRAMTypeTable[] = {\r
+ {\r
+ 0,\r
+ L" Other"\r
+ },\r
+ {\r
+ 1,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 2,\r
+ L" Non-Burst"\r
+ },\r
+ {\r
+ 3,\r
+ L" Burst"\r
+ },\r
+ {\r
+ 4,\r
+ L" Pipeline Burst"\r
+ },\r
+ {\r
+ 5,\r
+ L" Synchronous"\r
+ },\r
+ {\r
+ 6,\r
+ L" Asynchronous"\r
+ },\r
+};\r
+\r
+TABLE_ITEM CacheErrCorrectingTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"None"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Parity"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Single-bit ECC"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"Multi-bit ECC"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"Sixteen Way Interleave"\r
+ }\r
+};\r
+\r
+TABLE_ITEM CacheSystemCacheTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Instruction"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Data"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Unified"\r
+ }\r
+};\r
+\r
+TABLE_ITEM CacheAssociativityTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Direct Mapped"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"2-way Set-Associative"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"4-way Set-Associative"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"Fully Associative"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"8-way Set-Associative"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"16-way Set-Associative"\r
+ },\r
+ {\r
+ 0x09,\r
+ L"12-way Set-Associative"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L"24-way Set-Associative"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L"32-way Set-Associative"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L"48-way Set-Associative"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L"64-way Set-Associative"\r
+ }\r
+};\r
+\r
+TABLE_ITEM PortConnectorTypeTable[] = {\r
+ {\r
+ 0x00,\r
+ L"None"\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Centronics"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Mini Centronics"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Proprietary"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"DB-25 pin male"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"DB-25 pin female"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"DB-15 pin male"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"DB-15 pin female"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"DB-9 pin male"\r
+ },\r
+ {\r
+ 0x09,\r
+ L"DB-9 pin female"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L"RJ-11"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L"RJ-45"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L"50 Pin MiniSCSI"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L"Mini-DIN"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L"Micro-DIN"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L"PS/2"\r
+ },\r
+ {\r
+ 0x10,\r
+ L"Infrared"\r
+ },\r
+ {\r
+ 0x11,\r
+ L"HP-HIL"\r
+ },\r
+ {\r
+ 0x12,\r
+ L"Access Bus (USB)"\r
+ },\r
+ {\r
+ 0x13,\r
+ L"SSA SCSI"\r
+ },\r
+ {\r
+ 0x14,\r
+ L"Circular DIN-8 male"\r
+ },\r
+ {\r
+ 0x15,\r
+ L"Circular DIN-8 female"\r
+ },\r
+ {\r
+ 0x16,\r
+ L"On Board IDE"\r
+ },\r
+ {\r
+ 0x17,\r
+ L"On Board Floppy"\r
+ },\r
+ {\r
+ 0x18,\r
+ L"9 Pin Dual Inline (pin 10 cut)"\r
+ },\r
+ {\r
+ 0x19,\r
+ L"25 Pin Dual Inline (pin 26 cut)"\r
+ },\r
+ {\r
+ 0x1A,\r
+ L"50 Pin Dual Inline"\r
+ },\r
+ {\r
+ 0x1B,\r
+ L"68 Pin Dual Inline"\r
+ },\r
+ {\r
+ 0x1C,\r
+ L"On Board Sound Input from CD-ROM"\r
+ },\r
+ {\r
+ 0x1D,\r
+ L"Mini-Centronics Type-14"\r
+ },\r
+ {\r
+ 0x1E,\r
+ L"Mini-Centronics Type-26"\r
+ },\r
+ {\r
+ 0x1F,\r
+ L"Mini-jack (headphones)"\r
+ },\r
+ {\r
+ 0x20,\r
+ L"BNC"\r
+ },\r
+ {\r
+ 0x21,\r
+ L"1394"\r
+ },\r
+ {\r
+ 0x22,\r
+ L"SAS/SATA Plug Receptacle"\r
+ },\r
+ {\r
+ 0xA0,\r
+ L"PC-98"\r
+ },\r
+ {\r
+ 0xA1,\r
+ L"PC-98Hireso"\r
+ },\r
+ {\r
+ 0xA2,\r
+ L"PC-H98"\r
+ },\r
+ {\r
+ 0xA3,\r
+ L"PC-98Note"\r
+ },\r
+ {\r
+ 0xA4,\r
+ L"PC-98Full"\r
+ },\r
+ {\r
+ 0xFF,\r
+ L"Other"\r
+ },\r
+};\r
+\r
+TABLE_ITEM PortTypeTable[] = {\r
+ {\r
+ 0x00,\r
+ L"None"\r
+ },\r
+ {\r
+ 0x01,\r
+ L"Parallel Port XT/AT Compatible"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Parallel Port PS/2"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"Parallel Port ECP"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"Parallel Port EPP"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"Parallel Port ECP/EPP"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"Serial Port XT/AT Compatible"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"Serial Port 16450 Compatible"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"Serial Port 16550 Compatible"\r
+ },\r
+ {\r
+ 0x09,\r
+ L"Serial Port 16550A Compatible"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L"SCSI Port"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L"MIDI Port"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L"Joy Stick Port"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L"Keyboard Port"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L"Mouse Port"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L"SSA SCSI"\r
+ },\r
+ {\r
+ 0x10,\r
+ L"USB"\r
+ },\r
+ {\r
+ 0x11,\r
+ L"FireWire (IEEE P1394)"\r
+ },\r
+ {\r
+ 0x12,\r
+ L"PCMCIA Type II"\r
+ },\r
+ {\r
+ 0x13,\r
+ L"PCMCIA Type II"\r
+ },\r
+ {\r
+ 0x14,\r
+ L"PCMCIA Type III"\r
+ },\r
+ {\r
+ 0x15,\r
+ L"Cardbus"\r
+ },\r
+ {\r
+ 0x16,\r
+ L"Access Bus Port"\r
+ },\r
+ {\r
+ 0x17,\r
+ L"SCSI II"\r
+ },\r
+ {\r
+ 0x18,\r
+ L"SCSI Wide"\r
+ },\r
+ {\r
+ 0x19,\r
+ L"PC-98"\r
+ },\r
+ {\r
+ 0x1A,\r
+ L"PC-98-Hireso"\r
+ },\r
+ {\r
+ 0x1B,\r
+ L"PC-H98"\r
+ },\r
+ {\r
+ 0x1C,\r
+ L"Video Port"\r
+ },\r
+ {\r
+ 0x1D,\r
+ L"Audio Port"\r
+ },\r
+ {\r
+ 0x1E,\r
+ L"Modem Port"\r
+ },\r
+ {\r
+ 0x1F,\r
+ L"Network Port"\r
+ },\r
+ {\r
+ 0x20,\r
+ L"SATA Port"\r
+ },\r
+ {\r
+ 0x21,\r
+ L"SAS Port"\r
+ },\r
+ {\r
+ 0xA0,\r
+ L"8251 Compatible"\r
+ },\r
+ {\r
+ 0xA1,\r
+ L"8251 FIFO Compatible"\r
+ },\r
+ {\r
+ 0xFF,\r
+ L"Other "\r
+ },\r
+};\r
+\r
+TABLE_ITEM SystemSlotTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L"Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L"Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L"ISA"\r
+ },\r
+ {\r
+ 0x04,\r
+ L"MCA"\r
+ },\r
+ {\r
+ 0x05,\r
+ L"EISA"\r
+ },\r
+ {\r
+ 0x06,\r
+ L"PCI"\r
+ },\r
+ {\r
+ 0x07,\r
+ L"PC Card (PCMCIA)"\r
+ },\r
+ {\r
+ 0x08,\r
+ L"VL-VESA"\r
+ },\r
+ {\r
+ 0x09,\r
+ L"Proprietary"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L"Processor Card Slot"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L"Proprietary Memory Card Slot"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L"I/O Riser Card Slot"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L"NuBus"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L"PCI - 66MHz Capable"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L"AGP"\r
+ },\r
+ {\r
+ 0x10,\r
+ L"AGP 2X"\r
+ },\r
+ {\r
+ 0x11,\r
+ L"AGP 4X"\r
+ },\r
+ {\r
+ 0x12,\r
+ L"PCI-X"\r
+ },\r
+ {\r
+ 0xA0,\r
+ L"PC-98/C20 "\r
+ },\r
+ {\r
+ 0xA1,\r
+ L"PC-98/C24 "\r
+ },\r
+ {\r
+ 0xA2,\r
+ L"PC-98/E "\r
+ },\r
+ {\r
+ 0xA3,\r
+ L"PC-98/Local Bus "\r
+ },\r
+ {\r
+ 0xA4,\r
+ L"PC-98/Card "\r
+ },\r
+ {\r
+ 0xA5,\r
+ L"PCI Express "\r
+ },\r
+ {\r
+ 0xA6,\r
+ L"PCI Express X1"\r
+ },\r
+ {\r
+ 0xA7,\r
+ L"PCI Express X2"\r
+ },\r
+ {\r
+ 0xA8,\r
+ L"PCI Express X4"\r
+ },\r
+ {\r
+ 0xA9,\r
+ L"PCI Express X8"\r
+ },\r
+ {\r
+ 0xAA,\r
+ L"PCI Express X16"\r
+ },\r
+ {\r
+ 0xAB,\r
+ L"PCI Express Gen 26"\r
+ },\r
+ {\r
+ 0xAC,\r
+ L"PCI Express Gen 2 X1"\r
+ },\r
+ {\r
+ 0xAD,\r
+ L"PCI Express Gen 2 X2"\r
+ },\r
+ {\r
+ 0xAE,\r
+ L"PCI Express Gen 2 X4"\r
+ },\r
+ {\r
+ 0xAF,\r
+ L"PCI Express Gen 2 X8"\r
+ },\r
+ {\r
+ 0xB0,\r
+ L"PCI Express Gen 2 X16"\r
+ }\r
+};\r
+\r
+TABLE_ITEM SystemSlotDataBusWidthTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" 8 bit"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" 16 bit"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" 32 bit"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" 64 bit"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" 128 bit"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SystemSlotCurrentUsageTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Available"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" In use"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SystemSlotLengthTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Short length"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Long Length"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SlotCharacteristics1Table[] = {\r
+ {\r
+ 0,\r
+ L" Characteristics Unknown"\r
+ },\r
+ {\r
+ 1,\r
+ L" Provides 5.0 Volts"\r
+ },\r
+ {\r
+ 2,\r
+ L" Provides 3.3 Volts"\r
+ },\r
+ {\r
+ 3,\r
+ L" Slot's opening is shared with another slot, e.g. PCI/EISA shared slot."\r
+ },\r
+\r
+ {\r
+ 4,\r
+ L" PC Card slot supports PC Card-16"\r
+ },\r
+ {\r
+ 5,\r
+ L" PC Card slot supports CardBus"\r
+ },\r
+ {\r
+ 6,\r
+ L" PC Card slot supports Zoom Video "\r
+ },\r
+ {\r
+ 7,\r
+ L" PC Card slot supports Modem Ring Resume "\r
+ }\r
+};\r
+\r
+TABLE_ITEM SlotCharacteristics2Table[] = {\r
+ {\r
+ 0,\r
+ L" PCI slot supports Power Management Enable (PME#) signal"\r
+ },\r
+ {\r
+ 1,\r
+ L" Slot supports hot-plug devices"\r
+ },\r
+ {\r
+ 2,\r
+ L" PCI slot supports SMBus signal"\r
+ }\r
+};\r
+\r
+TABLE_ITEM OnboardDeviceTypesTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Video"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" SCSI Controller"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Ethernet"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Token Ring"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Sound"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Pata Controller"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Sata Controller"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Sas Controller"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SELTypesTable[] = {\r
+ {\r
+ 0x00,\r
+ L" Reserved."\r
+ },\r
+ {\r
+ 0x01,\r
+ L" Single-bit ECC memory error"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Multi-bit ECC memory error"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Parity memory error"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Bus time-out"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" I/O Channel Check"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Software NMI"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" POST Memory Resize"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" POST Error"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" PCI Parity Error"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" PCI System Error"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" CPU Failure"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" EISA FailSafe Timer time-out"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" Correctable memory log disabled"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L" Logging disabled for a specific Event Type"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L" Reserved"\r
+ },\r
+ {\r
+ 0x10,\r
+ L" System Limit Exceeded"\r
+ },\r
+ {\r
+ 0x11,\r
+ L" Asynchronous hardware timer expired and issued a system reset"\r
+ },\r
+ {\r
+ 0x12,\r
+ L" System configuration information"\r
+ },\r
+ {\r
+ 0x13,\r
+ L" Hard-disk information"\r
+ },\r
+ {\r
+ 0x14,\r
+ L" System reconfigured"\r
+ },\r
+ {\r
+ 0x15,\r
+ L" Uncorrectable CPU-complex error"\r
+ },\r
+ {\r
+ 0x16,\r
+ L" Log Area Reset/Cleared"\r
+ },\r
+ {\r
+ 0x17,\r
+ L" System boot"\r
+ },\r
+ {\r
+ 0x7F18,\r
+ L" Unused by SMBIOS specification"\r
+ },\r
+ {\r
+ 0xFE80,\r
+ L" System and OEM specified"\r
+ },\r
+ {\r
+ 0xFF,\r
+ L" End-of-log"\r
+ },\r
+};\r
+\r
+TABLE_ITEM SELVarDataFormatTypeTable[] = {\r
+ {\r
+ 0x00,\r
+ L" None "\r
+ },\r
+ {\r
+ 0x01,\r
+ L" Handle "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Multiple-Event "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Multiple-Event Handle "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" POST Results Bitmap "\r
+ },\r
+ //\r
+ // Defined below\r
+ //\r
+ {\r
+ 0x05,\r
+ L" System Management Type"\r
+ },\r
+ //\r
+ // Defined below\r
+ //\r
+ {\r
+ 0x06,\r
+ L" Multiple-Event System Management Type "\r
+ },\r
+ {\r
+ 0x7F07,\r
+ L" Unused "\r
+ },\r
+ {\r
+ 0xFF80,\r
+ L" OEM assigned "\r
+ },\r
+};\r
+\r
+TABLE_ITEM PostResultsBitmapDw1Table[] = {\r
+ {\r
+ 0,\r
+ L" Channel 2 Timer error "\r
+ },\r
+ {\r
+ 1,\r
+ L" Master PIC (8259 #1) error "\r
+ },\r
+ {\r
+ 2,\r
+ L" Slave PIC (8259 #2) error "\r
+ },\r
+ {\r
+ 3,\r
+ L" CMOS Battery Failure "\r
+ },\r
+ {\r
+ 4,\r
+ L" CMOS System Options Not Set "\r
+ },\r
+ {\r
+ 5,\r
+ L" CMOS Checksum Error "\r
+ },\r
+ {\r
+ 6,\r
+ L" CMOS Configuration Error "\r
+ },\r
+ {\r
+ 7,\r
+ L" Mouse and Keyboard Swapped "\r
+ },\r
+ {\r
+ 8,\r
+ L" Keyboard Locked "\r
+ },\r
+ {\r
+ 9,\r
+ L" Keyboard Not Functional "\r
+ },\r
+ {\r
+ 10,\r
+ L" Keyboard Controller Not Functional "\r
+ },\r
+ {\r
+ 11,\r
+ L" CMOS Memory Size Different "\r
+ },\r
+ {\r
+ 12,\r
+ L" Memory Decreased in Size "\r
+ },\r
+ {\r
+ 13,\r
+ L" Cache Memory Error "\r
+ },\r
+ {\r
+ 14,\r
+ L" Floppy Drive 0 Error "\r
+ },\r
+ {\r
+ 15,\r
+ L" Floppy Drive 1 Error "\r
+ },\r
+ {\r
+ 16,\r
+ L" Floppy Controller Failure "\r
+ },\r
+ {\r
+ 17,\r
+ L" Number of ATA Drives Reduced Error "\r
+ },\r
+ {\r
+ 18,\r
+ L" CMOS Time Not Set "\r
+ },\r
+ {\r
+ 19,\r
+ L" DDC Monitor Configuration Change "\r
+ },\r
+ {\r
+ 20,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 21,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 22,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 23,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 24,\r
+ L" Second DWORD has valid data "\r
+ },\r
+ {\r
+ 25,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 26,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 27,\r
+ L" Reserved, set to 0 "\r
+ },\r
+ {\r
+ 28,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 29,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 30,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 31,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+};\r
+\r
+TABLE_ITEM PostResultsBitmapDw2Table[] = {\r
+ {\r
+ 0,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 1,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 2,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 3,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 4,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 5,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 6,\r
+ L" Normally 0; available for OEM assignment "\r
+ },\r
+ {\r
+ 7,\r
+ L" PCI Memory Conflict "\r
+ },\r
+ {\r
+ 8,\r
+ L" PCI I/O Conflict "\r
+ },\r
+ {\r
+ 9,\r
+ L" PCI IRQ Conflict "\r
+ },\r
+ {\r
+ 10,\r
+ L" PNP Memory Conflict "\r
+ },\r
+ {\r
+ 11,\r
+ L" PNP 32 bit Memory Conflict "\r
+ },\r
+ {\r
+ 12,\r
+ L" PNP I/O Conflict "\r
+ },\r
+ {\r
+ 13,\r
+ L" PNP IRQ Conflict "\r
+ },\r
+ {\r
+ 14,\r
+ L" PNP DMA Conflict "\r
+ },\r
+ {\r
+ 15,\r
+ L" Bad PNP Serial ID Checksum "\r
+ },\r
+ {\r
+ 16,\r
+ L" Bad PNP Resource Data Checksum "\r
+ },\r
+ {\r
+ 17,\r
+ L" Static Resource Conflict "\r
+ },\r
+ {\r
+ 18,\r
+ L" NVRAM Checksum Error, NVRAM Cleared "\r
+ },\r
+ {\r
+ 19,\r
+ L" System Board Device Resource Conflict "\r
+ },\r
+ {\r
+ 20,\r
+ L" Primary Output Device Not Found "\r
+ },\r
+ {\r
+ 21,\r
+ L" Primary Input Device Not Found "\r
+ },\r
+ {\r
+ 22,\r
+ L" Primary Boot Device Not Found "\r
+ },\r
+ {\r
+ 23,\r
+ L" NVRAM Cleared By Jumper "\r
+ },\r
+ {\r
+ 24,\r
+ L" NVRAM Data Invalid, NVRAM Cleared "\r
+ },\r
+ {\r
+ 25,\r
+ L" FDC Resource Conflict "\r
+ },\r
+ {\r
+ 26,\r
+ L" Primary ATA Controller Resource Conflict "\r
+ },\r
+ {\r
+ 27,\r
+ L" Secondary ATA Controller Resource Conflict "\r
+ },\r
+ {\r
+ 28,\r
+ L" Parallel Port Resource Conflict "\r
+ },\r
+ {\r
+ 29,\r
+ L" Serial Port 1 Resource Conflict "\r
+ },\r
+ {\r
+ 30,\r
+ L" Serial Port 2 Resource Conflict "\r
+ },\r
+ {\r
+ 31,\r
+ L" Audio Resource Conflict "\r
+ },\r
+};\r
+\r
+TABLE_ITEM SELSysManagementTypesTable[] = {\r
+ {\r
+ 0x01,\r
+ L" +2.5V Out of range, #2 "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" +3.3V Out of range "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" +5V Out of range "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" -5V Out of range "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" +12V Out of range "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" -12V Out of range "\r
+ },\r
+ {\r
+ 0x0F07,\r
+ L" Reserved for future out-of-range voltage levels "\r
+ },\r
+ {\r
+ 0x10,\r
+ L" System board temperature out of range "\r
+ },\r
+ {\r
+ 0x11,\r
+ L" Processor #1 temperature out of range "\r
+ },\r
+ {\r
+ 0x12,\r
+ L" Processor #2 temperature out of range "\r
+ },\r
+ {\r
+ 0x13,\r
+ L" Processor #3 temperature out of range "\r
+ },\r
+ {\r
+ 0x14,\r
+ L" Processor #4 temperature out of range "\r
+ },\r
+ {\r
+ 0x1F15,\r
+ L" Reserved for future out-of-range temperatures"\r
+ },\r
+ {\r
+ 0x2720,\r
+ L" Fan n (n = 0 to 7) Out of range "\r
+ },\r
+ {\r
+ 0x2F28,\r
+ L" Reserved for future assignment via this specification "\r
+ },\r
+ {\r
+ 0x30,\r
+ L" Chassis secure switch activated "\r
+ },\r
+};\r
+\r
+TABLE_ITEM PMALocationTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" System board or motherboard"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" ISA add-on card"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" EISA add-on card"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" PCI add-on card"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" MCA add-on card"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" PCMCIA add-on card"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Proprietary add-on card"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" NuBus"\r
+ },\r
+ {\r
+ 0xA0,\r
+ L" PC-98/C20 add-on card"\r
+ },\r
+ {\r
+ 0xA1,\r
+ L" PC-98/C24 add-on card"\r
+ },\r
+ {\r
+ 0xA2,\r
+ L" PC-98/E add-on card"\r
+ },\r
+ {\r
+ 0xA3,\r
+ L" PC-98/Local bus add-on card"\r
+ }\r
+};\r
+\r
+TABLE_ITEM PMAUseTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" System memory"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Video memory"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Flash memory"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Non-volatile RAM"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Cache memory"\r
+ }\r
+};\r
+\r
+TABLE_ITEM PMAErrorCorrectionTypesTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" None"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Parity"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Single-bit ECC"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Multi-bit ECC"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" CRC"\r
+ }\r
+};\r
+\r
+TABLE_ITEM MemoryDeviceFormFactorTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" SIMM"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" SIP"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Chip"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" DIP"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" ZIP"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Proprietary Card"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" DIMM"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" TSOP"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Row of chips"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" RIMM"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" SODIMM"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L" SRIMM"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L" FB-DIMM"\r
+ }\r
+};\r
+\r
+TABLE_ITEM MemoryDeviceTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" DRAM"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" EDRAM"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" VRAM"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" SRAM"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" RAM"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" ROM"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" FLASH"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" EEPROM"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" FEPROM"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" EPROM"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" CDRAM"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L" 3DRAM"\r
+ },\r
+ {\r
+ 0x0F,\r
+ L" SDRAM"\r
+ },\r
+ {\r
+ 0x10,\r
+ L" SGRAM"\r
+ },\r
+ {\r
+ 0x11,\r
+ L" RDRAM"\r
+ },\r
+ {\r
+ 0x12,\r
+ L" DDR"\r
+ },\r
+ {\r
+ 0x13,\r
+ L" DDR2"\r
+ },\r
+ {\r
+ 0x14,\r
+ L" DDR2 FB-DIMM"\r
+ },\r
+ {\r
+ 0x18,\r
+ L" DDR3"\r
+ },\r
+ {\r
+ 0x19,\r
+ L" FBD2"\r
+ }\r
+};\r
+\r
+TABLE_ITEM MemoryDeviceTypeDetailTable[] = {\r
+ {\r
+ 1,\r
+ L" Other"\r
+ },\r
+ {\r
+ 2,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 3,\r
+ L" Fast-paged"\r
+ },\r
+ {\r
+ 4,\r
+ L" Static column"\r
+ },\r
+ {\r
+ 5,\r
+ L" Pseudo-STATIC"\r
+ },\r
+ {\r
+ 6,\r
+ L" RAMBUS "\r
+ },\r
+ {\r
+ 7,\r
+ L" Synchronous"\r
+ },\r
+ {\r
+ 8,\r
+ L" CMOS"\r
+ },\r
+ {\r
+ 9,\r
+ L" EDO"\r
+ },\r
+ {\r
+ 10,\r
+ L" Window DRAM"\r
+ },\r
+ {\r
+ 11,\r
+ L" Cache DRAM"\r
+ },\r
+ {\r
+ 12,\r
+ L" Non-volatile"\r
+ },\r
+};\r
+\r
+TABLE_ITEM MemoryErrorTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" OK"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Bad read"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Parity error"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Single-bit error"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Double-bit error"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Multi-bit error"\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Nibble error"\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Checksum error"\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" CRC error"\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" Corrected single-bit error"\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" Corrected error"\r
+ },\r
+ {\r
+ 0x0E,\r
+ L" Uncorrectable error"\r
+ },\r
+};\r
+\r
+TABLE_ITEM MemoryErrorGranularityTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Device level"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Memory partition level"\r
+ },\r
+};\r
+\r
+TABLE_ITEM MemoryErrorOperationTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Read"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Write"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Partial Write"\r
+ },\r
+};\r
+\r
+TABLE_ITEM PointingDeviceTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Mouse"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Track Ball"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Track Point"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Glide Point"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Touch Pad"\r
+ },\r
+};\r
+\r
+TABLE_ITEM PointingDeviceInterfaceTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other"\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown"\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Serial"\r
+ },\r
+ {\r
+ 0x04,\r
+ L" PS/2"\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Infrared"\r
+ },\r
+ {\r
+ 0x06,\r
+ L" HP-HIL"\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Bus mouse"\r
+ },\r
+ {\r
+ 0x08,\r
+ L" ADB(Apple Desktop Bus"\r
+ },\r
+ {\r
+ 0xA0,\r
+ L" Bus mouse DB-9"\r
+ },\r
+ {\r
+ 0xA1,\r
+ L" Bus mouse mirco-DIN"\r
+ },\r
+ {\r
+ 0xA2,\r
+ L" USB"\r
+ },\r
+};\r
+\r
+TABLE_ITEM PBDeviceChemistryTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Lead Acid "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Nickel Cadmium "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Nickel metal hydride "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Lithium-ion "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Zinc air "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Lithium Polymer "\r
+ },\r
+};\r
+\r
+TABLE_ITEM VPLocationTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" OK "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Non-critical "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Critical "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Non-recoverable "\r
+ },\r
+};\r
+\r
+TABLE_ITEM VPStatusTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Processor "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Disk "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Peripheral Bay "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" System Management Module "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Motherboard "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Memory Module "\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Processor Module "\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Power Unit "\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Add-in Card "\r
+ },\r
+};\r
+\r
+TABLE_ITEM CoolingDeviceStatusTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" OK "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Non-critical "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Critical "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Non-recoverable "\r
+ },\r
+};\r
+\r
+TABLE_ITEM CoolingDeviceTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Fan "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Centrifugal Blower "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Chip Fan "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Cabinet Fan "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Power Supply Fan "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Heat Pipe "\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Integrated Refrigeration "\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Active Cooling "\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Passive Cooling "\r
+ },\r
+};\r
+\r
+TABLE_ITEM TemperatureProbeStatusTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" OK "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Non-critical "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Critical "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Non-recoverable "\r
+ },\r
+};\r
+\r
+TABLE_ITEM TemperatureProbeLocTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Processor "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Disk "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Peripheral Bay "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" System Management Module "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Motherboard "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Memory Module "\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Processor Module "\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Power Unit "\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Add-in Card "\r
+ },\r
+};\r
+\r
+TABLE_ITEM ECPStatusTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" OK "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Non-critical "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Critical "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" Non-recoverable "\r
+ },\r
+};\r
+\r
+TABLE_ITEM ECPLocTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" Processor "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Disk "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" Peripheral Bay "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" System Management Module "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" Motherboard "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Memory Module "\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Processor Module "\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Power Unit "\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Add-in Card "\r
+ },\r
+};\r
+\r
+TABLE_ITEM MDTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" National Semiconductor LM75 "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" National Semiconductor LM78 "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" National Semiconductor LM79 "\r
+ },\r
+ {\r
+ 0x06,\r
+ L" National Semiconductor LM80 "\r
+ },\r
+ {\r
+ 0x07,\r
+ L" National Semiconductor LM81 "\r
+ },\r
+ {\r
+ 0x08,\r
+ L" Analog Devices ADM9240 "\r
+ },\r
+ {\r
+ 0x09,\r
+ L" Dallas Semiconductor DS1780 "\r
+ },\r
+ {\r
+ 0x0A,\r
+ L" Maxim 1617 "\r
+ },\r
+ {\r
+ 0x0B,\r
+ L" Genesys GL518SM "\r
+ },\r
+ {\r
+ 0x0C,\r
+ L" Winbond W83781D "\r
+ },\r
+ {\r
+ 0x0D,\r
+ L" Holtek HT82H791 "\r
+ },\r
+};\r
+\r
+TABLE_ITEM MDAddressTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" I/O Port "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" Memory "\r
+ },\r
+ {\r
+ 0x05,\r
+ L" SM Bus "\r
+ },\r
+};\r
+\r
+TABLE_ITEM MemoryChannelTypeTable[] = {\r
+ {\r
+ 0x01,\r
+ L" Other "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" RamBus "\r
+ },\r
+ {\r
+ 0x04,\r
+ L" SyncLink "\r
+ },\r
+};\r
+\r
+TABLE_ITEM IPMIDIBMCInterfaceTypeTable[] = {\r
+ {\r
+ 0x00,\r
+ L" Unknown "\r
+ },\r
+ {\r
+ 0x01,\r
+ L" KCS: Keyboard Controller Style "\r
+ },\r
+ {\r
+ 0x02,\r
+ L" SMIC: Server Management Interface Chip "\r
+ },\r
+ {\r
+ 0x03,\r
+ L" BT: Block Transfer "\r
+ },\r
+ {\r
+ 0xFF04,\r
+ L" Reserved for future assignment by this specification "\r
+ },\r
+};\r
+\r
+TABLE_ITEM StructureTypeInfoTable[] = {\r
+ {\r
+ 0,\r
+ L" BIOS Information"\r
+ },\r
+ {\r
+ 1,\r
+ L" System Information"\r
+ },\r
+ {\r
+ 2,\r
+ L" Base Board Information"\r
+ },\r
+ {\r
+ 3,\r
+ L" System Enclosure"\r
+ },\r
+ {\r
+ 4,\r
+ L" Processor Information"\r
+ },\r
+ {\r
+ 5,\r
+ L" Memory Controller Information "\r
+ },\r
+ {\r
+ 6,\r
+ L" Memory Module Information "\r
+ },\r
+ {\r
+ 7,\r
+ L" Cache Information "\r
+ },\r
+ {\r
+ 8,\r
+ L" Port Connector Information "\r
+ },\r
+ {\r
+ 9,\r
+ L" System Slots "\r
+ },\r
+ {\r
+ 10,\r
+ L" On Board Devices Information "\r
+ },\r
+ {\r
+ 11,\r
+ L" OEM Strings"\r
+ },\r
+ {\r
+ 12,\r
+ L" System Configuration Options "\r
+ },\r
+ {\r
+ 13,\r
+ L" BIOS Language Information "\r
+ },\r
+ {\r
+ 14,\r
+ L" Group Associations "\r
+ },\r
+ {\r
+ 15,\r
+ L" System Event Log "\r
+ },\r
+ {\r
+ 16,\r
+ L" Physical Memory Array "\r
+ },\r
+ {\r
+ 17,\r
+ L" Memory Device "\r
+ },\r
+ {\r
+ 18,\r
+ L" 32-bit Memory Error Information "\r
+ },\r
+ {\r
+ 19,\r
+ L" Memory Array Mapped Address "\r
+ },\r
+ {\r
+ 20,\r
+ L" Memory Device Mapped Address "\r
+ },\r
+ {\r
+ 21,\r
+ L" Built-in Pointing Device "\r
+ },\r
+ {\r
+ 22,\r
+ L" Portable Battery "\r
+ },\r
+ {\r
+ 23,\r
+ L" System Reset "\r
+ },\r
+ {\r
+ 24,\r
+ L" Hardware Security "\r
+ },\r
+ {\r
+ 25,\r
+ L" System Power Controls "\r
+ },\r
+ {\r
+ 26,\r
+ L" Voltage Probe "\r
+ },\r
+ {\r
+ 27,\r
+ L" Cooling Device "\r
+ },\r
+ {\r
+ 28,\r
+ L" Temperature Probe "\r
+ },\r
+ {\r
+ 29,\r
+ L" Electrical Current Probe "\r
+ },\r
+ {\r
+ 30,\r
+ L" Out-of-Band Remote Access "\r
+ },\r
+ {\r
+ 31,\r
+ L" Boot Integrity Services (BIS) Entry Point"\r
+ },\r
+ {\r
+ 32,\r
+ L" System Boot Information "\r
+ },\r
+ {\r
+ 33,\r
+ L" 64-bit Memory Error Information "\r
+ },\r
+ {\r
+ 34,\r
+ L" Management Device "\r
+ },\r
+ {\r
+ 35,\r
+ L" Management Device Component "\r
+ },\r
+ {\r
+ 36,\r
+ L" Management Device Threshold Data "\r
+ },\r
+ {\r
+ 37,\r
+ L" Memory Channel "\r
+ },\r
+ {\r
+ 38,\r
+ L" IPMI Device Information "\r
+ },\r
+ {\r
+ 39,\r
+ L" System Power Supply"\r
+ },\r
+ {\r
+ 0x7E,\r
+ L" Inactive"\r
+ },\r
+ {\r
+ 0x7F,\r
+ L" End-of-Table "\r
+ },\r
+};\r
+\r
+\r
+UINT8\r
+QueryTable (\r
+ IN TABLE_ITEM *Table,\r
+ IN UINTN Number,\r
+ IN UINT8 Key,\r
+ IN OUT CHAR16 *Info\r
+ )\r
+/*++\r
+Routine Description:\r
+ Function Description\r
+ Given a table and a Key, return the responding info.\r
+\r
+ Arguments:\r
+ Table - The begin address of table\r
+ Number - The number of table items\r
+ Key - The query Key\r
+ Info - Input as empty buffer; output as data buffer.\r
+\r
+ Returns:\r
+ if Key found - return found Key and Info\r
+ if Key unfound - return QUERY_TABLE_UNFOUND, Info=NULL\r
+\r
+ Notes:\r
+ Table[Index].Key is change from UINT8 to UINT16,\r
+ in order to deal with "0xaa - 0xbb".\r
+\r
+ For example:\r
+ DisplaySELVariableDataFormatTypes(UINT8 Type, UINT8 Option)\r
+ has a item:\r
+ "0x07-0x7F, Unused"\r
+ Now define Key = 0x7F07, that is to say: High = 0x7F, Low = 0x07.\r
+ Then all the Key Value between Low and High gets the same string\r
+ L"Unused".\r
+\r
+**/\r
+{\r
+ UINTN Index;\r
+ //\r
+ // High byte and Low byte of word\r
+ //\r
+ UINT8 High;\r
+ UINT8 Low;\r
+\r
+ for (Index = 0; Index < Number; Index++) {\r
+ High = (UINT8) (Table[Index].Key >> 8);\r
+ Low = (UINT8) (Table[Index].Key & 0x00FF);\r
+ //\r
+ // Check if Key is in the range\r
+ //\r
+ if (High > Low && Key >= Low && Key <= High) {\r
+ StrCpy (Info, Table[Index].Info);\r
+ StrCat (Info, L"\n");\r
+ return Key;\r
+ }\r
+ //\r
+ // Check if Key == Value in the table\r
+ //\r
+ if (Table[Index].Key == Key) {\r
+ StrCpy (Info, Table[Index].Info);\r
+ StrCat (Info, L"\n");\r
+ return Key;\r
+ }\r
+ }\r
+\r
+ StrCpy (Info, L"Undefined Value\n");\r
+ return QUERY_TABLE_UNFOUND;\r
+}\r
+\r
+VOID\r
+PrintBitsInfo (\r
+ IN TABLE_ITEM *Table,\r
+ IN UINTN Number,\r
+ IN UINT32 Bits\r
+ )\r
+/*++\r
+\r
+ Routine Description:\r
+ Given a table of bit info and a Key,\r
+ return the responding info to the Key.\r
+\r
+ Arguments:\r
+ Table - Point to a table which maintains a map of 'bit' to 'message'\r
+ Number - Number of table items.\r
+ Bits - The Key of query the bit map information.\r
+\r
+ Returns:\r
+ None\r
+\r
+**/\r
+{\r
+ //\r
+ // Get certain bit of 'Value':\r
+ //\r
+#define BIT(Value, bit) ((Value) & ((UINT32) 1) << (bit))\r
+ //\r
+ // Clear certain bit of 'Value':\r
+ //\r
+#define CLR_BIT(Value, bit) ((Value) -= (BIT (Value, bit)))\r
+\r
+ UINTN Index;\r
+ UINT32 Value;\r
+ BOOLEAN NoInfo;\r
+\r
+ NoInfo = TRUE;\r
+ Value = Bits;\r
+ //\r
+ // query the table and print information\r
+ //\r
+ for (Index = 0; Index < Number; Index++) {\r
+ if (BIT (Value, Table[Index].Key) != 0) {\r
+ Print (Table[Index].Info);\r
+ Print (L" | ");\r
+\r
+ NoInfo = FALSE;\r
+ //\r
+ // clear the bit, for reserved bits test\r
+ //\r
+ CLR_BIT (Value, Table[Index].Key);\r
+ }\r
+ }\r
+\r
+ if (NoInfo) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_NO_INFO), gShellDebug1HiiHandle);\r
+ }\r
+\r
+ if (Value != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_BITS_SET),\r
+ gShellDebug1HiiHandle,\r
+ Value\r
+ );\r
+ }\r
+\r
+ Print (L"\n");\r
+}\r
+//\r
+// //////////////////////////////////////////////////////////////////\r
+//\r
+// Following uses QueryTable functions to simplify the coding.\r
+// QueryTable(), PrintBitsInfo()\r
+//\r
+//\r
+#define PRINT_TABLE_ITEM(Table, Key) \\r
+ do { \\r
+ UINTN Num; \\r
+ CHAR16 Info[66]; \\r
+ Num = sizeof (Table) / sizeof (TABLE_ITEM); \\r
+ ZeroMem (Info, sizeof (Info)); \\r
+ QueryTable (Table, Num, Key, Info); \\r
+ Print (Info); \\r
+ } while (0);\r
+\r
+#define PRINT_BITS_INFO(Table, bits) \\r
+ do { \\r
+ UINTN Num; \\r
+ Num = sizeof (Table) / sizeof (TABLE_ITEM); \\r
+ PrintBitsInfo (Table, Num, (UINT32) bits); \\r
+ } while (0);\r
+\r
+//\r
+////////////////////////////////////////////////////////////////////\r
+//\r
+// System Information (Type 1)\r
+//\r
+VOID\r
+DisplaySystemWakeupType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_WAKEUP_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (SystemWakeupTypeTable, Type);\r
+}\r
+//\r
+// System Enclosure (Type 3)\r
+//\r
+VOID\r
+DisplaySystemEnclosureType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ //\r
+ // query table and print info\r
+ //\r
+ PRINT_TABLE_ITEM (SystemEnclosureTypeTable, Type);\r
+\r
+ if (BIT (Type, 7) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CHASSIS_LOCK_PRESENT), gShellDebug1HiiHandle);\r
+ }\r
+}\r
+\r
+VOID\r
+DisplaySystemEnclosureStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (SystemEnclosureStatusTable, Status);\r
+}\r
+\r
+VOID\r
+DisplaySESecurityStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_CHASSIS_SECURITY), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (SESecurityStatusTable, Status);\r
+}\r
+//\r
+// Processor Information (Type 4)\r
+//\r
+VOID\r
+DisplayProcessorType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (ProcessorTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayProcessorUpgrade (\r
+ UINT8 Upgrade,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_UPDATE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Upgrade, Option);\r
+ PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade);\r
+}\r
+//\r
+// Memory Controller Information (Type 5)\r
+//\r
+VOID\r
+DisplayMcErrorDetectMethod (\r
+ UINT8 Method,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DETECTMETHOD), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Method, Option);\r
+ PRINT_TABLE_ITEM (McErrorDetectMethodTable, Method);\r
+}\r
+\r
+VOID\r
+DisplayMcErrorCorrectCapability (\r
+ UINT8 Capability,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CORRECT_CAPABILITY), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Capability, Option);\r
+ PRINT_BITS_INFO (McErrorCorrectCapabilityTable, Capability);\r
+}\r
+\r
+VOID\r
+DisplayMcInterleaveSupport (\r
+ UINT8 Support,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_INTERLEAVE_SUPPORT), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Support, Option);\r
+ PRINT_TABLE_ITEM (McInterleaveSupportTable, Support);\r
+}\r
+\r
+VOID\r
+DisplayMcMemorySpeeds (\r
+ UINT16 Speed,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MEMORY_SPEED), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Speed, Option);\r
+ PRINT_BITS_INFO (McMemorySpeedsTable, Speed);\r
+}\r
+\r
+VOID\r
+DisplayMemoryModuleVoltage (\r
+ UINT8 Voltage,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_REQUIRED_VOLTAGES), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Voltage, Option);\r
+ PRINT_BITS_INFO (MemoryModuleVoltageTable, Voltage);\r
+}\r
+//\r
+// Memory Module Information (Type 6)\r
+//\r
+VOID\r
+DisplayMmMemoryType (\r
+ UINT16 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_BITS_INFO (MmMemoryTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayMmErrorStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_MODULE_ERROR_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_BITS_INFO (MmErrorStatusTable, Status);\r
+}\r
+//\r
+// Cache Information (Type 7)\r
+//\r
+VOID\r
+DisplayCacheSRAMType (\r
+ UINT16 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SRAM_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION ((UINT8) Type, Option);\r
+ PRINT_BITS_INFO (CacheSRAMTypeTable, (UINT8) Type);\r
+}\r
+\r
+VOID\r
+DisplayCacheErrCorrectingType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ERROR_CORRECTING), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (CacheErrCorrectingTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayCacheSystemCacheType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_SYSTEM_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (CacheSystemCacheTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayCacheAssociativity (\r
+ UINT8 Associativity,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_CACHE_ASSOCIATIVITY), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Associativity, Option);\r
+ PRINT_TABLE_ITEM (CacheAssociativityTable, Associativity);\r
+}\r
+//\r
+// Port Connector Information (Type 8)\r
+//\r
+VOID\r
+DisplayPortConnectorType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_CONNECTOR_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (PortConnectorTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayPortType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORT_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (PortTypeTable, Type);\r
+}\r
+//\r
+// System Slots (Type 9)\r
+//\r
+VOID\r
+DisplaySystemSlotType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (SystemSlotTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplaySystemSlotDataBusWidth (\r
+ UINT8 Width,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_DATA), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Width, Option);\r
+ PRINT_TABLE_ITEM (SystemSlotDataBusWidthTable, Width);\r
+}\r
+\r
+VOID\r
+DisplaySystemSlotCurrentUsage (\r
+ UINT8 Usage,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_CURRENT_USAGE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Usage, Option);\r
+ PRINT_TABLE_ITEM (SystemSlotCurrentUsageTable, Usage);\r
+}\r
+\r
+VOID\r
+DisplaySystemSlotLength (\r
+ UINT8 Length,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_SLOT_LENGTH), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Length, Option);\r
+ PRINT_TABLE_ITEM (SystemSlotLengthTable, Length);\r
+}\r
+\r
+VOID\r
+DisplaySlotCharacteristics1 (\r
+ UINT8 Chara1,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Chara1, Option);\r
+ PRINT_BITS_INFO (SlotCharacteristics1Table, Chara1);\r
+}\r
+\r
+VOID\r
+DisplaySlotCharacteristics2 (\r
+ UINT8 Chara2,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SLOT_CHARACTERISTICS_2), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Chara2, Option);\r
+ PRINT_BITS_INFO (SlotCharacteristics2Table, Chara2);\r
+}\r
+//\r
+// On Board Devices Information (Type 10)\r
+//\r
+VOID\r
+DisplayOnboardDeviceTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ONBOARD_DEVICE_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (OnboardDeviceTypesTable, Type);\r
+}\r
+//\r
+// System Event Log (Type 15)\r
+//\r
+VOID\r
+DisplaySELTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_EVENT_LOG_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (SELTypesTable, Type);\r
+}\r
+\r
+VOID\r
+DisplaySELVarDataFormatType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_EVENT_LOG_VAR_DATA_FORMAT), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (SELVarDataFormatTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayPostResultsBitmapDw1 (\r
+ UINT32 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_BITMAP), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_BITS_INFO (PostResultsBitmapDw1Table, Key);\r
+}\r
+\r
+VOID\r
+DisplayPostResultsBitmapDw2 (\r
+ UINT32 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POST_RESULTS_SECOND_DWORD), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_BITS_INFO (PostResultsBitmapDw2Table, Key);\r
+}\r
+\r
+VOID\r
+DisplaySELSysManagementTypes (\r
+ UINT32 SMType,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Temp;\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_TYPES), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (SMType, Option);\r
+\r
+ //\r
+ // Deal with wide range Value\r
+ //\r
+ if (SMType >= 0x80000000) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_OEM_ASSIGNED), gShellDebug1HiiHandle);\r
+ } else if (SMType >= 0x00020000) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r
+ } else if (SMType >= 0x00010000) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_SYSTEM_MANAGEMENT_PROBE), gShellDebug1HiiHandle);\r
+ } else if (SMType >= 0x31) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_RSVD_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);\r
+ } else {\r
+ //\r
+ // Deal with One byte data\r
+ //\r
+ Temp = (UINT8) (SMType & 0x3F);\r
+ PRINT_TABLE_ITEM (SELSysManagementTypesTable, Temp);\r
+ }\r
+}\r
+//\r
+// Physical Memory Array (Type 16)\r
+//\r
+VOID\r
+DisplayPMALocation (\r
+ UINT8 Location,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Location, Option);\r
+ PRINT_TABLE_ITEM (PMALocationTable, Location);\r
+}\r
+\r
+VOID\r
+DisplayPMAUse (\r
+ UINT8 Use,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_LOCATION), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Use, Option);\r
+ PRINT_TABLE_ITEM (PMAUseTable, Use);\r
+}\r
+\r
+VOID\r
+DisplayPMAErrorCorrectionTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PHYS_MEM_ARRAY_ERROR), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (PMAErrorCorrectionTypesTable, Type);\r
+}\r
+//\r
+// Memory Device (Type 17)\r
+//\r
+VOID\r
+DisplayMemoryDeviceFormFactor (\r
+ UINT8 FormFactor,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_FORM_FACTOR), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (FormFactor, Option);\r
+ PRINT_TABLE_ITEM (MemoryDeviceFormFactorTable, FormFactor);\r
+}\r
+\r
+VOID\r
+DisplayMemoryDeviceType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (MemoryDeviceTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayMemoryDeviceTypeDetail (\r
+ UINT16 para,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_DEVICE_TYPE_DETAIL), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (para, Option);\r
+ PRINT_BITS_INFO (MemoryDeviceTypeDetailTable, para);\r
+}\r
+//\r
+// 32-bit Memory Error Information (Type 18)\r
+//\r
+VOID\r
+DisplayMemoryErrorType (\r
+ UINT8 ErrorType,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_INFO), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (ErrorType, Option);\r
+ PRINT_TABLE_ITEM (MemoryErrorTypeTable, ErrorType);\r
+}\r
+\r
+VOID\r
+DisplayMemoryErrorGranularity (\r
+ UINT8 Granularity,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_GRANULARITY), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Granularity, Option);\r
+ PRINT_TABLE_ITEM (MemoryErrorGranularityTable, Granularity);\r
+}\r
+\r
+VOID\r
+DisplayMemoryErrorOperation (\r
+ UINT8 Operation,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_ERROR_OP), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Operation, Option);\r
+ PRINT_TABLE_ITEM (MemoryErrorOperationTable, Operation);\r
+}\r
+//\r
+// Built-in Pointing Device (Type 21)\r
+//\r
+VOID\r
+DisplayPointingDeviceType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (PointingDeviceTypeTable, Type);\r
+}\r
+\r
+VOID\r
+DisplayPointingDeviceInterface (\r
+ UINT8 Interface,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_POINTING_DEVICE_INTERFACE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Interface, Option);\r
+ PRINT_TABLE_ITEM (PointingDeviceInterfaceTable, Interface);\r
+}\r
+//\r
+// Portable Battery (Type 22)\r
+//\r
+VOID\r
+DisplayPBDeviceChemistry (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PORTABLE_BATT_DEV_CHEM), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (PBDeviceChemistryTable, Key);\r
+}\r
+//\r
+// Voltage Probe (Type 26)\r
+//\r
+VOID\r
+DisplayVPLocation (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Loc;\r
+\r
+ Loc = (UINT8) ((Key & 0xE0) >> 5);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Loc, Option);\r
+ PRINT_TABLE_ITEM (VPLocationTable, Loc);\r
+}\r
+\r
+VOID\r
+DisplayVPStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Status;\r
+\r
+ Status = (UINT8) (Key & 0x1F);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (VPStatusTable, Status);\r
+}\r
+//\r
+// Voltage Probe (Type 27)\r
+//\r
+VOID\r
+DisplayCoolingDeviceStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Status;\r
+\r
+ Status = (UINT8) ((Key & 0xE0) >> 5);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (CoolingDeviceStatusTable, Status);\r
+}\r
+\r
+VOID\r
+DisplayCoolingDeviceType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Type;\r
+\r
+ Type = (UINT8) (Key & 0x1F);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_COOLING_DEV_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Type, Option);\r
+ PRINT_TABLE_ITEM (CoolingDeviceTypeTable, Type);\r
+}\r
+//\r
+// Temperature Probe (Type 28)\r
+//\r
+VOID\r
+DisplayTemperatureProbeStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Status;\r
+\r
+ Status = (UINT8) ((Key & 0xE0) >> 5);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_TEMP_PROBE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (TemperatureProbeStatusTable, Status);\r
+}\r
+\r
+VOID\r
+DisplayTemperatureProbeLoc (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Loc;\r
+\r
+ Loc = (UINT8) (Key & 0x1F);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_VOLTAGE_PROBE_LOC), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Loc, Option);\r
+ PRINT_TABLE_ITEM (TemperatureProbeLocTable, Loc);\r
+}\r
+//\r
+// Electrical Current Probe (Type 29)\r
+//\r
+VOID\r
+DisplayECPStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Status;\r
+\r
+ Status = (UINT8) ((Key & 0xE0) >> 5);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_STATUS), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Status, Option);\r
+ PRINT_TABLE_ITEM (ECPStatusTable, Status);\r
+}\r
+\r
+VOID\r
+DisplayECPLoc (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ UINT8 Loc;\r
+\r
+ Loc = (UINT8) (Key & 0x1F);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_ELEC_PROBE_LOC), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Loc, Option);\r
+ PRINT_TABLE_ITEM (ECPLocTable, Loc);\r
+}\r
+//\r
+// Management Device (Type 34)\r
+//\r
+VOID\r
+DisplayMDType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (MDTypeTable, Key);\r
+}\r
+\r
+VOID\r
+DisplayMDAddressType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (MDAddressTypeTable, Key);\r
+}\r
+//\r
+// Memory Channel (Type 37)\r
+//\r
+VOID\r
+DisplayMemoryChannelType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MEM_CHANNEL_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (MemoryChannelTypeTable, Key);\r
+}\r
+//\r
+// IPMI Device Information (Type 38)\r
+//\r
+VOID\r
+DisplayIPMIDIBMCInterfaceType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BMC_INTERFACE_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (IPMIDIBMCInterfaceTypeTable, Key);\r
+}\r
+\r
+VOID\r
+DisplayStructureTypeInfo (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ )\r
+{\r
+ //\r
+ // display\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_STRUCT_TYPE), gShellDebug1HiiHandle);\r
+ PRINT_INFO_OPTION (Key, Option);\r
+ PRINT_TABLE_ITEM (StructureTypeInfoTable, Key);\r
+}\r
--- /dev/null
+/** @file\r
+ Build a table, each item is (key, info) pair.\r
+ and give a interface of query a string out of a table.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _SMBIOS_QUERY_TABLE_H\r
+#define _SMBIOS_QUERY_TABLE_H\r
+\r
+#define QUERY_TABLE_UNFOUND 0xFF\r
+\r
+typedef struct TABLE_ITEM {\r
+ UINT16 Key;\r
+ CHAR16 *Info;\r
+} TABLE_ITEM;\r
+\r
+//\r
+// Print info by option\r
+//\r
+#define PRINT_INFO_OPTION(Value, Option) \\r
+ do { \\r
+ if (Option == SHOW_NONE) { \\r
+ return ; \\r
+ } \\r
+ if (Option < SHOW_DETAIL) { \\r
+ Print (L"0x%x\n", Value); \\r
+ return ; \\r
+ } \\r
+ } while (0);\r
+\r
+UINT8\r
+QueryTable (\r
+ IN TABLE_ITEM *Table,\r
+ IN UINTN Number,\r
+ IN UINT8 Key,\r
+ IN OUT CHAR16 *Info\r
+ );\r
+\r
+VOID\r
+PrintBitsInfo (\r
+ IN TABLE_ITEM *Table,\r
+ IN UINTN Number,\r
+ IN UINT32 Bits\r
+ );\r
+\r
+//\r
+// Display the element detail information\r
+//\r
+VOID\r
+DisplayStructureTypeInfo (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Information (Type 1)\r
+//\r
+VOID\r
+DisplaySystemWakeupType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Enclosure (Type 3)\r
+//\r
+VOID\r
+DisplaySystemEnclosureType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySystemEnclosureStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySESecurityStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Processor Information (Type 4)\r
+//\r
+VOID\r
+DisplayProcessorType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayProcessorUpgrade (\r
+ UINT8 Upgrade,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Controller Information (Type 5)\r
+//\r
+VOID\r
+DisplayMcErrorDetectMethod (\r
+ UINT8 Method,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMcErrorCorrectCapability (\r
+ UINT8 Capability,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMcInterleaveSupport (\r
+ UINT8 Support,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMcMemorySpeeds (\r
+ UINT16 Speed,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryModuleVoltage (\r
+ UINT8 Voltage,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Module Information (Type 6)\r
+//\r
+VOID\r
+DisplayMmMemoryType (\r
+ UINT16 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMmErrorStatus (\r
+ UINT8 Status,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Cache Information (Type 7)\r
+//\r
+VOID\r
+DisplayCacheSRAMType (\r
+ UINT16 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayCacheErrCorrectingType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayCacheSystemCacheType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayCacheAssociativity (\r
+ UINT8 Associativity,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Port Connector Information (Type 8)\r
+//\r
+VOID\r
+DisplayPortConnectorType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPortType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Slots (Type 9)\r
+//\r
+VOID\r
+DisplaySystemSlotType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySystemSlotDataBusWidth (\r
+ UINT8 Width,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySystemSlotCurrentUsage (\r
+ UINT8 Usage,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySystemSlotLength (\r
+ UINT8 Length,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySlotCharacteristics1 (\r
+ UINT8 Chara1,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySlotCharacteristics2 (\r
+ UINT8 Chara2,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// On Board Devices Information (Type 10)\r
+//\r
+VOID\r
+DisplayOnboardDeviceTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// System Event Log (Type 15)\r
+//\r
+VOID\r
+DisplaySELTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySELVarDataFormatType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPostResultsBitmapDw1 (\r
+ UINT32 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPostResultsBitmapDw2 (\r
+ UINT32 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplaySELSysManagementTypes (\r
+ UINT32 SMType,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Physical Memory Array (Type 16)\r
+//\r
+VOID\r
+DisplayPMALocation (\r
+ UINT8 Location,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPMAUse (\r
+ UINT8 Use,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPMAErrorCorrectionTypes (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Device (Type 17)\r
+//\r
+VOID\r
+DisplayMemoryDeviceFormFactor (\r
+ UINT8 FormFactor,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryDeviceType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryDeviceTypeDetail (\r
+ UINT16 Parameter,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// 32-bit Memory Error Information (Type 18)\r
+//\r
+VOID\r
+DisplayMemoryErrorType (\r
+ UINT8 ErrorType,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryErrorGranularity (\r
+ UINT8 Granularity,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMemoryErrorOperation (\r
+ UINT8 Operation,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Array Mapped Address (Type 19)\r
+// Memory Device Mapped Address (Type 20)\r
+//\r
+// Built-in Pointing Device (Type 21)\r
+//\r
+VOID\r
+DisplayPointingDeviceType (\r
+ UINT8 Type,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayPointingDeviceInterface (\r
+ UINT8 Interface,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Portable Battery (Type 22)\r
+//\r
+VOID\r
+DisplayPBDeviceChemistry (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Voltage Probe (Type 26)\r
+//\r
+VOID\r
+DisplayVPLocation (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayVPStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Voltage Probe (Type 27)\r
+//\r
+VOID\r
+DisplayCoolingDeviceStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayCoolingDeviceType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Temperature Probe (Type 28)\r
+//\r
+VOID\r
+DisplayTemperatureProbeStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayTemperatureProbeLoc (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Electrical Current Probe (Type 29)\r
+//\r
+VOID\r
+DisplayECPStatus (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayECPLoc (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Management Device (Type 34)\r
+//\r
+VOID\r
+DisplayMDType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+VOID\r
+DisplayMDAddressType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// Memory Channel (Type 37)\r
+//\r
+VOID\r
+DisplayMemoryChannelType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+//\r
+// IPMI Device Information (Type 38)\r
+//\r
+VOID\r
+DisplayIPMIDIBMCInterfaceType (\r
+ UINT8 Key,\r
+ UINT8 Option\r
+ );\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Lib fucntions for SMBIOS. Used to get system serial number and GUID\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include <Guid/Smbios.h>\r
+#include "LibSmbios.h"\r
+\r
+EFI_STATUS\r
+LibGetSmbiosSystemGuidAndSerialNumber (\r
+ IN EFI_GUID *SystemGuid,\r
+ OUT CHAR8 **SystemSerialNumber\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+ SMBIOS_STRUCTURE_TABLE *SmbiosTable;\r
+ SMBIOS_STRUCTURE_POINTER Smbios;\r
+ SMBIOS_STRUCTURE_POINTER SmbiosEnd;\r
+ UINT16 Index;\r
+\r
+ Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);\r
+ if (EFI_ERROR (Status)) {\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ Smbios.Hdr = (SMBIOS_HEADER *) ((UINTN) (SmbiosTable->TableAddress));\r
+\r
+ SmbiosEnd.Raw = (UINT8 *) ((UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength));\r
+ for (Index = 0; Index < SmbiosTable->TableLength; Index++) {\r
+ if (Smbios.Hdr->Type == 1) {\r
+ if (Smbios.Hdr->Length < 0x19) {\r
+ //\r
+ // Older version did not support Guid and Serial number\r
+ //\r
+ continue;\r
+ }\r
+ //\r
+ // SMBIOS tables are byte packed so we need to do a byte copy to\r
+ // prevend alignment faults on Itanium-based platform.\r
+ //\r
+ CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID));\r
+ *SystemSerialNumber = LibGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // Make Smbios point to the next record\r
+ //\r
+ LibGetSmbiosString (&Smbios, (UINT16) (-1));\r
+\r
+ if (Smbios.Raw >= SmbiosEnd.Raw) {\r
+ //\r
+ // SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e.\r
+ // given this we must double check against the lenght of\r
+ // the structure. My home PC has this bug.ruthard\r
+ //\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+CHAR8 *\r
+LibGetSmbiosString (\r
+ IN SMBIOS_STRUCTURE_POINTER *Smbios,\r
+ IN UINT16 StringNumber\r
+ )\r
+/*++\r
+Routine Description:\r
+ Return SMBIOS string given the string number.\r
+\r
+ Arguments:\r
+ Smbios - Pointer to SMBIOS structure\r
+ StringNumber - String number to return. -1 is used to skip all strings and\r
+ point to the next SMBIOS structure.\r
+\r
+ Returns:\r
+ Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1\r
+**/\r
+{\r
+ UINT16 Index;\r
+ CHAR8 *String;\r
+\r
+ ASSERT (Smbios != NULL);\r
+\r
+ //\r
+ // Skip over formatted section\r
+ //\r
+ String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);\r
+\r
+ //\r
+ // Look through unformated section\r
+ //\r
+ for (Index = 1; Index <= StringNumber; Index++) {\r
+ if (StringNumber == Index) {\r
+ return String;\r
+ }\r
+ //\r
+ // Skip string\r
+ //\r
+ for (; *String != 0; String++);\r
+ String++;\r
+\r
+ if (*String == 0) {\r
+ //\r
+ // If double NULL then we are done.\r
+ // Retrun pointer to next structure in Smbios.\r
+ // if you pass in a -1 you will always get here\r
+ //\r
+ Smbios->Raw = (UINT8 *)++String;\r
+ return NULL;\r
+ }\r
+ }\r
+\r
+ return NULL;\r
+}\r
--- /dev/null
+/** @file\r
+ Tools of clarify the content of the smbios table.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "../UefiShellDebug1CommandsLib.h"\r
+#include "LibSmbiosView.h"\r
+#include "smbiosview.h"\r
+#include "PrintInfo.h"\r
+#include "QueryTable.h"\r
+\r
+UINT8 gShowType = SHOW_DETAIL;\r
+STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL;\r
+\r
+UINT8 SmbiosMajorVersion;\r
+UINT8 SmbiosMinorVersion;\r
+\r
+STATIC CONST SHELL_PARAM_ITEM ParamList[] = {\r
+ {L"-t", TypeValue},\r
+ {L"-h", TypeValue},\r
+ {L"-s", TypeFlag},\r
+ {L"-a", TypeFlag},\r
+ {NULL, TypeMax}\r
+ };\r
+\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSmbiosView (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ UINT8 StructType;\r
+ UINT16 StructHandle;\r
+ EFI_STATUS Status;\r
+ BOOLEAN RandomView;\r
+ LIST_ENTRY *Package;\r
+ CHAR16 *ProblemParam;\r
+ SHELL_STATUS ShellStatus;\r
+ CONST CHAR16 *Temp;\r
+\r
+ mStatisticsTable = NULL;\r
+ Package = NULL;\r
+ ShellStatus = SHELL_SUCCESS;\r
+\r
+ Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);\r
+ if (EFI_ERROR(Status)) {\r
+ if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);\r
+ FreePool(ProblemParam);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+ ASSERT(FALSE);\r
+ }\r
+ } else {\r
+ if (ShellCommandLineGetCount(Package) > 1) {\r
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);\r
+ ShellStatus = SHELL_INVALID_PARAMETER;\r
+ } else {\r
+\r
+ //\r
+ // Init Lib\r
+ //\r
+ Status = LibSmbiosInit ();\r
+ if (EFI_ERROR (Status)) {\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+ //\r
+ // build statistics table\r
+ //\r
+ Status = InitSmbiosTableStatistics ();\r
+ if (EFI_ERROR (Status)) {\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ goto Done;\r
+ }\r
+\r
+ StructType = STRUCTURE_TYPE_RANDOM;\r
+ RandomView = TRUE;\r
+ //\r
+ // Initialize the StructHandle to be the first handle\r
+ //\r
+ StructHandle = STRUCTURE_HANDLE_INVALID;\r
+ LibGetSmbiosStructure (&StructHandle, NULL, NULL);\r
+\r
+ Temp = ShellCommandLineGetValue(Package, L"-t");\r
+ if (Temp != NULL) {\r
+ StructType = (UINT8) ShellStrToUintn (Temp);\r
+ }\r
+\r
+ Temp = ShellCommandLineGetValue(Package, L"-h");\r
+ if (Temp != NULL) {\r
+ RandomView = FALSE;\r
+ StructHandle = (UINT16) ShellStrToUintn(Temp);\r
+ }\r
+\r
+ if (ShellCommandLineGetFlag(Package, L"-s")) {\r
+ Status = DisplayStatisticsTable (SHOW_DETAIL);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ goto Done;\r
+ }\r
+\r
+ if (ShellCommandLineGetFlag(Package, L"-a")) {\r
+ gShowType = SHOW_ALL;\r
+ }\r
+ //\r
+ // Show SMBIOS structure information\r
+ //\r
+ Status = SMBiosView (StructType, StructHandle, gShowType, RandomView);\r
+ if (EFI_ERROR(Status)) {\r
+ ShellStatus = SHELL_NOT_FOUND;\r
+ }\r
+ }\r
+ }\r
+Done:\r
+ //\r
+ // Release resources\r
+ //\r
+ if (mStatisticsTable != NULL) {\r
+ //\r
+ // Release statistics table\r
+ //\r
+ FreePool (mStatisticsTable);\r
+ mStatisticsTable = NULL;\r
+ }\r
+\r
+ if (Package != NULL) {\r
+ ShellCommandLineFreeVarList (Package);\r
+ }\r
+\r
+ LibSmbiosCleanup ();\r
+\r
+ return ShellStatus;\r
+}\r
+\r
+/**\r
+ Query all structures Data from SMBIOS table and Display\r
+ the information to users as required display option.\r
+\r
+ @param[in] QueryType Structure type to view.\r
+ @param[in] QueryHandle Structure handle to view.\r
+ @param[in] Option Display option: none,outline,normal,detail.\r
+ @param[in] RandomView Support for -h parameter.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+ @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SMBiosView (\r
+ IN UINT8 QueryType,\r
+ IN UINT16 QueryHandle,\r
+ IN UINT8 Option,\r
+ IN BOOLEAN RandomView\r
+ )\r
+{\r
+ UINT16 Handle;\r
+ UINT8 Buffer[1024];\r
+ //\r
+ // bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize\r
+ //\r
+ UINT16 Length;\r
+ UINTN Index;\r
+ UINT16 Offset;\r
+ //\r
+ // address offset from structure table head.\r
+ //\r
+ UINT32 TableHead;\r
+ //\r
+ // structure table head.\r
+ //\r
+\r
+ SMBIOS_STRUCTURE_POINTER pStruct;\r
+ SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
+\r
+ SMBiosTable = NULL;\r
+ LibSmbiosGetEPS (&SMBiosTable);\r
+ if (SMBiosTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);\r
+ return EFI_BAD_BUFFER_SIZE;\r
+ }\r
+\r
+ if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) {\r
+ //\r
+ // Have get SMBIOS table\r
+ //\r
+ SmbiosPrintEPSInfo (SMBiosTable, Option);\r
+\r
+ SmbiosMajorVersion = SMBiosTable->MajorVersion;\r
+ SmbiosMinorVersion = SMBiosTable->MinorVersion;\r
+\r
+ ShellPrintEx(-1,-1,L"=========================================================\n");\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);\r
+\r
+ if (QueryType == STRUCTURE_TYPE_RANDOM) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);\r
+ }\r
+\r
+ if (RandomView) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);\r
+ } else {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);\r
+ }\r
+\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);\r
+ ShellPrintEx(-1,-1,GetShowTypeString (gShowType));\r
+ ShellPrintEx(-1,-1,L"\n\n");\r
+\r
+/*\r
+ //\r
+ // Get internal commands, such as change options.\r
+ //\r
+ Status = WaitEnter ();\r
+ if (EFI_ERROR (Status)) {\r
+ if (Status == EFI_ABORTED) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return Status;\r
+ }\r
+*/\r
+\r
+ //\r
+ // Searching and display structure info\r
+ //\r
+ Handle = QueryHandle;\r
+ TableHead = SMBiosTable->TableAddress;\r
+ Offset = 0;\r
+ for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) {\r
+ //\r
+ // if reach the end of table, break..\r
+ //\r
+ if (Handle == STRUCTURE_HANDLE_INVALID) {\r
+ break;\r
+ }\r
+ //\r
+ // handle then point to the next!\r
+ //\r
+ if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {\r
+ break;\r
+ }\r
+ Offset = (UINT16) (Offset + Length);\r
+ pStruct.Raw = Buffer;\r
+\r
+ //\r
+ // if QueryType==Random, print this structure.\r
+ // if QueryType!=Random, but Hdr->Type==QueryType, also print it.\r
+ // only if QueryType != Random and Hdr->Type != QueryType, skiped it.\r
+ //\r
+ if (QueryType != STRUCTURE_TYPE_RANDOM && pStruct.Hdr->Type != QueryType) {\r
+ continue;\r
+ }\r
+\r
+ ShellPrintEx(-1,-1,L"\n=========================================================\n");\r
+ ShellPrintHiiEx(-1,-1,NULL,\r
+ STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),\r
+ gShellDebug1HiiHandle,\r
+ pStruct.Hdr->Type,\r
+ pStruct.Hdr->Handle\r
+ );\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);\r
+ //\r
+ // Addr of structure in structure in table\r
+ //\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset);\r
+ DumpHex (0, 0, Length, Buffer);\r
+\r
+/*\r
+ //\r
+ // Get internal commands, such as change options.\r
+ //\r
+ Status = WaitEnter ();\r
+ if (EFI_ERROR (Status)) {\r
+ if (Status == EFI_ABORTED) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return Status;\r
+ }\r
+*/\r
+\r
+ if (gShowType != SHOW_NONE) {\r
+ //\r
+ // check structure legality\r
+ //\r
+ SmbiosCheckStructure (&pStruct);\r
+\r
+ //\r
+ // Print structure information\r
+ //\r
+ SmbiosPrintStructure (&pStruct, gShowType);\r
+ ShellPrintEx(-1,-1,L"\n");\r
+\r
+/*\r
+ //\r
+ // Get internal commands, such as change options.\r
+ //\r
+ Status = WaitEnter ();\r
+ if (EFI_ERROR (Status)) {\r
+ if (Status == EFI_ABORTED) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return Status;\r
+ }\r
+*/\r
+ }\r
+ if (!RandomView) {\r
+ break;\r
+ }\r
+ }\r
+\r
+ ShellPrintEx(-1,-1,L"\n=========================================================\n");\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return EFI_BAD_BUFFER_SIZE;\r
+}\r
+\r
+/**\r
+ Function to initialize the global mStatisticsTable object.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitSmbiosTableStatistics (\r
+ VOID\r
+ )\r
+{\r
+ UINT16 Handle;\r
+ UINT8 Buffer[1024];\r
+ UINT16 Length;\r
+ UINT16 Offset;\r
+ UINT16 Index;\r
+\r
+ SMBIOS_STRUCTURE_POINTER pStruct;\r
+ SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
+ STRUCTURE_STATISTICS *pStatistics;\r
+\r
+ SMBiosTable = NULL;\r
+ LibSmbiosGetEPS (&SMBiosTable);\r
+ if (SMBiosTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) != 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);\r
+ return EFI_INVALID_PARAMETER;\r
+ }\r
+ //\r
+ // Allocate memory to mStatisticsTable\r
+ //\r
+ if (mStatisticsTable != NULL) {\r
+ FreePool (mStatisticsTable);\r
+ mStatisticsTable = NULL;\r
+ }\r
+\r
+ mStatisticsTable = (STRUCTURE_STATISTICS *) AllocatePool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));\r
+\r
+ if (mStatisticsTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);\r
+ return EFI_OUT_OF_RESOURCES;\r
+ }\r
+\r
+ Offset = 0;\r
+ pStatistics = mStatisticsTable;\r
+\r
+ //\r
+ // search from the first one\r
+ //\r
+ Handle = STRUCTURE_HANDLE_INVALID;\r
+ LibGetSmbiosStructure (&Handle, NULL, NULL);\r
+ for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) {\r
+ //\r
+ // If reach the end of table, break..\r
+ //\r
+ if (Handle == STRUCTURE_HANDLE_INVALID) {\r
+ break;\r
+ }\r
+ //\r
+ // After LibGetSmbiosStructure(), handle then point to the next!\r
+ //\r
+ if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {\r
+ break;\r
+ }\r
+\r
+ pStruct.Raw = Buffer;\r
+ Offset = (UINT16) (Offset + Length);\r
+\r
+ //\r
+ // general statistics\r
+ //\r
+ pStatistics->Index = Index;\r
+ pStatistics->Type = pStruct.Hdr->Type;\r
+ pStatistics->Handle = pStruct.Hdr->Handle;\r
+ pStatistics->Length = Length;\r
+ pStatistics->Addr = Offset;\r
+\r
+ pStatistics = &mStatisticsTable[Index];\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ Function to display the global mStatisticsTable object.\r
+\r
+ @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DisplayStatisticsTable (\r
+ IN UINT8 Option\r
+ )\r
+{\r
+ UINTN Index;\r
+ UINTN Num;\r
+ STRUCTURE_STATISTICS *pStatistics;\r
+ SMBIOS_STRUCTURE_TABLE *SMBiosTable;\r
+\r
+ SMBiosTable = NULL;\r
+ if (Option < SHOW_OUTLINE) {\r
+ return EFI_SUCCESS;\r
+ }\r
+ //\r
+ // display EPS information firstly\r
+ //\r
+ LibSmbiosGetEPS (&SMBiosTable);\r
+ if (SMBiosTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);\r
+ return EFI_UNSUPPORTED;\r
+ }\r
+\r
+ ShellPrintEx(-1,-1,L"\n============================================================\n");\r
+ SmbiosPrintEPSInfo (SMBiosTable, Option);\r
+\r
+ if (Option < SHOW_NORMAL) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ if (mStatisticsTable == NULL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);\r
+ return EFI_NOT_FOUND;\r
+ }\r
+\r
+ ShellPrintEx(-1,-1,L"============================================================\n");\r
+ pStatistics = &mStatisticsTable[0];\r
+ Num = SMBiosTable->NumberOfSmbiosStructures;\r
+ //\r
+ // display statistics table content\r
+ //\r
+ for (Index = 1; Index <= Num; Index++) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, pStatistics->Index);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, pStatistics->Type);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, pStatistics->Handle);\r
+ if (Option >= SHOW_DETAIL) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, pStatistics->Addr);\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, pStatistics->Length);\r
+ }\r
+\r
+ ShellPrintEx(-1,-1,L"\n");\r
+ pStatistics = &mStatisticsTable[Index];\r
+/*\r
+ //\r
+ // Display 20 lines and wait for a page break\r
+ //\r
+ if (Index % 20 == 0) {\r
+ ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);\r
+ Status = WaitEnter ();\r
+ if (EFI_ERROR (Status)) {\r
+ if (Status == EFI_ABORTED) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ return Status;\r
+ }\r
+ }\r
+*/\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ function to return a string of the detail level.\r
+\r
+ @param[in] ShowType The detail level whose name is desired in clear text.\r
+\r
+ @return A pointer to a string representing the ShowType (or 'undefined type' if not known).\r
+**/\r
+CHAR16 *\r
+EFIAPI\r
+GetShowTypeString (\r
+ UINT8 ShowType\r
+ )\r
+{\r
+ //\r
+ // show type\r
+ //\r
+ switch (ShowType) {\r
+\r
+ case SHOW_NONE:\r
+ return L"SHOW_NONE";\r
+\r
+ case SHOW_OUTLINE:\r
+ return L"SHOW_OUTLINE";\r
+\r
+ case SHOW_NORMAL:\r
+ return L"SHOW_NORMAL";\r
+\r
+ case SHOW_DETAIL:\r
+ return L"SHOW_DETAIL";\r
+\r
+ case SHOW_ALL:\r
+ return L"SHOW_ALL";\r
+\r
+ default:\r
+ return L"Undefined type";\r
+ }\r
+}\r
+\r
+/*\r
+EFI_STATUS\r
+InitializeSmbiosViewApplicationGetLineHelp (\r
+ OUT CHAR16 **Str\r
+ )\r
+{\r
+ return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str);\r
+}\r
+*/\r
--- /dev/null
+/** @file\r
+ Tools of clarify the content of the smbios table.\r
+\r
+ Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _SMBIOS_VIEW_H\r
+#define _SMBIOS_VIEW_H\r
+\r
+#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE\r
+#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF\r
+\r
+#define STRUCTURE_HANDLE_INVALID (UINT16) 0xFFFF\r
+\r
+typedef struct {\r
+ UINT16 Index;\r
+ UINT8 Type;\r
+ UINT16 Handle;\r
+ UINT16 Addr; // offset from table head\r
+ UINT16 Length; // total structure length\r
+} STRUCTURE_STATISTICS;\r
+\r
+/**\r
+ Query all structures Data from SMBIOS table and Display\r
+ the information to users as required display option.\r
+\r
+ @param[in] QueryType Structure type to view.\r
+ @param[in] QueryHandle Structure handle to view.\r
+ @param[in] Option Display option: none,outline,normal,detail.\r
+ @param[in] RandomView Support for -h parameter.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+ @retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+SMBiosView (\r
+ IN UINT8 QueryType,\r
+ IN UINT16 QueryHandle,\r
+ IN UINT8 Option,\r
+ IN BOOLEAN RandomView\r
+ );\r
+\r
+/**\r
+ Function to initialize the global mStatisticsTable object.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+InitSmbiosTableStatistics (\r
+ VOID\r
+ );\r
+\r
+/**\r
+ Function to display the global mStatisticsTable object.\r
+\r
+ @param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed.\r
+\r
+ @retval EFI_SUCCESS print is successful.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+DisplayStatisticsTable (\r
+ IN UINT8 Option\r
+ );\r
+\r
+/**\r
+ function to return a string of the detail level.\r
+\r
+ @param[in] ShowType The detail level whose name is desired in clear text.\r
+\r
+ @return A pointer to a string representing the ShowType (or 'undefined type' if not known).\r
+**/\r
+CHAR16*\r
+EFIAPI\r
+GetShowTypeString (\r
+ UINT8 ShowType\r
+ );\r
+\r
+extern UINT8 gShowType;\r
+\r
+#endif\r
--- /dev/null
+/** @file\r
+ Main file for NULL named library for debug1 profile shell command functions.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include "UefiShellDebug1CommandsLib.h"\r
+\r
+STATIC CONST CHAR16 mFileName[] = L"Debug1Commands";\r
+EFI_HANDLE gShellDebug1HiiHandle = NULL;\r
+CONST EFI_GUID gShellDebug1HiiGuid = \\r
+ { \\r
+ 0x25f200aa, 0xd3cb, 0x470a, { 0xbf, 0x51, 0xe7, 0xd1, 0x62, 0xd2, 0x2e, 0x6f } \\r
+ };\r
+\r
+CONST CHAR16*\r
+EFIAPI\r
+ShellCommandGetManFileNameDebug1 (\r
+ VOID\r
+ )\r
+{\r
+ return (mFileName);\r
+}\r
+\r
+/**\r
+ Constructor for the Shell Debug1 Commands library.\r
+\r
+ @param ImageHandle the image handle of the process\r
+ @param SystemTable the EFI System Table pointer\r
+\r
+ @retval EFI_SUCCESS the shell command handlers were installed sucessfully\r
+ @retval EFI_UNSUPPORTED the shell level required was not found.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UefiShellDebug1CommandsLibConstructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ //\r
+ // check our bit of the profiles mask\r
+ //\r
+ if ((PcdGet8(PcdShellProfileMask) & BIT1) == 0) {\r
+ return (EFI_UNSUPPORTED);\r
+ }\r
+\r
+ //\r
+ // install the HII stuff.\r
+ //\r
+ gShellDebug1HiiHandle = HiiAddPackages (&gShellDebug1HiiGuid, gImageHandle, UefiShellDebug1CommandsLibStrings, NULL);\r
+ if (gShellDebug1HiiHandle == NULL) {\r
+ return (EFI_DEVICE_ERROR);\r
+ }\r
+\r
+ //\r
+ // install our shell command handlers that are always installed\r
+ //\r
+ ShellCommandRegisterCommandName(L"SetSize", ShellCommandRunSetSize , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETSIZE) );\r
+ ShellCommandRegisterCommandName(L"comp", ShellCommandRunComp , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_COMP) );\r
+ ShellCommandRegisterCommandName(L"mode", ShellCommandRunMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MODE) );\r
+ ShellCommandRegisterCommandName(L"memmap", ShellCommandRunMemMap , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MEMMAP) );\r
+ ShellCommandRegisterCommandName(L"eficompress", ShellCommandRunEfiCompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFICOMPRESS) );\r
+ ShellCommandRegisterCommandName(L"efidecompress", ShellCommandRunEfiDecompress , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EFIDCOMPRESS) );\r
+ ShellCommandRegisterCommandName(L"dmem", ShellCommandRunDmem , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMEM) );\r
+ ShellCommandRegisterCommandName(L"LoadPciRom", ShellCommandRunLoadPciRom , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_LOAD_PCI_ROM) );\r
+ ShellCommandRegisterCommandName(L"mm", ShellCommandRunMm , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_MM) );\r
+ ShellCommandRegisterCommandName(L"SetVar", ShellCommandRunSetVar , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SETVAR) );\r
+ ShellCommandRegisterCommandName(L"SerMode", ShellCommandRunSerMode , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SERMODE) );\r
+ ShellCommandRegisterCommandName(L"Pci", ShellCommandRunPci , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_PCI) );\r
+ ShellCommandRegisterCommandName(L"smbiosview", ShellCommandRunSmbiosView , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_SMBIOSVIEW) );\r
+ ShellCommandRegisterCommandName(L"dmpstore", ShellCommandRunDmpStore , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DMPSTORE) );\r
+ ShellCommandRegisterCommandName(L"dblk", ShellCommandRunDblk , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_DBLK) );\r
+\r
+ //\r
+ // check install profile bit of the profiles mask is set\r
+ //\r
+ if ((PcdGet8(PcdShellProfileMask) & BIT2) == 0) {\r
+ ShellCommandRegisterCommandName(L"bcfg", ShellCommandRunBcfg , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_BCFG) );\r
+ }\r
+\r
+/*\r
+ ShellCommandRegisterCommandName(L"hexedit", ShellCommandRunHexEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_HEXEDIT );\r
+ ShellCommandRegisterCommandName(L"edit", ShellCommandRunEdit , ShellCommandGetManFileNameDebug1, 0, L"Debug1", TRUE, gShellDebug1HiiHandle, STRING_TOKEN(STR_GET_HELP_EDIT) );\r
+*/\r
+\r
+ ShellCommandRegisterAlias(L"dmem", L"mem");\r
+\r
+ return (EFI_SUCCESS);\r
+}\r
+\r
+/**\r
+ Destructor for the library. free any resources.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+UefiShellDebug1CommandsLibDestructor (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ )\r
+{\r
+ if (gShellDebug1HiiHandle != NULL) {\r
+ HiiRemovePackages(gShellDebug1HiiHandle);\r
+ }\r
+ return (EFI_SUCCESS);\r
+}\r
+\r
+STATIC CONST CHAR8 Hex[] = {\r
+ '0',\r
+ '1',\r
+ '2',\r
+ '3',\r
+ '4',\r
+ '5',\r
+ '6',\r
+ '7',\r
+ '8',\r
+ '9',\r
+ 'A',\r
+ 'B',\r
+ 'C',\r
+ 'D',\r
+ 'E',\r
+ 'F'\r
+};\r
+\r
+VOID\r
+EFIAPI\r
+DumpHex (\r
+ IN UINTN Indent,\r
+ IN UINTN Offset,\r
+ IN UINTN DataSize,\r
+ IN VOID *UserData\r
+ )\r
+{\r
+ UINT8 *Data;\r
+\r
+ CHAR8 Val[50];\r
+\r
+ CHAR8 Str[20];\r
+\r
+ UINT8 c;\r
+ UINTN Size;\r
+ UINTN Index;\r
+\r
+ ASSERT (UserData != NULL);\r
+\r
+ Data = UserData;\r
+ while (DataSize != 0) {\r
+ Size = 16;\r
+ if (Size > DataSize) {\r
+ Size = DataSize;\r
+ }\r
+\r
+ for (Index = 0; Index < Size; Index += 1) {\r
+ c = Data[Index];\r
+ Val[Index * 3 + 0] = Hex[c >> 4];\r
+ Val[Index * 3 + 1] = Hex[c & 0xF];\r
+ Val[Index * 3 + 2] = (CHAR8) ((Index == 7) ? '-' : ' ');\r
+ Str[Index] = (CHAR8) ((c < ' ' || c > 'z') ? '.' : c);\r
+ }\r
+\r
+ Val[Index * 3] = 0;\r
+ Str[Index] = 0;\r
+ ShellPrintEx(-1, -1, L"%*a%02X: %-.48a *%a*\r\n", Indent, "", Offset, Val, Str);\r
+\r
+ Data += Size;\r
+ Offset += Size;\r
+ DataSize -= Size;\r
+ }\r
+}\r
+\r
+/**\r
+ Convert a Unicode character to upper case only if\r
+ it maps to a valid small-case ASCII character.\r
+\r
+ This internal function only deal with Unicode character\r
+ which maps to a valid small-case ASCII character, i.e.\r
+ L'a' to L'z'. For other Unicode character, the input character\r
+ is returned directly.\r
+\r
+ @param Char The character to convert.\r
+\r
+ @retval LowerCharacter If the Char is with range L'a' to L'z'.\r
+ @retval Unchanged Otherwise.\r
+\r
+\r
+ //Stolen from MdePkg Baselib\r
+**/\r
+CHAR16\r
+EFIAPI\r
+CharToUpper (\r
+ IN CHAR16 Char\r
+ )\r
+{\r
+ if (Char >= L'a' && Char <= L'z') {\r
+ return (CHAR16) (Char - (L'a' - L'A'));\r
+ }\r
+\r
+ return Char;\r
+}\r
+\r
+/**\r
+ Function returns a system configuration table that is stored in the\r
+ EFI System Table based on the provided GUID.\r
+\r
+ @param[in] TableGuid A pointer to the table's GUID type.\r
+ @param[out] Table On exit, a pointer to a system configuration table.\r
+\r
+ @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
+ @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetSystemConfigurationTable (\r
+ IN EFI_GUID *TableGuid,\r
+ IN OUT VOID **Table\r
+ )\r
+{\r
+ UINTN Index;\r
+ ASSERT (Table != NULL);\r
+\r
+ for (Index = 0; Index < gST->NumberOfTableEntries; Index++) {\r
+ if (CompareGuid (TableGuid, &(gST->ConfigurationTable[Index].VendorGuid)) == 0) {\r
+ *Table = gST->ConfigurationTable[Index].VendorTable;\r
+ return EFI_SUCCESS;\r
+ }\r
+ }\r
+\r
+ return EFI_NOT_FOUND;\r
+}\r
+\r
+/**\r
+ Convert a Unicode character to numerical value.\r
+\r
+ This internal function only deal with Unicode character\r
+ which maps to a valid hexadecimal ASII character, i.e.\r
+ L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other\r
+ Unicode character, the value returned does not make sense.\r
+\r
+ @param Char The character to convert.\r
+\r
+ @return The numerical value converted.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+HexCharToUintn (\r
+ IN CHAR16 Char\r
+ )\r
+{\r
+ if (Char >= L'0' && Char <= L'9') {\r
+ return Char - L'0';\r
+ }\r
+\r
+ return (UINTN) (10 + CharToUpper (Char) - L'A');\r
+}\r
+\r
+EFI_STATUS\r
+EFIAPI\r
+ConvertStringToGuid (\r
+ IN CONST CHAR16 *StringGuid,\r
+ IN OUT EFI_GUID *Guid\r
+ )\r
+{\r
+ if (StrLen(StringGuid) != 35) {\r
+ return (EFI_INVALID_PARAMETER);\r
+ } else {\r
+ Guid->Data1 = (UINT32)StrHexToUintn(StringGuid);\r
+ StringGuid += 9;\r
+ Guid->Data2 = (UINT16)StrHexToUintn(StringGuid);\r
+ StringGuid += 5;\r
+ Guid->Data3 = (UINT16)StrHexToUintn(StringGuid);\r
+ StringGuid += 5;\r
+ Guid->Data4[0] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[0] = (UINT8)(Guid->Data4[0]+ (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[1] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[1] = (UINT8)(Guid->Data4[1] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[2] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[2] = (UINT8)(Guid->Data4[2] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[3] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[3] = (UINT8)(Guid->Data4[3] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[4] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[4] = (UINT8)(Guid->Data4[4] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[5] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[5] = (UINT8)(Guid->Data4[5] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[6] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[6] = (UINT8)(Guid->Data4[6] + (UINT8)HexCharToUintn(StringGuid[1]));\r
+ StringGuid += 2;\r
+ Guid->Data4[7] = (UINT8)(HexCharToUintn(StringGuid[0]) * 16);\r
+ Guid->Data4[7] = (UINT8)(Guid->Data4[7] = (UINT8)HexCharToUintn(StringGuid[1]));\r
+ return (EFI_SUCCESS);\r
+ }\r
+}\r
+\r
--- /dev/null
+/** @file\r
+ Main file for NULL named library for Profile1 shell command functions.\r
+\r
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#include <Uefi.h>\r
+#include <ShellBase.h>\r
+\r
+#include <Guid/GlobalVariable.h>\r
+#include <Guid/ConsoleInDevice.h>\r
+#include <Guid/ConsoleOutDevice.h>\r
+\r
+#include <Protocol/EfiShell.h>\r
+#include <Protocol/EfiShellParameters.h>\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/LoadedImage.h>\r
+#include <Protocol/UnicodeCollation.h>\r
+#include <Protocol/DevicePathToText.h>\r
+#include <Protocol/DriverDiagnostics2.h>\r
+#include <Protocol/DriverDiagnostics.h>\r
+#include <Protocol/PlatformDriverOverride.h>\r
+#include <Protocol/BusSpecificDriverOverride.h>\r
+#include <Protocol/PlatformToDriverConfiguration.h>\r
+#include <Protocol/DriverSupportedEfiVersion.h>\r
+#include <Protocol/DriverFamilyOverride.h>\r
+#include <Protocol/DriverHealth.h>\r
+#include <Protocol/DevicePathFromText.h>\r
+\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/MemoryAllocationLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/ShellCommandLib.h>\r
+#include <Library/ShellLib.h>\r
+#include <Library/SortLib.h>\r
+#include <Library/UefiLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/HiiLib.h>\r
+#include <Library/FileHandleLib.h>\r
+#include <Library/DevicePathLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/HandleParsingLib.h>\r
+\r
+\r
+extern EFI_HANDLE gShellDebug1HiiHandle;\r
+extern CONST EFI_GUID gShellDebug1HiiGuid;\r
+\r
+/**\r
+ Function printing hex output to the console.\r
+\r
+ @param[in] Indent Number of spaces to indent.\r
+ @param[in] Offset Offset to start with.\r
+ @param[in] DataSize Length of data.\r
+ @param[in] UserData Pointer to some data.\r
+**/\r
+VOID\r
+DumpHex (\r
+ IN UINTN Indent,\r
+ IN UINTN Offset,\r
+ IN UINTN DataSize,\r
+ IN VOID *UserData\r
+ );\r
+\r
+/**\r
+ Function returns a system configuration table that is stored in the\r
+ EFI System Table based on the provided GUID.\r
+\r
+ @param[in] TableGuid A pointer to the table's GUID type.\r
+ @param[out] Table On exit, a pointer to a system configuration table.\r
+\r
+ @retval EFI_SUCCESS A configuration table matching TableGuid was found.\r
+ @retval EFI_NOT_FOUND A configuration table matching TableGuid was not found.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+GetSystemConfigurationTable (\r
+ IN EFI_GUID *TableGuid,\r
+ IN OUT VOID **Table\r
+ );\r
+\r
+/**\r
+ Convert a string representation of a GUID to the GUID value.\r
+\r
+ @param[in] StringGuid The pointer to the string containing a GUID printed.\r
+ @param[in,out] Guid The pointer to the buffer to get the GUID value.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+ConvertStringToGuid (\r
+ IN CONST CHAR16 *StringGuid,\r
+ IN OUT EFI_GUID *Guid\r
+ );\r
+\r
+/**\r
+ Convert a Unicode character to numerical value.\r
+\r
+ This internal function only deal with Unicode character\r
+ which maps to a valid hexadecimal ASII character, i.e.\r
+ L'0' to L'9', L'a' to L'f' or L'A' to L'F'. For other\r
+ Unicode character, the value returned does not make sense.\r
+\r
+ @param Char The character to convert.\r
+\r
+ @return The numerical value converted.\r
+\r
+**/\r
+UINTN\r
+EFIAPI\r
+HexCharToUintn (\r
+ IN CHAR16 Char\r
+ );\r
+\r
+/**\r
+ Function for 'setsize' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSetSize (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'comp' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunComp (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'mode' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMode (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'memmap' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMemMap (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'compress' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunEfiCompress (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'decompress' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunEfiDecompress (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'dmem' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDmem (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'loadpcirom' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunLoadPciRom (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'mm' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunMm (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'setvar' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSetVar (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'sermode' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSerMode (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'bcfg' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunBcfg (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'pci' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunPci (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'smbiosview' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunSmbiosView (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'dmpstore' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDmpStore (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+/**\r
+ Function for 'dblk' command.\r
+\r
+ @param[in] ImageHandle Handle to the Image (NULL if Internal).\r
+ @param[in] SystemTable Pointer to the System Table (NULL if Internal).\r
+**/\r
+SHELL_STATUS\r
+EFIAPI\r
+ShellCommandRunDblk (\r
+ IN EFI_HANDLE ImageHandle,\r
+ IN EFI_SYSTEM_TABLE *SystemTable\r
+ );\r
+\r
+\r
--- /dev/null
+## @file\r
+# Provides shell Debug1 profile functions\r
+#\r
+# Copyright (c) 2010, Intel Corporation.All rights reserved. <BR>\r
+#\r
+# This program and the accompanying materials\r
+# are licensed and made available under the terms and conditions of the BSD License\r
+# which accompanies this distribution. The full text of the license may be found at\r
+# http://opensource.org/licenses/bsd-license.php\r
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#\r
+#\r
+##\r
+[Defines]\r
+ INF_VERSION = 0x00010006\r
+ BASE_NAME = UefiShellDebug1CommandsLib\r
+ FILE_GUID = 90330D51-A99B-4cc8-A2EB-AE22542A3F45\r
+ MODULE_TYPE = UEFI_DRIVER\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = NULL|UEFI_APPLICATION UEFI_DRIVER\r
+ CONSTRUCTOR = UefiShellDebug1CommandsLibConstructor\r
+ DESTRUCTOR = UefiShellDebug1CommandsLibDestructor\r
+\r
+[Sources]\r
+ SetSize.c\r
+ Comp.c\r
+ Mode.c\r
+ MemMap.c\r
+ Compress.h\r
+ Compress.c\r
+ EfiCompress.c\r
+ EfiDecompress.c\r
+ Dmem.c\r
+ LoadPciRom.c\r
+ Mm.c\r
+ SetVar.c\r
+ SerMode.c\r
+ Bcfg.c\r
+ Pci.c\r
+ Pci.h\r
+ DmpStore.c\r
+ Dblk.c\r
+ ./SmbiosView/EventLogInfo.c\r
+ ./SmbiosView/PrintInfo.c\r
+ ./SmbiosView/QueryTable.c\r
+ ./SmbiosView/SmbiosView.c\r
+ ./SmbiosView/Smbios.c\r
+ ./SmbiosView/SmbiosViewStrings.uni\r
+ ./SmbiosView/LibSmbiosView.c\r
+ UefiShellDebug1CommandsLib.c\r
+ UefiShellDebug1CommandsLib.h\r
+ UefiShellDebug1CommandsLib.uni\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ShellPkg/ShellPkg.dec\r
+ MdeModulePkg/MdeModulePkg.dec\r
+\r
+[LibraryClasses]\r
+ MemoryAllocationLib\r
+ BaseLib\r
+ BaseMemoryLib\r
+ DebugLib\r
+ ShellCommandLib\r
+ ShellLib\r
+ UefiLib\r
+ UefiRuntimeServicesTableLib\r
+ UefiBootServicesTableLib\r
+ SortLib\r
+ PrintLib\r
+\r
+[Pcd]\r
+ gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask # ALWAYS_CONSUMED\r
+ gEfiShellPkgTokenSpaceGuid.PcdShellFileOperationSize # ALWAYS_CONSUMED\r
+\r
+[Protocols]\r
+ gEfiPciRootBridgeIoProtocolGuid\r
+ gEfiBlockIoProtocolGuid\r
+\r
+[Guids]\r
+ gEfiGlobalVariableGuid\r
+ gEfiSmbiosTableGuid\r
+\r