| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $ */ | | 1 | /* $NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $ */ |
2 | | | 2 | |
3 | /* | | 3 | /* |
4 | * Copyright (c) 1995, 1996, 1997, 1998 | | 4 | * Copyright (c) 1995, 1996, 1997, 1998 |
5 | * Christopher G. Demetriou. All rights reserved. | | 5 | * Christopher G. Demetriou. All rights reserved. |
6 | * Copyright (c) 1994 Charles M. Hannum. All rights reserved. | | 6 | * Copyright (c) 1994 Charles M. Hannum. All rights reserved. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * 1. Redistributions of source code must retain the above copyright | | 11 | * 1. Redistributions of source code must retain the above copyright |
12 | * notice, this list of conditions and the following disclaimer. | | 12 | * notice, this list of conditions and the following disclaimer. |
13 | * 2. Redistributions in binary form must reproduce the above copyright | | 13 | * 2. Redistributions in binary form must reproduce the above copyright |
14 | * notice, this list of conditions and the following disclaimer in the | | 14 | * notice, this list of conditions and the following disclaimer in the |
| @@ -26,27 +26,27 @@ | | | @@ -26,27 +26,27 @@ |
26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | | 26 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | | 27 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | | 28 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | | 29 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | | 30 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | | 31 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | */ | | 32 | */ |
33 | | | 33 | |
34 | /* | | 34 | /* |
35 | * PCI bus autoconfiguration. | | 35 | * PCI bus autoconfiguration. |
36 | */ | | 36 | */ |
37 | | | 37 | |
38 | #include <sys/cdefs.h> | | 38 | #include <sys/cdefs.h> |
39 | __KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.157 2020/02/02 16:30:31 jmcneill Exp $"); | | 39 | __KERNEL_RCSID(0, "$NetBSD: pci.c,v 1.158 2021/01/29 06:00:08 skrll Exp $"); |
40 | | | 40 | |
41 | #ifdef _KERNEL_OPT | | 41 | #ifdef _KERNEL_OPT |
42 | #include "opt_pci.h" | | 42 | #include "opt_pci.h" |
43 | #endif | | 43 | #endif |
44 | | | 44 | |
45 | #include <sys/param.h> | | 45 | #include <sys/param.h> |
46 | #include <sys/malloc.h> | | 46 | #include <sys/malloc.h> |
47 | #include <sys/systm.h> | | 47 | #include <sys/systm.h> |
48 | #include <sys/device.h> | | 48 | #include <sys/device.h> |
49 | #include <sys/module.h> | | 49 | #include <sys/module.h> |
50 | | | 50 | |
51 | #include <dev/pci/pcireg.h> | | 51 | #include <dev/pci/pcireg.h> |
52 | #include <dev/pci/pcivar.h> | | 52 | #include <dev/pci/pcivar.h> |
| @@ -925,27 +925,27 @@ pci_conf_capture(pci_chipset_tag_t pc, p | | | @@ -925,27 +925,27 @@ pci_conf_capture(pci_chipset_tag_t pc, p |
925 | off + PCIE_DCSR2); | | 925 | off + PCIE_DCSR2); |
926 | | | 926 | |
927 | if (PCIE_HAS_LINKREGS(devtype)) | | 927 | if (PCIE_HAS_LINKREGS(devtype)) |
928 | pcs->e_lcr2 = (uint16_t)pci_conf_read(pc, tag, | | 928 | pcs->e_lcr2 = (uint16_t)pci_conf_read(pc, tag, |
929 | off + PCIE_LCSR2); | | 929 | off + PCIE_LCSR2); |
930 | | | 930 | |
931 | /* XXX PCIE_SLCSR2 (It's reserved by the PCIe spec) */ | | 931 | /* XXX PCIE_SLCSR2 (It's reserved by the PCIe spec) */ |
932 | } | | 932 | } |
933 | } | | 933 | } |
934 | | | 934 | |
935 | /* For MSI */ | | 935 | /* For MSI */ |
936 | if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, NULL) != 0) { | | 936 | if (pci_get_capability(pc, tag, PCI_CAP_MSI, &off, NULL) != 0) { |
937 | bool bit64, pvmask; | | 937 | bool bit64, pvmask; |
938 | | | 938 | |
939 | pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL); | | 939 | pcs->msi_ctl = pci_conf_read(pc, tag, off + PCI_MSI_CTL); |
940 | | | 940 | |
941 | bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR; | | 941 | bit64 = pcs->msi_ctl & PCI_MSI_CTL_64BIT_ADDR; |
942 | pvmask = pcs->msi_ctl & PCI_MSI_CTL_PERVEC_MASK; | | 942 | pvmask = pcs->msi_ctl & PCI_MSI_CTL_PERVEC_MASK; |
943 | | | 943 | |
944 | /* Address */ | | 944 | /* Address */ |
945 | pcs->msi_maddr = pci_conf_read(pc, tag, off + PCI_MSI_MADDR); | | 945 | pcs->msi_maddr = pci_conf_read(pc, tag, off + PCI_MSI_MADDR); |
946 | if (bit64) | | 946 | if (bit64) |
947 | pcs->msi_maddr64_hi = pci_conf_read(pc, tag, | | 947 | pcs->msi_maddr64_hi = pci_conf_read(pc, tag, |
948 | off + PCI_MSI_MADDR64_HI); | | 948 | off + PCI_MSI_MADDR64_HI); |
949 | | | 949 | |
950 | /* Data */ | | 950 | /* Data */ |
951 | pcs->msi_mdata = pci_conf_read(pc, tag, | | 951 | pcs->msi_mdata = pci_conf_read(pc, tag, |