From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: zhichao.gao@intel.com) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by groups.io with SMTP; Thu, 16 May 2019 17:08:13 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 May 2019 17:08:12 -0700 X-ExtLoop1: 1 Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 16 May 2019 17:08:12 -0700 Received: from fmsmsx112.amr.corp.intel.com (10.18.116.6) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 16 May 2019 17:08:12 -0700 Received: from shsmsx108.ccr.corp.intel.com (10.239.4.97) by FMSMSX112.amr.corp.intel.com (10.18.116.6) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 16 May 2019 17:08:11 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.129]) by SHSMSX108.ccr.corp.intel.com ([169.254.8.126]) with mapi id 14.03.0415.000; Fri, 17 May 2019 08:08:09 +0800 From: "Gao, Zhichao" To: Krzysztof Koch , "devel@edk2.groups.io" CC: "Carsey, Jaben" , "Ni, Ray" , "Sami.Mujawar@arm.com" , "nd@arm.com" Subject: Re: [PATCH v2 1/1] ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser Thread-Topic: [PATCH v2 1/1] ShellPkg: acpiview: Add GT Frame Number validation to GTDT parser Thread-Index: AQHVC8OKrf+KG2PzEU2+IpEmdPrcdaZucTKQ Date: Fri, 17 May 2019 00:08:08 +0000 Message-ID: <3CE959C139B4C44DBEA1810E3AA6F9000B7D374D@SHSMSX101.ccr.corp.intel.com> References: <20190516084335.33928-1-krzysztof.koch@arm.com> In-Reply-To: <20190516084335.33928-1-krzysztof.koch@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Return-Path: zhichao.gao@intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Zhichao Gao > -----Original Message----- > From: Krzysztof Koch [mailto:krzysztof.koch@arm.com] > Sent: Thursday, May 16, 2019 4:44 PM > To: devel@edk2.groups.io > Cc: Carsey, Jaben ; Ni, Ray ; > Gao, Zhichao ; Sami.Mujawar@arm.com; > nd@arm.com > Subject: [PATCH v2 1/1] ShellPkg: acpiview: Add GT Frame Number validatio= n > to GTDT parser >=20 > The ACPI 6.2 specification mandates that the Generic Timer (GT) Block Tim= er > Structures must have a frame number in the range 0-7. >=20 > Update the GTDT parser to warn if this condition is violated. >=20 > Signed-off-by: Krzysztof Koch > --- >=20 > The changes can be seen at: > https://github.com/KrzysztofKoch1/edk2/tree/528_acpiview_gt_frame_vali > date_v2 >=20 > Notes: > v2: > - Change FrameNumber data type to UINT8 [Zhichao] > - Modify the patch based on upstream review [Krzysztof] >=20 > ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c > | 47 +++++++++++++++++++- > 1 file changed, 45 insertions(+), 2 deletions(-) >=20 > diff --git > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser > .c > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser > .c > index > f31c4a2761751c58d4b1d3eb75084e24ec318e7f..1b7e56486c8fb98a8fe063ae5f > a25d86500a58a9 100644 > --- > a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser > .c > +++ > b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtPars > +++ er.c > @@ -1,7 +1,7 @@ > /** @file > GTDT table parser >=20 > - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. > + Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. > SPDX-License-Identifier: BSD-2-Clause-Patent >=20 > @par Reference(s): > @@ -38,6 +38,21 @@ ValidateGtBlockTimerCount ( > IN VOID* Context > ); >=20 > +/** > + This function validates the GT Frame Number. > + > + @param [in] Ptr Pointer to the start of the field data. > + @param [in] Context Pointer to context specific information e.g. this > + could be a pointer to the ACPI table header. > +**/ > +STATIC > +VOID > +EFIAPI > +ValidateGtFrameNumber ( > + IN UINT8* Ptr, > + IN VOID* Context > + ); > + > /** > An ACPI_PARSER array describing the ACPI GTDT Table. > **/ > @@ -92,7 +107,7 @@ STATIC CONST ACPI_PARSER GtBlockParser[] =3D { > An ACPI_PARSER array describing the GT Block timer. > **/ > STATIC CONST ACPI_PARSER GtBlockTimerParser[] =3D { > - {L"Frame Number", 1, 0, L"%d", NULL, NULL, NULL, NULL}, > + {L"Frame Number", 1, 0, L"%d", NULL, NULL, ValidateGtFrameNumber, > + NULL}, > {L"Reserved", 3, 1, L"%x %x %x", Dump3Chars, NULL, NULL, NULL}, > {L"Physical address (CntBaseX)", 8, 4, L"0x%lx", NULL, NULL, NULL, NUL= L}, > {L"Physical address (CntEL0BaseX)", 8, 12, L"0x%lx", NULL, NULL, NULL,= @@ > -145,6 +160,34 @@ ValidateGtBlockTimerCount ( > } > } >=20 > +/** > + This function validates the GT Frame Number. > + > + @param [in] Ptr Pointer to the start of the field data. > + @param [in] Context Pointer to context specific information e.g. this > + could be a pointer to the ACPI table header. > +**/ > +STATIC > +VOID > +EFIAPI > +ValidateGtFrameNumber ( > + IN UINT8* Ptr, > + IN VOID* Context > + ) > +{ > + UINT8 FrameNumber; > + > + FrameNumber =3D *(UINT8*)Ptr; > + > + if (FrameNumber > 7) { > + IncrementErrorCount (); > + Print ( > + L"\nERROR: GT Frame Number =3D %d. GT Frame Number must be in > range 0-7.", > + FrameNumber > + ); > + } > +} > + > /** > This function parses the Platform GT Block. >=20 > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20