| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $ */ | | 1 | /* $NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. |
5 | * All rights reserved. | | 5 | * All rights reserved. |
6 | * | | 6 | * |
7 | * This code is derived from software contributed to The NetBSD Foundation | | 7 | * This code is derived from software contributed to The NetBSD Foundation |
8 | * by Lennart Augustsson (lennart@augustsson.net). | | 8 | * by Lennart Augustsson (lennart@augustsson.net). |
9 | * | | 9 | * |
10 | * Redistribution and use in source and binary forms, with or without | | 10 | * Redistribution and use in source and binary forms, with or without |
11 | * modification, are permitted provided that the following conditions | | 11 | * modification, are permitted provided that the following conditions |
12 | * are met: | | 12 | * are met: |
13 | * 1. Redistributions of source code must retain the above copyright | | 13 | * 1. Redistributions of source code must retain the above copyright |
14 | * notice, this list of conditions and the following disclaimer. | | 14 | * notice, this list of conditions and the following disclaimer. |
| @@ -20,27 +20,27 @@ | | | @@ -20,27 +20,27 @@ |
20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
29 | * POSSIBILITY OF SUCH DAMAGE. | | 29 | * POSSIBILITY OF SUCH DAMAGE. |
30 | */ | | 30 | */ |
31 | | | 31 | |
32 | #include <sys/cdefs.h> | | 32 | #include <sys/cdefs.h> |
33 | __KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.64 2016/10/13 20:05:06 jdolecek Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: ehci_pci.c,v 1.65 2017/06/12 10:59:47 sborrill Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/systm.h> | | 36 | #include <sys/systm.h> |
37 | #include <sys/kernel.h> | | 37 | #include <sys/kernel.h> |
38 | #include <sys/device.h> | | 38 | #include <sys/device.h> |
39 | #include <sys/proc.h> | | 39 | #include <sys/proc.h> |
40 | #include <sys/queue.h> | | 40 | #include <sys/queue.h> |
41 | | | 41 | |
42 | #include <sys/bus.h> | | 42 | #include <sys/bus.h> |
43 | | | 43 | |
44 | #include <dev/pci/pcidevs.h> | | 44 | #include <dev/pci/pcidevs.h> |
45 | #include <dev/pci/pcivar.h> | | 45 | #include <dev/pci/pcivar.h> |
46 | #include <dev/pci/usb_pci.h> | | 46 | #include <dev/pci/usb_pci.h> |
| @@ -151,30 +151,34 @@ ehci_pci_attach(device_t parent, device_ | | | @@ -151,30 +151,34 @@ ehci_pci_attach(device_t parent, device_ |
151 | EOWRITE4(&sc->sc, EHCI_USBINTR, 0); | | 151 | EOWRITE4(&sc->sc, EHCI_USBINTR, 0); |
152 | | | 152 | |
153 | /* Handle quirks */ | | 153 | /* Handle quirks */ |
154 | switch (quirk) { | | 154 | switch (quirk) { |
155 | case EHCI_PCI_QUIRK_AMD_SB600: | | 155 | case EHCI_PCI_QUIRK_AMD_SB600: |
156 | ehci_apply_amd_quirks(sc); | | 156 | ehci_apply_amd_quirks(sc); |
157 | break; | | 157 | break; |
158 | case EHCI_PCI_QUIRK_AMD_SB700: | | 158 | case EHCI_PCI_QUIRK_AMD_SB700: |
159 | if (pci_find_device(NULL, ehci_sb700_match)) | | 159 | if (pci_find_device(NULL, ehci_sb700_match)) |
160 | ehci_apply_amd_quirks(sc); | | 160 | ehci_apply_amd_quirks(sc); |
161 | break; | | 161 | break; |
162 | } | | 162 | } |
163 | | | 163 | |
| | | 164 | pcireg_t intr = pci_conf_read(pc, tag, PCI_INTERRUPT_REG); |
| | | 165 | int pin = PCI_INTERRUPT_PIN(intr); |
| | | 166 | |
164 | /* Enable the device. */ | | 167 | /* Enable the device. */ |
165 | csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); | | 168 | csr = pci_conf_read(pc, tag, PCI_COMMAND_STATUS_REG); |
166 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, | | 169 | csr |= PCI_COMMAND_MASTER_ENABLE; |
167 | csr | PCI_COMMAND_MASTER_ENABLE); | | 170 | csr &= ~(pin ? PCI_COMMAND_INTERRUPT_DISABLE : 0); |
| | | 171 | pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, csr); |
168 | | | 172 | |
169 | /* Map and establish the interrupt. */ | | 173 | /* Map and establish the interrupt. */ |
170 | if (pci_intr_map(pa, &ih)) { | | 174 | if (pci_intr_map(pa, &ih)) { |
171 | aprint_error_dev(self, "couldn't map interrupt\n"); | | 175 | aprint_error_dev(self, "couldn't map interrupt\n"); |
172 | goto fail; | | 176 | goto fail; |
173 | } | | 177 | } |
174 | | | 178 | |
175 | /* | | 179 | /* |
176 | * Allocate IRQ | | 180 | * Allocate IRQ |
177 | */ | | 181 | */ |
178 | intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf)); | | 182 | intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf)); |
179 | sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_USB, ehci_intr, sc, | | 183 | sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_USB, ehci_intr, sc, |
180 | device_xname(self)); | | 184 | device_xname(self)); |