changeset 10595:1df9a0df7a0b

6869047 pcitool could not work correctly on sun4v platform if use "-s" option on snv_111
author Shesha Sreenivasamurthy <Shesha.Sreenivasamurthy@Sun.COM>
date Mon, 21 Sep 2009 13:34:48 -0700
parents 986cb68d2347
children ebad9a25355a
files usr/src/uts/sun4v/io/px/px_hcall.s usr/src/uts/sun4v/io/px/px_lib4v.c usr/src/uts/sun4v/io/px/px_libhv.c usr/src/uts/sun4v/io/px/px_tools_4v.c
diffstat 4 files changed, 10 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/sun4v/io/px/px_hcall.s	Mon Sep 21 10:38:24 2009 -0700
+++ b/usr/src/uts/sun4v/io/px/px_hcall.s	Mon Sep 21 13:34:48 2009 -0700
@@ -230,7 +230,7 @@
 	mov	HVIO_CONFIG_GET, %o5
 	ta	FAST_TRAP
 	movrnz	%o1, -1, %o2
-	stuw	%o2, [%o4]
+	stx	%o2, [%o4]
 	retl
 	nop
 	SET_SIZE(hvio_config_get)
--- a/usr/src/uts/sun4v/io/px/px_lib4v.c	Mon Sep 21 10:38:24 2009 -0700
+++ b/usr/src/uts/sun4v/io/px/px_lib4v.c	Mon Sep 21 13:34:48 2009 -0700
@@ -1172,13 +1172,13 @@
 	uint32_t pci_dev_addr = px_pvt->raddr;
 	uint32_t vaddr = px_pvt->vaddr;
 	uint16_t off = (uint16_t)(uintptr_t)(addr - vaddr) & 0xfff;
-	uint32_t rdata = 0;
+	uint64_t rdata = 0;
 
 	if (px_lib_config_get(px_pvt->dip, pci_dev_addr, off,
 	    size, (pci_cfg_data_t *)&rdata) != DDI_SUCCESS)
 		/* XXX update error kstats */
 		return (0xffffffff);
-	return (rdata);
+	return ((uint32_t)rdata);
 }
 
 static void
@@ -1935,13 +1935,13 @@
  */
 uint32_t
 px_fab_get(px_t *px_p, pcie_req_id_t bdf, uint16_t offset) {
-	uint32_t 	data = 0;
+	uint64_t 	data = 0;
 
 	(void) hvio_config_get(px_p->px_dev_hdl,
 	    (bdf << PX_RA_BDF_SHIFT), offset, 4,
 	    (pci_cfg_data_t *)&data);
 
-	return (data);
+	return ((uint32_t)data);
 }
 
 void
--- a/usr/src/uts/sun4v/io/px/px_libhv.c	Mon Sep 21 10:38:24 2009 -0700
+++ b/usr/src/uts/sun4v/io/px/px_libhv.c	Mon Sep 21 13:34:48 2009 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -61,8 +61,7 @@
 uint64_t
 hvio_rp_mps(devhandle_t dev_hdl, pci_device_t bdf, int32_t *mps, int op)
 {
-	uint32_t	data;
-	uint32_t	hdr, hdr_next_ptr, hdr_cap_id;
+	uint64_t	data, hdr, hdr_next_ptr, hdr_cap_id;
 	uint16_t	offset = PCI_CONF_STAT;
 	int		deadcount = 0;
 	pci_cfg_data_t	dataw;
@@ -117,7 +116,7 @@
 
 		data = (data & 0xffffff1f) | (*mps << 5);
 
-		dataw.qw = (uint32_t)data;
+		dataw.qw = data;
 
 		(void) hvio_config_put(dev_hdl, bdf, offset + PCIE_DEVCTL,
 		    4, dataw);
--- a/usr/src/uts/sun4v/io/px/px_tools_4v.c	Mon Sep 21 10:38:24 2009 -0700
+++ b/usr/src/uts/sun4v/io/px/px_tools_4v.c	Mon Sep 21 13:34:48 2009 -0700
@@ -19,12 +19,10 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <sys/sysmacros.h>
 #include <sys/machsystm.h>
 #include <sys/cpuvar.h>
@@ -293,25 +291,8 @@
 		DBG(DBG_TOOLS, dip, "get: bdf:0x%x, off:0x%" PRIx64 ", size:"
 		    "0x%" PRIx64 ", data:0x%" PRIx64 "\n",
 		    bdf, prg_p->offset, size, data.qw);
+		*data_p = data.qw;
 
-		switch (size) {
-			case sizeof (uint8_t):
-				*data_p = data.b;
-				break;
-			case sizeof (uint16_t):
-				*data_p = data.w;
-				break;
-			case sizeof (uint32_t):
-				*data_p = data.dw;
-				break;
-			case sizeof (uint64_t):
-				*data_p = data.qw;
-				break;
-			default:
-				DBG(DBG_TOOLS, dip,
-				    "bad size:0x%" PRIx64 "\n", size);
-				break;
-		}
 		if (PCITOOL_ACC_IS_BIG_ENDIAN(prg_p->acc_attr))
 			*data_p = pxtool_swap_endian(*data_p, size);
 	}