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