xref: /titanic_52/usr/src/uts/sun4u/starfire/sys/drmach.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef _SYS_DRMACH_H_
28*7c478bd9Sstevel@tonic-gate #define	_SYS_DRMACH_H_
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
33*7c478bd9Sstevel@tonic-gate #include <sys/memlist.h>
34*7c478bd9Sstevel@tonic-gate #include <sys/processor.h>
35*7c478bd9Sstevel@tonic-gate #include <sys/starfire.h>
36*7c478bd9Sstevel@tonic-gate #include <sys/sbd_ioctl.h>
37*7c478bd9Sstevel@tonic-gate #include <sys/sysevent.h>
38*7c478bd9Sstevel@tonic-gate 
39*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
40*7c478bd9Sstevel@tonic-gate extern "C" {
41*7c478bd9Sstevel@tonic-gate #endif
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #define	MAX_BOARDS		plat_max_boards()
44*7c478bd9Sstevel@tonic-gate #define	MAX_CPU_UNITS_PER_BOARD	plat_max_cpu_units_per_board()
45*7c478bd9Sstevel@tonic-gate #define	MAX_MEM_UNITS_PER_BOARD	plat_max_mem_units_per_board()
46*7c478bd9Sstevel@tonic-gate #define	MAX_IO_UNITS_PER_BOARD	plat_max_io_units_per_board()
47*7c478bd9Sstevel@tonic-gate #define	MAX_CMP_UNITS_PER_BOARD	MAX_CPU_UNITS_PER_BOARD
48*7c478bd9Sstevel@tonic-gate #define	MAX_CORES_PER_CMP	1
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate /* flags for drmach_configure() and drmach_unconfigure() */
51*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVI_FORCE	1
52*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVI_REMOVE	2
53*7c478bd9Sstevel@tonic-gate 
54*7c478bd9Sstevel@tonic-gate /* returned with drmach_board_find_devices callback */
55*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_CPU	"cpu"
56*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_MEM	"memory"
57*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_PCI	"pci"
58*7c478bd9Sstevel@tonic-gate #define	DRMACH_DEVTYPE_SBUS	"sbus"
59*7c478bd9Sstevel@tonic-gate 
60*7c478bd9Sstevel@tonic-gate /* number of bytes in smallest coherency unit of this machine */
61*7c478bd9Sstevel@tonic-gate #define	DRMACH_COHERENCY_UNIT	64
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate typedef void *drmachid_t;
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate typedef struct {
66*7c478bd9Sstevel@tonic-gate 	boolean_t	assigned;
67*7c478bd9Sstevel@tonic-gate 	boolean_t	powered;
68*7c478bd9Sstevel@tonic-gate 	boolean_t	configured;
69*7c478bd9Sstevel@tonic-gate 	boolean_t	busy;
70*7c478bd9Sstevel@tonic-gate 	boolean_t	empty;
71*7c478bd9Sstevel@tonic-gate 	sbd_cond_t	cond;
72*7c478bd9Sstevel@tonic-gate 	char		type[MAXNAMELEN];
73*7c478bd9Sstevel@tonic-gate 	char		info[MAXPATHLEN];	/* TODO: what size? */
74*7c478bd9Sstevel@tonic-gate } drmach_status_t;
75*7c478bd9Sstevel@tonic-gate 
76*7c478bd9Sstevel@tonic-gate typedef struct {
77*7c478bd9Sstevel@tonic-gate 	int	size;
78*7c478bd9Sstevel@tonic-gate 	char	*copts;
79*7c478bd9Sstevel@tonic-gate } drmach_opts_t;
80*7c478bd9Sstevel@tonic-gate 
81*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_copy_rename_init(
82*7c478bd9Sstevel@tonic-gate 				drmachid_t dst_id, uint64_t dst_slice_offset,
83*7c478bd9Sstevel@tonic-gate 				drmachid_t src_id, struct memlist *src_copy_ml,
84*7c478bd9Sstevel@tonic-gate 				drmachid_t *pgm_id);
85*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_copy_rename_fini(drmachid_t id);
86*7c478bd9Sstevel@tonic-gate extern void		 drmach_copy_rename(drmachid_t id);
87*7c478bd9Sstevel@tonic-gate 
88*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_pre_op(int cmd, drmachid_t id,
89*7c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
90*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_post_op(int cmd, drmachid_t id,
91*7c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
92*7c478bd9Sstevel@tonic-gate 
93*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_assign(int bnum, drmachid_t *id);
94*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_connect(drmachid_t id,
95*7c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
96*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_deprobe(drmachid_t id);
97*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_disconnect(drmachid_t id,
98*7c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
99*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_find_devices(drmachid_t id, void *a,
100*7c478bd9Sstevel@tonic-gate 		sbd_error_t *(*found)(void *a, const char *, int, drmachid_t));
101*7c478bd9Sstevel@tonic-gate extern int		drmach_board_lookup(int bnum, drmachid_t *id);
102*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_passthru(drmachid_t id,
103*7c478bd9Sstevel@tonic-gate 						drmach_opts_t *opts);
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_name(int bnum, char *buf, int buflen);
106*7c478bd9Sstevel@tonic-gate 
107*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_poweroff(drmachid_t id);
108*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_poweron(drmachid_t id);
109*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_test(drmachid_t id, drmach_opts_t *opts,
110*7c478bd9Sstevel@tonic-gate 				int force);
111*7c478bd9Sstevel@tonic-gate 
112*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_board_unassign(drmachid_t id);
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_configure(drmachid_t id, int flags);
115*7c478bd9Sstevel@tonic-gate 
116*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_disconnect(drmachid_t id);
117*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_get_id(drmachid_t id, processorid_t *cpuid);
118*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_cpu_get_impl(drmachid_t id, int *ip);
119*7c478bd9Sstevel@tonic-gate extern void		 drmach_cpu_flush_ecache_sync(void);
120*7c478bd9Sstevel@tonic-gate 
121*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_get_dip(drmachid_t id, dev_info_t **dip);
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_is_attached(drmachid_t id, int *yes);
124*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_post_attach(drmachid_t id);
125*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_post_release(drmachid_t id);
126*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_pre_release(drmachid_t id);
127*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_io_unrelease(drmachid_t id);
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_add_span(drmachid_t id,
130*7c478bd9Sstevel@tonic-gate 				uint64_t basepa, uint64_t size);
131*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_del_span(drmachid_t id,
132*7c478bd9Sstevel@tonic-gate 				uint64_t basepa, uint64_t size);
133*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_disable(drmachid_t id);
134*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_enable(drmachid_t id);
135*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_alignment(drmachid_t id, uint64_t *pa);
136*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_base_physaddr(drmachid_t id,
137*7c478bd9Sstevel@tonic-gate 				uint64_t *pa);
138*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_memlist(drmachid_t id,
139*7c478bd9Sstevel@tonic-gate 				struct memlist **ml);
140*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_size(drmachid_t id, uint64_t *bytes);
141*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_mem_get_slice_size(drmachid_t id,
142*7c478bd9Sstevel@tonic-gate 				uint64_t *bytes);
143*7c478bd9Sstevel@tonic-gate extern processorid_t	 drmach_mem_cpu_affinity(drmachid_t id);
144*7c478bd9Sstevel@tonic-gate extern int		 drmach_allow_memrange_modify(drmachid_t id);
145*7c478bd9Sstevel@tonic-gate 
146*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_release(drmachid_t id);
147*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_status(drmachid_t id, drmach_status_t *stat);
148*7c478bd9Sstevel@tonic-gate extern sbd_error_t	*drmach_unconfigure(drmachid_t id, int flags);
149*7c478bd9Sstevel@tonic-gate extern int		drmach_log_sysevent(int board, char *hint, int flag,
150*7c478bd9Sstevel@tonic-gate 					    int verbose);
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate extern int		drmach_verify_sr(dev_info_t *dip, int sflag);
153*7c478bd9Sstevel@tonic-gate extern void		drmach_suspend_last();
154*7c478bd9Sstevel@tonic-gate extern void		drmach_resume_first();
155*7c478bd9Sstevel@tonic-gate 
156*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
157*7c478bd9Sstevel@tonic-gate }
158*7c478bd9Sstevel@tonic-gate #endif
159*7c478bd9Sstevel@tonic-gate 
160*7c478bd9Sstevel@tonic-gate #endif /* _SYS_DRMACH_H_ */
161