Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 15 Jan 2010 16:43:19 +0000 (UTC)
From:      Marius Strobl <marius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r202399 - stable/7/sys/sparc64/pci
Message-ID:  <201001151643.o0FGhJMS030459@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marius
Date: Fri Jan 15 16:43:19 2010
New Revision: 202399
URL: http://svn.freebsd.org/changeset/base/202399

Log:
  MFC: r201199
  
  - Prefer i and j over i and n for temporary integer variables.
  - Wrap/shorten too long lines.
  - Remove a redundant variable and an unnecessary cast in schizo(4).

Modified:
  stable/7/sys/sparc64/pci/psycho.c
  stable/7/sys/sparc64/pci/schizo.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/sparc64/pci/psycho.c
==============================================================================
--- stable/7/sys/sparc64/pci/psycho.c	Fri Jan 15 16:42:39 2010	(r202398)
+++ stable/7/sys/sparc64/pci/psycho.c	Fri Jan 15 16:43:19 2010	(r202399)
@@ -182,9 +182,9 @@ struct psycho_dma_sync {
 	void			*pds_arg;	/* argument for the handler */
 	void			*pds_cookie;	/* parent bus int. cookie */
 	device_t		pds_ppb;	/* farest PCI-PCI bridge */
-	uint8_t			pds_bus;	/* bus of farest PCI device */
-	uint8_t			pds_slot;	/* slot of farest PCI device */
-	uint8_t			pds_func;	/* func. of farest PCI device */
+	uint8_t			pds_bus;	/* bus of farest PCI dev. */
+	uint8_t			pds_slot;	/* slot of farest PCI dev. */
+	uint8_t			pds_func;	/* func. of farest PCI dev. */
 };
 
 #define	PSYCHO_READ8(sc, off) \
@@ -206,8 +206,8 @@ struct psycho_dma_sync {
  * "Hummingbird" is the UltraSPARC IIe onboard UPA to PCI bridge. It's
  * basically the same as Sabre but without an APB underneath it.
  *
- * "Psycho" and "Psycho+" are dual UPA to PCI bridges.  They sit on the UPA bus
- * and manage two PCI buses.  "Psycho" has two 64-bit 33MHz buses, while
+ * "Psycho" and "Psycho+" are dual UPA to PCI bridges.  They sit on the UPA
+ * bus and manage two PCI buses.  "Psycho" has two 64-bit 33MHz buses, while
  * "Psycho+" controls both a 64-bit 33Mhz and a 64-bit 66Mhz PCI bus.  You
  * will usually find a "Psycho+" since I don't think the original "Psycho"
  * ever shipped, and if it did it would be in the U30.
@@ -264,7 +264,8 @@ psycho_get_desc(device_t dev)
 
 	rv = psycho_find_desc(psycho_models, ofw_bus_get_model(dev));
 	if (rv == NULL)
-		rv = psycho_find_desc(psycho_compats, ofw_bus_get_compat(dev));
+		rv = psycho_find_desc(psycho_compats,
+		    ofw_bus_get_compat(dev));
 	return (rv);
 }
 
@@ -296,7 +297,7 @@ psycho_attach(device_t dev)
 	uint32_t dvmabase, prop, prop_array[2];
 	int32_t rev;
 	u_int rerun, ver;
-	int i, n;
+	int i, j;
 
 	node = ofw_bus_get_node(dev);
 	sc = device_get_softc(dev);
@@ -462,12 +463,12 @@ psycho_attach(device_t dev)
 	    rman_manage_region(&sc->sc_pci_mem_rman, 0, PSYCHO_MEM_SIZE) != 0)
 		panic("%s: failed to set up memory rman", __func__);
 
-	n = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range);
+	i = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range);
 	/*
 	 * Make sure that the expected ranges are present.  The
 	 * OFW_PCI_CS_MEM64 one is not currently used though.
 	 */
-	if (n != PSYCHO_NRANGE)
+	if (i != PSYCHO_NRANGE)
 		panic("%s: unsupported number of ranges", __func__);
 	/*
 	 * Find the addresses of the various bus spaces.
@@ -475,11 +476,12 @@ psycho_attach(device_t dev)
 	 * The physical start addresses of the ranges are the configuration,
 	 * memory and I/O handles.
 	 */
