PERFORCE change 94486 for review

John-Mark Gurney jmg at FreeBSD.org
Sun Apr 2 20:59:57 UTC 2006


http://perforce.freebsd.org/chv.cgi?CH=94486

Change 94486 by jmg at jmg_carbon-60 on 2006/04/02 20:59:42

	the hv api assumes that data is a 32bit word, it does not write
	directly to memory, so just letoh the data value...  hopefully this
	will fix thigns...

Affected files ...

.. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#12 edit

Differences ...

==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#12 (text+ko) ====

@@ -180,26 +180,25 @@
 
 	r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func),
 			    reg, width, (pci_cfg_data_t *)&data);
-#if 0
 	printf("%d = read_config(%#lx, %#x, %d, %d) = %#x\n", r,
 	       sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, data);
-#endif
 	if (r == H_EOK) {
 		switch (width) {
 		case 1:
-			ret = *(uint8_t *)&data;
+			ret = data & 0xff;
 			break;
 		case 2:
-			ret = *(uint16_t *)&data;
+			ret = le16toh(data & 0xffff);
 			break;
 		case 4:
-			ret = data;
+			ret = le32toh(data);
 			break;
 		default:
 			ret = -1;
 		}
-		return data;
+		return ret;
 	}
+
 	return -1;
 }
 
@@ -218,13 +217,13 @@
 	sc = device_get_softc(dev);
 	switch (width) {
 	case 1:
-		*(uint8_t *)&data = val;
+		data = val;
 		break;
 	case 2:
-		*(uint16_t *)&data = val;
+		data = htole16(val);
 		break;
 	case 4:
-		data = val;
+		data = htole32(val);
 		break;
 	default:
 		panic("unsupported width: %d", width);
@@ -239,10 +238,12 @@
 {
 }
 #endif
+
 static int
 hvpci_setup_intr(device_t dev, device_t child, struct resource *ires,
     int flags, driver_intr_t *intr, void *arg, void **cookiep)
 {
+
 	return (0);
 }
 
@@ -250,6 +251,7 @@
 hvpci_teardown_intr(device_t dev, device_t child, struct resource *vec,
      void *cookie)
 {
+
 	return (0);
 }
 
@@ -257,6 +259,7 @@
 hvpci_alloc_resource(device_t bus, device_t child, int type, int *rid,
     u_long start, u_long end, u_long count, u_int flags)
 {
+
 	return (NULL);
 }
 
@@ -264,6 +267,7 @@
 hvpci_activate_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r) 
 {
+
 	return (0);
 }
 
@@ -271,6 +275,7 @@
 hvpci_deactivate_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r) 
 {
+
 	return (0);
 }
 
@@ -278,5 +283,6 @@
 hvpci_release_resource(device_t bus, device_t child, int type, int rid,
     struct resource *r)
 {
+
 	return (0);
 }


More information about the p4-projects mailing list