From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mx.groups.io with SMTP id smtpd.web12.10619.1609743600012869395 for ; Sun, 03 Jan 2021 23:00:00 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 134.134.136.65, mailfrom: heng.luo@intel.com) IronPort-SDR: bHtDDoSV42rrfcWYkHo3HNBmPdSv7926QCbSOMQJ+LVdBfOB+gXJ43gwaOyrUN/ZfSmvTogbbx qFM2H47Pco0A== X-IronPort-AV: E=McAfee;i="6000,8403,9853"; a="177020343" X-IronPort-AV: E=Sophos;i="5.78,473,1599548400"; d="scan'208";a="177020343" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jan 2021 22:59:58 -0800 IronPort-SDR: mf8GzZc1+etZ/f6OpsxTd5dAFtCSTPtnQzrO/nxCNqo9sc9/t3ynoFwGqpz8wvCAjbforYYSVC 66Bi8gKByhPw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,473,1599548400"; d="scan'208";a="349789076" Received: from hengluo-dev.ccr.corp.intel.com ([10.239.153.154]) by fmsmga008.fm.intel.com with ESMTP; 03 Jan 2021 22:59:57 -0800 From: "Heng Luo" To: devel@edk2.groups.io Cc: Ray Ni , Hao A Wu Subject: [Patch V3 1/2] MdePkg: Define structures for Resizable BAR Capability Date: Mon, 4 Jan 2021 14:59:53 +0800 Message-Id: <20210104065954.3901-1-heng.luo@intel.com> X-Mailer: git-send-email 2.24.0.windows.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3138 Define structures for Resizable BAR Capability in MdePkg/Include/IndustryStandard/PciExpress21.h, Change ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c to use new structures. Cc: Ray Ni Cc: Hao A Wu Signed-off-by: Heng Luo --- MdePkg/Include/IndustryStandard/PciExpress21.h | 30 +++++++++++++++++++= ++++++----- ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c | 6 +++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/MdePkg/Include/IndustryStandard/PciExpress21.h b/MdePkg/Includ= e/IndustryStandard/PciExpress21.h index 2c07cb560e..4617dc1569 100644 --- a/MdePkg/Include/IndustryStandard/PciExpress21.h +++ b/MdePkg/Include/IndustryStandard/PciExpress21.h @@ -1,7 +1,7 @@ /** @file=0D Support for the latest PCI standard.=0D =0D - Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.
=0D (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D =0D @@ -632,10 +632,30 @@ typedef struct { #define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID 0x0015=0D #define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_VER1 0x1=0D =0D +typedef union {=0D + struct {=0D + UINT32 Reserved:4;=0D + UINT32 BarSizeCapability:28;=0D + } Bits;=0D + UINT32 Uint32;=0D +} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CAPABILITY;=0D +=0D +=0D +typedef union {=0D + struct {=0D + UINT32 BarIndex:3;=0D + UINT32 Reserved:2;=0D + UINT32 ResizableBarNumber:3;=0D + UINT32 BarSize:6;=0D + UINT32 Reserved2:2;=0D + UINT32 BarSizeCapability:16;=0D + } Bits;=0D + UINT32 Uint32;=0D +} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL;=0D +=0D typedef struct {=0D - UINT32 ResizableBarCapab= ility;=0D - UINT16 ResizableBarContr= ol;=0D - UINT16 Reserved;=0D + PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CAPABILITY ResizableBarC= apability;=0D + PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL ResizableBarC= ontrol;=0D } PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY;=0D =0D typedef struct {=0D @@ -643,7 +663,7 @@ typedef struct { PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY Capability[1];=0D } PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR;=0D =0D -#define GET_NUMBER_RESIZABLE_BARS(x) (((x->Capability[0].ResizableBarContr= ol) & 0xE0) >> 5)=0D +#define GET_NUMBER_RESIZABLE_BARS(x) (x->Capability[0].ResizableBarControl= .Bits.ResizableBarNumber)=0D =0D #define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID 0x000E=0D #define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_VER1 0x1=0D diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c b/ShellPkg/L= ibrary/UefiShellDebug1CommandsLib/Pci.c index 3e138188ce..a2f04d8db5 100644 --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c @@ -1,7 +1,7 @@ /** @file=0D Main file for Pci shell Debug1 function.=0D =0D - Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.
=0D + Copyright (c) 2005 - 2021, Intel Corporation. All rights reserved.
=0D (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
=0D (C) Copyright 2016 Hewlett Packard Enterprise Development LP
=0D SPDX-License-Identifier: BSD-2-Clause-Patent=0D @@ -5534,8 +5534,8 @@ PrintInterpretedExtendedCompatibilityResizeableBar ( STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR),=0D gShellDebug1HiiHandle,=0D ItemCount+1,=0D - Header->Capability[ItemCount].ResizableBarCapability,=0D - Header->Capability[ItemCount].ResizableBarControl=0D + Header->Capability[ItemCount].ResizableBarCapability.Uint32,=0D + Header->Capability[ItemCount].ResizableBarControl.Uint32=0D );=0D }=0D =0D --=20 2.24.0.windows.2