xref: /titanic_41/usr/src/uts/i86pc/sys/machsystm.h (revision 9404882939d18ddd3c94a5bd3da7a0449c195a5d)
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 2007 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _SYS_MACHSYSTM_H
28 #define	_SYS_MACHSYSTM_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 /*
33  * Numerous platform-dependent interfaces that don't seem to belong
34  * in any other header file.
35  *
36  * This file should not be included by code that purports to be
37  * platform-independent.
38  *
39  */
40 
41 #include <sys/machparam.h>
42 #include <sys/varargs.h>
43 #include <sys/thread.h>
44 #include <sys/cpuvar.h>
45 #include <sys/privregs.h>
46 #include <sys/systm.h>
47 #include <sys/traptrace.h>
48 #include <vm/page.h>
49 
50 #ifdef __cplusplus
51 extern "C" {
52 #endif
53 
54 #ifdef _KERNEL
55 
56 extern void mach_cpu_idle(void);
57 extern void mach_cpu_halt(char *);
58 extern int mach_cpu_start(cpu_t *, void *);
59 
60 extern int Cpudelay;
61 extern void setcpudelay(void);
62 
63 extern void send_dirint(int, int);
64 extern void siron(void);
65 
66 extern void return_instr(void);
67 
68 extern int kcpc_hw_load_pcbe(void);
69 extern void kcpc_hw_init(cpu_t *cp);
70 extern void kcpc_hw_fini(cpu_t *cp);
71 extern int kcpc_hw_overflow_intr_installed;
72 
73 struct memconf {
74 	pfn_t	mcf_spfn;	/* begin page frame number */
75 	pfn_t	mcf_epfn;	/* end page frame number */
76 };
77 
78 struct system_hardware {
79 	int		hd_nodes;		/* number of nodes */
80 	int		hd_cpus_per_node; 	/* max cpus in a node */
81 	struct memconf 	hd_mem[MAXNODES];
82 						/*
83 						 * memory layout for each
84 						 * node.
85 						 */
86 };
87 extern struct system_hardware system_hardware;
88 extern void get_system_configuration(void);
89 extern void mmu_init(void);
90 extern int cpuid2nodeid(int);
91 extern void map_kaddr(caddr_t, pfn_t, int, int);
92 
93 extern void memscrub_init(void);
94 extern void trap(struct regs *, caddr_t, processorid_t);
95 
96 extern void do_interrupt(struct regs *, trap_trace_rec_t *);
97 extern void memscrub_disable(void);
98 
99 extern unsigned int microdata;
100 extern int use_mp;
101 
102 extern struct cpu	cpus[];		/* pointer to other cpus */
103 extern struct cpu	*cpu[];		/* pointer to all cpus */
104 
105 extern int mach_cpucontext_init(void);
106 extern void mach_cpucontext_fini(void);
107 extern void *mach_cpucontext_alloc(struct cpu *);
108 extern void mach_cpucontext_free(struct cpu *, void *, int);
109 
110 extern uintptr_t hole_start, hole_end;
111 
112 #define	INVALID_VADDR(a)	\
113 	(((a) >= (caddr_t)hole_start && (a) < (caddr_t)hole_end))
114 
115 /* kpm mapping window */
116 extern size_t   kpm_size;
117 extern uchar_t  kpm_size_shift;
118 extern caddr_t  kpm_vbase;
119 
120 struct memlist;
121 extern void memlist_add(uint64_t, uint64_t, struct memlist *,
122     struct memlist **);
123 extern page_t *page_get_physical(uintptr_t);
124 extern int linear_pc(struct regs *rp, proc_t *p, caddr_t *linearp);
125 extern int dtrace_linear_pc(struct regs *rp, proc_t *p, caddr_t *linearp);
126 
127 #endif /* _KERNEL */
128 
129 #ifdef __cplusplus
130 }
131 #endif
132 
133 #endif	/* _SYS_MACHSYSTM_H */
134