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 9166A740038 for ; Tue, 10 Oct 2023 07:31:30 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uaRgYT+AFotmbe0nulQ1dXT/WBRGSuMpDMDxNRlaHsU=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1696923089; v=1; b=Kicq1i/0FuKrG+4VRCLWeVFJYVDlMaDCs9X5JjqwlicnYmxHN1soWlCDTshmVzJd1iLrJ1vh ddJqXrTVA5UTBy0RL0TChU/S6E/hDT+WE3mMZbQtphRM/2FHyVsSHF3sNe2TaJz5jUXWfF8L63T TdKVvt9mzFduZSuoh5azEF8o= X-Received: by 127.0.0.2 with SMTP id Uq5qYY7687511xVgpFwW8gyH; Tue, 10 Oct 2023 00:31:29 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.85712.1696923087907028144 for ; Tue, 10 Oct 2023 00:31:28 -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 230C51FB; Tue, 10 Oct 2023 00:32:08 -0700 (PDT) X-Received: from [10.34.100.114] (e126645.nice.arm.com [10.34.100.114]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A48D33F7A6; Tue, 10 Oct 2023 00:31:26 -0700 (PDT) Message-ID: <4ead4656-06ca-4b72-94f8-7089dac255b6@arm.com> Date: Tue, 10 Oct 2023 09:31:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [edk2-devel] [PATCH v2] DynamicTablesPkg/AmlLib: Enumerate memory attributes To: Jeshua Smith , devel@edk2.groups.io Cc: Sami.Mujawar@arm.com, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org References: <62418e30e2f01cd9234caa783e22fd6a18613d06.1696453749.git.jeshuas@nvidia.com> From: "PierreGondois" In-Reply-To: <62418e30e2f01cd9234caa783e22fd6a18613d06.1696453749.git.jeshuas@nvidia.com> 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,pierre.gondois@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: 5IVfWztHS27CL3pdIBsZS4jnx7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed 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="Kicq1i/0"; 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 Hi Jeshua, Thanks for the v2, Reviewed-by: Pierre Gondois Sami: There was also a tag from Leif: https://edk2.groups.io/g/devel/message/109285 Regards, Pierre On 10/5/23 18:38, Jeshua Smith wrote: > AmlCodeGenRdQWordMemory's and AmlCodeGenRdDWordMemory's Cacheable > and MemoryRangeType parameters treat specific values as having > specific meanings as defined by the spec. This change adds enums to map > those meanings to their corresponding values. >=20 > Signed-off-by: Jeshua Smith > --- >=20 > Notes: > v2: based on comments from Pierre Gondois > - Added documentation reference > - Changed enum type and member names to closer align with documentatio= n > - Changed enum member names to CamelCase > - Added *Max members to enums > - Updated the signatures of relevant functions to use the enum types > instead of UNIT8 >=20 > .../Include/Library/AmlLib/AmlLib.h | 49 +++++++++++++++++-- > .../AcpiSsdtPcieLibArm/SsdtPcieGenerator.c | 12 ++--- > .../AmlLib/CodeGen/AmlResourceDataCodeGen.c | 8 +-- > 3 files changed, 55 insertions(+), 14 deletions(-) >=20 > diff --git a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h b/DynamicTa= blesPkg/Include/Library/AmlLib/AmlLib.h > index 510c79a399..71e8539b30 100644 > --- a/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > +++ b/DynamicTablesPkg/Include/Library/AmlLib/AmlLib.h > @@ -59,6 +59,47 @@ typedef void *AML_DATA_NODE_HANDLE; > =20 > #endif // AML_HANDLE > =20 > +/** Memory attributes, _MEM (2 bits) > + > + Possible values are: > + 0-The memory is non-cacheable > + 1-The memory is cacheable (DEPRECATED) > + 2-The memory is cacheable and supports > + write combining (DEPRECATED) > + 3-The memory is cacheable and prefetchable > + > + @par Reference(s): > + - ACPI 6.5, s6.4.3.5.5 "Resource Type Specific Flags" > + > +**/ > +typedef enum { > + AmlMemoryNonCacheable =3D 0, > + AmlMemoryCacheable =3D 1, > + AmlMemoryCacheableWriteCombine =3D 2, > + AmlMemoryCacheablePrefetch =3D 3, > + AmlMemoryCacheablityMax =3D 4 > +} AML_MEMORY_ATTRIBUTES_MEM; > + > +/** Memory attributes, _MTP (2 bits) > + > + Possible values are: > + 0-AddressRangeMemory > + 1-AddressRangeReserved > + 2-AddressRangeACPI > + 3-AddressRangeNVS > + > + @par Reference(s): > + - ACPI 6.5, s6.4.3.5.5 "Resource Type Specific Flags" > + > +**/ > +typedef enum { > + AmlAddressRangeMemory =3D 0, > + AmlAddressRangeReserved =3D 1, > + AmlAddressRangeACPI =3D 2, > + AmlAddressRangeNVS =3D 3, > + AmlAddressRangeMax =3D 4 > +} AML_MEMORY_ATTRIBUTES_MTP; > + > /** Parse the definition block. > =20 > The function parses the whole AML blob. It starts with the ACPI DSDT/= SSDT > @@ -578,7 +619,7 @@ AmlCodeGenRdDWordMemory ( > IN BOOLEAN IsPosDecode, > IN BOOLEAN IsMinFixed, > IN BOOLEAN IsMaxFixed, > - IN UINT8 Cacheable, > + IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, > IN BOOLEAN IsReadWrite, > IN UINT32 AddressGranularity, > IN UINT32 AddressMinimum, > @@ -587,7 +628,7 @@ AmlCodeGenRdDWordMemory ( > IN UINT32 RangeLength, > IN UINT8 ResourceSourceIndex, > IN CONST CHAR8 *ResourceSource, > - IN UINT8 MemoryRangeType, > + IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, > IN BOOLEAN IsTypeStatic, > IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > @@ -809,7 +850,7 @@ AmlCodeGenRdQWordMemory ( > IN BOOLEAN IsPosDecode, > IN BOOLEAN IsMinFixed, > IN BOOLEAN IsMaxFixed, > - IN UINT8 Cacheable, > + IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, > IN BOOLEAN IsReadWrite, > IN UINT64 AddressGranularity, > IN UINT64 AddressMinimum, > @@ -818,7 +859,7 @@ AmlCodeGenRdQWordMemory ( > IN UINT64 RangeLength, > IN UINT8 ResourceSourceIndex, > IN CONST CHAR8 *ResourceSource, > - IN UINT8 MemoryRangeType, > + IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, > IN BOOLEAN IsTypeStatic, > IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > diff --git a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPci= eGenerator.c b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPci= eGenerator.c > index 9ddaddc198..72873709aa 100644 > --- a/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera= tor.c > +++ b/DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtPcieLibArm/SsdtPcieGenera= tor.c > @@ -566,7 +566,7 @@ GeneratePciCrs ( > IsPosDecode, > TRUE, > TRUE, > - TRUE, > + AmlMemoryCacheable, > TRUE, > 0, > AddrMapInfo->PciAddress, > @@ -575,7 +575,7 @@ GeneratePciCrs ( > AddrMapInfo->AddressSize, > 0, > NULL, > - 0, > + AmlAddressRangeMemory, > TRUE, > CrsNode, > NULL > @@ -588,7 +588,7 @@ GeneratePciCrs ( > IsPosDecode, > TRUE, > TRUE, > - TRUE, > + AmlMemoryCacheable, > TRUE, > 0, > AddrMapInfo->PciAddress, > @@ -597,7 +597,7 @@ GeneratePciCrs ( > AddrMapInfo->AddressSize, > 0, > NULL, > - 0, > + AmlAddressRangeMemory, > TRUE, > CrsNode, > NULL > @@ -718,7 +718,7 @@ ReserveEcamSpace ( > TRUE, > TRUE, > TRUE, > - FALSE, // non-cacheable > + AmlMemoryNonCacheable, > TRUE, > 0, > AddressMinimum, > @@ -727,7 +727,7 @@ ReserveEcamSpace ( > AddressMaximum - AddressMinimum + 1, > 0, > NULL, > - 0, > + AmlAddressRangeMemory, > TRUE, > CrsNode, > NULL > diff --git a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDa= taCodeGen.c b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDat= aCodeGen.c > index 9c6700b9e0..0bc1c1d119 100644 > --- a/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG= en.c > +++ b/DynamicTablesPkg/Library/Common/AmlLib/CodeGen/AmlResourceDataCodeG= en.c > @@ -570,7 +570,7 @@ AmlCodeGenRdDWordMemory ( > IN BOOLEAN IsPosDecode, > IN BOOLEAN IsMinFixed, > IN BOOLEAN IsMaxFixed, > - IN UINT8 Cacheable, > + IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, > IN BOOLEAN IsReadWrite, > IN UINT32 AddressGranularity, > IN UINT32 AddressMinimum, > @@ -579,7 +579,7 @@ AmlCodeGenRdDWordMemory ( > IN UINT32 RangeLength, > IN UINT8 ResourceSourceIndex, > IN CONST CHAR8 *ResourceSource, > - IN UINT8 MemoryRangeType, > + IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, > IN BOOLEAN IsTypeStatic, > IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL > @@ -1161,7 +1161,7 @@ AmlCodeGenRdQWordMemory ( > IN BOOLEAN IsPosDecode, > IN BOOLEAN IsMinFixed, > IN BOOLEAN IsMaxFixed, > - IN UINT8 Cacheable, > + IN AML_MEMORY_ATTRIBUTES_MEM Cacheable, > IN BOOLEAN IsReadWrite, > IN UINT64 AddressGranularity, > IN UINT64 AddressMinimum, > @@ -1170,7 +1170,7 @@ AmlCodeGenRdQWordMemory ( > IN UINT64 RangeLength, > IN UINT8 ResourceSourceIndex, > IN CONST CHAR8 *ResourceSource, > - IN UINT8 MemoryRangeType, > + IN AML_MEMORY_ATTRIBUTES_MTP MemoryRangeType, > IN BOOLEAN IsTypeStatic, > IN AML_OBJECT_NODE_HANDLE NameOpNode, OPTIONAL > OUT AML_DATA_NODE_HANDLE *NewRdNode OPTIONAL -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#109474): https://edk2.groups.io/g/devel/message/109474 Mute This Topic: https://groups.io/mt/101780411/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-