From owner-freebsd-current@FreeBSD.ORG Mon May 24 10:23:42 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9DFB116A4CE for ; Mon, 24 May 2004 10:23:42 -0700 (PDT) Received: from mail6.speakeasy.net (mail6.speakeasy.net [216.254.0.206]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6ED6243D45 for ; Mon, 24 May 2004 10:23:42 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 20488 invoked from network); 24 May 2004 17:23:04 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 24 May 2004 17:23:04 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.11/8.12.11) with ESMTP id i4OHMxO0099204; Mon, 24 May 2004 13:22:59 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: phk@FreeBSD.org Date: Mon, 24 May 2004 13:23:32 -0400 User-Agent: KMail/1.6 References: <49494.1085413273@critter.freebsd.dk> In-Reply-To: <49494.1085413273@critter.freebsd.dk> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200405241323.32631.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: current@FreeBSD.org cc: "M. Warner Losh" Subject: Re: BURN_BRIDGES breaks kernel compile on PCIR_MAPS X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 May 2004 17:23:42 -0000 On Monday 24 May 2004 11:41 am, Poul-Henning Kamp wrote: > 'nuff said Untested fix; Index: dev/cp/if_cp.c =================================================================== RCS file: /usr/cvs/src/sys/dev/cp/if_cp.c,v retrieving revision 1.1 diff -u -r1.1 if_cp.c --- dev/cp/if_cp.c 5 May 2004 16:11:45 -0000 1.1 +++ dev/cp/if_cp.c 24 May 2004 17:19:54 -0000 @@ -368,7 +368,7 @@ #else bd->board = b; b->sys = bd; - rid = PCIR_MAPS; + rid = PCIR_BAR(0); bd->cp_res = bus_alloc_resource (dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); if (! bd->cp_res) { @@ -384,7 +384,7 @@ if (res) { printf ("cp%d: can't init, error code:%x\n", unit, res); #if __FreeBSD_version >= 400000 - bus_release_resource (dev, SYS_RES_MEMORY, PCIR_MAPS, bd->cp_res); + bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->cp_res); #endif free (b, M_DEVBUF); splx (s); @@ -418,7 +418,7 @@ if (! bd->cp_irq) { printf ("cp%d: cannot map interrupt\n", unit); bus_release_resource (dev, SYS_RES_MEMORY, - PCIR_MAPS, bd->cp_res); + PCIR_BAR(0), bd->cp_res); free (b, M_DEVBUF); splx (s); return (ENXIO); @@ -428,7 +428,7 @@ if (error) { printf ("cp%d: cannot set up irq\n", unit); bus_release_resource (dev, SYS_RES_MEMORY, - PCIR_MAPS, bd->cp_res); + PCIR_BAR(0), bd->cp_res); bus_release_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq); free (b, M_DEVBUF); splx (s); @@ -601,7 +601,7 @@ bus_teardown_intr (dev, bd->cp_irq, bd->cp_intrhand); bus_deactivate_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq); bus_release_resource (dev, SYS_RES_IRQ, 0, bd->cp_irq); - bus_release_resource (dev, SYS_RES_MEMORY, PCIR_MAPS, bd->cp_res); + bus_release_resource (dev, SYS_RES_MEMORY, PCIR_BAR(0), bd->cp_res); cp_led_off (b); if (led_timo[b->num].callout) untimeout (cp_led_off, b, led_timo[b->num]); Index: dev/pci/pci.c =================================================================== RCS file: /usr/cvs/src/sys/dev/pci/pci.c,v retrieving revision 1.260 diff -u -r1.260 pci.c --- dev/pci/pci.c 24 May 2004 15:52:57 -0000 1.260 +++ dev/pci/pci.c 24 May 2004 17:17:34 -0000 @@ -1834,7 +1834,7 @@ pci_set_powerstate(dev, PCI_POWERSTATE_D0); } for (i = 0; i < dinfo->cfg.nummaps; i++) - pci_write_config(dev, PCIR_MAPS + i * 4, dinfo->cfg.bar[i], 4); + pci_write_config(dev, PCIR_BAR(i), dinfo->cfg.bar[i], 4); pci_write_config(dev, PCIR_BIOS, dinfo->cfg.bios, 4); pci_write_config(dev, PCIR_COMMAND, dinfo->cfg.cmdreg, 2); pci_write_config(dev, PCIR_INTLINE, dinfo->cfg.intline, 1); @@ -1864,7 +1864,7 @@ if (dinfo->cfg.hdrtype != 0) return; for (i = 0; i < dinfo->cfg.nummaps; i++) - dinfo->cfg.bar[i] = pci_read_config(dev, PCIR_MAPS + i * 4, 4); + dinfo->cfg.bar[i] = pci_read_config(dev, PCIR_BAR(i), 4); dinfo->cfg.bios = pci_read_config(dev, PCIR_BIOS, 4); /* Index: dev/re/if_re.c =================================================================== RCS file: /usr/cvs/src/sys/dev/re/if_re.c,v retrieving revision 1.22 diff -u -r1.22 if_re.c --- dev/re/if_re.c 23 May 2004 21:05:08 -0000 1.22 +++ dev/re/if_re.c 24 May 2004 17:21:29 -0000 @@ -2420,19 +2420,23 @@ re_suspend(dev) device_t dev; { +#ifndef BURN_BRIDGES register int i; +#endif struct rl_softc *sc; sc = device_get_softc(dev); re_stop(sc); +#ifndef BURN_BRIDGES for (i = 0; i < 5; i++) sc->saved_maps[i] = pci_read_config(dev, PCIR_MAPS + i * 4, 4); sc->saved_biosaddr = pci_read_config(dev, PCIR_BIOS, 4); sc->saved_intline = pci_read_config(dev, PCIR_INTLINE, 1); sc->saved_cachelnsz = pci_read_config(dev, PCIR_CACHELNSZ, 1); sc->saved_lattimer = pci_read_config(dev, PCIR_LATTIMER, 1); +#endif sc->suspended = 1; @@ -2448,13 +2452,16 @@ re_resume(dev) device_t dev; { +#ifndef BURN_BRIDGES register int i; +#endif struct rl_softc *sc; struct ifnet *ifp; sc = device_get_softc(dev); ifp = &sc->arpcom.ac_if; +#ifndef BURN_BRIDGES /* better way to do this? */ for (i = 0; i < 5; i++) pci_write_config(dev, PCIR_MAPS + i * 4, sc->saved_maps[i], 4); @@ -2466,6 +2473,7 @@ /* reenable busmastering */ pci_enable_busmaster(dev); pci_enable_io(dev, RL_RES); +#endif /* reinitialize interface if necessary */ if (ifp->if_flags & IFF_UP) Index: pci/if_rl.c =================================================================== RCS file: /usr/cvs/src/sys/pci/if_rl.c,v retrieving revision 1.136 diff -u -r1.136 if_rl.c --- pci/if_rl.c 23 May 2004 21:05:07 -0000 1.136 +++ pci/if_rl.c 24 May 2004 17:20:45 -0000 @@ -1916,19 +1916,23 @@ rl_suspend(dev) device_t dev; { +#ifndef BURN_BRIDGES register int i; +#endif struct rl_softc *sc; sc = device_get_softc(dev); rl_stop(sc); +#ifndef BURN_BRIDGEs for (i = 0; i < 5; i++) sc->saved_maps[i] = pci_read_config(dev, PCIR_MAPS + i * 4, 4); sc->saved_biosaddr = pci_read_config(dev, PCIR_BIOS, 4); sc->saved_intline = pci_read_config(dev, PCIR_INTLINE, 1); sc->saved_cachelnsz = pci_read_config(dev, PCIR_CACHELNSZ, 1); sc->saved_lattimer = pci_read_config(dev, PCIR_LATTIMER, 1); +#endif sc->suspended = 1; @@ -1944,13 +1948,16 @@ rl_resume(dev) device_t dev; { +#ifndef BURN_BRIDGES register int i; +#endif struct rl_softc *sc; struct ifnet *ifp; sc = device_get_softc(dev); ifp = &sc->arpcom.ac_if; +#ifndef BURN_BRIDGES /* better way to do this? */ for (i = 0; i < 5; i++) pci_write_config(dev, PCIR_MAPS + i * 4, sc->saved_maps[i], 4); @@ -1962,6 +1969,7 @@ /* reenable busmastering */ pci_enable_busmaster(dev); pci_enable_io(dev, RL_RES); +#endif /* reinitialize interface if necessary */ if (ifp->if_flags & IFF_UP) -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org