summaryrefslogtreecommitdiff
path: root/Nt32Pkg
diff options
context:
space:
mode:
authordavidhuang <davidhuang@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-20 04:02:03 +0000
committerdavidhuang <davidhuang@6f19259b-4bc3-4df7-8a09-765794883524>2009-11-20 04:02:03 +0000
commit1fdd39d371ecd0c660dce8926add29846c95cd37 (patch)
treea29761d31d8e025753d9b4e3d0c45b86cf425c09 /Nt32Pkg
parent310b04e6f192fc7494b1f69fd37efeef6aacfc50 (diff)
downloadedk2-platforms-1fdd39d371ecd0c660dce8926add29846c95cd37.tar.xz
1. PI SMBIOS Checkin. Major change include:
1) Produce PI SMBIOS protocol in MdeModulePkg 2) Update all consumers (in CorePkgs and native platform pkgs) to consume SMBIOS protocol instead of DataHub 3) Pass ECC tool; Verify Nt32, Duet, Unix platform git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9457 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/Cpu.c132
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/CpuDriver.h5
-rw-r--r--Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf9
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c175
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c210
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c81
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c145
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c5
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c246
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c88
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c16
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c266
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c84
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf59
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.h84
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c107
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c336
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c92
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c176
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c91
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c4
-rw-r--r--Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c105
-rw-r--r--Nt32Pkg/Nt32Pkg.dsc1
-rw-r--r--Nt32Pkg/Nt32Pkg.fdf1
33 files changed, 1815 insertions, 739 deletions
diff --git a/Nt32Pkg/CpuRuntimeDxe/Cpu.c b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
index f0a138d96d..074781e6ff 100644
--- a/Nt32Pkg/CpuRuntimeDxe/Cpu.c
+++ b/Nt32Pkg/CpuRuntimeDxe/Cpu.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -55,19 +55,6 @@ CPU_ARCH_PROTOCOL_PRIVATE mCpuTemplate = {
-typedef union {
- EFI_CPU_DATA_RECORD *DataRecord;
- UINT8 *Raw;
-} EFI_CPU_DATA_RECORD_BUFFER;
-
-EFI_SUBCLASS_TYPE1_HEADER mCpuDataRecordHeader = {
- EFI_PROCESSOR_SUBCLASS_VERSION, // Version
- sizeof (EFI_SUBCLASS_TYPE1_HEADER), // Header Size
- 0, // Instance, Initialize later
- EFI_SUBCLASS_INSTANCE_NON_APPLICABLE, // SubInstance
- 0 // RecordType, Initialize later
-};
-
//
// Service routines for the driver
//
@@ -390,14 +377,42 @@ Returns:
}
+
+/**
+ Logs SMBIOS record.
+
+ @param Smbios Pointer to SMBIOS protocol instance.
+ @param Buffer Pointer to the data buffer.
+
+**/
+VOID
+LogSmbiosData (
+ IN EFI_SMBIOS_PROTOCOL *Smbios,
+ IN UINT8 *Buffer
+ )
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+
+ SmbiosHandle = 0;
+ Status = Smbios->Add (
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER*)Buffer
+ );
+ ASSERT_EFI_ERROR (Status);
+}
+
+
VOID
-CpuUpdateDataHub (
+CpuUpdateSmbios (
VOID
)
/*++
Routine Description:
- This function will log processor version and frequency data to data hub.
+ This function will log processor version and frequency data to Smbios.
Arguments:
Event - Event whose notification function is being invoked.
@@ -409,32 +424,25 @@ Returns:
--*/
{
EFI_STATUS Status;
- EFI_CPU_DATA_RECORD_BUFFER RecordBuffer;
- UINT32 HeaderSize;
UINT32 TotalSize;
- EFI_DATA_HUB_PROTOCOL *DataHub;
+ EFI_SMBIOS_PROTOCOL *Smbios;
EFI_HII_HANDLE HiiHandle;
+ STRING_REF Token;
+ UINTN CpuVerStrLen;
+ EFI_STRING CpuVerStr;
+ SMBIOS_TABLE_TYPE4 *SmbiosRecord;
+ CHAR8 *OptionalStrStart;
//
- // Locate DataHub protocol.
+ // Locate Smbios protocol.
//
- Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID**)&DataHub);
+ Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID **)&Smbios);
+
if (EFI_ERROR (Status)) {
return;
}
//
- // Initialize data record header
- //
- mCpuDataRecordHeader.Instance = 1;
- HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
-
- RecordBuffer.Raw = AllocatePool (HeaderSize + EFI_CPU_DATA_MAXIMUM_LENGTH);
- if (RecordBuffer.Raw == NULL) {
- return ;
- }
-
- //
// Initialize strings to HII database
//
HiiHandle = HiiAddPackages (
@@ -445,40 +453,40 @@ Returns:
);
ASSERT (HiiHandle != NULL);
- CopyMem (RecordBuffer.Raw, &mCpuDataRecordHeader, HeaderSize);
-
+ Token = STRING_TOKEN (STR_PROCESSOR_VERSION);
+ CpuVerStr = HiiGetPackageString(&gEfiCallerIdGuid, Token, NULL);
+ CpuVerStrLen = StrLen(CpuVerStr);
+ ASSERT (CpuVerStrLen <= SMBIOS_STRING_MAX_LENGTH);
- RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorVersionRecordType;
- RecordBuffer.DataRecord->VariableRecord.ProcessorVersion = STRING_TOKEN (STR_PROCESSOR_VERSION);
- TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_VERSION_DATA);
- Status = DataHub->LogData (
- DataHub,
- &gEfiProcessorSubClassGuid,
- &gEfiCallerIdGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- RecordBuffer.Raw,
- TotalSize
- );
+ TotalSize = sizeof(SMBIOS_TABLE_TYPE4) + CpuVerStrLen + 1 + 1;
+ SmbiosRecord = AllocatePool(TotalSize);
+ ZeroMem(SmbiosRecord, TotalSize);
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE4);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ //
+ // Processor version is the 1st string.
+ //
+ SmbiosRecord->ProcessorVersion = 1;
//
// Store CPU frequency data record to data hub - It's an emulator so make up a value
//
- RecordBuffer.DataRecord->DataRecordHeader.RecordType = ProcessorCoreFrequencyRecordType;
- RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Value = 1234;
- RecordBuffer.DataRecord->VariableRecord.ProcessorCoreFrequency.Exponent = 6;
- TotalSize = HeaderSize + sizeof (EFI_PROCESSOR_CORE_FREQUENCY_DATA);
-
- Status = DataHub->LogData (
- DataHub,
- &gEfiProcessorSubClassGuid,
- &gEfiCallerIdGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- RecordBuffer.Raw,
- TotalSize
- );
-
- FreePool (RecordBuffer.Raw);
+ SmbiosRecord->CurrentSpeed = 1234;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(CpuVerStr, OptionalStrStart);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ LogSmbiosData(Smbios, (UINT8 *) SmbiosRecord);
+ FreePool (SmbiosRecord);
+
}
@@ -512,7 +520,7 @@ Returns:
{
EFI_STATUS Status;
- CpuUpdateDataHub ();
+ CpuUpdateSmbios ();
Status = gBS->InstallMultipleProtocolInterfaces (
&mCpuTemplate.Handle,
@@ -524,5 +532,3 @@ Returns:
return Status;
}
-
-
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h b/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
index f7fdea9a92..2cd644c489 100644
--- a/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
+++ b/Nt32Pkg/CpuRuntimeDxe/CpuDriver.h
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -24,8 +24,9 @@ Abstract:
#include <FrameworkDxe.h>
+#include <IndustryStandard/SmBios.h>
#include <Protocol/Cpu.h>
-#include <Protocol/DataHub.h>
+#include <Protocol/Smbios.h>
#include <Protocol/FrameworkHii.h>
#include <Guid/DataHubRecords.h>
#include <Protocol/CpuIo.h>
diff --git a/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf b/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
index ded73b3661..28f116c3eb 100644
--- a/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
+++ b/Nt32Pkg/CpuRuntimeDxe/CpuRuntimeDxe.inf
@@ -2,7 +2,7 @@
# Component description file for Cpu module.
#
# This CPU module abstracts the interrupt subsystem of a platform and the CPU-specific setjump-long pair.
-# Copyright (c) 2006 - 2007, Intel Corporation
+# Copyright (c) 2006 - 2009, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -51,16 +51,13 @@
UefiDriverEntryPoint
DebugLib
HiiLib
-
-[Guids]
- gEfiProcessorSubClassGuid # SOMETIMES_CONSUMED
[Protocols]
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiDataHubProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
+ gEfiSmbiosProtocolGuid # PROTOCOL SOMETIMES_CONSUMED
gEfiWinNtIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
gEfiCpuIoProtocolGuid # PROTOCOL ALWAYS_PRODUCED
gEfiCpuArchProtocolGuid # PROTOCOL ALWAYS_PRODUCED
[Depex]
- gEfiDataHubProtocolGuid
+ gEfiSmbiosProtocolGuid
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
index a9eeefa6af..47854ff7ef 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer) = {
STRING_TOKEN(STR_MISC_BASE_BOARD_MANUFACTURER),
STRING_TOKEN(STR_MISC_BASE_BOARD_PRODUCT_NAME),
STRING_TOKEN(STR_MISC_BASE_BOARD_VERSION),
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c
new file mode 100644
index 0000000000..a66f6fe7af
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c
@@ -0,0 +1,175 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscBaseBoardManufacturerFunction.c
+
+Abstract:
+
+ BaseBoard manufacturer information boot time changes.
+ SMBIOS type 2.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+/**
+ This function makes boot time changes to the contents of the
+ MiscBaseBoardManufacturer (Type 2).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN ManuStrLen;
+ UINTN ProductStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ UINTN ChassisStrLen;
+ EFI_STATUS Status;
+ EFI_STRING Manufacturer;
+ EFI_STRING Product;
+ EFI_STRING Version;
+ EFI_STRING SerialNumber;
+ EFI_STRING AssertTag;
+ EFI_STRING Chassis;
+ STRING_REF TokenToGet;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE2 *SmbiosRecord;
+ EFI_MISC_BASE_BOARD_MANUFACTURER *ForType2InputData;
+
+ ForType2InputData = (EFI_MISC_BASE_BOARD_MANUFACTURER *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER);
+ Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ ManuStrLen = StrLen(Manufacturer);
+ if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME);
+ Product = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ ProductStrLen = StrLen(Product);
+ if (ProductStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION);
+ Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ VerStrLen = StrLen(Version);
+ if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER);
+ SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ SerialNumStrLen = StrLen(SerialNumber);
+ if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG);
+ AssertTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ AssertTagStrLen = StrLen(AssertTag);
+ if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION);
+ Chassis = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ ChassisStrLen = StrLen(Chassis);
+ if (ChassisStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ //
+ // Manu will be the 1st optional string following the formatted structure.
+ //
+ SmbiosRecord->Manufacturer = 1;
+ //
+ // ProductName will be the 2st optional string following the formatted structure.
+ //
+ SmbiosRecord->ProductName = 2;
+ //
+ // Version will be the 3rd optional string following the formatted structure.
+ //
+ SmbiosRecord->Version = 3;
+ //
+ // SerialNumber will be the 4th optional string following the formatted structure.
+ //
+ SmbiosRecord->SerialNumber = 4;
+ //
+ // AssertTag will be the 5th optional string following the formatted structure.
+ //
+ SmbiosRecord->AssetTag = 5;
+
+ //
+ // LocationInChassis will be the 6th optional string following the formatted structure.
+ //
+ SmbiosRecord->LocationInChassis = 6;
+ SmbiosRecord->FeatureFlag = (*(BASE_BOARD_FEATURE_FLAGS*)&(ForType2InputData->BaseBoardFeatureFlags));
+ SmbiosRecord->ChassisHandle = 0;
+ SmbiosRecord->BoardType = (UINT8)ForType2InputData->BaseBoardType;
+ SmbiosRecord->NumberOfContainedObjectHandles = 0;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ //
+ // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string
+ //
+ OptionalStrStart -= 2;
+ UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
+ UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1);
+ UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1);
+ UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1);
+ UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
+ UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1);
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
index 4a5a1f4041..e87ad5668b 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor) = {
STRING_TOKEN(STR_MISC_BIOS_VENDOR), // BiosVendor
STRING_TOKEN(STR_MISC_BIOS_VERSION), // BiosVersion
STRING_TOKEN(STR_MISC_BIOS_RELEASE_DATE), // BiosReleaseDate
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c
new file mode 100644
index 0000000000..513a10164b
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBiosVendorFunction.c
@@ -0,0 +1,210 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscBiosVendorFunction.c
+
+Abstract:
+
+ BIOS vendor information boot time changes.
+ Misc. subclass type 2.
+ SMBIOS type 0.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+
+/**
+ This function returns the value & exponent to Base2 for a given
+ Hex value. This is used to calculate the BiosPhysicalDeviceSize.
+
+ @param Value The hex value which is to be converted into value-exponent form
+ @param Exponent The exponent out of the conversion
+
+ @retval EFI_SUCCESS All parameters were valid and *Value & *Exponent have been set.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+EFI_STATUS
+GetValueExponentBase2(
+ IN OUT UINTN *Value,
+ OUT UINTN *Exponent
+ )
+{
+ if ((Value == NULL) || (Exponent == NULL)) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ while ((*Value % 2) == 0) {
+ *Value=*Value/2;
+ (*Exponent)++;
+ }
+
+ return EFI_SUCCESS;
+}
+
+/**
+ Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with '64k'
+ as the unit.
+
+ @param Base2Data Pointer to Base2_Data
+
+ @retval EFI_SUCCESS Transform successfully.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+UINT16
+Base2ToByteWith64KUnit (
+ IN EFI_EXP_BASE2_DATA *Base2Data
+ )
+{
+ UINT16 Value;
+ UINT16 Exponent;
+
+ Value = Base2Data->Value;
+ Exponent = Base2Data->Exponent;
+ Exponent -= 16;
+ Value <<= Exponent;
+
+ return Value;
+}
+
+
+/**
+ This function makes boot time changes to the contents of the
+ MiscBiosVendor (Type 0).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscBiosVendor)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN VendorStrLen;
+ UINTN VerStrLen;
+ UINTN DateStrLen;
+ CHAR16 *Version;
+ CHAR16 *ReleaseDate;
+ EFI_STATUS Status;
+ EFI_STRING Char16String;
+ STRING_REF TokenToGet;
+ STRING_REF TokenToUpdate;
+ SMBIOS_TABLE_TYPE0 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ EFI_MISC_BIOS_VENDOR *ForType0InputData;
+
+ ForType0InputData = (EFI_MISC_BIOS_VENDOR *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ Version = (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString);
+ if (StrLen (Version) > 0) {
+ TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_VERSION);
+ HiiSetString (mHiiHandle, TokenToUpdate, Version, NULL);
+ }
+
+ ReleaseDate = (CHAR16 *) PcdGetPtr (PcdFirmwareReleaseDateString);
+ if (StrLen(ReleaseDate) > 0) {
+ TokenToUpdate = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
+ HiiSetString (mHiiHandle, TokenToUpdate, ReleaseDate, NULL);
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VENDOR);
+ Char16String = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ VendorStrLen = StrLen(Char16String);
+ if (VendorStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BIOS_VERSION);
+ Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ VerStrLen = StrLen(Version);
+ if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE);
+ ReleaseDate = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ DateStrLen = StrLen(ReleaseDate);
+ if (DateStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE0) + VendorStrLen + 1 + VerStrLen + 1 + DateStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE0);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ //
+ // Vendor will be the 1st optional string following the formatted structure.
+ //
+ SmbiosRecord->Vendor = 1;
+ //
+ // Version will be the 2nd optional string following the formatted structure.
+ //
+ SmbiosRecord->BiosVersion = 2;
+ SmbiosRecord->BiosSegment = (UINT16)ForType0InputData->BiosStartingAddress;
+ //
+ // ReleaseDate will be the 3rd optional string following the formatted structure.
+ //
+ SmbiosRecord->BiosReleaseDate = 3;
+ //
+ // Nt32 has no PCD value to indicate BIOS Size, just fill 0 for simply.
+ //
+ SmbiosRecord->BiosSize = 0;
+ SmbiosRecord->BiosCharacteristics = *(MISC_BIOS_CHARACTERISTICS*)(&ForType0InputData->BiosCharacteristics1);
+ //
+ // CharacterExtensionBytes also store in ForType0InputData->BiosCharacteristics1 later two bytes to save size.
+ //
+ SmbiosRecord->BIOSCharacteristicsExtensionBytes[0] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 4);
+ SmbiosRecord->BIOSCharacteristicsExtensionBytes[1] = *((UINT8 *) &ForType0InputData->BiosCharacteristics1 + 5);
+
+ SmbiosRecord->SystemBiosMajorRelease = ForType0InputData->BiosMajorRelease;
+ SmbiosRecord->SystemBiosMinorRelease = ForType0InputData->BiosMinorRelease;
+ SmbiosRecord->EmbeddedControllerFirmwareMajorRelease = ForType0InputData->BiosEmbeddedFirmwareMajorRelease;
+ SmbiosRecord->EmbeddedControllerFirmwareMinorRelease = ForType0InputData->BiosEmbeddedFirmwareMinorRelease;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(Char16String, OptionalStrStart);
+ UnicodeStrToAsciiStr(Version, OptionalStrStart + VendorStrLen + 1);
+ UnicodeStrToAsciiStr(ReleaseDate, OptionalStrStart + VendorStrLen + 1 + VerStrLen + 1);
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
index b3dd97d640..ee28177c58 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus) = {
EfiBootInformationStatusNoError, // BootInformationStatus
0 // BootInformationData
};
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c
new file mode 100644
index 0000000000..78cee13268
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBootInformationFunction.c
@@ -0,0 +1,81 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscBootInformationFunction.c
+
+Abstract:
+
+ boot information boot time changes.
+ SMBIOS type 32.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+
+
+/**
+ This function makes boot time changes to the contents of the
+ MiscBootInformation (Type 32).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+
+MISC_SMBIOS_TABLE_FUNCTION(BootInformationStatus)
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE32 *SmbiosRecord;
+ EFI_MISC_BOOT_INFORMATION_STATUS* ForType32InputData;
+
+ ForType32InputData = (EFI_MISC_BOOT_INFORMATION_STATUS *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE32);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->BootStatus = (UINT8)ForType32InputData->BootInformationStatus;
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
index fad4708f73..9d2b7e9f44 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Chassis Manufacturer data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer) = {
STRING_TOKEN(STR_MISC_CHASSIS_MANUFACTURER), // ChassisManufactrurer
STRING_TOKEN(STR_MISC_CHASSIS_VERSION), // ChassisVersion
STRING_TOKEN(STR_MISC_CHASSIS_SERIAL_NUMBER), // ChassisSerialNumber
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c
new file mode 100644
index 0000000000..65f72fe0ad
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscChassisManufacturerFunction.c
@@ -0,0 +1,145 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscChassisManufacturerFunction.c
+
+Abstract:
+
+ Chassis manufacturer information boot time changes.
+ SMBIOS type 3.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+
+/**
+ This function makes boot time changes to the contents of the
+ MiscChassisManufacturer (Type 3).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscChassisManufacturer)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN ManuStrLen;
+ UINTN VerStrLen;
+ UINTN AssertTagStrLen;
+ UINTN SerialNumStrLen;
+ EFI_STATUS Status;
+ EFI_STRING Manufacturer;
+ EFI_STRING Version;
+ EFI_STRING SerialNumber;
+ EFI_STRING AssertTag;
+ STRING_REF TokenToGet;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE3 *SmbiosRecord;
+ EFI_MISC_CHASSIS_MANUFACTURER *ForType3InputData;
+
+ ForType3InputData = (EFI_MISC_CHASSIS_MANUFACTURER *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER);
+ Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ ManuStrLen = StrLen(Manufacturer);
+ if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_VERSION);
+ Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ VerStrLen = StrLen(Version);
+ if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER);
+ SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ SerialNumStrLen = StrLen(SerialNumber);
+ if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG);
+ AssertTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ AssertTagStrLen = StrLen(AssertTag);
+ if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssertTagStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE3);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ //
+ // Manu will be the 1st optional string following the formatted structure.
+ //
+ SmbiosRecord->Manufacturer = 1;
+ SmbiosRecord->Type = (UINT8)ForType3InputData->ChassisType.ChassisType;
+ //
+ // Version will be the 2nd optional string following the formatted structure.
+ //
+ SmbiosRecord->Version = 2;
+ //
+ // SerialNumber will be the 3rd optional string following the formatted structure.
+ //
+ SmbiosRecord->SerialNumber = 3;
+ //
+ // AssertTag will be the 4th optional string following the formatted structure.
+ //
+ SmbiosRecord->AssetTag = 4;
+ SmbiosRecord->BootupState = (UINT8)ForType3InputData->ChassisBootupState;
+ SmbiosRecord->PowerSupplyState = (UINT8)ForType3InputData->ChassisPowerSupplyState;
+ SmbiosRecord->ThermalState = (UINT8)ForType3InputData->ChassisThermalState;
+ SmbiosRecord->SecurityStatus = (UINT8)ForType3InputData->ChassisSecurityState;
+ CopyMem (SmbiosRecord->OemDefined,(UINT8*)&ForType3InputData->ChassisOemDefined, 4);
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
+ UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1);
+ UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1);
+ UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
index bf9728a0c8..5139f72fb1 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,8 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA, NumberOfInstallableLanguages)
+= {
1, // NumberOfInstallableLanguages
{ // LanguageFlags
0, // AbbreviatedLanguageFormat
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
new file mode 100644
index 0000000000..7e57502f91
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscNumberOfInstallableLanguagesFunction.c
@@ -0,0 +1,246 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscNumberOfInstallableLanguagesFunction.c
+
+Abstract:
+
+ This driver parses the mSmbiosMiscDataTable structure and reports
+ any generated data.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+/*++
+ Check whether the language is supported for given HII handle
+
+ @param HiiHandle The HII package list handle.
+ @param Offset The offest of current lanague in the supported languages.
+ @param CurrentLang The language code.
+
+ @retval TRUE Supported.
+ @retval FALSE Not Supported.
+
+--*/
+VOID
+EFIAPI
+CurrentLanguageMatch (
+ IN EFI_HII_HANDLE HiiHandle,
+ OUT UINT16 *Offset,
+ OUT CHAR8 *CurrentLang
+ )
+{
+ CHAR8 *DefaultLang;
+ CHAR8 *BestLanguage;
+ CHAR8 *Languages;
+ CHAR8 *MatchLang;
+ CHAR8 *EndMatchLang;
+ UINTN CompareLength;
+
+ Languages = HiiGetSupportedLanguages (HiiHandle);
+ if (Languages == NULL) {
+ return;
+ }
+
+ CurrentLang = GetEfiGlobalVariable (L"PlatformLang");
+ DefaultLang = (CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLang);
+ BestLanguage = GetBestLanguage (
+ Languages,
+ FALSE,
+ (CurrentLang != NULL) ? CurrentLang : "",
+ DefaultLang,
+ NULL
+ );
+ if (BestLanguage != NULL) {
+ //
+ // Find the best matching RFC 4646 language, compute the offset.
+ //
+ CompareLength = AsciiStrLen (BestLanguage);
+ for (MatchLang = Languages, (*Offset) = 0; MatchLang != '\0'; (*Offset)++) {
+ //
+ // Seek to the end of current match language.
+ //
+ for (EndMatchLang = MatchLang; *EndMatchLang != '\0' && *EndMatchLang != ';'; EndMatchLang++);
+
+ if ((EndMatchLang == MatchLang + CompareLength) && AsciiStrnCmp(MatchLang, BestLanguage, CompareLength) == 0) {
+ //
+ // Find the current best Language in the supported languages
+ //
+ break;
+ }
+ //
+ // best language match be in the supported language.
+ //
+ ASSERT (*EndMatchLang == ';');
+ MatchLang = EndMatchLang + 1;
+ }
+ FreePool (BestLanguage);
+ }
+
+ FreePool (Languages);
+ if (CurrentLang != NULL) {
+ FreePool (CurrentLang);
+ }
+ return ;
+}
+
+
+/**
+ Get next language from language code list (with separator ';').
+
+ @param LangCode Input: point to first language in the list. On
+ Otput: point to next language in the list, or
+ NULL if no more language in the list.
+ @param Lang The first language in the list.
+
+**/
+VOID
+EFIAPI
+GetNextLanguage (
+ IN OUT CHAR8 **LangCode,
+ OUT CHAR8 *Lang
+ )
+{
+ UINTN Index;
+ CHAR8 *StringPtr;
+
+ ASSERT (LangCode != NULL);
+ ASSERT (*LangCode != NULL);
+ ASSERT (Lang != NULL);
+
+ Index = 0;
+ StringPtr = *LangCode;
+ while (StringPtr[Index] != 0 && StringPtr[Index] != ';') {
+ Index++;
+ }
+
+ CopyMem (Lang, StringPtr, Index);
+ Lang[Index] = 0;
+
+ if (StringPtr[Index] == ';') {
+ Index++;
+ }
+ *LangCode = StringPtr + Index;
+}
+
+/**
+ This function returns the number of supported languages on HiiHandle.
+
+ @param HiiHandle The HII package list handle.
+
+ @retval The number of supported languages.
+
+**/
+UINT16
+EFIAPI
+GetSupportedLanguageNumber (
+ IN EFI_HII_HANDLE HiiHandle
+ )
+{
+ CHAR8 *Lang;
+ CHAR8 *Languages;
+ CHAR8 *LanguageString;
+ UINT16 LangNumber;
+
+ Languages = HiiGetSupportedLanguages (HiiHandle);
+ if (Languages == NULL) {
+ return 0;
+ }
+
+ LangNumber = 0;
+ Lang = AllocatePool (AsciiStrSize (Languages));
+ if (Lang != NULL) {
+ LanguageString = Languages;
+ while (*LanguageString != 0) {
+ GetNextLanguage (&LanguageString, Lang);
+ LangNumber++;
+ }
+ FreePool (Lang);
+ }
+ FreePool (Languages);
+ return LangNumber;
+}
+
+
+/**
+ This function makes boot time changes to the contents of the
+ MiscNumberOfInstallableLanguages (Type 13).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(NumberOfInstallableLanguages)
+{
+ UINTN LangStrLen;
+ CHAR8 CurrentLang[SMBIOS_STRING_MAX_LENGTH + 1];
+ CHAR8 *OptionalStrStart;
+ UINT16 Offset;
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE13 *SmbiosRecord;
+ EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *ForType13InputData;
+
+ ForType13InputData = (EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ ForType13InputData->NumberOfInstallableLanguages = GetSupportedLanguageNumber (mHiiHandle);
+
+ //
+ // Try to check if current langcode matches with the langcodes in installed languages
+ //
+ ZeroMem(CurrentLang, SMBIOS_STRING_MAX_LENGTH + 1);
+ CurrentLanguageMatch (mHiiHandle, &Offset, CurrentLang);
+ LangStrLen = AsciiStrLen(CurrentLang);
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + LangStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+
+ SmbiosRecord->InstallableLanguages = (UINT8)ForType13InputData->NumberOfInstallableLanguages;
+ SmbiosRecord->Flags = (UINT8)ForType13InputData->LanguageFlags.AbbreviatedLanguageFormat;
+ SmbiosRecord->CurrentLanguages = 1;
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ AsciiStrCpy(OptionalStrStart, CurrentLang);
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringData.c
index 6526e158aa..c3e79c2c5a 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_OEM_STRING_DATA, OemString) = {
STRING_TOKEN(STR_MISC_OEM_STRING)
};
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
new file mode 100644
index 0000000000..75aecb39f6
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscOemStringFunction.c
@@ -0,0 +1,88 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+Module Name:
+
+ MiscOemStringFunction.c
+
+Abstract:
+
+ boot information boot time changes.
+ SMBIOS type 11.
+
+--*/
+
+
+#include "MiscSubclassDriver.h"
+/**
+ This function makes boot time changes to the contents of the
+ MiscOemString (Type 11).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(OemString)
+{
+ UINTN OemStrLen;
+ CHAR8 *OptionalStrStart;
+ EFI_STATUS Status;
+ EFI_STRING OemStr;
+ STRING_REF TokenToGet;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE11 *SmbiosRecord;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_OEM_STRING);
+ OemStr = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ OemStrLen = StrLen(OemStr);
+ if (OemStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE11) + OemStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_OEM_STRINGS;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE11);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->StringCount = 1;
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(OemStr, OptionalStrStart);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
index 5f41c316db..a9385821b3 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator) = {
STRING_TOKEN(STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR), // PortInternalConnectorDesignator
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR), // PortExternalConnectorDesignator
EfiPortConnectorTypeOther, // PortInternalConnectorType
@@ -37,7 +37,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard) = {
STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD), // PortInternalConnectorDesignator
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_KEYBOARD), // PortExternalConnectorDesignator
EfiPortConnectorTypeNone, // PortInternalConnectorType
@@ -48,7 +48,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
0
};
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse) = {
STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE), // PortInternalConnectorDesignator
STRING_TOKEN (STR_MISC_PORT_EXTERNAL_MOUSE), // PortExternalConnectorDesignator
EfiPortConnectorTypeNone, // PortInternalConnectorType
@@ -60,7 +60,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
};
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1) = {
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM1),
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1),
EfiPortConnectorTypeNone,
@@ -69,7 +69,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
0
};
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2) = {
STRING_TOKEN(STR_MISC_PORT_INTERNAL_COM2),
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2),
EfiPortConnectorTypeNone,
@@ -78,7 +78,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
0
};
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower) = {
STRING_TOKEN(STR_MISC_PORT_INTERNAL_EXTENSION_POWER),
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER),
EfiPortConnectorTypeOther,
@@ -87,7 +87,7 @@ MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscP
0
};
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy) = {
STRING_TOKEN(STR_MISC_PORT_INTERNAL_FLOPPY),
STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY),
EfiPortConnectorTypeOnboardFloppy,
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
index 49d2c50f6a..83da857ec2 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscPortInternalConnectorDesignatorFunction.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -22,25 +22,8 @@ Abstract:
#include "MiscSubclassDriver.h"
-BOOLEAN mDone = FALSE;
-PS2_CONN_DEVICE_PATH mPs2KeyboardDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 0), DP_END };
-PS2_CONN_DEVICE_PATH mPs2MouseDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0303, 1), DP_END };
-SERIAL_CONN_DEVICE_PATH mCom1DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 0), DP_END };
-SERIAL_CONN_DEVICE_PATH mCom2DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0501, 1), DP_END };
-PARALLEL_CONN_DEVICE_PATH mLpt1DevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0401, 0), DP_END };
-FLOOPY_CONN_DEVICE_PATH mFloopyADevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 0), DP_END };
-FLOOPY_CONN_DEVICE_PATH mFloopyBDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x00), DP_LPC (0x0604, 1), DP_END };
-USB_PORT_DEVICE_PATH mUsb0DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x00), DP_END };
-USB_PORT_DEVICE_PATH mUsb1DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x01), DP_END };
-USB_PORT_DEVICE_PATH mUsb2DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x02), DP_END };
-USB_PORT_DEVICE_PATH mUsb3DevicePath = { DP_ACPI, DP_PCI (0x1d, 0x07), DP_END };
-IDE_DEVICE_PATH mIdeDevicePath = { DP_ACPI, DP_PCI (0x1F, 0x01), DP_END };
-GB_NIC_DEVICE_PATH mGbNicDevicePath = { DP_ACPI, DP_PCI( 0x03,0x00 ),DP_PCI( 0x1F,0x00 ),DP_PCI( 0x07,0x00 ), DP_END };
-//
-//
-//
-MISC_SUBCLASS_TABLE_FUNCTION (
+MISC_SMBIOS_TABLE_FUNCTION (
MiscPortInternalConnectorDesignator
)
/*++
@@ -84,184 +67,111 @@ Returns:
LogRecordData was NULL.
--*/
{
- EFI_DEVICE_PATH_PROTOCOL EndDevicePath = DP_END;
-
+ CHAR8 *OptionalStrStart;
+ UINTN InternalRefStrLen;
+ UINTN ExternalRefStrLen;
+ EFI_STRING InternalRef;
+ EFI_STRING ExternalRef;
+ STRING_REF TokenForInternal;
+ STRING_REF TokenForExternal;
+ EFI_STATUS Status;
+ SMBIOS_TABLE_TYPE8 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *ForType8InputData;
+
+ ForType8InputData = (EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR *)RecordData;
//
// First check for invalid parameters.
//
- // Shanmu >> to fix the Device Path Issue...
- // if (RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
- //
- if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
- //
- // End Shanmu
- //
+ if (RecordData == NULL) {
return EFI_INVALID_PARAMETER;
}
- //
- // Then check for unsupported RecordType.
- //
- if (RecordType != EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_RECORD_NUMBER) {
- return EFI_UNSUPPORTED;
- }
- //
- // Is this the first time through this function?
- //
- if (!mDone) {
- //
- // Yes, this is the first time. Inspect/Change the contents of the
- // RecordData structure.
- //
- //
- // Device path is only updated here as it was not taking that in static data
- //
- // Shanmu >> to fix the Device Path Issue...
- //
- /*
- switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortInternalConnectorDesignator)
- {
- case STR_MISC_PORT_INTERNAL_MOUSE:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2MouseDevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_KEYBOARD:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mPs2KeyboardDevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_COM1:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom1DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_COM2:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mCom2DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_LPT1:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mLpt1DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_USB1:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb0DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_USB2:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb1DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_USB3:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mUsb2DevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_NETWORK:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mGbNicDevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_FLOPPY:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mFloopyADevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_IDE1:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
- }break;
- case STR_MISC_PORT_INTERNAL_IDE2:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = *((EFI_DEVICE_PATH_PROTOCOL*)&mIdeDevicePath);
- }break;
- default:
- {
- (EFI_DEVICE_PATH_PROTOCOL)((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *)RecordData)->PortPath = EndDevicePath;
- }break;
- }
- */
- switch (((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortInternalConnectorDesignator) {
- case STR_MISC_PORT_INTERNAL_MOUSE:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &mPs2MouseDevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2MouseDevicePath);
- }
- break;
+ TokenForInternal = 0;
+ TokenForExternal = 0;
+
+ switch (ForType8InputData->PortInternalConnectorDesignator) {
+ case STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR:
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_CONNECTOR_DESIGNATOR);
+ break;
case STR_MISC_PORT_INTERNAL_KEYBOARD:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &mPs2KeyboardDevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mPs2KeyboardDevicePath);
- }
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_KEYBOARD);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_KEYBOARD);
+ break;
+ case STR_MISC_PORT_INTERNAL_MOUSE:
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_MOUSE);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_MOUSE);
break;
-
case STR_MISC_PORT_INTERNAL_COM1:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &mCom1DevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom1DevicePath);
- }
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM1);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM1);
break;
-
case STR_MISC_PORT_INTERNAL_COM2:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &mCom2DevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mCom2DevicePath);
- }
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_COM2);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_COM2);
+ break;
+ case STR_MISC_PORT_INTERNAL_EXTENSION_POWER:
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_EXTENSION_POWER);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_EXTENSION_POWER);
break;
-
case STR_MISC_PORT_INTERNAL_FLOPPY:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &mFloopyADevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &mFloopyADevicePath);
- }
+ TokenForInternal = STRING_TOKEN (STR_MISC_PORT_INTERNAL_FLOPPY);
+ TokenForExternal = STRING_TOKEN(STR_MISC_PORT_EXTERNAL_FLOPPY);
break;
-
default:
- {
- CopyMem (
- &((EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA *) RecordData)->PortPath,
- &EndDevicePath,
- GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath)
- );
- *RecordLen = *RecordLen - sizeof (EFI_MISC_PORT_DEVICE_PATH) + GetDevicePathSize ((EFI_DEVICE_PATH_PROTOCOL *) &EndDevicePath);
- }
break;
- }
- //
- // End Shanmu
- //
- // Set mDone flag to TRUE for next pass through this function.
- // Set *LogRecordData to TRUE so data will get logged to Data Hub.
- //
- mDone = TRUE;
- *LogRecordData = TRUE;
- } else {
- //
- // No, this is the second time. Reset the state of the mDone flag
- // to FALSE and tell the data logger that there is no more data
- // to be logged for this record type. If any memory allocations
- // were made by earlier passes, they must be released now.
- //
- mDone = FALSE;
- *LogRecordData = FALSE;
}
- return EFI_SUCCESS;
+ InternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForInternal, NULL);
+ InternalRefStrLen = StrLen(InternalRef);
+ if (InternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ ExternalRef = HiiGetPackageString(&gEfiCallerIdGuid, TokenForExternal, NULL);
+ ExternalRefStrLen = StrLen(ExternalRef);
+ if (ExternalRefStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE8) + InternalRefStrLen + 1 + ExternalRefStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_PORT_CONNECTOR_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE8);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->InternalReferenceDesignator = 1;
+ SmbiosRecord->InternalConnectorType = (UINT8)ForType8InputData->PortInternalConnectorType;
+ SmbiosRecord->ExternalReferenceDesignator = 2;
+ SmbiosRecord->ExternalConnectorType = (UINT8)ForType8InputData->PortExternalConnectorType;
+ SmbiosRecord->PortType = (UINT8)ForType8InputData->PortType;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(InternalRef, OptionalStrStart);
+ UnicodeStrToAsciiStr(ExternalRef, OptionalStrStart + InternalRefStrLen + 1);
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
}
+
+
/* eof - MiscSystemManufacturerFunction.c */
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
index 1f140f0ca6..aa5413ff00 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities) = {
{ // ResetCapabilities
0, // Status
0, // BootOption
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
new file mode 100644
index 0000000000..56423e5ad4
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscResetCapabilitiesFunction.c
@@ -0,0 +1,84 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+Module Name:
+
+ MiscResetCapabilitiesFunction.c
+
+Abstract:
+
+ ResetCapabilities.
+ SMBIOS type 23.
+
+--*/
+
+
+#include "MiscSubclassDriver.h"
+/**
+ This function makes boot time changes to the contents of the
+ MiscOemString (Type 11).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscResetCapabilities)
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE23 *SmbiosRecord;
+ EFI_MISC_RESET_CAPABILITIES *ForType23InputData;
+
+ ForType23InputData = (EFI_MISC_RESET_CAPABILITIES *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE23) + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_RESET;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE23);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->Capabilities = *(UINT8*)&(ForType23InputData->ResetCapabilities);
+ SmbiosRecord->ResetCount = (UINT16)ForType23InputData->ResetCount;
+ SmbiosRecord->ResetLimit = (UINT16)ForType23InputData->ResetLimit;
+ SmbiosRecord->TimerInterval = (UINT16)ForType23InputData->ResetTimerInterval;
+ SmbiosRecord->Timeout = (UINT16)ForType23InputData->ResetTimeout;
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
+
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf
index 19f19d578a..a8e6472018 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubClassPlatformDxe.inf
@@ -5,7 +5,7 @@
# All .uni file who tagged with "ToolCode="DUMMY"" in following file list is included by
# MiscSubclassDriver.uni file, the StrGather tool will expand MiscSubclassDriver.uni file
# and parse all .uni file.
-# Copyright (c) 2006 - 2007, Intel Corporation
+# Copyright (c) 2006 - 2009, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -35,25 +35,35 @@
#
[Sources.common]
+ MiscBaseBoardManufacturerData.c
+ MiscBaseBoardManufacturerFunction.c
+ MiscBiosVendorData.c
+ MiscBiosVendorFunction.c
+ MiscBootInformationData.c
+ MiscBootInformationFunction.c
+ MiscChassisManufacturerData.c
+ MiscChassisManufacturerFunction.c
+ MiscNumberOfInstallableLanguagesData.c
+ MiscNumberOfInstallableLanguagesFunction.c
+ MiscOemStringData.c
+ MiscOemStringFunction.c
+ MiscPortInternalConnectorDesignatorData.c
MiscPortInternalConnectorDesignatorFunction.c
- MiscSystemSlotDesignationData.c
- MiscSystemOptionStringData.c
- MiscSystemManufacturerFunction.c
- MiscSystemManufacturerData.c
- MiscSystemLanguageStringData.c
MiscResetCapabilitiesData.c
- MiscPortInternalConnectorDesignatorData.c
- MiscOemStringData.c
- MiscNumberOfInstallableLanguagesData.c
- MiscChassisManufacturerData.c
- MiscBootInformationData.c
- MiscBiosVendorData.c
- MiscBaseBoardManufacturerData.c
- MiscSubclassDriverDataTable.c
- MiscSubclassDriverEntryPoint.c
- MiscSubclassDriver.h
+ MiscResetCapabilitiesFunction.c
+ MiscSystemLanguageStringData.c
+ MiscSystemLanguageStringFunction.c
+ MiscSystemManufacturerData.c
+ MiscSystemManufacturerFunction.c
+ MiscSystemOptionStringData.c
+ MiscSystemOptionStringFunction.c
+ MiscSystemSlotDesignationData.c
+ MiscSystemSlotDesignationFunction.c
MiscDevicePath.h
+ MiscSubclassDriver.h
MiscSubclassDriver.uni
+ MiscSubclassDriverDataTable.c
+ MiscSubclassDriverEntryPoint.c
[Packages]
MdePkg/MdePkg.dec
@@ -72,21 +82,20 @@
HiiLib
DebugLib
BaseLib
+ MemoryAllocationLib
PcdLib
-
-[Guids]
- gEfiProcessorSubClassGuid # SOMETIMES_CONSUMED
- gEfiMiscSubClassGuid # SOMETIMES_CONSUMED
- gEfiMemorySubClassGuid # SOMETIMES_CONSUMED
-
[Protocols]
gEfiWinNtIoProtocolGuid # PROTOCOL_NOTIFY SOMETIMES_CONSUMED
- gEfiDataHubProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+ gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED
+
+[FixedPcd.common]
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareReleaseDateString
+ gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString
[Pcd.common]
gEfiNt32PkgTokenSpaceGuid.PcdWinNtMemorySize
+ gEfiMdePkgTokenSpaceGuid.PcdUefiVariableDefaultPlatformLang
[Depex]
- gEfiDataHubProtocolGuid
- \ No newline at end of file
+ gEfiSmbiosProtocolGuid
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.h b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.h
index df3ca8b986..68227f4764 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.h
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriver.h
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,8 @@ Abstract:
#include <FrameworkDxe.h>
#include <WinNtDxe.h>
#include <Guid/DataHubRecords.h>
-#include <Protocol/DataHub.h>
+#include <IndustryStandard/SmBios.h>
+#include <Protocol/Smbios.h>
#include <Protocol/WinNtIo.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
@@ -36,77 +37,80 @@ Abstract:
#include <Library/UefiBootServicesTableLib.h>
#include <Library/DevicePathLib.h>
#include <Library/PcdLib.h>
-
+#include <Library/MemoryAllocationLib.h>
#include <MiscDevicePath.h>
+
//
// Data table entry update function.
//
-typedef
-EFI_STATUS
-(EFIAPI EFI_MISC_SUBCLASS_DATA_FUNCTION) (
- IN UINT16 RecordType,
- IN UINT32 *RecordLen,
- IN OUT EFI_MISC_SUBCLASS_RECORDS *RecordData,
- OUT BOOLEAN *LogRecordData
+typedef EFI_STATUS (EFIAPI EFI_MISC_SMBIOS_DATA_FUNCTION) (
+ IN VOID *RecordData,
+ IN EFI_SMBIOS_PROTOCOL *Smbios
);
//
// Data table entry definition.
//
typedef struct {
- UINT16 RecordType;
- UINT32 RecordLen;
- VOID *RecordData;
- EFI_MISC_SUBCLASS_DATA_FUNCTION *Function;
-} EFI_MISC_SUBCLASS_DATA_TABLE;
+ //
+ // intermediat input data for SMBIOS record
+ //
+ VOID *RecordData;
+ EFI_MISC_SMBIOS_DATA_FUNCTION *Function;
+} EFI_MISC_SMBIOS_DATA_TABLE;
//
// Data Table extern definitions.
//
-#define MISC_SUBCLASS_TABLE_EXTERNS(NAME1, NAME2) \
- extern NAME1 NAME2 ## Data; \
- extern EFI_MISC_SUBCLASS_DATA_FUNCTION NAME2 ## Function
+#define MISC_SMBIOS_TABLE_EXTERNS(NAME1, NAME2, NAME3) \
+extern NAME1 NAME2 ## Data; \
+extern EFI_MISC_SMBIOS_DATA_FUNCTION NAME3 ## Function
+
//
// Data Table entries
//
-#define MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(NAME1, NAME2) { \
- NAME1 ## _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, NULL \
- }
-
-#define MISC_SUBCLASS_TABLE_ENTRY_FUNCTION_ONLY(NAME1, NAME2) \
- { \
- NAME1 ## _RECORD_NUMBER, 0, NULL, &NAME2 ## Function \
- }
-
-#define MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2, NAME3) \
- { \
- NAME1 ## _RECORD_NUMBER, sizeof (NAME1 ## _DATA), &NAME2 ## Data, &NAME3 ## Function \
- }
+#define MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \
+{ \
+ & NAME1 ## Data, \
+ & NAME2 ## Function \
+}
//
// Global definition macros.
//
-#define MISC_SUBCLASS_TABLE_DATA(NAME1, NAME2) NAME1 NAME2 ## Data
+#define MISC_SMBIOS_TABLE_DATA(NAME1, NAME2) \
+ NAME1 NAME2 ## Data
-#define MISC_SUBCLASS_TABLE_FUNCTION(NAME2) \
- EFI_STATUS EFIAPI NAME2 ## Function ( \
- IN UINT16 RecordType, \
- IN UINT32 *RecordLen, \
- IN OUT EFI_MISC_SUBCLASS_RECORDS * RecordData, \
- OUT BOOLEAN *LogRecordData \
+#define MISC_SMBIOS_TABLE_FUNCTION(NAME2) \
+ EFI_STATUS EFIAPI NAME2 ## Function( \
+ IN VOID *RecordData, \
+ IN EFI_SMBIOS_PROTOCOL *Smbios \
)
+
//
// Data Table Array
//
-extern EFI_MISC_SUBCLASS_DATA_TABLE mMiscSubclassDataTable[];
+extern EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[];
//
// Data Table Array Entries
//
-extern UINTN mMiscSubclassDataTableEntries;
+extern UINTN mMiscSubclassDataTableEntries;
+extern UINT8 MiscSubclassStrings[];
+extern EFI_HII_HANDLE mHiiHandle;
+
+//
+// Prototypes
+//
+EFI_STATUS
+MiscSubclassDriverEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
#endif /* _MISC_SUBCLASS_DRIVER_H */
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
index e6dc660551..e92b3acf2d 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverDataTable.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -22,78 +22,57 @@ Abstract:
#include "MiscSubclassDriver.h"
+
//
// External definitions referenced by Data Table entries.
//
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_CHASSIS_MANUFACTURER_DATA,
- MiscChassisManufacturer
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_BIOS_VENDOR_DATA,
- MiscBiosVendor
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_SYSTEM_MANUFACTURER_DATA,
- MiscSystemManufacturer
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_BASE_BOARD_MANUFACTURER_DATA,
- MiscBaseBoardManufacturer
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
- MiscPortInternalConnectorDesignator
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
- MiscPortKeyboard
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
- MiscPortMouse
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
- MiscPortCom1
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA,
- MiscPortCom2
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA,
- MiscSystemSlotDesignation
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_OEM_STRING_DATA,
- OemString
- );
-MISC_SUBCLASS_TABLE_EXTERNS (
- EFI_MISC_SYSTEM_OPTION_STRING_DATA,
- SystemOptionString
- );
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BASE_BOARD_MANUFACTURER_DATA, MiscBaseBoardManufacturer, MiscBaseBoardManufacturer);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BIOS_VENDOR_DATA, MiscBiosVendor,MiscBiosVendor );
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_BOOT_INFORMATION_STATUS_DATA, BootInformationStatus, BootInformationStatus);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_CHASSIS_MANUFACTURER_DATA, MiscChassisManufacturer, MiscChassisManufacturer);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_NUMBER_OF_INSTALLABLE_LANGUAGES_DATA,NumberOfInstallableLanguages, NumberOfInstallableLanguages);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_OEM_STRING_DATA,OemString, OemString);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortKeyboard, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortMouse, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom1, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortCom2, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortExtensionPower, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR_DATA, MiscPortFloppy, MiscPortInternalConnectorDesignator);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_RESET_CAPABILITIES, MiscResetCapabilities, MiscResetCapabilities);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA,SystemLanguageString, SystemLanguageString);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer, MiscSystemManufacturer);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString, SystemOptionString);
+MISC_SMBIOS_TABLE_EXTERNS ( EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation, MiscSystemSlotDesignation);
+
//
// Data Table.
//
-EFI_MISC_SUBCLASS_DATA_TABLE mMiscSubclassDataTable[] = {
- MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortKeyboard, MiscPortInternalConnectorDesignator),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortMouse, MiscPortInternalConnectorDesignator),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom1, MiscPortInternalConnectorDesignator),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_AND_FUNCTION(EFI_MISC_PORT_INTERNAL_CONNECTOR_DESIGNATOR, MiscPortCom2, MiscPortInternalConnectorDesignator),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BIOS_VENDOR, MiscBiosVendor),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_MANUFACTURER, MiscSystemManufacturer),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_BASE_BOARD_MANUFACTURER, MiscBaseBoardManufacturer),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_CHASSIS_MANUFACTURER, MiscChassisManufacturer),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_SLOT_DESIGNATION, MiscSystemSlotDesignation),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_OEM_STRING, OemString),
- MISC_SUBCLASS_TABLE_ENTRY_DATA_ONLY(EFI_MISC_SYSTEM_OPTION_STRING, SystemOptionString),
-};
-
+EFI_MISC_SMBIOS_DATA_TABLE mMiscSubclassDataTable[] = {
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBaseBoardManufacturer, MiscBaseBoardManufacturer),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscBiosVendor,MiscBiosVendor ),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( BootInformationStatus, BootInformationStatus),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscChassisManufacturer, MiscChassisManufacturer),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(NumberOfInstallableLanguages, NumberOfInstallableLanguages),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(OemString, OemString),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortInternalConnectorDesignator, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortKeyboard, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortMouse, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom1, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortCom2, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortExtensionPower, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscPortFloppy, MiscPortInternalConnectorDesignator),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscResetCapabilities, MiscResetCapabilities),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION(SystemLanguageString, SystemLanguageString),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemManufacturer, MiscSystemManufacturer),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( SystemOptionString, SystemOptionString),
+ MISC_SMBIOS_TABLE_ENTRY_DATA_AND_FUNCTION( MiscSystemSlotDesignation, MiscSystemSlotDesignation),
+ };
+
//
// Number of Data Table entries.
//
-UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SUBCLASS_DATA_TABLE);
+UINTN mMiscSubclassDataTableEntries = (sizeof mMiscSubclassDataTable) / sizeof (EFI_MISC_SMBIOS_DATA_TABLE);
/* eof - MiscSubclassDriverDataTable.c */
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
index 515ccbbc5b..208178eff0 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSubclassDriverEntryPoint.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2007, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -22,98 +22,78 @@ Abstract:
#include "MiscSubclassDriver.h"
+EFI_HII_HANDLE mHiiHandle;
-extern UINT8 MiscSubclassStrings[];
+/**
+ This is the standard EFI driver point that detects whether there is a
+ MemoryConfigurationData Variable and, if so, reports memory configuration info
+ to the DataHub.
+ @param ImageHandle Handle for the image of this driver
+ @param SystemTable Pointer to the EFI System Table
-//
-//
-//
+ @return EFI_SUCCESS if the data is successfully reported
+ @return EFI_NOT_FOUND if the HOB list could not be located.
+
+**/
EFI_STATUS
-LogRecordDataToDataHub (
- EFI_DATA_HUB_PROTOCOL *DataHub,
- UINT32 RecordType,
- UINT32 RecordLen,
- VOID *RecordData
+LogMemorySmbiosRecord (
+ VOID
)
-/*++
-Description:
-
-Parameters:
-
- DataHub
- %%TBD
-
- RecordType
- %%TBD
-
- RecordLen
- %%TBD
-
- RecordData
- %%TBD
-
-Returns:
-
- EFI_INVALID_PARAMETER
-
- EFI_SUCCESS
-
- Other Data Hub errors
-
---*/
{
- EFI_MISC_SUBCLASS_DRIVER_DATA MiscSubclass;
- EFI_STATUS Status;
+ EFI_STATUS Status;
+ UINT64 TotalMemorySize;
+ UINT8 NumSlots;
+ SMBIOS_TABLE_TYPE19 *Type19Record;
+ EFI_SMBIOS_HANDLE MemArrayMappedAddrSmbiosHandle;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+ CHAR16 *Nt32MemString;
+
+ Status = gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
+ ASSERT_EFI_ERROR (Status);
+
+ NumSlots = 1;
//
- // Do nothing if data parameters are not valid.
+ // Process Memory String in form size!size ...
+ // So 64!64 is 128 MB
//
- if (RecordLen == 0 || RecordData == NULL) {
- DEBUG (
- (EFI_D_ERROR,
- "RecordLen == %d RecordData == %xh\n",
- RecordLen,
- RecordData)
- );
-
- return EFI_INVALID_PARAMETER;
+ Nt32MemString = PcdGetPtr (PcdWinNtMemorySize);
+ for (TotalMemorySize = 0; *Nt32MemString != '\0';) {
+ TotalMemorySize += StrDecimalToUint64 (Nt32MemString);
+ while (*Nt32MemString != '\0') {
+ if (*Nt32MemString == '!') {
+ Nt32MemString++;
+ break;
+ }
+ Nt32MemString++;
+ }
}
+
+ //
+ // Convert Total Memory Size to based on KiloByte
//
- // Assemble Data Hub record.
+ TotalMemorySize = LShiftU64 (TotalMemorySize, 20);
//
- MiscSubclass.Header.Version = EFI_MISC_SUBCLASS_VERSION;
- MiscSubclass.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
- MiscSubclass.Header.Instance = 1;
- MiscSubclass.Header.SubInstance = 1;
- MiscSubclass.Header.RecordType = RecordType;
-
- CopyMem (
- &MiscSubclass.Record,
- RecordData,
- RecordLen
- );
+ // Generate Memory Array Mapped Address info
+ //
+ Type19Record = AllocatePool(sizeof (SMBIOS_TABLE_TYPE19));
+ ZeroMem(Type19Record, sizeof(SMBIOS_TABLE_TYPE19));
+ Type19Record->Hdr.Type = EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS;
+ Type19Record->Hdr.Length = sizeof(SMBIOS_TABLE_TYPE19);
+ Type19Record->Hdr.Handle = 0;
+ Type19Record->StartingAddress = 0;
+ Type19Record->EndingAddress = (UINT32)RShiftU64(TotalMemorySize, 10) - 1;
+ Type19Record->MemoryArrayHandle = 0;
+ Type19Record->PartitionWidth = (UINT8)(NumSlots);
//
- // Log Data Hub record.
+ // Generate Memory Array Mapped Address info (TYPE 19)
//
- Status = DataHub->LogData (
- DataHub,
- &gEfiMiscSubClassGuid,
- &gEfiMiscSubClassGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- &MiscSubclass,
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG (
- (EFI_D_ERROR,
- "LogData(%d bytes) == %r\n",
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + RecordLen,
- Status)
- );
- }
+ MemArrayMappedAddrSmbiosHandle = 0;
+ Status = Smbios->Add (Smbios, NULL, &MemArrayMappedAddrSmbiosHandle, (EFI_SMBIOS_TABLE_HEADER*) Type19Record);
+ FreePool(Type19Record);
+ ASSERT_EFI_ERROR (Status);
return Status;
}
@@ -146,193 +126,45 @@ Returns:
--*/
{
- EFI_MISC_SUBCLASS_DRIVER_DATA RecordData;
- EFI_DATA_HUB_PROTOCOL *DataHub;
- EFI_HII_HANDLE HiiHandle;
- EFI_STATUS Status;
- UINTN Index;
- BOOLEAN LogRecordData;
- EFI_MEMORY_SUBCLASS_DRIVER_DATA MemorySubClassData;
- UINT64 TotalMemorySize;
- CHAR16 *Nt32MemString;
+ UINTN Index;
+ EFI_STATUS EfiStatus;
+ EFI_SMBIOS_PROTOCOL *Smbios;
+ EfiStatus = gBS->LocateProtocol(&gEfiSmbiosProtocolGuid, NULL, (VOID**)&Smbios);
- //
- // Initialize constant portion of subclass header.
- //
- RecordData.Header.Version = EFI_MISC_SUBCLASS_VERSION;
- RecordData.Header.HeaderSize = sizeof (EFI_SUBCLASS_TYPE1_HEADER);
- RecordData.Header.Instance = 1;
- RecordData.Header.SubInstance = 1;
-
- //
- // Locate data hub protocol.
- //
- Status = gBS->LocateProtocol (&gEfiDataHubProtocolGuid, NULL, (VOID**)&DataHub);
-
- if (EFI_ERROR (Status)) {
- DEBUG ((EFI_D_ERROR, "Could not locate DataHub protocol. %r\n", Status));
- return Status;
- } else if (DataHub == NULL) {
- DEBUG ((EFI_D_ERROR, "LocateProtocol(DataHub) returned NULL pointer!\n"));
- return EFI_DEVICE_ERROR;
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((EFI_D_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiStatus));
+ return EfiStatus;
}
- //
- // Add our default strings to the HII database. They will be modified later.
- //
- HiiHandle = HiiAddPackages (
- &gEfiMiscSubClassGuid,
- NULL,
- MiscSubclassStrings,
- NULL
- );
- if (HiiHandle == NULL) {
- DEBUG ((EFI_D_ERROR, "Could not log default strings to Hii. %r\n", Status));
- return EFI_OUT_OF_RESOURCES;
- }
- //
- //
- //
- for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {
- //
- // Stupidity check! Do nothing if RecordLen is zero.
- // %%TBD - Should this be an error or a mechanism for ignoring
- // records in the Data Table?
- //
- if (mMiscSubclassDataTable[Index].RecordLen == 0) {
- DEBUG (
- (EFI_D_ERROR,
- "mMiscSubclassDataTable[%d].RecordLen == 0\n",
- Index)
- );
- continue;
- }
+ mHiiHandle = HiiAddPackages (
+ &gEfiCallerIdGuid,
+ NULL,
+ MiscSubclassStrings,
+ NULL
+ );
+ ASSERT (mHiiHandle != NULL);
+
+ for (Index = 0; Index < mMiscSubclassDataTableEntries; ++Index) {
//
- // Initialize per-record portion of subclass header and
- // copy static data into data portion of subclass record.
+ // If the entry have a function pointer, just log the data.
//
- RecordData.Header.RecordType = mMiscSubclassDataTable[Index].RecordType;
-
- if (mMiscSubclassDataTable[Index].RecordData == NULL) {
- ZeroMem (
- &RecordData.Record,
- mMiscSubclassDataTable[Index].RecordLen
- );
- } else {
- CopyMem (
- &RecordData.Record,
+ if (mMiscSubclassDataTable[Index].Function != NULL) {
+ EfiStatus = (*mMiscSubclassDataTable[Index].Function)(
mMiscSubclassDataTable[Index].RecordData,
- mMiscSubclassDataTable[Index].RecordLen
+ Smbios
);
- }
- //
- // If the entry does not have a function pointer, just log the data.
- //
- if (mMiscSubclassDataTable[Index].Function == NULL) {
- //
- // Log RecordData to Data Hub.
- //
- Status = DataHub->LogData (
- DataHub,
- &gEfiMiscSubClassGuid,
- &gEfiMiscSubClassGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- &RecordData,
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG (
- (EFI_D_ERROR,
- "LogData(%d bytes) == %r\n",
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,
- Status)
- );
- }
-
- continue;
- }
- //
- // The entry has a valid function pointer.
- // Keep calling the function and logging data until there
- // is no more data to log.
- //
- for (;;) {
- Status = (*mMiscSubclassDataTable[Index].Function)(mMiscSubclassDataTable[Index].RecordType, &mMiscSubclassDataTable[Index].RecordLen, &RecordData.Record, &LogRecordData);
- if (EFI_ERROR (Status)) {
- break;
- }
-
- if (!LogRecordData) {
- break;
- }
-
- Status = DataHub->LogData (
- DataHub,
- &gEfiMiscSubClassGuid,
- &gEfiMiscSubClassGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- &RecordData,
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen
- );
-
- if (EFI_ERROR (Status)) {
- DEBUG (
- (EFI_D_ERROR,
- "LogData(%d bytes) == %r\n",
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + mMiscSubclassDataTable[Index].RecordLen,
- Status)
- );
- }
- }
- }
-
-
- //
- // Log Memory Size info based on PCD setting.
- //
- MemorySubClassData.Header.Instance = 1;
- MemorySubClassData.Header.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
- MemorySubClassData.Header.RecordType = EFI_MEMORY_ARRAY_START_ADDRESS_RECORD_NUMBER;
- //
- // Process Memory String in form size!size ...
- // So 64!64 is 128 MB
- //
- Nt32MemString = PcdGetPtr (PcdWinNtMemorySize);
- for (TotalMemorySize = 0; *Nt32MemString != '\0';) {
- TotalMemorySize += StrDecimalToUint64 (Nt32MemString);
- while (*Nt32MemString != '\0') {
- if (*Nt32MemString == '!') {
- Nt32MemString++;
- break;
+ if (EFI_ERROR(EfiStatus)) {
+ DEBUG((EFI_D_ERROR, "Misc smbios store error. Index=%d, ReturnStatus=%r\n", Index, EfiStatus));
+ return EfiStatus;
}
- Nt32MemString++;
}
}
- MemorySubClassData.Record.ArrayStartAddress.MemoryArrayStartAddress = 0;
- MemorySubClassData.Record.ArrayStartAddress.MemoryArrayEndAddress = LShiftU64 (TotalMemorySize, 20) - 1;
- MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.ProducerName = gEfiCallerIdGuid;
- MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.Instance = 1;
- MemorySubClassData.Record.ArrayStartAddress.PhysicalMemoryArrayLink.SubInstance = EFI_SUBCLASS_INSTANCE_NON_APPLICABLE;
- MemorySubClassData.Record.ArrayStartAddress.MemoryArrayPartitionWidth = 0;
-
//
- // Store memory size data record to data hub.
+ // Log Memory SMBIOS Record
//
- Status = DataHub->LogData (
- DataHub,
- &gEfiMemorySubClassGuid,
- &gEfiCallerIdGuid,
- EFI_DATA_RECORD_CLASS_DATA,
- &MemorySubClassData,
- sizeof (EFI_SUBCLASS_TYPE1_HEADER) + sizeof (EFI_MEMORY_ARRAY_START_ADDRESS_DATA)
- );
-
-
- return EFI_SUCCESS;
+ EfiStatus = LogMemorySmbiosRecord();
+ return EfiStatus;
}
-
-
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
index 059dcf6805..48464a2fe1 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_LANGUAGE_STRING_DATA, SystemLanguageString) = {
0,
STRING_TOKEN(STR_MISC_SYSTEM_LANGUAGE_STRING)
};
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
new file mode 100644
index 0000000000..b2232a442f
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemLanguageStringFunction.c
@@ -0,0 +1,92 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+Module Name:
+
+ MiscResetCapabilitiesFunction.c
+
+Abstract:
+
+ ResetCapabilities.
+ SMBIOS type 23.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+/**
+ This function makes boot time changes to the contents of the
+ MiscOemString (Type 11).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(SystemLanguageString)
+{
+ EFI_STATUS Status;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE13 *SmbiosRecord;
+ UINTN StrLeng;
+ CHAR8 *OptionalStrStart;
+ EFI_STRING Str;
+ STRING_REF TokenToGet;
+
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_LANGUAGE_STRING);
+ Str = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ StrLeng = StrLen(Str);
+ if (StrLeng > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE13) + StrLeng + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE13);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->InstallableLanguages = 1;
+ SmbiosRecord->Flags = 1;
+ SmbiosRecord->CurrentLanguages = 1;
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(Str, OptionalStrStart);
+
+
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
+
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
index 3d3e7a5363..2608abbbf9 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) System Manufacturer data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_MANUFACTURER_DATA, MiscSystemManufacturer)
= {
STRING_TOKEN(STR_MISC_SYSTEM_MANUFACTURER),
// SystemManufactrurer
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
index 39c12cf482..5cb4a47273 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemManufacturerFunction.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -22,101 +22,119 @@ Abstract:
#include "MiscSubclassDriver.h"
-BOOLEAN mDone = FALSE;
-
-//
-//
-//
-MISC_SUBCLASS_TABLE_FUNCTION (
- MiscSystemManufacturer
- )
-/*++
-Description:
-
+/**
This function makes boot time changes to the contents of the
- MiscSystemManufacturer (Type 13).
+ MiscSystemManufacturer (Type 1).
-Parameters:
+ @param RecordData Pointer to copy of RecordData from the Data Table.
- RecordType
- Type of record to be processed from the Data Table.
- mMiscSubclassDataTable[].RecordType
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
- RecordLen
- Size of static RecordData from the Data Table.
- mMiscSubclassDataTable[].RecordLen
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscSystemManufacturer)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN ManuStrLen;
+ UINTN VerStrLen;
+ UINTN PdNameStrLen;
+ UINTN SerialNumStrLen;
+ EFI_STATUS Status;
+ EFI_STRING Manufacturer;
+ EFI_STRING ProductName;
+ EFI_STRING Version;
+ EFI_STRING SerialNumber;
+ STRING_REF TokenToGet;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE1 *SmbiosRecord;
+ EFI_MISC_SYSTEM_MANUFACTURER *ForType1InputData;
+
+ ForType1InputData = (EFI_MISC_SYSTEM_MANUFACTURER *)RecordData;
- RecordData
- Pointer to copy of RecordData from the Data Table. Changes made
- to this copy will be written to the Data Hub but will not alter
- the contents of the static Data Table.
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
- LogRecordData
- Set *LogRecordData to TRUE to log RecordData to Data Hub.
- Set *LogRecordData to FALSE when there is no more data to log.
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER);
+ Manufacturer = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ ManuStrLen = StrLen(Manufacturer);
+ if (ManuStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
-Returns:
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME);
+ ProductName = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ PdNameStrLen = StrLen(ProductName);
+ if (PdNameStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
- EFI_SUCCESS
- All parameters were valid and *RecordData and *LogRecordData have
- been set.
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_VERSION);
+ Version = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ VerStrLen = StrLen(Version);
+ if (VerStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
- EFI_UNSUPPORTED
- Unexpected RecordType value.
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER);
+ SerialNumber = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ SerialNumStrLen = StrLen(SerialNumber);
+ if (SerialNumStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE1) + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + 1);
- EFI_INVALID_PARAMETER
- One of the following parameter conditions was true:
- RecordLen was zero.
- RecordData was NULL.
- LogRecordData was NULL.
---*/
-{
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_INFORMATION;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE1);
//
- // First check for invalid parameters.
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
//
- if (*RecordLen == 0 || RecordData == NULL || LogRecordData == NULL) {
- return EFI_INVALID_PARAMETER;
- }
+ // Manu will be the 1st optional string following the formatted structure.
//
- // Then check for unsupported RecordType.
+ SmbiosRecord->Manufacturer = 1;
//
- if (RecordType != EFI_MISC_SYSTEM_MANUFACTURER_RECORD_NUMBER) {
- return EFI_UNSUPPORTED;
- }
+ // ProductName will be the 2nd optional string following the formatted structure.
//
- // Is this the first time through this function?
+ SmbiosRecord->ProductName = 2;
//
- if (!mDone) {
- //
- // Yes, this is the first time. Inspect/Change the contents of the
- // RecordData structure.
- //
- //
- // Set system GUID.
- //
- // ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemUuid = %%TBD
- //
- // Set power-on type.
- //
- // ((EFI_MISC_SYSTEM_MANUFACTURER_DATA *)RecordData)->SystemWakeupType = %%TBD
- //
- // Set mDone flag to TRUE for next pass through this function.
- // Set *LogRecordData to TRUE so data will get logged to Data Hub.
- //
- mDone = TRUE;
- *LogRecordData = TRUE;
- } else {
- //
- // No, this is the second time. Reset the state of the mDone flag
- // to FALSE and tell the data logger that there is no more data
- // to be logged for this record type. If any memory allocations
- // were made by earlier passes, they must be released now.
- //
- mDone = FALSE;
- *LogRecordData = FALSE;
- }
+ // Version will be the 3rd optional string following the formatted structure.
+ //
+ SmbiosRecord->Version = 3;
+ //
+ // Version will be the 4th optional string following the formatted structure.
+ //
+ SmbiosRecord->SerialNumber = 4;
+ CopyMem ((UINT8 *) (&SmbiosRecord->Uuid),&ForType1InputData->SystemUuid,16);
+ SmbiosRecord->WakeUpType = (UINT8)ForType1InputData->SystemWakeupType;
+
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart);
+ UnicodeStrToAsciiStr(ProductName, OptionalStrStart + ManuStrLen + 1);
+ UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1);
+ UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen + 1 + PdNameStrLen + 1 + VerStrLen + 1);
- return EFI_SUCCESS;
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
}
/* eof - MiscSystemManufacturerFunction.c */
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
index b2976aeef9..9a651b4ad9 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_OPTION_STRING_DATA, SystemOptionString) = {
STRING_TOKEN(STR_MISC_SYSTEM_OPTION_STRING)
};
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c
new file mode 100644
index 0000000000..a4aeb3113c
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemOptionStringFunction.c
@@ -0,0 +1,91 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscSystemOptionStringFunction.c
+
+Abstract:
+
+ BIOS system option string boot time changes.
+ SMBIOS type 12.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+
+
+/**
+ This function makes boot time changes to the contents of the
+ MiscSystemOptionString (Type 12).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(SystemOptionString)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN OptStrLen;
+ EFI_STRING OptionString;
+ EFI_STATUS Status;
+ STRING_REF TokenToGet;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ SMBIOS_TABLE_TYPE12 *SmbiosRecord;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_OPTION_STRING);
+ OptionString = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ OptStrLen = StrLen(OptionString);
+ if (OptStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE12) + OptStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_CONFIGURATION_OPTIONS;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE12);
+ //
+ // Make handle chosen by smbios protocol.add automatically.
+ //
+ SmbiosRecord->Hdr.Handle = 0;
+
+ SmbiosRecord->StringCount = 1;
+ OptionalStrStart = (CHAR8*) (SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(OptionString, OptionalStrStart);
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
index ce1ec70b98..d0058eb45a 100644
--- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationData.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006, Intel Corporation
+Copyright (c) 2006 - 2009, Intel Corporation
All rights reserved. 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
@@ -25,7 +25,7 @@ Abstract:
//
// Static (possibly build generated) Bios Vendor data.
//
-MISC_SUBCLASS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {
+MISC_SMBIOS_TABLE_DATA(EFI_MISC_SYSTEM_SLOT_DESIGNATION_DATA, MiscSystemSlotDesignation) = {
STRING_TOKEN(STR_MISC_SYSTEM_SLOT_DESIGNATION), // SlotDesignation
EfiSlotTypeOther, // SlotType
EfiSlotDataBusWidthOther, // SlotDataBusWidth
diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c
new file mode 100644
index 0000000000..c42b9d2d5d
--- /dev/null
+++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscSystemSlotDesignationFunction.c
@@ -0,0 +1,105 @@
+/*++
+
+Copyright (c) 2009, 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.
+
+
+Module Name:
+
+ MiscSystemSlotDesignatorFunction.c
+
+Abstract:
+
+ BIOS system slot designator information boot time changes.
+ SMBIOS type 9.
+
+--*/
+
+#include "MiscSubclassDriver.h"
+/**
+ This function makes boot time changes to the contents of the
+ MiscSystemSlotDesignator structure (Type 9).
+
+ @param RecordData Pointer to copy of RecordData from the Data Table.
+
+ @retval EFI_SUCCESS All parameters were valid.
+ @retval EFI_UNSUPPORTED Unexpected RecordType value.
+ @retval EFI_INVALID_PARAMETER Invalid parameter was found.
+
+**/
+MISC_SMBIOS_TABLE_FUNCTION(MiscSystemSlotDesignation)
+{
+ CHAR8 *OptionalStrStart;
+ UINTN SlotDesignationStrLen;
+ EFI_STATUS Status;
+ EFI_STRING SlotDesignation;
+ STRING_REF TokenToGet;
+ SMBIOS_TABLE_TYPE9 *SmbiosRecord;
+ EFI_SMBIOS_HANDLE SmbiosHandle;
+ EFI_MISC_SYSTEM_SLOT_DESIGNATION* ForType9InputData;
+
+ ForType9InputData = (EFI_MISC_SYSTEM_SLOT_DESIGNATION *)RecordData;
+
+ //
+ // First check for invalid parameters.
+ //
+ if (RecordData == NULL) {
+ return EFI_INVALID_PARAMETER;
+ }
+
+ TokenToGet = 0;
+ switch (ForType9InputData->SlotDesignation) {
+ case STR_MISC_SYSTEM_SLOT_DESIGNATION:
+ TokenToGet = STRING_TOKEN (STR_MISC_SYSTEM_SLOT_DESIGNATION);
+ break;
+ default:
+ break;
+ }
+
+ SlotDesignation = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL);
+ SlotDesignationStrLen = StrLen(SlotDesignation);
+ if (SlotDesignationStrLen > SMBIOS_STRING_MAX_LENGTH) {
+ return EFI_UNSUPPORTED;
+ }
+
+ //
+ // Two zeros following the last string.
+ //
+ SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE9) + SlotDesignationStrLen + 1 + 1);
+ ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE9) +SlotDesignationStrLen + 1 + 1);
+
+ SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_SYSTEM_SLOTS;
+ SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE9);
+ SmbiosRecord->Hdr.Handle = 0;
+ SmbiosRecord->SlotDesignation = 1;
+ SmbiosRecord->SlotType = ForType9InputData->SlotType;
+ SmbiosRecord->SlotDataBusWidth = ForType9InputData->SlotDataBusWidth;
+ SmbiosRecord->CurrentUsage = ForType9InputData->SlotUsage;
+ SmbiosRecord->SlotLength = ForType9InputData->SlotLength;
+ SmbiosRecord->SlotID = ForType9InputData->SlotId;
+
+ //
+ // Slot Characteristics
+ //
+ CopyMem ((UINT8 *) &SmbiosRecord->SlotCharacteristics1,(UINT8 *) &ForType9InputData->SlotCharacteristics,2);
+ OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1);
+ UnicodeStrToAsciiStr(SlotDesignation, OptionalStrStart);
+ //
+ // Now we have got the full smbios record, call smbios protocol to add this record.
+ //
+ SmbiosHandle = 0;
+ Status = Smbios-> Add(
+ Smbios,
+ NULL,
+ &SmbiosHandle,
+ (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord
+ );
+ FreePool(SmbiosRecord);
+ return Status;
+}
diff --git a/Nt32Pkg/Nt32Pkg.dsc b/Nt32Pkg/Nt32Pkg.dsc
index 406ef8ffe5..9e928a3c7c 100644
--- a/Nt32Pkg/Nt32Pkg.dsc
+++ b/Nt32Pkg/Nt32Pkg.dsc
@@ -394,6 +394,7 @@
Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+ MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
Nt32Pkg/WinNtThunkDxe/WinNtThunkDxe.inf
diff --git a/Nt32Pkg/Nt32Pkg.fdf b/Nt32Pkg/Nt32Pkg.fdf
index d2d8ccea76..4e041ab665 100644
--- a/Nt32Pkg/Nt32Pkg.fdf
+++ b/Nt32Pkg/Nt32Pkg.fdf
@@ -188,6 +188,7 @@ INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
INF Nt32Pkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
INF IntelFrameworkModulePkg/Universal/DataHubDxe/DataHubDxe.inf
+INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf