1*1708Sstevel /* 2*1708Sstevel * CDDL HEADER START 3*1708Sstevel * 4*1708Sstevel * The contents of this file are subject to the terms of the 5*1708Sstevel * Common Development and Distribution License, Version 1.0 only 6*1708Sstevel * (the "License"). You may not use this file except in compliance 7*1708Sstevel * with the License. 8*1708Sstevel * 9*1708Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*1708Sstevel * or http://www.opensolaris.org/os/licensing. 11*1708Sstevel * See the License for the specific language governing permissions 12*1708Sstevel * and limitations under the License. 13*1708Sstevel * 14*1708Sstevel * When distributing Covered Code, include this CDDL HEADER in each 15*1708Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*1708Sstevel * If applicable, add the following below this CDDL HEADER, with the 17*1708Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 18*1708Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 19*1708Sstevel * 20*1708Sstevel * CDDL HEADER END 21*1708Sstevel */ 22*1708Sstevel /* 23*1708Sstevel * Copyright (c) 1999-2000 by Sun Microsystems, Inc. 24*1708Sstevel * All rights reserved. 25*1708Sstevel */ 26*1708Sstevel 27*1708Sstevel #ifndef _MONTECARLO_SYS_HSCIMPL_H 28*1708Sstevel #define _MONTECARLO_SYS_HSCIMPL_H 29*1708Sstevel 30*1708Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*1708Sstevel 32*1708Sstevel #ifdef __cplusplus 33*1708Sstevel extern "C" { 34*1708Sstevel #endif 35*1708Sstevel 36*1708Sstevel #include <sys/types.h> 37*1708Sstevel #include <sys/hotplug/hpctrl.h> 38*1708Sstevel 39*1708Sstevel /* 40*1708Sstevel * Flag values 41*1708Sstevel */ 42*1708Sstevel #define HSC_ENABLED 0x1 /* if not enabled, slot unmanaged */ 43*1708Sstevel #define HSC_AUTOCFG 0x2 /* if set, ENUM# events will be sent */ 44*1708Sstevel #define HSC_REGISTERED HSC_ENABLED 45*1708Sstevel #define HSC_ALARM_CARD_PRES 0x4 /* Alarm Card on this slot */ 46*1708Sstevel #define HSC_BOARD_TYPE_HS 0x8 47*1708Sstevel #define HSC_BOARD_TYPE_UNKNOWN 0x10 48*1708Sstevel #define HSC_SLOT_ENABLED 0x20 49*1708Sstevel #define HSC_SLOT_BAD_STATE 0x40 /* Surprise Removal on this slot */ 50*1708Sstevel #define HSC_ENUM_FAILED 0x80 /* Could not Enumerate this slot */ 51*1708Sstevel #define HSC_SCB_HOTSWAPPED 0x100 /* slot status change due to SCB swap */ 52*1708Sstevel #define HSC_HOTSWAP_MODE_BASIC 0 53*1708Sstevel #define HSC_HOTSWAP_MODE_FULL 1 54*1708Sstevel 55*1708Sstevel 56*1708Sstevel typedef struct hsc_slot_state { 57*1708Sstevel int pslotnum; 58*1708Sstevel int state; 59*1708Sstevel } hsc_slot_state_t; 60*1708Sstevel 61*1708Sstevel typedef struct hsc_slot_table { 62*1708Sstevel char nexus[128]; 63*1708Sstevel int pci_devno; 64*1708Sstevel int pslotnum; 65*1708Sstevel int ga; 66*1708Sstevel } hsc_slot_table_t; 67*1708Sstevel 68*1708Sstevel typedef struct hsc_prom_slot_table { 69*1708Sstevel int phandle; 70*1708Sstevel int pci_devno; 71*1708Sstevel int pslotnum; 72*1708Sstevel int ga; 73*1708Sstevel } hsc_prom_slot_table_t; 74*1708Sstevel 75*1708Sstevel typedef struct hsc_state { 76*1708Sstevel int instance; 77*1708Sstevel int state; 78*1708Sstevel dev_info_t *dip; 79*1708Sstevel void *scsb_handle; 80*1708Sstevel struct hsc_slot *hsp_last; /* last board plugged in. */ 81*1708Sstevel hsc_slot_table_t *slot_table_prop; 82*1708Sstevel int slot_table_size; 83*1708Sstevel int hsc_intr_counter; 84*1708Sstevel kmutex_t hsc_mutex; 85*1708Sstevel ddi_iblock_cookie_t enum_iblock; 86*1708Sstevel boolean_t regDone; 87*1708Sstevel int n_registered_occupants; 88*1708Sstevel int hotswap_mode; 89*1708Sstevel } hsc_state_t; 90*1708Sstevel 91*1708Sstevel /* 92*1708Sstevel * This struct describes a HS slot known to us. It maintains 93*1708Sstevel * all the state associated with the slot. 94*1708Sstevel * Slots are placed on a linked list. 95*1708Sstevel */ 96*1708Sstevel typedef struct hsc_slot { 97*1708Sstevel struct hsc_slot *hs_next; 98*1708Sstevel 99*1708Sstevel void *hs_hpchandle; /* HPC (scsb) handle */ 100*1708Sstevel 101*1708Sstevel /* 102*1708Sstevel * The hs_slot_number identifies the plysical slot. 103*1708Sstevel * It should match with the documentation. 104*1708Sstevel */ 105*1708Sstevel int hs_slot_number; 106*1708Sstevel 107*1708Sstevel hpc_slot_info_t hs_info; 108*1708Sstevel 109*1708Sstevel hpc_board_type_t hs_board_type; 110*1708Sstevel /* 111*1708Sstevel * We only have 2 LEDs/slot on MonteCarlo, so we map them 112*1708Sstevel * to the ACTIVE and FAULT ones. 113*1708Sstevel * ACTIVE will be set when a board is in the slot, and has 114*1708Sstevel * been configured. 115*1708Sstevel */ 116*1708Sstevel hpc_led_state_t hs_active_led_state; 117*1708Sstevel hpc_led_state_t hs_fault_led_state; 118*1708Sstevel 119*1708Sstevel /* 120*1708Sstevel * hs_slot_handle is useful for supporting ENUM# 121*1708Sstevel * (when we need to inform the nexus of the event). 122*1708Sstevel */ 123*1708Sstevel hpc_slot_t hs_slot_handle; 124*1708Sstevel 125*1708Sstevel uint_t hs_flags; 126*1708Sstevel 127*1708Sstevel boolean_t hs_board_configured; 128*1708Sstevel boolean_t hs_board_configuring; 129*1708Sstevel boolean_t hs_board_unconfiguring; 130*1708Sstevel boolean_t hs_board_healthy; 131*1708Sstevel 132*1708Sstevel /* 133*1708Sstevel * The hs_slot_state is useful for HW-connection control 134*1708Sstevel */ 135*1708Sstevel hpc_slot_state_t hs_slot_state; 136*1708Sstevel hsc_state_t *hsc; /* pointer to our controller device */ 137*1708Sstevel } hsc_slot_t; 138*1708Sstevel 139*1708Sstevel /* state values in our control structure */ 140*1708Sstevel #define HSC_ENUM_ENABLED 1 141*1708Sstevel #define HSC_ATTACHED 2 142*1708Sstevel #define HSC_SCB_CONNECTED 4 143*1708Sstevel 144*1708Sstevel #ifdef __cplusplus 145*1708Sstevel } 146*1708Sstevel #endif 147*1708Sstevel 148*1708Sstevel #endif /* _MONTECARLO_SYS_HSCIMPL_H */ 149