From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (NAM11-BN8-obe.outbound.protection.outlook.com [40.107.236.117]) by mx.groups.io with SMTP id smtpd.web12.4647.1634883603854213341 for ; Thu, 21 Oct 2021 23:20:04 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="body hash did not verify" header.i=@os.amperecomputing.com header.s=selector2 header.b=q121NqSv; spf=pass (domain: os.amperecomputing.com, ip: 40.107.236.117, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gIs+NYtxBJC6ak2kdlNoYGbePdInqXz2FgtEoCq5juA2KKJmSaNyrTDppomYzyClbZuMu5/4uKDBqOOMtRa8x0UQEUG+sb5LIDSi0qsRuWZDD+Lhi0PIWbt9k/Em96o9xWpkEJz1yxGKLHvx9fmjw5JejFVMCp2O8c7uUVghni6SODuRD1YemGxj9XFnvzMPqCmYFRFV1w5wHw2zPTgyoImUPEBUG9wneGFioYu9YwTHnALWswNmXxyiqU6ZhIfoR5tE3R3X59SR5Pimum61h60u1+LfEsGrhRGhuENbMu4liVPLO1e1ZKo99Cor9FJR9USiiGRYc9O5u0Nk9q7BLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SBArTw8TohJrmNsVIFgM7fQyodJXydh9a1hGsWGasM4=; b=OgLkRxAy6rj1/K+SJkt17TyzY39wwyn9m+1njNuhEaWSQPA2FX5R1k1KJB4imvYwYFT0ky9QKIr+DNMMjsd/YKlsLKYNA8jbNIce1sh/1yowMVle31d6rCbciXfl2kaqYtE/gsvtutrmo17z0RQuf9pN+GkJblHUg4GIRvZWBNUKhYHxPFRFfPOWtpCBYJI77p7suLy75nkPHGBnU3T8ngq98zkWGIjW+siQwXwEGuP6ez+Ro/KQKC1KpZWTFOYkxBWw46l/kPTMLe17lF5/Aw7eB+e8Do23VRtrD0xhwPtTPNoC4TIxNRXVT5+6BHT965Y/QVIOEXVqstjGSqdaXA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SBArTw8TohJrmNsVIFgM7fQyodJXydh9a1hGsWGasM4=; b=q121NqSveyd/4zfxrcFTREzqy/5AMqfg+X8HthwMnhCeP2cyrU6dzp+w7UmBMdGUt0Ql6ltknjmv617+2kiVhHTqirnS2gsmNcwnLecPnktq+bxGOseo9IvIiT9olDWjfQ539GfCAlUY3pXJKBLIyWPUkk8bgw1aSSKaaHtYLPs= Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by PH0PR01MB6325.prod.exchangelabs.com (2603:10b6:510:1e::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.18; Fri, 22 Oct 2021 06:20:01 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::254c:9533:7f35:aee%4]) with mapi id 15.20.4628.016; Fri, 22 Oct 2021 06:20:01 +0000 From: "Nhi Pham" To: devel@edk2.groups.io CC: patches@amperecomputing.com, nhi@os.amperecomputing.com, vunguyen@os.amperecomputing.com, Thang Nguyen , Chuong Tran , Phong Vo , Leif Lindholm , Michael D Kinney , Ard Biesheuvel , Nate DeSimone Subject: [edk2-platforms][PATCH v4 11/31] AmpereAltraPkg: Add Root Complex HOB data structures Date: Fri, 22 Oct 2021 13:17:49 +0700 Message-ID: <20211022061809.31087-12-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211022061809.31087-1-nhi@os.amperecomputing.com> References: <20211022061809.31087-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 Received: from sw004.amperecomputing.com (118.69.219.201) by HK2PR02CA0168.apcprd02.prod.outlook.com (2603:1096:201:1f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.16 via Frontend Transport; Fri, 22 Oct 2021 06:19:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: ca8192fc-5583-4892-bd39-08d99523fabc X-MS-TrafficTypeDiagnostic: PH0PR01MB6325: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QTt+suYGrrtvdyoUE5c2boO+AFuqbwZ5RBbO9aZBBgyta3C3gVFoJDuGuTftlPblSdc4w0bezPzw2iBmyCo4sQbwTEEWPOhTeQbrFbAtvLRPhb6LUaMmsn/X/pvRKmHbFj8fuU1R3Ia/46f8USwvFMnuqkkkicC8EiOiFzmGnyWpe2ey0Or0Xe1zy2ocrYtiKpU7bR/feF2qtN0Y5o54xVgStXEqIR0xjZO4lGXfX2lYv2nWbTGFfN+0ryF8HhYKgKthryklo6FLaZ5377tBegmda/0X4a25zprII3TATvvi9ea2LRpLw9ljPOm9f2lfR1wkt2gyb1oguv/ezGD9MLagcxKTCvOQZGvLNgrVnM/5n5lZ3qtx9ZKMV4Lp1k67DjQE2NN3/bYtwqHfKwzfWWR+Gn6RsDHMrFad7oOYR1BA0/TYeeNdsSUjWgS9O0koz5GdBcsAEE6g9dIg6n5gecdFsqltP71raxZJo5+ycDatQCejm9SmEjAMRymELtDPIWtQzs0YWP2zUPToo4mnMbX6k8v04hvSjtLILxM8HnXzqa1xn7C1Y+4N2/G7al/ep2kXkUXY8MH8u+PoWdkC4eqCkbIvEGs10vIuYlaPKD/GAlNRDpX/ZedYy3jeDinbf8U5JelzopG+9oRu8zfdlJjmzCjDp4nq2nGPkAe3fujHCD5VyrqdNZKupn0kX0uTXyqdaMu6gk9rbf5vWj9Tvg== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(6506007)(5660300002)(6666004)(8936002)(38100700002)(38350700002)(6486002)(186003)(26005)(508600001)(1076003)(316002)(8676002)(54906003)(6916009)(66476007)(66556008)(6512007)(66946007)(83380400001)(86362001)(956004)(4326008)(2616005)(52116002)(2906002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?8a49/BbPawDx3qaPlj1Vm9rqnXvqhl1cRmRMO6cSudSQ1w7h0jltSyxxgTIS?= =?us-ascii?Q?tHIR8oIty9ZESeA6L66m/iBkXFZsX9VkFATtbhkFckRnFsnrTDZSXgR2U7j1?= =?us-ascii?Q?D3wvzpW0cEUCmSnXCzzndLAVTkaIkijkvK0X2YMAsGSq8rNGJuAPOD+3H3Eq?= =?us-ascii?Q?yZvXrOzA0zVTMhbOyrcWBk/b8hjtydR7W6Mu/qOaX0C9SISyH2HnU1LZpef4?= =?us-ascii?Q?E3xEuyXXBlG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PVcs1aiy0rP2c8Z?= =?us-ascii?Q?tLQOVhEJNgWnoDjmuByAd5nD0sgb6Paun7LHs7gh8h+S9t6/lgr6UOkA/rQu?= =?us-ascii?Q?hpEJ2H0CEE4cp8fnYetaazlt6Alx2EWDMTgRoEfugFdwxrzZS3pTav72wQVV?= =?us-ascii?Q?quKsi/h/51UdGohSEgFQORsAGHZ5SrbMmHCdMrhChZOEJoho9wdOea3FWVsI?= =?us-ascii?Q?Zl+nce6NRxDYdNFOhU2BK73/E9n9Ldju9wZgV8iehPbIK8LEaXH70Fp4PaWL?= =?us-ascii?Q?5zUhZ3kchMtJzQ1TabyGSfO83yYDyxHqywKhsIYa7or/DEMCreaPOGHLGe7L?= =?us-ascii?Q?nin1123BKarAPERuSE7fp7FVToGoopGMcXGo7Ln8nbfxLz5QZPQcwA=3D=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ca8192fc-5583-4892-bd39-08d99523fabc X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2021 06:20:01.5679 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nhi@amperemail.onmicrosoft.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR01MB6325 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Vu Nguyen Provide common data structures and macros which will be consumed by various PCIe modules. Cc: Thang Nguyen Cc: Chuong Tran Cc: Phong Vo Cc: Leif Lindholm Cc: Michael D Kinney Cc: Ard Biesheuvel Cc: Nate DeSimone Signed-off-by: Nhi Pham --- Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec | 3 + Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h | 140 ++++= ++++++++++++++++ 2 files changed, 143 insertions(+) diff --git a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec b/Silicon/Amp= ere/AmpereAltraPkg/AmpereAltraPkg.dec index c1226c296dad..e19925c68a0e 100644 --- a/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec +++ b/Silicon/Ampere/AmpereAltraPkg/AmpereAltraPkg.dec @@ -52,3 +52,6 @@ [Guids] =20 ## Include/Guid/PlatformInfoHob.h gPlatformInfoHobGuid =3D { 0x7f73e372, 0x7183, 0x4022, { 0xb3, 0= x76, 0x78, 0x30, 0x32, 0x6d, 0x79, 0xb4 } } + + ## Include/Guid/RootComplexInfoHob.h + gRootComplexInfoHobGuid =3D { 0x568a258a, 0xcaa1, 0x47e9, { 0xbb, 0= x89, 0x65, 0xa3, 0x73, 0x9b, 0x58, 0x75 } } diff --git a/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.= h b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h new file mode 100644 index 000000000000..89da1ac696a5 --- /dev/null +++ b/Silicon/Ampere/AmpereAltraPkg/Include/Guid/RootComplexInfoHob.h @@ -0,0 +1,140 @@ +/** @file + + Copyright (c) 2021, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef ROOT_COMPLEX_INFO_HOB_H_ +#define ROOT_COMPLEX_INFO_HOB_H_ + +#define ROOT_COMPLEX_INFO_HOB_GUID \ + { 0x568a258a, 0xcaa1, 0x47e9, { 0xbb, 0x89, 0x65, 0xa3, 0x73, 0x9b, 0x58= , 0x75 } } + +extern GUID gRootComplexInfoHobGuid; + +#define PRESET_INVALID 0xFF + +// +// PCIe link width +// +#define LINK_WIDTH_NONE 0x00 +#define LINK_WIDTH_X1 0x01 +#define LINK_WIDTH_X2 0x02 +#define LINK_WIDTH_X4 0x04 +#define LINK_WIDTH_X8 0x08 +#define LINK_WIDTH_X16 0x10 + +// +// PCIe link speed +// +#define LINK_SPEED_NONE 0x00 +#define LINK_SPEED_GEN1 0x01 +#define LINK_SPEED_GEN2 0x02 +#define LINK_SPEED_GEN3 0x04 +#define LINK_SPEED_GEN4 0x08 + +typedef enum { + DevMapMode1 =3D 0, + DevMapMode2, + DevMapMode3, + DevMapMode4, + MaxDevMapMode =3D DevMapMode4 +} DEV_MAP_MODE; + +// +// PCIe controller index +// +typedef enum { + PcieController0 =3D 0, + PcieController1, + PcieController2, + PcieController3, + PcieController4, + MaxPcieControllerA =3D PcieController4, + PcieController5, + PcieController6, + PcieController7, + MaxPcieController, + MaxPcieControllerB =3D MaxPcieController +} AC01_PCIE_CONTROLLER_INDEX; + +// +// Root Complex type +// +typedef enum { + RootComplexTypeA, + RootComplexTypeB, + MaxRootComplexType =3D RootComplexTypeB +} AC01_ROOT_COMPLEX_TYPE; + +// +// Root Complex index +// +typedef enum { + RootComplexA0 =3D 0, + RootComplexA1, + RootComplexA2, + RootComplexA3, + MaxRootComplexA, + RootComplexB0 =3D MaxRootComplexA, + RootComplexB1, + RootComplexB2, + RootComplexB3, + MaxRootComplex, + MaxRootComplexB =3D MaxRootComplex +} AC01_ROOT_COMPLEX_INDEX; + +#pragma pack(1) + +// +// Data structure to store the PCIe controller information +// +typedef struct { + PHYSICAL_ADDRESS CsrBase; // Base address of CSR block + PHYSICAL_ADDRESS SnpsRamBase; // Base address of Synopsys SRA= M + UINT8 MaxGen; // Max speed Gen-1/-2/-3/-4 + UINT8 CurrentGen; // Current speed Gen-1/-2/-3/-4 + UINT8 MaxWidth; // Max lanes x2/x4/x8/x16 + UINT8 CurWidth; // Current lanes x2/x4/x8/x16 + UINT8 ID; // ID of the controller within = Root Complex + UINT8 DevNum; // Device number as part of Bus= :Dev:Func + BOOLEAN Active; // Active? Used in bi-furcation= mode + BOOLEAN LinkUp; // PHY and PCIE linkup + BOOLEAN HotPlug; // Hotplug support +} AC01_PCIE_CONTROLLER; + +// +// Data structure to store the Root Complex information +// +typedef struct { + PHYSICAL_ADDRESS CsrBase; + PHYSICAL_ADDRESS TcuBase; + PHYSICAL_ADDRESS HostBridgeBase; + PHYSICAL_ADDRESS SerdesBase; + PHYSICAL_ADDRESS MmcfgBase; + PHYSICAL_ADDRESS MmioBase; + PHYSICAL_ADDRESS MmioSize; + PHYSICAL_ADDRESS Mmio32Base; + PHYSICAL_ADDRESS Mmio32Size; + AC01_PCIE_CONTROLLER Pcie[MaxPcieController]; + UINT8 MaxPcieController; + AC01_ROOT_COMPLEX_TYPE Type; + UINT8 ID; + DEV_MAP_MODE DevMapHigh:3; // Copy of High Devmap pr= ogrammed to Host bridge + DEV_MAP_MODE DevMapLow:3; // Copy of Low Devmap pro= grammed to Host bridge + DEV_MAP_MODE DefaultDevMapHigh:3; // Default of High devmap= based on board settings + DEV_MAP_MODE DefaultDevMapLow:3; // Default of Low devmap = based on board settings + UINT8 Socket; + BOOLEAN Active; + BOOLEAN DefaultActive; + UINT16 Logical; + UINT32 Flags; + UINT8 PresetGen3[MaxPcieController]; + UINT8 PresetGen4[MaxPcieController]; +} AC01_ROOT_COMPLEX; + +#pragma pack() + +#endif /* ROOT_COMPLEX_INFO_HOB_H_ */ --=20 2.17.1