17c478bdstevel@tonic-gate/*
27c478bdstevel@tonic-gate * CDDL HEADER START
37c478bdstevel@tonic-gate *
47c478bdstevel@tonic-gate * The contents of this file are subject to the terms of the
525cf1a3jl * Common Development and Distribution License (the "License").
625cf1a3jl * You may not use this file except in compliance with the License.
77c478bdstevel@tonic-gate *
87c478bdstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bdstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bdstevel@tonic-gate * See the License for the specific language governing permissions
117c478bdstevel@tonic-gate * and limitations under the License.
127c478bdstevel@tonic-gate *
137c478bdstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bdstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bdstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bdstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bdstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bdstevel@tonic-gate *
197c478bdstevel@tonic-gate * CDDL HEADER END
207c478bdstevel@tonic-gate */
217c478bdstevel@tonic-gate/*
224fe85d4James Anderson * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
237c478bdstevel@tonic-gate * Use is subject to license terms.
247c478bdstevel@tonic-gate */
252a1fd0fPeter Tribble/*
262a1fd0fPeter Tribble * Copyright 2019 Peter Tribble.
272a1fd0fPeter Tribble */
287c478bdstevel@tonic-gate
297c478bdstevel@tonic-gate#ifndef	_SBD_IOCTL_H
307c478bdstevel@tonic-gate#define	_SBD_IOCTL_H
317c478bdstevel@tonic-gate
32b307f19bm#ifndef	_ASM
337c478bdstevel@tonic-gate#include <sys/types.h>
347c478bdstevel@tonic-gate#include <sys/obpdefs.h>
357c478bdstevel@tonic-gate#include <sys/processor.h>
367c478bdstevel@tonic-gate#include <sys/param.h>
37b307f19bm#endif
387c478bdstevel@tonic-gate
397c478bdstevel@tonic-gate#ifdef	__cplusplus
407c478bdstevel@tonic-gateextern "C" {
417c478bdstevel@tonic-gate#endif
427c478bdstevel@tonic-gate
43b307f19bm#ifndef	_ASM
447c478bdstevel@tonic-gatetypedef enum {
457c478bdstevel@tonic-gate	SBD_COMP_NONE,
467c478bdstevel@tonic-gate	SBD_COMP_CPU,
477c478bdstevel@tonic-gate	SBD_COMP_MEM,
487c478bdstevel@tonic-gate	SBD_COMP_IO,
497c478bdstevel@tonic-gate	SBD_COMP_CMP,
507c478bdstevel@tonic-gate	SBD_COMP_UNKNOWN
517c478bdstevel@tonic-gate} sbd_comp_type_t;
527c478bdstevel@tonic-gate
537c478bdstevel@tonic-gatetypedef enum {
547c478bdstevel@tonic-gate	SBD_STAT_NONE = 0,
557c478bdstevel@tonic-gate	SBD_STAT_EMPTY,
567c478bdstevel@tonic-gate	SBD_STAT_DISCONNECTED,
577c478bdstevel@tonic-gate	SBD_STAT_CONNECTED,
587c478bdstevel@tonic-gate	SBD_STAT_UNCONFIGURED,
597c478bdstevel@tonic-gate	SBD_STAT_CONFIGURED
607c478bdstevel@tonic-gate} sbd_state_t;
617c478bdstevel@tonic-gate
627c478bdstevel@tonic-gatetypedef enum {
637c478bdstevel@tonic-gate	SBD_COND_UNKNOWN = 0,
647c478bdstevel@tonic-gate	SBD_COND_OK,
657c478bdstevel@tonic-gate	SBD_COND_FAILING,
667c478bdstevel@tonic-gate	SBD_COND_FAILED,
677c478bdstevel@tonic-gate	SBD_COND_UNUSABLE
687c478bdstevel@tonic-gate} sbd_cond_t;
697c478bdstevel@tonic-gate
707c478bdstevel@tonic-gatetypedef	int	sbd_busy_t;
717c478bdstevel@tonic-gate
727c478bdstevel@tonic-gate#define	SBD_MAX_UNSAFE		16
737c478bdstevel@tonic-gate#define	SBD_TYPE_LEN		12
747c478bdstevel@tonic-gate#define	SBD_NULL_UNIT		-1
757c478bdstevel@tonic-gate
767c478bdstevel@tonic-gatetypedef struct {
777c478bdstevel@tonic-gate	sbd_comp_type_t	c_type;
787c478bdstevel@tonic-gate	int		c_unit;
797c478bdstevel@tonic-gate	char		c_name[OBP_MAXPROPNAME];
807c478bdstevel@tonic-gate} sbd_comp_id_t;
817c478bdstevel@tonic-gate
827c478bdstevel@tonic-gatetypedef struct {
837c478bdstevel@tonic-gate	sbd_comp_id_t	c_id;
847c478bdstevel@tonic-gate	sbd_state_t	c_ostate;
857c478bdstevel@tonic-gate	sbd_cond_t	c_cond;
867c478bdstevel@tonic-gate	sbd_busy_t	c_busy;
877c478bdstevel@tonic-gate	uint_t		c_sflags;
887c478bdstevel@tonic-gate	time_t		c_time;
897c478bdstevel@tonic-gate} sbd_cm_stat_t;
907c478bdstevel@tonic-gate
917c478bdstevel@tonic-gate#define	ci_type		c_id.c_type
927c478bdstevel@tonic-gate#define	ci_unit		c_id.c_unit
937c478bdstevel@tonic-gate#define	ci_name		c_id.c_name
947c478bdstevel@tonic-gate
957c478bdstevel@tonic-gatetypedef struct {
967c478bdstevel@tonic-gate	sbd_cm_stat_t	cs_cm;
977c478bdstevel@tonic-gate	int		cs_isbootproc;
987c478bdstevel@tonic-gate	processorid_t	cs_cpuid;
997c478bdstevel@tonic-gate	int		cs_speed;
1007c478bdstevel@tonic-gate	int		cs_ecache;
1017c478bdstevel@tonic-gate} sbd_cpu_stat_t;
1027c478bdstevel@tonic-gate
1037c478bdstevel@tonic-gate#define	cs_type		cs_cm.ci_type
1047c478bdstevel@tonic-gate#define	cs_unit		cs_cm.ci_unit
1057c478bdstevel@tonic-gate#define	cs_name		cs_cm.ci_name
1067c478bdstevel@tonic-gate#define	cs_ostate	cs_cm.c_ostate
1077c478bdstevel@tonic-gate#define	cs_cond		cs_cm.c_cond
1087c478bdstevel@tonic-gate#define	cs_busy		cs_cm.c_busy
1097c478bdstevel@tonic-gate#define	cs_suspend	cs_cm.c_sflags
1107c478bdstevel@tonic-gate#define	cs_time		cs_cm.c_time
1117c478bdstevel@tonic-gate
1127c478bdstevel@tonic-gatetypedef struct {
1137c478bdstevel@tonic-gate	sbd_cm_stat_t	ms_cm;
1147c478bdstevel@tonic-gate	int		ms_interleave;
1157c478bdstevel@tonic-gate	pfn_t		ms_basepfn;
1167c478bdstevel@tonic-gate	pgcnt_t		ms_totpages;
1177c478bdstevel@tonic-gate	pgcnt_t		ms_detpages;
1187c478bdstevel@tonic-gate	pgcnt_t		ms_pageslost;
1197c478bdstevel@tonic-gate	pgcnt_t		ms_managed_pages;
1207c478bdstevel@tonic-gate	pgcnt_t		ms_noreloc_pages;
1217c478bdstevel@tonic-gate	pgcnt_t		ms_noreloc_first;
1227c478bdstevel@tonic-gate	pgcnt_t		ms_noreloc_last;
1237c478bdstevel@tonic-gate	int		ms_cage_enabled;
1247c478bdstevel@tonic-gate	int		ms_peer_is_target;	/* else peer is source */
1257c478bdstevel@tonic-gate	char		ms_peer_ap_id[MAXPATHLEN];	/* board's AP name */
1267c478bdstevel@tonic-gate} sbd_mem_stat_t;
1277c478bdstevel@tonic-gate
1287c478bdstevel@tonic-gate#define	ms_type		ms_cm.ci_type
1297c478bdstevel@tonic-gate#define	ms_unit		ms_cm.ci_unit
1307c478bdstevel@tonic-gate#define	ms_name		ms_cm.ci_name
1317c478bdstevel@tonic-gate#define	ms_ostate	ms_cm.c_ostate
1327c478bdstevel@tonic-gate#define	ms_cond		ms_cm.c_cond
1337c478bdstevel@tonic-gate#define	ms_busy		ms_cm.c_busy
1347c478bdstevel@tonic-gate#define	ms_suspend	ms_cm.c_sflags
1357c478bdstevel@tonic-gate#define	ms_time		ms_cm.c_time
1367c478bdstevel@tonic-gate
1377c478bdstevel@tonic-gatetypedef struct {
1387c478bdstevel@tonic-gate	sbd_cm_stat_t	is_cm;
1397c478bdstevel@tonic-gate	int		is_referenced;
1407c478bdstevel@tonic-gate	int		is_unsafe_count;
1417c478bdstevel@tonic-gate	int		is_unsafe_list[SBD_MAX_UNSAFE];
1427c478bdstevel@tonic-gate	char		is_pathname[MAXPATHLEN];
1437c478bdstevel@tonic-gate} sbd_io_stat_t;
1447c478bdstevel@tonic-gate
1457c478bdstevel@tonic-gate#define	is_type		is_cm.ci_type
1467c478bdstevel@tonic-gate#define	is_unit		is_cm.ci_unit
1477c478bdstevel@tonic-gate#define	is_name		is_cm.ci_name
1487c478bdstevel@tonic-gate#define	is_ostate	is_cm.c_ostate
1497c478bdstevel@tonic-gate#define	is_cond		is_cm.c_cond
1507c478bdstevel@tonic-gate#define	is_busy		is_cm.c_busy
1517c478bdstevel@tonic-gate#define	is_suspend	is_cm.c_sflags
1527c478bdstevel@tonic-gate#define	is_time		is_cm.c_time
1537c478bdstevel@tonic-gate
15425cf1a3jl/* This constant must be the max of the max cores on all platforms */
15525cf1a3jl
15625cf1a3jl#define	SBD_MAX_CORES_PER_CMP	8
1577c478bdstevel@tonic-gate
1587c478bdstevel@tonic-gatetypedef struct {
1597c478bdstevel@tonic-gate	sbd_cm_stat_t	ps_cm;
1607c478bdstevel@tonic-gate	processorid_t	ps_cpuid[SBD_MAX_CORES_PER_CMP];
1617c478bdstevel@tonic-gate	int		ps_ncores;
1627c478bdstevel@tonic-gate	int		ps_speed;
1637c478bdstevel@tonic-gate	int		ps_ecache;
1647c478bdstevel@tonic-gate} sbd_cmp_stat_t;
1657c478bdstevel@tonic-gate
1667c478bdstevel@tonic-gate#define	ps_type		ps_cm.ci_type
1677c478bdstevel@tonic-gate#define	ps_unit		ps_cm.ci_unit
1687c478bdstevel@tonic-gate#define	ps_name		ps_cm.ci_name
1697c478bdstevel@tonic-gate#define	ps_ostate	ps_cm.c_ostate
1707c478bdstevel@tonic-gate#define	ps_cond		ps_cm.c_cond
1717c478bdstevel@tonic-gate#define	ps_busy		ps_cm.c_busy
1727c478bdstevel@tonic-gate#define	ps_suspend	ps_cm.c_sflags
1737c478bdstevel@tonic-gate#define	ps_time		ps_cm.c_time
1747c478bdstevel@tonic-gate
1757c478bdstevel@tonic-gatetypedef union {
1767c478bdstevel@tonic-gate	sbd_cm_stat_t	d_cm;
1777c478bdstevel@tonic-gate	sbd_cpu_stat_t	d_cpu;
1787c478bdstevel@tonic-gate	sbd_mem_stat_t	d_mem;
1797c478bdstevel@tonic-gate	sbd_io_stat_t	d_io;
1807c478bdstevel@tonic-gate	sbd_cmp_stat_t	d_cmp;
1817c478bdstevel@tonic-gate} sbd_dev_stat_t;
1827c478bdstevel@tonic-gate
1837c478bdstevel@tonic-gate#define	ds_type		d_cm.ci_type
1847c478bdstevel@tonic-gate#define	ds_unit		d_cm.ci_unit
1857c478bdstevel@tonic-gate#define	ds_name		d_cm.ci_name
1867c478bdstevel@tonic-gate#define	ds_ostate	d_cm.c_ostate
1877c478bdstevel@tonic-gate#define	ds_cond		d_cm.c_cond
1887c478bdstevel@tonic-gate#define	ds_busy		d_cm.c_busy
1897c478bdstevel@tonic-gate#define	ds_suspend	d_cm.c_sflags
1907c478bdstevel@tonic-gate#define	ds_time		d_cm.c_time
1917c478bdstevel@tonic-gate
1927c478bdstevel@tonic-gate#define	SBD_MAX_INFO	64
1937c478bdstevel@tonic-gate
1947c478bdstevel@tonic-gatetypedef struct {
1957c478bdstevel@tonic-gate	int		s_board;
1967c478bdstevel@tonic-gate	char		s_type[SBD_TYPE_LEN];
1977c478bdstevel@tonic-gate	char		s_info[SBD_MAX_INFO];
1987c478bdstevel@tonic-gate	sbd_state_t	s_rstate;
1997c478bdstevel@tonic-gate	sbd_state_t	s_ostate;
2007c478bdstevel@tonic-gate	sbd_cond_t	s_cond;
2017c478bdstevel@tonic-gate	sbd_busy_t	s_busy;
2027c478bdstevel@tonic-gate	time_t		s_time;
2037c478bdstevel@tonic-gate	uint_t		s_power:1;
2047c478bdstevel@tonic-gate	uint_t		s_assigned:1;
2057c478bdstevel@tonic-gate	uint_t		s_platopts;
2067c478bdstevel@tonic-gate	int		s_nstat;
2077c478bdstevel@tonic-gate	sbd_dev_stat_t	s_stat[1];
2087c478bdstevel@tonic-gate} sbd_stat_t;
2097c478bdstevel@tonic-gate
2107c478bdstevel@tonic-gatetypedef struct {
2117c478bdstevel@tonic-gate	sbd_comp_id_t	c_id;
2127c478bdstevel@tonic-gate	uint_t		c_flags;
2137c478bdstevel@tonic-gate	int		c_len;
2147c478bdstevel@tonic-gate	caddr_t		c_opts;
2157c478bdstevel@tonic-gate} sbd_cm_cmd_t;
2167c478bdstevel@tonic-gate
2177c478bdstevel@tonic-gatetypedef struct {
2187c478bdstevel@tonic-gate	sbd_cm_cmd_t	g_cm;
2197c478bdstevel@tonic-gate	int		g_ncm;
2207c478bdstevel@tonic-gate} sbd_getncm_cmd_t;
2217c478bdstevel@tonic-gate
2227c478bdstevel@tonic-gatetypedef struct {
2237c478bdstevel@tonic-gate	sbd_cm_cmd_t	s_cm;
2247c478bdstevel@tonic-gate	int		s_nbytes;
2257c478bdstevel@tonic-gate	caddr_t		s_statp;
2267c478bdstevel@tonic-gate} sbd_stat_cmd_t;
2277c478bdstevel@tonic-gate
2287c478bdstevel@tonic-gatetypedef union {
2297c478bdstevel@tonic-gate	sbd_cm_cmd_t		cmd_cm;
2307c478bdstevel@tonic-gate	sbd_getncm_cmd_t	cmd_getncm;
2317c478bdstevel@tonic-gate	sbd_stat_cmd_t		cmd_stat;
2327c478bdstevel@tonic-gate} sbd_cmd_t;
2337c478bdstevel@tonic-gate
2347c478bdstevel@tonic-gatetypedef struct {
2357c478bdstevel@tonic-gate	int		e_code;
2367c478bdstevel@tonic-gate	char		e_rsc[MAXPATHLEN];
2377c478bdstevel@tonic-gate} sbd_error_t;
2387c478bdstevel@tonic-gate
2397c478bdstevel@tonic-gatetypedef struct {
2407c478bdstevel@tonic-gate	sbd_cmd_t	i_cmd;
2417c478bdstevel@tonic-gate	sbd_error_t	i_err;
2427c478bdstevel@tonic-gate} sbd_ioctl_arg_t;
2437c478bdstevel@tonic-gate
2447c478bdstevel@tonic-gatetypedef struct {
2457c478bdstevel@tonic-gate	int		t_base;
2467c478bdstevel@tonic-gate	int		t_bnd;
2477c478bdstevel@tonic-gate	char		**t_text;
2487c478bdstevel@tonic-gate} sbd_etab_t;
2497c478bdstevel@tonic-gate
2507c478bdstevel@tonic-gate#define	i_flags		i_cmd.cmd_cm.c_flags
2517c478bdstevel@tonic-gate#define	i_len		i_cmd.cmd_cm.c_len
2527c478bdstevel@tonic-gate#define	i_opts		i_cmd.cmd_cm.c_opts
2537c478bdstevel@tonic-gate#define	ic_type		i_cmd.cmd_cm.ci_type
2547c478bdstevel@tonic-gate#define	ic_name		i_cmd.cmd_cm.ci_name
2557c478bdstevel@tonic-gate#define	ic_unit		i_cmd.cmd_cm.ci_unit
2567c478bdstevel@tonic-gate#define	ie_code		i_err.e_code
2577c478bdstevel@tonic-gate#define	ie_rsc		i_err.e_rsc
2587c478bdstevel@tonic-gate
2597c478bdstevel@tonic-gate#define	_SBD_IOC		(('D' << 16) | ('R' << 8))
2607c478bdstevel@tonic-gate
2617c478bdstevel@tonic-gate#define	SBD_CMD_ASSIGN		(_SBD_IOC | 0x01)
2627c478bdstevel@tonic-gate#define	SBD_CMD_UNASSIGN	(_SBD_IOC | 0x02)
2637c478bdstevel@tonic-gate#define	SBD_CMD_POWERON		(_SBD_IOC | 0x03)
2647c478bdstevel@tonic-gate#define	SBD_CMD_POWEROFF	(_SBD_IOC | 0x04)
2657c478bdstevel@tonic-gate#define	SBD_CMD_TEST		(_SBD_IOC | 0x05)
2667c478bdstevel@tonic-gate#define	SBD_CMD_CONNECT		(_SBD_IOC | 0x06)
2677c478bdstevel@tonic-gate#define	SBD_CMD_CONFIGURE	(_SBD_IOC | 0x07)
2687c478bdstevel@tonic-gate#define	SBD_CMD_UNCONFIGURE	(_SBD_IOC | 0x08)
2697c478bdstevel@tonic-gate#define	SBD_CMD_DISCONNECT	(_SBD_IOC | 0x09)
2707c478bdstevel@tonic-gate#define	SBD_CMD_STATUS		(_SBD_IOC | 0x0a)
2717c478bdstevel@tonic-gate#define	SBD_CMD_GETNCM		(_SBD_IOC | 0x0b)
2727c478bdstevel@tonic-gate#define	SBD_CMD_PASSTHRU	(_SBD_IOC | 0x0c)
2737c478bdstevel@tonic-gate
2747c478bdstevel@tonic-gate#define	SBD_CHECK_SUSPEND(cmd, c_sflags) \
2757c478bdstevel@tonic-gate		(((c_sflags) >> (((cmd) & 0xf) - 1)) & 0x01)
2767c478bdstevel@tonic-gate
2777c478bdstevel@tonic-gate#define	SBD_SET_SUSPEND(cmd, c_sflags) \
2787c478bdstevel@tonic-gate		((c_sflags) |= (0x01 << (((cmd) & 0xf) - 1)))
2797c478bdstevel@tonic-gate
2807c478bdstevel@tonic-gate#define	SBD_CHECK_PLATOPTS(cmd, c_platopts) \
2817c478bdstevel@tonic-gate		(((c_platopts) >> (((cmd) & 0xf) - 1)) & 0x01)
2827c478bdstevel@tonic-gate
2837c478bdstevel@tonic-gate#define	SBD_SET_PLATOPTS(cmd, c_platopts) \
2847c478bdstevel@tonic-gate		((c_platopts) &= ~(0x01 << (((cmd) & 0xf) - 1)))
2857c478bdstevel@tonic-gate
2867c478bdstevel@tonic-gate#define	SBD_FLAG_FORCE		0x1
2877c478bdstevel@tonic-gate#define	SBD_FLAG_ALLCMP		0x2
2887c478bdstevel@tonic-gate#define	SBD_FLAG_QUIESCE_OKAY	0x4
2897c478bdstevel@tonic-gate
2907c478bdstevel@tonic-gate#if defined(_SYSCALL32)
2917c478bdstevel@tonic-gate
2927c478bdstevel@tonic-gatetypedef struct {
2937c478bdstevel@tonic-gate	int32_t		c_type;
2947c478bdstevel@tonic-gate	int32_t		c_unit;
2957c478bdstevel@tonic-gate	char		c_name[OBP_MAXPROPNAME];
2967c478bdstevel@tonic-gate} sbd_comp_id32_t;
2977c478bdstevel@tonic-gate
2987c478bdstevel@tonic-gatetypedef struct {
2997c478bdstevel@tonic-gate	sbd_comp_id32_t	c_id;
3007c478bdstevel@tonic-gate	int32_t		c_ostate;
3017c478bdstevel@tonic-gate	int32_t		c_cond;
3027c478bdstevel@tonic-gate	int32_t		c_busy;
3037c478bdstevel@tonic-gate	uint32_t	c_sflags;
3047c478bdstevel@tonic-gate	time32_t	c_time;
3057c478bdstevel@tonic-gate} sbd_cm_stat32_t;
3067c478bdstevel@tonic-gate
3077c478bdstevel@tonic-gatetypedef struct {
3087c478bdstevel@tonic-gate	sbd_cm_stat32_t	cs_cm;
3097c478bdstevel@tonic-gate	int32_t		cs_isbootproc;
3107c478bdstevel@tonic-gate	int32_t		cs_cpuid;
3117c478bdstevel@tonic-gate	int32_t		cs_speed;
3127c478bdstevel@tonic-gate	int32_t		cs_ecache;
3137c478bdstevel@tonic-gate} sbd_cpu_stat32_t;
3147c478bdstevel@tonic-gate
3157c478bdstevel@tonic-gatetypedef struct {
3167c478bdstevel@tonic-gate	sbd_cm_stat32_t	ms_cm;
3177c478bdstevel@tonic-gate	int32_t		ms_interleave;
3187c478bdstevel@tonic-gate	uint32_t	ms_basepfn;
3197c478bdstevel@tonic-gate	uint32_t	ms_totpages;
3207c478bdstevel@tonic-gate	uint32_t	ms_detpages;
3217c478bdstevel@tonic-gate	int32_t		ms_pageslost;
3227c478bdstevel@tonic-gate	uint32_t	ms_managed_pages;
3237c478bdstevel@tonic-gate	uint32_t	ms_noreloc_pages;
3247c478bdstevel@tonic-gate	uint32_t	ms_noreloc_first;
3257c478bdstevel@tonic-gate	uint32_t	ms_noreloc_last;
3267c478bdstevel@tonic-gate	int32_t		ms_cage_enabled;
3277c478bdstevel@tonic-gate	int32_t		ms_peer_is_target;
3287c478bdstevel@tonic-gate	char		ms_peer_ap_id[MAXPATHLEN];
3297c478bdstevel@tonic-gate} sbd_mem_stat32_t;
3307c478bdstevel@tonic-gate
3317c478bdstevel@tonic-gatetypedef struct {
3327c478bdstevel@tonic-gate	sbd_cm_stat32_t	is_cm;
3337c478bdstevel@tonic-gate	int32_t		is_referenced;
3347c478bdstevel@tonic-gate	int32_t		is_unsafe_count;
3357c478bdstevel@tonic-gate	int32_t		is_unsafe_list[SBD_MAX_UNSAFE];
3367c478bdstevel@tonic-gate	char		is_pathname[MAXPATHLEN];
3377c478bdstevel@tonic-gate} sbd_io_stat32_t;
3387c478bdstevel@tonic-gate
3397c478bdstevel@tonic-gatetypedef struct {
3407c478bdstevel@tonic-gate	sbd_cm_stat32_t	ps_cm;
3417c478bdstevel@tonic-gate	int32_t		ps_cpuid[SBD_MAX_CORES_PER_CMP];
3427c478bdstevel@tonic-gate	int32_t		ps_ncores;
3437c478bdstevel@tonic-gate	int32_t		ps_speed;
3447c478bdstevel@tonic-gate	int32_t		ps_ecache;
3457c478bdstevel@tonic-gate} sbd_cmp_stat32_t;
3467c478bdstevel@tonic-gate
3477c478bdstevel@tonic-gatetypedef union {
3487c478bdstevel@tonic-gate	sbd_cm_stat32_t		d_cm;
3497c478bdstevel@tonic-gate	sbd_cpu_stat32_t	d_cpu;
3507c478bdstevel@tonic-gate	sbd_mem_stat32_t	d_mem;
3517c478bdstevel@tonic-gate	sbd_io_stat32_t		d_io;
3527c478bdstevel@tonic-gate	sbd_cmp_stat32_t	d_cmp;
3537c478bdstevel@tonic-gate} sbd_dev_stat32_t;
3547c478bdstevel@tonic-gate
3557c478bdstevel@tonic-gatetypedef struct {
3567c478bdstevel@tonic-gate	int32_t			s_board;
3577c478bdstevel@tonic-gate	char			s_type[SBD_TYPE_LEN];
3587c478bdstevel@tonic-gate	char			s_info[SBD_MAX_INFO];
3597c478bdstevel@tonic-gate	int32_t			s_rstate;
3607c478bdstevel@tonic-gate	int32_t			s_ostate;
3617c478bdstevel@tonic-gate	int32_t			s_cond;
3627c478bdstevel@tonic-gate	int32_t			s_busy;
3637c478bdstevel@tonic-gate	time32_t		s_time;
3647c478bdstevel@tonic-gate	uint32_t		s_power:1;
3657c478bdstevel@tonic-gate	uint32_t		s_assigned:1;
3667c478bdstevel@tonic-gate	uint32_t		s_platopts;
3677c478bdstevel@tonic-gate	int32_t			s_nstat;
3687c478bdstevel@tonic-gate	sbd_dev_stat32_t	s_stat[1];
3697c478bdstevel@tonic-gate} sbd_stat32_t;
3707c478bdstevel@tonic-gate
3717c478bdstevel@tonic-gatetypedef struct {
3727c478bdstevel@tonic-gate	int32_t			e_code;
3737c478bdstevel@tonic-gate	char			e_rsc[MAXPATHLEN];
3747c478bdstevel@tonic-gate} sbd_error32_t;
3757c478bdstevel@tonic-gate
3767c478bdstevel@tonic-gatetypedef struct {
3777c478bdstevel@tonic-gate	sbd_comp_id32_t		c_id;
3787c478bdstevel@tonic-gate	uint32_t		c_flags;
3797c478bdstevel@tonic-gate	int32_t			c_len;
3807c478bdstevel@tonic-gate	caddr32_t		c_opts;
3817c478bdstevel@tonic-gate} sbd_cm_cmd32_t;
3827c478bdstevel@tonic-gate
3837c478bdstevel@tonic-gatetypedef struct {
3847c478bdstevel@tonic-gate	sbd_cm_cmd32_t	g_cm;
3857c478bdstevel@tonic-gate	int32_t		g_ncm;
3867c478bdstevel@tonic-gate} sbd_getncm_cmd32_t;
3877c478bdstevel@tonic-gate
3887c478bdstevel@tonic-gatetypedef struct {
3897c478bdstevel@tonic-gate	sbd_cm_cmd32_t	s_cm;
3907c478bdstevel@tonic-gate	int32_t		s_nbytes;
3917c478bdstevel@tonic-gate	caddr32_t	s_statp;
3927c478bdstevel@tonic-gate} sbd_stat_cmd32_t;
3937c478bdstevel@tonic-gate
3947c478bdstevel@tonic-gatetypedef union {
3957c478bdstevel@tonic-gate	sbd_cm_cmd32_t		cmd_cm;
3967c478bdstevel@tonic-gate	sbd_getncm_cmd32_t	cmd_getncm;
3977c478bdstevel@tonic-gate	sbd_stat_cmd32_t	cmd_stat;
3987c478bdstevel@tonic-gate} sbd_cmd32_t;
3997c478bdstevel@tonic-gate
4007c478bdstevel@tonic-gatetypedef struct {
4017c478bdstevel@tonic-gate	sbd_cmd32_t		i_cmd;
4027c478bdstevel@tonic-gate	sbd_error32_t		i_err;
4037c478bdstevel@tonic-gate} sbd_ioctl_arg32_t;
4047c478bdstevel@tonic-gate
4057c478bdstevel@tonic-gatetypedef struct {
4067c478bdstevel@tonic-gate	int32_t			t_base;
4077c478bdstevel@tonic-gate	int32_t			t_bnd;
4087c478bdstevel@tonic-gate	char			**t_text;
4097c478bdstevel@tonic-gate} sbd_etab32_t;
4107c478bdstevel@tonic-gate
4117c478bdstevel@tonic-gate#endif	/* _SYSCALL32 */
412b307f19bm#endif	/* _ASM */
4137c478bdstevel@tonic-gate
4147c478bdstevel@tonic-gate/* Common error codes */
4157c478bdstevel@tonic-gate
4167c478bdstevel@tonic-gate#define	ESBD_NOERROR		0	/* no error */
4177c478bdstevel@tonic-gate#define	ESBD_INTERNAL		1	/* Internal error */
4187c478bdstevel@tonic-gate#define	ESBD_NOMEM		2	/* Insufficient memory */
4197c478bdstevel@tonic-gate#define	ESBD_PROTO		3	/* Protocol error */
4207c478bdstevel@tonic-gate#define	ESBD_BUSY		4	/* Device busy */
4217c478bdstevel@tonic-gate#define	ESBD_NODEV		5	/* No such device */
4227c478bdstevel@tonic-gate#define	ESBD_ALREADY		6	/* Operation already in progress */
4237c478bdstevel@tonic-gate#define	ESBD_IO			7	/* I/O error */
4247c478bdstevel@tonic-gate#define	ESBD_FAULT		8	/* Bad address */
4257c478bdstevel@tonic-gate#define	ESBD_EMPTY_BD		9	/* No device(s) on board */
4267c478bdstevel@tonic-gate#define	ESBD_INVAL		10	/* Invalid argument */
4277c478bdstevel@tonic-gate#define	ESBD_STATE		11	/* Invalid state transition */
4287c478bdstevel@tonic-gate#define	ESBD_FATAL_STATE	12	/* Device in fatal state */
4297c478bdstevel@tonic-gate#define	ESBD_OUTSTANDING	13	/* Outstanding error */
4307c478bdstevel@tonic-gate#define	ESBD_SUSPEND		14	/* Device failed to suspend */
4317c478bdstevel@tonic-gate#define	ESBD_RESUME		15	/* Device failed to resume */
4327c478bdstevel@tonic-gate#define	ESBD_UTHREAD		16	/* Cannot stop user thread */
4337c478bdstevel@tonic-gate#define	ESBD_RTTHREAD		17	/* Cannot quiesce realtime thread */
4347c478bdstevel@tonic-gate#define	ESBD_KTHREAD		18	/* Cannot stop kernel thread  */
4357c478bdstevel@tonic-gate#define	ESBD_OFFLINE		19	/* Failed to off-line */
4367c478bdstevel@tonic-gate#define	ESBD_ONLINE		20	/* Failed to on-line */
4377c478bdstevel@tonic-gate#define	ESBD_CPUSTART		21	/* Failed to start CPU */
4387c478bdstevel@tonic-gate#define	ESBD_CPUSTOP		22	/* Failed to stop CPU */
4397c478bdstevel@tonic-gate#define	ESBD_INVAL_COMP		23	/* Invalid component type */
4407c478bdstevel@tonic-gate#define	ESBD_KCAGE_OFF		24	/* Kernel cage is disabled */
4417c478bdstevel@tonic-gate#define	ESBD_NO_TARGET		25	/* No available memory target */
4427c478bdstevel@tonic-gate#define	ESBD_HW_PROGRAM		26	/* Hardware programming error */
4437c478bdstevel@tonic-gate#define	ESBD_MEM_NOTVIABLE	27	/* VM viability test failed */
4447c478bdstevel@tonic-gate#define	ESBD_MEM_REFUSED	28	/* Memory operation refused */
4457c478bdstevel@tonic-gate#define	ESBD_MEM_NONRELOC	29	/* Non-relocatable pages in span */
4467c478bdstevel@tonic-gate#define	ESBD_MEM_CANCELLED	30	/* Memory operation cancelled */
4477c478bdstevel@tonic-gate#define	ESBD_MEMFAIL		31	/* Memory operation failed */
4487c478bdstevel@tonic-gate#define	ESBD_MEMONLINE		32	/* Can't unconfig cpu if mem online */
4497c478bdstevel@tonic-gate#define	ESBD_QUIESCE_REQD	33
4507c478bdstevel@tonic-gate	/* Operator confirmation for quiesce is required */
4517c478bdstevel@tonic-gate#define	ESBD_MEMINTLV		34
4527c478bdstevel@tonic-gate	/* Memory is interleaved across boards */
4537c478bdstevel@tonic-gate#define	ESBD_CPUONLINE		35
4547c478bdstevel@tonic-gate	/* Can't config memory if not all cpus are online */
4557c478bdstevel@tonic-gate#define	ESBD_UNSAFE		36	/* Unsafe driver present */
4567c478bdstevel@tonic-gate#define	ESBD_INVAL_OPT		37	/* option invalid */
4577c478bdstevel@tonic-gate
4587c478bdstevel@tonic-gate/* Starcat error codes */
4597c478bdstevel@tonic-gate
4607c478bdstevel@tonic-gate#define	ESTC_NONE		1000	/* No error */
4617c478bdstevel@tonic-gate#define	ESTC_GETPROP		1001	/* Cannot read property value */
4627c478bdstevel@tonic-gate#define	ESTC_BNUM		1002	/* Invalid board number */
4637c478bdstevel@tonic-gate#define	ESTC_CONFIGBUSY		1003
4647c478bdstevel@tonic-gate	/* Cannot proceed; Board is configured or busy */
4657c478bdstevel@tonic-gate#define	ESTC_PROBE		1004	/* Solaris failed to probe */
4667c478bdstevel@tonic-gate#define	ESTC_DEPROBE		1005	/* Solaris failed to deprobe */
4677c478bdstevel@tonic-gate#define	ESTC_MOVESIGB		1006	/* Firmware move-cpu0 failed */
4687c478bdstevel@tonic-gate#define	ESTC_SUPPORT		1007	/* Operation not supported */
4697c478bdstevel@tonic-gate#define	ESTC_DRVFAIL		1008	/* Device driver failure */
4707c478bdstevel@tonic-gate#define	ESTC_UNKPTCMD		1012	/* Unrecognized platform command */
4717c478bdstevel@tonic-gate#define	ESTC_NOTID		1013
4727c478bdstevel@tonic-gate	/* drmach parameter is not a valid ID */
4737c478bdstevel@tonic-gate#define	ESTC_INAPPROP		1014
4747c478bdstevel@tonic-gate	/* drmach parameter is inappropriate for operation */
4757c478bdstevel@tonic-gate#define	ESTC_INTERNAL		1015	/* Unexpected internal condition */
4767c478bdstevel@tonic-gate#define	ESTC_MBXRQST		1016
4777c478bdstevel@tonic-gate	/* Mailbox framework failure: outgoing */
4787c478bdstevel@tonic-gate#define	ESTC_MBXRPLY		1017
4797c478bdstevel@tonic-gate	/* Mailbox framework failure: incoming */
4807c478bdstevel@tonic-gate#define	ESTC_NOACL		1018	/* Board is not in domain ACL */
4817c478bdstevel@tonic-gate#define	ESTC_NOT_ASSIGNED	1019	/* Board is not assigned to domain */
4827c478bdstevel@tonic-gate#define	ESTC_NOT_ACTIVE		1020	/* Board is not active */
4837c478bdstevel@tonic-gate#define	ESTC_EMPTY_SLOT		1021	/* Slot is empty */
4847c478bdstevel@tonic-gate#define	ESTC_POWER_OFF		1022	/* Board is powered off */
4857c478bdstevel@tonic-gate#define	ESTC_TEST_IN_PROGRESS	1023	/* Board is already being tested */
4867c478bdstevel@tonic-gate#define	ESTC_TESTING_BUSY	1024
4877c478bdstevel@tonic-gate	/* Wait: All SC test resources are in use */
4887c478bdstevel@tonic-gate#define	ESTC_TEST_REQUIRED	1025	/* Board requires test prior to use */
4897c478bdstevel@tonic-gate#define	ESTC_TEST_ABORTED	1026	/* Board test has been aborted */
4907c478bdstevel@tonic-gate#define	ESTC_MBOX_UNKNOWN	1027
4917c478bdstevel@tonic-gate	/* Unknown error type received from SC */
4927c478bdstevel@tonic-gate#define	ESTC_TEST_STATUS_UNKNOWN	1028
4937c478bdstevel@tonic-gate	/* Test completed with unknown status */
4947c478bdstevel@tonic-gate#define	ESTC_TEST_RESULT_UNKNOWN	1029
4957c478bdstevel@tonic-gate	/* Unknown test result returned by SC */
4967c478bdstevel@tonic-gate#define	ESTC_TEST_FAILED	1030
4977c478bdstevel@tonic-gate	/* SMS hpost reported error, see POST log for details */
4987c478bdstevel@tonic-gate#define	ESTC_UNAVAILABLE	1031	/* Slot is unavailable to the domain */
4997c478bdstevel@tonic-gate#define	ESTC_NZ_LPA		1032	/* Nonzero LPA not yet supported */
5007c478bdstevel@tonic-gate#define	ESTC_IOSWITCH		1033
5017c478bdstevel@tonic-gate	/* Cannot unconfigure I/O board: tunnel switch failed */
5027c478bdstevel@tonic-gate#define	ESTC_IOCAGE_NO_CPU_AVAIL	1034
5037c478bdstevel@tonic-gate	/* No CPU available for I/O cage test. */
5047c478bdstevel@tonic-gate#define	ESTC_SMS_ERR_RECOVERABLE	1035
5057c478bdstevel@tonic-gate	/* SMS reported recoverable error: check SMS status and Retry */
5067c478bdstevel@tonic-gate#define	ESTC_SMS_ERR_UNRECOVERABLE	1036
5077c478bdstevel@tonic-gate	/* SMS reported unrecoverable error: Board is Unusable */
5087c478bdstevel@tonic-gate#define	ESTC_NWSWITCH		1037
5097c478bdstevel@tonic-gate	/* Cannot unconfigure I/O board: network switch failed */
5107c478bdstevel@tonic-gate
5117c478bdstevel@tonic-gate/* Daktari error codes */
5127c478bdstevel@tonic-gate
5137c478bdstevel@tonic-gate#define	EDAK_NONE		3000	/* no error */
5147c478bdstevel@tonic-gate#define	EDAK_INTERNAL		3001	/* Internal error */
5157c478bdstevel@tonic-gate#define	EDAK_NOFRUINFO		3002	/* Didn't receive fru info */
5167c478bdstevel@tonic-gate#define	EDAK_NONDR_BOARD	3003
5177c478bdstevel@tonic-gate	/* DR is not supported on this board type */
5187c478bdstevel@tonic-gate#define	EDAK_POWERON		3004	/* Power on request failed */
5197c478bdstevel@tonic-gate#define	EDAK_POWEROK		3005	/* Failed to power on */
5207c478bdstevel@tonic-gate#define	EDAK_INTERRUPTED	3006	/* Operation interrupted */
5217c478bdstevel@tonic-gate#define	EDAK_BOARDINIT		3007	/* Board initialization failed */
5227c478bdstevel@tonic-gate#define	EDAK_CPUINIT		3008	/* CPU intialization failed */
5237c478bdstevel@tonic-gate#define	EDAK_MEMFAIL		3009	/* Memory operation failed */
5247c478bdstevel@tonic-gate
5257c478bdstevel@tonic-gate/* Serengeti error codes */
5267c478bdstevel@tonic-gate
5277c478bdstevel@tonic-gate#define	ESGT_NONE		4000	/* no error */
5287c478bdstevel@tonic-gate#define	ESGT_INTERNAL		4001	/* Internal error */
5297c478bdstevel@tonic-gate#define	ESGT_INVAL		4002	/* Invalid argument */
5307c478bdstevel@tonic-gate#define	ESGT_MEMFAIL		4003	/* Memory operation failed */
5317c478bdstevel@tonic-gate#define	ESGT_PROBE		4004	/* Board probe failed */
5327c478bdstevel@tonic-gate#define	ESGT_DEPROBE		4005	/* Board deprobe failed */
5337c478bdstevel@tonic-gate#define	ESGT_JUGGLE_BOOTPROC	4006	/* Failed to juggle bootproc */
5347c478bdstevel@tonic-gate#define	ESGT_NOT_CPUTYPE	4007	/* Not a cpu device */
5357c478bdstevel@tonic-gate#define	ESGT_NO_DEV_TYPE	4008	/* Cannot find device type */
5367c478bdstevel@tonic-gate#define	ESGT_BAD_PORTID		4009	/* Bad port id */
5377c478bdstevel@tonic-gate#define	ESGT_RESUME		4010	/* Failed to resume device */
5387c478bdstevel@tonic-gate#define	ESGT_SUSPEND		4011	/* Failed to suspend device */
5397c478bdstevel@tonic-gate#define	ESGT_KTHREAD		4012	/* failed to stop kernel thd */
5407c478bdstevel@tonic-gate#define	ESGT_UNSAFE		4013	/* unsafe */
5417c478bdstevel@tonic-gate#define	ESGT_RTTHREAD		4014	/* real time threads */
5427c478bdstevel@tonic-gate#define	ESGT_UTHREAD		4015	/* failed to stop user thd */
5437c478bdstevel@tonic-gate#define	ESGT_PROM_ATTACH	4016	/* prom failed attach board */
5447c478bdstevel@tonic-gate#define	ESGT_PROM_DETACH	4017	/* prom failed detach board */
5457c478bdstevel@tonic-gate#define	ESGT_SC_ERR		4018	/* sc return a failure */
5467c478bdstevel@tonic-gate#define	ESGT_GET_BOARD_STAT	4019	/* Failed to obtain board information */
5477c478bdstevel@tonic-gate#define	ESGT_WAKEUPCPU		4020	/* Failed to wake up cpu */
5487c478bdstevel@tonic-gate#define	ESGT_STOPCPU		4021	/* Failed to stop cpu */
5497c478bdstevel@tonic-gate/* Serengeti SC return codes */
5507c478bdstevel@tonic-gate#define	ESGT_HW_FAIL		4022	/* Hardware Failure */
5517c478bdstevel@tonic-gate#define	ESGT_BD_ACCESS		4023	/* Board access denied */
5527c478bdstevel@tonic-gate#define	ESGT_STALE_CMP		4024	/* Stale components */
5537c478bdstevel@tonic-gate#define	ESGT_STALE_OBJ		4025	/* Stale objects */
5547c478bdstevel@tonic-gate#define	ESGT_NO_SEPROM_SPACE	4026	/* No SEPROM space */
5557c478bdstevel@tonic-gate#define	ESGT_NOT_SUPP		4027	/* Operation not supported */
5567c478bdstevel@tonic-gate#define	ESGT_NO_MEM		4028	/* No Memory */
5577c478bdstevel@tonic-gate
558e98fafbjl/* OPL error codes */
55925cf1a3jl
56025cf1a3jl#define	EOPL_GETPROP		5001	/* Cannot read property value */
56125cf1a3jl#define	EOPL_BNUM		5002	/* Invalid board number */
56225cf1a3jl#define	EOPL_CONFIGBUSY		5003
56325cf1a3jl	/* Cannot proceed; Board is configured or busy */
56425cf1a3jl#define	EOPL_PROBE		5004	/* Firmware probe failed */
56525cf1a3jl#define	EOPL_DEPROBE		5005	/* Firmware deprobe failed */
56625cf1a3jl#define	EOPL_SUPPORT		5006	/* Operation not supported */
56725cf1a3jl#define	EOPL_DRVFAIL		5007	/* Device driver failure */
56825cf1a3jl#define	EOPL_UNKPTCMD		5008	/* Unrecognized platform command */
56925cf1a3jl#define	EOPL_NOTID		5009	/* drmach parameter is not a valid ID */
57025cf1a3jl#define	EOPL_INAPPROP		5010
57125cf1a3jl	/* drmach parameter is inappropriate for operation */
57225cf1a3jl#define	EOPL_INTERNAL		5011	/* Unexpected internal condition */
57325cf1a3jl#define	EOPL_FINDDEVICE		5012	/* Firmware cannot find node. */
57468ac233jl#define	EOPL_MC_SETUP		5013	/* Cannot setup memory node */
57568ac233jl#define	EOPL_CPU_STATE		5014	/* Invalid CPU/core state */
57668ac233jl#define	EOPL_MC_OPL		5015	/* Cannot find mc-opl interface */
57768ac233jl#define	EOPL_SCF_FMEM		5016	/* Cannot find scf_fmem interface */
57868ac233jl#define	EOPL_FMEM_SETUP		5017	/* Error setting up FMEM buffer */
57968ac233jl#define	EOPL_SCF_FMEM_START	5018	/* scf_fmem_start error */
58068ac233jl#define	EOPL_FMEM_ERROR		5019	/* FMEM error */
58168ac233jl#define	EOPL_SCF_FMEM_CANCEL	5020	/* scf_fmem_cancel error */
582b307f19bm#define	EOPL_FMEM_XC_TIMEOUT	5021	/* xcall timeout */
583b307f19bm#define	EOPL_FMEM_COPY_TIMEOUT	5022	/* DR parellel copy timeout */
584b307f19bm#define	EOPL_FMEM_SCF_BUSY	5023	/* SCF busy */
585b307f19bm#define	EOPL_FMEM_RETRY_OUT	5024	/* SCF IO Retry Error */
586b307f19bm#define	EOPL_FMEM_TIMEOUT	5025	/* FMEM command timeout */
587b307f19bm#define	EOPL_FMEM_HW_ERROR	5026	/* Hardware error */
588b307f19bm#define	EOPL_FMEM_TERMINATE	5027	/* FMEM operation Terminated */
589b307f19bm#define	EOPL_FMEM_COPY_ERROR	5028	/* Memory copy error */
590b307f19bm#define	EOPL_FMEM_SCF_ERR	5029	/* SCF error */
591e98fafbjl#define	EOPL_MIXED_CPU		5030
592e98fafbjl	/* Cannot add SPARC64-VI to domain booted with all SPARC64-VII CPUs */
5934fe85d4James Anderson#define	EOPL_FMEM_SCF_OFFLINE	5031	/* SCF OFFLINE */
59425cf1a3jl
5957c478bdstevel@tonic-gate#ifdef	__cplusplus
5967c478bdstevel@tonic-gate}
5977c478bdstevel@tonic-gate#endif
5987c478bdstevel@tonic-gate
5997c478bdstevel@tonic-gate#endif	/* _SBD_IOCTL_H */
600