Sat Mar 26 09:07:31 2016 UTC ()
Restore HOST1X and AHB_A2 to pmap_devmap to give pmap less work to do


(skrll)
diff -r1.20 -r1.21 src/sys/arch/arm/nvidia/tegra_reg.h
diff -r1.8 -r1.9 src/sys/arch/arm/nvidia/tegra_soc.c
diff -r1.37 -r1.38 src/sys/arch/evbarm/tegra/tegra_machdep.c

cvs diff -r1.20 -r1.21 src/sys/arch/arm/nvidia/tegra_reg.h (expand / switch to unified diff)

--- src/sys/arch/arm/nvidia/tegra_reg.h 2015/11/21 22:55:32 1.20
+++ src/sys/arch/arm/nvidia/tegra_reg.h 2016/03/26 09:07:31 1.21
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tegra_reg.h,v 1.20 2015/11/21 22:55:32 jmcneill Exp $ */ 1/* $NetBSD: tegra_reg.h,v 1.21 2016/03/26 09:07:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -62,28 +62,30 @@ @@ -62,28 +62,30 @@
62#define TEGRA_HOST1X_BASE 0x50000000 62#define TEGRA_HOST1X_BASE 0x50000000
63#define TEGRA_HOST1X_SIZE 0x00034000 63#define TEGRA_HOST1X_SIZE 0x00034000
64#define TEGRA_GHOST_BASE 0x54000000 64#define TEGRA_GHOST_BASE 0x54000000
65#define TEGRA_GHOST_SIZE 0x01000000 65#define TEGRA_GHOST_SIZE 0x01000000
66#define TEGRA_GPU_BASE 0x57000000 66#define TEGRA_GPU_BASE 0x57000000
67#define TEGRA_GPU_SIZE 0x02000000 67#define TEGRA_GPU_SIZE 0x02000000
68#define TEGRA_PPSB_BASE 0x60000000 68#define TEGRA_PPSB_BASE 0x60000000
69#define TEGRA_PPSB_SIZE 0x01000000 69#define TEGRA_PPSB_SIZE 0x01000000
70#define TEGRA_APB_BASE 0x70000000 70#define TEGRA_APB_BASE 0x70000000
71#define TEGRA_APB_SIZE 0x01000000 71#define TEGRA_APB_SIZE 0x01000000
72#define TEGRA_AHB_A2_BASE 0x7c000000 72#define TEGRA_AHB_A2_BASE 0x7c000000
73#define TEGRA_AHB_A2_SIZE 0x02000000 73#define TEGRA_AHB_A2_SIZE 0x02000000
74 74
75#define TEGRA_PPSB_VBASE 0xfd000000 75#define TEGRA_HOST1X_VBASE 0xfaf00000
76#define TEGRA_APB_VBASE 0xfe000000 76#define TEGRA_PPSB_VBASE 0xfb000000
 77#define TEGRA_APB_VBASE 0xfc000000
 78#define TEGRA_AHB_A2_VBASE 0xfd000000
77 79
78#define TEGRA_REF_FREQ 12000000 80#define TEGRA_REF_FREQ 12000000
79 81
80/* APB */ 82/* APB */
81#define TEGRA_MPIO_OFFSET 0x00000000 83#define TEGRA_MPIO_OFFSET 0x00000000
82#define TEGRA_MPIO_SIZE 0x4000 84#define TEGRA_MPIO_SIZE 0x4000
83#define TEGRA_UARTA_OFFSET 0x00006000 85#define TEGRA_UARTA_OFFSET 0x00006000
84#define TEGRA_UARTA_SIZE 0x40 86#define TEGRA_UARTA_SIZE 0x40
85#define TEGRA_UARTB_OFFSET 0x00006040 87#define TEGRA_UARTB_OFFSET 0x00006040
86#define TEGRA_UARTB_SIZE 0x40 88#define TEGRA_UARTB_SIZE 0x40
87#define TEGRA_UARTC_OFFSET 0x00006200 89#define TEGRA_UARTC_OFFSET 0x00006200
88#define TEGRA_UARTC_SIZE 0x100 90#define TEGRA_UARTC_SIZE 0x100
89#define TEGRA_UARTD_OFFSET 0x00006300 91#define TEGRA_UARTD_OFFSET 0x00006300

cvs diff -r1.8 -r1.9 src/sys/arch/arm/nvidia/tegra_soc.c (expand / switch to unified diff)

