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]
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <sys/kstat.h>
31 #include <sys/mdb_modapi.h>
33 #include <sys/sgenv.h>
37 * This dcmd returns the values of the tunable variables in the Serengeti
38 * environmental driver (SGENV).
42 sgenv_parameters(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
49 if ((flags
& DCMD_ADDRSPEC
) || argc
!= 0)
52 mdb_printf("SGENV tunable parameters:\n");
53 mdb_printf("=========================\n");
55 err
= mdb_readvar(&mbox_wait_time
, "sgenv_max_mbox_wait_time");
57 mdb_printf("sgenv_max_mbox_wait_time = %d seconds\n",
61 err
= mdb_readvar(&debug_flag
, "sgenv_debug");
63 mdb_printf("sgenv_debug = 0x%x\n", debug_flag
);
71 * This dcmd prints the values of some of the module specific
72 * variables in the Serengeti environmental driver (SGENV).
76 sgenv_variables(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
78 size_t env_cache_snapshot_size
;
79 int env_cache_updated
;
82 int board_cache_updated
;
83 int board_count_snapshot
;
85 int board_writer_count
;
91 if ((flags
& DCMD_ADDRSPEC
) || argc
!= 0)
94 mdb_printf("\nSGENV module variables:\n");
95 mdb_printf("=======================\n");
97 mdb_printf("\nEnvironmental variables:\n");
98 mdb_printf("------------------------\n");
99 rv
= mdb_readvar(&env_cache_updated
, "env_cache_updated");
100 if (rv
== sizeof (env_cache_updated
)) {
101 mdb_printf("env_cache_updated\t\t= %s\n",
102 (env_cache_updated
? "TRUE": "FALSE"));
105 rv
= mdb_readvar(&env_writer_count
, "env_writer_count");
106 if (rv
== sizeof (env_writer_count
)) {
107 mdb_printf("env_writer_count\t\t= %d\n", env_writer_count
);
110 rv
= mdb_readvar(&env_cache_snapshot_size
, "env_cache_snapshot_size");
111 if (rv
== sizeof (env_cache_snapshot_size
)) {
112 mdb_printf("env_cache_snapshot_size\t\t= %d\n",
113 env_cache_snapshot_size
);
116 mdb_printf("\nBoard info variables:\n");
117 mdb_printf("---------------------\n");
118 rv
= mdb_readvar(&board_cache_updated
, "board_cache_updated");
119 if (rv
== sizeof (board_cache_updated
)) {
120 mdb_printf("board_cache_updated\t\t= %s\n",
121 (board_cache_updated
? "TRUE": "FALSE"));
124 rv
= mdb_readvar(&board_writer_count
, "board_writer_count");
125 if (rv
== sizeof (board_writer_count
)) {
126 mdb_printf("board_writer_count\t\t= %d\n", board_writer_count
);
129 rv
= mdb_readvar(&board_count
, "board_count");
130 if (rv
== sizeof (board_count
)) {
131 mdb_printf("board_count\t\t\t= %d\n", board_count
);
134 rv
= mdb_readvar(&board_count_snapshot
, "board_count_snapshot");
135 if (rv
== sizeof (board_count_snapshot
)) {
136 mdb_printf("board_count_snapshot\t\t= %d\n",
137 board_count_snapshot
);
140 mdb_printf("\nError variables:\n");
141 mdb_printf("----------------\n");
142 rv
= mdb_readvar(&mbox_error_count
, "sgenv_mbox_error_count");
143 if (rv
== sizeof (mbox_error_count
)) {
144 mdb_printf("mbox_error_count\t\t= %d\n", mbox_error_count
);
154 sgenv_env_sensor(uintptr_t addr
, uint_t flags
, int argc
, const mdb_arg_t
*argv
)
160 if ((flags
& DCMD_ADDRSPEC
) == 0) {
161 mdb_warn("sgenv_env_sensor: requires an address");
165 rv
= mdb_vread(&value
, sizeof (env_sensor_t
), addr
);
166 if (rv
!= sizeof (env_sensor_t
)) {
167 mdb_warn("sgenv_env_sensor: Failed read on "
168 "address %ll#r", addr
);
171 mdb_printf("---------- struct_env_sensor @ %ll#r ----------\n", addr
);
173 mdb_printf("sd_id: %29ll#x\n", value
.sd_id
);
174 mdb_printf("sd_value: %26lld\n", value
.sd_value
);
175 mdb_printf("sd_lo: %29lld\n", value
.sd_lo
);
176 mdb_printf("sd_hi: %29lld\n", value
.sd_hi
);
177 mdb_printf("sd_lo_warn: %24lld\n", value
.sd_lo_warn
);
178 mdb_printf("sd_hi_warn: %24lld\n", value
.sd_hi_warn
);
179 mdb_printf("sd_status: %25ll#x\n", value
.sd_status
);
185 * MDB module linkage information:
188 static const mdb_dcmd_t dcmds
[] = {{
191 "print environmental driver tunable parameters",
196 "print environmental driver variables",
201 "print contents of environmental sesnor",
206 static const mdb_modinfo_t modinfo
= {
207 MDB_API_VERSION
, dcmds
, NULL
210 const mdb_modinfo_t
*