xref: /illumos-gate/usr/src/uts/i86pc/sys/sbd_ioctl.h (revision 2a1fd0ffe121888d44fdec321c25b53dcfaa9118)
1a3114836SGerry Liu /*
2a3114836SGerry Liu  * CDDL HEADER START
3a3114836SGerry Liu  *
4a3114836SGerry Liu  * The contents of this file are subject to the terms of the
5a3114836SGerry Liu  * Common Development and Distribution License (the "License").
6a3114836SGerry Liu  * You may not use this file except in compliance with the License.
7a3114836SGerry Liu  *
8a3114836SGerry Liu  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9a3114836SGerry Liu  * or http://www.opensolaris.org/os/licensing.
10a3114836SGerry Liu  * See the License for the specific language governing permissions
11a3114836SGerry Liu  * and limitations under the License.
12a3114836SGerry Liu  *
13a3114836SGerry Liu  * When distributing Covered Code, include this CDDL HEADER in each
14a3114836SGerry Liu  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15a3114836SGerry Liu  * If applicable, add the following below this CDDL HEADER, with the
16a3114836SGerry Liu  * fields enclosed by brackets "[]" replaced with your own identifying
17a3114836SGerry Liu  * information: Portions Copyright [yyyy] [name of copyright owner]
18a3114836SGerry Liu  *
19a3114836SGerry Liu  * CDDL HEADER END
20a3114836SGerry Liu  */
21a3114836SGerry Liu /*
22a3114836SGerry Liu  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23a3114836SGerry Liu  * Use is subject to license terms.
24a3114836SGerry Liu  */
25a3114836SGerry Liu /*
26a3114836SGerry Liu  * Copyright (c) 2010, Intel Corporation.
27a3114836SGerry Liu  * All rights reserved.
28a3114836SGerry Liu  */
29*2a1fd0ffSPeter Tribble /*
30*2a1fd0ffSPeter Tribble  * Copyright 2019 Peter Tribble.
31*2a1fd0ffSPeter Tribble  */
32a3114836SGerry Liu 
33a3114836SGerry Liu #ifndef	_SBD_IOCTL_H
34a3114836SGerry Liu #define	_SBD_IOCTL_H
35a3114836SGerry Liu 
36a3114836SGerry Liu #ifndef	_ASM
37a3114836SGerry Liu #include <sys/types.h>
38a3114836SGerry Liu #include <sys/obpdefs.h>
39a3114836SGerry Liu #include <sys/processor.h>
40a3114836SGerry Liu #include <sys/param.h>
41a3114836SGerry Liu #endif
42a3114836SGerry Liu 
43a3114836SGerry Liu #ifdef	__cplusplus
44a3114836SGerry Liu extern "C" {
45a3114836SGerry Liu #endif
46a3114836SGerry Liu 
47a3114836SGerry Liu #ifndef	_ASM
48a3114836SGerry Liu typedef enum {
49a3114836SGerry Liu 	SBD_COMP_NONE,
50a3114836SGerry Liu 	SBD_COMP_CPU,
51a3114836SGerry Liu 	SBD_COMP_MEM,
52a3114836SGerry Liu 	SBD_COMP_IO,
53a3114836SGerry Liu 	SBD_COMP_CMP,
54a3114836SGerry Liu 	SBD_COMP_UNKNOWN
55a3114836SGerry Liu } sbd_comp_type_t;
56a3114836SGerry Liu 
57a3114836SGerry Liu typedef enum {
58a3114836SGerry Liu 	SBD_STAT_NONE = 0,
59a3114836SGerry Liu 	SBD_STAT_EMPTY,
60a3114836SGerry Liu 	SBD_STAT_DISCONNECTED,
61a3114836SGerry Liu 	SBD_STAT_CONNECTED,
62a3114836SGerry Liu 	SBD_STAT_UNCONFIGURED,
63a3114836SGerry Liu 	SBD_STAT_CONFIGURED
64a3114836SGerry Liu } sbd_state_t;
65a3114836SGerry Liu 
66a3114836SGerry Liu typedef enum {
67a3114836SGerry Liu 	SBD_COND_UNKNOWN = 0,
68a3114836SGerry Liu 	SBD_COND_OK,
69a3114836SGerry Liu 	SBD_COND_FAILING,
70a3114836SGerry Liu 	SBD_COND_FAILED,
71a3114836SGerry Liu 	SBD_COND_UNUSABLE
72a3114836SGerry Liu } sbd_cond_t;
73a3114836SGerry Liu 
74a3114836SGerry Liu typedef	int	sbd_busy_t;
75a3114836SGerry Liu 
76a3114836SGerry Liu #define	SBD_MAX_UNSAFE		16
77a3114836SGerry Liu #define	SBD_TYPE_LEN		12
78a3114836SGerry Liu #define	SBD_NULL_UNIT		-1
79a3114836SGerry Liu 
80a3114836SGerry Liu typedef struct {
81a3114836SGerry Liu 	sbd_comp_type_t	c_type;
82a3114836SGerry Liu 	int		c_unit;
83a3114836SGerry Liu 	char		c_name[OBP_MAXPROPNAME];
84a3114836SGerry Liu } sbd_comp_id_t;
85a3114836SGerry Liu 
86a3114836SGerry Liu typedef struct {
87a3114836SGerry Liu 	sbd_comp_id_t	c_id;
88a3114836SGerry Liu 	sbd_state_t	c_ostate;
89a3114836SGerry Liu 	sbd_cond_t	c_cond;
90a3114836SGerry Liu 	sbd_busy_t	c_busy;
91a3114836SGerry Liu 	uint_t		c_sflags;
92a3114836SGerry Liu 	time_t		c_time;
93a3114836SGerry Liu } sbd_cm_stat_t;
94a3114836SGerry Liu 
95a3114836SGerry Liu #define	ci_type		c_id.c_type
96a3114836SGerry Liu #define	ci_unit		c_id.c_unit
97a3114836SGerry Liu #define	ci_name		c_id.c_name
98a3114836SGerry Liu 
99a3114836SGerry Liu typedef struct {
100a3114836SGerry Liu 	sbd_cm_stat_t	cs_cm;
101a3114836SGerry Liu 	int		cs_isbootproc;
102a3114836SGerry Liu 	processorid_t	cs_cpuid;
103a3114836SGerry Liu 	int		cs_speed;
104a3114836SGerry Liu 	int		cs_ecache;
105a3114836SGerry Liu } sbd_cpu_stat_t;
106a3114836SGerry Liu 
107a3114836SGerry Liu #define	cs_type		cs_cm.ci_type
108a3114836SGerry Liu #define	cs_unit		cs_cm.ci_unit
109a3114836SGerry Liu #define	cs_name		cs_cm.ci_name
110a3114836SGerry Liu #define	cs_ostate	cs_cm.c_ostate
111a3114836SGerry Liu #define	cs_cond		cs_cm.c_cond
112a3114836SGerry Liu #define	cs_busy		cs_cm.c_busy
113a3114836SGerry Liu #define	cs_suspend	cs_cm.c_sflags
114a3114836SGerry Liu #define	cs_time		cs_cm.c_time
115a3114836SGerry Liu 
116a3114836SGerry Liu typedef struct {
117a3114836SGerry Liu 	sbd_cm_stat_t	ms_cm;
118a3114836SGerry Liu 	int		ms_interleave;
119a3114836SGerry Liu 	pfn_t		ms_basepfn;
120a3114836SGerry Liu 	pgcnt_t		ms_totpages;
121a3114836SGerry Liu 	pgcnt_t		ms_detpages;
122a3114836SGerry Liu 	pgcnt_t		ms_pageslost;
123a3114836SGerry Liu 	pgcnt_t		ms_managed_pages;
124a3114836SGerry Liu 	pgcnt_t		ms_noreloc_pages;
125a3114836SGerry Liu 	pgcnt_t		ms_noreloc_first;
126a3114836SGerry Liu 	pgcnt_t		ms_noreloc_last;
127a3114836SGerry Liu 	int		ms_cage_enabled;
128a3114836SGerry Liu 	int		ms_peer_is_target;	/* else peer is source */
129a3114836SGerry Liu 	char		ms_peer_ap_id[MAXPATHLEN];	/* board's AP name */
130a3114836SGerry Liu } sbd_mem_stat_t;
131a3114836SGerry Liu 
132a3114836SGerry Liu #define	ms_type		ms_cm.ci_type
133a3114836SGerry Liu #define	ms_unit		ms_cm.ci_unit
134a3114836SGerry Liu #define	ms_name		ms_cm.ci_name
135a3114836SGerry Liu #define	ms_ostate	ms_cm.c_ostate
136a3114836SGerry Liu #define	ms_cond		ms_cm.c_cond
137a3114836SGerry Liu #define	ms_busy		ms_cm.c_busy
138a3114836SGerry Liu #define	ms_suspend	ms_cm.c_sflags
139a3114836SGerry Liu #define	ms_time		ms_cm.c_time
140a3114836SGerry Liu 
141a3114836SGerry Liu typedef struct {
142a3114836SGerry Liu 	sbd_cm_stat_t	is_cm;
143a3114836SGerry Liu 	int		is_referenced;
144a3114836SGerry Liu 	int		is_unsafe_count;
145a3114836SGerry Liu 	int		is_unsafe_list[SBD_MAX_UNSAFE];
146a3114836SGerry Liu 	char		is_pathname[MAXPATHLEN];
147a3114836SGerry Liu } sbd_io_stat_t;
148a3114836SGerry Liu 
149a3114836SGerry Liu #define	is_type		is_cm.ci_type
150a3114836SGerry Liu #define	is_unit		is_cm.ci_unit
151a3114836SGerry Liu #define	is_name		is_cm.ci_name
152a3114836SGerry Liu #define	is_ostate	is_cm.c_ostate
153a3114836SGerry Liu #define	is_cond		is_cm.c_cond
154a3114836SGerry Liu #define	is_busy		is_cm.c_busy
155a3114836SGerry Liu #define	is_suspend	is_cm.c_sflags
156a3114836SGerry Liu #define	is_time		is_cm.c_time
157a3114836SGerry Liu 
158a3114836SGerry Liu /* This constant must be the max of the max cores on all platforms */
159a3114836SGerry Liu #define	SBD_MAX_CORES_PER_CMP	64
160a3114836SGerry Liu 
161a3114836SGerry Liu typedef struct {
162a3114836SGerry Liu 	sbd_cm_stat_t	ps_cm;
163a3114836SGerry Liu 	processorid_t	ps_cpuid[SBD_MAX_CORES_PER_CMP];
164a3114836SGerry Liu 	int		ps_ncores;
165a3114836SGerry Liu 	int		ps_speed;
166a3114836SGerry Liu 	int		ps_ecache;
167a3114836SGerry Liu } sbd_cmp_stat_t;
168a3114836SGerry Liu 
169a3114836SGerry Liu #define	ps_type		ps_cm.ci_type
170a3114836SGerry Liu #define	ps_unit		ps_cm.ci_unit
171a3114836SGerry Liu #define	ps_name		ps_cm.ci_name
172a3114836SGerry Liu #define	ps_ostate	ps_cm.c_ostate
173a3114836SGerry Liu #define	ps_cond		ps_cm.c_cond
174a3114836SGerry Liu #define	ps_busy		ps_cm.c_busy
175a3114836SGerry Liu #define	ps_suspend	ps_cm.c_sflags
176a3114836SGerry Liu #define	ps_time		ps_cm.c_time
177a3114836SGerry Liu 
178a3114836SGerry Liu typedef union {
179a3114836SGerry Liu 	sbd_cm_stat_t	d_cm;
180a3114836SGerry Liu 	sbd_cpu_stat_t	d_cpu;
181a3114836SGerry Liu 	sbd_mem_stat_t	d_mem;
182a3114836SGerry Liu 	sbd_io_stat_t	d_io;
183a3114836SGerry Liu 	sbd_cmp_stat_t	d_cmp;
184a3114836SGerry Liu } sbd_dev_stat_t;
185a3114836SGerry Liu 
186a3114836SGerry Liu #define	ds_type		d_cm.ci_type
187a3114836SGerry Liu #define	ds_unit		d_cm.ci_unit
188a3114836SGerry Liu #define	ds_name		d_cm.ci_name
189a3114836SGerry Liu #define	ds_ostate	d_cm.c_ostate
190a3114836SGerry Liu #define	ds_cond		d_cm.c_cond
191a3114836SGerry Liu #define	ds_busy		d_cm.c_busy
192a3114836SGerry Liu #define	ds_suspend	d_cm.c_sflags
193a3114836SGerry Liu #define	ds_time		d_cm.c_time
194a3114836SGerry Liu 
195a3114836SGerry Liu #define	SBD_MAX_INFO	256
196a3114836SGerry Liu 
197a3114836SGerry Liu typedef struct {
198a3114836SGerry Liu 	int		s_board;
199a3114836SGerry Liu 	char		s_type[SBD_TYPE_LEN];
200a3114836SGerry Liu 	char		s_info[SBD_MAX_INFO];
201a3114836SGerry Liu 	sbd_state_t	s_rstate;
202a3114836SGerry Liu 	sbd_state_t	s_ostate;
203a3114836SGerry Liu 	sbd_cond_t	s_cond;
204a3114836SGerry Liu 	sbd_busy_t	s_busy;
205a3114836SGerry Liu 	time_t		s_time;
206a3114836SGerry Liu 	uint_t		s_power:1;
207a3114836SGerry Liu 	uint_t		s_assigned:1;
208a3114836SGerry Liu 	uint_t		s_platopts;
209a3114836SGerry Liu 	int		s_nstat;
210a3114836SGerry Liu 	sbd_dev_stat_t	s_stat[1];
211a3114836SGerry Liu } sbd_stat_t;
212a3114836SGerry Liu 
213a3114836SGerry Liu typedef struct {
214a3114836SGerry Liu 	sbd_comp_id_t	c_id;
215a3114836SGerry Liu 	uint_t		c_flags;
216a3114836SGerry Liu 	int		c_len;
217a3114836SGerry Liu 	caddr_t		c_opts;
218a3114836SGerry Liu } sbd_cm_cmd_t;
219a3114836SGerry Liu 
220a3114836SGerry Liu typedef struct {
221a3114836SGerry Liu 	sbd_cm_cmd_t	g_cm;
222a3114836SGerry Liu 	int		g_ncm;
223a3114836SGerry Liu } sbd_getncm_cmd_t;
224a3114836SGerry Liu 
225a3114836SGerry Liu typedef struct {
226a3114836SGerry Liu 	sbd_cm_cmd_t	s_cm;
227a3114836SGerry Liu 	int		s_nbytes;
228a3114836SGerry Liu 	caddr_t		s_statp;
229a3114836SGerry Liu } sbd_stat_cmd_t;
230a3114836SGerry Liu 
231a3114836SGerry Liu typedef union {
232a3114836SGerry Liu 	sbd_cm_cmd_t		cmd_cm;
233a3114836SGerry Liu 	sbd_getncm_cmd_t	cmd_getncm;
234a3114836SGerry Liu 	sbd_stat_cmd_t		cmd_stat;
235a3114836SGerry Liu } sbd_cmd_t;
236a3114836SGerry Liu 
237a3114836SGerry Liu typedef struct {
238a3114836SGerry Liu 	int		e_code;
239a3114836SGerry Liu 	char		e_rsc[MAXPATHLEN];
240a3114836SGerry Liu } sbd_error_t;
241a3114836SGerry Liu 
242a3114836SGerry Liu typedef struct {
243a3114836SGerry Liu 	sbd_cmd_t	i_cmd;
244a3114836SGerry Liu 	sbd_error_t	i_err;
245a3114836SGerry Liu } sbd_ioctl_arg_t;
246a3114836SGerry Liu 
247a3114836SGerry Liu typedef struct {
248a3114836SGerry Liu 	int		t_base;
249a3114836SGerry Liu 	int		t_bnd;
250a3114836SGerry Liu 	char		**t_text;
251a3114836SGerry Liu } sbd_etab_t;
252a3114836SGerry Liu 
253a3114836SGerry Liu #define	i_flags		i_cmd.cmd_cm.c_flags
254a3114836SGerry Liu #define	i_len		i_cmd.cmd_cm.c_len
255a3114836SGerry Liu #define	i_opts		i_cmd.cmd_cm.c_opts
256a3114836SGerry Liu #define	ic_type		i_cmd.cmd_cm.ci_type
257a3114836SGerry Liu #define	ic_name		i_cmd.cmd_cm.ci_name
258a3114836SGerry Liu #define	ic_unit		i_cmd.cmd_cm.ci_unit
259a3114836SGerry Liu #define	ie_code		i_err.e_code
260a3114836SGerry Liu #define	ie_rsc		i_err.e_rsc
261a3114836SGerry Liu 
262a3114836SGerry Liu #define	_SBD_IOC		(('D' << 16) | ('R' << 8))
263a3114836SGerry Liu 
264a3114836SGerry Liu #define	SBD_CMD_ASSIGN		(_SBD_IOC | 0x01)
265a3114836SGerry Liu #define	SBD_CMD_UNASSIGN	(_SBD_IOC | 0x02)
266a3114836SGerry Liu #define	SBD_CMD_POWERON		(_SBD_IOC | 0x03)
267a3114836SGerry Liu #define	SBD_CMD_POWEROFF	(_SBD_IOC | 0x04)
268a3114836SGerry Liu #define	SBD_CMD_TEST		(_SBD_IOC | 0x05)
269a3114836SGerry Liu #define	SBD_CMD_CONNECT		(_SBD_IOC | 0x06)
270a3114836SGerry Liu #define	SBD_CMD_CONFIGURE	(_SBD_IOC | 0x07)
271a3114836SGerry Liu #define	SBD_CMD_UNCONFIGURE	(_SBD_IOC | 0x08)
272a3114836SGerry Liu #define	SBD_CMD_DISCONNECT	(_SBD_IOC | 0x09)
273a3114836SGerry Liu #define	SBD_CMD_STATUS		(_SBD_IOC | 0x0a)
274a3114836SGerry Liu #define	SBD_CMD_GETNCM		(_SBD_IOC | 0x0b)
275a3114836SGerry Liu #define	SBD_CMD_PASSTHRU	(_SBD_IOC | 0x0c)
276a3114836SGerry Liu 
277a3114836SGerry Liu #define	SBD_CHECK_SUSPEND(cmd, c_sflags) \
278a3114836SGerry Liu 		(((c_sflags) >> (((cmd) & 0xf) - 1)) & 0x01)
279a3114836SGerry Liu 
280a3114836SGerry Liu #define	SBD_SET_SUSPEND(cmd, c_sflags) \
281a3114836SGerry Liu 		((c_sflags) |= (0x01 << (((cmd) & 0xf) - 1)))
282a3114836SGerry Liu 
283a3114836SGerry Liu #define	SBD_CHECK_PLATOPTS(cmd, c_platopts) \
284a3114836SGerry Liu 		(((c_platopts) >> (((cmd) & 0xf) - 1)) & 0x01)
285a3114836SGerry Liu 
286a3114836SGerry Liu #define	SBD_SET_PLATOPTS(cmd, c_platopts) \
287a3114836SGerry Liu 		((c_platopts) &= ~(0x01 << (((cmd) & 0xf) - 1)))
288a3114836SGerry Liu 
289a3114836SGerry Liu #define	SBD_FLAG_FORCE		0x1
290a3114836SGerry Liu #define	SBD_FLAG_ALLCMP		0x2
291a3114836SGerry Liu #define	SBD_FLAG_QUIESCE_OKAY	0x4
292a3114836SGerry Liu 
293a3114836SGerry Liu #if defined(_SYSCALL32)
294a3114836SGerry Liu 
295a3114836SGerry Liu typedef struct {
296a3114836SGerry Liu 	int32_t		c_type;
297a3114836SGerry Liu 	int32_t		c_unit;
298a3114836SGerry Liu 	char		c_name[OBP_MAXPROPNAME];
299a3114836SGerry Liu } sbd_comp_id32_t;
300a3114836SGerry Liu 
301a3114836SGerry Liu typedef struct {
302a3114836SGerry Liu 	sbd_comp_id32_t	c_id;
303a3114836SGerry Liu 	int32_t		c_ostate;
304a3114836SGerry Liu 	int32_t		c_cond;
305a3114836SGerry Liu 	int32_t		c_busy;
306a3114836SGerry Liu 	uint32_t	c_sflags;
307a3114836SGerry Liu 	time32_t	c_time;
308a3114836SGerry Liu } sbd_cm_stat32_t;
309a3114836SGerry Liu 
310a3114836SGerry Liu typedef struct {
311a3114836SGerry Liu 	sbd_cm_stat32_t	cs_cm;
312a3114836SGerry Liu 	int32_t		cs_isbootproc;
313a3114836SGerry Liu 	int32_t		cs_cpuid;
314a3114836SGerry Liu 	int32_t		cs_speed;
315a3114836SGerry Liu 	int32_t		cs_ecache;
316a3114836SGerry Liu } sbd_cpu_stat32_t;
317a3114836SGerry Liu 
318a3114836SGerry Liu typedef struct {
319a3114836SGerry Liu 	sbd_cm_stat32_t	ms_cm;
320a3114836SGerry Liu 	int32_t		ms_interleave;
321a3114836SGerry Liu 	uint32_t	ms_basepfn;
322a3114836SGerry Liu 	uint32_t	ms_totpages;
323a3114836SGerry Liu 	uint32_t	ms_detpages;
324a3114836SGerry Liu 	int32_t		ms_pageslost;
325a3114836SGerry Liu 	uint32_t	ms_managed_pages;
326a3114836SGerry Liu 	uint32_t	ms_noreloc_pages;
327a3114836SGerry Liu 	uint32_t	ms_noreloc_first;
328a3114836SGerry Liu 	uint32_t	ms_noreloc_last;
329a3114836SGerry Liu 	int32_t		ms_cage_enabled;
330a3114836SGerry Liu 	int32_t		ms_peer_is_target;
331a3114836SGerry Liu 	char		ms_peer_ap_id[MAXPATHLEN];
332a3114836SGerry Liu } sbd_mem_stat32_t;
333a3114836SGerry Liu 
334a3114836SGerry Liu typedef struct {
335a3114836SGerry Liu 	sbd_cm_stat32_t	is_cm;
336a3114836SGerry Liu 	int32_t		is_referenced;
337a3114836SGerry Liu 	int32_t		is_unsafe_count;
338a3114836SGerry Liu 	int32_t		is_unsafe_list[SBD_MAX_UNSAFE];
339a3114836SGerry Liu 	char		is_pathname[MAXPATHLEN];
340a3114836SGerry Liu } sbd_io_stat32_t;
341a3114836SGerry Liu 
342a3114836SGerry Liu typedef struct {
343a3114836SGerry Liu 	sbd_cm_stat32_t	ps_cm;
344a3114836SGerry Liu 	int32_t		ps_cpuid[SBD_MAX_CORES_PER_CMP];
345a3114836SGerry Liu 	int32_t		ps_ncores;
346a3114836SGerry Liu 	int32_t		ps_speed;
347a3114836SGerry Liu 	int32_t		ps_ecache;
348a3114836SGerry Liu } sbd_cmp_stat32_t;
349a3114836SGerry Liu 
350a3114836SGerry Liu typedef union {
351a3114836SGerry Liu 	sbd_cm_stat32_t		d_cm;
352a3114836SGerry Liu 	sbd_cpu_stat32_t	d_cpu;
353a3114836SGerry Liu 	sbd_mem_stat32_t	d_mem;
354a3114836SGerry Liu 	sbd_io_stat32_t		d_io;
355a3114836SGerry Liu 	sbd_cmp_stat32_t	d_cmp;
356a3114836SGerry Liu } sbd_dev_stat32_t;
357a3114836SGerry Liu 
358a3114836SGerry Liu typedef struct {
359a3114836SGerry Liu 	int32_t			s_board;
360a3114836SGerry Liu 	char			s_type[SBD_TYPE_LEN];
361a3114836SGerry Liu 	char			s_info[SBD_MAX_INFO];
362a3114836SGerry Liu 	int32_t			s_rstate;
363a3114836SGerry Liu 	int32_t			s_ostate;
364a3114836SGerry Liu 	int32_t			s_cond;
365a3114836SGerry Liu 	int32_t			s_busy;
366a3114836SGerry Liu 	time32_t		s_time;
367a3114836SGerry Liu 	uint32_t		s_power:1;
368a3114836SGerry Liu 	uint32_t		s_assigned:1;
369a3114836SGerry Liu 	uint32_t		s_platopts;
370a3114836SGerry Liu 	int32_t			s_nstat;
371a3114836SGerry Liu 	sbd_dev_stat32_t	s_stat[1];
372a3114836SGerry Liu } sbd_stat32_t;
373a3114836SGerry Liu 
374a3114836SGerry Liu typedef struct {
375a3114836SGerry Liu 	int32_t			e_code;
376a3114836SGerry Liu 	char			e_rsc[MAXPATHLEN];
377a3114836SGerry Liu } sbd_error32_t;
378a3114836SGerry Liu 
379a3114836SGerry Liu typedef struct {
380a3114836SGerry Liu 	sbd_comp_id32_t		c_id;
381a3114836SGerry Liu 	uint32_t		c_flags;
382a3114836SGerry Liu 	int32_t			c_len;
383a3114836SGerry Liu 	caddr32_t		c_opts;
384a3114836SGerry Liu } sbd_cm_cmd32_t;
385a3114836SGerry Liu 
386a3114836SGerry Liu typedef struct {
387a3114836SGerry Liu 	sbd_cm_cmd32_t	g_cm;
388a3114836SGerry Liu 	int32_t		g_ncm;
389a3114836SGerry Liu } sbd_getncm_cmd32_t;
390a3114836SGerry Liu 
391a3114836SGerry Liu typedef struct {
392a3114836SGerry Liu 	sbd_cm_cmd32_t	s_cm;
393a3114836SGerry Liu 	int32_t		s_nbytes;
394a3114836SGerry Liu 	caddr32_t	s_statp;
395a3114836SGerry Liu } sbd_stat_cmd32_t;
396a3114836SGerry Liu 
397a3114836SGerry Liu typedef union {
398a3114836SGerry Liu 	sbd_cm_cmd32_t		cmd_cm;
399a3114836SGerry Liu 	sbd_getncm_cmd32_t	cmd_getncm;
400a3114836SGerry Liu 	sbd_stat_cmd32_t	cmd_stat;
401a3114836SGerry Liu } sbd_cmd32_t;
402a3114836SGerry Liu 
403a3114836SGerry Liu typedef struct {
404a3114836SGerry Liu 	sbd_cmd32_t		i_cmd;
405a3114836SGerry Liu 	sbd_error32_t		i_err;
406a3114836SGerry Liu } sbd_ioctl_arg32_t;
407a3114836SGerry Liu 
408a3114836SGerry Liu typedef struct {
409a3114836SGerry Liu 	int32_t			t_base;
410a3114836SGerry Liu 	int32_t			t_bnd;
411a3114836SGerry Liu 	char			**t_text;
412a3114836SGerry Liu } sbd_etab32_t;
413a3114836SGerry Liu 
414a3114836SGerry Liu #endif	/* _SYSCALL32 */
415a3114836SGerry Liu #endif	/* _ASM */
416a3114836SGerry Liu 
417a3114836SGerry Liu /* Common error codes */
418a3114836SGerry Liu 
419a3114836SGerry Liu #define	ESBD_NOERROR		0	/* no error */
420a3114836SGerry Liu #define	ESBD_INTERNAL		1	/* Internal error */
421a3114836SGerry Liu #define	ESBD_NOMEM		2	/* Insufficient memory */
422a3114836SGerry Liu #define	ESBD_PROTO		3	/* Protocol error */
423a3114836SGerry Liu #define	ESBD_BUSY		4	/* Device busy */
424a3114836SGerry Liu #define	ESBD_NODEV		5	/* No such device */
425a3114836SGerry Liu #define	ESBD_ALREADY		6	/* Operation already in progress */
426a3114836SGerry Liu #define	ESBD_IO			7	/* I/O error */
427a3114836SGerry Liu #define	ESBD_FAULT		8	/* Bad address */
428a3114836SGerry Liu #define	ESBD_EMPTY_BD		9	/* No device(s) on board */
429a3114836SGerry Liu #define	ESBD_INVAL		10	/* Invalid argument */
430a3114836SGerry Liu #define	ESBD_STATE		11	/* Invalid state transition */
431a3114836SGerry Liu #define	ESBD_FATAL_STATE	12	/* Device in fatal state */
432a3114836SGerry Liu #define	ESBD_OUTSTANDING	13	/* Outstanding error */
433a3114836SGerry Liu #define	ESBD_SUSPEND		14	/* Device failed to suspend */
434a3114836SGerry Liu #define	ESBD_RESUME		15	/* Device failed to resume */
435a3114836SGerry Liu #define	ESBD_UTHREAD		16	/* Cannot stop user thread */
436a3114836SGerry Liu #define	ESBD_RTTHREAD		17	/* Cannot quiesce realtime thread */
437a3114836SGerry Liu #define	ESBD_KTHREAD		18	/* Cannot stop kernel thread  */
438a3114836SGerry Liu #define	ESBD_OFFLINE		19	/* Failed to off-line */
439a3114836SGerry Liu #define	ESBD_ONLINE		20	/* Failed to on-line */
440a3114836SGerry Liu #define	ESBD_CPUSTART		21	/* Failed to start CPU */
441a3114836SGerry Liu #define	ESBD_CPUSTOP		22	/* Failed to stop CPU */
442a3114836SGerry Liu #define	ESBD_INVAL_COMP		23	/* Invalid component type */
443a3114836SGerry Liu #define	ESBD_KCAGE_OFF		24	/* Kernel cage is disabled */
444a3114836SGerry Liu #define	ESBD_NO_TARGET		25	/* No available memory target */
445a3114836SGerry Liu #define	ESBD_HW_PROGRAM		26	/* Hardware programming error */
446a3114836SGerry Liu #define	ESBD_MEM_NOTVIABLE	27	/* VM viability test failed */
447a3114836SGerry Liu #define	ESBD_MEM_REFUSED	28	/* Memory operation refused */
448a3114836SGerry Liu #define	ESBD_MEM_NONRELOC	29	/* Non-relocatable pages in span */
449a3114836SGerry Liu #define	ESBD_MEM_CANCELLED	30	/* Memory operation cancelled */
450a3114836SGerry Liu #define	ESBD_MEMFAIL		31	/* Memory operation failed */
451a3114836SGerry Liu #define	ESBD_MEMONLINE		32	/* Can't unconfig cpu if mem online */
452a3114836SGerry Liu #define	ESBD_QUIESCE_REQD	33
453a3114836SGerry Liu 	/* Operator confirmation for quiesce is required */
454a3114836SGerry Liu #define	ESBD_MEMINTLV		34
455a3114836SGerry Liu 	/* Memory is interleaved across boards */
456a3114836SGerry Liu #define	ESBD_CPUONLINE		35
457a3114836SGerry Liu 	/* Can't config memory if not all cpus are online */
458a3114836SGerry Liu #define	ESBD_UNSAFE		36	/* Unsafe driver present */
459a3114836SGerry Liu #define	ESBD_INVAL_OPT		37	/* option invalid */
460a3114836SGerry Liu 
461a3114836SGerry Liu /* Starcat error codes */
462a3114836SGerry Liu 
463a3114836SGerry Liu #define	ESTC_NONE		1000	/* No error */
464a3114836SGerry Liu #define	ESTC_GETPROP		1001	/* Cannot read property value */
465a3114836SGerry Liu #define	ESTC_BNUM		1002	/* Invalid board number */
466a3114836SGerry Liu #define	ESTC_CONFIGBUSY		1003
467a3114836SGerry Liu 	/* Cannot proceed; Board is configured or busy */
468a3114836SGerry Liu #define	ESTC_PROBE		1004	/* Solaris failed to probe */
469a3114836SGerry Liu #define	ESTC_DEPROBE		1005	/* Solaris failed to deprobe */
470a3114836SGerry Liu #define	ESTC_MOVESIGB		1006	/* Firmware move-cpu0 failed */
471a3114836SGerry Liu #define	ESTC_SUPPORT		1007	/* Operation not supported */
472a3114836SGerry Liu #define	ESTC_DRVFAIL		1008	/* Device driver failure */
473a3114836SGerry Liu #define	ESTC_UNKPTCMD		1012	/* Unrecognized platform command */
474a3114836SGerry Liu #define	ESTC_NOTID		1013
475a3114836SGerry Liu 	/* drmach parameter is not a valid ID */
476a3114836SGerry Liu #define	ESTC_INAPPROP		1014
477a3114836SGerry Liu 	/* drmach parameter is inappropriate for operation */
478a3114836SGerry Liu #define	ESTC_INTERNAL		1015	/* Unexpected internal condition */
479a3114836SGerry Liu #define	ESTC_MBXRQST		1016
480a3114836SGerry Liu 	/* Mailbox framework failure: outgoing */
481a3114836SGerry Liu #define	ESTC_MBXRPLY		1017
482a3114836SGerry Liu 	/* Mailbox framework failure: incoming */
483a3114836SGerry Liu #define	ESTC_NOACL		1018	/* Board is not in domain ACL */
484a3114836SGerry Liu #define	ESTC_NOT_ASSIGNED	1019	/* Board is not assigned to domain */
485a3114836SGerry Liu #define	ESTC_NOT_ACTIVE		1020	/* Board is not active */
486a3114836SGerry Liu #define	ESTC_EMPTY_SLOT		1021	/* Slot is empty */
487a3114836SGerry Liu #define	ESTC_POWER_OFF		1022	/* Board is powered off */
488a3114836SGerry Liu #define	ESTC_TEST_IN_PROGRESS	1023	/* Board is already being tested */
489a3114836SGerry Liu #define	ESTC_TESTING_BUSY	1024
490a3114836SGerry Liu 	/* Wait: All SC test resources are in use */
491a3114836SGerry Liu #define	ESTC_TEST_REQUIRED	1025	/* Board requires test prior to use */
492a3114836SGerry Liu #define	ESTC_TEST_ABORTED	1026	/* Board test has been aborted */
493a3114836SGerry Liu #define	ESTC_MBOX_UNKNOWN	1027
494a3114836SGerry Liu 	/* Unknown error type received from SC */
495a3114836SGerry Liu #define	ESTC_TEST_STATUS_UNKNOWN	1028
496a3114836SGerry Liu 	/* Test completed with unknown status */
497a3114836SGerry Liu #define	ESTC_TEST_RESULT_UNKNOWN	1029
498a3114836SGerry Liu 	/* Unknown test result returned by SC */
499a3114836SGerry Liu #define	ESTC_TEST_FAILED	1030
500a3114836SGerry Liu 	/* SMS hpost reported error, see POST log for details */
501a3114836SGerry Liu #define	ESTC_UNAVAILABLE	1031	/* Slot is unavailable to the domain */
502a3114836SGerry Liu #define	ESTC_NZ_LPA		1032	/* Nonzero LPA not yet supported */
503a3114836SGerry Liu #define	ESTC_IOSWITCH		1033
504a3114836SGerry Liu 	/* Cannot unconfigure I/O board: tunnel switch failed */
505a3114836SGerry Liu #define	ESTC_IOCAGE_NO_CPU_AVAIL	1034
506a3114836SGerry Liu 	/* No CPU available for I/O cage test. */
507a3114836SGerry Liu #define	ESTC_SMS_ERR_RECOVERABLE	1035
508a3114836SGerry Liu 	/* SMS reported recoverable error: check SMS status and Retry */
509a3114836SGerry Liu #define	ESTC_SMS_ERR_UNRECOVERABLE	1036
510a3114836SGerry Liu 	/* SMS reported unrecoverable error: Board is Unusable */
511a3114836SGerry Liu #define	ESTC_NWSWITCH		1037
512a3114836SGerry Liu 	/* Cannot unconfigure I/O board: network switch failed */
513a3114836SGerry Liu 
514a3114836SGerry Liu /* Daktari error codes */
515a3114836SGerry Liu 
516a3114836SGerry Liu #define	EDAK_NONE		3000	/* no error */
517a3114836SGerry Liu #define	EDAK_INTERNAL		3001	/* Internal error */
518a3114836SGerry Liu #define	EDAK_NOFRUINFO		3002	/* Didn't receive fru info */
519a3114836SGerry Liu #define	EDAK_NONDR_BOARD	3003
520a3114836SGerry Liu 	/* DR is not supported on this board type */
521a3114836SGerry Liu #define	EDAK_POWERON		3004	/* Power on request failed */
522a3114836SGerry Liu #define	EDAK_POWEROK		3005	/* Failed to power on */
523a3114836SGerry Liu #define	EDAK_INTERRUPTED	3006	/* Operation interrupted */
524a3114836SGerry Liu #define	EDAK_BOARDINIT		3007	/* Board initialization failed */
525a3114836SGerry Liu #define	EDAK_CPUINIT		3008	/* CPU intialization failed */
526a3114836SGerry Liu #define	EDAK_MEMFAIL		3009	/* Memory operation failed */
527a3114836SGerry Liu 
528a3114836SGerry Liu /* Serengeti error codes */
529a3114836SGerry Liu 
530a3114836SGerry Liu #define	ESGT_NONE		4000	/* no error */
531a3114836SGerry Liu #define	ESGT_INTERNAL		4001	/* Internal error */
532a3114836SGerry Liu #define	ESGT_INVAL		4002	/* Invalid argument */
533a3114836SGerry Liu #define	ESGT_MEMFAIL		4003	/* Memory operation failed */
534a3114836SGerry Liu #define	ESGT_PROBE		4004	/* Board probe failed */
535a3114836SGerry Liu #define	ESGT_DEPROBE		4005	/* Board deprobe failed */
536a3114836SGerry Liu #define	ESGT_JUGGLE_BOOTPROC	4006	/* Failed to juggle bootproc */
537a3114836SGerry Liu #define	ESGT_NOT_CPUTYPE	4007	/* Not a cpu device */
538a3114836SGerry Liu #define	ESGT_NO_DEV_TYPE	4008	/* Cannot find device type */
539a3114836SGerry Liu #define	ESGT_BAD_PORTID		4009	/* Bad port id */
540a3114836SGerry Liu #define	ESGT_RESUME		4010	/* Failed to resume device */
541a3114836SGerry Liu #define	ESGT_SUSPEND		4011	/* Failed to suspend device */
542a3114836SGerry Liu #define	ESGT_KTHREAD		4012	/* failed to stop kernel thd */
543a3114836SGerry Liu #define	ESGT_UNSAFE		4013	/* unsafe */
544a3114836SGerry Liu #define	ESGT_RTTHREAD		4014	/* real time threads */
545a3114836SGerry Liu #define	ESGT_UTHREAD		4015	/* failed to stop user thd */
546a3114836SGerry Liu #define	ESGT_PROM_ATTACH	4016	/* prom failed attach board */
547a3114836SGerry Liu #define	ESGT_PROM_DETACH	4017	/* prom failed detach board */
548a3114836SGerry Liu #define	ESGT_SC_ERR		4018	/* sc return a failure */
549a3114836SGerry Liu #define	ESGT_GET_BOARD_STAT	4019	/* Failed to obtain board information */
550a3114836SGerry Liu #define	ESGT_WAKEUPCPU		4020	/* Failed to wake up cpu */
551a3114836SGerry Liu #define	ESGT_STOPCPU		4021	/* Failed to stop cpu */
552a3114836SGerry Liu /* Serengeti SC return codes */
553a3114836SGerry Liu #define	ESGT_HW_FAIL		4022	/* Hardware Failure */
554a3114836SGerry Liu #define	ESGT_BD_ACCESS		4023	/* Board access denied */
555a3114836SGerry Liu #define	ESGT_STALE_CMP		4024	/* Stale components */
556a3114836SGerry Liu #define	ESGT_STALE_OBJ		4025	/* Stale objects */
557a3114836SGerry Liu #define	ESGT_NO_SEPROM_SPACE	4026	/* No SEPROM space */
558a3114836SGerry Liu #define	ESGT_NOT_SUPP		4027	/* Operation not supported */
559a3114836SGerry Liu #define	ESGT_NO_MEM		4028	/* No Memory */
560a3114836SGerry Liu 
561a3114836SGerry Liu /* OPL error codes */
562a3114836SGerry Liu 
563a3114836SGerry Liu #define	EOPL_GETPROP		5001	/* Cannot read property value */
564a3114836SGerry Liu #define	EOPL_BNUM		5002	/* Invalid board number */
565a3114836SGerry Liu #define	EOPL_CONFIGBUSY		5003
566a3114836SGerry Liu 	/* Cannot proceed; Board is configured or busy */
567a3114836SGerry Liu #define	EOPL_PROBE		5004	/* Firmware probe failed */
568a3114836SGerry Liu #define	EOPL_DEPROBE		5005	/* Firmware deprobe failed */
569a3114836SGerry Liu #define	EOPL_SUPPORT		5006	/* Operation not supported */
570a3114836SGerry Liu #define	EOPL_DRVFAIL		5007	/* Device driver failure */
571a3114836SGerry Liu #define	EOPL_UNKPTCMD		5008	/* Unrecognized platform command */
572a3114836SGerry Liu #define	EOPL_NOTID		5009	/* drmach parameter is not a valid ID */
573a3114836SGerry Liu #define	EOPL_INAPPROP		5010
574a3114836SGerry Liu 	/* drmach parameter is inappropriate for operation */
575a3114836SGerry Liu #define	EOPL_INTERNAL		5011	/* Unexpected internal condition */
576a3114836SGerry Liu #define	EOPL_FINDDEVICE		5012	/* Firmware cannot find node. */
577a3114836SGerry Liu #define	EOPL_MC_SETUP		5013	/* Cannot setup memory node */
578a3114836SGerry Liu #define	EOPL_CPU_STATE		5014	/* Invalid CPU/core state */
579a3114836SGerry Liu #define	EOPL_MC_OPL		5015	/* Cannot find mc-opl interface */
580a3114836SGerry Liu #define	EOPL_SCF_FMEM		5016	/* Cannot find scf_fmem interface */
581a3114836SGerry Liu #define	EOPL_FMEM_SETUP		5017	/* Error setting up FMEM buffer */
582a3114836SGerry Liu #define	EOPL_SCF_FMEM_START	5018	/* scf_fmem_start error */
583a3114836SGerry Liu #define	EOPL_FMEM_ERROR		5019	/* FMEM error */
584a3114836SGerry Liu #define	EOPL_SCF_FMEM_CANCEL	5020	/* scf_fmem_cancel error */
585a3114836SGerry Liu #define	EOPL_FMEM_XC_TIMEOUT	5021	/* xcall timeout */
586a3114836SGerry Liu #define	EOPL_FMEM_COPY_TIMEOUT	5022	/* DR parellel copy timeout */
587a3114836SGerry Liu #define	EOPL_FMEM_SCF_BUSY	5023	/* SCF busy */
588a3114836SGerry Liu #define	EOPL_FMEM_RETRY_OUT	5024	/* SCF IO Retry Error */
589a3114836SGerry Liu #define	EOPL_FMEM_TIMEOUT	5025	/* FMEM command timeout */
590a3114836SGerry Liu #define	EOPL_FMEM_HW_ERROR	5026	/* Hardware error */
591a3114836SGerry Liu #define	EOPL_FMEM_TERMINATE	5027	/* FMEM operation Terminated */
592a3114836SGerry Liu #define	EOPL_FMEM_COPY_ERROR	5028	/* Memory copy error */
593a3114836SGerry Liu #define	EOPL_FMEM_SCF_ERR	5029	/* SCF error */
594a3114836SGerry Liu #define	EOPL_MIXED_CPU		5030
595a3114836SGerry Liu 	/* Cannot add SPARC64-VI to domain booted with all SPARC64-VII CPUs */
596a3114836SGerry Liu #define	EOPL_FMEM_SCF_OFFLINE	5031	/* SCF OFFLINE */
597a3114836SGerry Liu 
598a3114836SGerry Liu /* X86 error codes */
599a3114836SGerry Liu 
600a3114836SGerry Liu #define	EX86_GETPROP		10001	/* Cannot read property value */
601a3114836SGerry Liu #define	EX86_BNUM		10002	/* Invalid board number */
602a3114836SGerry Liu #define	EX86_NOTID		10003	/* drmach parameter is not a valid ID */
603a3114836SGerry Liu #define	EX86_INAPPROP		10004
604a3114836SGerry Liu 	/* drmach parameter is inappropriate for operation */
605a3114836SGerry Liu #define	EX86_PROBE		10005	/* Firmware probe failed */
606a3114836SGerry Liu #define	EX86_DEPROBE		10006	/* Firmware deprobe failed */
607a3114836SGerry Liu #define	EX86_SUPPORT		10007	/* Operation not supported */
608a3114836SGerry Liu #define	EX86_INTERNAL		10008	/* Unexpected internal condition */
609a3114836SGerry Liu #define	EX86_CONFIGBUSY		10009
610a3114836SGerry Liu 	/* Cannot proceed, board is configured or busy */
611a3114836SGerry Liu #define	EX86_POWERBUSY		10010	/* Cannot proceed, board is powered */
612a3114836SGerry Liu #define	EX86_CONNECTBUSY	10011	/* Cannot proceed, board is connected */
613a3114836SGerry Liu #define	EX86_INVALID_ARG	10012	/* Invalid argument */
614a3114836SGerry Liu #define	EX86_DRVFAIL		10013	/* Device driver failure */
615a3114836SGerry Liu #define	EX86_UNKPTCMD		10014	/* Unrecognized platform command */
616a3114836SGerry Liu #define	EX86_ALLOC_CPUID	10015	/* Failed to allocate processor id */
617a3114836SGerry Liu #define	EX86_FREE_CPUID		10016	/* Failed to release processor id */
618a3114836SGerry Liu #define	EX86_POWERON		10017	/* Failed to power on board */
619a3114836SGerry Liu #define	EX86_POWEROFF		10018	/* Failed to power off board */
620a3114836SGerry Liu #define	EX86_MC_SETUP		10019	/* Cannot setup memory node */
621a3114836SGerry Liu #define	EX86_ACPIWALK		10020	/* Cannot walk ACPI namespace */
622a3114836SGerry Liu #define	EX86_WALK_DEPENDENCY	10021
623a3114836SGerry Liu 	/* Failed to check dependency for board */
624a3114836SGerry Liu #define	EX86_IN_FAILURE		10022	/* Board is in failure state */
625a3114836SGerry Liu 
626a3114836SGerry Liu #ifdef	__cplusplus
627a3114836SGerry Liu }
628a3114836SGerry Liu #endif
629a3114836SGerry Liu 
630a3114836SGerry Liu #endif	/* _SBD_IOCTL_H */
631