| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: amdccp_pci.c,v 1.1 2020/06/24 03:38:01 thorpej Exp $ */ | | 1 | /* $NetBSD: amdccp_pci.c,v 1.2 2020/06/25 16:40:40 thorpej Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 2020 The NetBSD Foundation, Inc. | | 4 | * Copyright (c) 2020 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 Jason R. Thorpe. | | 8 | * by Jason R. Thorpe. |
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: amdccp_pci.c,v 1.1 2020/06/24 03:38:01 thorpej Exp $"); | | 33 | __KERNEL_RCSID(0, "$NetBSD: amdccp_pci.c,v 1.2 2020/06/25 16:40:40 thorpej Exp $"); |
34 | | | 34 | |
35 | #include <sys/param.h> | | 35 | #include <sys/param.h> |
36 | #include <sys/bus.h> | | 36 | #include <sys/bus.h> |
37 | #include <sys/cpu.h> | | 37 | #include <sys/cpu.h> |
38 | #include <sys/device.h> | | 38 | #include <sys/device.h> |
39 | | | 39 | |
40 | #include <dev/pci/pcireg.h> | | 40 | #include <dev/pci/pcireg.h> |
41 | #include <dev/pci/pcivar.h> | | 41 | #include <dev/pci/pcivar.h> |
42 | #include <dev/pci/pcidevs.h> | | 42 | #include <dev/pci/pcidevs.h> |
43 | | | 43 | |
44 | #include <dev/ic/amdccpvar.h> | | 44 | #include <dev/ic/amdccpvar.h> |
45 | | | 45 | |
46 | static int amdccp_pci_match(device_t, cfdata_t, void *); | | 46 | static int amdccp_pci_match(device_t, cfdata_t, void *); |
| @@ -91,27 +91,27 @@ amdccp_pci_match(device_t parent, cfdata | | | @@ -91,27 +91,27 @@ amdccp_pci_match(device_t parent, cfdata |
91 | return amdccp_pci_lookup(pa) != NULL; | | 91 | return amdccp_pci_lookup(pa) != NULL; |
92 | } | | 92 | } |
93 | | | 93 | |
94 | static void | | 94 | static void |
95 | amdccp_pci_attach(device_t parent, device_t self, void *aux) | | 95 | amdccp_pci_attach(device_t parent, device_t self, void *aux) |
96 | { | | 96 | { |
97 | struct amdccp_softc * const sc = device_private(self); | | 97 | struct amdccp_softc * const sc = device_private(self); |
98 | const struct pci_attach_args * const pa = aux; | | 98 | const struct pci_attach_args * const pa = aux; |
99 | pcireg_t type; | | 99 | pcireg_t type; |
100 | | | 100 | |
101 | sc->sc_dev = self; | | 101 | sc->sc_dev = self; |
102 | | | 102 | |
103 | aprint_naive("\n"); | | 103 | aprint_naive("\n"); |
104 | aprint_normal(": AMD Cryptographc Coprocessor\n"); | | 104 | aprint_normal(": AMD Cryptographic Coprocessor\n"); |
105 | | | 105 | |
106 | type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AMDCCP_MEM_BAR); | | 106 | type = pci_mapreg_type(pa->pa_pc, pa->pa_tag, AMDCCP_MEM_BAR); |
107 | if (PCI_MAPREG_TYPE(type) != PCI_MAPREG_TYPE_MEM) { | | 107 | if (PCI_MAPREG_TYPE(type) != PCI_MAPREG_TYPE_MEM) { |
108 | aprint_error_dev(self, "expected MEM register, got IO\n"); | | 108 | aprint_error_dev(self, "expected MEM register, got IO\n"); |
109 | return; | | 109 | return; |
110 | } | | 110 | } |
111 | | | 111 | |
112 | if (pci_mapreg_map(pa, AMDCCP_MEM_BAR, type, 0, | | 112 | if (pci_mapreg_map(pa, AMDCCP_MEM_BAR, type, 0, |
113 | &sc->sc_bst, &sc->sc_bsh, NULL, NULL) != 0) { | | 113 | &sc->sc_bst, &sc->sc_bsh, NULL, NULL) != 0) { |
114 | aprint_error_dev(self, "unable to map device registers\n"); | | 114 | aprint_error_dev(self, "unable to map device registers\n"); |
115 | return; | | 115 | return; |
116 | } | | 116 | } |
117 | | | 117 | |