-	for (n = 0; n < PSYCHO_NRANGE; n++) {
-		i = OFW_PCI_RANGE_CS(&range[n]);
-		if (sc->sc_pci_bh[i] != 0)
-			panic("%s: duplicate range for space %d", __func__, i);
-		sc->sc_pci_bh[i] = OFW_PCI_RANGE_PHYS(&range[n]);
+	for (i = 0; i < PSYCHO_NRANGE; i++) {
+		j = OFW_PCI_RANGE_CS(&range[i]);
+		if (sc->sc_pci_bh[j] != 0)
+			panic("%s: duplicate range for space %d",
+			    __func__, j);
+		sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]);
 	}
 	free(range, M_OFWPROP);
 
@@ -497,8 +499,8 @@ psycho_attach(device_t dev)
 		 * vectors.  We do this early in order to be able to catch
 		 * stray interrupts.
 		 */
-		for (n = 0; n <= PSYCHO_MAX_INO; n++) {
-			if (psycho_find_intrmap(sc, n, &intrmap, &intrclr,
+		for (i = 0; i <= PSYCHO_MAX_INO; i++) {
+			if (psycho_find_intrmap(sc, i, &intrmap, &intrclr,
 			    NULL) == 0)
 				continue;
 			pica = malloc(sizeof(*pica), M_DEVBUF, M_NOWAIT);
@@ -516,21 +518,21 @@ psycho_attach(device_t dev)
 			 */
 			device_printf(dev,
 			    "intr map (INO %d, %s) %#lx: %#lx, clr: %#lx\n",
-			    n, intrmap <= PSR_PCIB3_INT_MAP ? "PCI" : "OBIO",
-			    (u_long)intrmap, (u_long)PSYCHO_READ8(sc, intrmap),
-			    (u_long)intrclr);
-			PSYCHO_WRITE8(sc, intrmap, INTMAP_VEC(sc->sc_ign, n));
+			    i, intrmap <= PSR_PCIB3_INT_MAP ? "PCI" : "OBIO",
+			    (u_long)intrmap, (u_long)PSYCHO_READ8(sc,
+			    intrmap), (u_long)intrclr);
+			PSYCHO_WRITE8(sc, intrmap, INTMAP_VEC(sc->sc_ign, i));
 			PSYCHO_WRITE8(sc, intrclr, 0);
 			PSYCHO_WRITE8(sc, intrmap,
-			    INTMAP_ENABLE(INTMAP_VEC(sc->sc_ign, n),
+			    INTMAP_ENABLE(INTMAP_VEC(sc->sc_ign, i),
 			    PCPU_GET(mid)));
 #endif
-			i = intr_controller_register(INTMAP_VEC(sc->sc_ign, n),
-			    &psycho_ic, pica);
-			if (i != 0)
+			j = intr_controller_register(INTMAP_VEC(sc->sc_ign,
+			    i), &psycho_ic, pica);
+			if (j != 0)
 				device_printf(dev, "could not register "
 				    "interrupt controller for INO %d (%d)\n",
-				    n, i);
+				    i, j);
 		}
 
 		if (sc->sc_mode == PSYCHO_MODE_PSYCHO)
@@ -584,12 +586,12 @@ psycho_attach(device_t dev)
 	sc->sc_pci_dmat->dt_cookie = sc->sc_is;
 	sc->sc_pci_dmat->dt_mt = &iommu_dma_methods;
 
-	n = OF_getprop(node, "bus-range", (void *)prop_array,
+	i = OF_getprop(node, "bus-range", (void *)prop_array,
 	    sizeof(prop_array));
-	if (n == -1)
+	if (i == -1)
 		panic("%s: could not get bus-range", __func__);
-	if (n != sizeof(prop_array))
-		panic("%s: broken bus-range (%d)", __func__, n);
+	if (i != sizeof(prop_array))
+		panic("%s: broken bus-range (%d)", __func__, i);
 	if (bootverbose)
 		device_printf(dev, "bus range %u to %u; PCI bus %d\n",
 		    prop_array[0], prop_array[1], prop_array[0]);
@@ -658,15 +660,15 @@ psycho_attach(device_t dev)
 	PCIB_WRITE_CONFIG(dev, sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC,
 	    PCIR_LATTIMER, OFW_PCI_LATENCY, 1);
 
-	for (n = PCIR_VENDOR; n < PCIR_STATUS; n += sizeof(uint16_t))
-		le16enc(&sc->sc_pci_hpbcfg[n], bus_space_read_2(
+	for (i = PCIR_VENDOR; i < PCIR_STATUS; i += sizeof(uint16_t))
+		le16enc(&sc->sc_pci_hpbcfg[i], bus_space_read_2(
 		    sc->sc_pci_cfgt, sc->sc_pci_bh[OFW_PCI_CS_CONFIG],
 		    PSYCHO_CONF_OFF(sc->sc_pci_secbus, PCS_DEVICE,
-		    PCS_FUNC, n)));
-	for (n = PCIR_REVID; n <= PCIR_BIST; n += sizeof(uint8_t))
-		sc->sc_pci_hpbcfg[n] = bus_space_read_1(sc->sc_pci_cfgt,
+		    PCS_FUNC, i)));
+	for (i = PCIR_REVID; i <= PCIR_BIST; i += sizeof(uint8_t))
+		sc->sc_pci_hpbcfg[i] = bus_space_read_1(sc->sc_pci_cfgt,
 		    sc->sc_pci_bh[OFW_PCI_CS_CONFIG], PSYCHO_CONF_OFF(
-		    sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC, n));
+		    sc->sc_pci_secbus, PCS_DEVICE, PCS_FUNC, i));
 
 	ofw_bus_setup_iinfo(node, &sc->sc_pci_iinfo, sizeof(ofw_pci_intr_t));
 	/*
@@ -695,8 +697,8 @@ psycho_set_intr(struct psycho_softc *sc,
 	int rid;
 
 	rid = index;
-	sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ,
-	    &rid, RF_ACTIVE);
+	sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev,
+	    SYS_RES_IRQ, &rid, RF_ACTIVE);
 	if (sc->sc_irq_res[index] == NULL && intrmap >= PSR_POWER_INT_MAP) {
 		/*
 		 * These interrupts aren't mandatory and not available
@@ -705,7 +707,8 @@ psycho_set_intr(struct psycho_softc *sc,
 		return;
 	}
 	if (sc->sc_irq_res[index] == NULL ||
-	    INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != sc->sc_ign ||
+	    INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) !=
+	    sc->sc_ign ||
 	    INTVEC(PSYCHO_READ8(sc, intrmap)) != vec ||
 	    intr_vectors[vec].iv_ic != &psycho_ic ||
 	    bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index],
@@ -715,8 +718,8 @@ psycho_set_intr(struct psycho_softc *sc,
 }
 
 static int
-psycho_find_intrmap(struct psycho_softc *sc, u_int ino, bus_addr_t *intrmapptr,
-    bus_addr_t *intrclrptr, bus_addr_t *intrdiagptr)
+psycho_find_intrmap(struct psycho_softc *sc, u_int ino,
+    bus_addr_t *intrmapptr, bus_addr_t *intrclrptr, bus_addr_t *intrdiagptr)
 {
 	bus_addr_t intrclr, intrmap;
 	uint64_t diag;
@@ -876,7 +879,7 @@ psycho_wakeup(void *arg)
 {
 	struct psycho_softc *sc = arg;
 
-	/* Gee, we don't really have a framework to deal with this properly. */
+	/* We don't really have a framework to deal with this properly. */
 	device_printf(sc->sc_dev, "power management wakeup\n");
 	return (FILTER_HANDLED);
 }
