pmcs.c revision c3bc407cfbd238a18e4728ad5f36f39cecdb062f
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * CDDL HEADER START
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 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * See the License for the specific language governing permissions
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and limitations under the License.
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 * CDDL HEADER END
3fb517f786391b507780c78aabb8d98bfea9efe9James Moore * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
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 Fortestatic uint32_t sas_phys, sata_phys, exp_phys, num_expanders, empty_phys;
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);
cbdc6dc775d8961a464fa0e1ca1bc234719c6e0dJohn Forte if (mdb_readvar(&msec_per_tick, "msec_per_tick") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Total nsecs between interrupts: %ld\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Max I/O completion interrupts : %d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_iport_phy_walk_cb(uintptr_t addr, const void *wdata, void *priv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&phy, sizeof (struct pmcs_phy), addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte sizeof (struct pmcs_phy)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortepmcs_iport_walk_cb(uintptr_t addr, const void *wdata, void *priv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&iport, sizeof (struct pmcs_iport), addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct pmcs_iport)) {
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (mdb_readstr(unit_address, sizeof (unit_address),
427fcaf873956aad428be801380a44e59d38b8b5tim szeto strncpy(unit_address, "Unset", sizeof (unit_address));
034d83c4b3be1c9bbe03552a652ebb90d4d66885tim szeto mdb_snprintf(portid, sizeof (portid), "%d", iport.portid);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Standard iport unit address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("UA %-16s %16s %8s %8s %16s", "Iport", "UA State",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%2s %16p %16s %8s %8d %16p\n", unit_address, addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Temporary iport unit address */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%-32s %16s %20s %8s %8s %16s", "UA", "Iport",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%32s %16p %20s %8s %8d %16p\n", unit_address, addr,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(addr + offsetof(struct pmcs_iport, phys));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("list", pmcs_iport_phy_walk_cb, NULL,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_iport(struct pmcs_hw m, uintptr_t addr, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte list_addr = (uintptr_t)(addr + offsetof(struct pmcs_hw, iports));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("list", pmcs_iport_walk_cb, NULL, list_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* ARGSUSED */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepmcs_utarget_walk_cb(uintptr_t addr, const void *wdata, void *priv)
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 mdb_printf("Unconfigured target SAS address:\n\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_pwalk("pmcs_phys", pmcs_utarget_walk_cb, NULL, addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read completion queue entry\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&work, sizeof (pmcwork_t), (uintptr_t)ccb.pwrk)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte != sizeof (pmcwork_t)) {
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 mdb_printf("Chip revision: %c\n", 'A' + m.chiprev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("SAS WWID: %"PRIx64"\n", m.sas_wwns[0]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PMCS_FW_MAJOR(mp), PMCS_FW_MINOR(mp), PMCS_FW_MICRO(mp),
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: Enabled (%d)\n", m.fwlog);
427fcaf873956aad428be801380a44e59d38b8b5tim szetodisplay_targets(struct pmcs_hw m, int verbose, int totals_only)
427fcaf873956aad428be801380a44e59d38b8b5tim szeto uint32_t sas_targets = 0, smp_targets = 0, sata_targets = 0;
427fcaf873956aad428be801380a44e59d38b8b5tim szeto targets = mdb_alloc(sizeof (targets) * max_dev, UM_SLEEP);
427fcaf873956aad428be801380a44e59d38b8b5tim szeto if (MDB_RD(targets, sizeof (targets) * max_dev, m.targets) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("---------------------------------------\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("VTGT %-16s %-16s %-5s %8s %s", "SAS Address",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&xs, sizeof (xs), targets[idx]) == -1) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * It has to be new or assigned to be of interest.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP)\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Configured targets:", (sas_targets + sata_targets + smp_targets),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_one_work(pmcwork_t *wp, int verbose, int idx)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte last_state = work_state_to_string(wp->last_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wp->ssp_event && wp->ssp_event != 0xffffffff) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wp->last_htag, last_state, wp->last_phy, wp->last_xp);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("\nActive Work structure information:\n");
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("----------------------------------\n");
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 if (!verbose && (wp->htag == PMCS_TAG_TYPE_FREE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteprint_spcmd(pmcs_cmd_t *sp, void *kaddr, int printhdr, int verbose)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16s %16s %16s %8s %s CDB\n", "Command",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto kaddr, sp->cmd_pkt, sp->cmd_clist, sp->cmd_tag, sp->cmd_satltag);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto * If we're printing verbose, dump the CDB as well.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (struct scsi_pkt)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*ARGSUSED1*/
5679c89fcd2facbb4334df8870d3d7a4d2b11673jvstatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte targets = mdb_alloc(sizeof (targets) * max_dev, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(targets, sizeof (targets) * max_dev, m.targets) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (i = 0; i < max_dev; i++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&xs, sizeof (xs), targets[i]) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("I/O");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("Other");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("I/O");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("General");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("Events");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("UNKNOWN");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortestatic char *
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return ("NET");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("FC");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SCSI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("???");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("ECHO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PHY_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PHY_STOP");
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan return ("INI_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_TM_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EXT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_ACCEPT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_RESPONSE_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EDC_EXT_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("INI_EDC_EXT_IO_START1");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TGT_EDC_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEREGISTER_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_REQUEST");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_RESPONSE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_ABORT");
4f4863587e52ddab00c1f01266a9198314761416Nattuvetty Bhavyan return ("ASSISTED_DISCOVERY");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("REGISTER_DEVICE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_HOST_IO_START");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("LOCAL_PHY_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TWI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("FW_FLASH_UPDATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_MODE_START_END");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_EXECUTE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_HW_EVENT_ACK");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_TIME_STAMP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("PORT_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic char *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("ECHO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_HW_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("LOCAL_PHY_CONTROL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_ASSISTED_DISCOVERY_SENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ASSISTED_DISCOVERY_SENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_REGISTRATION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEREGISTER_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_HANDLE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_COMPLETION");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_ARRIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SMP_REQUEST_RECEIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_REQUEST_RECEIVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_INFO");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("FW_FLASH_UPDATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_VPD");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GPIO_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GENERAL_EVENT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("TWI");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SSP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SATA_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_MODE_START_END");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SAS_DIAG_EXECUTE");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("GET_TIME_STAMP");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SAS_HW_EVENT_ACK_ACK");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("PORT_CONTROL");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SKIP_ENTRIES");
63ed874a56e20df7e4ec98ba42582352d87386c5tim szeto return ("SMP_ABORT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_NVMD_DATA");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("DEVICE_HANDLE_REMOVED");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("GET_DEVICE_STATE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("SET_DEVICE_INFO");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return ("UNKNOWN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedump_one_qentry_outbound(uint32_t *qentryp, int idx)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (word0 & PMCS_IOMB_OBID_MASK) >> PMCS_IOMB_OBID_SHIFT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte iomb_cat((word0 & PMCS_IOMB_CAT_MASK) >> PMCS_IOMB_CAT_SHIFT));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte outbound_iomb_opcode(word0 & PMCS_IOMB_OPCODE_MASK));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (qeidx = 1; qeidx < (PMCS_QENTRY_SIZE / 4); qeidx++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_outbound_queues(struct pmcs_hw ss, uint_t verbose)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t *qentryp = mdb_alloc(PMCS_QENTRY_SIZE, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("No outbound queue ptr for queue #%d\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Outbound Queue #%d (Queue Type = %s)\n", qidx,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Chip is the producer, so read the actual producer index
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * and not the driver's version
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Producer index: %d Consumer index: %d\n\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodump_one_qentry_inbound(uint32_t *qentryp, int idx)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto (word0 & PMCS_IOMB_OBID_MASK) >> PMCS_IOMB_OBID_SHIFT);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto iomb_cat((word0 & PMCS_IOMB_CAT_MASK) >> PMCS_IOMB_CAT_SHIFT));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto inbound_iomb_opcode(word0 & PMCS_IOMB_OPCODE_MASK));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("HTAG: 0x%08x\n", LE_32(*(qentryp + 1)));
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto for (qeidx = 2; qeidx < (PMCS_QENTRY_SIZE / 4); qeidx++) {
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szetodisplay_inbound_queues(struct pmcs_hw ss, uint_t verbose)
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto uint32_t *qentryp = mdb_alloc(PMCS_QENTRY_SIZE, UM_SLEEP);
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("No inbound queue ptr for queue #%d\n",
8fe960854f0d52e2e8a80ba68e8621a5ac6a866dtim szeto mdb_printf("Inbound Queue #%d (Queue Type = %s)\n", qidx,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Producer index: %d Consumer index: %d\n\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_phy(struct pmcs_phy phy, int verbose, int totals_only)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else if ((phy.dtype == EXPANDER) && phy.configured) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortedisplay_phys(struct pmcs_hw ss, int verbose, struct pmcs_phy *parent, int level,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Cfgd AbtP AbtS Chgd Dead Ref Lock\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (MDB_RD(&phy, sizeof (phy), (uintptr_t)pphy) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte display_phys(ss, verbose, phy.children, level + 1,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP) "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "(+%d subsidiary + %d empty)\n", "Occupied PHYs:",
5dfbf9be7aa351a2746b8259a906f60caf81fdcfSue Gleeson mdb_printf("%19s %d (%d SAS + %d SATA + %d SMP)\n",
5dfbf9be7aa351a2746b8259a906f60caf81fdcfSue Gleeson "Occupied PHYs:",
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 * 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 Fortepmcs_dump_tracelog(boolean_t filter, int instance, const char *phy_path,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t start_idx, elems_to_print, idx, tbuf_num_elems;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the address of the first element */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_addr, "pmcs_tbuf") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the total number */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_num_elems, "pmcs_tbuf_num_elems") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Get the current index */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&tbuf_idx, "pmcs_tbuf_idx") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Indicator as to whether the buffer has wrapped */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&wrap, "pmcs_tbuf_wrap") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * On little-endian systems, the SAS address passed in will be
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * byte swapped. Take care of that here.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Figure out where we start and stop */
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 * Check for filtering on HBA instance
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* Skip the driver name */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte while (*bufp != ':' && ei_idx < (MAX_INST_STRLEN - 1)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* Get the instance */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (!elem_filtered && (phy_path || sas_address)) {
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 mdb_printf("%Y.%09ld %s\n", tbuf.timestamp, tbuf.buf);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Address provided belongs to HBA softstate. Get the targets pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * to begin the walk.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&ss, sizeof (pmcs_hw_t), wsp->walk_addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte targets = mdb_alloc(sizeof (targets) * ss.max_dev, UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(targets, sizeof (targets) * ss.max_dev, ss.targets) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_data = mdb_alloc(sizeof (pmcs_xscsi_t), UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(wsp->walk_data, sizeof (pmcs_xscsi_t),
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Failed to read target at %p", (void *)wsp->walk_addr);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_addr = (uintptr_t)(targets[++target_idx]);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte } while ((wsp->walk_addr == NULL) && (target_idx < ss.max_dev));
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * First, if this is a root PHY, there are no more siblings
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Otherwise, next sibling is the parent's sibling
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("pmcs_next_sibling: Failed to read PHY at %p",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Address provided belongs to HBA softstate. Get the targets pointer
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * to begin the walk.
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(&ss, sizeof (pmcs_hw_t), wsp->walk_addr) !=
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte wsp->walk_data = mdb_alloc(sizeof (pmcs_phy_t), UM_SLEEP);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_vread(wsp->walk_data, sizeof (pmcs_phy_t),
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
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 Fortedisplay_matching_work(struct pmcs_hw ss, uintmax_t index, uintmax_t snum,
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) {
fdff21492ef0ebf614bb66c3e9d90526a4f0c9c0John Fortepmcs_tag(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs_tag", argc,
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 if (snum > (PMCS_TAG_SERNO_MASK >> PMCS_TAG_SERNO_SHIFT)) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte * Make sure 1 and only 1 option is specified
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_warn("Exactly one of -i, -s and -t must be specified\n");
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte /* processing completed */
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (((flags & DCMD_ADDRSPEC) && !(flags & DCMD_LOOP)) ||
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if ((flags & DCMD_LOOP) && !(flags & DCMD_LOOPFIRST))
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte mdb_printf("%16s %9s %4s B C WorkFlags wserno DbgMsk %16s\n",
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte "============================================\n");
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 display_matching_work(ss, index, snum, tag_type);
450396635f70344c58b6b1e4db38cf17ff34445cJohn Fortepmcs_log(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs_log", argc,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (pmcs_dump_tracelog(B_TRUE, dip.devi_instance,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte return (pmcs_dump_tracelog(B_FALSE, 0, match_phy_path,
cd36db67f9470c74ed7f5bbd57ec6eeb84f71fcdJohn Fortepmcs_dcmd(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_readvar(&pmcs_state, "pmcs_softc_state") == -1) {
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (mdb_pwalk_dcmd("genunix`softstate", "pmcs`pmcs", argc, argv,
450396635f70344c58b6b1e4db38cf17ff34445cJohn Forte if (MDB_RD(&dip, sizeof (struct dev_info), ss.dip) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* processing completed */
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 if ((flags & DCMD_LOOP) && !(flags & DCMD_LOOPFIRST))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16s %9s %4s B C WorkFlags wserno DbgMsk %16s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "============================================\n");
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 display_phys(ss, verbose, NULL, 0, tgt_phy_count);
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 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 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");
1b7fc709228029b3f29f1c3de6d817a476f7c583tim szeto { "pmcs", "?[-chiIpQqtTuwWv]", "print pmcs information",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_log",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "?[-p PHY_PATH | -s SAS_ADDRESS]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pmcs_tag", "?[-t tagtype|-s serialnum|-i index]",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Find work structures by tag type, serial number or index",