10Sstevel@tonic-gate /* 20Sstevel@tonic-gate * CDDL HEADER START 30Sstevel@tonic-gate * 40Sstevel@tonic-gate * The contents of this file are subject to the terms of the 50Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 60Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 70Sstevel@tonic-gate * with the License. 80Sstevel@tonic-gate * 90Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 100Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 110Sstevel@tonic-gate * See the License for the specific language governing permissions 120Sstevel@tonic-gate * and limitations under the License. 130Sstevel@tonic-gate * 140Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 150Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 160Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 170Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 180Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 190Sstevel@tonic-gate * 200Sstevel@tonic-gate * CDDL HEADER END 210Sstevel@tonic-gate */ 220Sstevel@tonic-gate /* 230Sstevel@tonic-gate * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 240Sstevel@tonic-gate * Use is subject to license terms. 250Sstevel@tonic-gate */ 260Sstevel@tonic-gate 270Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 280Sstevel@tonic-gate 290Sstevel@tonic-gate #include <stddef.h> 300Sstevel@tonic-gate #include <sys/mdb_modapi.h> 310Sstevel@tonic-gate #include <mdb/mdb_ks.h> 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/usb/usba.h> 340Sstevel@tonic-gate #include <sys/ddi_impldefs.h> 350Sstevel@tonic-gate #include <sys/usb/usba/usba_types.h> 360Sstevel@tonic-gate #include <sys/usb/usba/usba_impl.h> 370Sstevel@tonic-gate #include <sys/usb/usba/hcdi_impl.h> 380Sstevel@tonic-gate #include <sys/file.h> 390Sstevel@tonic-gate #include <sys/sunndi.h> 400Sstevel@tonic-gate #include <unistd.h> 410Sstevel@tonic-gate 420Sstevel@tonic-gate 430Sstevel@tonic-gate /* 440Sstevel@tonic-gate * Prototypes 450Sstevel@tonic-gate */ 460Sstevel@tonic-gate /* usba.c */ 470Sstevel@tonic-gate extern uintptr_t mdb_usba_get_usba_device(uintptr_t); 480Sstevel@tonic-gate extern uintptr_t mdb_usba_hcdi_get_hcdi(struct dev_info *); 490Sstevel@tonic-gate 500Sstevel@tonic-gate /* 510Sstevel@tonic-gate * Defines 520Sstevel@tonic-gate */ 530Sstevel@tonic-gate /* dcmd options */ 540Sstevel@tonic-gate #define USB_DUMP_VERBOSE 0x01 550Sstevel@tonic-gate #define USB_DUMP_ACTIVE_PIPES 0x02 560Sstevel@tonic-gate 570Sstevel@tonic-gate /* Hardcoded slop factor designed into debug buf logic */ 580Sstevel@tonic-gate #define USB_DEBUG_SIZE_EXTRA_ALLOC 8 590Sstevel@tonic-gate 600Sstevel@tonic-gate 610Sstevel@tonic-gate /* 620Sstevel@tonic-gate * Callback arg struct for find_dip (callback func used in usba_device2devinfo). 630Sstevel@tonic-gate */ 640Sstevel@tonic-gate typedef struct usba_device2devinfo_data { 650Sstevel@tonic-gate uintptr_t u2d_target_usb_dev_p; /* one we're looking for */ 660Sstevel@tonic-gate uintptr_t *u2d_dip_addr; /* Where to store result */ 670Sstevel@tonic-gate boolean_t u2d_found; /* Match found */ 680Sstevel@tonic-gate } usba_device2devinfo_cbdata_t; 690Sstevel@tonic-gate 700Sstevel@tonic-gate 710Sstevel@tonic-gate /* 720Sstevel@tonic-gate * Callback for usba_device2dip. 730Sstevel@tonic-gate * Callback called from the devinfo_children walk invoked in usba_device2dip. 740Sstevel@tonic-gate * 750Sstevel@tonic-gate * For the current dip, get the (potential) pointer to its usba_device_t 760Sstevel@tonic-gate * struct. 770Sstevel@tonic-gate * See if this pointer matches the address of the usba_device_t we're looking 780Sstevel@tonic-gate * for (passed in as usb_dev_p). If so, stuff its value in u2d_dip_addr, 790Sstevel@tonic-gate * and terminate the walk. 800Sstevel@tonic-gate * 810Sstevel@tonic-gate * - dip_addr is the address in core of the dip currently being processed by the 820Sstevel@tonic-gate * walk 830Sstevel@tonic-gate * - local_dip is a pointer to a copy of the struct dev_info in local memory 840Sstevel@tonic-gate * - cb_data is the addr of the callback arg the walker was invoked with 850Sstevel@tonic-gate * (passed through transparently from walk invoker). 860Sstevel@tonic-gate * 870Sstevel@tonic-gate * Returns: 880Sstevel@tonic-gate * - WALK_NEXT on success (match not found yet) 890Sstevel@tonic-gate * - WALK_ERR on errors. 900Sstevel@tonic-gate * - WALK_DONE is returned, cb_data.found is set to TRUE, and 910Sstevel@tonic-gate * *cb_data.u2d_dip_addr is set to the matched dip addr if a dip corresponding 920Sstevel@tonic-gate * to the desired usba_device_t* is found. 930Sstevel@tonic-gate */ 940Sstevel@tonic-gate /*ARGSUSED*/ 950Sstevel@tonic-gate static int 960Sstevel@tonic-gate find_dip(uintptr_t dip_addr, const void *local_dip, void *cb_arg) 970Sstevel@tonic-gate { 980Sstevel@tonic-gate uintptr_t cur_usb_dev; 990Sstevel@tonic-gate usba_device2devinfo_cbdata_t *cb_data = 1000Sstevel@tonic-gate (usba_device2devinfo_cbdata_t *)cb_arg; 1010Sstevel@tonic-gate 1020Sstevel@tonic-gate if ((cur_usb_dev = mdb_usba_get_usba_device(dip_addr)) == NULL) { 1030Sstevel@tonic-gate /* 1040Sstevel@tonic-gate * If there's no corresponding usba_device_t, this dip isn't 1050Sstevel@tonic-gate * a usb node. Might be an sd node. Ignore it. 1060Sstevel@tonic-gate */ 1070Sstevel@tonic-gate 1080Sstevel@tonic-gate return (WALK_NEXT); 1090Sstevel@tonic-gate } 1100Sstevel@tonic-gate 1110Sstevel@tonic-gate if (cur_usb_dev == cb_data->u2d_target_usb_dev_p) { 1120Sstevel@tonic-gate *cb_data->u2d_dip_addr = dip_addr; 1130Sstevel@tonic-gate cb_data->u2d_found = TRUE; 1140Sstevel@tonic-gate 1150Sstevel@tonic-gate return (WALK_DONE); 1160Sstevel@tonic-gate } 1170Sstevel@tonic-gate 1180Sstevel@tonic-gate return (WALK_NEXT); 1190Sstevel@tonic-gate } 1200Sstevel@tonic-gate 1210Sstevel@tonic-gate 1220Sstevel@tonic-gate /* 1230Sstevel@tonic-gate * Given a usba_device pointer, figure out which dip is associated with it. 1240Sstevel@tonic-gate * Relies on usba_device.usb_root_hub_dip being accurate. 1250Sstevel@tonic-gate * 1260Sstevel@tonic-gate * - usb_dev_addr is a pointer to a usba_device_t in core. 1270Sstevel@tonic-gate * - dip_addr is the address of a uintptr_t to receive the address in core 1280Sstevel@tonic-gate * of the found dip (if any). 1290Sstevel@tonic-gate * 1300Sstevel@tonic-gate * Returns: 1310Sstevel@tonic-gate * 0 on success (no match found) 1320Sstevel@tonic-gate * 1 on success (match found) 1330Sstevel@tonic-gate * -1 on errors. 1340Sstevel@tonic-gate */ 1350Sstevel@tonic-gate static int 1360Sstevel@tonic-gate usba_device2dip(uintptr_t usb_dev_addr, uintptr_t *dip_addr) 1370Sstevel@tonic-gate { 1380Sstevel@tonic-gate usba_device_t usb_dev; 1390Sstevel@tonic-gate usba_device2devinfo_cbdata_t cb_data; 1400Sstevel@tonic-gate 1410Sstevel@tonic-gate /* 1420Sstevel@tonic-gate * Walk all USB children of the root hub devinfo. 1430Sstevel@tonic-gate * The callback func looks for a match on the usba_device address. 1440Sstevel@tonic-gate */ 1450Sstevel@tonic-gate cb_data.u2d_target_usb_dev_p = usb_dev_addr; 1460Sstevel@tonic-gate cb_data.u2d_dip_addr = dip_addr; 1470Sstevel@tonic-gate cb_data.u2d_found = FALSE; 1480Sstevel@tonic-gate 149*880Sfrits if (mdb_vread(&usb_dev, sizeof (usba_device_t), 1500Sstevel@tonic-gate usb_dev_addr) == -1) { 1510Sstevel@tonic-gate mdb_warn("failed to read usba_device struct"); 1520Sstevel@tonic-gate 1530Sstevel@tonic-gate return (-1); 1540Sstevel@tonic-gate } 1550Sstevel@tonic-gate 1560Sstevel@tonic-gate /* 1570Sstevel@tonic-gate * Walk devinfo children starting with the root hub node, 1580Sstevel@tonic-gate * looking for a match on the usba_device pointer (which is what 1590Sstevel@tonic-gate * find_dip does). 1600Sstevel@tonic-gate * Result is placed in cb_data.dip_addr. 1610Sstevel@tonic-gate */ 162*880Sfrits if (mdb_pwalk("devinfo_children", find_dip, &cb_data, 1630Sstevel@tonic-gate (uintptr_t)usb_dev.usb_root_hub_dip) != 0) { 1640Sstevel@tonic-gate mdb_warn("failed to walk devinfo_children"); 1650Sstevel@tonic-gate 1660Sstevel@tonic-gate return (-1); 1670Sstevel@tonic-gate } 1680Sstevel@tonic-gate 1690Sstevel@tonic-gate if (cb_data.u2d_found == TRUE) { 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate return (1); 1720Sstevel@tonic-gate } 1730Sstevel@tonic-gate 1740Sstevel@tonic-gate return (0); 1750Sstevel@tonic-gate } 1760Sstevel@tonic-gate 1770Sstevel@tonic-gate 1780Sstevel@tonic-gate /* 1790Sstevel@tonic-gate * Generic walker usba_list_entry_t walker. 1800Sstevel@tonic-gate * Works for any usba_list_entry_t list. 1810Sstevel@tonic-gate */ 1820Sstevel@tonic-gate int 1830Sstevel@tonic-gate usba_list_walk_init(mdb_walk_state_t *wsp) 1840Sstevel@tonic-gate { 1850Sstevel@tonic-gate /* Must have a start addr. */ 1860Sstevel@tonic-gate if (wsp->walk_addr == NULL) { 1870Sstevel@tonic-gate mdb_warn("not a global walk. Starting address required\n"); 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate return (WALK_ERR); 1900Sstevel@tonic-gate } 1910Sstevel@tonic-gate 1920Sstevel@tonic-gate return (WALK_NEXT); 1930Sstevel@tonic-gate } 1940Sstevel@tonic-gate 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate /* 1970Sstevel@tonic-gate * Generic list walker step routine. 1980Sstevel@tonic-gate * NOTE: multiple walkers share this routine. 1990Sstevel@tonic-gate */ 2000Sstevel@tonic-gate int 2010Sstevel@tonic-gate usba_list_walk_step(mdb_walk_state_t *wsp) 2020Sstevel@tonic-gate { 2030Sstevel@tonic-gate int status; 2040Sstevel@tonic-gate usba_list_entry_t list_entry; 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate if (mdb_vread(&list_entry, sizeof (usba_list_entry_t), 2070Sstevel@tonic-gate (uintptr_t)wsp->walk_addr) == -1) { 2080Sstevel@tonic-gate mdb_warn("failed to read usba_list_entry_t at %p", 2090Sstevel@tonic-gate wsp->walk_addr); 2100Sstevel@tonic-gate 2110Sstevel@tonic-gate return (WALK_ERR); 2120Sstevel@tonic-gate } 2130Sstevel@tonic-gate 2140Sstevel@tonic-gate status = wsp->walk_callback(wsp->walk_addr, &list_entry, 2150Sstevel@tonic-gate wsp->walk_cbdata); 2160Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)list_entry.next; 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate /* Check if we're at the last element */ 2190Sstevel@tonic-gate if (wsp->walk_addr == NULL) { 2200Sstevel@tonic-gate 2210Sstevel@tonic-gate return (WALK_DONE); 2220Sstevel@tonic-gate } 2230Sstevel@tonic-gate 2240Sstevel@tonic-gate return (status); 2250Sstevel@tonic-gate } 2260Sstevel@tonic-gate 2270Sstevel@tonic-gate 2280Sstevel@tonic-gate /* 2290Sstevel@tonic-gate * usb_pipe_handle walker 2300Sstevel@tonic-gate * Given a pointer to a usba_device_t, walk the array of endpoint 2310Sstevel@tonic-gate * pipe_handle lists. 2320Sstevel@tonic-gate * For each list, traverse the list, invoking the callback on each element. 2330Sstevel@tonic-gate * 2340Sstevel@tonic-gate * Note this function takes the address of a usba_device struct (which is 2350Sstevel@tonic-gate * easily obtainable), but actually traverses a sub-portion of the struct 2360Sstevel@tonic-gate * (which address is not so easily obtainable). 2370Sstevel@tonic-gate */ 2380Sstevel@tonic-gate int 2390Sstevel@tonic-gate usb_pipe_handle_walk_init(mdb_walk_state_t *wsp) 2400Sstevel@tonic-gate { 2410Sstevel@tonic-gate if (wsp->walk_addr == NULL) { 2420Sstevel@tonic-gate mdb_warn("not a global walk; usba_device_t required\n"); 2430Sstevel@tonic-gate 2440Sstevel@tonic-gate return (WALK_ERR); 2450Sstevel@tonic-gate } 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate wsp->walk_data = mdb_alloc((sizeof (usba_ph_impl_t)) * USBA_N_ENDPOINTS, 2480Sstevel@tonic-gate UM_SLEEP | UM_GC); 2490Sstevel@tonic-gate 2500Sstevel@tonic-gate /* 2510Sstevel@tonic-gate * Read the usb_ph_list array into local memory. 2520Sstevel@tonic-gate * Set start address to first element/endpoint in usb_pipehandle_list 2530Sstevel@tonic-gate */ 254*880Sfrits if (mdb_vread(wsp->walk_data, 2550Sstevel@tonic-gate (sizeof (usba_ph_impl_t)) * USBA_N_ENDPOINTS, 2560Sstevel@tonic-gate (uintptr_t)((size_t)(wsp->walk_addr) + 2570Sstevel@tonic-gate offsetof(usba_device_t, usb_ph_list))) == -1) { 2580Sstevel@tonic-gate mdb_warn("failed to read usb_pipehandle_list at %p", 2590Sstevel@tonic-gate wsp->walk_addr); 2600Sstevel@tonic-gate 2610Sstevel@tonic-gate return (WALK_ERR); 2620Sstevel@tonic-gate } 2630Sstevel@tonic-gate 2640Sstevel@tonic-gate wsp->walk_arg = 0; 2650Sstevel@tonic-gate 2660Sstevel@tonic-gate return (WALK_NEXT); 2670Sstevel@tonic-gate } 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate 2700Sstevel@tonic-gate int 2710Sstevel@tonic-gate usb_pipe_handle_walk_step(mdb_walk_state_t *wsp) 2720Sstevel@tonic-gate { 2730Sstevel@tonic-gate int status; 2740Sstevel@tonic-gate usba_ph_impl_t *impl_list = (usba_ph_impl_t *)(wsp->walk_data); 2750Sstevel@tonic-gate intptr_t index = (intptr_t)wsp->walk_arg; 2760Sstevel@tonic-gate 2770Sstevel@tonic-gate /* Find the first valid endpoint, starting from where we left off. */ 2780Sstevel@tonic-gate while ((index < USBA_N_ENDPOINTS) && 2790Sstevel@tonic-gate (impl_list[index].usba_ph_data == NULL)) { 2800Sstevel@tonic-gate index++; 2810Sstevel@tonic-gate } 2820Sstevel@tonic-gate 2830Sstevel@tonic-gate /* No more valid endpoints. */ 2840Sstevel@tonic-gate if (index >= USBA_N_ENDPOINTS) { 2850Sstevel@tonic-gate 2860Sstevel@tonic-gate return (WALK_DONE); 2870Sstevel@tonic-gate } 2880Sstevel@tonic-gate 2890Sstevel@tonic-gate status = wsp->walk_callback((uintptr_t)impl_list[index].usba_ph_data, 2900Sstevel@tonic-gate wsp->walk_data, wsp->walk_cbdata); 2910Sstevel@tonic-gate 2920Sstevel@tonic-gate /* Set up to start at next pipe handle next time. */ 2930Sstevel@tonic-gate wsp->walk_arg = (void *)(index + 1); 2940Sstevel@tonic-gate 2950Sstevel@tonic-gate return (status); 2960Sstevel@tonic-gate } 2970Sstevel@tonic-gate 2980Sstevel@tonic-gate 2990Sstevel@tonic-gate /* 3000Sstevel@tonic-gate * Given the address of a usba_pipe_handle_data_t, dump summary info. 3010Sstevel@tonic-gate */ 3020Sstevel@tonic-gate /*ARGSUSED*/ 3030Sstevel@tonic-gate int 3040Sstevel@tonic-gate usb_pipe_handle(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 3050Sstevel@tonic-gate { 3060Sstevel@tonic-gate char *dir, *type, *state; 3070Sstevel@tonic-gate usb_ep_descr_t ept_descr; 3080Sstevel@tonic-gate usba_pipe_handle_data_t pipe_handle; 3090Sstevel@tonic-gate usba_ph_impl_t ph_impl; 3100Sstevel@tonic-gate 3110Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC)) { 3120Sstevel@tonic-gate 3130Sstevel@tonic-gate return (DCMD_USAGE); 3140Sstevel@tonic-gate } 3150Sstevel@tonic-gate 3160Sstevel@tonic-gate if (mdb_vread(&pipe_handle, 3170Sstevel@tonic-gate sizeof (usba_pipe_handle_data_t), addr) == -1) { 3180Sstevel@tonic-gate mdb_warn("failed to read pipe handle at %p", addr); 3190Sstevel@tonic-gate 3200Sstevel@tonic-gate return (DCMD_ERR); 3210Sstevel@tonic-gate } 3220Sstevel@tonic-gate 3230Sstevel@tonic-gate if (mdb_vread(&ph_impl, sizeof (usba_ph_impl_t), 3240Sstevel@tonic-gate (uintptr_t)pipe_handle.p_ph_impl) == -1) { 3250Sstevel@tonic-gate state = "*******"; 3260Sstevel@tonic-gate } else { 3270Sstevel@tonic-gate switch (ph_impl.usba_ph_state) { 3280Sstevel@tonic-gate case USB_PIPE_STATE_CLOSED: 3290Sstevel@tonic-gate state = "CLOSED "; 3300Sstevel@tonic-gate break; 3310Sstevel@tonic-gate 3320Sstevel@tonic-gate case USB_PIPE_STATE_IDLE: 3330Sstevel@tonic-gate state = "IDLE "; 3340Sstevel@tonic-gate break; 3350Sstevel@tonic-gate 3360Sstevel@tonic-gate case USB_PIPE_STATE_ACTIVE: 3370Sstevel@tonic-gate state = "ACTIVE "; 3380Sstevel@tonic-gate break; 3390Sstevel@tonic-gate 3400Sstevel@tonic-gate case USB_PIPE_STATE_ERROR: 3410Sstevel@tonic-gate state = "ERROR "; 3420Sstevel@tonic-gate break; 3430Sstevel@tonic-gate 3440Sstevel@tonic-gate case USB_PIPE_STATE_CLOSING: 3450Sstevel@tonic-gate state = "CLOSING"; 3460Sstevel@tonic-gate break; 3470Sstevel@tonic-gate 3480Sstevel@tonic-gate default: 3490Sstevel@tonic-gate state = "ILLEGAL"; 3500Sstevel@tonic-gate break; 3510Sstevel@tonic-gate } 3520Sstevel@tonic-gate } 3530Sstevel@tonic-gate 3540Sstevel@tonic-gate bcopy(&pipe_handle.p_ep, &ept_descr, sizeof (usb_ep_descr_t)); 3550Sstevel@tonic-gate 3560Sstevel@tonic-gate if (DCMD_HDRSPEC(flags)) { 3570Sstevel@tonic-gate mdb_printf("\n %<u>%-3s %5s %3s %7s %-?s %-?s %-?s%</u>\n", 3580Sstevel@tonic-gate "EP", "TYPE ", "DIR", "STATE ", "P_HANDLE", "P_POLICY", 3590Sstevel@tonic-gate "EP DESCR"); 3600Sstevel@tonic-gate } 3610Sstevel@tonic-gate 3620Sstevel@tonic-gate dir = ((ept_descr.bEndpointAddress & USB_EP_DIR_MASK) & 3630Sstevel@tonic-gate USB_EP_DIR_IN) ? "In " : "Out"; 3640Sstevel@tonic-gate switch (ept_descr.bmAttributes & USB_EP_ATTR_MASK) { 3650Sstevel@tonic-gate case USB_EP_ATTR_CONTROL: 3660Sstevel@tonic-gate type = "Cntrl"; 3670Sstevel@tonic-gate break; 3680Sstevel@tonic-gate 3690Sstevel@tonic-gate case USB_EP_ATTR_ISOCH: 3700Sstevel@tonic-gate type = "Isoch"; 3710Sstevel@tonic-gate break; 3720Sstevel@tonic-gate 3730Sstevel@tonic-gate case USB_EP_ATTR_BULK: 3740Sstevel@tonic-gate type = "Bulk "; 3750Sstevel@tonic-gate break; 3760Sstevel@tonic-gate 3770Sstevel@tonic-gate case USB_EP_ATTR_INTR: 3780Sstevel@tonic-gate type = "Intr "; 3790Sstevel@tonic-gate break; 3800Sstevel@tonic-gate 3810Sstevel@tonic-gate default: 3820Sstevel@tonic-gate type = "*****"; 3830Sstevel@tonic-gate break; 3840Sstevel@tonic-gate } 3850Sstevel@tonic-gate 3860Sstevel@tonic-gate mdb_printf(" %3d %5s %3s %7s %-?p %-?p %-?p\n", 3870Sstevel@tonic-gate ept_descr.bEndpointAddress & USB_EP_NUM_MASK, type, dir, state, 3880Sstevel@tonic-gate addr, addr + offsetof(usba_pipe_handle_data_t, p_policy), 3890Sstevel@tonic-gate addr + offsetof(usba_pipe_handle_data_t, p_ep)); 3900Sstevel@tonic-gate 3910Sstevel@tonic-gate return (DCMD_OK); 3920Sstevel@tonic-gate } 3930Sstevel@tonic-gate 3940Sstevel@tonic-gate 3950Sstevel@tonic-gate /* 3960Sstevel@tonic-gate * usba_device walker: 3970Sstevel@tonic-gate * 3980Sstevel@tonic-gate * walks the chain of usba_device structs headed by usba_device_list in usba.c 3990Sstevel@tonic-gate * NOTE: It uses the generic list walk step routine usba_list_walk_step. 4000Sstevel@tonic-gate * No walk_fini routine is needed. 4010Sstevel@tonic-gate */ 4020Sstevel@tonic-gate int 4030Sstevel@tonic-gate usba_device_walk_init(mdb_walk_state_t *wsp) 4040Sstevel@tonic-gate { 4050Sstevel@tonic-gate usba_list_entry_t list_entry; 4060Sstevel@tonic-gate 4070Sstevel@tonic-gate if (wsp->walk_addr != NULL) { 4080Sstevel@tonic-gate mdb_warn( 4090Sstevel@tonic-gate "global walk only. Must be invoked without an address\n"); 4100Sstevel@tonic-gate 4110Sstevel@tonic-gate return (WALK_ERR); 4120Sstevel@tonic-gate } 4130Sstevel@tonic-gate 414*880Sfrits if (mdb_readvar(&list_entry, "usba_device_list") == -1) { 4150Sstevel@tonic-gate mdb_warn("failed to read usba_device_list"); 4160Sstevel@tonic-gate 4170Sstevel@tonic-gate return (WALK_ERR); 4180Sstevel@tonic-gate } 4190Sstevel@tonic-gate 4200Sstevel@tonic-gate /* List head is not part of usba_device_t, get first usba_device_t */ 4210Sstevel@tonic-gate wsp->walk_addr = (uintptr_t)list_entry.next; 4220Sstevel@tonic-gate 4230Sstevel@tonic-gate return (WALK_NEXT); 4240Sstevel@tonic-gate } 4250Sstevel@tonic-gate 4260Sstevel@tonic-gate 4270Sstevel@tonic-gate /* 4280Sstevel@tonic-gate * usba_device dcmd 4290Sstevel@tonic-gate * Given the address of a usba_device struct, dump summary info 4300Sstevel@tonic-gate * -v: Print more (verbose) info 4310Sstevel@tonic-gate * -p: Walk/dump all open pipes for this usba_device 4320Sstevel@tonic-gate */ 4330Sstevel@tonic-gate /*ARGSUSED*/ 4340Sstevel@tonic-gate int 4350Sstevel@tonic-gate usba_device(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 4360Sstevel@tonic-gate { 4370Sstevel@tonic-gate int status; 4380Sstevel@tonic-gate char pathname[MAXNAMELEN]; 4390Sstevel@tonic-gate char dname[MODMAXNAMELEN + 1] = "<unatt>"; /* Driver name */ 4400Sstevel@tonic-gate char drv_statep[MODMAXNAMELEN+ 10]; 4410Sstevel@tonic-gate uint_t usb_flag = NULL; 4420Sstevel@tonic-gate boolean_t no_driver_attached = FALSE; 4430Sstevel@tonic-gate uintptr_t dip_addr; 4440Sstevel@tonic-gate struct dev_info devinfo; 4450Sstevel@tonic-gate 4460Sstevel@tonic-gate if (!(flags & DCMD_ADDRSPEC)) { 4470Sstevel@tonic-gate /* Global walk */ 4480Sstevel@tonic-gate if (mdb_walk_dcmd("usba_device", "usba_device", argc, 4490Sstevel@tonic-gate argv) == -1) { 4500Sstevel@tonic-gate mdb_warn("failed to walk usba_device"); 4510Sstevel@tonic-gate 4520Sstevel@tonic-gate return (DCMD_ERR); 4530Sstevel@tonic-gate } 4540Sstevel@tonic-gate 4550Sstevel@tonic-gate return (DCMD_OK); 4560Sstevel@tonic-gate } 4570Sstevel@tonic-gate 4580Sstevel@tonic-gate if (mdb_getopts(argc, argv, 4590Sstevel@tonic-gate 'p', MDB_OPT_SETBITS, USB_DUMP_ACTIVE_PIPES, &usb_flag, 4600Sstevel@tonic-gate 'v', MDB_OPT_SETBITS, USB_DUMP_VERBOSE, &usb_flag, NULL) != argc) { 4610Sstevel@tonic-gate 4620Sstevel@tonic-gate return (DCMD_USAGE); 4630Sstevel@tonic-gate } 4640Sstevel@tonic-gate 4650Sstevel@tonic-gate if (usb_flag && !(DCMD_HDRSPEC(flags))) { 4660Sstevel@tonic-gate mdb_printf("\n"); 4670Sstevel@tonic-gate } 4680Sstevel@tonic-gate 4690Sstevel@tonic-gate if (DCMD_HDRSPEC(flags)) { 4700Sstevel@tonic-gate mdb_printf("%<u>%-15s %4s %-?s %-42s%</u>\n", 4710Sstevel@tonic-gate "NAME", "INST", "DIP", "PATH "); 4720Sstevel@tonic-gate } 4730Sstevel@tonic-gate 4740Sstevel@tonic-gate status = usba_device2dip(addr, &dip_addr); 4750Sstevel@tonic-gate /* 4760Sstevel@tonic-gate * -1 = error 4770Sstevel@tonic-gate * 0 = no error, no match 4780Sstevel@tonic-gate * 1 = no error, match 4790Sstevel@tonic-gate */ 4800Sstevel@tonic-gate if (status != 1) { 4810Sstevel@tonic-gate if (status == -1) { 4820Sstevel@tonic-gate mdb_warn("error looking for dip for usba_device %p", 4830Sstevel@tonic-gate addr); 4840Sstevel@tonic-gate } else { 4850Sstevel@tonic-gate mdb_warn("failed to find dip for usba_device %p\n", 4860Sstevel@tonic-gate addr); 4870Sstevel@tonic-gate } 4880Sstevel@tonic-gate mdb_warn("dip and statep unobtainable\n"); 4890Sstevel@tonic-gate 4900Sstevel@tonic-gate return (DCMD_ERR); 4910Sstevel@tonic-gate } 4920Sstevel@tonic-gate 4930Sstevel@tonic-gate /* Figure out what driver (name) is attached to this node. */ 4940Sstevel@tonic-gate (void) mdb_devinfo2driver(dip_addr, (char *)dname, sizeof (dname)); 4950Sstevel@tonic-gate 496*880Sfrits if (mdb_vread(&devinfo, sizeof (struct dev_info), 4970Sstevel@tonic-gate dip_addr) == -1) { 4980Sstevel@tonic-gate mdb_warn("failed to read devinfo"); 4990Sstevel@tonic-gate 5000Sstevel@tonic-gate return (DCMD_ERR); 5010Sstevel@tonic-gate } 5020Sstevel@tonic-gate 5030Sstevel@tonic-gate if (!(DDI_CF2(&devinfo))) { 5040Sstevel@tonic-gate no_driver_attached = TRUE; 5050Sstevel@tonic-gate } 5060Sstevel@tonic-gate 5070Sstevel@tonic-gate (void) mdb_ddi_pathname(dip_addr, pathname, sizeof (pathname)); 5080Sstevel@tonic-gate mdb_printf("%-15s %2d %-?p %s\n", dname, devinfo.devi_instance, 5090Sstevel@tonic-gate dip_addr, pathname); 5100Sstevel@tonic-gate 5110Sstevel@tonic-gate if (usb_flag & USB_DUMP_VERBOSE) { 5120Sstevel@tonic-gate int i; 5130Sstevel@tonic-gate uintptr_t statep = NULL; 5140Sstevel@tonic-gate char *string_descr; 5150Sstevel@tonic-gate char **config_cloud, **conf_str_descr; 5160Sstevel@tonic-gate usb_dev_descr_t usb_dev_descr; 5170Sstevel@tonic-gate usba_device_t usba_device_struct; 5180Sstevel@tonic-gate 519*880Sfrits if (mdb_vread(&usba_device_struct, 5200Sstevel@tonic-gate sizeof (usba_device_t), addr) == -1) { 5210Sstevel@tonic-gate mdb_warn("failed to read usba_device struct"); 5220Sstevel@tonic-gate 5230Sstevel@tonic-gate return (DCMD_ERR); 5240Sstevel@tonic-gate } 5250Sstevel@tonic-gate 5260Sstevel@tonic-gate mdb_printf(" usba_device: %-16p\n\n", (usba_device_t *)addr); 5270Sstevel@tonic-gate 5280Sstevel@tonic-gate if (mdb_vread(&usb_dev_descr, sizeof (usb_dev_descr), 5290Sstevel@tonic-gate (uintptr_t)usba_device_struct.usb_dev_descr) == -1) { 5300Sstevel@tonic-gate mdb_warn("failed to read usb_dev_descr_t struct"); 5310Sstevel@tonic-gate 5320Sstevel@tonic-gate return (DCMD_ERR); 5330Sstevel@tonic-gate } 5340Sstevel@tonic-gate 5350Sstevel@tonic-gate mdb_printf("\n idVendor: 0x%04x idProduct: 0x%04x " 5360Sstevel@tonic-gate "usb_addr: 0x%02x\n", usb_dev_descr.idVendor, 5370Sstevel@tonic-gate usb_dev_descr.idProduct, usba_device_struct.usb_addr); 5380Sstevel@tonic-gate 5390Sstevel@tonic-gate /* Get the string descriptor string into local space. */ 5400Sstevel@tonic-gate string_descr = (char *)mdb_alloc(USB_MAXSTRINGLEN, UM_GC); 5410Sstevel@tonic-gate 5420Sstevel@tonic-gate if (usba_device_struct.usb_mfg_str == NULL) { 5430Sstevel@tonic-gate (void) strcpy(string_descr, "<No Manufacturer String>"); 5440Sstevel@tonic-gate } else { 5450Sstevel@tonic-gate if (mdb_readstr(string_descr, USB_MAXSTRINGLEN, 5460Sstevel@tonic-gate (uintptr_t)usba_device_struct.usb_mfg_str) == -1) { 5470Sstevel@tonic-gate mdb_warn("failed to read manufacturer " 5480Sstevel@tonic-gate "string descriptor"); 5490Sstevel@tonic-gate (void) strcpy(string_descr, "???"); 5500Sstevel@tonic-gate } 5510Sstevel@tonic-gate } 5520Sstevel@tonic-gate mdb_printf("\n Manufacturer String:\t%s\n", string_descr); 5530Sstevel@tonic-gate 5540Sstevel@tonic-gate if (usba_device_struct.usb_product_str == NULL) { 5550Sstevel@tonic-gate (void) strcpy(string_descr, "<No Product String>"); 5560Sstevel@tonic-gate } else { 5570Sstevel@tonic-gate if (mdb_readstr(string_descr, USB_MAXSTRINGLEN, 5580Sstevel@tonic-gate (uintptr_t)usba_device_struct.usb_product_str) == 5590Sstevel@tonic-gate -1) { 5600Sstevel@tonic-gate mdb_warn("failed to read product string " 5610Sstevel@tonic-gate "descriptor"); 5620Sstevel@tonic-gate (void) strcpy(string_descr, "???"); 5630Sstevel@tonic-gate } 5640Sstevel@tonic-gate } 5650Sstevel@tonic-gate mdb_printf(" Product String:\t\t%s\n", string_descr); 5660Sstevel@tonic-gate 5670Sstevel@tonic-gate if (usba_device_struct.usb_serialno_str == NULL) { 5680Sstevel@tonic-gate (void) strcpy(string_descr, "<No SerialNumber String>"); 5690Sstevel@tonic-gate } else { 5700Sstevel@tonic-gate if (mdb_readstr(string_descr, USB_MAXSTRINGLEN, 5710Sstevel@tonic-gate (uintptr_t)usba_device_struct.usb_serialno_str) == 5720Sstevel@tonic-gate -1) { 5730Sstevel@tonic-gate mdb_warn("failed to read serial number string " 5740Sstevel@tonic-gate "descriptor"); 5750Sstevel@tonic-gate (void) strcpy(string_descr, "???"); 5760Sstevel@tonic-gate } 5770Sstevel@tonic-gate } 5780Sstevel@tonic-gate mdb_printf(" SerialNumber String:\t%s\n", string_descr); 5790Sstevel@tonic-gate 5800Sstevel@tonic-gate if (no_driver_attached) { 5810Sstevel@tonic-gate mdb_printf("\n"); 5820Sstevel@tonic-gate } else { 5830Sstevel@tonic-gate mdb_printf(" state_p: "); 5840Sstevel@tonic-gate 5850Sstevel@tonic-gate /* 5860Sstevel@tonic-gate * Given the dip, find the associated statep. The 5870Sstevel@tonic-gate * convention to generate this soft state anchor is: 5880Sstevel@tonic-gate * <driver_name>_statep 5890Sstevel@tonic-gate */ 5900Sstevel@tonic-gate (void) mdb_snprintf(drv_statep, sizeof (drv_statep), 5910Sstevel@tonic-gate "%s_statep", dname); 5920Sstevel@tonic-gate if (mdb_devinfo2statep(dip_addr, drv_statep, 5930Sstevel@tonic-gate &statep) == -1) { 5940Sstevel@tonic-gate mdb_warn("failed to find %s state struct for " 5950Sstevel@tonic-gate "dip %p", drv_statep, dip_addr); 5960Sstevel@tonic-gate 5970Sstevel@tonic-gate return (DCMD_ERR); 5980Sstevel@tonic-gate } 5990Sstevel@tonic-gate mdb_printf("%-?p\n", statep); 6000Sstevel@tonic-gate } 6010Sstevel@tonic-gate 6020Sstevel@tonic-gate config_cloud = (char **)mdb_alloc(sizeof (void *) * 6030Sstevel@tonic-gate usba_device_struct.usb_n_cfgs, UM_GC); 6040Sstevel@tonic-gate 6050Sstevel@tonic-gate conf_str_descr = (char **)mdb_alloc(sizeof (void *) * 6060Sstevel@tonic-gate usba_device_struct.usb_n_cfgs, UM_GC); 6070Sstevel@tonic-gate 6080Sstevel@tonic-gate if ((usba_device_struct.usb_cfg_array) && 6090Sstevel@tonic-gate (usba_device_struct.usb_cfg_str_descr)) { 6100Sstevel@tonic-gate if ((mdb_vread(config_cloud, sizeof (void *) * 6110Sstevel@tonic-gate usba_device_struct.usb_n_cfgs, 6120Sstevel@tonic-gate (uintptr_t)usba_device_struct.usb_cfg_array) == 6130Sstevel@tonic-gate -1) || (mdb_vread(conf_str_descr, sizeof (void *) 6140Sstevel@tonic-gate * usba_device_struct.usb_n_cfgs, (uintptr_t) 6150Sstevel@tonic-gate usba_device_struct.usb_cfg_str_descr)) == -1) { 6160Sstevel@tonic-gate 6170Sstevel@tonic-gate mdb_warn("failed to read config cloud pointers"); 6180Sstevel@tonic-gate 6190Sstevel@tonic-gate } else { 6200Sstevel@tonic-gate 6210Sstevel@tonic-gate mdb_printf("\n Device Config Clouds:\n" 6220Sstevel@tonic-gate " Index\tConfig\t\tConfiguration " 6230Sstevel@tonic-gate "String\n" 6240Sstevel@tonic-gate " -----\t------\t\t" 6250Sstevel@tonic-gate "--------------------\n"); 6260Sstevel@tonic-gate 6270Sstevel@tonic-gate for (i = 0; i < usba_device_struct.usb_n_cfgs; 6280Sstevel@tonic-gate i++) { 6290Sstevel@tonic-gate if (mdb_readstr(string_descr, 6300Sstevel@tonic-gate USB_MAXSTRINGLEN, 6310Sstevel@tonic-gate (uintptr_t)conf_str_descr[i]) == 6320Sstevel@tonic-gate -1) { 6330Sstevel@tonic-gate (void) strcpy(string_descr, 6340Sstevel@tonic-gate "<No Configuration " 6350Sstevel@tonic-gate "String>"); 6360Sstevel@tonic-gate } 6370Sstevel@tonic-gate mdb_printf(" %4d\t0x%p\t%s\n", i, 6380Sstevel@tonic-gate config_cloud[i], string_descr); 6390Sstevel@tonic-gate } 6400Sstevel@tonic-gate } 6410Sstevel@tonic-gate } 6420Sstevel@tonic-gate 6430Sstevel@tonic-gate mdb_printf("\n Active configuration index: %d\n", 6440Sstevel@tonic-gate usba_device_struct.usb_active_cfg_ndx); 6450Sstevel@tonic-gate } 6460Sstevel@tonic-gate 6470Sstevel@tonic-gate if (usb_flag & USB_DUMP_ACTIVE_PIPES) { 6480Sstevel@tonic-gate 6490Sstevel@tonic-gate if (mdb_pwalk_dcmd("usb_pipe_handle", "usb_pipe_handle", 6500Sstevel@tonic-gate 0, NULL, addr) == -1) { 6510Sstevel@tonic-gate mdb_warn("failed to walk usb_pipe_handle"); 6520Sstevel@tonic-gate return (DCMD_ERR); 6530Sstevel@tonic-gate } 6540Sstevel@tonic-gate } 6550Sstevel@tonic-gate 6560Sstevel@tonic-gate return (DCMD_OK); 6570Sstevel@tonic-gate } 6580Sstevel@tonic-gate 6590Sstevel@tonic-gate 6600Sstevel@tonic-gate /* 6610Sstevel@tonic-gate * Dump the contents of the usba_debug_buf, from the oldest to newest, 6620Sstevel@tonic-gate * wrapping around if necessary. 6630Sstevel@tonic-gate */ 6640Sstevel@tonic-gate /*ARGSUSED*/ 6650Sstevel@tonic-gate int 6660Sstevel@tonic-gate usba_debug_buf(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 6670Sstevel@tonic-gate { 6680Sstevel@tonic-gate char *debug_buf_addr; /* addr in core */ 6690Sstevel@tonic-gate char *local_debug_buf; /* local copy of buf */ 6700Sstevel@tonic-gate int debug_buf_size; 6710Sstevel@tonic-gate char *term_p; 6720Sstevel@tonic-gate int being_cleared; 6730Sstevel@tonic-gate 6740Sstevel@tonic-gate if (flags & DCMD_ADDRSPEC) { 6750Sstevel@tonic-gate 6760Sstevel@tonic-gate return (DCMD_USAGE); 6770Sstevel@tonic-gate } 6780Sstevel@tonic-gate 679*880Sfrits if (mdb_readvar(&being_cleared, "usba_clear_debug_buf_flag") == 6800Sstevel@tonic-gate -1) { 6810Sstevel@tonic-gate mdb_warn("failed to read usba_clear_debug_buf_flag"); 6820Sstevel@tonic-gate 6830Sstevel@tonic-gate return (DCMD_ERR); 6840Sstevel@tonic-gate } 6850Sstevel@tonic-gate if (being_cleared) { 6860Sstevel@tonic-gate 6870Sstevel@tonic-gate return (DCMD_OK); 6880Sstevel@tonic-gate } 6890Sstevel@tonic-gate 690*880Sfrits if (mdb_readvar(&debug_buf_addr, "usba_debug_buf") == -1) { 6910Sstevel@tonic-gate mdb_warn("failed to read usba_debug_buf"); 6920Sstevel@tonic-gate 6930Sstevel@tonic-gate return (DCMD_ERR); 6940Sstevel@tonic-gate } 6950Sstevel@tonic-gate 6960Sstevel@tonic-gate if (debug_buf_addr == NULL) { 6970Sstevel@tonic-gate mdb_warn("usba_debug_buf not allocated\n"); 6980Sstevel@tonic-gate 6990Sstevel@tonic-gate return (DCMD_OK); 7000Sstevel@tonic-gate } 7010Sstevel@tonic-gate 7020Sstevel@tonic-gate 703*880Sfrits if (mdb_readvar(&debug_buf_size, "usba_debug_buf_size") == -1) { 7040Sstevel@tonic-gate mdb_warn("failed to read usba_debug_buf_size"); 7050Sstevel@tonic-gate 7060Sstevel@tonic-gate return (DCMD_ERR); 7070Sstevel@tonic-gate } 7080Sstevel@tonic-gate 7090Sstevel@tonic-gate debug_buf_size += USB_DEBUG_SIZE_EXTRA_ALLOC; 7100Sstevel@tonic-gate local_debug_buf = (char *)mdb_alloc(debug_buf_size, UM_SLEEP | UM_GC); 7110Sstevel@tonic-gate 712*880Sfrits if ((mdb_vread(local_debug_buf, debug_buf_size, 7130Sstevel@tonic-gate (uintptr_t)debug_buf_addr)) == -1) { 7140Sstevel@tonic-gate mdb_warn("failed to read usba_debug_buf at %p", 7150Sstevel@tonic-gate local_debug_buf); 7160Sstevel@tonic-gate 7170Sstevel@tonic-gate return (DCMD_ERR); 7180Sstevel@tonic-gate } 7190Sstevel@tonic-gate local_debug_buf[debug_buf_size - 1] = '\0'; 7200Sstevel@tonic-gate 7210Sstevel@tonic-gate if (strlen(local_debug_buf) == NULL) { 7220Sstevel@tonic-gate 7230Sstevel@tonic-gate return (DCMD_OK); 7240Sstevel@tonic-gate } 7250Sstevel@tonic-gate 7260Sstevel@tonic-gate if ((term_p = strstr(local_debug_buf, ">>>>")) == NULL) { 7270Sstevel@tonic-gate mdb_warn("failed to find terminator \">>>>\"\n"); 7280Sstevel@tonic-gate 7290Sstevel@tonic-gate return (DCMD_ERR); 7300Sstevel@tonic-gate } 7310Sstevel@tonic-gate 7320Sstevel@tonic-gate /* 7330Sstevel@tonic-gate * Print the chunk of buffer from the terminator to the end. 7340Sstevel@tonic-gate * This will print a null string if no wrap has occurred yet. 7350Sstevel@tonic-gate */ 7360Sstevel@tonic-gate mdb_printf("%s", term_p+5); /* after >>>>\0 to end of buf */ 7370Sstevel@tonic-gate mdb_printf("%s\n", local_debug_buf); /* beg of buf to >>>>\0 */ 7380Sstevel@tonic-gate 7390Sstevel@tonic-gate return (DCMD_OK); 7400Sstevel@tonic-gate } 7410Sstevel@tonic-gate 7420Sstevel@tonic-gate /*ARGSUSED*/ 7430Sstevel@tonic-gate int 7440Sstevel@tonic-gate usba_clear_debug_buf( 7450Sstevel@tonic-gate uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) 7460Sstevel@tonic-gate { 7470Sstevel@tonic-gate int clear = 1; 7480Sstevel@tonic-gate 7490Sstevel@tonic-gate /* stop the tracing */ 7500Sstevel@tonic-gate if (mdb_writevar((void*)&clear, "usba_clear_debug_buf_flag") == -1) { 7510Sstevel@tonic-gate mdb_warn("failed to set usba_clear_debug_buf_flag"); 7520Sstevel@tonic-gate 7530Sstevel@tonic-gate return (DCMD_ERR); 7540Sstevel@tonic-gate } 7550Sstevel@tonic-gate 7560Sstevel@tonic-gate return (DCMD_OK); 7570Sstevel@tonic-gate } 7580Sstevel@tonic-gate 7590Sstevel@tonic-gate 7600Sstevel@tonic-gate /* 7610Sstevel@tonic-gate * MDB module linkage information: 7620Sstevel@tonic-gate * 7630Sstevel@tonic-gate * We declare a list of structures describing our dcmds, and a function 7640Sstevel@tonic-gate * named _mdb_init to return a pointer to our module information. 7650Sstevel@tonic-gate */ 7660Sstevel@tonic-gate static const mdb_dcmd_t dcmds[] = { 7670Sstevel@tonic-gate { "usb_pipe_handle", ":", 7680Sstevel@tonic-gate "print a usb_pipe_handle struct", usb_pipe_handle, NULL}, 7690Sstevel@tonic-gate { "usba_device", ": [-pv]", 7700Sstevel@tonic-gate "print summary info for a usba_device_t struct", usba_device, NULL}, 7710Sstevel@tonic-gate { "usba_debug_buf", NULL, 7720Sstevel@tonic-gate "print usba_debug_buf", usba_debug_buf, NULL}, 7730Sstevel@tonic-gate { "usba_clear_debug_buf", NULL, 7740Sstevel@tonic-gate "clear usba_debug_buf", usba_clear_debug_buf, NULL}, 7750Sstevel@tonic-gate { NULL } 7760Sstevel@tonic-gate }; 7770Sstevel@tonic-gate 7780Sstevel@tonic-gate static const mdb_walker_t walkers[] = { 7790Sstevel@tonic-gate /* Generic list walker. */ 7800Sstevel@tonic-gate { "usba_list_entry", "walk list of usba_list_entry_t structures", 7810Sstevel@tonic-gate usba_list_walk_init, usba_list_walk_step, NULL, NULL }, 7820Sstevel@tonic-gate { "usb_pipe_handle", "walk USB pipe handles, given a usba_device_t ptr", 7830Sstevel@tonic-gate usb_pipe_handle_walk_init, usb_pipe_handle_walk_step, NULL, NULL }, 7840Sstevel@tonic-gate { "usba_device", "walk global list of usba_device_t structures", 7850Sstevel@tonic-gate usba_device_walk_init, usba_list_walk_step, NULL, NULL }, 7860Sstevel@tonic-gate { NULL } 7870Sstevel@tonic-gate }; 7880Sstevel@tonic-gate 7890Sstevel@tonic-gate static const mdb_modinfo_t modinfo = { 7900Sstevel@tonic-gate MDB_API_VERSION, dcmds, walkers 7910Sstevel@tonic-gate }; 7920Sstevel@tonic-gate 7930Sstevel@tonic-gate const mdb_modinfo_t * 7940Sstevel@tonic-gate _mdb_init(void) 7950Sstevel@tonic-gate { 7960Sstevel@tonic-gate return (&modinfo); 7970Sstevel@tonic-gate } 798