types.h revision 1.16
1/* $NetBSD: types.h,v 1.16 2023/05/07 12:41:48 skrll 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) || defined(_STANDALONE) 40 41/* XLEN is the native base integer ISA width */ 42#define XLEN (sizeof(long) * NBBY) 43 44typedef __uint64_t paddr_t; 45typedef __uint64_t psize_t; 46#define PRIxPADDR PRIx64 47#define PRIxPSIZE PRIx64 48#define PRIuPSIZE PRIu64 49 50typedef __UINTPTR_TYPE__ vaddr_t; 51typedef __UINTPTR_TYPE__ vsize_t; 52#define PRIxVADDR PRIxPTR 53#define PRIxVSIZE PRIxPTR 54#define PRIuVSIZE PRIuPTR 55 56#ifdef _LP64 // match <riscv/reg.h> 57#define PRIxREGISTER PRIx64 58typedef __int64_t register_t; 59typedef __uint64_t uregister_t; 60#else 61#define PRIxREGISTER PRIx32 62typedef __int32_t register_t; 63typedef __uint32_t uregister_t; 64#endif 65typedef signed int register32_t; 66typedef unsigned int uregister32_t; 67#define PRIxREGISTER32 "x" 68 69typedef unsigned int tlb_asid_t; 70#endif 71 72#if defined(_KERNEL) 73typedef struct label_t { /* Used by setjmp & longjmp */ 74 register_t lb_reg[16]; /* */ 75 __uint32_t lb_sr; 76} label_t; 77#endif 78 79typedef unsigned int __cpu_simple_lock_nv_t; 80#ifdef _LP64 81typedef __int64_t __register_t; 82#else 83typedef __int32_t __register_t; 84#endif 85 86#define __SIMPLELOCK_LOCKED 1 87#define __SIMPLELOCK_UNLOCKED 0 88 89#define __HAVE_COMMON___TLS_GET_ADDR 90#define __HAVE_COMPAT_NETBSD32 91#define __HAVE_CPU_COUNTER 92#define __HAVE_CPU_DATA_FIRST 93#define __HAVE_CPU_LWP_SETPRIVATE 94#if 0 95#define __HAVE_FAST_SOFTINTS // Not yet 96#endif 97#define __HAVE_MM_MD_DIRECT_MAPPED_PHYS 98#define __HAVE_NEW_STYLE_BUS_H 99#define __HAVE_SYSCALL_INTERN 100#define __HAVE_TLS_VARIANT_I 101/* XXX temporary */ 102#define __HAVE_UNLOCKED_PMAP 103#define __HAVE___LWP_GETPRIVATE_FAST 104#define __HAVE___LWP_GETTCB_FAST 105#define __HAVE___LWP_SETTCB 106 107#ifdef __LP64 108#define __HAVE_ATOMIC64_OPS 109#define __HAVE_CPU_UAREA_ROUTINES 110#endif 111 112//#if defined(_KERNEL) 113//#define __HAVE_RAS 114//#endif 115 116#if defined(_KERNEL) || defined(_KMEMUSER) 117#define PCU_FPU 0 118#define PCU_UNIT_COUNT 1 119#endif 120 121#endif /* _RISCV_TYPES_H_ */ 122