pmcs.c revision c3bc407cfbd238a18e4728ad5f36f39cecdb062f
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The contents of this file are subject to the terms of the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Common Development and Distribution License (the "License").
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You may not use this file except in compliance with the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * or http://www.opensolaris.org/os/licensing.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * When distributing Covered Code, include this CDDL HEADER in each
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If applicable, add the following below this CDDL HEADER, with the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * fields enclosed by brackets "[]" replaced with your own identifying
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * information: Portions Copyright [yyyy] [name of copyright owner]
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER END
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <limits.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mdb_modapi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/sysinfo.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/byteorder.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/scsi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/scsi/adapters/pmcs/pmcs.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MDB_RD(a, b, c) mdb_vread(a, b, (uintptr_t)c)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define NOREAD(a, b) mdb_warn("could not read " #a " at 0x%p", b)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic pmcs_hw_t ss;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic pmcs_xscsi_t **targets = NULL;
5679c89fcd2facbb4334df8870d3d7a4d2b11673jvstatic int target_idx;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t sas_phys, sata_phys, exp_phys, num_expanders, empty_phys;
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappanstatic pmcs_phy_t *pmcs_next_sibling(pmcs_phy_t *phyp);
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappanstatic void display_one_work(pmcwork_t *wp, int verbose, int idx);
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappanstatic void
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappanprint_sas_address(pmcs_phy_t *phy)
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan{
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan int idx;
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan
4558d122136f151d62acbbc02ddb42df89a5ef66Viswanathan Kannappan for (idx = 0; idx < 8; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%02x", phy->sas_address[idx]);
780c822c86101e82568fa9e357d13965b9f0cf81tim szeto }
780c822c86101e82568fa9e357d13965b9f0cf81tim szeto}
780c822c86101e82568fa9e357d13965b9f0cf81tim szeto
780c822c86101e82568fa9e357d13965b9f0cf81tim szeto/*ARGSUSED*/
780c822c86101e82568fa9e357d13965b9f0cf81tim szetostatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_ic(struct pmcs_hw m, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte int msec_per_tick;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte if (mdb_readvar(&msec_per_tick, "msec_per_tick") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("can't read msec_per_tick");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte msec_per_tick = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Interrupt coalescing timer info\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-------------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (msec_per_tick == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Quantum : ?? ms\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Quantum : %d ms\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.quantum * msec_per_tick);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("Timer enabled : ");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (m.io_intr_coal.timer_on) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("Yes\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Coalescing timer value : %d us\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.intr_coal_timer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("No\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Total nsecs between interrupts: %ld\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.nsecs_between_intrs);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Time of last I/O interrupt : %ld\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.last_io_comp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Number of I/O interrupts : %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.num_intrs);
91159e90831fc9243576f2ec1a483b3bb462bcf4John Forte mdb_printf("Number of I/O completions : %d\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto m.io_intr_coal.num_io_completions);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Max I/O completion interrupts : %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.max_io_completions);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Measured ECHO int latency : %d ns\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto m.io_intr_coal.intr_latency);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Interrupt threshold : %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte m.io_intr_coal.intr_threshold);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_iport_phy_walk_cb(uintptr_t addr, const void *wdata, void *priv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct pmcs_phy phy;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&phy, sizeof (struct pmcs_phy), addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (struct pmcs_phy)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("%16p %2d\n", addr, phy.phynum);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (0);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*ARGSUSED*/
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortepmcs_iport_walk_cb(uintptr_t addr, const void *wdata, void *priv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct pmcs_iport iport;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uintptr_t list_addr;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *ua_state;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char portid[4];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char unit_address[34];
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&iport, sizeof (struct pmcs_iport), addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct pmcs_iport)) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto return (DCMD_ERR);
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (mdb_readstr(unit_address, sizeof (unit_address),
427fcaf873956aad428be801380a44e59d38b8b5tim szeto (uintptr_t)(iport.ua)) == -1) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto strncpy(unit_address, "Unset", sizeof (unit_address));
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (iport.portid == 0xffff) {
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto mdb_snprintf(portid, sizeof (portid), "%s", "-");
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto } else {
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto mdb_snprintf(portid, sizeof (portid), "%d", iport.portid);
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto }
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto switch (iport.ua_state) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto case UA_INACTIVE:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ua_state = "Inactive";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto break;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto case UA_PEND_ACTIVATE:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ua_state = "PendActivate";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto break;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto case UA_ACTIVE:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ua_state = "Active";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto break;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto case UA_PEND_DEACTIVATE:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ua_state = "PendDeactivate";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto break;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto default:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ua_state = "Unknown";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (strlen(unit_address) < 3) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Standard iport unit address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("UA %-16s %16s %8s %8s %16s", "Iport", "UA State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "PortID", "NumPhys", "DIP\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%2s %16p %16s %8s %8d %16p\n", unit_address, addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ua_state, portid, iport.nphy, iport.dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Temporary iport unit address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-32s %16s %20s %8s %8s %16s", "UA", "Iport",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "UA State", "PortID", "NumPhys", "DIP\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%32s %16p %20s %8s %8d %16p\n", unit_address, addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ua_state, portid, iport.nphy, iport.dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iport.nphy > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-18s %8s", "Phy", "PhyNum\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(addr + offsetof(struct pmcs_iport, phys));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("list", pmcs_iport_phy_walk_cb, NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pmcs iport walk failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(6);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED*/
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_iport(struct pmcs_hw m, uintptr_t addr, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t list_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (m.iports_attached) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Iport information:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("-----------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("No Iports found.\n\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_addr = (uintptr_t)(addr + offsetof(struct pmcs_hw, iports));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("list", pmcs_iport_walk_cb, NULL, list_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pmcs iport walk failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_utarget_walk_cb(uintptr_t addr, const void *wdata, void *priv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_phy_t phy;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&phy, sizeof (pmcs_phy_t), (uintptr_t)addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pmcs_utarget_walk_cb: Failed to read PHY at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void *)addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.configured && (phy.target == NULL)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SAS address: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_sas_address(&phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" DType: ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (phy.dtype) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4s", "SAS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4s", "SATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXPANDER:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4s", "SMP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4s", "N/A");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" Path: %s\n", phy.path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_unconfigured_targets(uintptr_t addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Unconfigured target SAS address:\n\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("pmcs_phys", pmcs_utarget_walk_cb, NULL, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pmcs phys walk failed");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szetostatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_completion_queue(struct pmcs_hw ss)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_iocomp_cb_t ccb, *ccbp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcwork_t work;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ss.iocomp_cb_head == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Completion queue is empty.\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ccbp = ss.iocomp_cb_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%8s %10s %20s %8s %8s O D\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "HTag", "State", "Phy Path", "Target", "Timer");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (ccbp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ccb, sizeof (pmcs_iocomp_cb_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ccbp) != sizeof (pmcs_iocomp_cb_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read completion queue entry\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&work, sizeof (pmcwork_t), (uintptr_t)ccb.pwrk)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != sizeof (pmcwork_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read work structure\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Only print the work structure if it's still active. If
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * it's not, it's been completed since we started looking at
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * it.
427fcaf873956aad428be801380a44e59d38b8b5tim szeto */
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (work.state != PMCS_WORK_STATE_NIL) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto display_one_work(&work, 0, 0);
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto ccbp = ccb.next;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto}
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto/*ARGSUSED*/
427fcaf873956aad428be801380a44e59d38b8b5tim szetostatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_hwinfo(struct pmcs_hw m, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct pmcs_hw *mp = &m;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *fwsupport;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (PMCS_FW_TYPE(mp)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_FW_TYPE_RELEASED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fwsupport = "Released";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_FW_TYPE_DEVELOPMENT:
427fcaf873956aad428be801380a44e59d38b8b5tim szeto fwsupport = "Development";
427fcaf873956aad428be801380a44e59d38b8b5tim szeto break;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto case PMCS_FW_TYPE_ALPHA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fwsupport = "Alpha";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_FW_TYPE_BETA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fwsupport = "Beta";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fwsupport = "Special";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nHardware information:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Chip revision: %c\n", 'A' + m.chiprev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SAS WWID: %"PRIx64"\n", m.sas_wwns[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Firmware version: %x.%x.%x (%s)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PMCS_FW_MAJOR(mp), PMCS_FW_MINOR(mp), PMCS_FW_MICRO(mp),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fwsupport);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Number of PHYs: %d\n", m.nphy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Maximum commands: %d\n", m.max_cmd);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Maximum devices: %d\n", m.max_dev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("I/O queue depth: %d\n", m.ioq_depth);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (m.fwlog == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Firmware logging: Disabled\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Firmware logging: Enabled (%d)\n", m.fwlog);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
427fcaf873956aad428be801380a44e59d38b8b5tim szetodisplay_targets(struct pmcs_hw m, int verbose, int totals_only)
427fcaf873956aad428be801380a44e59d38b8b5tim szeto{
427fcaf873956aad428be801380a44e59d38b8b5tim szeto char *dtype;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto pmcs_xscsi_t xs;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto pmcs_phy_t phy;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto uint16_t max_dev, idx;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto uint32_t sas_targets = 0, smp_targets = 0, sata_targets = 0;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto max_dev = m.max_dev;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (targets == NULL) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto targets = mdb_alloc(sizeof (targets) * max_dev, UM_SLEEP);
427fcaf873956aad428be801380a44e59d38b8b5tim szeto }
427fcaf873956aad428be801380a44e59d38b8b5tim szeto
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (MDB_RD(targets, sizeof (targets) * max_dev, m.targets) == -1) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto NOREAD(targets, m.targets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nTarget information:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("VTGT %-16s %-16s %-5s %8s %s", "SAS Address",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "PHY Address", "DType", "Active", "DS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (idx = 0; idx < max_dev; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targets[idx] == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&xs, sizeof (xs), targets[idx]) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_xscsi_t, targets[idx]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * It has to be new or assigned to be of interest.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.new == 0 && xs.assigned == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (xs.dtype) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case NOTHING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "None";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "SATA";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sata_targets++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "SAS";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_targets++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXPANDER:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "SMP";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte smp_targets++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.phy) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&phy, sizeof (phy), xs.phy) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_phy_t, xs.phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4d ", idx);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_sas_address(&phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" %16p", xs.phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4d %16s", idx, "<no phy avail>");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" %5s", dtype);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" %8d", xs.actv_cnt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" %2d", xs.dev_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.new) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" new");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.assigned) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" assigned");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.draining) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" draining");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.reset_wait) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" reset_wait");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.resetting) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" resetting");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.recover_wait) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" recover_wait");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.recovering) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" recovering");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.event_recovery) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" event recovery");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.special_running) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" special_active");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (xs.ncq) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" ncq_tagmap=0x%x qdepth=%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xs.tagmap, xs.qdepth);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if (xs.pio) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" pio");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Configured targets:", (sas_targets + sata_targets + smp_targets),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_targets, sata_targets, smp_targets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortework_state_to_string(uint32_t state)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *state_string;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (state) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_NIL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "Free";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_READY:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "Ready";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_ONCHIP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "On Chip";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_INTR:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "In Intr";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_IOCOMPQ:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "I/O Comp";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_ABORTED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "I/O Aborted";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_WORK_STATE_TIMED_OUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "I/O Timed Out";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_string = "INVALID";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (state_string);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_one_work(pmcwork_t *wp, int verbose, int idx)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *state, *last_state;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_xscsi_t xs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_phy_t phy;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int tgt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state = work_state_to_string(wp->state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_state = work_state_to_string(wp->last_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wp->ssp_event && wp->ssp_event != 0xffffffff) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SSP event 0x%x", wp->ssp_event);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tgt = -1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wp->xp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&xs, sizeof (xs), wp->xp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_xscsi_t, wp->xp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tgt = xs.target_num;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wp->phy) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&phy, sizeof (phy), wp->phy) == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto NOREAD(pmcs_phy_t, wp->phy);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto path = phy.path;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte path = "N/A";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4d ", idx);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (tgt == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%08x %10s %20s N/A %8u %1d %1d ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->htag, state, path, wp->timer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->onwire, wp->dead);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%08x %10s %20s %8d %8u %1d %1d ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->htag, state, path, tgt, wp->timer,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->onwire, wp->dead);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%08x %10s 0x%016p 0x%016p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->last_htag, last_state, wp->last_phy, wp->last_xp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_work(struct pmcs_hw m, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t header_printed = B_FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcwork_t work, *wp = &work;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uintptr_t _wp;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\nActive Work structure information:\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("----------------------------------\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto _wp = (uintptr_t)m.work;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (idx = 0; idx < m.max_cmd; idx++, _wp += sizeof (pmcwork_t)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (MDB_RD(&work, sizeof (pmcwork_t), _wp) == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto NOREAD(pmcwork_t, _wp);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (!verbose && (wp->htag == PMCS_TAG_TYPE_FREE)) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (header_printed == B_FALSE) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (verbose) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%4s ", "Idx");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%8s %10s %20s %8s %8s O D ",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "HTag", "State", "Phy Path", "Target", "Timer");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (verbose) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%8s %10s %18s %18s\n", "LastHTAG",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "LastState", "LastPHY", "LastTgt");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto header_printed = B_TRUE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_one_work(wp, verbose, idx);
5679c89fcd2facbb4334df8870d3d7a4d2b11673jv }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_spcmd(pmcs_cmd_t *sp, void *kaddr, int printhdr, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int cdb_size, idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct scsi_pkt pkt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uchar_t cdb[256];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (printhdr) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16s %16s %16s %8s %s CDB\n", "Command",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "SCSA pkt", "DMA Chunks", "HTAG", "SATL Tag");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%16s %16s %16s %8s %s\n", "Command",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto "SCSA pkt", "DMA Chunks", "HTAG", "SATL Tag");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%16p %16p %16p %08x %08x ",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto kaddr, sp->cmd_pkt, sp->cmd_clist, sp->cmd_tag, sp->cmd_satltag);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto /*
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * If we're printing verbose, dump the CDB as well.
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto */
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (verbose) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (sp->cmd_pkt) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (mdb_vread(&pkt, sizeof (struct scsi_pkt),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)sp->cmd_pkt) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct scsi_pkt)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read SCSI pkt\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
5679c89fcd2facbb4334df8870d3d7a4d2b11673jv }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cdb_size = pkt.pkt_cdblen;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&cdb[0], cdb_size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)pkt.pkt_cdbp) != cdb_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read CDB\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (idx = 0; idx < cdb_size; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%02x ", cdb[idx]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("N/A");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED1*/
5679c89fcd2facbb4334df8870d3d7a4d2b11673jvstatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_waitqs(struct pmcs_hw m, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_cmd_t *sp, s;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_xscsi_t xs;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int first, i;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int max_dev = m.max_dev;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = m.dq.stqh_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (sp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nDead Command Queue:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&s, sizeof (s), sp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_cmd_t, sp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_spcmd(&s, sp, first, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = s.cmd_next.stqe_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = m.cq.stqh_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (sp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nCompletion Command Queue:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&s, sizeof (s), sp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_cmd_t, sp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_spcmd(&s, sp, first, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = s.cmd_next.stqe_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targets == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte targets = mdb_alloc(sizeof (targets) * max_dev, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(targets, sizeof (targets) * max_dev, m.targets) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(targets, m.targets);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < max_dev; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (targets[i] == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&xs, sizeof (xs), targets[i]) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_xscsi_t, targets[i]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = xs.wq.stqh_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (sp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nTarget %u Wait Queue:\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xs.target_num);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&s, sizeof (s), sp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_cmd_t, sp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_spcmd(&s, sp, first, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = s.cmd_next.stqe_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = xs.aq.stqh_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (sp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nTarget %u Active Queue:\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xs.target_num);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&s, sizeof (s), sp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_cmd_t, sp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_spcmd(&s, sp, first, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = s.cmd_next.stqe_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = xs.sq.stqh_first;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (sp) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\nTarget %u Special Queue:\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte xs.target_num);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&s, sizeof (s), sp) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_cmd_t, sp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_spcmd(&s, sp, first, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sp = s.cmd_next.stqe_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteibq_type(int qnum)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (qnum < 0 || qnum >= PMCS_NIQ) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (qnum < PMCS_IQ_OTHER) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("I/O");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Other");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteobq_type(int qnum)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (qnum) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_OQ_IODONE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("I/O");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_OQ_GENERAL:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("General");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_OQ_EVENTS:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("Events");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte default:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("UNKNOWN");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic char *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forteiomb_cat(uint32_t cat)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte switch (cat) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_IOMB_CAT_NET:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("NET");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_IOMB_CAT_FC:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("FC");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_IOMB_CAT_SAS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCS_IOMB_CAT_SCSI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SCSI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("???");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteinbound_iomb_opcode(uint32_t opcode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (opcode) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_ECHO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("ECHO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_INFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_VPD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_PHY_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PHY_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_PHY_STOP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PHY_STOP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan case PMCIN_SSP_INI_IO_START:
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan return ("INI_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_INI_TM_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_TM_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_INI_EXT_IO_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EXT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_DEVICE_HANDLE_ACCEPT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_ACCEPT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_TGT_IO_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_TGT_RESPONSE_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_RESPONSE_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_INI_EDC_EXT_IO_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EDC_EXT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_INI_EDC_EXT_IO_START1:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EDC_EXT_IO_START1");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_TGT_EDC_IO_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_EDC_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SSP_ABORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_DEREGISTER_DEVICE_HANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEREGISTER_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_DEVICE_HANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SMP_REQUEST:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_REQUEST");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SMP_RESPONSE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_RESPONSE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SMP_ABORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_ASSISTED_DISCOVERY:
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan return ("ASSISTED_DISCOVERY");
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_REGISTER_DEVICE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("REGISTER_DEVICE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SATA_HOST_IO_START:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_HOST_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SATA_ABORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_LOCAL_PHY_CONTROL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("LOCAL_PHY_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_DEVICE_INFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_TWI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TWI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_FW_FLASH_UPDATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("FW_FLASH_UPDATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SET_VPD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GPIO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SAS_DIAG_MODE_START_END:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_MODE_START_END");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SAS_DIAG_EXECUTE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_EXECUTE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SAW_HW_EVENT_ACK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_HW_EVENT_ACK");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_TIME_STAMP:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_TIME_STAMP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_PORT_CONTROL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PORT_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_NVMD_DATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SET_NVMD_DATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_SET_DEVICE_STATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCIN_GET_DEVICE_STATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteoutbound_iomb_opcode(uint32_t opcode)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (opcode) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_ECHO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("ECHO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GET_INFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GET_VPD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SAS_HW_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_HW_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SSP_COMPLETION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SMP_COMPLETION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_LOCAL_PHY_CONTROL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("LOCAL_PHY_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SAS_ASSISTED_DISCOVERY_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_ASSISTED_DISCOVERY_SENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SATA_ASSISTED_DISCOVERY_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ASSISTED_DISCOVERY_SENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_DEVICE_REGISTRATION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_REGISTRATION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_DEREGISTER_DEVICE_HANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEREGISTER_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GET_DEVICE_HANDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SATA_COMPLETION:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SATA_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SSP_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_DEVICE_HANDLE_ARRIVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_ARRIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SMP_REQUEST_RECEIVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_REQUEST_RECEIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SSP_REQUEST_RECEIVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_REQUEST_RECEIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_DEVICE_INFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_FW_FLASH_UPDATE:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("FW_FLASH_UPDATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SET_VPD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GPIO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GPIO_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GENERAL_EVENT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GENERAL_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_TWI:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TWI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SSP_ABORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SATA_ABORT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SAS_DIAG_MODE_START_END:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_MODE_START_END");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SAS_DIAG_EXECUTE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_EXECUTE");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_GET_TIME_STAMP:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("GET_TIME_STAMP");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_SAS_HW_EVENT_ACK_ACK:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SAS_HW_EVENT_ACK_ACK");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_PORT_CONTROL:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("PORT_CONTROL");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_SKIP_ENTRIES:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SKIP_ENTRIES");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_SMP_ABORT:
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SMP_ABORT");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto break;
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto case PMCOUT_GET_NVMD_DATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SET_NVMD_DATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_DEVICE_HANDLE_REMOVED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_REMOVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SET_DEVICE_STATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_GET_DEVICE_STATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PMCOUT_SET_DEVICE_INFO:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedump_one_qentry_outbound(uint32_t *qentryp, int idx)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int qeidx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t word0 = LE_32(*qentryp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Entry #%02d\n", idx);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Header: 0x%08x (", word0);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (word0 & PMCS_IOMB_VALID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("VALID, ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (word0 & PMCS_IOMB_HIPRI) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("HIPRI, ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("OBID=%d, ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (word0 & PMCS_IOMB_OBID_MASK) >> PMCS_IOMB_OBID_SHIFT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("CAT=%s, ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iomb_cat((word0 & PMCS_IOMB_CAT_MASK) >> PMCS_IOMB_CAT_SHIFT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("OPCODE=%s",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte outbound_iomb_opcode(word0 & PMCS_IOMB_OPCODE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(")\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Remaining Payload:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (qeidx = 1; qeidx < (PMCS_QENTRY_SIZE / 4); qeidx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%08x ", LE_32(*(qentryp + qeidx)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(4);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic void
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_outbound_queues(struct pmcs_hw ss, uint_t verbose)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int idx, qidx;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uintptr_t obqp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t *cip;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t *qentryp = mdb_alloc(PMCS_QENTRY_SIZE, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint32_t last_consumed, oqpi;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Outbound Queues\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (qidx = 0; qidx < PMCS_NOQ; qidx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obqp = (uintptr_t)ss.oqp[qidx];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (obqp == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("No outbound queue ptr for queue #%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte qidx);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Outbound Queue #%d (Queue Type = %s)\n", qidx,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte obq_type(qidx));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Chip is the producer, so read the actual producer index
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and not the driver's version
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cip = (uint32_t *)((void *)ss.cip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&oqpi, 4, cip + OQPI_BASE_OFFSET +
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (qidx * 4)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Couldn't read oqpi\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Producer index: %d Consumer index: %d\n\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte LE_32(oqpi), ss.oqci[qidx]);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (ss.oqci[qidx] == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_consumed = ss.ioq_depth - 1;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_consumed = ss.oqci[qidx] - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (!verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Last processed entry:\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(qentryp, PMCS_QENTRY_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (obqp + (PMCS_QENTRY_SIZE * last_consumed)))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_warn("Couldn't read queue entry at 0x%p\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (obqp + (PMCS_QENTRY_SIZE *
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto last_consumed)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto break;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto dump_one_qentry_outbound(qentryp, last_consumed);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte continue;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (idx = 0; idx < ss.ioq_depth; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(qentryp, PMCS_QENTRY_SIZE,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (obqp + (PMCS_QENTRY_SIZE * idx))) == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_warn("Couldn't read queue entry at 0x%p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (obqp + (PMCS_QENTRY_SIZE * idx)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dump_one_qentry_outbound(qentryp, idx);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_free(qentryp, PMCS_QENTRY_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodump_one_qentry_inbound(uint32_t *qentryp, int idx)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int qeidx;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t word0 = LE_32(*qentryp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Entry #%02d\n", idx);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_inc_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Header: 0x%08x (", word0);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (word0 & PMCS_IOMB_VALID) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("VALID, ");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (word0 & PMCS_IOMB_HIPRI) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("HIPRI, ");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("OBID=%d, ",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (word0 & PMCS_IOMB_OBID_MASK) >> PMCS_IOMB_OBID_SHIFT);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("CAT=%s, ",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto iomb_cat((word0 & PMCS_IOMB_CAT_MASK) >> PMCS_IOMB_CAT_SHIFT));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("OPCODE=%s",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto inbound_iomb_opcode(word0 & PMCS_IOMB_OPCODE_MASK));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf(")\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("HTAG: 0x%08x\n", LE_32(*(qentryp + 1)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Remaining Payload:\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_inc_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (qeidx = 2; qeidx < (PMCS_QENTRY_SIZE / 4); qeidx++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("%08x ", LE_32(*(qentryp + qeidx)));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(4);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto}
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetostatic void
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_inbound_queues(struct pmcs_hw ss, uint_t verbose)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto{
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto int idx, qidx, iqci, last_consumed;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uintptr_t ibqp;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t *qentryp = mdb_alloc(PMCS_QENTRY_SIZE, UM_SLEEP);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t *cip;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Inbound Queues\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("--------------\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_inc_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (qidx = 0; qidx < PMCS_NIQ; qidx++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto ibqp = (uintptr_t)ss.iqp[qidx];
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (ibqp == NULL) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("No inbound queue ptr for queue #%d\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto qidx);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Inbound Queue #%d (Queue Type = %s)\n", qidx,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ibq_type(qidx));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cip = (uint32_t *)((void *)ss.cip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&iqci, 4, cip + (qidx * 4)) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Couldn't read iqci\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iqci = LE_32(iqci);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Producer index: %d Consumer index: %d\n\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss.shadow_iqpi[qidx], iqci);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (iqci == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_consumed = ss.ioq_depth - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_consumed = iqci - 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (!verbose) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Last processed entry:\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (MDB_RD(qentryp, PMCS_QENTRY_SIZE,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (ibqp + (PMCS_QENTRY_SIZE * last_consumed)))
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_warn("Couldn't read queue entry at 0x%p\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (ibqp + (PMCS_QENTRY_SIZE *
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto last_consumed)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto break;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto dump_one_qentry_inbound(qentryp, last_consumed);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(2);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto continue;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (idx = 0; idx < ss.ioq_depth; idx++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto if (MDB_RD(qentryp, PMCS_QENTRY_SIZE,
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (ibqp + (PMCS_QENTRY_SIZE * idx))) == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_warn("Couldn't read queue entry at 0x%p\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (ibqp + (PMCS_QENTRY_SIZE * idx)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto break;
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto dump_one_qentry_inbound(qentryp, idx);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto }
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_dec_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(2);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(qentryp, PMCS_QENTRY_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_phy(struct pmcs_phy phy, int verbose, int totals_only)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *dtype, *speed;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *yes = "Yes";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *no = "No";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *cfgd = no;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *apend = no;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *asent = no;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *dead = no;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *changed = no;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (phy.dtype) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case NOTHING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "None";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SATA:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "SATA";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ++sata_phys;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "SAS";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ++sas_phys;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case EXPANDER:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dtype = "EXP";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ++exp_phys;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.dtype == NOTHING) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte empty_phys++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((phy.dtype == EXPANDER) && phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_expanders++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (phy.link_rate) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS_LINK_RATE_1_5GBIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte speed = "1.5Gb/s";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS_LINK_RATE_3GBIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte speed = "3 Gb/s";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case SAS_LINK_RATE_6GBIT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte speed = "6 Gb/s";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte speed = "N/A";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((phy.dtype != NOTHING) || verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte print_sas_address(&phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.device_id != PMCS_INVALID_DEVICE_ID) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" %3d %4d %6s %4s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phy.device_id, phy.phynum, speed, dtype);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" N/A %4d %6s %4s ",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phy.phynum, speed, dtype);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.abort_sent) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte asent = yes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.abort_pending) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte apend = yes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte cfgd = yes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.dead) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte dead = yes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.changed) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte changed = yes;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-4s %-4s %-4s %-4s %-4s %3d "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "0x%p ", cfgd, apend, asent,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte changed, dead, phy.ref_count, phy.phy_lock);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Path: %s\n", phy.path);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_phys(struct pmcs_hw ss, int verbose, struct pmcs_phy *parent, int level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int totals_only)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_phy_t phy;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_phy_t *pphy = parent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (parent == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pphy = (pmcs_phy_t *)ss.root_phys;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pphy = (pmcs_phy_t *)parent;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (level == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_phys = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sata_phys = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte exp_phys = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte num_expanders = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte empty_phys = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (level == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("PHY information\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("--------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Level %2d\n", level);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("--------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SAS Address Hdl Phy# Speed Type ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Cfgd AbtP AbtS Chgd Dead Ref Lock\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (pphy) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&phy, sizeof (phy), (uintptr_t)pphy) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte NOREAD(pmcs_phy_t, phy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_phy(phy, verbose, totals_only);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy.children) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_phys(ss, verbose, phy.children, level + 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte totals_only);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!totals_only) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pphy = phy.sibling;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_dec_indent(3);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (level == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (verbose) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP) "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(+%d subsidiary + %d empty)\n", "Occupied PHYs:",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sas_phys + sata_phys + num_expanders),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_phys, sata_phys, num_expanders,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (exp_phys - num_expanders), empty_phys);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
5dfbf9be7aa351a2746b8259a906f60caf81fdcfSue Gleeson mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP)\n",
5dfbf9be7aa351a2746b8259a906f60caf81fdcfSue Gleeson "Occupied PHYs:",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sas_phys + sata_phys + num_expanders),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_phys, sata_phys, num_expanders);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * filter is used to indicate whether we are filtering log messages based
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * on "instance". The other filtering (based on options) depends on the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * values that are passed in for "sas_addr" and "phy_path".
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MAX_INST_STRLEN is the largest string size from which we will attempt
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to convert to an instance number. The string will be formed up as
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * "0t<inst>\0" so that mdb_strtoull can parse it properly.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define MAX_INST_STRLEN 8
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_dump_tracelog(boolean_t filter, int instance, const char *phy_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t sas_address)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_tbuf_t *tbuf_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t tbuf_idx;
5679c89fcd2facbb4334df8870d3d7a4d2b11673jv pmcs_tbuf_t tbuf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte boolean_t wrap, elem_filtered;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t start_idx, elems_to_print, idx, tbuf_num_elems;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *bufp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char elem_inst[MAX_INST_STRLEN], ei_idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint64_t sas_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint8_t *sas_addressp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the address of the first element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_addr, "pmcs_tbuf") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("can't read pmcs_tbuf");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the total number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_num_elems, "pmcs_tbuf_num_elems") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("can't read pmcs_tbuf_num_elems");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the current index */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_idx, "pmcs_tbuf_idx") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("can't read pmcs_tbuf_idx");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
640428ae0ffb68033a9bf38dcc271e17d13933cbSue Gleeson }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Indicator as to whether the buffer has wrapped */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&wrap, "pmcs_tbuf_wrap") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("can't read pmcs_tbuf_wrap");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On little-endian systems, the SAS address passed in will be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * byte swapped. Take care of that here.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#if defined(_LITTLE_ENDIAN)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_addr = ((sas_address << 56) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address << 40) & 0xff000000000000ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address << 24) & 0xff0000000000ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address << 8) & 0xff00000000ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address >> 8) & 0xff000000ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address >> 24) & 0xff0000ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ((sas_address >> 40) & 0xff00ULL) |
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (sas_address >> 56));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_addr = sas_address;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#endif
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sas_addressp = (uint8_t *)&sas_addr;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Figure out where we start and stop */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wrap) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte start_idx = tbuf_idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elems_to_print = tbuf_num_elems;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte start_idx = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte elems_to_print = tbuf_idx;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte idx = start_idx;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* Dump the buffer contents */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte while (elems_to_print != 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&tbuf, sizeof (pmcs_tbuf_t), (tbuf_addr + idx))
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(tbuf, (tbuf_addr + idx));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Check for filtering on HBA instance
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_filtered = B_FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (filter) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte bufp = tbuf.buf;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* Skip the driver name */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte while (*bufp < '0' || *bufp > '9') {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte bufp++;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte ei_idx = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_inst[ei_idx++] = '0';
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_inst[ei_idx++] = 't';
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte while (*bufp != ':' && ei_idx < (MAX_INST_STRLEN - 1)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_inst[ei_idx++] = *bufp;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte bufp++;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_inst[ei_idx] = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* Get the instance */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((int)mdb_strtoull(elem_inst) != instance) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_filtered = B_TRUE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!elem_filtered && (phy_path || sas_address)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * This message is not being filtered by HBA instance.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Now check to see if we're filtering based on
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * PHY path or SAS address.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Filtering is an "OR" operation. So, if any of the
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * criteria matches, this message will be printed.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_filtered = B_TRUE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (phy_path != NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (strncmp(phy_path, tbuf.phy_path,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte PMCS_TBUF_UA_MAX_SIZE) == 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_filtered = B_FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (sas_address != 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (memcmp(sas_addressp, tbuf.phy_sas_address,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 8) == 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte elem_filtered = B_FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!elem_filtered) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("%Y.%09ld %s\n", tbuf.timestamp, tbuf.buf);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte --elems_to_print;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (++idx == tbuf_num_elems) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte idx = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte/*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Walkers
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetargets_walk_i(mdb_walk_state_t *wsp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (wsp->walk_addr == NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Can not perform global walk\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Address provided belongs to HBA softstate. Get the targets pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * to begin the walk.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&ss, sizeof (pmcs_hw_t), wsp->walk_addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (pmcs_hw_t)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Unable to read HBA softstate\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (targets == NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte targets = mdb_alloc(sizeof (targets) * ss.max_dev, UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(targets, sizeof (targets) * ss.max_dev, ss.targets) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(targets, ss.targets);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte target_idx = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(targets[0]);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_data = mdb_alloc(sizeof (pmcs_xscsi_t), UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_NEXT);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetargets_walk_s(mdb_walk_state_t *wsp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte int status;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (target_idx == ss.max_dev) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_DONE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(wsp->walk_data, sizeof (pmcs_xscsi_t),
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Failed to read target at %p", (void *)wsp->walk_addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_DONE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_cbdata);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte do {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(targets[++target_idx]);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } while ((wsp->walk_addr == NULL) && (target_idx < ss.max_dev));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (target_idx == ss.max_dev) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_DONE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (status);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic void
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortetargets_walk_f(mdb_walk_state_t *wsp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_free(wsp->walk_data, sizeof (pmcs_xscsi_t));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic pmcs_phy_t *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortepmcs_next_sibling(pmcs_phy_t *phyp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pmcs_phy_t parent;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * First, if this is a root PHY, there are no more siblings
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (phyp->level == 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (NULL);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Otherwise, next sibling is the parent's sibling
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte while (phyp->level > 0) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&parent, sizeof (pmcs_phy_t),
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte (uintptr_t)phyp->parent) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("pmcs_next_sibling: Failed to read PHY at %p",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte (void *)phyp->parent);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (NULL);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (parent.sibling != NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte phyp = phyp->parent;
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte }
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte return (parent.sibling);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortephy_walk_i(mdb_walk_state_t *wsp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (wsp->walk_addr == NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Can not perform global walk\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Address provided belongs to HBA softstate. Get the targets pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * to begin the walk.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&ss, sizeof (pmcs_hw_t), wsp->walk_addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (pmcs_hw_t)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Unable to read HBA softstate\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(ss.root_phys);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_data = mdb_alloc(sizeof (pmcs_phy_t), UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_NEXT);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Fortestatic int
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Fortephy_walk_s(mdb_walk_state_t *wsp)
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte{
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte pmcs_phy_t *phyp, *nphyp;
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte int status;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(wsp->walk_data, sizeof (pmcs_phy_t),
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("phy_walk_s: Failed to read PHY at %p",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte (void *)wsp->walk_addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (WALK_DONE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_cbdata);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte phyp = (pmcs_phy_t *)wsp->walk_data;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (phyp->children) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(phyp->children);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(phyp->sibling);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (wsp->walk_addr == NULL) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * We reached the end of this sibling list. Trudge back up
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * to the parent and find the next sibling after the expander
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * we just finished traversing, if there is one.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte nphyp = pmcs_next_sibling(phyp);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (nphyp == NULL) {
91159e90831fc9243576f2ec1a483b3bb462bcf4John Forte return (WALK_DONE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)nphyp;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (status);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic void
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortephy_walk_f(mdb_walk_state_t *wsp)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_free(wsp->walk_data, sizeof (pmcs_phy_t));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic void
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortedisplay_matching_work(struct pmcs_hw ss, uintmax_t index, uintmax_t snum,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uintmax_t tag_type)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte int idx;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pmcwork_t work, *wp = &work;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uintptr_t _wp;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte boolean_t printed_header = B_FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint32_t mask, mask_val, match_val;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *match_type;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (index != UINT_MAX) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_type = "index";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask = PMCS_TAG_INDEX_MASK;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask_val = index << PMCS_TAG_INDEX_SHIFT;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_val = index;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else if (snum != UINT_MAX) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_type = "serial number";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask = PMCS_TAG_SERNO_MASK;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask_val = snum << PMCS_TAG_SERNO_SHIFT;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_val = snum;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte switch (tag_type) {
91159e90831fc9243576f2ec1a483b3bb462bcf4John Forte case PMCS_TAG_TYPE_NONE:
91159e90831fc9243576f2ec1a483b3bb462bcf4John Forte match_type = "tag type NONE";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_TAG_TYPE_CBACK:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_type = "tag type CBACK";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_TAG_TYPE_WAIT:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_type = "tag type WAIT";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask = PMCS_TAG_TYPE_MASK;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mask_val = tag_type << PMCS_TAG_TYPE_SHIFT;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_val = tag_type;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte _wp = (uintptr_t)ss.work;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte for (idx = 0; idx < ss.max_cmd; idx++, _wp += sizeof (pmcwork_t)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&work, sizeof (pmcwork_t), _wp) == -1) {
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte NOREAD(pmcwork_t, _wp);
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte continue;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((work.htag & mask) != mask_val) {
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte continue;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (printed_header == B_FALSE) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (tag_type) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("\nWork structures matching %s\n\n",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_type, match_val);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else {
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte mdb_printf("\nWork structures matching %s of "
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte "0x%x\n\n", match_type, match_val);
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte }
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte mdb_printf("%8s %10s %20s %8s %8s O D\n",
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte "HTag", "State", "Phy Path", "Target", "Timer");
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte printed_header = B_TRUE;
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte }
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte display_one_work(wp, 0, 0);
437be37266d159c6a27c02e61710a578bef3d15fJohn Forte }
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte if (!printed_header) {
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte mdb_printf("No work structure matches found\n");
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Forte }
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Forte}
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Forte
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Fortestatic int
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Fortepmcs_tag(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Forte{
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Forte struct pmcs_hw ss;
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte uintmax_t tag_type = UINT_MAX;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uintmax_t snum = UINT_MAX;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uintmax_t index = UINT_MAX;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte int args = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte void *pmcs_state;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *state_str;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct dev_info dip;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pmcs_state = NULL;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("can't read pmcs_softc_state");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs_tag", argc,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte argv, (uintptr_t)pmcs_state) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("mdb_pwalk_dcmd failed");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_getopts(argc, argv,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'i', MDB_OPT_UINT64, &index,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 's', MDB_OPT_UINT64, &snum,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 't', MDB_OPT_UINT64, &tag_type) != argc)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Count the number of supplied options and make sure they are
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * within appropriate ranges. If they're set to UINT_MAX, that means
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * they were not supplied, in which case reset them to 0.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (index != UINT_MAX) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte args++;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (index > PMCS_TAG_INDEX_MASK) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Index is out of range\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (tag_type != UINT_MAX) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte args++;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte switch (tag_type) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_TAG_TYPE_NONE:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_TAG_TYPE_CBACK:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case PMCS_TAG_TYPE_WAIT:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte default:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Invalid tag type\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (snum != UINT_MAX) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte args++;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (snum > (PMCS_TAG_SERNO_MASK >> PMCS_TAG_SERNO_SHIFT)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Serial number is out of range\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /*
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Make sure 1 and only 1 option is specified
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((args == 0) || (args > 1)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Exactly one of -i, -s and -t must be specified\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&ss, sizeof (ss), addr) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* processing completed */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (((flags & DCMD_ADDRSPEC) && !(flags & DCMD_LOOP)) ||
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte (flags & DCMD_LOOPFIRST)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((flags & DCMD_LOOP) && !(flags & DCMD_LOOPFIRST))
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("%16s %9s %4s B C WorkFlags wserno DbgMsk %16s\n",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "Address", "State", "Inst", "DIP");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("================================="
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "============================================\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte switch (ss.state) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case STATE_NIL:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str = "Invalid";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case STATE_PROBING:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str = "Probing";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case STATE_RUNNING:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str = "Running";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case STATE_UNPROBING:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str = "Unprobing";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte case STATE_DEAD:
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str = "Dead";
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte break;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("%16p %9s %4d %1d %1d 0x%08x 0x%04x 0x%04x %16p\n", addr,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte state_str, dip.devi_instance, ss.blocked, ss.configuring,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte ss.work_flags, ss.wserno, ss.debug_mask, ss.dip);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_inc_indent(4);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte display_matching_work(ss, index, snum, tag_type);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_dec_indent(4);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic int
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortepmcs_log(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte void *pmcs_state;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct pmcs_hw ss;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct dev_info dip;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte const char *match_phy_path = NULL;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint64_t match_sas_address = 0;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pmcs_state = NULL;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("can't read pmcs_softc_state");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs_log", argc,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte argv, (uintptr_t)pmcs_state) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("mdb_pwalk_dcmd failed for pmcs_log");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_getopts(argc, argv,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'p', MDB_OPT_STR, &match_phy_path,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 's', MDB_OPT_UINT64, &match_sas_address,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NULL) != argc) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&ss, sizeof (ss), addr) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!(flags & DCMD_LOOP)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (pmcs_dump_tracelog(B_TRUE, dip.devi_instance,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_phy_path, match_sas_address));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else if (flags & DCMD_LOOPFIRST) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (pmcs_dump_tracelog(B_FALSE, 0, match_phy_path,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte match_sas_address));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } else {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte}
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
cd36db67f9470c74ed7f5bbd57ec6eeb84f71fcdJohn Fortestatic int
cd36db67f9470c74ed7f5bbd57ec6eeb84f71fcdJohn Fortepmcs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
cd36db67f9470c74ed7f5bbd57ec6eeb84f71fcdJohn Forte{
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct pmcs_hw ss;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t verbose = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t phy_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t hw_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t target_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t work_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t ic_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t iport_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t waitqs_info = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t ibq = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t obq = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t tgt_phy_count = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t compq = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte uint_t unconfigured = FALSE;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte int rv = DCMD_OK;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte void *pmcs_state;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte char *state_str;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte struct dev_info dip;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte pmcs_state = NULL;
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("can't read pmcs_softc_state");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs", argc, argv,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte (uintptr_t)pmcs_state) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("mdb_pwalk_dcmd failed");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_OK);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_getopts(argc, argv,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'c', MDB_OPT_SETBITS, TRUE, &compq,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'h', MDB_OPT_SETBITS, TRUE, &hw_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'i', MDB_OPT_SETBITS, TRUE, &ic_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'I', MDB_OPT_SETBITS, TRUE, &iport_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'p', MDB_OPT_SETBITS, TRUE, &phy_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'q', MDB_OPT_SETBITS, TRUE, &ibq,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'Q', MDB_OPT_SETBITS, TRUE, &obq,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 't', MDB_OPT_SETBITS, TRUE, &target_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'T', MDB_OPT_SETBITS, TRUE, &tgt_phy_count,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'u', MDB_OPT_SETBITS, TRUE, &unconfigured,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'v', MDB_OPT_SETBITS, TRUE, &verbose,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'w', MDB_OPT_SETBITS, TRUE, &work_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte 'W', MDB_OPT_SETBITS, TRUE, &waitqs_info,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NULL) != argc)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_USAGE);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&ss, sizeof (ss), addr) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte NOREAD(pmcs_hw_t, addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (DCMD_ERR);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* processing completed */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (((flags & DCMD_ADDRSPEC) && !(flags & DCMD_LOOP)) ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (flags & DCMD_LOOPFIRST) || phy_info || target_info || hw_info ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte work_info || waitqs_info || ibq || obq || tgt_phy_count || compq ||
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte unconfigured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((flags & DCMD_LOOP) && !(flags & DCMD_LOOPFIRST))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16s %9s %4s B C WorkFlags wserno DbgMsk %16s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Address", "State", "Inst", "DIP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("================================="
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "============================================\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (ss.state) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case STATE_NIL:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str = "Invalid";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case STATE_PROBING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str = "Probing";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case STATE_RUNNING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str = "Running";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case STATE_UNPROBING:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str = "Unprobing";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case STATE_DEAD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str = "Dead";
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16p %9s %4d %1d %1d 0x%08x 0x%04x 0x%04x %16p\n", addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte state_str, dip.devi_instance, ss.blocked, ss.configuring,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ss.work_flags, ss.wserno, ss.debug_mask, ss.dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_inc_indent(4);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (waitqs_info)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_waitqs(ss, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (hw_info)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_hwinfo(ss, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (phy_info || tgt_phy_count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_phys(ss, verbose, NULL, 0, tgt_phy_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (target_info || tgt_phy_count)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_targets(ss, verbose, tgt_phy_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
5679c89fcd2facbb4334df8870d3d7a4d2b11673jv if (work_info)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_work(ss, verbose);
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore if (ic_info)
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore display_ic(ss, verbose);
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ibq)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_inbound_queues(ss, verbose);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (obq)
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang display_outbound_queues(ss, verbose);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang if (iport_info)
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang display_iport(ss, addr, verbose);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang if (compq)
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang display_completion_queue(ss);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang if (unconfigured)
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang display_unconfigured_targets(addr);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang mdb_dec_indent(4);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang return (rv);
2a8164df8a5f42c8a00f10c67d7bc84f80ae9c41Zhong Wang}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Prints summary information about each pmcs instance.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -c: Dump the completion queue\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -h: Print more detailed hardware information\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -i: Print interrupt coalescing information\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -I: Print information about each iport\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -l: Dump the trace log (cannot be used with other options)\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -p: Print information about each attached PHY\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -q: Dump inbound queues\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -Q: Dump outbound queues\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -t: Print information about each configured target\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -T: Print target and PHY count summary\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -u: Show SAS address of all unconfigured targets\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -w: Dump work structures\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -W: List pmcs cmds waiting on various queues\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -v: Add verbosity to the above options\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_log_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Dump the pmcs log buffer, possibly with filtering.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -p PHY_PATH: Dump messages matching PHY_PATH\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -s SAS_ADDRESS: Dump messages matching SAS_ADDRESS\n\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Where: PHY_PATH can be found with ::pmcs -p (e.g. pp04.18.18.01)\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " SAS_ADDRESS can be found with ::pmcs -t "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(e.g. 5000c5000358c221)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortevoid
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_tag_help()
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Print all work structures by matching the tag.\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -i index: Match tag index (0x000 - 0xfff)\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -s serialnumber: Match serial number (0x0000 - 0xffff)\n"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " -t tagtype: Match tag type [NONE(1), CBACK(2), "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "WAIT(3)]\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
1b7fc709228029b3f29f1c3de6d817a476f7c583tim szeto
1b7fc709228029b3f29f1c3de6d817a476f7c583tim szetostatic const mdb_dcmd_t dcmds[] = {
1b7fc709228029b3f29f1c3de6d817a476f7c583tim szeto { "pmcs", "?[-chiIpQqtTuwWv]", "print pmcs information",
1b7fc709228029b3f29f1c3de6d817a476f7c583tim szeto pmcs_dcmd, pmcs_help
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_log",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "?[-p PHY_PATH | -s SAS_ADDRESS]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "dump pmcs log file", pmcs_log, pmcs_log_help
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_tag", "?[-t tagtype|-s serialnum|-i index]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Find work structures by tag type, serial number or index",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pmcs_tag, pmcs_tag_help
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_walker_t walkers[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_targets", "walk target structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte targets_walk_i, targets_walk_s, targets_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_phys", "walk PHY structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte phy_walk_i, phy_walk_s, phy_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_modinfo_t modinfo = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDB_API_VERSION, dcmds, walkers
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_modinfo_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_mdb_init(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (&modinfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte