Merge remote-tracking branch 'hpa/master'
[syslinux.git] / com32 / hdt / hdt-menu-dmi.c
blob7a413a15030cece798a41a814b5ab7c192e206e9
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
12 * conditions:
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 * -----------------------------------------------------------------------
29 #include "hdt-menu.h"
31 /* Compute System main menu */
32 void compute_system(struct s_my_menu *menu, s_dmi * dmi)
34 char buffer[SUBMENULEN + 1];
35 char statbuffer[STATLEN + 1];
37 menu->menu = add_menu(" System ", -1);
38 menu->items_count = 0;
39 set_menu_pos(SUBMENU_Y, SUBMENU_X);
41 snprintf(buffer, sizeof buffer, "Vendor : %s", dmi->system.manufacturer);
42 snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
43 dmi->system.manufacturer);
44 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
45 menu->items_count++;
47 snprintf(buffer, sizeof buffer, "Product : %s", dmi->system.product_name);
48 snprintf(statbuffer, sizeof statbuffer, "Product Name: %s",
49 dmi->system.product_name);
50 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
51 menu->items_count++;
53 snprintf(buffer, sizeof buffer, "Version : %s", dmi->system.version);
54 snprintf(statbuffer, sizeof statbuffer, "Version: %s", dmi->system.version);
55 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
56 menu->items_count++;
58 snprintf(buffer, sizeof buffer, "Serial : %s", dmi->system.serial);
59 snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
60 dmi->system.serial);
61 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
62 menu->items_count++;
64 snprintf(buffer, sizeof buffer, "UUID : %s", dmi->system.uuid);
65 snprintf(statbuffer, sizeof statbuffer, "UUID: %s", dmi->system.uuid);
66 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
67 menu->items_count++;
69 snprintf(buffer, sizeof buffer, "Wakeup : %s", dmi->system.wakeup_type);
70 snprintf(statbuffer, sizeof statbuffer, "Wakeup Type: %s",
71 dmi->system.wakeup_type);
72 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
73 menu->items_count++;
75 snprintf(buffer, sizeof buffer, "SKU Number: %s", dmi->system.sku_number);
76 snprintf(statbuffer, sizeof statbuffer, "SKU Number: %s",
77 dmi->system.sku_number);
78 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
79 menu->items_count++;
81 snprintf(buffer, sizeof buffer, "Family : %s", dmi->system.family);
82 snprintf(statbuffer, sizeof statbuffer, "Family: %s", dmi->system.family);
83 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
84 menu->items_count++;
86 printf("MENU: System menu done (%d items)\n", menu->items_count);
89 /* Compute Chassis menu */
90 void compute_chassis(struct s_my_menu *menu, s_dmi * dmi)
92 char buffer[SUBMENULEN + 1];
93 char statbuffer[STATLEN + 1];
94 menu->menu = add_menu(" Chassis ", -1);
95 menu->items_count = 0;
96 set_menu_pos(SUBMENU_Y, SUBMENU_X);
98 snprintf(buffer, sizeof buffer, "Vendor : %s",
99 dmi->chassis.manufacturer);
100 snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
101 dmi->chassis.manufacturer);
102 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
103 menu->items_count++;
105 snprintf(buffer, sizeof buffer, "Type : %s", dmi->chassis.type);
106 snprintf(statbuffer, sizeof statbuffer, "Type: %s", dmi->chassis.type);
107 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
108 menu->items_count++;
110 snprintf(buffer, sizeof buffer, "Version : %s", dmi->chassis.version);
111 snprintf(statbuffer, sizeof statbuffer, "Version: %s",
112 dmi->chassis.version);
113 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
114 menu->items_count++;
116 snprintf(buffer, sizeof buffer, "Serial : %s", dmi->chassis.serial);
117 snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
118 dmi->chassis.serial);
119 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
120 menu->items_count++;
122 snprintf(buffer, sizeof buffer, "Asset Tag : %s",
123 del_multi_spaces(dmi->chassis.asset_tag));
124 snprintf(statbuffer, sizeof statbuffer, "Asset Tag: %s",
125 del_multi_spaces(dmi->chassis.asset_tag));
126 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
127 menu->items_count++;
129 snprintf(buffer, sizeof buffer, "Lock : %s", dmi->chassis.lock);
130 snprintf(statbuffer, sizeof statbuffer, "Lock: %s", dmi->chassis.lock);
131 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
132 menu->items_count++;
134 printf("MENU: Chassis menu done (%d items)\n", menu->items_count);
137 /* Compute BIOS menu */
138 void compute_bios(struct s_my_menu *menu, s_dmi * dmi)
140 char buffer[SUBMENULEN + 1];
141 char statbuffer[STATLEN + 1];
143 menu->menu = add_menu(" BIOS ", -1);
144 menu->items_count = 0;
145 set_menu_pos(SUBMENU_Y, SUBMENU_X);
147 snprintf(buffer, sizeof buffer, "Vendor : %s", dmi->bios.vendor);
148 snprintf(statbuffer, sizeof statbuffer, "Vendor: %s", dmi->bios.vendor);
149 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
150 menu->items_count++;
152 snprintf(buffer, sizeof buffer, "Version : %s", dmi->bios.version);
153 snprintf(statbuffer, sizeof statbuffer, "Version: %s", dmi->bios.version);
154 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
155 menu->items_count++;
157 snprintf(buffer, sizeof buffer, "Release : %s", dmi->bios.release_date);
158 snprintf(statbuffer, sizeof statbuffer, "Release Date: %s",
159 dmi->bios.release_date);
160 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
161 menu->items_count++;
163 snprintf(buffer, sizeof buffer, "Bios Rev. : %s", dmi->bios.bios_revision);
164 snprintf(statbuffer, sizeof statbuffer, "Bios Revision: %s",
165 dmi->bios.bios_revision);
166 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
167 menu->items_count++;
169 snprintf(buffer, sizeof buffer, "Fw. Rev. : %s",
170 dmi->bios.firmware_revision);
171 snprintf(statbuffer, sizeof statbuffer, "Firmware Revision : %s",
172 dmi->bios.firmware_revision);
173 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
175 printf("MENU: BIOS menu done (%d items)\n", menu->items_count);
178 /* Compute Motherboard main menu */
179 void compute_motherboard(struct s_my_menu *menu, s_dmi * dmi)
181 char buffer[SUBMENULEN + 1];
182 char statbuffer[STATLEN + 1];
184 menu->menu = add_menu(" Motherboard ", -1);
185 menu->items_count = 0;
186 set_menu_pos(SUBMENU_Y, SUBMENU_X);
188 snprintf(buffer, sizeof buffer, "Vendor : %s",
189 dmi->base_board.manufacturer);
190 snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
191 dmi->base_board.manufacturer);
192 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
193 menu->items_count++;
195 snprintf(buffer, sizeof buffer, "Product : %s",
196 dmi->base_board.product_name);
197 snprintf(statbuffer, sizeof statbuffer, "Product Name: %s",
198 dmi->base_board.product_name);
199 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
200 menu->items_count++;
202 snprintf(buffer, sizeof buffer, "Version : %s", dmi->base_board.version);
203 snprintf(statbuffer, sizeof statbuffer, "Version: %s",
204 dmi->base_board.version);
205 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
206 menu->items_count++;
208 snprintf(buffer, sizeof buffer, "Serial : %s", dmi->base_board.serial);
209 snprintf(statbuffer, sizeof statbuffer, "Serial Number: %s",
210 dmi->base_board.serial);
211 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
212 menu->items_count++;
214 snprintf(buffer, sizeof buffer, "Asset Tag : %s",
215 dmi->base_board.asset_tag);
216 snprintf(statbuffer, sizeof statbuffer, "Asset Tag: %s",
217 dmi->base_board.asset_tag);
218 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
219 menu->items_count++;
221 snprintf(buffer, sizeof buffer, "Location : %s", dmi->base_board.location);
222 snprintf(statbuffer, sizeof statbuffer, "Location: %s",
223 dmi->base_board.location);
224 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
225 menu->items_count++;
227 snprintf(buffer, sizeof buffer, "Type : %s", dmi->base_board.type);
228 snprintf(statbuffer, sizeof statbuffer, "Type: %s", dmi->base_board.type);
229 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
230 menu->items_count++;
232 printf("MENU: Motherboard menu done (%d items)\n", menu->items_count);
235 /* Compute Main IPMI menu */
236 void compute_ipmi(struct s_my_menu *menu, s_dmi * dmi)
238 char buffer[SUBMENULEN + 1];
239 char statbuffer[STATLEN + 1];
240 menu->menu = add_menu(" IPMI ", -1);
241 menu->items_count = 0;
242 set_menu_pos(SUBMENU_Y, SUBMENU_X);
244 snprintf(buffer, sizeof buffer, "Interface Type : %s",
245 dmi->ipmi.interface_type);
246 snprintf(statbuffer, sizeof statbuffer, "Interface Type: %s",
247 dmi->ipmi.interface_type);
248 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
249 menu->items_count++;
251 snprintf(buffer, sizeof buffer, "Spec. Version : %u.%u",
252 dmi->ipmi.major_specification_version,
253 dmi->ipmi.minor_specification_version);
254 snprintf(statbuffer, sizeof statbuffer, "Specification Version: %u.%u",
255 dmi->ipmi.major_specification_version,
256 dmi->ipmi.minor_specification_version);
257 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
258 menu->items_count++;
260 snprintf(buffer, sizeof buffer, "I2C Slave @ : 0x%02x",
261 dmi->ipmi.I2C_slave_address);
262 snprintf(statbuffer, sizeof statbuffer, "I2C Slave Address: 0x%02x",
263 dmi->ipmi.I2C_slave_address);
264 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
265 menu->items_count++;
267 snprintf(buffer, sizeof buffer, "NV Storage @ : %u",
268 dmi->ipmi.nv_address);
269 snprintf(statbuffer, sizeof statbuffer, "NV Storage Address: %u",
270 dmi->ipmi.nv_address);
271 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
272 menu->items_count++;
274 uint32_t high = dmi->ipmi.base_address >> 32;
275 uint32_t low = dmi->ipmi.base_address & 0xFFFF;
277 snprintf(buffer, sizeof buffer, "Base Address : %08X%08X",
278 high, (low & ~1));
279 snprintf(statbuffer, sizeof statbuffer, "Base Address : %08X%08X",
280 high, (low & ~1));
281 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
282 menu->items_count++;
284 snprintf(buffer, sizeof buffer, "IRQ : %d", dmi->ipmi.irq);
285 snprintf(statbuffer, sizeof statbuffer, "IRQ : %d", dmi->ipmi.irq);
286 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
287 menu->items_count++;
289 printf("MENU: IPMI menu done (%d items)\n", menu->items_count);
292 /* Compute Main Battery menu */
293 void compute_battery(struct s_my_menu *menu, s_dmi * dmi)
295 char buffer[SUBMENULEN + 1];
296 char statbuffer[STATLEN + 1];
297 menu->menu = add_menu(" Battery ", -1);
298 menu->items_count = 0;
299 set_menu_pos(SUBMENU_Y, SUBMENU_X);
301 snprintf(buffer, sizeof buffer, "Vendor : %s",
302 dmi->battery.manufacturer);
303 snprintf(statbuffer, sizeof statbuffer, "Vendor: %s",
304 dmi->battery.manufacturer);
305 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
306 menu->items_count++;
308 snprintf(buffer, sizeof buffer, "Manufacture Date: %s",
309 dmi->battery.manufacture_date);
310 snprintf(statbuffer, sizeof statbuffer, "Manufacture Date: %s",
311 dmi->battery.manufacture_date);
312 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
313 menu->items_count++;
315 snprintf(buffer, sizeof buffer, "Serial : %s",
316 dmi->battery.serial);
317 snprintf(statbuffer, sizeof statbuffer, "Serial: %s", dmi->battery.serial);
318 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
319 menu->items_count++;
321 snprintf(buffer, sizeof buffer, "Name : %s", dmi->battery.name);
322 snprintf(statbuffer, sizeof statbuffer, "Name: %s", dmi->battery.name);
323 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
324 menu->items_count++;
326 snprintf(buffer, sizeof buffer, "Chemistry : %s",
327 dmi->battery.chemistry);
328 snprintf(statbuffer, sizeof statbuffer, "Chemistry: %s",
329 dmi->battery.chemistry);
330 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
331 menu->items_count++;
333 snprintf(buffer, sizeof buffer, "Design Capacity : %s",
334 dmi->battery.design_capacity);
335 snprintf(statbuffer, sizeof statbuffer, "Design Capacity: %s",
336 dmi->battery.design_capacity);
337 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
338 menu->items_count++;
340 snprintf(buffer, sizeof buffer, "Design Voltage : %s",
341 dmi->battery.design_voltage);
342 snprintf(statbuffer, sizeof statbuffer, "Design Voltage : %s",
343 dmi->battery.design_voltage);
344 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
345 menu->items_count++;
347 snprintf(buffer, sizeof buffer, "SBDS : %s", dmi->battery.sbds);
348 snprintf(statbuffer, sizeof statbuffer, "SBDS: %s", dmi->battery.sbds);
349 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
350 menu->items_count++;
352 snprintf(buffer, sizeof buffer, "SBDS Manuf. Date: %s",
353 dmi->battery.sbds_manufacture_date);
354 snprintf(statbuffer, sizeof statbuffer, "SBDS Manufacture Date: %s",
355 dmi->battery.sbds_manufacture_date);
356 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
357 menu->items_count++;
359 snprintf(buffer, sizeof buffer, "SBDS Chemistry : %s",
360 dmi->battery.sbds_chemistry);
361 snprintf(statbuffer, sizeof statbuffer, "SBDS Chemistry : %s",
362 dmi->battery.sbds_chemistry);
363 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
364 menu->items_count++;
366 snprintf(buffer, sizeof buffer, "Maximum Error : %s",
367 dmi->battery.maximum_error);
368 snprintf(statbuffer, sizeof statbuffer, "Maximum Error (percent) : %s",
369 dmi->battery.maximum_error);
370 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
371 menu->items_count++;
373 snprintf(buffer, sizeof buffer, "OEM Info : %s",
374 dmi->battery.oem_info);
375 snprintf(statbuffer, sizeof statbuffer, "OEM Info: %s",
376 dmi->battery.oem_info);
377 add_item(buffer, statbuffer, OPT_INACTIVE, NULL, 0);
378 menu->items_count++;
380 printf("MENU: Battery menu done (%d items)\n", menu->items_count);