types.h revision 1.4
1/* $NetBSD: types.h,v 1.4 2016/01/23 21:22:14 christos Exp $ */
2
3/*-
4 * Copyright (c) 2014 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Matt Thomas of 3am Software Foundry.
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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
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
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
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
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
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifndef	_RISCV_TYPES_H_
33#define _RISCV_TYPES_H_
34
35#include <sys/cdefs.h>
36#include <sys/featuretest.h>
37#include <riscv/int_types.h>
38
39#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
40typedef __UINTPTR_TYPE__	paddr_t;
41typedef __UINTPTR_TYPE__	psize_t;
42typedef __UINTPTR_TYPE__	vaddr_t;
43typedef __UINTPTR_TYPE__	vsize_t;
44#define PRIxPADDR	PRIxPTR
45#define PRIxPSIZE	PRIxPTR
46#define PRIuPSIZE	PRIuPTR
47#define PRIxVADDR	PRIxPTR
48#define PRIxVSIZE	PRIxPTR
49#define PRIuVSIZE	PRIuPTR
50
51#ifdef _LP64			// match <riscv/reg.h>
52#define PRIxREGISTER	PRIx64
53typedef __int64_t register_t;
54typedef __uint64_t uregister_t;
55#else
56#define PRIxREGISTER	PRIx32
57typedef __int32_t register_t;
58typedef __uint32_t uregister_t;
59#endif
60typedef signed int register32_t;
61typedef unsigned int uregister32_t;
62#define PRIxREGISTER32	"x"
63
64typedef unsigned long	pmc_evid_t;
65#define PMC_INVALID_EVID	(-1)
66typedef unsigned long	pmc_ctr_t;
67typedef unsigned short	tlb_asid_t;
68#endif
69
70#if defined(_KERNEL)
71typedef struct label_t {	/* Used by setjmp & longjmp */
72        register_t lb_reg[16];	/* */
73	__uint32_t lb_sr;
74} label_t;
75#endif
76
77typedef	unsigned int	__cpu_simple_lock_nv_t;
78#ifdef _LP64
79typedef __int64_t	__register_t;
80#else
81typedef __int32_t	__register_t;
82#endif
83
84#define __SIMPLELOCK_LOCKED	1
85#define __SIMPLELOCK_UNLOCKED	0
86
87#define __HAVE_FAST_SOFTINTS
88#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS
89#define __HAVE_CPU_COUNTER
90#define __HAVE_SYSCALL_INTERN
91#define __HAVE_CPU_DATA_FIRST
92#define __HAVE___LWP_GETPRIVATE_FAST
93#define __HAVE_COMMON___TLS_GET_ADDR
94#define __HAVE_TLS_VARIANT_I
95#ifdef __LP64
96#define __HAVE_ATOMIC64_OPS
97#define __HAVE_CPU_UAREA_ROUTINES
98#endif
99
100//#define __HAVE_NEW_STYLE_BUS_H
101#define __HAVE_NO_BUS_DMA
102
103//#if defined(_KERNEL)
104//#define __HAVE_RAS
105//#endif
106
107#if defined(_KERNEL) || defined(_KMEMUSER)
108#define PCU_FPU		0
109#define PCU_UNIT_COUNT	1
110#endif
111
112#endif	/* _RISCV_TYPES_H_ */
113