@@ -993,8 +996,8 @@ psycho_read_config(device_t dev, u_int b
 }
 
 static void
-psycho_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
-    uint32_t val, int width)
+psycho_write_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, uint32_t val, int width)
 {
 	struct psycho_softc *sc;
 	bus_space_handle_t bh;
@@ -1030,8 +1033,9 @@ psycho_route_interrupt(device_t bridge, 
 
 	sc = device_get_softc(bridge);
 	pintr = pin;
-	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, &reg,
-	    sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf))
+	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo,
+	    &reg, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
+	    maskbuf))
 		return (mintr);
 	/*
 	 * If this is outside of the range for an intpin, it's likely a full
@@ -1053,7 +1057,8 @@ psycho_route_interrupt(device_t bridge, 
 	intrmap = PSR_PCIA0_INT_MAP +
 	    8 * (pci_get_slot(dev) - 1 + 3 * sc->sc_half);
 	mintr = INTINO(PSYCHO_READ8(sc, intrmap)) + pin - 1;
-	device_printf(bridge, "guessing interrupt %d for device %d.%d pin %d\n",
+	device_printf(bridge,
+	    "guessing interrupt %d for device %d.%d pin %d\n",
 	    (int)mintr, pci_get_slot(dev), pci_get_function(dev), pin);
 	return (mintr);
 }
@@ -1272,8 +1277,8 @@ psycho_alloc_resource(device_t bus, devi
 		if (start != end)
 			panic("%s: XXX: interrupt range", __func__);
 		start = end = INTMAP_VEC(sc->sc_ign, end);
-		return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type,
-		    rid, start, end, count, flags));
+		return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
+		    type, rid, start, end, count, flags));
 	}
 	switch (type) {
 	case SYS_RES_MEMORY:
@@ -1388,7 +1393,8 @@ psycho_alloc_bus_tag(struct psycho_softc
 {
 	bus_space_tag_t bt;
 
-	bt = malloc(sizeof(struct bus_space_tag), M_DEVBUF, M_NOWAIT | M_ZERO);
+	bt = malloc(sizeof(struct bus_space_tag), M_DEVBUF,
+	    M_NOWAIT | M_ZERO);
 	if (bt == NULL)
 		panic("%s: out of memory", __func__);
 

Modified: stable/7/sys/sparc64/pci/schizo.c
==============================================================================
--- stable/7/sys/sparc64/pci/schizo.c	Fri Jan 15 16:42:39 2010	(r202398)
+++ stable/7/sys/sparc64/pci/schizo.c	Fri Jan 15 16:43:19 2010	(r202399)
@@ -181,9 +181,9 @@ struct schizo_dma_sync {
 	void			*sds_cookie;
 	uint64_t		sds_syncval;
 	device_t		sds_ppb;	/* farest PCI-PCI bridge */
