| @@ -1,38 +1,38 @@ | | | @@ -1,38 +1,38 @@ |
1 | /* $NetBSD: if_iwn.c,v 1.68 2013/08/23 16:49:53 christos Exp $ */ | | 1 | /* $NetBSD: if_iwn.c,v 1.69 2013/09/14 13:11:31 joerg Exp $ */ |
2 | /* $OpenBSD: if_iwn.c,v 1.119 2013/05/29 23:16:52 yuo Exp $ */ | | 2 | /* $OpenBSD: if_iwn.c,v 1.119 2013/05/29 23:16:52 yuo Exp $ */ |
3 | | | 3 | |
4 | /*- | | 4 | /*- |
5 | * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> | | 5 | * Copyright (c) 2007-2010 Damien Bergamini <damien.bergamini@free.fr> |
6 | * | | 6 | * |
7 | * Permission to use, copy, modify, and distribute this software for any | | 7 | * Permission to use, copy, modify, and distribute this software for any |
8 | * purpose with or without fee is hereby granted, provided that the above | | 8 | * purpose with or without fee is hereby granted, provided that the above |
9 | * copyright notice and this permission notice appear in all copies. | | 9 | * copyright notice and this permission notice appear in all copies. |
10 | * | | 10 | * |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
18 | */ | | 18 | */ |
19 | | | 19 | |
20 | /* | | 20 | /* |
21 | * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network | | 21 | * Driver for Intel WiFi Link 4965 and 1000/5000/6000 Series 802.11 network |
22 | * adapters. | | 22 | * adapters. |
23 | */ | | 23 | */ |
24 | #include <sys/cdefs.h> | | 24 | #include <sys/cdefs.h> |
25 | __KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.68 2013/08/23 16:49:53 christos Exp $"); | | 25 | __KERNEL_RCSID(0, "$NetBSD: if_iwn.c,v 1.69 2013/09/14 13:11:31 joerg Exp $"); |
26 | | | 26 | |
27 | #define IWN_USE_RBUF /* Use local storage for RX */ | | 27 | #define IWN_USE_RBUF /* Use local storage for RX */ |
28 | #undef IWN_HWCRYPTO /* XXX does not even compile yet */ | | 28 | #undef IWN_HWCRYPTO /* XXX does not even compile yet */ |
29 | | | 29 | |
30 | #include <sys/param.h> | | 30 | #include <sys/param.h> |
31 | #include <sys/sockio.h> | | 31 | #include <sys/sockio.h> |
32 | #include <sys/proc.h> | | 32 | #include <sys/proc.h> |
33 | #include <sys/mbuf.h> | | 33 | #include <sys/mbuf.h> |
34 | #include <sys/kernel.h> | | 34 | #include <sys/kernel.h> |
35 | #include <sys/socket.h> | | 35 | #include <sys/socket.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/malloc.h> | | 37 | #include <sys/malloc.h> |
38 | #ifdef notyetMODULE | | 38 | #ifdef notyetMODULE |
| @@ -908,38 +908,40 @@ iwn_mem_read(struct iwn_softc *sc, uint3 | | | @@ -908,38 +908,40 @@ iwn_mem_read(struct iwn_softc *sc, uint3 |
908 | IWN_WRITE(sc, IWN_MEM_RADDR, addr); | | 908 | IWN_WRITE(sc, IWN_MEM_RADDR, addr); |
909 | IWN_BARRIER_READ_WRITE(sc); | | 909 | IWN_BARRIER_READ_WRITE(sc); |
910 | return IWN_READ(sc, IWN_MEM_RDATA); | | 910 | return IWN_READ(sc, IWN_MEM_RDATA); |
911 | } | | 911 | } |
912 | | | 912 | |
913 | static __inline void | | 913 | static __inline void |
914 | iwn_mem_write(struct iwn_softc *sc, uint32_t addr, uint32_t data) | | 914 | iwn_mem_write(struct iwn_softc *sc, uint32_t addr, uint32_t data) |
915 | { | | 915 | { |
916 | IWN_WRITE(sc, IWN_MEM_WADDR, addr); | | 916 | IWN_WRITE(sc, IWN_MEM_WADDR, addr); |
917 | IWN_BARRIER_WRITE(sc); | | 917 | IWN_BARRIER_WRITE(sc); |
918 | IWN_WRITE(sc, IWN_MEM_WDATA, data); | | 918 | IWN_WRITE(sc, IWN_MEM_WDATA, data); |
919 | } | | 919 | } |
920 | | | 920 | |
| | | 921 | #ifndef IEEE80211_NO_HT |
921 | static __inline void | | 922 | static __inline void |
922 | iwn_mem_write_2(struct iwn_softc *sc, uint32_t addr, uint16_t data) | | 923 | iwn_mem_write_2(struct iwn_softc *sc, uint32_t addr, uint16_t data) |
923 | { | | 924 | { |
924 | uint32_t tmp; | | 925 | uint32_t tmp; |
925 | | | 926 | |
926 | tmp = iwn_mem_read(sc, addr & ~3); | | 927 | tmp = iwn_mem_read(sc, addr & ~3); |
927 | if (addr & 3) | | 928 | if (addr & 3) |
928 | tmp = (tmp & 0x0000ffff) | data << 16; | | 929 | tmp = (tmp & 0x0000ffff) | data << 16; |
929 | else | | 930 | else |
930 | tmp = (tmp & 0xffff0000) | data; | | 931 | tmp = (tmp & 0xffff0000) | data; |
931 | iwn_mem_write(sc, addr & ~3, tmp); | | 932 | iwn_mem_write(sc, addr & ~3, tmp); |
932 | } | | 933 | } |
| | | 934 | #endif |
933 | | | 935 | |
934 | static __inline void | | 936 | static __inline void |
935 | iwn_mem_read_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t *data, | | 937 | iwn_mem_read_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t *data, |
936 | int count) | | 938 | int count) |
937 | { | | 939 | { |
938 | for (; count > 0; count--, addr += 4) | | 940 | for (; count > 0; count--, addr += 4) |
939 | *data++ = iwn_mem_read(sc, addr); | | 941 | *data++ = iwn_mem_read(sc, addr); |
940 | } | | 942 | } |
941 | | | 943 | |
942 | static __inline void | | 944 | static __inline void |
943 | iwn_mem_set_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t val, | | 945 | iwn_mem_set_region_4(struct iwn_softc *sc, uint32_t addr, uint32_t val, |
944 | int count) | | 946 | int count) |
945 | { | | 947 | { |