--- src/sys/arch/arm/nvidia/tegra_soc.c 2015/12/22 22:10:36 1.8
+++ src/sys/arch/arm/nvidia/tegra_soc.c 2016/03/26 09:07:31 1.9
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tegra_soc.c,v 1.8 2015/12/22 22:10:36 jmcneill Exp $ */ 1/* $NetBSD: tegra_soc.c,v 1.9 2016/03/26 09:07:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -20,66 +20,76 @@ @@ -20,66 +20,76 @@
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include "opt_tegra.h" 29#include "opt_tegra.h"
30#include "opt_multiprocessor.h" 30#include "opt_multiprocessor.h"
31 31
32#include <sys/cdefs.h> 32#include <sys/cdefs.h>
33__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.8 2015/12/22 22:10:36 jmcneill Exp $"); 33__KERNEL_RCSID(0, "$NetBSD: tegra_soc.c,v 1.9 2016/03/26 09:07:31 skrll Exp $");
34 34
35#define _ARM32_BUS_DMA_PRIVATE 35#define _ARM32_BUS_DMA_PRIVATE
36#include <sys/param.h> 36#include <sys/param.h>
37#include <sys/bus.h> 37#include <sys/bus.h>
38#include <sys/cpu.h> 38#include <sys/cpu.h>
39#include <sys/device.h> 39#include <sys/device.h>
40 40
41#include <uvm/uvm_extern.h> 41#include <uvm/uvm_extern.h>
42 42
43#include <arm/bootconfig.h> 43#include <arm/bootconfig.h>
44#include <arm/cpufunc.h> 44#include <arm/cpufunc.h>
45 45
46#include <arm/nvidia/tegra_reg.h> 46#include <arm/nvidia/tegra_reg.h>
47#include <arm/nvidia/tegra_apbreg.h> 47#include <arm/nvidia/tegra_apbreg.h>
48#include <arm/nvidia/tegra_mcreg.h> 48#include <arm/nvidia/tegra_mcreg.h>
49#include <arm/nvidia/tegra_var.h> 49#include <arm/nvidia/tegra_var.h>
50 50
 51bus_space_handle_t tegra_host1x_bsh;
51bus_space_handle_t tegra_ppsb_bsh; 52bus_space_handle_t tegra_ppsb_bsh;
52bus_space_handle_t tegra_apb_bsh; 53bus_space_handle_t tegra_apb_bsh;
 54bus_space_handle_t tegra_ahb_a2_bsh;
53 55
54struct arm32_bus_dma_tag tegra_dma_tag = { 56struct arm32_bus_dma_tag tegra_dma_tag = {
55 _BUS_DMAMAP_FUNCS, 57 _BUS_DMAMAP_FUNCS,
56 _BUS_DMAMEM_FUNCS, 58 _BUS_DMAMEM_FUNCS,
57 _BUS_DMATAG_FUNCS, 59 _BUS_DMATAG_FUNCS,
58}; 60};
59 61
60static void tegra_mpinit(void); 62static void tegra_mpinit(void);
61 63
62void 64void
63tegra_bootstrap(void) 65tegra_bootstrap(void)
64{ 66{
65 if (bus_space_map(&armv7_generic_bs_tag, 67 if (bus_space_map(&armv7_generic_bs_tag,
 68 TEGRA_HOST1X_BASE, TEGRA_HOST1X_SIZE, 0,
 69 &tegra_host1x_bsh) != 0)
 70 panic("couldn't map HOST1X");
 71 if (bus_space_map(&armv7_generic_bs_tag,
66 TEGRA_PPSB_BASE, TEGRA_PPSB_SIZE, 0, 72 TEGRA_PPSB_BASE, TEGRA_PPSB_SIZE, 0,
67 &tegra_ppsb_bsh) != 0) 73 &tegra_ppsb_bsh) != 0)
68 panic("couldn't map PPSB"); 74 panic("couldn't map PPSB");
69 if (bus_space_map(&armv7_generic_bs_tag, 75 if (bus_space_map(&armv7_generic_bs_tag,
70 TEGRA_APB_BASE, TEGRA_APB_SIZE, 0, 76 TEGRA_APB_BASE, TEGRA_APB_SIZE, 0,
71 &tegra_apb_bsh) != 0) 77 &tegra_apb_bsh) != 0)
72 panic("couldn't map APB"); 78 panic("couldn't map APB");
 79 if (bus_space_map(&armv7_generic_bs_tag,
 80 TEGRA_AHB_A2_BASE, TEGRA_AHB_A2_SIZE, 0,
 81 &tegra_ahb_a2_bsh) != 0)
 82 panic("couldn't map AHB A2");
73 83
74 tegra_mpinit(); 84 tegra_mpinit();
75} 85}
76 86
77void 87void
78tegra_dma_bootstrap(psize_t psize) 88tegra_dma_bootstrap(psize_t psize)
79{ 89{
80} 90}
81 91
82void 92void
83tegra_cpuinit(void) 93tegra_cpuinit(void)
84{ 94{
85 switch (tegra_chip_id()) { 95 switch (tegra_chip_id()) {

cvs diff -r1.37 -r1.38 src/sys/arch/evbarm/tegra/Attic/tegra_machdep.c (expand / switch to unified diff)

--- src/sys/arch/evbarm/tegra/Attic/tegra_machdep.c 2015/12/22 22:10:36 1.37
+++ src/sys/arch/evbarm/tegra/Attic/tegra_machdep.c 2016/03/26 09:07:31 1.38
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: tegra_machdep.c,v 1.37 2015/12/22 22:10:36 jmcneill Exp $ */ 1/* $NetBSD: tegra_machdep.c,v 1.38 2016/03/26 09:07:31 skrll Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca> 4 * Copyright (c) 2015 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -17,27 +17,27 @@ @@ -17,27 +17,27 @@
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.37 2015/12/22 22:10:36 jmcneill Exp $"); 30__KERNEL_RCSID(0, "$NetBSD: tegra_machdep.c,v 1.38 2016/03/26 09:07:31 skrll Exp $");
31 31
32#include "opt_tegra.h" 32#include "opt_tegra.h"
33#include "opt_machdep.h" 33#include "opt_machdep.h"
34#include "opt_ddb.h" 34#include "opt_ddb.h"
35#include "opt_md.h" 35#include "opt_md.h"
36#include "opt_arm_debug.h" 36#include "opt_arm_debug.h"
37#include "opt_multiprocessor.h" 37#include "opt_multiprocessor.h"
38 38
39#include "com.h" 39#include "com.h"
40#include "ukbd.h" 40#include "ukbd.h"
41#include "genfb.h" 41#include "genfb.h"
42#include "ether.h" 42#include "ether.h"
43#include "as3722pmic.h" 43#include "as3722pmic.h"
@@ -112,39 +112,53 @@ extern char KERNEL_BASE_phys[]; @@ -112,39 +112,53 @@ extern char KERNEL_BASE_phys[];
112#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys) 112#define KERNEL_BASE_PHYS ((paddr_t)KERNEL_BASE_phys)
113 113
114static void tegra_device_register(device_t, void *); 114static void tegra_device_register(device_t, void *);
115static void tegra_reset(void); 115static void tegra_reset(void);
116static void tegra_powerdown(void); 116static void tegra_powerdown(void);
117 117
118bs_protos(bs_notimpl); 118bs_protos(bs_notimpl);
119 119
120#define _A(a) ((a) & ~L1_S_OFFSET) 120#define _A(a) ((a) & ~L1_S_OFFSET)
121#define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1)) 121#define _S(s) (((s) + L1_S_SIZE - 1) & ~(L1_S_SIZE-1))
122 122
123static const struct pmap_devmap devmap[] = { 123static const struct pmap_devmap devmap[] = {
124 { 124 {
 125 .pd_va = _A(TEGRA_HOST1X_VBASE),
 126 .pd_pa = _A(TEGRA_HOST1X_BASE),
 127 .pd_size = _S(TEGRA_HOST1X_SIZE),
 128 .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
 129 .pd_cache = PTE_NOCACHE
 130 },
 131 {
125 .pd_va = _A(TEGRA_PPSB_VBASE), 132 .pd_va = _A(TEGRA_PPSB_VBASE),
126 .pd_pa = _A(TEGRA_PPSB_BASE), 133 .pd_pa = _A(TEGRA_PPSB_BASE),
127 .pd_size = _S(TEGRA_PPSB_SIZE), 134 .pd_size = _S(TEGRA_PPSB_SIZE),
128 .pd_prot = VM_PROT_READ|VM_PROT_WRITE, 135 .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
129 .pd_cache = PTE_NOCACHE 136 .pd_cache = PTE_NOCACHE
130 }, 137 },
131 { 138 {
132 .pd_va = _A(TEGRA_APB_VBASE), 139 .pd_va = _A(TEGRA_APB_VBASE),
133 .pd_pa = _A(TEGRA_APB_BASE), 140 .pd_pa = _A(TEGRA_APB_BASE),
134 .pd_size = _S(TEGRA_APB_SIZE), 141 .pd_size = _S(TEGRA_APB_SIZE),
135 .pd_prot = VM_PROT_READ|VM_PROT_WRITE, 142 .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
136 .pd_cache = PTE_NOCACHE 143 .pd_cache = PTE_NOCACHE
137 }, 144 },
 145 {
 146 .pd_va = _A(TEGRA_AHB_A2_VBASE),
 147 .pd_pa = _A(TEGRA_AHB_A2_BASE),
 148 .pd_size = _S(TEGRA_AHB_A2_SIZE),
 149 .pd_prot = VM_PROT_READ|VM_PROT_WRITE,
 150 .pd_cache = PTE_NOCACHE
 151 },
138 {0} 152 {0}
139}; 153};
140 154
141#undef _A 155#undef _A
142#undef _S 156#undef _S
143 157
144#ifdef PMAP_NEED_ALLOC_POOLPAGE 158#ifdef PMAP_NEED_ALLOC_POOLPAGE
145static struct boot_physmem bp_lowgig = { 159static struct boot_physmem bp_lowgig = {
146 .bp_start = TEGRA_EXTMEM_BASE / NBPG, 160 .bp_start = TEGRA_EXTMEM_BASE / NBPG,
147 .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG, 161 .bp_pages = (KERNEL_VM_BASE - KERNEL_BASE) / NBPG,
148 .bp_freelist = VM_FREELIST_ISADMA, 162 .bp_freelist = VM_FREELIST_ISADMA,
149 .bp_flags = 0 163 .bp_flags = 0
150}; 164};