dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / lib / fm / topo / libtopo / common / mktables.sh
blobb5e1f301549c3c77eac6046b96df55dcd02a9781
1 #!/bin/sh
4 # CDDL HEADER START
6 # The contents of this file are subject to the terms of the
7 # Common Development and Distribution License (the "License").
8 # You may not use this file except in compliance with the License.
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # CDDL HEADER END
24 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
25 # Use is subject to license terms.
29 # Construct translation tables for defines in libtopo.h to translate to readable
30 # strings.
33 if [ $# -ne 1 ]; then
34 echo >&2 "USAGE: $0 <path to libtopo.h>"
35 exit 1
38 if [ -r $1 ]; then
39 libtopo_h=$1
40 else
41 echo >&2 "USAGE: $0 <path to libtopo.h>"
42 echo >&2 "Make sure libtopo.h exists and is readable"
43 exit 1
46 echo "\
48 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
49 * Use is subject to license terms.
52 #include <libtopo.h>
53 #include \"topo_mod.h\"
54 #include \"topo_subr.h\""
57 # Sensor types.
59 echo "\ntopo_name_trans_t topo_sensor_type_table[] = {"
61 pattern="#define TOPO_SENSOR_TYPE_\([A-Z0-9_]*\).*\$"
62 replace=" { TOPO_SENSOR_TYPE_\1, \"\1\" },"
64 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
66 echo "\t{ 0, NULL }
67 };"
70 # Units
72 echo "\ntopo_name_trans_t topo_units_type_table[] = {"
74 pattern=" TOPO_SENSOR_UNITS_\([A-Z0-9_]*\).*\$"
75 replace=" { TOPO_SENSOR_UNITS_\1, \"\1\" },"
77 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
79 echo "\t{ 0, NULL }
80 };"
83 # Indicator (LED) types
85 echo "\ntopo_name_trans_t topo_led_type_table[] = {"
87 pattern=" TOPO_LED_TYPE_\([A-Z0-9_]*\).*\$"
88 replace=" { TOPO_LED_TYPE_\1, \"\1\" },"
90 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
92 echo "\t{ 0, NULL }
93 };"
96 # Indicator (LED) states
98 echo "\ntopo_name_trans_t topo_led_states_table[] = {"
100 pattern=" TOPO_LED_STATE_\([A-Z0-9_]*\).*\$"
101 replace=" { TOPO_LED_STATE_\1, \"\1\" },"
103 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
105 echo "\t{ 0, NULL }
109 # Discrete sensor states
111 echo "\ntopo_name_trans_t topo_sensor_states_physical_table[] = {"
113 pattern="#define TOPO_SENSOR_STATE_PHYSICAL_\([A-Z0-9_]*\).*\$"
114 replace=" { TOPO_SENSOR_STATE_PHYSICAL_\1, \"\1\" },"
116 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
118 echo "\t{ 0, NULL }
121 echo "\ntopo_name_trans_t topo_sensor_states_platform_table[] = {"
123 pattern="#define TOPO_SENSOR_STATE_PLATFORM_\([A-Z0-9_]*\).*\$"
124 replace=" { TOPO_SENSOR_STATE_PLATFORM_\1, \"\1\" },"
126 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
128 echo "\t{ 0, NULL }
131 echo "\ntopo_name_trans_t topo_sensor_states_processor_table[] = {"
133 pattern="#define TOPO_SENSOR_STATE_PROCESSOR_\([A-Z0-9_]*\).*\$"
134 replace=" { TOPO_SENSOR_STATE_PROCESSOR_\1, \"\1\" },"
136 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
138 echo "\t{ 0, NULL }
141 echo "\ntopo_name_trans_t topo_sensor_states_power_supply_table[] = {"
143 pattern="#define TOPO_SENSOR_STATE_POWER_SUPPLY_\([A-Z0-9_]*\).*\$"
144 replace=" { TOPO_SENSOR_STATE_POWER_SUPPLY_\1, \"\1\" },"
146 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
148 echo "\t{ 0, NULL }
151 echo "\ntopo_name_trans_t topo_sensor_states_power_unit_table[] = {"
153 pattern="#define TOPO_SENSOR_STATE_POWER_UNIT_\([A-Z0-9_]*\).*\$"
154 replace=" { TOPO_SENSOR_STATE_POWER_UNIT_\1, \"\1\" },"
156 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
158 echo "\t{ 0, NULL }
161 echo "\ntopo_name_trans_t topo_sensor_states_memory_table[] = {"
163 pattern="#define TOPO_SENSOR_STATE_MEMORY_\([A-Z0-9_]*\).*\$"
164 replace=" { TOPO_SENSOR_STATE_MEMORY_\1, \"\1\" },"
166 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
168 echo "\t{ 0, NULL }
171 echo "\ntopo_name_trans_t topo_sensor_states_bay_table[] = {"
173 pattern="#define TOPO_SENSOR_STATE_BAY_\([A-Z0-9_]*\).*\$"
174 replace=" { TOPO_SENSOR_STATE_BAY_\1, \"\1\" },"
176 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
178 echo "\t{ 0, NULL }
181 echo "\ntopo_name_trans_t topo_sensor_states_firmware_table[] = {"
183 pattern="#define TOPO_SENSOR_STATE_FIRMWARE_\([A-Z0-9_]*\).*\$"
184 replace=" { TOPO_SENSOR_STATE_FIRMWARE_\1, \"\1\" },"
186 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
188 echo "\t{ 0, NULL }
191 echo "\ntopo_name_trans_t topo_sensor_states_event_log_table[] = {"
193 pattern="#define TOPO_SENSOR_STATE_EVENT_LOG_\([A-Z0-9_]*\).*\$"
194 replace=" { TOPO_SENSOR_STATE_EVENT_LOG_\1, \"\1\" },"
196 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
198 echo "\t{ 0, NULL }
201 echo "\ntopo_name_trans_t topo_sensor_states_watchdog1_table[] = {"
203 pattern="#define TOPO_SENSOR_STATE_WATCHDOG_\([A-Z0-9_]*\).*\$"
204 replace=" { TOPO_SENSOR_STATE_WATCHDOG_\1, \"\1\" },"
206 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
208 echo "\t{ 0, NULL }
211 echo "\ntopo_name_trans_t topo_sensor_states_system_table[] = {"
213 pattern="#define TOPO_SENSOR_STATE_SYSTEM_\([A-Z0-9_]*\).*\$"
214 replace=" { TOPO_SENSOR_STATE_SYSTEM_\1, \"\1\" },"
216 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
218 echo "\t{ 0, NULL }
221 echo "\ntopo_name_trans_t topo_sensor_states_critical_table[] = {"
223 pattern="#define TOPO_SENSOR_STATE_CRITICAL_\([A-Z0-9_]*\).*\$"
224 replace=" { TOPO_SENSOR_STATE_CRITICAL_\1, \"\1\" },"
226 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
228 echo "\t{ 0, NULL }
231 echo "\ntopo_name_trans_t topo_sensor_states_button_table[] = {"
233 pattern="#define TOPO_SENSOR_STATE_BUTTON_\([A-Z0-9_]*\).*\$"
234 replace=" { TOPO_SENSOR_STATE_BUTTON_\1, \"\1\" },"
236 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
238 echo "\t{ 0, NULL }
241 echo "\ntopo_name_trans_t topo_sensor_states_cable_table[] = {"
243 pattern="#define TOPO_SENSOR_STATE_CABLE_\([A-Z0-9_]*\).*\$"
244 replace=" { TOPO_SENSOR_STATE_CABLE_\1, \"\1\" },"
246 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
248 echo "\t{ 0, NULL }
251 echo "\ntopo_name_trans_t topo_sensor_states_boot_state_table[] = {"
253 pattern="#define TOPO_SENSOR_STATE_BOOT_STATE_\([A-Z0-9_]*\).*\$"
254 replace=" { TOPO_SENSOR_STATE_BOOT_STATE_\1, \"\1\" },"
256 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
258 echo "\t{ 0, NULL }
261 echo "\ntopo_name_trans_t topo_sensor_states_boot_error_table[] = {"
263 pattern="#define TOPO_SENSOR_STATE_BOOT_ERROR_\([A-Z0-9_]*\).*\$"
264 replace=" { TOPO_SENSOR_STATE_BOOT_ERROR_\1, \"\1\" },"
266 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
268 echo "\t{ 0, NULL }
271 echo "\ntopo_name_trans_t topo_sensor_states_boot_os_table[] = {"
273 pattern="#define TOPO_SENSOR_STATE_BOOT_OS_\([A-Z0-9_]*\).*\$"
274 replace=" { TOPO_SENSOR_STATE_BOOT_OS_\1, \"\1\" },"
276 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
278 echo "\t{ 0, NULL }
281 echo "\ntopo_name_trans_t topo_sensor_states_os_table[] = {"
283 pattern="#define TOPO_SENSOR_STATE_OS_\([A-Z0-9_]*\).*\$"
284 replace=" { TOPO_SENSOR_STATE_OS_\1, \"\1\" },"
286 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
288 echo "\t{ 0, NULL }
291 echo "\ntopo_name_trans_t topo_sensor_states_slot_table[] = {"
293 pattern="#define TOPO_SENSOR_STATE_SLOT_\([A-Z0-9_]*\).*\$"
294 replace=" { TOPO_SENSOR_STATE_SLOT_\1, \"\1\" },"
296 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
298 echo "\t{ 0, NULL }
301 echo "\ntopo_name_trans_t topo_sensor_states_acpi_table[] = {"
303 pattern="#define TOPO_SENSOR_STATE_ACPI_\([A-Z0-9_]*\).*\$"
304 replace=" { TOPO_SENSOR_STATE_ACPI_\1, \"\1\" },"
306 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
308 echo "\t{ 0, NULL }
311 echo "\ntopo_name_trans_t topo_sensor_states_watchdog2_table[] = {"
313 pattern="#define TOPO_SENSOR_STATE_WATCHDOG2_\([A-Z0-9_]*\).*\$"
314 replace=" { TOPO_SENSOR_STATE_WATCHDOG2_\1, \"\1\" },"
316 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
318 echo "\t{ 0, NULL }
321 echo "\ntopo_name_trans_t topo_sensor_states_alert_table[] = {"
323 pattern="#define TOPO_SENSOR_STATE_ALERT_\([A-Z0-9_]*\).*\$"
324 replace=" { TOPO_SENSOR_STATE_ALERT_\1, \"\1\" },"
326 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
328 echo "\t{ 0, NULL }
331 echo "\ntopo_name_trans_t topo_sensor_states_presence_table[] = {"
333 pattern="#define TOPO_SENSOR_STATE_PRESENCE_\([A-Z0-9_]*\).*\$"
334 replace=" { TOPO_SENSOR_STATE_PRESENCE_\1, \"\1\" },"
336 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
338 echo "\t{ 0, NULL }
341 echo "\ntopo_name_trans_t topo_sensor_states_lan_table[] = {"
343 pattern="#define TOPO_SENSOR_STATE_LAN_\([A-Z0-9_]*\).*\$"
344 replace=" { TOPO_SENSOR_STATE_LAN_\1, \"\1\" },"
346 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
348 echo "\t{ 0, NULL }
351 echo "\ntopo_name_trans_t topo_sensor_states_health_table[] = {"
353 pattern="#define TOPO_SENSOR_STATE_HEALTH_\([A-Z0-9_]*\).*\$"
354 replace=" { TOPO_SENSOR_STATE_HEALTH_\1, \"\1\" },"
356 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
358 echo "\t{ 0, NULL }
361 echo "\ntopo_name_trans_t topo_sensor_states_battery_table[] = {"
363 pattern="#define TOPO_SENSOR_STATE_BATTERY_\([A-Z0-9_]*\).*\$"
364 replace=" { TOPO_SENSOR_STATE_BATTERY_\1, \"\1\" },"
366 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
368 echo "\t{ 0, NULL }
371 echo "\ntopo_name_trans_t topo_sensor_states_audit_table[] = {"
373 pattern="#define TOPO_SENSOR_STATE_AUDIT_\([A-Z0-9_]*\).*\$"
374 replace=" { TOPO_SENSOR_STATE_AUDIT_\1, \"\1\" },"
376 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
378 echo "\t{ 0, NULL }
381 echo "\ntopo_name_trans_t topo_sensor_states_version_table[] = {"
383 pattern="#define TOPO_SENSOR_STATE_VERSION_\([A-Z0-9_]*\).*\$"
384 replace=" { TOPO_SENSOR_STATE_VERSION_\1, \"\1\" },"
386 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
388 echo "\t{ 0, NULL }
391 echo "\ntopo_name_trans_t topo_sensor_states_fru_state_table[] = {"
393 pattern="#define TOPO_SENSOR_STATE_FRU_STATE_\([A-Z0-9_]*\).*\$"
394 replace=" { TOPO_SENSOR_STATE_FRU_STATE_\1, \"\1\" },"
396 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
398 echo "\t{ 0, NULL }
401 echo "\ntopo_name_trans_t topo_sensor_states_thresh_table[] = {"
403 pattern="#define TOPO_SENSOR_STATE_THRESH_\([A-Z0-9_]*\).*\$"
404 replace=" { TOPO_SENSOR_STATE_THRESH_\1, \"\1\" },"
406 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
408 echo "\t{ 0, NULL }
411 echo "\ntopo_name_trans_t topo_sensor_states_generic_usage_table[] = {"
413 pattern="#define TOPO_SENSOR_STATE_GENERIC_USAGE_\([A-Z0-9_]*\).*\$"
414 replace=" { TOPO_SENSOR_STATE_GENERIC_USAGE_\1, \"\1\" },"
416 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
418 echo "\t{ 0, NULL }
421 echo "\ntopo_name_trans_t topo_sensor_states_generic_state_table[] = {"
423 pattern="#define TOPO_SENSOR_STATE_GENERIC_STATE_\([A-Z0-9_]*\).*\$"
424 replace=" { TOPO_SENSOR_STATE_GENERIC_STATE_\1, \"\1\" },"
426 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
428 echo "\t{ 0, NULL }
432 echo "\ntopo_name_trans_t topo_sensor_states_generic_predfail_table[] = {"
434 pattern="#define TOPO_SENSOR_STATE_GENERIC_PREDFAIL_\([A-Z0-9_]*\).*\$"
435 replace=" { TOPO_SENSOR_STATE_GENERIC_PREDFAIL_\1, \"\1\" },"
437 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
439 echo "\t{ 0, NULL }
442 echo "\ntopo_name_trans_t topo_sensor_states_generic_limit_table[] = {"
444 pattern="#define TOPO_SENSOR_STATE_GENERIC_LIMIT_\([A-Z0-9_]*\).*\$"
445 replace=" { TOPO_SENSOR_STATE_GENERIC_LIMIT_\1, \"\1\" },"
447 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
449 echo "\t{ 0, NULL }
452 echo "\ntopo_name_trans_t topo_sensor_states_generic_perf_table[] = {"
454 pattern="#define TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_\([A-Z0-9_]*\).*\$"
455 replace=" { TOPO_SENSOR_STATE_GENERIC_PERFORMANCE_\1, \"\1\" },"
457 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
459 echo "\t{ 0, NULL }
462 echo "\ntopo_name_trans_t topo_sensor_states_severity_table[] = {"
464 pattern="#define TOPO_SENSOR_STATE_SEVERITY_\([A-Z0-9_]*\).*\$"
465 replace=" { TOPO_SENSOR_STATE_SEVERITY_\1, \"\1\" },"
467 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
469 echo "\t{ 0, NULL }
472 echo "\ntopo_name_trans_t topo_sensor_states_generic_presence_table[] = {"
474 pattern="#define TOPO_SENSOR_STATE_GENERIC_PRESENCE_\([A-Z0-9_]*\).*\$"
475 replace=" { TOPO_SENSOR_STATE_GENERIC_PRESENCE_\1, \"\1\" },"
477 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
479 echo "\t{ 0, NULL }
482 echo "\ntopo_name_trans_t topo_sensor_states_generic_avail_table[] = {"
484 pattern="#define TOPO_SENSOR_STATE_GENERIC_AVAILABILITY_\([A-Z0-9_]*\).*\$"
485 replace=" { TOPO_SENSOR_STATE_GENERIC_AVAILABILITY_\1, \"\1\" },"
487 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
489 echo "\t{ 0, NULL }
492 echo "\ntopo_name_trans_t topo_sensor_states_generic_status_table[] = {"
494 pattern="#define TOPO_SENSOR_STATE_GENERIC_STATUS_\([A-Z0-9_]*\).*\$"
495 replace=" { TOPO_SENSOR_STATE_GENERIC_STATUS_\1, \"\1\" },"
497 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
499 echo "\t{ 0, NULL }
502 echo "\ntopo_name_trans_t topo_sensor_states_generic_acpi_pwr_table[] = {"
504 pattern="#define TOPO_SENSOR_STATE_GENERIC_ACPI_PWR_STATE_\([A-Z0-9_]*\).*\$"
505 replace=" { TOPO_SENSOR_STATE_GENERIC_ACPI_PWR_STATE_\1, \"\1\" },"
507 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
509 echo "\t{ 0, NULL }
512 echo "\ntopo_name_trans_t topo_sensor_states_generic_failure_table[] = {"
514 pattern="#define TOPO_SENSOR_STATE_GENERIC_FAIL_\([A-Z0-9_]*\).*\$"
515 replace=" { TOPO_SENSOR_STATE_GENERIC_FAIL_\1, \"\1\" },"
517 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
519 echo "\t{ 0, NULL }
522 echo "\ntopo_name_trans_t topo_sensor_states_generic_ok_table[] = {"
524 pattern="#define TOPO_SENSOR_STATE_GENERIC_OK_\([A-Z0-9_]*\).*\$"
525 replace=" { TOPO_SENSOR_STATE_GENERIC_OK_\1, \"\1\" },"
527 cat $libtopo_h | sed -n "s/$pattern/$replace/p" || exit 1
529 echo "\t{ 0, NULL }