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