10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 51957Sdnielsen * Common Development and Distribution License (the "License"). 61957Sdnielsen * You may not use this file except in compliance with the License. 70Sstevel@tonic-gate * 80Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 90Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 100Sstevel@tonic-gate * See the License for the specific language governing permissions 110Sstevel@tonic-gate * and limitations under the License. 120Sstevel@tonic-gate * 130Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 140Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 150Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 160Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 170Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 180Sstevel@tonic-gate * 190Sstevel@tonic-gate * CDDL HEADER END 200Sstevel@tonic-gate */ 211957Sdnielsen 220Sstevel@tonic-gate /* 23*10696SDavid.Hollister@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #ifndef _CFGA_SCSI_H 280Sstevel@tonic-gate #define _CFGA_SCSI_H 290Sstevel@tonic-gate 300Sstevel@tonic-gate #ifdef __cplusplus 310Sstevel@tonic-gate extern "C" { 320Sstevel@tonic-gate #endif 330Sstevel@tonic-gate 340Sstevel@tonic-gate #include <stddef.h> 350Sstevel@tonic-gate #include <locale.h> 360Sstevel@tonic-gate #include <ctype.h> 370Sstevel@tonic-gate #include <stdio.h> 380Sstevel@tonic-gate #include <stdlib.h> 390Sstevel@tonic-gate #include <string.h> 400Sstevel@tonic-gate #include <fcntl.h> 410Sstevel@tonic-gate #include <unistd.h> 420Sstevel@tonic-gate #include <errno.h> 430Sstevel@tonic-gate #include <locale.h> 440Sstevel@tonic-gate #include <langinfo.h> 450Sstevel@tonic-gate #include <time.h> 460Sstevel@tonic-gate #include <stdarg.h> 470Sstevel@tonic-gate #include <sys/types.h> 480Sstevel@tonic-gate #include <sys/ioctl.h> 490Sstevel@tonic-gate #include <sys/dditypes.h> 500Sstevel@tonic-gate #include <sys/modctl.h> 510Sstevel@tonic-gate #include <libdevinfo.h> 520Sstevel@tonic-gate #include <libdevice.h> 530Sstevel@tonic-gate #include <librcm.h> 540Sstevel@tonic-gate #include <dirent.h> 550Sstevel@tonic-gate #include <strings.h> 560Sstevel@tonic-gate 570Sstevel@tonic-gate #include <sys/ioctl.h> 580Sstevel@tonic-gate #include <sys/byteorder.h> 590Sstevel@tonic-gate #include <sys/scsi/scsi.h> 600Sstevel@tonic-gate #include <strings.h> 610Sstevel@tonic-gate #include <sys/vfstab.h> 620Sstevel@tonic-gate #include <sys/stat.h> 630Sstevel@tonic-gate #include <sys/mnttab.h> 640Sstevel@tonic-gate #include <sys/wait.h> 650Sstevel@tonic-gate #include <signal.h> 660Sstevel@tonic-gate 670Sstevel@tonic-gate #include <sys/uio.h> 680Sstevel@tonic-gate #include <sys/param.h> 690Sstevel@tonic-gate 700Sstevel@tonic-gate #include <synch.h> 710Sstevel@tonic-gate #include <thread.h> 720Sstevel@tonic-gate 730Sstevel@tonic-gate #include <limits.h> 740Sstevel@tonic-gate #include <ftw.h> 750Sstevel@tonic-gate 760Sstevel@tonic-gate #define CFGA_PLUGIN_LIB 770Sstevel@tonic-gate #include <config_admin.h> 780Sstevel@tonic-gate 790Sstevel@tonic-gate #if !defined(DEBUG) 800Sstevel@tonic-gate #define NDEBUG 1 810Sstevel@tonic-gate #else 820Sstevel@tonic-gate #undef NDEBUG 830Sstevel@tonic-gate #endif 840Sstevel@tonic-gate 850Sstevel@tonic-gate #include <assert.h> 860Sstevel@tonic-gate 870Sstevel@tonic-gate /* Return/error codes */ 880Sstevel@tonic-gate typedef enum { 890Sstevel@tonic-gate SCFGA_ERR = -1, 900Sstevel@tonic-gate SCFGA_LIB_ERR = 0, 910Sstevel@tonic-gate SCFGA_OK, 920Sstevel@tonic-gate SCFGA_NACK, 930Sstevel@tonic-gate SCFGA_BUSY, 940Sstevel@tonic-gate SCFGA_SYSTEM_BUSY, 950Sstevel@tonic-gate SCFGA_APID_NOEXIST, 960Sstevel@tonic-gate SCFGA_OPNOTSUPP, 970Sstevel@tonic-gate SCFGA_PRIV, 980Sstevel@tonic-gate SCFGA_UNLOCKED, 990Sstevel@tonic-gate SCFGA_NO_REC, 1000Sstevel@tonic-gate SCFGA_OP_INTR, 1010Sstevel@tonic-gate SCFGA_DB_INVAL, 1020Sstevel@tonic-gate SCFGA_UNKNOWN_ERR 1030Sstevel@tonic-gate } scfga_ret_t; 1040Sstevel@tonic-gate 1050Sstevel@tonic-gate /* Commands used internally */ 1060Sstevel@tonic-gate typedef enum { 1070Sstevel@tonic-gate SCFGA_INVAL_CMD = -1, 1080Sstevel@tonic-gate SCFGA_DEV_OP = 0, 1090Sstevel@tonic-gate SCFGA_BUS_OP, 1100Sstevel@tonic-gate SCFGA_STAT_DEV, 1110Sstevel@tonic-gate SCFGA_STAT_BUS, 1120Sstevel@tonic-gate SCFGA_STAT_ALL, 1130Sstevel@tonic-gate SCFGA_GET_DEVPATH, 1140Sstevel@tonic-gate SCFGA_INSERT_DEV, 1150Sstevel@tonic-gate SCFGA_REMOVE_DEV, 1160Sstevel@tonic-gate SCFGA_REPLACE_DEV, 1170Sstevel@tonic-gate SCFGA_WALK_NODE, 1180Sstevel@tonic-gate SCFGA_WALK_MINOR, 119*10696SDavid.Hollister@Sun.COM SCFGA_WALK_PATH, 1200Sstevel@tonic-gate SCFGA_BUS_QUIESCE, 1210Sstevel@tonic-gate SCFGA_BUS_UNQUIESCE, 1220Sstevel@tonic-gate SCFGA_BUS_GETSTATE, 1230Sstevel@tonic-gate SCFGA_DEV_GETSTATE, 1240Sstevel@tonic-gate SCFGA_BUS_CONFIGURE, 1250Sstevel@tonic-gate SCFGA_BUS_UNCONFIGURE, 1260Sstevel@tonic-gate SCFGA_DEV_CONFIGURE, 1270Sstevel@tonic-gate SCFGA_DEV_UNCONFIGURE, 1280Sstevel@tonic-gate SCFGA_DEV_REMOVE, 1291957Sdnielsen SCFGA_LED_DEV, 1301957Sdnielsen SCFGA_LOCATOR_DEV, 1310Sstevel@tonic-gate SCFGA_RESET_DEV, 1320Sstevel@tonic-gate SCFGA_RESET_BUS, 1330Sstevel@tonic-gate SCFGA_RESET_ALL, 1340Sstevel@tonic-gate SCFGA_READ, 1350Sstevel@tonic-gate SCFGA_WRITE 1360Sstevel@tonic-gate } scfga_cmd_t; 1370Sstevel@tonic-gate 1380Sstevel@tonic-gate typedef enum { 1390Sstevel@tonic-gate SCFGA_TERMINATE = 0, 1400Sstevel@tonic-gate SCFGA_CONTINUE 1410Sstevel@tonic-gate } scfga_recur_t; 1420Sstevel@tonic-gate 143*10696SDavid.Hollister@Sun.COM typedef enum { 144*10696SDavid.Hollister@Sun.COM NODYNCOMP = 1, 145*10696SDavid.Hollister@Sun.COM DEV_APID, 146*10696SDavid.Hollister@Sun.COM PATH_APID 147*10696SDavid.Hollister@Sun.COM } dyncomp_t; 148*10696SDavid.Hollister@Sun.COM 1490Sstevel@tonic-gate 1500Sstevel@tonic-gate /* Structures for tree walking code */ 1510Sstevel@tonic-gate 1520Sstevel@tonic-gate typedef struct { 1530Sstevel@tonic-gate uint_t flags; 1540Sstevel@tonic-gate int (*fcn)(di_node_t node, void *argp); 1550Sstevel@tonic-gate } walk_node_t; 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate typedef struct { 1580Sstevel@tonic-gate const char *nodetype; 1590Sstevel@tonic-gate int (*fcn)(di_node_t node, di_minor_t minor, void *argp); 1600Sstevel@tonic-gate } walk_minor_t; 1610Sstevel@tonic-gate 1620Sstevel@tonic-gate typedef union { 1630Sstevel@tonic-gate walk_node_t node_args; 1640Sstevel@tonic-gate walk_minor_t minor_args; 1650Sstevel@tonic-gate } walkarg_t; 1660Sstevel@tonic-gate 1670Sstevel@tonic-gate typedef struct { 1680Sstevel@tonic-gate char *phys; 1690Sstevel@tonic-gate char *log; 1700Sstevel@tonic-gate scfga_ret_t ret; 1710Sstevel@tonic-gate int match_minor; 1720Sstevel@tonic-gate int l_errno; 1730Sstevel@tonic-gate } pathm_t; 1740Sstevel@tonic-gate 1750Sstevel@tonic-gate typedef struct ldata_list { 1760Sstevel@tonic-gate cfga_list_data_t ldata; 1770Sstevel@tonic-gate struct ldata_list *next; 1780Sstevel@tonic-gate } ldata_list_t; 1790Sstevel@tonic-gate 1800Sstevel@tonic-gate typedef struct { 1810Sstevel@tonic-gate struct cfga_confirm *confp; 1820Sstevel@tonic-gate struct cfga_msg *msgp; 1830Sstevel@tonic-gate } prompt_t; 1840Sstevel@tonic-gate 1850Sstevel@tonic-gate typedef struct { 1860Sstevel@tonic-gate char *hba_phys; 1870Sstevel@tonic-gate char *dyncomp; 188*10696SDavid.Hollister@Sun.COM dyncomp_t dyntype; /* is pathinfo or dev apid? */ 189*10696SDavid.Hollister@Sun.COM char *path; /* for apid with device dyn comp. */ 1900Sstevel@tonic-gate uint_t flags; 1910Sstevel@tonic-gate } apid_t; 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate /* Private hardware options */ 1940Sstevel@tonic-gate #define OPT_DISABLE_RCM "disable_rcm" 1950Sstevel@tonic-gate #define OPT_USE_DIFORCE "use_diforce" 1960Sstevel@tonic-gate 1970Sstevel@tonic-gate /* apid_t flags */ 1980Sstevel@tonic-gate #define FLAG_DISABLE_RCM 0x01 1990Sstevel@tonic-gate #define FLAG_USE_DIFORCE 0x02 2000Sstevel@tonic-gate 201*10696SDavid.Hollister@Sun.COM /* internal use for handling pathinfo */ 202*10696SDavid.Hollister@Sun.COM #define FLAG_CLIENT_DEV 0x04 203*10696SDavid.Hollister@Sun.COM 2040Sstevel@tonic-gate /* Message ids */ 2050Sstevel@tonic-gate typedef enum { 2060Sstevel@tonic-gate 2070Sstevel@tonic-gate /* ERRORS */ 2080Sstevel@tonic-gate ERR_UNKNOWN = -1, 2090Sstevel@tonic-gate ERR_OP_FAILED, 2100Sstevel@tonic-gate ERR_CMD_INVAL, 2110Sstevel@tonic-gate ERR_NOT_BUSAPID, 2120Sstevel@tonic-gate ERR_APID_INVAL, 2130Sstevel@tonic-gate ERR_NOT_BUSOP, 2140Sstevel@tonic-gate ERR_NOT_DEVOP, 2150Sstevel@tonic-gate ERR_UNAVAILABLE, 2160Sstevel@tonic-gate ERR_CTRLR_CRIT, 2170Sstevel@tonic-gate ERR_BUS_GETSTATE, 2180Sstevel@tonic-gate ERR_BUS_NOTCONNECTED, 2190Sstevel@tonic-gate ERR_BUS_CONNECTED, 2200Sstevel@tonic-gate ERR_BUS_QUIESCE, 2210Sstevel@tonic-gate ERR_BUS_UNQUIESCE, 2220Sstevel@tonic-gate ERR_BUS_CONFIGURE, 2230Sstevel@tonic-gate ERR_BUS_UNCONFIGURE, 2240Sstevel@tonic-gate ERR_DEV_CONFIGURE, 2250Sstevel@tonic-gate ERR_DEV_RECONFIGURE, 2260Sstevel@tonic-gate ERR_DEV_UNCONFIGURE, 2270Sstevel@tonic-gate ERR_DEV_REMOVE, 2280Sstevel@tonic-gate ERR_DEV_REPLACE, 2290Sstevel@tonic-gate ERR_DEV_INSERT, 2300Sstevel@tonic-gate ERR_DEV_GETSTATE, 2310Sstevel@tonic-gate ERR_RESET, 2320Sstevel@tonic-gate ERR_LIST, 2330Sstevel@tonic-gate ERR_MAYBE_BUSY, 2340Sstevel@tonic-gate ERR_BUS_DEV_MISMATCH, 2350Sstevel@tonic-gate ERR_VAR_RUN, 2360Sstevel@tonic-gate ERR_FORK, 2370Sstevel@tonic-gate 2380Sstevel@tonic-gate /* Errors with arguments */ 2390Sstevel@tonic-gate ERRARG_OPT_INVAL, 2400Sstevel@tonic-gate ERRARG_HWCMD_INVAL, 2410Sstevel@tonic-gate ERRARG_DEVINFO, 2420Sstevel@tonic-gate ERRARG_OPEN, 2430Sstevel@tonic-gate ERRARG_LOCK, 2440Sstevel@tonic-gate ERRARG_QUIESCE_LOCK, 2450Sstevel@tonic-gate 2460Sstevel@tonic-gate /* RCM Errors */ 2470Sstevel@tonic-gate ERR_RCM_HANDLE, 2480Sstevel@tonic-gate ERRARG_RCM_SUSPEND, 2490Sstevel@tonic-gate ERRARG_RCM_RESUME, 2500Sstevel@tonic-gate ERRARG_RCM_OFFLINE, 251*10696SDavid.Hollister@Sun.COM ERRARG_RCM_CLIENT_OFFLINE, 2520Sstevel@tonic-gate ERRARG_RCM_ONLINE, 2530Sstevel@tonic-gate ERRARG_RCM_REMOVE, 2540Sstevel@tonic-gate 2550Sstevel@tonic-gate /* Commands */ 2560Sstevel@tonic-gate CMD_INSERT_DEV, 2570Sstevel@tonic-gate CMD_REMOVE_DEV, 2580Sstevel@tonic-gate CMD_REPLACE_DEV, 2591957Sdnielsen CMD_LED_DEV, 2601957Sdnielsen CMD_LOCATOR_DEV, 2610Sstevel@tonic-gate CMD_RESET_DEV, 2620Sstevel@tonic-gate CMD_RESET_BUS, 2630Sstevel@tonic-gate CMD_RESET_ALL, 2640Sstevel@tonic-gate 2650Sstevel@tonic-gate /* help messages */ 2660Sstevel@tonic-gate MSG_HELP_HDR, 2670Sstevel@tonic-gate MSG_HELP_USAGE, 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate /* Hotplug messages */ 2700Sstevel@tonic-gate MSG_INSDEV, 2710Sstevel@tonic-gate MSG_RMDEV, 2720Sstevel@tonic-gate MSG_REPLDEV, 2730Sstevel@tonic-gate MSG_WAIT_LOCK, 2740Sstevel@tonic-gate 2750Sstevel@tonic-gate /* Hotplugging confirmation prompts */ 2760Sstevel@tonic-gate CONF_QUIESCE_1, 2770Sstevel@tonic-gate CONF_QUIESCE_2, 2780Sstevel@tonic-gate CONF_UNQUIESCE, 2790Sstevel@tonic-gate CONF_NO_QUIESCE, 2800Sstevel@tonic-gate 2810Sstevel@tonic-gate /* Misc. */ 2821957Sdnielsen WARN_DISCONNECT, 2831957Sdnielsen 2841957Sdnielsen /* HDD led/locator messages */ 2851957Sdnielsen MSG_LED_HDR, 2861957Sdnielsen MSG_MISSING_LED_NAME, 2871957Sdnielsen MSG_MISSING_LED_MODE 2880Sstevel@tonic-gate } msgid_t; 2890Sstevel@tonic-gate 2901957Sdnielsen typedef enum { 2911957Sdnielsen LED_STR_FAULT, 2921957Sdnielsen LED_STR_POWER, 2931957Sdnielsen LED_STR_ATTN, 2941957Sdnielsen LED_STR_ACTIVE, 2951957Sdnielsen LED_STR_LOCATOR 2961957Sdnielsen } led_strid_t; 2971957Sdnielsen 2981957Sdnielsen typedef enum { 2991957Sdnielsen LED_MODE_OFF, 3001957Sdnielsen LED_MODE_ON, 3011957Sdnielsen LED_MODE_BLINK, 3021957Sdnielsen LED_MODE_FAULTED, 3031957Sdnielsen LED_MODE_UNK 3041957Sdnielsen } led_modeid_t; 3051957Sdnielsen 3061957Sdnielsen 3070Sstevel@tonic-gate typedef struct { 3080Sstevel@tonic-gate msgid_t str_id; 3090Sstevel@tonic-gate scfga_cmd_t cmd; 3101957Sdnielsen scfga_ret_t (*fcn)(const char *, scfga_cmd_t, apid_t *, prompt_t *, 3111957Sdnielsen cfga_flags_t, char **); 3120Sstevel@tonic-gate } hw_cmd_t; 3130Sstevel@tonic-gate 3140Sstevel@tonic-gate typedef struct { 3150Sstevel@tonic-gate msgid_t msgid; 3160Sstevel@tonic-gate int nargs; /* Number of arguments following msgid */ 3170Sstevel@tonic-gate int intl; /* Flag: if 1, internationalize */ 3180Sstevel@tonic-gate const char *msgstr; 3190Sstevel@tonic-gate } msgcvt_t; 3200Sstevel@tonic-gate 3210Sstevel@tonic-gate 3220Sstevel@tonic-gate #define SLASH "/" 3230Sstevel@tonic-gate #define CFGA_DEV_DIR "/dev/cfg" 3240Sstevel@tonic-gate #define DEV_DIR "/dev" 3250Sstevel@tonic-gate #define DEVICES_DIR "/devices" 3260Sstevel@tonic-gate #define DEV_DSK "/dev/dsk" 3270Sstevel@tonic-gate #define DEV_RDSK "/dev/rdsk" 3280Sstevel@tonic-gate #define DEV_RMT "/dev/rmt" 3290Sstevel@tonic-gate #define DSK_DIR "dsk" 3300Sstevel@tonic-gate #define RDSK_DIR "rdsk" 3310Sstevel@tonic-gate #define RMT_DIR "rmt" 3320Sstevel@tonic-gate 3330Sstevel@tonic-gate 3340Sstevel@tonic-gate #define DYN_SEP "::" 3350Sstevel@tonic-gate #define MINOR_SEP ":" 336*10696SDavid.Hollister@Sun.COM #define PATH_APID_DYN_SEP "," 3370Sstevel@tonic-gate 3380Sstevel@tonic-gate #define S_FREE(x) (((x) != NULL) ? (free(x), (x) = NULL) : (void *)0) 3390Sstevel@tonic-gate #define S_STR(x) (((x) == NULL) ? "" : (x)) 3400Sstevel@tonic-gate 3410Sstevel@tonic-gate 3420Sstevel@tonic-gate #define IS_STUB_NODE(s) (di_instance(s) == -1 && \ 3430Sstevel@tonic-gate di_nodeid(s) == (DI_PROM_NODEID)) 3440Sstevel@tonic-gate 3450Sstevel@tonic-gate #define GET_MSG_STR(i) (str_tbl[msg_idx(i)].msgstr) 3460Sstevel@tonic-gate 3470Sstevel@tonic-gate #define GET_DYN(a) (((a) != NULL) ? strstr((a), DYN_SEP) : (void *)0) 3480Sstevel@tonic-gate 3490Sstevel@tonic-gate /* 3500Sstevel@tonic-gate * The following macro removes the separator from the dynamic component. 3510Sstevel@tonic-gate */ 3520Sstevel@tonic-gate #define DYN_TO_DYNCOMP(a) ((a) + strlen(DYN_SEP)) 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate extern int _scfga_debug; 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate /* 3570Sstevel@tonic-gate * Tracing/debugging macros 3580Sstevel@tonic-gate */ 3590Sstevel@tonic-gate #define CFGA_TRACE1(args) (void) ((_scfga_debug >= 1) ? fprintf args : 0) 3600Sstevel@tonic-gate #define CFGA_TRACE2(args) (void) ((_scfga_debug >= 2) ? fprintf args : 0) 3610Sstevel@tonic-gate #define CFGA_TRACE3(args) (void) ((_scfga_debug >= 3) ? fprintf args : 0) 3620Sstevel@tonic-gate 3630Sstevel@tonic-gate /* Function prototypes */ 3640Sstevel@tonic-gate 3650Sstevel@tonic-gate /* bus/device ctl routines */ 3660Sstevel@tonic-gate scfga_ret_t bus_change_state(cfga_cmd_t state_change_cmd, 3670Sstevel@tonic-gate apid_t *apidp, struct cfga_confirm *confp, cfga_flags_t flags, 3680Sstevel@tonic-gate char **errstring); 3690Sstevel@tonic-gate scfga_ret_t dev_change_state(cfga_cmd_t state_change_cmd, 3700Sstevel@tonic-gate apid_t *apidp, cfga_flags_t flags, char **errstring); 3711957Sdnielsen scfga_ret_t dev_insert(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3721957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3731957Sdnielsen scfga_ret_t dev_replace(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3741957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3751957Sdnielsen scfga_ret_t dev_remove(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3761957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3771957Sdnielsen scfga_ret_t reset_common(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3781957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3791957Sdnielsen scfga_ret_t dev_led(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3801957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3811957Sdnielsen scfga_ret_t plat_dev_led(const char *func, scfga_cmd_t cmd, apid_t *apidp, 3821957Sdnielsen prompt_t *argsp, cfga_flags_t flags, char **errstring); 3830Sstevel@tonic-gate 3840Sstevel@tonic-gate 3850Sstevel@tonic-gate /* List related routines */ 3860Sstevel@tonic-gate scfga_ret_t do_list(apid_t *apidp, scfga_cmd_t cmd, 3870Sstevel@tonic-gate ldata_list_t **llpp, int *nelem, char **errstring); 3880Sstevel@tonic-gate scfga_ret_t list_ext_postprocess(ldata_list_t **llpp, int nelem, 3890Sstevel@tonic-gate cfga_list_data_t **ap_id_list, int *nlistp, char **errstring); 390*10696SDavid.Hollister@Sun.COM int stat_path_info(di_node_t root, void *arg, int *l_errnop); 3910Sstevel@tonic-gate 3920Sstevel@tonic-gate 3930Sstevel@tonic-gate /* Conversion routines */ 3940Sstevel@tonic-gate scfga_ret_t make_hba_logid(const char *hba_phys, char **hba_logpp, 3950Sstevel@tonic-gate int *l_errnop); 3960Sstevel@tonic-gate scfga_ret_t apid_to_path(const char *hba_phys, const char *dyncomp, 3970Sstevel@tonic-gate char **pathpp, int *l_errnop); 3980Sstevel@tonic-gate scfga_ret_t make_dyncomp(di_node_t node, const char *physpath, 3990Sstevel@tonic-gate char **dyncompp, int *l_errnop); 400*10696SDavid.Hollister@Sun.COM scfga_ret_t make_path_dyncomp(di_path_t path, char **dyncomp, int *l_errnop); 4010Sstevel@tonic-gate 4020Sstevel@tonic-gate 4030Sstevel@tonic-gate /* RCM routines */ 4040Sstevel@tonic-gate scfga_ret_t scsi_rcm_suspend(char **rsrclist, char **errstring, 4050Sstevel@tonic-gate cfga_flags_t flags, int pflag); 4060Sstevel@tonic-gate scfga_ret_t scsi_rcm_resume(char **rsrclist, char **errstring, 4070Sstevel@tonic-gate cfga_flags_t flags, int pflag); 4080Sstevel@tonic-gate scfga_ret_t scsi_rcm_offline(char **rsrclist, char **errstring, 4090Sstevel@tonic-gate cfga_flags_t flags); 4100Sstevel@tonic-gate scfga_ret_t scsi_rcm_online(char **rsrclist, char **errstring, 4110Sstevel@tonic-gate cfga_flags_t flags); 4120Sstevel@tonic-gate scfga_ret_t scsi_rcm_remove(char **rsrclist, char **errstring, 4130Sstevel@tonic-gate cfga_flags_t flags); 4140Sstevel@tonic-gate 4150Sstevel@tonic-gate 4160Sstevel@tonic-gate /* Utility routines */ 4170Sstevel@tonic-gate scfga_ret_t physpath_to_devlink(char *physpath, char **linkpp, int *l_errnop, 4180Sstevel@tonic-gate int match_minor); 4190Sstevel@tonic-gate scfga_ret_t apidt_create(const char *ap_id, apid_t *apidp, 4200Sstevel@tonic-gate char **errstring); 4210Sstevel@tonic-gate void apidt_free(apid_t *apidp); 4220Sstevel@tonic-gate cfga_err_t err_cvt(scfga_ret_t err); 4230Sstevel@tonic-gate void list_free(ldata_list_t **llpp); 4240Sstevel@tonic-gate int known_state(di_node_t node); 4250Sstevel@tonic-gate scfga_ret_t devctl_cmd(const char *ap_id, scfga_cmd_t cmd, 4260Sstevel@tonic-gate uint_t *statep, int *l_errnop); 427*10696SDavid.Hollister@Sun.COM scfga_ret_t path_apid_state_change(apid_t *apidp, scfga_cmd_t cmd, 428*10696SDavid.Hollister@Sun.COM cfga_flags_t flags, char **errstring, int *l_errnop, msgid_t errid); 4290Sstevel@tonic-gate scfga_ret_t invoke_cmd(const char *func, apid_t *apidt, prompt_t *prp, 4300Sstevel@tonic-gate cfga_flags_t flags, char **errstring); 4310Sstevel@tonic-gate 4320Sstevel@tonic-gate void cfga_err(char **errstring, int use_errno, ...); 4330Sstevel@tonic-gate void cfga_msg(struct cfga_msg *msgp, ...); 4341957Sdnielsen void cfga_led_msg(struct cfga_msg *msgp, apid_t *apidp, led_strid_t, 4351957Sdnielsen led_modeid_t); 4360Sstevel@tonic-gate char *cfga_str(int append_newline, ...); 4370Sstevel@tonic-gate int msg_idx(msgid_t msgid); 4380Sstevel@tonic-gate scfga_ret_t walk_tree(const char *physpath, void *arg, uint_t init_flags, 4390Sstevel@tonic-gate walkarg_t *up, scfga_cmd_t cmd, int *l_errnop); 4400Sstevel@tonic-gate int hba_dev_cmp(const char *hba, const char *dev); 4410Sstevel@tonic-gate int dev_cmp(const char *dev1, const char *dev2, int match_minor); 4420Sstevel@tonic-gate 4430Sstevel@tonic-gate extern msgcvt_t str_tbl[]; 4440Sstevel@tonic-gate 4450Sstevel@tonic-gate #ifdef __cplusplus 4460Sstevel@tonic-gate } 4470Sstevel@tonic-gate #endif 4480Sstevel@tonic-gate 4490Sstevel@tonic-gate #endif /* _CFGA_SCSI_H */ 450