-	uint8_t			sds_bus;	/* bus of farest PCI device */
-	uint8_t			sds_slot;	/* slot of farest PCI device */
-	uint8_t			sds_func;	/* func. of farest PCI device */
+	uint8_t			sds_bus;	/* bus of farest PCI dev. */
+	uint8_t			sds_slot;	/* slot of farest PCI dev. */
+	uint8_t			sds_func;	/* func. of farest PCI dev. */
 };
 
 #define	SCHIZO_PERF_CNT_QLTY	100
@@ -261,7 +261,7 @@ schizo_attach(device_t dev)
 	uint64_t ino_bitmap, reg;
 	phandle_t node;
 	uint32_t prop, prop_array[2];
-	int i, mode, n, nrange, rid, tsbsize;
+	int i, j, mode, rid, tsbsize;
 
 	sc = device_get_softc(dev);
 	node = ofw_bus_get_node(dev);
@@ -290,18 +290,18 @@ schizo_attach(device_t dev)
 	 */
 	sc->sc_half = (bus_get_resource_start(dev, SYS_RES_MEMORY, STX_PCI) >>
 	    20) & 1;
-	for (n = 0; n < (mode == SCHIZO_MODE_SCZ ? SCZ_NREG : TOM_NREG);
-	    n++) {
-		rid = n;
-		sc->sc_mem_res[n] = bus_alloc_resource_any(dev,
+	for (i = 0; i < (mode == SCHIZO_MODE_SCZ ? SCZ_NREG : TOM_NREG);
+	    i++) {
+		rid = i;
+		sc->sc_mem_res[i] = bus_alloc_resource_any(dev,
 		    SYS_RES_MEMORY, &rid,
 		    (((mode == SCHIZO_MODE_SCZ && ((sc->sc_half == 1 &&
-		    n == STX_PCI) || n == STX_CTRL)) ||
+		    i == STX_PCI) || i == STX_CTRL)) ||
 		    (mode == SCHIZO_MODE_TOM && sc->sc_half == 0 &&
-		    n == STX_CTRL)) ? RF_SHAREABLE : 0) | RF_ACTIVE);
-		if (sc->sc_mem_res[n] == NULL)
+		    i == STX_CTRL)) ? RF_SHAREABLE : 0) | RF_ACTIVE);
+		if (sc->sc_mem_res[i] == NULL)
 			panic("%s: could not allocate register bank %d",
-			    __func__, n);
+			    __func__, i);
 	}
 
 	/*
@@ -334,7 +334,8 @@ schizo_attach(device_t dev)
 
 	if (OF_getprop(node, "portid", &sc->sc_ign, sizeof(sc->sc_ign)) == -1)
 		panic("%s: could not determine IGN", __func__);
-	if (OF_getprop(node, "version#", &sc->sc_ver, sizeof(sc->sc_ver)) == -1)
+	if (OF_getprop(node, "version#", &sc->sc_ver, sizeof(sc->sc_ver)) ==
+	    -1)
 		panic("%s: could not determine version", __func__);
 	if (OF_getprop(node, "clock-frequency", &prop, sizeof(prop)) == -1)
 		prop = 33000000;
@@ -398,21 +399,21 @@ schizo_attach(device_t dev)
 	 * This is complicated by the fact that a pair of Schizo PBMs
 	 * shares one IGN.
 	 */
