8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / mdb / sun4u / modules / serengeti / sgsbbc / sgsbbc.c
blobde6f69b1120c24f7cb9c0d1222827398f14a2a2d
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/mutex.h>
30 #include <sys/mdb_modapi.h>
31 #include <sys/sgsbbc_priv.h>
34 * Given the address of a soft state pointer for the SGSBBC driver,
35 * this function displays the values of selected fields.
37 * You have to specify the address of the soft state structure you
38 * want to decode. This dcmd does not automatically work that out
39 * for you. The contents of <sbbcp> points to the variable pointing
40 * to the soft state pointers.
42 * (ie. typing "**sbbcp/10J" at the mdb prompt will list the addresses
43 * of the first 10 soft state structures (if they exist).
45 * It can also be obtained using mdb's softstate dcmd.
46 * "*sbbcp::softstate 0 | ::sgsbbc_softstate"
48 /* ARGSUSED */
49 int
50 display_sbbc_softstate_t(uintptr_t addr, uint_t flags, int argc,
51 const mdb_arg_t *argv)
53 sbbc_softstate_t softp;
55 uint_t offset = 0; /* offset into soft state structure */
56 int rv; /* return value from mdb function */
59 * You have to specify the address of the soft state structure you
60 * want to decode. This dcmd does not automatically work that out.
62 if ((flags & DCMD_ADDRSPEC) == 0)
63 return (DCMD_ERR);
65 rv = mdb_vread(&softp, sizeof (sbbc_softstate_t), addr);
66 if (rv != sizeof (sbbc_softstate_t)) {
67 mdb_warn("sgsbbc soft_state: Failed read on %ll#r", addr);
68 return (DCMD_ERR);
71 mdb_printf("---------- sbbc_softstate_t @ %#lr ----------\n", addr);
73 offset = (int)(uintptr_t)&softp.dip - (int)(uintptr_t)&softp;
74 mdb_printf("%p: dip: %31ll#r\n", addr + offset, softp.dip);
76 offset = (int)(uintptr_t)&softp.sram - (int)(uintptr_t)&softp;
77 mdb_printf("%p: sram: %30ll#r\n", addr + offset, softp.sram);
79 offset = (int)(uintptr_t)&softp.sbbc_regs - (int)(uintptr_t)&softp;
80 mdb_printf("%p: sbbc_regs: %25ll#r\n", addr + offset, softp.sbbc_regs);
82 offset = (int)(uintptr_t)&softp.port_int_regs - (int)(uintptr_t)&softp;
83 mdb_printf("%p: port_int_regs: %21ll#r\n", addr + offset,
84 softp.port_int_regs);
86 offset = (int)(uintptr_t)&softp.epld_regs - (int)(uintptr_t)&softp;
87 mdb_printf("%p: epld_regs: %25p\n", addr + offset, softp.epld_regs);
89 offset = (int)(uintptr_t)&softp.sram_toc - (int)(uintptr_t)&softp;
90 mdb_printf("%p: sram_toc: %26d\n", addr + offset, softp.sram_toc);
92 offset = (int)(uintptr_t)&softp.sbbc_reg_handle1 -
93 (int)(uintptr_t)&softp;
94 mdb_printf("%p: sbbc_reg_handle1: %18ll#r\n", addr + offset,
95 softp.sbbc_reg_handle1);
97 offset = (int)(uintptr_t)&softp.sbbc_reg_handle2 -
98 (int)(uintptr_t)&softp;
99 mdb_printf("%p: sbbc_reg_handle2: %18ll#r\n", addr + offset,
100 softp.sbbc_reg_handle2);
102 offset = (int)(uintptr_t)&softp.inumber - (int)(uintptr_t)&softp;
103 mdb_printf("%p: inumber: %27ll#r\n", addr + offset, softp.inumber);
105 offset = (int)(uintptr_t)&softp.intr_hdlrs - (int)(uintptr_t)&softp;
106 mdb_printf("%p: intr_hdlrs: %24ll#r\n", addr + offset,
107 softp.intr_hdlrs);
109 offset = (int)(uintptr_t)&softp.suspended - (int)(uintptr_t)&softp;
110 mdb_printf("%p: suspended: %25ll#r\n", addr + offset, softp.suspended);
112 offset = (int)(uintptr_t)&softp.chosen - (int)(uintptr_t)&softp;
113 mdb_printf("%p: chosen: %28ll#r\n", addr + offset, softp.chosen);
115 return (DCMD_OK);
119 * MDB module linkage information:
122 static const mdb_dcmd_t dcmds[] = {{
123 "sgsbbc_softstate",
124 NULL,
125 "print SGSBBC mailbox driver softstate fields",
126 display_sbbc_softstate_t
127 }, { NULL }
130 static const mdb_modinfo_t modinfo = {
131 MDB_API_VERSION, dcmds, NULL
134 const mdb_modinfo_t *
135 _mdb_init(void)
137 return (&modinfo);