From nobody Mon Feb 9 19:08:24 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+73650+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+73650+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1617354806; cv=none; d=zohomail.com; s=zohoarc; b=S51EIa8Gt3Kg3hJPpotxNvagbM3U2o36P8hFuxOHLWsL80/KVzU3whEdR3LOCdjBPHecGhkskC9y1cZUUvEPImnsgqBXWtZg/SJ2C8gFKxTSOBnI+jGrPYkt5757l0Bs6a48aTkq6XkKtwIcI4sf+JB6mKII1oDpfok7kYa4b3A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1617354806; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=jmRn8CSrEqfmlBnUz05sH/GJrHI2K+iOUZG5QE4MbiU=; b=IcDAKG/gDAdNWZLNaJYYlgb9wm+JdD9ZIbLzinjpKjZGMKwU04Fyb4pRvQIOc6tS2FL57uPIwZAiYZi2UeSJZ4eiW59H2l7TUDyQFwQth5AJjADs7662kfwIlrXqem5AEZkspi7mwDm9URcRvSTJ72BdfN/BlxaE9P6m94JtTLA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+73650+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1617354806453366.35696679046896; Fri, 2 Apr 2021 02:13:26 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0dRHYY1788612xjvSN2UQvpT; Fri, 02 Apr 2021 02:13:26 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.13846.1617354804437675999 for ; Fri, 02 Apr 2021 02:13:24 -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 F100F11B3; Fri, 2 Apr 2021 02:13:18 -0700 (PDT) X-Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8CEC13F792; Fri, 2 Apr 2021 02:13:17 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V1 1/8] Platform/Sgi: Helper macros for PPTT Table Date: Fri, 2 Apr 2021 14:42:01 +0530 Message-Id: <20210402091208.16752-2-pranav.madhu@arm.com> In-Reply-To: <20210402091208.16752-1-pranav.madhu@arm.com> References: <20210402091208.16752-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,pranav.madhu@arm.com X-Gm-Message-State: FVmC32YFCg6UWsJCNRoJf8Arx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1617354806; bh=XdJlAFDR8R8U/2QHuIcmsfJ7CqhLGKW2KGBpcVs1D0s=; h=Cc:Date:From:Reply-To:Subject:To; b=Fa+FULtM11JxHElGybsOfBHgHWnyL2usmjOQzcmZkuuLTLsssTHT+BY3grzIOM/Gz0y Wx3hrRo3LjZeix5rGPHr+zoU0lDhm+tXAPZMZY6HEwIe7lhgdfFu81VwVTr8iNyf6368O yCoH1SrewyCxKNJRehjYM6rp52pXc7qrBME= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add helper macros for the creation for PPTT table. These macros help with initializing processor hierarchy node structure, cache type structure and ID structure. Signed-off-by: Pranav Madhu --- Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h | 163 +++++++++++++++++++- 1 file changed, 162 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h b/Platform/ARM/Sgi= Pkg/Include/SgiAcpiHeader.h index 8d715de173c9..7ceb090a78e9 100644 --- a/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h +++ b/Platform/ARM/SgiPkg/Include/SgiAcpiHeader.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2018-2020, ARM Limited. All rights reserved. +* Copyright (c) 2018-2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -20,6 +20,132 @@ #define EFI_ACPI_ARM_CREATOR_ID SIGNATURE_32('A','R','M',' ') #define EFI_ACPI_ARM_CREATOR_REVISION 0x00000099 =20 +#define CORE_COUNT FixedPcdGet32 (PcdCoreCount) +#define CLUSTER_COUNT FixedPcdGet32 (PcdClusterCount) + +#pragma pack(1) +// PPTT processor core structure +typedef struct { + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR Core; + UINT32 Offset[2]; + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE DCache; + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE ICache; + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE L2Cache; +} RD_PPTT_CORE; + +// PPTT processor cluster structure +typedef struct { + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR Cluster; + UINT32 Offset; + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE L3Cache; + RD_PPTT_CORE Core[CORE_COUNT]; +} RD_PPTT_CLUSTER; + +// PPTT processor cluster structure without cache +typedef struct { + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR Cluster; + UINT32 Offset; + RD_PPTT_CORE Core[CORE_COUNT]; +} RD_PPTT_MINIMAL_CLUSTER; + +// PPTT processor package structure +typedef struct { + EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR Package; + UINT32 Offset; + EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE Slc; + RD_PPTT_MINIMAL_CLUSTER Cluster[CLUSTER_COUNT]; +} RD_PPTT_SLC_PACKAGE; +#pragma pack () + +// +// PPTT processor structure flags for different SoC components as defined = in +// ACPI 6.3 specification +// + +// Processor structure flags for SoC package +#define PPTT_PROCESSOR_PACKAGE_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL = \ + } + +// Processor structure flags for cluster +#define PPTT_PROCESSOR_CLUSTER_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL = \ + } + +// Processor structure flags for single-thread core +#define PPTT_PROCESSOR_CORE_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_3_PPTT_NODE_IS_LEAF = \ + } + +// Processor structure flags for multi-thread core +#define PPTT_PROCESSOR_CORE_THREADED_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_IS_NOT_THREAD, = \ + EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF, = \ + EFI_ACPI_6_3_PPTT_IMPLEMENTATION_IDENTICAL = \ + } + +// Processor structure flags for CPU thread +#define PPTT_PROCESSOR_THREAD_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID, = \ + EFI_ACPI_6_3_PPTT_PROCESSOR_IS_THREAD, = \ + EFI_ACPI_6_3_PPTT_NODE_IS_LEAF = \ + } + +// PPTT cache structure flags as defined in ACPI 6.3 Specification +#define PPTT_CACHE_STRUCTURE_FLAGS = \ + { = \ + EFI_ACPI_6_3_PPTT_CACHE_SIZE_VALID, = \ + EFI_ACPI_6_3_PPTT_NUMBER_OF_SETS_VALID, = \ + EFI_ACPI_6_3_PPTT_ASSOCIATIVITY_VALID, = \ + EFI_ACPI_6_3_PPTT_ALLOCATION_TYPE_VALID, = \ + EFI_ACPI_6_3_PPTT_CACHE_TYPE_VALID, = \ + EFI_ACPI_6_3_PPTT_WRITE_POLICY_VALID, = \ + EFI_ACPI_6_3_PPTT_LINE_SIZE_VALID = \ + } + +// PPTT cache attributes for data cache +#define PPTT_DATA_CACHE_ATTR = \ + { = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_DATA, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK = \ + } + +// PPTT cache attributes for instruction cache +#define PPTT_INST_CACHE_ATTR = \ + { = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_INSTRUCTION, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK = \ + } + +// PPTT cache attributes for unified cache +#define PPTT_UNIFIED_CACHE_ATTR = \ + { = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_ALLOCATION_READ_WRITE, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_CACHE_TYPE_UNIFIED, = \ + EFI_ACPI_6_3_CACHE_ATTRIBUTES_WRITE_POLICY_WRITE_BACK = \ + } + // A macro to initialise the common header part of EFI ACPI tables as defi= ned by // EFI_ACPI_DESCRIPTION_HEADER structure. #define ARM_ACPI_HEADER(Signature, Type, Revision) { \ @@ -119,4 +245,39 @@ ACPIProcessorUID, Flags, ClockDomain = \ } =20 +// EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR +#define EFI_ACPI_6_3_PPTT_STRUCTURE_PROCESSOR_INIT(Length, Flag, Parent, = \ + ACPIProcessorID, NumberOfPrivateResource) = \ + { = \ + EFI_ACPI_6_3_PPTT_TYPE_PROCESSOR, /* Type 0 */ = \ + Length, /* Length */ = \ + { = \ + EFI_ACPI_RESERVED_BYTE, = \ + EFI_ACPI_RESERVED_BYTE, = \ + }, = \ + Flag, /* Processor flags *= / \ + Parent, /* Ref to parent nod= e */ \ + ACPIProcessorID, /* UID, as per MADT = */ \ + NumberOfPrivateResource /* Resource count */= \ + } + +// EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE +#define EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE_INIT(Flag, NextLevelCache, Size,= \ + NoOfSets, Associativity, Attributes, LineSize) = \ + { = \ + EFI_ACPI_6_3_PPTT_TYPE_CACHE, /* Type 1 */ = \ + sizeof (EFI_ACPI_6_3_PPTT_STRUCTURE_CACHE), /* Length */ = \ + { = \ + EFI_ACPI_RESERVED_BYTE, = \ + EFI_ACPI_RESERVED_BYTE, = \ + }, = \ + Flag, /* Cache flags */ = \ + NextLevelCache, /* Ref to next level= */ \ + Size, /* Size in bytes */ = \ + NoOfSets, /* Num of sets */ = \ + Associativity, /* Num of ways */ = \ + Attributes, /* Cache attributes = */ \ + LineSize /* Line size in byte= s */ \ + } + #endif /* __SGI_ACPI_HEADER__ */ --=20 2.17.1 -=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 (#73650): https://edk2.groups.io/g/devel/message/73650 Mute This Topic: https://groups.io/mt/81798780/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-