From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0705.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe40::705]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6EACB81C10 for ; Thu, 12 Jan 2017 00:15:52 -0800 (PST) Received: from DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.26) by DF4PR84MB0139.NAMPRD84.PROD.OUTLOOK.COM (10.162.192.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.829.7; Thu, 12 Jan 2017 08:15:49 +0000 Received: from DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.26]) by DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM ([10.162.192.26]) with mapi id 15.01.0829.019; Thu, 12 Jan 2017 08:15:49 +0000 From: "Phillips, Chris J (Plano, TX)" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Ni, Ruiyu" Thread-Topic: [edk2] [PATCH v2] Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Length Thread-Index: AQHSa2F6q+jzENWQ4kaF280mSGlx/qEyf2WAgACO7wCAAXHisA== Date: Thu, 12 Jan 2017 08:15:49 +0000 Message-ID: References: <2f986db7-7f13-43e4-b76d-fe9dcead5edc@AIA2PHNNRN.local> <0C09AFA07DD0434D9E2A0C6AEB0483103B815A02@shsmsx102.ccr.corp.intel.com> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=chrisp@hpe.com; x-originating-ip: [104.188.247.48] x-ms-office365-filtering-correlation-id: 02fb02bf-ea3d-49fa-3298-08d43ac337e5 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:DF4PR84MB0139; x-microsoft-exchange-diagnostics: 1; DF4PR84MB0139; 7:l4GS/9ZQnWqnK22xojlmsstld3je96vSYRZ7Cnjbo3FjVgLGewmMnUlVs2bISr/2Nf73edoFVnlXt6LI2151rVWjeGhkXI/OKtwrxc71MiHZrVv/hturpEYKRouuZv10e3PT5m4PY7xQ3T6TngL85eqpzzUQOrVB1RQvLrko5+lvniE4RfV44sB9ld+zTqK1XSF7rSoJxojHbJihNsv7oFuGo0A0W9O2QUhA28Tk1NRikPbIIIBRKtXNXa1eYlTHB78YNYMZXurnNN7m0fjAr9erQ7WvaShq26mI45BMyBVnz765iT93KnE544H5NZd/1P72ne54nGIx4ffeVG09qNqW9LWryhXP88Ww6Js/c5NyBTHmJQneojLRZOHJFEaJU4oiJuKUrsCwSjekRYs1f0nX1NBzOhnqYV9wfo/pr5nKxjE15wfAHoj2cnXUhwZKcrjyGxvqh+Hc8mZwtswf9w== x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123560025)(20161123562025)(20161123555025)(6072148); SRVR:DF4PR84MB0139; BCL:0; PCL:0; RULEID:; SRVR:DF4PR84MB0139; x-forefront-prvs: 018577E36E x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39410400002)(39860400002)(39840400002)(39450400003)(39850400002)(377454003)(199003)(189002)(24454002)(13464003)(54356999)(76176999)(50986999)(81156014)(4326007)(3280700002)(33656002)(81166006)(101416001)(8676002)(2906002)(8936002)(2501003)(7696004)(5660300001)(122556002)(74316002)(2900100001)(2950100002)(92566002)(9686003)(7736002)(6306002)(86362001)(305945005)(97736004)(189998001)(3660700001)(6436002)(68736007)(66066001)(55016002)(6506006)(105586002)(6116002)(77096006)(38730400001)(229853002)(3846002)(5001770100001)(106356001)(106116001)(102836003); DIR:OUT; SFP:1102; SCL:1; SRVR:DF4PR84MB0139; H:DF4PR84MB0140.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2017 08:15:49.5552 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR84MB0139 Subject: Re: [PATCH v2] Nt32Pkg: Fix code to correctly set SMBIOS Type 2 Length X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2017 08:15:52 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Star, Yes, please help push the patches. This one, and the following with subjec= t: MdePkg: Add comments for SMBIOS Type 3 structure to cover SKU Number ShellPkg: Update smbiosview command to display Type 3 values Nt32Pkg: Fixes to correctly set SMBIOS Type 3 Thanks, Chris -----Original Message----- From: Zeng, Star [mailto:star.zeng@intel.com]=20 Sent: Wednesday, January 11, 2017 4:08 AM To: Phillips, Chris J (Plano, TX) ; edk2-devel@lists.01.org Cc: Ni, Ruiyu ; star.zeng@intel.com Subject: Re: [edk2] [PATCH v2] Nt32Pkg: Fix code to correctly set SMBIOS Ty= pe 2 Length Chris, Since no other comments received, do you need me to help push the SMBIOS re= lated patches? Thanks, Star On 2017/1/11 9:36, Zeng, Star wrote: > Reviewed-by: Star Zeng > > -----Original Message----- > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of=20 > Chris Phillips > Sent: Wednesday, January 11, 2017 12:49 AM > To: edk2-devel@lists.01.org > Cc: Ni, Ruiyu > Subject: [edk2] [PATCH v2] Nt32Pkg: Fix code to correctly set SMBIOS=20 > Type 2 Length > > When running Nt32Pkg, SMBIOS Type 2 had the wrong Length. > Fixed the code to use the correct structure in sizeof, and properly accou= nt for ContainedObjectHandles. > Also updated variable names with Assert -> Asset > > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Chris Phillips > --- > .../MiscBaseBoardManufacturerFunction.c | 32 +++++++++++++---= ------ > 1 file changed, 19 insertions(+), 13 deletions(-) > > diff --git=20 > a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c=20 > b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c > index 303726c3fd..765627a8e6 100644 > ---=20 > a/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction.c > +++ b/Nt32Pkg/MiscSubClassPlatformDxe/MiscBaseBoardManufacturerFunction. > +++ c > @@ -3,6 +3,7 @@ > SMBIOS type 2. > > Copyright (c) 2009 - 2011, Intel Corporation. All rights=20 > reserved.
> +(C) Copyright 2017 Hewlett Packard Enterprise Development LP
> This program and the accompanying materials are licensed and made avail= able under the terms and conditions of the BSD License which accompanies t= his distribution. The full text of the license may be found at @@ -31,7 +3= 2,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 =3D STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG); > - AssertTag =3D HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet,=20 > NULL); > - AssertTagStrLen =3D StrLen(AssertTag); > - if (AssertTagStrLen > SMBIOS_STRING_MAX_LENGTH) { > + AssetTag =3D HiiGetPackageString(&gEfiCallerIdGuid, TokenToGet,=20 > + NULL); AssetTagStrLen =3D StrLen(AssetTag); if (AssetTagStrLen > > + SMBIOS_STRING_MAX_LENGTH) { > return EFI_UNSUPPORTED; > } > > @@ -101,11 +102,16 @@ MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacture= r) > // > // Two zeros following the last string. > // > - SmbiosRecord =3D AllocatePool(sizeof (SMBIOS_TABLE_TYPE3) +=20 > ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen +=20 > 1 + AssertTagStrLen + 1 + ChassisStrLen +1 + 1); > - ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE3) + ManuStrLen + 1=20 > + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 +=20 > AssertTagStrLen + 1 + ChassisStrLen +1 + 1); > + // Since we fill NumberOfContainedObjectHandles =3D 0, remove sizeof > + (UINT16) bytes for ContainedObjectHandles[1] // SmbiosRecord =3D=20 > + AllocatePool(sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16) +=20 > + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen=20 > + + > + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1);=20 > + ZeroMem(SmbiosRecord, sizeof (SMBIOS_TABLE_TYPE2) - sizeof (UINT16)=20 > + + ManuStrLen + 1 + ProductStrLen + 1 + VerStrLen + 1 +=20 > + SerialNumStrLen + > + 1 + AssetTagStrLen + 1 + ChassisStrLen + 1 + 1); > > SmbiosRecord->Hdr.Type =3D EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION; > - SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); > + // > + // Since we fill NumberOfContainedObjectHandles =3D 0, remove sizeof > + (UINT16) bytes for ContainedObjectHandles[1] // > + SmbiosRecord->Hdr.Length =3D 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 =3D 4; > // > - // AssertTag will be the 5th optional string following the formatted s= tructure. > + // AssetTag will be the 5th optional string following the formatted st= ructure. > // > SmbiosRecord->AssetTag =3D 5; > > @@ -142,15 +148,15 @@=20 > MISC_SMBIOS_TABLE_FUNCTION(MiscBaseBoardManufacturer) > > OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); > // > - // Since we fill NumberOfContainedObjectHandles =3D 0 for simple,=20 > just after this filed to fill string > + // Since we fill NumberOfContainedObjectHandles =3D 0, just after=20 > + this field to fill string > // > - OptionalStrStart -=3D 2; > + OptionalStrStart -=3D sizeof (UINT16); > UnicodeStrToAsciiStr(Manufacturer, OptionalStrStart); > UnicodeStrToAsciiStr(Product, OptionalStrStart + ManuStrLen + 1); > UnicodeStrToAsciiStr(Version, OptionalStrStart + ManuStrLen + 1 + Prod= uctStrLen + 1); > UnicodeStrToAsciiStr(SerialNumber, OptionalStrStart + ManuStrLen +=20 > 1 + ProductStrLen + 1 + VerStrLen + 1); > - UnicodeStrToAsciiStr(AssertTag, OptionalStrStart + ManuStrLen + 1 +=20 > ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1); > - UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 +=20 > ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 +=20 > AssertTagStrLen + 1); > + UnicodeStrToAsciiStr(AssetTag, OptionalStrStart + ManuStrLen + 1 +=20 > + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1);=20 > + UnicodeStrToAsciiStr(Chassis, OptionalStrStart + ManuStrLen + 1 +=20 > + ProductStrLen + 1 + VerStrLen + 1 + SerialNumStrLen + 1 +=20 > + AssetTagStrLen + 1); > // > // Now we have got the full smbios record, call smbios protocol to add= this record. > // > -- > 2.11.0.windows.1 > > > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel >