Add SMBIOS 2.7.1 support to SmbiosView command.

Signed-off-by: lzeng14
Reviewed-by: jcarsey


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13101 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lzeng14 2012-03-15 08:29:49 +00:00
parent 55b175331e
commit 187cb3dd8d
13 changed files with 1073 additions and 1098 deletions

View File

@ -1,645 +0,0 @@
/** @file
Lib include for SMBIOS services. Used to get system serial number and GUID
Copyright (c) 2005 - 2011, 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 _DEVICE_STRUCTURE {
UINT8 DeviceType;
SMBIOS_STRING DescriptionString;
} DEVICE_STRUCTURE;
typedef struct {
SMBIOS_HEADER Hdr;
DEVICE_STRUCTURE 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;
//
// Add for smbios 2.7
//
UINT64 ExtendedStartingAddress;
UINT64 ExtendedEndingAddress;
} 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()
/**
Return SMBIOS string given the string number.
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
API for SMBIOS table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -15,12 +15,11 @@
#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_TABLE_ENTRY_POINT *mSmbiosTable = NULL;
STATIC SMBIOS_STRUCTURE_POINTER m_SmbiosStruct;
STATIC SMBIOS_STRUCTURE_POINTER *mSmbiosStruct = &m_SmbiosStruct;
@ -90,7 +89,7 @@ LibSmbiosCleanup (
**/
VOID
LibSmbiosGetEPS (
OUT SMBIOS_STRUCTURE_TABLE **EntryPointStructure
OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
)
{
//
@ -100,27 +99,77 @@ LibSmbiosGetEPS (
}
/**
Get SMBIOS structure given the Handle,copy data to the Buffer,
Return SMBIOS string for the given string number.
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
)
{
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.
// Return 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;
}
/**
Get SMBIOS structure for the given Handle,
Handle is changed to the next handle or 0xFFFF when the end is
reached or the handle is not found.
@param[in, out] Handle 0xFFFF: get the first structure
Others: get a structure according to this value.
@param[in, out] Buffer The pointer to the caller's memory buffer.
@param[out] Length Length of return buffer in bytes.
@param[out] Buffer The pointer to the pointer to the structure.
@param[out] Length Length of the structure.
@retval DMI_SUCCESS Buffer contains the required structure data
Handle is updated with next structure handle or
@retval DMI_SUCCESS Handle is updated with next structure handle or
0xFFFF(end-of-list).
@retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data.
Handle is updated with next structure handle or
@retval DMI_INVALID_HANDLE Handle is updated with first structure handle or
0xFFFF(end-of-list).
**/
EFI_STATUS
LibGetSmbiosStructure (
IN OUT UINT16 *Handle,
IN OUT UINT8 *Buffer,
OUT UINT8 **Buffer,
OUT UINT16 *Length
)
{
@ -128,13 +177,13 @@ LibGetSmbiosStructure (
SMBIOS_STRUCTURE_POINTER SmbiosEnd;
UINT8 *Raw;
if (*Handle == INVALIDE_HANDLE) {
if (*Handle == INVALID_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);
if ((Buffer == NULL) || (Length == NULL)) {
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_LIBSMBIOSVIEW_NO_BUFF_LEN_SPEC), gShellDebug1HiiHandle);
return DMI_INVALID_HANDLE;
}
@ -152,14 +201,14 @@ LibGetSmbiosStructure (
// Length = Next structure head - this structure head
//
*Length = (UINT16) (Smbios.Raw - Raw);
CopyMem (Buffer, Raw, *Length);
*Buffer = Raw;
//
// update with the next structure handle.
//
if (Smbios.Raw < SmbiosEnd.Raw) {
*Handle = Smbios.Hdr->Handle;
} else {
*Handle = INVALIDE_HANDLE;
*Handle = INVALID_HANDLE;
}
return DMI_SUCCESS;
}
@ -169,126 +218,7 @@ LibGetSmbiosStructure (
LibGetSmbiosString (&Smbios, (UINT16) (-1));
}
*Handle = INVALIDE_HANDLE;
*Handle = INVALID_HANDLE;
return DMI_INVALID_HANDLE;
}
/**
Check the structure to see if it is legal.
@param[in] Smbios - Pointer to the structure that will be checked.
@retval DMI_SUCCESS Structure data is legal.
@retval DMI_BAD_PARAMETER Structure data contains bad parameter.
**/
EFI_STATUS
SmbiosCheckStructure (
IN SMBIOS_STRUCTURE_POINTER *Smbios
)
{
//
// 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;
}
/**
Get a string from the smbios information.
@param[in] Smbios The pointer to the smbios information.
@param[in] StringNumber The index to the string to get.
@param[out] Buffer The buffer to fill with the string when retrieved.
**/
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;
}
}

