public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] MdePkg/PciExpress21.h: Fix typo in PCI_REG_PCIE_SLOT_CONTROL
@ 2017-10-26  8:07 Ruiyu Ni
  2017-10-26  8:52 ` Gao, Liming
  0 siblings, 1 reply; 2+ messages in thread
From: Ruiyu Ni @ 2017-10-26  8:07 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

PCI_REG_PCIE_SLOT_CONTROL contains a typo. It is defined as:
typedef union {
  struct {
    UINT32 AttentionButtonPressed : 1;
    UINT32 ...
    ...
  } Bits;
  UINT16   Uint16;
} PCI_REG_PCIE_SLOT_CONTROL;

The bit field data type should be UINT16 instead of UINT32,
results sizeof (PCI_REG_PCIE_SLOT_CONTROL) equals to 4 instead of 2.

Because this structure is used in PCI_CAPABILITY_PCIEXP as below:
typedef struct {
  ...
  PCI_REG_PCIE_SLOT_CONTROL       SlotControl;
  PCI_REG_PCIE_SLOT_STATUS        SlotStatus;
} PCI_CAPABILITY_PCIEXP;

It cause the OFFSET_OF (PCI_CAPABILITY_PCIEXP, SlotStatus) equal
to a wrong value.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
 MdePkg/Include/IndustryStandard/PciExpress21.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/PciExpress21.h b/MdePkg/Include/IndustryStandard/PciExpress21.h
index ce9c06a7c6..d90b5975ba 100644
--- a/MdePkg/Include/IndustryStandard/PciExpress21.h
+++ b/MdePkg/Include/IndustryStandard/PciExpress21.h
@@ -182,18 +182,18 @@ typedef union {
 
 typedef union {
   struct {
-    UINT32 AttentionButtonPressed : 1;
-    UINT32 PowerFaultDetected : 1;
-    UINT32 MrlSensorChanged : 1;
-    UINT32 PresenceDetectChanged : 1;
-    UINT32 CommandCompletedInterrupt : 1;
-    UINT32 HotPlugInterrupt : 1;
-    UINT32 AttentionIndicator : 2;
-    UINT32 PowerIndicator : 2;
-    UINT32 PowerController : 1;
-    UINT32 ElectromechanicalInterlock : 1;
-    UINT32 DataLinkLayerStateChanged : 1;
-    UINT32 Reserved : 3;
+    UINT16 AttentionButtonPressed : 1;
+    UINT16 PowerFaultDetected : 1;
+    UINT16 MrlSensorChanged : 1;
+    UINT16 PresenceDetectChanged : 1;
+    UINT16 CommandCompletedInterrupt : 1;
+    UINT16 HotPlugInterrupt : 1;
+    UINT16 AttentionIndicator : 2;
+    UINT16 PowerIndicator : 2;
+    UINT16 PowerController : 1;
+    UINT16 ElectromechanicalInterlock : 1;
+    UINT16 DataLinkLayerStateChanged : 1;
+    UINT16 Reserved : 3;
   } Bits;
   UINT16   Uint16;
 } PCI_REG_PCIE_SLOT_CONTROL;
-- 
2.12.2.windows.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] MdePkg/PciExpress21.h: Fix typo in PCI_REG_PCIE_SLOT_CONTROL
  2017-10-26  8:07 [PATCH] MdePkg/PciExpress21.h: Fix typo in PCI_REG_PCIE_SLOT_CONTROL Ruiyu Ni
@ 2017-10-26  8:52 ` Gao, Liming
  0 siblings, 0 replies; 2+ messages in thread
From: Gao, Liming @ 2017-10-26  8:52 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Ni, Ruiyu
>Sent: Thursday, October 26, 2017 4:08 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [PATCH] MdePkg/PciExpress21.h: Fix typo in
>PCI_REG_PCIE_SLOT_CONTROL
>
>PCI_REG_PCIE_SLOT_CONTROL contains a typo. It is defined as:
>typedef union {
>  struct {
>    UINT32 AttentionButtonPressed : 1;
>    UINT32 ...
>    ...
>  } Bits;
>  UINT16   Uint16;
>} PCI_REG_PCIE_SLOT_CONTROL;
>
>The bit field data type should be UINT16 instead of UINT32,
>results sizeof (PCI_REG_PCIE_SLOT_CONTROL) equals to 4 instead of 2.
>
>Because this structure is used in PCI_CAPABILITY_PCIEXP as below:
>typedef struct {
>  ...
>  PCI_REG_PCIE_SLOT_CONTROL       SlotControl;
>  PCI_REG_PCIE_SLOT_STATUS        SlotStatus;
>} PCI_CAPABILITY_PCIEXP;
>
>It cause the OFFSET_OF (PCI_CAPABILITY_PCIEXP, SlotStatus) equal
>to a wrong value.
>
>Contributed-under: TianoCore Contribution Agreement 1.1
>Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
>Cc: Liming Gao <liming.gao@intel.com>
>---
> MdePkg/Include/IndustryStandard/PciExpress21.h | 24 ++++++++++++-------
>-----
> 1 file changed, 12 insertions(+), 12 deletions(-)
>
>diff --git a/MdePkg/Include/IndustryStandard/PciExpress21.h
>b/MdePkg/Include/IndustryStandard/PciExpress21.h
>index ce9c06a7c6..d90b5975ba 100644
>--- a/MdePkg/Include/IndustryStandard/PciExpress21.h
>+++ b/MdePkg/Include/IndustryStandard/PciExpress21.h
>@@ -182,18 +182,18 @@ typedef union {
>
> typedef union {
>   struct {
>-    UINT32 AttentionButtonPressed : 1;
>-    UINT32 PowerFaultDetected : 1;
>-    UINT32 MrlSensorChanged : 1;
>-    UINT32 PresenceDetectChanged : 1;
>-    UINT32 CommandCompletedInterrupt : 1;
>-    UINT32 HotPlugInterrupt : 1;
>-    UINT32 AttentionIndicator : 2;
>-    UINT32 PowerIndicator : 2;
>-    UINT32 PowerController : 1;
>-    UINT32 ElectromechanicalInterlock : 1;
>-    UINT32 DataLinkLayerStateChanged : 1;
>-    UINT32 Reserved : 3;
>+    UINT16 AttentionButtonPressed : 1;
>+    UINT16 PowerFaultDetected : 1;
>+    UINT16 MrlSensorChanged : 1;
>+    UINT16 PresenceDetectChanged : 1;
>+    UINT16 CommandCompletedInterrupt : 1;
>+    UINT16 HotPlugInterrupt : 1;
>+    UINT16 AttentionIndicator : 2;
>+    UINT16 PowerIndicator : 2;
>+    UINT16 PowerController : 1;
>+    UINT16 ElectromechanicalInterlock : 1;
>+    UINT16 DataLinkLayerStateChanged : 1;
>+    UINT16 Reserved : 3;
>   } Bits;
>   UINT16   Uint16;
> } PCI_REG_PCIE_SLOT_CONTROL;
>--
>2.12.2.windows.2



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-10-26  8:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  8:07 [PATCH] MdePkg/PciExpress21.h: Fix typo in PCI_REG_PCIE_SLOT_CONTROL Ruiyu Ni
2017-10-26  8:52 ` Gao, Liming

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox