X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=Nt32Pkg%2FMiscSubClassPlatformDxe%2FMiscBaseBoardManufacturerFunction.c;h=765627a8e6222a530f0ccae4aa8de2335532895d;hb=06e24096670ba13eaff39496498a5d9e41a37034;hp=223d99ee4b4c0783fadcaf8f7b895b79deb388ee;hpb=5e973c9630be45e950aa38c629a34033c85f9637;p=mirror_edk2.git diff --git a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c index 223d99ee4b..765627a8e6 100644 --- a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c +++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c @@ -2,8 +2,9 @@ BaseBoard manufacturer information boot time changes. SMBIOS type 2. -Copyright (c) 2009, Intel Corporation -All rights reserved. This program and the accompanying materials +Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+(C) Copyright 2017 Hewlett Packard Enterprise Development LP
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -31,7 +32,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) UINTN ManuStrLen; UINTN ProductStrLen; UINTN VerStrLen; - UINTN AssertTagStrLen; + UINTN AssetTagStrLen; UINTN SerialNumStrLen; UINTN ChassisStrLen; EFI_STATUS Status; @@ -39,7 +40,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) EFI_STRING Product; EFI_STRING Version; EFI_STRING SerialNumber; - EFI_STRING AssertTag; + EFI_STRING AssetTag; EFI_STRING Chassis; STRING_REF TokenToGet; EFI_SMBIOS_HANDLE SmbiosHandle; @@ -84,9 +85,9 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) } TokenToGet = STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG); - AssertTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL); - AssertTagStrLen = StrLen(AssertTag); - if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) { + AssetTag = HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet, NULL); + AssetTagStrLen = StrLen(AssetTag); + if (AssetTagStrLen > SMBIOS_STRING_MAX_LENGTH) { return EFI_UNSUPPORTED; } @@ -101,11 +102,16 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // // 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); + // Since we fill NumberOfContainedObjectHandles = 0, remove sizeof (UINT16) bytes for ContainedObjectHandles[1] + // + SmbiosRecord = AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1); + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1); SmbiosRecord->Hdr.Type = EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; - SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2); + // + // Since we fill NumberOfContainedObjectHandles = 0, remove sizeof (UINT16) bytes for ContainedObjectHandles[1] + // + SmbiosRecord->Hdr.Length = sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16); // // Make handle chosen by smbios protocol.add automatically. // @@ -127,7 +133,7 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) // SmbiosRecord->SerialNumber = 4; // - // AssertTag will be the 5th optional string following the formatted structure. + // AssetTag will be the 5th optional string following the formatted structure. // SmbiosRecord->AssetTag = 5; @@ -142,25 +148,19 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) OptionalStrStart = (CHAR8 *)(SmbiosRecord + 1); // - // Since we fill NumberOfContainedObjectHandles = 0 for simple, just after this filed to fill string + // Since we fill NumberOfContainedObjectHandles = 0, just after this field to fill string // - OptionalStrStart -= 2; + OptionalStrStart -= sizeof (UINT16); 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); + UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); + UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 + AssetTagStrLen + 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 - ); + Status = AddSmbiosRecord (Smbios, &SmbiosHandle, (EFI_SMBIOS_TABLE_HEADER *) SmbiosRecord); FreePool(SmbiosRecord); return Status;