Always use pci_intr_alloc(9)/pci_intr_release(9).diff -r1.38 -r1.39 src/sys/dev/pci/if_iwm.c
(nonaka)
--- src/sys/dev/pci/if_iwm.c 2015/10/14 02:16:51 1.38
+++ src/sys/dev/pci/if_iwm.c 2015/11/06 14:22:17 1.39
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_iwm.c,v 1.38 2015/10/14 02:16:51 ozaki-r Exp $ */ | 1 | /* $NetBSD: if_iwm.c,v 1.39 2015/11/06 14:22:17 nonaka Exp $ */ | |
2 | /* OpenBSD: if_iwm.c,v 1.41 2015/05/22 06:50:54 kettenis Exp */ | 2 | /* OpenBSD: if_iwm.c,v 1.41 2015/05/22 06:50:54 kettenis Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2014 genua mbh <info@genua.de> | 5 | * Copyright (c) 2014 genua mbh <info@genua.de> | |
6 | * Copyright (c) 2014 Fixup Software Ltd. | 6 | * Copyright (c) 2014 Fixup Software Ltd. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
@@ -95,27 +95,27 @@ | @@ -95,27 +95,27 @@ | |||
95 | * purpose with or without fee is hereby granted, provided that the above | 95 | * purpose with or without fee is hereby granted, provided that the above | |
96 | * copyright notice and this permission notice appear in all copies. | 96 | * copyright notice and this permission notice appear in all copies. | |
97 | * | 97 | * | |
98 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 98 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
99 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 99 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
100 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 100 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
101 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 101 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
102 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 102 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
103 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 103 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
104 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 104 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
105 | */ | 105 | */ | |
106 | 106 | |||
107 | #include <sys/cdefs.h> | 107 | #include <sys/cdefs.h> | |
108 | __KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.38 2015/10/14 02:16:51 ozaki-r Exp $"); | 108 | __KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.39 2015/11/06 14:22:17 nonaka Exp $"); | |
109 | 109 | |||
110 | #include <sys/param.h> | 110 | #include <sys/param.h> | |
111 | #include <sys/conf.h> | 111 | #include <sys/conf.h> | |
112 | #include <sys/kernel.h> | 112 | #include <sys/kernel.h> | |
113 | #include <sys/kmem.h> | 113 | #include <sys/kmem.h> | |
114 | #include <sys/mbuf.h> | 114 | #include <sys/mbuf.h> | |
115 | #include <sys/mutex.h> | 115 | #include <sys/mutex.h> | |
116 | #include <sys/proc.h> | 116 | #include <sys/proc.h> | |
117 | #include <sys/socket.h> | 117 | #include <sys/socket.h> | |
118 | #include <sys/sockio.h> | 118 | #include <sys/sockio.h> | |
119 | #include <sys/sysctl.h> | 119 | #include <sys/sysctl.h> | |
120 | #include <sys/systm.h> | 120 | #include <sys/systm.h> | |
121 | 121 | |||
@@ -6593,29 +6593,26 @@ iwm_attach_hook(device_t dev) | @@ -6593,29 +6593,26 @@ iwm_attach_hook(device_t dev) | |||
6593 | { | 6593 | { | |
6594 | struct iwm_softc *sc = device_private(dev); | 6594 | struct iwm_softc *sc = device_private(dev); | |
6595 | 6595 | |||
6596 | iwm_preinit(sc); | 6596 | iwm_preinit(sc); | |
6597 | } | 6597 | } | |
6598 | 6598 | |||
6599 | static void | 6599 | static void | |
6600 | iwm_attach(device_t parent, device_t self, void *aux) | 6600 | iwm_attach(device_t parent, device_t self, void *aux) | |
6601 | { | 6601 | { | |
6602 | struct iwm_softc *sc = device_private(self); | 6602 | struct iwm_softc *sc = device_private(self); | |
6603 | struct pci_attach_args *pa = aux; | 6603 | struct pci_attach_args *pa = aux; | |
6604 | struct ieee80211com *ic = &sc->sc_ic; | 6604 | struct ieee80211com *ic = &sc->sc_ic; | |
6605 | struct ifnet *ifp = &sc->sc_ec.ec_if; | 6605 | struct ifnet *ifp = &sc->sc_ec.ec_if; | |
6606 | #ifndef __HAVE_PCI_MSI_MSIX | |||
6607 | pci_intr_handle_t ih; | |||
6608 | #endif | |||
6609 | pcireg_t reg, memtype; | 6606 | pcireg_t reg, memtype; | |
6610 | char intrbuf[PCI_INTRSTR_LEN]; | 6607 | char intrbuf[PCI_INTRSTR_LEN]; | |
6611 | const char *intrstr; | 6608 | const char *intrstr; | |
6612 | int error; | 6609 | int error; | |
6613 | int txq_i; | 6610 | int txq_i; | |
6614 | const struct sysctlnode *node; | 6611 | const struct sysctlnode *node; | |
6615 | 6612 | |||
6616 | sc->sc_dev = self; | 6613 | sc->sc_dev = self; | |
6617 | sc->sc_pct = pa->pa_pc; | 6614 | sc->sc_pct = pa->pa_pc; | |
6618 | sc->sc_pcitag = pa->pa_tag; | 6615 | sc->sc_pcitag = pa->pa_tag; | |
6619 | sc->sc_dmat = pa->pa_dmat; | 6616 | sc->sc_dmat = pa->pa_dmat; | |
6620 | sc->sc_pciid = pa->pa_id; | 6617 | sc->sc_pciid = pa->pa_id; | |
6621 | 6618 | |||
@@ -6645,44 +6642,35 @@ iwm_attach(device_t parent, device_t sel | @@ -6645,44 +6642,35 @@ iwm_attach(device_t parent, device_t sel | |||
6645 | reg &= ~PCI_COMMAND_INTERRUPT_DISABLE; | 6642 | reg &= ~PCI_COMMAND_INTERRUPT_DISABLE; | |
6646 | } | 6643 | } | |
6647 | pci_conf_write(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG, reg); | 6644 | pci_conf_write(sc->sc_pct, sc->sc_pcitag, PCI_COMMAND_STATUS_REG, reg); | |
6648 | 6645 | |||
6649 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | 6646 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, PCI_MAPREG_START); | |
6650 | error = pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, | 6647 | error = pci_mapreg_map(pa, PCI_MAPREG_START, memtype, 0, | |
6651 | &sc->sc_st, &sc->sc_sh, NULL, &sc->sc_sz); | 6648 | &sc->sc_st, &sc->sc_sh, NULL, &sc->sc_sz); | |
6652 | if (error != 0) { | 6649 | if (error != 0) { | |
6653 | aprint_error_dev(self, "can't map mem space\n"); | 6650 | aprint_error_dev(self, "can't map mem space\n"); | |
6654 | return; | 6651 | return; | |
6655 | } | 6652 | } | |
6656 | 6653 | |||
6657 | /* Install interrupt handler. */ | 6654 | /* Install interrupt handler. */ | |
6658 | #ifdef __HAVE_PCI_MSI_MSIX | |||
6659 | error = pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0); | 6655 | error = pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0); | |
6660 | if (error != 0) { | 6656 | if (error != 0) { | |
6661 | aprint_error_dev(self, "can't allocate interrupt\n"); | 6657 | aprint_error_dev(self, "can't allocate interrupt\n"); | |
6662 | return; | 6658 | return; | |
6663 | } | 6659 | } | |
6664 | intrstr = pci_intr_string(sc->sc_pct, sc->sc_pihp[0], intrbuf, | 6660 | intrstr = pci_intr_string(sc->sc_pct, sc->sc_pihp[0], intrbuf, | |
6665 | sizeof(intrbuf)); | 6661 | sizeof(intrbuf)); | |
6666 | sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0], IPL_NET, | 6662 | sc->sc_ih = pci_intr_establish(sc->sc_pct, sc->sc_pihp[0], IPL_NET, | |
6667 | iwm_intr, sc); | 6663 | iwm_intr, sc); | |
6668 | #else /* !__HAVE_PCI_MSI_MSIX */ | |||
6669 | if (pci_intr_map(pa, &ih)) { | |||
6670 | aprint_error_dev(self, "can't map interrupt\n"); | |||
6671 | return; | |||
6672 | } | |||
6673 | intrstr = pci_intr_string(sc->sc_pct, ih, intrbuf, sizeof(intrbuf)); | |||
6674 | sc->sc_ih = pci_intr_establish(sc->sc_pct, ih, IPL_NET, iwm_intr, sc); | |||
6675 | #endif /* __HAVE_PCI_MSI_MSIX */ | |||
6676 | if (sc->sc_ih == NULL) { | 6664 | if (sc->sc_ih == NULL) { | |
6677 | aprint_error_dev(self, "can't establish interrupt"); | 6665 | aprint_error_dev(self, "can't establish interrupt"); | |
6678 | if (intrstr != NULL) | 6666 | if (intrstr != NULL) | |
6679 | aprint_error(" at %s", intrstr); | 6667 | aprint_error(" at %s", intrstr); | |
6680 | aprint_error("\n"); | 6668 | aprint_error("\n"); | |
6681 | return; | 6669 | return; | |
6682 | } | 6670 | } | |
6683 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | 6671 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | |
6684 | 6672 | |||
6685 | sc->sc_wantresp = -1; | 6673 | sc->sc_wantresp = -1; | |
6686 | 6674 | |||
6687 | switch (PCI_PRODUCT(sc->sc_pciid)) { | 6675 | switch (PCI_PRODUCT(sc->sc_pciid)) { | |
6688 | case PCI_PRODUCT_INTEL_WIFI_LINK_7260_1: | 6676 | case PCI_PRODUCT_INTEL_WIFI_LINK_7260_1: |
--- src/sys/dev/pci/if_iwmvar.h 2015/07/22 15:18:01 1.8
+++ src/sys/dev/pci/if_iwmvar.h 2015/11/06 14:22:17 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_iwmvar.h,v 1.8 2015/07/22 15:18:01 nonaka Exp $ */ | 1 | /* $NetBSD: if_iwmvar.h,v 1.9 2015/11/06 14:22:17 nonaka Exp $ */ | |
2 | /* OpenBSD: if_iwmvar.h,v 1.7 2015/03/02 13:51:10 jsg Exp */ | 2 | /* OpenBSD: if_iwmvar.h,v 1.7 2015/03/02 13:51:10 jsg Exp */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2014 genua mbh <info@genua.de> | 5 | * Copyright (c) 2014 genua mbh <info@genua.de> | |
6 | * Copyright (c) 2014 Fixup Software Ltd. | 6 | * Copyright (c) 2014 Fixup Software Ltd. | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
@@ -367,29 +367,27 @@ struct iwm_bf_data { | @@ -367,29 +367,27 @@ struct iwm_bf_data { | |||
367 | struct iwm_softc { | 367 | struct iwm_softc { | |
368 | device_t sc_dev; | 368 | device_t sc_dev; | |
369 | struct ethercom sc_ec; | 369 | struct ethercom sc_ec; | |
370 | struct ieee80211com sc_ic; | 370 | struct ieee80211com sc_ic; | |
371 | 371 | |||
372 | int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int); | 372 | int (*sc_newstate)(struct ieee80211com *, enum ieee80211_state, int); | |
373 | int sc_newstate_pending; | 373 | int sc_newstate_pending; | |
374 | 374 | |||
375 | struct ieee80211_amrr sc_amrr; | 375 | struct ieee80211_amrr sc_amrr; | |
376 | struct callout sc_calib_to; | 376 | struct callout sc_calib_to; | |
377 | 377 | |||
378 | bus_space_tag_t sc_st; | 378 | bus_space_tag_t sc_st; | |
379 | bus_space_handle_t sc_sh; | 379 | bus_space_handle_t sc_sh; | |
380 | #ifdef __HAVE_PCI_MSI_MSIX | |||
381 | pci_intr_handle_t *sc_pihp; | 380 | pci_intr_handle_t *sc_pihp; | |
382 | #endif | |||
383 | 381 | |||
384 | bus_size_t sc_sz; | 382 | bus_size_t sc_sz; | |
385 | bus_dma_tag_t sc_dmat; | 383 | bus_dma_tag_t sc_dmat; | |
386 | pci_chipset_tag_t sc_pct; | 384 | pci_chipset_tag_t sc_pct; | |
387 | pcitag_t sc_pcitag; | 385 | pcitag_t sc_pcitag; | |
388 | pcireg_t sc_pciid; | 386 | pcireg_t sc_pciid; | |
389 | const void *sc_ih; | 387 | const void *sc_ih; | |
390 | 388 | |||
391 | /* TX scheduler rings. */ | 389 | /* TX scheduler rings. */ | |
392 | struct iwm_dma_info sched_dma; | 390 | struct iwm_dma_info sched_dma; | |
393 | uint32_t sched_base; | 391 | uint32_t sched_base; | |
394 | 392 | |||
395 | /* TX/RX rings. */ | 393 | /* TX/RX rings. */ |
--- src/sys/dev/pci/if_rtwn.c 2015/08/27 14:04:08 1.1
+++ src/sys/dev/pci/if_rtwn.c 2015/11/06 14:22:17 1.2
@@ -1,39 +1,39 @@ | @@ -1,39 +1,39 @@ | |||
1 | /* $NetBSD: if_rtwn.c,v 1.1 2015/08/27 14:04:08 nonaka Exp $ */ | 1 | /* $NetBSD: if_rtwn.c,v 1.2 2015/11/06 14:22:17 nonaka Exp $ */ | |
2 | /* $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $ */ | 2 | /* $OpenBSD: if_rtwn.c,v 1.5 2015/06/14 08:02:47 stsp Exp $ */ | |
3 | #define IEEE80211_NO_HT | 3 | #define IEEE80211_NO_HT | |
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | 5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | |
6 | * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> | 6 | * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 15 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 16 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 17 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 18 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
19 | */ | 19 | */ | |
20 | 20 | |||
21 | /* | 21 | /* | |
22 | * Driver for Realtek RTL8188CE | 22 | * Driver for Realtek RTL8188CE | |
23 | */ | 23 | */ | |
24 | 24 | |||
25 | #include <sys/cdefs.h> | 25 | #include <sys/cdefs.h> | |
26 | __KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.1 2015/08/27 14:04:08 nonaka Exp $"); | 26 | __KERNEL_RCSID(0, "$NetBSD: if_rtwn.c,v 1.2 2015/11/06 14:22:17 nonaka Exp $"); | |
27 | 27 | |||
28 | #include <sys/param.h> | 28 | #include <sys/param.h> | |
29 | #include <sys/sockio.h> | 29 | #include <sys/sockio.h> | |
30 | #include <sys/mbuf.h> | 30 | #include <sys/mbuf.h> | |
31 | #include <sys/kernel.h> | 31 | #include <sys/kernel.h> | |
32 | #include <sys/socket.h> | 32 | #include <sys/socket.h> | |
33 | #include <sys/systm.h> | 33 | #include <sys/systm.h> | |
34 | #include <sys/callout.h> | 34 | #include <sys/callout.h> | |
35 | #include <sys/conf.h> | 35 | #include <sys/conf.h> | |
36 | #include <sys/device.h> | 36 | #include <sys/device.h> | |
37 | #include <sys/endian.h> | 37 | #include <sys/endian.h> | |
38 | #include <sys/mutex.h> | 38 | #include <sys/mutex.h> | |
39 | 39 | |||
@@ -203,29 +203,26 @@ rtwn_match(device_t parent, cfdata_t mat | @@ -203,29 +203,26 @@ rtwn_match(device_t parent, cfdata_t mat | |||
203 | return 1; | 203 | return 1; | |
204 | return 0; | 204 | return 0; | |
205 | } | 205 | } | |
206 | 206 | |||
207 | static void | 207 | static void | |
208 | rtwn_attach(device_t parent, device_t self, void *aux) | 208 | rtwn_attach(device_t parent, device_t self, void *aux) | |
209 | { | 209 | { | |
210 | struct rtwn_softc *sc = device_private(self); | 210 | struct rtwn_softc *sc = device_private(self); | |
211 | struct pci_attach_args *pa = aux; | 211 | struct pci_attach_args *pa = aux; | |
212 | struct ieee80211com *ic = &sc->sc_ic; | 212 | struct ieee80211com *ic = &sc->sc_ic; | |
213 | struct ifnet *ifp = GET_IFP(sc); | 213 | struct ifnet *ifp = GET_IFP(sc); | |
214 | int i, error; | 214 | int i, error; | |
215 | pcireg_t memtype; | 215 | pcireg_t memtype; | |
216 | #ifndef __HAVE_PCI_MSI_MSIX | |||
217 | pci_intr_handle_t ih; | |||
218 | #endif | |||
219 | const char *intrstr; | 216 | const char *intrstr; | |
220 | char intrbuf[PCI_INTRSTR_LEN]; | 217 | char intrbuf[PCI_INTRSTR_LEN]; | |
221 | 218 | |||
222 | sc->sc_dev = self; | 219 | sc->sc_dev = self; | |
223 | sc->sc_dmat = pa->pa_dmat; | 220 | sc->sc_dmat = pa->pa_dmat; | |
224 | sc->sc_pc = pa->pa_pc; | 221 | sc->sc_pc = pa->pa_pc; | |
225 | sc->sc_tag = pa->pa_tag; | 222 | sc->sc_tag = pa->pa_tag; | |
226 | 223 | |||
227 | pci_aprint_devinfo(pa, NULL); | 224 | pci_aprint_devinfo(pa, NULL); | |
228 | 225 | |||
229 | callout_init(&sc->scan_to, 0); | 226 | callout_init(&sc->scan_to, 0); | |
230 | callout_setfunc(&sc->scan_to, rtwn_next_scan, sc); | 227 | callout_setfunc(&sc->scan_to, rtwn_next_scan, sc); | |
231 | callout_init(&sc->calib_to, 0); | 228 | callout_init(&sc->calib_to, 0); | |
@@ -236,43 +233,34 @@ rtwn_attach(device_t parent, device_t se | @@ -236,43 +233,34 @@ rtwn_attach(device_t parent, device_t se | |||
236 | /* Power up the device */ | 233 | /* Power up the device */ | |
237 | pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); | 234 | pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0); | |
238 | 235 | |||
239 | /* Map control/status registers. */ | 236 | /* Map control/status registers. */ | |
240 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, RTWN_PCI_MMBA); | 237 | memtype = pci_mapreg_type(pa->pa_pc, pa->pa_tag, RTWN_PCI_MMBA); | |
241 | error = pci_mapreg_map(pa, RTWN_PCI_MMBA, memtype, 0, &sc->sc_st, | 238 | error = pci_mapreg_map(pa, RTWN_PCI_MMBA, memtype, 0, &sc->sc_st, | |
242 | &sc->sc_sh, NULL, &sc->sc_mapsize); | 239 | &sc->sc_sh, NULL, &sc->sc_mapsize); | |
243 | if (error != 0) { | 240 | if (error != 0) { | |
244 | aprint_error_dev(self, "can't map mem space\n"); | 241 | aprint_error_dev(self, "can't map mem space\n"); | |
245 | return; | 242 | return; | |
246 | } | 243 | } | |
247 | 244 | |||
248 | /* Install interrupt handler. */ | 245 | /* Install interrupt handler. */ | |
249 | #ifdef __HAVE_PCI_MSI_MSIX | |||
250 | if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) { | 246 | if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) { | |
251 | aprint_error_dev(self, "can't map interrupt\n"); | 247 | aprint_error_dev(self, "can't map interrupt\n"); | |
252 | return; | 248 | return; | |
253 | } | 249 | } | |
254 | intrstr = pci_intr_string(sc->sc_pc, sc->sc_pihp[0], intrbuf, | 250 | intrstr = pci_intr_string(sc->sc_pc, sc->sc_pihp[0], intrbuf, | |
255 | sizeof(intrbuf)); | 251 | sizeof(intrbuf)); | |
256 | sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pihp[0], IPL_NET, | 252 | sc->sc_ih = pci_intr_establish(sc->sc_pc, sc->sc_pihp[0], IPL_NET, | |
257 | rtwn_intr, sc); | 253 | rtwn_intr, sc); | |
258 | #else /* !__HAVE_PCI_MSI_MSIX */ | |||
259 | if (pci_intr_map(pa, &ih)) { | |||
260 | aprint_error_dev(self, "can't map interrupt\n"); | |||
261 | return; | |||
262 | } | |||
263 | intrstr = pci_intr_string(sc->sc_pc, ih, intrbuf, sizeof(intrbuf)); | |||
264 | sc->sc_ih = pci_intr_establish(sc->sc_pc, ih, IPL_NET, rtwn_intr, sc); | |||
265 | #endif /* __HAVE_PCI_MSI_MSIX */ | |||
266 | if (sc->sc_ih == NULL) { | 254 | if (sc->sc_ih == NULL) { | |
267 | aprint_error_dev(self, "can't establish interrupt"); | 255 | aprint_error_dev(self, "can't establish interrupt"); | |
268 | if (intrstr != NULL) | 256 | if (intrstr != NULL) | |
269 | aprint_error(" at %s", intrstr); | 257 | aprint_error(" at %s", intrstr); | |
270 | aprint_error("\n"); | 258 | aprint_error("\n"); | |
271 | return; | 259 | return; | |
272 | } | 260 | } | |
273 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | 261 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | |
274 | 262 | |||
275 | error = rtwn_read_chipid(sc); | 263 | error = rtwn_read_chipid(sc); | |
276 | if (error != 0) { | 264 | if (error != 0) { | |
277 | aprint_error_dev(self, "unsupported test or unknown chip\n"); | 265 | aprint_error_dev(self, "unsupported test or unknown chip\n"); | |
278 | return; | 266 | return; | |
@@ -426,29 +414,27 @@ rtwn_detach(device_t self, int flags) | @@ -426,29 +414,27 @@ rtwn_detach(device_t self, int flags) | |||
426 | rtwn_free_tx_list(sc, i); | 414 | rtwn_free_tx_list(sc, i); | |
427 | rtwn_free_rx_list(sc); | 415 | rtwn_free_rx_list(sc); | |
428 | 416 | |||
429 | splx(s); | 417 | splx(s); | |
430 | 418 | |||
431 | callout_destroy(&sc->scan_to); | 419 | callout_destroy(&sc->scan_to); | |
432 | callout_destroy(&sc->calib_to); | 420 | callout_destroy(&sc->calib_to); | |
433 | 421 | |||
434 | if (sc->init_task != NULL) | 422 | if (sc->init_task != NULL) | |
435 | softint_disestablish(sc->init_task); | 423 | softint_disestablish(sc->init_task); | |
436 | 424 | |||
437 | if (sc->sc_ih != NULL) { | 425 | if (sc->sc_ih != NULL) { | |
438 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | 426 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | |
439 | #ifdef __HAVE_PCI_MSI_MSIX | |||
440 | pci_intr_release(sc->sc_pc, sc->sc_pihp, 1); | 427 | pci_intr_release(sc->sc_pc, sc->sc_pihp, 1); | |
441 | #endif | |||
442 | } | 428 | } | |
443 | 429 | |||
444 | pmf_device_deregister(self); | 430 | pmf_device_deregister(self); | |
445 | 431 | |||
446 | return 0; | 432 | return 0; | |
447 | } | 433 | } | |
448 | 434 | |||
449 | static int | 435 | static int | |
450 | rtwn_activate(device_t self, enum devact act) | 436 | rtwn_activate(device_t self, enum devact act) | |
451 | { | 437 | { | |
452 | struct rtwn_softc *sc = device_private(self); | 438 | struct rtwn_softc *sc = device_private(self); | |
453 | struct ifnet *ifp = GET_IFP(sc); | 439 | struct ifnet *ifp = GET_IFP(sc); | |
454 | 440 |
--- src/sys/dev/pci/if_rtwnreg.h 2015/08/27 14:04:08 1.1
+++ src/sys/dev/pci/if_rtwnreg.h 2015/11/06 14:22:17 1.2
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: if_rtwnreg.h,v 1.1 2015/08/27 14:04:08 nonaka Exp $ */ | 1 | /* $NetBSD: if_rtwnreg.h,v 1.2 2015/11/06 14:22:17 nonaka Exp $ */ | |
2 | /* $OpenBSD: if_rtwnreg.h,v 1.3 2015/06/14 08:02:47 stsp Exp $ */ | 2 | /* $OpenBSD: if_rtwnreg.h,v 1.3 2015/06/14 08:02:47 stsp Exp $ */ | |
3 | 3 | |||
4 | /*- | 4 | /*- | |
5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | 5 | * Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr> | |
6 | * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> | 6 | * Copyright (c) 2015 Stefan Sperling <stsp@openbsd.org> | |
7 | * | 7 | * | |
8 | * Permission to use, copy, modify, and distribute this software for any | 8 | * Permission to use, copy, modify, and distribute this software for any | |
9 | * purpose with or without fee is hereby granted, provided that the above | 9 | * purpose with or without fee is hereby granted, provided that the above | |
10 | * copyright notice and this permission notice appear in all copies. | 10 | * copyright notice and this permission notice appear in all copies. | |
11 | * | 11 | * | |
12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 12 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 13 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 14 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
@@ -1270,29 +1270,27 @@ struct rtwn_host_cmd_ring { | @@ -1270,29 +1270,27 @@ struct rtwn_host_cmd_ring { | |||
1270 | 1270 | |||
1271 | struct rtwn_softc { | 1271 | struct rtwn_softc { | |
1272 | device_t sc_dev; | 1272 | device_t sc_dev; | |
1273 | struct ethercom sc_ec; | 1273 | struct ethercom sc_ec; | |
1274 | struct ieee80211com sc_ic; | 1274 | struct ieee80211com sc_ic; | |
1275 | int (*sc_newstate)(struct ieee80211com *, | 1275 | int (*sc_newstate)(struct ieee80211com *, | |
1276 | enum ieee80211_state, int); | 1276 | enum ieee80211_state, int); | |
1277 | 1277 | |||
1278 | /* PCI specific goo. */ | 1278 | /* PCI specific goo. */ | |
1279 | bus_dma_tag_t sc_dmat; | 1279 | bus_dma_tag_t sc_dmat; | |
1280 | pci_chipset_tag_t sc_pc; | 1280 | pci_chipset_tag_t sc_pc; | |
1281 | pcitag_t sc_tag; | 1281 | pcitag_t sc_tag; | |
1282 | void *sc_ih; | 1282 | void *sc_ih; | |
1283 | #ifdef __HAVE_PCI_MSI_MSIX | |||
1284 | pci_intr_handle_t *sc_pihp; | 1283 | pci_intr_handle_t *sc_pihp; | |
1285 | #endif | |||
1286 | bus_space_tag_t sc_st; | 1284 | bus_space_tag_t sc_st; | |
1287 | bus_space_handle_t sc_sh; | 1285 | bus_space_handle_t sc_sh; | |
1288 | bus_size_t sc_mapsize; | 1286 | bus_size_t sc_mapsize; | |
1289 | int sc_cap_off; | 1287 | int sc_cap_off; | |
1290 | 1288 | |||
1291 | 1289 | |||
1292 | struct callout scan_to; | 1290 | struct callout scan_to; | |
1293 | struct callout calib_to; | 1291 | struct callout calib_to; | |
1294 | void *init_task; | 1292 | void *init_task; | |
1295 | int ac2idx[WME_NUM_AC]; | 1293 | int ac2idx[WME_NUM_AC]; | |
1296 | uint32_t sc_flags; | 1294 | uint32_t sc_flags; | |
1297 | #define RTWN_FLAG_FW_LOADED __BIT(0) | 1295 | #define RTWN_FLAG_FW_LOADED __BIT(0) | |
1298 | #define RTWN_FLAG_CCK_HIPWR __BIT(1) | 1296 | #define RTWN_FLAG_CCK_HIPWR __BIT(1) |
--- src/sys/dev/pci/rtsx_pci.c 2015/09/05 04:56:53 1.4
+++ src/sys/dev/pci/rtsx_pci.c 2015/11/06 14:22:17 1.5
@@ -1,61 +1,59 @@ | @@ -1,61 +1,59 @@ | |||
1 | /* $NetBSD: rtsx_pci.c,v 1.4 2015/09/05 04:56:53 nonaka Exp $ */ | 1 | /* $NetBSD: rtsx_pci.c,v 1.5 2015/11/06 14:22:17 nonaka Exp $ */ | |
2 | /* $OpenBSD: rtsx_pci.c,v 1.7 2014/08/19 17:55:03 phessler Exp $ */ | 2 | /* $OpenBSD: rtsx_pci.c,v 1.7 2014/08/19 17:55:03 phessler Exp $ */ | |
3 | 3 | |||
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> | 6 | * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> | |
7 | * Copyright (c) 2012 Stefan Sperling <stsp@openbsd.org> | 7 | * Copyright (c) 2012 Stefan Sperling <stsp@openbsd.org> | |
8 | * | 8 | * | |
9 | * Permission to use, copy, modify, and distribute this software for any | 9 | * Permission to use, copy, modify, and distribute this software for any | |
10 | * purpose with or without fee is hereby granted, provided that the above | 10 | * purpose with or without fee is hereby granted, provided that the above | |
11 | * copyright notice and this permission notice appear in all copies. | 11 | * copyright notice and this permission notice appear in all copies. | |
12 | * | 12 | * | |
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 14 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 15 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 16 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 17 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 18 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 19 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
20 | */ | 20 | */ | |
21 | 21 | |||
22 | #include <sys/cdefs.h> | 22 | #include <sys/cdefs.h> | |
23 | __KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.4 2015/09/05 04:56:53 nonaka Exp $"); | 23 | __KERNEL_RCSID(0, "$NetBSD: rtsx_pci.c,v 1.5 2015/11/06 14:22:17 nonaka Exp $"); | |
24 | 24 | |||
25 | #include <sys/param.h> | 25 | #include <sys/param.h> | |
26 | #include <sys/device.h> | 26 | #include <sys/device.h> | |
27 | #include <sys/systm.h> | 27 | #include <sys/systm.h> | |
28 | #include <sys/malloc.h> | 28 | #include <sys/malloc.h> | |
29 | #include <sys/pmf.h> | 29 | #include <sys/pmf.h> | |
30 | 30 | |||
31 | #include <dev/pci/pcivar.h> | 31 | #include <dev/pci/pcivar.h> | |
32 | #include <dev/pci/pcidevs.h> | 32 | #include <dev/pci/pcidevs.h> | |
33 | 33 | |||
34 | #include <dev/ic/rtsxreg.h> | 34 | #include <dev/ic/rtsxreg.h> | |
35 | #include <dev/ic/rtsxvar.h> | 35 | #include <dev/ic/rtsxvar.h> | |
36 | 36 | |||
37 | #include <dev/sdmmc/sdmmcvar.h> | 37 | #include <dev/sdmmc/sdmmcvar.h> | |
38 | 38 | |||
39 | #define RTSX_PCI_BAR 0x10 | 39 | #define RTSX_PCI_BAR 0x10 | |
40 | 40 | |||
41 | struct rtsx_pci_softc { | 41 | struct rtsx_pci_softc { | |
42 | struct rtsx_softc sc; | 42 | struct rtsx_softc sc; | |
43 | pci_chipset_tag_t sc_pc; | 43 | pci_chipset_tag_t sc_pc; | |
44 | void *sc_ih; | 44 | void *sc_ih; | |
45 | 45 | |||
46 | #ifdef __HAVE_PCI_MSI_MSIX | |||
47 | pci_intr_handle_t *sc_pihp; | 46 | pci_intr_handle_t *sc_pihp; | |
48 | #endif | |||
49 | }; | 47 | }; | |
50 | 48 | |||
51 | static int rtsx_pci_match(device_t , cfdata_t, void *); | 49 | static int rtsx_pci_match(device_t , cfdata_t, void *); | |
52 | static void rtsx_pci_attach(device_t, device_t, void *); | 50 | static void rtsx_pci_attach(device_t, device_t, void *); | |
53 | static int rtsx_pci_detach(device_t, int); | 51 | static int rtsx_pci_detach(device_t, int); | |
54 | 52 | |||
55 | CFATTACH_DECL_NEW(rtsx_pci, sizeof(struct rtsx_pci_softc), | 53 | CFATTACH_DECL_NEW(rtsx_pci, sizeof(struct rtsx_pci_softc), | |
56 | rtsx_pci_match, rtsx_pci_attach, rtsx_pci_detach, NULL); | 54 | rtsx_pci_match, rtsx_pci_attach, rtsx_pci_detach, NULL); | |
57 | 55 | |||
58 | #ifdef RTSX_DEBUG | 56 | #ifdef RTSX_DEBUG | |
59 | extern int rtsxdebug; | 57 | extern int rtsxdebug; | |
60 | #define DPRINTF(n,s) do { if ((n) <= rtsxdebug) printf s; } while (0) | 58 | #define DPRINTF(n,s) do { if ((n) <= rtsxdebug) printf s; } while (0) | |
61 | #else | 59 | #else | |
@@ -86,69 +84,57 @@ rtsx_pci_match(device_t parent, cfdata_t | @@ -86,69 +84,57 @@ rtsx_pci_match(device_t parent, cfdata_t | |||
86 | return 1; | 84 | return 1; | |
87 | } | 85 | } | |
88 | 86 | |||
89 | return 0; | 87 | return 0; | |
90 | } | 88 | } | |
91 | 89 | |||
92 | static void | 90 | static void | |
93 | rtsx_pci_attach(device_t parent, device_t self, void *aux) | 91 | rtsx_pci_attach(device_t parent, device_t self, void *aux) | |
94 | { | 92 | { | |
95 | struct rtsx_pci_softc *sc = device_private(self); | 93 | struct rtsx_pci_softc *sc = device_private(self); | |
96 | struct pci_attach_args *pa = (struct pci_attach_args *)aux; | 94 | struct pci_attach_args *pa = (struct pci_attach_args *)aux; | |
97 | pci_chipset_tag_t pc = pa->pa_pc; | 95 | pci_chipset_tag_t pc = pa->pa_pc; | |
98 | pcitag_t tag = pa->pa_tag; | 96 | pcitag_t tag = pa->pa_tag; | |
99 | #ifndef __HAVE_PCI_MSI_MSIX | |||
100 | pci_intr_handle_t ih; | |||
101 | #endif | |||
102 | pcireg_t reg; | 97 | pcireg_t reg; | |
103 | char const *intrstr; | 98 | char const *intrstr; | |
104 | bus_space_tag_t iot; | 99 | bus_space_tag_t iot; | |
105 | bus_space_handle_t ioh; | 100 | bus_space_handle_t ioh; | |
106 | bus_size_t size; | 101 | bus_size_t size; | |
107 | uint32_t flags; | 102 | uint32_t flags; | |
108 | char intrbuf[PCI_INTRSTR_LEN]; | 103 | char intrbuf[PCI_INTRSTR_LEN]; | |
109 | 104 | |||
110 | sc->sc.sc_dev = self; | 105 | sc->sc.sc_dev = self; | |
111 | sc->sc_pc = pc; | 106 | sc->sc_pc = pc; | |
112 | 107 | |||
113 | pci_aprint_devinfo(pa, NULL); | 108 | pci_aprint_devinfo(pa, NULL); | |
114 | 109 | |||
115 | if ((pci_conf_read(pc, tag, RTSX_CFG_PCI) & RTSX_CFG_ASIC) != 0) { | 110 | if ((pci_conf_read(pc, tag, RTSX_CFG_PCI) & RTSX_CFG_ASIC) != 0) { | |
116 | aprint_error_dev(self, "no asic\n"); | 111 | aprint_error_dev(self, "no asic\n"); | |
117 | return; | 112 | return; | |
118 | } | 113 | } | |
119 | 114 | |||
120 | if (pci_mapreg_map(pa, RTSX_PCI_BAR, PCI_MAPREG_TYPE_MEM, 0, | 115 | if (pci_mapreg_map(pa, RTSX_PCI_BAR, PCI_MAPREG_TYPE_MEM, 0, | |
121 | &iot, &ioh, NULL, &size)) { | 116 | &iot, &ioh, NULL, &size)) { | |
122 | aprint_error_dev(self, "couldn't map registers\n"); | 117 | aprint_error_dev(self, "couldn't map registers\n"); | |
123 | return; | 118 | return; | |
124 | } | 119 | } | |
125 | 120 | |||
126 | #ifdef __HAVE_PCI_MSI_MSIX | |||
127 | if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) { | 121 | if (pci_intr_alloc(pa, &sc->sc_pihp, NULL, 0)) { | |
128 | aprint_error_dev(self, "couldn't map interrupt\n"); | 122 | aprint_error_dev(self, "couldn't map interrupt\n"); | |
129 | return; | 123 | return; | |
130 | } | 124 | } | |
131 | intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf, sizeof(intrbuf)); | 125 | intrstr = pci_intr_string(pc, sc->sc_pihp[0], intrbuf, sizeof(intrbuf)); | |
132 | sc->sc_ih = pci_intr_establish(pc, sc->sc_pihp[0], IPL_SDMMC, rtsx_intr, | 126 | sc->sc_ih = pci_intr_establish(pc, sc->sc_pihp[0], IPL_SDMMC, rtsx_intr, | |
133 | &sc->sc); | 127 | &sc->sc); | |
134 | #else /* !__HAVE_PCI_MSI_MSIX */ | |||
135 | if (pci_intr_map(pa, &ih)) { | |||
136 | aprint_error_dev(self, "couldn't map interrupt\n"); | |||
137 | return; | |||
138 | } | |||
139 | intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf)); | |||
140 | sc->sc_ih = pci_intr_establish(pc, ih, IPL_SDMMC, rtsx_intr, &sc->sc); | |||
141 | #endif /* __HAVE_PCI_MSI_MSIX */ | |||
142 | if (sc->sc_ih == NULL) { | 128 | if (sc->sc_ih == NULL) { | |
143 | aprint_error_dev(self, "couldn't establish interrupt\n"); | 129 | aprint_error_dev(self, "couldn't establish interrupt\n"); | |
144 | return; | 130 | return; | |
145 | } | 131 | } | |
146 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | 132 | aprint_normal_dev(self, "interrupting at %s\n", intrstr); | |
147 | 133 | |||
148 | /* Enable the device */ | 134 | /* Enable the device */ | |
149 | reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); | 135 | reg = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); | |
150 | reg |= PCI_COMMAND_MASTER_ENABLE; | 136 | reg |= PCI_COMMAND_MASTER_ENABLE; | |
151 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg); | 137 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, reg); | |
152 | 138 | |||
153 | /* Power up the device */ | 139 | /* Power up the device */ | |
154 | pci_set_powerstate(pc, tag, PCI_PMCSR_STATE_D0); | 140 | pci_set_powerstate(pc, tag, PCI_PMCSR_STATE_D0); | |
@@ -188,19 +174,17 @@ rtsx_pci_attach(device_t parent, device_ | @@ -188,19 +174,17 @@ rtsx_pci_attach(device_t parent, device_ | |||
188 | } | 174 | } | |
189 | 175 | |||
190 | static int | 176 | static int | |
191 | rtsx_pci_detach(device_t self, int flags) | 177 | rtsx_pci_detach(device_t self, int flags) | |
192 | { | 178 | { | |
193 | struct rtsx_pci_softc *sc = device_private(self); | 179 | struct rtsx_pci_softc *sc = device_private(self); | |
194 | int rv; | 180 | int rv; | |
195 | 181 | |||
196 | rv = rtsx_detach(&sc->sc, flags); | 182 | rv = rtsx_detach(&sc->sc, flags); | |
197 | if (rv) | 183 | if (rv) | |
198 | return rv; | 184 | return rv; | |
199 | 185 | |||
200 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | 186 | pci_intr_disestablish(sc->sc_pc, sc->sc_ih); | |
201 | #ifdef __HAVE_PCI_MSI_MSIX | |||
202 | pci_intr_release(sc->sc_pc, sc->sc_pihp, 1); | 187 | pci_intr_release(sc->sc_pc, sc->sc_pihp, 1); | |
203 | #endif /* __HAVE_PCI_MSI_MSIX */ | |||
204 | 188 | |||
205 | return 0; | 189 | return 0; | |
206 | } | 190 | } |