| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_mec.c,v 1.38 2009/09/02 10:43:24 tsutsui Exp $ */ | | 1 | /* $NetBSD: if_mec.c,v 1.39 2009/09/02 17:22:53 tsutsui Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved. | | 4 | * Copyright (c) 2004, 2008 Izumi Tsutsui. All rights reserved. |
5 | * | | 5 | * |
6 | * Redistribution and use in source and binary forms, with or without | | 6 | * Redistribution and use in source and binary forms, with or without |
7 | * modification, are permitted provided that the following conditions | | 7 | * modification, are permitted provided that the following conditions |
8 | * are met: | | 8 | * are met: |
9 | * 1. Redistributions of source code must retain the above copyright | | 9 | * 1. Redistributions of source code must retain the above copyright |
10 | * notice, this list of conditions and the following disclaimer. | | 10 | * notice, this list of conditions and the following disclaimer. |
11 | * 2. Redistributions in binary form must reproduce the above copyright | | 11 | * 2. Redistributions in binary form must reproduce the above copyright |
12 | * notice, this list of conditions and the following disclaimer in the | | 12 | * notice, this list of conditions and the following disclaimer in the |
13 | * documentation and/or other materials provided with the distribution. | | 13 | * documentation and/or other materials provided with the distribution. |
14 | * | | 14 | * |
| @@ -51,27 +51,27 @@ | | | @@ -51,27 +51,27 @@ |
51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 51 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 52 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 53 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 54 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 55 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 56 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
57 | */ | | 57 | */ |
58 | | | 58 | |
59 | /* | | 59 | /* |
60 | * MACE MAC-110 Ethernet driver | | 60 | * MACE MAC-110 Ethernet driver |
61 | */ | | 61 | */ |
62 | | | 62 | |
63 | #include <sys/cdefs.h> | | 63 | #include <sys/cdefs.h> |
64 | __KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.38 2009/09/02 10:43:24 tsutsui Exp $"); | | 64 | __KERNEL_RCSID(0, "$NetBSD: if_mec.c,v 1.39 2009/09/02 17:22:53 tsutsui Exp $"); |
65 | | | 65 | |
66 | #include "opt_ddb.h" | | 66 | #include "opt_ddb.h" |
67 | #include "bpfilter.h" | | 67 | #include "bpfilter.h" |
68 | #include "rnd.h" | | 68 | #include "rnd.h" |
69 | | | 69 | |
70 | #include <sys/param.h> | | 70 | #include <sys/param.h> |
71 | #include <sys/systm.h> | | 71 | #include <sys/systm.h> |
72 | #include <sys/device.h> | | 72 | #include <sys/device.h> |
73 | #include <sys/callout.h> | | 73 | #include <sys/callout.h> |
74 | #include <sys/mbuf.h> | | 74 | #include <sys/mbuf.h> |
75 | #include <sys/malloc.h> | | 75 | #include <sys/malloc.h> |
76 | #include <sys/kernel.h> | | 76 | #include <sys/kernel.h> |
77 | #include <sys/socket.h> | | 77 | #include <sys/socket.h> |
| @@ -717,27 +717,27 @@ mec_attach(device_t parent, device_t sel | | | @@ -717,27 +717,27 @@ mec_attach(device_t parent, device_t sel |
717 | NULL, device_xname(self), "TX pkts w/ptrs ~80bytes hdr"); | | 717 | NULL, device_xname(self), "TX pkts w/ptrs ~80bytes hdr"); |
718 | evcnt_attach_dynamic(&sc->sc_ev_txptrh5 , EVCNT_TYPE_MISC, | | 718 | evcnt_attach_dynamic(&sc->sc_ev_txptrh5 , EVCNT_TYPE_MISC, |
719 | NULL, device_xname(self), "TX pkts w/ptrs ~96bytes hdr"); | | 719 | NULL, device_xname(self), "TX pkts w/ptrs ~96bytes hdr"); |
720 | evcnt_attach_dynamic(&sc->sc_ev_txdstall , EVCNT_TYPE_MISC, | | 720 | evcnt_attach_dynamic(&sc->sc_ev_txdstall , EVCNT_TYPE_MISC, |
721 | NULL, device_xname(self), "TX stalled due to no txdesc"); | | 721 | NULL, device_xname(self), "TX stalled due to no txdesc"); |
722 | evcnt_attach_dynamic(&sc->sc_ev_txempty , EVCNT_TYPE_MISC, | | 722 | evcnt_attach_dynamic(&sc->sc_ev_txempty , EVCNT_TYPE_MISC, |
723 | NULL, device_xname(self), "TX empty interrupts"); | | 723 | NULL, device_xname(self), "TX empty interrupts"); |
724 | evcnt_attach_dynamic(&sc->sc_ev_txsent , EVCNT_TYPE_MISC, | | 724 | evcnt_attach_dynamic(&sc->sc_ev_txsent , EVCNT_TYPE_MISC, |
725 | NULL, device_xname(self), "TX sent interrupts"); | | 725 | NULL, device_xname(self), "TX sent interrupts"); |
726 | #endif | | 726 | #endif |
727 | | | 727 | |
728 | /* set shutdown hook to reset interface on powerdown */ | | 728 | /* set shutdown hook to reset interface on powerdown */ |
729 | if (pmf_device_register1(self, NULL, NULL, mec_shutdown)) | | 729 | if (pmf_device_register1(self, NULL, NULL, mec_shutdown)) |
730 | pmf_class_network_register(self, &sc->sc_ethercom.ec_if); | | 730 | pmf_class_network_register(self, ifp); |
731 | else | | 731 | else |
732 | aprint_error_dev(self, "couldn't establish power handler\n"); | | 732 | aprint_error_dev(self, "couldn't establish power handler\n"); |
733 | | | 733 | |
734 | return; | | 734 | return; |
735 | | | 735 | |
736 | /* | | 736 | /* |
737 | * Free any resources we've allocated during the failed attach | | 737 | * Free any resources we've allocated during the failed attach |
738 | * attempt. Do this in reverse order and fall though. | | 738 | * attempt. Do this in reverse order and fall though. |
739 | */ | | 739 | */ |
740 | fail_4: | | 740 | fail_4: |
741 | for (i = 0; i < MEC_NTXDESC; i++) { | | 741 | for (i = 0; i < MEC_NTXDESC; i++) { |
742 | if (sc->sc_txsoft[i].txs_dmamap != NULL) | | 742 | if (sc->sc_txsoft[i].txs_dmamap != NULL) |
743 | bus_dmamap_destroy(sc->sc_dmat, | | 743 | bus_dmamap_destroy(sc->sc_dmat, |