1/*	$NetBSD: types.h,v 1.52 2011/06/12 03:35:44 rmind Exp $	*/
2
3/*-
4 * Copyright (c) 1992, 1993
5 *	The Regents of the University of California.  All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Ralph Campbell.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 *    notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 *    notice, this list of conditions and the following disclaimer in the
17 *    documentation and/or other materials provided with the distribution.
18 * 3. Neither the name of the University nor the names of its contributors
19 *    may be used to endorse or promote products derived from this software
20 *    without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE.
33 *
34 *	@(#)types.h	8.3 (Berkeley) 1/5/94
35 */
36
37#ifndef	_MACHTYPES_H_
38#define	_MACHTYPES_H_
39
40#include <sys/cdefs.h>
41#include <sys/featuretest.h>
42#include <mips/int_types.h>
43
44/*
45 * Note that mips_reg_t is distinct from the register_t defined
46 * in <types.h> to allow these structures to be as hidden from
47 * the rest of the operating system as possible.
48 */
49
50
51/* NB: This should probably be if defined(_KERNEL) */
52#if defined(_NETBSD_SOURCE)
53#if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
54typedef __uint64_t	paddr_t;
55typedef __uint64_t	psize_t;
56#define	PRIxPADDR	PRIx64
57#define	PRIxPSIZE	PRIx64
58#define	PRIdPSIZE	PRId64
59#else
60typedef __uint32_t	paddr_t;
61typedef __uint32_t	psize_t;
62#define	PRIxPADDR	PRIx32
63#define	PRIxPSIZE	PRIx32
64#define	PRIdPSIZE	PRId32
65#endif
66#ifdef _LP64
67typedef __uint64_t	vaddr_t;
68typedef __uint64_t	vsize_t;
69#define	PRIxVADDR	PRIx64
70#define	PRIxVSIZE	PRIx64
71#define	PRIdVSIZE	PRId64
72#else
73typedef __uint32_t	vaddr_t;
74typedef __uint32_t	vsize_t;
75#define	PRIxVADDR	PRIx32
76#define	PRIxVSIZE	PRIx32
77#define	PRIdVSIZE	PRId32
78#endif
79#endif
80
81typedef int		mips_prid_t;
82/* Make sure this is signed; we need pointers to be sign-extended. */
83#if defined(__mips_o64) || defined(__mips_o32)
84typedef	__uint32_t	fpregister_t;
85typedef	__uint32_t	mips_fpreg_t;		/* do not use */
86#else
87typedef	__uint64_t	fpregister_t;
88typedef	__uint64_t	mips_fpreg_t;		/* do not use */
89#endif
90#if defined(__mips_o32)
91typedef __int32_t	register_t;
92typedef __uint32_t	uregister_t;
93typedef __int32_t	mips_reg_t;		/* do not use */
94typedef __uint32_t	mips_ureg_t;		/* do not use */
95#define	PRIxREGISTER	PRIx32
96#define	PRIxUREGISTER	PRIx32
97#else
98typedef __int64_t	register_t;
99typedef __uint64_t	uregister_t;
100typedef __int64_t	mips_reg_t;		/* do not use */
101typedef __uint64_t	mips_ureg_t;		/* do not use */
102typedef __int64_t	register32_t;
103typedef __uint64_t	uregister32_t;
104#define	PRIxREGISTER	PRIx64
105#define	PRIxUREGISTER	PRIx64
106#endif /* __mips_o32 */
107
108#if defined(_KERNEL) || defined(_NETBSD_SOURCE)
109typedef struct label_t {
110	register_t val[14];
111} label_t;
112#define	_L_S0		0
113#define	_L_S1		1
114#define	_L_S2		2
115#define	_L_S3		3
116#define	_L_S4		4
117#define	_L_S5		5
118#define	_L_S6		6
119#define	_L_S7		7
120#define	_L_T8		8
121#define	_L_GP		9
122#define	_L_SP		10
123#define	_L_S8		11
124#define	_L_RA		12
125#define	_L_SR		13
126#endif
127
128#if defined(_KERNEL) || defined(_KMEMUSER)
129#define	PCU_FPU		0
130#define	PCU_DSP		1
131#define	PCU_UNIT_COUNT	2
132#endif
133
134typedef __uint64_t		__cpuset_t;
135#define	__CPUSET_MAXNUMCPU	64
136
137typedef	volatile unsigned int	__cpu_simple_lock_t;
138
139#define	__SIMPLELOCK_LOCKED	1
140#define	__SIMPLELOCK_UNLOCKED	0
141
142#define	__HAVE_FAST_SOFTINTS
143#define	__HAVE_AST_PERPROC
144#define	__HAVE_SYSCALL_INTERN
145#define	__HAVE_PROCESS_XFPREGS
146#define	__HAVE_CPU_LWP_SETPRIVATE
147#define	__HAVE_CPU_DATA_FIRST
148#define	__HAVE_MD_CPU_OFFLINE
149#ifdef MIPS3_PLUS	/* XXX bogus! */
150#define	__HAVE_CPU_COUNTER
151#endif
152#define	__HAVE_CPU_UAREA_ROUTINES
153#define	__HAVE_COMMON___TLS_GET_ADDR
154#define	__HAVE___LWP_GETTCB_FAST
155#define	__HAVE___LWP_SETTCB
156#define	__HAVE_TLS_VARIANT_I
157
158#if !defined(__mips_o32)
159#define	__HAVE_ATOMIC64_OPS
160#endif
161
162#if defined(_KERNEL)
163#define	__HAVE_RAS
164#if defined(_LP64)
165#define	__HAVE_CPU_VMSPACE_EXEC
166#endif
167#endif /* _KERNEL */
168
169#define	__HAVE_MM_MD_DIRECT_MAPPED_PHYS
170#define	__HAVE_MM_MD_KERNACC
171#define	__HAVE_MM_MD_CACHE_ALIASING
172
173#endif	/* _MACHTYPES_H_ */
174