summaryrefslogtreecommitdiff
path: root/Platform/Intel/AdvancedFeaturePkg/Smbios
diff options
context:
space:
mode:
Diffstat (limited to 'Platform/Intel/AdvancedFeaturePkg/Smbios')
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h59
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf96
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c137
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c88
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c121
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c138
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c61
-rw-r--r--Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c131
8 files changed, 831 insertions, 0 deletions
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
new file mode 100644
index 0000000000..204e16e617
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasic.h
@@ -0,0 +1,59 @@
+/**
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+
+ @file SmbiosMisc.h
+
+ Header file for the SmbiosMisc Driver.
+
+**/
+
+#ifndef _SMBIOS_BASIC_DRIVER_H
+#define _SMBIOS_BASIC_DRIVER_H
+
+#include <PiDxe.h>
+#include <Protocol/Smbios.h>
+#include <IndustryStandard/Smbios.h>
+#include <Library/UefiBootServicesTableLib.h>
+#include <Library/DebugLib.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/DevicePathLib.h>
+#include <Library/MemoryAllocationLib.h>
+#include <Library/PcdLib.h>
+#include <Library/UefiLib.h>
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ );
+
+#endif
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
new file mode 100644
index 0000000000..64dba3507e
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicDxe.inf
@@ -0,0 +1,96 @@
+#
+# This file contains a 'Sample Driver' and is licensed as such
+# under the terms of your license agreement with Intel or your
+# vendor. This file may be modified by the user, subject to
+# the additional terms of the license agreement
+#
+#
+## @file
+# Component description file for Smbios Misc module.
+#
+# Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+#
+# This software and associated documentation (if any) is furnished
+# under a license and may only be used or copied in accordance
+# with the terms of the license. Except as permitted by such
+# license, no part of this software or documentation may be
+# reproduced, stored in a retrieval system, or transmitted in any
+# form or by any means without the express written consent of
+# Intel Corporation.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = SmbiosBasic
+ FILE_GUID = 03ADF4A1-A27A-45E3-B211-3177C6C2E7ED
+ MODULE_TYPE = DXE_DRIVER
+ VERSION_STRING = 1.0
+ ENTRY_POINT = SmbiosBasicEntryPoint
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ SmbiosBasicEntryPoint.c
+ Type0BiosVendorFunction.c
+ Type1SystemManufacturerFunction.c
+ Type2BaseBoardManufacturerFunction.c
+ Type3ChassisManufacturerFunction.c
+ Type32BootInformationFunction.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+ MdeModulePkg/MdeModulePkg.dec
+ AdvancedFeaturePkg/AdvancedFeaturePkg.dec
+
+[LibraryClasses]
+ PcdLib
+ MemoryAllocationLib
+ DevicePathLib
+ BaseMemoryLib
+ BaseLib
+ DebugLib
+ UefiBootServicesTableLib
+ UefiDriverEntryPoint
+ UefiLib
+ HobLib
+
+[Protocols]
+ gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiVariableArchProtocolGuid
+
+[Pcd]
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0BiosInformation
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringVendor
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosVersion
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType0StringBiosReleaseDate
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1SystemInformation
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringManufacturer
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringProductName
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringVersion
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSerialNumber
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringSKUNumber
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType1StringFamily
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2BaseBoardInformation
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringManufacturer
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringProductName
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringVersion
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringSerialNumber
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringAssetTag
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType2StringLocationInChassis
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3SystemEnclosureChassis
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringManufacturer
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringVersion
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSerialNumber
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringAssetTag
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType3StringSKUNumber
+ gAdvancedFeaturePkgTokenSpaceGuid.PcdSmbiosType32SystemBootInformation
+
+[Depex]
+ gEfiSmbiosProtocolGuid AND
+ gEfiVariableArchProtocolGuid
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
new file mode 100644
index 0000000000..2eb87611d4
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/SmbiosBasicEntryPoint.c
@@ -0,0 +1,137 @@
+/**
+ This file contains a 'Sample Driver' and is licensed as such
+ under the terms of your license agreement with Intel or your
+ vendor. This file may be modified by the user, subject to
+ the additional terms of the license agreement
+
+
+Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+ @file SmbiosBasicEntryPoint.c
+
+**/
+
+#include "SmbiosBasic.h"
+
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI EFI_BASIC_SMBIOS_DATA_FUNCTION) (
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ );
+
+typedef struct {
+ EFI_BASIC_SMBIOS_DATA_FUNCTION *Function;
+} EFI_BASIC_SMBIOS_DATA;
+
+EFI_BASIC_SMBIOS_DATA mSmbiosBasicDataFuncTable[] = {
+ {&BiosVendorFunction},
+ {&SystemManufacturerFunction},
+ {&BaseBoardManufacturerFunction},
+ {&ChassisManufacturerFunction},
+ {&BootInfoStatusFunction},
+};
+
+/**
+ Standard EFI driver point. This driver parses the mSmbiosMiscDataTable
+ structure and reports any generated data using SMBIOS protocol.
+
+ @param ImageHandle Handle for the image of this driver
+ @param SystemTable Pointer to the EFI System Table
+
+ @retval EFI_SUCCESS The data was successfully stored.
+
+**/
+EFI_STATUS
+EFIAPI
+SmbiosBasicEntryPoint(
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ UINTN Index;
+ EFI_STATUS EfiStatus;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+
+ EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
+ return EfiStatus;
+ }
+
+ for (Index = 0; Index < sizeof(mSmbiosBasicDataFuncTable)/sizeof(mSmbiosBasicDataFuncTable[0]); ++Index) {
+ EfiStatus = (*mSmbiosBasicDataFuncTable[Index].Function) (Smbios);
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((EFI_D_ERROR, "Basic smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
+ return EfiStatus;
+ }
+ }
+
+ return EfiStatus;
+}
+
+/**
+ Add an SMBIOS record.
+
+ @param Smbios The EFI_SMBIOS_PROTOCOL instance.
+ @param SmbiosHandle A unique handle will be assigned to the SMBIOS record.
+ @param Record The data for the fixed portion of the SMBIOS record. The format of the record is
+ determined by EFI_SMBIOS_TABLE_HEADER.Type. The size of the formatted area is defined
+ by EFI_SMBIOS_TABLE_HEADER.Length and either followed by a double-null (0x0000) or
+ a set of null terminated strings and a null.
+
+ @retval EFI_SUCCESS Record was added.
+ @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system resources.
+
+**/
+EFI_STATUS
+AddSmbiosRecord (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ OUT EFI_SMBIOS_HANDLE *SmbiosHandle,
+ IN EFI_SMBIOS_TABLE_HEADER *Record
+ )
+{
+ *SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;
+ return Smbios->Add (
+ Smbios,
+ NULL,
+ SmbiosHandle,
+ Record
+ );
+}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
new file mode 100644
index 0000000000..847737cd05
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type0BiosVendorFunction.c
@@ -0,0 +1,88 @@
+/**
+ SMBIOS type 0.
+
+ Copyright (c) 1999 - 2016 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+**/
+
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BiosVendor (Type 0).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BiosVendorFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *VendorStr;
+ UINTN VendorStrLen;
+ CHAR8 *VersionStr;
+ UINTN VerStrLen;
+ CHAR8 *DateStr;
+ UINTN DateStrLen;
+ SMBIOS_TABLE_TYPE0 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE0 *PcdSmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType0BiosInformation);
+
+ VendorStr = PcdGetPtr (PcdSmbiosType0StringVendor);
+ VendorStrLen = AsciiStrLen (VendorStr);
+ ASSERT (VendorStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType0StringBiosVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ DateStr = PcdGetPtr (PcdSmbiosType0StringBiosReleaseDate);
+ DateStrLen = AsciiStrLen (DateStr);
+ ASSERT (DateStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE0));
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BIOS_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VendorStr, VendorStrLen);
+ StringOffset += VendorStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, DateStr, DateStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool (SmbiosRecord);
+ return Status;
+}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
new file mode 100644
index 0000000000..b3b07c57f8
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type1SystemManufacturerFunction.c
@@ -0,0 +1,121 @@
+/**
+ SMBIOS type 1.
+
+ Copyright (c) 2008 - 2016 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+**/
+
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ SystemManufacturer (Type 1).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+SystemManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductNameStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *SKUNumberStr;
+ CHAR8 *FamilyStr;
+ UINTN ManufacturerStrLen;
+ UINTN ProductNameStrLen;
+ UINTN VersionStrLen;
+ UINTN SerialNumberStrLen;
+ UINTN SKUNumberStrLen;
+ UINTN FamilyStrLen;
+ UINTN TableSize;
+ SMBIOS_TABLE_TYPE1 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE1 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType1SystemInformation);
+
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType1StringManufacturer);
+ ManufacturerStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManufacturerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ ProductNameStr = PcdGetPtr (PcdSmbiosType1StringProductName);
+ ProductNameStrLen = AsciiStrLen (ProductNameStr);
+ ASSERT (ProductNameStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ VersionStr = PcdGetPtr (PcdSmbiosType1StringVersion);
+ VersionStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VersionStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType1StringSerialNumber);
+ SerialNumberStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType1StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ FamilyStr = PcdGetPtr (PcdSmbiosType1StringFamily);
+ FamilyStrLen = AsciiStrLen (FamilyStr);
+ ASSERT (FamilyStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Create table size based on string lengths
+ //
+ TableSize = sizeof (SMBIOS_TABLE_TYPE1) + ManufacturerStrLen + 1 + ProductNameStrLen + 1 + VersionStrLen + 1 + SerialNumberStrLen + 1 + SKUNumberStrLen + 1 + FamilyStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool (TableSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE1));
+
+ //
+ // Fill in Type 1 fields
+ //
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_SYSTEM_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Add strings to bottom of data block
+ //
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManufacturerStrLen);
+ StringOffset += ManufacturerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductNameStr, ProductNameStrLen);
+ StringOffset += ProductNameStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VersionStrLen);
+ StringOffset += VersionStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumberStrLen);
+ StringOffset += SerialNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+ StringOffset += SKUNumberStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, FamilyStr, FamilyStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
new file mode 100644
index 0000000000..f0159fa781
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type2BaseBoardManufacturerFunction.c
@@ -0,0 +1,138 @@
+/**
+ SMBIOS type 2.
+
+ Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+**/
+
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ BaseBoardManufacturer (Type 2).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BaseBoardManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *ProductStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *ChassisStr;
+ UINTN ManuStrLen;
+ UINTN ProductStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN ChassisStrLen;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE2 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE2 *SmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType2BaseBoardInformation);
+
+ //
+ // Get BoardManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType2StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board ProductName String.
+ //
+ ProductStr = PcdGetPtr (PcdSmbiosType2StringProductName);
+ ProductStrLen = AsciiStrLen (ProductStr);
+ ASSERT (ProductStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Version String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType2StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Serial Number String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType2StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Asset Tag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType2StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get Board Chassis Location Tag String.
+ //
+ ChassisStr = PcdGetPtr (PcdSmbiosType2StringLocationInChassis);
+ ChassisStrLen = AsciiStrLen (ChassisStr);
+ ASSERT (ChassisStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize (PcdSmbiosType2BaseBoardInformation);
+ TotalSize = SourceSize + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = SMBIOS_TYPE_BASEBOARD_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
+ if (PcdSmbiosRecord->NumberOfContainedObjectHandles >= 2) {
+ SmbiosRecord->Hdr.Length += (PcdSmbiosRecord->NumberOfContainedObjectHandles - 1) * sizeof(PcdSmbiosRecord->ContainedObjectHandles);
+ }
+ ASSERT(SourceSize >= SmbiosRecord->Hdr.Length);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ProductStr, ProductStrLen);
+ StringOffset += ProductStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ChassisStr, ChassisStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
new file mode 100644
index 0000000000..60c70e24d8
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type32BootInformationFunction.c
@@ -0,0 +1,61 @@
+/**
+ Copyright (c) 1999 - 2016 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+**/
+
+
+#include "SmbiosBasic.h"
+
+
+/**
+ This function makes boot time changes to the contents of the
+ BootInformation (Type 32).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+BootInfoStatusFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE32 *PcdSmbiosRecord;
+ SMBIOS_TABLE_TYPE32 *SmbiosRecord;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType32SystemBootInformation);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocateZeroPool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, sizeof(SMBIOS_TABLE_TYPE32));
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
+ SmbiosRecord->Hdr.Handle = 0;
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
new file mode 100644
index 0000000000..f806bffa55
--- /dev/null
+++ b/Platform/Intel/AdvancedFeaturePkg/Smbios/SmbiosBasicDxe/Type3ChassisManufacturerFunction.c
@@ -0,0 +1,131 @@
+/**
+ SMBIOS type 3.
+
+ Copyright (c) 2011 - 2016 Intel Corporation. All rights reserved.
+ This software and associated documentation (if any) is furnished
+ under a license and may only be used or copied in accordance
+ with the terms of the license. Except as permitted by such
+ license, no part of this software or documentation may be
+ reproduced, stored in a retrieval system, or transmitted in any
+ form or by any means without the express written consent of
+ Intel Corporation.
+
+**/
+
+#include "SmbiosBasic.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ ChassisManufacturer (Type 3).
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+EFIAPI
+ChassisManufacturerFunction(
+ IN EFI_SMBIOS_PROTOCOL *Smbios
+ )
+{
+ UINTN ManuStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN SKUNumberStrLen;
+ EFI_STATUS Status;
+ CHAR8 *ManufacturerStr;
+ CHAR8 *VersionStr;
+ CHAR8 *SerialNumberStr;
+ CHAR8 *AssertTagStr;
+ CHAR8 *SKUNumberStr;
+ SMBIOS_TABLE_STRING *SKUNumberPtr;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE3 *SmbiosRecord;
+ SMBIOS_TABLE_TYPE3 *PcdSmbiosRecord;
+ UINTN SourceSize;
+ UINTN TotalSize;
+ UINTN StringOffset;
+
+ PcdSmbiosRecord = PcdGetPtr (PcdSmbiosType3SystemEnclosureChassis);
+
+ //
+ // Get ChassisManufacturer String.
+ //
+ ManufacturerStr = PcdGetPtr (PcdSmbiosType3StringManufacturer);
+ ManuStrLen = AsciiStrLen (ManufacturerStr);
+ ASSERT (ManuStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisVersion String.
+ //
+ VersionStr = PcdGetPtr (PcdSmbiosType3StringVersion);
+ VerStrLen = AsciiStrLen (VersionStr);
+ ASSERT (VerStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSerialNumber String.
+ //
+ SerialNumberStr = PcdGetPtr (PcdSmbiosType3StringSerialNumber);
+ SerialNumStrLen = AsciiStrLen (SerialNumberStr);
+ ASSERT (SerialNumStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisAssetTag String.
+ //
+ AssertTagStr = PcdGetPtr (PcdSmbiosType3StringAssetTag);
+ AssertTagStrLen = AsciiStrLen (AssertTagStr);
+ ASSERT (AssertTagStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Get ChassisSKUNumber String.
+ //
+ SKUNumberStr = PcdGetPtr (PcdSmbiosType3StringSKUNumber);
+ SKUNumberStrLen = AsciiStrLen (SKUNumberStr);
+ ASSERT (SKUNumberStrLen <= SMBIOS_STRING_MAX_LENGTH);
+
+ //
+ // Two zeros following the last string.
+ //
+ SourceSize = PcdGetSize(PcdSmbiosType3SystemEnclosureChassis);
+ TotalSize = SourceSize + sizeof(SMBIOS_TABLE_STRING) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + SKUNumberStrLen + 1 + 1;
+ SmbiosRecord = AllocateZeroPool(TotalSize);
+ if (SmbiosRecord == NULL) {
+ ASSERT_EFI_ERROR (EFI_OUT_OF_RESOURCES);
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ CopyMem (SmbiosRecord, PcdSmbiosRecord, SourceSize);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
+ SmbiosRecord->Hdr.Length = OFFSET_OF (SMBIOS_TABLE_TYPE3, ContainedElements) + sizeof(SMBIOS_TABLE_STRING);
+ if (PcdSmbiosRecord->ContainedElementCount >= 1) {
+ SmbiosRecord->Hdr.Length += PcdSmbiosRecord->ContainedElementCount * PcdSmbiosRecord->ContainedElementRecordLength;
+ }
+ SmbiosRecord->Hdr.Handle = 0;
+
+ if ((PcdSmbiosRecord->ContainedElementCount == 0) || (SourceSize < (UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length)) {
+ SKUNumberPtr = (SMBIOS_TABLE_STRING *)((UINTN)SmbiosRecord + SmbiosRecord->Hdr.Length - sizeof(SMBIOS_TABLE_STRING));
+ *SKUNumberPtr = 5;
+ }
+
+ StringOffset = SmbiosRecord->Hdr.Length;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, ManufacturerStr, ManuStrLen);
+ StringOffset += ManuStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, VersionStr, VerStrLen);
+ StringOffset += VerStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SerialNumberStr, SerialNumStrLen);
+ StringOffset += SerialNumStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, AssertTagStr, AssertTagStrLen);
+ StringOffset += AssertTagStrLen + 1;
+ CopyMem ((UINT8 *)SmbiosRecord + StringOffset, SKUNumberStr, SKUNumberStrLen);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord);
+
+ FreePool(SmbiosRecord);
+ return Status;
+}