| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_tlp_eisa.c,v 1.28 2021/01/27 04:35:15 thorpej Exp $ */ | | 1 | /* $NetBSD: if_tlp_eisa.c,v 1.29 2021/07/24 18:50:07 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | | 8 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, |
9 | * NASA Ames Research Center. | | 9 | * NASA Ames Research Center. |
10 | * | | 10 | * |
11 | * Redistribution and use in source and binary forms, with or without | | 11 | * Redistribution and use in source and binary forms, with or without |
12 | * modification, are permitted provided that the following conditions | | 12 | * modification, are permitted provided that the following conditions |
13 | * are met: | | 13 | * are met: |
14 | * 1. Redistributions of source code must retain the above copyright | | 14 | * 1. Redistributions of source code must retain the above copyright |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
30 | * POSSIBILITY OF SUCH DAMAGE. | | 30 | * POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | /* | | 33 | /* |
34 | * EISA bus front-end for the Digital Semiconductor ``Tulip'' (21x4x) | | 34 | * EISA bus front-end for the Digital Semiconductor ``Tulip'' (21x4x) |
35 | * Ethernet controller family driver. | | 35 | * Ethernet controller family driver. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: if_tlp_eisa.c,v 1.28 2021/01/27 04:35:15 thorpej Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: if_tlp_eisa.c,v 1.29 2021/07/24 18:50:07 thorpej Exp $"); |
40 | | | 40 | |
41 | #include "opt_inet.h" | | 41 | #include "opt_inet.h" |
42 | | | 42 | |
43 | #include <sys/param.h> | | 43 | #include <sys/param.h> |
44 | #include <sys/systm.h> | | 44 | #include <sys/systm.h> |
45 | #include <sys/mbuf.h> | | 45 | #include <sys/mbuf.h> |
46 | #include <sys/malloc.h> | | 46 | #include <sys/malloc.h> |
47 | #include <sys/kernel.h> | | 47 | #include <sys/kernel.h> |
48 | #include <sys/socket.h> | | 48 | #include <sys/socket.h> |
49 | #include <sys/ioctl.h> | | 49 | #include <sys/ioctl.h> |
50 | #include <sys/errno.h> | | 50 | #include <sys/errno.h> |
51 | #include <sys/device.h> | | 51 | #include <sys/device.h> |
52 | | | 52 | |
| @@ -140,27 +140,27 @@ tlp_eisa_attach(device_t parent, device_ | | | @@ -140,27 +140,27 @@ tlp_eisa_attach(device_t parent, device_ |
140 | { 0xff, 0, 0x55, 0xaa, 0xff, 0, 0x55, 0xaa }; | | 140 | { 0xff, 0, 0x55, 0xaa, 0xff, 0, 0x55, 0xaa }; |
141 | struct tulip_eisa_softc *esc = device_private(self); | | 141 | struct tulip_eisa_softc *esc = device_private(self); |
142 | struct tulip_softc *sc = &esc->sc_tulip; | | 142 | struct tulip_softc *sc = &esc->sc_tulip; |
143 | struct eisa_attach_args *ea = aux; | | 143 | struct eisa_attach_args *ea = aux; |
144 | const struct device_compatible_entry *dce; | | 144 | const struct device_compatible_entry *dce; |
145 | eisa_chipset_tag_t ec = ea->ea_ec; | | 145 | eisa_chipset_tag_t ec = ea->ea_ec; |
146 | eisa_intr_handle_t ih; | | 146 | eisa_intr_handle_t ih; |
147 | bus_space_tag_t iot = ea->ea_iot; | | 147 | bus_space_tag_t iot = ea->ea_iot; |
148 | bus_space_handle_t ioh; | | 148 | bus_space_handle_t ioh; |
149 | const char *intrstr; | | 149 | const char *intrstr; |
150 | const struct tulip_eisa_product *tep; | | 150 | const struct tulip_eisa_product *tep; |
151 | u_int8_t enaddr[ETHER_ADDR_LEN], tmpbuf[sizeof(testpat)]; | | 151 | u_int8_t enaddr[ETHER_ADDR_LEN], tmpbuf[sizeof(testpat)]; |
152 | u_int32_t val; | | 152 | u_int32_t val; |
153 | int irq, i, cnt; | | 153 | int irq, ist, i, cnt; |
154 | char intrbuf[EISA_INTRSTR_LEN]; | | 154 | char intrbuf[EISA_INTRSTR_LEN]; |
155 | | | 155 | |
156 | /* | | 156 | /* |
157 | * Map the device. | | 157 | * Map the device. |
158 | */ | | 158 | */ |
159 | if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot), | | 159 | if (bus_space_map(iot, EISA_SLOT_ADDR(ea->ea_slot), |
160 | EISA_SLOT_SIZE, 0, &ioh)) { | | 160 | EISA_SLOT_SIZE, 0, &ioh)) { |
161 | aprint_error(": unable to map I/O space\n"); | | 161 | aprint_error(": unable to map I/O space\n"); |
162 | return; | | 162 | return; |
163 | } | | 163 | } |
164 | | | 164 | |
165 | sc->sc_dev = self; | | 165 | sc->sc_dev = self; |
166 | sc->sc_st = iot; | | 166 | sc->sc_st = iot; |
| @@ -234,39 +234,41 @@ tlp_eisa_attach(device_t parent, device_ | | | @@ -234,39 +234,41 @@ tlp_eisa_attach(device_t parent, device_ |
234 | } | | 234 | } |
235 | | | 235 | |
236 | /* | | 236 | /* |
237 | * All DE425 boards use the 21040 media switch. | | 237 | * All DE425 boards use the 21040 media switch. |
238 | */ | | 238 | */ |
239 | sc->sc_mediasw = &tlp_21040_mediasw; | | 239 | sc->sc_mediasw = &tlp_21040_mediasw; |
240 | | | 240 | |
241 | /* | | 241 | /* |
242 | * Figure out which IRQ we want to use, and determine if it's | | 242 | * Figure out which IRQ we want to use, and determine if it's |
243 | * edge- or level-triggered. | | 243 | * edge- or level-triggered. |
244 | */ | | 244 | */ |
245 | val = bus_space_read_4(iot, ioh, DE425_CFG0); | | 245 | val = bus_space_read_4(iot, ioh, DE425_CFG0); |
246 | irq = tlp_eisa_irqs[(val >> 1) & 0x03]; | | 246 | irq = tlp_eisa_irqs[(val >> 1) & 0x03]; |
| | | 247 | ist = (val & 0x01) ? IST_EDGE : IST_LEVEL; |
247 | | | 248 | |
248 | /* | | 249 | /* |
249 | * Map and establish our interrupt. | | 250 | * Map and establish our interrupt. |
250 | */ | | 251 | */ |
251 | if (eisa_intr_map(ec, irq, &ih)) { | | 252 | if (eisa_intr_map(ec, irq, &ih)) { |
252 | aprint_error_dev(self, "unable to map interrupt (%u)\n", irq); | | 253 | aprint_error_dev(self, "unable to map interrupt (%u)\n", irq); |
253 | return; | | 254 | return; |
254 | } | | 255 | } |
255 | intrstr = eisa_intr_string(ec, ih, intrbuf, sizeof(intrbuf)); | | 256 | intrstr = eisa_intr_string(ec, ih, intrbuf, sizeof(intrbuf)); |
256 | esc->sc_ih = eisa_intr_establish(ec, ih, | | 257 | esc->sc_ih = eisa_intr_establish(ec, ih, ist, IPL_NET, tlp_intr, sc); |
257 | (val & 0x01) ? IST_EDGE : IST_LEVEL, IPL_NET, tlp_intr, sc); | | | |
258 | if (esc->sc_ih == NULL) { | | 258 | if (esc->sc_ih == NULL) { |
259 | aprint_error_dev(self, "unable to establish interrupt"); | | 259 | aprint_error_dev(self, "unable to establish interrupt"); |
260 | if (intrstr != NULL) | | 260 | if (intrstr != NULL) |
261 | aprint_error(" at %s", intrstr); | | 261 | aprint_error(" at %s", intrstr); |
262 | aprint_error("\n"); | | 262 | aprint_error("\n"); |
263 | return; | | 263 | return; |
264 | } | | 264 | } |
265 | if (intrstr != NULL) | | 265 | if (intrstr != NULL) { |
266 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | | 266 | aprint_normal_dev(self, "interrupting at %s (%s trigger)\n", |
| | | 267 | ist == IST_EDGE ? "edge" : "level", intrstr); |
| | | 268 | } |
267 | | | 269 | |
268 | /* | | 270 | /* |
269 | * Finish off the attach. | | 271 | * Finish off the attach. |
270 | */ | | 272 | */ |
271 | tlp_attach(sc, enaddr); | | 273 | tlp_attach(sc, enaddr); |
272 | } | | 274 | } |