View File

@ -1,7 +1,7 @@
/** @file
API for SMBIOS Plug and Play functions, access to SMBIOS table and structures.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -15,7 +15,7 @@
#ifndef _LIB_SMBIOS_VIEW_H_
#define _LIB_SMBIOS_VIEW_H_
#include "LibSmbios.h"
#include <IndustryStandard/SmBios.h>
#define DMI_SUCCESS 0x00
#define DMI_UNKNOWN_FUNCTION 0x81
@ -30,7 +30,7 @@
#define DMI_CURRENTLY_LOCKED 0x91
#define DMI_INVALID_LOCK 0x92
#define INVALIDE_HANDLE (UINT16) (-1)
#define INVALID_HANDLE (UINT16) (-1)
#define EFI_SMBIOSERR(val) EFIERR (0x30000 | val)
@ -64,59 +64,45 @@ LibSmbiosCleanup (
**/
VOID
LibSmbiosGetEPS (
OUT SMBIOS_STRUCTURE_TABLE **EntryPointStructure
OUT SMBIOS_TABLE_ENTRY_POINT **EntryPointStructure
);
/**
Get SMBIOS structure given the Handle,copy data to the Buffer,
Return SMBIOS string for the given string number.
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
);
/**
Get SMBIOS structure for the given Handle,
Handle is changed to the next handle or 0xFFFF when the end is
reached or the handle is not found.
@param[in, out] Handle 0xFFFF: get the first structure
Others: get a structure according to this value.
@param[in, out] Buffer The pointer to the caller's memory buffer.
@param[out] Length Length of return buffer in bytes.
@param[out] Buffer The pointer to the pointer to the structure.
@param[out] Length Length of the structure.
@retval DMI_SUCCESS Buffer contains the required structure data
Handle is updated with next structure handle or
@retval DMI_SUCCESS Handle is updated with next structure handle or
0xFFFF(end-of-list).
@retval DMI_INVALID_HANDLE Buffer not contain the requiring structure data.
Handle is updated with next structure handle or
@retval DMI_INVALID_HANDLE Handle is updated with first structure handle or
0xFFFF(end-of-list).
**/
EFI_STATUS
LibGetSmbiosStructure (
IN OUT UINT16 *Handle,
IN OUT UINT8 *Buffer,
OUT UINT8 **Buffer,
OUT UINT16 *Length
);
/**
Get a string from the smbios information.
@param[in] Smbios The pointer to the smbios information.
@param[in] StringNumber The index to the string to get.
@param[out] Buffer The buffer to fill with the string when retrieved.
**/
VOID
SmbiosGetPendingString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber,
OUT CHAR8 *Buffer
);
/**
Check the structure to see if it is legal.
@param[in] Smbios - Pointer to the structure that will be checked.
@retval DMI_SUCCESS Structure data is legal.
@retval DMI_BAD_PARAMETER Structure data contains bad parameter.
**/
EFI_STATUS
SmbiosCheckStructure (
IN SMBIOS_STRUCTURE_POINTER *Smbios
);
#endif

View File

