| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ixp425_npe.c,v 1.6 2009/10/26 19:16:55 cegger Exp $ */ | | 1 | /* $NetBSD: ixp425_npe.c,v 1.7 2011/05/13 22:28:40 rmind Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2006 Sam Leffler, Errno Consulting | | 4 | * Copyright (c) 2006 Sam Leffler, Errno Consulting |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer, | | 11 | * notice, this list of conditions and the following disclaimer, |
12 | * without modification. | | 12 | * without modification. |
13 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer | | 13 | * 2. Redistributions in binary form must reproduce at minimum a disclaimer |
14 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any | | 14 | * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any |
| @@ -52,27 +52,27 @@ | | | @@ -52,27 +52,27 @@ |
52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE | | 52 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE |
53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 53 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 54 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 55 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | | 56 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
59 | * SUCH DAMAGE. | | 59 | * SUCH DAMAGE. |
60 | */ | | 60 | */ |
61 | #include <sys/cdefs.h> | | 61 | #include <sys/cdefs.h> |
62 | #if 0 | | 62 | #if 0 |
63 | __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); | | 63 | __FBSDID("$FreeBSD: src/sys/arm/xscale/ixp425/ixp425_npe.c,v 1.1 2006/11/19 23:55:23 sam Exp $"); |
64 | #endif | | 64 | #endif |
65 | __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.6 2009/10/26 19:16:55 cegger Exp $"); | | 65 | __KERNEL_RCSID(0, "$NetBSD: ixp425_npe.c,v 1.7 2011/05/13 22:28:40 rmind Exp $"); |
66 | | | 66 | |
67 | /* | | 67 | /* |
68 | * Intel XScale Network Processing Engine (NPE) support. | | 68 | * Intel XScale Network Processing Engine (NPE) support. |
69 | * | | 69 | * |
70 | * Each NPE has an ixpnpeX device associated with it that is | | 70 | * Each NPE has an ixpnpeX device associated with it that is |
71 | * attached at boot. Depending on the microcode loaded into | | 71 | * attached at boot. Depending on the microcode loaded into |
72 | * an NPE there may be an Ethernet interface (npeX) or some | | 72 | * an NPE there may be an Ethernet interface (npeX) or some |
73 | * other network interface (e.g. for ATM). This file has support | | 73 | * other network interface (e.g. for ATM). This file has support |
74 | * for loading microcode images and the associated NPE CPU | | 74 | * for loading microcode images and the associated NPE CPU |
75 | * manipulations (start, stop, reset). | | 75 | * manipulations (start, stop, reset). |
76 | * | | 76 | * |
77 | * The code here basically replaces the npeDl and npeMh classes | | 77 | * The code here basically replaces the npeDl and npeMh classes |
78 | * in the Intel Access Library (IAL). | | 78 | * in the Intel Access Library (IAL). |
| @@ -1374,35 +1374,28 @@ ixpnpe_sendmsg_locked(struct ixpnpe_soft | | | @@ -1374,35 +1374,28 @@ ixpnpe_sendmsg_locked(struct ixpnpe_soft |
1374 | error = EIO; | | 1374 | error = EIO; |
1375 | | | 1375 | |
1376 | if (error) | | 1376 | if (error) |
1377 | printf("%s: input FIFO timeout, msg [0x%x,0x%x]\n", | | 1377 | printf("%s: input FIFO timeout, msg [0x%x,0x%x]\n", |
1378 | sc->sc_dev.dv_xname, msg[0], msg[1]); | | 1378 | sc->sc_dev.dv_xname, msg[0], msg[1]); |
1379 | return error; | | 1379 | return error; |
1380 | } | | 1380 | } |
1381 | | | 1381 | |
1382 | static int | | 1382 | static int |
1383 | ixpnpe_recvmsg_locked(struct ixpnpe_softc *sc, uint32_t msg[2]) | | 1383 | ixpnpe_recvmsg_locked(struct ixpnpe_softc *sc, uint32_t msg[2]) |
1384 | { | | 1384 | { |
1385 | | | 1385 | |
1386 | if (!sc->sc_msgwaiting) { | | 1386 | if (!sc->sc_msgwaiting) { |
1387 | #if 0 | | 1387 | /* XXX interrupt context - cannot sleep */ |
1388 | /* | | | |
1389 | * This ltsleep() is dangerous because this function may be | | | |
1390 | * called under interrupt context. | | | |
1391 | */ | | | |
1392 | ltsleep(sc, 0, "npemh", 0, &sc->sc_lock); | | | |
1393 | #else | | | |
1394 | delay(1000); /* wait 1ms (is it ok?)*/ | | 1388 | delay(1000); /* wait 1ms (is it ok?)*/ |
1395 | #endif | | | |
1396 | } | | 1389 | } |
1397 | memcpy(msg, sc->sc_msg, sizeof(sc->sc_msg)); | | 1390 | memcpy(msg, sc->sc_msg, sizeof(sc->sc_msg)); |
1398 | /* NB: sc_msgwaiting != 1 means the ack fetch failed */ | | 1391 | /* NB: sc_msgwaiting != 1 means the ack fetch failed */ |
1399 | return sc->sc_msgwaiting != 1 ? EIO : 0; | | 1392 | return sc->sc_msgwaiting != 1 ? EIO : 0; |
1400 | } | | 1393 | } |
1401 | | | 1394 | |
1402 | /* | | 1395 | /* |
1403 | * Send a msg to the NPE and wait for a reply. We use the | | 1396 | * Send a msg to the NPE and wait for a reply. We use the |
1404 | * private mutex and sleep until an interrupt is received | | 1397 | * private mutex and sleep until an interrupt is received |
1405 | * signalling the availability of data in the output FIFO | | 1398 | * signalling the availability of data in the output FIFO |
1406 | * so the caller cannot be holding a mutex. May be better | | 1399 | * so the caller cannot be holding a mutex. May be better |
1407 | * piggyback on the caller's mutex instead but that would | | 1400 | * piggyback on the caller's mutex instead but that would |
1408 | * make other locking confusing. | | 1401 | * make other locking confusing. |