BURN_BRIDGES breaks kernel compile on PCIR_MAPS

John Baldwin jhb at FreeBSD.org
Mon May 24 10:23:42 PDT 2004


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 <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-current mailing list