Re: BURN_BRIDGES breaks kernel compile on PCIR_MAPS

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Mon, 24 May 2004 13:23:32 -0400
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
_at__at_ -368,7 +368,7 _at__at_
 #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) {
_at__at_ -384,7 +384,7 _at__at_
 	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);
_at__at_ -418,7 +418,7 _at__at_
        	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);
_at__at_ -428,7 +428,7 _at__at_
 	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);
_at__at_ -601,7 +601,7 _at__at_
 	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
_at__at_ -1834,7 +1834,7 _at__at_
 		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);
_at__at_ -1864,7 +1864,7 _at__at_
 	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
_at__at_ -2420,19 +2420,23 _at__at_
 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;
 
_at__at_ -2448,13 +2452,16 _at__at_
 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);
_at__at_ -2466,6 +2473,7 _at__at_
 	/* 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
_at__at_ -1916,19 +1916,23 _at__at_
 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;
 
_at__at_ -1944,13 +1948,16 _at__at_
 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);
_at__at_ -1962,6 +1969,7 _at__at_
 	/* 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 <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Mon May 24 2004 - 08:23:42 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:54 UTC