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