1 /*        $NetBSD: types.h,v 1.73 2023/03/20 11:07:33 martin Exp $ */
2 
3 /*
4  * Copyright (c) 1992, 1993
5  *        The Regents of the University of California.  All rights reserved.
6  *
7  * This software was developed by the Computer Systems Engineering group
8  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
9  * contributed to Berkeley.
10  *
11  * All advertising materials mentioning features or use of this software
12  * must display the following acknowledgement:
13  *        This product includes software developed by the University of
14  *        California, Lawrence Berkeley Laboratory.
15  *
16  * Redistribution and use in source and binary forms, with or without
17  * modification, are permitted provided that the following conditions
18  * are met:
19  * 1. Redistributions of source code must retain the above copyright
20  *    notice, this list of conditions and the following disclaimer.
21  * 2. Redistributions in binary form must reproduce the above copyright
22  *    notice, this list of conditions and the following disclaimer in the
23  *    documentation and/or other materials provided with the distribution.
24  * 3. Neither the name of the University nor the names of its contributors
25  *    may be used to endorse or promote products derived from this software
26  *    without specific prior written permission.
27  *
28  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
29  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
30  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
31  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
32  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
37  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
38  * SUCH DAMAGE.
39  *
40  *        @(#)types.h         8.1 (Berkeley) 6/11/93
41  */
42 
43 #ifndef   _MACHTYPES_H_
44 #define   _MACHTYPES_H_
45 
46 #ifdef sun
47 #undef sun
48 #endif
49 
50 #if defined(_KERNEL_OPT)
51 #include "opt_multiprocessor.h"
52 #include "opt_sparc_arch.h"
53 #endif
54 
55 #ifndef _LOCORE
56 
57 #include <sys/cdefs.h>
58 #include <sys/featuretest.h>
59 #include <machine/int_types.h>
60 
61 /* The following are unsigned to prevent annoying sign extended pointers. */
62 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
63 typedef unsigned long int     register_t;
64 #define   PRIxREGISTER                  "lx"
65 typedef unsigned int                    register32_t;
66 #define   PRIxREGISTER32                "x"
67 #ifdef __arch64__
68 typedef unsigned long int     register64_t;
69 #define   PRIxREGISTER64                "lx"
70 #else
71 /* LONGLONG */
72 typedef unsigned long long int          register64_t;
73 #define   PRIxREGISTER64                "llx"
74 #endif
75 #endif
76 
77 #if defined(_KERNEL)
78 typedef struct label_t {
79 #ifdef __sparc_v9__
80           register64_t val[2];
81 #else
82           register_t val[3];
83 #endif
84 } label_t;
85 #endif
86 
87 #if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES) || defined(_STANDALONE)
88 typedef unsigned long int     vaddr_t;
89 typedef vaddr_t                         vsize_t;
90 #define   PRIxVADDR           "lx"
91 #define   PRIxVSIZE           "lx"
92 #define   PRIuVSIZE           "lu"
93 #ifdef __sparc_v9__
94 #ifdef __arch64__
95 typedef unsigned long int     paddr_t;
96 #define   PRIxPADDR           "lx"
97 #define   PRIuPSIZE           "lu"
98 #else
99 /* LONGLONG */
100 typedef unsigned long long int          paddr_t;
101 #define   PRIxPADDR           "llx"
102 #define   PRIuPSIZE           "llu"
103 #endif /* __arch64__ */
104 #else
105 typedef unsigned long int     paddr_t;
106 #define   PRIxPADDR           "lx"
107 #define   PRIuPSIZE           "lu"
108 #endif /* __sparc_v9__ */
109 typedef paddr_t                         psize_t;
110 #define   PRIxPSIZE           PRIxPADDR
111 #endif
112 
113 typedef   unsigned char                 __cpu_simple_lock_nv_t;
114 typedef unsigned long int     __register_t;
115 
116 /* __cpu_simple_lock_t used to be a full word. */
117 #define   __CPU_SIMPLE_LOCK_PAD
118 
119 #define   __SIMPLELOCK_LOCKED 0xff
120 #define   __SIMPLELOCK_UNLOCKED         0
121 
122 #endif /* _LOCORE */
123 
124 #define   __HAVE_NEW_STYLE_BUS_H
125 #define   __HAVE_SYSCALL_INTERN
126 #define   __GENERIC_SOFT_INTERRUPTS_ALL_LEVELS
127 #define   __HAVE_CPU_VMSPACE_EXEC
128 #define   __HAVE_RAS
129 #define   __HAVE_BUS_SPACE_8
130 
131 #ifdef __sparc_v9__
132 #define   __HAVE_CPU_DATA_FIRST
133 #define   __HAVE_DEVICE_REGISTER_POSTCONFIG
134 #define   __HAVE_ATOMIC64_OPS
135 #define   __HAVE_CPU_COUNTER  /* sparc v9 CPUs have %tick */
136 #define   __HAVE_FAST_SOFTINTS
137 #else
138 #define   __HAVE_MM_MD_READWRITE
139 #if !defined(_KERNEL) || defined(MULTIPROCESSOR)
140 #define   __HAVE_HASHLOCKED_ATOMICS
141 #endif
142 #endif
143 
144 #define   __HAVE_CPU_LWP_SETPRIVATE
145 #define   __HAVE___LWP_GETPRIVATE_FAST
146 #define   __HAVE_TLS_VARIANT_II
147 #define   __HAVE_COMMON___TLS_GET_ADDR
148 
149 #endif    /* _MACHTYPES_H_ */
150