Thu Jun 20 15:25:28 2019 UTC ()
 Fix panic on attach. This bug was added in rev. 1.56. I think it's not
required to call txp_set_filter() in the attach function.


(msaitoh)
diff -r1.57 -r1.58 src/sys/dev/pci/if_txp.c

cvs diff -r1.57 -r1.58 src/sys/dev/pci/if_txp.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_txp.c 2019/05/29 10:07:29 1.57
+++ src/sys/dev/pci/if_txp.c 2019/06/20 15:25:28 1.58
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_txp.c,v 1.57 2019/05/29 10:07:29 msaitoh Exp $ */ 1/* $NetBSD: if_txp.c,v 1.58 2019/06/20 15:25:28 msaitoh Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 4 * Copyright (c) 2001
5 * Jason L. Wright <jason@thought.net>, Theo de Raadt, and 5 * Jason L. Wright <jason@thought.net>, Theo de Raadt, and
6 * Aaron Campbell <aaron@monkey.org>. All rights reserved. 6 * Aaron Campbell <aaron@monkey.org>. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -22,27 +22,27 @@ @@ -22,27 +22,27 @@
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27 * THE POSSIBILITY OF SUCH DAMAGE. 27 * THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30/* 30/*
31 * Driver for 3c990 (Typhoon) Ethernet ASIC 31 * Driver for 3c990 (Typhoon) Ethernet ASIC
32 */ 32 */
33 33
34#include <sys/cdefs.h> 34#include <sys/cdefs.h>
35__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.57 2019/05/29 10:07:29 msaitoh Exp $"); 35__KERNEL_RCSID(0, "$NetBSD: if_txp.c,v 1.58 2019/06/20 15:25:28 msaitoh Exp $");
36 36
37#include "opt_inet.h" 37#include "opt_inet.h"
38 38
39#include <sys/param.h> 39#include <sys/param.h>
40#include <sys/systm.h> 40#include <sys/systm.h>
41#include <sys/sockio.h> 41#include <sys/sockio.h>
42#include <sys/mbuf.h> 42#include <sys/mbuf.h>
43#include <sys/malloc.h> 43#include <sys/malloc.h>
44#include <sys/kernel.h> 44#include <sys/kernel.h>
45#include <sys/socket.h> 45#include <sys/socket.h>
46#include <sys/device.h> 46#include <sys/device.h>
47#include <sys/callout.h> 47#include <sys/callout.h>
48#include <sys/bus.h> 48#include <sys/bus.h>
@@ -266,28 +266,26 @@ txp_attach(device_t parent, device_t sel @@ -266,28 +266,26 @@ txp_attach(device_t parent, device_t sel
266 goto cleanupintr; 266 goto cleanupintr;
267 267
268 if (txp_alloc_rings(sc)) 268 if (txp_alloc_rings(sc))
269 goto cleanupintr; 269 goto cleanupintr;
270 270
271 if (txp_command(sc, TXP_CMD_MAX_PKT_SIZE_WRITE, TXP_MAX_PKTLEN, 0, 0, 271 if (txp_command(sc, TXP_CMD_MAX_PKT_SIZE_WRITE, TXP_MAX_PKTLEN, 0, 0,
272 NULL, NULL, NULL, 1)) 272 NULL, NULL, NULL, 1))
273 goto cleanupintr; 273 goto cleanupintr;
274 274
275 if (txp_command(sc, TXP_CMD_STATION_ADDRESS_READ, 0, 0, 0, 275 if (txp_command(sc, TXP_CMD_STATION_ADDRESS_READ, 0, 0, 0,
276 &p1, &p2, NULL, 1)) 276 &p1, &p2, NULL, 1))
277 goto cleanupintr; 277 goto cleanupintr;
278 278
279 txp_set_filter(sc); 
280 
281 p1 = htole16(p1); 279 p1 = htole16(p1);
282 enaddr[0] = ((uint8_t *)&p1)[1]; 280 enaddr[0] = ((uint8_t *)&p1)[1];
283 enaddr[1] = ((uint8_t *)&p1)[0]; 281 enaddr[1] = ((uint8_t *)&p1)[0];
284 p2 = htole32(p2); 282 p2 = htole32(p2);
285 enaddr[2] = ((uint8_t *)&p2)[3]; 283 enaddr[2] = ((uint8_t *)&p2)[3];
286 enaddr[3] = ((uint8_t *)&p2)[2]; 284 enaddr[3] = ((uint8_t *)&p2)[2];
287 enaddr[4] = ((uint8_t *)&p2)[1]; 285 enaddr[4] = ((uint8_t *)&p2)[1];
288 enaddr[5] = ((uint8_t *)&p2)[0]; 286 enaddr[5] = ((uint8_t *)&p2)[0];
289 287
290 aprint_normal_dev(self, "Ethernet address %s\n", 288 aprint_normal_dev(self, "Ethernet address %s\n",
291 ether_sprintf(enaddr)); 289 ether_sprintf(enaddr));
292 sc->sc_cold = 0; 290 sc->sc_cold = 0;
293 291