4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 * Copyright (c) 2010, Intel Corporation.
27 * All rights reserved.
34 #include <sys/types.h>
35 #include <sys/obpdefs.h>
36 #include <sys/processor.h>
37 #include <sys/param.h>
57 SBD_STAT_DISCONNECTED
,
59 SBD_STAT_UNCONFIGURED
,
71 typedef int sbd_busy_t
;
73 #define SBD_MAX_UNSAFE 16
74 #define SBD_TYPE_LEN 12
75 #define SBD_NULL_UNIT -1
78 sbd_comp_type_t c_type
;
80 char c_name
[OBP_MAXPROPNAME
];
92 #define ci_type c_id.c_type
93 #define ci_unit c_id.c_unit
94 #define ci_name c_id.c_name
99 processorid_t cs_cpuid
;
104 #define cs_type cs_cm.ci_type
105 #define cs_unit cs_cm.ci_unit
106 #define cs_name cs_cm.ci_name
107 #define cs_ostate cs_cm.c_ostate
108 #define cs_cond cs_cm.c_cond
109 #define cs_busy cs_cm.c_busy
110 #define cs_suspend cs_cm.c_sflags
111 #define cs_time cs_cm.c_time
119 pgcnt_t ms_pageslost
;
120 pgcnt_t ms_managed_pages
;
121 pgcnt_t ms_noreloc_pages
;
122 pgcnt_t ms_noreloc_first
;
123 pgcnt_t ms_noreloc_last
;
125 int ms_peer_is_target
; /* else peer is source */
126 char ms_peer_ap_id
[MAXPATHLEN
]; /* board's AP name */
129 #define ms_type ms_cm.ci_type
130 #define ms_unit ms_cm.ci_unit
131 #define ms_name ms_cm.ci_name
132 #define ms_ostate ms_cm.c_ostate
133 #define ms_cond ms_cm.c_cond
134 #define ms_busy ms_cm.c_busy
135 #define ms_suspend ms_cm.c_sflags
136 #define ms_time ms_cm.c_time
142 int is_unsafe_list
[SBD_MAX_UNSAFE
];
143 char is_pathname
[MAXPATHLEN
];
146 #define is_type is_cm.ci_type
147 #define is_unit is_cm.ci_unit
148 #define is_name is_cm.ci_name
149 #define is_ostate is_cm.c_ostate
150 #define is_cond is_cm.c_cond
151 #define is_busy is_cm.c_busy
152 #define is_suspend is_cm.c_sflags
153 #define is_time is_cm.c_time
155 /* This constant must be the max of the max cores on all platforms */
156 #define SBD_MAX_CORES_PER_CMP 64
160 processorid_t ps_cpuid
[SBD_MAX_CORES_PER_CMP
];
166 #define ps_type ps_cm.ci_type
167 #define ps_unit ps_cm.ci_unit
168 #define ps_name ps_cm.ci_name
169 #define ps_ostate ps_cm.c_ostate
170 #define ps_cond ps_cm.c_cond
171 #define ps_busy ps_cm.c_busy
172 #define ps_suspend ps_cm.c_sflags
173 #define ps_time ps_cm.c_time
177 sbd_cpu_stat_t d_cpu
;
178 sbd_mem_stat_t d_mem
;
180 sbd_cmp_stat_t d_cmp
;
183 #define ds_type d_cm.ci_type
184 #define ds_unit d_cm.ci_unit
185 #define ds_name d_cm.ci_name
186 #define ds_ostate d_cm.c_ostate
187 #define ds_cond d_cm.c_cond
188 #define ds_busy d_cm.c_busy
189 #define ds_suspend d_cm.c_sflags
190 #define ds_time d_cm.c_time
192 #define SBD_MAX_INFO 256
196 char s_type
[SBD_TYPE_LEN
];
197 char s_info
[SBD_MAX_INFO
];
198 sbd_state_t s_rstate
;
199 sbd_state_t s_ostate
;
207 sbd_dev_stat_t s_stat
[1];
230 sbd_getncm_cmd_t cmd_getncm
;
231 sbd_stat_cmd_t cmd_stat
;
236 char e_rsc
[MAXPATHLEN
];
250 #define i_flags i_cmd.cmd_cm.c_flags
251 #define i_len i_cmd.cmd_cm.c_len
252 #define i_opts i_cmd.cmd_cm.c_opts
253 #define ic_type i_cmd.cmd_cm.ci_type
254 #define ic_name i_cmd.cmd_cm.ci_name
255 #define ic_unit i_cmd.cmd_cm.ci_unit
256 #define ie_code i_err.e_code
257 #define ie_rsc i_err.e_rsc
259 #define _SBD_IOC (('D' << 16) | ('R' << 8))
261 #define SBD_CMD_ASSIGN (_SBD_IOC | 0x01)
262 #define SBD_CMD_UNASSIGN (_SBD_IOC | 0x02)
263 #define SBD_CMD_POWERON (_SBD_IOC | 0x03)
264 #define SBD_CMD_POWEROFF (_SBD_IOC | 0x04)
265 #define SBD_CMD_TEST (_SBD_IOC | 0x05)
266 #define SBD_CMD_CONNECT (_SBD_IOC | 0x06)
267 #define SBD_CMD_CONFIGURE (_SBD_IOC | 0x07)
268 #define SBD_CMD_UNCONFIGURE (_SBD_IOC | 0x08)
269 #define SBD_CMD_DISCONNECT (_SBD_IOC | 0x09)
270 #define SBD_CMD_STATUS (_SBD_IOC | 0x0a)
271 #define SBD_CMD_GETNCM (_SBD_IOC | 0x0b)
272 #define SBD_CMD_PASSTHRU (_SBD_IOC | 0x0c)
274 #define SBD_CHECK_SUSPEND(cmd, c_sflags) \
275 (((c_sflags) >> (((cmd) & 0xf) - 1)) & 0x01)
277 #define SBD_SET_SUSPEND(cmd, c_sflags) \
278 ((c_sflags) |= (0x01 << (((cmd) & 0xf) - 1)))
280 #define SBD_CHECK_PLATOPTS(cmd, c_platopts) \
281 (((c_platopts) >> (((cmd) & 0xf) - 1)) & 0x01)
283 #define SBD_SET_PLATOPTS(cmd, c_platopts) \
284 ((c_platopts) &= ~(0x01 << (((cmd) & 0xf) - 1)))
286 #define SBD_FLAG_FORCE 0x1
287 #define SBD_FLAG_ALLCMP 0x2
288 #define SBD_FLAG_QUIESCE_OKAY 0x4
290 #if defined(_SYSCALL32)
295 char c_name
[OBP_MAXPROPNAME
];
299 sbd_comp_id32_t c_id
;
308 sbd_cm_stat32_t cs_cm
;
309 int32_t cs_isbootproc
;
316 sbd_cm_stat32_t ms_cm
;
317 int32_t ms_interleave
;
319 uint32_t ms_totpages
;
320 uint32_t ms_detpages
;
321 int32_t ms_pageslost
;
322 uint32_t ms_managed_pages
;
323 uint32_t ms_noreloc_pages
;
324 uint32_t ms_noreloc_first
;
325 uint32_t ms_noreloc_last
;
326 int32_t ms_cage_enabled
;
327 int32_t ms_peer_is_target
;
328 char ms_peer_ap_id
[MAXPATHLEN
];
332 sbd_cm_stat32_t is_cm
;
333 int32_t is_referenced
;
334 int32_t is_unsafe_count
;
335 int32_t is_unsafe_list
[SBD_MAX_UNSAFE
];
336 char is_pathname
[MAXPATHLEN
];
340 sbd_cm_stat32_t ps_cm
;
341 int32_t ps_cpuid
[SBD_MAX_CORES_PER_CMP
];
348 sbd_cm_stat32_t d_cm
;
349 sbd_cpu_stat32_t d_cpu
;
350 sbd_mem_stat32_t d_mem
;
351 sbd_io_stat32_t d_io
;
352 sbd_cmp_stat32_t d_cmp
;
357 char s_type
[SBD_TYPE_LEN
];
358 char s_info
[SBD_MAX_INFO
];
365 uint32_t s_assigned
:1;
368 sbd_dev_stat32_t s_stat
[1];
373 char e_rsc
[MAXPATHLEN
];
377 sbd_comp_id32_t c_id
;
386 } sbd_getncm_cmd32_t
;
395 sbd_cm_cmd32_t cmd_cm
;
396 sbd_getncm_cmd32_t cmd_getncm
;
397 sbd_stat_cmd32_t cmd_stat
;
411 #endif /* _SYSCALL32 */
414 /* Common error codes */
416 #define ESBD_NOERROR 0 /* no error */
417 #define ESBD_INTERNAL 1 /* Internal error */
418 #define ESBD_NOMEM 2 /* Insufficient memory */
419 #define ESBD_PROTO 3 /* Protocol error */
420 #define ESBD_BUSY 4 /* Device busy */
421 #define ESBD_NODEV 5 /* No such device */
422 #define ESBD_ALREADY 6 /* Operation already in progress */
423 #define ESBD_IO 7 /* I/O error */
424 #define ESBD_FAULT 8 /* Bad address */
425 #define ESBD_EMPTY_BD 9 /* No device(s) on board */
426 #define ESBD_INVAL 10 /* Invalid argument */
427 #define ESBD_STATE 11 /* Invalid state transition */
428 #define ESBD_FATAL_STATE 12 /* Device in fatal state */
429 #define ESBD_OUTSTANDING 13 /* Outstanding error */
430 #define ESBD_SUSPEND 14 /* Device failed to suspend */
431 #define ESBD_RESUME 15 /* Device failed to resume */
432 #define ESBD_UTHREAD 16 /* Cannot stop user thread */
433 #define ESBD_RTTHREAD 17 /* Cannot quiesce realtime thread */
434 #define ESBD_KTHREAD 18 /* Cannot stop kernel thread */
435 #define ESBD_OFFLINE 19 /* Failed to off-line */
436 #define ESBD_ONLINE 20 /* Failed to on-line */
437 #define ESBD_CPUSTART 21 /* Failed to start CPU */
438 #define ESBD_CPUSTOP 22 /* Failed to stop CPU */
439 #define ESBD_INVAL_COMP 23 /* Invalid component type */
440 #define ESBD_KCAGE_OFF 24 /* Kernel cage is disabled */
441 #define ESBD_NO_TARGET 25 /* No available memory target */
442 #define ESBD_HW_PROGRAM 26 /* Hardware programming error */
443 #define ESBD_MEM_NOTVIABLE 27 /* VM viability test failed */
444 #define ESBD_MEM_REFUSED 28 /* Memory operation refused */
445 #define ESBD_MEM_NONRELOC 29 /* Non-relocatable pages in span */
446 #define ESBD_MEM_CANCELLED 30 /* Memory operation cancelled */
447 #define ESBD_MEMFAIL 31 /* Memory operation failed */
448 #define ESBD_MEMONLINE 32 /* Can't unconfig cpu if mem online */
449 #define ESBD_QUIESCE_REQD 33
450 /* Operator confirmation for quiesce is required */
451 #define ESBD_MEMINTLV 34
452 /* Memory is interleaved across boards */
453 #define ESBD_CPUONLINE 35
454 /* Can't config memory if not all cpus are online */
455 #define ESBD_UNSAFE 36 /* Unsafe driver present */
456 #define ESBD_INVAL_OPT 37 /* option invalid */
458 /* Starcat error codes */
460 #define ESTC_NONE 1000 /* No error */
461 #define ESTC_GETPROP 1001 /* Cannot read property value */
462 #define ESTC_BNUM 1002 /* Invalid board number */
463 #define ESTC_CONFIGBUSY 1003
464 /* Cannot proceed; Board is configured or busy */
465 #define ESTC_PROBE 1004 /* Solaris failed to probe */
466 #define ESTC_DEPROBE 1005 /* Solaris failed to deprobe */
467 #define ESTC_MOVESIGB 1006 /* Firmware move-cpu0 failed */
468 #define ESTC_SUPPORT 1007 /* Operation not supported */
469 #define ESTC_DRVFAIL 1008 /* Device driver failure */
470 #define ESTC_UNKPTCMD 1012 /* Unrecognized platform command */
471 #define ESTC_NOTID 1013
472 /* drmach parameter is not a valid ID */
473 #define ESTC_INAPPROP 1014
474 /* drmach parameter is inappropriate for operation */
475 #define ESTC_INTERNAL 1015 /* Unexpected internal condition */
476 #define ESTC_MBXRQST 1016
477 /* Mailbox framework failure: outgoing */
478 #define ESTC_MBXRPLY 1017
479 /* Mailbox framework failure: incoming */
480 #define ESTC_NOACL 1018 /* Board is not in domain ACL */
481 #define ESTC_NOT_ASSIGNED 1019 /* Board is not assigned to domain */
482 #define ESTC_NOT_ACTIVE 1020 /* Board is not active */
483 #define ESTC_EMPTY_SLOT 1021 /* Slot is empty */
484 #define ESTC_POWER_OFF 1022 /* Board is powered off */
485 #define ESTC_TEST_IN_PROGRESS 1023 /* Board is already being tested */
486 #define ESTC_TESTING_BUSY 1024
487 /* Wait: All SC test resources are in use */
488 #define ESTC_TEST_REQUIRED 1025 /* Board requires test prior to use */
489 #define ESTC_TEST_ABORTED 1026 /* Board test has been aborted */
490 #define ESTC_MBOX_UNKNOWN 1027
491 /* Unknown error type received from SC */
492 #define ESTC_TEST_STATUS_UNKNOWN 1028
493 /* Test completed with unknown status */
494 #define ESTC_TEST_RESULT_UNKNOWN 1029
495 /* Unknown test result returned by SC */
496 #define ESTC_TEST_FAILED 1030
497 /* SMS hpost reported error, see POST log for details */
498 #define ESTC_UNAVAILABLE 1031 /* Slot is unavailable to the domain */
499 #define ESTC_NZ_LPA 1032 /* Nonzero LPA not yet supported */
500 #define ESTC_IOSWITCH 1033
501 /* Cannot unconfigure I/O board: tunnel switch failed */
502 #define ESTC_IOCAGE_NO_CPU_AVAIL 1034
503 /* No CPU available for I/O cage test. */
504 #define ESTC_SMS_ERR_RECOVERABLE 1035
505 /* SMS reported recoverable error: check SMS status and Retry */
506 #define ESTC_SMS_ERR_UNRECOVERABLE 1036
507 /* SMS reported unrecoverable error: Board is Unusable */
508 #define ESTC_NWSWITCH 1037
509 /* Cannot unconfigure I/O board: network switch failed */
511 /* Starfire error codes */
513 #define ESTF_NONE 2000 /* No error */
514 #define ESTF_GETPROP 2001 /* Cannot read property value */
515 #define ESTF_GETPROPLEN 2002 /* Cannot determine property length */
516 #define ESTF_BNUM 2003 /* Invalid board number */
517 #define ESTF_CONFIGBUSY 2004
518 /* Cannot proceed; Board is configured or busy */
519 #define ESTF_NOCPUID 2005 /* No CPU specified for connect */
520 #define ESTF_PROBE 2006 /* Firmware probe failed */
521 #define ESTF_DEPROBE 2007 /* Firmware deprobe failed */
522 #define ESTF_MOVESIGB 2008 /* Firmware move-cpu0 failed */
523 #define ESTF_JUGGLE 2009 /* Cannot move SIGB assignment */
524 #define ESTF_HASSIGB 2010
525 /* Cannot disconnect CPU; SIGB is currently assigned */
526 #define ESTF_SUPPORT 2011 /* Operation not supported */
527 #define ESTF_DRVFAIL 2012 /* Device driver failure */
528 #define ESTF_SETCPUVAL 2013
529 /* Must specify a CPU on the given board */
530 #define ESTF_NODEV 2014 /* No such device */
531 #define ESTF_INTERBOARD 2015
532 /* Memory configured with inter-board interleaving */
533 #define ESTF_UNKPTCMD 2016 /* Unrecognized platform command */
534 #define ESTF_NOTID 2017 /* drmach parameter is not a valid ID */
535 #define ESTF_INAPPROP 2018
536 /* drmach parameter is inappropriate for operation */
537 #define ESTF_INTERNAL 2019 /* Unexpected internal condition */
539 /* Daktari error codes */
541 #define EDAK_NONE 3000 /* no error */
542 #define EDAK_INTERNAL 3001 /* Internal error */
543 #define EDAK_NOFRUINFO 3002 /* Didn't receive fru info */
544 #define EDAK_NONDR_BOARD 3003
545 /* DR is not supported on this board type */
546 #define EDAK_POWERON 3004 /* Power on request failed */
547 #define EDAK_POWEROK 3005 /* Failed to power on */
548 #define EDAK_INTERRUPTED 3006 /* Operation interrupted */
549 #define EDAK_BOARDINIT 3007 /* Board initialization failed */
550 #define EDAK_CPUINIT 3008 /* CPU intialization failed */
551 #define EDAK_MEMFAIL 3009 /* Memory operation failed */
553 /* Serengeti error codes */
555 #define ESGT_NONE 4000 /* no error */
556 #define ESGT_INTERNAL 4001 /* Internal error */
557 #define ESGT_INVAL 4002 /* Invalid argument */
558 #define ESGT_MEMFAIL 4003 /* Memory operation failed */
559 #define ESGT_PROBE 4004 /* Board probe failed */
560 #define ESGT_DEPROBE 4005 /* Board deprobe failed */
561 #define ESGT_JUGGLE_BOOTPROC 4006 /* Failed to juggle bootproc */
562 #define ESGT_NOT_CPUTYPE 4007 /* Not a cpu device */
563 #define ESGT_NO_DEV_TYPE 4008 /* Cannot find device type */
564 #define ESGT_BAD_PORTID 4009 /* Bad port id */
565 #define ESGT_RESUME 4010 /* Failed to resume device */
566 #define ESGT_SUSPEND 4011 /* Failed to suspend device */
567 #define ESGT_KTHREAD 4012 /* failed to stop kernel thd */
568 #define ESGT_UNSAFE 4013 /* unsafe */
569 #define ESGT_RTTHREAD 4014 /* real time threads */
570 #define ESGT_UTHREAD 4015 /* failed to stop user thd */
571 #define ESGT_PROM_ATTACH 4016 /* prom failed attach board */
572 #define ESGT_PROM_DETACH 4017 /* prom failed detach board */
573 #define ESGT_SC_ERR 4018 /* sc return a failure */
574 #define ESGT_GET_BOARD_STAT 4019 /* Failed to obtain board information */
575 #define ESGT_WAKEUPCPU 4020 /* Failed to wake up cpu */
576 #define ESGT_STOPCPU 4021 /* Failed to stop cpu */
577 /* Serengeti SC return codes */
578 #define ESGT_HW_FAIL 4022 /* Hardware Failure */
579 #define ESGT_BD_ACCESS 4023 /* Board access denied */
580 #define ESGT_STALE_CMP 4024 /* Stale components */
581 #define ESGT_STALE_OBJ 4025 /* Stale objects */
582 #define ESGT_NO_SEPROM_SPACE 4026 /* No SEPROM space */
583 #define ESGT_NOT_SUPP 4027 /* Operation not supported */
584 #define ESGT_NO_MEM 4028 /* No Memory */
586 /* OPL error codes */
588 #define EOPL_GETPROP 5001 /* Cannot read property value */
589 #define EOPL_BNUM 5002 /* Invalid board number */
590 #define EOPL_CONFIGBUSY 5003
591 /* Cannot proceed; Board is configured or busy */
592 #define EOPL_PROBE 5004 /* Firmware probe failed */
593 #define EOPL_DEPROBE 5005 /* Firmware deprobe failed */
594 #define EOPL_SUPPORT 5006 /* Operation not supported */
595 #define EOPL_DRVFAIL 5007 /* Device driver failure */
596 #define EOPL_UNKPTCMD 5008 /* Unrecognized platform command */
597 #define EOPL_NOTID 5009 /* drmach parameter is not a valid ID */
598 #define EOPL_INAPPROP 5010
599 /* drmach parameter is inappropriate for operation */
600 #define EOPL_INTERNAL 5011 /* Unexpected internal condition */
601 #define EOPL_FINDDEVICE 5012 /* Firmware cannot find node. */
602 #define EOPL_MC_SETUP 5013 /* Cannot setup memory node */
603 #define EOPL_CPU_STATE 5014 /* Invalid CPU/core state */
604 #define EOPL_MC_OPL 5015 /* Cannot find mc-opl interface */
605 #define EOPL_SCF_FMEM 5016 /* Cannot find scf_fmem interface */
606 #define EOPL_FMEM_SETUP 5017 /* Error setting up FMEM buffer */
607 #define EOPL_SCF_FMEM_START 5018 /* scf_fmem_start error */
608 #define EOPL_FMEM_ERROR 5019 /* FMEM error */
609 #define EOPL_SCF_FMEM_CANCEL 5020 /* scf_fmem_cancel error */
610 #define EOPL_FMEM_XC_TIMEOUT 5021 /* xcall timeout */
611 #define EOPL_FMEM_COPY_TIMEOUT 5022 /* DR parellel copy timeout */
612 #define EOPL_FMEM_SCF_BUSY 5023 /* SCF busy */
613 #define EOPL_FMEM_RETRY_OUT 5024 /* SCF IO Retry Error */
614 #define EOPL_FMEM_TIMEOUT 5025 /* FMEM command timeout */
615 #define EOPL_FMEM_HW_ERROR 5026 /* Hardware error */
616 #define EOPL_FMEM_TERMINATE 5027 /* FMEM operation Terminated */
617 #define EOPL_FMEM_COPY_ERROR 5028 /* Memory copy error */
618 #define EOPL_FMEM_SCF_ERR 5029 /* SCF error */
619 #define EOPL_MIXED_CPU 5030
620 /* Cannot add SPARC64-VI to domain booted with all SPARC64-VII CPUs */
621 #define EOPL_FMEM_SCF_OFFLINE 5031 /* SCF OFFLINE */
623 /* X86 error codes */
625 #define EX86_GETPROP 10001 /* Cannot read property value */
626 #define EX86_BNUM 10002 /* Invalid board number */
627 #define EX86_NOTID 10003 /* drmach parameter is not a valid ID */
628 #define EX86_INAPPROP 10004
629 /* drmach parameter is inappropriate for operation */
630 #define EX86_PROBE 10005 /* Firmware probe failed */
631 #define EX86_DEPROBE 10006 /* Firmware deprobe failed */
632 #define EX86_SUPPORT 10007 /* Operation not supported */
633 #define EX86_INTERNAL 10008 /* Unexpected internal condition */
634 #define EX86_CONFIGBUSY 10009
635 /* Cannot proceed, board is configured or busy */
636 #define EX86_POWERBUSY 10010 /* Cannot proceed, board is powered */
637 #define EX86_CONNECTBUSY 10011 /* Cannot proceed, board is connected */
638 #define EX86_INVALID_ARG 10012 /* Invalid argument */
639 #define EX86_DRVFAIL 10013 /* Device driver failure */
640 #define EX86_UNKPTCMD 10014 /* Unrecognized platform command */
641 #define EX86_ALLOC_CPUID 10015 /* Failed to allocate processor id */
642 #define EX86_FREE_CPUID 10016 /* Failed to release processor id */
643 #define EX86_POWERON 10017 /* Failed to power on board */
644 #define EX86_POWEROFF 10018 /* Failed to power off board */
645 #define EX86_MC_SETUP 10019 /* Cannot setup memory node */
646 #define EX86_ACPIWALK 10020 /* Cannot walk ACPI namespace */
647 #define EX86_WALK_DEPENDENCY 10021
648 /* Failed to check dependency for board */
649 #define EX86_IN_FAILURE 10022 /* Board is in failure state */
655 #endif /* _SBD_IOCTL_H */