From owner-p4-projects@FreeBSD.ORG Sun Nov 11 19:34:27 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 9194716A418; Sun, 11 Nov 2007 19:34:27 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06F8516A421 for ; Sun, 11 Nov 2007 19:34:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id E230C13C48D for ; Sun, 11 Nov 2007 19:34:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id lABJYQC8068383 for ; Sun, 11 Nov 2007 19:34:26 GMT (envelope-from gonzo@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id lABJYQl5068380 for perforce@freebsd.org; Sun, 11 Nov 2007 19:34:26 GMT (envelope-from gonzo@FreeBSD.org) Date: Sun, 11 Nov 2007 19:34:26 GMT Message-Id: <200711111934.lABJYQl5068380@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko To: Perforce Change Reviews Cc: Subject: PERFORCE change 128940 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: Sun, 11 Nov 2007 19:34:27 -0000 http://perforce.freebsd.org/chv.cgi?CH=128940 Change 128940 by gonzo@gonzo_jeeves on 2007/11/11 19:33:55 o Use all four windows (two memory, two IO) for resource allocation, otherwise korina BARs content exhaust IO window and vr devices fail to allocate resources. Affected files ... .. //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#5 edit Differences ... ==== //depot/projects/mips2/src/sys/mips/mips32/idt/idtpci.c#5 (text+ko) ==== @@ -122,8 +122,8 @@ device_t sc_dev; int sc_busno; - struct rman sc_mem_rman; - struct rman sc_io_rman; + struct rman sc_mem_rman[2]; + struct rman sc_io_rman[2]; struct rman sc_irq_rman; uint32_t sc_mem; uint32_t sc_io; @@ -241,20 +241,36 @@ /* Use KSEG1 to access IO ports for it is uncached */ sc->sc_io = 0; - sc->sc_io_rman.rm_type = RMAN_ARRAY; - sc->sc_io_rman.rm_descr = "IDTPCI I/O Ports"; - if (rman_init(&sc->sc_io_rman) != 0 || - rman_manage_region(&sc->sc_io_rman, + sc->sc_io_rman[0].rm_type = RMAN_ARRAY; + sc->sc_io_rman[0].rm_descr = "IDTPCI I/O Ports window 1"; + if (rman_init(&sc->sc_io_rman[0]) != 0 || + rman_manage_region(&sc->sc_io_rman[0], + IDT_PCIMEM2_BASE, IDT_PCIMEM2_BASE + IDT_PCIMEM2_SIZE - 1) != 0) { + panic("idtpci_attach: failed to set up I/O rman"); + } + + sc->sc_io_rman[1].rm_type = RMAN_ARRAY; + sc->sc_io_rman[1].rm_descr = "IDTPCI I/O Ports window 2"; + if (rman_init(&sc->sc_io_rman[1]) != 0 || + rman_manage_region(&sc->sc_io_rman[1], IDT_PCIMEM3_BASE, IDT_PCIMEM3_BASE + IDT_PCIMEM3_SIZE - 1) != 0) { panic("idtpci_attach: failed to set up I/O rman"); } /* Use KSEG1 to access PCI memory for it is uncached */ sc->sc_mem = 0; - sc->sc_mem_rman.rm_type = RMAN_ARRAY; - sc->sc_mem_rman.rm_descr = "IDTPCI PCI Memory"; - if (rman_init(&sc->sc_mem_rman) != 0 || - rman_manage_region(&sc->sc_mem_rman, + sc->sc_mem_rman[0].rm_type = RMAN_ARRAY; + sc->sc_mem_rman[0].rm_descr = "IDTPCI PCI Memory window 1"; + if (rman_init(&sc->sc_mem_rman[0]) != 0 || + rman_manage_region(&sc->sc_mem_rman[0], + IDT_PCIMEM0_BASE, IDT_PCIMEM0_BASE + IDT_PCIMEM0_SIZE) != 0) { + panic("idtpci_attach: failed to set up memory rman"); + } + + sc->sc_mem_rman[1].rm_type = RMAN_ARRAY; + sc->sc_mem_rman[1].rm_descr = "IDTPCI PCI Memory window 2"; + if (rman_init(&sc->sc_mem_rman[1]) != 0 || + rman_manage_region(&sc->sc_mem_rman[1], IDT_PCIMEM1_BASE, IDT_PCIMEM1_BASE + IDT_PCIMEM1_SIZE) != 0) { panic("idtpci_attach: failed to set up memory rman"); } @@ -458,25 +474,34 @@ struct idtpci_softc *sc = device_get_softc(bus); struct resource *rv = NULL; - struct rman *rm; + struct rman *rm1, *rm2; bus_space_handle_t bh = 0; void *vaddr; + switch (type) { case SYS_RES_IRQ: - rm = &sc->sc_irq_rman; + rm1 = &sc->sc_irq_rman; + rm2 = NULL; break; case SYS_RES_MEMORY: - rm = &sc->sc_mem_rman; + rm1 = &sc->sc_mem_rman[0]; + rm2 = &sc->sc_mem_rman[1]; break; case SYS_RES_IOPORT: - rm = &sc->sc_io_rman; + rm1 = &sc->sc_io_rman[0]; + rm2 = &sc->sc_io_rman[1]; break; default: return (NULL); } - rv = rman_reserve_resource(rm, start, end, count, flags, child); + rv = rman_reserve_resource(rm1, start, end, count, flags, child); + + /* Try second window if it exists */ + if ((rv == NULL) && (rm2 != NULL)) + rv = rman_reserve_resource(rm2, start, end, count, flags, + child); if (rv == NULL) return (NULL);