From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web10.14022.1632622190760133094 for ; Sat, 25 Sep 2021 19:09:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=RNnTv/7R; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: ray.ni@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10118"; a="224363943" X-IronPort-AV: E=Sophos;i="5.85,322,1624345200"; d="scan'208";a="224363943" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2021 19:09:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,322,1624345200"; d="scan'208";a="706010798" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga005.fm.intel.com with ESMTP; 25 Sep 2021 19:09:49 -0700 Received: from fmsmsx607.amr.corp.intel.com (10.18.126.87) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sat, 25 Sep 2021 19:09:49 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx607.amr.corp.intel.com (10.18.126.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Sat, 25 Sep 2021 19:09:48 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Sat, 25 Sep 2021 19:09:48 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.12; Sat, 25 Sep 2021 19:09:48 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BwWphzoz8mUHaA18tOq3UBSMq8efY34jj9CAPkm1zLpYq6/o9RnCwur/VbgZMl77Xg8rpXhFdzbEbwnP/u+WZha9CfousPVo21ZbPnwqc2hdjbFIEo6et5NlfH5ctwGX+o5qTgeQqmY6tbCfVeRz85rnKAhYLQ9MO9ZGdBEibl/4wGExkq0oRQCHCvrnbVH07IzLJ615DYs27fLwxHqDYaNIbsDsqZIR8ds8qciEnyxg6BKqevCDglR0kfHm3fKhw9W67pKRnCogP5wHx/+di2H3pbNtncfVGgV0JNUv9paSLfLBoFPVT72qJLFMUjOWEa4JM//EogutwM6pD2hMVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=DCJStfpHhRYyyuTy5y5Bim704flg3sQ+dSlr8z9WFcE=; b=T3oFeLLhesyjoZKOj2Ct2K2dm65tpzP3RfUf4dnYFauW3b4xkG/ptXpdM711p1+yW7GnckCGKoEQy+I2wIyPVg9a/m00IVLKCcK3jX5JlsvftFFn8v9bxr9Yby87TUKJLlgamwnAAMQR+ec0DZ5vZpS/4BQLmSjDORIRjX6anEGCZSwRim5p46lU/mnC/0e67bULZC4aaVuyYxY03ngvMQ4ff/voim3svGSByWR0hjpB9SDWQZZrkkbOeK1q0k0fITangBBKLu8YqBRM4YAE5+O754LG180vty7CDEDRPyj8ukewOyErwLjqN/KmpPzozDAD/I/h86QbR4Ma8UaZGQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DCJStfpHhRYyyuTy5y5Bim704flg3sQ+dSlr8z9WFcE=; b=RNnTv/7RsxwPOAKJoL1Nz/BClK7UypA301H7uJFQxXxgGTN7ts7HWAt3n7RLNSgFTs/Fcn3ib6Tjk2h7I1Coxx3wZRqRQkrG0dWZFXNOGd8xJuGCzTbkvq9igef8Ltlul7rQh/XllhcgjoFHZshSVZvz1AQ0O3ABF3MprplkjNg= Received: from CY4PR1101MB2072.namprd11.prod.outlook.com (2603:10b6:910:1d::15) by CY4PR1101MB2197.namprd11.prod.outlook.com (2603:10b6:910:18::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.18; Sun, 26 Sep 2021 02:09:47 +0000 Received: from CY4PR1101MB2072.namprd11.prod.outlook.com ([fe80::7dc5:34b5:bbff:832f]) by CY4PR1101MB2072.namprd11.prod.outlook.com ([fe80::7dc5:34b5:bbff:832f%8]) with mapi id 15.20.4544.021; Sun, 26 Sep 2021 02:09:47 +0000 From: "Ni, Ray" To: "Dong, Guo" , "devel@edk2.groups.io" CC: "Ma, Maurice" , "You, Benjamin" , "Tan, Dun" Subject: Re: [`edk2-devel][PATCH v2] UefiPayloadPkg: Add ".upld_info" in universal payload Thread-Topic: [`edk2-devel][PATCH v2] UefiPayloadPkg: Add ".upld_info" in universal payload Thread-Index: AQHXsmLOWtSGVU5Wn0SWEnO6qoXRkKu1kgGw Date: Sun, 26 Sep 2021 02:09:47 +0000 Message-ID: References: <20210925231211.221-1-guo.dong@intel.com> In-Reply-To: <20210925231211.221-1-guo.dong@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0091af30-e85d-4b41-b8f9-08d98092b724 x-ms-traffictypediagnostic: CY4PR1101MB2197: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:240; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: RRM82RfnWB/dBZ9nvKghrH6c0hTMTrD/gohvbhCd6pPO5WsTv5B07iZXr45g6ztGle/ZK2IfnEpn/xSKQcurY7apJON18hyQ9dIzoeYdbSE4h4QiD4WBsAU1A7KKGd27AmCFypQMOpwRdO2Cas25uvA0VFsig2tkCJFnnMWF+NR8f6opRnWxX+SEeO3EWNIO3VBdm7FpqHU/4mwPzGN6DldLanSLI8yMzJp7KaOF+it7Yc0VsMpJs8hVLxGhmdA5XYbvYY5Ec0pjfy+a6YuDftrSr/Ovu31Py+NH+VXuHnc8w8Hlm70t3Zs7wwa6KuTWv7Kb6axqtohbM9PcVw0Rt8g+Qt2dQwK0TIlV++mxepbusPinqmHrG3Wrjq46pPYdS/qDejqolLfJyQMirfEcAegQTNqDbp8OLc9lL/qK/J6nbI+8S1sT/j6DPJnkqZrKBmZASnEhWhBY3UM3yTb3awhJBhhhlXbxpqcLafkTqohfx3LhJSAyOFEswllMLlbX0hDsQisArzgzYx0I/9lO77ukxGAKzjW2ud+dJBaIebC/BSMsq0ewPIbX2Mo/Pc6tPG3ldDqZAT9m4/PGM8lM+GqFY23Ytt3FWG3G81AEf0+Msn1dLUmWzCnMGC+GvJY1K7h+ZYVpd3piIsJF1JRBhV4HJcQwiYsN8FZ7JiaYsX+Cul6vCnEFRmYWz9cXH5UfwrbXVohsn2W+NcYInW3BE70WiUy767gGtsPyTJWZtsw= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CY4PR1101MB2072.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(110136005)(66446008)(26005)(2906002)(64756008)(76116006)(66946007)(66476007)(9686003)(38100700002)(54906003)(122000001)(7696005)(66556008)(8676002)(8936002)(71200400001)(186003)(508600001)(316002)(107886003)(83380400001)(86362001)(4326008)(38070700005)(52536014)(5660300002)(55016002)(6506007)(53546011)(33656002)(81973001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0sftoIR4EUtV+SvLi+PV5/HVeN98KfZpI+B+ukAR0lu8jx2CN5YRqH4Xq2Ia?= =?us-ascii?Q?K0oX0U0mGrMVut70wevVzPyAlHrmzG/+AEj4vxx2ghqq9TlXWvTRfbq7P2W2?= =?us-ascii?Q?KBl4pZ6OxkEXZItVsD0auYPeyBWzfyYhJqOosB0V8ZiD0VaQa08oHzT7AFaw?= =?us-ascii?Q?Nj+RkuMIwjO1SHCkng3ott5me29kA672OaMKYHatBottDTuAAVPghWasSr73?= =?us-ascii?Q?AVlwyuV1nLDiGIFIQkvV1X//gJIr2+ENhJy+VGwmx/gc9J09cgAwxwzVqAWV?= =?us-ascii?Q?OLDFzhH7nJZbMzPjpu/LOiYTGVHeCK31c3ZYx1r9G1PwybVES+0fpG4iNr+Z?= =?us-ascii?Q?OdtjZEzplAH1vGqz4dnl3hJax4k3Wj7A5xgiLhegviW/6fBvSDU5GyMSTdP5?= =?us-ascii?Q?o5UrxCCfIleS9c+mSZwY3h2yB5S/uXQvea3nacQezAyKAU5QCCY1AfvcQicE?= =?us-ascii?Q?xCe38uZZbnHabQUyXbCVp+szXZRWkC2oL/bz1kwbHCofGIsdZSs6M4zZ4j1G?= =?us-ascii?Q?12yOqJHwvLG1dT5GiSFRa0+/LS309GtY7+oVnUJkDlW2BpPvrob6cumJIsmx?= =?us-ascii?Q?Efvg6sKVb+4Dpfw1du3istg8nS4CiWi4mZJVJMo41oNfA1B746D5MhA5QDr+?= =?us-ascii?Q?Qp6djowBMVMvVPTd583uIDzGMDV7WosX5gLiNckdPbyNDMOnWQ61xC8S/OiS?= =?us-ascii?Q?cbBrA1/kM0xSOSLkQ27125zztKEzrgkjvJxdrOR2Q7xcvG/OSAu1VCIPr//Y?= =?us-ascii?Q?uo/Ep6jLdtNOq4cajBYhcHMa895hdPVy0gWAtAukMmf9rJm8AltgM2PPudFE?= =?us-ascii?Q?nmyPiuuihXYr2kaRBNtUtiV5k1KpMzZ+bRgZ6joJtcT27IcQdfNdYOmaLMw7?= =?us-ascii?Q?8QUWUNuw946DQEeruKR2EzxC6RvbUI0EDvnpkbyS9nmCuTiAHI0jCYJRR+hw?= =?us-ascii?Q?zhL92hO93PlS4FM9mqUSZpQEzYKPwHSg3P0XzLYdsXF3kj1sux4s6Jn/K75g?= =?us-ascii?Q?LWo0okHAukOoh/dEaGK4J29zzxI9tvIshDyqXoz/TVn/xdxm+ksLB8shPH5G?= =?us-ascii?Q?eLW6xx2SQIFn5h5BjtmwUBcwbLGcgVWZZbzu8S6lR8zKKa3IhDqEzb7nD//A?= =?us-ascii?Q?FI583xwlBe6sUhkOgfQ3Xw3f1JHS4Y4548+v0BLqlaDi90czIReNqHtpzteL?= =?us-ascii?Q?Rk5MtgA9liTrV8ZYfPTDFwV17FGJlmzfGxRUW+cb+4AtV50f9hoam3PAoWme?= =?us-ascii?Q?EWASTt7cjwNegNlnzpJMkUv47A9zCWq+IH0Bd1j/G1Bom5ICCJCfi9vXua9A?= =?us-ascii?Q?QabbtPbL7PIpm4ABTwRdEcpu?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CY4PR1101MB2072.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0091af30-e85d-4b41-b8f9-08d98092b724 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Sep 2021 02:09:47.4804 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: xC0l3EcywjEWcBFCG1pGG3K+6tz8FK4JSMCzRN1u27x6MtTqBDBNZ9jgtBJH7yo3z4lIgVMqD6Yxtym7WUSQEg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1101MB2197 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni Dun, any comments? -----Original Message----- From: Dong, Guo =20 Sent: Sunday, September 26, 2021 7:12 AM To: devel@edk2.groups.io Cc: Dong, Guo ; Ni, Ray ; Ma, Maurice= ; You, Benjamin Subject: [`edk2-devel][PATCH v2] UefiPayloadPkg: Add ".upld_info" in univer= sal payload From: Guo Dong V2: Use LittleEndianStructure by review comment. >>From the universal scalable firmware payload requirement V0.75, Payload must have Universal Payload Information Section ".upld_info" So update the build tool to add this section. Cc: Ray Ni Cc: Maurice Ma Cc: Benjamin You Signed-off-by: Guo Dong --- UefiPayloadPkg/UniversalPayloadBuild.py | 42 +++++++++++++++++++++++++++++= ++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/UefiPayloadPkg/UniversalPayloadBuild.py b/UefiPayloadPkg/Unive= rsalPayloadBuild.py index b78c6a7620..e624ec5874 100644 --- a/UefiPayloadPkg/UniversalPayloadBuild.py +++ b/UefiPayloadPkg/UniversalPayloadBuild.py @@ -10,6 +10,31 @@ import subprocess import os import shutil import sys +from ctypes import * + +sys.dont_write_bytecode =3D True + +class UPLD_INFO_HEADER(LittleEndianStructure): + _pack_ =3D 1 + _fields_ =3D [ + ('Identifier', ARRAY(c_char, 4)), + ('HeaderLength', c_uint32), + ('SpecRevision', c_uint16), + ('Reserved', c_uint16), + ('Revision', c_uint32), + ('Attribute', c_uint32), + ('Capability', c_uint32), + ('ProducerId', ARRAY(c_char, 16)), + ('ImageId', ARRAY(c_char, 16)), + ] + + def __init__(self): + self.Identifier =3D b'UPLD' + self.HeaderLength =3D sizeof(UPLD_INFO_HEADER) + self.HeaderRevision =3D 0x0075 + self.Revision =3D 0x0000010105 + self.ImageId =3D b'UEFI' + self.ProducerId =3D b'INTEL' =20 def RunCommand(cmd): print(cmd) @@ -37,6 +62,7 @@ def BuildUniversalPayload(Args, MacroList): EntryOutputDir =3D os.path.join(BuildDir, f"{BuildTarget}_{ElfToolChai= n}", os.path.normpath("X64/UefiPayloadPkg/UefiPayloadEntry/UniversalPayload= Entry/DEBUG/UniversalPayloadEntry.dll")) PayloadReportPath =3D os.path.join(BuildDir, "UefiUniversalPayload.txt= ") ModuleReportPath =3D os.path.join(BuildDir, "UefiUniversalPayloadEntry= .txt") + UpldInfoFile =3D os.path.join(BuildDir, "UniversalPayloadInfo.bin") =20 if "CLANG_BIN" in os.environ: LlvmObjcopyPath =3D os.path.join(os.environ["CLANG_BIN"], "llvm-ob= jcopy") @@ -65,12 +91,21 @@ def BuildUniversalPayload(Args, MacroList): BuildModule +=3D Defines RunCommand(BuildModule) =20 + # + # Buid Universal Payload Information Section ".upld_info" + # + upld_info_hdr =3D UPLD_INFO_HEADER() + upld_info_hdr.ImageId =3D Args.ImageId.encode()[:16] + fp =3D open(UpldInfoFile, 'wb') + fp.write(bytearray(upld_info_hdr)) + fp.close() + # # Copy the DXEFV as a section in elf format Universal Payload entry. # - remove_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --remove-sect= ion .upld.uefi_fv %s'%(LlvmObjcopyPath, EntryOutputDir) - add_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --add-section .u= pld.uefi_fv=3D%s %s'%(LlvmObjcopyPath, FvOutputDir, EntryOutputDir) - set_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --set-section-al= ignment .upld.uefi_fv=3D16 %s'%(LlvmObjcopyPath, EntryOutputDir) + remove_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --remove-sect= ion .upld_info --remove-section .upld.uefi_fv %s'%(LlvmObjcopyPath, EntryOu= tputDir) + add_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --add-section= .upld_info=3D%s --add-section .upld.uefi_fv=3D%s %s'%(LlvmObjcopyPath, Upl= dInfoFile, FvOutputDir, EntryOutputDir) + set_section =3D '"%s" -I elf64-x86-64 -O elf64-x86-64 --set-section= -alignment .upld.upld_info=3D16 --set-section-alignment .upld.uefi_fv=3D16 = %s'%(LlvmObjcopyPath, EntryOutputDir) RunCommand(remove_section) RunCommand(add_section) RunCommand(set_section) @@ -82,6 +117,7 @@ def main(): parser.add_argument('-t', '--ToolChain') parser.add_argument('-b', '--Target', default=3D'DEBUG') parser.add_argument("-D", "--Macro", action=3D"append", default=3D["UN= IVERSAL_PAYLOAD=3DTRUE"]) + parser.add_argument('-i', '--ImageId', type=3Dstr, help=3D'Specify pay= load ID (16 bytes maximal).', default =3D'UEFI') MacroList =3D {} args =3D parser.parse_args() if args.Macro is not None: --=20 2.32.0.windows.2