| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_cas.c,v 1.45 2021/05/08 00:27:02 thorpej Exp $ */ | | 1 | /* $NetBSD: if_cas.c,v 1.46 2021/05/30 00:17:20 joerg Exp $ */ |
2 | /* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ | | 2 | /* $OpenBSD: if_cas.c,v 1.29 2009/11/29 16:19:38 kettenis Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * | | 5 | * |
6 | * Copyright (C) 2007 Mark Kettenis. | | 6 | * Copyright (C) 2007 Mark Kettenis. |
7 | * Copyright (C) 2001 Eduardo Horvath. | | 7 | * Copyright (C) 2001 Eduardo Horvath. |
8 | * All rights reserved. | | 8 | * All rights reserved. |
9 | * | | 9 | * |
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 |
| @@ -34,27 +34,27 @@ | | | @@ -34,27 +34,27 @@ |
34 | /* | | 34 | /* |
35 | * Driver for Sun Cassini ethernet controllers. | | 35 | * Driver for Sun Cassini ethernet controllers. |
36 | * | | 36 | * |
37 | * There are basically two variants of this chip: Cassini and | | 37 | * There are basically two variants of this chip: Cassini and |
38 | * Cassini+. We can distinguish between the two by revision: 0x10 and | | 38 | * Cassini+. We can distinguish between the two by revision: 0x10 and |
39 | * up are Cassini+. The most important difference is that Cassini+ | | 39 | * up are Cassini+. The most important difference is that Cassini+ |
40 | * has a second RX descriptor ring. Cassini+ will not work without | | 40 | * has a second RX descriptor ring. Cassini+ will not work without |
41 | * configuring that second ring. However, since we don't use it we | | 41 | * configuring that second ring. However, since we don't use it we |
42 | * don't actually fill the descriptors, and only hand off the first | | 42 | * don't actually fill the descriptors, and only hand off the first |
43 | * four to the chip. | | 43 | * four to the chip. |
44 | */ | | 44 | */ |
45 | | | 45 | |
46 | #include <sys/cdefs.h> | | 46 | #include <sys/cdefs.h> |
47 | __KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.45 2021/05/08 00:27:02 thorpej Exp $"); | | 47 | __KERNEL_RCSID(0, "$NetBSD: if_cas.c,v 1.46 2021/05/30 00:17:20 joerg Exp $"); |
48 | | | 48 | |
49 | #ifndef _MODULE | | 49 | #ifndef _MODULE |
50 | #include "opt_inet.h" | | 50 | #include "opt_inet.h" |
51 | #endif | | 51 | #endif |
52 | | | 52 | |
53 | #include <sys/param.h> | | 53 | #include <sys/param.h> |
54 | #include <sys/systm.h> | | 54 | #include <sys/systm.h> |
55 | #include <sys/callout.h> | | 55 | #include <sys/callout.h> |
56 | #include <sys/mbuf.h> | | 56 | #include <sys/mbuf.h> |
57 | #include <sys/syslog.h> | | 57 | #include <sys/syslog.h> |
58 | #include <sys/malloc.h> | | 58 | #include <sys/malloc.h> |
59 | #include <sys/kernel.h> | | 59 | #include <sys/kernel.h> |
60 | #include <sys/socket.h> | | 60 | #include <sys/socket.h> |
| @@ -773,28 +773,28 @@ cas_detach(device_t self, int flags) | | | @@ -773,28 +773,28 @@ cas_detach(device_t self, int flags) |
773 | for (i = 0; i < CAS_NRXDESC; i++) { | | 773 | for (i = 0; i < CAS_NRXDESC; i++) { |
774 | if (sc->sc_rxsoft[i].rxs_dmamap != NULL) | | 774 | if (sc->sc_rxsoft[i].rxs_dmamap != NULL) |
775 | bus_dmamap_unload(sc->sc_dmatag, | | 775 | bus_dmamap_unload(sc->sc_dmatag, |
776 | sc->sc_rxsoft[i].rxs_dmamap); | | 776 | sc->sc_rxsoft[i].rxs_dmamap); |
777 | if (sc->sc_rxsoft[i].rxs_dmamap != NULL) | | 777 | if (sc->sc_rxsoft[i].rxs_dmamap != NULL) |
778 | bus_dmamap_destroy(sc->sc_dmatag, | | 778 | bus_dmamap_destroy(sc->sc_dmatag, |
779 | sc->sc_rxsoft[i].rxs_dmamap); | | 779 | sc->sc_rxsoft[i].rxs_dmamap); |
780 | if (sc->sc_rxsoft[i].rxs_kva != NULL) | | 780 | if (sc->sc_rxsoft[i].rxs_kva != NULL) |
781 | bus_dmamem_unmap(sc->sc_dmatag, | | 781 | bus_dmamem_unmap(sc->sc_dmatag, |
782 | sc->sc_rxsoft[i].rxs_kva, CAS_PAGE_SIZE); | | 782 | sc->sc_rxsoft[i].rxs_kva, CAS_PAGE_SIZE); |
783 | /* XXX need to check that bus_dmamem_alloc suceeded | | 783 | /* XXX need to check that bus_dmamem_alloc suceeded |
784 | if (sc->sc_rxsoft[i].rxs_dmaseg != NULL) | | 784 | if (sc->sc_rxsoft[i].rxs_dmaseg != NULL) |
785 | */ | | 785 | */ |
786 | bus_dmamem_free(sc->sc_dmatag, | | 786 | bus_dmamem_free(sc->sc_dmatag, |
787 | &(sc->sc_rxsoft[i].rxs_dmaseg), 1); | | 787 | &(sc->sc_rxsoft[i].rxs_dmaseg), 1); |
788 | } | | 788 | } |
789 | bus_dmamap_unload(sc->sc_dmatag, sc->sc_cddmamap); | | 789 | bus_dmamap_unload(sc->sc_dmatag, sc->sc_cddmamap); |
790 | /*FALLTHROUGH*/ | | 790 | /*FALLTHROUGH*/ |
791 | case CAS_ATT_4: | | 791 | case CAS_ATT_4: |
792 | case CAS_ATT_3: | | 792 | case CAS_ATT_3: |
793 | bus_dmamap_destroy(sc->sc_dmatag, sc->sc_cddmamap); | | 793 | bus_dmamap_destroy(sc->sc_dmatag, sc->sc_cddmamap); |
794 | /*FALLTHROUGH*/ | | 794 | /*FALLTHROUGH*/ |
795 | case CAS_ATT_2: | | 795 | case CAS_ATT_2: |
796 | bus_dmamem_unmap(sc->sc_dmatag, sc->sc_control_data, | | 796 | bus_dmamem_unmap(sc->sc_dmatag, sc->sc_control_data, |
797 | sizeof(struct cas_control_data)); | | 797 | sizeof(struct cas_control_data)); |
798 | /*FALLTHROUGH*/ | | 798 | /*FALLTHROUGH*/ |
799 | case CAS_ATT_1: | | 799 | case CAS_ATT_1: |
800 | bus_dmamem_free(sc->sc_dmatag, &sc->sc_cdseg, sc->sc_cdnseg); | | 800 | bus_dmamem_free(sc->sc_dmatag, &sc->sc_cdseg, sc->sc_cdnseg); |