From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (NAM11-CO1-obe.outbound.protection.outlook.com [40.107.220.108]) by mx.groups.io with SMTP id smtpd.web11.23526.1688377154783735620 for ; Mon, 03 Jul 2023 02:39:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Ycgd0wYo; spf=pass (domain: os.amperecomputing.com, ip: 40.107.220.108, mailfrom: chrisli@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XNBh2BH4SzmCMu/k9YqKQlSah5y2ZGPJsNf1IOrxUAfX/zBtgiFrUyuXV3o1MN4X8B0KYAmAqUJtAas4dIbK6P4nlsXaPL3i7h7dq+v0UT0DB7M7UAupqtmmfrwuEUugl1uKmho4OIgBQxRAz6Fv7UJWEGDXPuluYOB39q8s+mFJb41YHW6soaQ3CimvKMeeiMAIonGJ5uN4F8qQdUXINknZ4J9OoSYhIYi7rPFlyCwFCnTnsW/OUTUBrCSucXkVV5pA4RUOsn/IkYi7winvD6kvLsj1UqIt7n7kovk0B7sY+fqzC6nEK/cL15yRV3zdiLpQ/KerzkO/+vM/1mZmOg== 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=oix/93uXkjFkdo/6V6EGW/CBhc9vBntxCPeN9sM0e9w=; b=YsXLASkVJjxunlWJ/UuAFBTMgMSeZLrwyHS6NYMrfesh44bFTMiNFFD7JhaBZK8n2evfS7A/AUfxE0U0coi3yfvh56zgxUWZTZ6p1i5PTJtCEKGm/0oZUiqiGIV1NyFV7+C+P4aWe5fWMEdbSIpuiNWLbkXBJoo6hjs95G+C+iHEB1FFtKlPCRuiGzvpPm/rbUA/dCREHrF0RQk9plCZ3o2uPPF02TNHnxzL5sh+dMCzMbXUEIQ1/D7eK2vRe+WX+smn+klNCttahFJ2IfdmESyAenHY1XvceMNIBbS5IScIYr2N95Iq33i0ZZC8rBRbBdF9/xc09OqQq2x6e++ThQ== 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=oix/93uXkjFkdo/6V6EGW/CBhc9vBntxCPeN9sM0e9w=; b=Ycgd0wYoAaeGyZUh1VpRGaUexy5He+ImsPfCV12pvGqUWXhx8Y3Kr//knBYFK4Lgv9YaiYblwP45YU6bDGTy3cuKguxnxXQBh8zCMBZ6LRM7JEhWn/NNOAUqBwR3AL+f32tjMS11uP6F33nL3nRfrrRZspxDlaDcBU8yoeO2Ggs= Received: from SN6PR01MB4656.prod.exchangelabs.com (2603:10b6:805:cf::31) by CH0PR01MB7171.prod.exchangelabs.com (2603:10b6:610:fb::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.24; Mon, 3 Jul 2023 09:39:08 +0000 Received: from SN6PR01MB4656.prod.exchangelabs.com ([fe80::291a:3b8c:e5d7:8a16]) by SN6PR01MB4656.prod.exchangelabs.com ([fe80::291a:3b8c:e5d7:8a16%4]) with mapi id 15.20.6544.024; Mon, 3 Jul 2023 09:39:08 +0000 From: "Chris Li OS" To: "Ni, Ray" , "devel@edk2.groups.io" , "Yao, Jiewen" , "Nong, Foster" CC: "gaoliming@byosoft.com.cn" , "michael.d.kinney@intel.com" , Open Source Submission Subject: [edk2-devel] [PATCH v2 1/1] MdePkg: Add Cxl20.h into IndustryStandard Thread-Topic: [edk2-devel] [PATCH v2 1/1] MdePkg: Add Cxl20.h into IndustryStandard Thread-Index: AQHZrZI2hEI6RbUNGUm39KAiwqrE6w== Date: Mon, 3 Jul 2023 09:39:07 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Enabled=True;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SiteId=3bc2b170-fd94-476d-b0ce-4229bdc904a7;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_SetDate=2023-07-03T09:39:06.018Z;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Name=Confidential;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_ContentBits=0;MSIP_Label_5b82cb1d-c2e0-4643-920a-bbe7b2d7cc47_Method=Standard; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SN6PR01MB4656:EE_|CH0PR01MB7171:EE_ x-ms-office365-filtering-correlation-id: 04fc2669-7e0b-4e1f-8286-08db7ba95931 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: rjP1y3fcYIzmhNz72U4vSb8sWaF5UFHL5IIZQy2sQ8RYt/dLzbhCJQfohmsF7A5IsujZqndkLiGii9WVIc2Iz3t5vVVo0u5g+G4Vr/yO9HAiEqb1lGe+P5UJqhpueC2TvjPEKFNxOKIxdSkvLlxYiHCwp/DIaLkyUjTaX0C0LNH5w6/OMh2nWp7hMhXj3hUjYqCij1nA5Q61X9/ksJDPwYNOl+CaB1Qu5ZuU1o5a4qykgypEUwjpw1xV/BWapeBsz3tHOPuaHVx0tg0JK21fP63++ET2hBBAgVGDjU9+GW6ywh77aiFN4VWnX7OZ9/9R5SHlYslXaOyXQZubNhzZXPH6dmIb/+7etSkAWQSfSrVj7T+UPmUF44tE3ptcx3oCOAyD3VUf1S8HUwlKeBP0RBbu9BLAQ4td09Rto90M2zbyfA9Q0wNtbMsoFOWFvppNPWRNedmnScr3RlIqCydjSakR6GFpKWJb4VF3ESQMt8u9dNpyqaM/D42wlu3wK23q9PGE7Ogr6F84Mh+RBB7bU3tE5KLclBfRxjANg3UgR9A8AAE3FjBQ+l5kwpzKWUZPnTErz6S1FNiKDcJv6BGX5s/HLi2CUAfSJIPLuIja+/0= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SN6PR01MB4656.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(136003)(39860400002)(366004)(346002)(376002)(451199021)(30864003)(2906002)(66899021)(41300700001)(52536014)(5660300002)(38070700005)(8676002)(8936002)(33656002)(55016003)(86362001)(71200400001)(478600001)(186003)(107886003)(26005)(9686003)(6506007)(966005)(53546011)(38100700002)(7696005)(66556008)(316002)(64756008)(66446008)(66476007)(66946007)(76116006)(91956017)(4326008)(110136005)(83380400001)(122000001)(54906003)(19627235002)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?iso-8859-1?Q?2CF7GwGFliA1l/WydsNhJ186n2qvKTnpFwpE+4/fkRi980e0CIagI1mUs8?= =?iso-8859-1?Q?DmeCbMGKLJOv8hMaVtQRq7E1kM1I+8rgvyPHPR9Vz5Q0N124AwJZLJeEBW?= =?iso-8859-1?Q?B077nvFcyAA3gMIp5suCLfmPJ4At2JPZSRUNN6FmhnQzePLnnlTsNQUnb2?= =?iso-8859-1?Q?Q4c0/V5dIj2taOYSKmJSD25sHk8o4mkLpysak+GaPzu3VUZXWp6I2VxiMi?= =?iso-8859-1?Q?pQslk/83LUA4JQJ8cgSgdtR+2xMkOLZqMWr0cty1+5KsYlMXZYJBnTm0A0?= =?iso-8859-1?Q?RajEpFROuMEHzBcUqSSbZ/99C33aIBUCDKbT12j+yIf+gf5v/EL3rtI0N7?= =?iso-8859-1?Q?BOisxQco8JUXM2H7xAmAjP5H0VcLc5hWWeUL+ek+j7Ra9z+GuGiwbYZLzb?= =?iso-8859-1?Q?YJ0pcleDIzPuHectXYZNdVOPzGEwyYXV/OiNwr5VbyY+0t8CFaOT9pSU+m?= =?iso-8859-1?Q?dDzPyOmX5TfowZR61apVy0KQ8cwvx1BkJ+foIk0FbpjwVtFNDyict59VsF?= =?iso-8859-1?Q?mf0z6IVyk5S+1vNK0kNLOVHORtqDQzV0IhQQfNjvP42O6iybt3lXgdZTdg?= =?iso-8859-1?Q?P3lPZtF9VXM6Qs7khTjHRmdfNeQO9Igjo+JEvFTLC2RJc7YGbzsE96bsFS?= =?iso-8859-1?Q?U3jpTbk/dgfrrUIBmoXI/a+NDYh2rICtWLUG80qlghqwogy3tZf48EuweR?= =?iso-8859-1?Q?cT4iZ9s04+TM6nmIfrygttIh0dRcUYiGT1zzpMo8H19u2ZyIyqBvM4p7B1?= =?iso-8859-1?Q?nmC2edJdVrFHbLRaC3J7RtfIZKDJFxj27Rq1BE8WddES4XVay0Myo39QKb?= =?iso-8859-1?Q?TyaPK83wvupAK0WeMHL3+xOB1lJ2DJtNj4d1ztkvjpqAHL3bkdwt76E/US?= =?iso-8859-1?Q?0jqhY3zu4GLVlS0vDa38eTbhMliArVcV0S7T6BxcOAVdRiWENyDH1ck5aw?= =?iso-8859-1?Q?LrSu9jDjUBYB3txyo10De1eCjyZ9FAPtV2O9XMbZvIKA6irg6LkdBVJabX?= =?iso-8859-1?Q?ls+CAsyf4uq38NwipkdUlPHzVFmNDVtEA1LyoechuILH6UATjTB51ZxY/L?= =?iso-8859-1?Q?BoMrlRkkMPbR7u3tvxmoJnI83sxuj0RaAVDjyuVrFv6NKfwF0UReX3UKXx?= =?iso-8859-1?Q?z2wMgekpmNK1pxjZFKoT6onHummBXBtvd7jkmmOQL5Fkax8gNhNn175s9W?= =?iso-8859-1?Q?5H4D/o2XQl9NfQ4UNTM1Ez+sfZ5F2uNrpOtwigHOauFh6yfeIlTfM3c2yK?= =?iso-8859-1?Q?CiUvCy1u/Hu7UL0pJLF/TYBeh/GaNnCeWx7dbYJECN45jBloo36FmjEzUt?= =?iso-8859-1?Q?SPHCFz8RjMBC6Jj28U1YIqYTMirVBG0DVXleBD1QyvHfBN9J0k/MCD8xur?= =?iso-8859-1?Q?NQ5I2Pl1nPP0DsFlHZ4WSY8140cef/7IRPI8AFJVE4HSKoFSmHhAfMYFdx?= =?iso-8859-1?Q?djBIjz0dv09Hn0eLPBZLqqEkPbNp4ZZHNer/sNlths1A9re6KfSW115EiO?= =?iso-8859-1?Q?D+2IFHqL/XIletfdaWlJJu4U/KSglWAkK13J9lFhTF/7E48Ho3OxIuaTp1?= =?iso-8859-1?Q?fraylVST30P+s3MHRS4RuRz/Ijz+eTmDm+piE2xYeS+a5GWmLrw4TWCaO4?= =?iso-8859-1?Q?IOUhTiBFa8bjwQmHEu+5KXqy0fZ3IjvANKdSz7hldSk8826JlU+f5ZQQ?= =?iso-8859-1?Q?=3D=3D?= MIME-Version: 1.0 X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SN6PR01MB4656.prod.exchangelabs.com X-MS-Exchange-CrossTenant-Network-Message-Id: 04fc2669-7e0b-4e1f-8286-08db7ba95931 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Jul 2023 09:39:07.8911 (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: 4s/HsHrYBDY16oOjB/dset/6GPRokWr3oJi8I/QTHbc1zVTWd47RjdnmjJtAHsWQMAc1G8j+dLEIVKLou0fes26I/KLLYNmRq9MBJfhWRzGf16B6MZIwgJfkLwPNdwNh X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR01MB7171 Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable +To/Cc Updated places from v1: +#define CXL_2_0_DVSEC_REVISON_ID 0x1 -#define CXL20_DVSEC_REVISON_REGISTOR_LOCATOR 0x0 +#define CXL_2_0_DVSEC_REVISON_REGISTOR_LOCATOR 0x0 -} HDM_DECODER_N_INFO; +} CXL_HDM_DECODER_N_INFO; ----- 1) Add CXL 2.0 header file to comply with CXL 2.0 specification 2) CXL 2.0 header will embed Cxl11.h 3) Updated Cxl.h to point to 2.0 header file Signed-off-by: Chris Li --- MdePkg/Include/IndustryStandard/Cxl.h | 2 +- MdePkg/Include/IndustryStandard/Cxl20.h | 479 ++++++++++++++++++++++++ 2 files changed, 480 insertions(+), 1 deletion(-) create mode 100644 MdePkg/Include/IndustryStandard/Cxl20.h diff --git a/MdePkg/Include/IndustryStandard/Cxl.h b/MdePkg/Include/Industr= yStandard/Cxl.h index 06c1230e3e..9ad3242e25 100644 --- a/MdePkg/Include/IndustryStandard/Cxl.h +++ b/MdePkg/Include/IndustryStandard/Cxl.h @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _CXL_MAIN_H_ #define _CXL_MAIN_H_ =20 -#include +#include // // CXL assigned new Vendor ID // diff --git a/MdePkg/Include/IndustryStandard/Cxl20.h b/MdePkg/Include/Indus= tryStandard/Cxl20.h new file mode 100644 index 0000000000..16ac6d5aff --- /dev/null +++ b/MdePkg/Include/IndustryStandard/Cxl20.h @@ -0,0 +1,479 @@ +/** @file + CXL 2.0 Register definitions + + This file contains the register definitions based on the Compute Express= Link + (CXL) Specification Revision 2.0. + + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef CXL20_H_ +#define CXL20_H_ + +#include + +// +// Ensure proper structure formats +// +#pragma pack(1) + + +// +// CXL DVSEC IDs and Revisions +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.1 +// +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_CXL_DEVICE 0x0 +#define CXL_DVSEC_ID_NON_CXL_FUNCTION_MAP 0x2 +#define CXL_DVSEC_ID_CXL20_EXTENSIONS_DVSEC_FOR_PORTS 0x3 +#define CXL_DVSEC_ID_GPF_DVSEC_FOR_CXL_PORTS 0x4 +#define CXL_DVSEC_ID_GPF_DVSEC_FOR_CXL_DEVICES 0x5 +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_FLEX_BUS_PORT 0x7 +#define CXL_DVSEC_ID_REGISTER_LOCATOR 0x8 +#define CXL_DVSEC_ID_MLD 0x9 +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_TEST_CAPABILITY 0xA + +#define CXL_2_0_DVSEC_REVISON_ID 0x1 + +#define CXL_2_0_DVSEC_REVISON_REGISTOR_LOCATOR 0x0 + +// +// Register Block ID +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.9.1 +// +#define CXL_REGISTER_BLOCK_ID_EMPTY 0x0 +#define CXL_REGISTER_BLOCK_ID_COMPONENT 0x01 +#define CXL_REGISTER_BLOCK_ID_BAR_VIRTUALIZATION_ACL 0x02 +#define CXL_REGISTER_BLOCK_ID_DEVICE 0x03 + +// +// Component Register Block Register Ranges Offset +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.4 +// +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_IO 0x0 +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_CACHE_MEM 0x1000 +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_ARB_MUX 0xE000 + +// +// CXL Cache Memory Capability IDs +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5 +// +#define CXL_CACHE_MEM_CAPABILITY_ID_CXL 0x1 +#define CXL_CACHE_MEM_CAPABILITY_ID_RAS 0x2 +#define CXL_CACHE_MEM_CAPABILITY_ID_SECURITY 0x3 +#define CXL_CACHE_MEM_CAPABILITY_ID_LINK 0x4 +#define CXL_CACHE_MEM_CAPABILITY_ID_HDM_DECODER 0x5 +#define CXL_CACHE_MEM_CAPABILITY_ID_EXTENDED_SECURITY 0x6 +#define CXL_CACHE_MEM_CAPABILITY_ID_IDE 0x7 +#define CXL_CACHE_MEM_CAPABILITY_ID_SNOOP_FILTER 0x8 +#define CXL_CACHE_MEM_CAPABILITY_ID_MASK 0xFFFF + +// +// Generic CXL Device Capability IDs 0x0000 ~ 0x3FFF +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.2.1 +// +#define CXL_DEVICE_CAPABILITY_ID_CAPABILITIES_ARRAY_REGISTER 0x0000 +#define CXL_DEVICE_CAPABILITY_ID_DEVICE_STATUS 0x0001 +#define CXL_DEVICE_CAPABILITY_ID_PRIMARY_MAILBOX 0x0002 +#define CXL_DEVICE_CAPABILITY_ID_SECONDARY_MAILBOX 0x0003 + +// +// Specific CXL Device Capability IDs 0x4000 ~ 0x7FFF +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.2.1 +// +// (ref: CXL 2.0 spec $8.2.8.5) +#define CXL_DEVICE_CAPABILITY_ID_MEMORY_DEVICE_STATUS 0x4000 +#define CXL_DEVICE_CAPABILITY_ID_MASK 0xFFFF + +// +// Memory Device Status +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.5.1.1 +// +#define CXL_MEM_DEVICE_MEDIA_STATUS_NOT_READY 0b00 +#define CXL_MEM_DEVICE_MEDIA_STATUS_READY 0b01 +#define CXL_MEM_DEVICE_MEDIA_STATUS_ERROR 0b10 +#define CXL_MEM_DEVICE_MEDIA_STATUS_DISABLED 0b11 + +// +// PCIe DVSEC for CXL Device +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.3 +// +typedef union { + struct { + UINT16 CacheCapable : 1; // bit 0 + UINT16 IoCapable : 1; // bit 1 + UINT16 MemCapable : 1; // bit 2 + UINT16 MemHwInitMode : 1; // bit 3 + UINT16 HdmCount : 2; // bit 4..5 + UINT16 CacheWriteBackAndInvalidateCapable : 1; // bit 6 + UINT16 CxlResetCapable : 1; // bit 7 + UINT16 CxlResetTimeout : 3; // bit 8..10 + UINT16 CxlResetMemClrCapable : 1; // bit 11 + UINT16 Reserved : 1; // bit 12 + UINT16 MultipleLogicalDevice : 1; // bit 13 + UINT16 ViralCapable : 1; // bit 14 + UINT16 PmInitCompletionReportingCapable : 1; // bit 15 + } Bits; + UINT16 Uint16; +} CXL_DVSEC_CXL_DEVICE_CAPABILITY; + +typedef union { + struct { + UINT16 CacheEnable : 1; // bit 0 + UINT16 IoEnable : 1; // bit 1 + UINT16 MemEnable : 1; // bit 2 + UINT16 CacheSfCoverage : 5; // bit 3..7 + UINT16 CacheSfGranularity : 3; // bit 8..10 + UINT16 CacheCleanEviction : 1; // bit 11 + UINT16 Reserved1 : 2; // bit 12..13 + UINT16 ViralEnable : 1; // bit 14 + UINT16 Reserved2 : 1; // bit 15 + } Bits; + UINT16 Uint16; +} CXL_DVSEC_CXL_DEVICE_CONTROL; + +typedef union { + struct { + UINT16 Reserved1 : 14; // bit 0..13 + UINT16 ViralStatus : 1; // bit 14 + UINT16 Reserved2 : 1; // bit 15 + } Bits; + UINT16 Uint16; +} CXL_DVSEC_CXL_DEVICE_STATUS; + +typedef union { + struct { + UINT16 DisableCaching : 1; // bit 0 + UINT16 InitiateCacheWriteBackAndInvalidate : 1; // bit 1 + UINT16 InitiateCxlReset : 1; // bit 2 + UINT16 CxlResetMemClrEnable : 1; // bit 3 + UINT16 Reserved : 12; // bit 4..15 + } Bits; + UINT16 Uint16; +} CXL_2_0_DVSEC_CXL_DEVICE_CONTROL2; + +typedef union { + struct { + UINT16 CacheInvalid : 1; // bit 0 + UINT16 CxlResetComplete : 1; // bit 1 + UINT16 Reserved : 13; // bit 2..= 14 + UINT16 PowerManagementInitialzationComplete : 1; // bit 15 + } Bits; + UINT16 Uint16; +} CXL_2_0_DVSEC_CXL_DEVICE_STATUS2; + +typedef union { + struct { + UINT16 ConfigLock : 1; // bit 0 + UINT16 Reserved : 15; // bit 1..15 + } Bits; + UINT16 Uint16; +} CXL_DVSEC_CXL_DEVICE_LOCK; + +typedef union { + struct { + UINT16 CacheSizeUnit : 4; // bit 0..3 + UINT16 Reserved : 4; // bit 4..7 + UINT16 CacheSize : 8; // bit 8..15 + } Bits; + UINT16 Uint16; +} CXL_2_0_DVSEC_CXL_DEVICE_CAPABILITY2; + +typedef union { + struct { + UINT32 MemorySizeHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_HIGH; + +typedef union { + struct { + UINT32 MemoryInfoValid : 1; // bit 0 + UINT32 MemoryActive : 1; // bit 1 + UINT32 MediaType : 3; // bit 2..4 + UINT32 MemoryClass : 3; // bit 5..7 + UINT32 DesiredInterleave : 5; // bit 8..12 + UINT32 MemoryActiveTimeout : 3; // bit 13..15 + UINT32 Reserved : 12; // bit 16..27 + UINT32 MemorySizeLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_LOW; + +typedef union { + struct { + UINT32 MemoryBaseHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_HIGH; + +typedef union { + struct { + UINT32 Reserved : 28; // bit 0..27 + UINT32 MemoryBaseLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_LOW; + +typedef union { + struct { + UINT32 MemorySizeHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_HIGH; + +typedef union { + struct { + UINT32 MemoryInfoValid : 1; // bit 0 + UINT32 MemoryActive : 1; // bit 1 + UINT32 MediaType : 3; // bit 2..4 + UINT32 MemoryClass : 3; // bit 5..7 + UINT32 DesiredInterleave : 5; // bit 8..12 + UINT32 MemoryActiveTimeout : 3; // bit 13..15 + UINT32 Reserved : 12; // bit 16..27 + UINT32 MemorySizeLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_LOW; + +typedef union { + struct { + UINT32 MemoryBaseHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_HIGH; + +typedef union { + struct { + UINT32 Reserved : 28; // bit 0..27 + UINT32 MemoryBaseLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_LOW; + +typedef struct { + PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; = // offset 0x00 + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_1 DesignatedVendorSpeci= ficHeader1; // offset 0x04 + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_2 DesignatedVendorSpeci= ficHeader2; // offset 0x08 + CXL_DVSEC_CXL_DEVICE_CAPABILITY DeviceCapability; = // offset 0x0A + CXL_DVSEC_CXL_DEVICE_CONTROL DeviceControl; = // offset 0x0C + CXL_DVSEC_CXL_DEVICE_STATUS DeviceStatus; = // offset 0x0E + CXL_2_0_DVSEC_CXL_DEVICE_CONTROL2 DeviceControl2; = // offset 0x10 + CXL_2_0_DVSEC_CXL_DEVICE_STATUS2 DeviceStatus2; = // offset 0x12 + CXL_DVSEC_CXL_DEVICE_LOCK DeviceLock; = // offset 0x14 + CXL_2_0_DVSEC_CXL_DEVICE_CAPABILITY2 DeviceCapability2; = // offset 0x16 + CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_HIGH DeviceRange1SizeHigh;= // offset 0x18 + CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_LOW DeviceRange1SizeLow; = // offset 0x1C + CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_HIGH DeviceRange1BaseHigh;= // offset 0x20 + CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_LOW DeviceRange1BaseLow; = // offset 0x24 + CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_HIGH DeviceRange2SizeHigh;= // offset 0x28 + CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_LOW DeviceRange2SizeLow; = // offset 0x2C + CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_HIGH DeviceRange2BaseHigh;= // offset 0x30 + CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_LOW DeviceRange2BaseLow; = // offset 0x34 +} CXL_2_0_DVSEC_CXL_DEVICE; + +// +// Register Locator DVSEC +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.9 +// +typedef union { + struct { + UINT32 RegisterBir : 3; // bit 0..2 + UINT32 Reserved : 5; // bit 3..7 + UINT32 RegisterBlockIdentifier : 8; // bit 8..15 + UINT32 RegisterBlockOffsetLow : 16; // bit 16..31 + } Bits; + UINT32 Uint32; +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_LOW; + +typedef union { + struct { + UINT32 RegisterBlockOffsetHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_HIGH; + +typedef struct { + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_LOW OffsetLow; + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_HIGH OffsetHigh; +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_BLOCK; + + +typedef struct { + PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; = // offset 0x00 + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_1 DesignatedVendorSpeci= ficHeader1; // offset 0x04 + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_2 DesignatedVendorSpeci= ficHeader2; // offset 0x08 + UINT16 Reserved; = // offset 0x0A + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_BLOCK RegisterBlock[1]; = // offset 0x0C +} CXL_REGISTER_LOCATOR_DVSEC; + +// +// CXL HDM Decoder Capability Header Register +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5.5 +// +typedef union { + struct { + UINT32 CxlCapabilityId : 16; // bit 0..15 + UINT32 CxlCapabilityVersion : 4; // bit 16..19 + UINT32 CxlHdmDecoderCapabilityPointer : 12; // bit 20..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_CAPABILITY_HEADER_REGISTER; + +// +// CXL HDM Decoder Capability Register +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5.12 +// +typedef union { + struct { + UINT32 DecoderCount : 4; // bit 0..3 + UINT32 TargetCount : 4; // bit 4..7 + UINT32 A11to8InterleaveCapable : 1; // bit 8 + UINT32 A14to12InterleaveCapable : 1; // bit 9 + UINT32 PoisonOnDecodeErrorCapability : 1; // bit 10 + UINT32 Reserved : 21; // bit 11..31 + } Bits; + UINT32 Uint32; +} CXL_2_0_HDM_DECODER_CAPABILITY_REGISTER; + +typedef union { + struct { + UINT32 PoisonOnDecodeErrorEnable : 1; // bit 0 + UINT32 HdmDecoderEnable : 1; // bit 1 + UINT32 Reserved : 30; // bit 2..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_GLOBAL_CONTROL_REGISTER; + +typedef union { + struct { + UINT32 Reserved : 28; // bit 0..27 + UINT32 MemoryBaseLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_BASE_LOW_REGISTER; + +typedef union { + struct { + UINT32 MemoryBaseHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_BASE_HIGH_REGISTER; + +typedef union { + struct { + UINT32 Reserved : 28; // bit 0..27 + UINT32 MemorySizeLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_SIZE_LOW_REGISTER; + +typedef union { + struct { + UINT32 MemorySizeHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_SIZE_HIGH_REGISTER; + +typedef union { + struct { + UINT32 InterleaveGranularity : 4; // bit 0..3 + UINT32 InterleaveWays : 4; // bit 4..7 + UINT32 LockOnCommit : 1; // bit 8 + UINT32 Commit : 1; // bit 9 + UINT32 Committed : 1; // bit 10 + UINT32 ErrorNotCommitted : 1; // bit 11 + UINT32 TargetDeviceType : 1; // bit 12 + UINT32 Reserved : 19; // bit 13..31 + } Bits; + UINT32 Uint32; +} CXL_2_0_HDM_DECODER_N_CONTROL_REGISTER; + +typedef union { + struct { + UINT32 TargetPortIdentiferWay0 : 8; // bit 0..7 + UINT32 TargetPortIdentiferWay1 : 8; // bit 8..15 + UINT32 TargetPortIdentiferWay2 : 8; // bit 16..23 + UINT32 TargetPortIdentiferWay3 : 8; // bit 24..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_TARGET_LIST_LOW_REGISTER; + +typedef union { + struct { + UINT32 Reserved : 28; // bit 0..27 + UINT32 DpaSkipLow : 4; // bit 28..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_DPA_SKIP_LOW_REGISTER; + +typedef union { + struct { + UINT32 TargetPortIdentiferWay4 : 8; // bit 0..7 + UINT32 TargetPortIdentiferWay5 : 8; // bit 8..15 + UINT32 TargetPortIdentiferWay6 : 8; // bit 16..23 + UINT32 TargetPortIdentiferWay7 : 8; // bit 24..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_TARGET_LIST_HIGH_REGISTER; + +typedef union { + struct { + UINT32 DpaSkipHigh : 32; // bit 0..31 + } Bits; + UINT32 Uint32; +} CXL_HDM_DECODER_N_DPA_SKIP_HIGH_REGISTER; + +typedef union { + CXL_HDM_DECODER_N_TARGET_LIST_LOW_REGISTER TargetListLow; + CXL_HDM_DECODER_N_DPA_SKIP_LOW_REGISTER DpaSkipLow; +} CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_LOW; + +typedef union { + CXL_HDM_DECODER_N_TARGET_LIST_HIGH_REGISTER TargetListHigh; + CXL_HDM_DECODER_N_DPA_SKIP_HIGH_REGISTER DpaSkipHigh; +} CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_HIGH; + +typedef struct { + CXL_HDM_DECODER_N_BASE_LOW_REGISTER DecoderBaseLow; = // 0x10 + CXL_HDM_DECODER_N_BASE_HIGH_REGISTER DecoderBaseHigh; = // 0x14 + CXL_HDM_DECODER_N_SIZE_LOW_REGISTER DecoderSizeLow; = // 0x18 + CXL_HDM_DECODER_N_SIZE_HIGH_REGISTER DecoderSizeHigh; = // 0x1c + CXL_2_0_HDM_DECODER_N_CONTROL_REGISTER DecoderControl; = // 0x20 + CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_LOW DecoderTargetListDpaSkip= Low; // 0x24 + CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_HIGH DecoderTargetListDpaSkip= High; // 0x28 + UINT32 Reserved; = // 0x2C +} CXL_HDM_DECODER_N_INFO; + +typedef union { + struct { + UINT64 CxlDeviceCapabilityId : 16; // bit 0..15 + UINT64 CxlDeviceCapabilityVersion : 8; // bit 16..23 + UINT64 Reserved1 : 8; // bit 24..31 + UINT64 CxlDeviceCapabilitiesCount : 16; // bit 32..47 + UINT64 Reserved2 : 16; // bit 48..63 + } Bits; + UINT64 Uint64; +} CXL_DEVICE_CAPABILITIES_ARRAY_REGISTER; + +// +// CXL Memory Status Register +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.5 +// +typedef union { + struct { + UINT64 DeviceFatal : 1; // bit 0 + UINT64 FwHalt : 1; // bit 1 + UINT64 MediaStatus : 2; // bit 2..3 + UINT64 MailboxInterfacesReady : 1; // bit 4 + UINT64 ResetNeeded : 3; // bit 5..7 + UINT64 Reserved : 56; // bit 8..63 + } Bits; + UINT64 Uint64; +} CXL_MEMORY_DEVICE_STATUS_REGISTER; + +#pragma pack() + +#endif --=20 2.34.1 ________________________________________ From: Ni, Ray Sent: Friday, June 30, 2023 2:08 PM To: devel@edk2.groups.io; Chris Li OS; Yao, Jiewen; Nong, Foster Subject: RE: [edk2-devel] [PATCH 1/1] MdePkg: Add Cxl20.h into IndustryStan= dard +@Nong, Foster > -----Original Message----- > From: devel@edk2.groups.io On Behalf Of Chris Li O= S > via groups.io > Sent: Friday, June 30, 2023 2:07 PM > To: Yao, Jiewen ; devel@edk2.groups.io > Subject: Re: [edk2-devel] [PATCH 1/1] MdePkg: Add Cxl20.h into > IndustryStandard > > Thanks Jiewen, will soon send an v2 for it. > > ________________________________________ > From: Yao, Jiewen > Sent: Thursday, June 29, 2023 4:43 PM > To: Chris Li OS; devel@edk2.groups.io > Cc: Yao, Jiewen > Subject: RE: [PATCH 1/1] MdePkg: Add Cxl20.h into IndustryStandard > > Thanks for the update. > > +} HDM_DECODER_N_INFO; > > I think this need add CXL_ prefix. > > Other looks good to me. > > Thank you > Yao, Jiewen > > > > > -----Original Message----- > > From: Chris Li OS > > Sent: Wednesday, June 28, 2023 1:28 PM > > To: devel@edk2.groups.io; Yao, Jiewen > > Subject: [PATCH 1/1] MdePkg: Add Cxl20.h into IndustryStandard > > > > 1) Add CXL 2.0 header file to comply with CXL 2.0 specification > > 2) CXL 2.0 header will embed Cxl11.h > > 3) Updated Cxl.h to point to 2.0 header file > > > > Signed-off-by: Chris Li > > --- > > MdePkg/Include/IndustryStandard/Cxl.h | 2 +- > > MdePkg/Include/IndustryStandard/Cxl20.h | 477 > ++++++++++++++++++++++++ > > 2 files changed, 478 insertions(+), 1 deletion(-) > > create mode 100644 MdePkg/Include/IndustryStandard/Cxl20.h > > > > diff --git a/MdePkg/Include/IndustryStandard/Cxl.h > > b/MdePkg/Include/IndustryStandard/Cxl.h > > index 06c1230e3e..9ad3242e25 100644 > > --- a/MdePkg/Include/IndustryStandard/Cxl.h > > +++ b/MdePkg/Include/IndustryStandard/Cxl.h > > @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent > > #ifndef _CXL_MAIN_H_ > > #define _CXL_MAIN_H_ > > > > -#include > > +#include > > // > > // CXL assigned new Vendor ID > > // > > diff --git a/MdePkg/Include/IndustryStandard/Cxl20.h > > b/MdePkg/Include/IndustryStandard/Cxl20.h > > new file mode 100644 > > index 0000000000..a08251f4e9 > > --- /dev/null > > +++ b/MdePkg/Include/IndustryStandard/Cxl20.h > > @@ -0,0 +1,477 @@ > > +/** @file > > + CXL 2.0 Register definitions > > + > > + This file contains the register definitions based on the Compute Exp= ress Link > > + (CXL) Specification Revision 2.0. > > + > > + Copyright (c) 2023, Ampere Computing LLC. All rights reserved.
> > + > > + SPDX-License-Identifier: BSD-2-Clause-Patent > > + > > +**/ > > + > > +#ifndef CXL20_H_ > > +#define CXL20_H_ > > + > > +#include > > + > > +// > > +// Ensure proper structure formats > > +// > > +#pragma pack(1) > > + > > + > > +// > > +// CXL DVSEC IDs and Revisions > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.1 > > +// > > +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_CXL_DEVICE 0x0 > > +#define CXL_DVSEC_ID_NON_CXL_FUNCTION_MAP 0x2 > > +#define CXL_DVSEC_ID_CXL20_EXTENSIONS_DVSEC_FOR_PORTS 0x3 > > +#define CXL_DVSEC_ID_GPF_DVSEC_FOR_CXL_PORTS 0x4 > > +#define CXL_DVSEC_ID_GPF_DVSEC_FOR_CXL_DEVICES 0x5 > > +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_FLEX_BUS_PORT 0x7 > > +#define CXL_DVSEC_ID_REGISTER_LOCATOR 0x8 > > +#define CXL_DVSEC_ID_MLD 0x9 > > +#define CXL_DVSEC_ID_PCIE_DVSEC_FOR_TEST_CAPABILITY 0xA > > + > > +#define CXL20_DVSEC_REVISON_REGISTOR_LOCATOR 0x0 > > + > > +// > > +// Register Block ID > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.9.1 > > +// > > +#define CXL_REGISTER_BLOCK_ID_EMPTY 0x0 > > +#define CXL_REGISTER_BLOCK_ID_COMPONENT 0x01 > > +#define CXL_REGISTER_BLOCK_ID_BAR_VIRTUALIZATION_ACL 0x02 > > +#define CXL_REGISTER_BLOCK_ID_DEVICE 0x03 > > + > > +// > > +// Component Register Block Register Ranges Offset > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.4 > > +// > > +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_IO 0x0 > > +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_CACHE_MEM > > 0x1000 > > +#define CXL_COMPONENT_REGISTERS_RANGE_OFFSET_ARB_MUX > 0xE000 > > + > > +// > > +// CXL Cache Memory Capability IDs > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5 > > +// > > +#define CXL_CACHE_MEM_CAPABILITY_ID_CXL 0x1 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_RAS 0x2 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_SECURITY 0x3 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_LINK 0x4 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_HDM_DECODER 0x5 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_EXTENDED_SECURITY 0x6 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_IDE 0x7 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_SNOOP_FILTER 0x8 > > +#define CXL_CACHE_MEM_CAPABILITY_ID_MASK 0xFFFF > > + > > +// > > +// Generic CXL Device Capability IDs 0x0000 ~ 0x3FFF > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.2.1 > > +// > > +#define CXL_DEVICE_CAPABILITY_ID_CAPABILITIES_ARRAY_REGISTER > > 0x0000 > > +#define CXL_DEVICE_CAPABILITY_ID_DEVICE_STATUS 0x00= 01 > > +#define CXL_DEVICE_CAPABILITY_ID_PRIMARY_MAILBOX 0x00= 02 > > +#define CXL_DEVICE_CAPABILITY_ID_SECONDARY_MAILBOX 0x00= 03 > > + > > +// > > +// Specific CXL Device Capability IDs 0x4000 ~ 0x7FFF > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.2.1 > > +// > > +// (ref: CXL 2.0 spec $8.2.8.5) > > +#define CXL_DEVICE_CAPABILITY_ID_MEMORY_DEVICE_STATUS > > 0x4000 > > +#define CXL_DEVICE_CAPABILITY_ID_MASK 0xFF= FF > > + > > +// > > +// Memory Device Status > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.5.1= .1 > > +// > > +#define CXL_MEM_DEVICE_MEDIA_STATUS_NOT_READY 0b00 > > +#define CXL_MEM_DEVICE_MEDIA_STATUS_READY 0b01 > > +#define CXL_MEM_DEVICE_MEDIA_STATUS_ERROR 0b10 > > +#define CXL_MEM_DEVICE_MEDIA_STATUS_DISABLED 0b11 > > + > > +// > > +// PCIe DVSEC for CXL Device > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.3 > > +// > > +typedef union { > > + struct { > > + UINT16 CacheCapable : 1; // bit 0 > > + UINT16 IoCapable : 1; // bit 1 > > + UINT16 MemCapable : 1; // bit 2 > > + UINT16 MemHwInitMode : 1; // bit 3 > > + UINT16 HdmCount : 2; // bit 4..= 5 > > + UINT16 CacheWriteBackAndInvalidateCapable : 1; // bit 6 > > + UINT16 CxlResetCapable : 1; // bit 7 > > + UINT16 CxlResetTimeout : 3; // bit 8..= 10 > > + UINT16 CxlResetMemClrCapable : 1; // bit 11 > > + UINT16 Reserved : 1; // bit 12 > > + UINT16 MultipleLogicalDevice : 1; // bit 13 > > + UINT16 ViralCapable : 1; // bit 14 > > + UINT16 PmInitCompletionReportingCapable : 1; // bit 15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_DVSEC_CXL_DEVICE_CAPABILITY; > > + > > +typedef union { > > + struct { > > + UINT16 CacheEnable : 1; // bit 0 > > + UINT16 IoEnable : 1; // bit 1 > > + UINT16 MemEnable : 1; // bit 2 > > + UINT16 CacheSfCoverage : 5; // bit 3..7 > > + UINT16 CacheSfGranularity : 3; // bit 8..10 > > + UINT16 CacheCleanEviction : 1; // bit 11 > > + UINT16 Reserved1 : 2; // bit 12..13 > > + UINT16 ViralEnable : 1; // bit 14 > > + UINT16 Reserved2 : 1; // bit 15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_DVSEC_CXL_DEVICE_CONTROL; > > + > > +typedef union { > > + struct { > > + UINT16 Reserved1 : 14; // bit 0..13 > > + UINT16 ViralStatus : 1; // bit 14 > > + UINT16 Reserved2 : 1; // bit 15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_DVSEC_CXL_DEVICE_STATUS; > > + > > +typedef union { > > + struct { > > + UINT16 DisableCaching : 1; // bit 0 > > + UINT16 InitiateCacheWriteBackAndInvalidate : 1; // bit 1 > > + UINT16 InitiateCxlReset : 1; // bit 2 > > + UINT16 CxlResetMemClrEnable : 1; // bit 3 > > + UINT16 Reserved : 12; // bit 4..= 15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_2_0_DVSEC_CXL_DEVICE_CONTROL2; > > + > > +typedef union { > > + struct { > > + UINT16 CacheInvalid : 1; // bit= 0 > > + UINT16 CxlResetComplete : 1; // bit= 1 > > + UINT16 Reserved : 13; // bit= 2..14 > > + UINT16 PowerManagementInitialzationComplete : 1; // bit= 15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_2_0_DVSEC_CXL_DEVICE_STATUS2; > > + > > +typedef union { > > + struct { > > + UINT16 ConfigLock : 1; // bit 0 > > + UINT16 Reserved : 15; // bit 1..15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_DVSEC_CXL_DEVICE_LOCK; > > + > > +typedef union { > > + struct { > > + UINT16 CacheSizeUnit : 4; // bit 0..3 > > + UINT16 Reserved : 4; // bit 4..7 > > + UINT16 CacheSize : 8; // bit 8..15 > > + } Bits; > > + UINT16 Uint16; > > +} CXL_2_0_DVSEC_CXL_DEVICE_CAPABILITY2; > > + > > +typedef union { > > + struct { > > + UINT32 MemorySizeHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_HIGH; > > + > > +typedef union { > > + struct { > > + UINT32 MemoryInfoValid : 1; // bit 0 > > + UINT32 MemoryActive : 1; // bit 1 > > + UINT32 MediaType : 3; // bit 2..4 > > + UINT32 MemoryClass : 3; // bit 5..7 > > + UINT32 DesiredInterleave : 5; // bit 8..12 > > + UINT32 MemoryActiveTimeout : 3; // bit 13..15 > > + UINT32 Reserved : 12; // bit 16..27 > > + UINT32 MemorySizeLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_LOW; > > + > > +typedef union { > > + struct { > > + UINT32 MemoryBaseHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_HIGH; > > + > > +typedef union { > > + struct { > > + UINT32 Reserved : 28; // bit 0..27 > > + UINT32 MemoryBaseLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_LOW; > > + > > +typedef union { > > + struct { > > + UINT32 MemorySizeHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_HIGH; > > + > > +typedef union { > > + struct { > > + UINT32 MemoryInfoValid : 1; // bit 0 > > + UINT32 MemoryActive : 1; // bit 1 > > + UINT32 MediaType : 3; // bit 2..4 > > + UINT32 MemoryClass : 3; // bit 5..7 > > + UINT32 DesiredInterleave : 5; // bit 8..12 > > + UINT32 MemoryActiveTimeout : 3; // bit 13..15 > > + UINT32 Reserved : 12; // bit 16..27 > > + UINT32 MemorySizeLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_LOW; > > + > > +typedef union { > > + struct { > > + UINT32 MemoryBaseHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_HIGH; > > + > > +typedef union { > > + struct { > > + UINT32 Reserved : 28; // bit 0..27 > > + UINT32 MemoryBaseLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_LOW; > > + > > +typedef struct { > > + PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; > > // offset 0x00 > > + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_1 > > DesignatedVendorSpecificHeader1; // offset 0x04 > > + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_2 > > DesignatedVendorSpecificHeader2; // offset 0x08 > > + CXL_DVSEC_CXL_DEVICE_CAPABILITY DeviceCapability; > > // offset 0x0A > > + CXL_DVSEC_CXL_DEVICE_CONTROL DeviceControl; > > // offset 0x0C > > + CXL_DVSEC_CXL_DEVICE_STATUS DeviceStatus; = // > > offset 0x0E > > + CXL_2_0_DVSEC_CXL_DEVICE_CONTROL2 DeviceControl2; > > // offset 0x10 > > + CXL_2_0_DVSEC_CXL_DEVICE_STATUS2 DeviceStatus2; > > // offset 0x12 > > + CXL_DVSEC_CXL_DEVICE_LOCK DeviceLock; = // > > offset 0x14 > > + CXL_2_0_DVSEC_CXL_DEVICE_CAPABILITY2 DeviceCapability2= ; > > // offset 0x16 > > + CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_HIGH > DeviceRange1SizeHigh; > > // offset 0x18 > > + CXL_DVSEC_CXL_DEVICE_RANGE1_SIZE_LOW > DeviceRange1SizeLow; > > // offset 0x1C > > + CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_HIGH > > DeviceRange1BaseHigh; // offset 0x20 > > + CXL_DVSEC_CXL_DEVICE_RANGE1_BASE_LOW > > DeviceRange1BaseLow; // offset 0x24 > > + CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_HIGH > DeviceRange2SizeHigh; > > // offset 0x28 > > + CXL_DVSEC_CXL_DEVICE_RANGE2_SIZE_LOW > DeviceRange2SizeLow; > > // offset 0x2C > > + CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_HIGH > > DeviceRange2BaseHigh; // offset 0x30 > > + CXL_DVSEC_CXL_DEVICE_RANGE2_BASE_LOW > > DeviceRange2BaseLow; // offset 0x34 > > +} CXL_2_0_DVSEC_CXL_DEVICE; > > + > > +// > > +// Register Locator DVSEC > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.1.9 > > +// > > +typedef union { > > + struct { > > + UINT32 RegisterBir : 3; // bit 0..2 > > + UINT32 Reserved : 5; // bit 3..7 > > + UINT32 RegisterBlockIdentifier : 8; // bit 8..15 > > + UINT32 RegisterBlockOffsetLow : 16; // bit 16..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_LOW; > > + > > +typedef union { > > + struct { > > + UINT32 RegisterBlockOffsetHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_HIGH; > > + > > +typedef struct { > > + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_LOW OffsetLow; > > + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_OFFSET_HIGH OffsetHigh; > > +} CXL_REGISTER_LOCATOR_DVSEC_REGISTER_BLOCK; > > + > > + > > +typedef struct { > > + PCI_EXPRESS_EXTENDED_CAPABILITIES_HEADER Header; > > // offset 0x00 > > + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_1 > > DesignatedVendorSpecificHeader1; // offset 0x04 > > + PCI_EXPRESS_DESIGNATED_VENDOR_SPECIFIC_HEADER_2 > > DesignatedVendorSpecificHeader2; // offset 0x08 > > + UINT16 Reserved; = // offset 0x0A > > + CXL_REGISTER_LOCATOR_DVSEC_REGISTER_BLOCK RegisterBlock[1]; > > // offset 0x0C > > +} CXL_REGISTER_LOCATOR_DVSEC; > > + > > +// > > +// CXL HDM Decoder Capability Header Register > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5.5 > > +// > > +typedef union { > > + struct { > > + UINT32 CxlCapabilityId : 16; // bit 0..15 > > + UINT32 CxlCapabilityVersion : 4; // bit 16..19 > > + UINT32 CxlHdmDecoderCapabilityPointer : 12; // bit 20..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_CAPABILITY_HEADER_REGISTER; > > + > > +// > > +// CXL HDM Decoder Capability Register > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.5.12 > > +// > > +typedef union { > > + struct { > > + UINT32 DecoderCount : 4; // bit 0..3 > > + UINT32 TargetCount : 4; // bit 4..7 > > + UINT32 A11to8InterleaveCapable : 1; // bit 8 > > + UINT32 A14to12InterleaveCapable : 1; // bit 9 > > + UINT32 PoisonOnDecodeErrorCapability : 1; // bit 10 > > + UINT32 Reserved : 21; // bit 11..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_2_0_HDM_DECODER_CAPABILITY_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 PoisonOnDecodeErrorEnable : 1; // bit 0 > > + UINT32 HdmDecoderEnable : 1; // bit 1 > > + UINT32 Reserved : 30; // bit 2..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_GLOBAL_CONTROL_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 Reserved : 28; // bit 0..27 > > + UINT32 MemoryBaseLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_BASE_LOW_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 MemoryBaseHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_BASE_HIGH_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 Reserved : 28; // bit 0..27 > > + UINT32 MemorySizeLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_SIZE_LOW_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 MemorySizeHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_SIZE_HIGH_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 InterleaveGranularity : 4; // bit 0..3 > > + UINT32 InterleaveWays : 4; // bit 4..7 > > + UINT32 LockOnCommit : 1; // bit 8 > > + UINT32 Commit : 1; // bit 9 > > + UINT32 Committed : 1; // bit 10 > > + UINT32 ErrorNotCommitted : 1; // bit 11 > > + UINT32 TargetDeviceType : 1; // bit 12 > > + UINT32 Reserved : 19; // bit 13..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_2_0_HDM_DECODER_N_CONTROL_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 TargetPortIdentiferWay0 : 8; // bit 0..7 > > + UINT32 TargetPortIdentiferWay1 : 8; // bit 8..15 > > + UINT32 TargetPortIdentiferWay2 : 8; // bit 16..23 > > + UINT32 TargetPortIdentiferWay3 : 8; // bit 24..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_TARGET_LIST_LOW_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 Reserved : 28; // bit 0..27 > > + UINT32 DpaSkipLow : 4; // bit 28..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_DPA_SKIP_LOW_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 TargetPortIdentiferWay4 : 8; // bit 0..7 > > + UINT32 TargetPortIdentiferWay5 : 8; // bit 8..15 > > + UINT32 TargetPortIdentiferWay6 : 8; // bit 16..23 > > + UINT32 TargetPortIdentiferWay7 : 8; // bit 24..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_TARGET_LIST_HIGH_REGISTER; > > + > > +typedef union { > > + struct { > > + UINT32 DpaSkipHigh : 32; // bit 0..31 > > + } Bits; > > + UINT32 Uint32; > > +} CXL_HDM_DECODER_N_DPA_SKIP_HIGH_REGISTER; > > + > > +typedef union { > > + CXL_HDM_DECODER_N_TARGET_LIST_LOW_REGISTER TargetListLow; > > + CXL_HDM_DECODER_N_DPA_SKIP_LOW_REGISTER DpaSkipLow; > > +} CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_LOW; > > + > > +typedef union { > > + CXL_HDM_DECODER_N_TARGET_LIST_HIGH_REGISTER TargetListHigh; > > + CXL_HDM_DECODER_N_DPA_SKIP_HIGH_REGISTER DpaSkipHigh; > > +} CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_HIGH; > > + > > +typedef struct { > > + CXL_HDM_DECODER_N_BASE_LOW_REGISTER DecoderBaseLow; > > // 0x10 > > + CXL_HDM_DECODER_N_BASE_HIGH_REGISTER DecoderBaseHigh; > > // 0x14 > > + CXL_HDM_DECODER_N_SIZE_LOW_REGISTER DecoderSizeLow; > > // 0x18 > > + CXL_HDM_DECODER_N_SIZE_HIGH_REGISTER DecoderSizeHigh; > > // 0x1c > > + CXL_2_0_HDM_DECODER_N_CONTROL_REGISTER DecoderControl; > > // 0x20 > > + CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_LOW > > DecoderTargetListDpaSkipLow; // 0x24 > > + CXL_HDM_DECODER_N_TARGET_LIST_OR_DPA_SKIP_HIGH > > DecoderTargetListDpaSkipHigh; // 0x28 > > + UINT32 Reserved; = // 0x2C > > +} HDM_DECODER_N_INFO; > > + > > +typedef union { > > + struct { > > + UINT64 CxlDeviceCapabilityId : 16; // bit 0..15 > > + UINT64 CxlDeviceCapabilityVersion : 8; // bit 16..23 > > + UINT64 Reserved1 : 8; // bit 24..31 > > + UINT64 CxlDeviceCapabilitiesCount : 16; // bit 32..47 > > + UINT64 Reserved2 : 16; // bit 48..63 > > + } Bits; > > + UINT64 Uint64; > > +} CXL_DEVICE_CAPABILITIES_ARRAY_REGISTER; > > + > > +// > > +// CXL Memory Status Register > > +// Compute Express Link Specification Revision 2.0 - Chapter 8.2.8.5 > > +// > > +typedef union { > > + struct { > > + UINT64 DeviceFatal : 1; // bit 0 > > + UINT64 FwHalt : 1; // bit 1 > > + UINT64 MediaStatus : 2; // bit 2..3 > > + UINT64 MailboxInterfacesReady : 1; // bit 4 > > + UINT64 ResetNeeded : 3; // bit 5..7 > > + UINT64 Reserved : 56; // bit 8..63 > > + } Bits; > > + UINT64 Uint64; > > +} CXL_MEMORY_DEVICE_STATUS_REGISTER; > > + > > +#pragma pack() > > + > > +#endif > > -- > > 2.34.1 > > >=20 >