]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg: Define structures for Resizable BAR Capability
authorLuo, Heng <heng.luo@intel.com>
Mon, 4 Jan 2021 06:59:53 +0000 (14:59 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Mon, 4 Jan 2021 08:25:28 +0000 (08:25 +0000)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3138

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 <ray.ni@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/IndustryStandard/PciExpress21.h
ShellPkg/Library/UefiShellDebug1CommandsLib/Pci.c

index 2c07cb560e92aea21d8dda9f9d61c273dbd1a494..4617dc1569846e4958ce435228f0c62243c04bc7 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Support for the latest PCI standard.\r
 \r
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2021, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
@@ -632,10 +632,30 @@ typedef struct {
 #define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_ID    0x0015\r
 #define PCI_EXPRESS_EXTENDED_CAPABILITY_RESIZABLE_BAR_VER1  0x1\r
 \r
+typedef union {\r
+  struct {\r
+    UINT32 Reserved:4;\r
+    UINT32 BarSizeCapability:28;\r
+  } Bits;\r
+  UINT32   Uint32;\r
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CAPABILITY;\r
+\r
+\r
+typedef union {\r
+  struct {\r
+    UINT32 BarIndex:3;\r
+    UINT32 Reserved:2;\r
+    UINT32 ResizableBarNumber:3;\r
+    UINT32 BarSize:6;\r
+    UINT32 Reserved2:2;\r
+    UINT32 BarSizeCapability:16;\r
+  } Bits;\r
+  UINT32   Uint32;\r
+} PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL;\r
+\r
 typedef struct {\r
-  UINT32                                                 ResizableBarCapability;\r
-  UINT16                                                 ResizableBarControl;\r
-  UINT16                                                 Reserved;\r
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CAPABILITY ResizableBarCapability;\r
+  PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_CONTROL    ResizableBarControl;\r
 } PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY;\r
 \r
 typedef struct {\r
@@ -643,7 +663,7 @@ typedef struct {
   PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR_ENTRY  Capability[1];\r
 } PCI_EXPRESS_EXTENDED_CAPABILITIES_RESIZABLE_BAR;\r
 \r
-#define GET_NUMBER_RESIZABLE_BARS(x) (((x->Capability[0].ResizableBarControl) & 0xE0) >> 5)\r
+#define GET_NUMBER_RESIZABLE_BARS(x) (x->Capability[0].ResizableBarControl.Bits.ResizableBarNumber)\r
 \r
 #define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_ID    0x000E\r
 #define PCI_EXPRESS_EXTENDED_CAPABILITY_ARI_CAPABILITY_VER1  0x1\r
index 3e138188cec34d8e1f638a6d6c22e83faa687cd1..a2f04d8db58378bbcd89b1a1672add2003afa15b 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for Pci shell Debug1 function.\r
 \r
-  Copyright (c) 2005 - 2019, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2005 - 2021, Intel Corporation. All rights reserved.<BR>\r
   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>\r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   SPDX-License-Identifier: BSD-2-Clause-Patent\r
@@ -5534,8 +5534,8 @@ PrintInterpretedExtendedCompatibilityResizeableBar (
       STRING_TOKEN (STR_PCI_EXT_CAP_RESIZE_BAR),\r
       gShellDebug1HiiHandle,\r
       ItemCount+1,\r
-      Header->Capability[ItemCount].ResizableBarCapability,\r
-      Header->Capability[ItemCount].ResizableBarControl\r
+      Header->Capability[ItemCount].ResizableBarCapability.Uint32,\r
+      Header->Capability[ItemCount].ResizableBarControl.Uint32\r
       );\r
   }\r
 \r