From owner-p4-projects@FreeBSD.ORG Sat May 20 18:59:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C061716A426; Sat, 20 May 2006 18:59:01 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5F2E016A421 for ; Sat, 20 May 2006 18:59:01 +0000 (UTC) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2279643D45 for ; Sat, 20 May 2006 18:59:01 +0000 (GMT) (envelope-from kmacy@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k4KIwQ6l084848 for ; Sat, 20 May 2006 18:58:26 GMT (envelope-from kmacy@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k4KIwQiT084845 for perforce@freebsd.org; Sat, 20 May 2006 18:58:26 GMT (envelope-from kmacy@freebsd.org) Date: Sat, 20 May 2006 18:58:26 GMT Message-Id: <200605201858.k4KIwQiT084845@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to kmacy@freebsd.org using -f From: Kip Macy To: Perforce Change Reviews Cc: Subject: PERFORCE change 97524 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 May 2006 18:59:02 -0000 http://perforce.freebsd.org/chv.cgi?CH=97524 Change 97524 by kmacy@kmacy_storage:sun4v_rwbuf on 2006/05/20 18:58:01 add debug output interrupt assignment Affected files ... .. //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#40 edit Differences ... ==== //depot/projects/kmacy_sun4v/src/sys/sun4v/sun4v/hv_pci.c#40 (text+ko) ==== @@ -200,6 +200,9 @@ sc->hs_pci_ioh = OFW_PCI_RANGE_PHYS(&range[i]) & PHYS_MASK; type = PCI_IO_BUS_SPACE; +#ifdef DEBUG + printf("io handle: %#lx\n", sc->hs_pci_ioh); +#endif break; case OFW_PCI_CS_MEM32: @@ -277,31 +280,19 @@ r = hvio_config_get(sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, (pci_cfg_data_t *)&data); + if (r == H_EOK) { switch (width) { case 1: ret = data & 0xff; if (ret == 0 && reg == PCIR_INTLINE) ret = PCI_INVALID_IRQ; -#if 0 - printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r, - sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret); -#endif break; case 2: ret = data & 0xffff; -#if 0 - printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r, - sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret); -#endif - break; case 4: ret = data; -#if 0 - printf("%ld = read_config(%#lx, %#x, %d, %d) = %#x\n", r, - sc->hs_devhandle, HVPCI_BDF(bus, slot, func), reg, width, ret); -#endif break; default: ret = -1; @@ -381,6 +372,9 @@ switch (type) { case SYS_RES_IOPORT: *tag = sc->hs_pci_iot; +#ifdef DEBUG + printf("io handle: %#lx\n", sc->hs_pci_ioh + childhdl); +#endif return (sc->hs_pci_ioh + childhdl); break; @@ -432,14 +426,15 @@ struct hvpci_softc *sc; int pciintr, rid; int error; + int i; sc = device_get_softc(dev); pciintr = rman_get_start(ires); /* sun4v uses 1 through 4 interrupts */ - KASSERT(pciintr >= 1 && pciintr <= 4, - ("interrupt out of range")); - rid = pciintr; + KASSERT(pciintr >= 1 && pciintr <= 4, ("interrupt out of range")); + for (i = 1; i <= 4; i++) { + rid = pciintr = i; pciintr--; if (sc->hs_intr[pciintr] == NULL) { if ((sc->hs_intr[pciintr] = bus_alloc_resource_any(dev, @@ -464,6 +459,7 @@ device_printf(dev, "bus_setup_intr: %d\n", error); return (error); } + } return (0); } @@ -478,6 +474,7 @@ sc = device_get_softc(dev); pciintr = rman_get_start(vec); + KASSERT(pciintr >= 1 && pciintr <= 4, ("interrupt out of range")); pciintr--; error = bus_teardown_intr(dev, sc->hs_intr[pciintr], cookie); @@ -526,6 +523,9 @@ break; case SYS_RES_IOPORT: +#ifdef DEBUG + printf("alloc: start: %#lx, end: %#lx, count: %#lx\n", start, end, count); +#endif rm = &sc->hs_pci_io_rman; bt = sc->hs_pci_iot; bh = sc->hs_pci_ioh; @@ -536,6 +536,12 @@ } rv = rman_reserve_resource(rm, start, end, count, flags, child); +#ifdef DEBUG + if (type == SYS_RES_IRQ) { + printf("%s: reserve_resource: start: %ld, end: %ld, flags: %#x, rv: %p\n", + __func__, start, end, flags, rv); + } +#endif if (rv == NULL) return (NULL);