-	n = OF_getprop(node, "ino-bitmap", (void *)prop_array,
+	i = OF_getprop(node, "ino-bitmap", (void *)prop_array,
 	    sizeof(prop_array));
-	if (n == -1)
+	if (i == -1)
 		panic("%s: could not get ino-bitmap", __func__);
 	ino_bitmap = ((uint64_t)prop_array[1] << 32) | prop_array[0];
-	for (n = 0; n <= STX_MAX_INO; n++) {
-		if ((ino_bitmap & (1ULL << n)) == 0)
+	for (i = 0; i <= STX_MAX_INO; i++) {
+		if ((ino_bitmap & (1ULL << i)) == 0)
 			continue;
-		if (n == STX_FB0_INO || n == STX_FB1_INO)
+		if (i == STX_FB0_INO || i == STX_FB1_INO)
 			/* Leave for upa(4). */
 			continue;
-		i = schizo_intr_register(sc, n);
-		if (i != 0)
+		j = schizo_intr_register(sc, i);
+		if (j != 0)
 			device_printf(dev, "could not register interrupt "
-			    "controller for INO %d (%d)\n", n, i);
+			    "controller for INO %d (%d)\n", i, j);
 	}
 
 	/*
@@ -465,9 +466,9 @@ schizo_attach(device_t dev)
 		tsbsize = (x);						\
 		break;							\
 
-	n = OF_getprop(node, "virtual-dma", (void *)prop_array,
+	i = OF_getprop(node, "virtual-dma", (void *)prop_array,
 	    sizeof(prop_array));
-	if (n == -1 || n != sizeof(prop_array))
+	if (i == -1 || i != sizeof(prop_array))
 		schizo_iommu_init(sc, 7, -1);
 	else {
 		switch (prop_array[1]) {
@@ -501,13 +502,12 @@ schizo_attach(device_t dev)
 	    rman_manage_region(&sc->sc_pci_mem_rman, 0, STX_MEM_SIZE) != 0)
 		panic("%s: failed to set up memory rman", __func__);
 
-	nrange = OF_getprop_alloc(node, "ranges", sizeof(*range),
-	    (void **)&range);
+	i = OF_getprop_alloc(node, "ranges", sizeof(*range), (void **)&range);
 	/*
 	 * Make sure that the expected ranges are present.  The
 	 * OFW_PCI_CS_MEM64 one is not currently used though.
 	 */
-	if (nrange != STX_NRANGE)
+	if (i != STX_NRANGE)
 		panic("%s: unsupported number of ranges", __func__);
 	/*
 	 * Find the addresses of the various bus spaces.
@@ -515,11 +515,12 @@ schizo_attach(device_t dev)
 	 * The physical start addresses of the ranges are the configuration,
 	 * memory and I/O handles.
 	 */
-	for (n = 0; n < STX_NRANGE; n++) {
-		i = OFW_PCI_RANGE_CS(&range[n]);
-		if (sc->sc_pci_bh[i] != 0)
-			panic("%s: duplicate range for space %d", __func__, i);
-		sc->sc_pci_bh[i] = OFW_PCI_RANGE_PHYS(&range[n]);
+	for (i = 0; i < STX_NRANGE; i++) {
+		j = OFW_PCI_RANGE_CS(&range[i]);
+		if (sc->sc_pci_bh[j] != 0)
+			panic("%s: duplicate range for space %d",
+			    __func__, j);
+		sc->sc_pci_bh[j] = OFW_PCI_RANGE_PHYS(&range[i]);
 	}
 	free(range, M_OFWPROP);
 
@@ -542,12 +543,12 @@ schizo_attach(device_t dev)
 	 * Get the bus range from the firmware.
 	 * NB: Tomatillos don't support PCI bus reenumeration.
 	 */
-	n = OF_getprop(node, "bus-range", (void *)prop_array,
+	i = OF_getprop(node, "bus-range", (void *)prop_array,
 	    sizeof(prop_array));
-	if (n == -1)
+	if (i == -1)
 		panic("%s: could not get bus-range", __func__);
-	if (n != sizeof(prop_array))
-		panic("%s: broken bus-range (%d)", __func__, n);
+	if (i != sizeof(prop_array))
+		panic("%s: broken bus-range (%d)", __func__, i);
 	if (bootverbose)
 		device_printf(dev, "bus range %u to %u; PCI bus %d\n",
 		    prop_array[0], prop_array[1], prop_array[0]);
@@ -635,7 +636,8 @@ schizo_attach(device_t dev)
 	 * a block store after a write to TOMXMS_PCI_DMA_SYNC_PEND though.
 	 */
 	if ((sc->sc_mode == SCHIZO_MODE_SCZ && sc->sc_ver >= 5) ||
-	    sc->sc_mode == SCHIZO_MODE_TOM || sc->sc_mode == SCHIZO_MODE_XMS) {
+	    sc->sc_mode == SCHIZO_MODE_TOM ||
+	    sc->sc_mode == SCHIZO_MODE_XMS) {
 		sc->sc_flags |= SCHIZO_FLAGS_CDMA;
 		if (sc->sc_mode == SCHIZO_MODE_SCZ) {
 			sc->sc_cdma_state = SCHIZO_CDMA_STATE_DONE;
@@ -644,26 +646,26 @@ schizo_attach(device_t dev)
 			 * at RID 4 but most don't.  With the latter we add
 			 * it ourselves at the spare RID 5.
 			 */
-			n = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ,
+			i = INTINO(bus_get_resource_start(dev, SYS_RES_IRQ,
 			    4));
-			if (n == STX_CDMA_A_INO || n == STX_CDMA_B_INO) {
-				(void)schizo_get_intrmap(sc, n, NULL,
+			if (i == STX_CDMA_A_INO || i == STX_CDMA_B_INO) {
+				(void)schizo_get_intrmap(sc, i, NULL,
 				   &sc->sc_cdma_clr);
-				schizo_set_intr(sc, 4, n, schizo_cdma);
+				schizo_set_intr(sc, 4, i, schizo_cdma);
 			} else {
-				n = STX_CDMA_A_INO + sc->sc_half;
+				i = STX_CDMA_A_INO + sc->sc_half;
 				if (bus_set_resource(dev, SYS_RES_IRQ, 5,
-				    INTMAP_VEC(sc->sc_ign, n), 1) != 0)
+				    INTMAP_VEC(sc->sc_ign, i), 1) != 0)
 					panic("%s: failed to add CDMA "
 					    "interrupt", __func__);
-				i = schizo_intr_register(sc, n);
-				if (i != 0)
+				j = schizo_intr_register(sc, i);
+				if (j != 0)
 					panic("%s: could not register "
 					    "interrupt controller for CDMA "
-					    "(%d)", __func__, i);
-				(void)schizo_get_intrmap(sc, n, NULL,
+					    "(%d)", __func__, j);
+				(void)schizo_get_intrmap(sc, i, NULL,
 				   &sc->sc_cdma_clr);
-				schizo_set_intr(sc, 5, n, schizo_cdma);
+				schizo_set_intr(sc, 5, i, schizo_cdma);
 			}
 		}
 		if (sc->sc_mode == SCHIZO_MODE_TOM && sc->sc_ver <= 4)
@@ -691,11 +693,11 @@ schizo_set_intr(struct schizo_softc *sc,
 	int rid;
 
 	rid = index;
-	sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev, SYS_RES_IRQ,
-	    &rid, RF_ACTIVE);
+	sc->sc_irq_res[index] = bus_alloc_resource_any(sc->sc_dev,
+	    SYS_RES_IRQ, &rid, RF_ACTIVE);
 	if (sc->sc_irq_res[index] == NULL ||
-	    INTIGN(vec = rman_get_start(sc->sc_irq_res[index])) != sc->sc_ign ||
-	    INTINO(vec) != ino ||
+	    INTINO(vec = rman_get_start(sc->sc_irq_res[index])) != ino ||
+	    INTIGN(vec) != sc->sc_ign ||
 	    intr_vectors[vec].iv_ic != &schizo_ic ||
 	    bus_setup_intr(sc->sc_dev, sc->sc_irq_res[index],
 	    INTR_TYPE_MISC | INTR_FAST, handler, NULL, sc,
@@ -731,8 +733,8 @@ schizo_intr_register(struct schizo_softc
 }
 
 static int
-schizo_get_intrmap(struct schizo_softc *sc, u_int ino, bus_addr_t *intrmapptr,
-    bus_addr_t *intrclrptr)
+schizo_get_intrmap(struct schizo_softc *sc, u_int ino,
+    bus_addr_t *intrmapptr, bus_addr_t *intrclrptr)
 {
 	bus_addr_t intrclr, intrmap;
 	uint64_t mr;
@@ -966,8 +968,8 @@ schizo_read_config(device_t dev, u_int b
 }
 
 static void
-schizo_write_config(device_t dev, u_int bus, u_int slot, u_int func, u_int reg,
-    uint32_t val, int width)
+schizo_write_config(device_t dev, u_int bus, u_int slot, u_int func,
+    u_int reg, uint32_t val, int width)
 {
 	struct schizo_softc *sc;
 	bus_space_handle_t bh;
@@ -1002,8 +1004,9 @@ schizo_route_interrupt(device_t bridge, 
 
 	sc = device_get_softc(bridge);
 	pintr = pin;
-	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, &reg,
-	    sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf))
+	if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo,
+	    &reg, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr),
+	    maskbuf))
 		return (mintr);
 
 	device_printf(bridge, "could not route pin %d for device %d.%d\n",
@@ -1038,8 +1041,8 @@ schizo_dma_sync_stub(void *arg)
 
 	(void)PCIB_READ_CONFIG(sds->sds_ppb, sds->sds_bus, sds->sds_slot,
 	    sds->sds_func, PCIR_VENDOR, 2);
-	for (; atomic_cmpset_acq_32(&sc->sc_cdma_state, SCHIZO_CDMA_STATE_DONE,
-	    SCHIZO_CDMA_STATE_PENDING) == 0;)
+	for (; atomic_cmpset_acq_32(&sc->sc_cdma_state,
+	    SCHIZO_CDMA_STATE_DONE, SCHIZO_CDMA_STATE_PENDING) == 0;)
 		;
 	SCHIZO_PCI_WRITE_8(sc, sc->sc_cdma_clr, 1);
 	microuptime(&cur);
@@ -1296,8 +1299,8 @@ schizo_alloc_resource(device_t bus, devi
 		if (start != end)
 			panic("%s: XXX: interrupt range", __func__);
 		start = end = INTMAP_VEC(sc->sc_ign, end);
-		return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child, type,
-		    rid, start, end, count, flags));
+		return (BUS_ALLOC_RESOURCE(device_get_parent(bus), child,
+		    type, rid, start, end, count, flags));
 	}
 	switch (type) {
 	case SYS_RES_MEMORY:
@@ -1412,7 +1415,7 @@ schizo_alloc_bus_tag(struct schizo_softc
 {
 	bus_space_tag_t bt;
 
-	bt = (bus_space_tag_t)malloc(sizeof(struct bus_space_tag), M_DEVBUF,
+	bt = malloc(sizeof(struct bus_space_tag), M_DEVBUF,
 	    M_NOWAIT | M_ZERO);
 	if (bt == NULL)
 		panic("%s: out of memory", __func__);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201001151643.o0FGhJMS030459>