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/*
585995d5d19489bf178112c08c8c61ffc049ff6eYu Renia Miao * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Use is subject to license terms.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mdb_modapi.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/mutex.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/modctl.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <time.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/fc.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fctl_private.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fc_ulpif.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fc_portif.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#include <sys/fibre-channel/impl/fc_fcaif.h>
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If we #include <string.h> then other definitions fail. This is
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the easiest way of getting access to the function
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteextern char *strtok(char *string, const char *sepset);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* we need 26 bytes for the cftime() call */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte#define TIMESTAMPSIZE 26 * sizeof (char)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/* for backward compatibility */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortetypedef struct fc_trace_dmsgv1 {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int id_size;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int id_flag;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte time_t id_time;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t id_buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte struct fc_trace_dmsgv1 *id_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte} fc_trace_dmsgv1_t;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct pwwn_hash *fp_pwwn_table;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic struct d_id_hash *fp_did_table;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic uint32_t pd_hash_index;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestruct fc_local_port port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville port walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Initialize the fc_fca_port_t walker by either using the given starting
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * address, or reading the value of the kernel's fctl_fca_portlist pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We also allocate a fc_fca_port_t for storage, and save this using the
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walk_data pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteport_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_readvar(&wsp->walk_addr, "fctl_fca_portlist") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read 'fctl_fca_portlist'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (fc_fca_port_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * At each step, read a fc_fca_port_t into our private storage, and then invoke
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the callback function. We terminate when we reach a NULL p_next pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteport_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (fc_fca_port_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fc_fca_port_t at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((fc_fca_port_t *)wsp->walk_data)->port_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The walker's fini function is invoked at the end of each walk. Since we
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dynamically allocated a fc_fca_port_t in port_walk_i, we must free it now.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteport_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (fc_fca_port_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteports(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_fca_port_t portlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int longlist = FALSE;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc > 1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'l', MDB_OPT_SETBITS, TRUE, &longlist) != argc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (longlist == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("ports", "ports",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'fctl_fca_portlist'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("ports", "fcport",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'fctl_fca_portlist'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If this is the first invocation of the command, print a nice
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * header line for the output that will follow.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16s %-2s %4s %-4s%16s %16s %16s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Port", "I#", "State", "Soft", "FCA Handle",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Port DIP", "FCA Port DIP");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For each port, we just need to read the fc_fca_port_t struct, read
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the port_handle
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&portlist, sizeof (fc_fca_port_t), addr) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_fca_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now read that port in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t), (uintptr_t)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portlist.port_handle) == sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%16p %2d %4x %4x %16p %16p %16p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portlist.port_handle, port.fp_instance,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_state, port.fp_soft_state,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_fca_handle, port.fp_port_dip,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_fca_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read port at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte portlist.port_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read port info at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville ULP walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulp_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_readvar(&wsp->walk_addr, "fctl_ulp_list") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read 'fctl_ulp_list'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (fc_ulp_list_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulp_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (fc_ulp_list_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fctl_ulp_list %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((fc_ulp_list_t *)wsp->walk_data)->ulp_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulp_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (fc_ulp_list_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulps(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_list_t ulplist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_modinfo_t ulp;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char ulp_name[30];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If no fc_ulp_list_t address was specified on the command line, we can
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * print out all processes by invoking the walker, using this
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * dcmd itself as the callback.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("ulps", "ulps", argc, argv) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'fc_ulp_list_t'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If this is the first invocation of the command, print a nice
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * header line for the output that will follow.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%30s %4s %8s\n", "ULP Name", "Type", "Revision");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For each port, we just need to read the fc_fca_port_t struct, read
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the port_handle
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ulplist, sizeof (fc_ulp_list_t), addr) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_ulp_list_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now read that port in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ulp, sizeof (fc_ulp_modinfo_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ulplist.ulp_info) == sizeof (fc_ulp_modinfo_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ulp_name, 30,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ulp.ulp_name) > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%30s %4x %8x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulp_name, ulp.ulp_type, ulp.ulp_rev);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read ulp at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulplist.ulp_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read ulplist at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville ULP module walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulpmod_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_readvar(&wsp->walk_addr, "fctl_ulp_modules") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read 'fctl_ulp_modules'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (fc_ulp_module_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulpmod_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (fc_ulp_module_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fctl_ulp_modules %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((fc_ulp_module_t *)wsp->walk_data)->mod_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulpmod_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (fc_ulp_module_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteulpmods(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_module_t modlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_modinfo_t modinfo;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_ulp_ports_t ulp_port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_walk_dcmd("ulpmods", "ulpmods", argc, argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to walk 'fc_ulp_module_t'");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * If this is the first invocation of the command, print a nice
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * header line for the output that will follow.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags))
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4s %16s %8s %8s\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "Type", "Port Handle", "dstate", "statec");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For each port, we just need to read the fc_fca_port_t struct, read
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * the port_handle
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&modlist, sizeof (fc_ulp_module_t), addr) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_ulp_module_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Now read that module info in
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&modinfo, sizeof (fc_ulp_modinfo_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)modlist.mod_info) == sizeof (fc_ulp_modinfo_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* Now read all the ports for this module */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&ulp_port, sizeof (fc_ulp_ports_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)modlist.mod_ports) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_ulp_ports_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (ulp_port.port_handle != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%4x %16p %8x %8x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte modinfo.ulp_type,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulp_port.port_handle,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulp_port.port_dstate,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulp_port.port_statec);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (ulp_port.port_next == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_vread(&ulp_port,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_ulp_ports_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)ulp_port.port_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read modinfo at %p",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte modlist.mod_info);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read modlist at %p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display an fc_local_port_t struct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefcport(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_fca_port_t portlist;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int walking_fc_fca_portlist = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int result;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc != 1)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argv->a_type != MDB_TYPE_STRING)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte walking_fc_fca_portlist = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Sorry, you must provide an address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (walking_fc_fca_portlist) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Must read the fc_fca_portlist to get the fc_local_port addr
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&portlist, sizeof (fc_fca_port_t), addr) ==
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_fca_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = (uintptr_t)portlist.port_handle;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Reading fc_local_port_t at %p:\n", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * For each port, we just need to read the fc_local_port_t struct
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr) == sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_mutex : 0x%p\n", port.fp_mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_state : 0x%-8x\n", port.fp_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_port_id : 0x%-06x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_port_id.port_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_fca_handle : 0x%p\n", port.fp_fca_handle);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_fca_tran : 0x%p\n", port.fp_fca_tran);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_job_head : 0x%p\n", port.fp_job_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_job_tail : 0x%p\n", port.fp_job_tail);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_wait_head : 0x%p\n", port.fp_wait_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_wait_tail : 0x%p\n", port.fp_wait_tail);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_topology : %u\n", port.fp_topology);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_task : %d\n", port.fp_task);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_last_task : %d\n", port.fp_last_task);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_soft_state : 0x%-4x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_soft_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_flag : 0x%-2x\n", port.fp_flag);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_statec_busy : 0x%-8x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_statec_busy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_port_num : %d\n", port.fp_port_num);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_instance : %d\n", port.fp_instance);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_ulp_attach : %d\n", port.fp_ulp_attach);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_dev_count : %d\n", port.fp_dev_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_total_devices : %d\n", port.fp_total_devices);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_bind_state : 0x%-8x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_bind_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_options : 0x%-8x\n", port.fp_options);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_port_type : 0x%-2x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_port_type.port_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_ub_count : %d\n", port.fp_ub_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_active_ubs : %d\n", port.fp_active_ubs);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_port_dip : 0x%p\n", port.fp_port_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_fca_dip : 0x%p\n", port.fp_fca_dip);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (idx = 0; idx < 16; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port.fp_ip_addr[idx] != 0)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (idx != 16) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_ip_addr : %-2x:%-2x:%-2x:%-2x:"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "%-2x:%-2x:%-2x:%-2x:%-2x:%-2x:%-2x:%-2x:%-2x:%-2x"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ":%-2x:%-2x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[0], port.fp_ip_addr[1],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[2], port.fp_ip_addr[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[4], port.fp_ip_addr[5],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[6], port.fp_ip_addr[7],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[8], port.fp_ip_addr[9],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[10], port.fp_ip_addr[11],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[12], port.fp_ip_addr[13],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_ip_addr[14], port.fp_ip_addr[15]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_ip_addr : N/A\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_fc4_types : ");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte for (idx = 0; idx < 8; idx++) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (port.fp_fc4_types[idx] != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_fc4_types[idx]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(", %d",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_fc4_types[idx]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("None\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_pm_level : %d\n", port.fp_pm_level);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_pm_busy : %d\n", port.fp_pm_busy);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_pm_busy_nocomp : 0x%-8x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_pm_busy_nocomp);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_hard_addr : 0x%-6x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_hard_addr.hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_sym_port_name : \"%s\"\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_sym_port_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_sym_node_name : \"%s\"\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port.fp_sym_node_name);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" fp_rscn_count : %d\n", port.fp_rscn_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fc_local_port_t at 0x%p", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville remote_port walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We need to be given the address of a port structure in order to start
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walking. From that, we can read the pwwn table.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_pwwn_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pd_by_pwwn walk doesn't support global walks\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Allocate space for the pwwn_hash table
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_pwwn_table = mdb_alloc(sizeof (struct pwwn_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PWWN_HASH_TABLE_SIZE, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input should be an fc_local_port_t, so read it to get the pwwn
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * table's head
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t), wsp->walk_addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read in the port structure address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(fp_pwwn_table, sizeof (struct pwwn_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PWWN_HASH_TABLE_SIZE, (uintptr_t)port.fp_pwwn_table) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read in the pwwn hash table\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fp_pwwn_table[pd_hash_index].pwwn_head == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index < PWWN_HASH_TABLE_SIZE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)fp_pwwn_table[pd_hash_index].pwwn_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (fc_remote_port_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * At each step, read a fc_remote_port_t into our private storage, and then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * invoke the callback function. We terminate when we reach a NULL p_next
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_pwwn_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((wsp->walk_addr == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index >= (PWWN_HASH_TABLE_SIZE - 1))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (fc_remote_port_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fc_remote_port at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((fc_remote_port_t *)wsp->walk_data)->pd_wwn_hnext);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Try the next hash list, if there is one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fp_pwwn_table[pd_hash_index].pwwn_head == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index < PWWN_HASH_TABLE_SIZE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd_hash_index == PWWN_HASH_TABLE_SIZE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We're done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)fp_pwwn_table[pd_hash_index].pwwn_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The walker's fini function is invoked at the end of each walk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_pwwn_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (fc_remote_port_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(fp_pwwn_table, sizeof (struct pwwn_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte PWWN_HASH_TABLE_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_pwwn_table = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * This is the same walker as pd_by_pwwn, but we walk the D_ID hash table
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_did_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_local_port_t port;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("pd_by_did walk doesn't support global walks\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Allocate space for the did_hash table
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_did_table = mdb_alloc(sizeof (struct d_id_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte D_ID_HASH_TABLE_SIZE, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input should be an fc_local_port_t, so read it to get the d_id
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * table's head
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t), wsp->walk_addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read in the port structure address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(fp_did_table, sizeof (struct d_id_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte D_ID_HASH_TABLE_SIZE, (uintptr_t)port.fp_did_table) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Unable to read in the D_ID hash table\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fp_did_table[pd_hash_index].d_id_head == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index < D_ID_HASH_TABLE_SIZE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)fp_did_table[pd_hash_index].d_id_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (fc_remote_port_t), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * At each step, read a fc_remote_port_t into our private storage, and then
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * invoke the callback function. We terminate when we reach a NULL p_next
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * pointer.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_did_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((wsp->walk_addr == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index >= (D_ID_HASH_TABLE_SIZE - 1))) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (fc_remote_port_t), wsp->walk_addr)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fc_remote_port at %p", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((fc_remote_port_t *)wsp->walk_data)->pd_did_hnext);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Try the next hash list, if there is one.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while ((fp_did_table[pd_hash_index].d_id_head == NULL) &&
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (pd_hash_index < D_ID_HASH_TABLE_SIZE)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_hash_index++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd_hash_index == D_ID_HASH_TABLE_SIZE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* We're done */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)fp_did_table[pd_hash_index].d_id_head;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The walker's fini function is invoked at the end of each walk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortepd_by_did_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (fc_remote_port_t));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(fp_did_table, sizeof (struct d_id_hash) *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte D_ID_HASH_TABLE_SIZE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_did_table = NULL;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Display a remote_port structure
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteremote_port(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_remote_port_t pd;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int idx;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (argc > 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (!(flags & DCMD_ADDRSPEC)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Sorry, you must provide an address\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&pd, sizeof (fc_remote_port_t), addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_remote_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Error reading pd at 0x%x\n", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("Reading remote_port at 0x%p\n", addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" mutex : 0x%p\n", pd.pd_mutex);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" port_id : 0x%-8x\n", pd.pd_port_id);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" port_name : 0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd.pd_port_name.raw_wwn[0], pd.pd_port_name.raw_wwn[1],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd.pd_port_name.raw_wwn[2], pd.pd_port_name.raw_wwn[3],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd.pd_port_name.raw_wwn[4], pd.pd_port_name.raw_wwn[5],
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd.pd_port_name.raw_wwn[6], pd.pd_port_name.raw_wwn[7]);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" login_count : %d\n", pd.pd_login_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" state : 0x%x ", pd.pd_state);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (pd.pd_state) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_INVALID:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(invalid)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_VALID:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(valid)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_LOGGED_IN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(logged in)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Unknown state)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" remote node : 0x%p\n", pd.pd_remote_nodep);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" hard_addr : 0x%x\n", pd.pd_hard_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" local port : 0x%p\n", pd.pd_port);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" type : %d ", pd.pd_type);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (pd.pd_type) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_NOCHANGE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(No change)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_NEW:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(New)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_OLD:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Old)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_CHANGED:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Changed)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_DELETE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Delete)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_USER_LOGIN:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(User login)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_USER_LOGOUT:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(User logout)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_USER_CREATE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(User create)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PORT_DEVICE_USER_DELETE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(User delete)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Unknown type)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" flags : 0x%x ", pd.pd_flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte switch (pd.pd_flags) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PD_IDLE:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Idle)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PD_ELS_IN_PROGRESS:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(ELS in progress)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte case PD_ELS_MARK:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Mark)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte break;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte default:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(Unknown flag value)\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" login_class : 0x%x\n", pd.pd_login_class);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" recipient : %d\n", pd.pd_recepient);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" ref_count : %d\n", pd.pd_ref_count);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" aux_flags : 0x%x ", pd.pd_aux_flags);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 1;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd.pd_aux_flags & PD_IN_DID_QUEUE) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(IN_DID_QUEUE");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd.pd_aux_flags & PD_DISABLE_RELOGIN) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(DISABLE_RELOGIN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(", DISABLE_RELOGIN");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd.pd_aux_flags & PD_NEEDS_REMOVAL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(NEEDS_REMOVAL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(", NEEDS_REMOVAL");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd.pd_aux_flags & PD_LOGGED_OUT) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(LOGGED_OUT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(", LOGGED_OUT");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pd.pd_aux_flags & PD_GIVEN_TO_ULPS) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("(GIVEN_TO_ULPS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(", GIVEN_TO_ULPS");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte first = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (first == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(")\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" sig : %p\n", pd.pd_logo_tc.sig);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" active : %d\n", pd.pd_logo_tc.active);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" counter : %d\n", pd.pd_logo_tc.counter);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" max_value : %d\n", pd.pd_logo_tc.max_value);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf(" timer : %d\n", pd.pd_logo_tc.timer);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_dump_logmsg(fc_trace_dmsg_t *addr, uint_t pktstart, uint_t pktend,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t *printed)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_trace_dmsg_t msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char merge[1024];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t tmppkt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *tmpbuf; /* for tokenising the buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t pktnum = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (addr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&msg, sizeof (msg), (uintptr_t)addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (msg)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read message pointer in kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (msg.id_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte buf = mdb_alloc(msg.id_size + 1, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmppkt = mdb_alloc(msg.id_size + 1, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(buf, msg.id_size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)msg.id_buf) != msg.id_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read buffer contents"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " in kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(buf, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (buf[0] == '\n') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("There is a problem in"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the buffer\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* funky packet processing stuff */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(buf, tmppkt, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* find the equals sign, and put a null there */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmpbuf = strchr(tmppkt, '=');
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *tmpbuf = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pktnum = (uint_t)mdb_strtoull(tmppkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pktnum >= pktstart) && (pktnum <= pktend)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mdb_snprintf(merge, sizeof (merge),
585995d5d19489bf178112c08c8c61ffc049ff6eYu Renia Miao "[%Y:%03d:%03d:%03d] %s",
585995d5d19489bf178112c08c8c61ffc049ff6eYu Renia Miao msg.id_time.tv_sec,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)msg.id_time.tv_nsec/1000000,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (int)(msg.id_time.tv_nsec/1000)%1000,
585995d5d19489bf178112c08c8c61ffc049ff6eYu Renia Miao (int)msg.id_time.tv_nsec%1000, buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s", merge);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (printed != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*printed) ++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(buf, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(tmppkt, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = msg.id_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_dump_old_logmsg(fc_trace_dmsgv1_t *addr, uint_t pktstart, uint_t pktend,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t *printed)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_trace_dmsgv1_t msg;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t buf;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char merge[1024];
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte caddr_t tmppkt;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte char *tmpbuf; /* for tokenising the buffer */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t pktnum = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte while (addr != NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&msg, sizeof (msg), (uintptr_t)addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (msg)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read message pointer in kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (msg.id_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte buf = mdb_alloc(msg.id_size + 1, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmppkt = mdb_alloc(msg.id_size + 1, UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(buf, msg.id_size,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)msg.id_buf) != msg.id_size) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read buffer contents"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " in kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(buf, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (buf[0] == '\n') {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("There is a problem in"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "the buffer\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /* funky packet processing stuff */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte bcopy(buf, tmppkt, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte tmpbuf = strchr(tmppkt, '=');
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *tmpbuf = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pktnum = (uint_t)mdb_strtoull(tmppkt);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if ((pktnum >= pktstart) && (pktnum <= pktend)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (void) mdb_snprintf(merge, sizeof (merge),
585995d5d19489bf178112c08c8c61ffc049ff6eYu Renia Miao "[%Y] %s", msg.id_time, buf);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("%s", merge);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (printed != NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (*printed) ++;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(buf, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(tmppkt, msg.id_size + 1);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte addr = msg.id_next;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_OK);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefc_trace_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fc_trace_logq_t logq;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t pktnum = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uint_t printed = 0; /* have we printed anything? */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t pktstart = 0;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte uintptr_t pktend = UINT_MAX;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int rval = DCMD_OK;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&logq, sizeof (logq), addr) != sizeof (logq)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Failed to read log queue in kernel");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_getopts(argc, argv,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 's', MDB_OPT_UINTPTR, &pktstart,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte 'e', MDB_OPT_UINTPTR, &pktend) != argc) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (pktstart > pktend) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_USAGE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (logq.il_flags & FC_TRACE_LOGQ_V2 != 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = fc_dump_logmsg((fc_trace_dmsg_t *)logq.il_msgh, pktstart,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pktend, &printed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte } else {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte rval = fc_dump_old_logmsg((fc_trace_dmsgv1_t *)logq.il_msgh,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pktstart, pktend, &printed);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (rval != DCMD_OK) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (printed == 0) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("No packets in the buffer match the"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " criteria given");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (rval);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefp_trace_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&addr, "fp_logq") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fp_logq");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("fp trace buffer contents\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (fc_trace_dump(addr, flags, argc, argv));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteint
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortefcp_trace_dump(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_readvar(&addr, "fcp_logq") == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("failed to read fcp_logq");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (DCMD_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (DCMD_HDRSPEC(flags)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_printf("fcp trace buffer contents\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (fc_trace_dump(addr, flags, argc, argv));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville job_request walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We need to be given the address of a local port structure in order to start
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walking. From that, we can read the job_request list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortejob_request_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("The address of a fc_local_port"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " structure must be given\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input should be a fc_local_port_t, so read it to get the job_request
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lists's head
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t), wsp->walk_addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Failed to read in the fc_local_port"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " at 0x%p\n", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(port.fp_job_head);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (struct job_request), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortejob_request_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (struct job_request),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Failed to read in the job_request at 0x%p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((struct job_request *)wsp->walk_data)->job_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The walker's fini function is invoked at the end of each walk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortejob_request_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct job_request));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Leadville fc_orphan walker/dcmd code
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We need to be given the address of a port structure in order to start
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * walking. From that, we can read the orphan list.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteorphan_walk_i(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("The address of a fc_local_port"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " structure must be given\n");
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte /*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * Input should be a fc_local_port_t, so read it to get the orphan
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * lists's head
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(&port, sizeof (fc_local_port_t), wsp->walk_addr) !=
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte sizeof (fc_local_port_t)) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Failed to read in the fc_local_port"
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte " at 0x%p\n", wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_ERR);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr = (uintptr_t)(port.fp_orphan_list);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_data = mdb_alloc(sizeof (struct fc_orphan), UM_SLEEP);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_NEXT);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic int
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteorphan_walk_s(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte int status;
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (wsp->walk_addr == NULL)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte if (mdb_vread(wsp->walk_data, sizeof (struct fc_orphan),
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr) == -1) {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_warn("Failed to read in the fc_orphan at 0x%p\n",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (WALK_DONE);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte status = wsp->walk_callback(wsp->walk_addr, wsp->walk_data,
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_cbdata);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte wsp->walk_addr =
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte (uintptr_t)(((struct fc_orphan *)wsp->walk_data)->orp_next);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (status);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * The walker's fini function is invoked at the end of each walk.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic void
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteorphan_walk_f(mdb_walk_state_t *wsp)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte mdb_free(wsp->walk_data, sizeof (struct fc_orphan));
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte/*
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * MDB module linkage information:
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * We declare a list of structures describing our dcmds, a list of structures
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * describing our walkers, and a function named _mdb_init to return a pointer
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte * to our module information.
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte */
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_dcmd_t dcmds[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ports", "[-l]", "Leadville port list", ports },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ulps", NULL, "Leadville ULP list", ulps },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ulpmods", NULL, "Leadville ULP module list", ulpmods },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "fcport", NULL, "Display a Leadville fc_local_port structure",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcport },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "remote_port", NULL, "Display fc_remote_port structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte remote_port },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "fcptrace", "[-s m][-e n] (m < n)", "Dump the fcp trace buffer, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "optionally supplying starting and ending packet numbers.",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fcp_trace_dump, NULL },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "fptrace", "[-s m][-e n] (m < n)", "Dump the fp trace buffer, "
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte "optionally supplying starting and ending packet numbers.",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte fp_trace_dump, NULL },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_walker_t walkers[] = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ports", "walk list of Leadville port structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte port_walk_i, port_walk_s, port_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ulps", "walk list of Leadville ULP structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulp_walk_i, ulp_walk_s, ulp_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "ulpmods", "walk list of Leadville ULP module structures",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte ulpmod_walk_i, ulpmod_walk_s, ulpmod_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pd_by_pwwn", "walk list of fc_remote_port structures hashed by PWWN",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_by_pwwn_walk_i, pd_by_pwwn_walk_s, pd_by_pwwn_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "pd_by_did", "walk list of fc_remote_port structures hashed by D_ID",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte pd_by_did_walk_i, pd_by_did_walk_s, pd_by_did_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "job_request", "walk list of job_request structures for a local port",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte job_request_walk_i, job_request_walk_s, job_request_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { "orphan", "walk list of orphan structures for a local port",
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte orphan_walk_i, orphan_walk_s, orphan_walk_f },
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte { NULL }
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Fortestatic const mdb_modinfo_t modinfo = {
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte MDB_API_VERSION, dcmds, walkers
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte};
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forteconst mdb_modinfo_t *
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte_mdb_init(void)
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte{
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte return (&modinfo);
fcf3ce441efd61da9bb2884968af01cb7c1452ccJohn Forte}