| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pccbb.c,v 1.180 2008/10/25 18:46:38 christos Exp $ */ | | 1 | /* $NetBSD: pccbb.c,v 1.180.4.1 2009/09/30 00:00:49 snj Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1998, 1999 and 2000 | | 4 | * Copyright (c) 1998, 1999 and 2000 |
5 | * HAYAKAWA Koichi. All rights reserved. | | 5 | * HAYAKAWA Koichi. All rights reserved. |
6 | * | | 6 | * |
7 | * Redistribution and use in source and binary forms, with or without | | 7 | * Redistribution and use in source and binary forms, with or without |
8 | * modification, are permitted provided that the following conditions | | 8 | * modification, are permitted provided that the following conditions |
9 | * are met: | | 9 | * are met: |
10 | * 1. Redistributions of source code must retain the above copyright | | 10 | * 1. Redistributions of source code must retain the above copyright |
11 | * notice, this list of conditions and the following disclaimer. | | 11 | * notice, this list of conditions and the following disclaimer. |
12 | * 2. Redistributions in binary form must reproduce the above copyright | | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
13 | * notice, this list of conditions and the following disclaimer in the | | 13 | * notice, this list of conditions and the following disclaimer in the |
14 | * documentation and/or other materials provided with the distribution. | | 14 | * documentation and/or other materials provided with the distribution. |
| @@ -21,27 +21,27 @@ | | | @@ -21,27 +21,27 @@ |
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | | 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | | 22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | | 23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | | 24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.180 2008/10/25 18:46:38 christos Exp $"); | | 34 | __KERNEL_RCSID(0, "$NetBSD: pccbb.c,v 1.180.4.1 2009/09/30 00:00:49 snj Exp $"); |
35 | | | 35 | |
36 | /* | | 36 | /* |
37 | #define CBB_DEBUG | | 37 | #define CBB_DEBUG |
38 | #define SHOW_REGS | | 38 | #define SHOW_REGS |
39 | */ | | 39 | */ |
40 | | | 40 | |
41 | #include <sys/param.h> | | 41 | #include <sys/param.h> |
42 | #include <sys/systm.h> | | 42 | #include <sys/systm.h> |
43 | #include <sys/kernel.h> | | 43 | #include <sys/kernel.h> |
44 | #include <sys/errno.h> | | 44 | #include <sys/errno.h> |
45 | #include <sys/ioctl.h> | | 45 | #include <sys/ioctl.h> |
46 | #include <sys/reboot.h> /* for bootverbose */ | | 46 | #include <sys/reboot.h> /* for bootverbose */ |
47 | #include <sys/syslog.h> | | 47 | #include <sys/syslog.h> |
| @@ -140,27 +140,27 @@ static void pccbb_cb_intr_disestablish(c | | | @@ -140,27 +140,27 @@ static void pccbb_cb_intr_disestablish(c |
140 | static cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int); | | 140 | static cardbustag_t pccbb_make_tag(cardbus_chipset_tag_t, int, int); |
141 | static void pccbb_free_tag(cardbus_chipset_tag_t, cardbustag_t); | | 141 | static void pccbb_free_tag(cardbus_chipset_tag_t, cardbustag_t); |
142 | static cardbusreg_t pccbb_conf_read(cardbus_chipset_tag_t, cardbustag_t, int); | | 142 | static cardbusreg_t pccbb_conf_read(cardbus_chipset_tag_t, cardbustag_t, int); |
143 | static void pccbb_conf_write(cardbus_chipset_tag_t, cardbustag_t, int, | | 143 | static void pccbb_conf_write(cardbus_chipset_tag_t, cardbustag_t, int, |
144 | cardbusreg_t); | | 144 | cardbusreg_t); |
145 | static void pccbb_chipinit(struct pccbb_softc *); | | 145 | static void pccbb_chipinit(struct pccbb_softc *); |
146 | static void pccbb_intrinit(struct pccbb_softc *); | | 146 | static void pccbb_intrinit(struct pccbb_softc *); |
147 | | | 147 | |
148 | STATIC int pccbb_pcmcia_mem_alloc(pcmcia_chipset_handle_t, bus_size_t, | | 148 | STATIC int pccbb_pcmcia_mem_alloc(pcmcia_chipset_handle_t, bus_size_t, |
149 | struct pcmcia_mem_handle *); | | 149 | struct pcmcia_mem_handle *); |
150 | STATIC void pccbb_pcmcia_mem_free(pcmcia_chipset_handle_t, | | 150 | STATIC void pccbb_pcmcia_mem_free(pcmcia_chipset_handle_t, |
151 | struct pcmcia_mem_handle *); | | 151 | struct pcmcia_mem_handle *); |
152 | STATIC int pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t, int, bus_addr_t, | | 152 | STATIC int pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t, int, bus_addr_t, |
153 | bus_size_t, struct pcmcia_mem_handle *, bus_addr_t *, int *); | | 153 | bus_size_t, struct pcmcia_mem_handle *, bus_size_t *, int *); |
154 | STATIC void pccbb_pcmcia_mem_unmap(pcmcia_chipset_handle_t, int); | | 154 | STATIC void pccbb_pcmcia_mem_unmap(pcmcia_chipset_handle_t, int); |
155 | STATIC int pccbb_pcmcia_io_alloc(pcmcia_chipset_handle_t, bus_addr_t, | | 155 | STATIC int pccbb_pcmcia_io_alloc(pcmcia_chipset_handle_t, bus_addr_t, |
156 | bus_size_t, bus_size_t, struct pcmcia_io_handle *); | | 156 | bus_size_t, bus_size_t, struct pcmcia_io_handle *); |
157 | STATIC void pccbb_pcmcia_io_free(pcmcia_chipset_handle_t, | | 157 | STATIC void pccbb_pcmcia_io_free(pcmcia_chipset_handle_t, |
158 | struct pcmcia_io_handle *); | | 158 | struct pcmcia_io_handle *); |
159 | STATIC int pccbb_pcmcia_io_map(pcmcia_chipset_handle_t, int, bus_addr_t, | | 159 | STATIC int pccbb_pcmcia_io_map(pcmcia_chipset_handle_t, int, bus_addr_t, |
160 | bus_size_t, struct pcmcia_io_handle *, int *); | | 160 | bus_size_t, struct pcmcia_io_handle *, int *); |
161 | STATIC void pccbb_pcmcia_io_unmap(pcmcia_chipset_handle_t, int); | | 161 | STATIC void pccbb_pcmcia_io_unmap(pcmcia_chipset_handle_t, int); |
162 | STATIC void *pccbb_pcmcia_intr_establish(pcmcia_chipset_handle_t, | | 162 | STATIC void *pccbb_pcmcia_intr_establish(pcmcia_chipset_handle_t, |
163 | struct pcmcia_function *, int, int (*)(void *), void *); | | 163 | struct pcmcia_function *, int, int (*)(void *), void *); |
164 | STATIC void pccbb_pcmcia_intr_disestablish(pcmcia_chipset_handle_t, void *); | | 164 | STATIC void pccbb_pcmcia_intr_disestablish(pcmcia_chipset_handle_t, void *); |
165 | STATIC void pccbb_pcmcia_socket_enable(pcmcia_chipset_handle_t); | | 165 | STATIC void pccbb_pcmcia_socket_enable(pcmcia_chipset_handle_t); |
166 | STATIC void pccbb_pcmcia_socket_disable(pcmcia_chipset_handle_t); | | 166 | STATIC void pccbb_pcmcia_socket_disable(pcmcia_chipset_handle_t); |
| @@ -2673,27 +2673,27 @@ pccbb_pcmcia_do_mem_map(struct pccbb_sof | | | @@ -2673,27 +2673,27 @@ pccbb_pcmcia_do_mem_map(struct pccbb_sof |
2673 | | | 2673 | |
2674 | /* | | 2674 | /* |
2675 | * STATIC int pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t pch, int kind, | | 2675 | * STATIC int pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t pch, int kind, |
2676 | * bus_addr_t card_addr, bus_size_t size, | | 2676 | * bus_addr_t card_addr, bus_size_t size, |
2677 | * struct pcmcia_mem_handle *pcmhp, | | 2677 | * struct pcmcia_mem_handle *pcmhp, |
2678 | * bus_addr_t *offsetp, int *windowp) | | 2678 | * bus_addr_t *offsetp, int *windowp) |
2679 | * | | 2679 | * |
2680 | * This function maps memory space allocated by the function | | 2680 | * This function maps memory space allocated by the function |
2681 | * pccbb_pcmcia_mem_alloc(). | | 2681 | * pccbb_pcmcia_mem_alloc(). |
2682 | */ | | 2682 | */ |
2683 | STATIC int | | 2683 | STATIC int |
2684 | pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t pch, int kind, | | 2684 | pccbb_pcmcia_mem_map(pcmcia_chipset_handle_t pch, int kind, |
2685 | bus_addr_t card_addr, bus_size_t size, struct pcmcia_mem_handle *pcmhp, | | 2685 | bus_addr_t card_addr, bus_size_t size, struct pcmcia_mem_handle *pcmhp, |
2686 | bus_addr_t *offsetp, int *windowp) | | 2686 | bus_size_t *offsetp, int *windowp) |
2687 | { | | 2687 | { |
2688 | struct pccbb_softc *sc = (struct pccbb_softc *)pch; | | 2688 | struct pccbb_softc *sc = (struct pccbb_softc *)pch; |
2689 | struct pcic_handle *ph = &sc->sc_pcmcia_h; | | 2689 | struct pcic_handle *ph = &sc->sc_pcmcia_h; |
2690 | bus_addr_t busaddr; | | 2690 | bus_addr_t busaddr; |
2691 | long card_offset; | | 2691 | long card_offset; |
2692 | int win; | | 2692 | int win; |
2693 | | | 2693 | |
2694 | /* Check that the card is still there. */ | | 2694 | /* Check that the card is still there. */ |
2695 | if ((Pcic_read(sc, PCIC_IF_STATUS) & PCIC_IF_STATUS_CARDDETECT_MASK) != | | 2695 | if ((Pcic_read(sc, PCIC_IF_STATUS) & PCIC_IF_STATUS_CARDDETECT_MASK) != |
2696 | PCIC_IF_STATUS_CARDDETECT_PRESENT) | | 2696 | PCIC_IF_STATUS_CARDDETECT_PRESENT) |
2697 | return 1; | | 2697 | return 1; |
2698 | | | 2698 | |
2699 | for (win = 0; win < PCIC_MEM_WINS; ++win) { | | 2699 | for (win = 0; win < PCIC_MEM_WINS; ++win) { |