1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 3*0Sstevel@tonic-gate * Use is subject to license terms. 4*0Sstevel@tonic-gate */ 5*0Sstevel@tonic-gate /* 6*0Sstevel@tonic-gate * Copyright (c) 1999,2000 Michael Smith 7*0Sstevel@tonic-gate * Copyright (c) 2000 BSDi 8*0Sstevel@tonic-gate * All rights reserved. 9*0Sstevel@tonic-gate * 10*0Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 11*0Sstevel@tonic-gate * modification, are permitted provided that the following conditions 12*0Sstevel@tonic-gate * are met: 13*0Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 14*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 15*0Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 16*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 17*0Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 18*0Sstevel@tonic-gate * 19*0Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 20*0Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21*0Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22*0Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 23*0Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24*0Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25*0Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26*0Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27*0Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28*0Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29*0Sstevel@tonic-gate * SUCH DAMAGE. 30*0Sstevel@tonic-gate * 31*0Sstevel@tonic-gate * Copyright (c) 2002 Eric Moore 32*0Sstevel@tonic-gate * Copyright (c) 2002 LSI Logic Corporation 33*0Sstevel@tonic-gate * All rights reserved. 34*0Sstevel@tonic-gate * 35*0Sstevel@tonic-gate * Redistribution and use in source and binary forms, with or without 36*0Sstevel@tonic-gate * modification, are permitted provided that the following conditions 37*0Sstevel@tonic-gate * are met: 38*0Sstevel@tonic-gate * 1. Redistributions of source code must retain the above copyright 39*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer. 40*0Sstevel@tonic-gate * 2. Redistributions in binary form must reproduce the above copyright 41*0Sstevel@tonic-gate * notice, this list of conditions and the following disclaimer in the 42*0Sstevel@tonic-gate * documentation and/or other materials provided with the distribution. 43*0Sstevel@tonic-gate * 3. The party using or redistributing the source code and binary forms 44*0Sstevel@tonic-gate * agrees to the disclaimer below and the terms and conditions set forth 45*0Sstevel@tonic-gate * herein. 46*0Sstevel@tonic-gate * 47*0Sstevel@tonic-gate * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 48*0Sstevel@tonic-gate * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 49*0Sstevel@tonic-gate * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 50*0Sstevel@tonic-gate * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 51*0Sstevel@tonic-gate * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 52*0Sstevel@tonic-gate * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 53*0Sstevel@tonic-gate * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 54*0Sstevel@tonic-gate * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 55*0Sstevel@tonic-gate * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 56*0Sstevel@tonic-gate * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 57*0Sstevel@tonic-gate * SUCH DAMAGE. 58*0Sstevel@tonic-gate */ 59*0Sstevel@tonic-gate 60*0Sstevel@tonic-gate /* 61*0Sstevel@tonic-gate * Note: If the structures and variables definitions can be found from the 62*0Sstevel@tonic-gate * "MegaRAID PCI SCSI Disk Array Controller F/W Technical Reference 63*0Sstevel@tonic-gate * Manual", the names defined in this documents will also be provided 64*0Sstevel@tonic-gate * by " ", and the descriptions for each variables and constants are 65*0Sstevel@tonic-gate * given as well. 66*0Sstevel@tonic-gate */ 67*0Sstevel@tonic-gate 68*0Sstevel@tonic-gate #ifndef _AMRREG_H 69*0Sstevel@tonic-gate #define _AMRREG_H 70*0Sstevel@tonic-gate 71*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 72*0Sstevel@tonic-gate 73*0Sstevel@tonic-gate #ifdef __cplusplus 74*0Sstevel@tonic-gate extern "C" { 75*0Sstevel@tonic-gate #endif 76*0Sstevel@tonic-gate 77*0Sstevel@tonic-gate #define AMR_NSEG 26 78*0Sstevel@tonic-gate #define AMR_MAX_STATUS_ACK 46 79*0Sstevel@tonic-gate 80*0Sstevel@tonic-gate #define AMR_MAXCMD 255 /* The last CMD is used for Poll only */ 81*0Sstevel@tonic-gate 82*0Sstevel@tonic-gate #define AMR_LIMITCMD 120 /* max count of outstanding commands */ 83*0Sstevel@tonic-gate #define AMR_MAXLD 40 84*0Sstevel@tonic-gate 85*0Sstevel@tonic-gate #define AMR_MAX_CHANNELS 4 86*0Sstevel@tonic-gate #define AMR_MAX_TARGETS 15 87*0Sstevel@tonic-gate #define AMR_MAX_LUNS 7 88*0Sstevel@tonic-gate #define AMR_MAX_SCSI_CMDS (AMR_MAX_CHANNELS * AMR_MAX_TARGETS) 89*0Sstevel@tonic-gate 90*0Sstevel@tonic-gate #define AMR_MAX_CDB_LEN 0x0a 91*0Sstevel@tonic-gate #define AMR_MAX_EXTCDB_LEN 0x10 92*0Sstevel@tonic-gate #define AMR_MAX_REQ_SENSE_LEN 0x20 93*0Sstevel@tonic-gate 94*0Sstevel@tonic-gate #define AMR_BLKSIZE 512 /* constant for all controllers */ 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate /* 97*0Sstevel@tonic-gate * Array constraints for controllers that support 8 logic drivers 98*0Sstevel@tonic-gate */ 99*0Sstevel@tonic-gate #define AMR_8LD_MAXDRIVES 8 100*0Sstevel@tonic-gate #define AMR_8LD_MAXCHAN 5 101*0Sstevel@tonic-gate #define AMR_8LD_MAXTARG 15 102*0Sstevel@tonic-gate #define AMR_8LD_MAXPHYSDRIVES (AMR_8LD_MAXCHAN * AMR_8LD_MAXTARG) 103*0Sstevel@tonic-gate 104*0Sstevel@tonic-gate /* 105*0Sstevel@tonic-gate * Array constraints for controllers that support 40 logic drivers 106*0Sstevel@tonic-gate */ 107*0Sstevel@tonic-gate #define AMR_40LD_MAXDRIVES 40 108*0Sstevel@tonic-gate #define AMR_40LD_MAXCHAN 16 109*0Sstevel@tonic-gate #define AMR_40LD_MAXTARG 16 110*0Sstevel@tonic-gate #define AMR_40LD_MAXPHYSDRIVES (AMR_40LD_MAXCHAN * AMR_40LD_MAXTARG) 111*0Sstevel@tonic-gate 112*0Sstevel@tonic-gate /* 113*0Sstevel@tonic-gate * The buffer size for enquiry command 114*0Sstevel@tonic-gate */ 115*0Sstevel@tonic-gate #define AMR_ENQ_BUFFER_SIZE sizeof (union amr_enq_buffer) 116*0Sstevel@tonic-gate 117*0Sstevel@tonic-gate /* 118*0Sstevel@tonic-gate * Constants used for poll command 119*0Sstevel@tonic-gate */ 120*0Sstevel@tonic-gate #define AMR_POLL_COMMAND_ID 0xfe 121*0Sstevel@tonic-gate #define AMR_POLL_DEFAULT_NSTATUS 0xff 122*0Sstevel@tonic-gate #define AMR_POLL_DEFAULT_STATUS 0xff 123*0Sstevel@tonic-gate #define AMR_POLL_ACK 0x77 124*0Sstevel@tonic-gate 125*0Sstevel@tonic-gate #pragma pack(1) 126*0Sstevel@tonic-gate 127*0Sstevel@tonic-gate /* 128*0Sstevel@tonic-gate * The AMR mailbox. This is the main interface for 129*0Sstevel@tonic-gate * programming the controller. Must be aligned at 130*0Sstevel@tonic-gate * a 16-Byte physical address boundary. 131*0Sstevel@tonic-gate * 132*0Sstevel@tonic-gate * The first sixteen bytes are commands to the controller. 133*0Sstevel@tonic-gate * 134*0Sstevel@tonic-gate * There are two formats: 135*0Sstevel@tonic-gate * 1. Commands for I/O: mb_blkcount/mb_lba are used. 136*0Sstevel@tonic-gate * 2. Commands for I/O control: mb_channel/mb_param are used. 137*0Sstevel@tonic-gate * 138*0Sstevel@tonic-gate */ 139*0Sstevel@tonic-gate 140*0Sstevel@tonic-gate struct amr_mailbox 141*0Sstevel@tonic-gate { 142*0Sstevel@tonic-gate uint8_t mb_command; /* "Command", OUT, the op */ 143*0Sstevel@tonic-gate /* code of the command */ 144*0Sstevel@tonic-gate uint8_t mb_ident; /* "CommandID", OUT, the */ 145*0Sstevel@tonic-gate /* id for this command */ 146*0Sstevel@tonic-gate union { 147*0Sstevel@tonic-gate uint16_t mbu_blkcount; /* "NoOfSectors", OUT, the */ 148*0Sstevel@tonic-gate /* number of sectors for */ 149*0Sstevel@tonic-gate /* this request */ 150*0Sstevel@tonic-gate uint8_t mbu_chparam[2]; /* "Channel" and "Param", */ 151*0Sstevel@tonic-gate /* OUT, Channel No. and */ 152*0Sstevel@tonic-gate /* parameters */ 153*0Sstevel@tonic-gate } mb_un1; 154*0Sstevel@tonic-gate union { 155*0Sstevel@tonic-gate uint32_t mbu_lba; /* "Lba", OUT, the starting */ 156*0Sstevel@tonic-gate /* LBA for this request */ 157*0Sstevel@tonic-gate uint8_t mbu_pad[4]; 158*0Sstevel@tonic-gate } mb_un2; 159*0Sstevel@tonic-gate uint32_t mb_physaddr; /* "DataTransferAddress", OUT */ 160*0Sstevel@tonic-gate /* physical address for a */ 161*0Sstevel@tonic-gate /* non-s/g command or the */ 162*0Sstevel@tonic-gate /* physical address of a s/g */ 163*0Sstevel@tonic-gate /* list for a s/g command */ 164*0Sstevel@tonic-gate uint8_t mb_drive; /* "LogicalDriveNumber", OUT, */ 165*0Sstevel@tonic-gate /* the log-drive for which */ 166*0Sstevel@tonic-gate /* this request is intended */ 167*0Sstevel@tonic-gate uint8_t mb_nsgelem; /* "NoSGElements", OUT, */ 168*0Sstevel@tonic-gate /* number of s/g elements */ 169*0Sstevel@tonic-gate uint8_t res1; 170*0Sstevel@tonic-gate uint8_t mb_busy; /* "mailboxBusy", INOUT, set */ 171*0Sstevel@tonic-gate /* to 1 before submit the */ 172*0Sstevel@tonic-gate /* command, firmware picks */ 173*0Sstevel@tonic-gate /* it and makes this byte 0 */ 174*0Sstevel@tonic-gate uint8_t mb_nstatus; /* "NoOfStatus", IN, the */ 175*0Sstevel@tonic-gate /* number of status returned */ 176*0Sstevel@tonic-gate /* by firmware */ 177*0Sstevel@tonic-gate uint8_t mb_status; /* "Status", IN, status for */ 178*0Sstevel@tonic-gate /* the IDs in mb_completed[] */ 179*0Sstevel@tonic-gate uint8_t mb_completed[AMR_MAX_STATUS_ACK]; 180*0Sstevel@tonic-gate /* "CompletedIdList", IN, */ 181*0Sstevel@tonic-gate /* finished ID list */ 182*0Sstevel@tonic-gate uint8_t mb_poll; /* "Mraid_poll", IN, used for */ 183*0Sstevel@tonic-gate /* polling/interrupt-driven */ 184*0Sstevel@tonic-gate uint8_t mb_ack; /* "Mraid_ack", IN, used for */ 185*0Sstevel@tonic-gate /* polling/interrupt-driver */ 186*0Sstevel@tonic-gate uint8_t res2[16]; 187*0Sstevel@tonic-gate }; 188*0Sstevel@tonic-gate 189*0Sstevel@tonic-gate /* Fields before mb_nstatus are the portions worth copying for controller */ 190*0Sstevel@tonic-gate #define AMR_MBOX_CMDSIZE (size_t)(&((struct amr_mailbox *)(NULL))->mb_nstatus) 191*0Sstevel@tonic-gate 192*0Sstevel@tonic-gate #define mb_blkcount mb_un1.mbu_blkcount 193*0Sstevel@tonic-gate #define mb_channel mb_un1.mbu_chparam[0] 194*0Sstevel@tonic-gate #define mb_param mb_un1.mbu_chparam[1] 195*0Sstevel@tonic-gate #define mb_cmdsub mb_un1.mbu_chparam[0] 196*0Sstevel@tonic-gate #define mb_cmdqual mb_un1.mbu_chparam[1] 197*0Sstevel@tonic-gate #define mb_lba mb_un2.mbu_lba 198*0Sstevel@tonic-gate 199*0Sstevel@tonic-gate /* 200*0Sstevel@tonic-gate * I/O commands expect the physical address of an array 201*0Sstevel@tonic-gate * of no more than AMR_NSEGS of scatter/gather table entries 202*0Sstevel@tonic-gate * in mb_physaddr. 203*0Sstevel@tonic-gate * 204*0Sstevel@tonic-gate * sg_addr is a physical address. 205*0Sstevel@tonic-gate */ 206*0Sstevel@tonic-gate struct amr_sgentry 207*0Sstevel@tonic-gate { 208*0Sstevel@tonic-gate uint32_t sg_addr; 209*0Sstevel@tonic-gate uint32_t sg_count; 210*0Sstevel@tonic-gate }; 211*0Sstevel@tonic-gate 212*0Sstevel@tonic-gate /* 213*0Sstevel@tonic-gate * Mailbox commands 214*0Sstevel@tonic-gate * Note: This is a subset for the command set 215*0Sstevel@tonic-gate */ 216*0Sstevel@tonic-gate #define AMR_CMD_LREAD 0x01 217*0Sstevel@tonic-gate #define AMR_CMD_LWRITE 0x02 218*0Sstevel@tonic-gate #define AMR_CMD_PASS 0x03 219*0Sstevel@tonic-gate #define AMR_CMD_EXT_ENQUIRY 0x04 220*0Sstevel@tonic-gate #define AMR_CMD_ENQUIRY 0x05 221*0Sstevel@tonic-gate #define AMR_CMD_FLUSH 0x0a 222*0Sstevel@tonic-gate #define AMR_CMD_EXT_ENQUIRY2 0x0c 223*0Sstevel@tonic-gate #define AMR_CMD_GET_MACHINEID 0x36 224*0Sstevel@tonic-gate #define AMR_CMD_GET_INITIATOR 0x7d 225*0Sstevel@tonic-gate #define AMR_CMD_RESET_ADAPTER 0x96 226*0Sstevel@tonic-gate #define AMR_CMD_CONFIG 0xa1 227*0Sstevel@tonic-gate #define AMR_CMD_MISC_OPCODE 0xa4 228*0Sstevel@tonic-gate #define AMR_CMD_EXTPASS 0xe3 229*0Sstevel@tonic-gate 230*0Sstevel@tonic-gate /* 231*0Sstevel@tonic-gate * Subcodes for AMR_CMD_CONFIG 232*0Sstevel@tonic-gate */ 233*0Sstevel@tonic-gate #define AMR_CONFIG_PRODUCT_INFO 0x0e 234*0Sstevel@tonic-gate #define AMR_CONFIG_ENQ3 0x0f 235*0Sstevel@tonic-gate #define AMR_CONFIG_ENQ3_SOLICITED_NOTIFY 0x01 236*0Sstevel@tonic-gate #define AMR_CONFIG_ENQ3_SOLICITED_FULL 0x02 237*0Sstevel@tonic-gate #define AMR_CONFIG_ENQ3_UNSOLICITED 0x03 238*0Sstevel@tonic-gate 239*0Sstevel@tonic-gate /* 240*0Sstevel@tonic-gate * Subcodes for AMR_CMD_MISC_OPCODE 241*0Sstevel@tonic-gate */ 242*0Sstevel@tonic-gate #define AMR_MISC_CDB_QUERY 0x16 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gate /* 245*0Sstevel@tonic-gate * Mailbox command results 246*0Sstevel@tonic-gate */ 247*0Sstevel@tonic-gate #define AMR_STATUS_SUCCESS 0x00 248*0Sstevel@tonic-gate #define AMR_STATUS_ABORTED 0x02 249*0Sstevel@tonic-gate #define AMR_STATUS_FAILED 0x80 250*0Sstevel@tonic-gate 251*0Sstevel@tonic-gate /* 252*0Sstevel@tonic-gate * Adapter Info structure 253*0Sstevel@tonic-gate */ 254*0Sstevel@tonic-gate struct amr_adapter_info 255*0Sstevel@tonic-gate { 256*0Sstevel@tonic-gate uint8_t aa_maxio; /* "MaxConcCmds", concurrent */ 257*0Sstevel@tonic-gate /* commands supported */ 258*0Sstevel@tonic-gate uint8_t aa_rebuild_rate; /* "RbldRate", rebuild rate, */ 259*0Sstevel@tonic-gate /* varies from 0%-100% */ 260*0Sstevel@tonic-gate uint8_t aa_maxtargchan; /* "MaxTargPerChan", targets */ 261*0Sstevel@tonic-gate /* supported per chan */ 262*0Sstevel@tonic-gate uint8_t aa_channels; /* "ChanPresent", No. of */ 263*0Sstevel@tonic-gate /* Chans present on this */ 264*0Sstevel@tonic-gate /* adapter */ 265*0Sstevel@tonic-gate uint8_t aa_firmware[4]; /* "FwVer", firmware version */ 266*0Sstevel@tonic-gate uint16_t aa_flashage; /* "AgeOfFlash", No. of times */ 267*0Sstevel@tonic-gate /* FW has been downloaded */ 268*0Sstevel@tonic-gate uint8_t aa_chipsetvalue; /* "ChipSetValue", contents */ 269*0Sstevel@tonic-gate /* of 0xC0000832 */ 270*0Sstevel@tonic-gate uint8_t aa_memorysize; /* "DramSize", in terms of MB */ 271*0Sstevel@tonic-gate uint8_t aa_cacheflush; /* "CacheFlushInterval", in */ 272*0Sstevel@tonic-gate /* terms of Seconds */ 273*0Sstevel@tonic-gate uint8_t aa_bios[4]; /* "BiosVersion", Bios ver */ 274*0Sstevel@tonic-gate uint8_t aa_boardtype; /* "BoardType", board type */ 275*0Sstevel@tonic-gate uint8_t aa_scsisensealert; /* "sense_alert" */ 276*0Sstevel@tonic-gate uint8_t aa_writeconfigcount; /* "write_config_count", */ 277*0Sstevel@tonic-gate /* increase with evry */ 278*0Sstevel@tonic-gate /* configuration change */ 279*0Sstevel@tonic-gate uint8_t aa_driveinsertioncount; /* "drive_inserted_count", */ 280*0Sstevel@tonic-gate /* increase with every drive */ 281*0Sstevel@tonic-gate /* inserted */ 282*0Sstevel@tonic-gate uint8_t aa_inserteddrive; /* "inserted_drive", Chan:Id */ 283*0Sstevel@tonic-gate /* of inserted drive */ 284*0Sstevel@tonic-gate uint8_t aa_batterystatus; /* "battery_status", battery */ 285*0Sstevel@tonic-gate /* status */ 286*0Sstevel@tonic-gate uint8_t res1; /* "dec_fault_bus_info", was */ 287*0Sstevel@tonic-gate /* reserved */ 288*0Sstevel@tonic-gate }; 289*0Sstevel@tonic-gate 290*0Sstevel@tonic-gate /* 291*0Sstevel@tonic-gate * aa_batterystatus values 292*0Sstevel@tonic-gate */ 293*0Sstevel@tonic-gate #define AMR_BATT_MODULE_MISSING 0x01 294*0Sstevel@tonic-gate #define AMR_BATT_LOW_VOLTAGE 0x02 295*0Sstevel@tonic-gate #define AMR_BATT_TEMP_HIGH 0x04 296*0Sstevel@tonic-gate #define AMR_BATT_PACK_MISSING 0x08 297*0Sstevel@tonic-gate #define AMR_BATT_CHARGE_MASK 0x30 298*0Sstevel@tonic-gate #define AMR_BATT_CHARGE_DONE 0x00 299*0Sstevel@tonic-gate #define AMR_BATT_CHARGE_INPROG 0x10 300*0Sstevel@tonic-gate #define AMR_BATT_CHARGE_FAIL 0x20 301*0Sstevel@tonic-gate #define AMR_BATT_CYCLES_EXCEEDED 0x40 302*0Sstevel@tonic-gate 303*0Sstevel@tonic-gate /* 304*0Sstevel@tonic-gate * Logical Drive info structure 305*0Sstevel@tonic-gate */ 306*0Sstevel@tonic-gate struct amr_logdrive_info 307*0Sstevel@tonic-gate { 308*0Sstevel@tonic-gate uint8_t al_numdrives; /* "NumLogDrv", No. of */ 309*0Sstevel@tonic-gate /* configured logic drivers */ 310*0Sstevel@tonic-gate uint8_t res1[3]; 311*0Sstevel@tonic-gate uint32_t al_size[AMR_8LD_MAXDRIVES]; 312*0Sstevel@tonic-gate /* "LDrvSize", size of each */ 313*0Sstevel@tonic-gate /* logic driver */ 314*0Sstevel@tonic-gate uint8_t al_properties[AMR_8LD_MAXDRIVES]; 315*0Sstevel@tonic-gate /* "LDrvProp", properties of */ 316*0Sstevel@tonic-gate /* each logic driver */ 317*0Sstevel@tonic-gate uint8_t al_state[AMR_8LD_MAXDRIVES]; 318*0Sstevel@tonic-gate /* "LDrvState", state of */ 319*0Sstevel@tonic-gate /* each logic driver */ 320*0Sstevel@tonic-gate }; 321*0Sstevel@tonic-gate 322*0Sstevel@tonic-gate /* 323*0Sstevel@tonic-gate * Logical drive only: al_properties 324*0Sstevel@tonic-gate */ 325*0Sstevel@tonic-gate #define AMR_DRV_RAID_MASK 0x0f /* RAID level 0, 1, 3, 5, etc */ 326*0Sstevel@tonic-gate #define AMR_DRV_WRITEBACK 0x10 /* write-back enabled */ 327*0Sstevel@tonic-gate #define AMR_DRV_READHEAD 0x20 /* readhead policy enabled */ 328*0Sstevel@tonic-gate #define AMR_DRV_ADAPTIVE 0x40 /* adaptive I/O enabled */ 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate /* 331*0Sstevel@tonic-gate * Physical Drive info structure 332*0Sstevel@tonic-gate */ 333*0Sstevel@tonic-gate struct amr_physdrive_info 334*0Sstevel@tonic-gate { 335*0Sstevel@tonic-gate uint8_t ap_state[AMR_8LD_MAXPHYSDRIVES]; 336*0Sstevel@tonic-gate /* "PDrvState", state of each */ 337*0Sstevel@tonic-gate /* phy-driver. Low nibble is */ 338*0Sstevel@tonic-gate /* current state, high nibble */ 339*0Sstevel@tonic-gate /* is previous state */ 340*0Sstevel@tonic-gate uint8_t ap_predictivefailure; /* "PredictiveFailure" */ 341*0Sstevel@tonic-gate }; 342*0Sstevel@tonic-gate 343*0Sstevel@tonic-gate /* 344*0Sstevel@tonic-gate * Physical/logical drive states 345*0Sstevel@tonic-gate * 346*0Sstevel@tonic-gate * Both logical and physical drives maintain 347*0Sstevel@tonic-gate * 'current' and 'previous' states in the low/high 348*0Sstevel@tonic-gate * nibble of the _state field. 349*0Sstevel@tonic-gate */ 350*0Sstevel@tonic-gate #define AMR_DRV_CURSTATE(x) ((x) & 0x0f) 351*0Sstevel@tonic-gate #define AMR_DRV_PREVSTATE(x) (((x) >> 4) & 0x0f) 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate /* 354*0Sstevel@tonic-gate * Logical drives: al_state. 355*0Sstevel@tonic-gate */ 356*0Sstevel@tonic-gate #define AMR_LDRV_OFFLINE 0x00 357*0Sstevel@tonic-gate #define AMR_LDRV_DEGRADED 0x01 358*0Sstevel@tonic-gate #define AMR_LDRV_OPTIMAL 0x02 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate /* 361*0Sstevel@tonic-gate * Physical drives: ap_state. 362*0Sstevel@tonic-gate */ 363*0Sstevel@tonic-gate #define AMR_PDRV_UNCNF 0x00 364*0Sstevel@tonic-gate #define AMR_PDRV_ONLINE 0x03 365*0Sstevel@tonic-gate #define AMR_PDRV_FAILED 0x04 366*0Sstevel@tonic-gate #define AMR_PDRV_REBUILD 0x05 367*0Sstevel@tonic-gate #define AMR_PDRV_HOTSPARE 0x06 368*0Sstevel@tonic-gate 369*0Sstevel@tonic-gate /* 370*0Sstevel@tonic-gate * Notify structure 371*0Sstevel@tonic-gate */ 372*0Sstevel@tonic-gate struct amr_notify 373*0Sstevel@tonic-gate { 374*0Sstevel@tonic-gate uint32_t an_globalcounter; /* "globalCounter", change */ 375*0Sstevel@tonic-gate /* counter */ 376*0Sstevel@tonic-gate uint8_t an_paramcounter; /* "paramCounter", parameter */ 377*0Sstevel@tonic-gate /* change counter */ 378*0Sstevel@tonic-gate uint8_t an_paramid; /* "paramId", param modified */ 379*0Sstevel@tonic-gate uint16_t an_paramval; /* "paramVal", new var of */ 380*0Sstevel@tonic-gate /* last param modified */ 381*0Sstevel@tonic-gate 382*0Sstevel@tonic-gate uint8_t an_writeconfigcounter; /* "writeConfigCounter", */ 383*0Sstevel@tonic-gate /* write config occurred */ 384*0Sstevel@tonic-gate uint8_t res1[3]; /* "writeConfigRsvd" */ 385*0Sstevel@tonic-gate 386*0Sstevel@tonic-gate uint8_t an_ldrvopcounter; /* "ldrvOpCounter", logical */ 387*0Sstevel@tonic-gate /* drive operation */ 388*0Sstevel@tonic-gate uint8_t an_ldrvopid; /* "ldrvOpId", ldrv num */ 389*0Sstevel@tonic-gate uint8_t an_ldrvopcmd; /* "ldrvOpCmd", ldrv */ 390*0Sstevel@tonic-gate /* operations */ 391*0Sstevel@tonic-gate uint8_t an_ldrvopstatus; /* "ldrvOpStatus", status of */ 392*0Sstevel@tonic-gate /* the operation */ 393*0Sstevel@tonic-gate 394*0Sstevel@tonic-gate uint8_t an_ldrvstatecounter; /* "ldrvStateCounter", change */ 395*0Sstevel@tonic-gate /* of logical drive state */ 396*0Sstevel@tonic-gate uint8_t an_ldrvstateid; /* "ldrvStateId", ldrv num */ 397*0Sstevel@tonic-gate uint8_t an_ldrvstatenew; /* "ldrvStateNew", new state */ 398*0Sstevel@tonic-gate uint8_t an_ldrvstateold; /* "ldrvStateOld", old state */ 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate uint8_t an_pdrvstatecounter; /* "pdrvStateCounter", change */ 401*0Sstevel@tonic-gate /* of physical drive state */ 402*0Sstevel@tonic-gate uint8_t an_pdrvstateid; /* "pdrvStateId", pdrv id */ 403*0Sstevel@tonic-gate uint8_t an_pdrvstatenew; /* "pdrvStateNew", new state */ 404*0Sstevel@tonic-gate uint8_t an_pdrvstateold; /* "pdrvStateOld", old state */ 405*0Sstevel@tonic-gate 406*0Sstevel@tonic-gate uint8_t an_pdrvfmtcounter; /* "pdrvFmtCounter", pdrv */ 407*0Sstevel@tonic-gate /* format started/over */ 408*0Sstevel@tonic-gate uint8_t an_pdrvfmtid; /* "pdrvFmtId", pdrv id */ 409*0Sstevel@tonic-gate uint8_t an_pdrvfmtval; /* "pdrvFmtVal", format */ 410*0Sstevel@tonic-gate /* started/over */ 411*0Sstevel@tonic-gate uint8_t res2; /* "pdrvFmtRsvd" */ 412*0Sstevel@tonic-gate 413*0Sstevel@tonic-gate uint8_t an_targxfercounter; /* "targXferCounter", scsi */ 414*0Sstevel@tonic-gate /* xfer rate change */ 415*0Sstevel@tonic-gate uint8_t an_targxferid; /* "targXferId", pdrv id */ 416*0Sstevel@tonic-gate uint8_t an_targxferval; /* "targXferVal", new Xfer */ 417*0Sstevel@tonic-gate /* params of last pdrv */ 418*0Sstevel@tonic-gate uint8_t res3; /* "targXferRsvd" */ 419*0Sstevel@tonic-gate 420*0Sstevel@tonic-gate uint8_t an_fcloopidcounter; /* "fcLoopIdChgCounter", */ 421*0Sstevel@tonic-gate /* FC/AL loop ID changed */ 422*0Sstevel@tonic-gate uint8_t an_fcloopidpdrvid; /* "fcLoopIdPdrvId", pdrv id */ 423*0Sstevel@tonic-gate uint8_t an_fcloopid0; /* "fcLoopId0", loopid on fc */ 424*0Sstevel@tonic-gate /* loop 0 */ 425*0Sstevel@tonic-gate uint8_t an_fcloopid1; /* "fcLoopId1", loopid on fc */ 426*0Sstevel@tonic-gate /* loop 1 */ 427*0Sstevel@tonic-gate 428*0Sstevel@tonic-gate uint8_t an_fcloopstatecounter; /* "fcLoopStateCounter", */ 429*0Sstevel@tonic-gate /* FC/AL loop status changed */ 430*0Sstevel@tonic-gate uint8_t an_fcloopstate0; /* "fcLoopState0", state of */ 431*0Sstevel@tonic-gate /* fc loop 0 */ 432*0Sstevel@tonic-gate uint8_t an_fcloopstate1; /* "fcLoopState1", state of */ 433*0Sstevel@tonic-gate /* fc loop 1 */ 434*0Sstevel@tonic-gate uint8_t res4; /* "fcLoopStateRsvd" */ 435*0Sstevel@tonic-gate uint8_t pad[88]; 436*0Sstevel@tonic-gate }; 437*0Sstevel@tonic-gate 438*0Sstevel@tonic-gate /* 439*0Sstevel@tonic-gate * an_param values 440*0Sstevel@tonic-gate */ 441*0Sstevel@tonic-gate #define AMR_PARAM_REBUILD_RATE 0x01 442*0Sstevel@tonic-gate #define AMR_PARAM_FLUSH_INTERVAL 0x02 443*0Sstevel@tonic-gate #define AMR_PARAM_SENSE_ALERT 0x03 444*0Sstevel@tonic-gate #define AMR_PARAM_DRIVE_INSERTED 0x04 445*0Sstevel@tonic-gate #define AMR_PARAM_BATTERY_STATUS 0x05 446*0Sstevel@tonic-gate 447*0Sstevel@tonic-gate /* 448*0Sstevel@tonic-gate * an_ldrvopcmd values 449*0Sstevel@tonic-gate */ 450*0Sstevel@tonic-gate #define AMR_LDRVOP_CHECK 0x01 451*0Sstevel@tonic-gate #define AMR_LDRVOP_INIT 0x02 452*0Sstevel@tonic-gate #define AMR_LDRVOP_REBUILD 0x03 453*0Sstevel@tonic-gate 454*0Sstevel@tonic-gate /* 455*0Sstevel@tonic-gate * an_ldrvopstatus: return values after issuing command 456*0Sstevel@tonic-gate * via an_ldrvopcmd. 457*0Sstevel@tonic-gate */ 458*0Sstevel@tonic-gate #define AMR_LDRVOP_SUCCESS 0x00 459*0Sstevel@tonic-gate #define AMR_LDRVOP_FAILED 0x01 460*0Sstevel@tonic-gate #define AMR_LDRVOP_ABORTED 0x02 461*0Sstevel@tonic-gate #define AMR_LDRVOP_CORRECTED 0x03 462*0Sstevel@tonic-gate #define AMR_LDRVOP_STARTED 0x04 463*0Sstevel@tonic-gate 464*0Sstevel@tonic-gate /* 465*0Sstevel@tonic-gate * an_pdrvfmtval: Formatting commands/return values 466*0Sstevel@tonic-gate */ 467*0Sstevel@tonic-gate #define AMR_FORMAT_START 0x01 468*0Sstevel@tonic-gate #define AMR_FORMAT_COMPLETE 0x02 469*0Sstevel@tonic-gate 470*0Sstevel@tonic-gate /* 471*0Sstevel@tonic-gate * Enquiry response structure for AMR_CMD_ENQUIRY, AMR_CMD_EXT_ENQUIRY and 472*0Sstevel@tonic-gate * AMR_CMD_EXT_ENQUIRY2. 473*0Sstevel@tonic-gate */ 474*0Sstevel@tonic-gate struct amr_enquiry 475*0Sstevel@tonic-gate { 476*0Sstevel@tonic-gate struct amr_adapter_info ae_adapter; 477*0Sstevel@tonic-gate struct amr_logdrive_info ae_ldrv; 478*0Sstevel@tonic-gate struct amr_physdrive_info ae_pdrv; 479*0Sstevel@tonic-gate uint8_t ae_formatting[AMR_8LD_MAXDRIVES]; 480*0Sstevel@tonic-gate uint8_t res1[AMR_8LD_MAXDRIVES]; 481*0Sstevel@tonic-gate uint32_t ae_extlen; 482*0Sstevel@tonic-gate uint16_t ae_subsystem; 483*0Sstevel@tonic-gate uint16_t ae_subvendor; 484*0Sstevel@tonic-gate uint32_t ae_signature; 485*0Sstevel@tonic-gate uint8_t res2[844]; 486*0Sstevel@tonic-gate }; 487*0Sstevel@tonic-gate 488*0Sstevel@tonic-gate /* 489*0Sstevel@tonic-gate * ae_signature values 490*0Sstevel@tonic-gate */ 491*0Sstevel@tonic-gate #define AMR_SIG_431 0xfffe0001 492*0Sstevel@tonic-gate #define AMR_SIG_438 0xfffd0002 493*0Sstevel@tonic-gate #define AMR_SIG_762 0xfffc0003 494*0Sstevel@tonic-gate #define AMR_SIG_T5 0xfffb0004 495*0Sstevel@tonic-gate #define AMR_SIG_466 0xfffa0005 496*0Sstevel@tonic-gate #define AMR_SIG_467 0xfff90006 497*0Sstevel@tonic-gate #define AMR_SIG_T7 0xfff80007 498*0Sstevel@tonic-gate #define AMR_SIG_490 0xfff70008 499*0Sstevel@tonic-gate 500*0Sstevel@tonic-gate /* 501*0Sstevel@tonic-gate * Enquiry3 structure 502*0Sstevel@tonic-gate */ 503*0Sstevel@tonic-gate struct amr_enquiry3 504*0Sstevel@tonic-gate { 505*0Sstevel@tonic-gate uint32_t ae_datasize; /* "dataSize", current size */ 506*0Sstevel@tonic-gate /* in bytes(resvd excluded) */ 507*0Sstevel@tonic-gate struct amr_notify ae_notify; /* "notify", event notify */ 508*0Sstevel@tonic-gate /* structure */ 509*0Sstevel@tonic-gate uint8_t ae_rebuildrate; /* "rbldRate", current */ 510*0Sstevel@tonic-gate /* rebuild rate in % */ 511*0Sstevel@tonic-gate uint8_t ae_cacheflush; /* "cacheFlushInterval", */ 512*0Sstevel@tonic-gate /* flush interval in seconds */ 513*0Sstevel@tonic-gate uint8_t ae_sensealert; /* "senseAlert" */ 514*0Sstevel@tonic-gate uint8_t ae_driveinsertcount; /* "driveInsertedCount", */ 515*0Sstevel@tonic-gate /* count of inserted drives */ 516*0Sstevel@tonic-gate uint8_t ae_batterystatus; /* "batteryStatus" */ 517*0Sstevel@tonic-gate uint8_t ae_numldrives; /* "numLDrv", number of logic */ 518*0Sstevel@tonic-gate /* drivers configured */ 519*0Sstevel@tonic-gate uint8_t ae_reconstate[AMR_40LD_MAXDRIVES/8]; 520*0Sstevel@tonic-gate /* "reconState", */ 521*0Sstevel@tonic-gate /* reconstruction state */ 522*0Sstevel@tonic-gate uint16_t ae_opstatus[AMR_40LD_MAXDRIVES/8]; 523*0Sstevel@tonic-gate /* "lDrvOpStatus", operation */ 524*0Sstevel@tonic-gate /* state per logic driver */ 525*0Sstevel@tonic-gate uint32_t ae_drivesize[AMR_40LD_MAXDRIVES]; 526*0Sstevel@tonic-gate /* "lDrvSize", size of each */ 527*0Sstevel@tonic-gate /* logic driver */ 528*0Sstevel@tonic-gate uint8_t ae_driveprop[AMR_40LD_MAXDRIVES]; 529*0Sstevel@tonic-gate /* "lDrvProp", properties of */ 530*0Sstevel@tonic-gate /* each logic driver */ 531*0Sstevel@tonic-gate uint8_t ae_drivestate[AMR_40LD_MAXDRIVES]; 532*0Sstevel@tonic-gate /* "lDrvState", state of */ 533*0Sstevel@tonic-gate /* each logic driver */ 534*0Sstevel@tonic-gate uint8_t ae_pdrivestate[AMR_40LD_MAXPHYSDRIVES]; 535*0Sstevel@tonic-gate /* "pDrvState", state of each */ 536*0Sstevel@tonic-gate /* physical driver */ 537*0Sstevel@tonic-gate uint16_t ae_pdriveformat[AMR_40LD_MAXPHYSDRIVES/16]; 538*0Sstevel@tonic-gate /* "physDrvFormat" */ 539*0Sstevel@tonic-gate uint8_t ae_targxfer[80]; /* "targXfer", physical drive */ 540*0Sstevel@tonic-gate /* transfer rates */ 541*0Sstevel@tonic-gate uint8_t res1[263]; /* pad to 1024 bytes */ 542*0Sstevel@tonic-gate }; 543*0Sstevel@tonic-gate 544*0Sstevel@tonic-gate /* 545*0Sstevel@tonic-gate * Product Info structure. Query for this via AMR_CONFIG_PRODUCT_INFO. 546*0Sstevel@tonic-gate */ 547*0Sstevel@tonic-gate struct amr_prodinfo 548*0Sstevel@tonic-gate { 549*0Sstevel@tonic-gate uint32_t ap_size; /* "DataSize", current size */ 550*0Sstevel@tonic-gate /* in bytes */ 551*0Sstevel@tonic-gate uint32_t ap_configsig; /* "ConfigSignature", default */ 552*0Sstevel@tonic-gate /* is 0x00282008, indicating */ 553*0Sstevel@tonic-gate /* 0x28 max logical drives, */ 554*0Sstevel@tonic-gate /* 0x20 maximum stripes and */ 555*0Sstevel@tonic-gate /* 0x08 maximum spans */ 556*0Sstevel@tonic-gate uint8_t ap_firmware[16]; /* "FwVer", firmware version */ 557*0Sstevel@tonic-gate uint8_t ap_bios[16]; /* "BiosVer", Bios version */ 558*0Sstevel@tonic-gate uint8_t ap_product[80]; /* "ProductName", prod name */ 559*0Sstevel@tonic-gate uint8_t ap_maxio; /* "MaxConcCmds", max number */ 560*0Sstevel@tonic-gate /* of concurrent commands */ 561*0Sstevel@tonic-gate uint8_t ap_nschan; /* "SCSIChanPresent", number */ 562*0Sstevel@tonic-gate /* of SCSI channels present */ 563*0Sstevel@tonic-gate uint8_t ap_fcloops; /* "FCLoopPresent", number of */ 564*0Sstevel@tonic-gate /* fibre loops present */ 565*0Sstevel@tonic-gate uint8_t ap_memtype; /* "memType", memory type */ 566*0Sstevel@tonic-gate uint32_t ap_signature; /* "signature" */ 567*0Sstevel@tonic-gate uint16_t ap_memsize; /* "DramSize", onboard memory */ 568*0Sstevel@tonic-gate /* in MB */ 569*0Sstevel@tonic-gate uint16_t ap_subsystem; /* "subSystemID", subsystem */ 570*0Sstevel@tonic-gate /* identifier */ 571*0Sstevel@tonic-gate uint16_t ap_subvendor; /* "subSystemVendorID" */ 572*0Sstevel@tonic-gate uint8_t ap_numnotifyctr; /* "numNotifyCounters", num */ 573*0Sstevel@tonic-gate /* of notify counters */ 574*0Sstevel@tonic-gate }; 575*0Sstevel@tonic-gate 576*0Sstevel@tonic-gate /* 577*0Sstevel@tonic-gate * The union for used enquiry commands 578*0Sstevel@tonic-gate */ 579*0Sstevel@tonic-gate union amr_enq_buffer 580*0Sstevel@tonic-gate { 581*0Sstevel@tonic-gate struct amr_enquiry3 aeb_enquiry3; 582*0Sstevel@tonic-gate struct amr_enquiry aeb_enquiry; 583*0Sstevel@tonic-gate struct amr_prodinfo aeb_prodinfo; 584*0Sstevel@tonic-gate }; 585*0Sstevel@tonic-gate 586*0Sstevel@tonic-gate #pragma pack() 587*0Sstevel@tonic-gate 588*0Sstevel@tonic-gate #ifdef _KERNEL 589*0Sstevel@tonic-gate 590*0Sstevel@tonic-gate /* 591*0Sstevel@tonic-gate * I/O Port offsets 592*0Sstevel@tonic-gate */ 593*0Sstevel@tonic-gate #define ACK_BYTE 0x08 594*0Sstevel@tonic-gate #define I_CMD_PORT 0x00 595*0Sstevel@tonic-gate #define I_ACK_PORT 0x00 596*0Sstevel@tonic-gate #define I_TOGGLE_PORT 0x01 597*0Sstevel@tonic-gate #define INTR_PORT 0x0a 598*0Sstevel@tonic-gate #define ENABLE_INTR_BYTE 0xc0 599*0Sstevel@tonic-gate #define DISABLE_INTR_BYTE 0x00 600*0Sstevel@tonic-gate #define AMR_QINTR 0x0a 601*0Sstevel@tonic-gate #define AMR_QINTR_VALID 0x40 602*0Sstevel@tonic-gate 603*0Sstevel@tonic-gate #define AMR_QGET_ISTAT(sc) pci_config_get8(sc->regsmap_handle, AMR_QINTR) 604*0Sstevel@tonic-gate #define AMR_QCLEAR_INTR(sc) pci_config_put8(sc->regsmap_handle, \ 605*0Sstevel@tonic-gate I_ACK_PORT, ACK_BYTE) 606*0Sstevel@tonic-gate #define AMR_QENABLE_INTR(sc) pci_config_put8(sc->regsmap_handle, \ 607*0Sstevel@tonic-gate I_TOGGLE_PORT, ENABLE_INTR_BYTE) 608*0Sstevel@tonic-gate #define AMR_QDISABLE_INTR(sc) pci_config_put8(sc->regsmap_handle, \ 609*0Sstevel@tonic-gate I_TOGGLE_PORT, DISABLE_INTR_BYTE) 610*0Sstevel@tonic-gate #define AMR_CFG_SIG 0xa0 /* PCI config register for signature */ 611*0Sstevel@tonic-gate #define AMR_SIGNATURE_1 0xCCCC /* i960 signature (older adapters) */ 612*0Sstevel@tonic-gate #define AMR_SIGNATURE_2 0x3344 /* i960 signature (newer adapters) */ 613*0Sstevel@tonic-gate 614*0Sstevel@tonic-gate /* 615*0Sstevel@tonic-gate * Doorbell registers 616*0Sstevel@tonic-gate */ 617*0Sstevel@tonic-gate #define AMR_QIDB 0x20 618*0Sstevel@tonic-gate #define AMR_QODB 0x2c 619*0Sstevel@tonic-gate #define AMR_QIDB_SUBMIT 0x00000001 /* mailbox ready for work */ 620*0Sstevel@tonic-gate #define AMR_QIDB_ACK 0x00000002 /* mailbox done */ 621*0Sstevel@tonic-gate #define AMR_QODB_READY 0x10001234 /* work ready to be processed */ 622*0Sstevel@tonic-gate 623*0Sstevel@tonic-gate /* 624*0Sstevel@tonic-gate * Initialisation status 625*0Sstevel@tonic-gate */ 626*0Sstevel@tonic-gate #define AMR_QINIT_SCAN 0x01 /* init scanning drives */ 627*0Sstevel@tonic-gate #define AMR_QINIT_SCANINIT 0x02 /* init scanning initialising */ 628*0Sstevel@tonic-gate #define AMR_QINIT_FIRMWARE 0x03 /* init firmware initing */ 629*0Sstevel@tonic-gate #define AMR_QINIT_INPROG 0xdc /* init in progress */ 630*0Sstevel@tonic-gate #define AMR_QINIT_SPINUP 0x2c /* init spinning drives */ 631*0Sstevel@tonic-gate #define AMR_QINIT_NOMEM 0xac /* insufficient memory */ 632*0Sstevel@tonic-gate #define AMR_QINIT_CACHEFLUSH 0xbc /* init flushing cache */ 633*0Sstevel@tonic-gate #define AMR_QINIT_DONE 0x9c /* init successfully done */ 634*0Sstevel@tonic-gate 635*0Sstevel@tonic-gate /* 636*0Sstevel@tonic-gate * I/O primitives 637*0Sstevel@tonic-gate */ 638*0Sstevel@tonic-gate #define AMR_QPUT_IDB(sc, val) pci_config_put32(sc->regsmap_handle, \ 639*0Sstevel@tonic-gate AMR_QIDB, val) 640*0Sstevel@tonic-gate #define AMR_QGET_IDB(sc) pci_config_get32(sc->regsmap_handle, \ 641*0Sstevel@tonic-gate AMR_QIDB) 642*0Sstevel@tonic-gate #define AMR_QPUT_ODB(sc, val) pci_config_put32(sc->regsmap_handle, \ 643*0Sstevel@tonic-gate AMR_QODB, val) 644*0Sstevel@tonic-gate #define AMR_QGET_ODB(sc) pci_config_get32(sc->regsmap_handle, \ 645*0Sstevel@tonic-gate AMR_QODB) 646*0Sstevel@tonic-gate 647*0Sstevel@tonic-gate /* 648*0Sstevel@tonic-gate * I/O registers 649*0Sstevel@tonic-gate */ 650*0Sstevel@tonic-gate #define AMR_SCMD 0x10 /* command/ack register (write) */ 651*0Sstevel@tonic-gate #define AMR_SMBOX_BUSY 0x10 /* mailbox status (read) */ 652*0Sstevel@tonic-gate #define AMR_STOGGLE 0x11 /* interrupt enable bit here */ 653*0Sstevel@tonic-gate #define AMR_SMBOX_0 0x14 /* mailbox physical address low byte */ 654*0Sstevel@tonic-gate #define AMR_SMBOX_1 0x15 655*0Sstevel@tonic-gate #define AMR_SMBOX_2 0x16 656*0Sstevel@tonic-gate #define AMR_SMBOX_3 0x17 /* high byte */ 657*0Sstevel@tonic-gate #define AMR_SMBOX_ENABLE 0x18 /* atomic mailbox address enable */ 658*0Sstevel@tonic-gate #define AMR_SINTR 0x1a /* interrupt status */ 659*0Sstevel@tonic-gate 660*0Sstevel@tonic-gate /* 661*0Sstevel@tonic-gate * I/O magic numbers 662*0Sstevel@tonic-gate */ 663*0Sstevel@tonic-gate #define AMR_SCMD_POST 0x10 /* SCMD to initiate action on mailbox */ 664*0Sstevel@tonic-gate #define AMR_SCMD_ACKINTR 0x08 /* SCMD to ack mailbox retrieved */ 665*0Sstevel@tonic-gate #define AMR_STOGL_IENABLE 0xc0 /* in STOGGLE */ 666*0Sstevel@tonic-gate #define AMR_SINTR_VALID 0x40 /* in SINTR */ 667*0Sstevel@tonic-gate #define AMR_SMBOX_BUSYFLAG 0x10 /* in SMBOX_BUSY */ 668*0Sstevel@tonic-gate #define AMR_SMBOX_ADDR 0x00 /* SMBOX_ENABLE */ 669*0Sstevel@tonic-gate 670*0Sstevel@tonic-gate /* 671*0Sstevel@tonic-gate * Initialisation status 672*0Sstevel@tonic-gate */ 673*0Sstevel@tonic-gate #define AMR_SINIT_ABEND 0xee /* init abnormal terminated */ 674*0Sstevel@tonic-gate #define AMR_SINIT_NOMEM 0xca /* insufficient memory */ 675*0Sstevel@tonic-gate #define AMR_SINIT_CACHEFLUSH 0xbb /* firmware flushing cache */ 676*0Sstevel@tonic-gate #define AMR_SINIT_INPROG 0x11 /* init in progress */ 677*0Sstevel@tonic-gate #define AMR_SINIT_SPINUP 0x22 /* firmware spinning drives */ 678*0Sstevel@tonic-gate #define AMR_SINIT_DONE 0x99 /* init successfully done */ 679*0Sstevel@tonic-gate 680*0Sstevel@tonic-gate /* 681*0Sstevel@tonic-gate * I/O primitives 682*0Sstevel@tonic-gate */ 683*0Sstevel@tonic-gate #define AMR_SPUT_ISTAT(sc, val) pci_config_put8(sc->regsmap_handle, \ 684*0Sstevel@tonic-gate AMR_SINTR, val) 685*0Sstevel@tonic-gate #define AMR_SGET_ISTAT(sc) pci_config_get8(sc->regsmap_handle, AMR_SINTR) 686*0Sstevel@tonic-gate #define AMR_SACK_INTERRUPT(sc) pci_config_put8(sc->regsmap_handle, \ 687*0Sstevel@tonic-gate AMR_SCMD, AMR_SCMD_ACKINTR) 688*0Sstevel@tonic-gate #define AMR_SPOST_COMMAND(sc) pci_config_put8(sc->regsmap_handle, AMR_SCMD, \ 689*0Sstevel@tonic-gate AMR_SCMD_POST) 690*0Sstevel@tonic-gate #define AMR_SGET_MBSTAT(sc) pci_config_get8(sc->regsmap_handle, \ 691*0Sstevel@tonic-gate AMR_SMBOX_BUSY) 692*0Sstevel@tonic-gate 693*0Sstevel@tonic-gate #define AMR_SENABLE_INTR(sc) \ 694*0Sstevel@tonic-gate pci_config_put8(sc->regsmap_handle, AMR_STOGGLE, \ 695*0Sstevel@tonic-gate pci_config_get8(sc->regsmap_handle, AMR_STOGGLE) \ 696*0Sstevel@tonic-gate | AMR_STOGL_IENABLE) 697*0Sstevel@tonic-gate 698*0Sstevel@tonic-gate #define AMR_SDISABLE_INTR(sc) \ 699*0Sstevel@tonic-gate pci_config_put8(sc->regsmap_handle, AMR_STOGGLE, \ 700*0Sstevel@tonic-gate pci_config_get8(sc->regsmap_handle, AMR_STOGGLE) \ 701*0Sstevel@tonic-gate & ~AMR_STOGL_IENABLE) 702*0Sstevel@tonic-gate 703*0Sstevel@tonic-gate #define AMR_SBYTE_SET(sc, reg, val) pci_config_put8(sc->regsmap_handle, \ 704*0Sstevel@tonic-gate reg, val) 705*0Sstevel@tonic-gate 706*0Sstevel@tonic-gate #endif /* _KERNEL */ 707*0Sstevel@tonic-gate 708*0Sstevel@tonic-gate #ifdef __cplusplus 709*0Sstevel@tonic-gate } 710*0Sstevel@tonic-gate #endif 711*0Sstevel@tonic-gate 712*0Sstevel@tonic-gate #endif /* _AMRREG_H */ 713