1 /* ----------------------------------------------------------------------- *
3 * Copyright 2009 Erwan Velu - All Rights Reserved
5 * Permission is hereby granted, free of charge, to any person
6 * obtaining a copy of this software and associated documentation
7 * files (the "Software"), to deal in the Software without
8 * restriction, including without limitation the rights to use,
9 * copy, modify, merge, publish, distribute, sublicense, and/or
10 * sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following
14 * The above copyright notice and this permission notice shall
15 * be included in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
19 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
21 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
22 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
26 * -----------------------------------------------------------------------
35 #include "hdt-common.h"
37 static void show_dmi_modules(int argc __unused
, char **argv __unused
,
38 struct s_hardware
*hardware
)
40 char available_dmi_commands
[1024];
42 memset(available_dmi_commands
, 0, sizeof(available_dmi_commands
));
44 more_printf("Available DMI modules on your system:\n");
45 if (hardware
->dmi
.base_board
.filled
== true)
46 more_printf("\t%s\n", CLI_DMI_BASE_BOARD
);
47 if (hardware
->dmi
.battery
.filled
== true)
48 more_printf("\t%s\n", CLI_DMI_BATTERY
);
49 if (hardware
->dmi
.bios
.filled
== true)
50 more_printf("\t%s\n", CLI_DMI_BIOS
);
51 if (hardware
->dmi
.chassis
.filled
== true)
52 more_printf("\t%s\n", CLI_DMI_CHASSIS
);
53 for (int i
= 0; i
< hardware
->dmi
.memory_count
; i
++) {
54 if (hardware
->dmi
.memory
[i
].filled
== true) {
55 more_printf("\tbank <number>\n");
59 for (int i
= 0; i
< hardware
->dmi
.memory_module_count
; i
++) {
60 if (hardware
->dmi
.memory_module
[i
].filled
== true) {
61 more_printf("\tmodule <number>\n");
65 if (hardware
->dmi
.processor
.filled
== true)
66 more_printf("\t%s\n", CLI_DMI_PROCESSOR
);
67 if (hardware
->dmi
.system
.filled
== true)
68 more_printf("\t%s\n", CLI_DMI_SYSTEM
);
69 if (hardware
->dmi
.ipmi
.filled
== true)
70 more_printf("\t%s\n", CLI_DMI_IPMI
);
71 if (hardware
->dmi
.cache_count
)
72 more_printf("\t%s\n", CLI_DMI_CACHE
);
73 if (strlen(hardware
->dmi
.oem_strings
))
74 more_printf("\t%s\n", CLI_DMI_OEM
);
75 if (hardware
->dmi
.hardware_security
.filled
)
76 more_printf("\t%s\n", CLI_DMI_SECURITY
);
79 static void show_dmi_base_board(int argc __unused
, char **argv __unused
,
80 struct s_hardware
*hardware
)
82 if (hardware
->dmi
.base_board
.filled
== false) {
83 more_printf("base_board information not found on your system, see "
84 "`show list' to see which module is available.\n");
88 more_printf("Base board\n");
89 more_printf(" Manufacturer : %s\n", hardware
->dmi
.base_board
.manufacturer
);
90 more_printf(" Product Name : %s\n", hardware
->dmi
.base_board
.product_name
);
91 more_printf(" Version : %s\n", hardware
->dmi
.base_board
.version
);
92 more_printf(" Serial : %s\n", hardware
->dmi
.base_board
.serial
);
93 more_printf(" Asset Tag : %s\n", hardware
->dmi
.base_board
.asset_tag
);
94 more_printf(" Location : %s\n", hardware
->dmi
.base_board
.location
);
95 more_printf(" Type : %s\n", hardware
->dmi
.base_board
.type
);
96 for (int i
= 0; i
< BASE_BOARD_NB_ELEMENTS
; i
++) {
97 if (((bool *) (&hardware
->dmi
.base_board
.features
))[i
] == true) {
98 more_printf(" %s\n", base_board_features_strings
[i
]);
102 for (unsigned int i
= 0;
104 sizeof hardware
->dmi
.base_board
.devices_information
/
105 sizeof *hardware
->dmi
.base_board
.devices_information
; i
++) {
106 if (strlen(hardware
->dmi
.base_board
.devices_information
[i
].type
)) {
107 more_printf("On Board Device #%u Information\n", i
)
108 more_printf(" Type : %s\n",
109 hardware
->dmi
.base_board
.devices_information
[i
].
111 more_printf(" Status : %s\n",
112 hardware
->dmi
.base_board
.devices_information
[i
].
113 status
? "Enabled" : "Disabled");
114 more_printf(" Description : %s\n",
115 hardware
->dmi
.base_board
.devices_information
[i
].
121 static void show_dmi_system(int argc __unused
, char **argv __unused
,
122 struct s_hardware
*hardware
)
124 if (hardware
->dmi
.system
.filled
== false) {
125 more_printf("system information not found on your system, see "
126 "`show list' to see which module is available.\n");
130 more_printf("System\n");
131 more_printf(" Manufacturer : %s\n", hardware
->dmi
.system
.manufacturer
);
132 more_printf(" Product Name : %s\n", hardware
->dmi
.system
.product_name
);
133 more_printf(" Version : %s\n", hardware
->dmi
.system
.version
);
134 more_printf(" Serial : %s\n", hardware
->dmi
.system
.serial
);
135 more_printf(" UUID : %s\n", hardware
->dmi
.system
.uuid
);
136 more_printf(" Wakeup Type : %s\n", hardware
->dmi
.system
.wakeup_type
);
137 more_printf(" SKU Number : %s\n", hardware
->dmi
.system
.sku_number
);
138 more_printf(" Family : %s\n", hardware
->dmi
.system
.family
);
140 if (strlen(hardware
->dmi
.system
.configuration_options
)) {
141 more_printf("System Configuration Options\n");
142 more_printf("%s\n", hardware
->dmi
.system
.configuration_options
);
145 if (hardware
->dmi
.system
.system_reset
.filled
) {
146 more_printf("System Reset\n");
147 more_printf(" Status : %s\n",
148 (hardware
->dmi
.system
.system_reset
.
149 status
? "Enabled" : "Disabled"));
150 more_printf(" Watchdog Timer : %s\n",
151 (hardware
->dmi
.system
.system_reset
.
152 watchdog
? "Present" : "Not Present"));
153 if (strlen(hardware
->dmi
.system
.system_reset
.boot_option
))
154 more_printf(" Boot Option : %s\n",
155 hardware
->dmi
.system
.system_reset
.boot_option
);
156 if (strlen(hardware
->dmi
.system
.system_reset
.boot_option_on_limit
))
157 more_printf(" Boot Option On Limit : %s\n",
158 hardware
->dmi
.system
.system_reset
.boot_option_on_limit
);
159 if (strlen(hardware
->dmi
.system
.system_reset
.reset_count
))
160 more_printf(" Reset Count : %s\n",
161 hardware
->dmi
.system
.system_reset
.reset_count
);
162 if (strlen(hardware
->dmi
.system
.system_reset
.reset_limit
))
163 more_printf(" Reset Limit : %s\n",
164 hardware
->dmi
.system
.system_reset
.reset_limit
);
165 if (strlen(hardware
->dmi
.system
.system_reset
.timer_interval
))
166 more_printf(" Timer Interval : %s\n",
167 hardware
->dmi
.system
.system_reset
.timer_interval
);
168 if (strlen(hardware
->dmi
.system
.system_reset
.timeout
))
169 more_printf(" Timeout : %s\n",
170 hardware
->dmi
.system
.system_reset
.timeout
);
173 more_printf("System Boot Information\n");
174 more_printf(" Status : %s\n",
175 hardware
->dmi
.system
.system_boot_status
);
178 static void show_dmi_bios(int argc __unused
, char **argv __unused
,
179 struct s_hardware
*hardware
)
181 if (hardware
->dmi
.bios
.filled
== false) {
182 more_printf("bios information not found on your system, see "
183 "`show list' to see which module is available.\n");
187 more_printf("BIOS\n");
188 more_printf(" Vendor : %s\n", hardware
->dmi
.bios
.vendor
);
189 more_printf(" Version : %s\n", hardware
->dmi
.bios
.version
);
190 more_printf(" Release Date : %s\n", hardware
->dmi
.bios
.release_date
);
191 more_printf(" Bios Revision : %s\n", hardware
->dmi
.bios
.bios_revision
);
192 if (strlen(hardware
->dmi
.bios
.firmware_revision
))
193 more_printf(" Firmware Revision : %s\n",
194 hardware
->dmi
.bios
.firmware_revision
);
195 more_printf(" Address : 0x%04X0\n", hardware
->dmi
.bios
.address
);
196 more_printf(" Runtime address : %u %s\n",
197 hardware
->dmi
.bios
.runtime_size
,
198 hardware
->dmi
.bios
.runtime_size_unit
);
199 more_printf(" Rom size : %u %s\n", hardware
->dmi
.bios
.rom_size
,
200 hardware
->dmi
.bios
.rom_size_unit
);
202 for (int i
= 0; i
< BIOS_CHAR_NB_ELEMENTS
; i
++) {
203 if (((bool *) (&hardware
->dmi
.bios
.characteristics
))[i
] == true) {
204 more_printf(" %s\n", bios_charac_strings
[i
]);
207 for (int i
= 0; i
< BIOS_CHAR_X1_NB_ELEMENTS
; i
++) {
208 if (((bool *) (&hardware
->dmi
.bios
.characteristics_x1
))[i
] == true) {
209 more_printf(" %s\n", bios_charac_x1_strings
[i
]);
213 for (int i
= 0; i
< BIOS_CHAR_X2_NB_ELEMENTS
; i
++) {
214 if (((bool *) (&hardware
->dmi
.bios
.characteristics_x2
))[i
] == true) {
215 more_printf(" %s\n", bios_charac_x2_strings
[i
]);
221 static void show_dmi_chassis(int argc __unused
, char **argv __unused
,
222 struct s_hardware
*hardware
)
224 if (hardware
->dmi
.chassis
.filled
== false) {
225 more_printf("chassis information not found on your system, see "
226 "`show list' to see which module is available.\n");
230 more_printf("Chassis\n");
231 more_printf(" Manufacturer : %s\n",
232 hardware
->dmi
.chassis
.manufacturer
);
233 more_printf(" Type : %s\n", hardware
->dmi
.chassis
.type
);
234 more_printf(" Lock : %s\n", hardware
->dmi
.chassis
.lock
);
235 more_printf(" Version : %s\n", hardware
->dmi
.chassis
.version
);
236 more_printf(" Serial : %s\n", hardware
->dmi
.chassis
.serial
);
237 more_printf(" Asset Tag : %s\n",
238 del_multi_spaces(hardware
->dmi
.chassis
.asset_tag
));
239 more_printf(" Boot up state : %s\n",
240 hardware
->dmi
.chassis
.boot_up_state
);
241 more_printf(" Power supply state : %s\n",
242 hardware
->dmi
.chassis
.power_supply_state
);
243 more_printf(" Thermal state : %s\n",
244 hardware
->dmi
.chassis
.thermal_state
);
245 more_printf(" Security Status : %s\n",
246 hardware
->dmi
.chassis
.security_status
);
247 more_printf(" OEM Information : %s\n",
248 hardware
->dmi
.chassis
.oem_information
);
249 more_printf(" Height : %u\n", hardware
->dmi
.chassis
.height
);
250 more_printf(" NB Power Cords : %u\n",
251 hardware
->dmi
.chassis
.nb_power_cords
);
254 static void show_dmi_ipmi(int argc __unused
, char **argv __unused
,
255 struct s_hardware
*hardware
)
257 if (hardware
->dmi
.ipmi
.filled
== false) {
258 more_printf("IPMI module not available\n");
262 more_printf("IPMI\n");
263 more_printf(" Interface Type : %s\n",
264 hardware
->dmi
.ipmi
.interface_type
);
265 more_printf(" Specification Ver. : %u.%u\n",
266 hardware
->dmi
.ipmi
.major_specification_version
,
267 hardware
->dmi
.ipmi
.minor_specification_version
);
268 more_printf(" I2C Slave Address : 0x%02x\n",
269 hardware
->dmi
.ipmi
.I2C_slave_address
);
270 more_printf(" Nv Storage Address : %u\n", hardware
->dmi
.ipmi
.nv_address
);
271 uint32_t high
= hardware
->dmi
.ipmi
.base_address
>> 32;
272 uint32_t low
= hardware
->dmi
.ipmi
.base_address
& 0xFFFF;
273 more_printf(" Base Address : %08X%08X\n", high
, (low
& ~1));
274 more_printf(" IRQ : %d\n", hardware
->dmi
.ipmi
.irq
);
277 static void show_dmi_battery(int argc __unused
, char **argv __unused
,
278 struct s_hardware
*hardware
)
280 if (hardware
->dmi
.battery
.filled
== false) {
281 more_printf("battery information not found on your system, see "
282 "`show list' to see which module is available.\n");
286 more_printf("Battery \n");
287 more_printf(" Vendor : %s\n",
288 hardware
->dmi
.battery
.manufacturer
);
289 more_printf(" Manufacture Date : %s\n",
290 hardware
->dmi
.battery
.manufacture_date
);
291 more_printf(" Serial : %s\n", hardware
->dmi
.battery
.serial
);
292 more_printf(" Name : %s\n", hardware
->dmi
.battery
.name
);
293 more_printf(" Chemistry : %s\n", hardware
->dmi
.battery
.chemistry
);
294 more_printf(" Design Capacity : %s\n",
295 hardware
->dmi
.battery
.design_capacity
);
296 more_printf(" Design Voltage : %s\n",
297 hardware
->dmi
.battery
.design_voltage
);
298 more_printf(" SBDS : %s\n", hardware
->dmi
.battery
.sbds
);
299 more_printf(" SBDS Manuf. Date : %s\n",
300 hardware
->dmi
.battery
.sbds_manufacture_date
);
301 more_printf(" SBDS Chemistry : %s\n",
302 hardware
->dmi
.battery
.sbds_chemistry
);
303 more_printf(" Maximum Error : %s\n",
304 hardware
->dmi
.battery
.maximum_error
);
305 more_printf(" OEM Info : %s\n", hardware
->dmi
.battery
.oem_info
);
308 static void show_dmi_cpu(int argc __unused
, char **argv __unused
,
309 struct s_hardware
*hardware
)
311 if (hardware
->dmi
.processor
.filled
== false) {
312 more_printf("processor information not found on your system, see "
313 "`show list' to see which module is available.\n");
317 more_printf("CPU\n");
318 more_printf(" Socket Designation : %s\n",
319 hardware
->dmi
.processor
.socket_designation
);
320 more_printf(" Type : %s\n", hardware
->dmi
.processor
.type
);
321 more_printf(" Family : %s\n", hardware
->dmi
.processor
.family
);
322 more_printf(" Manufacturer : %s\n",
323 hardware
->dmi
.processor
.manufacturer
);
324 more_printf(" Version : %s\n", hardware
->dmi
.processor
.version
);
325 more_printf(" External Clock : %u\n",
326 hardware
->dmi
.processor
.external_clock
);
327 more_printf(" Max Speed : %u\n",
328 hardware
->dmi
.processor
.max_speed
);
329 more_printf(" Current Speed : %u\n",
330 hardware
->dmi
.processor
.current_speed
);
331 more_printf(" Cpu Type : %u\n",
332 hardware
->dmi
.processor
.signature
.type
);
333 more_printf(" Cpu Family : %u\n",
334 hardware
->dmi
.processor
.signature
.family
);
335 more_printf(" Cpu Model : %u\n",
336 hardware
->dmi
.processor
.signature
.model
);
337 more_printf(" Cpu Stepping : %u\n",
338 hardware
->dmi
.processor
.signature
.stepping
);
339 more_printf(" Cpu Minor Stepping : %u\n",
340 hardware
->dmi
.processor
.signature
.minor_stepping
);
341 // more_printf(" Voltage : %f\n",hardware->dmi.processor.voltage);
342 more_printf(" Status : %s\n", hardware
->dmi
.processor
.status
);
343 more_printf(" Upgrade : %s\n", hardware
->dmi
.processor
.upgrade
);
344 more_printf(" Cache L1 Handle : %s\n", hardware
->dmi
.processor
.cache1
);
345 more_printf(" Cache L2 Handle : %s\n", hardware
->dmi
.processor
.cache2
);
346 more_printf(" Cache L3 Handle : %s\n", hardware
->dmi
.processor
.cache3
);
347 more_printf(" Serial : %s\n", hardware
->dmi
.processor
.serial
);
348 more_printf(" Part Number : %s\n",
349 hardware
->dmi
.processor
.part_number
);
350 more_printf(" ID : %s\n", hardware
->dmi
.processor
.id
);
351 for (int i
= 0; i
< PROCESSOR_FLAGS_ELEMENTS
; i
++) {
352 if (((bool *) (&hardware
->dmi
.processor
.cpu_flags
))[i
] == true) {
353 more_printf(" %s\n", cpu_flags_strings
[i
]);
358 void show_dmi_memory_bank(int argc
, char **argv
, struct s_hardware
*hardware
)
362 /* Sanitize arguments */
364 bank
= strtol(argv
[0], (char **)NULL
, 10);
366 if (errno
== ERANGE
|| bank
< 0) {
367 more_printf("This bank number is incorrect\n");
371 if ((bank
>= hardware
->dmi
.memory_count
) || (bank
< 0)) {
372 more_printf("Bank %d number doesn't exist\n", bank
);
375 if (hardware
->dmi
.memory
[bank
].filled
== false) {
376 more_printf("Bank %d doesn't contain any information\n", bank
);
381 more_printf("Memory Bank %d\n", bank
);
382 more_printf(" Form Factor : %s\n", hardware
->dmi
.memory
[bank
].form_factor
);
383 more_printf(" Type : %s\n", hardware
->dmi
.memory
[bank
].type
);
384 more_printf(" Type Detail : %s\n", hardware
->dmi
.memory
[bank
].type_detail
);
385 more_printf(" Speed : %s\n", hardware
->dmi
.memory
[bank
].speed
);
386 more_printf(" Size : %s\n", hardware
->dmi
.memory
[bank
].size
);
387 more_printf(" Device Set : %s\n", hardware
->dmi
.memory
[bank
].device_set
);
388 more_printf(" Device Loc. : %s\n",
389 hardware
->dmi
.memory
[bank
].device_locator
);
390 more_printf(" Bank Locator : %s\n",
391 hardware
->dmi
.memory
[bank
].bank_locator
);
392 more_printf(" Total Width : %s\n", hardware
->dmi
.memory
[bank
].total_width
);
393 more_printf(" Data Width : %s\n", hardware
->dmi
.memory
[bank
].data_width
);
394 more_printf(" Error : %s\n", hardware
->dmi
.memory
[bank
].error
);
395 more_printf(" Vendor : %s\n",
396 hardware
->dmi
.memory
[bank
].manufacturer
);
397 more_printf(" Serial : %s\n", hardware
->dmi
.memory
[bank
].serial
);
398 more_printf(" Asset Tag : %s\n", hardware
->dmi
.memory
[bank
].asset_tag
);
399 more_printf(" Part Number : %s\n", hardware
->dmi
.memory
[bank
].part_number
);
402 static void show_dmi_cache(int argc
, char **argv
, struct s_hardware
*hardware
)
404 if (!hardware
->dmi
.cache_count
) {
405 more_printf("cache information not found on your system, see "
406 "`show list' to see which module is available.\n");
410 int cache
= strtol(argv
[0], NULL
, 10);
412 if (argc
!= 1 || cache
> hardware
->dmi
.cache_count
) {
413 more_printf("show cache [0-%d]\n", hardware
->dmi
.cache_count
- 1);
419 more_printf("Cache Information #%d\n", cache
);
420 more_printf(" Socket Designation : %s\n",
421 hardware
->dmi
.cache
[cache
].socket_designation
);
422 more_printf(" Configuration : %s\n",
423 hardware
->dmi
.cache
[cache
].configuration
);
424 more_printf(" Operational Mode : %s\n",
425 hardware
->dmi
.cache
[cache
].mode
);
426 more_printf(" Location : %s\n",
427 hardware
->dmi
.cache
[cache
].location
);
428 more_printf(" Installed Size : %u KB",
429 hardware
->dmi
.cache
[cache
].installed_size
);
431 more_printf(" Maximum Size : %u KB",
432 hardware
->dmi
.cache
[cache
].max_size
);
434 more_printf(" Supported SRAM Types : %s",
435 hardware
->dmi
.cache
[cache
].supported_sram_types
);
437 more_printf(" Installed SRAM Type : %s",
438 hardware
->dmi
.cache
[cache
].installed_sram_types
);
440 more_printf(" Speed : %u ns",
441 hardware
->dmi
.cache
[cache
].speed
);
443 more_printf(" Error Correction Type : %s\n",
444 hardware
->dmi
.cache
[cache
].error_correction_type
);
445 more_printf(" System Type : %s\n",
446 hardware
->dmi
.cache
[cache
].system_type
);
447 more_printf(" Associativity : %s\n",
448 hardware
->dmi
.cache
[cache
].associativity
);
451 void show_dmi_memory_module(int argc
, char **argv
, struct s_hardware
*hardware
)
455 /* Sanitize arguments */
457 module
= strtol(argv
[0], (char **)NULL
, 10);
459 if (errno
== ERANGE
|| module
< 0) {
460 more_printf("This module number is incorrect\n");
464 if ((module
>= hardware
->dmi
.memory_module_count
) || (module
< 0)) {
465 more_printf("Module number %d doesn't exist\n", module
);
469 if (hardware
->dmi
.memory_module
[module
].filled
== false) {
470 more_printf("Module %d doesn't contain any information\n", module
);
475 more_printf("Memory Module %d\n", module
);
476 more_printf(" Socket Designation : %s\n",
477 hardware
->dmi
.memory_module
[module
].socket_designation
);
478 more_printf(" Bank Connections : %s\n",
479 hardware
->dmi
.memory_module
[module
].bank_connections
);
480 more_printf(" Current Speed : %s\n",
481 hardware
->dmi
.memory_module
[module
].speed
);
482 more_printf(" Type : %s\n",
483 hardware
->dmi
.memory_module
[module
].type
);
484 more_printf(" Installed Size : %s\n",
485 hardware
->dmi
.memory_module
[module
].installed_size
);
486 more_printf(" Enabled Size : %s\n",
487 hardware
->dmi
.memory_module
[module
].enabled_size
);
488 more_printf(" Error Status : %s\n",
489 hardware
->dmi
.memory_module
[module
].error_status
);
492 void main_show_dmi(int argc __unused
, char **argv __unused
,
493 struct s_hardware
*hardware
)
496 detect_dmi(hardware
);
498 if (hardware
->is_dmi_valid
== false) {
499 more_printf("No valid DMI table found, exiting.\n");
503 more_printf("DMI Table version %u.%u found\n",
504 hardware
->dmi
.dmitable
.major_version
,
505 hardware
->dmi
.dmitable
.minor_version
);
507 show_dmi_modules(0, NULL
, hardware
);
510 void show_dmi_memory_modules(int argc __unused
, char **argv __unused
,
511 struct s_hardware
*hardware
)
513 /* Do we have so display unpopulated banks ? */
514 int show_free_banks
= 1;
516 /* Needed, if called by the memory mode */
517 detect_dmi(hardware
);
519 /* Detecting installed memory */
520 detect_memory(hardware
);
522 more_printf("Memory Size : %lu MB (%lu KB)\n",
523 (hardware
->detected_memory_size
+ (1 << 9)) >> 10,
524 hardware
->detected_memory_size
);
526 if ((hardware
->dmi
.memory_count
<= 0)
527 && (hardware
->dmi
.memory_module_count
<= 0)) {
528 more_printf("No memory bank found\n");
532 /* Sanitize arguments */
534 /* When we display a summary, there is no need to show the unpopulated banks
535 * The first argv is set to define this behavior
537 show_free_banks
= strtol(argv
[0], NULL
, 10);
538 if (errno
== ERANGE
|| show_free_banks
< 0 || show_free_banks
> 1)
543 /* If type 17 is available */
544 if (hardware
->dmi
.memory_count
> 0) {
545 char bank_number
[255];
546 more_printf("Memory Banks\n");
547 for (int i
= 0; i
< hardware
->dmi
.memory_count
; i
++) {
548 if (hardware
->dmi
.memory
[i
].filled
== true) {
549 memset(bank_number
, 0, sizeof(bank_number
));
550 snprintf(bank_number
, sizeof(bank_number
), "%d ", i
);
551 if (show_free_banks
== false) {
552 if (strncmp(hardware
->dmi
.memory
[i
].size
, "Free", 4))
553 more_printf(" bank %02d : %s %s@%s\n",
554 i
, hardware
->dmi
.memory
[i
].size
,
555 hardware
->dmi
.memory
[i
].type
,
556 hardware
->dmi
.memory
[i
].speed
);
558 more_printf(" bank %02d : %s %s@%s\n", i
,
559 hardware
->dmi
.memory
[i
].size
,
560 hardware
->dmi
.memory
[i
].type
,
561 hardware
->dmi
.memory
[i
].speed
);
565 } else if (hardware
->dmi
.memory_module_count
> 0) {
566 /* Let's use type 6 as a fallback of type 17 */
567 more_printf("Memory Modules\n");
568 for (int i
= 0; i
< hardware
->dmi
.memory_module_count
; i
++) {
569 if (hardware
->dmi
.memory_module
[i
].filled
== true) {
570 more_printf(" module %02d : %s %s@%s\n", i
,
571 hardware
->dmi
.memory_module
[i
].enabled_size
,
572 hardware
->dmi
.memory_module
[i
].type
,
573 hardware
->dmi
.memory_module
[i
].speed
);
579 //printf("Type 'show bank<bank_number>' for more details.\n");
582 more_printf("show memory <clear screen? <show free banks?>>\n");
586 void show_dmi_oem_strings(int argc __unused
, char **argv __unused
,
587 struct s_hardware
*hardware
)
591 if (strlen(hardware
->dmi
.oem_strings
))
592 more_printf("OEM Strings\n%s", hardware
->dmi
.oem_strings
);
595 void show_dmi_hardware_security(int argc __unused
, char **argv __unused
,
596 struct s_hardware
*hardware
)
600 if (!hardware
->dmi
.hardware_security
.filled
)
603 more_printf("Hardware Security\n");
604 more_printf(" Power-On Password Status : %s\n",
605 hardware
->dmi
.hardware_security
.power_on_passwd_status
);
606 more_printf(" Keyboard Password Status : %s\n",
607 hardware
->dmi
.hardware_security
.keyboard_passwd_status
);
608 more_printf(" Administrator Password Status : %s\n",
609 hardware
->dmi
.hardware_security
.administrator_passwd_status
);
610 more_printf(" Front Panel Reset Status : %s\n",
611 hardware
->dmi
.hardware_security
.front_panel_reset_status
);
614 struct cli_callback_descr list_dmi_show_modules
[] = {
616 .name
= CLI_DMI_BASE_BOARD
,
617 .exec
= show_dmi_base_board
,
620 .name
= CLI_DMI_BIOS
,
621 .exec
= show_dmi_bios
,
624 .name
= CLI_DMI_BATTERY
,
625 .exec
= show_dmi_battery
,
628 .name
= CLI_DMI_CHASSIS
,
629 .exec
= show_dmi_chassis
,
632 .name
= CLI_DMI_MEMORY
,
633 .exec
= show_dmi_memory_modules
,
636 .name
= CLI_DMI_MEMORY_BANK
,
637 .exec
= show_dmi_memory_bank
,
641 .exec
= show_dmi_memory_module
,
644 .name
= CLI_DMI_PROCESSOR
,
645 .exec
= show_dmi_cpu
,
648 .name
= CLI_DMI_SYSTEM
,
649 .exec
= show_dmi_system
,
653 .exec
= show_dmi_oem_strings
,
656 .name
= CLI_DMI_SECURITY
,
657 .exec
= show_dmi_hardware_security
,
660 .name
= CLI_DMI_IPMI
,
661 .exec
= show_dmi_ipmi
,
664 .name
= CLI_DMI_CACHE
,
665 .exec
= show_dmi_cache
,
668 .name
= CLI_DMI_LIST
,
669 .exec
= show_dmi_modules
,
677 struct cli_module_descr dmi_show_modules
= {
678 .modules
= list_dmi_show_modules
,
679 .default_callback
= main_show_dmi
,
682 struct cli_mode_descr dmi_mode
= {
685 .default_modules
= NULL
,
686 .show_modules
= &dmi_show_modules
,