Adding upstream version 3.50~pre5.
[syslinux-debian/hramrach.git] / com32 / modules / dmitest.c
blob1958eb3e484bb94a2f7b1212163ccf782f50584f
1 /* ----------------------------------------------------------------------- *
3 * Copyright 2006 Erwan Velu - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
14 * dmitest.c
16 * DMI demo program using libcom32
19 #include <string.h>
20 #include <stdio.h>
21 #include <console.h>
22 #include "dmi/dmi.h"
24 char display_line;
26 void display_bios(s_dmi *dmi) {
27 moreprintf("BIOS\n");
28 moreprintf("\tVendor: %s\n",dmi->bios.vendor);
29 moreprintf("\tVersion: %s\n",dmi->bios.version);
30 moreprintf("\tRelease: %s\n",dmi->bios.release_date);
31 moreprintf("\tBios Revision %s\n",dmi->bios.bios_revision);
32 moreprintf("\tFirmware Revision %s\n",dmi->bios.firmware_revision);
33 moreprintf("\tAddress: 0x%04X0\n",dmi->bios.address);
34 moreprintf("\tRuntime address: %u %s\n",dmi->bios.runtime_size,dmi->bios.runtime_size_unit);
35 moreprintf("\tRom size: %u %s\n",dmi->bios.rom_size,dmi->bios.rom_size_unit);
36 display_bios_characteristics(dmi);
39 void display_system(s_dmi *dmi) {
40 moreprintf("\nSystem\n");
41 moreprintf("\tManufacturer %s\n",dmi->system.manufacturer);
42 moreprintf("\tProduct Name %s\n",dmi->system.product_name);
43 moreprintf("\tVersion %s\n",dmi->system.version);
44 moreprintf("\tSerial %s\n",dmi->system.serial);
45 moreprintf("\tUUID %s\n",dmi->system.uuid);
46 moreprintf("\tWakeup Type %s\n",dmi->system.wakeup_type);
47 moreprintf("\tSKU Number %s\n",dmi->system.sku_number);
48 moreprintf("\tFamily %s\n",dmi->system.family);
51 void display_base_board(s_dmi *dmi) {
52 moreprintf("Base board\n");
53 moreprintf("\tManufacturer %s\n",dmi->base_board.manufacturer);
54 moreprintf("\tProduct Name %s\n",dmi->base_board.product_name);
55 moreprintf("\tVersion %s\n",dmi->base_board.version);
56 moreprintf("\tSerial %s\n",dmi->base_board.serial);
57 moreprintf("\tAsset Tag %s\n",dmi->base_board.asset_tag);
58 moreprintf("\tLocation %s\n",dmi->base_board.location);
59 moreprintf("\tType %s\n",dmi->base_board.type);
60 display_base_board_features(dmi);
63 void display_chassis(s_dmi *dmi) {
64 moreprintf("\nChassis\n");
65 moreprintf("\tManufacturer %s\n",dmi->chassis.manufacturer);
66 moreprintf("\tType %s\n",dmi->chassis.type);
67 moreprintf("\tLock %s\n",dmi->chassis.lock);
68 moreprintf("\tVersion %s\n",dmi->chassis.version);
69 moreprintf("\tSerial %s\n",dmi->chassis.serial);
70 moreprintf("\tAsset Tag %s\n",dmi->chassis.asset_tag);
71 moreprintf("\tBoot up state %s\n",dmi->chassis.boot_up_state);
72 moreprintf("\tPower supply state %s\n",dmi->chassis.power_supply_state);
73 moreprintf("\tThermal state %s\n",dmi->chassis.thermal_state);
74 moreprintf("\tSecurity Status %s\n",dmi->chassis.security_status);
75 moreprintf("\tOEM Information %s\n",dmi->chassis.oem_information);
76 moreprintf("\tHeight %u\n",dmi->chassis.height);
77 moreprintf("\tNB Power Cords %u\n",dmi->chassis.nb_power_cords);
80 void display_cpu(s_dmi *dmi) {
81 moreprintf("\nCPU\n");
82 moreprintf("\tSocket Designation %s\n",dmi->processor.socket_designation);
83 moreprintf("\tType %s\n",dmi->processor.type);
84 moreprintf("\tFamily %s\n",dmi->processor.family);
85 moreprintf("\tManufacturer %s\n",dmi->processor.manufacturer);
86 moreprintf("\tVersion %s\n",dmi->processor.version);
87 moreprintf("\tExternal Clock %u\n",dmi->processor.external_clock);
88 moreprintf("\tMax Speed %u\n",dmi->processor.max_speed);
89 moreprintf("\tCurrent Speed %u\n",dmi->processor.current_speed);
90 moreprintf("\tCpu Type %u\n",dmi->processor.signature.type);
91 moreprintf("\tCpu Family %u\n",dmi->processor.signature.family);
92 moreprintf("\tCpu Model %u\n",dmi->processor.signature.model);
93 moreprintf("\tCpu Stepping %u\n",dmi->processor.signature.stepping);
94 moreprintf("\tCpu Minor Stepping %u\n",dmi->processor.signature.minor_stepping);
95 moreprintf("\tVoltage %f\n",dmi->processor.voltage);
96 moreprintf("\tStatus %s\n",dmi->processor.status);
97 moreprintf("\tUpgrade %s\n",dmi->processor.upgrade);
98 moreprintf("\tCache L1 Handle %s\n",dmi->processor.cache1);
99 moreprintf("\tCache L2 Handle %s\n",dmi->processor.cache2);
100 moreprintf("\tCache L3 Handle %s\n",dmi->processor.cache3);
101 moreprintf("\tSerial %s\n",dmi->processor.serial);
102 moreprintf("\tPart Number %s\n",dmi->processor.part_number);
103 moreprintf("\tID %s\n",dmi->processor.id);
104 display_processor_flags(dmi);
107 int main(void)
109 char buffer[1024];
110 s_dmi dmi;
111 openconsole(&dev_stdcon_r, &dev_stdcon_w);
113 if ( ! dmi_interate() ) {
114 printf("No DMI Structure found\n");
115 return -1;
118 parse_dmitable(&dmi);
120 for (;;) {
121 printf("Available commands are system, chassis, base_board, cpu, bios, all, exit\n");
122 printf("dmi: ");
123 fgets(buffer, sizeof buffer, stdin);
124 if ( !strncmp(buffer, "exit", 4) )
125 break;
126 if ( !strncmp(buffer, "system", 6) )
127 display_system(&dmi);
128 if ( !strncmp(buffer, "chassis", 6) )
129 display_chassis(&dmi);
130 if ( !strncmp(buffer, "base_board", 10) )
131 display_base_board(&dmi);
132 if ( !strncmp(buffer, "cpu", 3) )
133 display_cpu(&dmi);
134 if ( !strncmp(buffer, "bios", 4) )
135 display_bios(&dmi);
136 if ( !strncmp(buffer, "all", 3) ) {
137 display_bios(&dmi);
138 display_system(&dmi);
139 display_chassis(&dmi);
140 display_base_board(&dmi);
141 display_cpu(&dmi);
145 return 0;