summaryrefslogtreecommitdiff
path: root/sys/arch/evbarm/gemini/gemini.h
blob: 7db2e87082fbc173e9a6bfbfc638f1f33c120603 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*	$NetBSD: gemini.h,v 1.8 2008/12/06 05:22:39 cliff Exp $	*/

/*-
 * Copyright (c) 2008 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Matt Thomas <matt@3am-software.com>
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _EVBARM_GEMINI_GEMINI_H
#define _EVBARM_GEMINI_GEMINI_H

/*
 * sanity check opt_gemini.h
 */
#include "opt_gemini.h"
#if !defined(GEMINI)
# error must define GEMINI to use gemini.h
#endif
#if !defined(GEMINI_SINGLE) && !defined(GEMINI_MASTER) && !defined(GEMINI_SLAVE)
# error must define one of GEMINI_SINGLE, GEMINI_MASTER, or GEMINI_SLAVE
#endif
#if defined(GEMINI_SINGLE)
# if defined(GEMINI_MASTER) || defined(GEMINI_SLAVE)
#  error GEMINI_SINGLE can not define either GEMINI_MASTER or GEMINI_SLAVE
# endif
#else
# if defined(GEMINI_MASTER) && defined(GEMINI_SLAVE)
#  error can not define both GEMINI_MASTER and GEMINI_SLAVE
# endif
#endif

#include <machine/vmparam.h>
#include <arm/gemini/gemini_reg.h>


/*
 * Kernel VM space: 192MB at KERNEL_VM_BASE
 */
#define	KERNEL_VM_BASE		((KERNEL_BASE + 0x01000000) & ~(0x400000-1))
#define KERNEL_VM_SIZE		0x0C000000

/*
 * We devmap IO starting at KERNEL_VM_BASE + KERNEL_VM_SIZE
 */
#define	GEMINI_KERNEL_IO_VBASE	(KERNEL_VM_BASE + KERNEL_VM_SIZE)
#define	GEMINI_GLOBAL_VBASE	GEMINI_KERNEL_IO_VBASE
#define	GEMINI_WATCHDOG_VBASE	(GEMINI_GLOBAL_VBASE   + L1_S_SIZE)
#define	GEMINI_UART_VBASE	(GEMINI_WATCHDOG_VBASE + L1_S_SIZE)
#define	GEMINI_LPCHC_VBASE	(GEMINI_UART_VBASE     + L1_S_SIZE)
#define	GEMINI_LPCIO_VBASE	(GEMINI_LPCHC_VBASE    + L1_S_SIZE)
#define	GEMINI_TIMER_VBASE	(GEMINI_LPCIO_VBASE    + L1_S_SIZE)
#define	GEMINI_DRAMC_VBASE	(GEMINI_TIMER_VBASE    + L1_S_SIZE)

/*
 * mapping of physical RAM
 */
#define	GEMINI_RAMDISK_VBASE	(GEMINI_DRAMC_VBASE    + L1_S_SIZE)
#define	GEMINI_RAMDISK_PBASE	0x00800000
#define	GEMINI_RAMDISK_SIZE	0x00300000
#define	GEMINI_RAMDISK_PEND	(GEMINI_RAMDISK_PBASE + GEMINI_RAMDISK_SIZE)

#define	GEMINI_IPMQ_VBASE 					\
	((GEMINI_RAMDISK_VBASE + GEMINI_RAMDISK_SIZE		\
	  + (L1_S_SIZE * 4) - 1) & ~((L1_S_SIZE * 4) - 1))
		/* round up for l2pt alignment */
#ifdef GEMINI_SLAVE
# define	GEMINI_IPMQ_PBASE	(GEMINI_RAMDISK_PEND + (GEMINI_BUSBASE * 1024 * 1024))
#else
# define	GEMINI_IPMQ_PBASE	GEMINI_RAMDISK_PEND
#endif
#if 0
# define	GEMINI_IPMQ_SIZE	(2 * sizeof(ipm_queue_t))
#else
# define	GEMINI_IPMQ_SIZE	(2 * 4096)
#endif
#define	GEMINI_IPMQ_PEND	(GEMINI_IPMQ_PBASE + GEMINI_IPMQ_SIZE)

/*
 * reserve physical RAM, as needed
 *
 * NOTE: the RAM used for the IPM queues is owned by the MASTER
 * so MASTER needs to reserve those pages from VM; the slave does not.
 * Hence, GEMINI_RAM_RESV_PEND is adjusted for the MASTER but not the SLAVE.
 */
#define GEMINI_RAM_RESV_PBASE	0
#define GEMINI_RAM_RESV_PEND	0
#if defined(MEMORY_DISK_DYNAMIC)
# undef  GEMINI_RAM_RESV_PBASE
# undef  GEMINI_RAM_RESV_PEND
# define GEMINI_RAM_RESV_PBASE	GEMINI_RAMDISK_PBASE
# define GEMINI_RAM_RESV_PEND	GEMINI_RAMDISK_PEND
#endif
#if (NGEMINIIPM > 0) && !defined(GEMINI_SLAVE)
# if (NGEMINIIPM > 1)
#  error unexpected NGEMINIIPM > 1
# endif
# if (GEMINI_RAM_RESV_PBASE == 0)
#  undef  GEMINI_RAM_RESV_PBASE
#  define GEMINI_RAM_RESV_PBASE	GEMINI_IPMQ_PBASE
# endif
# undef  GEMINI_RAM_RESV_PEND
# define GEMINI_RAM_RESV_PEND	GEMINI_IPMQ_PEND
#endif

/*
 * to map all of memory, including RAM owned by both core.
 * we start at nice round vbase to simplify conversion
 * from VA to PA and back
 */
#define GEMINI_ALLMEM_PBASE	0
#define GEMINI_ALLMEM_VBASE	0xf0000000
#define GEMINI_ALLMEM_SIZE	128		/* units of MB */


#endif /* _EVBARM_GEMINI_GEMINI_H */