Fri May 13 22:28:40 2011 UTC ()
Eliminate few references to ltsleep.


(rmind)
diff -r1.6 -r1.7 src/sys/arch/arm/xscale/ixp425_npe.c
diff -r1.18 -r1.19 src/sys/dev/ppbus/ppbus_conf.c

cvs diff -r1.6 -r1.7 src/sys/arch/arm/xscale/ixp425_npe.c (expand / switch to unified diff)

--- src/sys/arch/arm/xscale/ixp425_npe.c 2009/10/26 19:16:55 1.6
+++ src/sys/arch/arm/xscale/ixp425_npe.c 2011/05/13 22:28:40 1.7
@@ -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
1382static int 1382static int
1383ixpnpe_recvmsg_locked(struct ixpnpe_softc *sc, uint32_t msg[2]) 1383ixpnpe_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.

cvs diff -r1.18 -r1.19 src/sys/dev/ppbus/ppbus_conf.c (expand / switch to unified diff)

--- src/sys/dev/ppbus/ppbus_conf.c 2009/11/11 15:34:37 1.18
+++ src/sys/dev/ppbus/ppbus_conf.c 2011/05/13 22:28:40 1.19
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ppbus_conf.c,v 1.18 2009/11/11 15:34:37 he Exp $ */ 1/* $NetBSD: ppbus_conf.c,v 1.19 2011/05/13 22:28:40 rmind Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1997, 1998, 1999 Nicolas Souchu 4 * Copyright (c) 1997, 1998, 1999 Nicolas Souchu
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 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,27 +20,27 @@ @@ -20,27 +20,27 @@
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 * 27 *
28 * FreeBSD: src/sys/dev/ppbus/ppbconf.c,v 1.17.2.1 2000/05/24 00:20:57 n_hibma Exp 28 * FreeBSD: src/sys/dev/ppbus/ppbconf.c,v 1.17.2.1 2000/05/24 00:20:57 n_hibma Exp
29 * 29 *
30 */ 30 */
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: ppbus_conf.c,v 1.18 2009/11/11 15:34:37 he Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: ppbus_conf.c,v 1.19 2011/05/13 22:28:40 rmind Exp $");
34 34
35#include "opt_ppbus.h" 35#include "opt_ppbus.h"
36#include "opt_ppbus_1284.h" 36#include "opt_ppbus_1284.h"
37 37
38#include "gpio.h" 38#include "gpio.h"
39 39
40#include <sys/param.h> 40#include <sys/param.h>
41#include <sys/systm.h> 41#include <sys/systm.h>
42#include <sys/kernel.h> 42#include <sys/kernel.h>
43#include <sys/device.h> 43#include <sys/device.h>
44#include <sys/proc.h> 44#include <sys/proc.h>
45 45
46#include <dev/ppbus/ppbus_1284.h> 46#include <dev/ppbus/ppbus_1284.h>
@@ -145,27 +145,27 @@ ppbus_attach(device_t parent, device_t s @@ -145,27 +145,27 @@ ppbus_attach(device_t parent, device_t s
145 ppbus->sc_1284_error = PPBUS_NO_ERROR; 145 ppbus->sc_1284_error = PPBUS_NO_ERROR;
146 146
147 /* Record device's sucessful attachment */ 147 /* Record device's sucessful attachment */
148 ppbus->sc_dev_ok = PPBUS_OK; 148 ppbus->sc_dev_ok = PPBUS_OK;
149 149
150#ifndef DONTPROBE_1284 150#ifndef DONTPROBE_1284
151 /* detect IEEE1284 compliant devices */ 151 /* detect IEEE1284 compliant devices */
152 if (ppbus_scan_bus(self)) { 152 if (ppbus_scan_bus(self)) {
153 printf("%s: No IEEE1284 device found.\n", device_xname(self)); 153 printf("%s: No IEEE1284 device found.\n", device_xname(self));
154 } else { 154 } else {
155 printf("%s: IEEE1284 device found.\n", device_xname(self)); 155 printf("%s: IEEE1284 device found.\n", device_xname(self));
156 /* 156 /*
157 * Detect device ID (interrupts must be disabled because we 157 * Detect device ID (interrupts must be disabled because we
158 * cannot do a ltsleep() to wait for it - no context) 158 * cannot do a block to wait for it - no context)
159 */ 159 */
160 if (args.capabilities & PPBUS_HAS_INTR) { 160 if (args.capabilities & PPBUS_HAS_INTR) {
161 int val = 0; 161 int val = 0;
162 if(ppbus_write_ivar(self, PPBUS_IVAR_INTR, &val) != 0) { 162 if(ppbus_write_ivar(self, PPBUS_IVAR_INTR, &val) != 0) {
163 printf(" <problem initializing interrupt " 163 printf(" <problem initializing interrupt "
164 "usage>"); 164 "usage>");
165 } 165 }
166 } 166 }
167 ppbus_pnp_detect(self); 167 ppbus_pnp_detect(self);
168 } 168 }
169#endif /* !DONTPROBE_1284 */ 169#endif /* !DONTPROBE_1284 */
170 170
171 /* Configure child devices */ 171 /* Configure child devices */