cvs commit: src/sys/dev/netif/ipw if_ipw.c if_ipwvar.h

Matthew Dillon dillon at apollo.backplane.com
Tue Nov 29 11:17:42 PST 2005


:Thanks, this fixes the panic, but the firmware loading no longer works. I get:
:
:Nov 29 19:06:45 blob kernel: ipw0: timeout waiting for firmware initialization to complete
:Nov 29 19:06:45 blob kernel: ipw0: could not load firmware
:
:Regards,
: Johannes

    Ugh.  ipw is so badly written.  Sigh.  Try this patch.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>


Index: dev/netif/ipw/if_ipw.c
===================================================================
RCS file: /cvs/src/sys/dev/netif/ipw/if_ipw.c,v
retrieving revision 1.11
diff -u -r1.11 if_ipw.c
--- dev/netif/ipw/if_ipw.c	29 Nov 2005 17:15:56 -0000	1.11
+++ dev/netif/ipw/if_ipw.c	29 Nov 2005 19:13:55 -0000
@@ -1268,6 +1268,7 @@
 static int
 ipw_cmd(struct ipw_softc *sc, u_int32_t type, void *data, u_int32_t len)
 {
+	struct ifnet *ifp = &sc->sc_ic.ic_if;
 	struct ipw_soft_bd *sbd;
 	bus_addr_t physaddr;
 	int error;
@@ -1301,12 +1302,16 @@
 
 	sc->txcur = (sc->txcur + 1) % IPW_NTBD;
 	sc->txfree--;
-	CSR_WRITE_4(sc, IPW_CSR_TX_WRITE_INDEX, sc->txcur);
-
-	DPRINTFN(2, ("TX!CMD!%u!%u!%u!%u\n", type, 0, 0, len));
 
+	crit_enter();
+	tsleep_interlock(sc);
+	CSR_WRITE_4(sc, IPW_CSR_TX_WRITE_INDEX, sc->txcur);
+	lwkt_serialize_exit(ifp->if_serializer);
 	/* wait at most one second for command to complete */
-	return tsleep(sc, 0, "ipwcmd", hz);
+	error = tsleep(sc, 0, "ipwcmd", hz);
+	crit_exit();
+	lwkt_serialize_enter(ifp->if_serializer);
+	return (error);
 }
 
 static int
@@ -1706,6 +1711,7 @@
 static int
 ipw_load_firmware(struct ipw_softc *sc, u_char *fw, int size)
 {
+	struct ifnet *ifp = &sc->sc_ic.ic_if;
 	u_char *p, *end;
 	u_int32_t dst;
 	u_int16_t len;
@@ -1734,12 +1740,18 @@
 	CSR_WRITE_4(sc, IPW_CSR_INTR_MASK, IPW_INTR_MASK);
 
 	/* Tell the adapter to initialize the firmware */
+	crit_enter();
 	CSR_WRITE_4(sc, IPW_CSR_RST, 0);
 	CSR_WRITE_4(sc, IPW_CSR_CTL, CSR_READ_4(sc, IPW_CSR_CTL) |
 	    IPW_CTL_ALLOW_STANDBY);
 
 	/* Wait at most one second for firmware initialization to complete */
-	if ((error = tsleep(sc, 0, "ipwinit", hz)) != 0) {
+	tsleep_interlock(sc);
+	lwkt_serialize_exit(ifp->if_serializer);
+	error = tsleep(sc, 0, "ipwinit", hz);
+	crit_exit();
+	lwkt_serialize_enter(ifp->if_serializer);
+	if (error) {
 		if_printf(&sc->sc_ic.ic_if, "timeout waiting for firmware "
 		    "initialization to complete\n");
 		return error;





More information about the Commits mailing list