1371853e5SOlivier Houchard /* $NetBSD: sysarch.h,v 1.5 2003/09/11 09:40:12 kleink Exp $ */ 2371853e5SOlivier Houchard 3d8315c79SWarner Losh /*- 4*af3dc4a7SPedro F. Giffuni * SPDX-License-Identifier: BSD-4-Clause 5*af3dc4a7SPedro F. Giffuni * 6371853e5SOlivier Houchard * Copyright (c) 1996-1997 Mark Brinicombe. 7371853e5SOlivier Houchard * All rights reserved. 8371853e5SOlivier Houchard * 9371853e5SOlivier Houchard * Redistribution and use in source and binary forms, with or without 10371853e5SOlivier Houchard * modification, are permitted provided that the following conditions 11371853e5SOlivier Houchard * are met: 12371853e5SOlivier Houchard * 1. Redistributions of source code must retain the above copyright 13371853e5SOlivier Houchard * notice, this list of conditions and the following disclaimer. 14371853e5SOlivier Houchard * 2. Redistributions in binary form must reproduce the above copyright 15371853e5SOlivier Houchard * notice, this list of conditions and the following disclaimer in the 16371853e5SOlivier Houchard * documentation and/or other materials provided with the distribution. 17371853e5SOlivier Houchard * 3. All advertising materials mentioning features or use of this software 18371853e5SOlivier Houchard * must display the following acknowledgement: 19371853e5SOlivier Houchard * This product includes software developed by Mark Brinicombe. 20371853e5SOlivier Houchard * 4. The name of the company nor the name of the author may be used to 21371853e5SOlivier Houchard * endorse or promote products derived from this software without specific 22371853e5SOlivier Houchard * prior written permission. 23371853e5SOlivier Houchard * 24371853e5SOlivier Houchard * THIS SOFTWARE IS PROVIDED BY AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED 25371853e5SOlivier Houchard * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 26371853e5SOlivier Houchard * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 27371853e5SOlivier Houchard * IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 28371853e5SOlivier Houchard * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 29371853e5SOlivier Houchard * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30371853e5SOlivier Houchard * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31371853e5SOlivier Houchard * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32371853e5SOlivier Houchard * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33371853e5SOlivier Houchard * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34371853e5SOlivier Houchard * SUCH DAMAGE. 35371853e5SOlivier Houchard */ 36371853e5SOlivier Houchard 37371853e5SOlivier Houchard /* $FreeBSD$ */ 38371853e5SOlivier Houchard 39371853e5SOlivier Houchard #ifndef _ARM_SYSARCH_H_ 40371853e5SOlivier Houchard #define _ARM_SYSARCH_H_ 41371853e5SOlivier Houchard 42e081d0acSRafal Jaworowski #include <machine/armreg.h> 432aa4a62dSAndrew Turner 44e081d0acSRafal Jaworowski /* 45e081d0acSRafal Jaworowski * The ARM_TP_ADDRESS points to a special purpose page, which is used as local 46e081d0acSRafal Jaworowski * store for the ARM per-thread data and Restartable Atomic Sequences support. 47e081d0acSRafal Jaworowski * Put it just above the "high" vectors' page. 48c435dafbSOlivier Houchard * The cpu_switch() code assumes ARM_RAS_START is ARM_TP_ADDRESS + 4, and 49a43268a7SOlivier Houchard * ARM_RAS_END is ARM_TP_ADDRESS + 8, so if that ever changes, be sure to 50a43268a7SOlivier Houchard * update the cpu_switch() (and cpu_throw()) code as well. 516d51b773SIan Lepore * In addition, code in arm/include/atomic.h and arm/arm/exception.S 52c435dafbSOlivier Houchard * assumes that ARM_RAS_END is at ARM_RAS_START+4, so be sure to update those 53ab3f6b34SGabor Kovesdan * if ARM_RAS_END moves in relation to ARM_RAS_START (look for occurrences 54c435dafbSOlivier Houchard * of ldr/str rm,[rn, #4]). 55e081d0acSRafal Jaworowski */ 56cf1a573fSOleksandr Tymoshenko 57cf1a573fSOleksandr Tymoshenko /* ARM_TP_ADDRESS is needed for processors that don't support 58cf1a573fSOleksandr Tymoshenko * the exclusive-access opcodes introduced with ARMv6K. */ 592aa4a62dSAndrew Turner #if __ARM_ARCH <= 5 60e081d0acSRafal Jaworowski #define ARM_TP_ADDRESS (ARM_VECTORS_HIGH + 0x1000) 61e081d0acSRafal Jaworowski #define ARM_RAS_START (ARM_TP_ADDRESS + 4) 62e081d0acSRafal Jaworowski #define ARM_RAS_END (ARM_TP_ADDRESS + 8) 63cf1a573fSOleksandr Tymoshenko #endif 64e081d0acSRafal Jaworowski 65e081d0acSRafal Jaworowski #ifndef LOCORE 660b898a9eSAndrew Turner #ifndef __ASSEMBLER__ 67e081d0acSRafal Jaworowski 68371853e5SOlivier Houchard #include <sys/cdefs.h> 69371853e5SOlivier Houchard 70371853e5SOlivier Houchard /* 71371853e5SOlivier Houchard * Pickup definition of uintptr_t 72371853e5SOlivier Houchard */ 73371853e5SOlivier Houchard #include <sys/stdint.h> 74371853e5SOlivier Houchard 75371853e5SOlivier Houchard /* 76371853e5SOlivier Houchard * Architecture specific syscalls (arm) 77371853e5SOlivier Houchard */ 78371853e5SOlivier Houchard 79371853e5SOlivier Houchard #define ARM_SYNC_ICACHE 0 80371853e5SOlivier Houchard #define ARM_DRAIN_WRITEBUF 1 81a74985cdSOlivier Houchard #define ARM_SET_TP 2 82a74985cdSOlivier Houchard #define ARM_GET_TP 3 83a86d7982SMichal Meloun #define ARM_GET_VFPSTATE 4 84371853e5SOlivier Houchard 85371853e5SOlivier Houchard struct arm_sync_icache_args { 86371853e5SOlivier Houchard uintptr_t addr; /* Virtual start address */ 87371853e5SOlivier Houchard size_t len; /* Region size */ 88371853e5SOlivier Houchard }; 89371853e5SOlivier Houchard 90a86d7982SMichal Meloun struct arm_get_vfpstate_args { 91a86d7982SMichal Meloun size_t mc_vfp_size; 92a86d7982SMichal Meloun void *mc_vfp; 93a86d7982SMichal Meloun }; 94a86d7982SMichal Meloun 95371853e5SOlivier Houchard #ifndef _KERNEL 96371853e5SOlivier Houchard __BEGIN_DECLS 97371853e5SOlivier Houchard int arm_sync_icache (u_int addr, int len); 98371853e5SOlivier Houchard int arm_drain_writebuf (void); 99a74985cdSOlivier Houchard int sysarch(int, void *); 100371853e5SOlivier Houchard __END_DECLS 101371853e5SOlivier Houchard #endif 102371853e5SOlivier Houchard 1030b898a9eSAndrew Turner #endif /* __ASSEMBLER__ */ 104e081d0acSRafal Jaworowski #endif /* LOCORE */ 105e081d0acSRafal Jaworowski 106371853e5SOlivier Houchard #endif /* !_ARM_SYSARCH_H_ */ 107