From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 3E3DA941DE0 for ; Mon, 2 Oct 2023 17:16:19 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=q9Sgl3pEY8gma77+2TcsfYKqC29Msnfu6pjHjuG9y4U=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1696266977; v=1; b=G9OIFRT0IGP4Rv5D3Z6Rmum4Yj6QuLFiGAra/27kngNGd/PRxtaTtVig77f1AsXvSh0+Dark 9TuHk+dZbNdfIpoXydK10bm94TJgV6w14PwjHS/hYKMsLC2kDL5SmikItR8zV/fkwtOJVvr2H51 6eWsdiKdVLjTs99CPtnT7z7Y= X-Received: by 127.0.0.2 with SMTP id RQ7JYY7687511xP8lgWbIMSZ; Mon, 02 Oct 2023 10:16:17 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.88246.1696266977055970223 for ; Mon, 02 Oct 2023 10:16:17 -0700 X-Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1A877C15; Mon, 2 Oct 2023 10:16:55 -0700 (PDT) X-Received: from usa.arm.com (iss-desktop03.cambridge.arm.com [10.1.196.33]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8937C3F59C; Mon, 2 Oct 2023 10:16:15 -0700 (PDT) From: "Rohit Mathew" To: devel@edk2.groups.io Cc: Rohit Mathew , James Morse , Sami Mujawar , Thomas Abraham , Zhichao Gao Subject: [edk2-devel] [PATCH v5 2/6] ShellPkg/AcpiView: Update field-validator prototype Date: Mon, 2 Oct 2023 18:15:50 +0100 Message-Id: <20231002171550.901005-1-Rohit.Mathew@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,rohit.mathew@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: i2NFone2h9jhPzzqeXHoKv4Lx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=G9OIFRT0; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io As of now, the field-validator implemented by FNPTR_FIELD_VALIDATOR function pointer takes two parameters, the pointer to the field and a context pointer. For cases where the validator has to have access to the length of the field, there is no clean way to currently do it. In order to resolve this, this commit updates the field-validator's prototype to take the length of the field as a third parameter. This enhancement allows field validators to perform more comprehensive validation, especially when the length of the field is critical to the validation logic. This change should improve the overall robustness and flexibility of AcpiView. Signed-off-by: Rohit Mathew Cc: James Morse Cc: Sami Mujawar Cc: Thomas Abraham Cc: Zhichao Gao --- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c |= 6 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h |= 5 +- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParser.c |= 32 +++++++---- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parser.c |= 8 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParser.c |= 20 ++++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParser.c |= 20 ++++--- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParser.c |= 14 +++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParser.c |= 8 +-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c |= 32 +++++++---- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParser.c |= 14 +++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParser.c |= 56 +++++++++++++------- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParser.c |= 38 ++++++++----- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParser.c |= 14 +++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParser.c |= 14 +++-- ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParser.c |= 14 +++-- 15 files changed, 190 insertions(+), 105 deletions(-) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c index eac9286176..6823ba60cf 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.c @@ -1,7 +1,7 @@ /** @file ACPI parser =20 - Copyright (c) 2016 - 2021, Arm Limited. All rights reserved. + Copyright (c) 2016 - 2023, Arm Limited. All rights reserved. Copyright (c) 2022, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -616,7 +616,7 @@ ParseAcpi ( if (GetConsistencyChecking () && (Parser[Index].FieldValidator !=3D NULL)) { - Parser[Index].FieldValidator (Ptr, Parser[Index].Context); + Parser[Index].FieldValidator (Ptr, Parser[Index].Context, Parser= [Index].Length); } =20 Print (L"\n"); @@ -927,7 +927,7 @@ ParseAcpiBitFields ( if (GetConsistencyChecking () && (Parser[Index].FieldValidator !=3D NULL)) { - Parser[Index].FieldValidator ((UINT8 *)&Data, Parser[Index].Cont= ext); + Parser[Index].FieldValidator ((UINT8 *)&Data, Parser[Index].Cont= ext, Parser[Index].Length); } =20 Print (L"\n"); diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h b/= ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h index 4b4397961b..6d8b44d94a 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/AcpiParser.h @@ -2,7 +2,7 @@ Header file for ACPI parser =20 Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. - Copyright (c) 2016 - 2020, Arm Limited. All rights reserved. + Copyright (c) 2016 - 2023, Arm Limited. All rights reserved. Copyright (c) 2022, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -237,8 +237,9 @@ typedef VOID (EFIAPI *FNPTR_PRINT_FORMATTER)(CONST CH= AR16 *Format, UINT8 *Ptr); @param [in] Context Pointer to context specific information as specifi= ed by the 'Context' member of the ACPI_PARSER. e.g. this could be a pointer to the ACPI table hea= der. + @param [in] Length Length of the field. **/ -typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context); +typedef VOID (EFIAPI *FNPTR_FIELD_VALIDATOR)(UINT8 *Ptr, VOID *Context, = UINT32 Length); =20 /** The ACPI_PARSER structure describes the fields of an ACPI table and diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/Ae= stParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/Ae= stParser.c index 48f71484fb..a37927b107 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Aest/AestParse= r.c @@ -1,7 +1,7 @@ /** @file AEST table parser =20 - Copyright (c) 2020, Arm Limited. + Copyright (c) 2023, Arm Limited. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -35,13 +35,15 @@ STATIC UINT8 *ProcessorResour= ceType; @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateProcessorFlags ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // If the global or shared node flag is set then the ACPI Processor ID @@ -61,13 +63,15 @@ ValidateProcessorFlags ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateGicInterfaceType ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT32 GicInterfaceType; @@ -85,13 +89,15 @@ ValidateGicInterfaceType ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateInterfaceType ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*Ptr > 1) { @@ -106,13 +112,15 @@ ValidateInterfaceType ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateInterruptType ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*Ptr > 1) { @@ -127,13 +135,15 @@ ValidateInterruptType ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateInterruptFlags ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if ((*Ptr & 0xfe) !=3D 0) { diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Db= g2Parser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Db= g2Parser.c index d25d4d84f8..4400b55553 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Dbg2/Dbg2Parse= r.c @@ -1,7 +1,7 @@ /** @file DBG2 table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -32,13 +32,15 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @param [in] Ptr Pointer to the start of the buffer. @param [in] Context Pointer to context specific information e.g. this could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateNameSpaceStrLen ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT16 NameSpaceStrLen; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/Er= stParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/Er= stParser.c index f3ae09309c..f9f08732ca 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Erst/ErstParse= r.c @@ -2,7 +2,7 @@ ERST table parser =20 Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. - Copyright (c) 2016 - 2018, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -72,13 +72,15 @@ STATIC CONST CHAR16 *ErstInstructionTable[] =3D { @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateErstAction ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*Ptr > EFI_ACPI_6_4_ERST_GET_EXECUTE_OPERATION_TIMINGS) { @@ -93,13 +95,15 @@ ValidateErstAction ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateErstInstruction ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*Ptr > EFI_ACPI_6_4_ERST_MOVE_DATA) { @@ -114,13 +118,15 @@ ValidateErstInstruction ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateErstFlags ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if ((*Ptr & 0xfe) !=3D 0) { diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/Fa= dtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/Fa= dtParser.c index abc58d6552..f03b99ebde 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Fadt/FadtParse= r.c @@ -1,7 +1,7 @@ /** @file FADT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. Copyright (c) 2022, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -59,13 +59,15 @@ GetAcpiXsdtHeaderInfo ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateFirmwareCtrl ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -85,13 +87,15 @@ ValidateFirmwareCtrl ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateXFirmwareCtrl ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -111,13 +115,15 @@ ValidateXFirmwareCtrl ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateFlags ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gt= dtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/Gt= dtParser.c index e62927098a..29bd781465 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Gtdt/GtdtParse= r.c @@ -1,7 +1,7 @@ /** @file GTDT table parser =20 - Copyright (c) 2016 - 2021, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -32,13 +32,15 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateGtBlockTimerCount ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT32 BlockTimerCount; @@ -61,13 +63,15 @@ ValidateGtBlockTimerCount ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateGtFrameNumber ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT8 FrameNumber; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/Hm= atParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/Hm= atParser.c index 2a1357c853..de8e9cf01f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Hmat/HmatParse= r.c @@ -1,7 +1,7 @@ /** @file HMAT table parser =20 - Copyright (c) 2020, Arm Limited. + Copyright (c) 2023, Arm Limited. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -56,13 +56,15 @@ STATIC CONST CHAR16 *SllbiNames[] =3D { @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheAttributes ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { EFI_ACPI_6_4_HMAT_STRUCTURE_MEMORY_SIDE_CACHE_INFO_CACHE_ATTRIBUTES * diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Io= rtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/Io= rtParser.c index 599cf0ee8f..122e087eed 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParse= r.c @@ -1,7 +1,7 @@ /** @file IORT table parser =20 - Copyright (c) 2016 - 2022, Arm Limited. All rights reserved. + Copyright (c) 2016 - 2023, Arm Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -48,13 +48,15 @@ STATIC CONST UINT32 *RmrMemDescOffset; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateItsIdMappingCount ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr !=3D 0) { @@ -70,13 +72,15 @@ ValidateItsIdMappingCount ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePmcgIdMappingCount ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr > 1) { @@ -91,13 +95,15 @@ ValidatePmcgIdMappingCount ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateItsIdArrayReference ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr !=3D 0) { @@ -113,13 +119,15 @@ ValidateItsIdArrayReference ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePhysicalRange ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT64 Value; @@ -137,13 +145,15 @@ ValidatePhysicalRange ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateRmrMemDescCount ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr =3D=3D 0) { diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Ma= dtParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/Ma= dtParser.c index 41edcb9ffd..3633329bea 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Madt/MadtParse= r.c @@ -1,7 +1,7 @@ /** @file MADT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. Copyright (c) 2022, AMD Incorporated. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -30,13 +30,15 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateGICDSystemVectorBase ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr !=3D 0) { @@ -53,13 +55,15 @@ ValidateGICDSystemVectorBase ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateSpeOverflowInterrupt ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT16 SpeOverflowInterrupt; diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pc= ctParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/Pc= ctParser.c index 8ad39090af..5d350ae16d 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pcct/PcctParse= r.c @@ -1,7 +1,7 @@ /** @file PCCT table parser =20 - Copyright (c) 2021, Arm Limited. + Copyright (c) 2023, Arm Limited. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -30,13 +30,15 @@ STATIC UINT8 *ExtendedPccSubspaceInterruptFlags; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateRangeLength4 ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr < MIN_EXT_PCC_SUBSPACE_MEM_RANGE_LEN) { @@ -56,13 +58,15 @@ ValidateRangeLength4 ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateRangeLength8 ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT64 *)Ptr <=3D MIN_MEMORY_RANGE_LENGTH) { @@ -82,13 +86,15 @@ ValidateRangeLength8 ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePccMemoryIoGas ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { switch (*(UINT8 *)Ptr) { @@ -109,13 +115,15 @@ ValidatePccMemoryIoGas ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePccGas ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { switch (*(UINT8 *)Ptr) { @@ -137,13 +145,15 @@ ValidatePccGas ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePccDoorbellGas ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // For responder subspaces this field is optional, if not present the = field @@ -158,7 +168,7 @@ ValidatePccDoorbellGas ( } } =20 - ValidatePccGas (Ptr, Context); + ValidatePccGas (Ptr, Context, Length); } =20 /** @@ -168,13 +178,15 @@ ValidatePccDoorbellGas ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePccIntAckGas ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // If the subspace does not support interrupts or the interrupt is @@ -196,7 +208,7 @@ ValidatePccIntAckGas ( } } =20 - ValidatePccGas (Ptr, Context); + ValidatePccGas (Ptr, Context, Length); } =20 /** @@ -205,13 +217,15 @@ ValidatePccIntAckGas ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePccErrStatusGas ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // This field is ignored by the OSPM on responder channels. @@ -219,7 +233,7 @@ ValidatePccErrStatusGas ( return; } =20 - ValidatePccGas (Ptr, Context); + ValidatePccGas (Ptr, Context, Length); } =20 /** @@ -228,13 +242,15 @@ ValidatePccErrStatusGas ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidatePlatInterrupt ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // If a responder subspace is present in the PCCT, then the global Pla= tform diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pp= ttParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/Pp= ttParser.c index 5377764458..a079d2498f 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Pptt/PpttParse= r.c @@ -1,7 +1,7 @@ /** @file PPTT table parser =20 - Copyright (c) 2019 - 2021, ARM Limited. All rights reserved. + Copyright (c) 2019 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -54,13 +54,15 @@ LogCacheFlagError ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheFlags ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -117,13 +119,15 @@ ValidateCacheFlags ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheNumberOfSets ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT32 NumberOfSets; @@ -168,13 +172,15 @@ ValidateCacheNumberOfSets ( @param [in] Ptr Pointer to the start of the field data. @param [in] Context Pointer to context specific information e.g. thi= s could be a pointer to the ACPI table header. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheAssociativity ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT8 Associativity; @@ -194,13 +200,15 @@ ValidateCacheAssociativity ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheLineSize ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -239,13 +247,15 @@ ValidateCacheLineSize ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheId ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT32 CacheId; @@ -278,13 +288,15 @@ ValidateCacheId ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateCacheAttributes ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { // Reference: Advanced Configuration and Power Interface (ACPI) Specif= ication diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/Rs= dpParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/Rs= dpParser.c index bddf276356..8d58392b08 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Rsdp/RsdpParse= r.c @@ -1,7 +1,7 @@ /** @file RSDP table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -21,13 +21,15 @@ STATIC CONST UINT64 *XsdtAddress; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateRsdtAddress ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -57,13 +59,15 @@ ValidateRsdtAddress ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateXsdtAddress ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/Sp= crParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/Sp= crParser.c index e5267b1d04..60522dd408 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Spcr/SpcrParse= r.c @@ -1,7 +1,7 @@ /** @file SPCR table parser =20 - Copyright (c) 2016 - 2019, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -24,13 +24,15 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateInterruptType ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) @@ -57,13 +59,15 @@ ValidateInterruptType ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateIrq ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { #if defined (MDE_CPU_ARM) || defined (MDE_CPU_AARCH64) diff --git a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Sr= atParser.c b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/Sr= atParser.c index 2980704479..76534ccee3 100644 --- a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParse= r.c +++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Srat/SratParse= r.c @@ -1,7 +1,7 @@ /** @file SRAT table parser =20 - Copyright (c) 2016 - 2020, ARM Limited. All rights reserved. + Copyright (c) 2016 - 2023, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent =20 @par Reference(s): @@ -27,13 +27,15 @@ STATIC ACPI_DESCRIPTION_HEADER_INFO AcpiHdrInfo; @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateSratReserved ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { if (*(UINT32 *)Ptr !=3D 1) { @@ -49,13 +51,15 @@ ValidateSratReserved ( @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. + @param [in] Length Length of the field. **/ STATIC VOID EFIAPI ValidateSratDeviceHandleType ( - IN UINT8 *Ptr, - IN VOID *Context + IN UINT8 *Ptr, + IN VOID *Context, + IN UINT32 Length ) { UINT8 DeviceHandleType; --=20 2.34.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109260): https://edk2.groups.io/g/devel/message/109260 Mute This Topic: https://groups.io/mt/101716935/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-