[Skiboot] [PATCH 1/2] platforms/ibm-fsp: Fix incorrect struct member access and comparison

Suraj Jitindar Singh sjitindarsingh at gmail.com
Mon Jul 18 15:26:12 AEST 2016


For a 1004 slot mapping bit 6 (0x40) of the P0 field represents the
pwr_ctl bit. This code previously accessed the wrong field (power_ctl)
which is a single bit which corresponds to the 1005 mapping (which is
the wrong mapping), performed a bitwise and with 0x40 (which will always
be 0), and then compared to 1 (which will also always be 0).

Fix this to access the byte struct member, bitwise and with 0x40 to mask
the power_ctl bit, and double negate to guarantee 0 or 1 result.

Fixes: 6884fe63 ("platforms/ibm-fsp: Support PCI slot")

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh at gmail.com>
Acked-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 platforms/ibm-fsp/lxvpd.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/platforms/ibm-fsp/lxvpd.c b/platforms/ibm-fsp/lxvpd.c
index 78e709c..72512b7 100644
--- a/platforms/ibm-fsp/lxvpd.c
+++ b/platforms/ibm-fsp/lxvpd.c
@@ -207,7 +207,7 @@ static void lxvpd_parse_1004_map(struct phb *phb,
 		s->vswitch_id     = entry->pba & 0xf;
 		s->dev_id         = entry->sba;
 		s->pluggable      = ((entry->p0.byte & 0x20) == 0);
-		s->power_ctl      = ((entry->p0.power_ctl & 0x40) == 1);
+		s->power_ctl      = !!(entry->p0.byte & 0x40);
 		s->bus_clock      = entry->p2.bus_clock - 4;
 		s->connector_type = entry->p2.connector_type - 5;
 		s->card_desc      = entry->p3.byte >> 6;
-- 
2.5.5



More information about the Skiboot mailing list