1fcf3ce44SJohn Forte /* 2fcf3ce44SJohn Forte * CDDL HEADER START 3fcf3ce44SJohn Forte * 4fcf3ce44SJohn Forte * The contents of this file are subject to the terms of the 5fcf3ce44SJohn Forte * Common Development and Distribution License (the "License"). 6fcf3ce44SJohn Forte * You may not use this file except in compliance with the License. 7fcf3ce44SJohn Forte * 8fcf3ce44SJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fcf3ce44SJohn Forte * or http://www.opensolaris.org/os/licensing. 10fcf3ce44SJohn Forte * See the License for the specific language governing permissions 11fcf3ce44SJohn Forte * and limitations under the License. 12fcf3ce44SJohn Forte * 13fcf3ce44SJohn Forte * When distributing Covered Code, include this CDDL HEADER in each 14fcf3ce44SJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fcf3ce44SJohn Forte * If applicable, add the following below this CDDL HEADER, with the 16fcf3ce44SJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying 17fcf3ce44SJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner] 18fcf3ce44SJohn Forte * 19fcf3ce44SJohn Forte * CDDL HEADER END 20fcf3ce44SJohn Forte */ 21fcf3ce44SJohn Forte 22*f885d00fSDaniel Beauregard /* Copyright 2010 QLogic Corporation */ 23fcf3ce44SJohn Forte 24fcf3ce44SJohn Forte /* 25fcf3ce44SJohn Forte * ISP2xxx Solaris Fibre Channel Adapter (FCA) qlc mdb source file. 26fcf3ce44SJohn Forte * 27fcf3ce44SJohn Forte * *********************************************************************** 28fcf3ce44SJohn Forte * * ** 29fcf3ce44SJohn Forte * * NOTICE ** 30eb82ff87SDaniel Beauregard * * COPYRIGHT (C) 1996-2010 QLOGIC CORPORATION ** 31fcf3ce44SJohn Forte * * ALL RIGHTS RESERVED ** 32fcf3ce44SJohn Forte * * ** 33fcf3ce44SJohn Forte * *********************************************************************** 34fcf3ce44SJohn Forte * 35fcf3ce44SJohn Forte */ 36fcf3ce44SJohn Forte 37eb82ff87SDaniel Beauregard #pragma ident "Copyright 2010 QLogic Corporation; ql_mdb.c" 38fcf3ce44SJohn Forte 39fcf3ce44SJohn Forte #include <sys/mdb_modapi.h> 4016dd44c2SDaniel Beauregard #include <ql_apps.h> 4116dd44c2SDaniel Beauregard #include <ql_api.h> 4216dd44c2SDaniel Beauregard #include <ql_init.h> 4316dd44c2SDaniel Beauregard #include <ql_debug.h> 44fcf3ce44SJohn Forte 45fcf3ce44SJohn Forte /* 46fcf3ce44SJohn Forte * local prototypes 47fcf3ce44SJohn Forte */ 48fcf3ce44SJohn Forte static int32_t ql_doprint(uintptr_t, int8_t *); 49fcf3ce44SJohn Forte static void ql_dump_flags(uint64_t, int8_t **); 50fcf3ce44SJohn Forte static int qlclinks_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 51fcf3ce44SJohn Forte static int qlcstate_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 52fcf3ce44SJohn Forte static int qlc_osc_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 5316dd44c2SDaniel Beauregard static int qlc_wdog_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 5416dd44c2SDaniel Beauregard static int qlc_getdump_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 5516dd44c2SDaniel Beauregard static int qlc_gettrace_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 5616dd44c2SDaniel Beauregard #if 0 5716dd44c2SDaniel Beauregard static int qlc_triggerdump_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 5816dd44c2SDaniel Beauregard #endif 59fcf3ce44SJohn Forte static int qlcver_dcmd(uintptr_t, uint_t, int, const mdb_arg_t *); 60fcf3ce44SJohn Forte static int qlstates_walk_init(mdb_walk_state_t *); 61fcf3ce44SJohn Forte static int qlstates_walk_step(mdb_walk_state_t *); 62fcf3ce44SJohn Forte static void qlstates_walk_fini(mdb_walk_state_t *); 63fcf3ce44SJohn Forte static int qlsrb_walk_init(mdb_walk_state_t *); 64fcf3ce44SJohn Forte static int qlsrb_walk_step(mdb_walk_state_t *); 65fcf3ce44SJohn Forte static void qlsrb_walk_fini(mdb_walk_state_t *); 66fcf3ce44SJohn Forte static int get_next_link(ql_link_t *); 67fcf3ce44SJohn Forte static int get_first_link(ql_head_t *, ql_link_t *); 68fcf3ce44SJohn Forte 69fcf3ce44SJohn Forte static int ql_24xx_dump_dcmd(ql_adapter_state_t *, uint_t, int, 70fcf3ce44SJohn Forte const mdb_arg_t *); 71fcf3ce44SJohn Forte static int ql_23xx_dump_dcmd(ql_adapter_state_t *, uint_t, int, 72fcf3ce44SJohn Forte const mdb_arg_t *); 73fcf3ce44SJohn Forte static int ql_25xx_dump_dcmd(ql_adapter_state_t *, uint_t, int, 74fcf3ce44SJohn Forte const mdb_arg_t *); 75f33c1cdbSDaniel Beauregard static int ql_81xx_dump_dcmd(ql_adapter_state_t *, uint_t, int, 76f33c1cdbSDaniel Beauregard const mdb_arg_t *); 77fcf3ce44SJohn Forte static void ql_elog_common(ql_adapter_state_t *, boolean_t); 78fcf3ce44SJohn Forte 79fcf3ce44SJohn Forte /* 80fcf3ce44SJohn Forte * local adapter state flags strings 81fcf3ce44SJohn Forte */ 82fcf3ce44SJohn Forte int8_t *adapter_state_flags[] = { 83fcf3ce44SJohn Forte "FCA_BOUND", 84fcf3ce44SJohn Forte "QL_OPENED", 85fcf3ce44SJohn Forte "ONLINE", 86fcf3ce44SJohn Forte "INTERRUPTS_ENABLED", 8716dd44c2SDaniel Beauregard "ABORT_CMDS_LOOP_DOWN_TMO", 88fcf3ce44SJohn Forte "POINT_TO_POINT", 89fcf3ce44SJohn Forte "IP_ENABLED", 90fcf3ce44SJohn Forte "IP_INITIALIZED", 915dfd244aSDaniel Beauregard "MENLO_LOGIN_OPERATIONAL", 92fcf3ce44SJohn Forte "ADAPTER_SUSPENDED", 93fcf3ce44SJohn Forte "ADAPTER_TIMER_BUSY", 94fcf3ce44SJohn Forte "PARITY_ERROR", 95fcf3ce44SJohn Forte "FLASH_ERRLOG_MARKER", 96fcf3ce44SJohn Forte "VP_ENABLED", 97fcf3ce44SJohn Forte "FDISC_ENABLED", 985dfd244aSDaniel Beauregard "FUNCTION_1", 994f8b8adcSDaniel Beauregard "MPI_RESET_NEEDED", 100fcf3ce44SJohn Forte NULL 101fcf3ce44SJohn Forte }; 102fcf3ce44SJohn Forte 103fcf3ce44SJohn Forte int8_t *adapter_config_flags[] = { 104fcf3ce44SJohn Forte "ENABLE_HARD_ADDRESS", 105fcf3ce44SJohn Forte "ENABLE_64BIT_ADDRESSING", 106fcf3ce44SJohn Forte "ENABLE_LIP_RESET", 107fcf3ce44SJohn Forte "ENABLE_FULL_LIP_LOGIN", 108fcf3ce44SJohn Forte "ENABLE_TARGET_RESET", 109fcf3ce44SJohn Forte "ENABLE_LINK_DOWN_REPORTING", 1105dfd244aSDaniel Beauregard "DISABLE_EXTENDED_LOGGING_TRACE", 111fcf3ce44SJohn Forte "ENABLE_FCP_2_SUPPORT", 112fcf3ce44SJohn Forte "MULTI_CHIP_ADAPTER", 113fcf3ce44SJohn Forte "SBUS_CARD", 114fcf3ce44SJohn Forte "CTRL_2300", 115fcf3ce44SJohn Forte "CTRL_6322", 116fcf3ce44SJohn Forte "CTRL_2200", 117fcf3ce44SJohn Forte "CTRL_2422", 118fcf3ce44SJohn Forte "CTRL_25XX", 119fcf3ce44SJohn Forte "ENABLE_EXTENDED_LOGGING", 120fcf3ce44SJohn Forte "DISABLE_RISC_CODE_LOAD", 121fcf3ce44SJohn Forte "SET_CACHE_LINE_SIZE_1", 1225dfd244aSDaniel Beauregard "CTRL_MENLO", 123fcf3ce44SJohn Forte "EXT_FW_INTERFACE", 124fcf3ce44SJohn Forte "LOAD_FLASH_FW", 125fcf3ce44SJohn Forte "DUMP_MAILBOX_TIMEOUT", 126fcf3ce44SJohn Forte "DUMP_ISP_SYSTEM_ERROR", 127fcf3ce44SJohn Forte "DUMP_DRIVER_COMMAND_TIMEOUT", 128fcf3ce44SJohn Forte "DUMP_LOOP_OFFLINE_TIMEOUT", 129fcf3ce44SJohn Forte "ENABLE_FWEXTTRACE", 130fcf3ce44SJohn Forte "ENABLE_FWFCETRACE", 131fcf3ce44SJohn Forte "FW_MISMATCH", 1325dfd244aSDaniel Beauregard "CTRL_81XX", 133eb82ff87SDaniel Beauregard "CTRL_8021", 134eb82ff87SDaniel Beauregard "ENABLE_FAST_TIMEOUT", 135eb82ff87SDaniel Beauregard "LR_SUPPORT", 136fcf3ce44SJohn Forte NULL 137fcf3ce44SJohn Forte }; 138fcf3ce44SJohn Forte 139fcf3ce44SJohn Forte /* 140fcf3ce44SJohn Forte * local task daemon flags strings 141fcf3ce44SJohn Forte */ 142fcf3ce44SJohn Forte int8_t *task_daemon_flags[] = { 143fcf3ce44SJohn Forte "TASK_DAEMON_STOP_FLG", 144fcf3ce44SJohn Forte "TASK_DAEMON_SLEEPING_FLG", 145fcf3ce44SJohn Forte "TASK_DAEMON_ALIVE_FLG", 146fcf3ce44SJohn Forte "TASK_DAEMON_IDLE_CHK_FLG", 147fcf3ce44SJohn Forte "SUSPENDED_WAKEUP_FLG", 148fcf3ce44SJohn Forte "FC_STATE_CHANGE", 149fcf3ce44SJohn Forte "NEED_UNSOLICITED_BUFFERS", 150fcf3ce44SJohn Forte "RESET_MARKER_NEEDED", 151fcf3ce44SJohn Forte "RESET_ACTIVE", 152fcf3ce44SJohn Forte "ISP_ABORT_NEEDED", 153fcf3ce44SJohn Forte "ABORT_ISP_ACTIVE", 154fcf3ce44SJohn Forte "LOOP_RESYNC_NEEDED", 155fcf3ce44SJohn Forte "LOOP_RESYNC_ACTIVE", 156fcf3ce44SJohn Forte "LOOP_DOWN", 157fcf3ce44SJohn Forte "DRIVER_STALL", 158fcf3ce44SJohn Forte "COMMAND_WAIT_NEEDED", 159fcf3ce44SJohn Forte "COMMAND_WAIT_ACTIVE", 160fcf3ce44SJohn Forte "STATE_ONLINE", 161fcf3ce44SJohn Forte "ABORT_QUEUES_NEEDED", 162fcf3ce44SJohn Forte "TASK_DAEMON_STALLED_FLG", 163fcf3ce44SJohn Forte "TASK_THREAD_CALLED", 164fcf3ce44SJohn Forte "FIRMWARE_UP", 165fcf3ce44SJohn Forte "LIP_RESET_PENDING", 166fcf3ce44SJohn Forte "FIRMWARE_LOADED", 167fcf3ce44SJohn Forte "RSCN_UPDATE_NEEDED", 168fcf3ce44SJohn Forte "HANDLE_PORT_BYPASS_CHANGE", 169fcf3ce44SJohn Forte "PORT_RETRY_NEEDED", 170fcf3ce44SJohn Forte "TASK_DAEMON_POWERING_DOWN", 171fcf3ce44SJohn Forte "TD_IIDMA_NEEDED", 1725dfd244aSDaniel Beauregard "SEND_PLOGI", 173*f885d00fSDaniel Beauregard "IDC_EVENT", 174fcf3ce44SJohn Forte NULL 175fcf3ce44SJohn Forte }; 176fcf3ce44SJohn Forte 177fcf3ce44SJohn Forte /* 178fcf3ce44SJohn Forte * local interrupt aif flags 179fcf3ce44SJohn Forte */ 180fcf3ce44SJohn Forte int8_t *aif_flags[] = { 181fcf3ce44SJohn Forte "IFLG_INTR_LEGACY", 182fcf3ce44SJohn Forte "IFLG_INTR_FIXED", 1835dfd244aSDaniel Beauregard "IFLG_INTR_MSI", 1845dfd244aSDaniel Beauregard "IFLG_INTR_MSIX", 185fcf3ce44SJohn Forte NULL 186fcf3ce44SJohn Forte }; 187fcf3ce44SJohn Forte 188fcf3ce44SJohn Forte int8_t *qlsrb_flags[] = { 189fcf3ce44SJohn Forte "SRB_ISP_STARTED", 190fcf3ce44SJohn Forte "SRB_ISP_COMPLETED", 191fcf3ce44SJohn Forte "SRB_RETRY", 192fcf3ce44SJohn Forte "SRB_POLL", 193fcf3ce44SJohn Forte "SRB_WATCHDOG_ENABLED", 194fcf3ce44SJohn Forte "SRB_ABORT", 195fcf3ce44SJohn Forte "SRB_UB_IN_FCA", 196fcf3ce44SJohn Forte "SRB_UB_IN_ISP", 197fcf3ce44SJohn Forte "SRB_UB_CALLBACK", 198fcf3ce44SJohn Forte "SRB_UB_RSCN", 199fcf3ce44SJohn Forte "SRB_UB_FCP", 200fcf3ce44SJohn Forte "SRB_FCP_CMD_PKT", 201fcf3ce44SJohn Forte "SRB_FCP_DATA_PKT", 202fcf3ce44SJohn Forte "SRB_FCP_RSP_PKT", 203fcf3ce44SJohn Forte "SRB_IP_PKT", 204fcf3ce44SJohn Forte "SRB_GENERIC_SERVICES_PKT", 205fcf3ce44SJohn Forte "SRB_COMMAND_TIMEOUT", 206fcf3ce44SJohn Forte "SRB_ABORTING", 207fcf3ce44SJohn Forte "SRB_IN_DEVICE_QUEUE", 208fcf3ce44SJohn Forte "SRB_IN_TOKEN_ARRAY", 209fcf3ce44SJohn Forte "SRB_UB_FREE_REQUESTED", 210fcf3ce44SJohn Forte "SRB_UB_ACQUIRED", 211fcf3ce44SJohn Forte "SRB_MS_PKT", 212fcf3ce44SJohn Forte NULL 213fcf3ce44SJohn Forte }; 214fcf3ce44SJohn Forte 215fcf3ce44SJohn Forte int8_t *qllun_flags[] = { 216fcf3ce44SJohn Forte "LQF_UNTAGGED_PENDING", 217fcf3ce44SJohn Forte NULL 218fcf3ce44SJohn Forte }; 219fcf3ce44SJohn Forte 220fcf3ce44SJohn Forte int8_t *qltgt_flags[] = { 221fcf3ce44SJohn Forte "TQF_TAPE_DEVICE", 222fcf3ce44SJohn Forte "TQF_QUEUE_SUSPENDED", 223fcf3ce44SJohn Forte "TQF_FABRIC_DEVICE", 224fcf3ce44SJohn Forte "TQF_INITIATOR_DEVICE", 225fcf3ce44SJohn Forte "TQF_RSCN_RCVD", 226fcf3ce44SJohn Forte "TQF_NEED_AUTHENTICATION", 227fcf3ce44SJohn Forte "TQF_PLOGI_PROGRS", 228fcf3ce44SJohn Forte "TQF_IIDMA_NEEDED", 229fcf3ce44SJohn Forte NULL 230fcf3ce44SJohn Forte }; 231fcf3ce44SJohn Forte 23216dd44c2SDaniel Beauregard int8_t *qldump_flags[] = { 23316dd44c2SDaniel Beauregard "QL_DUMPING", 23416dd44c2SDaniel Beauregard "QL_DUMP_VALID", 23516dd44c2SDaniel Beauregard "QL_DUMP_UPLOADED", 23616dd44c2SDaniel Beauregard NULL 23716dd44c2SDaniel Beauregard }; 23816dd44c2SDaniel Beauregard 239fcf3ce44SJohn Forte /* 240fcf3ce44SJohn Forte * qlclinks_dcmd 241fcf3ce44SJohn Forte * mdb dcmd which prints out the ql_hba pointers 242fcf3ce44SJohn Forte * 243fcf3ce44SJohn Forte * Input: 244fcf3ce44SJohn Forte * addr = User supplied address -- error if supplied. 245fcf3ce44SJohn Forte * flags = mdb flags. 246fcf3ce44SJohn Forte * argc = Number of user supplied args -- error if non-zero. 247fcf3ce44SJohn Forte * argv = Arg array. 248fcf3ce44SJohn Forte * 249fcf3ce44SJohn Forte * Returns: 250fcf3ce44SJohn Forte * DCMD_ERR, DCMD_USAGE, or DCMD_OK 251fcf3ce44SJohn Forte * 252fcf3ce44SJohn Forte * Context: 253fcf3ce44SJohn Forte * User context. 254fcf3ce44SJohn Forte * 255fcf3ce44SJohn Forte */ 256fcf3ce44SJohn Forte /*ARGSUSED*/ 257fcf3ce44SJohn Forte static int 258fcf3ce44SJohn Forte qlclinks_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 259fcf3ce44SJohn Forte { 260fcf3ce44SJohn Forte ql_head_t ql_hba; 261fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 262fcf3ce44SJohn Forte uintptr_t hbaptr = NULL; 263fcf3ce44SJohn Forte 264fcf3ce44SJohn Forte if ((flags & DCMD_ADDRSPEC) || argc != 0) { 265fcf3ce44SJohn Forte return (DCMD_USAGE); 266fcf3ce44SJohn Forte } 267fcf3ce44SJohn Forte 268fcf3ce44SJohn Forte if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 269fcf3ce44SJohn Forte mdb_warn("failed to read ql_hba structure"); 270fcf3ce44SJohn Forte return (DCMD_ERR); 271fcf3ce44SJohn Forte } 272fcf3ce44SJohn Forte 273fcf3ce44SJohn Forte if (&ql_hba == NULL) { 274fcf3ce44SJohn Forte mdb_warn("failed to read ql_hba structure -- is qlc loaded?"); 275fcf3ce44SJohn Forte return (DCMD_ERR); 276fcf3ce44SJohn Forte } 277fcf3ce44SJohn Forte 278fcf3ce44SJohn Forte mdb_printf("\nqlc adapter state linkages (f=0x%llx, l=0x%llx)\n\n", 279fcf3ce44SJohn Forte ql_hba.first, ql_hba.last); 280fcf3ce44SJohn Forte 281fcf3ce44SJohn Forte if ((qlstate = (ql_adapter_state_t *)mdb_alloc( 282fcf3ce44SJohn Forte sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 283fcf3ce44SJohn Forte mdb_warn("Unable to allocate memory for ql_adapter_state\n"); 284fcf3ce44SJohn Forte return (DCMD_OK); 285fcf3ce44SJohn Forte } 286fcf3ce44SJohn Forte 287fcf3ce44SJohn Forte (void) mdb_inc_indent((ulong_t)4); 288fcf3ce44SJohn Forte mdb_printf("%<u>%-?s\t%-45s%</u>\n\n", "baseaddr", "instance"); 289fcf3ce44SJohn Forte 290fcf3ce44SJohn Forte hbaptr = (uintptr_t)ql_hba.first; 291fcf3ce44SJohn Forte while (hbaptr != NULL) { 292fcf3ce44SJohn Forte 293fcf3ce44SJohn Forte if (mdb_vread(qlstate, sizeof (ql_adapter_state_t), 294fcf3ce44SJohn Forte hbaptr) == -1) { 295fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 296fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", 297fcf3ce44SJohn Forte hbaptr); 298fcf3ce44SJohn Forte return (DCMD_OK); 299fcf3ce44SJohn Forte } 300fcf3ce44SJohn Forte 301fcf3ce44SJohn Forte mdb_printf("%<b>0x%016p%t%d%</b>\n", 302fcf3ce44SJohn Forte qlstate->hba.base_address, qlstate->instance); 303fcf3ce44SJohn Forte 304fcf3ce44SJohn Forte /* 305fcf3ce44SJohn Forte * If vp exists, loop through those 306fcf3ce44SJohn Forte */ 307fcf3ce44SJohn Forte 308fcf3ce44SJohn Forte if ((qlstate->flags & VP_ENABLED) && 309fcf3ce44SJohn Forte (qlstate->vp_next != NULL)) { 310fcf3ce44SJohn Forte 311fcf3ce44SJohn Forte ql_adapter_state_t *vqlstate; 312fcf3ce44SJohn Forte uintptr_t vhbaptr = NULL; 313fcf3ce44SJohn Forte 314fcf3ce44SJohn Forte vhbaptr = (uintptr_t)qlstate->vp_next; 315fcf3ce44SJohn Forte 316fcf3ce44SJohn Forte if ((vqlstate = (ql_adapter_state_t *)mdb_alloc( 317fcf3ce44SJohn Forte sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 318fcf3ce44SJohn Forte mdb_warn("Unable to allocate memory for " 319fcf3ce44SJohn Forte "ql_adapter_state vp\n"); 320fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 321fcf3ce44SJohn Forte return (DCMD_OK); 322fcf3ce44SJohn Forte } 323fcf3ce44SJohn Forte 324fcf3ce44SJohn Forte (void) mdb_inc_indent((ulong_t)30); 325fcf3ce44SJohn Forte 326fcf3ce44SJohn Forte mdb_printf("%<u>vp baseaddr\t\tvp index%</u>\n"); 327fcf3ce44SJohn Forte 328fcf3ce44SJohn Forte while (vhbaptr != NULL) { 329fcf3ce44SJohn Forte 330fcf3ce44SJohn Forte if (mdb_vread(vqlstate, 33116dd44c2SDaniel Beauregard sizeof (ql_adapter_state_t), vhbaptr) == 33216dd44c2SDaniel Beauregard -1) { 333fcf3ce44SJohn Forte mdb_free(vqlstate, 334fcf3ce44SJohn Forte sizeof (ql_adapter_state_t)); 335fcf3ce44SJohn Forte mdb_free(qlstate, 336fcf3ce44SJohn Forte sizeof (ql_adapter_state_t)); 337fcf3ce44SJohn Forte mdb_warn("failed to read vp " 338fcf3ce44SJohn Forte "ql_adapter_state at %p", vhbaptr); 339fcf3ce44SJohn Forte return (DCMD_OK); 340fcf3ce44SJohn Forte } 341fcf3ce44SJohn Forte 342fcf3ce44SJohn Forte mdb_printf("%<b>0x%016p%t%d%</b>\n", 343fcf3ce44SJohn Forte vqlstate->hba.base_address, 344fcf3ce44SJohn Forte vqlstate->vp_index); 345fcf3ce44SJohn Forte 346fcf3ce44SJohn Forte vhbaptr = (uintptr_t)vqlstate->vp_next; 347fcf3ce44SJohn Forte } 348fcf3ce44SJohn Forte 349fcf3ce44SJohn Forte mdb_free(vqlstate, sizeof (ql_adapter_state_t)); 350fcf3ce44SJohn Forte 351fcf3ce44SJohn Forte (void) mdb_dec_indent((ulong_t)30); 352fcf3ce44SJohn Forte 353fcf3ce44SJohn Forte mdb_printf("\n"); 354fcf3ce44SJohn Forte } 355fcf3ce44SJohn Forte 356fcf3ce44SJohn Forte hbaptr = (uintptr_t)qlstate->hba.next; 357fcf3ce44SJohn Forte } 358fcf3ce44SJohn Forte 359fcf3ce44SJohn Forte (void) mdb_dec_indent((ulong_t)4); 360fcf3ce44SJohn Forte 361fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 362fcf3ce44SJohn Forte 363fcf3ce44SJohn Forte return (DCMD_OK); 364fcf3ce44SJohn Forte } 365fcf3ce44SJohn Forte 366fcf3ce44SJohn Forte /* 367fcf3ce44SJohn Forte * qlcver_dcmd 368fcf3ce44SJohn Forte * mdb dcmd which prints out the qlc driver version the mdb 369fcf3ce44SJohn Forte * module was compiled with, and the verison of qlc which is 370fcf3ce44SJohn Forte * currently loaded on the machine. 371fcf3ce44SJohn Forte * 372fcf3ce44SJohn Forte * Input: 373fcf3ce44SJohn Forte * addr = User supplied address -- error if supplied. 374fcf3ce44SJohn Forte * flags = mdb flags. 375fcf3ce44SJohn Forte * argc = Number of user supplied args -- error if non-zero. 376fcf3ce44SJohn Forte * argv = Arg array. 377fcf3ce44SJohn Forte * 378fcf3ce44SJohn Forte * Returns: 379fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 380fcf3ce44SJohn Forte * 381fcf3ce44SJohn Forte * Context: 382fcf3ce44SJohn Forte * User context. 383fcf3ce44SJohn Forte * 384fcf3ce44SJohn Forte */ 385fcf3ce44SJohn Forte /*ARGSUSED*/ 386fcf3ce44SJohn Forte static int 387fcf3ce44SJohn Forte qlcver_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 388fcf3ce44SJohn Forte { 389fcf3ce44SJohn Forte int8_t qlcversion[100]; 39016dd44c2SDaniel Beauregard struct fw_table fw_table[10], *fwt = NULL; 39116dd44c2SDaniel Beauregard uint8_t *fwverptr = NULL; 39216dd44c2SDaniel Beauregard ql_head_t ql_hba; 39316dd44c2SDaniel Beauregard uint32_t found = 0; 394fcf3ce44SJohn Forte 395fcf3ce44SJohn Forte if ((flags & DCMD_ADDRSPEC) || argc != 0) { 396fcf3ce44SJohn Forte return (DCMD_USAGE); 397fcf3ce44SJohn Forte } 398fcf3ce44SJohn Forte 399fcf3ce44SJohn Forte if (mdb_readvar(&qlcversion, "qlc_driver_version") == -1) { 400fcf3ce44SJohn Forte mdb_warn("unable to read qlc driver version\n"); 401fcf3ce44SJohn Forte } else { 40216dd44c2SDaniel Beauregard mdb_printf("\n%s version currently loaded is: %s\n", 403fcf3ce44SJohn Forte QL_NAME, qlcversion); 404fcf3ce44SJohn Forte } 405fcf3ce44SJohn Forte 40616dd44c2SDaniel Beauregard mdb_printf("qlc mdb library compiled with %s version: %s\n", 40716dd44c2SDaniel Beauregard QL_NAME, QL_VERSION); 40816dd44c2SDaniel Beauregard 40916dd44c2SDaniel Beauregard if ((fwverptr = (uint8_t *)(mdb_alloc(50, UM_SLEEP))) == NULL) { 41016dd44c2SDaniel Beauregard mdb_warn("unable to alloc fwverptr\n"); 41116dd44c2SDaniel Beauregard return (DCMD_OK); 41216dd44c2SDaniel Beauregard } 41316dd44c2SDaniel Beauregard 41416dd44c2SDaniel Beauregard if (mdb_readvar(&fw_table, "fw_table") == -1) { 41516dd44c2SDaniel Beauregard mdb_warn("unable to read firmware table\n"); 41616dd44c2SDaniel Beauregard } else { 41716dd44c2SDaniel Beauregard ql_adapter_state_t *qlstate; 41816dd44c2SDaniel Beauregard uintptr_t hbaptr = NULL; 41916dd44c2SDaniel Beauregard 42016dd44c2SDaniel Beauregard if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 42116dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure"); 42216dd44c2SDaniel Beauregard return (DCMD_ERR); 42316dd44c2SDaniel Beauregard } 42416dd44c2SDaniel Beauregard 42516dd44c2SDaniel Beauregard if ((qlstate = (ql_adapter_state_t *)mdb_alloc( 42616dd44c2SDaniel Beauregard sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 42716dd44c2SDaniel Beauregard mdb_warn("Unable to allocate memory for " 42816dd44c2SDaniel Beauregard "ql_adapter_state\n"); 42916dd44c2SDaniel Beauregard return (DCMD_OK); 43016dd44c2SDaniel Beauregard } 43116dd44c2SDaniel Beauregard 43216dd44c2SDaniel Beauregard mdb_printf("\n%-8s%-11s%s\n", "f/w", "compiled", "loaded"); 43316dd44c2SDaniel Beauregard mdb_printf("%<u>%-8s%-11s%-13s%s%</u>\n\n", "class", "version", 43416dd44c2SDaniel Beauregard "version", "instance list"); 43516dd44c2SDaniel Beauregard 43616dd44c2SDaniel Beauregard for (fwt = &fw_table[0]; fwt->fw_class; fwt++) { 43716dd44c2SDaniel Beauregard 43816dd44c2SDaniel Beauregard if (mdb_vread(fwverptr, sizeof (void *), 43916dd44c2SDaniel Beauregard (uintptr_t)fwt->fw_version) == -1) { 44016dd44c2SDaniel Beauregard mdb_warn("unable to read fwverptr\n"); 44116dd44c2SDaniel Beauregard mdb_free(fwverptr, sizeof (void *)); 44216dd44c2SDaniel Beauregard mdb_free(qlstate, sizeof (ql_adapter_state_t)); 44316dd44c2SDaniel Beauregard return (DCMD_OK); 44416dd44c2SDaniel Beauregard } 44516dd44c2SDaniel Beauregard 44616dd44c2SDaniel Beauregard mdb_printf("%x\t%-11s", fwt->fw_class, fwverptr); 44716dd44c2SDaniel Beauregard 44816dd44c2SDaniel Beauregard if (&ql_hba == NULL) { 44916dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure"); 45016dd44c2SDaniel Beauregard hbaptr = NULL; 45116dd44c2SDaniel Beauregard } else { 45216dd44c2SDaniel Beauregard hbaptr = (uintptr_t)ql_hba.first; 45316dd44c2SDaniel Beauregard } 45416dd44c2SDaniel Beauregard 45516dd44c2SDaniel Beauregard found = 0; 45616dd44c2SDaniel Beauregard while (hbaptr != NULL) { 45716dd44c2SDaniel Beauregard 45816dd44c2SDaniel Beauregard if (mdb_vread(qlstate, 45916dd44c2SDaniel Beauregard sizeof (ql_adapter_state_t), hbaptr) == 46016dd44c2SDaniel Beauregard -1) { 46116dd44c2SDaniel Beauregard mdb_warn("failed to read " 46216dd44c2SDaniel Beauregard "ql_adapter_state at %p", hbaptr); 46316dd44c2SDaniel Beauregard break; 46416dd44c2SDaniel Beauregard } 46516dd44c2SDaniel Beauregard 46616dd44c2SDaniel Beauregard if (qlstate->fw_class == fwt->fw_class) { 46716dd44c2SDaniel Beauregard if (found == 0) { 46816dd44c2SDaniel Beauregard mdb_printf("%x.%02x.%02x\t", 46916dd44c2SDaniel Beauregard qlstate->fw_major_version, 47016dd44c2SDaniel Beauregard qlstate->fw_minor_version, 47116dd44c2SDaniel Beauregard qlstate-> 47216dd44c2SDaniel Beauregard fw_subminor_version); 47316dd44c2SDaniel Beauregard mdb_printf("%d", 47416dd44c2SDaniel Beauregard qlstate->instance); 47516dd44c2SDaniel Beauregard } else { 47616dd44c2SDaniel Beauregard mdb_printf(", %d", 47716dd44c2SDaniel Beauregard qlstate->instance); 47816dd44c2SDaniel Beauregard } 47916dd44c2SDaniel Beauregard found = 1; 48016dd44c2SDaniel Beauregard } 48116dd44c2SDaniel Beauregard 48216dd44c2SDaniel Beauregard hbaptr = (uintptr_t)qlstate->hba.next; 48316dd44c2SDaniel Beauregard } 48416dd44c2SDaniel Beauregard 48516dd44c2SDaniel Beauregard if (found == 1) { 48616dd44c2SDaniel Beauregard mdb_printf("\n"); 48716dd44c2SDaniel Beauregard } else { 48816dd44c2SDaniel Beauregard mdb_printf("not loaded\n"); 48916dd44c2SDaniel Beauregard } 49016dd44c2SDaniel Beauregard } 49116dd44c2SDaniel Beauregard 49216dd44c2SDaniel Beauregard mdb_free(qlstate, sizeof (ql_adapter_state_t)); 49316dd44c2SDaniel Beauregard mdb_free(fwverptr, sizeof (void *)); 49416dd44c2SDaniel Beauregard } 49516dd44c2SDaniel Beauregard 496fcf3ce44SJohn Forte return (DCMD_OK); 497fcf3ce44SJohn Forte } 498fcf3ce44SJohn Forte 499fcf3ce44SJohn Forte /* 500fcf3ce44SJohn Forte * qlc_el_dcmd 501fcf3ce44SJohn Forte * mdb dcmd which turns the extended logging bit on or off 502fcf3ce44SJohn Forte * for the specificed qlc instance(s). 503fcf3ce44SJohn Forte * 504fcf3ce44SJohn Forte * Input: 505fcf3ce44SJohn Forte * addr = User supplied address -- error if supplied. 506fcf3ce44SJohn Forte * flags = mdb flags. 507fcf3ce44SJohn Forte * argc = Number of user supplied args -- error if non-zero. 508fcf3ce44SJohn Forte * argv = Arg array. 509fcf3ce44SJohn Forte * 510fcf3ce44SJohn Forte * Returns: 511fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 512fcf3ce44SJohn Forte * 513fcf3ce44SJohn Forte * Context: 514fcf3ce44SJohn Forte * User context. 515fcf3ce44SJohn Forte * 516fcf3ce44SJohn Forte */ 517fcf3ce44SJohn Forte /*ARGSUSED*/ 518fcf3ce44SJohn Forte static int 519fcf3ce44SJohn Forte qlc_el_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 520fcf3ce44SJohn Forte { 521fcf3ce44SJohn Forte int8_t qlcversion[100]; 522fcf3ce44SJohn Forte boolean_t elswitch; 523fcf3ce44SJohn Forte uint32_t argcnt; 524fcf3ce44SJohn Forte int mdbs; 525fcf3ce44SJohn Forte uint32_t instance; 526fcf3ce44SJohn Forte uint32_t qlsize = sizeof (ql_adapter_state_t); 527fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 528fcf3ce44SJohn Forte uintptr_t hbaptr = NULL; 529fcf3ce44SJohn Forte ql_head_t ql_hba; 530fcf3ce44SJohn Forte 531fcf3ce44SJohn Forte if ((mdbs = mdb_get_state()) == MDB_STATE_DEAD) { 532fcf3ce44SJohn Forte mdb_warn("Cannot change core file data (state=%xh)\n", mdbs); 533fcf3ce44SJohn Forte return (DCMD_OK); 534fcf3ce44SJohn Forte } 535fcf3ce44SJohn Forte 536fcf3ce44SJohn Forte if ((flags & DCMD_ADDRSPEC) || argc < 2) { 537fcf3ce44SJohn Forte return (DCMD_USAGE); 538fcf3ce44SJohn Forte } 539fcf3ce44SJohn Forte 540fcf3ce44SJohn Forte /* 541fcf3ce44SJohn Forte * Check and make sure the driver version and the mdb versions 542fcf3ce44SJohn Forte * match so all the structures and flags line up 543fcf3ce44SJohn Forte */ 544fcf3ce44SJohn Forte 545fcf3ce44SJohn Forte if (mdb_readvar(&qlcversion, "qlc_driver_version") == -1) { 546fcf3ce44SJohn Forte mdb_warn("unable to read qlc driver version\n"); 547fcf3ce44SJohn Forte return (DCMD_OK); 548fcf3ce44SJohn Forte } 549fcf3ce44SJohn Forte 550fcf3ce44SJohn Forte if ((strcmp(QL_VERSION, (const char *)&qlcversion)) != 0) { 551fcf3ce44SJohn Forte mdb_warn("Error: qlc driver/qlc mdb version mismatch\n"); 552fcf3ce44SJohn Forte mdb_printf("\tqlc mdb library compiled version is: %s\n", 553fcf3ce44SJohn Forte QL_VERSION); 554fcf3ce44SJohn Forte mdb_printf("\tqlc driver version is: %s\n", qlcversion); 555fcf3ce44SJohn Forte 556fcf3ce44SJohn Forte return (DCMD_OK); 557fcf3ce44SJohn Forte } 558fcf3ce44SJohn Forte 559fcf3ce44SJohn Forte if ((strcasecmp(argv[0].a_un.a_str, "on")) == 0) { 560fcf3ce44SJohn Forte elswitch = TRUE; 561fcf3ce44SJohn Forte } else if ((strcasecmp(argv[0].a_un.a_str, "off")) == 0) { 562fcf3ce44SJohn Forte elswitch = FALSE; 563fcf3ce44SJohn Forte } else { 564fcf3ce44SJohn Forte return (DCMD_USAGE); 565fcf3ce44SJohn Forte } 566fcf3ce44SJohn Forte 567fcf3ce44SJohn Forte if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 568fcf3ce44SJohn Forte mdb_warn("failed to read ql_hba structure"); 569fcf3ce44SJohn Forte return (DCMD_ERR); 570fcf3ce44SJohn Forte } 571fcf3ce44SJohn Forte 572fcf3ce44SJohn Forte if (&ql_hba == NULL) { 573fcf3ce44SJohn Forte mdb_warn("failed to read ql_hba structure - is qlc loaded?"); 574fcf3ce44SJohn Forte return (DCMD_ERR); 575fcf3ce44SJohn Forte } 576fcf3ce44SJohn Forte 577fcf3ce44SJohn Forte if ((qlstate = (ql_adapter_state_t *)mdb_alloc(qlsize, 578fcf3ce44SJohn Forte UM_SLEEP)) == NULL) { 579fcf3ce44SJohn Forte mdb_warn("Unable to allocate memory for " 580fcf3ce44SJohn Forte "ql_adapter_state\n"); 581fcf3ce44SJohn Forte return (DCMD_OK); 582fcf3ce44SJohn Forte } 583fcf3ce44SJohn Forte 584fcf3ce44SJohn Forte if ((strcasecmp(argv[1].a_un.a_str, "all")) == 0) { 585fcf3ce44SJohn Forte 586fcf3ce44SJohn Forte if (argc != 2) { 587fcf3ce44SJohn Forte mdb_free(qlstate, qlsize); 588fcf3ce44SJohn Forte return (DCMD_USAGE); 589fcf3ce44SJohn Forte } 590fcf3ce44SJohn Forte 591fcf3ce44SJohn Forte hbaptr = (uintptr_t)ql_hba.first; 592fcf3ce44SJohn Forte 593fcf3ce44SJohn Forte while (hbaptr != NULL) { 594fcf3ce44SJohn Forte 595fcf3ce44SJohn Forte if (mdb_vread(qlstate, qlsize, hbaptr) == -1) { 596fcf3ce44SJohn Forte mdb_free(qlstate, qlsize); 597fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state " 598fcf3ce44SJohn Forte "at %p", hbaptr); 599fcf3ce44SJohn Forte return (DCMD_OK); 600fcf3ce44SJohn Forte } 601fcf3ce44SJohn Forte 602fcf3ce44SJohn Forte ql_elog_common(qlstate, elswitch); 603fcf3ce44SJohn Forte 604fcf3ce44SJohn Forte hbaptr = (uintptr_t)qlstate->hba.next; 605fcf3ce44SJohn Forte } 606fcf3ce44SJohn Forte } else { 607fcf3ce44SJohn Forte for (argcnt = 1; argcnt < argc; argcnt++) { 608fcf3ce44SJohn Forte 609fcf3ce44SJohn Forte instance = (uint32_t)mdb_strtoull( 610fcf3ce44SJohn Forte argv[argcnt].a_un.a_str); 611fcf3ce44SJohn Forte 612fcf3ce44SJohn Forte /* find the correct instance to change */ 613fcf3ce44SJohn Forte hbaptr = (uintptr_t)ql_hba.first; 614fcf3ce44SJohn Forte while (hbaptr != NULL) { 615fcf3ce44SJohn Forte 616fcf3ce44SJohn Forte if (mdb_vread(qlstate, qlsize, hbaptr) == -1) { 617fcf3ce44SJohn Forte mdb_free(qlstate, qlsize); 61816dd44c2SDaniel Beauregard mdb_warn("failed to read " 61916dd44c2SDaniel Beauregard "ql_adapter_state at %p", hbaptr); 620fcf3ce44SJohn Forte return (DCMD_OK); 621fcf3ce44SJohn Forte } 622fcf3ce44SJohn Forte 623fcf3ce44SJohn Forte if (qlstate->instance == instance) { 624fcf3ce44SJohn Forte break; 625fcf3ce44SJohn Forte } 626fcf3ce44SJohn Forte 627fcf3ce44SJohn Forte hbaptr = (uintptr_t)qlstate->hba.next; 628fcf3ce44SJohn Forte } 629fcf3ce44SJohn Forte 630fcf3ce44SJohn Forte if (hbaptr == NULL) { 631fcf3ce44SJohn Forte mdb_printf("instance %d is not loaded", 632fcf3ce44SJohn Forte instance); 633fcf3ce44SJohn Forte continue; 634fcf3ce44SJohn Forte } 635fcf3ce44SJohn Forte 636fcf3ce44SJohn Forte ql_elog_common(qlstate, elswitch); 637fcf3ce44SJohn Forte } 638fcf3ce44SJohn Forte } 639fcf3ce44SJohn Forte 640fcf3ce44SJohn Forte mdb_free(qlstate, qlsize); 641fcf3ce44SJohn Forte 642fcf3ce44SJohn Forte return (DCMD_OK); 643fcf3ce44SJohn Forte } 644fcf3ce44SJohn Forte 645fcf3ce44SJohn Forte /* 646fcf3ce44SJohn Forte * qlc_elog_common 647fcf3ce44SJohn Forte * mdb helper function which set/resets the extended logging bit 648fcf3ce44SJohn Forte * 649fcf3ce44SJohn Forte * Input: 650fcf3ce44SJohn Forte * qlstate = adapter state structure 651fcf3ce44SJohn Forte * elswitch = boolean which specifies to reset (0) or set (1) the 652fcf3ce44SJohn Forte * extended logging bit. 653fcf3ce44SJohn Forte * 654fcf3ce44SJohn Forte * Returns: 655fcf3ce44SJohn Forte * 656fcf3ce44SJohn Forte * Context: 657fcf3ce44SJohn Forte * User context. 658fcf3ce44SJohn Forte * 659fcf3ce44SJohn Forte */ 660fcf3ce44SJohn Forte static void 661fcf3ce44SJohn Forte ql_elog_common(ql_adapter_state_t *qlstate, boolean_t elswitch) 662fcf3ce44SJohn Forte { 663fcf3ce44SJohn Forte uintptr_t hbaptr = (uintptr_t)qlstate->hba.base_address; 664fcf3ce44SJohn Forte size_t qlsize = sizeof (ql_adapter_state_t); 665fcf3ce44SJohn Forte 666fcf3ce44SJohn Forte if (elswitch) { 667fcf3ce44SJohn Forte if ((qlstate->cfg_flags & CFG_ENABLE_EXTENDED_LOGGING) == 0) { 668fcf3ce44SJohn Forte 669fcf3ce44SJohn Forte qlstate->cfg_flags |= CFG_ENABLE_EXTENDED_LOGGING; 670fcf3ce44SJohn Forte 671fcf3ce44SJohn Forte if ((mdb_vwrite((const void *)qlstate, qlsize, 672fcf3ce44SJohn Forte hbaptr)) != (ssize_t)qlsize) { 673fcf3ce44SJohn Forte mdb_warn("instance %d - unable to update", 674fcf3ce44SJohn Forte qlstate->instance); 675fcf3ce44SJohn Forte } else { 676fcf3ce44SJohn Forte mdb_printf("instance %d extended logging is " 677fcf3ce44SJohn Forte "now on\n", qlstate->instance); 678fcf3ce44SJohn Forte } 679fcf3ce44SJohn Forte } else { 680fcf3ce44SJohn Forte mdb_printf("instance %d extended logging is " 681fcf3ce44SJohn Forte "already on\n", qlstate->instance); 682fcf3ce44SJohn Forte } 683fcf3ce44SJohn Forte } else { 684fcf3ce44SJohn Forte if ((qlstate->cfg_flags & CFG_ENABLE_EXTENDED_LOGGING) != 0) { 685fcf3ce44SJohn Forte 686fcf3ce44SJohn Forte qlstate->cfg_flags &= ~CFG_ENABLE_EXTENDED_LOGGING; 687fcf3ce44SJohn Forte 688fcf3ce44SJohn Forte if ((mdb_vwrite((const void *)qlstate, qlsize, 689fcf3ce44SJohn Forte hbaptr)) != (ssize_t)qlsize) { 690fcf3ce44SJohn Forte mdb_warn("instance %d - unable to update", 691fcf3ce44SJohn Forte qlstate->instance); 692fcf3ce44SJohn Forte } else { 693fcf3ce44SJohn Forte mdb_printf("instance %d extended logging is " 694fcf3ce44SJohn Forte "now off\n", qlstate->instance); 695fcf3ce44SJohn Forte } 696fcf3ce44SJohn Forte } else { 697fcf3ce44SJohn Forte mdb_printf("instance %d extended logging is " 698fcf3ce44SJohn Forte "already off\n", qlstate->instance); 699fcf3ce44SJohn Forte } 700fcf3ce44SJohn Forte } 701fcf3ce44SJohn Forte } 702fcf3ce44SJohn Forte 703fcf3ce44SJohn Forte /* 704fcf3ce44SJohn Forte * qlc_ocs_dcmd 705fcf3ce44SJohn Forte * mdb dcmd which prints out the outstanding command array using 706fcf3ce44SJohn Forte * caller supplied address (which sb the ha structure). 707fcf3ce44SJohn Forte * 708fcf3ce44SJohn Forte * Input: 709fcf3ce44SJohn Forte * addr = User supplied ha address. 710fcf3ce44SJohn Forte * flags = mdb flags. 711fcf3ce44SJohn Forte * argc = Number of user supplied args. 712fcf3ce44SJohn Forte * argv = Arg array. 713fcf3ce44SJohn Forte * 714fcf3ce44SJohn Forte * Returns: 715fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 716fcf3ce44SJohn Forte * 717fcf3ce44SJohn Forte * Context: 718fcf3ce44SJohn Forte * User context. 719fcf3ce44SJohn Forte * 720fcf3ce44SJohn Forte * 721fcf3ce44SJohn Forte */ 722fcf3ce44SJohn Forte static int 723fcf3ce44SJohn Forte /*ARGSUSED*/ 724fcf3ce44SJohn Forte qlc_osc_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 725fcf3ce44SJohn Forte { 726fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 727fcf3ce44SJohn Forte uintptr_t qlosc, ptr1; 728fcf3ce44SJohn Forte uint32_t indx, found = 0; 729fcf3ce44SJohn Forte ql_srb_t *qlsrb; 730fcf3ce44SJohn Forte 731fcf3ce44SJohn Forte if (!(flags & DCMD_ADDRSPEC)) { 732fcf3ce44SJohn Forte return (DCMD_USAGE); 733fcf3ce44SJohn Forte } 734fcf3ce44SJohn Forte 735fcf3ce44SJohn Forte if ((qlstate = (ql_adapter_state_t *) 736fcf3ce44SJohn Forte mdb_alloc(sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 737fcf3ce44SJohn Forte mdb_warn("Unable to allocate memory for ql_adapter_state\n"); 738fcf3ce44SJohn Forte return (DCMD_OK); 739fcf3ce44SJohn Forte } 740fcf3ce44SJohn Forte if (mdb_vread(qlstate, sizeof (ql_adapter_state_t), addr) == -1) { 741fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 742fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", addr); 743fcf3ce44SJohn Forte return (DCMD_OK); 744fcf3ce44SJohn Forte } 745fcf3ce44SJohn Forte 746fcf3ce44SJohn Forte qlosc = (uintptr_t)qlstate->outstanding_cmds; 747fcf3ce44SJohn Forte mdb_printf("qlc instance: %d, base addr = %llx, osc base = %p\n", 748fcf3ce44SJohn Forte qlstate->instance, qlstate->hba.base_address, qlosc); 749fcf3ce44SJohn Forte 750fcf3ce44SJohn Forte if ((qlsrb = (ql_srb_t *)mdb_alloc(sizeof (ql_srb_t), UM_SLEEP)) == 751fcf3ce44SJohn Forte NULL) { 752fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 753fcf3ce44SJohn Forte mdb_warn("failed to allocate space for srb_t\n"); 754fcf3ce44SJohn Forte return (DCMD_OK); 755fcf3ce44SJohn Forte } 756fcf3ce44SJohn Forte for (indx = 0; indx < MAX_OUTSTANDING_COMMANDS; indx++, qlosc += 8) { 757fcf3ce44SJohn Forte if (mdb_vread(&ptr1, 8, qlosc) == -1) { 758fcf3ce44SJohn Forte mdb_warn("failed to read ptr1, indx=%d", indx); 759fcf3ce44SJohn Forte break; 760fcf3ce44SJohn Forte } 761fcf3ce44SJohn Forte if (ptr1 == 0) { 762fcf3ce44SJohn Forte continue; 763fcf3ce44SJohn Forte } 764fcf3ce44SJohn Forte 765fcf3ce44SJohn Forte mdb_printf("osc ptr = %p, indx = %xh\n", ptr1, indx); 766fcf3ce44SJohn Forte 767fcf3ce44SJohn Forte if (mdb_vread(qlsrb, sizeof (ql_srb_t), ptr1) == -1) { 768fcf3ce44SJohn Forte mdb_warn("failed to read ql_srb_t at %p", ptr1); 769fcf3ce44SJohn Forte break; 770fcf3ce44SJohn Forte } 771fcf3ce44SJohn Forte (void) ql_doprint(ptr1, "struct ql_srb"); 772fcf3ce44SJohn Forte found++; 773fcf3ce44SJohn Forte } 774fcf3ce44SJohn Forte 775fcf3ce44SJohn Forte mdb_free(qlsrb, sizeof (ql_srb_t)); 776fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 777fcf3ce44SJohn Forte 778fcf3ce44SJohn Forte mdb_printf("number of outstanding command srb's is: %d\n", found); 779fcf3ce44SJohn Forte 780fcf3ce44SJohn Forte return (DCMD_OK); 781fcf3ce44SJohn Forte } 782fcf3ce44SJohn Forte 783fcf3ce44SJohn Forte /* 784fcf3ce44SJohn Forte * qlc_wdog_dcmd 785fcf3ce44SJohn Forte * mdb dcmd which prints out the commands which are linked 786fcf3ce44SJohn Forte * on the watchdog linked list. Caller supplied address (which 787fcf3ce44SJohn Forte * sb the ha structure). 788fcf3ce44SJohn Forte * 789fcf3ce44SJohn Forte * Input: 790fcf3ce44SJohn Forte * addr = User supplied ha address. 791fcf3ce44SJohn Forte * flags = mdb flags. 792fcf3ce44SJohn Forte * argc = Number of user supplied args. 793fcf3ce44SJohn Forte * argv = Arg array. 794fcf3ce44SJohn Forte * 795fcf3ce44SJohn Forte * Returns: 796fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 797fcf3ce44SJohn Forte * 798fcf3ce44SJohn Forte * Context: 799fcf3ce44SJohn Forte * User context. 800fcf3ce44SJohn Forte * 801fcf3ce44SJohn Forte * 802fcf3ce44SJohn Forte */ 803fcf3ce44SJohn Forte static int 804fcf3ce44SJohn Forte /*ARGSUSED*/ 805fcf3ce44SJohn Forte qlc_wdog_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 806fcf3ce44SJohn Forte { 807fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 808fcf3ce44SJohn Forte uint16_t index, count; 809fcf3ce44SJohn Forte ql_head_t *dev; 810fcf3ce44SJohn Forte ql_srb_t *srb; 811fcf3ce44SJohn Forte ql_tgt_t *tq; 812fcf3ce44SJohn Forte ql_lun_t *lq; 813fcf3ce44SJohn Forte ql_link_t *tqlink, *srblink, *lqlink; 814fcf3ce44SJohn Forte int nextlink; 815fcf3ce44SJohn Forte 816fcf3ce44SJohn Forte if (!(flags & DCMD_ADDRSPEC)) { 817fcf3ce44SJohn Forte mdb_warn("Address required\n", addr); 818fcf3ce44SJohn Forte return (DCMD_USAGE); 819fcf3ce44SJohn Forte } 820fcf3ce44SJohn Forte 821fcf3ce44SJohn Forte if ((qlstate = (ql_adapter_state_t *) 822fcf3ce44SJohn Forte mdb_alloc(sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 823fcf3ce44SJohn Forte mdb_warn("Unable to allocate memory for ql_adapter_state\n"); 824fcf3ce44SJohn Forte return (DCMD_OK); 825fcf3ce44SJohn Forte } 826fcf3ce44SJohn Forte 827fcf3ce44SJohn Forte if (mdb_vread(qlstate, sizeof (ql_adapter_state_t), addr) == -1) { 828fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 829fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", addr); 830fcf3ce44SJohn Forte return (DCMD_OK); 831fcf3ce44SJohn Forte } 832fcf3ce44SJohn Forte 833fcf3ce44SJohn Forte /* 834fcf3ce44SJohn Forte * Read in the device array 835fcf3ce44SJohn Forte */ 836fcf3ce44SJohn Forte dev = (ql_head_t *) 837fcf3ce44SJohn Forte mdb_alloc(sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE, UM_SLEEP); 838fcf3ce44SJohn Forte 839fcf3ce44SJohn Forte if (mdb_vread(dev, sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE, 840fcf3ce44SJohn Forte (uintptr_t)qlstate->dev) == -1) { 841fcf3ce44SJohn Forte mdb_warn("failed to read ql_head_t (dev) at %p", qlstate->dev); 842fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 843fcf3ce44SJohn Forte mdb_free(dev, sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE); 844fcf3ce44SJohn Forte return (DCMD_OK); 845fcf3ce44SJohn Forte } 846fcf3ce44SJohn Forte 847fcf3ce44SJohn Forte tqlink = (ql_link_t *)mdb_alloc(sizeof (ql_link_t), UM_SLEEP); 848fcf3ce44SJohn Forte tq = (ql_tgt_t *)mdb_alloc(sizeof (ql_tgt_t), UM_SLEEP); 849fcf3ce44SJohn Forte lqlink = (ql_link_t *)mdb_alloc(sizeof (ql_link_t), UM_SLEEP); 850fcf3ce44SJohn Forte lq = (ql_lun_t *)mdb_alloc(sizeof (ql_lun_t), UM_SLEEP); 851fcf3ce44SJohn Forte srblink = (ql_link_t *)mdb_alloc(sizeof (ql_link_t), UM_SLEEP); 852fcf3ce44SJohn Forte srb = (ql_srb_t *)mdb_alloc(sizeof (ql_srb_t), UM_SLEEP); 853fcf3ce44SJohn Forte 854fcf3ce44SJohn Forte /* 855fcf3ce44SJohn Forte * Validate the devices watchdog queue 856fcf3ce44SJohn Forte */ 857fcf3ce44SJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) { 858fcf3ce44SJohn Forte 859fcf3ce44SJohn Forte /* Skip empty ones */ 860fcf3ce44SJohn Forte if (dev[index].first == NULL) { 861fcf3ce44SJohn Forte continue; 862fcf3ce44SJohn Forte } 863fcf3ce44SJohn Forte 864fcf3ce44SJohn Forte mdb_printf("dev array index = %x\n", index); 865fcf3ce44SJohn Forte 866fcf3ce44SJohn Forte /* Loop through targets on device linked list */ 867fcf3ce44SJohn Forte /* get the first link */ 868fcf3ce44SJohn Forte 869fcf3ce44SJohn Forte nextlink = get_first_link(&dev[index], tqlink); 870fcf3ce44SJohn Forte 871fcf3ce44SJohn Forte /* 872fcf3ce44SJohn Forte * traverse the targets linked list at this device array index. 873fcf3ce44SJohn Forte */ 874fcf3ce44SJohn Forte while (nextlink == DCMD_OK) { 875fcf3ce44SJohn Forte /* Get the target */ 876fcf3ce44SJohn Forte if (mdb_vread(tq, sizeof (ql_tgt_t), 877fcf3ce44SJohn Forte (uintptr_t)(tqlink->base_address)) == -1) { 878fcf3ce44SJohn Forte mdb_warn("failed to read ql_tgt at %p", 879fcf3ce44SJohn Forte tqlink->base_address); 880fcf3ce44SJohn Forte break; 881fcf3ce44SJohn Forte } 882fcf3ce44SJohn Forte mdb_printf("tgt q base = %llx, ", 883fcf3ce44SJohn Forte tqlink->base_address); 884fcf3ce44SJohn Forte 885fcf3ce44SJohn Forte mdb_printf("flags: (%xh)", tq->flags); 886fcf3ce44SJohn Forte 887fcf3ce44SJohn Forte if (tq->flags) { 888fcf3ce44SJohn Forte ql_dump_flags((uint64_t)tq->flags, qltgt_flags); 889fcf3ce44SJohn Forte } 890fcf3ce44SJohn Forte 891fcf3ce44SJohn Forte mdb_printf("tgt: %02x%02x%02x%02x%02x%02x%02x%02x ", 892fcf3ce44SJohn Forte tq->node_name[0], tq->node_name[1], 893fcf3ce44SJohn Forte tq->node_name[2], tq->node_name[3], 894fcf3ce44SJohn Forte tq->node_name[4], tq->node_name[5], 895fcf3ce44SJohn Forte tq->node_name[6], tq->node_name[7]); 896fcf3ce44SJohn Forte 897fcf3ce44SJohn Forte /* 898fcf3ce44SJohn Forte * Loop through commands on this targets watchdog queue. 899fcf3ce44SJohn Forte */ 900fcf3ce44SJohn Forte 901fcf3ce44SJohn Forte /* Get the first link on the targets cmd wdg q. */ 902fcf3ce44SJohn Forte if (tq->wdg.first == NULL) { 903fcf3ce44SJohn Forte mdb_printf(" watchdog list empty "); 904fcf3ce44SJohn Forte break; 905fcf3ce44SJohn Forte } else { 906fcf3ce44SJohn Forte if (mdb_vread(srblink, sizeof (ql_link_t), 907fcf3ce44SJohn Forte (uintptr_t)tq->wdg.first) == -1) { 908fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t" 909fcf3ce44SJohn Forte " at %p", tq->wdg.first); 910fcf3ce44SJohn Forte break; 911fcf3ce44SJohn Forte } 912fcf3ce44SJohn Forte /* There is aleast one. */ 913fcf3ce44SJohn Forte count = 1; 914fcf3ce44SJohn Forte /* 915fcf3ce44SJohn Forte * Count the remaining items in the 916fcf3ce44SJohn Forte * cmd watchdog list. 917fcf3ce44SJohn Forte */ 918fcf3ce44SJohn Forte while (srblink->next != NULL) { 919fcf3ce44SJohn Forte /* Read in the next ql_link_t header */ 920fcf3ce44SJohn Forte if (mdb_vread(srblink, 921fcf3ce44SJohn Forte sizeof (ql_link_t), 922fcf3ce44SJohn Forte (uintptr_t)srblink->next) == -1) { 923fcf3ce44SJohn Forte mdb_warn("failed to read" 924fcf3ce44SJohn Forte " ql_link_t next at %p", 925fcf3ce44SJohn Forte srblink->next); 926fcf3ce44SJohn Forte break; 927fcf3ce44SJohn Forte } 928fcf3ce44SJohn Forte count = (uint16_t)(count + 1); 929fcf3ce44SJohn Forte } 930fcf3ce44SJohn Forte mdb_printf(" watchdog list: %d entries\n", 931fcf3ce44SJohn Forte count); 932fcf3ce44SJohn Forte /* get the first one again */ 933fcf3ce44SJohn Forte if (mdb_vread(srblink, sizeof (ql_link_t), 934fcf3ce44SJohn Forte (uintptr_t)tq->wdg.first) == -1) { 935fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t" 936fcf3ce44SJohn Forte " at %p", tq->wdg.first); 937fcf3ce44SJohn Forte break; 938fcf3ce44SJohn Forte } 939fcf3ce44SJohn Forte } 940fcf3ce44SJohn Forte /* 941fcf3ce44SJohn Forte * Traverse the targets cmd watchdog linked list 942fcf3ce44SJohn Forte * verifying srb's from the list are on a lun cmd list. 943fcf3ce44SJohn Forte */ 944fcf3ce44SJohn Forte while (nextlink == DCMD_OK) { 945fcf3ce44SJohn Forte int found = 0; 946fcf3ce44SJohn Forte /* get the srb */ 947fcf3ce44SJohn Forte if (mdb_vread(srb, sizeof (ql_srb_t), 948fcf3ce44SJohn Forte (uintptr_t)srblink->base_address) == -1) { 949fcf3ce44SJohn Forte mdb_warn("failed to read ql_srb_t" 950fcf3ce44SJohn Forte " at %p", srblink->base_address); 951fcf3ce44SJohn Forte break; 952fcf3ce44SJohn Forte } 953fcf3ce44SJohn Forte mdb_printf("ql_srb %llx ", 954fcf3ce44SJohn Forte srblink->base_address); 955fcf3ce44SJohn Forte 956fcf3ce44SJohn Forte /* 957fcf3ce44SJohn Forte * Get the lun q the srb is on 958fcf3ce44SJohn Forte */ 959fcf3ce44SJohn Forte if (mdb_vread(lq, sizeof (ql_lun_t), 960fcf3ce44SJohn Forte (uintptr_t)srb->lun_queue) == -1) { 961fcf3ce44SJohn Forte mdb_warn("failed to read ql_srb_t" 962fcf3ce44SJohn Forte " at %p", srb->lun_queue); 963fcf3ce44SJohn Forte break; 964fcf3ce44SJohn Forte } 965fcf3ce44SJohn Forte nextlink = get_first_link(&lq->cmd, lqlink); 966fcf3ce44SJohn Forte /* 967fcf3ce44SJohn Forte * traverse the lun cmd linked list looking 968fcf3ce44SJohn Forte * for the srb from the targets watchdog list 969fcf3ce44SJohn Forte */ 970fcf3ce44SJohn Forte while (nextlink == DCMD_OK) { 971fcf3ce44SJohn Forte if (srblink->base_address == 972fcf3ce44SJohn Forte lqlink->base_address) { 973fcf3ce44SJohn Forte mdb_printf("on lun %d cmd q\n", 974fcf3ce44SJohn Forte lq->lun_no); 975fcf3ce44SJohn Forte found = 1; 976fcf3ce44SJohn Forte break; 977fcf3ce44SJohn Forte } 978fcf3ce44SJohn Forte /* get next item on lun cmd list */ 979fcf3ce44SJohn Forte nextlink = get_next_link(lqlink); 980fcf3ce44SJohn Forte } 981fcf3ce44SJohn Forte if (!found) { 982fcf3ce44SJohn Forte mdb_printf("not found on lun cmd q\n"); 983fcf3ce44SJohn Forte } 984fcf3ce44SJohn Forte /* get next item in the watchdog list */ 985fcf3ce44SJohn Forte nextlink = get_next_link(srblink); 986fcf3ce44SJohn Forte } /* End targets command watchdog list */ 987fcf3ce44SJohn Forte /* get next item in this target list */ 988fcf3ce44SJohn Forte nextlink = get_next_link(tqlink); 989fcf3ce44SJohn Forte } /* End traverse the device targets linked list */ 990fcf3ce44SJohn Forte mdb_printf("\n"); 991fcf3ce44SJohn Forte } /* End device array */ 992fcf3ce44SJohn Forte 993fcf3ce44SJohn Forte mdb_free(tq, sizeof (ql_tgt_t)); 994fcf3ce44SJohn Forte mdb_free(lq, sizeof (ql_lun_t)); 995fcf3ce44SJohn Forte mdb_free(srb, sizeof (ql_srb_t)); 996fcf3ce44SJohn Forte mdb_free(tqlink, sizeof (ql_link_t)); 997fcf3ce44SJohn Forte mdb_free(srblink, sizeof (ql_link_t)); 998fcf3ce44SJohn Forte mdb_free(lqlink, sizeof (ql_link_t)); 999fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 1000fcf3ce44SJohn Forte mdb_free(dev, sizeof (ql_head_t)*DEVICE_HEAD_LIST_SIZE); 1001fcf3ce44SJohn Forte 1002fcf3ce44SJohn Forte return (DCMD_OK); 1003fcf3ce44SJohn Forte } 1004fcf3ce44SJohn Forte 1005fcf3ce44SJohn Forte /* 1006fcf3ce44SJohn Forte * get_first_link 1007fcf3ce44SJohn Forte * Gets the first ql_link_t header on ql_head. 1008fcf3ce44SJohn Forte * 1009fcf3ce44SJohn Forte * Input: 1010fcf3ce44SJohn Forte * ql_head = pointer to a ql_head_t structure. 1011fcf3ce44SJohn Forte * ql_link = pointer to a ql_link_t structure. 1012fcf3ce44SJohn Forte * 1013fcf3ce44SJohn Forte * Returns: 1014fcf3ce44SJohn Forte * DCMD_ABORT, or DCMD_OK 1015fcf3ce44SJohn Forte * 1016fcf3ce44SJohn Forte * Context: 1017fcf3ce44SJohn Forte * User context. 1018fcf3ce44SJohn Forte * 1019fcf3ce44SJohn Forte */ 1020fcf3ce44SJohn Forte static int 1021fcf3ce44SJohn Forte get_first_link(ql_head_t *qlhead, ql_link_t *qllink) 1022fcf3ce44SJohn Forte { 1023fcf3ce44SJohn Forte int rval = DCMD_ABORT; 1024fcf3ce44SJohn Forte 1025fcf3ce44SJohn Forte if (qlhead != NULL) { 1026fcf3ce44SJohn Forte if (qlhead->first != NULL) { 1027fcf3ce44SJohn Forte /* Read in the first ql_link_t header */ 1028fcf3ce44SJohn Forte if (mdb_vread(qllink, sizeof (ql_link_t), 1029fcf3ce44SJohn Forte (uintptr_t)(qlhead->first)) == -1) { 1030fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t " 1031fcf3ce44SJohn Forte "next at %p", qlhead->first); 1032fcf3ce44SJohn Forte } else { 1033fcf3ce44SJohn Forte rval = DCMD_OK; 1034fcf3ce44SJohn Forte } 1035fcf3ce44SJohn Forte } 1036fcf3ce44SJohn Forte } 1037fcf3ce44SJohn Forte return (rval); 1038fcf3ce44SJohn Forte } 1039fcf3ce44SJohn Forte 1040fcf3ce44SJohn Forte /* 1041fcf3ce44SJohn Forte * get_next_link 1042fcf3ce44SJohn Forte * Gets the next ql_link_t structure. 1043fcf3ce44SJohn Forte * 1044fcf3ce44SJohn Forte * Input: 1045fcf3ce44SJohn Forte * ql_link = pointer to a ql_link_t structure. 1046fcf3ce44SJohn Forte * 1047fcf3ce44SJohn Forte * Returns: 1048fcf3ce44SJohn Forte * DCMD_ABORT, or DCMD_OK 1049fcf3ce44SJohn Forte * 1050fcf3ce44SJohn Forte * Context: 1051fcf3ce44SJohn Forte * User context. 1052fcf3ce44SJohn Forte * 1053fcf3ce44SJohn Forte */ 1054fcf3ce44SJohn Forte static int 1055fcf3ce44SJohn Forte get_next_link(ql_link_t *qllink) 1056fcf3ce44SJohn Forte { 1057fcf3ce44SJohn Forte int rval = DCMD_ABORT; 1058fcf3ce44SJohn Forte 1059fcf3ce44SJohn Forte if (qllink != NULL) { 1060fcf3ce44SJohn Forte if (qllink->next != NULL) { 1061fcf3ce44SJohn Forte /* Read in the next ql_link_t header */ 1062fcf3ce44SJohn Forte if (mdb_vread(qllink, sizeof (ql_link_t), 1063fcf3ce44SJohn Forte (uintptr_t)(qllink->next)) == -1) { 1064fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t " 1065fcf3ce44SJohn Forte "next at %p", qllink->next); 1066fcf3ce44SJohn Forte } else { 1067fcf3ce44SJohn Forte rval = DCMD_OK; 1068fcf3ce44SJohn Forte } 1069fcf3ce44SJohn Forte } 1070fcf3ce44SJohn Forte } 1071fcf3ce44SJohn Forte return (rval); 1072fcf3ce44SJohn Forte } 1073fcf3ce44SJohn Forte 1074fcf3ce44SJohn Forte /* 1075fcf3ce44SJohn Forte * qlcstate_dcmd 1076fcf3ce44SJohn Forte * mdb dcmd which prints out the ql_state info using 1077fcf3ce44SJohn Forte * caller supplied address. 1078fcf3ce44SJohn Forte * 1079fcf3ce44SJohn Forte * Input: 1080fcf3ce44SJohn Forte * addr = User supplied address. 1081fcf3ce44SJohn Forte * flags = mdb flags. 1082fcf3ce44SJohn Forte * argc = Number of user supplied args. 1083fcf3ce44SJohn Forte * argv = Arg array. 1084fcf3ce44SJohn Forte * 1085fcf3ce44SJohn Forte * Returns: 1086fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 1087fcf3ce44SJohn Forte * 1088fcf3ce44SJohn Forte * Context: 1089fcf3ce44SJohn Forte * User context. 1090fcf3ce44SJohn Forte * 1091fcf3ce44SJohn Forte */ 1092fcf3ce44SJohn Forte static int 1093fcf3ce44SJohn Forte qlcstate_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 1094fcf3ce44SJohn Forte { 1095fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 1096fcf3ce44SJohn Forte int verbose = 0; 1097fcf3ce44SJohn Forte 1098fcf3ce44SJohn Forte if (!(flags & DCMD_ADDRSPEC)) { 1099fcf3ce44SJohn Forte return (DCMD_USAGE); 1100fcf3ce44SJohn Forte } 1101fcf3ce44SJohn Forte 1102fcf3ce44SJohn Forte if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE, &verbose) != 1103fcf3ce44SJohn Forte argc) { 1104fcf3ce44SJohn Forte return (DCMD_USAGE); 1105fcf3ce44SJohn Forte } 1106fcf3ce44SJohn Forte 1107fcf3ce44SJohn Forte if ((qlstate = (ql_adapter_state_t *) 1108fcf3ce44SJohn Forte mdb_alloc(sizeof (ql_adapter_state_t), UM_SLEEP)) == NULL) { 1109fcf3ce44SJohn Forte mdb_warn("failed to allocate memory for ql_adapter_state\n"); 1110fcf3ce44SJohn Forte return (DCMD_OK); 1111fcf3ce44SJohn Forte } 1112fcf3ce44SJohn Forte if (mdb_vread(qlstate, sizeof (ql_adapter_state_t), addr) == -1) { 1113fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 1114fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", addr); 1115fcf3ce44SJohn Forte return (DCMD_OK); 1116fcf3ce44SJohn Forte } 1117fcf3ce44SJohn Forte 1118fcf3ce44SJohn Forte mdb_printf("qlc instance: %d, base addr = %llx\n", qlstate->instance, 1119fcf3ce44SJohn Forte addr); 1120fcf3ce44SJohn Forte 1121fcf3ce44SJohn Forte mdb_printf("\nadapter state flags:\n"); 1122fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->flags, adapter_state_flags); 1123fcf3ce44SJohn Forte mdb_printf("\nadapter cfg flags:\n"); 1124fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->cfg_flags, adapter_config_flags); 1125fcf3ce44SJohn Forte mdb_printf("\ntask daemon state flags:\n"); 1126fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->task_daemon_flags, 1127fcf3ce44SJohn Forte task_daemon_flags); 1128fcf3ce44SJohn Forte 1129fcf3ce44SJohn Forte if (verbose) { 1130fcf3ce44SJohn Forte (void) ql_doprint(addr, "struct ql_adapter_state"); 1131fcf3ce44SJohn Forte } 1132fcf3ce44SJohn Forte 1133fcf3ce44SJohn Forte mdb_free(qlstate, sizeof (ql_adapter_state_t)); 1134fcf3ce44SJohn Forte 1135fcf3ce44SJohn Forte return (DCMD_OK); 1136fcf3ce44SJohn Forte } 1137fcf3ce44SJohn Forte 1138fcf3ce44SJohn Forte /* 1139fcf3ce44SJohn Forte * qlcstates_walk_init 1140fcf3ce44SJohn Forte * mdb walker init which prints out all qlc states info. 1141fcf3ce44SJohn Forte * 1142fcf3ce44SJohn Forte * Input: 1143fcf3ce44SJohn Forte * wsp - Pointer to walker state struct 1144fcf3ce44SJohn Forte * 1145fcf3ce44SJohn Forte * Returns: 1146fcf3ce44SJohn Forte * WALK_ERR, or WALK_NEXT 1147fcf3ce44SJohn Forte * 1148fcf3ce44SJohn Forte * Context: 1149fcf3ce44SJohn Forte * User context. 1150fcf3ce44SJohn Forte * 1151fcf3ce44SJohn Forte */ 1152fcf3ce44SJohn Forte static int 1153fcf3ce44SJohn Forte qlstates_walk_init(mdb_walk_state_t *wsp) 1154fcf3ce44SJohn Forte { 1155fcf3ce44SJohn Forte ql_head_t ql_hba; 1156fcf3ce44SJohn Forte 1157fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) { 1158fcf3ce44SJohn Forte if ((mdb_readvar(&ql_hba, "ql_hba") == -1) || 1159fcf3ce44SJohn Forte (&ql_hba == NULL)) { 1160fcf3ce44SJohn Forte mdb_warn("failed to read ql_hba structure"); 1161fcf3ce44SJohn Forte return (WALK_ERR); 1162fcf3ce44SJohn Forte } 1163fcf3ce44SJohn Forte 1164fcf3ce44SJohn Forte wsp->walk_addr = (uintptr_t)ql_hba.first; 1165fcf3ce44SJohn Forte wsp->walk_data = mdb_alloc(sizeof (ql_adapter_state_t), 1166fcf3ce44SJohn Forte UM_SLEEP); 1167fcf3ce44SJohn Forte return (WALK_NEXT); 1168fcf3ce44SJohn Forte } else { 1169fcf3ce44SJohn Forte return (ql_doprint(wsp->walk_addr, "struct ql_adapter_state")); 1170fcf3ce44SJohn Forte } 1171fcf3ce44SJohn Forte } 1172fcf3ce44SJohn Forte 1173fcf3ce44SJohn Forte /* 1174fcf3ce44SJohn Forte * qlstates_walk_step 1175fcf3ce44SJohn Forte * mdb walker step which prints out all qlc states info. 1176fcf3ce44SJohn Forte * 1177fcf3ce44SJohn Forte * Input: 1178fcf3ce44SJohn Forte * wsp - Pointer to walker state struct 1179fcf3ce44SJohn Forte * 1180fcf3ce44SJohn Forte * Returns: 1181fcf3ce44SJohn Forte * WALK_DONE, or WALK_NEXT 1182fcf3ce44SJohn Forte * 1183fcf3ce44SJohn Forte * Context: 1184fcf3ce44SJohn Forte * User context. 1185fcf3ce44SJohn Forte * 1186fcf3ce44SJohn Forte */ 1187fcf3ce44SJohn Forte static int 1188fcf3ce44SJohn Forte qlstates_walk_step(mdb_walk_state_t *wsp) 1189fcf3ce44SJohn Forte { 1190fcf3ce44SJohn Forte ql_adapter_state_t *qlstate; 1191fcf3ce44SJohn Forte 1192fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) { 1193fcf3ce44SJohn Forte return (WALK_DONE); 1194fcf3ce44SJohn Forte } 1195fcf3ce44SJohn Forte 1196fcf3ce44SJohn Forte if (mdb_vread(wsp->walk_data, sizeof (ql_adapter_state_t), 1197fcf3ce44SJohn Forte wsp->walk_addr) == -1) { 1198fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", 1199fcf3ce44SJohn Forte wsp->walk_addr); 1200fcf3ce44SJohn Forte return (WALK_DONE); 1201fcf3ce44SJohn Forte } 1202fcf3ce44SJohn Forte 1203fcf3ce44SJohn Forte qlstate = (ql_adapter_state_t *)(wsp->walk_data); 1204fcf3ce44SJohn Forte mdb_printf("qlc instance: %d, base addr = %llx\n", 1205fcf3ce44SJohn Forte qlstate->instance, wsp->walk_addr); 1206fcf3ce44SJohn Forte 1207fcf3ce44SJohn Forte mdb_printf("\nadapter state flags:\n"); 1208fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->flags, adapter_state_flags); 1209fcf3ce44SJohn Forte mdb_printf("\nadapter cfg flags:\n"); 1210fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->cfg_flags, adapter_config_flags); 1211fcf3ce44SJohn Forte mdb_printf("\ntask daemon state flags:\n"); 1212fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlstate->task_daemon_flags, 1213fcf3ce44SJohn Forte task_daemon_flags); 1214fcf3ce44SJohn Forte 1215fcf3ce44SJohn Forte mdb_printf("\nadapter state:\n"); 1216fcf3ce44SJohn Forte (void) ql_doprint(wsp->walk_addr, "struct ql_adapter_state"); 1217fcf3ce44SJohn Forte 1218fcf3ce44SJohn Forte mdb_printf("\n"); 1219fcf3ce44SJohn Forte 1220fcf3ce44SJohn Forte wsp->walk_addr = (uintptr_t) 1221fcf3ce44SJohn Forte (((ql_adapter_state_t *)wsp->walk_data)->hba.next); 1222fcf3ce44SJohn Forte 1223fcf3ce44SJohn Forte return (WALK_NEXT); 1224fcf3ce44SJohn Forte } 1225fcf3ce44SJohn Forte 1226fcf3ce44SJohn Forte /* 1227fcf3ce44SJohn Forte * qlstates_walk_fini 1228fcf3ce44SJohn Forte * mdb walker fini which wraps up the walker 1229fcf3ce44SJohn Forte * 1230fcf3ce44SJohn Forte * Input: 1231fcf3ce44SJohn Forte * wsp - Pointer to walker state struct 1232fcf3ce44SJohn Forte * 1233fcf3ce44SJohn Forte * Returns: 1234fcf3ce44SJohn Forte * 1235fcf3ce44SJohn Forte * Context: 1236fcf3ce44SJohn Forte * User context. 1237fcf3ce44SJohn Forte * 1238fcf3ce44SJohn Forte */ 1239fcf3ce44SJohn Forte static void 1240fcf3ce44SJohn Forte qlstates_walk_fini(mdb_walk_state_t *wsp) 1241fcf3ce44SJohn Forte { 1242fcf3ce44SJohn Forte mdb_free(wsp->walk_data, sizeof (ql_adapter_state_t)); 1243fcf3ce44SJohn Forte } 1244fcf3ce44SJohn Forte 1245fcf3ce44SJohn Forte /* 1246fcf3ce44SJohn Forte * qlsrb_walk_init 1247fcf3ce44SJohn Forte * mdb walker init which prints out linked srb's 1248fcf3ce44SJohn Forte * 1249fcf3ce44SJohn Forte * Input: 1250fcf3ce44SJohn Forte * wsp - Pointer to walker ql_srb struct 1251fcf3ce44SJohn Forte * 1252fcf3ce44SJohn Forte * Returns: 1253fcf3ce44SJohn Forte * WALK_ERR, or WALK_NEXT 1254fcf3ce44SJohn Forte * 1255fcf3ce44SJohn Forte * Context: 1256fcf3ce44SJohn Forte * User context. 1257fcf3ce44SJohn Forte * 1258fcf3ce44SJohn Forte */ 1259fcf3ce44SJohn Forte static int 1260fcf3ce44SJohn Forte qlsrb_walk_init(mdb_walk_state_t *wsp) 1261fcf3ce44SJohn Forte { 1262fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) { 1263fcf3ce44SJohn Forte mdb_warn("failed to read ql_srb addr at %p", 1264fcf3ce44SJohn Forte wsp->walk_addr); 1265fcf3ce44SJohn Forte return (WALK_ERR); 1266fcf3ce44SJohn Forte } 1267fcf3ce44SJohn Forte 1268fcf3ce44SJohn Forte wsp->walk_data = mdb_alloc(sizeof (ql_srb_t), UM_SLEEP); 1269fcf3ce44SJohn Forte 1270fcf3ce44SJohn Forte return (WALK_NEXT); 1271fcf3ce44SJohn Forte } 1272fcf3ce44SJohn Forte 1273fcf3ce44SJohn Forte /* 1274fcf3ce44SJohn Forte * qlcsrb_walk_step 1275fcf3ce44SJohn Forte * mdb walker step which prints out linked ql_srb structures 1276fcf3ce44SJohn Forte * 1277fcf3ce44SJohn Forte * Input: 1278fcf3ce44SJohn Forte * wsp - Pointer to walker srb struct 1279fcf3ce44SJohn Forte * 1280fcf3ce44SJohn Forte * Returns: 1281fcf3ce44SJohn Forte * WALK_DONE, or WALK_NEXT 1282fcf3ce44SJohn Forte * 1283fcf3ce44SJohn Forte * Context: 1284fcf3ce44SJohn Forte * User context. 1285fcf3ce44SJohn Forte * 1286fcf3ce44SJohn Forte */ 1287fcf3ce44SJohn Forte static int 1288fcf3ce44SJohn Forte qlsrb_walk_step(mdb_walk_state_t *wsp) 1289fcf3ce44SJohn Forte { 1290fcf3ce44SJohn Forte ql_srb_t *qlsrb; 1291fcf3ce44SJohn Forte 1292fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) 1293fcf3ce44SJohn Forte return (WALK_DONE); 1294fcf3ce44SJohn Forte 1295fcf3ce44SJohn Forte if (mdb_vread(wsp->walk_data, sizeof (ql_srb_t), 1296fcf3ce44SJohn Forte wsp->walk_addr) == -1) { 1297fcf3ce44SJohn Forte mdb_warn("failed to read ql_srb at %p", wsp->walk_addr); 1298fcf3ce44SJohn Forte return (WALK_DONE); 1299fcf3ce44SJohn Forte } 1300fcf3ce44SJohn Forte 1301fcf3ce44SJohn Forte qlsrb = (ql_srb_t *)(wsp->walk_data); 1302fcf3ce44SJohn Forte mdb_printf("ql_srb base addr = %llx\n", wsp->walk_addr); 1303fcf3ce44SJohn Forte 1304fcf3ce44SJohn Forte mdb_printf("\nql_srb flags:\n"); 1305fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qlsrb->flags, qlsrb_flags); 1306fcf3ce44SJohn Forte 1307fcf3ce44SJohn Forte mdb_printf("\nql_srb:\n"); 1308fcf3ce44SJohn Forte (void) ql_doprint(wsp->walk_addr, "struct ql_srb"); 1309fcf3ce44SJohn Forte 1310fcf3ce44SJohn Forte mdb_printf("\n"); 1311fcf3ce44SJohn Forte 1312fcf3ce44SJohn Forte wsp->walk_addr = (uintptr_t) 1313fcf3ce44SJohn Forte (((ql_srb_t *)wsp->walk_data)->cmd.next); 1314fcf3ce44SJohn Forte 1315fcf3ce44SJohn Forte return (WALK_NEXT); 1316fcf3ce44SJohn Forte } 1317fcf3ce44SJohn Forte 1318fcf3ce44SJohn Forte /* 1319fcf3ce44SJohn Forte * qlsrb_walk_fini 1320fcf3ce44SJohn Forte * mdb walker fini which wraps up the walker 1321fcf3ce44SJohn Forte * 1322fcf3ce44SJohn Forte * Input: 1323fcf3ce44SJohn Forte * wsp - Pointer to walker state struct 1324fcf3ce44SJohn Forte * 1325fcf3ce44SJohn Forte * Returns: 1326fcf3ce44SJohn Forte * 1327fcf3ce44SJohn Forte * Context: 1328fcf3ce44SJohn Forte * User context. 1329fcf3ce44SJohn Forte * 1330fcf3ce44SJohn Forte */ 1331fcf3ce44SJohn Forte static void 1332fcf3ce44SJohn Forte qlsrb_walk_fini(mdb_walk_state_t *wsp) 1333fcf3ce44SJohn Forte { 1334fcf3ce44SJohn Forte mdb_free(wsp->walk_data, sizeof (ql_srb_t)); 1335fcf3ce44SJohn Forte } 1336fcf3ce44SJohn Forte 1337fcf3ce44SJohn Forte /* 1338fcf3ce44SJohn Forte * qllunq_dcmd 1339fcf3ce44SJohn Forte * mdb walker which prints out lun q's 1340fcf3ce44SJohn Forte * 1341fcf3ce44SJohn Forte * Input: 1342fcf3ce44SJohn Forte * wsp - Pointer to walker ql_lun struct 1343fcf3ce44SJohn Forte * 1344fcf3ce44SJohn Forte * Returns: 1345fcf3ce44SJohn Forte * WALK_ERR, or WALK_NEXT 1346fcf3ce44SJohn Forte * 1347fcf3ce44SJohn Forte * Context: 1348fcf3ce44SJohn Forte * User context. 1349fcf3ce44SJohn Forte * 1350fcf3ce44SJohn Forte */ 1351fcf3ce44SJohn Forte static int 1352fcf3ce44SJohn Forte qllunq_walk_init(mdb_walk_state_t *wsp) 1353fcf3ce44SJohn Forte { 1354fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) { 1355fcf3ce44SJohn Forte mdb_warn("failed to read ql_lun addr at %p", 1356fcf3ce44SJohn Forte wsp->walk_addr); 1357fcf3ce44SJohn Forte return (WALK_ERR); 1358fcf3ce44SJohn Forte } 1359fcf3ce44SJohn Forte 1360fcf3ce44SJohn Forte wsp->walk_data = mdb_alloc(sizeof (ql_lun_t), UM_SLEEP); 1361fcf3ce44SJohn Forte 1362fcf3ce44SJohn Forte return (WALK_NEXT); 1363fcf3ce44SJohn Forte } 1364fcf3ce44SJohn Forte 1365fcf3ce44SJohn Forte /* 1366fcf3ce44SJohn Forte * qlclunq_walk_step 1367fcf3ce44SJohn Forte * mdb walker step which prints out linked ql_lun structures 1368fcf3ce44SJohn Forte * 1369fcf3ce44SJohn Forte * Input: 1370fcf3ce44SJohn Forte * wsp - Pointer to walker srb struct 1371fcf3ce44SJohn Forte * 1372fcf3ce44SJohn Forte * Returns: 1373fcf3ce44SJohn Forte * WALK_DONE, or WALK_NEXT 1374fcf3ce44SJohn Forte * 1375fcf3ce44SJohn Forte * Context: 1376fcf3ce44SJohn Forte * User context. 1377fcf3ce44SJohn Forte * 1378fcf3ce44SJohn Forte */ 1379fcf3ce44SJohn Forte static int 1380fcf3ce44SJohn Forte qllunq_walk_step(mdb_walk_state_t *wsp) 1381fcf3ce44SJohn Forte { 1382fcf3ce44SJohn Forte ql_lun_t *qllun; 1383fcf3ce44SJohn Forte ql_link_t ql_link; 1384fcf3ce44SJohn Forte ql_link_t *qllink; 1385fcf3ce44SJohn Forte 1386fcf3ce44SJohn Forte if (wsp->walk_addr == NULL) 1387fcf3ce44SJohn Forte return (WALK_DONE); 1388fcf3ce44SJohn Forte 1389fcf3ce44SJohn Forte if (mdb_vread(wsp->walk_data, sizeof (ql_lun_t), 1390fcf3ce44SJohn Forte wsp->walk_addr) == -1) { 1391fcf3ce44SJohn Forte mdb_warn("failed to read ql_lun at %p", wsp->walk_addr); 1392fcf3ce44SJohn Forte return (WALK_DONE); 1393fcf3ce44SJohn Forte } 1394fcf3ce44SJohn Forte 1395fcf3ce44SJohn Forte qllun = (ql_lun_t *)(wsp->walk_data); 1396fcf3ce44SJohn Forte mdb_printf("ql_lun base addr = %llx\n", wsp->walk_addr); 1397fcf3ce44SJohn Forte 1398fcf3ce44SJohn Forte mdb_printf("\nql_lun flags:\n"); 1399fcf3ce44SJohn Forte ql_dump_flags((uint64_t)qllun->flags, qllun_flags); 1400fcf3ce44SJohn Forte 1401fcf3ce44SJohn Forte mdb_printf("\nql_lun:\n"); 1402fcf3ce44SJohn Forte (void) ql_doprint(wsp->walk_addr, "struct ql_lun"); 1403fcf3ce44SJohn Forte 1404fcf3ce44SJohn Forte mdb_printf("\n"); 1405fcf3ce44SJohn Forte 1406fcf3ce44SJohn Forte qllink = (ql_link_t *) 1407fcf3ce44SJohn Forte (((ql_lun_t *)wsp->walk_data)->link.next); 1408fcf3ce44SJohn Forte 1409fcf3ce44SJohn Forte if (qllink == NULL) { 1410fcf3ce44SJohn Forte return (WALK_DONE); 1411fcf3ce44SJohn Forte } else { 1412fcf3ce44SJohn Forte /* 1413fcf3ce44SJohn Forte * Read in the next link_t header 1414fcf3ce44SJohn Forte */ 1415fcf3ce44SJohn Forte if (mdb_vread(&ql_link, sizeof (ql_link_t), 1416fcf3ce44SJohn Forte (uintptr_t)qllink) == -1) { 1417fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t " 1418fcf3ce44SJohn Forte "next at %p", qllink->next); 1419fcf3ce44SJohn Forte return (WALK_DONE); 1420fcf3ce44SJohn Forte } 1421fcf3ce44SJohn Forte qllink = &ql_link; 1422fcf3ce44SJohn Forte } 1423fcf3ce44SJohn Forte 1424fcf3ce44SJohn Forte wsp->walk_addr = (uintptr_t)qllink->base_address; 1425fcf3ce44SJohn Forte 1426fcf3ce44SJohn Forte return (WALK_NEXT); 1427fcf3ce44SJohn Forte } 1428fcf3ce44SJohn Forte 1429fcf3ce44SJohn Forte /* 1430fcf3ce44SJohn Forte * qllunq_walk_fini 1431fcf3ce44SJohn Forte * mdb walker fini which wraps up the walker 1432fcf3ce44SJohn Forte * 1433fcf3ce44SJohn Forte * Input: 1434fcf3ce44SJohn Forte * wsp - Pointer to walker state struct 1435fcf3ce44SJohn Forte * 1436fcf3ce44SJohn Forte * Returns: 1437fcf3ce44SJohn Forte * 1438fcf3ce44SJohn Forte * Context: 1439fcf3ce44SJohn Forte * User context. 1440fcf3ce44SJohn Forte * 1441fcf3ce44SJohn Forte */ 1442fcf3ce44SJohn Forte static void 1443fcf3ce44SJohn Forte qllunq_walk_fini(mdb_walk_state_t *wsp) 1444fcf3ce44SJohn Forte { 1445fcf3ce44SJohn Forte mdb_free(wsp->walk_data, sizeof (ql_lun_t)); 1446fcf3ce44SJohn Forte } 1447fcf3ce44SJohn Forte 1448fcf3ce44SJohn Forte /* 1449fcf3ce44SJohn Forte * qltgtq_dcmd 1450fcf3ce44SJohn Forte * mdb dcmd which prints out an hs's tq struct info. 1451fcf3ce44SJohn Forte * 1452fcf3ce44SJohn Forte * Input: 1453fcf3ce44SJohn Forte * addr = User supplied address. (NB: nust be an ha) 1454fcf3ce44SJohn Forte * flags = mdb flags. 1455fcf3ce44SJohn Forte * argc = Number of user supplied args. 1456fcf3ce44SJohn Forte * argv = Arg array. 1457fcf3ce44SJohn Forte * 1458fcf3ce44SJohn Forte * Returns: 1459fcf3ce44SJohn Forte * DCMD_USAGE, or DCMD_OK 1460fcf3ce44SJohn Forte * 1461fcf3ce44SJohn Forte * Context: 1462fcf3ce44SJohn Forte * User context. 1463fcf3ce44SJohn Forte * 1464fcf3ce44SJohn Forte */ 1465fcf3ce44SJohn Forte /*ARGSUSED*/ 1466fcf3ce44SJohn Forte static int 1467fcf3ce44SJohn Forte qltgtq_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 1468fcf3ce44SJohn Forte { 1469fcf3ce44SJohn Forte ql_adapter_state_t *ha; 1470fcf3ce44SJohn Forte ql_link_t *link; 1471fcf3ce44SJohn Forte ql_tgt_t *tq; 1472fcf3ce44SJohn Forte uint32_t index; 1473fcf3ce44SJohn Forte ql_head_t *dev; 1474fcf3ce44SJohn Forte 1475fcf3ce44SJohn Forte if ((!(flags & DCMD_ADDRSPEC)) || addr == NULL) { 1476fcf3ce44SJohn Forte mdb_warn("ql_hba structure addr is required"); 1477fcf3ce44SJohn Forte return (DCMD_USAGE); 1478fcf3ce44SJohn Forte } 1479fcf3ce44SJohn Forte 1480fcf3ce44SJohn Forte /* 1481fcf3ce44SJohn Forte * Get the adapter state struct which was passed 1482fcf3ce44SJohn Forte */ 1483fcf3ce44SJohn Forte 1484fcf3ce44SJohn Forte ha = (ql_adapter_state_t *)mdb_alloc(sizeof (ql_adapter_state_t), 1485fcf3ce44SJohn Forte UM_SLEEP); 1486fcf3ce44SJohn Forte 1487fcf3ce44SJohn Forte if (mdb_vread(ha, sizeof (ql_adapter_state_t), addr) == -1) { 1488fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", addr); 1489fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1490fcf3ce44SJohn Forte return (DCMD_OK); 1491fcf3ce44SJohn Forte } 1492fcf3ce44SJohn Forte 1493fcf3ce44SJohn Forte if (ha->dev == NULL) { 1494fcf3ce44SJohn Forte mdb_warn("dev ptr is NULL for ha: %p", addr); 1495fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1496fcf3ce44SJohn Forte return (DCMD_OK); 1497fcf3ce44SJohn Forte } 1498fcf3ce44SJohn Forte 1499fcf3ce44SJohn Forte /* 1500fcf3ce44SJohn Forte * Read in the device array 1501fcf3ce44SJohn Forte */ 1502fcf3ce44SJohn Forte dev = (ql_head_t *) 1503fcf3ce44SJohn Forte mdb_alloc(sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE, UM_SLEEP); 1504fcf3ce44SJohn Forte 1505fcf3ce44SJohn Forte if (mdb_vread(dev, sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE, 1506fcf3ce44SJohn Forte (uintptr_t)ha->dev) == -1) { 1507fcf3ce44SJohn Forte mdb_warn("failed to read ql_head_t (dev) at %p", ha->dev); 1508fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1509fcf3ce44SJohn Forte mdb_free(dev, sizeof (ql_head_t) * DEVICE_HEAD_LIST_SIZE); 1510fcf3ce44SJohn Forte } 1511fcf3ce44SJohn Forte 1512fcf3ce44SJohn Forte tq = (ql_tgt_t *)mdb_alloc(sizeof (ql_tgt_t), UM_SLEEP); 1513fcf3ce44SJohn Forte link = (ql_link_t *)mdb_alloc(sizeof (ql_link_t), UM_SLEEP); 1514fcf3ce44SJohn Forte 1515fcf3ce44SJohn Forte for (index = 0; index < DEVICE_HEAD_LIST_SIZE; index++) { 1516fcf3ce44SJohn Forte 1517fcf3ce44SJohn Forte if (dev[index].first == NULL) { 1518fcf3ce44SJohn Forte continue; 1519fcf3ce44SJohn Forte } 1520fcf3ce44SJohn Forte 1521fcf3ce44SJohn Forte if (mdb_vread(link, sizeof (ql_link_t), 1522fcf3ce44SJohn Forte (uintptr_t)dev[index].first) == -1) { 1523fcf3ce44SJohn Forte mdb_warn("failed to read ql_link_t at %p", 1524fcf3ce44SJohn Forte dev[index].first); 1525fcf3ce44SJohn Forte break; 1526fcf3ce44SJohn Forte } 1527fcf3ce44SJohn Forte 1528fcf3ce44SJohn Forte while (link != NULL) { 1529fcf3ce44SJohn Forte if (mdb_vread(tq, sizeof (ql_tgt_t), 1530fcf3ce44SJohn Forte (uintptr_t)(link->base_address)) == -1) { 1531fcf3ce44SJohn Forte mdb_warn("failed to read ql_tgt at %p", 1532fcf3ce44SJohn Forte link->base_address); 1533fcf3ce44SJohn Forte break; 1534fcf3ce44SJohn Forte } 1535fcf3ce44SJohn Forte 1536fcf3ce44SJohn Forte mdb_printf("tgt queue base addr = %llx\n", 1537fcf3ce44SJohn Forte link->base_address); 1538fcf3ce44SJohn Forte 1539fcf3ce44SJohn Forte mdb_printf("\ntgt queue flags: (%xh)\n", tq->flags); 1540fcf3ce44SJohn Forte ql_dump_flags((uint64_t)tq->flags, qltgt_flags); 1541fcf3ce44SJohn Forte 1542fcf3ce44SJohn Forte mdb_printf("\ntgt queue:\n"); 1543fcf3ce44SJohn Forte 1544fcf3ce44SJohn Forte (void) ql_doprint((uintptr_t)link->base_address, 1545fcf3ce44SJohn Forte "struct ql_target"); 1546fcf3ce44SJohn Forte 1547fcf3ce44SJohn Forte mdb_printf("\n"); 1548fcf3ce44SJohn Forte 1549fcf3ce44SJohn Forte if (get_next_link(link) != DCMD_OK) { 1550fcf3ce44SJohn Forte break; 1551fcf3ce44SJohn Forte } 1552fcf3ce44SJohn Forte } 1553fcf3ce44SJohn Forte } 1554fcf3ce44SJohn Forte 1555fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1556fcf3ce44SJohn Forte mdb_free(tq, sizeof (ql_tgt_t)); 1557fcf3ce44SJohn Forte mdb_free(link, sizeof (ql_link_t)); 1558fcf3ce44SJohn Forte mdb_free(dev, sizeof (ql_head_t)*DEVICE_HEAD_LIST_SIZE); 1559fcf3ce44SJohn Forte 1560fcf3ce44SJohn Forte return (DCMD_OK); 1561fcf3ce44SJohn Forte } 1562fcf3ce44SJohn Forte 1563fcf3ce44SJohn Forte /* 156416dd44c2SDaniel Beauregard * ql_triggerdump_dcmd 156516dd44c2SDaniel Beauregard * Triggers the driver to take a firmware dump 156616dd44c2SDaniel Beauregard * 156716dd44c2SDaniel Beauregard * Input: 156816dd44c2SDaniel Beauregard * addr = User supplied address (optional) 156916dd44c2SDaniel Beauregard * flags = mdb flags. 157016dd44c2SDaniel Beauregard * argc = Number of user supplied args. 157116dd44c2SDaniel Beauregard * argv = Arg array (instance #, optional). 157216dd44c2SDaniel Beauregard * 157316dd44c2SDaniel Beauregard * Returns: 157416dd44c2SDaniel Beauregard * DCMD_OK or DCMD_ERR 157516dd44c2SDaniel Beauregard * 157616dd44c2SDaniel Beauregard * Context: 157716dd44c2SDaniel Beauregard * User context. 157816dd44c2SDaniel Beauregard * 157916dd44c2SDaniel Beauregard */ 158016dd44c2SDaniel Beauregard 158116dd44c2SDaniel Beauregard #if 0 158216dd44c2SDaniel Beauregard 158316dd44c2SDaniel Beauregard /*ARGSUSED*/ 158416dd44c2SDaniel Beauregard static int 158516dd44c2SDaniel Beauregard qlc_triggerdump_dcmd(uintptr_t addr, uint_t flags, int argc, 158616dd44c2SDaniel Beauregard const mdb_arg_t *argv) 158716dd44c2SDaniel Beauregard { 158816dd44c2SDaniel Beauregard ql_adapter_state_t *qlstate; 158916dd44c2SDaniel Beauregard uintptr_t hbaptr = NULL; 159016dd44c2SDaniel Beauregard ql_head_t ql_hba; 159116dd44c2SDaniel Beauregard uint32_t qlsize = sizeof (ql_adapter_state_t); 159216dd44c2SDaniel Beauregard int mdbs; 159316dd44c2SDaniel Beauregard 159416dd44c2SDaniel Beauregard if ((mdbs = mdb_get_state()) == MDB_STATE_DEAD) { 159516dd44c2SDaniel Beauregard mdb_warn("Cannot change core file data (state=%xh)\n", mdbs); 159616dd44c2SDaniel Beauregard return (DCMD_OK); 159716dd44c2SDaniel Beauregard } 159816dd44c2SDaniel Beauregard 159916dd44c2SDaniel Beauregard if ((qlstate = (ql_adapter_state_t *)mdb_alloc(qlsize, 160016dd44c2SDaniel Beauregard UM_SLEEP)) == NULL) { 160116dd44c2SDaniel Beauregard mdb_warn("Unable to allocate memory for ql_adapter_state\n"); 160216dd44c2SDaniel Beauregard return (DCMD_OK); 160316dd44c2SDaniel Beauregard } 160416dd44c2SDaniel Beauregard 160516dd44c2SDaniel Beauregard if (addr == NULL) { 160616dd44c2SDaniel Beauregard char *tptr; 160716dd44c2SDaniel Beauregard uint32_t instance; 160816dd44c2SDaniel Beauregard 160916dd44c2SDaniel Beauregard if (argc == 0) { 161016dd44c2SDaniel Beauregard mdb_warn("must specify either the ha addr or " 161116dd44c2SDaniel Beauregard "the instance number\n"); 161216dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 161316dd44c2SDaniel Beauregard return (DCMD_OK); 161416dd44c2SDaniel Beauregard } 161516dd44c2SDaniel Beauregard 161616dd44c2SDaniel Beauregard /* 161716dd44c2SDaniel Beauregard * find the specified instance in the ha list 161816dd44c2SDaniel Beauregard */ 161916dd44c2SDaniel Beauregard 162016dd44c2SDaniel Beauregard instance = (uint32_t)strtol(argv[1].a_un.a_str, &tptr, 16); 162116dd44c2SDaniel Beauregard if (tptr == argv[1].a_un.a_str) { 162216dd44c2SDaniel Beauregard mdb_printf("instance # is illegal: '%s'\n", 162316dd44c2SDaniel Beauregard argv[1].a_un.a_str); 162416dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 162516dd44c2SDaniel Beauregard return (DCMD_OK); 162616dd44c2SDaniel Beauregard } 162716dd44c2SDaniel Beauregard 162816dd44c2SDaniel Beauregard if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 162916dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure"); 163016dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 163116dd44c2SDaniel Beauregard return (DCMD_ERR); 163216dd44c2SDaniel Beauregard } 163316dd44c2SDaniel Beauregard 163416dd44c2SDaniel Beauregard if (&ql_hba == NULL) { 163516dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure - " 163616dd44c2SDaniel Beauregard "is qlc loaded?"); 163716dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 163816dd44c2SDaniel Beauregard return (DCMD_ERR); 163916dd44c2SDaniel Beauregard } 164016dd44c2SDaniel Beauregard 164116dd44c2SDaniel Beauregard hbaptr = (uintptr_t)ql_hba.first; 164216dd44c2SDaniel Beauregard while (hbaptr != NULL) { 164316dd44c2SDaniel Beauregard 164416dd44c2SDaniel Beauregard if (mdb_vread(qlstate, qlsize, hbaptr) == -1) { 164516dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 164616dd44c2SDaniel Beauregard mdb_warn("failed to read " 164716dd44c2SDaniel Beauregard "ql_adapter_state at %p", hbaptr); 164816dd44c2SDaniel Beauregard return (DCMD_OK); 164916dd44c2SDaniel Beauregard } 165016dd44c2SDaniel Beauregard 165116dd44c2SDaniel Beauregard if (qlstate->instance == instance) { 165216dd44c2SDaniel Beauregard break; 165316dd44c2SDaniel Beauregard } 165416dd44c2SDaniel Beauregard 165516dd44c2SDaniel Beauregard hbaptr = (uintptr_t)qlstate->hba.next; 165616dd44c2SDaniel Beauregard } 165716dd44c2SDaniel Beauregard } else { 165816dd44c2SDaniel Beauregard 165916dd44c2SDaniel Beauregard /* 166016dd44c2SDaniel Beauregard * verify the addr specified 166116dd44c2SDaniel Beauregard */ 166216dd44c2SDaniel Beauregard 166316dd44c2SDaniel Beauregard if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 166416dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure"); 166516dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 166616dd44c2SDaniel Beauregard return (DCMD_ERR); 166716dd44c2SDaniel Beauregard } 166816dd44c2SDaniel Beauregard 166916dd44c2SDaniel Beauregard if (&ql_hba == NULL) { 167016dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure - " 167116dd44c2SDaniel Beauregard "is qlc loaded?"); 167216dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 167316dd44c2SDaniel Beauregard return (DCMD_ERR); 167416dd44c2SDaniel Beauregard } 167516dd44c2SDaniel Beauregard 167616dd44c2SDaniel Beauregard hbaptr = (uintptr_t)ql_hba.first; 167716dd44c2SDaniel Beauregard while (hbaptr != NULL) { 167816dd44c2SDaniel Beauregard 167916dd44c2SDaniel Beauregard if (mdb_vread(qlstate, qlsize, hbaptr) == -1) { 168016dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 168116dd44c2SDaniel Beauregard mdb_warn("failed to read " 168216dd44c2SDaniel Beauregard "ql_adapter_state at %p", hbaptr); 168316dd44c2SDaniel Beauregard return (DCMD_OK); 168416dd44c2SDaniel Beauregard } 168516dd44c2SDaniel Beauregard 168616dd44c2SDaniel Beauregard if (hbaptr == addr) { 168716dd44c2SDaniel Beauregard break; 168816dd44c2SDaniel Beauregard } 168916dd44c2SDaniel Beauregard 169016dd44c2SDaniel Beauregard hbaptr = (uintptr_t)qlstate->hba.next; 169116dd44c2SDaniel Beauregard } 169216dd44c2SDaniel Beauregard } 169316dd44c2SDaniel Beauregard 169416dd44c2SDaniel Beauregard if (hbaptr == NULL) { 169516dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 169616dd44c2SDaniel Beauregard if (argc == 0) { 169716dd44c2SDaniel Beauregard mdb_warn("addr specified is not in the hba list\n"); 169816dd44c2SDaniel Beauregard } else { 169916dd44c2SDaniel Beauregard mdb_warn("instance specified does not exist\n"); 170016dd44c2SDaniel Beauregard } 170116dd44c2SDaniel Beauregard return (DCMD_OK); 170216dd44c2SDaniel Beauregard } 170316dd44c2SDaniel Beauregard 170416dd44c2SDaniel Beauregard if (((qlstate->ql_dump_state & QL_DUMP_VALID) != 0) || 170516dd44c2SDaniel Beauregard (qlstate->ql_dump_ptr != NULL)) { 170616dd44c2SDaniel Beauregard mdb_warn("instance %d already has a valid dump\n", 170716dd44c2SDaniel Beauregard qlstate->instance); 170816dd44c2SDaniel Beauregard mdb_free(qlstate, qlsize); 170916dd44c2SDaniel Beauregard return (DCMD_OK); 171016dd44c2SDaniel Beauregard } 171116dd44c2SDaniel Beauregard } 171216dd44c2SDaniel Beauregard #endif 171316dd44c2SDaniel Beauregard 171416dd44c2SDaniel Beauregard /* 171516dd44c2SDaniel Beauregard * ql_getdump_dcmd 1716fcf3ce44SJohn Forte * prints out the firmware dump buffer 1717fcf3ce44SJohn Forte * 1718fcf3ce44SJohn Forte * Input: 171916dd44c2SDaniel Beauregard * addr = User supplied address. (NB: must be an ha) 1720fcf3ce44SJohn Forte * flags = mdb flags. 1721fcf3ce44SJohn Forte * argc = Number of user supplied args. 1722fcf3ce44SJohn Forte * argv = Arg array. 1723fcf3ce44SJohn Forte * 1724fcf3ce44SJohn Forte * Returns: 1725fcf3ce44SJohn Forte * DCMD_OK or DCMD_ERR 1726fcf3ce44SJohn Forte * 1727fcf3ce44SJohn Forte * Context: 1728fcf3ce44SJohn Forte * User context. 1729fcf3ce44SJohn Forte * 1730fcf3ce44SJohn Forte */ 1731fcf3ce44SJohn Forte static int 173216dd44c2SDaniel Beauregard qlc_getdump_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 1733fcf3ce44SJohn Forte { 1734fcf3ce44SJohn Forte ql_adapter_state_t *ha; 173516dd44c2SDaniel Beauregard ql_head_t ql_hba; 173616dd44c2SDaniel Beauregard uintptr_t hbaptr = NULL; 173716dd44c2SDaniel Beauregard int verbose = 0; 1738fcf3ce44SJohn Forte 1739fcf3ce44SJohn Forte if ((!(flags & DCMD_ADDRSPEC)) || addr == NULL) { 1740fcf3ce44SJohn Forte mdb_warn("ql_adapter_state structure addr is required"); 1741fcf3ce44SJohn Forte return (DCMD_USAGE); 1742fcf3ce44SJohn Forte } 1743fcf3ce44SJohn Forte 174416dd44c2SDaniel Beauregard if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE, &verbose) != 174516dd44c2SDaniel Beauregard argc) { 174616dd44c2SDaniel Beauregard return (DCMD_USAGE); 174716dd44c2SDaniel Beauregard } 174816dd44c2SDaniel Beauregard 1749fcf3ce44SJohn Forte /* 1750fcf3ce44SJohn Forte * Get the adapter state struct which was passed 1751fcf3ce44SJohn Forte */ 1752fcf3ce44SJohn Forte if ((ha = (ql_adapter_state_t *)mdb_alloc(sizeof (ql_adapter_state_t), 1753fcf3ce44SJohn Forte UM_SLEEP)) == NULL) { 1754fcf3ce44SJohn Forte mdb_warn("failed to allocate memory for ql_adapter_state\n"); 1755fcf3ce44SJohn Forte return (DCMD_OK); 1756fcf3ce44SJohn Forte } 1757fcf3ce44SJohn Forte 175816dd44c2SDaniel Beauregard /* 175916dd44c2SDaniel Beauregard * show user which instances have valid f/w dumps available if 176016dd44c2SDaniel Beauregard * user has specified verbose option 176116dd44c2SDaniel Beauregard */ 176216dd44c2SDaniel Beauregard if (mdb_readvar(&ql_hba, "ql_hba") == -1) { 176316dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure"); 176416dd44c2SDaniel Beauregard } else if (&ql_hba == NULL) { 176516dd44c2SDaniel Beauregard mdb_warn("failed to read ql_hba structure -- is qlc loaded?"); 176616dd44c2SDaniel Beauregard } else if (verbose) { 176716dd44c2SDaniel Beauregard hbaptr = (uintptr_t)ql_hba.first; 176816dd44c2SDaniel Beauregard while (hbaptr != NULL) { 176916dd44c2SDaniel Beauregard 177016dd44c2SDaniel Beauregard if (mdb_vread(ha, sizeof (ql_adapter_state_t), 177116dd44c2SDaniel Beauregard hbaptr) == -1) { 177216dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 177316dd44c2SDaniel Beauregard mdb_warn("failed read ql_adapter_state at %p", 177416dd44c2SDaniel Beauregard hbaptr); 177516dd44c2SDaniel Beauregard return (DCMD_OK); 177616dd44c2SDaniel Beauregard } 177716dd44c2SDaniel Beauregard 177816dd44c2SDaniel Beauregard mdb_printf("instance %d:\n", ha->instance); 177916dd44c2SDaniel Beauregard (void) mdb_inc_indent((ulong_t)4); 178016dd44c2SDaniel Beauregard 178116dd44c2SDaniel Beauregard if (ha->ql_dump_state == 0) { 178216dd44c2SDaniel Beauregard mdb_printf("no dump flags\n"); 178316dd44c2SDaniel Beauregard } else { 178416dd44c2SDaniel Beauregard ql_dump_flags((uint64_t)ha->ql_dump_state, 178516dd44c2SDaniel Beauregard qldump_flags); 178616dd44c2SDaniel Beauregard } 178716dd44c2SDaniel Beauregard 178816dd44c2SDaniel Beauregard if (ha->ql_dump_ptr == NULL) { 178916dd44c2SDaniel Beauregard mdb_printf("no dump address\n"); 179016dd44c2SDaniel Beauregard } else { 179116dd44c2SDaniel Beauregard mdb_printf("dump address is: %p\n", 179216dd44c2SDaniel Beauregard ha->ql_dump_ptr); 179316dd44c2SDaniel Beauregard } 179416dd44c2SDaniel Beauregard 179516dd44c2SDaniel Beauregard (void) mdb_dec_indent((ulong_t)4); 179616dd44c2SDaniel Beauregard 179716dd44c2SDaniel Beauregard hbaptr = (uintptr_t)ha->hba.next; 179816dd44c2SDaniel Beauregard } 179916dd44c2SDaniel Beauregard mdb_printf("\n"); 180016dd44c2SDaniel Beauregard } 180116dd44c2SDaniel Beauregard 1802fcf3ce44SJohn Forte if (mdb_vread(ha, sizeof (ql_adapter_state_t), addr) == -1) { 1803fcf3ce44SJohn Forte mdb_warn("failed to read ql_adapter_state at %p", addr); 1804fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1805fcf3ce44SJohn Forte return (DCMD_OK); 1806fcf3ce44SJohn Forte } 1807fcf3ce44SJohn Forte 180816dd44c2SDaniel Beauregard /* 180916dd44c2SDaniel Beauregard * If its not a valid dump or there's not a f/w dump binary (???) 181016dd44c2SDaniel Beauregard * then bail out 181116dd44c2SDaniel Beauregard */ 181216dd44c2SDaniel Beauregard if (((ha->ql_dump_state & QL_DUMP_VALID) == 0) || 181316dd44c2SDaniel Beauregard (ha->ql_dump_ptr == NULL)) { 181416dd44c2SDaniel Beauregard mdb_warn("dump does not exist for instance %d (%x, %p)\n", 181516dd44c2SDaniel Beauregard ha->instance, ha->ql_dump_state, ha->ql_dump_ptr); 181616dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 181716dd44c2SDaniel Beauregard return (DCMD_OK); 181816dd44c2SDaniel Beauregard } 181916dd44c2SDaniel Beauregard 1820fcf3ce44SJohn Forte if (CFG_IST(ha, CFG_CTRL_2422)) { 1821fcf3ce44SJohn Forte (void) ql_24xx_dump_dcmd(ha, flags, argc, argv); 1822f33c1cdbSDaniel Beauregard } else if (CFG_IST(ha, CFG_CTRL_25XX)) { 1823fcf3ce44SJohn Forte (void) ql_25xx_dump_dcmd(ha, flags, argc, argv); 1824f33c1cdbSDaniel Beauregard } else if (CFG_IST(ha, CFG_CTRL_81XX)) { 1825f33c1cdbSDaniel Beauregard (void) ql_81xx_dump_dcmd(ha, flags, argc, argv); 1826eb82ff87SDaniel Beauregard } else if (!(CFG_IST(ha, CFG_CTRL_8021))) { 1827fcf3ce44SJohn Forte (void) ql_23xx_dump_dcmd(ha, flags, argc, argv); 1828fcf3ce44SJohn Forte } 1829fcf3ce44SJohn Forte 1830fcf3ce44SJohn Forte mdb_free(ha, sizeof (ql_adapter_state_t)); 1831fcf3ce44SJohn Forte 1832fcf3ce44SJohn Forte return (DCMD_OK); 1833fcf3ce44SJohn Forte } 1834fcf3ce44SJohn Forte 1835fcf3ce44SJohn Forte /* 1836fcf3ce44SJohn Forte * ql_23xx_dump_dcmd 1837fcf3ce44SJohn Forte * prints out a firmware dump buffer 1838fcf3ce44SJohn Forte * 1839fcf3ce44SJohn Forte * Input: 1840fcf3ce44SJohn Forte * addr = User supplied address. (NB: nust be an ha) 1841fcf3ce44SJohn Forte * flags = mdb flags. 1842fcf3ce44SJohn Forte * argc = Number of user supplied args. 1843fcf3ce44SJohn Forte * argv = Arg array. 1844fcf3ce44SJohn Forte * 1845fcf3ce44SJohn Forte * Returns: 1846fcf3ce44SJohn Forte * DCMD_OK or DCMD_ERR 1847fcf3ce44SJohn Forte * 1848fcf3ce44SJohn Forte * Context: 1849fcf3ce44SJohn Forte * User context. 1850fcf3ce44SJohn Forte * 1851fcf3ce44SJohn Forte */ 1852fcf3ce44SJohn Forte /*ARGSUSED*/ 1853fcf3ce44SJohn Forte static int 1854fcf3ce44SJohn Forte ql_23xx_dump_dcmd(ql_adapter_state_t *ha, uint_t flags, int argc, 1855fcf3ce44SJohn Forte const mdb_arg_t *argv) 1856fcf3ce44SJohn Forte { 1857fcf3ce44SJohn Forte ql_fw_dump_t *fw; 1858fcf3ce44SJohn Forte uint32_t cnt = 0; 1859fcf3ce44SJohn Forte int mbox_cnt; 1860fcf3ce44SJohn Forte 186116dd44c2SDaniel Beauregard fw = (ql_fw_dump_t *)mdb_alloc(ha->ql_dump_size, UM_SLEEP); 1862fcf3ce44SJohn Forte 186316dd44c2SDaniel Beauregard if (mdb_vread(fw, ha->ql_dump_size, 186416dd44c2SDaniel Beauregard (uintptr_t)ha->ql_dump_ptr) == -1) { 186516dd44c2SDaniel Beauregard mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)"); 186616dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 1867fcf3ce44SJohn Forte return (DCMD_OK); 1868fcf3ce44SJohn Forte } 1869fcf3ce44SJohn Forte 1870fcf3ce44SJohn Forte if (ha->cfg_flags & CFG_CTRL_2300) { 1871fcf3ce44SJohn Forte mdb_printf("\nISP 2300IP "); 1872fcf3ce44SJohn Forte } else if (ha->cfg_flags & CFG_CTRL_6322) { 1873fcf3ce44SJohn Forte mdb_printf("\nISP 6322FLX "); 1874fcf3ce44SJohn Forte } else { 1875fcf3ce44SJohn Forte mdb_printf("\nISP 2200IP "); 1876fcf3ce44SJohn Forte } 1877fcf3ce44SJohn Forte 1878fcf3ce44SJohn Forte mdb_printf("Firmware Version %d.%d.%d\n", 1879fcf3ce44SJohn Forte ha->fw_major_version, ha->fw_minor_version, 1880fcf3ce44SJohn Forte ha->fw_subminor_version); 1881fcf3ce44SJohn Forte 1882fcf3ce44SJohn Forte mdb_printf("\nPBIU Registers:"); 1883fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->pbiu_reg) / 2; cnt++) { 1884fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1885fcf3ce44SJohn Forte mdb_printf("\n"); 1886fcf3ce44SJohn Forte } 1887fcf3ce44SJohn Forte mdb_printf("%04x ", fw->pbiu_reg[cnt]); 1888fcf3ce44SJohn Forte } 1889fcf3ce44SJohn Forte 1890fcf3ce44SJohn Forte if (ha->cfg_flags & (CFG_CTRL_2300 | CFG_CTRL_6322)) { 1891fcf3ce44SJohn Forte mdb_printf("\n\nReqQ-RspQ-Risc2Host Status registers:"); 1892fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_host_reg) / 2; cnt++) { 1893fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1894fcf3ce44SJohn Forte mdb_printf("\n"); 1895fcf3ce44SJohn Forte } 1896fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_host_reg[cnt]); 1897fcf3ce44SJohn Forte } 1898fcf3ce44SJohn Forte } 1899fcf3ce44SJohn Forte 1900fcf3ce44SJohn Forte mdb_printf("\n\nMailbox Registers:"); 1901fcf3ce44SJohn Forte mbox_cnt = (ha->cfg_flags & (CFG_CTRL_2300 | CFG_CTRL_6322)) ? 16 : 8; 1902fcf3ce44SJohn Forte for (cnt = 0; cnt < mbox_cnt; cnt++) { 1903fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1904fcf3ce44SJohn Forte mdb_printf("\n"); 1905fcf3ce44SJohn Forte } 1906fcf3ce44SJohn Forte mdb_printf("%04x ", fw->mailbox_reg[cnt]); 1907fcf3ce44SJohn Forte } 1908fcf3ce44SJohn Forte 1909fcf3ce44SJohn Forte if (ha->cfg_flags & (CFG_CTRL_2300 | CFG_CTRL_6322)) { 1910fcf3ce44SJohn Forte mdb_printf("\n\nAuto Request Response DMA Registers:"); 1911fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->resp_dma_reg) / 2; cnt++) { 1912fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1913fcf3ce44SJohn Forte mdb_printf("\n"); 1914fcf3ce44SJohn Forte } 1915fcf3ce44SJohn Forte mdb_printf("%04x ", fw->resp_dma_reg[cnt]); 1916fcf3ce44SJohn Forte } 1917fcf3ce44SJohn Forte } 1918fcf3ce44SJohn Forte 1919fcf3ce44SJohn Forte mdb_printf("\n\nDMA Registers:"); 1920fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->dma_reg) / 2; cnt++) { 1921fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1922fcf3ce44SJohn Forte mdb_printf("\n"); 1923fcf3ce44SJohn Forte } 1924fcf3ce44SJohn Forte mdb_printf("%04x ", fw->dma_reg[cnt]); 1925fcf3ce44SJohn Forte } 1926fcf3ce44SJohn Forte 1927fcf3ce44SJohn Forte mdb_printf("\n\nRISC Hardware Registers:"); 1928fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_hdw_reg) / 2; cnt++) { 1929fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1930fcf3ce44SJohn Forte mdb_printf("\n"); 1931fcf3ce44SJohn Forte } 1932fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_hdw_reg[cnt]); 1933fcf3ce44SJohn Forte } 1934fcf3ce44SJohn Forte 1935fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP0 Registers:"); 1936fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp0_reg) / 2; cnt++) { 1937fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1938fcf3ce44SJohn Forte mdb_printf("\n"); 1939fcf3ce44SJohn Forte } 1940fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp0_reg[cnt]); 1941fcf3ce44SJohn Forte } 1942fcf3ce44SJohn Forte 1943fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP1 Registers:"); 1944fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp1_reg) / 2; cnt++) { 1945fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1946fcf3ce44SJohn Forte mdb_printf("\n"); 1947fcf3ce44SJohn Forte } 1948fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp1_reg[cnt]); 1949fcf3ce44SJohn Forte } 1950fcf3ce44SJohn Forte 1951fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP2 Registers:"); 1952fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp2_reg) / 2; cnt++) { 1953fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1954fcf3ce44SJohn Forte mdb_printf("\n"); 1955fcf3ce44SJohn Forte } 1956fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp2_reg[cnt]); 1957fcf3ce44SJohn Forte } 1958fcf3ce44SJohn Forte 1959fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP3 Registers:"); 1960fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp3_reg) / 2; cnt++) { 1961fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1962fcf3ce44SJohn Forte mdb_printf("\n"); 1963fcf3ce44SJohn Forte } 1964fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp3_reg[cnt]); 1965fcf3ce44SJohn Forte } 1966fcf3ce44SJohn Forte 1967fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP4 Registers:"); 1968fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp4_reg) / 2; cnt++) { 1969fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1970fcf3ce44SJohn Forte mdb_printf("\n"); 1971fcf3ce44SJohn Forte } 1972fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp4_reg[cnt]); 1973fcf3ce44SJohn Forte } 1974fcf3ce44SJohn Forte 1975fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP5 Registers:"); 1976fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp5_reg) / 2; cnt++) { 1977fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1978fcf3ce44SJohn Forte mdb_printf("\n"); 1979fcf3ce44SJohn Forte } 1980fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp5_reg[cnt]); 1981fcf3ce44SJohn Forte } 1982fcf3ce44SJohn Forte 1983fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP6 Registers:"); 1984fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp6_reg) / 2; cnt++) { 1985fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1986fcf3ce44SJohn Forte mdb_printf("\n"); 1987fcf3ce44SJohn Forte } 1988fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp6_reg[cnt]); 1989fcf3ce44SJohn Forte } 1990fcf3ce44SJohn Forte 1991fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP7 Registers:"); 1992fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp7_reg) / 2; cnt++) { 1993fcf3ce44SJohn Forte if (cnt % 8 == 0) { 1994fcf3ce44SJohn Forte mdb_printf("\n"); 1995fcf3ce44SJohn Forte } 1996fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_gp7_reg[cnt]); 1997fcf3ce44SJohn Forte } 1998fcf3ce44SJohn Forte 1999fcf3ce44SJohn Forte mdb_printf("\n\nFrame Buffer Hardware Registers:"); 2000fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->frame_buf_hdw_reg) / 2; cnt++) { 2001fcf3ce44SJohn Forte if ((cnt == 16) && 2002fcf3ce44SJohn Forte ((ha->cfg_flags & (CFG_CTRL_2300 | CFG_CTRL_6322)) == 0)) { 2003fcf3ce44SJohn Forte break; 2004fcf3ce44SJohn Forte } 2005fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2006fcf3ce44SJohn Forte mdb_printf("\n"); 2007fcf3ce44SJohn Forte } 2008fcf3ce44SJohn Forte mdb_printf("%04x ", fw->frame_buf_hdw_reg[cnt]); 2009fcf3ce44SJohn Forte } 2010fcf3ce44SJohn Forte 2011fcf3ce44SJohn Forte mdb_printf("\n\nFPM B0 Registers:"); 2012fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fpm_b0_reg) / 2; cnt++) { 2013fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2014fcf3ce44SJohn Forte mdb_printf("\n"); 2015fcf3ce44SJohn Forte } 2016fcf3ce44SJohn Forte mdb_printf("%04x ", fw->fpm_b0_reg[cnt]); 2017fcf3ce44SJohn Forte } 2018fcf3ce44SJohn Forte 2019fcf3ce44SJohn Forte mdb_printf("\n\nFPM B1 Registers:"); 2020fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fpm_b1_reg) / 2; cnt++) { 2021fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2022fcf3ce44SJohn Forte mdb_printf("\n"); 2023fcf3ce44SJohn Forte } 2024fcf3ce44SJohn Forte mdb_printf("%04x ", fw->fpm_b1_reg[cnt]); 2025fcf3ce44SJohn Forte } 2026fcf3ce44SJohn Forte 2027fcf3ce44SJohn Forte if (ha->cfg_flags & (CFG_CTRL_2300 | CFG_CTRL_6322)) { 2028fcf3ce44SJohn Forte mdb_printf("\n\nCode RAM Dump:"); 2029fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_ram) / 2; cnt++) { 2030fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2031fcf3ce44SJohn Forte mdb_printf("\n%05x: ", cnt + 0x0800); 2032fcf3ce44SJohn Forte } 2033fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_ram[cnt]); 2034fcf3ce44SJohn Forte } 2035fcf3ce44SJohn Forte 2036fcf3ce44SJohn Forte mdb_printf("\n\nStack RAM Dump:"); 2037fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->stack_ram) / 2; cnt++) { 2038fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2039fcf3ce44SJohn Forte mdb_printf("\n%05x: ", cnt + 0x010000); 2040fcf3ce44SJohn Forte } 2041fcf3ce44SJohn Forte mdb_printf("%04x ", fw->stack_ram[cnt]); 2042fcf3ce44SJohn Forte } 2043fcf3ce44SJohn Forte 2044fcf3ce44SJohn Forte mdb_printf("\n\nData RAM Dump:"); 2045fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->data_ram) / 2; cnt++) { 2046fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2047fcf3ce44SJohn Forte mdb_printf("\n%05x: ", cnt + 0x010800); 2048fcf3ce44SJohn Forte } 2049fcf3ce44SJohn Forte mdb_printf("%04x ", fw->data_ram[cnt]); 2050fcf3ce44SJohn Forte } 2051fcf3ce44SJohn Forte 2052fcf3ce44SJohn Forte mdb_printf("\n\n[<==END] ISP Debug Dump.\n"); 205316dd44c2SDaniel Beauregard 205416dd44c2SDaniel Beauregard mdb_printf("\n\nRequest Queue"); 205516dd44c2SDaniel Beauregard 205616dd44c2SDaniel Beauregard for (cnt = 0; cnt < REQUEST_QUEUE_SIZE / 4; cnt++) { 205716dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 205816dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 205916dd44c2SDaniel Beauregard } 206016dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->req_q[cnt]); 206116dd44c2SDaniel Beauregard } 206216dd44c2SDaniel Beauregard 206316dd44c2SDaniel Beauregard mdb_printf("\n\nResponse Queue"); 206416dd44c2SDaniel Beauregard 206516dd44c2SDaniel Beauregard for (cnt = 0; cnt < RESPONSE_QUEUE_SIZE / 4; cnt++) { 206616dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 206716dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 206816dd44c2SDaniel Beauregard } 206916dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->rsp_q[cnt]); 207016dd44c2SDaniel Beauregard } 207116dd44c2SDaniel Beauregard 207216dd44c2SDaniel Beauregard mdb_printf("\n"); 207316dd44c2SDaniel Beauregard 2074fcf3ce44SJohn Forte } else { 2075fcf3ce44SJohn Forte mdb_printf("\n\nRISC SRAM:"); 2076fcf3ce44SJohn Forte for (cnt = 0; cnt < 0xf000; cnt++) { 2077fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2078fcf3ce44SJohn Forte mdb_printf("\n%04x: ", cnt + 0x1000); 2079fcf3ce44SJohn Forte } 2080fcf3ce44SJohn Forte mdb_printf("%04x ", fw->risc_ram[cnt]); 2081fcf3ce44SJohn Forte } 2082fcf3ce44SJohn Forte } 2083fcf3ce44SJohn Forte 208416dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 208516dd44c2SDaniel Beauregard 2086fcf3ce44SJohn Forte return (DCMD_OK); 2087fcf3ce44SJohn Forte } 2088fcf3ce44SJohn Forte 2089fcf3ce44SJohn Forte /* 2090fcf3ce44SJohn Forte * ql_24xx_dump_dcmd 2091fcf3ce44SJohn Forte * prints out a firmware dump buffer 2092fcf3ce44SJohn Forte * 2093fcf3ce44SJohn Forte * Input: 2094fcf3ce44SJohn Forte * addr = User supplied address. (NB: nust be an ha) 2095fcf3ce44SJohn Forte * flags = mdb flags. 2096fcf3ce44SJohn Forte * argc = Number of user supplied args. 2097fcf3ce44SJohn Forte * argv = Arg array. 2098fcf3ce44SJohn Forte * 2099fcf3ce44SJohn Forte * Returns: 2100fcf3ce44SJohn Forte * DCMD_OK or DCMD_ERR 2101fcf3ce44SJohn Forte * 2102fcf3ce44SJohn Forte * Context: 2103fcf3ce44SJohn Forte * User context. 2104fcf3ce44SJohn Forte * 2105fcf3ce44SJohn Forte */ 2106fcf3ce44SJohn Forte /*ARGSUSED*/ 2107fcf3ce44SJohn Forte static int 2108fcf3ce44SJohn Forte ql_24xx_dump_dcmd(ql_adapter_state_t *ha, uint_t flags, int argc, 2109fcf3ce44SJohn Forte const mdb_arg_t *argv) 2110fcf3ce44SJohn Forte { 2111fcf3ce44SJohn Forte ql_24xx_fw_dump_t *fw; 2112fcf3ce44SJohn Forte uint32_t cnt = 0; 2113fcf3ce44SJohn Forte 211416dd44c2SDaniel Beauregard fw = (ql_24xx_fw_dump_t *)mdb_alloc(ha->ql_dump_size, UM_SLEEP); 211516dd44c2SDaniel Beauregard 211616dd44c2SDaniel Beauregard if (mdb_vread(fw, ha->ql_dump_size, 211716dd44c2SDaniel Beauregard (uintptr_t)ha->ql_dump_ptr) == -1) { 2118fcf3ce44SJohn Forte mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)"); 211916dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 2120fcf3ce44SJohn Forte return (DCMD_OK); 2121fcf3ce44SJohn Forte } 2122fcf3ce44SJohn Forte 2123fcf3ce44SJohn Forte mdb_printf("ISP FW Version %d.%02d.%02d Attributes %X\n", 2124fcf3ce44SJohn Forte ha->fw_major_version, ha->fw_minor_version, 2125fcf3ce44SJohn Forte ha->fw_subminor_version, ha->fw_attributes); 2126fcf3ce44SJohn Forte 2127fcf3ce44SJohn Forte mdb_printf("\nHCCR Register\n%08x\n", fw->hccr); 2128fcf3ce44SJohn Forte 2129fcf3ce44SJohn Forte mdb_printf("\nHost Interface Registers"); 2130fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->host_reg) / 4; cnt++) { 2131fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2132fcf3ce44SJohn Forte mdb_printf("\n"); 2133fcf3ce44SJohn Forte } 2134fcf3ce44SJohn Forte mdb_printf("%08x ", fw->host_reg[cnt]); 2135fcf3ce44SJohn Forte } 2136fcf3ce44SJohn Forte 2137fcf3ce44SJohn Forte mdb_printf("\n\nMailbox Registers"); 2138fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->mailbox_reg) / 2; cnt++) { 2139fcf3ce44SJohn Forte if (cnt % 16 == 0) { 2140fcf3ce44SJohn Forte mdb_printf("\n"); 2141fcf3ce44SJohn Forte } 2142fcf3ce44SJohn Forte mdb_printf("%04x ", fw->mailbox_reg[cnt]); 2143fcf3ce44SJohn Forte } 2144fcf3ce44SJohn Forte 2145fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ GP Registers"); 2146fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_gp_reg) / 4; cnt++) { 2147fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2148fcf3ce44SJohn Forte mdb_printf("\n"); 2149fcf3ce44SJohn Forte } 2150fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_gp_reg[cnt]); 2151fcf3ce44SJohn Forte } 2152fcf3ce44SJohn Forte 2153fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ-0 Registers"); 2154fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_0_reg) / 4; cnt++) { 2155fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2156fcf3ce44SJohn Forte mdb_printf("\n"); 2157fcf3ce44SJohn Forte } 2158fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_0_reg[cnt]); 2159fcf3ce44SJohn Forte } 2160fcf3ce44SJohn Forte 2161fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ-1 Registers"); 2162fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_1_reg) / 4; cnt++) { 2163fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2164fcf3ce44SJohn Forte mdb_printf("\n"); 2165fcf3ce44SJohn Forte } 2166fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_1_reg[cnt]); 2167fcf3ce44SJohn Forte } 2168fcf3ce44SJohn Forte 2169fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ GP Registers"); 2170fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_gp_reg) / 4; cnt++) { 2171fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2172fcf3ce44SJohn Forte mdb_printf("\n"); 2173fcf3ce44SJohn Forte } 2174fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_gp_reg[cnt]); 2175fcf3ce44SJohn Forte } 2176fcf3ce44SJohn Forte 2177fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-0 Registers"); 2178fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_0_reg) / 4; cnt++) { 2179fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2180fcf3ce44SJohn Forte mdb_printf("\n"); 2181fcf3ce44SJohn Forte } 2182fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_0_reg[cnt]); 2183fcf3ce44SJohn Forte } 2184fcf3ce44SJohn Forte 2185fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-1 Registers"); 2186fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_1_reg) / 4; cnt++) { 2187fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2188fcf3ce44SJohn Forte mdb_printf("\n"); 2189fcf3ce44SJohn Forte } 2190fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_1_reg[cnt]); 2191fcf3ce44SJohn Forte } 2192fcf3ce44SJohn Forte 2193fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-2 Registers"); 2194fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_2_reg) / 4; cnt++) { 2195fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2196fcf3ce44SJohn Forte mdb_printf("\n"); 2197fcf3ce44SJohn Forte } 2198fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_2_reg[cnt]); 2199fcf3ce44SJohn Forte } 2200fcf3ce44SJohn Forte 2201fcf3ce44SJohn Forte mdb_printf("\n\nCommand DMA Registers"); 2202fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->cmd_dma_reg) / 4; cnt++) { 2203fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2204fcf3ce44SJohn Forte mdb_printf("\n"); 2205fcf3ce44SJohn Forte } 2206fcf3ce44SJohn Forte mdb_printf("%08x ", fw->cmd_dma_reg[cnt]); 2207fcf3ce44SJohn Forte } 2208fcf3ce44SJohn Forte 2209fcf3ce44SJohn Forte mdb_printf("\n\nRequest0 Queue DMA Channel Registers"); 2210fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->req0_dma_reg) / 4; cnt++) { 2211fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2212fcf3ce44SJohn Forte mdb_printf("\n"); 2213fcf3ce44SJohn Forte } 2214fcf3ce44SJohn Forte mdb_printf("%08x ", fw->req0_dma_reg[cnt]); 2215fcf3ce44SJohn Forte } 2216fcf3ce44SJohn Forte 2217fcf3ce44SJohn Forte mdb_printf("\n\nResponse0 Queue DMA Channel Registers"); 2218fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->resp0_dma_reg) / 4; cnt++) { 2219fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2220fcf3ce44SJohn Forte mdb_printf("\n"); 2221fcf3ce44SJohn Forte } 2222fcf3ce44SJohn Forte mdb_printf("%08x ", fw->resp0_dma_reg[cnt]); 2223fcf3ce44SJohn Forte } 2224fcf3ce44SJohn Forte 2225fcf3ce44SJohn Forte mdb_printf("\n\nRequest1 Queue DMA Channel Registers"); 2226fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->req1_dma_reg) / 4; cnt++) { 2227fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2228fcf3ce44SJohn Forte mdb_printf("\n"); 2229fcf3ce44SJohn Forte } 2230fcf3ce44SJohn Forte mdb_printf("%08x ", fw->req1_dma_reg[cnt]); 2231fcf3ce44SJohn Forte } 2232fcf3ce44SJohn Forte 2233fcf3ce44SJohn Forte mdb_printf("\n\nXMT0 Data DMA Registers"); 2234fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt0_dma_reg) / 4; cnt++) { 2235fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2236fcf3ce44SJohn Forte mdb_printf("\n"); 2237fcf3ce44SJohn Forte } 2238fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt0_dma_reg[cnt]); 2239fcf3ce44SJohn Forte } 2240fcf3ce44SJohn Forte 2241fcf3ce44SJohn Forte mdb_printf("\n\nXMT1 Data DMA Registers"); 2242fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt1_dma_reg) / 4; cnt++) { 2243fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2244fcf3ce44SJohn Forte mdb_printf("\n"); 2245fcf3ce44SJohn Forte } 2246fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt1_dma_reg[cnt]); 2247fcf3ce44SJohn Forte } 2248fcf3ce44SJohn Forte 2249fcf3ce44SJohn Forte mdb_printf("\n\nXMT2 Data DMA Registers"); 2250fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt2_dma_reg) / 4; cnt++) { 2251fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2252fcf3ce44SJohn Forte mdb_printf("\n"); 2253fcf3ce44SJohn Forte } 2254fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt2_dma_reg[cnt]); 2255fcf3ce44SJohn Forte } 2256fcf3ce44SJohn Forte 2257fcf3ce44SJohn Forte mdb_printf("\n\nXMT3 Data DMA Registers"); 2258fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt3_dma_reg) / 4; cnt++) { 2259fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2260fcf3ce44SJohn Forte mdb_printf("\n"); 2261fcf3ce44SJohn Forte } 2262fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt3_dma_reg[cnt]); 2263fcf3ce44SJohn Forte } 2264fcf3ce44SJohn Forte 2265fcf3ce44SJohn Forte mdb_printf("\n\nXMT4 Data DMA Registers"); 2266fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt4_dma_reg) / 4; cnt++) { 2267fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2268fcf3ce44SJohn Forte mdb_printf("\n"); 2269fcf3ce44SJohn Forte } 2270fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt4_dma_reg[cnt]); 2271fcf3ce44SJohn Forte } 2272fcf3ce44SJohn Forte 2273fcf3ce44SJohn Forte mdb_printf("\n\nXMT Data DMA Common Registers"); 2274fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt_data_dma_reg) / 4; cnt++) { 2275fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2276fcf3ce44SJohn Forte mdb_printf("\n"); 2277fcf3ce44SJohn Forte } 2278fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt_data_dma_reg[cnt]); 2279fcf3ce44SJohn Forte } 2280fcf3ce44SJohn Forte 2281fcf3ce44SJohn Forte mdb_printf("\n\nRCV Thread 0 Data DMA Registers"); 2282fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rcvt0_data_dma_reg) / 4; cnt++) { 2283fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2284fcf3ce44SJohn Forte mdb_printf("\n"); 2285fcf3ce44SJohn Forte } 2286fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rcvt0_data_dma_reg[cnt]); 2287fcf3ce44SJohn Forte } 2288fcf3ce44SJohn Forte 2289fcf3ce44SJohn Forte mdb_printf("\n\nRCV Thread 1 Data DMA Registers"); 2290fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rcvt1_data_dma_reg) / 4; cnt++) { 2291fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2292fcf3ce44SJohn Forte mdb_printf("\n"); 2293fcf3ce44SJohn Forte } 2294fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rcvt1_data_dma_reg[cnt]); 2295fcf3ce44SJohn Forte } 2296fcf3ce44SJohn Forte 2297fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP Registers"); 2298fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp_reg) / 4; cnt++) { 2299fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2300fcf3ce44SJohn Forte mdb_printf("\n"); 2301fcf3ce44SJohn Forte } 2302fcf3ce44SJohn Forte mdb_printf("%08x ", fw->risc_gp_reg[cnt]); 2303fcf3ce44SJohn Forte } 2304fcf3ce44SJohn Forte 2305fcf3ce44SJohn Forte mdb_printf("\n\nShadow Registers"); 2306fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->shadow_reg) / 4; cnt++) { 2307fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2308fcf3ce44SJohn Forte mdb_printf("\n"); 2309fcf3ce44SJohn Forte } 2310fcf3ce44SJohn Forte mdb_printf("%08x ", fw->shadow_reg[cnt]); 2311fcf3ce44SJohn Forte } 2312fcf3ce44SJohn Forte 2313fcf3ce44SJohn Forte mdb_printf("\n\nLMC Registers"); 2314fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->lmc_reg) / 4; cnt++) { 2315fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2316fcf3ce44SJohn Forte mdb_printf("\n"); 2317fcf3ce44SJohn Forte } 2318fcf3ce44SJohn Forte mdb_printf("%08x ", fw->lmc_reg[cnt]); 2319fcf3ce44SJohn Forte } 2320fcf3ce44SJohn Forte 2321fcf3ce44SJohn Forte mdb_printf("\n\nFPM Hardware Registers"); 2322fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fpm_hdw_reg) / 4; cnt++) { 2323fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2324fcf3ce44SJohn Forte mdb_printf("\n"); 2325fcf3ce44SJohn Forte } 2326fcf3ce44SJohn Forte mdb_printf("%08x ", fw->fpm_hdw_reg[cnt]); 2327fcf3ce44SJohn Forte } 2328fcf3ce44SJohn Forte 2329fcf3ce44SJohn Forte mdb_printf("\n\nFB Hardware Registers"); 2330fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fb_hdw_reg) / 4; cnt++) { 2331fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2332fcf3ce44SJohn Forte mdb_printf("\n"); 2333fcf3ce44SJohn Forte } 2334fcf3ce44SJohn Forte mdb_printf("%08x ", fw->fb_hdw_reg[cnt]); 2335fcf3ce44SJohn Forte } 2336fcf3ce44SJohn Forte 2337fcf3ce44SJohn Forte mdb_printf("\n\nCode RAM"); 2338fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) { 2339fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2340fcf3ce44SJohn Forte mdb_printf("\n%08x: ", cnt + 0x20000); 2341fcf3ce44SJohn Forte } 2342fcf3ce44SJohn Forte mdb_printf("%08x ", fw->code_ram[cnt]); 2343fcf3ce44SJohn Forte } 2344fcf3ce44SJohn Forte 2345fcf3ce44SJohn Forte mdb_printf("\n\nExternal Memory"); 2346fcf3ce44SJohn Forte for (cnt = 0; cnt < ha->fw_ext_memory_size / 4; cnt++) { 2347fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2348fcf3ce44SJohn Forte mdb_printf("\n%08x: ", cnt + 0x100000); 2349fcf3ce44SJohn Forte } 2350fcf3ce44SJohn Forte mdb_printf("%08x ", fw->ext_mem[cnt]); 2351fcf3ce44SJohn Forte } 2352fcf3ce44SJohn Forte 2353fcf3ce44SJohn Forte mdb_printf("\n[<==END] ISP Debug Dump"); 2354fcf3ce44SJohn Forte 235516dd44c2SDaniel Beauregard mdb_printf("\n\nRequest Queue"); 235616dd44c2SDaniel Beauregard 235716dd44c2SDaniel Beauregard for (cnt = 0; cnt < REQUEST_QUEUE_SIZE / 4; cnt++) { 235816dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 235916dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 236016dd44c2SDaniel Beauregard } 236116dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->req_q[cnt]); 236216dd44c2SDaniel Beauregard } 236316dd44c2SDaniel Beauregard 236416dd44c2SDaniel Beauregard mdb_printf("\n\nResponse Queue"); 236516dd44c2SDaniel Beauregard 236616dd44c2SDaniel Beauregard for (cnt = 0; cnt < RESPONSE_QUEUE_SIZE / 4; cnt++) { 236716dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 236816dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 236916dd44c2SDaniel Beauregard } 237016dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->rsp_q[cnt]); 237116dd44c2SDaniel Beauregard } 237216dd44c2SDaniel Beauregard 237316dd44c2SDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWEXTTRACE) && 237416dd44c2SDaniel Beauregard (ha->fwexttracebuf.bp != NULL)) { 237516dd44c2SDaniel Beauregard uint32_t cnt_b = 0; 237616dd44c2SDaniel Beauregard uint32_t *w32 = ha->fwexttracebuf.bp; 237716dd44c2SDaniel Beauregard 237816dd44c2SDaniel Beauregard mdb_printf("\n\nExtended Trace Buffer Memory"); 237916dd44c2SDaniel Beauregard /* show data address as a byte address, data as long words */ 238016dd44c2SDaniel Beauregard for (cnt = 0; cnt < FWEXTSIZE / 4; cnt++) { 238116dd44c2SDaniel Beauregard cnt_b = cnt * 4; 238216dd44c2SDaniel Beauregard if (cnt_b % 32 == 0) { 238316dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 238416dd44c2SDaniel Beauregard } 238516dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->ext_trace_buf[cnt]); 238616dd44c2SDaniel Beauregard } 238716dd44c2SDaniel Beauregard } 238816dd44c2SDaniel Beauregard 238916dd44c2SDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWFCETRACE) && 239016dd44c2SDaniel Beauregard (ha->fwfcetracebuf.bp != NULL)) { 239116dd44c2SDaniel Beauregard uint32_t cnt_b = 0; 239216dd44c2SDaniel Beauregard uint32_t *w32 = ha->fwfcetracebuf.bp; 239316dd44c2SDaniel Beauregard 239416dd44c2SDaniel Beauregard mdb_printf("\n\nFC Event Trace Buffer Memory"); 239516dd44c2SDaniel Beauregard /* show data address as a byte address, data as long words */ 239616dd44c2SDaniel Beauregard for (cnt = 0; cnt < FWFCESIZE / 4; cnt++) { 239716dd44c2SDaniel Beauregard cnt_b = cnt * 4; 239816dd44c2SDaniel Beauregard if (cnt_b % 32 == 0) { 239916dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 240016dd44c2SDaniel Beauregard } 240116dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->fce_trace_buf[cnt]); 240216dd44c2SDaniel Beauregard } 240316dd44c2SDaniel Beauregard } 240416dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 2405fcf3ce44SJohn Forte 2406fcf3ce44SJohn Forte return (DCMD_OK); 2407fcf3ce44SJohn Forte } 2408fcf3ce44SJohn Forte 2409fcf3ce44SJohn Forte /* 2410fcf3ce44SJohn Forte * ql_25xx_dump_dcmd 2411fcf3ce44SJohn Forte * prints out a firmware dump buffer 2412fcf3ce44SJohn Forte * 2413fcf3ce44SJohn Forte * Input: 2414fcf3ce44SJohn Forte * addr = User supplied address. (NB: nust be an ha) 2415fcf3ce44SJohn Forte * flags = mdb flags. 2416fcf3ce44SJohn Forte * argc = Number of user supplied args. 2417fcf3ce44SJohn Forte * argv = Arg array. 2418fcf3ce44SJohn Forte * 2419fcf3ce44SJohn Forte * Returns: 2420fcf3ce44SJohn Forte * DCMD_OK or DCMD_ERR 2421fcf3ce44SJohn Forte * 2422fcf3ce44SJohn Forte * Context: 2423fcf3ce44SJohn Forte * User context. 2424fcf3ce44SJohn Forte * 2425fcf3ce44SJohn Forte */ 2426fcf3ce44SJohn Forte /*ARGSUSED*/ 2427fcf3ce44SJohn Forte static int 2428fcf3ce44SJohn Forte ql_25xx_dump_dcmd(ql_adapter_state_t *ha, uint_t flags, int argc, 2429fcf3ce44SJohn Forte const mdb_arg_t *argv) 2430fcf3ce44SJohn Forte { 2431fcf3ce44SJohn Forte ql_25xx_fw_dump_t *fw; 2432fcf3ce44SJohn Forte uint32_t cnt = 0; 2433fcf3ce44SJohn Forte 243416dd44c2SDaniel Beauregard fw = (ql_25xx_fw_dump_t *)mdb_alloc(ha->ql_dump_size, UM_SLEEP); 2435fcf3ce44SJohn Forte 243616dd44c2SDaniel Beauregard if (mdb_vread(fw, ha->ql_dump_size, 243716dd44c2SDaniel Beauregard (uintptr_t)ha->ql_dump_ptr) == -1) { 2438fcf3ce44SJohn Forte mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)"); 243916dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 2440fcf3ce44SJohn Forte return (DCMD_OK); 2441fcf3ce44SJohn Forte } 2442fcf3ce44SJohn Forte 244316dd44c2SDaniel Beauregard mdb_printf("\nISP FW Version %d.%02d.%02d Attributes %X\n", 2444fcf3ce44SJohn Forte ha->fw_major_version, ha->fw_minor_version, 2445fcf3ce44SJohn Forte ha->fw_subminor_version, ha->fw_attributes); 2446fcf3ce44SJohn Forte 2447fcf3ce44SJohn Forte mdb_printf("\nR2H Register\n%08x\n", fw->r2h_status); 2448fcf3ce44SJohn Forte 244916dd44c2SDaniel Beauregard mdb_printf("\n\nHostRisc Registers"); 2450fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->hostrisc_reg) / 4; cnt++) { 2451fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2452fcf3ce44SJohn Forte mdb_printf("\n"); 2453fcf3ce44SJohn Forte } 2454fcf3ce44SJohn Forte mdb_printf("%08x ", fw->hostrisc_reg[cnt]); 2455fcf3ce44SJohn Forte } 2456fcf3ce44SJohn Forte 245716dd44c2SDaniel Beauregard mdb_printf("\n\nPCIe Registers"); 2458fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->pcie_reg) / 4; cnt++) { 2459fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2460fcf3ce44SJohn Forte mdb_printf("\n"); 2461fcf3ce44SJohn Forte } 2462fcf3ce44SJohn Forte mdb_printf("%08x ", fw->pcie_reg[cnt]); 2463fcf3ce44SJohn Forte } 2464fcf3ce44SJohn Forte 246516dd44c2SDaniel Beauregard mdb_printf("\n\nHost Interface Registers"); 2466fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->host_reg) / 4; cnt++) { 2467fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2468fcf3ce44SJohn Forte mdb_printf("\n"); 2469fcf3ce44SJohn Forte } 2470fcf3ce44SJohn Forte mdb_printf("%08x ", fw->host_reg[cnt]); 2471fcf3ce44SJohn Forte } 2472fcf3ce44SJohn Forte 247316dd44c2SDaniel Beauregard mdb_printf("\n\nShadow Registers"); 247416dd44c2SDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->shadow_reg) / 4; cnt++) { 247516dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 247616dd44c2SDaniel Beauregard mdb_printf("\n"); 247716dd44c2SDaniel Beauregard } 247816dd44c2SDaniel Beauregard 247916dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->shadow_reg[cnt]); 248016dd44c2SDaniel Beauregard } 248116dd44c2SDaniel Beauregard 2482fcf3ce44SJohn Forte mdb_printf("\n\nMailbox Registers"); 2483fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->mailbox_reg) / 2; cnt++) { 2484fcf3ce44SJohn Forte if (cnt % 16 == 0) { 2485fcf3ce44SJohn Forte mdb_printf("\n"); 2486fcf3ce44SJohn Forte } 2487fcf3ce44SJohn Forte mdb_printf("%04x ", fw->mailbox_reg[cnt]); 2488fcf3ce44SJohn Forte } 2489fcf3ce44SJohn Forte 2490fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ GP Registers"); 2491fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_gp_reg) / 4; cnt++) { 2492fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2493fcf3ce44SJohn Forte mdb_printf("\n"); 2494fcf3ce44SJohn Forte } 2495fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_gp_reg[cnt]); 2496fcf3ce44SJohn Forte } 2497fcf3ce44SJohn Forte 2498fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ-0 Registers"); 2499fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_0_reg) / 4; cnt++) { 2500fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2501fcf3ce44SJohn Forte mdb_printf("\n"); 2502fcf3ce44SJohn Forte } 2503fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_0_reg[cnt]); 2504fcf3ce44SJohn Forte } 2505fcf3ce44SJohn Forte 2506fcf3ce44SJohn Forte mdb_printf("\n\nXSEQ-1 Registers"); 2507fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xseq_1_reg) / 4; cnt++) { 2508fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2509fcf3ce44SJohn Forte mdb_printf("\n"); 2510fcf3ce44SJohn Forte } 2511fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xseq_1_reg[cnt]); 2512fcf3ce44SJohn Forte } 2513fcf3ce44SJohn Forte 2514fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ GP Registers"); 2515fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_gp_reg) / 4; cnt++) { 2516fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2517fcf3ce44SJohn Forte mdb_printf("\n"); 2518fcf3ce44SJohn Forte } 2519fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_gp_reg[cnt]); 2520fcf3ce44SJohn Forte } 2521fcf3ce44SJohn Forte 2522fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-0 Registers"); 2523fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_0_reg) / 4; cnt++) { 2524fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2525fcf3ce44SJohn Forte mdb_printf("\n"); 2526fcf3ce44SJohn Forte } 2527fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_0_reg[cnt]); 2528fcf3ce44SJohn Forte } 2529fcf3ce44SJohn Forte 2530fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-1 Registers"); 2531fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_1_reg) / 4; cnt++) { 2532fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2533fcf3ce44SJohn Forte mdb_printf("\n"); 2534fcf3ce44SJohn Forte } 2535fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_1_reg[cnt]); 2536fcf3ce44SJohn Forte } 2537fcf3ce44SJohn Forte 2538fcf3ce44SJohn Forte mdb_printf("\n\nRSEQ-2 Registers"); 2539fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rseq_2_reg) / 4; cnt++) { 2540fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2541fcf3ce44SJohn Forte mdb_printf("\n"); 2542fcf3ce44SJohn Forte } 2543fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rseq_2_reg[cnt]); 2544fcf3ce44SJohn Forte } 2545fcf3ce44SJohn Forte 2546fcf3ce44SJohn Forte mdb_printf("\n\nASEQ GP Registers"); 2547fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->aseq_gp_reg) / 4; cnt++) { 2548fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2549fcf3ce44SJohn Forte mdb_printf("\n"); 2550fcf3ce44SJohn Forte } 2551fcf3ce44SJohn Forte mdb_printf("%08x ", fw->aseq_gp_reg[cnt]); 2552fcf3ce44SJohn Forte } 2553fcf3ce44SJohn Forte 2554fcf3ce44SJohn Forte mdb_printf("\n\nASEQ-0 GP Registers"); 2555fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->aseq_0_reg) / 4; cnt++) { 2556fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2557fcf3ce44SJohn Forte mdb_printf("\n"); 2558fcf3ce44SJohn Forte } 2559fcf3ce44SJohn Forte 2560fcf3ce44SJohn Forte mdb_printf("%08x ", fw->aseq_0_reg[cnt]); 2561fcf3ce44SJohn Forte } 2562fcf3ce44SJohn Forte 2563fcf3ce44SJohn Forte mdb_printf("\n\nASEQ-1 GP Registers"); 2564fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->aseq_1_reg) / 4; cnt++) { 2565fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2566fcf3ce44SJohn Forte mdb_printf("\n"); 2567fcf3ce44SJohn Forte } 2568fcf3ce44SJohn Forte 2569fcf3ce44SJohn Forte mdb_printf("%08x ", fw->aseq_1_reg[cnt]); 2570fcf3ce44SJohn Forte } 2571fcf3ce44SJohn Forte 2572fcf3ce44SJohn Forte mdb_printf("\n\nASEQ-2 GP Registers"); 2573fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->aseq_2_reg) / 4; cnt++) { 2574fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2575fcf3ce44SJohn Forte mdb_printf("\n"); 2576fcf3ce44SJohn Forte } 2577fcf3ce44SJohn Forte mdb_printf("%08x ", fw->aseq_2_reg[cnt]); 2578fcf3ce44SJohn Forte } 2579fcf3ce44SJohn Forte 2580fcf3ce44SJohn Forte mdb_printf("\n\nCommand DMA Registers"); 2581fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->cmd_dma_reg) / 4; cnt++) { 2582fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2583fcf3ce44SJohn Forte mdb_printf("\n"); 2584fcf3ce44SJohn Forte } 2585fcf3ce44SJohn Forte mdb_printf("%08x ", fw->cmd_dma_reg[cnt]); 2586fcf3ce44SJohn Forte } 2587fcf3ce44SJohn Forte 2588fcf3ce44SJohn Forte mdb_printf("\n\nRequest0 Queue DMA Channel Registers"); 2589fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->req0_dma_reg) / 4; cnt++) { 2590fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2591fcf3ce44SJohn Forte mdb_printf("\n"); 2592fcf3ce44SJohn Forte } 2593fcf3ce44SJohn Forte mdb_printf("%08x ", fw->req0_dma_reg[cnt]); 2594fcf3ce44SJohn Forte } 2595fcf3ce44SJohn Forte 2596fcf3ce44SJohn Forte mdb_printf("\n\nResponse0 Queue DMA Channel Registers"); 2597fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->resp0_dma_reg) / 4; cnt++) { 2598fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2599fcf3ce44SJohn Forte mdb_printf("\n"); 2600fcf3ce44SJohn Forte } 2601fcf3ce44SJohn Forte mdb_printf("%08x ", fw->resp0_dma_reg[cnt]); 2602fcf3ce44SJohn Forte } 2603fcf3ce44SJohn Forte 2604fcf3ce44SJohn Forte mdb_printf("\n\nRequest1 Queue DMA Channel Registers"); 2605fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->req1_dma_reg) / 4; cnt++) { 2606fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2607fcf3ce44SJohn Forte mdb_printf("\n"); 2608fcf3ce44SJohn Forte } 2609fcf3ce44SJohn Forte mdb_printf("%08x ", fw->req1_dma_reg[cnt]); 2610fcf3ce44SJohn Forte } 2611fcf3ce44SJohn Forte 2612fcf3ce44SJohn Forte mdb_printf("\n\nXMT0 Data DMA Registers"); 2613fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt0_dma_reg) / 4; cnt++) { 2614fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2615fcf3ce44SJohn Forte mdb_printf("\n"); 2616fcf3ce44SJohn Forte } 2617fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt0_dma_reg[cnt]); 2618fcf3ce44SJohn Forte } 2619fcf3ce44SJohn Forte 2620fcf3ce44SJohn Forte mdb_printf("\n\nXMT1 Data DMA Registers"); 2621fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt1_dma_reg) / 4; cnt++) { 2622fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2623fcf3ce44SJohn Forte mdb_printf("\n"); 2624fcf3ce44SJohn Forte } 2625fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt1_dma_reg[cnt]); 2626fcf3ce44SJohn Forte } 2627fcf3ce44SJohn Forte 2628fcf3ce44SJohn Forte mdb_printf("\n\nXMT2 Data DMA Registers"); 2629fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt2_dma_reg) / 4; cnt++) { 2630fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2631fcf3ce44SJohn Forte mdb_printf("\n"); 2632fcf3ce44SJohn Forte } 2633fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt2_dma_reg[cnt]); 2634fcf3ce44SJohn Forte } 2635fcf3ce44SJohn Forte 2636fcf3ce44SJohn Forte mdb_printf("\n\nXMT3 Data DMA Registers"); 2637fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt3_dma_reg) / 4; cnt++) { 2638fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2639fcf3ce44SJohn Forte mdb_printf("\n"); 2640fcf3ce44SJohn Forte } 2641fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt3_dma_reg[cnt]); 2642fcf3ce44SJohn Forte } 2643fcf3ce44SJohn Forte 2644fcf3ce44SJohn Forte mdb_printf("\n\nXMT4 Data DMA Registers"); 2645fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt4_dma_reg) / 4; cnt++) { 2646fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2647fcf3ce44SJohn Forte mdb_printf("\n"); 2648fcf3ce44SJohn Forte } 2649fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt4_dma_reg[cnt]); 2650fcf3ce44SJohn Forte } 2651fcf3ce44SJohn Forte 2652fcf3ce44SJohn Forte mdb_printf("\n\nXMT Data DMA Common Registers"); 2653fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->xmt_data_dma_reg) / 4; cnt++) { 2654fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2655fcf3ce44SJohn Forte mdb_printf("\n"); 2656fcf3ce44SJohn Forte } 2657fcf3ce44SJohn Forte mdb_printf("%08x ", fw->xmt_data_dma_reg[cnt]); 2658fcf3ce44SJohn Forte } 2659fcf3ce44SJohn Forte 2660fcf3ce44SJohn Forte mdb_printf("\n\nRCV Thread 0 Data DMA Registers"); 2661fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rcvt0_data_dma_reg) / 4; cnt++) { 2662fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2663fcf3ce44SJohn Forte mdb_printf("\n"); 2664fcf3ce44SJohn Forte } 2665fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rcvt0_data_dma_reg[cnt]); 2666fcf3ce44SJohn Forte } 2667fcf3ce44SJohn Forte 2668fcf3ce44SJohn Forte mdb_printf("\n\nRCV Thread 1 Data DMA Registers"); 2669fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->rcvt1_data_dma_reg) / 4; cnt++) { 2670fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2671fcf3ce44SJohn Forte mdb_printf("\n"); 2672fcf3ce44SJohn Forte } 2673fcf3ce44SJohn Forte mdb_printf("%08x ", fw->rcvt1_data_dma_reg[cnt]); 2674fcf3ce44SJohn Forte } 2675fcf3ce44SJohn Forte 2676fcf3ce44SJohn Forte mdb_printf("\n\nRISC GP Registers"); 2677fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->risc_gp_reg) / 4; cnt++) { 2678fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2679fcf3ce44SJohn Forte mdb_printf("\n"); 2680fcf3ce44SJohn Forte } 2681fcf3ce44SJohn Forte mdb_printf("%08x ", fw->risc_gp_reg[cnt]); 2682fcf3ce44SJohn Forte } 2683fcf3ce44SJohn Forte 2684fcf3ce44SJohn Forte mdb_printf("\n\nRISC IO Register\n%08x", fw->risc_io); 2685fcf3ce44SJohn Forte 2686fcf3ce44SJohn Forte mdb_printf("\n\nLMC Registers"); 2687fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->lmc_reg) / 4; cnt++) { 2688fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2689fcf3ce44SJohn Forte mdb_printf("\n"); 2690fcf3ce44SJohn Forte } 2691fcf3ce44SJohn Forte mdb_printf("%08x ", fw->lmc_reg[cnt]); 2692fcf3ce44SJohn Forte } 2693fcf3ce44SJohn Forte 2694fcf3ce44SJohn Forte mdb_printf("\n\nFPM Hardware Registers"); 2695fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fpm_hdw_reg) / 4; cnt++) { 2696fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2697fcf3ce44SJohn Forte mdb_printf("\n"); 2698fcf3ce44SJohn Forte } 2699fcf3ce44SJohn Forte mdb_printf("%08x ", fw->fpm_hdw_reg[cnt]); 2700fcf3ce44SJohn Forte } 2701fcf3ce44SJohn Forte 2702fcf3ce44SJohn Forte mdb_printf("\n\nFB Hardware Registers"); 2703fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->fb_hdw_reg) / 4; cnt++) { 2704fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2705fcf3ce44SJohn Forte mdb_printf("\n"); 2706fcf3ce44SJohn Forte } 2707fcf3ce44SJohn Forte mdb_printf("%08x ", fw->fb_hdw_reg[cnt]); 2708fcf3ce44SJohn Forte } 2709fcf3ce44SJohn Forte 2710fcf3ce44SJohn Forte mdb_printf("\n\nCode RAM"); 2711fcf3ce44SJohn Forte for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) { 2712fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2713fcf3ce44SJohn Forte mdb_printf("\n%08x: ", cnt + 0x20000); 2714fcf3ce44SJohn Forte } 2715fcf3ce44SJohn Forte mdb_printf("%08x ", fw->code_ram[cnt]); 2716fcf3ce44SJohn Forte } 2717fcf3ce44SJohn Forte 2718fcf3ce44SJohn Forte mdb_printf("\n\nExternal Memory"); 2719fcf3ce44SJohn Forte for (cnt = 0; cnt < ha->fw_ext_memory_size / 4; cnt++) { 2720fcf3ce44SJohn Forte if (cnt % 8 == 0) { 2721fcf3ce44SJohn Forte mdb_printf("\n%08x: ", cnt + 0x100000); 2722fcf3ce44SJohn Forte } 2723fcf3ce44SJohn Forte mdb_printf("%08x ", fw->ext_mem[cnt]); 2724fcf3ce44SJohn Forte } 2725fcf3ce44SJohn Forte 2726fcf3ce44SJohn Forte mdb_printf("\n[<==END] ISP Debug Dump"); 2727fcf3ce44SJohn Forte 272816dd44c2SDaniel Beauregard mdb_printf("\n\nRequest Queue"); 2729fcf3ce44SJohn Forte 273016dd44c2SDaniel Beauregard for (cnt = 0; cnt < REQUEST_QUEUE_SIZE / 4; cnt++) { 273116dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 273216dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 273316dd44c2SDaniel Beauregard } 273416dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->req_q[cnt]); 273516dd44c2SDaniel Beauregard } 273616dd44c2SDaniel Beauregard 273716dd44c2SDaniel Beauregard mdb_printf("\n\nResponse Queue"); 273816dd44c2SDaniel Beauregard 273916dd44c2SDaniel Beauregard for (cnt = 0; cnt < RESPONSE_QUEUE_SIZE / 4; cnt++) { 274016dd44c2SDaniel Beauregard if (cnt % 8 == 0) { 274116dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", cnt); 274216dd44c2SDaniel Beauregard } 274316dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->rsp_q[cnt]); 274416dd44c2SDaniel Beauregard } 274516dd44c2SDaniel Beauregard 274616dd44c2SDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWEXTTRACE) && 274716dd44c2SDaniel Beauregard (ha->fwexttracebuf.bp != NULL)) { 274816dd44c2SDaniel Beauregard uint32_t cnt_b = 0; 274916dd44c2SDaniel Beauregard uint32_t *w32 = ha->fwexttracebuf.bp; 275016dd44c2SDaniel Beauregard 275116dd44c2SDaniel Beauregard mdb_printf("\n\nExtended Trace Buffer Memory"); 275216dd44c2SDaniel Beauregard /* show data address as a byte address, data as long words */ 275316dd44c2SDaniel Beauregard for (cnt = 0; cnt < FWEXTSIZE / 4; cnt++) { 275416dd44c2SDaniel Beauregard cnt_b = cnt * 4; 275516dd44c2SDaniel Beauregard if (cnt_b % 32 == 0) { 275616dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 275716dd44c2SDaniel Beauregard } 275816dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->ext_trace_buf[cnt]); 275916dd44c2SDaniel Beauregard } 276016dd44c2SDaniel Beauregard } 276116dd44c2SDaniel Beauregard 276216dd44c2SDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWFCETRACE) && 276316dd44c2SDaniel Beauregard (ha->fwfcetracebuf.bp != NULL)) { 276416dd44c2SDaniel Beauregard uint32_t cnt_b = 0; 276516dd44c2SDaniel Beauregard uint32_t *w32 = ha->fwfcetracebuf.bp; 276616dd44c2SDaniel Beauregard 276716dd44c2SDaniel Beauregard mdb_printf("\n\nFC Event Trace Buffer Memory"); 276816dd44c2SDaniel Beauregard /* show data address as a byte address, data as long words */ 276916dd44c2SDaniel Beauregard for (cnt = 0; cnt < FWFCESIZE / 4; cnt++) { 277016dd44c2SDaniel Beauregard cnt_b = cnt * 4; 277116dd44c2SDaniel Beauregard if (cnt_b % 32 == 0) { 277216dd44c2SDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 277316dd44c2SDaniel Beauregard } 277416dd44c2SDaniel Beauregard mdb_printf("%08x ", fw->fce_trace_buf[cnt]); 277516dd44c2SDaniel Beauregard } 277616dd44c2SDaniel Beauregard } 277716dd44c2SDaniel Beauregard 277816dd44c2SDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 277916dd44c2SDaniel Beauregard 278016dd44c2SDaniel Beauregard mdb_printf("\n\nreturn exit\n"); 2781fcf3ce44SJohn Forte 2782fcf3ce44SJohn Forte return (DCMD_OK); 2783fcf3ce44SJohn Forte } 2784fcf3ce44SJohn Forte 2785fcf3ce44SJohn Forte /* 2786f33c1cdbSDaniel Beauregard * ql_81xx_dump_dcmd 2787f33c1cdbSDaniel Beauregard * prints out a firmware dump buffer 2788f33c1cdbSDaniel Beauregard * 2789f33c1cdbSDaniel Beauregard * Input: 2790f33c1cdbSDaniel Beauregard * addr = User supplied address. (NB: nust be an ha) 2791f33c1cdbSDaniel Beauregard * flags = mdb flags. 2792f33c1cdbSDaniel Beauregard * argc = Number of user supplied args. 2793f33c1cdbSDaniel Beauregard * argv = Arg array. 2794f33c1cdbSDaniel Beauregard * 2795f33c1cdbSDaniel Beauregard * Returns: 2796f33c1cdbSDaniel Beauregard * DCMD_OK or DCMD_ERR 2797f33c1cdbSDaniel Beauregard * 2798f33c1cdbSDaniel Beauregard * Context: 2799f33c1cdbSDaniel Beauregard * User context. 2800f33c1cdbSDaniel Beauregard * 2801f33c1cdbSDaniel Beauregard */ 2802f33c1cdbSDaniel Beauregard /*ARGSUSED*/ 2803f33c1cdbSDaniel Beauregard static int 2804f33c1cdbSDaniel Beauregard ql_81xx_dump_dcmd(ql_adapter_state_t *ha, uint_t flags, int argc, 2805f33c1cdbSDaniel Beauregard const mdb_arg_t *argv) 2806f33c1cdbSDaniel Beauregard { 2807f33c1cdbSDaniel Beauregard ql_81xx_fw_dump_t *fw; 2808f33c1cdbSDaniel Beauregard uint32_t cnt = 0; 2809f33c1cdbSDaniel Beauregard 2810f33c1cdbSDaniel Beauregard fw = (ql_81xx_fw_dump_t *)mdb_alloc(ha->ql_dump_size, UM_SLEEP); 2811f33c1cdbSDaniel Beauregard 2812f33c1cdbSDaniel Beauregard if (mdb_vread(fw, ha->ql_dump_size, 2813f33c1cdbSDaniel Beauregard (uintptr_t)ha->ql_dump_ptr) == -1) { 2814f33c1cdbSDaniel Beauregard mdb_warn("failed to read ql_dump_ptr (no f/w dump active?)"); 2815f33c1cdbSDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 2816f33c1cdbSDaniel Beauregard return (DCMD_OK); 2817f33c1cdbSDaniel Beauregard } 2818f33c1cdbSDaniel Beauregard 2819f33c1cdbSDaniel Beauregard mdb_printf("\nISP FW Version %d.%02d.%02d Attributes %X\n", 2820f33c1cdbSDaniel Beauregard ha->fw_major_version, ha->fw_minor_version, 2821f33c1cdbSDaniel Beauregard ha->fw_subminor_version, ha->fw_attributes); 2822f33c1cdbSDaniel Beauregard 2823f33c1cdbSDaniel Beauregard mdb_printf("\nR2H Register\n%08x\n", fw->r2h_status); 2824f33c1cdbSDaniel Beauregard 2825f33c1cdbSDaniel Beauregard mdb_printf("\n\nHostRisc Registers"); 2826f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->hostrisc_reg) / 4; cnt++) { 2827f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2828f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2829f33c1cdbSDaniel Beauregard } 2830f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->hostrisc_reg[cnt]); 2831f33c1cdbSDaniel Beauregard } 2832f33c1cdbSDaniel Beauregard 2833f33c1cdbSDaniel Beauregard mdb_printf("\n\nPCIe Registers"); 2834f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->pcie_reg) / 4; cnt++) { 2835f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2836f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2837f33c1cdbSDaniel Beauregard } 2838f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->pcie_reg[cnt]); 2839f33c1cdbSDaniel Beauregard } 2840f33c1cdbSDaniel Beauregard 2841f33c1cdbSDaniel Beauregard mdb_printf("\n\nHost Interface Registers"); 2842f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->host_reg) / 4; cnt++) { 2843f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2844f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2845f33c1cdbSDaniel Beauregard } 2846f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->host_reg[cnt]); 2847f33c1cdbSDaniel Beauregard } 2848f33c1cdbSDaniel Beauregard 2849f33c1cdbSDaniel Beauregard mdb_printf("\n\nShadow Registers"); 2850f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->shadow_reg) / 4; cnt++) { 2851f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2852f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2853f33c1cdbSDaniel Beauregard } 2854f33c1cdbSDaniel Beauregard 2855f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->shadow_reg[cnt]); 2856f33c1cdbSDaniel Beauregard } 2857f33c1cdbSDaniel Beauregard 2858f33c1cdbSDaniel Beauregard mdb_printf("\n\nMailbox Registers"); 2859f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->mailbox_reg) / 2; cnt++) { 2860f33c1cdbSDaniel Beauregard if (cnt % 16 == 0) { 2861f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2862f33c1cdbSDaniel Beauregard } 2863f33c1cdbSDaniel Beauregard mdb_printf("%04x ", fw->mailbox_reg[cnt]); 2864f33c1cdbSDaniel Beauregard } 2865f33c1cdbSDaniel Beauregard 2866f33c1cdbSDaniel Beauregard mdb_printf("\n\nXSEQ GP Registers"); 2867f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xseq_gp_reg) / 4; cnt++) { 2868f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2869f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2870f33c1cdbSDaniel Beauregard } 2871f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xseq_gp_reg[cnt]); 2872f33c1cdbSDaniel Beauregard } 2873f33c1cdbSDaniel Beauregard 2874f33c1cdbSDaniel Beauregard mdb_printf("\n\nXSEQ-0 Registers"); 2875f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xseq_0_reg) / 4; cnt++) { 2876f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2877f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2878f33c1cdbSDaniel Beauregard } 2879f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xseq_0_reg[cnt]); 2880f33c1cdbSDaniel Beauregard } 2881f33c1cdbSDaniel Beauregard 2882f33c1cdbSDaniel Beauregard mdb_printf("\n\nXSEQ-1 Registers"); 2883f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xseq_1_reg) / 4; cnt++) { 2884f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2885f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2886f33c1cdbSDaniel Beauregard } 2887f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xseq_1_reg[cnt]); 2888f33c1cdbSDaniel Beauregard } 2889f33c1cdbSDaniel Beauregard 2890f33c1cdbSDaniel Beauregard mdb_printf("\n\nRSEQ GP Registers"); 2891f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rseq_gp_reg) / 4; cnt++) { 2892f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2893f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2894f33c1cdbSDaniel Beauregard } 2895f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rseq_gp_reg[cnt]); 2896f33c1cdbSDaniel Beauregard } 2897f33c1cdbSDaniel Beauregard 2898f33c1cdbSDaniel Beauregard mdb_printf("\n\nRSEQ-0 Registers"); 2899f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rseq_0_reg) / 4; cnt++) { 2900f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2901f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2902f33c1cdbSDaniel Beauregard } 2903f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rseq_0_reg[cnt]); 2904f33c1cdbSDaniel Beauregard } 2905f33c1cdbSDaniel Beauregard 2906f33c1cdbSDaniel Beauregard mdb_printf("\n\nRSEQ-1 Registers"); 2907f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rseq_1_reg) / 4; cnt++) { 2908f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2909f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2910f33c1cdbSDaniel Beauregard } 2911f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rseq_1_reg[cnt]); 2912f33c1cdbSDaniel Beauregard } 2913f33c1cdbSDaniel Beauregard 2914f33c1cdbSDaniel Beauregard mdb_printf("\n\nRSEQ-2 Registers"); 2915f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rseq_2_reg) / 4; cnt++) { 2916f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2917f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2918f33c1cdbSDaniel Beauregard } 2919f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rseq_2_reg[cnt]); 2920f33c1cdbSDaniel Beauregard } 2921f33c1cdbSDaniel Beauregard 2922f33c1cdbSDaniel Beauregard mdb_printf("\n\nASEQ GP Registers"); 2923f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->aseq_gp_reg) / 4; cnt++) { 2924f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2925f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2926f33c1cdbSDaniel Beauregard } 2927f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->aseq_gp_reg[cnt]); 2928f33c1cdbSDaniel Beauregard } 2929f33c1cdbSDaniel Beauregard 2930f33c1cdbSDaniel Beauregard mdb_printf("\n\nASEQ-0 GP Registers"); 2931f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->aseq_0_reg) / 4; cnt++) { 2932f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2933f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2934f33c1cdbSDaniel Beauregard } 2935f33c1cdbSDaniel Beauregard 2936f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->aseq_0_reg[cnt]); 2937f33c1cdbSDaniel Beauregard } 2938f33c1cdbSDaniel Beauregard 2939f33c1cdbSDaniel Beauregard mdb_printf("\n\nASEQ-1 GP Registers"); 2940f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->aseq_1_reg) / 4; cnt++) { 2941f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2942f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2943f33c1cdbSDaniel Beauregard } 2944f33c1cdbSDaniel Beauregard 2945f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->aseq_1_reg[cnt]); 2946f33c1cdbSDaniel Beauregard } 2947f33c1cdbSDaniel Beauregard 2948f33c1cdbSDaniel Beauregard mdb_printf("\n\nASEQ-2 GP Registers"); 2949f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->aseq_2_reg) / 4; cnt++) { 2950f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2951f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2952f33c1cdbSDaniel Beauregard } 2953f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->aseq_2_reg[cnt]); 2954f33c1cdbSDaniel Beauregard } 2955f33c1cdbSDaniel Beauregard 2956f33c1cdbSDaniel Beauregard mdb_printf("\n\nCommand DMA Registers"); 2957f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->cmd_dma_reg) / 4; cnt++) { 2958f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2959f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2960f33c1cdbSDaniel Beauregard } 2961f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->cmd_dma_reg[cnt]); 2962f33c1cdbSDaniel Beauregard } 2963f33c1cdbSDaniel Beauregard 2964f33c1cdbSDaniel Beauregard mdb_printf("\n\nRequest0 Queue DMA Channel Registers"); 2965f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->req0_dma_reg) / 4; cnt++) { 2966f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2967f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2968f33c1cdbSDaniel Beauregard } 2969f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->req0_dma_reg[cnt]); 2970f33c1cdbSDaniel Beauregard } 2971f33c1cdbSDaniel Beauregard 2972f33c1cdbSDaniel Beauregard mdb_printf("\n\nResponse0 Queue DMA Channel Registers"); 2973f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->resp0_dma_reg) / 4; cnt++) { 2974f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2975f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2976f33c1cdbSDaniel Beauregard } 2977f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->resp0_dma_reg[cnt]); 2978f33c1cdbSDaniel Beauregard } 2979f33c1cdbSDaniel Beauregard 2980f33c1cdbSDaniel Beauregard mdb_printf("\n\nRequest1 Queue DMA Channel Registers"); 2981f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->req1_dma_reg) / 4; cnt++) { 2982f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2983f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2984f33c1cdbSDaniel Beauregard } 2985f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->req1_dma_reg[cnt]); 2986f33c1cdbSDaniel Beauregard } 2987f33c1cdbSDaniel Beauregard 2988f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT0 Data DMA Registers"); 2989f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt0_dma_reg) / 4; cnt++) { 2990f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2991f33c1cdbSDaniel Beauregard mdb_printf("\n"); 2992f33c1cdbSDaniel Beauregard } 2993f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt0_dma_reg[cnt]); 2994f33c1cdbSDaniel Beauregard } 2995f33c1cdbSDaniel Beauregard 2996f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT1 Data DMA Registers"); 2997f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt1_dma_reg) / 4; cnt++) { 2998f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 2999f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3000f33c1cdbSDaniel Beauregard } 3001f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt1_dma_reg[cnt]); 3002f33c1cdbSDaniel Beauregard } 3003f33c1cdbSDaniel Beauregard 3004f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT2 Data DMA Registers"); 3005f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt2_dma_reg) / 4; cnt++) { 3006f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3007f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3008f33c1cdbSDaniel Beauregard } 3009f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt2_dma_reg[cnt]); 3010f33c1cdbSDaniel Beauregard } 3011f33c1cdbSDaniel Beauregard 3012f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT3 Data DMA Registers"); 3013f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt3_dma_reg) / 4; cnt++) { 3014f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3015f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3016f33c1cdbSDaniel Beauregard } 3017f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt3_dma_reg[cnt]); 3018f33c1cdbSDaniel Beauregard } 3019f33c1cdbSDaniel Beauregard 3020f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT4 Data DMA Registers"); 3021f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt4_dma_reg) / 4; cnt++) { 3022f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3023f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3024f33c1cdbSDaniel Beauregard } 3025f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt4_dma_reg[cnt]); 3026f33c1cdbSDaniel Beauregard } 3027f33c1cdbSDaniel Beauregard 3028f33c1cdbSDaniel Beauregard mdb_printf("\n\nXMT Data DMA Common Registers"); 3029f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->xmt_data_dma_reg) / 4; cnt++) { 3030f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3031f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3032f33c1cdbSDaniel Beauregard } 3033f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->xmt_data_dma_reg[cnt]); 3034f33c1cdbSDaniel Beauregard } 3035f33c1cdbSDaniel Beauregard 3036f33c1cdbSDaniel Beauregard mdb_printf("\n\nRCV Thread 0 Data DMA Registers"); 3037f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rcvt0_data_dma_reg) / 4; cnt++) { 3038f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3039f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3040f33c1cdbSDaniel Beauregard } 3041f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rcvt0_data_dma_reg[cnt]); 3042f33c1cdbSDaniel Beauregard } 3043f33c1cdbSDaniel Beauregard 3044f33c1cdbSDaniel Beauregard mdb_printf("\n\nRCV Thread 1 Data DMA Registers"); 3045f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->rcvt1_data_dma_reg) / 4; cnt++) { 3046f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3047f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3048f33c1cdbSDaniel Beauregard } 3049f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rcvt1_data_dma_reg[cnt]); 3050f33c1cdbSDaniel Beauregard } 3051f33c1cdbSDaniel Beauregard 3052f33c1cdbSDaniel Beauregard mdb_printf("\n\nRISC GP Registers"); 3053f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->risc_gp_reg) / 4; cnt++) { 3054f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3055f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3056f33c1cdbSDaniel Beauregard } 3057f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->risc_gp_reg[cnt]); 3058f33c1cdbSDaniel Beauregard } 3059f33c1cdbSDaniel Beauregard 3060f33c1cdbSDaniel Beauregard mdb_printf("\n\nRISC IO Register\n%08x", fw->risc_io); 3061f33c1cdbSDaniel Beauregard 3062f33c1cdbSDaniel Beauregard mdb_printf("\n\nLMC Registers"); 3063f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->lmc_reg) / 4; cnt++) { 3064f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3065f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3066f33c1cdbSDaniel Beauregard } 3067f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->lmc_reg[cnt]); 3068f33c1cdbSDaniel Beauregard } 3069f33c1cdbSDaniel Beauregard 3070f33c1cdbSDaniel Beauregard mdb_printf("\n\nFPM Hardware Registers"); 3071f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->fpm_hdw_reg) / 4; cnt++) { 3072f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3073f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3074f33c1cdbSDaniel Beauregard } 3075f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->fpm_hdw_reg[cnt]); 3076f33c1cdbSDaniel Beauregard } 3077f33c1cdbSDaniel Beauregard 3078f33c1cdbSDaniel Beauregard mdb_printf("\n\nFB Hardware Registers"); 3079f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->fb_hdw_reg) / 4; cnt++) { 3080f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3081f33c1cdbSDaniel Beauregard mdb_printf("\n"); 3082f33c1cdbSDaniel Beauregard } 3083f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->fb_hdw_reg[cnt]); 3084f33c1cdbSDaniel Beauregard } 3085f33c1cdbSDaniel Beauregard 3086f33c1cdbSDaniel Beauregard mdb_printf("\n\nCode RAM"); 3087f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < sizeof (fw->code_ram) / 4; cnt++) { 3088f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3089f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", cnt + 0x20000); 3090f33c1cdbSDaniel Beauregard } 3091f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->code_ram[cnt]); 3092f33c1cdbSDaniel Beauregard } 3093f33c1cdbSDaniel Beauregard 3094f33c1cdbSDaniel Beauregard mdb_printf("\n\nExternal Memory"); 3095f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < ha->fw_ext_memory_size / 4; cnt++) { 3096f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3097f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", cnt + 0x100000); 3098f33c1cdbSDaniel Beauregard } 3099f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->ext_mem[cnt]); 3100f33c1cdbSDaniel Beauregard } 3101f33c1cdbSDaniel Beauregard 3102f33c1cdbSDaniel Beauregard mdb_printf("\n[<==END] ISP Debug Dump"); 3103f33c1cdbSDaniel Beauregard 3104f33c1cdbSDaniel Beauregard mdb_printf("\n\nRequest Queue"); 3105f33c1cdbSDaniel Beauregard 3106f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < REQUEST_QUEUE_SIZE / 4; cnt++) { 3107f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3108f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", cnt); 3109f33c1cdbSDaniel Beauregard } 3110f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->req_q[cnt]); 3111f33c1cdbSDaniel Beauregard } 3112f33c1cdbSDaniel Beauregard 3113f33c1cdbSDaniel Beauregard mdb_printf("\n\nResponse Queue"); 3114f33c1cdbSDaniel Beauregard 3115f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < RESPONSE_QUEUE_SIZE / 4; cnt++) { 3116f33c1cdbSDaniel Beauregard if (cnt % 8 == 0) { 3117f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", cnt); 3118f33c1cdbSDaniel Beauregard } 3119f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->rsp_q[cnt]); 3120f33c1cdbSDaniel Beauregard } 3121f33c1cdbSDaniel Beauregard 3122f33c1cdbSDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWEXTTRACE) && 3123f33c1cdbSDaniel Beauregard (ha->fwexttracebuf.bp != NULL)) { 3124f33c1cdbSDaniel Beauregard uint32_t cnt_b = 0; 3125f33c1cdbSDaniel Beauregard uint32_t *w32 = ha->fwexttracebuf.bp; 3126f33c1cdbSDaniel Beauregard 3127f33c1cdbSDaniel Beauregard mdb_printf("\n\nExtended Trace Buffer Memory"); 3128f33c1cdbSDaniel Beauregard /* show data address as a byte address, data as long words */ 3129f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < FWEXTSIZE / 4; cnt++) { 3130f33c1cdbSDaniel Beauregard cnt_b = cnt * 4; 3131f33c1cdbSDaniel Beauregard if (cnt_b % 32 == 0) { 3132f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 3133f33c1cdbSDaniel Beauregard } 3134f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->ext_trace_buf[cnt]); 3135f33c1cdbSDaniel Beauregard } 3136f33c1cdbSDaniel Beauregard } 3137f33c1cdbSDaniel Beauregard 3138f33c1cdbSDaniel Beauregard if ((ha->cfg_flags & CFG_ENABLE_FWFCETRACE) && 3139f33c1cdbSDaniel Beauregard (ha->fwfcetracebuf.bp != NULL)) { 3140f33c1cdbSDaniel Beauregard uint32_t cnt_b = 0; 3141f33c1cdbSDaniel Beauregard uint32_t *w32 = ha->fwfcetracebuf.bp; 3142f33c1cdbSDaniel Beauregard 3143f33c1cdbSDaniel Beauregard mdb_printf("\n\nFC Event Trace Buffer Memory"); 3144f33c1cdbSDaniel Beauregard /* show data address as a byte address, data as long words */ 3145f33c1cdbSDaniel Beauregard for (cnt = 0; cnt < FWFCESIZE / 4; cnt++) { 3146f33c1cdbSDaniel Beauregard cnt_b = cnt * 4; 3147f33c1cdbSDaniel Beauregard if (cnt_b % 32 == 0) { 3148f33c1cdbSDaniel Beauregard mdb_printf("\n%08x: ", w32 + cnt_b); 3149f33c1cdbSDaniel Beauregard } 3150f33c1cdbSDaniel Beauregard mdb_printf("%08x ", fw->fce_trace_buf[cnt]); 3151f33c1cdbSDaniel Beauregard } 3152f33c1cdbSDaniel Beauregard } 3153f33c1cdbSDaniel Beauregard 3154f33c1cdbSDaniel Beauregard mdb_free(fw, ha->ql_dump_size); 3155f33c1cdbSDaniel Beauregard 3156f33c1cdbSDaniel Beauregard mdb_printf("\n\nreturn exit\n"); 3157f33c1cdbSDaniel Beauregard 3158f33c1cdbSDaniel Beauregard return (DCMD_OK); 3159f33c1cdbSDaniel Beauregard } 3160f33c1cdbSDaniel Beauregard 3161f33c1cdbSDaniel Beauregard /* 316216dd44c2SDaniel Beauregard * ql_gettrace_dcmd 316316dd44c2SDaniel Beauregard * prints out the Extended Logging trace buffer 316416dd44c2SDaniel Beauregard * 316516dd44c2SDaniel Beauregard * Input: 316616dd44c2SDaniel Beauregard * addr = User supplied address. (NB: must be an ha) 316716dd44c2SDaniel Beauregard * flags = mdb flags. 316816dd44c2SDaniel Beauregard * argc = Number of user supplied args. 316916dd44c2SDaniel Beauregard * argv = Arg array. 317016dd44c2SDaniel Beauregard * 317116dd44c2SDaniel Beauregard * Returns: 317216dd44c2SDaniel Beauregard * DCMD_OK or DCMD_ERR 317316dd44c2SDaniel Beauregard * 317416dd44c2SDaniel Beauregard * Context: 317516dd44c2SDaniel Beauregard * User context. 317616dd44c2SDaniel Beauregard * 317716dd44c2SDaniel Beauregard */ 317816dd44c2SDaniel Beauregard static int 317916dd44c2SDaniel Beauregard qlc_gettrace_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 318016dd44c2SDaniel Beauregard { 318116dd44c2SDaniel Beauregard ql_adapter_state_t *ha; 318216dd44c2SDaniel Beauregard int verbose = 0; 318316dd44c2SDaniel Beauregard int wrapped = 0; 318416dd44c2SDaniel Beauregard char *trace_start; 318516dd44c2SDaniel Beauregard char *trace_end; 318616dd44c2SDaniel Beauregard char *dump_start = 0; 318716dd44c2SDaniel Beauregard char *trace_next = 0; 318816dd44c2SDaniel Beauregard char *dump_current = 0; 318916dd44c2SDaniel Beauregard el_trace_desc_t *trace_desc; 319016dd44c2SDaniel Beauregard 319116dd44c2SDaniel Beauregard if ((!(flags & DCMD_ADDRSPEC)) || addr == NULL) { 319216dd44c2SDaniel Beauregard mdb_warn("ql_adapter_state structure addr is required"); 319316dd44c2SDaniel Beauregard return (DCMD_USAGE); 319416dd44c2SDaniel Beauregard } 319516dd44c2SDaniel Beauregard 319616dd44c2SDaniel Beauregard if (mdb_getopts(argc, argv, 'v', MDB_OPT_SETBITS, TRUE, &verbose) != 319716dd44c2SDaniel Beauregard argc) { 319816dd44c2SDaniel Beauregard return (DCMD_USAGE); 319916dd44c2SDaniel Beauregard } 320016dd44c2SDaniel Beauregard 320116dd44c2SDaniel Beauregard /* 320216dd44c2SDaniel Beauregard * Get the adapter state struct which was passed 320316dd44c2SDaniel Beauregard */ 320416dd44c2SDaniel Beauregard if ((ha = (ql_adapter_state_t *)mdb_alloc(sizeof (ql_adapter_state_t), 320516dd44c2SDaniel Beauregard UM_SLEEP)) == NULL) { 320616dd44c2SDaniel Beauregard mdb_warn("failed to allocate memory for ql_adapter_state\n"); 320716dd44c2SDaniel Beauregard return (DCMD_OK); 320816dd44c2SDaniel Beauregard } 320916dd44c2SDaniel Beauregard 321016dd44c2SDaniel Beauregard if (mdb_vread(ha, sizeof (ql_adapter_state_t), addr) == -1) { 321116dd44c2SDaniel Beauregard mdb_warn("failed to read ql_adapter_state at %p", addr); 321216dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 321316dd44c2SDaniel Beauregard return (DCMD_OK); 321416dd44c2SDaniel Beauregard } 321516dd44c2SDaniel Beauregard 321616dd44c2SDaniel Beauregard /* 321716dd44c2SDaniel Beauregard * If its not a valid trace descriptor then bail out 321816dd44c2SDaniel Beauregard */ 321916dd44c2SDaniel Beauregard if (ha->el_trace_desc == NULL) { 322016dd44c2SDaniel Beauregard mdb_warn("trace descriptor does not exist for instance %d\n", 322116dd44c2SDaniel Beauregard ha->instance); 322216dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 322316dd44c2SDaniel Beauregard return (DCMD_OK); 322416dd44c2SDaniel Beauregard } else { 322516dd44c2SDaniel Beauregard trace_desc = (el_trace_desc_t *) 322616dd44c2SDaniel Beauregard mdb_alloc(sizeof (el_trace_desc_t), UM_SLEEP); 322716dd44c2SDaniel Beauregard if (mdb_vread(trace_desc, sizeof (el_trace_desc_t), 322816dd44c2SDaniel Beauregard (uintptr_t)ha->el_trace_desc) == -1) { 322916dd44c2SDaniel Beauregard mdb_warn("failed to read ql_adapter_state at %p", 323016dd44c2SDaniel Beauregard addr); 323116dd44c2SDaniel Beauregard mdb_free(trace_desc, sizeof (el_trace_desc_t)); 323216dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 323316dd44c2SDaniel Beauregard return (DCMD_OK); 323416dd44c2SDaniel Beauregard } 323516dd44c2SDaniel Beauregard if (trace_desc->trace_buffer == NULL) { 323616dd44c2SDaniel Beauregard mdb_warn("trace buffer does not exist for " 323716dd44c2SDaniel Beauregard "instance %d\n", ha->instance); 323816dd44c2SDaniel Beauregard mdb_free(trace_desc, sizeof (el_trace_desc_t)); 323916dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 324016dd44c2SDaniel Beauregard return (DCMD_OK); 324116dd44c2SDaniel Beauregard } 324216dd44c2SDaniel Beauregard } 324316dd44c2SDaniel Beauregard 324416dd44c2SDaniel Beauregard /* Get the trace buffer */ 324516dd44c2SDaniel Beauregard 324616dd44c2SDaniel Beauregard trace_start = (char *) 324716dd44c2SDaniel Beauregard mdb_zalloc(trace_desc->trace_buffer_size, UM_SLEEP); 324816dd44c2SDaniel Beauregard 324916dd44c2SDaniel Beauregard if (mdb_vread(trace_start, trace_desc->trace_buffer_size, 325016dd44c2SDaniel Beauregard (uintptr_t)trace_desc->trace_buffer) == -1) { 325116dd44c2SDaniel Beauregard mdb_warn("failed to read trace buffer?)"); 325216dd44c2SDaniel Beauregard mdb_free(trace_start, trace_desc->trace_buffer_size); 325316dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 325416dd44c2SDaniel Beauregard return (DCMD_OK); 325516dd44c2SDaniel Beauregard } 325616dd44c2SDaniel Beauregard 325716dd44c2SDaniel Beauregard /* set the end of the trace buffer. */ 325816dd44c2SDaniel Beauregard trace_end = trace_start + trace_desc->trace_buffer_size; 325916dd44c2SDaniel Beauregard 326016dd44c2SDaniel Beauregard /* Find the start point of trace. */ 326116dd44c2SDaniel Beauregard trace_next = trace_start + trace_desc->next; 326216dd44c2SDaniel Beauregard 326316dd44c2SDaniel Beauregard /* 326416dd44c2SDaniel Beauregard * If the buffer has not wrapped next will point at a null so 326516dd44c2SDaniel Beauregard * start is the begining of the buffer. If next points at a char 326616dd44c2SDaniel Beauregard * then we must traverse the buffer further until a null is detected. 326716dd44c2SDaniel Beauregard * The location after the null will be the beginning of the oldest 326816dd44c2SDaniel Beauregard * whole object in the buffer, which we use as the start. 326916dd44c2SDaniel Beauregard */ 327016dd44c2SDaniel Beauregard 327116dd44c2SDaniel Beauregard if ((trace_next + EL_BUFFER_RESERVE) >= trace_end) { 327216dd44c2SDaniel Beauregard dump_start = trace_start; 327316dd44c2SDaniel Beauregard } else if (*trace_next != NULL) { 327416dd44c2SDaniel Beauregard dump_start = trace_next + (strlen(trace_next) + 1); 327516dd44c2SDaniel Beauregard } else { 327616dd44c2SDaniel Beauregard dump_start = trace_start; 327716dd44c2SDaniel Beauregard } 327816dd44c2SDaniel Beauregard 327916dd44c2SDaniel Beauregard dump_current = dump_start; 328016dd44c2SDaniel Beauregard 328116dd44c2SDaniel Beauregard mdb_printf("\nExtended Logging trace buffer @%x, start @%x, " 328216dd44c2SDaniel Beauregard "size=%d\n\n", trace_start, dump_current, 328316dd44c2SDaniel Beauregard trace_desc->trace_buffer_size); 328416dd44c2SDaniel Beauregard 328516dd44c2SDaniel Beauregard /* Don't run off the end, no matter what. */ 328616dd44c2SDaniel Beauregard while (((uintptr_t)dump_current - (uintptr_t)trace_start) <= 328716dd44c2SDaniel Beauregard (uintptr_t)trace_desc->trace_buffer_size) { 328816dd44c2SDaniel Beauregard /* Show it... */ 328916dd44c2SDaniel Beauregard mdb_printf("%s", dump_current); 329016dd44c2SDaniel Beauregard /* Calculate the next and make it the current */ 329116dd44c2SDaniel Beauregard dump_current += (strlen(dump_current) + 1); 329216dd44c2SDaniel Beauregard /* check for wrap */ 329316dd44c2SDaniel Beauregard if ((dump_current + EL_BUFFER_RESERVE) >= trace_end) { 329416dd44c2SDaniel Beauregard mdb_printf("Wraping %x\n", dump_current); 329516dd44c2SDaniel Beauregard dump_current = trace_start; 329616dd44c2SDaniel Beauregard wrapped = 1; 329716dd44c2SDaniel Beauregard } else if (wrapped) { 329816dd44c2SDaniel Beauregard /* Don't go past next. */ 329916dd44c2SDaniel Beauregard if ((trace_start + trace_desc->next) <= dump_current) { 330016dd44c2SDaniel Beauregard mdb_printf("Done %x", dump_current); 330116dd44c2SDaniel Beauregard break; 330216dd44c2SDaniel Beauregard } 330316dd44c2SDaniel Beauregard } else if (*dump_current == NULL) { 330416dd44c2SDaniel Beauregard mdb_printf("Done %x(null)", dump_current); 330516dd44c2SDaniel Beauregard break; 330616dd44c2SDaniel Beauregard } 330716dd44c2SDaniel Beauregard } 330816dd44c2SDaniel Beauregard 330916dd44c2SDaniel Beauregard mdb_free(ha, sizeof (ql_adapter_state_t)); 331016dd44c2SDaniel Beauregard mdb_free(trace_start, trace_desc->trace_buffer_size); 331116dd44c2SDaniel Beauregard mdb_free(trace_desc, sizeof (el_trace_desc_t)); 331216dd44c2SDaniel Beauregard 331316dd44c2SDaniel Beauregard return (DCMD_OK); 331416dd44c2SDaniel Beauregard } 331516dd44c2SDaniel Beauregard /* 3316fcf3ce44SJohn Forte * ql_doprint 3317fcf3ce44SJohn Forte * ql generic function to call the print dcmd 3318fcf3ce44SJohn Forte * 3319fcf3ce44SJohn Forte * Input: 3320fcf3ce44SJohn Forte * addr - address to struct 3321fcf3ce44SJohn Forte * prtsting - address to string 3322fcf3ce44SJohn Forte * 3323fcf3ce44SJohn Forte * Returns: 3324fcf3ce44SJohn Forte * WALK_DONE 3325fcf3ce44SJohn Forte * 3326fcf3ce44SJohn Forte * Context: 3327fcf3ce44SJohn Forte * User context. 3328fcf3ce44SJohn Forte * 3329fcf3ce44SJohn Forte */ 3330fcf3ce44SJohn Forte static int32_t 3331fcf3ce44SJohn Forte ql_doprint(uintptr_t addr, int8_t *prtstring) 3332fcf3ce44SJohn Forte { 3333fcf3ce44SJohn Forte struct mdb_arg printarg; 3334fcf3ce44SJohn Forte 3335fcf3ce44SJohn Forte printarg.a_un.a_str = (int8_t *)(mdb_zalloc(strlen(prtstring), 3336fcf3ce44SJohn Forte UM_SLEEP)); 3337fcf3ce44SJohn Forte printarg.a_type = MDB_TYPE_STRING; 3338fcf3ce44SJohn Forte (void) strcpy((int8_t *)(printarg.a_un.a_str), prtstring); 3339fcf3ce44SJohn Forte 3340fcf3ce44SJohn Forte if ((mdb_call_dcmd("print", addr, DCMD_ADDRSPEC, 1, 3341fcf3ce44SJohn Forte &printarg)) == -1) { 3342fcf3ce44SJohn Forte mdb_warn("ql_doprint: failed print dcmd: %s" 3343fcf3ce44SJohn Forte "at addr: %llxh", prtstring, addr); 3344fcf3ce44SJohn Forte } 3345fcf3ce44SJohn Forte 3346fcf3ce44SJohn Forte mdb_free((void *)(printarg.a_un.a_str), strlen(prtstring)); 3347fcf3ce44SJohn Forte return (WALK_DONE); 3348fcf3ce44SJohn Forte } 3349fcf3ce44SJohn Forte 3350fcf3ce44SJohn Forte /* 3351fcf3ce44SJohn Forte * ql_dump_flags 3352fcf3ce44SJohn Forte * mdb utility to print the flag string 3353fcf3ce44SJohn Forte * 3354fcf3ce44SJohn Forte * Input: 3355fcf3ce44SJohn Forte * flags - flags to print 3356fcf3ce44SJohn Forte * strings - text to print when flag is set 3357fcf3ce44SJohn Forte * 3358fcf3ce44SJohn Forte * Returns: 3359fcf3ce44SJohn Forte * 3360fcf3ce44SJohn Forte * 3361fcf3ce44SJohn Forte * Context: 3362fcf3ce44SJohn Forte * User context. 3363fcf3ce44SJohn Forte * 3364fcf3ce44SJohn Forte */ 3365fcf3ce44SJohn Forte static void 3366fcf3ce44SJohn Forte ql_dump_flags(uint64_t flags, int8_t **strings) 3367fcf3ce44SJohn Forte { 3368fcf3ce44SJohn Forte int i, linel, first = 1; 3369fcf3ce44SJohn Forte uint64_t mask = 1; 3370fcf3ce44SJohn Forte 3371fcf3ce44SJohn Forte linel = 8; 3372fcf3ce44SJohn Forte mdb_printf("\t"); 3373fcf3ce44SJohn Forte for (i = 0; i < 64; i++) { 3374fcf3ce44SJohn Forte if (strings[i] == NULL) 3375fcf3ce44SJohn Forte break; 3376fcf3ce44SJohn Forte if (flags & mask) { 3377fcf3ce44SJohn Forte if (!first) { 3378fcf3ce44SJohn Forte mdb_printf(" | "); 3379fcf3ce44SJohn Forte } else { 3380fcf3ce44SJohn Forte first = 0; 3381fcf3ce44SJohn Forte } 3382fcf3ce44SJohn Forte linel += (int32_t)strlen(strings[i]) + 3; 3383fcf3ce44SJohn Forte if (linel > 80) { 3384fcf3ce44SJohn Forte mdb_printf("\n\t"); 3385fcf3ce44SJohn Forte linel = (int32_t)strlen(strings[i]) + 1 + 8; 3386fcf3ce44SJohn Forte } 3387fcf3ce44SJohn Forte mdb_printf("%s", strings[i]); 3388fcf3ce44SJohn Forte } 3389fcf3ce44SJohn Forte mask <<= 1; 3390fcf3ce44SJohn Forte } 3391fcf3ce44SJohn Forte mdb_printf("\n"); 3392fcf3ce44SJohn Forte } 3393fcf3ce44SJohn Forte 3394fcf3ce44SJohn Forte /* 3395fcf3ce44SJohn Forte * MDB module linkage information 3396fcf3ce44SJohn Forte * 3397fcf3ce44SJohn Forte * 3398fcf3ce44SJohn Forte * dcmd structures for the _mdb_init function 3399fcf3ce44SJohn Forte */ 3400fcf3ce44SJohn Forte static const mdb_dcmd_t dcmds[] = { 3401fcf3ce44SJohn Forte { "qlclinks", NULL, "Prints qlc link information", qlclinks_dcmd }, 3402fcf3ce44SJohn Forte { "qlcosc", NULL, "Prints outstanding cmd info", qlc_osc_dcmd }, 3403fcf3ce44SJohn Forte { "qlcver", NULL, "Prints driver/mdb version", qlcver_dcmd }, 3404fcf3ce44SJohn Forte { "qlc_elog", "[on|off] [<inst #>|all]", "Turns qlc extended logging " 3405fcf3ce44SJohn Forte "on / off", qlc_el_dcmd }, 3406fcf3ce44SJohn Forte { "qlcstate", ":[-v]", "Prints qlc adapter state information", 3407fcf3ce44SJohn Forte qlcstate_dcmd }, 3408fcf3ce44SJohn Forte { "qlctgtq", NULL, "Prints qlc target queues", qltgtq_dcmd }, 3409fcf3ce44SJohn Forte { "qlcwdog", NULL, "Prints out watchdog linked list", qlc_wdog_dcmd}, 341016dd44c2SDaniel Beauregard { "qlcgetdump", ":[-v]", "Retrieves the ASCII f/w dump", 341116dd44c2SDaniel Beauregard qlc_getdump_dcmd }, 341216dd44c2SDaniel Beauregard { "qlcgettrace", ":[-v]", "Retrieves the ASCII Extended Logging trace", 341316dd44c2SDaniel Beauregard qlc_gettrace_dcmd }, 3414fcf3ce44SJohn Forte { NULL } 3415fcf3ce44SJohn Forte }; 3416fcf3ce44SJohn Forte 3417fcf3ce44SJohn Forte /* 3418fcf3ce44SJohn Forte * walker structures for the _mdb_init function 3419fcf3ce44SJohn Forte */ 3420fcf3ce44SJohn Forte static const mdb_walker_t walkers[] = { 3421fcf3ce44SJohn Forte { "qlcstates", "walk list of qlc ql_state_t structures", 3422fcf3ce44SJohn Forte qlstates_walk_init, qlstates_walk_step, qlstates_walk_fini }, 3423fcf3ce44SJohn Forte { "qlcsrbs", "walk list of qlc ql_srb_t strctures", 3424fcf3ce44SJohn Forte qlsrb_walk_init, qlsrb_walk_step, qlsrb_walk_fini }, 3425fcf3ce44SJohn Forte { "qlclunq", "walk list of qlc ql_lun_t strctures", 3426fcf3ce44SJohn Forte qllunq_walk_init, qllunq_walk_step, qllunq_walk_fini }, 3427fcf3ce44SJohn Forte { NULL } 3428fcf3ce44SJohn Forte }; 3429fcf3ce44SJohn Forte 3430fcf3ce44SJohn Forte static const mdb_modinfo_t ql_mdb_modinfo = { 3431fcf3ce44SJohn Forte MDB_API_VERSION, dcmds, walkers 3432fcf3ce44SJohn Forte }; 3433fcf3ce44SJohn Forte 3434fcf3ce44SJohn Forte /* 3435fcf3ce44SJohn Forte * Registration function which lists the dcmds and walker structures 3436fcf3ce44SJohn Forte */ 3437fcf3ce44SJohn Forte const mdb_modinfo_t * 3438fcf3ce44SJohn Forte _mdb_init(void) 3439fcf3ce44SJohn Forte { 3440fcf3ce44SJohn Forte return (&ql_mdb_modinfo); 3441fcf3ce44SJohn Forte } 3442