@ -1,7 +1,7 @@
/** @file
Module to clarify the element info of the smbios structure.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -15,7 +15,7 @@
#ifndef _SMBIOS_PRINT_INFO_H_
#define _SMBIOS_PRINT_INFO_H_
#include "LibSmbios.h"
#include <IndustryStandard/SmBios.h>
extern UINT8 SmbiosMajorVersion;
extern UINT8 SmbiosMinorVersion;
@ -42,7 +42,7 @@ extern UINT8 SmbiosMinorVersion;
**/
VOID
SmbiosPrintEPSInfo (
IN SMBIOS_STRUCTURE_TABLE *SmbiosTable,
IN SMBIOS_TABLE_ENTRY_POINT *SmbiosTable,
IN UINT8 Option
);
@ -157,8 +157,8 @@ DisplayProcessorVoltage (
Bit 7 Reserved, must be 0
Bit 6 CPU Socket Populated
1 - CPU Socket Populated
0 - CPU Socket UnpopulatedBits
5:3 Reserved, must be zero
0 - CPU Socket Unpopulated
Bits 5:3 Reserved, must be zero
Bits 2:0 CPU Status
0h - Unknown
1h - CPU Enabled
@ -236,6 +236,40 @@ DisplayMmMemorySize (
IN UINT8 Option
);
/**
Display Cache Configuration.
@param[in] CacheConfiguration Cache Configuration.
Bits 15:10 Reserved, must be 0
Bits 9:8 Operational Mode
0h - Write Through
1h - Write Back
2h - Varies with Memory Address
3h - Unknown
Bit 7 Enabled/Disabled
1 - Enabled
0 - Disabled
Bits 6:5 Location
0h - Internal
1h - External
2h - Reserved
3h - Unknown
Bit 4 Reserved, must be zero
Bit 3 Cache Socketed
1 - Socketed
0 - Unsocketed
Bits 2:0 Cache Level
1 through 8 (For example, an L1 cache would
use value 000b and an L3 cache would use 010b.)
@param[in] Option The option
**/
VOID
DisplayCacheConfiguration (
IN UINT16 CacheConfiguration,
IN UINT8 Option
);
/**
The Slot ID field of the System Slot structure provides a mechanism to
correlate the physical attributes of the slot to its logical access method

View File

@ -2,7 +2,7 @@
Build a table, each item is (Key, Info) pair.
And give a interface of query a string out of a table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -52,10 +52,88 @@ TABLE_ITEM SystemWakeupTypeTable[] = {
}
};
TABLE_ITEM BaseBoardFeatureFlagsTable[] = {
{
0,
L" Hosting board"
},
{
1,
L" Requires at least one daughter board or auxiliary card"
},
{
2,
L" Removable"
},
{
3,
L" Replaceable"
},
{
4,
L" Hot swappable"
}
};
TABLE_ITEM BaseBoardBoardTypeTable[] = {
{
0x01,
L" Unknown"
},
{
0x02,
L" Other"
},
{
0x03,
L" Server Blade"
},
{
0x04,
L" Connectivity Switch"
},
{
0x05,
L" System Management Module"
},
{
0x06,
L" Processor Module"
},
{
0x07,
L" I/O Module"
},
{
0x08,
L" Memory Module"
},
{
0x09,
L" Daughter board"
},
{
0x0A,
L" Motherboard"
},
{
0x0B,
L" Processor/Memory Module"
},
{
0x0C,
L" Processor/IO Module"
},
{
0x0D,
L" Interconnect Board"
}
};
TABLE_ITEM SystemEnclosureTypeTable[] = {
{
0x01,
L" None"
L" Other"
},
{
0x02,
@ -348,9 +426,109 @@ TABLE_ITEM ProcessorUpgradeTable[] = {
{
0x19,
L"Socket LGA1366"
}\
},
{
0x1A,
L"Socket G34"
},
{
0x1B,
L"Socket AM3"
},
{
0x1C,
L"Socket C32"
},
{
0x1D,
L"Socket LGA1156"
},
{
0x1E,
L"Socket LGA1567"
},
{
0x1F,
L"Socket PGA988A"
},
{
0x20,
L"Socket BGA1288"
},
{
0x21,
L"Socket rPGA988B"
},
{
0x22,
L"Socket BGA1023"
},
{
0x23,
L"Socket BGA1224"
},
{
0x24,
L"Socket BGA1155"
},
{
0x25,
L"Socket LGA1356"
},
{
0x26,
L"Socket LGA2011"
},
{
0x27,
L"Socket FS1"
},
{
0x28,
L"Socket FS2"
},
{
0x29,
L"Socket FM1"
},
{
0x2A,
L"Socket FM2"
}
};
TABLE_ITEM ProcessorCharacteristicsTable[] = {
{
1,
L" Unknown"
},
{
2,
L" 64-bit Capable"
},
{
3,
L" Multi-Core"
},
{
4,
L" Hardware Thread"
},
{
5,
L" Execute Protection"
},
{
6,
L" Enhanced Virtualization"
},
{
7,
L" Power/Performance Control"
}
};
TABLE_ITEM McErrorDetectMethodTable[] = {
{
0x01,
@ -599,10 +777,6 @@ TABLE_ITEM CacheErrCorrectingTypeTable[] = {
{
0x06,
L"Multi-bit ECC"
},
{
0x07,
L"Sixteen Way Interleave"
}
};
@ -681,6 +855,10 @@ TABLE_ITEM CacheAssociativityTable[] = {
{
0x0D,
L"64-way Set-Associative"
},
{
0x0E,
L"20-way Set-Associative"
}
};
@ -1121,7 +1299,7 @@ TABLE_ITEM SystemSlotTypeTable[] = {
},
{
0xAB,
L"PCI Express Gen 26"
L"PCI Express Gen 2"
},
{
0xAC,
@ -1142,6 +1320,30 @@ TABLE_ITEM SystemSlotTypeTable[] = {
{
0xB0,
L"PCI Express Gen 2 X16"
},
{
0xB1,
L"PCI Express Gen 3"
},
{
0xB2,
L"PCI Express Gen 3 X1"
},
{
0xB3,
L"PCI Express Gen 3 X2"
},
{
0xB4,
L"PCI Express Gen 3 X4"
},
{
0xB5,
L"PCI Express Gen 3 X8"
},
{
0xB6,
L"PCI Express Gen 3 X16"
}
};
@ -1174,6 +1376,34 @@ TABLE_ITEM SystemSlotDataBusWidthTable[] = {
0x07,
L" 128 bit"
},
{
0x08,
L" 1x or x1"
},
{
0x09,
L" 2x or x2"
},
{
0x0A,
L" 4x or x4"
},
{
0x0B,
L" 8x or x8"
},
{
0x0C,
L" 12x or x12"
},
{
0x0D,
L" 16x or x16"
},
{
0x0E,
L" 32x or x32"
}
};
TABLE_ITEM SystemSlotCurrentUsageTable[] = {
@ -2117,6 +2347,14 @@ TABLE_ITEM MemoryDeviceTypeDetailTable[] = {
12,
L" Non-volatile"
},
{
13,
L" Registered(Buffered)"
},
{
14,
L" Unbuffered(Unregistered)"
}
};
TABLE_ITEM MemoryErrorTypeTable[] = {
@ -2910,6 +3148,18 @@ TABLE_ITEM StructureTypeInfoTable[] = {
39,
L" System Power Supply"
},
{
40,
L" Additional Information"
},
{
41,
L" Onboard Devices Extended Information"
},
{
42,
L" Management Controller Host Interface"
},
{
0x7E,
L" Inactive"
@ -3086,6 +3336,40 @@ DisplaySystemWakeupType (
PRINT_TABLE_ITEM (SystemWakeupTypeTable, Type);
}
/**
Display Base Board (Type 2) Feature Flags.
@param[in] FeatureFlags The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayBaseBoardFeatureFlags (
IN UINT8 FeatureFlags,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_FEATURE_FLAGS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (FeatureFlags, Option);
PRINT_BITS_INFO (BaseBoardFeatureFlagsTable, FeatureFlags);
}
/**
Display Base Board (Type 2) Board Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayBaseBoardBoardType(
IN UINT8 Type,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_BASE_BOARD_BOARD_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_TABLE_ITEM (BaseBoardBoardTypeTable, Type);
}
/**
Display System Enclosure (Type 3) Enclosure Type.
@ -3178,6 +3462,23 @@ DisplayProcessorUpgrade (
PRINT_TABLE_ITEM (ProcessorUpgradeTable, Upgrade);
}
/**
Display Processor Information (Type 4) Characteristics.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayProcessorCharacteristics (
IN UINT16 Type,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_PROC_CHARACTERISTICS), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Type, Option);
PRINT_BITS_INFO (ProcessorCharacteristicsTable, Type);
}
/**
Display Memory Controller Information (Type 5) method.
@ -3988,7 +4289,7 @@ DisplayECPLoc (
}
/**
Display Management Device (Type 34) information.
Display Management Device (Type 34) Type.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
@ -4004,6 +4305,23 @@ DisplayMDType (
PRINT_TABLE_ITEM (MDTypeTable, Key);
}
/**
Display Management Device (Type 34) Address Type.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMDAddressType (
IN UINT8 Key,
IN UINT8 Option
)
{
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_QUERYTABLE_MANAGEMENT_DEV_ADDR_TYPE), gShellDebug1HiiHandle);
PRINT_INFO_OPTION (Key, Option);
PRINT_TABLE_ITEM (MDAddressTypeTable, Key);
}
/**
Display Memory Channel (Type 37) information.

View File

@ -2,7 +2,7 @@
Build a table, each item is (key, info) pair.
and give a interface of query a string out of a table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -94,6 +94,30 @@ DisplaySystemWakeupType (
IN UINT8 Option
);
/**
Display Base Board (Type 2) Feature Flags.
@param[in] FeatureFlags The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayBaseBoardFeatureFlags (
IN UINT8 FeatureFlags,
IN UINT8 Option
);
/**
Display Base Board (Type 2) Board Type.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayBaseBoardBoardType(
IN UINT8 Type,
IN UINT8 Option
);
/**
Display System Enclosure (Type 3) Enclosure Type.
@ -155,6 +179,18 @@ DisplayProcessorUpgrade (
IN UINT8 Option
);
/**
Display Processor Information (Type 4) Characteristics.
@param[in] Type The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayProcessorCharacteristics (
IN UINT16 Type,
IN UINT8 Option
);
/**
Display Memory Controller Information (Type 5) method.
@ -696,7 +732,7 @@ DisplayECPLoc (
);
/**
Display Management Device (Type 34) information.
Display Management Device (Type 34) Type.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
@ -707,6 +743,18 @@ DisplayMDType (
IN UINT8 Option
);
/**
Display Management Device (Type 34) Address Type.
@param[in] Key The key of the structure.
@param[in] Option The optional information.
**/
VOID
DisplayMDAddressType (
IN UINT8 Key,
IN UINT8 Option
);
/**
Display Memory Channel (Type 37) information.

View File

@ -1,69 +0,0 @@
/** @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"
/**
Return SMBIOS string given the string number.
@param[in] Smbios Pointer to SMBIOS structure.
@param[in] StringNumber String number to return. -1 is used to skip all strings and
point to the next SMBIOS structure.
@return Pointer to string, or pointer to next SMBIOS strcuture if StringNumber == -1
**/
CHAR8*
LibGetSmbiosString (
IN SMBIOS_STRUCTURE_POINTER *Smbios,
IN UINT16 StringNumber
)
{
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;
}

View File

@ -1,7 +1,7 @@
/** @file
Tools of clarify the content of the smbios table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -111,7 +111,7 @@ ShellCommandRunSmbiosView (
//
// Initialize the StructHandle to be the first handle
//
StructHandle = STRUCTURE_HANDLE_INVALID;
StructHandle = INVALID_HANDLE;
LibGetSmbiosStructure (&StructHandle, NULL, NULL);
Temp = ShellCommandLineGetValue(Package, L"-t");
@ -188,23 +188,12 @@ SMBiosView (
)
{
UINT16 Handle;
UINT8 Buffer[1024];
//
// bigger than SMBIOS_STRUCTURE_TABLE.MaxStructureSize
//
UINT8 *Buffer;
UINT16 Length;
UINTN Index;
UINT16 Offset;
//
// address offset from structure table head.
//
UINT32 TableHead;
//
// structure table head.
//
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
SMBiosTable = NULL;
LibSmbiosGetEPS (&SMBiosTable);
@ -215,7 +204,7 @@ SMBiosView (
if (CompareMem (SMBiosTable->AnchorString, "_SM_", 4) == 0) {
//
// Have get SMBIOS table
// Have got SMBIOS table
//
SmbiosPrintEPSInfo (SMBiosTable, Option);
@ -259,22 +248,20 @@ SMBiosView (
// 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) {
if (Handle == INVALID_HANDLE) {
break;
}
//
// handle then point to the next!
//
if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {
if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) {
break;
}
Offset = (UINT16) (Offset + Length);
SmbiosStruct.Raw = Buffer;
//
@ -297,7 +284,7 @@ SMBiosView (
//
// Addr of structure in structure in table
//
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, TableHead + Offset);
ShellPrintHiiEx(-1,-1,NULL,STRING_TOKEN (STR_SMBIOSVIEW_SMBIOSVIEW_ADDR), gShellDebug1HiiHandle, (UINTN) Buffer);
DumpHex (0, 0, Length, Buffer);
/*
@ -315,11 +302,6 @@ SMBiosView (
*/
if (gShowType != SHOW_NONE) {
//
// check structure legality
//
SmbiosCheckStructure (&SmbiosStruct);
//
// Print structure information
//
@ -364,13 +346,13 @@ InitSmbiosTableStatistics (
)
{
UINT16 Handle;
UINT8 Buffer[1024];
UINT8 *Buffer;
UINT16 Length;
UINT16 Offset;
UINT16 Index;
SMBIOS_STRUCTURE_POINTER SmbiosStruct;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
STRUCTURE_STATISTICS *StatisticsPointer;
SMBiosTable = NULL;
@ -405,24 +387,23 @@ InitSmbiosTableStatistics (
//
// search from the first one
//
Handle = STRUCTURE_HANDLE_INVALID;
Handle = INVALID_HANDLE;
LibGetSmbiosStructure (&Handle, NULL, NULL);
for (Index = 1; Index <= SMBiosTable->NumberOfSmbiosStructures; Index++) {
//
// If reach the end of table, break..
//
if (Handle == STRUCTURE_HANDLE_INVALID) {
if (Handle == INVALID_HANDLE) {
break;
}
//
// After LibGetSmbiosStructure(), handle then point to the next!
//
if (LibGetSmbiosStructure (&Handle, Buffer, &Length) != DMI_SUCCESS) {
if (LibGetSmbiosStructure (&Handle, &Buffer, &Length) != DMI_SUCCESS) {
break;
}
SmbiosStruct.Raw = Buffer;
Offset = (UINT16) (Offset + Length);
//
// general statistics
@ -433,6 +414,8 @@ InitSmbiosTableStatistics (
StatisticsPointer->Length = Length;
StatisticsPointer->Addr = Offset;
Offset = (UINT16) (Offset + Length);
StatisticsPointer = &mStatisticsTable[Index];
}
@ -455,7 +438,7 @@ DisplayStatisticsTable (
UINTN Index;
UINTN Num;
STRUCTURE_STATISTICS *StatisticsPointer;
SMBIOS_STRUCTURE_TABLE *SMBiosTable;
SMBIOS_TABLE_ENTRY_POINT *SMBiosTable;
SMBiosTable = NULL;
if (Option < SHOW_OUTLINE) {
@ -558,12 +541,3 @@ GetShowTypeString (
}
}
/*
EFI_STATUS
InitializeSmbiosViewApplicationGetLineHelp (
OUT CHAR16 **Str
)
{
return LibCmdGetStringByToken (STRING_ARRAY_NAME, &EfiSmbiosViewGuid, STRING_TOKEN (STR_SMBIOSVIEW_LINE_HELP), Str);
}
*/

View File

@ -1,7 +1,7 @@
/** @file
Tools of clarify the content of the smbios table.
Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2005 - 2012, 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
@ -18,8 +18,6 @@
#define STRUCTURE_TYPE_RANDOM (UINT8) 0xFE
#define STRUCTURE_TYPE_INVALID (UINT8) 0xFF
#define STRUCTURE_HANDLE_INVALID (UINT16) 0xFFFF
typedef struct {
UINT16 Index;
UINT8 Type;

View File

@ -1,7 +1,7 @@
## @file
# Provides shell Debug1 profile functions
#
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2010 - 2012, 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
@ -46,12 +46,10 @@
SmbiosView/PrintInfo.c
SmbiosView/QueryTable.c
SmbiosView/SmbiosView.c
SmbiosView/Smbios.c
SmbiosView/SmbiosViewStrings.uni
SmbiosView/LibSmbiosView.c
SmbiosView/PrintInfo.h
SmbiosView/LibSmbiosView.h
SmbiosView/LibSmbios.h
SmbiosView/QueryTable.h
SmbiosView/SmbiosView.h
UefiShellDebug1CommandsLib.c