Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
smbios.h
Go to the documentation of this file.
1/* Copyright (C) 2022 Wildfire Games.
2 *
3 * Permission is hereby granted, free of charge, to any person obtaining
4 * a copy of this software and associated documentation files (the
5 * "Software"), to deal in the Software without restriction, including
6 * without limitation the rights to use, copy, modify, merge, publish,
7 * distribute, sublicense, and/or sell copies of the Software, and to
8 * permit persons to whom the Software is furnished to do so, subject to
9 * the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
18 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
19 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
20 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 */
22
23/*
24 * provide access to System Management BIOS information
25 */
26
27#ifndef INCLUDED_SMBIOS
28#define INCLUDED_SMBIOS
29
30namespace SMBIOS {
31
32// to introduce another enumeration:
33// 1) add its name and underlying type here
34// 2) define a <name>_ENUMERATORS macro specifying its enumerators
35// (prefer lower case to avoid conflicts with macros)
36#define ENUMERATIONS\
37 ENUMERATION(State, u8)\
38 ENUMERATION(ECC, u8)\
39 ENUMERATION(BiosFlags, u32)\
40 ENUMERATION(BiosFlags1, u8)\
41 ENUMERATION(BiosFlags2, u8)\
42 ENUMERATION(SystemWakeUpType, u8)\
43 ENUMERATION(BaseboardFlags, u8)\
44 ENUMERATION(BaseboardType, u8)\
45 ENUMERATION(ChassisType, u8)\
46 ENUMERATION(ChassisSecurityStatus, u8)\
47 ENUMERATION(ProcessorType, u8)\
48 ENUMERATION(ProcessorStatus, u8)\
49 ENUMERATION(ProcessorUpgrade, u8)\
50 ENUMERATION(ProcessorFlags, u16)\
51 ENUMERATION(CacheMode, u8)\
52 ENUMERATION(CacheLocation, u8)\
53 ENUMERATION(CacheConfigurationFlags, u16)\
54 ENUMERATION(CacheFlags, u16)\
55 ENUMERATION(CacheType, u8)\
56 ENUMERATION(CacheAssociativity, u8)\
57 ENUMERATION(PortConnectorType, u8)\
58 ENUMERATION(PortType, u8)\
59 ENUMERATION(SystemSlotType, u8)\
60 ENUMERATION(SystemSlotBusWidth, u8)\
61 ENUMERATION(SystemSlotUsage, u8)\
62 ENUMERATION(SystemSlotLength, u8)\
63 ENUMERATION(SystemSlotFlags1, u8)\
64 ENUMERATION(SystemSlotFlags2, u8)\
65 ENUMERATION(OnBoardDeviceType, u8)\
66 ENUMERATION(MemoryArrayLocation, u8)\
67 ENUMERATION(MemoryArrayUse, u8)\
68 ENUMERATION(MemoryDeviceFormFactor, u8)\
69 ENUMERATION(MemoryDeviceType, u8)\
70 ENUMERATION(MemoryDeviceTypeFlags, u16)\
71 ENUMERATION(PortableBatteryChemistry, u8)\
72 ENUMERATION(VoltageProbeLocation, u8)\
73 ENUMERATION(CoolingDeviceType, u8)\
74 ENUMERATION(TemperatureProbeLocation, u8)\
75 ENUMERATION(SystemBootStatus, u8)\
76 ENUMERATION(ManagementDeviceType, u8)\
77 ENUMERATION(ManagementDeviceAddressType, u8)\
78 ENUMERATION(SystemPowerSupplyCharacteristics, u16)\
79 ENUMERATION(SystemPowerSupplyType, u8)\
80 ENUMERATION(SystemPowerSupplyInputSwitching, u8)
81
82// to introduce another structure:
83// 1) add its name and ID here
84// 2) define a <name>_FIELDS macro specifying its fields
85// 3) (optional) add a specialization of Fixup
86#define STRUCTURES\
87 STRUCTURE(Bios, 0)\
88 STRUCTURE(System, 1)\
89 STRUCTURE(Baseboard, 2)\
90 STRUCTURE(Chassis, 3)\
91 STRUCTURE(Processor, 4)\
92 /* MemoryController (5) and MemoryModule (6) are obsolete */\
93 STRUCTURE(Cache, 7)\
94 STRUCTURE(PortConnector, 8)\
95 STRUCTURE(SystemSlot, 9)\
96 STRUCTURE(OnBoardDevices, 10)\
97 /* OemStrings (11), SystemConfiguration (12), BiosLanguage (13), GroupAssociations (14), SystemEventLog (15) are optional */\
98 STRUCTURE(MemoryArray, 16)\
99 STRUCTURE(MemoryDevice, 17)\
100 /* MemoryError32 (18) is optional */\
101 STRUCTURE(MemoryArrayMappedAddress, 19)\
102 STRUCTURE(MemoryDeviceMappedAddress, 20)\
103 /* PointingDevice (21) is optional */\
104 STRUCTURE(PortableBattery, 22)\
105 /* SystemReset (23), HardwareSecurity (24), SystemPowerControls (25) are optional */\
106 STRUCTURE(VoltageProbe, 26)\
107 STRUCTURE(CoolingDevice, 27)\
108 STRUCTURE(TemperatureProbe, 28)\
109 /* ElectricalCurrentProbe (29), OutOfBandRemoteAccess (30), BootIntegrityServices (31) are optional */\
110 STRUCTURE(SystemBoot, 32)\
111 STRUCTURE(ManagementDevice, 34)\
112 STRUCTURE(ManagementDeviceComponent, 35)\
113 STRUCTURE(ManagementDeviceThreshold, 36)\
114 STRUCTURE(SystemPowerSupply, 39)\
115 STRUCTURE(OnboardDevices2, 41)\
116 /* MemoryError64 (33), MemoryChannel (37), IpmiDevice (38) are optional */
117 /* Additional (40), ManagementControllerHostInterface (42) are optional */
118
119
120//-----------------------------------------------------------------------------
121// declarations required for the fields
122
123// indicates a field (:= member of a structure) is:
125{
126 // computed via other fields (i.e. should not be copied from the SMBIOS data).
128
129 // not intended for display / use by applications (usually because
130 // it is superseded by another - possibly derived - field).
132
133 // a number that should be displayed in hexadecimal form.
134 F_HEX = 4
136
137
138// (wrapper classes allow special handling of certain fields via
139// template specialization and function overloads)
140
141// size [bytes] - displayed with auto-range
142template<typename T>
143struct Size
144{
145 Size(): value(0) {}
148 operator T() const { return value; }
149};
150
151// SMBIOS structure handle - only displayed if meaningful
152struct Handle
153{
154 Handle(): value(0) {}
157};
158
159
160#define State_ENUMERATORS\
161 ENUM(other, 1)\
162 ENUM(unknown, 2)\
163 ENUM(ok, 3)\
164 ENUM(noncritical, 4)\
165 ENUM(critical, 5)\
166 ENUM(nonrecoverable, 6)
167
168#define ECC_ENUMERATORS\
169 ENUM(other, 1)\
170 ENUM(unknown, 2)\
171 ENUM(none, 3)\
172 ENUM(parity, 4)\
173 ENUM(single_bit, 5)\
174 ENUM(multiple_bit, 6)\
175 ENUM(crc, 7)
176
177
178#pragma pack(push, 1)
179
180
181//-----------------------------------------------------------------------------
182// Bios
183
184#define BiosFlags_ENUMERATORS\
185 ENUM(isa, 0x10)\
186 ENUM(mca, 0x20)\
187 ENUM(eisa, 0x40)\
188 ENUM(pci, 0x80)\
189 ENUM(pcmcia, 0x100)\
190 ENUM(plug_and_play, 0x200)\
191 ENUM(apm, 0x400)\
192 ENUM(upgradable, 0x800)\
193 ENUM(shadowing, 0x1000)\
194 ENUM(vl_vesa, 0x2000)\
195 ENUM(escd, 0x4000)\
196 ENUM(boot_cd, 0x8000)\
197 ENUM(selectable_boot, 0x10000)\
198 ENUM(socketed_rom, 0x20000)\
199 ENUM(boot_pcmcia, 0x40000)\
200 ENUM(edd, 0x80000)\
201 ENUM(int13a, 0x100000)\
202 ENUM(int13b, 0x200000)\
203 ENUM(int13c, 0x400000)\
204 ENUM(int13d, 0x800000)\
205 ENUM(int13e, 0x1000000)\
206 ENUM(int13f, 0x2000000)\
207 ENUM(int5, 0x4000000)\
208 ENUM(int9, 0x8000000)\
209 ENUM(int14, 0x10000000)\
210 ENUM(int17, 0x20000000)\
211 ENUM(int10, 0x40000000)\
212 ENUM(pc_98, 0x80000000)
213
214#define BiosFlags1_ENUMERATORS\
215 ENUM(acpi, 0x01)\
216 ENUM(usb_legacy, 0x02)\
217 ENUM(agp, 0x04)\
218 ENUM(boot_i2o, 0x08)\
219 ENUM(boot_ls_120, 0x10)\
220 ENUM(boot_zip_drive, 0x20)\
221 ENUM(boot_1394, 0x40)\
222 ENUM(smart_battery, 0x80)
223
224#define BiosFlags2_ENUMERATORS\
225 ENUM(bios_boot, 0x01)\
226 ENUM(function_key_boot, 0x02)\
227 ENUM(targeted_content_distribution, 0x04)\
228 ENUM(uefi, 0x08)\
229 ENUM(virtual_machine, 0x10)
230
231#define Bios_FIELDS\
232 FIELD(0, const char*, vendor, "")\
233 FIELD(0, const char*, version, "")\
234 FIELD(F_HEX, u16, startSegment, "")\
235 FIELD(0, const char*, releaseDate, "")\
236 FIELD(F_INTERNAL, u8, encodedSize, "")\
237 FIELD(0, BiosFlags, flags, "")\
238 FIELD(F_HEX, u32, vendorFlags, "")\
239 FIELD(0, BiosFlags1, flags1, "")\
240 FIELD(0, BiosFlags2, flags2, "")\
241 FIELD(F_DERIVED, Size<size_t>, size, "")
242
243
244//-----------------------------------------------------------------------------
245// System
246
247#define SystemWakeUpType_ENUMERATORS\
248 ENUM(other, 1)\
249 ENUM(unknown, 2)\
250 ENUM(apm_timer, 3)\
251 ENUM(modem_ring, 4)\
252 ENUM(lan_remote, 5)\
253 ENUM(power_switch, 6)\
254 ENUM(pci_pme, 7)\
255 ENUM(ac_power_restored, 8)
256
257#define System_FIELDS\
258 FIELD(0, const char*, manufacturer, "")\
259 FIELD(0, const char*, productName, "")\
260 FIELD(0, const char*, version, "")\
261 FIELD(0, const char*, serialNumber, "")\
262 FIELD(F_HEX, u64, uuid0, "")\
263 FIELD(F_HEX, u64, uuid1, "")\
264 FIELD(0, SystemWakeUpType, wakeUpType, "")\
265 FIELD(0, const char*, skuNumber, "")\
266 FIELD(0, const char*, m_Family, "")
267
268
269//-----------------------------------------------------------------------------
270// Baseboard
271
272#define BaseboardFlags_ENUMERATORS\
273 ENUM(motherboard, 0x01)\
274 ENUM(requires_add_in, 0x02)\
275 ENUM(removable, 0x04)\
276 ENUM(replaceable, 0x08)\
277 ENUM(hot_swappable, 0x10)
278
279#define BaseboardType_ENUMERATORS\
280 ENUM(other, 1)\
281 ENUM(unknown, 2)\
282 ENUM(blade, 3)\
283 ENUM(connectivity_switch, 4)\
284 ENUM(system_management, 5)\
285 ENUM(processor, 6)\
286 ENUM(io, 7)\
287 ENUM(memory, 8)\
288 ENUM(daughter, 9)\
289 ENUM(motherboard, 10)\
290 ENUM(processor_memory, 11)\
291 ENUM(processor_io, 12)\
292 ENUM(interconnect, 13)
293
294#define Baseboard_FIELDS\
295 FIELD(0, const char*, manufacturer, "")\
296 FIELD(0, const char*, product, "")\
297 FIELD(0, const char*, version, "")\
298 FIELD(0, const char*, serialNumber, "")\
299 FIELD(0, const char*, assetTag, "")\
300 FIELD(0, BaseboardFlags, flags, "")\
301 FIELD(0, const char*, location, "")\
302 FIELD(0, Handle, hChassis, "")\
303 FIELD(0, BaseboardType, type, "")\
304 /* omit subsequent fields because we can't handle the variable-length contained objects */
305
306
307//-----------------------------------------------------------------------------
308// Chassis
309
310#define ChassisType_ENUMERATORS\
311 ENUM(other, 1)\
312 ENUM(unknown, 2)\
313 ENUM(desktop, 3)\
314 ENUM(low_profile_desktop, 4)\
315 ENUM(pizza_box, 5)\
316 ENUM(mini_tower, 6)\
317 ENUM(tower, 7)\
318 ENUM(portable, 8)\
319 ENUM(laptop, 9)\
320 ENUM(notebook, 10)\
321 ENUM(handheld, 11)\
322 ENUM(docking_station, 12)\
323 ENUM(all_in_one, 13)\
324 ENUM(subnotebook, 14)\
325 ENUM(space_saving, 15)\
326 ENUM(lunchbox, 16)\
327 ENUM(main_server, 17)\
328 ENUM(expansion, 18)\
329 ENUM(sub, 19)\
330 ENUM(bus_expansion, 20)\
331 ENUM(peripheral, 21)\
332 ENUM(raid, 22)\
333 ENUM(rack_mount, 23)\
334 ENUM(sealed_case, 24)\
335 ENUM(multi_system, 25)\
336 ENUM(compact_pci, 26)\
337 ENUM(advanced_tca, 27)\
338 ENUM(blade, 28)\
339 ENUM(blade_enclosure, 29)
340
341#define ChassisSecurityStatus_ENUMERATORS\
342 ENUM(other, 1)\
343 ENUM(unknown, 2)\
344 ENUM(none, 3)\
345 ENUM(external_interface_locked, 4)\
346 ENUM(external_interface_enabled, 5)
347
348#define Chassis_FIELDS\
349 FIELD(0, const char*, manufacturer, "")\
350 FIELD(0, ChassisType, type, "")\
351 FIELD(0, const char*, version, "")\
352 FIELD(0, const char*, serialNumber, "")\
353 FIELD(0, const char*, assetTag, "")\
354 FIELD(0, State, state, "")\
355 FIELD(0, State, powerState, "")\
356 FIELD(0, State, thermalState, "")\
357 FIELD(0, ChassisSecurityStatus, securityStatus, "")\
358 FIELD(0, u32, oemDefined, "")\
359 FIELD(0, u8, height, "U")\
360 FIELD(0, u8, numPowerCords, "")\
361 /* omit subsequent fields because we can't handle the variable-length contained objects */
362
363
364//-----------------------------------------------------------------------------
365// Processor
366
367#define ProcessorType_ENUMERATORS\
368 ENUM(other, 1)\
369 ENUM(unknown, 2)\
370 ENUM(CPU, 3)\
371 ENUM(FPU, 4)\
372 ENUM(DSP, 5)\
373 ENUM(GPU, 6)
374
375#define ProcessorStatus_ENUMERATORS\
376 ENUM(unknown, 0)\
377 ENUM(other, 7)\
378 ENUM(enabled, 1)\
379 ENUM(user_disabled, 2)\
380 ENUM(post_disabled, 3)\
381 ENUM(idle, 4)
382
383#define ProcessorUpgrade_ENUMERATORS\
384 ENUM(other, 1)\
385 ENUM(unknown, 2)\
386 ENUM(daughter, 3)\
387 ENUM(zif, 4)\
388 ENUM(piggyback, 5)\
389 ENUM(none, 6)\
390 ENUM(lif, 7)\
391 ENUM(slot_1, 8)\
392 ENUM(slot_2, 9)\
393 ENUM(socket_370, 10)\
394 ENUM(slot_a, 11)\
395 ENUM(slot_m, 12)\
396 ENUM(socket_423, 13)\
397 ENUM(socket_a, 14)\
398 ENUM(socket_478, 15)\
399 ENUM(socket_754, 16)\
400 ENUM(socket_940, 17)\
401 ENUM(socket_939, 18)\
402 ENUM(socket_604, 19)\
403 ENUM(socket_771, 20)\
404 ENUM(socket_775, 21)\
405 ENUM(socket_s1, 22)\
406 ENUM(socket_am2, 23)\
407 ENUM(socket_1207, 24)\
408 ENUM(socket_1366, 25)\
409 ENUM(socket_g34, 26)\
410 ENUM(socket_am3, 27)\
411 ENUM(socket_c32, 28)\
412 ENUM(socket_1156, 29)\
413 ENUM(socket_1567, 30)\
414 ENUM(socket_988a, 31)\
415 ENUM(socket_1288, 32)\
416 ENUM(socket_988b, 33)\
417 ENUM(socket_1023, 34)\
418 ENUM(socket_1224, 35)\
419 ENUM(socket_1155, 36)\
420 ENUM(socket_1356, 37)\
421 ENUM(socket_2011, 38)\
422 ENUM(socket_fs1, 39)\
423 ENUM(socket_fs2, 40)\
424 ENUM(socket_fm1, 41)\
425 ENUM(socket_fm2, 42)
426
427#define ProcessorFlags_ENUMERATORS\
428 ENUM(unknown, 0x2)\
429 ENUM(x64, 0x4)\
430 ENUM(multi_core, 0x8)/* indicates cores are present, but they might be disabled*/\
431 ENUM(ht, 0x10)\
432 ENUM(execute_protection, 0x20)\
433 ENUM(enhanced_virtualization, 0x40)\
434 ENUM(power_control, 0x80)
435
436#define Processor_FIELDS\
437 FIELD(0, const char*, socket, "")\
438 FIELD(0, ProcessorType, type, "")\
439 FIELD(0, u8, m_Family, "") /* we don't bother providing enumerators for > 200 families */\
440 FIELD(0, const char*, manufacturer, "")\
441 FIELD(F_HEX, u64, id, "")\
442 FIELD(0, const char*, version, "")\
443 FIELD(0, u8, voltage, " dV")\
444 FIELD(0, u16, externalClockFrequency, " MHz")\
445 FIELD(0, u16, maxFrequency, " MHz")\
446 FIELD(0, u16, bootFrequency, " MHz")\
447 FIELD(0, ProcessorStatus, status, "")\
448 FIELD(0, ProcessorUpgrade, upgrade, "")\
449 FIELD(0, Handle, hL1, "")\
450 FIELD(0, Handle, hL2, "")\
451 FIELD(0, Handle, hL3, "")\
452 FIELD(0, const char*, serialNumber, "")\
453 FIELD(0, const char*, assetTag, "")\
454 FIELD(0, const char*, partNumber, "")\
455 FIELD(0, u8, coresPerPackage, "")\
456 FIELD(0, u8, enabledCores, "")\
457 FIELD(0, u8, logicalPerPackage, "")\
458 FIELD(0, ProcessorFlags, flags, "")\
459 FIELD(0, u16, family2, "")\
460 FIELD(F_DERIVED, bool, populated, "")
461
462
463//-----------------------------------------------------------------------------
464// Cache
465
466#define CacheMode_ENUMERATORS\
467 ENUM(write_through, 0)\
468 ENUM(write_back, 1)\
469 ENUM(varies, 2)\
470 ENUM(unknown, 3)
471
472#define CacheLocation_ENUMERATORS\
473 ENUM(internal, 0)\
474 ENUM(external, 1)\
475 ENUM(reserved, 2)\
476 ENUM(unknown, 3)
477
478#define CacheConfigurationFlags_ENUMERATORS\
479 ENUM(socketed, 0x08)\
480 ENUM(enabled, 0x80)
481
482#define CacheFlags_ENUMERATORS\
483 ENUM(other, 0x01)\
484 ENUM(unknown, 0x02)\
485 ENUM(non_burst, 0x04)\
486 ENUM(burst, 0x08)\
487 ENUM(pipeline_burst, 0x10)\
488 ENUM(synchronous, 0x20)\
489 ENUM(asynchronous, 0x40)
490
491#define CacheType_ENUMERATORS\
492 ENUM(other, 1)\
493 ENUM(unknown, 2)\
494 ENUM(instruction, 3)\
495 ENUM(data, 4)\
496 ENUM(unified, 5)
497
498#define CacheAssociativity_ENUMERATORS\
499 ENUM(other, 1)\
500 ENUM(unknown, 2)\
501 ENUM(direct_mapped, 3)\
502 ENUM(A2, 4)\
503 ENUM(A4, 5)\
504 ENUM(full, 6)\
505 ENUM(A8, 7)\
506 ENUM(A16, 8)\
507 ENUM(A12, 9)\
508 ENUM(A24, 10)\
509 ENUM(A32, 11)\
510 ENUM(A48, 12)\
511 ENUM(A64, 13)\
512 ENUM(A20, 14)
513
514#define Cache_FIELDS\
515 FIELD(0, const char*, designation, "")\
516 FIELD(0, CacheConfigurationFlags, configuration, "")\
517 FIELD(F_INTERNAL, u16, maxSize16, "")\
518 FIELD(F_INTERNAL, u16, installedSize16, "")\
519 FIELD(0, CacheFlags, supportedFlags, "")\
520 FIELD(0, CacheFlags, currentFlags, "")\
521 FIELD(0, u8, speed, " ns")\
522 FIELD(0, ECC, ecc, "")\
523 FIELD(0, CacheType, type, "")\
524 FIELD(0, CacheAssociativity, m_Associativity, "")\
525 FIELD(F_DERIVED, size_t, level, "") /* 1..8 */\
526 FIELD(F_DERIVED, CacheLocation, location, "")\
527 FIELD(F_DERIVED, CacheMode, mode, "")\
528 FIELD(F_DERIVED, Size<u64>, maxSize, "")\
529 FIELD(F_DERIVED, Size<u64>, installedSize, "")
530
531
532//-----------------------------------------------------------------------------
533// PortConnector
534
535#define PortConnectorType_ENUMERATORS\
536 ENUM(other, 255)\
537 ENUM(none, 0)\
538 ENUM(centronics, 1)\
539 ENUM(mini_centronics, 2)\
540 ENUM(proprietary, 3)\
541 ENUM(db25_male, 4)\
542 ENUM(db25_pin_female, 5)\
543 ENUM(db15_pin_male, 6)\
544 ENUM(db15_pin_female, 7)\
545 ENUM(db9_pin_male, 8)\
546 ENUM(db9_pin_female, 9)\
547 ENUM(rj11, 10)\
548 ENUM(rj45, 11)\
549 ENUM(mini_scsi, 12)\
550 ENUM(mini_din, 13)\
551 ENUM(micro_din, 14)\
552 ENUM(ps2, 15)\
553 ENUM(infrared, 16)\
554 ENUM(hp_hil, 17)\
555 ENUM(access_bus_usb, 18)\
556 ENUM(pc_ssa_scsi, 19)\
557 ENUM(din8_male, 20)\
558 ENUM(din8_female, 21)\
559 ENUM(on_board_ide, 22)\
560 ENUM(on_board_floppy, 23)\
561 ENUM(dual_inline_9, 24)\
562 ENUM(dual_inline_25, 25)\
563 ENUM(dual_inline_50, 26)\
564 ENUM(dual_inline_68, 27)\
565 ENUM(on_board_sound_input_from_cd, 28)\
566 ENUM(mini_centronics_14, 29)\
567 ENUM(mini_centronics_26, 30)\
568 ENUM(headphones, 31)\
569 ENUM(bnc, 32)\
570 ENUM(pc_firewire, 33)\
571 ENUM(sas_sata, 34)\
572 ENUM(pc_98, 160)\
573 ENUM(pc_98_hireso, 161)\
574 ENUM(pc_h98, 162)\
575 ENUM(pc_98_note, 163)\
576 ENUM(pc_98_full, 164)
577
578#define PortType_ENUMERATORS\
579 ENUM(other, 255)\
580 ENUM(none, 0)\
581 ENUM(parallel_xt_at, 1)\
582 ENUM(parallel_ps2, 2)\
583 ENUM(parallel_ecp, 3)\
584 ENUM(parallel_epp, 4)\
585 ENUM(parallel_ecepp, 5)\
586 ENUM(serial_xt_at, 6)\
587 ENUM(serial_16450, 7)\
588 ENUM(serial_16550, 8)\
589 ENUM(serial_16550a, 9)\
590 ENUM(scsi, 10)\
591 ENUM(midi, 11)\
592 ENUM(joystick, 12)\
593 ENUM(keyboard, 13)\
594 ENUM(mouse, 14)\
595 ENUM(ssa_scsi, 15)\
596 ENUM(usb, 16)\
597 ENUM(firewire, 17)\
598 ENUM(pcmcia_i, 18)\
599 ENUM(pcmcia_ii, 19)\
600 ENUM(pcmcia_iii, 20)\
601 ENUM(cardbus, 21)\
602 ENUM(access_bus, 22)\
603 ENUM(scsi_ii, 23)\
604 ENUM(scsi_wide, 24)\
605 ENUM(pc_98, 25)\
606 ENUM(pc_98_hireso, 26)\
607 ENUM(pc_h98, 27)\
608 ENUM(video, 28)\
609 ENUM(audio, 29)\
610 ENUM(modem, 30)\
611 ENUM(network, 31)\
612 ENUM(sata, 32)\
613 ENUM(sas, 33)\
614 ENUM(_8251_compatible, 160)\
615 ENUM(_8251_fifo_compatible, 161)
616
617#define PortConnector_FIELDS\
618 FIELD(0, const char*, internalDesignator, "")\
619 FIELD(0, PortConnectorType, internalConnectorType, "")\
620 FIELD(0, const char*, externalDesignator, "")\
621 FIELD(0, PortConnectorType, externalConnectorType, "")\
622 FIELD(0, PortType, portType, "")
623
624
625//-----------------------------------------------------------------------------
626// SystemSlot
627
628#define SystemSlotType_ENUMERATORS\
629 ENUM(other, 1)\
630 ENUM(unknown, 2)\
631 ENUM(isa, 3)\
632 ENUM(mca, 4)\
633 ENUM(eisa, 5)\
634 ENUM(pci, 6)\
635 ENUM(pcmcia, 7)\
636 ENUM(vesa, 8)\
637 ENUM(proprietary, 9)\
638 ENUM(processor, 10)\
639 ENUM(memory_card, 11)\
640 ENUM(io_riser, 12)\
641 ENUM(nubus, 13)\
642 ENUM(pci_66, 14)\
643 ENUM(agp, 15)\
644 ENUM(agp_2x, 16)\
645 ENUM(agp_4x, 17)\
646 ENUM(pcix, 18)\
647 ENUM(agp_8x, 19)\
648 ENUM(pc_98_c20, 160)\
649 ENUM(pc_98_c24, 161)\
650 ENUM(pc_98_e, 162)\
651 ENUM(pc_98_local_bus, 163)\
652 ENUM(pc_98_card, 164)\
653 ENUM(pcie, 165)\
654 ENUM(pcie_x1, 166)\
655 ENUM(pcie_x2, 167)\
656 ENUM(pcie_x4, 168)\
657 ENUM(pcie_x8, 169)\
658 ENUM(pcie_x16, 170)\
659 ENUM(pcie2, 171)\
660 ENUM(pcie2_x1, 172)\
661 ENUM(pcie2_x2, 173)\
662 ENUM(pcie2_x4, 174)\
663 ENUM(pcie2_x8, 175)\
664 ENUM(pcie2_x16, 176)\
665 ENUM(pcie3, 177)\
666 ENUM(pcie3_x1, 178)\
667 ENUM(pcie3_x2, 179)\
668 ENUM(pcie3_x4, 180)\
669 ENUM(pcie3_x8, 181)\
670 ENUM(pcie3_x16, 182)
671
672#define SystemSlotBusWidth_ENUMERATORS\
673 ENUM(other, 1)\
674 ENUM(unknown, 2)\
675 ENUM(_8, 3)\
676 ENUM(_16, 4)\
677 ENUM(_32, 5)\
678 ENUM(_64, 6)\
679 ENUM(_128, 7)\
680 ENUM(x1, 8)\
681 ENUM(x2, 9)\
682 ENUM(x4, 10)\
683 ENUM(x8, 11)\
684 ENUM(x12, 12)\
685 ENUM(x16, 13)\
686 ENUM(x32, 14)
687
688#define SystemSlotUsage_ENUMERATORS\
689 ENUM(other, 1)\
690 ENUM(unknown, 2)\
691 ENUM(available, 3)\
692 ENUM(in_use, 4)
693
694#define SystemSlotLength_ENUMERATORS\
695 ENUM(other, 1)\
696 ENUM(unknown, 2)\
697 ENUM(_short, 3)\
698 ENUM(_long, 4)
699
700#define SystemSlotFlags1_ENUMERATORS\
701 ENUM(unknown, 0x1)\
702 ENUM(v5, 0x2)\
703 ENUM(v3_3, 0x4)\
704 ENUM(shared, 0x8)\
705 ENUM(pc_card_16, 0x10)\
706 ENUM(pc_cardbus, 0x20)\
707 ENUM(pc_zoom_video, 0x40)\
708 ENUM(pc_modem_ring_resume, 0x80)
709
710#define SystemSlotFlags2_ENUMERATORS\
711 ENUM(pme, 0x1)\
712 ENUM(hot_plug, 0x2)\
713 ENUM(smbus, 0x4)\
714
715#define SystemSlot_FIELDS\
716 FIELD(0, const char*, designation, "")\
717 FIELD(0, SystemSlotType, type, "")\
718 FIELD(0, SystemSlotBusWidth, busWidth, "")\
719 FIELD(0, SystemSlotUsage, usage, "")\
720 FIELD(0, SystemSlotLength, length, "")\
721 FIELD(0, u16, id, "")\
722 FIELD(0, SystemSlotFlags1, flags1, "")\
723 FIELD(0, SystemSlotFlags2, flags2, "")\
724 FIELD(0, u16, segmentGroupNumber, "")\
725 FIELD(0, u8, busNumber, "")\
726 FIELD(F_INTERNAL, u8, functionAndDeviceNumber, "")\
727 FIELD(F_DERIVED, u8, deviceNumber, "")\
728 FIELD(F_DERIVED, u8, functionNumber, "")
729
730
731//-----------------------------------------------------------------------------
732// OnBoardDevices
733
734#define OnBoardDeviceType_ENUMERATORS\
735 ENUM(other, 1)\
736 ENUM(unknown, 2)\
737 ENUM(video, 3)\
738 ENUM(scsi_controller, 4)\
739 ENUM(ethernet, 5)\
740 ENUM(token_ring, 6)\
741 ENUM(sound, 7)\
742 ENUM(pata_controller, 8)\
743 ENUM(sata_controller, 9)\
744 ENUM(sas_controller, 10)
745
746#define OnBoardDevices_FIELDS\
747 FIELD(0, OnBoardDeviceType, type, "")\
748 FIELD(0, const char*, description, "")\
749 FIELD(F_DERIVED, bool, enabled, "")\
750 /* NB: this structure could contain any number of type/description pairs, but Dell BIOS only provides 1 */
751
752
753//-----------------------------------------------------------------------------
754// MemoryArray
755
756#define MemoryArrayLocation_ENUMERATORS\
757 ENUM(other, 1)\
758 ENUM(unknown, 2)\
759 ENUM(motherboard, 3)\
760 ENUM(isa_addon, 4)\
761 ENUM(eisa_addon, 5)\
762 ENUM(pci_addon, 6)\
763 ENUM(mca_addon, 7)\
764 ENUM(pcmcia_addon, 8)\
765 ENUM(proprietary_addon, 9)\
766 ENUM(nubus, 10)\
767 ENUM(pc_98_c20, 160)\
768 ENUM(pc_98_c24, 161)\
769 ENUM(pc_98_e, 162)\
770 ENUM(pc_98_local_bus, 163)
771
772#define MemoryArrayUse_ENUMERATORS\
773 ENUM(other, 1)\
774 ENUM(unknown, 2)\
775 ENUM(system, 3)\
776 ENUM(video, 4)\
777 ENUM(flash, 5)\
778 ENUM(nvram, 6)\
779 ENUM(cache, 7)
780
781#define MemoryArray_FIELDS\
782 FIELD(0, MemoryArrayLocation, location, "")\
783 FIELD(0, MemoryArrayUse, use, "")\
784 FIELD(0, ECC, ecc, "")\
785 FIELD(F_INTERNAL, u32, maxCapacity32, "")\
786 FIELD(0, Handle, hError, "")\
787 FIELD(0, u16, numDevices, "")\
788 FIELD(0, Size<u64>, maxCapacity, "")
789
790
791//-----------------------------------------------------------------------------
792// MemoryDevice
793
794#define MemoryDeviceFormFactor_ENUMERATORS\
795 ENUM(other, 1)\
796 ENUM(unknown, 2)\
797 ENUM(SIMM, 3)\
798 ENUM(SIP, 4)\
799 ENUM(chip, 5)\
800 ENUM(DIP, 6)\
801 ENUM(ZIP, 7)\
802 ENUM(proprietary_card, 8)\
803 ENUM(DIMM, 9)\
804 ENUM(TSOP, 10)\
805 ENUM(row_of_chips, 11)\
806 ENUM(RIMM, 12)\
807 ENUM(SODIMM, 13)\
808 ENUM(SRIMM, 14)\
809 ENUM(FBDIMM, 15)
810
811#define MemoryDeviceType_ENUMERATORS\
812 ENUM(other, 1)\
813 ENUM(unknown, 2)\
814 ENUM(DRAM, 3)\
815 ENUM(EDRAM, 4)\
816 ENUM(VRAM, 5)\
817 ENUM(SRAM, 6)\
818 ENUM(RAM, 7)\
819 ENUM(ROM, 8)\
820 ENUM(FLASH, 9)\
821 ENUM(EEPROM, 10)\
822 ENUM(FEPROM, 11)\
823 ENUM(EPROM, 12)\
824 ENUM(CRRAM, 13)\
825 ENUM(_3DRAM, 14)\
826 ENUM(SDRAM, 15)\
827 ENUM(SGRAM, 16)\
828 ENUM(RDRAM, 17)\
829 ENUM(DDR, 18)\
830 ENUM(DDR2, 19)\
831 ENUM(DDR2_FBDIMM, 20)\
832 ENUM(DDR3, 24)\
833 ENUM(FBD2, 25)
834
835#define MemoryDeviceTypeFlags_ENUMERATORS\
836 ENUM(other, 0x0002)\
837 ENUM(unknown, 0x0004)\
838 ENUM(fast_paged, 0x0008)\
839 ENUM(static_column, 0x0010)\
840 ENUM(pseudo_static, 0x0020)\
841 ENUM(rambus, 0x0040)\
842 ENUM(synchronous, 0x0080)\
843 ENUM(cmos, 0x0100)\
844 ENUM(edo, 0x0200)\
845 ENUM(window_dram, 0x0400)\
846 ENUM(cache_dram, 0x0800)\
847 ENUM(non_volatile, 0x1000)\
848 ENUM(buffered, 0x2000)\
849 ENUM(unbuffered, 0x4000)
850
851#define MemoryDevice_FIELDS\
852 FIELD(0, Handle, hMemoryArray, "")\
853 FIELD(0, Handle, hError, "")\
854 FIELD(0, u16, totalWidth, " bits")\
855 FIELD(0, u16, dataWidth, " bits")\
856 FIELD(F_INTERNAL, u16, size16, "")\
857 FIELD(0, MemoryDeviceFormFactor, formFactor, "")\
858 FIELD(0, u8, deviceSet, "")\
859 FIELD(0, const char*, locator, "")\
860 FIELD(0, const char*, bank, "")\
861 FIELD(0, MemoryDeviceType, type, "")\
862 FIELD(0, MemoryDeviceTypeFlags, typeFlags, "")\
863 FIELD(0, u16, speed, " MHz")\
864 FIELD(0, const char*, manufacturer, "")\
865 FIELD(0, const char*, serialNumber, "")\
866 FIELD(0, const char*, assetTag, "")\
867 FIELD(0, const char*, partNumber, "")\
868 FIELD(F_INTERNAL, u8, attributes, "")\
869 FIELD(F_INTERNAL, u32, size32, "")\
870 FIELD(0, u16, configuredSpeed, " MHz")\
871 FIELD(F_DERIVED, Size<u64>, size, "")\
872 FIELD(F_DERIVED, u8, rank, "")\
873
874
875//-----------------------------------------------------------------------------
876// MemoryArrayMappedAddress
877
878#define MemoryArrayMappedAddress_FIELDS\
879 FIELD(F_INTERNAL, u32, startAddress32, "")\
880 FIELD(F_INTERNAL, u32, endAddress32, "")\
881 FIELD(0, Handle, hMemoryArray, "")\
882 FIELD(0, u8, partitionWidth, "")\
883 FIELD(F_HEX, u64, startAddress, "")\
884 FIELD(F_HEX, u64, endAddress, "")
885
886
887//-----------------------------------------------------------------------------
888// MemoryDeviceMappedAddress
889
890#define MemoryDeviceMappedAddress_FIELDS\
891 FIELD(F_INTERNAL, u32, startAddress32, "")\
892 FIELD(F_INTERNAL, u32, endAddress32, "")\
893 FIELD(0, Handle, hMemoryDevice, "")\
894 FIELD(0, Handle, hMemoryArrayMappedAddress, "")\
895 FIELD(0, u8, partitionRowPosition, "")\
896 FIELD(0, u8, interleavePosition, "")\
897 FIELD(0, u8, interleavedDataDepth, "")\
898 FIELD(F_HEX, u64, startAddress, "")\
899 FIELD(F_HEX, u64, endAddress, "")
900
901
902//----------------------------------------------------------------------------
903// PortableBattery
904
905#define PortableBatteryChemistry_ENUMERATORS\
906 ENUM(other, 1)\
907 ENUM(unknown, 2)\
908 ENUM(lead_acid, 3)\
909 ENUM(nickel_cadmium, 4)\
910 ENUM(nickel_metal_hydride, 5)\
911 ENUM(lithium_ion, 6)\
912 ENUM(zinc_air, 7)\
913 ENUM(lithium_polymer, 8)
914
915#define PortableBattery_FIELDS\
916 FIELD(0, const char*, location, "")\
917 FIELD(0, const char*, manufacturer, "")\
918 FIELD(0, const char*, date, "")\
919 FIELD(0, const char*, serialNumber, "")\
920 FIELD(0, const char*, deviceName, "")\
921 FIELD(0, PortableBatteryChemistry, chemistry, "")\
922 FIELD(0, u16, capacity, " mWh")\
923 FIELD(0, u16, voltage, " mV")\
924 FIELD(0, const char*, sbdsVersion, "")\
925 FIELD(0, u8, maxError, "%")\
926 FIELD(0, u16, sbdsSerialNumber, "")\
927 FIELD(0, u16, sbdsDate, "")\
928 FIELD(0, const char*, sbdsChemistry, "")\
929 FIELD(0, u8, capacityMultiplier, "")\
930 FIELD(0, u32, oemSpecific, "")
931
932
933//----------------------------------------------------------------------------
934// VoltageProbe
935
936#define VoltageProbeLocation_ENUMERATORS\
937 ENUM(other, 1)\
938 ENUM(unknown, 2)\
939 ENUM(processor, 3)\
940 ENUM(disk, 4)\
941 ENUM(peripheral_bay, 5)\
942 ENUM(system_management_module, 6)\
943 ENUM(motherboard, 7)\
944 ENUM(memory_module, 8)\
945 ENUM(processor_module, 9)\
946 ENUM(power_unit, 10)\
947 ENUM(add_in_card, 11)
948
949#define VoltageProbe_FIELDS\
950 FIELD(0, const char*, description, "")\
951 FIELD(F_INTERNAL, u8, locationAndStatus, "")\
952 FIELD(0, i16, maxValue, " mV")\
953 FIELD(0, i16, minValue, " mV")\
954 FIELD(0, i16, resolution, " x 0.1 mV")\
955 FIELD(0, i16, tolerance, " mV")\
956 FIELD(0, i16, accuracy, " x 0.01%")\
957 FIELD(0, u32, oemDefined, "")\
958 FIELD(0, i16, nominalValue, " mv")\
959 FIELD(F_DERIVED, VoltageProbeLocation, location, "")\
960 FIELD(F_DERIVED, State, status, "")
961
962
963//----------------------------------------------------------------------------
964// CoolingDevice
965
966#define CoolingDeviceType_ENUMERATORS\
967 ENUM(other, 1)\
968 ENUM(unknown, 2)\
969 ENUM(fan, 3)\
970 ENUM(centrifugal_blower, 4)\
971 ENUM(chip_fan, 5)\
972 ENUM(cabinet_fan, 6)\
973 ENUM(power_supply_fan, 7)\
974 ENUM(heat_pipe, 8)\
975 ENUM(integrated_refrigeration, 9)\
976 ENUM(active_cooling, 16)\
977 ENUM(passive_cooling, 17)
978
979#define CoolingDevice_FIELDS\
980 FIELD(0, Handle, hTemperatureProbe, "")\
981 FIELD(F_INTERNAL, u8, typeAndStatus, "")\
982 FIELD(0, u8, group, "")\
983 FIELD(0, u32, oemDefined, "")\
984 FIELD(0, u16, nominalSpeed, " rpm")\
985 FIELD(0, const char*, description, "")\
986 FIELD(F_DERIVED, CoolingDeviceType, type, "")\
987 FIELD(F_DERIVED, State, status, "")
988
989
990//----------------------------------------------------------------------------
991// TemperatureProbe
992
993#define TemperatureProbeLocation_ENUMERATORS\
994 ENUM(other, 1)\
995 ENUM(unknown, 2)\
996 ENUM(processor, 3)\
997 ENUM(disk, 4)\
998 ENUM(peripheral_bay, 5)\
999 ENUM(system_management_module, 6)\
1000 ENUM(motherboard, 7)\
1001 ENUM(memory_module, 8)\
1002 ENUM(processor_module, 9)\
1003 ENUM(power_unit, 10)\
1004 ENUM(add_in_card, 11)\
1005 ENUM(front_panel_board, 12)\
1006 ENUM(back_panel_board, 13)\
1007 ENUM(power_system_board, 14)\
1008 ENUM(drive_backplane, 15)
1009
1010#define TemperatureProbe_FIELDS\
1011 FIELD(0, const char*, description, "")\
1012 FIELD(F_INTERNAL, u8, locationAndStatus, "")\
1013 FIELD(0, i16, maxValue, " dDegC")\
1014 FIELD(0, i16, minValue, " dDegC")\
1015 FIELD(0, i16, resolution, " mDegC")\
1016 FIELD(0, i16, tolerance, " dDegC")\
1017 FIELD(0, i16, accuracy, " x 0.01%")\
1018 FIELD(0, u32, oemDefined, "")\
1019 FIELD(0, i16, nominalValue, " dDegC")\
1020 FIELD(F_DERIVED, TemperatureProbeLocation, location, "")\
1021 FIELD(F_DERIVED, State, status, "")
1022
1023
1024//----------------------------------------------------------------------------
1025// SystemBoot
1026
1027#define SystemBootStatus_ENUMERATORS\
1028 ENUM(no_error, 0)\
1029 ENUM(no_bootable_media, 1)\
1030 ENUM(os_load_failed, 2)\
1031 ENUM(hardware_failure_firmware, 3)\
1032 ENUM(hardware_failure_os, 4)\
1033 ENUM(user_requested_boot, 5)\
1034 ENUM(security_violation, 6)\
1035 ENUM(previously_requested_image, 7)\
1036 ENUM(watchdog_expired, 8)
1037
1038#define SystemBoot_FIELDS\
1039 FIELD(F_INTERNAL, u32, reserved32, "")\
1040 FIELD(F_INTERNAL, u16, reserved16, "")\
1041 FIELD(0, SystemBootStatus, status, "")\
1042
1043
1044//----------------------------------------------------------------------------
1045// ManagementDevice
1046
1047#define ManagementDeviceType_ENUMERATORS\
1048 ENUM(other, 1)\
1049 ENUM(unknown, 2)\
1050 ENUM(LM75, 3)\
1051 ENUM(LM78, 4)\
1052 ENUM(LM79, 5)\
1053 ENUM(LM80, 6)\
1054 ENUM(LM81, 7)\
1055 ENUM(ADM9240, 8)\
1056 ENUM(DS1780, 9)\
1057 ENUM(M1617, 0xA)\
1058 ENUM(GL518SM, 0xB)\
1059 ENUM(W83781D, 0xC)\
1060 ENUM(HT82H791, 0xD)\
1061
1062#define ManagementDeviceAddressType_ENUMERATORS\
1063 ENUM(other, 1)\
1064 ENUM(unknown, 2)\
1065 ENUM(port, 3)\
1066 ENUM(memory, 4)\
1067 ENUM(smbus, 5)
1068
1069#define ManagementDevice_FIELDS\
1070 FIELD(0, const char*, description, "")\
1071 FIELD(0, ManagementDeviceType, type, "")\
1072 FIELD(0, u32, address, "")\
1073 FIELD(0, ManagementDeviceAddressType, addressType, "")
1074
1075
1076//----------------------------------------------------------------------------
1077// ManagementDeviceComponent
1078
1079#define ManagementDeviceComponent_FIELDS\
1080 FIELD(0, const char*, description, "")\
1081 FIELD(0, Handle, hDevice, "")\
1082 FIELD(0, Handle, hComponent, "")\
1083 FIELD(0, Handle, hThreshold, "")
1084
1085
1086//----------------------------------------------------------------------------
1087// ManagementDeviceThreshold
1088
1089#define ManagementDeviceThreshold_FIELDS\
1090 FIELD(0, i16, nonCriticalLo, "")\
1091 FIELD(0, i16, nonCriticalHi, "")\
1092 FIELD(0, i16, criticalLo, "")\
1093 FIELD(0, i16, criticalHi, "")\
1094 FIELD(0, i16, nonrecoverableLo, "")\
1095 FIELD(0, i16, nonrecoverableHi, "")
1096
1097
1098//----------------------------------------------------------------------------
1099// SystemPowerSupply
1100
1101#define SystemPowerSupplyCharacteristics_ENUMERATORS\
1102 ENUM(hot_replaceable, 1)\
1103 ENUM(present, 2)\
1104 ENUM(unplugged, 4)
1105
1106#define SystemPowerSupplyType_ENUMERATORS\
1107 ENUM(other, 1)\
1108 ENUM(unknown, 2)\
1109 ENUM(linear, 3)\
1110 ENUM(switching, 4)\
1111 ENUM(battery, 5)\
1112 ENUM(ups, 6)\
1113 ENUM(converter, 7)\
1114 ENUM(regulator, 8)
1115
1116#define SystemPowerSupplyInputSwitching_ENUMERATORS\
1117 ENUM(other, 1)\
1118 ENUM(unknown, 2)\
1119 ENUM(manual, 3)\
1120 ENUM(auto_switch, 4)\
1121 ENUM(wide_range, 5)\
1122 ENUM(none, 6)
1123
1124#define SystemPowerSupply_FIELDS\
1125 FIELD(0, u8, group, "")\
1126 FIELD(0, const char*, location, "")\
1127 FIELD(0, const char*, deviceName, "")\
1128 FIELD(0, const char*, manufacturer, "")\
1129 FIELD(0, const char*, serialNumber, "")\
1130 FIELD(0, const char*, assetTag, "")\
1131 FIELD(0, const char*, partNumber, "")\
1132 FIELD(0, const char*, revisionLevel, "")\
1133 FIELD(0, i16, maxPower, " mW")\
1134 FIELD(0, SystemPowerSupplyCharacteristics, characteristics, "")\
1135 FIELD(0, Handle, hVoltageProbe, "")\
1136 FIELD(0, Handle, hCoolingDevice, "")\
1137 FIELD(0, Handle, hCurrentProbe, "")\
1138 FIELD(F_DERIVED, SystemPowerSupplyType, type, "")\
1139 FIELD(F_DERIVED, State, status, "")\
1140 FIELD(F_DERIVED, SystemPowerSupplyInputSwitching, inputSwitching, "")\
1141
1142
1143//----------------------------------------------------------------------------
1144// OnboardDevices2
1145
1146#define OnboardDevices2_FIELDS\
1147 FIELD(0, const char*, referenceDesignation, "")\
1148 FIELD(0, OnBoardDeviceType, type, "")\
1149 FIELD(0, u8, instance, "")\
1150 FIELD(0, u16, groupNumber, "")\
1151 FIELD(0, u8, busNumber, "")\
1152 FIELD(F_INTERNAL, u8, functionAndDeviceNumber, "")\
1153 FIELD(F_DERIVED, bool, enabled, "")\
1154 FIELD(F_DERIVED, u8, deviceNumber, "")\
1155 FIELD(F_DERIVED, u8, functionNumber, "")\
1156
1157
1158//-----------------------------------------------------------------------------
1159
1161{
1165};
1166
1167// define each enumeration:
1168#define ENUM(enumerator, value) enumerator = value,
1169// (a struct wrapper allows reusing common enumerator names such as `other'.)
1170#define ENUMERATION(name, type)\
1171 struct name\
1172 {\
1173 /* (determines how much data to read from SMBIOS) */\
1174 typedef type T;\
1175 name(): value((Enum)0) {}\
1176 name(size_t num): value((Enum)num) {}\
1177 /* (the existence of this member type indicates the field is an enum) */\
1178 enum Enum { name##_ENUMERATORS sentinel } value;\
1179 /* (allows generic Field comparison against numeric_limits) */\
1180 operator size_t() const { return value; }\
1181 };
1183#undef ENUMERATION
1184#undef ENUM
1185
1186// declare each structure
1187#define FIELD(flags, type, name, units) type name;
1188#define STRUCTURE(name, id)\
1189 struct name\
1190 {\
1191 /* (allows searching for a structure with a given handle) */\
1192 Header header;\
1193 /* (defines a linked list of instances of this structure type) */\
1194 name* next;\
1195 name##_FIELDS\
1196 };
1198#undef STRUCTURE
1199#undef FIELD
1200
1201// declare a struct holding pointers (freed at exit) to each structure
1203{
1204#define STRUCTURE(name, id) name* name##_;
1206#undef STRUCTURE
1207};
1208
1209#pragma pack(pop)
1210
1211
1212//-----------------------------------------------------------------------------
1213
1214/**
1215 * @return a pointer to a static Structures (i.e. always valid), with its
1216 * member pointers non-zero iff SMBIOS information is available and includes
1217 * the corresponding structure.
1218 *
1219 * thread-safe; return value should be cached (if possible) to avoid an
1220 * atomic comparison.
1221 **/
1222const Structures* GetStructures();
1223
1224/**
1225 * @return a string describing all structures (omitting fields with
1226 * meaningless or dummy values).
1227 **/
1228std::string StringizeStructures(const Structures*);
1229
1230} // namespace SMBIOS
1231
1232#endif // #ifndef INCLUDED_SMBIOS
Definition: smbios.cpp:44
const Structures * GetStructures()
Definition: smbios.cpp:691
std::string StringizeStructures(const Structures *structures)
Definition: smbios.cpp:713
FieldFlags
Definition: smbios.h:125
@ F_HEX
Definition: smbios.h:134
@ F_INTERNAL
Definition: smbios.h:131
@ F_DERIVED
Definition: smbios.h:127
#define T(string_literal)
Definition: secure_crt.cpp:77
#define ENUMERATIONS
Definition: smbios.h:36
#define STRUCTURES
Definition: smbios.h:86
Definition: smbios.h:153
u16 value
Definition: smbios.h:156
Handle()
Definition: smbios.h:154
Handle(u16 value)
Definition: smbios.h:155
Definition: smbios.h:1161
u8 id
Definition: smbios.h:1162
Handle handle
Definition: smbios.h:1164
u8 length
Definition: smbios.h:1163
Definition: smbios.h:144
T value
Definition: smbios.h:147
Size()
Definition: smbios.h:145
Size(T value)
Definition: smbios.h:146
Definition: smbios.h:1203
uint8_t u8
Definition: types.h:37
uint16_t u16
Definition: types.h:38