1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 24*0Sstevel@tonic-gate * Use is subject to license terms. 25*0Sstevel@tonic-gate */ 26*0Sstevel@tonic-gate 27*0Sstevel@tonic-gate #ifndef _SYS_DR_H 28*0Sstevel@tonic-gate #define _SYS_DR_H 29*0Sstevel@tonic-gate 30*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 31*0Sstevel@tonic-gate 32*0Sstevel@tonic-gate #ifdef __cplusplus 33*0Sstevel@tonic-gate extern "C" { 34*0Sstevel@tonic-gate #endif 35*0Sstevel@tonic-gate 36*0Sstevel@tonic-gate #include <sys/types.h> 37*0Sstevel@tonic-gate #include <sys/processor.h> 38*0Sstevel@tonic-gate #include <sys/obpdefs.h> 39*0Sstevel@tonic-gate #include <sys/memlist.h> 40*0Sstevel@tonic-gate #include <sys/sbd_ioctl.h> 41*0Sstevel@tonic-gate #include <sys/mem_config.h> 42*0Sstevel@tonic-gate #include <sys/dr_util.h> 43*0Sstevel@tonic-gate #include <sys/drmach.h> 44*0Sstevel@tonic-gate #include <sys/param.h> /* for MAXPATHLEN */ 45*0Sstevel@tonic-gate #include <sys/varargs.h> 46*0Sstevel@tonic-gate #include <sys/note.h> 47*0Sstevel@tonic-gate 48*0Sstevel@tonic-gate #define DR_MAXNUM_NT 3 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate /* used to map sbd_comp_type_t to array index */ 51*0Sstevel@tonic-gate #define NIX(t) \ 52*0Sstevel@tonic-gate (((t) == SBD_COMP_CPU) ? 0 : \ 53*0Sstevel@tonic-gate ((t) == SBD_COMP_MEM) ? 1 : \ 54*0Sstevel@tonic-gate ((t) == SBD_COMP_IO) ? 2 : \ 55*0Sstevel@tonic-gate ((t) == SBD_COMP_CMP) ? 0 : DR_MAXNUM_NT) 56*0Sstevel@tonic-gate 57*0Sstevel@tonic-gate /* 58*0Sstevel@tonic-gate * helper macros for constructing and reporting internal error messages. 59*0Sstevel@tonic-gate * NOTE: each module which uses one or more this these macros is expected 60*0Sstevel@tonic-gate * to supply a char *dr_ie_fmt string containing the SCCS filename 61*0Sstevel@tonic-gate * expansion macro (percent M percent) and a sprintf %d to render the 62*0Sstevel@tonic-gate * line number argument. 63*0Sstevel@tonic-gate */ 64*0Sstevel@tonic-gate #define DR_INTERNAL_ERROR(hp) \ 65*0Sstevel@tonic-gate drerr_new(1, ESBD_INTERNAL, dr_ie_fmt, __LINE__) 66*0Sstevel@tonic-gate 67*0Sstevel@tonic-gate #define DR_OP_INTERNAL_ERROR(hp) \ 68*0Sstevel@tonic-gate drerr_set_c(CE_WARN, &(hp)->h_err, \ 69*0Sstevel@tonic-gate ESBD_INTERNAL, dr_ie_fmt, __LINE__) 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #define DR_DEV_INTERNAL_ERROR(cp) \ 72*0Sstevel@tonic-gate drerr_set_c(CE_WARN, &(cp)->sbdev_error, \ 73*0Sstevel@tonic-gate ESBD_INTERNAL, dr_ie_fmt, __LINE__) 74*0Sstevel@tonic-gate 75*0Sstevel@tonic-gate /* 76*0Sstevel@tonic-gate * TODO: Simplify or get rid of this. 77*0Sstevel@tonic-gate * Macros for keeping an error code and an associated list of integers. 78*0Sstevel@tonic-gate */ 79*0Sstevel@tonic-gate #define DR_MAX_ERR_INT (32) 80*0Sstevel@tonic-gate #define DR_GET_E_CODE(sep) ((sep)->e_code) 81*0Sstevel@tonic-gate #define DR_SET_E_CODE(sep, en) ((sep)->e_code = (en)) 82*0Sstevel@tonic-gate #define DR_GET_E_RSC(sep) ((sep)->e_rsc) 83*0Sstevel@tonic-gate 84*0Sstevel@tonic-gate /* 85*0Sstevel@tonic-gate * Format of dr_devset_t bit masks: 86*0Sstevel@tonic-gate * 87*0Sstevel@tonic-gate * 32 16 8 0 88*0Sstevel@tonic-gate * |....|....|....|IIII|....|...M|CCCC|CCCC| 89*0Sstevel@tonic-gate * 90*0Sstevel@tonic-gate * 1 = indicates respective component present/attached. 91*0Sstevel@tonic-gate * I = I/O, M = Memory, C = CPU. 92*0Sstevel@tonic-gate */ 93*0Sstevel@tonic-gate #define DEVSET_ANYUNIT (-1) 94*0Sstevel@tonic-gate #define _NT2DEVPOS(t, u) ((NIX(t) << 3) + (u)) 95*0Sstevel@tonic-gate #define _DEVSET_MASK 0x000f01ff 96*0Sstevel@tonic-gate #define _CMP_DEVSET_MASK 0x11 97*0Sstevel@tonic-gate #define DEVSET(t, u) \ 98*0Sstevel@tonic-gate (((u) == DEVSET_ANYUNIT) ? \ 99*0Sstevel@tonic-gate (dr_devset_t)((0xff << _NT2DEVPOS((t), 0)) & _DEVSET_MASK) : \ 100*0Sstevel@tonic-gate ((t) == SBD_COMP_CMP) ? \ 101*0Sstevel@tonic-gate (dr_devset_t)(_CMP_DEVSET_MASK << _NT2DEVPOS((t), (u))) : \ 102*0Sstevel@tonic-gate (dr_devset_t)(1 << _NT2DEVPOS((t), (u)))) 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate #define DEVSET_IN_SET(ds, t, u) (((ds) & DEVSET((t), (u))) != 0) 105*0Sstevel@tonic-gate #define DEVSET_ADD(ds, t, u) ((ds) |= DEVSET((t), (u))) 106*0Sstevel@tonic-gate #define DEVSET_DEL(ds, t, u) ((ds) &= ~DEVSET((t), (u))) 107*0Sstevel@tonic-gate #define DEVSET_GET_UNITSET(ds, t) \ 108*0Sstevel@tonic-gate (((ds) & DEVSET((t), DEVSET_ANYUNIT)) >> _NT2DEVPOS((t), 0)) 109*0Sstevel@tonic-gate 110*0Sstevel@tonic-gate /* 111*0Sstevel@tonic-gate * Ops for dr_board_t.b_dev_* 112*0Sstevel@tonic-gate */ 113*0Sstevel@tonic-gate #define DR_DEV_IS(ds, cp) DEVSET_IN_SET( \ 114*0Sstevel@tonic-gate (cp)->sbdev_bp->b_dev_##ds, \ 115*0Sstevel@tonic-gate (cp)->sbdev_type, \ 116*0Sstevel@tonic-gate (cp)->sbdev_unum) 117*0Sstevel@tonic-gate 118*0Sstevel@tonic-gate #define DR_DEV_ADD(ds, cp) DEVSET_ADD( \ 119*0Sstevel@tonic-gate (cp)->sbdev_bp->b_dev_##ds, \ 120*0Sstevel@tonic-gate (cp)->sbdev_type, \ 121*0Sstevel@tonic-gate (cp)->sbdev_unum) 122*0Sstevel@tonic-gate 123*0Sstevel@tonic-gate #define DR_DEV_DEL(ds, cp) DEVSET_DEL( \ 124*0Sstevel@tonic-gate (cp)->sbdev_bp->b_dev_##ds, \ 125*0Sstevel@tonic-gate (cp)->sbdev_type, \ 126*0Sstevel@tonic-gate (cp)->sbdev_unum) 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate /* 129*0Sstevel@tonic-gate * Ops for dr_board_t.b_dev_present 130*0Sstevel@tonic-gate */ 131*0Sstevel@tonic-gate #define DR_DEV_IS_PRESENT(cp) DR_DEV_IS(present, cp) 132*0Sstevel@tonic-gate #define DR_DEV_SET_PRESENT(cp) DR_DEV_ADD(present, cp) 133*0Sstevel@tonic-gate #define DR_DEV_CLR_PRESENT(cp) DR_DEV_DEL(present, cp) 134*0Sstevel@tonic-gate 135*0Sstevel@tonic-gate /* 136*0Sstevel@tonic-gate * Ops for dr_board_t.b_dev_attached 137*0Sstevel@tonic-gate */ 138*0Sstevel@tonic-gate #define DR_DEV_IS_ATTACHED(cp) DR_DEV_IS(attached, cp) 139*0Sstevel@tonic-gate #define DR_DEV_SET_ATTACHED(cp) DR_DEV_ADD(attached, cp) 140*0Sstevel@tonic-gate #define DR_DEV_CLR_ATTACHED(cp) DR_DEV_DEL(attached, cp) 141*0Sstevel@tonic-gate 142*0Sstevel@tonic-gate /* 143*0Sstevel@tonic-gate * Ops for dr_board_t.b_dev_released 144*0Sstevel@tonic-gate */ 145*0Sstevel@tonic-gate #define DR_DEV_IS_RELEASED(cp) DR_DEV_IS(released, cp) 146*0Sstevel@tonic-gate #define DR_DEV_SET_RELEASED(cp) DR_DEV_ADD(released, cp) 147*0Sstevel@tonic-gate #define DR_DEV_CLR_RELEASED(cp) DR_DEV_DEL(released, cp) 148*0Sstevel@tonic-gate 149*0Sstevel@tonic-gate /* 150*0Sstevel@tonic-gate * Ops for dr_board_t.b_dev_unreferenced 151*0Sstevel@tonic-gate */ 152*0Sstevel@tonic-gate #define DR_DEV_IS_UNREFERENCED(cp) DR_DEV_IS(unreferenced, cp) 153*0Sstevel@tonic-gate #define DR_DEV_SET_UNREFERENCED(cp) DR_DEV_ADD(unreferenced, cp) 154*0Sstevel@tonic-gate #define DR_DEV_CLR_UNREFERENCED(cp) DR_DEV_DEL(unreferenced, cp) 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate #define DR_DEVS_PRESENT(bp) \ 157*0Sstevel@tonic-gate ((bp)->b_dev_present) 158*0Sstevel@tonic-gate #define DR_DEVS_ATTACHED(bp) \ 159*0Sstevel@tonic-gate ((bp)->b_dev_attached) 160*0Sstevel@tonic-gate #define DR_DEVS_RELEASED(bp) \ 161*0Sstevel@tonic-gate ((bp)->b_dev_released) 162*0Sstevel@tonic-gate #define DR_DEVS_UNREFERENCED(bp) \ 163*0Sstevel@tonic-gate ((bp)->b_dev_unreferenced) 164*0Sstevel@tonic-gate #define DR_DEVS_UNATTACHED(bp) \ 165*0Sstevel@tonic-gate ((bp)->b_dev_present & ~(bp)->b_dev_attached) 166*0Sstevel@tonic-gate #define DR_DEVS_CONFIGURE(bp, devs) \ 167*0Sstevel@tonic-gate ((bp)->b_dev_attached = (devs)) 168*0Sstevel@tonic-gate #define DR_DEVS_DISCONNECT(bp, devs) \ 169*0Sstevel@tonic-gate ((bp)->b_dev_present &= ~(devs)) 170*0Sstevel@tonic-gate #define DR_DEVS_CANCEL(bp, devs) \ 171*0Sstevel@tonic-gate ((bp)->b_dev_released &= ~(devs), \ 172*0Sstevel@tonic-gate (bp)->b_dev_unreferenced &= ~(devs)) 173*0Sstevel@tonic-gate 174*0Sstevel@tonic-gate /* 175*0Sstevel@tonic-gate * CMP Specific Helpers 176*0Sstevel@tonic-gate */ 177*0Sstevel@tonic-gate #define DR_CMP_CORE_UNUM(cmp, core) (cmp + (core * 4)) 178*0Sstevel@tonic-gate #define DR_UNUM2SBD_UNUM(unum) (unum & 0x3) 179*0Sstevel@tonic-gate 180*0Sstevel@tonic-gate /* 181*0Sstevel@tonic-gate * Some stuff to assist in debug. 182*0Sstevel@tonic-gate */ 183*0Sstevel@tonic-gate #ifdef DEBUG 184*0Sstevel@tonic-gate #define DRDBG_STATE 0x00000001 185*0Sstevel@tonic-gate #define DRDBG_QR 0x00000002 186*0Sstevel@tonic-gate #define DRDBG_CPU 0x00000004 187*0Sstevel@tonic-gate #define DRDBG_MEM 0x00000008 188*0Sstevel@tonic-gate #define DRDBG_IO 0x00000010 189*0Sstevel@tonic-gate 190*0Sstevel@tonic-gate #define PR_ALL if (dr_debug) printf 191*0Sstevel@tonic-gate #define PR_STATE if (dr_debug & DRDBG_STATE) printf 192*0Sstevel@tonic-gate #define PR_QR if (dr_debug & DRDBG_QR) prom_printf 193*0Sstevel@tonic-gate #define PR_CPU if (dr_debug & DRDBG_CPU) printf 194*0Sstevel@tonic-gate #define PR_MEM if (dr_debug & DRDBG_MEM) printf 195*0Sstevel@tonic-gate #define PR_IO if (dr_debug & DRDBG_IO) printf 196*0Sstevel@tonic-gate #define PR_MEMLIST_DUMP if (dr_debug & DRDBG_MEM) MEMLIST_DUMP 197*0Sstevel@tonic-gate 198*0Sstevel@tonic-gate extern uint_t dr_debug; 199*0Sstevel@tonic-gate #else /* DEBUG */ 200*0Sstevel@tonic-gate #define PR_ALL _NOTE(CONSTANTCONDITION) if (0) printf 201*0Sstevel@tonic-gate #define PR_STATE PR_ALL 202*0Sstevel@tonic-gate #define PR_QR PR_ALL 203*0Sstevel@tonic-gate #define PR_CPU PR_ALL 204*0Sstevel@tonic-gate #define PR_MEM PR_ALL 205*0Sstevel@tonic-gate #define PR_IO PR_ALL 206*0Sstevel@tonic-gate #define PR_MEMLIST_DUMP _NOTE(CONSTANTCONDITION) if (0) MEMLIST_DUMP 207*0Sstevel@tonic-gate 208*0Sstevel@tonic-gate #endif /* DEBUG */ 209*0Sstevel@tonic-gate 210*0Sstevel@tonic-gate /* 211*0Sstevel@tonic-gate * dr_board_t b_sflags. 212*0Sstevel@tonic-gate */ 213*0Sstevel@tonic-gate #define DR_BSLOCK 0x01 /* for blocking status (protected by b_slock) */ 214*0Sstevel@tonic-gate 215*0Sstevel@tonic-gate typedef const char *fn_t; 216*0Sstevel@tonic-gate typedef uint32_t dr_devset_t; /* TODO: fix limitation */ 217*0Sstevel@tonic-gate 218*0Sstevel@tonic-gate /* 219*0Sstevel@tonic-gate * Unsafe devices based on dr.conf prop "unsupported-io-drivers" 220*0Sstevel@tonic-gate */ 221*0Sstevel@tonic-gate typedef struct { 222*0Sstevel@tonic-gate char **devnames; 223*0Sstevel@tonic-gate uint_t ndevs; 224*0Sstevel@tonic-gate } dr_unsafe_devs_t; 225*0Sstevel@tonic-gate 226*0Sstevel@tonic-gate /* 227*0Sstevel@tonic-gate * Device states. 228*0Sstevel@tonic-gate * PARTIAL state is really only relevant for board state. 229*0Sstevel@tonic-gate */ 230*0Sstevel@tonic-gate typedef enum { 231*0Sstevel@tonic-gate DR_STATE_EMPTY = 0, 232*0Sstevel@tonic-gate DR_STATE_OCCUPIED, 233*0Sstevel@tonic-gate DR_STATE_CONNECTED, 234*0Sstevel@tonic-gate DR_STATE_UNCONFIGURED, 235*0Sstevel@tonic-gate DR_STATE_PARTIAL, /* part connected, part configured */ 236*0Sstevel@tonic-gate DR_STATE_CONFIGURED, 237*0Sstevel@tonic-gate DR_STATE_RELEASE, 238*0Sstevel@tonic-gate DR_STATE_UNREFERENCED, 239*0Sstevel@tonic-gate DR_STATE_FATAL, 240*0Sstevel@tonic-gate DR_STATE_MAX 241*0Sstevel@tonic-gate } dr_state_t; 242*0Sstevel@tonic-gate 243*0Sstevel@tonic-gate typedef struct dr_handle { 244*0Sstevel@tonic-gate struct dr_board *h_bd; 245*0Sstevel@tonic-gate sbd_error_t *h_err; 246*0Sstevel@tonic-gate int h_op_intr; /* nz if op interrupted */ 247*0Sstevel@tonic-gate dev_t h_dev; /* dev_t of opened device */ 248*0Sstevel@tonic-gate int h_cmd; /* PIM ioctl argument */ 249*0Sstevel@tonic-gate int h_mode; /* device open mode */ 250*0Sstevel@tonic-gate sbd_cmd_t h_sbdcmd; /* copied-in ioctl cmd struct */ 251*0Sstevel@tonic-gate sbd_ioctl_arg_t *h_iap; /* ptr to caller-space cmd struct */ 252*0Sstevel@tonic-gate dr_devset_t h_devset; /* based on h_dev */ 253*0Sstevel@tonic-gate uint_t h_ndi; 254*0Sstevel@tonic-gate drmach_opts_t h_opts; /* command-line platform options */ 255*0Sstevel@tonic-gate } dr_handle_t; 256*0Sstevel@tonic-gate 257*0Sstevel@tonic-gate typedef struct dr_common_unit { 258*0Sstevel@tonic-gate dr_state_t sbdev_state; 259*0Sstevel@tonic-gate sbd_state_t sbdev_ostate; 260*0Sstevel@tonic-gate sbd_cond_t sbdev_cond; 261*0Sstevel@tonic-gate time_t sbdev_time; 262*0Sstevel@tonic-gate int sbdev_busy; 263*0Sstevel@tonic-gate struct dr_board *sbdev_bp; 264*0Sstevel@tonic-gate int sbdev_unum; 265*0Sstevel@tonic-gate sbd_comp_type_t sbdev_type; 266*0Sstevel@tonic-gate drmachid_t sbdev_id; 267*0Sstevel@tonic-gate char sbdev_path[MAXNAMELEN]; 268*0Sstevel@tonic-gate sbd_error_t *sbdev_error; 269*0Sstevel@tonic-gate } dr_common_unit_t; 270*0Sstevel@tonic-gate 271*0Sstevel@tonic-gate typedef struct dr_mem_unit { 272*0Sstevel@tonic-gate dr_common_unit_t sbm_cm; /* mem-unit state */ 273*0Sstevel@tonic-gate uint_t sbm_flags; 274*0Sstevel@tonic-gate pfn_t sbm_basepfn; 275*0Sstevel@tonic-gate pgcnt_t sbm_npages; 276*0Sstevel@tonic-gate pgcnt_t sbm_pageslost; 277*0Sstevel@tonic-gate struct memlist *sbm_dyn_segs; /* kphysm_add_dynamic segs */ 278*0Sstevel@tonic-gate /* 279*0Sstevel@tonic-gate * The following fields are used during 280*0Sstevel@tonic-gate * the memory detach process only. sbm_mlist 281*0Sstevel@tonic-gate * will be used to store the board memlist 282*0Sstevel@tonic-gate * following a detach. The memlist will be 283*0Sstevel@tonic-gate * used to re-attach the board when configuring 284*0Sstevel@tonic-gate * the unit directly after an unconfigure. 285*0Sstevel@tonic-gate */ 286*0Sstevel@tonic-gate struct dr_mem_unit *sbm_peer; 287*0Sstevel@tonic-gate struct memlist *sbm_mlist; 288*0Sstevel@tonic-gate struct memlist *sbm_del_mlist; 289*0Sstevel@tonic-gate memhandle_t sbm_memhandle; 290*0Sstevel@tonic-gate pfn_t sbm_alignment_mask; 291*0Sstevel@tonic-gate pfn_t sbm_slice_offset; 292*0Sstevel@tonic-gate uint64_t sbm_slice_size; 293*0Sstevel@tonic-gate } dr_mem_unit_t; 294*0Sstevel@tonic-gate 295*0Sstevel@tonic-gate /* 296*0Sstevel@tonic-gate * Currently only maintain state information for individual 297*0Sstevel@tonic-gate * components. 298*0Sstevel@tonic-gate */ 299*0Sstevel@tonic-gate typedef struct dr_cpu_unit { 300*0Sstevel@tonic-gate dr_common_unit_t sbc_cm; /* cpu-unit state */ 301*0Sstevel@tonic-gate processorid_t sbc_cpu_id; 302*0Sstevel@tonic-gate cpu_flag_t sbc_cpu_flags; /* snapshot of CPU flags */ 303*0Sstevel@tonic-gate ushort_t sbc_pad1; /* padded for compatibility */ 304*0Sstevel@tonic-gate int sbc_speed; 305*0Sstevel@tonic-gate int sbc_ecache; 306*0Sstevel@tonic-gate int sbc_cpu_impl; 307*0Sstevel@tonic-gate } dr_cpu_unit_t; 308*0Sstevel@tonic-gate 309*0Sstevel@tonic-gate typedef struct dr_io_unit { 310*0Sstevel@tonic-gate dr_common_unit_t sbi_cm; /* io-unit state */ 311*0Sstevel@tonic-gate } dr_io_unit_t; 312*0Sstevel@tonic-gate 313*0Sstevel@tonic-gate typedef union { 314*0Sstevel@tonic-gate dr_common_unit_t du_common; 315*0Sstevel@tonic-gate dr_mem_unit_t du_mem; 316*0Sstevel@tonic-gate dr_cpu_unit_t du_cpu; 317*0Sstevel@tonic-gate dr_io_unit_t du_io; 318*0Sstevel@tonic-gate } dr_dev_unit_t; 319*0Sstevel@tonic-gate 320*0Sstevel@tonic-gate typedef struct dr_board { 321*0Sstevel@tonic-gate kmutex_t b_lock; /* lock for this board struct */ 322*0Sstevel@tonic-gate kmutex_t b_slock; /* lock for status on the board */ 323*0Sstevel@tonic-gate kcondvar_t b_scv; /* condvar for status on the board */ 324*0Sstevel@tonic-gate int b_sflags; /* for serializing status */ 325*0Sstevel@tonic-gate sbd_state_t b_rstate; /* board's cfgadm receptacle state */ 326*0Sstevel@tonic-gate sbd_state_t b_ostate; /* board's cfgadm occupant state */ 327*0Sstevel@tonic-gate sbd_cond_t b_cond; /* cfgadm condition */ 328*0Sstevel@tonic-gate int b_busy; 329*0Sstevel@tonic-gate int b_assigned; 330*0Sstevel@tonic-gate time_t b_time; /* time of last board operation */ 331*0Sstevel@tonic-gate char b_type[MAXNAMELEN]; 332*0Sstevel@tonic-gate drmachid_t b_id; 333*0Sstevel@tonic-gate int b_num; /* board number */ 334*0Sstevel@tonic-gate int b_ndev; /* # of devices on board */ 335*0Sstevel@tonic-gate dev_info_t *b_dip; /* dip for make-nodes */ 336*0Sstevel@tonic-gate dr_state_t b_state; /* board DR state */ 337*0Sstevel@tonic-gate dr_devset_t b_dev_present; /* present mask */ 338*0Sstevel@tonic-gate dr_devset_t b_dev_attached; /* attached mask */ 339*0Sstevel@tonic-gate dr_devset_t b_dev_released; /* released mask */ 340*0Sstevel@tonic-gate dr_devset_t b_dev_unreferenced; /* unreferenced mask */ 341*0Sstevel@tonic-gate char b_path[MAXNAMELEN]; 342*0Sstevel@tonic-gate dr_dev_unit_t *b_dev[DR_MAXNUM_NT]; 343*0Sstevel@tonic-gate } dr_board_t; 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate /* 346*0Sstevel@tonic-gate * dr_quiesce.c interfaces 347*0Sstevel@tonic-gate */ 348*0Sstevel@tonic-gate struct dr_sr_handle; 349*0Sstevel@tonic-gate typedef struct dr_sr_handle dr_sr_handle_t; 350*0Sstevel@tonic-gate 351*0Sstevel@tonic-gate extern dr_sr_handle_t *dr_get_sr_handle(dr_handle_t *handle); 352*0Sstevel@tonic-gate extern void dr_release_sr_handle(dr_sr_handle_t *srh); 353*0Sstevel@tonic-gate extern int dr_suspend(dr_sr_handle_t *srh); 354*0Sstevel@tonic-gate extern void dr_resume(dr_sr_handle_t *srh); 355*0Sstevel@tonic-gate extern void dr_check_devices(dev_info_t *dip, int *refcount, 356*0Sstevel@tonic-gate dr_handle_t *handle, uint64_t *arr, 357*0Sstevel@tonic-gate int *idx, int len); 358*0Sstevel@tonic-gate extern int dr_pt_test_suspend(dr_handle_t *hp); 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate /* 361*0Sstevel@tonic-gate * dr_cpu.c interface 362*0Sstevel@tonic-gate */ 363*0Sstevel@tonic-gate extern void dr_init_cpu_unit(dr_cpu_unit_t *cp); 364*0Sstevel@tonic-gate extern int dr_pre_attach_cpu(dr_handle_t *hp, 365*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 366*0Sstevel@tonic-gate extern void dr_attach_cpu(dr_handle_t *hp, dr_common_unit_t *cp); 367*0Sstevel@tonic-gate extern int dr_post_attach_cpu(dr_handle_t *hp, 368*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 369*0Sstevel@tonic-gate extern int dr_pre_release_cpu(dr_handle_t *hp, 370*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 371*0Sstevel@tonic-gate extern int dr_pre_detach_cpu(dr_handle_t *hp, 372*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 373*0Sstevel@tonic-gate extern void dr_detach_cpu(dr_handle_t *hp, dr_common_unit_t *cp); 374*0Sstevel@tonic-gate extern int dr_post_detach_cpu(dr_handle_t *hp, 375*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 376*0Sstevel@tonic-gate extern int dr_cpu_status(dr_handle_t *hp, dr_devset_t devset, 377*0Sstevel@tonic-gate sbd_dev_stat_t *dsp); 378*0Sstevel@tonic-gate extern int dr_cancel_cpu(dr_cpu_unit_t *cp); 379*0Sstevel@tonic-gate extern int dr_disconnect_cpu(dr_cpu_unit_t *cp); 380*0Sstevel@tonic-gate 381*0Sstevel@tonic-gate 382*0Sstevel@tonic-gate /* 383*0Sstevel@tonic-gate * dr_mem.c interface 384*0Sstevel@tonic-gate */ 385*0Sstevel@tonic-gate extern void dr_init_mem_unit(dr_mem_unit_t *mp); 386*0Sstevel@tonic-gate extern int dr_pre_attach_mem(dr_handle_t *hp, 387*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 388*0Sstevel@tonic-gate extern void dr_attach_mem(dr_handle_t *hp, dr_common_unit_t *cp); 389*0Sstevel@tonic-gate extern int dr_post_attach_mem(dr_handle_t *hp, 390*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 391*0Sstevel@tonic-gate extern int dr_pre_release_mem(dr_handle_t *hp, 392*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 393*0Sstevel@tonic-gate extern void dr_release_mem(dr_common_unit_t *cp); 394*0Sstevel@tonic-gate extern void dr_release_mem_done(dr_common_unit_t *cp); 395*0Sstevel@tonic-gate extern int dr_pre_detach_mem(dr_handle_t *hp, 396*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 397*0Sstevel@tonic-gate extern void dr_detach_mem(dr_handle_t *, dr_common_unit_t *); 398*0Sstevel@tonic-gate extern int dr_post_detach_mem(dr_handle_t *hp, 399*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 400*0Sstevel@tonic-gate extern int dr_mem_status(dr_handle_t *hp, dr_devset_t devset, 401*0Sstevel@tonic-gate sbd_dev_stat_t *dsp); 402*0Sstevel@tonic-gate extern int dr_cancel_mem(dr_mem_unit_t *mp); 403*0Sstevel@tonic-gate extern int dr_disconnect_mem(dr_mem_unit_t *mp); 404*0Sstevel@tonic-gate 405*0Sstevel@tonic-gate /* 406*0Sstevel@tonic-gate * dr_io.c interface 407*0Sstevel@tonic-gate */ 408*0Sstevel@tonic-gate extern void dr_init_io_unit(dr_io_unit_t *io); 409*0Sstevel@tonic-gate extern int dr_disconnect_io(dr_io_unit_t *ip); 410*0Sstevel@tonic-gate extern int dr_pre_attach_io(dr_handle_t *hp, 411*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 412*0Sstevel@tonic-gate extern void dr_attach_io(dr_handle_t *hp, dr_common_unit_t *cp); 413*0Sstevel@tonic-gate extern int dr_post_attach_io(dr_handle_t *hp, 414*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 415*0Sstevel@tonic-gate extern int dr_pre_release_io(dr_handle_t *hp, 416*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 417*0Sstevel@tonic-gate extern int dr_pre_detach_io(dr_handle_t *hp, 418*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 419*0Sstevel@tonic-gate extern void dr_detach_io(dr_handle_t *hp, dr_common_unit_t *cp); 420*0Sstevel@tonic-gate extern int dr_post_detach_io(dr_handle_t *hp, 421*0Sstevel@tonic-gate dr_common_unit_t **devlist, int devnum); 422*0Sstevel@tonic-gate extern int dr_io_status(dr_handle_t *hp, dr_devset_t devset, 423*0Sstevel@tonic-gate sbd_dev_stat_t *dsp); 424*0Sstevel@tonic-gate 425*0Sstevel@tonic-gate 426*0Sstevel@tonic-gate /* 427*0Sstevel@tonic-gate * dr.c interface 428*0Sstevel@tonic-gate */ 429*0Sstevel@tonic-gate extern void dr_op_err(int ce, dr_handle_t *hp, int code, char *fmt, ...); 430*0Sstevel@tonic-gate extern void dr_dev_err(int ce, dr_common_unit_t *cp, int code); 431*0Sstevel@tonic-gate 432*0Sstevel@tonic-gate extern dr_cpu_unit_t *dr_get_cpu_unit(dr_board_t *bp, int unit_num); 433*0Sstevel@tonic-gate extern dr_mem_unit_t *dr_get_mem_unit(dr_board_t *bp, int unit_num); 434*0Sstevel@tonic-gate extern dr_io_unit_t *dr_get_io_unit(dr_board_t *bp, int unit_num); 435*0Sstevel@tonic-gate 436*0Sstevel@tonic-gate extern dr_board_t *dr_lookup_board(int board_num); 437*0Sstevel@tonic-gate extern int dr_release_dev_done(dr_common_unit_t *cp); 438*0Sstevel@tonic-gate extern char *dr_nt_to_dev_type(int type); 439*0Sstevel@tonic-gate extern void dr_device_transition(dr_common_unit_t *cp, 440*0Sstevel@tonic-gate dr_state_t new_state); 441*0Sstevel@tonic-gate extern void dr_lock_status(dr_board_t *bp); 442*0Sstevel@tonic-gate extern void dr_unlock_status(dr_board_t *bp); 443*0Sstevel@tonic-gate extern int dr_cmd_flags(dr_handle_t *hp); 444*0Sstevel@tonic-gate 445*0Sstevel@tonic-gate #ifdef __cplusplus 446*0Sstevel@tonic-gate } 447*0Sstevel@tonic-gate #endif 448*0Sstevel@tonic-gate 449*0Sstevel@tonic-gate #endif /* _SYS_DR_H */ 450