xref: /onnv-gate/usr/src/uts/sun4v/sys/lpad.h (revision 1991:f29baf5bf770)
1*1991Sheppo /*
2*1991Sheppo  * CDDL HEADER START
3*1991Sheppo  *
4*1991Sheppo  * The contents of this file are subject to the terms of the
5*1991Sheppo  * Common Development and Distribution License (the "License").
6*1991Sheppo  * You may not use this file except in compliance with the License.
7*1991Sheppo  *
8*1991Sheppo  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*1991Sheppo  * or http://www.opensolaris.org/os/licensing.
10*1991Sheppo  * See the License for the specific language governing permissions
11*1991Sheppo  * and limitations under the License.
12*1991Sheppo  *
13*1991Sheppo  * When distributing Covered Code, include this CDDL HEADER in each
14*1991Sheppo  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*1991Sheppo  * If applicable, add the following below this CDDL HEADER, with the
16*1991Sheppo  * fields enclosed by brackets "[]" replaced with your own identifying
17*1991Sheppo  * information: Portions Copyright [yyyy] [name of copyright owner]
18*1991Sheppo  *
19*1991Sheppo  * CDDL HEADER END
20*1991Sheppo  */
21*1991Sheppo 
22*1991Sheppo /*
23*1991Sheppo  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
24*1991Sheppo  * Use is subject to license terms.
25*1991Sheppo  */
26*1991Sheppo 
27*1991Sheppo #ifndef _LPAD_H
28*1991Sheppo #define	_LPAD_H
29*1991Sheppo 
30*1991Sheppo #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*1991Sheppo 
32*1991Sheppo /*
33*1991Sheppo  * sun4v Landing Pad
34*1991Sheppo  */
35*1991Sheppo 
36*1991Sheppo #ifdef __cplusplus
37*1991Sheppo extern "C" {
38*1991Sheppo #endif
39*1991Sheppo 
40*1991Sheppo #ifndef _ASM
41*1991Sheppo 
42*1991Sheppo #include <sys/pte.h>
43*1991Sheppo 
44*1991Sheppo typedef union {
45*1991Sheppo 	struct {
46*1991Sheppo 		unsigned int	rsvd0:32;
47*1991Sheppo 		unsigned int	rsvd1:29;
48*1991Sheppo 		unsigned int	perm:1;
49*1991Sheppo 		unsigned int	mmuflags:2;
50*1991Sheppo 	} flag_bits;
51*1991Sheppo 	uint64_t	ll;
52*1991Sheppo } lpad_map_flag_t;
53*1991Sheppo 
54*1991Sheppo typedef struct lpad_map {
55*1991Sheppo 	lpad_map_flag_t	flags;
56*1991Sheppo 	uint64_t	va;
57*1991Sheppo 	tte_t		tte;
58*1991Sheppo } lpad_map_t;
59*1991Sheppo 
60*1991Sheppo #define	flag_mmuflags	flags.flag_bits.mmuflags
61*1991Sheppo #define	flag_perm	flags.flag_bits.perm
62*1991Sheppo 
63*1991Sheppo typedef struct lpad_data {
64*1991Sheppo 	uint64_t	magic;		/* magic value for sanity checking */
65*1991Sheppo 	uint64_t	*inuse;		/* clear flag when done with lpad */
66*1991Sheppo 	uint64_t	mmfsa_ra;	/* RA of MMU fault status area */
67*1991Sheppo 	uint64_t	pc;		/* VA of CPU startup function */
68*1991Sheppo 	uint64_t	arg;		/* argument to startup function */
69*1991Sheppo 	uint64_t	nmap;		/* number of mappings */
70*1991Sheppo 	lpad_map_t	map[1];		/* array of mappings */
71*1991Sheppo } lpad_data_t;
72*1991Sheppo 
73*1991Sheppo extern uint64_t *lpad_setup(int cpuid, uint64_t pc, uint64_t arg);
74*1991Sheppo 
75*1991Sheppo #endif /* ! _ASM */
76*1991Sheppo 
77*1991Sheppo /*
78*1991Sheppo  * General landing pad constants
79*1991Sheppo  */
80*1991Sheppo #define	LPAD_TEXT_SIZE		1024
81*1991Sheppo #define	LPAD_DATA_SIZE		1024
82*1991Sheppo #define	LPAD_SIZE		(LPAD_TEXT_SIZE + LPAD_DATA_SIZE)
83*1991Sheppo #define	LPAD_MAGIC_VAL		0x4C502D4D41474943	/* "LP-MAGIC" */
84*1991Sheppo 
85*1991Sheppo /*
86*1991Sheppo  * Masks for the lpad_map_t flag bitfield
87*1991Sheppo  */
88*1991Sheppo #define	FLAG_MMUFLAGS_MASK	0x3
89*1991Sheppo #define	FLAG_LOCK_MASK		0x4
90*1991Sheppo 
91*1991Sheppo #ifdef __cplusplus
92*1991Sheppo }
93*1991Sheppo #endif
94*1991Sheppo 
95*1991Sheppo #endif /* _LPAD_H */
96