[Skiboot] [PATCH stable 08/14] sparse: fix endian conversions in hdata/iohub.c

Stewart Smith stewart at linux.vnet.ibm.com
Thu Jan 21 14:51:15 AEDT 2016


commit d6e3293cb1d794bf118aab334bb250ed12236956 upstream

Since skiboot is all BE and hdat is BE, this changes nothing except for silencing
the sparse warnings

hdata/iohub.c:35:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:35:9:    expected unsigned int
hdata/iohub.c:35:9:    got restricted beint32_t const [usertype] buid_ext
hdata/iohub.c:36:9: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:36:9:    expected unsigned int [unsigned] [usertype] proc_chip_id
hdata/iohub.c:36:9:    got restricted beint32_t const [usertype] proc_chip_id
hdata/iohub.c:36:9: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:36:9:    expected unsigned int [unsigned] [usertype] proc_chip_id
hdata/iohub.c:36:9:    got restricted beint32_t const [usertype] proc_chip_id
hdata/iohub.c:38:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:38:9:    expected unsigned int
hdata/iohub.c:38:9:    got restricted beint32_t const [usertype] gx_index
hdata/iohub.c:39:9: warning: incorrect type in initializer (different base types)
hdata/iohub.c:39:9:    expected unsigned int
hdata/iohub.c:39:9:    got restricted beint32_t const [usertype] ec_level
hdata/iohub.c:114:63: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:114:63:    expected unsigned short [unsigned] [usertype] slca_index
hdata/iohub.c:114:63:    got restricted beint16_t const [usertype] slca_index
hdata/iohub.c:634:17: warning: incorrect type in argument 1 (different base types)
hdata/iohub.c:634:17:    expected restricted beint32_t [usertype] be_val
hdata/iohub.c:634:17:    got restricted beint16_t const [usertype] hub_num
hdata/iohub.c:708:22: warning: incorrect type in assignment (different base types)
hdata/iohub.c:708:22:    expected unsigned int [unsigned] type
hdata/iohub.c:708:22:    got restricted beint32_t const [usertype] card_type

Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 hdata/iohub.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/hdata/iohub.c b/hdata/iohub.c
index 44ebded17e57..7dae74cf674e 100644
--- a/hdata/iohub.c
+++ b/hdata/iohub.c
@@ -33,11 +33,11 @@ static void io_add_common(struct dt_node *hn, const struct cechub_io_hub *hub)
 {
 	dt_add_property_cells(hn, "#address-cells", 2);
 	dt_add_property_cells(hn, "#size-cells", 2);
-	dt_add_property_cells(hn, "ibm,buid-ext", hub->buid_ext);
+	dt_add_property_cells(hn, "ibm,buid-ext", be32_to_cpu(hub->buid_ext));
 	dt_add_property_cells(hn, "ibm,chip-id",
-			      pcid_to_chip_id(hub->proc_chip_id));
-	dt_add_property_cells(hn, "ibm,gx-index", hub->gx_index);
-	dt_add_property_cells(hn, "revision", hub->ec_level);
+			      pcid_to_chip_id(be32_to_cpu(hub->proc_chip_id)));
+	dt_add_property_cells(hn, "ibm,gx-index", be32_to_cpu(hub->gx_index));
+	dt_add_property_cells(hn, "revision", be32_to_cpu(hub->ec_level));
 
 	/* Instead of exposing the GX BARs as separate ranges as we *should*
 	 * do in an ideal world, we just create a pass-through ranges and
@@ -112,7 +112,7 @@ static void io_get_loc_code(const void *sp_iohubs, struct dt_node *hn, const cha
 		memset(loc_code, 0, sizeof(loc_code));
 
 		/* Find LOC Code from SLCA Index */
-		slca_loc_code = slca_get_loc_code_index(fru_id->slca_index);
+		slca_loc_code = slca_get_loc_code_index(be16_to_cpu(fru_id->slca_index));
 		if (slca_loc_code) {
 			strncpy(loc_code, slca_loc_code, LOC_CODE_SIZE);
 			if (!dt_has_node_property(hn, prop_name, NULL)) {
@@ -635,7 +635,7 @@ static void io_parse_fru(const void *sp_iohubs)
 		prlog(PR_DEBUG, "CEC:   PChip: %d HUB ID: %04x [EC=0x%x]"
 		      " Hub#=%d)\n",
 		      be32_to_cpu(hub->proc_chip_id), hub_id,
-		      be32_to_cpu(hub->ec_level), be32_to_cpu(hub->hub_num));
+		      be32_to_cpu(hub->ec_level), be16_to_cpu(hub->hub_num));
 
 		switch(hub_id) {
 		case CECHUB_HUB_P7IOC:
@@ -706,7 +706,7 @@ void io_parse(void)
 			prerror("CEC: IO-HUB FRU %d, bad ID data\n", i);
 			continue;
 		}
-		type = fru_id_data->card_type;
+		type = be32_to_cpu(fru_id_data->card_type);
 
 		prlog(PR_INFO, "CEC: HUB FRU %d is %s\n",
 		      i, type > 4 ? "Unknown" : typestr[type]);
-- 
2.1.4



More information about the Skiboot mailing list