From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.120, mailfrom: guo.dong@intel.com) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by groups.io with SMTP; Sun, 22 Sep 2019 19:31:00 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Sep 2019 19:31:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,538,1559545200"; d="scan'208";a="203027851" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga001.fm.intel.com with ESMTP; 22 Sep 2019 19:31:00 -0700 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 22 Sep 2019 19:31:00 -0700 Received: from fmsmsx119.amr.corp.intel.com ([169.254.14.227]) by FMSMSX110.amr.corp.intel.com ([169.254.14.97]) with mapi id 14.03.0439.000; Sun, 22 Sep 2019 19:30:59 -0700 From: "Guo Dong" To: Laszlo Ersek , edk2-devel-groups-io CC: "You, Benjamin" , "Ma, Maurice" Subject: Re: [PATCH 34/35] UefiPayloadPkg/BlSupportPei: fix MMCONFIG assignment from XSDT Thread-Topic: [PATCH 34/35] UefiPayloadPkg/BlSupportPei: fix MMCONFIG assignment from XSDT Thread-Index: AQHVbZE8o6Jo6GN6nUis+HyGRdgTJKc4kqwg Date: Mon, 23 Sep 2019 02:30:59 +0000 Message-ID: <0DE6ECBAEEB99B4DA9564FF580F3580A498EE281@FMSMSX119.amr.corp.intel.com> References: <20190917194935.24322-1-lersek@redhat.com> <20190917194935.24322-35-lersek@redhat.com> In-Reply-To: <20190917194935.24322-35-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzVlMTRlZjctN2JjOS00MjE4LTliYzItOTY0ODBlNGIxZThmIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiUkRkRkdkNzNobkhSVDcrTDMwd2lzQ2d0bVdyNlVzSFI3NHB4bkNJSGhTaFNBRlJ3TWtyMjhQR0tjUFJzUTZpUyJ9 dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action x-originating-ip: [10.1.200.106] MIME-Version: 1.0 Return-Path: guo.dong@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It looks good to me. Reviewed-by: Guo Dong > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Tuesday, September 17, 2019 12:50 PM > To: edk2-devel-groups-io > Cc: You, Benjamin ; Dong, Guo > ; Ma, Maurice > Subject: [PATCH 34/35] UefiPayloadPkg/BlSupportPei: fix MMCONFIG > assignment from XSDT >=20 > (This patch is unrelated to the rest of this series; its purpose is to en= able > building the UefiPayloadPkg DSC files with GCC.) >=20 > When building "UefiPayloadPkg/UefiPayloadPkgIa32.dsc" with GCC48 for the > DEBUG target, the compiler reports that "Entry32" may be used uninitializ= ed > in ParseAcpiInfo(), in the XSDT branch. >=20 > Code inspection proves the compiler right. In the XSDT branch, the code f= rom > the RSDT branch must have been duplicated, and "Entry32" references were > replaced with "Entry64" -- except where "MmCfgHdr" is assigned. >=20 > Fix this bug by introducing a helper variable called "Signature", so that= we > have to refer to "Entry32" or "Entry64" only once per loop body. >=20 > Cc: Benjamin You > Cc: Guo Dong > Cc: Maurice Ma > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > build-tested only >=20 > UefiPayloadPkg/BlSupportPei/BlSupportPei.c | 19 +++++++++++-------- > 1 file changed, 11 insertions(+), 8 deletions(-) >=20 > diff --git a/UefiPayloadPkg/BlSupportPei/BlSupportPei.c > b/UefiPayloadPkg/BlSupportPei/BlSupportPei.c > index 90433b609f22..22972453117a 100644 > --- a/UefiPayloadPkg/BlSupportPei/BlSupportPei.c > +++ b/UefiPayloadPkg/BlSupportPei/BlSupportPei.c > @@ -164,6 +164,7 @@ ParseAcpiInfo ( > UINT64 *Entry64; > UINTN Entry64Num; > UINTN Idx; > + UINT32 *Signature; >=20 > EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_HE > ADER *MmCfgHdr; >=20 > EFI_ACPI_MEMORY_MAPPED_ENHANCED_CONFIGURATION_SPACE_BASE_ > ADDRESS_ALLOCATION_STRUCTURE *MmCfgBase; >=20 > @@ -181,13 +182,14 @@ ParseAcpiInfo ( > Entry32 =3D (UINT32 *)(Rsdt + 1); > Entry32Num =3D (Rsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) > >> 2; > for (Idx =3D 0; Idx < Entry32Num; Idx++) { > - if (*(UINT32 *)(UINTN)(Entry32[Idx]) =3D=3D > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE > *)(UINTN)(Entry32[Idx]); > + Signature =3D (UINT32 *)(UINTN)Entry32[Idx]; > + if (*Signature =3D=3D > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature; > DEBUG ((DEBUG_INFO, "Found Fadt in Rsdt\n")); > } >=20 > - if (*(UINT32 *)(UINTN)(Entry32[Idx]) =3D=3D > EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE > _BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { > - MmCfgHdr =3D > (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_H > EADER *)(UINTN)(Entry32[Idx]); > + if (*Signature =3D=3D > EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE > _BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { > + MmCfgHdr =3D > + > (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_H > EADER > + *)Signature; > DEBUG ((DEBUG_INFO, "Found MM config address in Rsdt\n")); > } >=20 > @@ -205,13 +207,14 @@ ParseAcpiInfo ( > Entry64 =3D (UINT64 *)(Xsdt + 1); > Entry64Num =3D (Xsdt->Length - sizeof(EFI_ACPI_DESCRIPTION_HEADER)) > >> 3; > for (Idx =3D 0; Idx < Entry64Num; Idx++) { > - if (*(UINT32 *)(UINTN)(Entry64[Idx]) =3D=3D > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > - Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE > *)(UINTN)(Entry64[Idx]); > + Signature =3D (UINT32 *)(UINTN)Entry64[Idx]; > + if (*Signature =3D=3D > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE) { > + Fadt =3D (EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE *)Signature; > DEBUG ((DEBUG_INFO, "Found Fadt in Xsdt\n")); > } >=20 > - if (*(UINT32 *)(UINTN)(Entry64[Idx]) =3D=3D > EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE > _BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { > - MmCfgHdr =3D > (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_H > EADER *)(UINTN)(Entry32[Idx]); > + if (*Signature =3D=3D > EFI_ACPI_5_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE > _BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE) { > + MmCfgHdr =3D > + > (EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_BASE_ADDRESS_TABLE_H > EADER > + *)Signature; > DEBUG ((DEBUG_INFO, "Found MM config address in Xsdt\n")); > } >=20 > -- > 2.19.1.3.g30247aa5d201 >=20