From owner-svn-src-stable-8@FreeBSD.ORG Fri Jan 15 16:42:40 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 458ED106566B; Fri, 15 Jan 2010 16:42:40 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 323188FC0C; Fri, 15 Jan 2010 16:42:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o0FGgegW030288; Fri, 15 Jan 2010 16:42:40 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o0FGgeHi030285; Fri, 15 Jan 2010 16:42:40 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201001151642.o0FGgeHi030285@svn.freebsd.org> From: Marius Strobl Date: Fri, 15 Jan 2010 16:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r202398 - stable/8/sys/sparc64/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 15 Jan 2010 16:42:40 -0000 Author: marius Date: Fri Jan 15 16:42:39 2010 New Revision: 202398 URL: http://svn.freebsd.org/changeset/base/202398 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/8/sys/sparc64/pci/psycho.c stable/8/sys/sparc64/pci/schizo.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/sparc64/pci/psycho.c ============================================================================== --- stable/8/sys/sparc64/pci/psycho.c Fri Jan 15 16:41:10 2010 (r202397) +++ stable/8/sys/sparc64/pci/psycho.c Fri Jan 15 16:42:39 2010 (r202398) @@ -181,9 +181,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) \ @@ -205,8 +205,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. @@ -263,7 +263,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); } @@ -295,7 +296,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); @@ -461,12 +462,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. @@ -474,11 +475,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); @@ -496,8 +498,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); @@ -515,21 +517,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) @@ -583,12 +585,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]); @@ -657,15 +659,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)); /* @@ -694,8 +696,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 @@ -704,7 +706,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], @@ -714,8 +717,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; @@ -875,7 +878,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); } @@ -992,8 +995,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; @@ -1029,8 +1032,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, ®, - sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf)) + if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, + ®, 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 @@ -1052,7 +1056,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); } @@ -1271,8 +1276,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: @@ -1387,7 +1392,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/8/sys/sparc64/pci/schizo.c ============================================================================== --- stable/8/sys/sparc64/pci/schizo.c Fri Jan 15 16:41:10 2010 (r202397) +++ stable/8/sys/sparc64/pci/schizo.c Fri Jan 15 16:42:39 2010 (r202398) @@ -180,9 +180,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 @@ -260,7 +260,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); @@ -289,18 +289,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); } /* @@ -333,7 +333,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; @@ -397,21 +398,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); } /* @@ -464,9 +465,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]) { @@ -500,13 +501,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. @@ -514,11 +514,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); @@ -541,12 +542,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]); @@ -634,7 +635,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; @@ -643,26 +645,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) @@ -690,11 +692,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, @@ -730,8 +732,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; @@ -965,8 +967,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; @@ -1001,8 +1003,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, ®, - sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), maskbuf)) + if (ofw_bus_lookup_imap(ofw_bus_get_node(dev), &sc->sc_pci_iinfo, + ®, sizeof(reg), &pintr, sizeof(pintr), &mintr, sizeof(mintr), + maskbuf)) return (mintr); device_printf(bridge, "could not route pin %d for device %d.%d\n", @@ -1037,8 +1040,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); @@ -1295,8 +1298,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: @@ -1411,7 +1414,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__);