Add "Debug1" profile (all but Edit and HexEdit commands)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11068 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -0,0 +1,394 @@
|
||||
/**
|
||||
Module for clarifying the content of the smbios structure element info.
|
||||
|
||||
Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "../UefiShellDebug1CommandsLib.h"
|
||||
#include "PrintInfo.h"
|
||||
#include "QueryTable.h"
|
||||
#include "EventLogInfo.h"
|
||||
|
||||
/**
|
||||
Function to display system event log access information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySELAccessMethod (
|
||||
IN CONST UINT8 Key,
|
||||
IN CONST UINT8 Option
|
||||
)
|
||||
{
|
||||
//
|
||||
// Print prompt
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ACCESS_METHOD), gShellDebug1HiiHandle);
|
||||
PRINT_INFO_OPTION (Key, Option);
|
||||
|
||||
//
|
||||
// Print value info
|
||||
//
|
||||
switch (Key) {
|
||||
case 0:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_EIGHT_BIT), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TWO_EIGHT_BITS), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_SIXTEEN_BIT), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MEM_MAPPED_PHYS), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_VIA_GENERAL), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (Key <= 0x7f) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE_ASSIGN), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR_OEM), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Function to display system event log status information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySELLogStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
)
|
||||
{
|
||||
//
|
||||
// Print prompt
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_STATUS), gShellDebug1HiiHandle);
|
||||
PRINT_INFO_OPTION (Key, Option);
|
||||
|
||||
//
|
||||
// Print value info
|
||||
//
|
||||
if ((Key & 0x01) != 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_VALID), gShellDebug1HiiHandle);
|
||||
}
|
||||
|
||||
if ((Key & 0x02) != 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_FULL), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_AREA_NOT_FULL), gShellDebug1HiiHandle);
|
||||
}
|
||||
|
||||
if ((Key & 0xFC) != 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RES_BITS_NOT_ZERO), gShellDebug1HiiHandle, Key & 0xFC);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Function to display system event log header format information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogHeaderFormat (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
)
|
||||
{
|
||||
//
|
||||
// Print prompt
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_FORMAT), gShellDebug1HiiHandle);
|
||||
PRINT_INFO_OPTION (Key, Option);
|
||||
|
||||
//
|
||||
// Print value info
|
||||
//
|
||||
if (Key == 0x00) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
|
||||
} else if (Key == 0x01) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
|
||||
} else if (Key <= 0x7f) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_FUTURE), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DisplaySELLogHeaderLen (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
)
|
||||
{
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER_LEN), gShellDebug1HiiHandle);
|
||||
PRINT_INFO_OPTION (Key, Option);
|
||||
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ONE_VAR_D), gShellDebug1HiiHandle, Key & 0x7F);
|
||||
|
||||
//
|
||||
// The most-significant bit of the field specifies
|
||||
// whether (0) or not (1) the record has been read
|
||||
//
|
||||
if ((Key & 0x80) != 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_READ), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_THIS_RECORD_NOT_READ), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DisplaySysEventLogHeaderType1 (
|
||||
UINT8 *LogHeader
|
||||
)
|
||||
{
|
||||
LOG_HEADER_TYPE1_FORMAT *Header;
|
||||
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG), gShellDebug1HiiHandle);
|
||||
|
||||
//
|
||||
// Print Log Header Type1 Format info
|
||||
//
|
||||
Header = (LOG_HEADER_TYPE1_FORMAT *) (LogHeader);
|
||||
|
||||
ShellPrintHiiEx(-1,-1,NULL,
|
||||
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_OEM_RESERVED),
|
||||
gShellDebug1HiiHandle,
|
||||
Header->OEMReserved[0],
|
||||
Header->OEMReserved[1],
|
||||
Header->OEMReserved[2],
|
||||
Header->OEMReserved[3],
|
||||
Header->OEMReserved[4]
|
||||
);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_TIME), gShellDebug1HiiHandle, Header->METW);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULTIPLE_EVENT_COUNT), gShellDebug1HiiHandle, Header->MECI);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_ADDRESS), gShellDebug1HiiHandle, Header->CMOSAddress);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_PREBOOT_INDEX), gShellDebug1HiiHandle, Header->CMOSBitIndex);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUM_STARTING_OFF), gShellDebug1HiiHandle, Header->StartingOffset);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_CHECKSUN_BYTE_COUNT), gShellDebug1HiiHandle, Header->ChecksumOffset);
|
||||
ShellPrintHiiEx(-1,-1,NULL,
|
||||
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_RESERVED),
|
||||
gShellDebug1HiiHandle,
|
||||
Header->OEMReserved[0],
|
||||
Header->OEMReserved[1],
|
||||
Header->OEMReserved[2]
|
||||
);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_HEADER_REVISION), gShellDebug1HiiHandle, Header->HeaderRevision);
|
||||
}
|
||||
|
||||
/**
|
||||
Function to display system event log header information.
|
||||
|
||||
@param[in] LogHeaderFormat Format identifier.
|
||||
@param[in] LogHeader Format informcation.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogHeader (
|
||||
UINT8 LogHeaderFormat,
|
||||
UINT8 *LogHeader
|
||||
)
|
||||
{
|
||||
//
|
||||
// Print prompt
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_LOG_HEADER), gShellDebug1HiiHandle);
|
||||
|
||||
//
|
||||
// Print value info
|
||||
//
|
||||
if (LogHeaderFormat == 0x00) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_HEADER), gShellDebug1HiiHandle);
|
||||
} else if (LogHeaderFormat == 0x01) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TYPE_LOG_HEADER), gShellDebug1HiiHandle);
|
||||
DisplaySysEventLogHeaderType1 (LogHeader);
|
||||
} else if (LogHeaderFormat <= 0x7f) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FUTURE_ASSIGN), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_BIOS_VENDOR), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
DisplayElVdfInfo (
|
||||
UINT8 ElVdfType,
|
||||
UINT8 *VarData
|
||||
)
|
||||
{
|
||||
UINT16 *Word;
|
||||
UINT32 *Dword;
|
||||
|
||||
//
|
||||
// Display Type Name
|
||||
//
|
||||
DisplaySELVarDataFormatType (ElVdfType, SHOW_DETAIL);
|
||||
|
||||
//
|
||||
// Display Type description
|
||||
//
|
||||
switch (ElVdfType) {
|
||||
case 0:
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_NO_STD_FORMAT), gShellDebug1HiiHandle);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
Word = (UINT16 *) (VarData + 1);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
Word = (UINT16 *) (VarData + 1);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SMBIOS_STRUCT_ASSOC), gShellDebug1HiiHandle);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_STRUCT_HANDLE), gShellDebug1HiiHandle, *Word);
|
||||
//
|
||||
// Followed by a multiple-event counter
|
||||
//
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
DisplayPostResultsBitmapDw1 (*Dword, SHOW_DETAIL);
|
||||
Dword++;
|
||||
DisplayPostResultsBitmapDw2 (*Dword, SHOW_DETAIL);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
DisplaySELSysManagementTypes (*Dword, SHOW_DETAIL);
|
||||
//
|
||||
// Followed by a multiple-event counter
|
||||
//
|
||||
Dword = (UINT32 *) (VarData + 1);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_MULT_EVENT_COUNTER), gShellDebug1HiiHandle, *Dword);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (ElVdfType <= 0x7F) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_UNUSED_AVAIL_FOR_ASSIGN), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_AVAIL_FOR_SYSTEM), gShellDebug1HiiHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Function to display system event log data.
|
||||
|
||||
@param[in] LogData The data information.
|
||||
@param[in] LogAreaLength Length of the data.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogData (
|
||||
UINT8 *LogData,
|
||||
UINT16 LogAreaLength
|
||||
)
|
||||
{
|
||||
LOG_RECORD_FORMAT *Log;
|
||||
UINT8 ElVdfType;
|
||||
//
|
||||
// Event Log Variable Data Format Types
|
||||
//
|
||||
UINTN Offset;
|
||||
|
||||
//
|
||||
// Print prompt
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_SYSTEM_EVENT_LOG_2), gShellDebug1HiiHandle);
|
||||
|
||||
//
|
||||
// Print Log info
|
||||
//
|
||||
Offset = 0;
|
||||
Log = (LOG_RECORD_FORMAT *) LogData;
|
||||
while (Log->Type != END_OF_LOG && Offset < LogAreaLength) {
|
||||
//
|
||||
// Get a Event Log Record
|
||||
//
|
||||
Log = (LOG_RECORD_FORMAT *) (LogData + Offset);
|
||||
|
||||
//
|
||||
// Display Event Log Record Information
|
||||
//
|
||||
DisplaySELVarDataFormatType (Log->Type, SHOW_DETAIL);
|
||||
DisplaySELLogHeaderLen (Log->Length, SHOW_DETAIL);
|
||||
|
||||
Offset += Log->Length;
|
||||
|
||||
//
|
||||
// Display Log Header Date/Time Fields
|
||||
// These fields contain the BCD representation of the date and time
|
||||
// (as read from CMOS) of the occurrence of the event
|
||||
// So Print as hex and represent decimal
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_DATE), gShellDebug1HiiHandle);
|
||||
if (Log != NULL && Log->Year >= 80 && Log->Year <= 99) {
|
||||
Print (L"19");
|
||||
} else if (Log != NULL && Log->Year <= 79) {
|
||||
Print (L"20");
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_ERROR), gShellDebug1HiiHandle);
|
||||
continue;
|
||||
}
|
||||
|
||||
ShellPrintHiiEx(-1,-1,NULL,
|
||||
STRING_TOKEN (STR_SMBIOSVIEW_EVENTLOGINFO_TIME_SIX_VARS),
|
||||
gShellDebug1HiiHandle,
|
||||
Log->Year,
|
||||
Log->Month,
|
||||
Log->Day,
|
||||
Log->Hour,
|
||||
Log->Minute,
|
||||
Log->Second
|
||||
);
|
||||
|
||||
//
|
||||
// Display Variable Data Format
|
||||
//
|
||||
if (Log->Length <= (sizeof (LOG_RECORD_FORMAT) - 1)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ElVdfType = Log->LogVariableData[0];
|
||||
DisplayElVdfInfo (ElVdfType, Log->LogVariableData);
|
||||
}
|
||||
}
|
@ -0,0 +1,117 @@
|
||||
/**
|
||||
Module to clarify system event log of smbios structure.
|
||||
|
||||
Copyright (c) 2005-2010, Intel Corporation. All rights reserved. <BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMBIOS_EVENT_LOG_INFO_H
|
||||
#define _SMBIOS_EVENT_LOG_INFO_H
|
||||
|
||||
#define END_OF_LOG 0xFF
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT8 Year;
|
||||
UINT8 Month;
|
||||
UINT8 Day;
|
||||
UINT8 Hour;
|
||||
UINT8 Minute;
|
||||
UINT8 Second;
|
||||
UINT8 LogVariableData[1];
|
||||
} LOG_RECORD_FORMAT;
|
||||
|
||||
typedef struct {
|
||||
UINT8 OEMReserved[5];
|
||||
UINT8 METW; // Multiple Event Time Window
|
||||
UINT8 MECI; // Multiple Event Count Increment
|
||||
UINT8 CMOSAddress; // Pre-boot Event Log Reset - CMOS Address
|
||||
UINT8 CMOSBitIndex; // Pre-boot Event Log Reset - CMOS Bit Index
|
||||
UINT8 StartingOffset; // CMOS Checksum - Starting Offset
|
||||
UINT8 ByteCount; // CMOS Checksum - Byte Count
|
||||
UINT8 ChecksumOffset; // CMOS Checksum - Checksum Offset
|
||||
UINT8 Reserved[3];
|
||||
UINT8 HeaderRevision;
|
||||
} LOG_HEADER_TYPE1_FORMAT;
|
||||
|
||||
#pragma pack()
|
||||
//
|
||||
// System Event Log (Type 15)
|
||||
//
|
||||
|
||||
/**
|
||||
Function to display system event log access information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySELAccessMethod (
|
||||
IN CONST UINT8 Key,
|
||||
IN CONST UINT8 Option
|
||||
);
|
||||
|
||||
/**
|
||||
Function to display system event log status information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySELLogStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
/**
|
||||
Function to display system event log header format information.
|
||||
|
||||
@param[in] Key Additional information to print.
|
||||
@param[in] Option Whether to print the additional information.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogHeaderFormat (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
/**
|
||||
Function to display system event log header information.
|
||||
|
||||
@param[in] LogHeaderFormat Format identifier.
|
||||
@param[in] LogHeader Format informcation.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogHeader (
|
||||
UINT8 LogHeaderFormat,
|
||||
UINT8 *LogHeader
|
||||
);
|
||||
|
||||
/**
|
||||
Function to display system event log data.
|
||||
|
||||
@param[in] LogData The data information.
|
||||
@param[in] LogAreaLength Length of the data.
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
DisplaySysEventLogData (
|
||||
UINT8 *LogData,
|
||||
UINT16 LogAreaLength
|
||||
);
|
||||
|
||||
#endif
|
@ -0,0 +1,638 @@
|
||||
/** @file
|
||||
Lib include for SMBIOS services. Used to get system serial number and GUID
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _LIB_SMBIOS_H
|
||||
#define _LIB_SMBIOS_H
|
||||
|
||||
//
|
||||
// Define SMBIOS tables.
|
||||
//
|
||||
#pragma pack(1)
|
||||
|
||||
typedef UINT8 SMBIOS_STRING;
|
||||
|
||||
typedef struct {
|
||||
UINT8 AnchorString[4];
|
||||
UINT8 EntryPointStructureChecksum;
|
||||
UINT8 EntryPointLength;
|
||||
UINT8 MajorVersion;
|
||||
UINT8 MinorVersion;
|
||||
UINT16 MaxStructureSize;
|
||||
UINT8 EntryPointRevision;
|
||||
UINT8 FormattedArea[5];
|
||||
UINT8 IntermediateAnchorString[5];
|
||||
UINT8 IntermediateChecksum;
|
||||
UINT16 TableLength;
|
||||
UINT32 TableAddress;
|
||||
UINT16 NumberOfSmbiosStructures;
|
||||
UINT8 SmbiosBcdRevision;
|
||||
} SMBIOS_STRUCTURE_TABLE;
|
||||
|
||||
//
|
||||
// Please note that SMBIOS structures can be odd byte aligned since the
|
||||
// unformated section of each record is a set of arbitrary size strings.
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 Type;
|
||||
UINT8 Length;
|
||||
UINT16 Handle;
|
||||
} SMBIOS_HEADER;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Vendor;
|
||||
SMBIOS_STRING BiosVersion;
|
||||
UINT16 BiosSegment;
|
||||
SMBIOS_STRING BiosReleaseDate;
|
||||
UINT8 BiosSize;
|
||||
UINT64 BiosCharacteristics;
|
||||
UINT8 BIOSCharacteristicsExtensionBytes[2];
|
||||
UINT8 SystemBiosMajorRelease;
|
||||
UINT8 SystemBiosMinorRelease;
|
||||
UINT8 EmbeddedControllerFirmwareMajorRelease;
|
||||
UINT8 EmbeddedControllerFirmwareMinorRelease;
|
||||
} SMBIOS_TYPE0;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING ProductName;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
EFI_GUID Uuid;
|
||||
UINT8 WakeUpType;
|
||||
SMBIOS_STRING SKUNumber;
|
||||
SMBIOS_STRING Family;
|
||||
} SMBIOS_TYPE1;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING ProductName;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTag;
|
||||
UINT8 FeatureFlag;
|
||||
SMBIOS_STRING LocationInChassis;
|
||||
UINT16 ChassisHandle;
|
||||
UINT8 BoardType;
|
||||
UINT8 NumberOfContainedObjectHandles;
|
||||
UINT16 ContainedObjectHandles[1];
|
||||
} SMBIOS_TYPE2;
|
||||
|
||||
typedef struct {
|
||||
UINT8 ContainedElementType;
|
||||
UINT8 ContainedElementMinimum;
|
||||
UINT8 ContainedElementMaximum;
|
||||
} CONTAINED_ELEMENT;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
UINT8 Type;
|
||||
SMBIOS_STRING Version;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTag;
|
||||
UINT8 BootupState;
|
||||
UINT8 PowerSupplyState;
|
||||
UINT8 ThermalState;
|
||||
UINT8 SecurityStatus;
|
||||
UINT8 OemDefined[4];
|
||||
UINT8 Height;
|
||||
UINT8 NumberofPowerCords;
|
||||
UINT8 ContainedElementCount;
|
||||
UINT8 ContainedElementRecordLength;
|
||||
CONTAINED_ELEMENT ContainedElements[1];
|
||||
} SMBIOS_TYPE3;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Socket;
|
||||
UINT8 ProcessorType;
|
||||
UINT8 ProcessorFamily;
|
||||
SMBIOS_STRING ProcessorManufacture;
|
||||
UINT8 ProcessorId[8];
|
||||
SMBIOS_STRING ProcessorVersion;
|
||||
UINT8 Voltage;
|
||||
UINT16 ExternalClock;
|
||||
UINT16 MaxSpeed;
|
||||
UINT16 CurrentSpeed;
|
||||
UINT8 Status;
|
||||
UINT8 ProcessorUpgrade;
|
||||
UINT16 L1CacheHandle;
|
||||
UINT16 L2CacheHandle;
|
||||
UINT16 L3CacheHandle;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTag;
|
||||
SMBIOS_STRING PartNumber;
|
||||
//
|
||||
// Add for smbios 2.5
|
||||
//
|
||||
UINT8 CoreCount;
|
||||
UINT8 EnabledCoreCount;
|
||||
UINT8 ThreadCount;
|
||||
UINT16 ProcessorCharacteristics;
|
||||
//
|
||||
// Add for smbios 2.6
|
||||
//
|
||||
UINT16 ProcessorFamily2;
|
||||
} SMBIOS_TYPE4;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 ErrDetectMethod;
|
||||
UINT8 ErrCorrectCapability;
|
||||
UINT8 SupportInterleave;
|
||||
UINT8 CurrentInterleave;
|
||||
UINT8 MaxMemoryModuleSize;
|
||||
UINT16 SupportSpeed;
|
||||
UINT16 SupportMemoryType;
|
||||
UINT8 MemoryModuleVoltage;
|
||||
UINT8 AssociatedMemorySlotNum;
|
||||
UINT16 MemoryModuleConfigHandles[1];
|
||||
} SMBIOS_TYPE5;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING SocketDesignation;
|
||||
UINT8 BankConnections;
|
||||
UINT8 CurrentSpeed;
|
||||
UINT16 CurrentMemoryType;
|
||||
UINT8 InstalledSize;
|
||||
UINT8 EnabledSize;
|
||||
UINT8 ErrorStatus;
|
||||
} SMBIOS_TYPE6;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING SocketDesignation;
|
||||
UINT16 CacheConfiguration;
|
||||
UINT16 MaximumCacheSize;
|
||||
UINT16 InstalledSize;
|
||||
UINT16 SupportedSRAMType;
|
||||
UINT16 CurrentSRAMType;
|
||||
UINT8 CacheSpeed;
|
||||
UINT8 ErrorCorrectionType;
|
||||
UINT8 SystemCacheType;
|
||||
UINT8 Associativity;
|
||||
} SMBIOS_TYPE7;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING InternalReferenceDesignator;
|
||||
UINT8 InternalConnectorType;
|
||||
SMBIOS_STRING ExternalReferenceDesignator;
|
||||
UINT8 ExternalConnectorType;
|
||||
UINT8 PortType;
|
||||
} SMBIOS_TYPE8;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING SlotDesignation;
|
||||
UINT8 SlotType;
|
||||
UINT8 SlotDataBusWidth;
|
||||
UINT8 CurrentUsage;
|
||||
UINT8 SlotLength;
|
||||
UINT16 SlotID;
|
||||
UINT8 SlotCharacteristics1;
|
||||
UINT8 SlotCharacteristics2;
|
||||
//
|
||||
// Add for smbios 2.6
|
||||
//
|
||||
UINT16 SegmentGroupNum;
|
||||
UINT8 BusNum;
|
||||
UINT8 DevFuncNum;
|
||||
} SMBIOS_TYPE9;
|
||||
|
||||
typedef struct DeviceStruct {
|
||||
UINT8 DeviceType;
|
||||
SMBIOS_STRING DescriptionString;
|
||||
} DeviceStruct;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
DeviceStruct Device[1];
|
||||
} SMBIOS_TYPE10;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 StringCount;
|
||||
} SMBIOS_TYPE11;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 StringCount;
|
||||
} SMBIOS_TYPE12;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 InstallableLanguages;
|
||||
UINT8 Flags;
|
||||
UINT8 reserved[15];
|
||||
SMBIOS_STRING CurrentLanguages;
|
||||
} SMBIOS_TYPE13;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING GroupName;
|
||||
UINT8 ItemType;
|
||||
UINT16 ItemHandle;
|
||||
} SMBIOS_TYPE14;
|
||||
|
||||
typedef struct EVENTLOGTYPE {
|
||||
UINT8 LogType;
|
||||
UINT8 DataFormatType;
|
||||
} EVENTLOGTYPE;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT16 LogAreaLength;
|
||||
UINT16 LogHeaderStartOffset;
|
||||
UINT16 LogDataStartOffset;
|
||||
UINT8 AccessMethod;
|
||||
UINT8 LogStatus;
|
||||
UINT32 LogChangeToken;
|
||||
UINT32 AccessMethodAddress;
|
||||
UINT8 LogHeaderFormat;
|
||||
UINT8 NumberOfSupportedLogTypeDescriptors;
|
||||
UINT8 LengthOfLogTypeDescriptor;
|
||||
EVENTLOGTYPE EventLogTypeDescriptors[1];
|
||||
} SMBIOS_TYPE15;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Location;
|
||||
UINT8 Use;
|
||||
UINT8 MemoryErrorCorrection;
|
||||
UINT32 MaximumCapacity;
|
||||
UINT16 MemoryErrorInformationHandle;
|
||||
UINT16 NumberOfMemoryDevices;
|
||||
} SMBIOS_TYPE16;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT16 MemoryArrayHandle;
|
||||
UINT16 MemoryErrorInformationHandle;
|
||||
UINT16 TotalWidth;
|
||||
UINT16 DataWidth;
|
||||
UINT16 Size;
|
||||
UINT8 FormFactor;
|
||||
UINT8 DeviceSet;
|
||||
SMBIOS_STRING DeviceLocator;
|
||||
SMBIOS_STRING BankLocator;
|
||||
UINT8 MemoryType;
|
||||
UINT16 TypeDetail;
|
||||
UINT16 Speed;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTag;
|
||||
SMBIOS_STRING PartNumber;
|
||||
//
|
||||
// Add for smbios 2.6
|
||||
//
|
||||
UINT8 Attributes;
|
||||
} SMBIOS_TYPE17;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 ErrorType;
|
||||
UINT8 ErrorGranularity;
|
||||
UINT8 ErrorOperation;
|
||||
UINT32 VendorSyndrome;
|
||||
UINT32 MemoryArrayErrorAddress;
|
||||
UINT32 DeviceErrorAddress;
|
||||
UINT32 ErrorResolution;
|
||||
} SMBIOS_TYPE18;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT32 StartingAddress;
|
||||
UINT32 EndingAddress;
|
||||
UINT16 MemoryArrayHandle;
|
||||
UINT8 PartitionWidth;
|
||||
} SMBIOS_TYPE19;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT32 StartingAddress;
|
||||
UINT32 EndingAddress;
|
||||
UINT16 MemoryDeviceHandle;
|
||||
UINT16 MemoryArrayMappedAddressHandle;
|
||||
UINT8 PartitionRowPosition;
|
||||
UINT8 InterleavePosition;
|
||||
UINT8 InterleavedDataDepth;
|
||||
} SMBIOS_TYPE20;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Type;
|
||||
UINT8 Interface;
|
||||
UINT8 NumberOfButtons;
|
||||
} SMBIOS_TYPE21;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Location;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING ManufactureDate;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING DeviceName;
|
||||
UINT8 DeviceChemistry;
|
||||
UINT16 DeviceCapacity;
|
||||
UINT16 DesignVoltage;
|
||||
SMBIOS_STRING SBDSVersionNumber;
|
||||
UINT8 MaximumErrorInBatteryData;
|
||||
UINT16 SBDSSerialNumber;
|
||||
UINT16 SBDSManufactureDate;
|
||||
SMBIOS_STRING SBDSDeviceChemistry;
|
||||
UINT8 DesignCapacityMultiplier;
|
||||
UINT32 OEMSpecific;
|
||||
} SMBIOS_TYPE22;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Capabilities;
|
||||
UINT16 ResetCount;
|
||||
UINT16 ResetLimit;
|
||||
UINT16 TimerInterval;
|
||||
UINT16 Timeout;
|
||||
} SMBIOS_TYPE23;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 HardwareSecuritySettings;
|
||||
} SMBIOS_TYPE24;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 NextScheduledPowerOnMonth;
|
||||
UINT8 NextScheduledPowerOnDayOfMonth;
|
||||
UINT8 NextScheduledPowerOnHour;
|
||||
UINT8 NextScheduledPowerOnMinute;
|
||||
UINT8 NextScheduledPowerOnSecond;
|
||||
} SMBIOS_TYPE25;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Description;
|
||||
UINT8 LocationAndStatus;
|
||||
UINT16 MaximumValue;
|
||||
UINT16 MinimumValue;
|
||||
UINT16 Resolution;
|
||||
UINT16 Tolerance;
|
||||
UINT16 Accuracy;
|
||||
UINT32 OEMDefined;
|
||||
UINT16 NominalValue;
|
||||
} SMBIOS_TYPE26;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT16 TemperatureProbeHandle;
|
||||
UINT8 DeviceTypeAndStatus;
|
||||
UINT8 CoolingUnitGroup;
|
||||
UINT32 OEMDefined;
|
||||
UINT16 NominalSpeed;
|
||||
} SMBIOS_TYPE27;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Description;
|
||||
UINT8 LocationAndStatus;
|
||||
UINT16 MaximumValue;
|
||||
UINT16 MinimumValue;
|
||||
UINT16 Resolution;
|
||||
UINT16 Tolerance;
|
||||
UINT16 Accuracy;
|
||||
UINT32 OEMDefined;
|
||||
UINT16 NominalValue;
|
||||
} SMBIOS_TYPE28;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Description;
|
||||
UINT8 LocationAndStatus;
|
||||
UINT16 MaximumValue;
|
||||
UINT16 MinimumValue;
|
||||
UINT16 Resolution;
|
||||
UINT16 Tolerance;
|
||||
UINT16 Accuracy;
|
||||
UINT32 OEMDefined;
|
||||
UINT16 NominalValue;
|
||||
} SMBIOS_TYPE29;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING ManufacturerName;
|
||||
UINT8 Connections;
|
||||
} SMBIOS_TYPE30;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Checksum;
|
||||
UINT8 Reserved1;
|
||||
UINT16 Reserved2;
|
||||
UINT32 BisEntry16;
|
||||
UINT32 BisEntry32;
|
||||
UINT64 Reserved3;
|
||||
UINT32 Reserved4;
|
||||
} SMBIOS_TYPE31;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 Reserved[6];
|
||||
UINT8 BootStatus[1];
|
||||
} SMBIOS_TYPE32;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 ErrorType;
|
||||
UINT8 ErrorGranularity;
|
||||
UINT8 ErrorOperation;
|
||||
UINT32 VendorSyndrome;
|
||||
UINT64 MemoryArrayErrorAddress;
|
||||
UINT64 DeviceErrorAddress;
|
||||
UINT32 ErrorResolution;
|
||||
} SMBIOS_TYPE33;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Description;
|
||||
UINT8 Type;
|
||||
UINT32 Address;
|
||||
UINT8 AddressType;
|
||||
} SMBIOS_TYPE34;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING Description;
|
||||
UINT16 ManagementDeviceHandle;
|
||||
UINT16 ComponentHandle;
|
||||
UINT16 ThresholdHandle;
|
||||
} SMBIOS_TYPE35;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT16 LowerThresholdNonCritical;
|
||||
UINT16 UpperThresholdNonCritical;
|
||||
UINT16 LowerThresholdCritical;
|
||||
UINT16 UpperThresholdCritical;
|
||||
UINT16 LowerThresholdNonRecoverable;
|
||||
UINT16 UpperThresholdNonRecoverable;
|
||||
} SMBIOS_TYPE36;
|
||||
|
||||
typedef struct MEMORYDEVICE {
|
||||
UINT8 DeviceLoad;
|
||||
UINT16 DeviceHandle;
|
||||
} MEMORYDEVICE;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 ChannelType;
|
||||
UINT8 MaximumChannelLoad;
|
||||
UINT8 MemoryDeviceCount;
|
||||
MEMORYDEVICE MemoryDevice[1];
|
||||
} SMBIOS_TYPE37;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 InterfaceType;
|
||||
UINT8 IPMISpecificationRevision;
|
||||
UINT8 I2CSlaveAddress;
|
||||
UINT8 NVStorageDeviceAddress;
|
||||
UINT64 BaseAddress;
|
||||
} SMBIOS_TYPE38;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 PowerUnitGroup;
|
||||
SMBIOS_STRING Location;
|
||||
SMBIOS_STRING DeviceName;
|
||||
SMBIOS_STRING Manufacturer;
|
||||
SMBIOS_STRING SerialNumber;
|
||||
SMBIOS_STRING AssetTagNumber;
|
||||
SMBIOS_STRING ModelPartNumber;
|
||||
SMBIOS_STRING RevisionLevel;
|
||||
UINT16 MaxPowerCapacity;
|
||||
UINT16 PowerSupplyCharacteristics;
|
||||
UINT16 InputVoltageProbeHandle;
|
||||
UINT16 CoolingDeviceHandle;
|
||||
UINT16 InputCurrentProbeHandle;
|
||||
} SMBIOS_TYPE39;
|
||||
|
||||
//
|
||||
// Add type 40 and type 41 for smbios 2.6
|
||||
//
|
||||
typedef struct {
|
||||
UINT8 EntryLength;
|
||||
UINT16 ReferencedHandle;
|
||||
UINT8 ReferencedOffset;
|
||||
SMBIOS_STRING EntryString;
|
||||
UINT8 Value[1];
|
||||
} ADDITIONAL_INFORMATION_ENTRY;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
UINT8 NumberOfAdditionalInformationEntries;
|
||||
ADDITIONAL_INFORMATION_ENTRY AdditionalInfoEntries[1];
|
||||
} SMBIOS_TYPE40;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
SMBIOS_STRING ReferenceDesignation;
|
||||
UINT8 DeviceType;
|
||||
UINT8 DeviceTypeInstance;
|
||||
UINT16 SegmentGroupNum;
|
||||
UINT8 BusNum;
|
||||
UINT8 DevFuncNum;
|
||||
} SMBIOS_TYPE41;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
} SMBIOS_TYPE126;
|
||||
|
||||
typedef struct {
|
||||
SMBIOS_HEADER Hdr;
|
||||
} SMBIOS_TYPE127;
|
||||
|
||||
/*
|
||||
Notes:
|
||||
Among the following 42 type of structues for SMBIOS Stucture table,
|
||||
There are only 11 Types(0,1,3,4,7,9,16,17,19,20,32) are required,
|
||||
The other types is optional.
|
||||
*/
|
||||
typedef union {
|
||||
SMBIOS_HEADER *Hdr;
|
||||
SMBIOS_TYPE0 *Type0;
|
||||
SMBIOS_TYPE1 *Type1;
|
||||
SMBIOS_TYPE2 *Type2;
|
||||
SMBIOS_TYPE3 *Type3;
|
||||
SMBIOS_TYPE4 *Type4;
|
||||
SMBIOS_TYPE5 *Type5;
|
||||
SMBIOS_TYPE6 *Type6;
|
||||
SMBIOS_TYPE7 *Type7;
|
||||
SMBIOS_TYPE8 *Type8;
|
||||
SMBIOS_TYPE9 *Type9;
|
||||
SMBIOS_TYPE10 *Type10;
|
||||
SMBIOS_TYPE11 *Type11;
|
||||
SMBIOS_TYPE12 *Type12;
|
||||
SMBIOS_TYPE13 *Type13;
|
||||
SMBIOS_TYPE14 *Type14;
|
||||
SMBIOS_TYPE15 *Type15;
|
||||
SMBIOS_TYPE16 *Type16;
|
||||
SMBIOS_TYPE17 *Type17;
|
||||
SMBIOS_TYPE18 *Type18;
|
||||
SMBIOS_TYPE19 *Type19;
|
||||
SMBIOS_TYPE20 *Type20;
|
||||
SMBIOS_TYPE21 *Type21;
|
||||
SMBIOS_TYPE22 *Type22;
|
||||
SMBIOS_TYPE23 *Type23;
|
||||
SMBIOS_TYPE24 *Type24;
|
||||
SMBIOS_TYPE25 *Type25;
|
||||
SMBIOS_TYPE26 *Type26;
|
||||
SMBIOS_TYPE27 *Type27;
|
||||
SMBIOS_TYPE28 *Type28;
|
||||
SMBIOS_TYPE29 *Type29;
|
||||
SMBIOS_TYPE30 *Type30;
|
||||
SMBIOS_TYPE31 *Type31;
|
||||
SMBIOS_TYPE32 *Type32;
|
||||
SMBIOS_TYPE33 *Type33;
|
||||
SMBIOS_TYPE34 *Type34;
|
||||
SMBIOS_TYPE35 *Type35;
|
||||
SMBIOS_TYPE36 *Type36;
|
||||
SMBIOS_TYPE37 *Type37;
|
||||
SMBIOS_TYPE38 *Type38;
|
||||
SMBIOS_TYPE39 *Type39;
|
||||
SMBIOS_TYPE40 *Type40;
|
||||
SMBIOS_TYPE41 *Type41;
|
||||
SMBIOS_TYPE126 *Type126;
|
||||
SMBIOS_TYPE127 *Type127;
|
||||
UINT8 *Raw;
|
||||
} SMBIOS_STRUCTURE_POINTER;
|
||||
|
||||
#pragma pack()
|
||||
|
||||
CHAR8 *
|
||||
LibGetSmbiosString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
IN UINT16 StringNumber
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosSystemGuidAndSerialNumber (
|
||||
IN EFI_GUID *SystemGuid,
|
||||
OUT CHAR8 **SystemSerialNumber
|
||||
);
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,349 @@
|
||||
/** @file
|
||||
API for SMBIOS table.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "../UefiShellDebug1CommandsLib.h"
|
||||
#include <Guid/Smbios.h>
|
||||
#include "LIbSmbios.h"
|
||||
#include "LibSmbiosView.h"
|
||||
#include "smbiosview.h"
|
||||
|
||||
STATIC UINT8 mInit = 0;
|
||||
STATIC SMBIOS_STRUCTURE_TABLE *mSmbiosTable = NULL;
|
||||
STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;
|
||||
STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;
|
||||
|
||||
EFI_STATUS
|
||||
LibSmbiosInit (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Init the SMBIOS VIEW API's environment.
|
||||
|
||||
Arguments:
|
||||
None
|
||||
|
||||
Returns:
|
||||
EFI_SUCCESS - Successful to init the SMBIOS VIEW Lib
|
||||
Others - Cannot get SMBIOS Table
|
||||
|
||||
**/
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Init only once
|
||||
//
|
||||
if (mInit == 1) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Get SMBIOS table from System Configure table
|
||||
//
|
||||
Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID**)&mSmbiosTable);
|
||||
|
||||
if (mSmbiosTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_CANNOT_GET_TABLE), gShellDebug1HiiHandle);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_GET_TABLE_ERROR), gShellDebug1HiiHandle, Status);
|
||||
return Status;
|
||||
}
|
||||
//
|
||||
// Init SMBIOS structure table address
|
||||
//
|
||||
mSmbiosStruct->Raw = (UINT8 *) (UINTN) (mSmbiosTable->TableAddress);
|
||||
|
||||
mInit = 1;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
VOID
|
||||
LibSmbiosCleanup (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
//
|
||||
// Release resources
|
||||
//
|
||||
if (mSmbiosTable != NULL) {
|
||||
mSmbiosTable = NULL;
|
||||
}
|
||||
|
||||
mInit = 0;
|
||||
}
|
||||
|
||||
VOID
|
||||
LibSmbiosGetEPS (
|
||||
SMBIOS_STRUCTURE_TABLE **pEntryPointStructure
|
||||
)
|
||||
{
|
||||
//
|
||||
// return SMBIOS Table address
|
||||
//
|
||||
*pEntryPointStructure = mSmbiosTable;
|
||||
}
|
||||
|
||||
VOID
|
||||
LibSmbiosGetStructHead (
|
||||
SMBIOS_STRUCTURE_POINTER *pHead
|
||||
)
|
||||
{
|
||||
//
|
||||
// return SMBIOS structure table address
|
||||
//
|
||||
pHead = mSmbiosStruct;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosInfo (
|
||||
OUT CHAR8 *dmiBIOSRevision,
|
||||
OUT UINT16 *NumStructures,
|
||||
OUT UINT16 *StructureSize,
|
||||
OUT UINT32 *dmiStorageBase,
|
||||
OUT UINT16 *dmiStorageSize
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Get SMBIOS Information.
|
||||
|
||||
Arguments:
|
||||
dmiBIOSRevision - Revision of the SMBIOS Extensions.
|
||||
NumStructures - Max. Number of Structures the BIOS will return.
|
||||
StructureSize - Size of largest SMBIOS Structure.
|
||||
dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.
|
||||
dmiStorageSize - Size of the memory-mapped SMBIOS data.
|
||||
|
||||
Returns:
|
||||
DMI_SUCCESS - successful.
|
||||
DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.
|
||||
|
||||
**/
|
||||
{
|
||||
//
|
||||
// If no SMIBOS table, unsupported.
|
||||
//
|
||||
if (mSmbiosTable == NULL) {
|
||||
return DMI_FUNCTION_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
*dmiBIOSRevision = mSmbiosTable->SmbiosBcdRevision;
|
||||
*NumStructures = mSmbiosTable->NumberOfSmbiosStructures;
|
||||
*StructureSize = mSmbiosTable->MaxStructureSize;
|
||||
*dmiStorageBase = mSmbiosTable->TableAddress;
|
||||
*dmiStorageSize = mSmbiosTable->TableLength;
|
||||
|
||||
return DMI_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosStructure (
|
||||
IN OUT UINT16 *Handle,
|
||||
IN OUT UINT8 *Buffer,
|
||||
OUT UINT16 *Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Get SMBIOS structure given the Handle,copy data to the Buffer,
|
||||
Handle is changed to the next handle or 0xFFFF when the end is
|
||||
reached or the handle is not found.
|
||||
|
||||
Arguments:
|
||||
Handle: - 0xFFFF: get the first structure
|
||||
- Others: get a structure according to this value.
|
||||
Buffter: - The pointer to the caller's memory buffer.
|
||||
Length: - Length of return buffer in bytes.
|
||||
|
||||
Returns:
|
||||
DMI_SUCCESS - Buffer contains the required structure data
|
||||
- Handle is updated with next structure handle or
|
||||
0xFFFF(end-of-list).
|
||||
|
||||
DMI_INVALID_HANDLE - Buffer not contain the requiring structure data
|
||||
- Handle is updated with next structure handle or
|
||||
0xFFFF(end-of-list).
|
||||
**/
|
||||
{
|
||||
SMBIOS_STRUCTURE_POINTER Smbios;
|
||||
SMBIOS_STRUCTURE_POINTER SmbiosEnd;
|
||||
UINT8 *Raw;
|
||||
|
||||
if (*Handle == INVALIDE_HANDLE) {
|
||||
*Handle = mSmbiosStruct->Hdr->Handle;
|
||||
return DMI_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
if (Buffer == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_SPEC), gShellDebug1HiiHandle);
|
||||
return DMI_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
*Length = 0;
|
||||
Smbios.Hdr = mSmbiosStruct->Hdr;
|
||||
SmbiosEnd.Raw = Smbios.Raw + mSmbiosTable->TableLength;
|
||||
while (Smbios.Raw < SmbiosEnd.Raw) {
|
||||
if (Smbios.Hdr->Handle == *Handle) {
|
||||
Raw = Smbios.Raw;
|
||||
//
|
||||
// Walk to next structure
|
||||
//
|
||||
LibGetSmbiosString (&Smbios, (UINT16) (-1));
|
||||
//
|
||||
// Length = Next structure head - this structure head
|
||||
//
|
||||
*Length = (UINT16) (Smbios.Raw - Raw);
|
||||
CopyMem (Buffer, Raw, *Length);
|
||||
//
|
||||
// update with the next structure handle.
|
||||
//
|
||||
if (Smbios.Raw < SmbiosEnd.Raw) {
|
||||
*Handle = Smbios.Hdr->Handle;
|
||||
} else {
|
||||
*Handle = INVALIDE_HANDLE;
|
||||
}
|
||||
return DMI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Walk to next structure
|
||||
//
|
||||
LibGetSmbiosString (&Smbios, (UINT16) (-1));
|
||||
}
|
||||
|
||||
*Handle = INVALIDE_HANDLE;
|
||||
return DMI_INVALID_HANDLE;
|
||||
}
|
||||
|
||||
EFI_STATUS
|
||||
SmbiosCheckStructure (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Check the structure to see if it is legal.
|
||||
|
||||
Arguments:
|
||||
Smbios - Pointer to the structure that will be checked.
|
||||
|
||||
Returns:
|
||||
DMI_SUCCESS - Structure data is legal.
|
||||
DMI_BAD_PARAMETER - Structure data contains bad parameter
|
||||
|
||||
**/
|
||||
{
|
||||
//
|
||||
// If key != value, then error.
|
||||
//
|
||||
#define CHECK_VALUE(key, value) (((key) == (value)) ? EFI_SUCCESS : DMI_BAD_PARAMETER)
|
||||
|
||||
EFI_STATUS Status;
|
||||
//
|
||||
// Assume staus is EFI_SUCCESS,
|
||||
// but if check is error, then EFI_ERROR.
|
||||
//
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
switch (Smbios->Hdr->Type) {
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (Smbios->Type1->Hdr.Length == 0x08 || Smbios->Type0->Hdr.Length == 0x19) {
|
||||
Status = EFI_SUCCESS;
|
||||
} else {
|
||||
Status = DMI_BAD_PARAMETER;
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
Status = CHECK_VALUE (Smbios->Type2->Hdr.Length, 0x08);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
Status = CHECK_VALUE (Smbios->Type6->Hdr.Length, 0x0C);
|
||||
break;
|
||||
|
||||
case 11:
|
||||
Status = CHECK_VALUE (Smbios->Type11->Hdr.Length, 0x05);
|
||||
break;
|
||||
|
||||
case 12:
|
||||
Status = CHECK_VALUE (Smbios->Type12->Hdr.Length, 0x05);
|
||||
break;
|
||||
|
||||
case 13:
|
||||
Status = CHECK_VALUE (Smbios->Type13->Hdr.Length, 0x16);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
Status = CHECK_VALUE (Smbios->Type16->Hdr.Length, 0x0F);
|
||||
break;
|
||||
|
||||
case 19:
|
||||
Status = CHECK_VALUE (Smbios->Type19->Hdr.Length, 0x0F);
|
||||
break;
|
||||
|
||||
case 20:
|
||||
Status = CHECK_VALUE (Smbios->Type20->Hdr.Length, 0x13);
|
||||
break;
|
||||
|
||||
case 32:
|
||||
//
|
||||
// Because EFI_SUCCESS == 0,
|
||||
// So errors added up is also error.
|
||||
//
|
||||
Status = CHECK_VALUE (Smbios->Type32->Reserved[0], 0x00) +
|
||||
CHECK_VALUE (Smbios->Type32->Reserved[1], 0x00) +
|
||||
CHECK_VALUE (Smbios->Type32->Reserved[2], 0x00) +
|
||||
CHECK_VALUE (Smbios->Type32->Reserved[3], 0x00) +
|
||||
CHECK_VALUE (Smbios->Type32->Reserved[4], 0x00) +
|
||||
CHECK_VALUE (Smbios->Type32->Reserved[5], 0x00);
|
||||
break;
|
||||
|
||||
default:
|
||||
Status = DMI_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
VOID
|
||||
SmbiosGetPendingString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
IN UINT16 StringNumber,
|
||||
OUT CHAR8 *Buffer
|
||||
)
|
||||
{
|
||||
CHAR8 *String;
|
||||
if (Buffer == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUF_SPEC_WHEN_STRUCT), gShellDebug1HiiHandle);
|
||||
return ;
|
||||
}
|
||||
//
|
||||
// Get string and copy to buffer.
|
||||
// Caller should provide the buffer.
|
||||
//
|
||||
String = LibGetSmbiosString (Smbios, StringNumber);
|
||||
if (String != NULL) {
|
||||
CopyMem (Buffer, String, AsciiStrLen(String));
|
||||
} else {
|
||||
Buffer = NULL;
|
||||
}
|
||||
}
|
@ -0,0 +1,120 @@
|
||||
/** @file
|
||||
API for SMBIOS Plug and Play functions, access to SMBIOS table and structures.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _LIB_SMBIOS_VIEW_H
|
||||
#define _LIB_SMBIOS_VIEW_H
|
||||
|
||||
#include "LibSmbios.h"
|
||||
|
||||
#define DMI_SUCCESS 0x00
|
||||
#define DMI_UNKNOWN_FUNCTION 0x81
|
||||
#define DMI_FUNCTION_NOT_SUPPORTED 0x82
|
||||
#define DMI_INVALID_HANDLE 0x83
|
||||
#define DMI_BAD_PARAMETER 0x84
|
||||
#define DMI_INVALID_SUBFUNCTION 0x85
|
||||
#define DMI_NO_CHANGE 0x86
|
||||
#define DMI_ADD_STRUCTURE_FAILED 0x87
|
||||
#define DMI_READ_ONLY 0x8D
|
||||
#define DMI_LOCK_NOT_SUPPORTED 0x90
|
||||
#define DMI_CURRENTLY_LOCKED 0x91
|
||||
#define DMI_INVALID_LOCK 0x92
|
||||
|
||||
#define INVALIDE_HANDLE (UINT16) (-1)
|
||||
|
||||
#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val)
|
||||
|
||||
#define EFI_SMBIOSERR_FAILURE EFI_SMBIOSERR (1)
|
||||
#define EFI_SMBIOSERR_STRUCT_NOT_FOUND EFI_SMBIOSERR (2)
|
||||
#define EFI_SMBIOSERR_TYPE_UNKNOWN EFI_SMBIOSERR (3)
|
||||
#define EFI_SMBIOSERR_UNSUPPORTED EFI_SMBIOSERR (4)
|
||||
|
||||
EFI_STATUS
|
||||
LibSmbiosInit (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
LibSmbiosCleanup (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
LibSmbiosGetEPS (
|
||||
SMBIOS_STRUCTURE_TABLE **pEntryPointStructure
|
||||
);
|
||||
|
||||
VOID
|
||||
LibSmbiosGetStructHead (
|
||||
SMBIOS_STRUCTURE_POINTER *pHead
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosInfo (
|
||||
OUT CHAR8 *dmiBIOSRevision,
|
||||
OUT UINT16 *NumStructures,
|
||||
OUT UINT16 *StructureSize,
|
||||
OUT UINT32 *dmiStorageBase,
|
||||
OUT UINT16 *dmiStorageSize
|
||||
);
|
||||
|
||||
/*++
|
||||
Description:
|
||||
Get SMBIOS Information.
|
||||
|
||||
Arguments:
|
||||
dmiBIOSRevision - Revision of the SMBIOS Extensions.
|
||||
NumStructures - Max. Number of Structures the BIOS will return.
|
||||
StructureSize - Size of largest SMBIOS Structure.
|
||||
dmiStorageBase - 32-bit physical base address for memory mapped SMBIOS data.
|
||||
dmiStorageSize - Size of the memory-mapped SMBIOS data.
|
||||
|
||||
Returns:
|
||||
DMI_SUCCESS - successful.
|
||||
DMI_FUNCTION_NOT_SUPPORTED - Does not support SMBIOS calling interface capability.
|
||||
**/
|
||||
EFI_STATUS
|
||||
LibGetSmbiosStructure (
|
||||
IN OUT UINT16 *Handle,
|
||||
IN OUT UINT8 *Buffer,
|
||||
OUT UINT16 *Length
|
||||
);
|
||||
|
||||
/*++
|
||||
Description:
|
||||
Get SMBIOS structure given the Handle,copy data to the Buffer,Handle is then the next.
|
||||
|
||||
Arguments:
|
||||
Handle: - 0x0: get the first structure
|
||||
- Others: get a certain structure according to this value.
|
||||
Buffter: - contains the pointer to the caller's memory buffer.
|
||||
|
||||
Returns:
|
||||
DMI_SUCCESS - Buffer contains the required structure data
|
||||
- Handle is updated with next structure handle or 0xFFFF(end-of-list).
|
||||
DMI_INVALID_HANDLE - Buffer not contain the requiring structure data
|
||||
- Handle is updated with next structure handle or 0xFFFF(end-of-list).
|
||||
**/
|
||||
VOID
|
||||
SmbiosGetPendingString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
IN UINT16 StringNumber,
|
||||
OUT CHAR8 *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SmbiosCheckStructure (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios
|
||||
);
|
||||
|
||||
#endif
|
2679
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
Normal file
2679
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/PrintInfo.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,192 @@
|
||||
/** @file
|
||||
Module to clarify the element info of the smbios structure.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMBIOS_PRINT_INFO_H
|
||||
#define _SMBIOS_PRINT_INFO_H
|
||||
|
||||
#include "LibSmbios.h"
|
||||
|
||||
extern UINT8 SmbiosMajorVersion;
|
||||
extern UINT8 SmbiosMinorVersion;
|
||||
|
||||
#define SHOW_NONE 0x00
|
||||
#define SHOW_OUTLINE 0x01
|
||||
#define SHOW_NORMAL 0x02
|
||||
#define SHOW_DETAIL 0x03
|
||||
//
|
||||
// SHOW_ALL: WaitEnter() not wait input.
|
||||
//
|
||||
#define SHOW_ALL 0x04
|
||||
#define SHOW_STATISTICS 0x05
|
||||
|
||||
#define AS_UINT16(pData) (*((UINT16 *) pData))
|
||||
#define AS_UINT32(pData) (*((UINT32 *) pData))
|
||||
#define AS_UINT64(pData) (*((UINT64 *) pData))
|
||||
|
||||
VOID
|
||||
SmbiosPrintEPSInfo (
|
||||
IN SMBIOS_STRUCTURE_TABLE *pSmbiosTable,
|
||||
IN UINT8 Option
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SmbiosPrintStructure (
|
||||
IN SMBIOS_STRUCTURE_POINTER *pStruct,
|
||||
IN UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// BIOS Information (Type 0)
|
||||
//
|
||||
VOID
|
||||
DisplayBiosCharacteristics (
|
||||
UINT64 chara,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayBiosCharacteristicsExt1 (
|
||||
UINT8 byte1,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayBiosCharacteristicsExt2 (
|
||||
UINT8 byte2,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Processor Information (Type 4)
|
||||
//
|
||||
VOID
|
||||
DisplayProcessorFamily (
|
||||
UINT8 Family,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
VOID
|
||||
DisplayProcessorFamily2 (
|
||||
UINT16 Family2,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
VOID
|
||||
DisplayProcessorVoltage (
|
||||
UINT8 Voltage,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayProcessorStatus (
|
||||
UINT8 Status,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Controller Information (Type 5)
|
||||
//
|
||||
VOID
|
||||
DisplayMaxMemoryModuleSize (
|
||||
UINT8 Size,
|
||||
UINT8 SlotNum,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryModuleConfigHandles (
|
||||
UINT16 *pHandles,
|
||||
UINT8 SlotNum,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Module Information (Type 6)
|
||||
//
|
||||
VOID
|
||||
DisplayMmBankConnections (
|
||||
UINT8 BankConnections,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMmMemorySize (
|
||||
UINT8 Size,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Slots (Type 9)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemSlotId (
|
||||
UINT16 SlotId,
|
||||
UINT8 SlotType,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Physical Memory Array (Type 16)
|
||||
// Memory Device (Type 17)
|
||||
// Memory Array Mapped Address (Type 19)
|
||||
// Memory Device Mapped Address (Type 20)
|
||||
// Portable Battery (Type 22)
|
||||
//
|
||||
VOID
|
||||
DisplaySBDSManufactureDate (
|
||||
UINT16 Date,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Reset (Type 23)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemResetCapabilities (
|
||||
UINT8 Reset,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Hardware Security (Type 24)
|
||||
//
|
||||
VOID
|
||||
DisplayHardwareSecuritySettings (
|
||||
UINT8 Settings,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Out-of-Band Remote Access (Type 30)
|
||||
//
|
||||
VOID
|
||||
DisplayOBRAConnections (
|
||||
UINT8 Connections,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Boot Information (Type 32)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemBootStatus (
|
||||
UINT8 Parameter,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Power Supply (Type 39)
|
||||
//
|
||||
VOID
|
||||
DisplaySPSCharacteristics (
|
||||
UINT16 Characteristics,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
#endif
|
3798
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
Normal file
3798
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/QueryTable.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,430 @@
|
||||
/** @file
|
||||
Build a table, each item is (key, info) pair.
|
||||
and give a interface of query a string out of a table.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMBIOS_QUERY_TABLE_H
|
||||
#define _SMBIOS_QUERY_TABLE_H
|
||||
|
||||
#define QUERY_TABLE_UNFOUND 0xFF
|
||||
|
||||
typedef struct TABLE_ITEM {
|
||||
UINT16 Key;
|
||||
CHAR16 *Info;
|
||||
} TABLE_ITEM;
|
||||
|
||||
//
|
||||
// Print info by option
|
||||
//
|
||||
#define PRINT_INFO_OPTION(Value, Option) \
|
||||
do { \
|
||||
if (Option == SHOW_NONE) { \
|
||||
return ; \
|
||||
} \
|
||||
if (Option < SHOW_DETAIL) { \
|
||||
Print (L"0x%x\n", Value); \
|
||||
return ; \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
UINT8
|
||||
QueryTable (
|
||||
IN TABLE_ITEM *Table,
|
||||
IN UINTN Number,
|
||||
IN UINT8 Key,
|
||||
IN OUT CHAR16 *Info
|
||||
);
|
||||
|
||||
VOID
|
||||
PrintBitsInfo (
|
||||
IN TABLE_ITEM *Table,
|
||||
IN UINTN Number,
|
||||
IN UINT32 Bits
|
||||
);
|
||||
|
||||
//
|
||||
// Display the element detail information
|
||||
//
|
||||
VOID
|
||||
DisplayStructureTypeInfo (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Information (Type 1)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemWakeupType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Enclosure (Type 3)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemEnclosureType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySystemEnclosureStatus (
|
||||
UINT8 Status,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySESecurityStatus (
|
||||
UINT8 Status,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Processor Information (Type 4)
|
||||
//
|
||||
VOID
|
||||
DisplayProcessorType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayProcessorUpgrade (
|
||||
UINT8 Upgrade,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Controller Information (Type 5)
|
||||
//
|
||||
VOID
|
||||
DisplayMcErrorDetectMethod (
|
||||
UINT8 Method,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMcErrorCorrectCapability (
|
||||
UINT8 Capability,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMcInterleaveSupport (
|
||||
UINT8 Support,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMcMemorySpeeds (
|
||||
UINT16 Speed,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryModuleVoltage (
|
||||
UINT8 Voltage,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Module Information (Type 6)
|
||||
//
|
||||
VOID
|
||||
DisplayMmMemoryType (
|
||||
UINT16 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMmErrorStatus (
|
||||
UINT8 Status,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Cache Information (Type 7)
|
||||
//
|
||||
VOID
|
||||
DisplayCacheSRAMType (
|
||||
UINT16 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayCacheErrCorrectingType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayCacheSystemCacheType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayCacheAssociativity (
|
||||
UINT8 Associativity,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Port Connector Information (Type 8)
|
||||
//
|
||||
VOID
|
||||
DisplayPortConnectorType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPortType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Slots (Type 9)
|
||||
//
|
||||
VOID
|
||||
DisplaySystemSlotType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySystemSlotDataBusWidth (
|
||||
UINT8 Width,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySystemSlotCurrentUsage (
|
||||
UINT8 Usage,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySystemSlotLength (
|
||||
UINT8 Length,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySlotCharacteristics1 (
|
||||
UINT8 Chara1,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySlotCharacteristics2 (
|
||||
UINT8 Chara2,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// On Board Devices Information (Type 10)
|
||||
//
|
||||
VOID
|
||||
DisplayOnboardDeviceTypes (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// System Event Log (Type 15)
|
||||
//
|
||||
VOID
|
||||
DisplaySELTypes (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySELVarDataFormatType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPostResultsBitmapDw1 (
|
||||
UINT32 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPostResultsBitmapDw2 (
|
||||
UINT32 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplaySELSysManagementTypes (
|
||||
UINT32 SMType,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Physical Memory Array (Type 16)
|
||||
//
|
||||
VOID
|
||||
DisplayPMALocation (
|
||||
UINT8 Location,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPMAUse (
|
||||
UINT8 Use,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPMAErrorCorrectionTypes (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Device (Type 17)
|
||||
//
|
||||
VOID
|
||||
DisplayMemoryDeviceFormFactor (
|
||||
UINT8 FormFactor,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryDeviceType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryDeviceTypeDetail (
|
||||
UINT16 Parameter,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// 32-bit Memory Error Information (Type 18)
|
||||
//
|
||||
VOID
|
||||
DisplayMemoryErrorType (
|
||||
UINT8 ErrorType,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryErrorGranularity (
|
||||
UINT8 Granularity,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMemoryErrorOperation (
|
||||
UINT8 Operation,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Array Mapped Address (Type 19)
|
||||
// Memory Device Mapped Address (Type 20)
|
||||
//
|
||||
// Built-in Pointing Device (Type 21)
|
||||
//
|
||||
VOID
|
||||
DisplayPointingDeviceType (
|
||||
UINT8 Type,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayPointingDeviceInterface (
|
||||
UINT8 Interface,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Portable Battery (Type 22)
|
||||
//
|
||||
VOID
|
||||
DisplayPBDeviceChemistry (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Voltage Probe (Type 26)
|
||||
//
|
||||
VOID
|
||||
DisplayVPLocation (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayVPStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Voltage Probe (Type 27)
|
||||
//
|
||||
VOID
|
||||
DisplayCoolingDeviceStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayCoolingDeviceType (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Temperature Probe (Type 28)
|
||||
//
|
||||
VOID
|
||||
DisplayTemperatureProbeStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayTemperatureProbeLoc (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Electrical Current Probe (Type 29)
|
||||
//
|
||||
VOID
|
||||
DisplayECPStatus (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayECPLoc (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Management Device (Type 34)
|
||||
//
|
||||
VOID
|
||||
DisplayMDType (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
VOID
|
||||
DisplayMDAddressType (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// Memory Channel (Type 37)
|
||||
//
|
||||
VOID
|
||||
DisplayMemoryChannelType (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
//
|
||||
// IPMI Device Information (Type 38)
|
||||
//
|
||||
VOID
|
||||
DisplayIPMIDIBMCInterfaceType (
|
||||
UINT8 Key,
|
||||
UINT8 Option
|
||||
);
|
||||
|
||||
#endif
|
126
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c
Normal file
126
ShellPkg/Library/UefiShellDebug1CommandsLib/SmbiosView/Smbios.c
Normal file
@ -0,0 +1,126 @@
|
||||
/** @file
|
||||
Lib fucntions for SMBIOS. Used to get system serial number and GUID
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "../UefiShellDebug1CommandsLib.h"
|
||||
#include <Guid/Smbios.h>
|
||||
#include "LibSmbios.h"
|
||||
|
||||
EFI_STATUS
|
||||
LibGetSmbiosSystemGuidAndSerialNumber (
|
||||
IN EFI_GUID *SystemGuid,
|
||||
OUT CHAR8 **SystemSerialNumber
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
SMBIOS_STRUCTURE_TABLE *SmbiosTable;
|
||||
SMBIOS_STRUCTURE_POINTER Smbios;
|
||||
SMBIOS_STRUCTURE_POINTER SmbiosEnd;
|
||||
UINT16 Index;
|
||||
|
||||
Status = GetSystemConfigurationTable (&gEfiSmbiosTableGuid, (VOID **) &SmbiosTable);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
Smbios.Hdr = (SMBIOS_HEADER *) ((UINTN) (SmbiosTable->TableAddress));
|
||||
|
||||
SmbiosEnd.Raw = (UINT8 *) ((UINTN) (SmbiosTable->TableAddress + SmbiosTable->TableLength));
|
||||
for (Index = 0; Index < SmbiosTable->TableLength; Index++) {
|
||||
if (Smbios.Hdr->Type == 1) {
|
||||
if (Smbios.Hdr->Length < 0x19) {
|
||||
//
|
||||
// Older version did not support Guid and Serial number
|
||||
//
|
||||
continue;
|
||||
}
|
||||
//
|
||||
// SMBIOS tables are byte packed so we need to do a byte copy to
|
||||
// prevend alignment faults on Itanium-based platform.
|
||||
//
|
||||
CopyMem (SystemGuid, &Smbios.Type1->Uuid, sizeof (EFI_GUID));
|
||||
*SystemSerialNumber = LibGetSmbiosString (&Smbios, Smbios.Type1->SerialNumber);
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// Make Smbios point to the next record
|
||||
//
|
||||
LibGetSmbiosString (&Smbios, (UINT16) (-1));
|
||||
|
||||
if (Smbios.Raw >= SmbiosEnd.Raw) {
|
||||
//
|
||||
// SMBIOS 2.1 incorrectly stated the length of SmbiosTable as 0x1e.
|
||||
// given this we must double check against the lenght of
|
||||
// the structure. My home PC has this bug.ruthard
|
||||
//
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
CHAR8 *
|
||||
LibGetSmbiosString (
|
||||
IN SMBIOS_STRUCTURE_POINTER *Smbios,
|
||||
IN UINT16 StringNumber
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
Return SMBIOS string given the string number.
|
||||
|
||||
Arguments:
|
||||
Smbios - Pointer to SMBIOS structure
|
||||
StringNumber - String number to return. -1 is used to skip all strings and
|
||||
point to the next SMBIOS structure.
|
||||
|
||||
Returns:
|
||||
Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
|
||||
**/
|
||||
{
|
||||
UINT16 Index;
|
||||
CHAR8 *String;
|
||||
|
||||
ASSERT (Smbios != NULL);
|
||||
|
||||
//
|
||||
// Skip over formatted section
|
||||
//
|
||||
String = (CHAR8 *) (Smbios->Raw + Smbios->Hdr->Length);
|
||||
|
||||
//
|
||||
// Look through unformated section
|
||||
//
|
||||
for (Index = 1; Index <= StringNumber; Index++) {
|
||||
if (StringNumber == Index) {
|
||||
return String;
|
||||
}
|
||||
//
|
||||
// Skip string
|
||||
//
|
||||
for (; *String != 0; String++);
|
||||
String++;
|
||||
|
||||
if (*String == 0) {
|
||||
//
|
||||
// If double NULL then we are done.
|
||||
// Retrun pointer to next structure in Smbios.
|
||||
// if you pass in a -1 you will always get here
|
||||
//
|
||||
Smbios->Raw = (UINT8 *)++String;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
@ -0,0 +1,547 @@
|
||||
/** @file
|
||||
Tools of clarify the content of the smbios table.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "../UefiShellDebug1CommandsLib.h"
|
||||
#include "LibSmbiosView.h"
|
||||
#include "smbiosview.h"
|
||||
#include "PrintInfo.h"
|
||||
#include "QueryTable.h"
|
||||
|
||||
UINT8 gShowType = SHOW_DETAIL;
|
||||
STATIC STRUCTURE_STATISTICS *mStatisticsTable = NULL;
|
||||
|
||||
UINT8 SmbiosMajorVersion;
|
||||
UINT8 SmbiosMinorVersion;
|
||||
|
||||
STATIC CONST SHELL_PARAM_ITEM ParamList[] = {
|
||||
{L"-t", TypeValue},
|
||||
{L"-h", TypeValue},
|
||||
{L"-s", TypeFlag},
|
||||
{L"-a", TypeFlag},
|
||||
{NULL, TypeMax}
|
||||
};
|
||||
|
||||
SHELL_STATUS
|
||||
EFIAPI
|
||||
ShellCommandRunSmbiosView (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
UINT8 StructType;
|
||||
UINT16 StructHandle;
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN RandomView;
|
||||
LIST_ENTRY *Package;
|
||||
CHAR16 *ProblemParam;
|
||||
SHELL_STATUS ShellStatus;
|
||||
CONST CHAR16 *Temp;
|
||||
|
||||
mStatisticsTable = NULL;
|
||||
Package = NULL;
|
||||
ShellStatus = SHELL_SUCCESS;
|
||||
|
||||
Status = ShellCommandLineParse (EmptyParamList, &Package, &ProblemParam, TRUE);
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (Status == EFI_VOLUME_CORRUPTED && ProblemParam != NULL) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_PROBLEM), gShellDebug1HiiHandle, ProblemParam);
|
||||
FreePool(ProblemParam);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
ASSERT(FALSE);
|
||||
}
|
||||
} else {
|
||||
if (ShellCommandLineGetCount(Package) > 1) {
|
||||
ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_TOO_MANY), gShellDebug1HiiHandle);
|
||||
ShellStatus = SHELL_INVALID_PARAMETER;
|
||||
} else {
|
||||
|
||||
//
|
||||
// Init Lib
|
||||
//
|
||||
Status = LibSmbiosInit ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
//
|
||||
// build statistics table
|
||||
//
|
||||
Status = InitSmbiosTableStatistics ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
StructType = STRUCTURE_TYPE_RANDOM;
|
||||
RandomView = TRUE;
|
||||
//
|
||||
// Initialize the StructHandle to be the first handle
|
||||
//
|
||||
StructHandle = STRUCTURE_HANDLE_INVALID;
|
||||
LibGetSmbiosStructure (&StructHandle, NULL, NULL);
|
||||
|
||||
Temp = ShellCommandLineGetValue(Package, L"-t");
|
||||
if (Temp != NULL) {
|
||||
StructType = (UINT8) ShellStrToUintn (Temp);
|
||||
}
|
||||
|
||||
Temp = ShellCommandLineGetValue(Package, L"-h");
|
||||
if (Temp != NULL) {
|
||||
RandomView = FALSE;
|
||||
StructHandle = (UINT16) ShellStrToUintn(Temp);
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetFlag(Package, L"-s")) {
|
||||
Status = DisplayStatisticsTable (SHOW_DETAIL);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (ShellCommandLineGetFlag(Package, L"-a")) {
|
||||
gShowType = SHOW_ALL;
|
||||
}
|
||||
//
|
||||
// Show SMBIOS structure information
|
||||
//
|
||||
Status = SMBiosView (StructType, StructHandle, gShowType, RandomView);
|
||||
if (EFI_ERROR(Status)) {
|
||||
ShellStatus = SHELL_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
}
|
||||
Done:
|
||||
//
|
||||
// Release resources
|
||||
//
|
||||
if (mStatisticsTable != NULL) {
|
||||
//
|
||||
// Release statistics table
|
||||
//
|
||||
FreePool (mStatisticsTable);
|
||||
mStatisticsTable = NULL;
|
||||
}
|
||||
|
||||
if (Package != NULL) {
|
||||
ShellCommandLineFreeVarList (Package);
|
||||
}
|
||||
|
||||
LibSmbiosCleanup ();
|
||||
|
||||
return ShellStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
Query all structures Data from SMBIOS table and Display
|
||||
the information to users as required display option.
|
||||
|
||||
@param[in] QueryType Structure type to view.
|
||||
@param[in] QueryHandle Structure handle to view.
|
||||
@param[in] Option Display option: none,outline,normal,detail.
|
||||
@param[in] RandomView Support for -h parameter.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
@retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SMBiosView (
|
||||
IN UINT8 QueryType,
|
||||
IN UINT16 QueryHandle,
|
||||
IN UINT8 Option,
|
||||
IN BOOLEAN RandomView
|
||||
)
|
||||
{
|
||||
UINT16 Handle;
|
||||
UINT8 Buffer[1024];
|
||||
//
|
||||
// bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize
|
||||
//
|
||||
UINT16 Length;
|
||||
UINTN Index;
|
||||
UINT16 Offset;
|
||||
//
|
||||
// address offset from structure table head.
|
||||
//
|
||||
UINT32 TableHead;
|
||||
//
|
||||
// structure table head.
|
||||
//
|
||||
|
||||
SMBIOS_STRUCTURE_POINTER pStruct;
|
||||
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
|
||||
|
||||
SMBiosTable = NULL;
|
||||
LibSmbiosGetEPS (&SMBiosTable);
|
||||
if (SMBiosTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) {
|
||||
//
|
||||
// Have get SMBIOS table
|
||||
//
|
||||
SmbiosPrintEPSInfo (SMBiosTable, Option);
|
||||
|
||||
SmbiosMajorVersion = SMBiosTable->MajorVersion;
|
||||
SmbiosMinorVersion = SMBiosTable->MinorVersion;
|
||||
|
||||
ShellPrintEx(-1,-1,L"=========================================================\n");
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERY_STRUCT_COND), gShellDebug1HiiHandle);
|
||||
|
||||
if (QueryType == STRUCTURE_TYPE_RANDOM) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE_RANDOM), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYTYPE), gShellDebug1HiiHandle, QueryType);
|
||||
}
|
||||
|
||||
if (RandomView) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE_RANDOM), gShellDebug1HiiHandle);
|
||||
} else {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_QUERYHANDLE), gShellDebug1HiiHandle, QueryHandle);
|
||||
}
|
||||
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SHOWTYPE), gShellDebug1HiiHandle);
|
||||
ShellPrintEx(-1,-1,GetShowTypeString (gShowType));
|
||||
ShellPrintEx(-1,-1,L"\n\n");
|
||||
|
||||
/*
|
||||
//
|
||||
// Get internal commands, such as change options.
|
||||
//
|
||||
Status = WaitEnter ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
*/
|
||||
|
||||
//
|
||||
// Searching and display structure info
|
||||
//
|
||||
Handle = QueryHandle;
|
||||
TableHead = SMBiosTable->TableAddress;
|
||||
Offset = 0;
|
||||
for (Index = 0; Index < SMBiosTable->NumberOfSmbiosStructures; Index++) {
|
||||
//
|
||||
// if reach the end of table, break..
|
||||
//
|
||||
if (Handle == STRUCTURE_HANDLE_INVALID) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// handle then point to the next!
|
||||
//
|
||||
if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
Offset = (UINT16) (Offset + Length);
|
||||
pStruct.Raw = Buffer;
|
||||
|
||||
//
|
||||
// if QueryType==Random, print this structure.
|
||||
// if QueryType!=Random, but Hdr->Type==QueryType, also print it.
|
||||
// only if QueryType != Random and Hdr->Type != QueryType, skiped it.
|
||||
//
|
||||
if (QueryType != STRUCTURE_TYPE_RANDOM && pStruct.Hdr->Type != QueryType) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ShellPrintEx(-1,-1,L"\n=========================================================\n");
|
||||
ShellPrintHiiEx(-1,-1,NULL,
|
||||
STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE_HANDLE_DUMP_STRUCT),
|
||||
gShellDebug1HiiHandle,
|
||||
pStruct.Hdr->Type,
|
||||
pStruct.Hdr->Handle
|
||||
);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX_LENGTH), gShellDebug1HiiHandle, Index, Length);
|
||||
//
|
||||
// Addr of structure in structure in table
|
||||
//
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset);
|
||||
DumpHex (0, 0, Length, Buffer);
|
||||
|
||||
/*
|
||||
//
|
||||
// Get internal commands, such as change options.
|
||||
//
|
||||
Status = WaitEnter ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
*/
|
||||
|
||||
if (gShowType != SHOW_NONE) {
|
||||
//
|
||||
// check structure legality
|
||||
//
|
||||
SmbiosCheckStructure (&pStruct);
|
||||
|
||||
//
|
||||
// Print structure information
|
||||
//
|
||||
SmbiosPrintStructure (&pStruct, gShowType);
|
||||
ShellPrintEx(-1,-1,L"\n");
|
||||
|
||||
/*
|
||||
//
|
||||
// Get internal commands, such as change options.
|
||||
//
|
||||
Status = WaitEnter ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
*/
|
||||
}
|
||||
if (!RandomView) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ShellPrintEx(-1,-1,L"\n=========================================================\n");
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
Function to initialize the global mStatisticsTable object.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitSmbiosTableStatistics (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
UINT16 Handle;
|
||||
UINT8 Buffer[1024];
|
||||
UINT16 Length;
|
||||
UINT16 Offset;
|
||||
UINT16 Index;
|
||||
|
||||
SMBIOS_STRUCTURE_POINTER pStruct;
|
||||
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
|
||||
STRUCTURE_STATISTICS *pStatistics;
|
||||
|
||||
SMBiosTable = NULL;
|
||||
LibSmbiosGetEPS (&SMBiosTable);
|
||||
if (SMBiosTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) != 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_SMBIOS_TABLE), gShellDebug1HiiHandle);
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Allocate memory to mStatisticsTable
|
||||
//
|
||||
if (mStatisticsTable != NULL) {
|
||||
FreePool (mStatisticsTable);
|
||||
mStatisticsTable = NULL;
|
||||
}
|
||||
|
||||
mStatisticsTable = (STRUCTURE_STATISTICS *) AllocatePool (SMBiosTable->NumberOfSmbiosStructures * sizeof (STRUCTURE_STATISTICS));
|
||||
|
||||
if (mStatisticsTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OUT_OF_MEM), gShellDebug1HiiHandle);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Offset = 0;
|
||||
pStatistics = mStatisticsTable;
|
||||
|
||||
//
|
||||
// search from the first one
|
||||
//
|
||||
Handle = STRUCTURE_HANDLE_INVALID;
|
||||
LibGetSmbiosStructure (&Handle, NULL, NULL);
|
||||
for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) {
|
||||
//
|
||||
// If reach the end of table, break..
|
||||
//
|
||||
if (Handle == STRUCTURE_HANDLE_INVALID) {
|
||||
break;
|
||||
}
|
||||
//
|
||||
// After LibGetSmbiosStructure(), handle then point to the next!
|
||||
//
|
||||
if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {
|
||||
break;
|
||||
}
|
||||
|
||||
pStruct.Raw = Buffer;
|
||||
Offset = (UINT16) (Offset + Length);
|
||||
|
||||
//
|
||||
// general statistics
|
||||
//
|
||||
pStatistics->Index = Index;
|
||||
pStatistics->Type = pStruct.Hdr->Type;
|
||||
pStatistics->Handle = pStruct.Hdr->Handle;
|
||||
pStatistics->Length = Length;
|
||||
pStatistics->Addr = Offset;
|
||||
|
||||
pStatistics = &mStatisticsTable[Index];
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Function to display the global mStatisticsTable object.
|
||||
|
||||
@param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DisplayStatisticsTable (
|
||||
IN UINT8 Option
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Num;
|
||||
STRUCTURE_STATISTICS *pStatistics;
|
||||
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
|
||||
|
||||
SMBiosTable = NULL;
|
||||
if (Option < SHOW_OUTLINE) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
//
|
||||
// display EPS information firstly
|
||||
//
|
||||
LibSmbiosGetEPS (&SMBiosTable);
|
||||
if (SMBiosTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_TABLE), gShellDebug1HiiHandle);
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
ShellPrintEx(-1,-1,L"\n============================================================\n");
|
||||
SmbiosPrintEPSInfo (SMBiosTable, Option);
|
||||
|
||||
if (Option < SHOW_NORMAL) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if (mStatisticsTable == NULL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_CANNOT_ACCESS_STATS), gShellDebug1HiiHandle);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ShellPrintEx(-1,-1,L"============================================================\n");
|
||||
pStatistics = &mStatisticsTable[0];
|
||||
Num = SMBiosTable->NumberOfSmbiosStructures;
|
||||
//
|
||||
// display statistics table content
|
||||
//
|
||||
for (Index = 1; Index <= Num; Index++) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_INDEX), gShellDebug1HiiHandle, pStatistics->Index);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_TYPE), gShellDebug1HiiHandle, pStatistics->Type);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_HANDLE), gShellDebug1HiiHandle, pStatistics->Handle);
|
||||
if (Option >= SHOW_DETAIL) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_OFFSET), gShellDebug1HiiHandle, pStatistics->Addr);
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_LENGTH), gShellDebug1HiiHandle, pStatistics->Length);
|
||||
}
|
||||
|
||||
ShellPrintEx(-1,-1,L"\n");
|
||||
pStatistics = &mStatisticsTable[Index];
|
||||
/*
|
||||
//
|
||||
// Display 20 lines and wait for a page break
|
||||
//
|
||||
if (Index % 20 == 0) {
|
||||
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ENTER_CONTINUE), gShellDebug1HiiHandle);
|
||||
Status = WaitEnter ();
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Status == EFI_ABORTED) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
function to return a string of the detail level.
|
||||
|
||||
@param[in] ShowType The detail level whose name is desired in clear text.
|
||||
|
||||
@return A pointer to a string representing the ShowType (or 'undefined type' if not known).
|
||||
**/
|
||||
CHAR16 *
|
||||
EFIAPI
|
||||
GetShowTypeString (
|
||||
UINT8 ShowType
|
||||
)
|
||||
{
|
||||
//
|
||||
// show type
|
||||
//
|
||||
switch (ShowType) {
|
||||
|
||||
case SHOW_NONE:
|
||||
return L"SHOW_NONE";
|
||||
|
||||
case SHOW_OUTLINE:
|
||||
return L"SHOW_OUTLINE";
|
||||
|
||||
case SHOW_NORMAL:
|
||||
return L"SHOW_NORMAL";
|
||||
|
||||
case SHOW_DETAIL:
|
||||
return L"SHOW_DETAIL";
|
||||
|
||||
case SHOW_ALL:
|
||||
return L"SHOW_ALL";
|
||||
|
||||
default:
|
||||
return L"Undefined type";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
EFI_STATUS
|
||||
InitializeSmbiosViewApplicationGetLineHelp (
|
||||
OUT CHAR16 **Str
|
||||
)
|
||||
{
|
||||
return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str);
|
||||
}
|
||||
*/
|
Binary file not shown.
@ -0,0 +1,91 @@
|
||||
/** @file
|
||||
Tools of clarify the content of the smbios table.
|
||||
|
||||
Copyright (c) 2005 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SMBIOS_VIEW_H
|
||||
#define _SMBIOS_VIEW_H
|
||||
|
||||
#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE
|
||||
#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF
|
||||
|
||||
#define STRUCTURE_HANDLE_INVALID (UINT16) 0xFFFF
|
||||
|
||||
typedef struct {
|
||||
UINT16 Index;
|
||||
UINT8 Type;
|
||||
UINT16 Handle;
|
||||
UINT16 Addr; // offset from table head
|
||||
UINT16 Length; // total structure length
|
||||
} STRUCTURE_STATISTICS;
|
||||
|
||||
/**
|
||||
Query all structures Data from SMBIOS table and Display
|
||||
the information to users as required display option.
|
||||
|
||||
@param[in] QueryType Structure type to view.
|
||||
@param[in] QueryHandle Structure handle to view.
|
||||
@param[in] Option Display option: none,outline,normal,detail.
|
||||
@param[in] RandomView Support for -h parameter.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
@retval EFI_BAD_BUFFER_SIZE structure is out of the range of SMBIOS table.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SMBiosView (
|
||||
IN UINT8 QueryType,
|
||||
IN UINT16 QueryHandle,
|
||||
IN UINT8 Option,
|
||||
IN BOOLEAN RandomView
|
||||
);
|
||||
|
||||
/**
|
||||
Function to initialize the global mStatisticsTable object.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitSmbiosTableStatistics (
|
||||
VOID
|
||||
);
|
||||
|
||||
/**
|
||||
Function to display the global mStatisticsTable object.
|
||||
|
||||
@param[in] Option ECHO, NORMAL, or DETAIL control the amount of detail displayed.
|
||||
|
||||
@retval EFI_SUCCESS print is successful.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DisplayStatisticsTable (
|
||||
IN UINT8 Option
|
||||
);
|
||||
|
||||
/**
|
||||
function to return a string of the detail level.
|
||||
|
||||
@param[in] ShowType The detail level whose name is desired in clear text.
|
||||
|
||||
@return A pointer to a string representing the ShowType (or 'undefined type' if not known).
|
||||
**/
|
||||
CHAR16*
|
||||
EFIAPI
|
||||
GetShowTypeString (
|
||||
UINT8 ShowType
|
||||
);
|
||||
|
||||
extern UINT8 gShowType;
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user