| @@ -1,34 +1,34 @@ | | | @@ -1,34 +1,34 @@ |
1 | /* $NetBSD: sdhc_pci.c,v 1.2 2009/06/29 11:05:12 hubertf Exp $ */ | | 1 | /* $NetBSD: sdhc_pci.c,v 1.3 2009/10/02 04:38:47 uebayasi Exp $ */ |
2 | /* $OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $ */ | | 2 | /* $OpenBSD: sdhc_pci.c,v 1.7 2007/10/30 18:13:45 chl Exp $ */ |
3 | | | 3 | |
4 | /* | | 4 | /* |
5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> | | 5 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> |
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 | #include <sys/cdefs.h> | | 20 | #include <sys/cdefs.h> |
21 | __KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.2 2009/06/29 11:05:12 hubertf Exp $"); | | 21 | __KERNEL_RCSID(0, "$NetBSD: sdhc_pci.c,v 1.3 2009/10/02 04:38:47 uebayasi Exp $"); |
22 | | | 22 | |
23 | #include <sys/param.h> | | 23 | #include <sys/param.h> |
24 | #include <sys/device.h> | | 24 | #include <sys/device.h> |
25 | #include <sys/systm.h> | | 25 | #include <sys/systm.h> |
26 | #include <sys/malloc.h> | | 26 | #include <sys/malloc.h> |
27 | #include <sys/pmf.h> | | 27 | #include <sys/pmf.h> |
28 | | | 28 | |
29 | #include <dev/pci/pcivar.h> | | 29 | #include <dev/pci/pcivar.h> |
30 | #include <dev/pci/pcidevs.h> | | 30 | #include <dev/pci/pcidevs.h> |
31 | | | 31 | |
32 | #include <dev/sdmmc/sdhcreg.h> | | 32 | #include <dev/sdmmc/sdhcreg.h> |
33 | #include <dev/sdmmc/sdhcvar.h> | | 33 | #include <dev/sdmmc/sdhcvar.h> |
34 | #include <dev/sdmmc/sdmmcvar.h> | | 34 | #include <dev/sdmmc/sdmmcvar.h> |
| @@ -211,27 +211,27 @@ sdhc_pci_attach(device_t parent, device_ | | | @@ -211,27 +211,27 @@ sdhc_pci_attach(device_t parent, device_ |
211 | | | 211 | |
212 | /* Enable the device. */ | | 212 | /* Enable the device. */ |
213 | csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); | | 213 | csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); |
214 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, | | 214 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, |
215 | csr | PCI_COMMAND_MASTER_ENABLE); | | 215 | csr | PCI_COMMAND_MASTER_ENABLE); |
216 | | | 216 | |
217 | /* Map and establish the interrupt. */ | | 217 | /* Map and establish the interrupt. */ |
218 | if (pci_intr_map(pa, &ih)) { | | 218 | if (pci_intr_map(pa, &ih)) { |
219 | aprint_error_dev(self, "couldn't map interrupt\n"); | | 219 | aprint_error_dev(self, "couldn't map interrupt\n"); |
220 | goto err; | | 220 | goto err; |
221 | } | | 221 | } |
222 | | | 222 | |
223 | intrstr = pci_intr_string(pc, ih); | | 223 | intrstr = pci_intr_string(pc, ih); |
224 | sc->sc_ih = pci_intr_establish(pc, ih, IPL_SDMMC, sdhc_intr, sc); | | 224 | sc->sc_ih = pci_intr_establish(pc, ih, IPL_SDMMC, sdhc_intr, &sc->sc); |
225 | if (sc->sc_ih == NULL) { | | 225 | if (sc->sc_ih == NULL) { |
226 | aprint_error_dev(self, "couldn't establish interrupt\n"); | | 226 | aprint_error_dev(self, "couldn't establish interrupt\n"); |
227 | goto err; | | 227 | goto err; |
228 | } | | 228 | } |
229 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | | 229 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); |
230 | | | 230 | |
231 | /* Enable use of DMA if supported by the interface. */ | | 231 | /* Enable use of DMA if supported by the interface. */ |
232 | if ((PCI_INTERFACE(pa->pa_class) == SDHC_PCI_INTERFACE_DMA)) | | 232 | if ((PCI_INTERFACE(pa->pa_class) == SDHC_PCI_INTERFACE_DMA)) |
233 | SET(sc->sc.sc_flags, SDHC_FLAG_USE_DMA); | | 233 | SET(sc->sc.sc_flags, SDHC_FLAG_USE_DMA); |
234 | | | 234 | |
235 | /* XXX: handle 64-bit BARs */ | | 235 | /* XXX: handle 64-bit BARs */ |
236 | cnt = 0; | | 236 | cnt = 0; |
237 | for (reg = SDHC_PCI_BAR_START + SDHC_PCI_FIRST_BAR(slotinfo) * | | 237 | for (reg = SDHC_PCI_BAR_START + SDHC_PCI_FIRST_BAR(slotinfo) * |