| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: if_tr_isa.c,v 1.18 2008/04/28 20:23:52 martin Exp $ */ | | 1 | /* $NetBSD: if_tr_isa.c,v 1.18.10.1 2009/09/29 23:59:45 snj Exp $ */ |
2 | | | 2 | |
3 | /* XXXJRT changes isa_attach_args too early!! */ | | 3 | /* XXXJRT changes isa_attach_args too early!! */ |
4 | | | 4 | |
5 | /* | | 5 | /* |
6 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | | 6 | * Copyright (c) 1999 The NetBSD Foundation, Inc. |
7 | * All rights reserved. | | 7 | * All rights reserved. |
8 | * | | 8 | * |
9 | * This code is derived from software contributed to The NetBSD Foundation | | 9 | * This code is derived from software contributed to The NetBSD Foundation |
10 | * by Onno van der Linden. | | 10 | * by Onno van der Linden. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
| @@ -22,27 +22,27 @@ | | | @@ -22,27 +22,27 @@ |
22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 22 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 23 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 24 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 25 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 26 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 27 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 28 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 29 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 30 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
31 | * POSSIBILITY OF SUCH DAMAGE. | | 31 | * POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | #include <sys/cdefs.h> | | 34 | #include <sys/cdefs.h> |
35 | __KERNEL_RCSID(0, "$NetBSD: if_tr_isa.c,v 1.18 2008/04/28 20:23:52 martin Exp $"); | | 35 | __KERNEL_RCSID(0, "$NetBSD: if_tr_isa.c,v 1.18.10.1 2009/09/29 23:59:45 snj Exp $"); |
36 | | | 36 | |
37 | #undef TRISADEBUG | | 37 | #undef TRISADEBUG |
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/socket.h> | | 41 | #include <sys/socket.h> |
42 | #include <sys/device.h> | | 42 | #include <sys/device.h> |
43 | | | 43 | |
44 | #include <net/if.h> | | 44 | #include <net/if.h> |
45 | #include <net/if_ether.h> | | 45 | #include <net/if_ether.h> |
46 | #include <net/if_media.h> | | 46 | #include <net/if_media.h> |
47 | | | 47 | |
48 | #include <sys/cpu.h> | | 48 | #include <sys/cpu.h> |
| @@ -97,27 +97,27 @@ bus_space_handle_t *pioh, *mmioh; | | | @@ -97,27 +97,27 @@ bus_space_handle_t *pioh, *mmioh; |
97 | | | 97 | |
98 | /* Read adapter switches and calculate addresses of MMIO. */ | | 98 | /* Read adapter switches and calculate addresses of MMIO. */ |
99 | s = bus_space_read_1(ia->ia_iot, *pioh, TR_SWITCH); | | 99 | s = bus_space_read_1(ia->ia_iot, *pioh, TR_SWITCH); |
100 | | | 100 | |
101 | if ((s & 0xfc) < ((TR_MMIO_MINADDR - TR_MMIO_OFFSET) >> 11) || | | 101 | if ((s & 0xfc) < ((TR_MMIO_MINADDR - TR_MMIO_OFFSET) >> 11) || |
102 | (s & 0xfc) > ((TR_MMIO_MAXADDR - TR_MMIO_OFFSET) >> 11)) { | | 102 | (s & 0xfc) > ((TR_MMIO_MAXADDR - TR_MMIO_OFFSET) >> 11)) { |
103 | bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); | | 103 | bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); |
104 | return 1; | | 104 | return 1; |
105 | } | | 105 | } |
106 | | | 106 | |
107 | mmio = ((s & 0xfc) << 11) + TR_MMIO_OFFSET; | | 107 | mmio = ((s & 0xfc) << 11) + TR_MMIO_OFFSET; |
108 | if (bus_space_map(ia->ia_memt, mmio, TR_MMIO_SIZE, 0, mmioh)) { | | 108 | if (bus_space_map(ia->ia_memt, mmio, TR_MMIO_SIZE, 0, mmioh)) { |
109 | printf("tr_isa_map_io: can't map MMIO region 0x%05lx/%d\n", | | 109 | printf("tr_isa_map_io: can't map MMIO region 0x%05lx/%d\n", |
110 | mmio, TR_MMIO_SIZE); | | 110 | (u_long)mmio, TR_MMIO_SIZE); |
111 | bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); | | 111 | bus_space_unmap(ia->ia_iot, *pioh, ia->ia_io[0].ir_size); |
112 | return 1; | | 112 | return 1; |
113 | } | | 113 | } |
114 | return 0; | | 114 | return 0; |
115 | } | | 115 | } |
116 | | | 116 | |
117 | void | | 117 | void |
118 | tr_isa_unmap_io(ia, pioh, mmioh) | | 118 | tr_isa_unmap_io(ia, pioh, mmioh) |
119 | struct isa_attach_args *ia; | | 119 | struct isa_attach_args *ia; |
120 | bus_space_handle_t pioh, mmioh; | | 120 | bus_space_handle_t pioh, mmioh; |
121 | { | | 121 | { |
122 | bus_space_unmap(ia->ia_memt, mmioh, TR_MMIO_SIZE); | | 122 | bus_space_unmap(ia->ia_memt, mmioh, TR_MMIO_SIZE); |
123 | bus_space_unmap(ia->ia_iot, pioh, ia->ia_io[0].ir_size); | | 123 | bus_space_unmap(ia->ia_iot, pioh, ia->ia_io[0].ir_size); |