├── AUTHORS ├── CHANGELOG ├── LICENSE ├── Makefile ├── README ├── biosdecode.c ├── config.h ├── dmidecode.c ├── dmidecode.h ├── dmioem.c ├── dmioem.h ├── dmiopt.c ├── dmiopt.h ├── man ├── biosdecode.8 ├── dmidecode.8 ├── ownership.8 └── vpddecode.8 ├── ownership.c ├── types.h ├── util.c ├── util.h ├── version.h ├── vpddecode.c ├── vpdopt.c └── vpdopt.h /AUTHORS: -------------------------------------------------------------------------------- 1 | DEVELOPER AND MAINTAINER 2 | Jean Delvare 3 | 4 | ORIGINAL AUTHORS 5 | Alan Cox 6 | Jean Delvare 7 | 8 | CODE CONTRIBUTORS (IN CHRONOLOGICAL ORDER) 9 | Matt Domsch 10 | Arjan van de Ven 11 | Mark D. Studebaker 12 | Larry Lile 13 | Dave Johnson 14 | Petter Reinholdtsen 15 | Roberto Nibali 16 | John Cagle 17 | Jens Elkner 18 | Jarod Wilson 19 | Anton Arapov 20 | Roy Franz 21 | Tyler Bell 22 | Xie XiuQi 23 | Petr Oros 24 | 25 | MANY THANKS TO (IN CHRONOLOGICAL ORDER) 26 | Werner Heuser 27 | Alexandre Duret-Lutz 28 | Xavier Roche 29 | Pamela Huntley 30 | Gael Stephan 31 | Sebastian Henschel 32 | Richard Sharpe 33 | David Wilson 34 | Glen Foster 35 | Chad Smith 36 | Joshua Goldenhar 37 | Luc Van de Velde 38 | Mario Lang 39 | Hugues Lepesant 40 | Sergey Leonovich 41 | Mike Cooper 42 | Marc Rieffel 43 | Jeff Moyer 44 | Josef Moellers 45 | Zing Zing Shishak 46 | Rafael Avila de Espindola 47 | Roger Koot 48 | Martin Pool 49 | Doug Brenner 50 | Alex Williamson 51 | Durval Menezes 52 | Raphael Raimbault 53 | Raul Nunez de Arenas Coronado 54 | Francois Revol 55 | Dominik Klein 56 | Erwan Velu 57 | Don Howard 58 | Frans Pop 59 | Tomek Mateja 60 | Myke Olson 61 | Torsten Seemann 62 | Garry Belka 63 | Klaus Muth 64 | Antoine Fuselier 65 | Matthew Garrett 66 | Landry Breuil 67 | Luke Suchocki 68 | Attila Nagy 69 | Alex Iribarren 70 | Sebastien Douche 71 | William Lallemand 72 | Olivier Guerrier 73 | Pascal Terjan 74 | Stuart Hayes 75 | Sofian Brabez 76 | Vincent Pelletier 77 | Andreas Gruenbacher 78 | Lin Li 79 | Thomas Hiller 80 | Paul Flo Williams 81 | Olof Johansson 82 | Alexandre Lissy 83 | Michal Svec 84 | Vojtech Pavlik 85 | Murlin Wenzel 86 | Harald Mueller-Ney 87 | Lars Mueller 88 | Thomas Mingarelli 89 | Andrey Matveyev 90 | Stefan Tauner 91 | Naga Chumbalkar 92 | Jens Rosenboom 93 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | 2015-09-03 Jean Delvare 2 | 3 | * version.h: Set version to 3.1. 4 | 5 | 2017-05-23 Jean Delvare 6 | 7 | * dmidecode.c, dmiopt.c: Add a new option to extract OEM strings, like 8 | we already have for many other strings. 9 | * dmidecode.8: Document the new option. 10 | 11 | 2017-04-27 Jean Delvare 12 | 13 | Update to support SMBIOS specification version 3.1.1. 14 | 15 | * dmidecode.c: Add support for 3-digit versions. 16 | * dmidecode.c: Add new enumerated values for processors (DMI type 4). 17 | 18 | 2017-04-27 Jean Delvare 19 | 20 | Update to support SMBIOS specification version 3.1.0. 21 | 22 | * dmidecode.c: Add support for extended BIOS ROM size (DMI type 0). 23 | * dmidecode.c: Add new enumerated values for chassis types 24 | (DMI type 3). 25 | * dmidecode.c: Add new enumerated values for processors (DMI type 4). 26 | * dmidecode.c: Don't assume 8-bit processor family in dmi_processor_id 27 | (DMI type 4). 28 | * dmidecode.c: Decode the MIDR register on ARM processors 29 | (DMI type 4). 30 | * dmidecode.c: Add support for large cache sizes (DMI type 7). 31 | * dmidecode.c: Add Mini PCIe system slot enumerated values 32 | (DMI type 9). 33 | * dmidecode.c: Clarify the memory speed unit (DMI type 17). 34 | * dmidecode.c: Add support for structure type 43 (TPM Device). 35 | 36 | 2017-04-11 Jean Delvare 37 | 38 | * util.c: Don't leak a file descriptor in function read_file. 39 | * util.c, util.c, dmidecode.c: Let callers pass an offset to function 40 | read_file. 41 | * dmidecode.c: Fix reading from SMBIOS 3 dump files using a 64-bit 42 | entry point. 43 | 44 | 2017-04-10 Jean Delvare 45 | 46 | * dmidecode.c: Decode the processor ID of the Intel Core M, AMD 47 | Athlon X4 and AMD Opteron X1000/X2000 processors (DMI type 4). 48 | * dmidecode.c: Display the IPMI interrupt number as a decimal 49 | number (DMI type 38). 50 | 51 | 2017-01-20 Jean Delvare 52 | 53 | * biosdecode.c: Decode the entry point defined in the Intel 54 | Multiprocessor specification. 55 | 56 | 2017-01-20 Jean Delvare 57 | 58 | * dmidecode.c: Only decode one DMI table. 59 | This fixes Savannah bug #50022: 60 | https://savannah.nongnu.org/bugs/?50022 61 | 62 | 2016-09-22 Jean Delvare 63 | 64 | * README: Explain that we can no longer support Cygwin. 65 | 66 | 2016-06-30 Petr Oros 67 | 68 | * dmidecode.c: Unmask LRDIMM in memory type detail (DMI type 17). 69 | 70 | 2015-11-02 Jean Delvare 71 | 72 | * dmidecode.c, util.c, util.h: Let read_file return the actual data 73 | size. 74 | * dmidecode.c: Use read_file to read the DMI table from sysfs. 75 | This fixes Savannah bug #46176: 76 | https://savannah.nongnu.org/bugs/?46176 77 | * dmidecode.c: Check the sysfs entry point length. 78 | 79 | 2015-10-21 Xie XiuQi 80 | 81 | * dmidecode.c: Handle SMBIOS 3.0 entry points on EFI systems. 82 | 83 | 2015-10-20 Jean Delvare 84 | 85 | * dmidecode.c: Handle OEM-specific types in group associations 86 | (DMI type 14). 87 | 88 | 2015-10-14 Jean Delvare 89 | 90 | * util.c: Avoid SIGBUS on mmap failure. 91 | This fixes Savannah bug #46066: 92 | https://savannah.nongnu.org/bugs/?46066 93 | * util.c: Fix error paths in mem_chunk. 94 | 95 | 2015-10-01 Roy Franz 96 | 97 | * dmiopt.c: Add "--no-sysfs" option description to -h output. 98 | 99 | 2015-09-03 Jean Delvare 100 | 101 | * version.h: Set version to 3.0. 102 | 103 | 2015-08-04 Tyler Bell 104 | 105 | * dmioem.c: Decode HP-specific DMI type 233 106 | * dmioem.c: Refactored HP-specific types 209 and 221 to use common code 107 | * dmioem.c: Documented spec for HP-specific types 209, 221 and 233 108 | 109 | 2015-05-21 Jean Delvare 110 | 111 | * dmidecode.c: Fix up invalid DMI type 34 structure length. 112 | * dmioem.c: Decode HP-specific DMI types 212 and 219. 113 | * dmioem.c: Move function is_printable to dmidecode.c. 114 | 115 | 2015-05-13 Jean Delvare 116 | 117 | * dmidecode.c: Add support for SMBIOS3 EFI table. 118 | * dmidecode.c: Fix warnings about comparison between signed and 119 | unsigned integers. 120 | * util.c: Fix warnings about unused labels when building without 121 | -DUSE_MMAP. 122 | * dmioem.c: Strip spaces at the end of vendor names. 123 | * dmioem.c: Decode Acer-specific DMI type 170. 124 | 125 | 2015-05-12 Jean Delvare 126 | 127 | * dmidecode.c: Remove extra blank line after hidden DMI type 40 128 | structure. 129 | 130 | 2015-05-04 Jean Delvare 131 | 132 | * dmidecode.c: Move table decoding to a separate function. 133 | * dmidecode.c: Simplify function dmi_table_dump. 134 | * dmidecode.c: Display types 41 and 42 in quiet mode too. 135 | * dmidecode.c: Get OEM vendor from System Information (DMI type 1). 136 | 137 | 2015-04-28 Jean Delvare 138 | 139 | * dmidecode.h, dmiopt.h: Fix sparse errors. 140 | * biosdecode.c, dmiopt.c, ownership.c, vpdopt.c: Fix sparse warnings. 141 | * util.c: Fix sparse warning. 142 | 143 | 2015-04-27 Jean Delvare 144 | 145 | * dmidecode.c: Fix --dump-bin when reading from sysfs. 146 | 147 | 2015-04-27 Jean Delvare 148 | 149 | Update to support SMBIOS specification version 3.0.0. 150 | 151 | * dmidecode.c: Add support for the new _SM3_ 64-bit entry point 152 | defined in the SMBIOS specification version 3.0.0, including 153 | support of 64-bit addresses and 32-bit table lengths. 154 | * dmidecode.c: Add 3 new chassis types (DMI type 3). 155 | * dmidecode.c: Add 4 new processor families (DMI type 4). 156 | * dmidecode.c: Add 4 new Intel socket types (DMI type 4). 157 | * dmidecode.c: Add 13 new slot types (DMI type 9). 158 | * dmidecode.c: Add 4 new memory device types (DMI type 17). 159 | * dmidecode.c: Add support for processors with more than 255 cores 160 | or threads (DMI type 4). 161 | * dmidecode.c: Stop decoding v3 tables at End-of-Table marker. 162 | 163 | 2015-04-21 Roy Franz 164 | 165 | * util.c, util.h: Add utility function read_file, which reads an 166 | entire binary file into a buffer. 167 | * dmidecode.c: Add passing of flags parameter to dmi_table. 168 | * dmidecode.c: Add reading of SMBIOS tables from sysfs. 169 | * dmidecode.c, dmiopt.c, dmiopt.h: Add --no-sysfs option to disable 170 | use of sysfs. 171 | * dmidecode.8: Document the changes above. 172 | 173 | 2015-04-20 Jean Delvare 174 | 175 | * biosdecode.c: Add support for the _SM3_ entry point, as defined in 176 | the SMBIOS 3.0.0 specification. 177 | 178 | 2014-11-14 Jean Delvare 179 | 180 | * man/dmidecode.8: Add a note about DMI strings available from sysfs 181 | on Linux. 182 | 183 | 2014-10-13 Jean Delvare 184 | 185 | * dmidecode.c: Add support for DDR4 (DMI type 17). Patch from Tomohiro 186 | Kimura. The value was taken from preliminary SMBIOS specification 187 | version 3.0.0d. 188 | This fixes Savannah bug #43370: 189 | https://savannah.nongnu.org/bugs/?43370 190 | 191 | 2014-07-11 Jean Delvare 192 | 193 | * dmidecode.c: Decode the CPUID of recent AMD processors (DMI type 4). 194 | 195 | 2014-03-20 Jean Delvare 196 | 197 | * dmidecode.c: Let legacy_decode be quiet in dump mode too. 198 | * dmidecode.c: Skip the SMBIOS version comparison in quiet mode. 199 | Patch from Jens Rosenboom. 200 | 201 | 2014-02-25 Jean Delvare 202 | 203 | * dmidecode.c: Fix spacing of memory module voltage attributes 204 | (DMI type 17). 205 | 206 | 2014-01-13 Jean Delvare 207 | 208 | * dmidecode.c: Decode ID of PCI Express 3 slots (DMI type 9). 209 | This fixes Savannah bug #40178: 210 | https://savannah.nongnu.org/bugs/?40178 211 | 212 | 2014-01-13 Jean Delvare 213 | 214 | * LICENSE: Update to the latest upstream version. Amongst other 215 | things, this fixes the FSF address. 216 | 217 | 2013-04-24 Jean Delvare 218 | 219 | * dmidecode.c: Strip trailing zeroes from memory voltage values 220 | (DMI type 17). 221 | * dmidecode.c: Fix support for new processor upgrade types (DMI 222 | type 4) and new memory device type (DMI type 17.) 223 | 224 | 2013-04-17 Anton Arapov 225 | 226 | * version.h: Set version to 2.12. 227 | 228 | 2013-04-17 Anton Arapov 229 | 230 | Update to support SMBIOS specification version 2.8.0. 231 | 232 | * dmidecode.c: Correct processor family name (DMI type 4). 233 | * dmidecode.c: Correct typo in processor upgrade type (DMI type 4). 234 | * dmidecode.c: Add 9 new processor families (DMI type 4). 235 | * dmidecode.c: Add 2 new Intel socket types (DMI type 4). 236 | * dmidecode.c: Add Min/Max/Configured memory voltages (DMI type 17). 237 | * dmidecode.c: Add LRDIMM to memory device list (DMI type 17). 238 | 239 | 2012-03-26 Anton Arapov 240 | 241 | * man/dmidecode.8: Add missing DMI type introduced with SMBIOS 2.7+, and 242 | include the information about the extra output when dmidecode is run 243 | on a hardware that has non-supported SMBIOS version. 244 | 245 | 2012-03-12 Anton Arapov 246 | 247 | * dmioem.c: Add "PXE" to the HP OEM Type 209 output so it is similar to 248 | the "iSCSI" description in HP OEM Type 221. Patch from Naga Chumbalkar. 249 | 250 | 2011-11-18 Jean Delvare 251 | 252 | * dmidecode.c: Properly print the hexadecimal value of invalid 253 | string characters. 254 | 255 | 2011-11-14 Anton Arapov 256 | 257 | * dmidecode.c: Make dmi_chassis_type aware of the lock bit. 258 | Patch from Stefan Tauner. 259 | * config.h: Haiku dropped the _BEOS_ definition in favor of its own 260 | platform identification _HAIKU_. Patch from Francois Revol. 261 | 262 | 2011-04-20 Jean Delvare 263 | 264 | Update to support SMBIOS specification version 2.7.1. 265 | 266 | * dmidecode.c: Add 6 AMD processor families (DMI type 4). 267 | * dmidecode.c: Add cache associativity value 268 | "20-way Set-associative" (DMI type 7). 269 | * dmidecode.c: Add PCI Express 3 slot types (DMI type 9). 270 | 271 | 2011-01-25 Jean Delvare 272 | 273 | * dmidecode.c: Fix boundary checks of memory array location codes 274 | (DMI type 16). Reported by Andrey Matveyev. 275 | 276 | 2011-01-19 Anton Arapov 277 | 278 | * version.h: Set version to 2.11. 279 | 280 | 2010-11-24 Jean Delvare 281 | 282 | * dmidecode.c: Assume that the max power capacity is expressed in 283 | Watts, not milliWatts (DMI type 39). The specification isn't 284 | clear about the actual unit, but the only implementation I've 285 | seen (HP Proliant G7) clearly uses Watts. Also, using milliWatts 286 | would limit the max value that can be stored to 32 W, which 287 | doesn't make much sense. 288 | * dmidecode.c: Fix offset of partition width (DMI type 19). 289 | * dmidecode.c: Decode BIOS language information flags 290 | (DMI type 13). 291 | * dmidecode.c: Fix CPU flags mask (DMI type 4). 292 | * dmidecode.c: Reword "PCI Express Gen 2" to just "PCI Express 2" 293 | (DMI type 9). 294 | * dmidecode.c: Decode the slot ID for all PCI Express and PCI 295 | Express 2 slots (DMI type 9). 296 | 297 | 2010-11-24 Jean Delvare 298 | 299 | Update to support SMBIOS specification version 2.7.0. 300 | 301 | * dmidecode.c: Update all references to the SMBIOS specification 302 | to match the new numbering. 303 | * dmidecode.c: Add UEFI support and virtual machine flags to BIOS 304 | characteristics (DMI type 0). 305 | * dmideocde.c: Add SKU number field to system enclosure or chassis 306 | (DMI type 3). 307 | * dmidecode.c: Add many Intel, AMD and VIA CPU family names 308 | (DMI type 4). 309 | * dmidecode.c: Add many socket formats (DMI type 4). 310 | * dmidecode.c: Add processor characteristics flags (DMI type 4). 311 | * util.c, util.h: Add utility function u64_range, which computes 312 | the range between two u64 values. 313 | * dmidecode.c: Add support for memory arrays of 2 TB and more 314 | (DMI types 16, 19 and 20). 315 | * dmidecode.c: Add support for memory devices of 32 GB and more 316 | (DMI type 17). 317 | * dmidecode.c: Add description of cooling device (DMI type 27). 318 | * dmidecode.c: Add limited support for new DMI type 42 (Management 319 | Controller Host Interface). 320 | 321 | 2010-11-16 Jean Delvare 322 | 323 | * dmidecode.c: Handle ambiguous processor family value 0x30 324 | (DMI type 4). 325 | * dmidecode.c: Prevent unlikely array overrun when decoding 326 | processor family value 0xBE (DMI type 4). 327 | * dmidecode.c: Handle DMI type 2 record of size 0x0E. 328 | 329 | 2010-11-11 Jean Delvare 330 | 331 | * dmidecode.c: Fix decoding of IPMI base address LSB. 332 | 333 | 2010-11-09 Jean Delvare 334 | 335 | * dmidecode.c: Drop redundant/obsolete references to 336 | CIM_Processor.Family. 337 | 338 | 2010-10-26 Jean Delvare 339 | 340 | Update to support Intel AP-485 (CPUID) revision 36 (was 32). 341 | 342 | * dmidecode.c: Update the link to the AP-485 document, the revision 343 | and the table number. 344 | * dmidecode.c: Update two CPU flag descriptions (FXSR and HTT). 345 | Drop CPU flag IA64. 346 | * dmidecode.c: Update the list of processors for which we decode the 347 | CPUID flags. 348 | 349 | 2010-10-11 Jean Delvare 350 | 351 | * dmidecode.c: One more SMBIOS version fix-up case. 352 | * Makefile: Rework BSD make compatibility trick. The previous 353 | trick would break GNU make 3.82. 354 | 355 | 2010-09-29 Anton Arapov 356 | 357 | * util.c: makes dmidecode fall back to regular reads if the mmap 358 | fails. Patch from Olof Johansson. 359 | 360 | 2010-09-21 Jean Delvare 361 | 362 | * dmidecode.c: Fix Xeon 7xxx entries in CPU name lookup table 363 | (DMI type 4). Patch from Paul Flo Williams. 364 | 365 | 2009-08-28 Jarod Wilson 366 | 367 | Update to support SMBIOS specification version 2.6.1. 368 | 369 | * dmidecode.c: Add processor types "Dual-Core Xeon 5200", 370 | "Dual-Core Xeon 7200", "Quad-Core Xeon 7300", "QuadCore Xeon 7400", 371 | "Multi-Core Xeon 7400", "Core i7", "Dual-Core Celeron", 372 | "Multi-Core Xeon", "Dual-Core Xeon 3xxx", "Quad-Core Xeon 3xxx", 373 | "Dual-Core Xeon 5xxx", "Quad-Core Xeon 5xxx", "Dual-Core Xeon 7xxx", 374 | "Quad-Core Xeon 7xxx" and "Multi-Core Xeon 7xxx" (DMI type 4). 375 | * dmidecode.c: Add slot types "PCI Express Gen 2 x1", 376 | "PCI Express Gen 2 x2", "PCI Express Gen 2 x4", 377 | "PCI Express Gen 2 x8" and "PCI Express Gen 2 x16" (DMI type 9). 378 | * dmidecode.c: Add memory device types "DDR3" and "FB-DIMM" 379 | (DMI type 17). 380 | * dmidecode.c: Add cache associativity types "12-way Set-associative", 381 | "24-way Set-associative", "32-way Set-associative", 382 | "48-way Set-associative" and "64-way Set-associative" (DMI type 7). 383 | 384 | 2009-07-27 Jean Delvare 385 | 386 | * dmioem.c: Recognize "Hewlett-Packard" as a possible DMI vendor 387 | string for HP. Orginal patch from Thomas Hiller (HP). 388 | * dmidecode.c: Add processor upgrade type "Socket LGA1366" 389 | (DMI type 4). 390 | 391 | 2009-06-19 Jean Delvare 392 | 393 | * dmidecode.c: Fix decoding of memory array capacity. A maximum 394 | capacity of 128 GB would erroneously be reported as Unknown, 395 | while a unknown capacity would be erroneously reported as 2048 396 | GB. Bug reported by Lin Li (HP). 397 | 398 | 2009-04-30 Jean Delvare 399 | 400 | * dmidecode.c: Warn if decoding an SMBIOS implementation which is 401 | newer than what we support. 402 | 403 | 2009-04-04 Jean Delvare 404 | 405 | * Makefile: Clarify license. 406 | 407 | 2008-11-23 Jean Delvare 408 | 409 | * biosdecode.c: Stop using the inline keyword. It causes more 410 | portability issues than is worth given how little we care about 411 | performance in this tool, and recent versions of gcc know when 412 | to inline functions anyway. 413 | * version.h: Set version to 2.10. 414 | 415 | 2008-11-14 Jean Delvare 416 | 417 | * dmidecode.c: Handle chassis information records of size 19 418 | (DMI type 3). 419 | 420 | 2008-11-10 Jean Delvare 421 | 422 | * dmidecode.c: Claim to support revision 32 of Intel AP-485 423 | (CPUID). No relevant change since revision 31. 424 | * dmidecode.c: Update reference to AMD CPUID document. 425 | 426 | 2008-11-09 Jean Delvare 427 | 428 | * dmidecode.c: Decode the CPUID of more Intel, VIA and AMD 429 | processors (DMI type 4). 430 | * dmidecode.c: More CPUID exceptions based on the version string 431 | (DMI type 4). 432 | * README: Drop reference to the Linux kernel. 433 | * README: Drop "model-specific issues" common problem entry, it is 434 | no longer relevant. 435 | * README: Simplify "IA-64" common problem entry, most of the 436 | issues are solved by now. 437 | 438 | 2008-11-08 Jean Delvare 439 | 440 | * dmidecode.c: Add many processor types taken from the CIM Schema. 441 | * dmidecode.c: Drop all references to the DMTF Master MIF 442 | document. This document hasn't been updated in years, so the 443 | additions it may contain are no longer relevant. 444 | 445 | 2008-11-07 Jean Delvare 446 | 447 | * dmidecode.c: Handle base board information records of size 9 448 | (DMI type 2). 449 | * dmidecode.c: Don't display access time equivalent of memory 450 | device speed (DMI type 17). The access time didn't add much 451 | value, and rounding effects made it look bad at times. 452 | 453 | 2008-11-07 Jean Delvare 454 | 455 | Update to support SMBIOS specification version 2.6, fourth round. 456 | 457 | * dmidecode.c: Initial support for additional information entries 458 | (DMI type 40). Proper support of this new entry type would 459 | require redesigning a large part of the code, so I am waiting 460 | to see actual implementations of it to decide whether it's worth 461 | the effort. 462 | * dmidecode.c, dmidecode.8: Update reference SMBIOS document. 463 | * dmiopt.c, dmidecode.8: Include entry type 41 in --type baseboard. 464 | 465 | 2008-11-05 Jean Delvare 466 | 467 | Update to support SMBIOS specification version 2.6, third round. 468 | 469 | * dmidecode.c: Decode the group number, bus number and 470 | device/function number of system slots (DMI type 9). 471 | Based on a preliminary patch by Matt Domsch. 472 | * dmidecode.c: Decode onboard devices extended information 473 | entries (DMI type 41). Based on a preliminary patch by Matt 474 | Domsch. 475 | * dmidecode.c: Add slot types "PCI Express x1", "PCI Express x2", 476 | "PCI Express x4", "PCI Express x8" and "PCI Express x16" 477 | (DMI type 9). 478 | * dmidecode.c: Decode the memory device rank (DMI type 17). 479 | 480 | 2008-11-02 Jean Delvare 481 | 482 | * dmidecode.c: Use binary search for dmi_processor_family, it's 483 | faster than linear search (DMI type 4). 484 | * dmidecode.c: Decode boot integrity services entry point entries 485 | (DMI type 31). 486 | 487 | 2008-10-31 Jean Delvare 488 | 489 | * dmidecode.c: The compiler knows how to reuse strings, it doesn't 490 | need our help, and actually it does a better job without it. So, 491 | turn out_of_spec into a define. 492 | * dmidecode.c: Optimize functions dmi_processor_status(), 493 | dmi_cache_location(), dmi_system_reset_boot_option() and 494 | dmi_ipmi_register_spacing(). 495 | 496 | 2008-10-30 Jean Delvare 497 | 498 | * dmidecode.c, dmiopt.c, dmidecode.8: Option --dump is only a 499 | modifier as --quiet is, so it's not actually mutually exclusive 500 | with the output format options. 501 | * dmidecode.c: Make options --dump-bin and --quiet work together. 502 | * dmidecode.c: Delay string filtering when option --dump is used. 503 | * dmidecode.c: Refactor dmi_processor_family function to avoid 504 | code duplication. 505 | * dmidecode.c: Fix up invalid SMBIOS version 2.51. 506 | 507 | 2008-10-29 Jean Delvare 508 | 509 | * dmidecode.c: Handle special case of processor family code 0xBE, 510 | which can be both Core 2 or K7. We use the processor 511 | manufacturer string as a hint (DMI type 4). 512 | 513 | 2008-10-28 Jean Delvare 514 | 515 | * dmidecode.c, dmidecode.h, dmiopt.c, dmiopt.h: Don't use function 516 | pointers for special string cases. Each special case is itself 517 | special and needs to call a function with its own prototype, so 518 | better have dedicated code to handle it all. 519 | * dmidecode.c, dmidecode.h, dmioem.c, dmioem.h: Mark a few 520 | pointers const. 521 | * dmidecode.c, util.c, util.h: When dumping the DMI table to a 522 | binary file, truncate the file first. 523 | * dmidecode.c: Support Processor Family 2 field also when queried 524 | with option --string. 525 | 526 | 2008-10-27 Jean Delvare 527 | 528 | Update to support SMBIOS specification version 2.6, second round. 529 | 530 | * dmidecode.c: Add support for Processor Family 2 field 531 | (DMI type 4). 532 | * dmidecode.c: Add processor types "Turion 64 X2", "Core Solo", 533 | "Core 2 Duo", "ESA/390 G6", "z/Architectur", "C7-M", "C7-D", 534 | "C7" and "Eden" (DMI type 4). 535 | * dmidecode.c: Fix typo in processor type "AMD29000" (DMI type 4). 536 | * dmidecode.c: Add processor upgrade types "Socket S1", 537 | "Socket AM2" and "Socket F (1207)" (DMI type 4). 538 | 539 | 2008-10-26 Jean Delvare 540 | 541 | Update to support SMBIOS specification version 2.6, first round. 542 | 543 | * dmidecode.c: Byte-swap the first 3 fields of the UUID 544 | (DMI type 1). 545 | * dmidecode.c: Add chassis types "Blade" and "Blade Enclosure" 546 | (DMI type 3). 547 | 548 | 2008-10-26 Jean Delvare 549 | 550 | * dmiopt.c, dmidecode.8: Simplify the handling and documentation 551 | of mutually exclusive output format options. 552 | * dmidecode.8: Document the binary dump file format. 553 | * dmidecode.c: Don't display the source dump file name in quiet 554 | mode. 555 | * biosdecode.c, dmidecode.c, dmioem.c, dmiopt.c, dmiopt.h, 556 | ownership.c, types.h, util.c, vpddecode.c, vpdopt.c, vpdopt.h: 557 | Mass coding-style change: add spaces around operators. 558 | * vpddecode.c: Fix --quiet option. 559 | * dmidecode.h, dmiopt.h: Pass version information to print 560 | callback functions. 561 | * dmidecode.c: Fix up invalid SMBIOS version. 562 | * dmidecode.c: Handle base board information records of size 10 563 | (DMI type 2). 564 | 565 | 2008-10-25 Jean Delvare 566 | 567 | * dmidecode.c: Limit indentation in smbios_decode and 568 | legacy_decode. 569 | * dmidecode.c, dmiopt.c: Write binary dump to a compact file 570 | rather than a sparse file. 571 | * dmidecode.c, dmiopt.c, dmiopt.h: New option --from-dump, read 572 | the DMI data from a binary file. 573 | * dmidecode.8: Update the option --dump-bin, document the new 574 | option --from-dump. 575 | 576 | 2008-08-28 Jean Delvare 577 | 578 | * dmidecode.c: Add missing colon to temperature probe label. 579 | Patch from Alex Iribarren. 580 | 581 | 2008-02-16 Jean Delvare 582 | 583 | * util.c, util.h: New helper function write_dump. 584 | * dmidecode.c, dmiopt.c, dmiopt.h: New option --dump-bin, dump 585 | the DMI data to a sparse binary file. 586 | * dmidecode.8: Document the new option --dump-bin. 587 | * Makefile, biosdecode.c, dmidecode.c, dmidecode.h, dmioem.c, 588 | dmioem.h, dmiopt.c, dmiopt.h, ownership.c, util.c, util.h, 589 | vpddecode.c, vpdopt.c, vpdopt.h: Update copyright statements. 590 | * dmidecode.c: Adjust the error message which is displayed when 591 | the table is unreachable. 592 | 593 | 2007-06-30 Jean Delvare 594 | 595 | * config.h: Add support for Solaris (x86 only, of course). Based 596 | on a patch by Sun's Dan Mick, brought to my knowledge by 597 | Attila Nagy. 598 | 599 | 2007-06-27 Jean Delvare 600 | 601 | * Makefile: Fix the uninstall-man target. 602 | 603 | 2007-06-07 Jean Delvare 604 | 605 | * dmidecode.c: If the SMBIOS entry point decoding fails (for 606 | example due to a bad checksum), still try decoding the 607 | encapsulated DMI entry point. Suggested by Luke Suchocki. 608 | * dmidecode.c: Replace all occurrences of "KB" by the more 609 | correct "kB". 610 | 611 | 2007-03-16 Jean Delvare 612 | 613 | * vpddecode.c: Stop asking the user to report bad checksums, 614 | unaligned records and the like. Such machines exist, too bad, 615 | we have to live with it. 616 | 617 | 2007-02-27 Jean Delvare 618 | 619 | * biosdecode.c: Fix a compilation error with non-C99 compilers. 620 | Patch from Francois Revol. 621 | 622 | 2007-02-26 Jean Delvare 623 | 624 | * dmidecode.c: Fix an array overrun while decoding the system 625 | event log status (DMI type 15). 626 | * biosdecode.c: Use printf instead of fwrite. 627 | * dmidecode.8: Some OEM-specific types can be decoded now. 628 | * biosdecode.8: List the FJKEYINF entry point type. 629 | * vpddecode.8: The product name is no longer displayed. 630 | * version.h: Set version to 2.9. 631 | 632 | 2007-02-16 Jean Delvare 633 | 634 | * dmidecode.c: Do not print the BIOS base address and runtime size 635 | if the base address is 0. This happens on IA-64 because there's 636 | no BIOS. 637 | * Makefile, README: Do not build biosdecode, ownership and 638 | vpddecode on IA-64, as IA-64 systems have no BIOS. This was 639 | quite tricky to keep both GNU make and BSD make happy, but it 640 | seems that I finally succeeded. 641 | 642 | 2007-02-13 Jean Delvare 643 | 644 | Update to support SMBIOS specification version 2.5, second round. 645 | 646 | * dmidecode.c: Decode new processor characteristics (multi-core, 647 | multi-thread, 64-bit) (DMI type 4). 648 | * dmidecode.c: Decode slot ID of AGP 8x and PCI Express slots (DMI 649 | type 9). 650 | 651 | * dmidecode.c: Fix the mask of 3 bitfield tests. This will let 652 | the memory type of some systems be properly reported as SDRAM. 653 | * dmidecode.c: Fix the AMD processors signature decoding. 654 | * README: Minor edits. 655 | 656 | 2007-02-12 Jens Elkner 657 | 658 | Update to support SMBIOS specification version 2.5, first round. 659 | 660 | * dmidecode.c: Add chassis types "CompactPCI" and "AdvancedTCA" 661 | (DMI type 3). 662 | * dmidecode.c: Add processor types "Turion 64", 663 | "Dual-Core Opteron", "Athlon 64 X2", "Celeron D", "Pentium D" 664 | and "Pentium EE" (DMI type 4). 665 | * dmidecode.c: Add processor upgrade types "Socket mPGA604", 666 | "Socket LGA771" and "Socket LGA775" (DMI type 4). 667 | * dmidecode.c: Add connector type "SAS/SATA Plug Receptacle" and 668 | port types "SATA" and "SAS" (DMI type 8). 669 | * dmidecode.c: Add on-board device types "PATA Controller", 670 | "SATA Controller" and "SAS Controller" (DMI type 10). 671 | * dmidecode.c: Add memory device form factor "FB-DIMM" and memory 672 | device type "DDR2 FB-DIMM" (DMI type 17). 673 | 674 | 2007-02-12 Jean Delvare 675 | 676 | * dmioem.c: Share the code between HP-specific types 209 and 221. 677 | Both types are really the same, only the title is different. 678 | * dmioem.c: Make the HP-specific types 209 and 221 output a bit 679 | more verbose. 680 | * dmidecode.c: Let --type decode OEM-specific entries when 681 | possible. 682 | * dmidecode.c: Include decoded OEM-specific entries in quiet mode 683 | output (--quiet). 684 | * dmidecode.c: Do not complain about truncated entries in quiet 685 | mode. 686 | * dmioem.c: Decode HP-specific type 204 entries in a safer way: 687 | check the length before decoding, and don't assume that all 688 | strings are provided in the same order as they are used. 689 | 690 | Update to support Intel AP-485 (CPUID) revision 31 (was 28). 691 | 692 | * dmidecode.c: New CPUID flag IA64. 693 | * dmidecode.c: Fix the decoding of Intel extended family. 694 | 695 | 2007-02-11 Jean Delvare 696 | 697 | * dmioem.c, dmioem.h: New. 698 | * Makefile, dmidecode.c, dmidecode.h, dmioem.c, dmioem.h: Move the 699 | decoding of OEM-specific entries to a separate source file. 700 | * dmidecode.c: DMI type 38 is tested by now. 701 | * dmioem.c: The PCI function is typically represented as a single 702 | digit. 703 | * Makefile, dmiopt.c, vpdopt.c, util.h: Define an ARRAY_SIZE macro 704 | which computes the size of a static array, and use it where 705 | relevant. 706 | 707 | 2007-02-11 John Cagle 708 | 709 | * dmidecode.c: Add support for 3 HP-specific entries: system/rack 710 | locator (type 204), NIC MAC information (type 209) and NIC iSCSI 711 | MAC information (type 221). 712 | 713 | 2007-01-14 Jean Delvare 714 | 715 | * vpddecode.c: Fix a rare warning. 716 | * biosdecode.c: Add support for the FJKEYINF entry point, which 717 | contains data related to the "application panel" on Fujitsu 718 | laptops. 719 | 720 | 2006-05-23 Jean Delvare 721 | 722 | * dmidecode.c: Fix a recently introduced compilation error with 723 | non-C99 compilers. 724 | * dmidecode.c: Check for short entries (less than 4 bytes), stop 725 | with an error when one is encountered. 726 | 727 | 2006-05-13 Jean Delvare 728 | 729 | * vpddecode.c, README: Drop the product name lookup table. It 730 | was reported to be unreliable too many times, and was also 731 | difficult to maintain. 732 | 733 | 2006-05-10 Jean Delvare 734 | 735 | * dmidecode.c: Don't cast from u8* to dmi_header*, else 736 | architectures which do not support unaligned memory accesses 737 | may break. Instead, copy the members individually. That's a 738 | bit slower, but that's also safer and we only need to do it 739 | once per DMI entry, so it's not time critical. So far, we 740 | were using a trick to later work around the unaligned memory 741 | access, but the compiler would still warn about the risk, 742 | which is always confusing. 743 | * config.h, types.h, README: Automatically enable the unaligned 744 | memory access workaround on ia64. 745 | * types.h: Inline U64. It makes sense per se and also lets us 746 | get rid of a warning about U64 being unused. 747 | * dmidecode.c: Detect EFI at run-time rather than compilation- 748 | time. Based on an original patch from Matthew Garrett. This 749 | will make x86 binaries work for both PC systems with BIOS and 750 | Macintosh systems with EFI. Also prevent a possible, though 751 | unlikely, NULL-pointer dereference in the EFI code. 752 | 753 | 2006-02-25 Jean Delvare 754 | 755 | * dmidecode.c: Fix typo reported by David Wilson (DMI case 3). 756 | 757 | 2006-02-04 Jean Delvare 758 | 759 | * vpddecode.c: Update lookup table from revision 2006-01-31 of IBM 760 | reference document (add product ID "7B"). 761 | * version.h: Set version to 2.8. 762 | 763 | 2006-01-21 Jean Delvare 764 | 765 | * vpddecode.c: The mysterious last character of xSeries records 766 | may be a BIOS revision. Display it as such when present and 767 | non zero, and ask users to report. 768 | * vpddecode.c: Adjust an error message. 769 | * dmidecode.8: Update the sample entry to match the new output 770 | format. 771 | * README: Improve the IA-64 specific section and the vpddecode 772 | tool description. 773 | * vpdopt.h: Add missing system header file include. 774 | 775 | 2006-01-20 Jean Delvare 776 | 777 | * vpddecode.c: Assume a constant length of 12 characters for the 778 | "Default Flash Image File Name" entry. The 13th character never 779 | contained anything useful, so it probably has a different 780 | meaning (unknown for now). 781 | 782 | 2005-12-24 Jean Delvare 783 | 784 | * vpddecode.c: Scan for VPD records on 4-byte boundaries instead 785 | of 16-byte boundaries. This is needed for some eServer xSeries 786 | 206. Still emit a warning if a VPD record is found not on a 787 | 16-byte boundary. 788 | 789 | 2005-10-26 Jean Delvare 790 | 791 | * vpddecode.c: Add product ID "NR". Reported by Klaus Muth. 792 | * vpddecode.c: Update lookup table from revision 2005-10-06 of IBM 793 | reference document (add product IDs "77" and "78"). 794 | 795 | 2005-10-05 Jean Delvare 796 | 797 | Update to support IPMI specification version 2.0 (was 1.5). 798 | 799 | * dmidecode.c: Support IPMI interface type SSIF. Original patch 800 | by Garry Belka. 801 | 802 | 2005-10-04 Jean Delvare 803 | 804 | * vpdopt.c: Display the list of all valid string keywords when 805 | --string is used without an argument. 806 | * vpddecode.8: Document the new -s, --string option. 807 | * dmidecode.8: List the four new string keywords. 808 | * vpddecode.c: Keep quiet when --string is used, even when no VPD 809 | record is found. 810 | 811 | 2005-10-03 Jean Delvare 812 | 813 | * biosdecode.c: Fix a potential (but highly improbable) buffer 814 | overrun in the VPD record decoding. 815 | * biosdecode.c: Change the xSeries checksumming method to 816 | accommodate a strange xSeries 440 VPD record, as was done in 817 | vpddecode.c some weeks ago. Do not display the default flash 818 | image file name anymore, it's not so useful and the field length 819 | is now uncertain. 820 | * vpdopt.c, vpdopt.h: New. 821 | * Makefile, vpddecode.c, vpdopt.c, vpdopt.h: Move the command line 822 | handling of vpddecode to a separate source file. 823 | * vpddecode.c, vpdopt.c, vpdopt.h: Add option -s, --string. It 824 | prints one selected VPD string instead of the regular output. 825 | 826 | 2005-09-24 Jean Delvare 827 | 828 | * dmiopt.c: Fix incorrect header include. The strcasecmp function 829 | is defined in , not . Reported by Petter 830 | Reinholdtsen. 831 | 832 | 2005-09-14 Jean Delvare 833 | 834 | * dmidecode.h: New. 835 | * dmidecode.c, dmidecode.h, Makefile: Export four specific 836 | decoding functions, make them suitable for external call. 837 | * dmidecode.c, dmiopt.c, dmiopt.h, Makefile: Make it possible 838 | for --string to print decoded binary data rather than only 839 | DMI strings. Add four such string keywords. 840 | * dmidecode.c, dmiopt.c, dmiopt.h: Modify the opt structure 841 | to handle the string option more efficiently. 842 | 843 | 2005-09-13 Jean Delvare 844 | 845 | * vpddecode.c: Slightly change the xSeries checksumming method to 846 | accommodate a strange xSeries 440 VPD record. Also tweak the 847 | decoding of the "Default Flash Image File Name" entry. Thanks 848 | to Torsten Seemann for providing a test VPD record. 849 | 850 | 2005-09-05 Jean Delvare 851 | 852 | * Makefile: Use -Wundef. 853 | 854 | 2005-08-31 Jean Delvare 855 | 856 | * dmidecode.c: Drop trailing dot from handle description line. 857 | 858 | 2005-08-29 Jean Delvare 859 | 860 | * dmidecode.c: Reword a comment about CPUID. 861 | * dmidecode.c: Claim to support revision 28 of Intel AP-485 862 | (CPUID). No relevant change since revision 27. 863 | 864 | 2005-08-25 Jean Delvare 865 | 866 | * vpddecode.c: Add product ID "VI". Reported by Torsten Seemann. 867 | * vpddecode.c: Update lookup table from revision 2005-06-24 of IBM 868 | reference document (add product IDs "1U", "1X", "70", "74", "75" 869 | and "76", update product ID "1Y"). 870 | * dmiopt.c: Complain about unknown options again. 871 | * biosdecode.c, ownership.c, vpddecode.c: getopt_long() will never 872 | return ':'. 873 | 874 | 2005-08-04 Jean Delvare 875 | 876 | * README: Manual pages document the command line interface. 877 | A discussion list exists for developers. Mmap is used on 878 | most systems, not just Linux. 879 | * version.h: Set version to 2.7. 880 | 881 | 2005-08-02 Jean Delvare 882 | 883 | * dmiopt.c, dmidecode.8: Options --dump and --quiet are mutually 884 | exclusive. 885 | 886 | 2005-06-23 Jean Delvare 887 | 888 | * dmiopt.c, dmidecode.8: Options --dump and --string are mutually 889 | exclusive. 890 | 891 | 2005-06-22 Jean Delvare 892 | 893 | * dmiopt.c: Display the list of all valid type or string keywords 894 | when --type or --string, respectively, is used without an 895 | argument or with an invalid one. 896 | * dmidecode.8: Document the new -s, --string option. Update the 897 | -t, --type option documentation. 898 | * dmiopt.c, dmidecode.8: Add string keyword "bios-release-date", 899 | the Linux kernel uses it. 900 | * dmidecode.c, dmidecode.8: Fix typo ("Controler" becomes 901 | "Controller"). 902 | 903 | 2005-06-21 Jean Delvare 904 | 905 | * dmidecode.c, dmiopt.c, dmiopt.h: Add option -s, --string. It 906 | prints one selected DMI string instead of the regular output. 907 | 908 | 2005-06-18 Jean Delvare 909 | 910 | * dmidecode.c: Hide handle references and entries of unknown 911 | type when --quiet is used. 912 | * dmidecode.8: Document the new -q, --quiet option. 913 | * dmidecode.c: Stop decoding at end of table entry when --quiet 914 | is used. Also don't warn about incorrect table length or entries 915 | count when --quiet is used. 916 | 917 | 2005-06-17 Jean Delvare 918 | 919 | * dmidecode.c, dmiopt.c, dmiopt.h: Add option -q, --quiet. It 920 | makes the output less verbose. 921 | * dmidecode.c: Suppress one level of indentation in the output, 922 | insert blank lines between records. This will hopefully make 923 | the output easier to read. 924 | * dmidecode.c: Hide table address and size when --type is used. 925 | 926 | 2005-06-16 Jean Delvare 927 | 928 | * dmidecode.8: Document the new -t, --type option. 929 | 930 | 2005-06-15 Jean Delvare 931 | 932 | * dmiopt.c, dmiopt.h: New. 933 | * Makefile, dmidecode.c, dmiopt.c, dmiopt.h: Move the command line 934 | handling of dmidecode to a separate source file. 935 | * dmiopt.c: Define keywords to be used with --type (instead of 936 | numeric values). 937 | 938 | 2005-06-14 Jean Delvare 939 | 940 | * dmidecode.c: Centralize the main exit point. This allows fixing 941 | a minor, recently introduced memory leak which was happening on 942 | error conditions. 943 | 944 | 2005-06-13 Jean Delvare 945 | 946 | * dmidecode.c: Add option -t, --type. It limits the output to 947 | the given type(s) of DMI entries. 948 | 949 | 2005-05-25 Jean Delvare 950 | 951 | * vpddecode.c: Add product IDs "KE", "NT" and "ZR". Reported by 952 | Bernd Krumboeck. 953 | 954 | 2005-05-15 Jean Delvare 955 | 956 | * dmidecode.8, vpddecode.8: Document the new -u, --dump option. 957 | 958 | Update to support SMBIOS specification version 2.4 (was 2.4 959 | preliminary). There is actually no difference between 2.4 960 | preliminary and 2.4 final. 961 | 962 | * dmidecode.c: Update the "System Management BIOS Reference 963 | Specification" version. 964 | 965 | 2005-04-26 Jean Delvare 966 | 967 | * vpddecode.c: Add product ID "M1". Reported by Myke Olson. 968 | * vpddecode.c: Add option -u, --dump. It disables decoding of the 969 | VPD records, a raw dump is displayed instead. This option is 970 | mainly intended for debugging. 971 | 972 | 2005-04-03 Jean Delvare 973 | 974 | * Makefile: Use variables for install and rm commands, so that these 975 | can be overridden by the caller. 976 | 977 | 2005-03-25 Jean Delvare 978 | 979 | * Makefile: Install some documentation files (README, CHANGELOG, 980 | AUTHORS). 981 | 982 | Update to support SMBIOS specification version 2.4 preliminary 983 | [11/18/2004] (was 2.3.4). 984 | 985 | * dmidecode.c: Add BIOS characteristics (DMI type 0). 986 | * dmidecode.c: Display BIOS and firmware revisions where available 987 | (DMI type 0). 988 | * dmidecode.c: Display system SKU number and family where available 989 | (DMI type 1). 990 | * dmidecode.c: Add system slot types and widths (DMI type 9). 991 | * dmidecode.c: Add memory device type "DDR2" (DMI type 17). 992 | 993 | 2005-03-20 Jean Delvare 994 | 995 | * Makefile: Install manual pages under $(prefix)/share/man by 996 | default, instead of $(prefix)/man, so as to comply with the FHS. 997 | 998 | 2005-03-08 Jean Delvare 999 | 1000 | * vpddecode.c: Update lookup table from revision 2005-03-08 of IBM 1001 | reference document (add product ID "1V", update product ID "1R"). 1002 | Thanks to Ingo van Lil for reporting about product ID "1V". 1003 | 1004 | 2005-03-06 Jean Delvare 1005 | 1006 | * dmidecode.c: Add option -u, --dump. It disables decoding of the 1007 | entries, raw dumps are displayed instead. This option is mainly 1008 | intended for debugging. 1009 | * Makefile: Use -Winline. 1010 | * dmidecode.c: Make ASCII filtering of strings faster. 1011 | 1012 | 2005-02-28 Jean Delvare 1013 | 1014 | * version.h: Set version to 2.6. 1015 | * Makefile: ownership.o depends on version.h. 1016 | 1017 | 2005-02-24 Jean Delvare 1018 | 1019 | * vpddecode.c: Add product ID "2C". Reported by Tomek Mateja. 1020 | 1021 | 2005-02-17 Jean Delvare 1022 | 1023 | * vpddecode.c: Add product IDs "OP" and "PN". Reported by Scott 1024 | Denham. 1025 | * vpddecode.c: Fix typo in one product name (560E improperly 1026 | spelled 650E). 1027 | * vpddecode.c: Add product IDs "IW" and "IY", as added recently 1028 | on IBM's reference web page. Update reference. 1029 | * config.h: Use mmap on all but BeOS, instead of only Linux. 1030 | 1031 | 2005-02-12 Jean Delvare 1032 | 1033 | * util.c: Fix incorrect length in munmap call. 1034 | * Makefile: Use -Wmissing-prototypes. 1035 | * dmidecode.c: Fix maximum battery error value. 1036 | 1037 | 2005-02-11 Jean Delvare 1038 | 1039 | * Makefile: Discard -pedantic, we don't really need this. 1040 | * util.c: Display an error message on memory shortage. Suggested 1041 | by Don Howard. 1042 | 1043 | Fix a bug causing dmidecode to crash on some systems with more than 1044 | 2 GB of memory. This is a signed vs unsigned issue, which existed 1045 | up to version 2.2, was fixed in 2.3 but reintroduced in a different 1046 | form in 2.5 as part of a code clean up and refactoring. 1047 | https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=112355 1048 | Thanks to Petter Reinholdtsen for reporting. Thanks to Don Howard 1049 | for additional insight. 1050 | 1051 | * dmidecode.c, util.c, util.h: Use size_t instead of off_t when 1052 | handling memory addresses. 1053 | 1054 | 2005-02-10 Jean Delvare 1055 | 1056 | * dmidecode.c: Add option -h, --help, display a usage summary. 1057 | * biosdecode.c, ownership.c, vpddecode.c: Copy command-line handling 1058 | from dmidecode.c. 1059 | * biosdecode.8, dmidecode.8, ownership.8, vpddecode.8: Document 1060 | the new command-line interface. 1061 | 1062 | 2005-02-06 Jean Delvare 1063 | 1064 | * Makefile: Everything depends on config.h. 1065 | * dmidecode.c: Add basic command-line handling. This was suggested 1066 | a long time ago by Erwan Velu. 1067 | 1068 | 2005-02-01 Jean Delvare 1069 | 1070 | * vpddecode.c: Add product IDs "AP", "KP" and "RD". Reported by 1071 | David Rosala. 1072 | 1073 | 2005-01-17 Jean Delvare 1074 | 1075 | * README: Add a note about Cygwin. Thanks to Dominik Klein for 1076 | reporting success. 1077 | 1078 | 2004-12-10 Jean Delvare 1079 | 1080 | Increase portability and configurability to in order to support BeOS. 1081 | 1082 | * config.h: New. 1083 | * config.h: Define a default memory device. 1084 | * biosdecode.c, dmidecode.c, ownership.c, vpddecide.c: Include 1085 | config.h and use the defined default memory device. 1086 | * Makefile, config.h, util.c, README: Move USE_MMAP to config.h, 1087 | use mmap on Linux only. 1088 | 1089 | 2004-11-22 Jean Delvare 1090 | 1091 | * biosdecode.c: Avoid size_t in printf. Should remove a warning on 1092 | ia64. Thanks to Petter Reinholdtsen for reporting. 1093 | * util.c: Use sysconf(_SC_PAGESIZE) instead of getpagesize() where 1094 | available. This may remove a warning on ia64 as a side effect. 1095 | Thanks to Petter Reinholdtsen for reporting. 1096 | 1097 | 2004-11-21 Jean Delvare 1098 | 1099 | * util.c, util.h: Function myread has no more user outside of util.c. 1100 | * biosdecode.c: Speed improvements. 1101 | 1102 | 2004-11-20 Jean Delvare 1103 | 1104 | * biosdecode.c, ownership.c, vpddecode.c: Make use of the mem_chunk 1105 | function. 1106 | * vpddecode.c: Simplify the memory loop code a bit. 1107 | 1108 | 2004-11-12 Jean Delvare 1109 | 1110 | * dmidecode.c: Hide bank connection type for non-installed memory 1111 | modules. 1112 | * dmidecode.c: Reference comment fix. 1113 | * dmidecode.c: Hide watchdog timer details when no watchdog is 1114 | present. Change label for no watchdog. 1115 | * README: Match case change for PREFIX (now prefix) in the Makefile 1116 | file. Reported by Raul Nunez de Arenas Coronado. 1117 | 1118 | 2004-11-12 Jean Delvare 1119 | 1120 | Update to support DMTF Master MIF version 040707 (was 030621). 1121 | 1122 | * dmidecode.c: One additional processor type (Sempron). 1123 | * dmidecode.c: One additional processor type (Efficeon TM8800). 1124 | * dmidecode.c: One additional processor upgrade type (Socket 939). 1125 | * dmidecode.c: Add the AMD Sempron to the list of x86-class 1126 | processors. 1127 | 1128 | Update to support Intel AP-485 (CPUID) revision 27 (was 25). 1129 | 1130 | * dmidecode.c: Rename SBF flag to PBE. 1131 | 1132 | 2004-11-11 Jean Delvare 1133 | 1134 | * util.c: More helpful error messages. 1135 | * util.c: Use MAP_SHARED instead of MAP_PRIVATE in mmap. 1136 | * version.h: Set version to 2.5. 1137 | 1138 | 2004-11-10 Jean Delvare 1139 | 1140 | * README: Update dmidecode presentation (copied from the web page). 1141 | Move the list of supported systems from the documentation section 1142 | to the installation section. 1143 | 1144 | 2004-11-09 Jean Delvare 1145 | 1146 | * vpddecode.c: Update product ID "1R". Reported by Marco Wertejuk. 1147 | 1148 | 2004-10-24 Jean Delvare 1149 | 1150 | * util.c: Workaround missing MAP_FAILED definition, needed on 1151 | old systems. Original patch from Durval Menezes. 1152 | 1153 | 2004-10-14 Jean Delvare 1154 | 1155 | * dmidecode.c: Search for EFI systab at /sys/firmware/efi/systab. 1156 | Original patch from Alex Williamson. 1157 | * dmidecode.c: Remove warning about legacy_decode not being used 1158 | when USE_EFI is defined. 1159 | * dmidecode.c: Detect missing SMBIOS entry point in efi/systab. 1160 | * dmidecode.c: Fix fatal typo in USE_EFI-specific code. 1161 | 1162 | 2004-10-01 Roberto Nibali 1163 | 1164 | * Makefile: Be LDFLAGS aware. 1165 | 1166 | 2004-07-24 Jean Delvare 1167 | 1168 | * util.c: Add missing header include. 1169 | 1170 | 2004-06-11 Jean Delvare 1171 | 1172 | * vpddecode.c: Add product IDs "GE" and "T2". Reported by Doug Brenner. 1173 | 1174 | 2004-05-02 Jean Delvare 1175 | 1176 | * dmidecode.c: Move legacy DMI entry point decoding to a separate 1177 | function. 1178 | * dmidecode.c: Use a 64 kB buffer for searching entry points, 1179 | instead of repeated 16-byte reads. 1180 | * util.c, util.h: New mem_chunk function. It returns a buffer 1181 | containing a copy of a given chunk of the physical memory. 1182 | * dmidecode.c: Make use of the new mem_chunk function. 1183 | 1184 | 2004-04-30 Jean Delvare 1185 | 1186 | * vpddecode.c: Add product ID "JP". Reported by Bernd Krumboeck. 1187 | 1188 | 2004-04-22 Jean Delvare 1189 | 1190 | * dmidecode.c, biosdecode.c, ownership.c, types.h: Move common 1191 | WORD-like macros to types.h. 1192 | 1193 | 2004-04-21 Jean Delvare 1194 | 1195 | * dmidecode.c, biosdecode.c: Fix my contact information. 1196 | * dmidecode.c: Update copyright year. 1197 | 1198 | 2004-04-20 Jean Delvare 1199 | 1200 | * README: Correct Chad Smith's name. Reported by Martin Pool. 1201 | 1202 | 2004-04-15 Jean Delvare 1203 | 1204 | * vpddecode.c: Add product ID "PL". Reported by Mark Syms. 1205 | 1206 | 2004-04-14 Jean Delvare 1207 | 1208 | * vpddecode.c: Add product ID "PD". Reported by Roger Koot. 1209 | 1210 | 2004-04-11 Jean Delvare 1211 | 1212 | * dmidecode.c, Makefile, README: Drop TABLE_LITTLEENDIAN. 1213 | * README: Update manual pages information. 1214 | 1215 | 2004-04-02 Jean Delvare 1216 | 1217 | * vpddecode.c: Add product ID "NV". Reported by Shawn Starr. 1218 | 1219 | 2004-03-27 Jean Delvare 1220 | 1221 | * vpddecode.c: Add product ID "24". Reported by Paul Sturm. 1222 | * dmidecode.c: Fix two missing comas in string enumerations. Thanks to 1223 | Joshua Goldenhar for reporting the first one. 1224 | 1225 | 2004-03-24 Jean Delvare 1226 | 1227 | * vpddecode.c: Add product ID "PJ". Reported by Roger Koot. 1228 | * vpddecode.c: Rename two Netvista systems to use their real name 1229 | instead of machine type. 1230 | 1231 | 2004-03-20 Petter Reinholdtsen 1232 | 1233 | * Makefile: Make it easier to select where to install the binaries 1234 | and manual pages, and to use different paths when building and 1235 | installing. 1236 | 1237 | 2004-03-19 Jean Delvare 1238 | 1239 | * vpddecode.c: Add product ID "2A". Reported by Rafael Avila 1240 | de Espindola. 1241 | * version.h: Set version to 2.4. 1242 | 1243 | 2004-03-07 Jean Delvare 1244 | 1245 | * biosdecode.c, vpddecode.c: Add a third checksumming method for 1246 | VPD records. 1247 | * vpddecode.c: Add product ID "PI", update "20". Reported by 1248 | Zing Zing Shishak. 1249 | 1250 | 2004-03-05 Jean Delvare 1251 | 1252 | * README: Update. 1253 | 1254 | 2004-02-25 Jean Delvare 1255 | 1256 | * dmidecode.c: Support CPUID document revision 25 (no change). 1257 | * dmidecode.c: Shorten the EOF error message. 1258 | 1259 | 2004-02-23 Jean Delvare 1260 | 1261 | * man/biosdecode.8, man/dmidecode.8, man/ownership.8, 1262 | man/vpddecode.8: New. 1263 | * Makefile: Handle new manual pages. 1264 | 1265 | 2003-12-28 Jean Delvare 1266 | 1267 | * vpddecode.c: Add product ID "PT". Reported by Ramiro Barreiro. 1268 | 1269 | 2003-12-17 Jean Delvare 1270 | 1271 | * vpddecode.c: Add product ID "RE". Reported by Josef Moellers. 1272 | * vpddecode.c, biosdecode.c: Handle longer VPD records as seen on 1273 | xSeries. These have a different checksumming method. 1274 | 1275 | 2003-12-03 Jean Delvare 1276 | 1277 | * vpddecode.c: Add product ID "TT". Reported by Hugues Lepesant. 1278 | * vpddecode.c, biosdecode.c: Fix typo ("Bios" becomes "BIOS"). 1279 | * dmidecode.c: Add another exception to the CPUID-supporting CPU list 1280 | ("Pentium III MMX"). 1281 | * dmidecode.c: Number devices in multi-device on board device 1282 | information structures (DMI case 10). 1283 | 1284 | 2003-11-13 Jean Delvare 1285 | 1286 | * dmidecode.c: Automatically detect architectures on which to use EFI 1287 | (ia64 for now). Suggested by Jeff Moyer. 1288 | 1289 | 2003-11-11 Jean Delvare 1290 | 1291 | * vpddecode.c: Add product ID "KX". Reported by Klaus Ade Johnstad, 1292 | confirmed by Pamela Huntley. 1293 | * dmidecode.c: Display CPUID values as decimal, not hexadecimal. 1294 | This is a reversal of the 2003-07-18 change to be consistent with 1295 | /proc/cpuinfo under Linux. 1296 | * dmidecode.c: Fix processor ID decoding for older 80486. Not very 1297 | important since such systems are unlikely to support SMBIOS. 1298 | * dmidecode.c: Modify CPU signature display for AMD processors. 1299 | * vpddecode.c, biosdecode.c: Fix incorrect VPD checksumming. 1300 | 1301 | 2003-10-24 Jean Delvare 1302 | 1303 | * dmidecode.c: Add another exception to the CPUID-supporting CPU list. 1304 | 1305 | 2003-10-19 Jean Delvare 1306 | 1307 | * README: Clarify why mmap is used. Fix typo. 1308 | * Makefile: Add deleting core to the clean target. 1309 | * version.h: Set version to 2.3. 1310 | 1311 | 2003-10-17 Jean Delvare 1312 | 1313 | * biosdecode.c: Use (void) instead of __attribute__ ((unused)) to 1314 | declare that a function parameter isn't used. According to Alexandre 1315 | Duret-Lutz, this is the portable way do to it. Fix typo in comment. 1316 | * dmidecode.c: Fix typo. 1317 | 1318 | 2003-10-16 Jean Delvare 1319 | 1320 | * dmidecode.c: Remove useless comparison in dmi_system_boot_status. 1321 | Thanks to Alexandre Duret-Lutz for pointing this out. 1322 | * biosdecode.c: Add a missing length check in acpi_decode. Found 1323 | using Valgrind. 1324 | * biosdecode.c: Fix buffer overrun in main. Found using Valgrind. 1325 | 1326 | 2003-10-14 Jean Delvare 1327 | 1328 | * dmidecode.c: Update DMTF reference addresses. 1329 | * dmidecode.c: List two more processors (Athlon64 and Pentium M) 1330 | as x86-class (i.e. supporting CPUID). 1331 | 1332 | 2003-10-11 Jean Delvare 1333 | 1334 | Update to support DMTF Master MIF version 030621 (was 021205). 1335 | 1336 | * dmidecode.c: Handle unknown processor voltage. 1337 | * dmidecode.c: Fix typo in event log method. 1338 | * dmidecode.c: One additional processor type (Pentium M). 1339 | * dmidecode.c: Add the AMD Opteron to the list of x86-class 1340 | processors. Thanks to Mike Cooper for providing information. 1341 | * vpddecode.c: New program for decoding a machine's VPD structure 1342 | (only found in IBM machines). 1343 | * Makefile: Update accordingly. 1344 | * Makefile: Fix dependencies for ownership. Add strip target. Various 1345 | cleanups (reordering, comments, optimization and debug flags). 1346 | * README: Update to reflect the addition of the strip target and the 1347 | vpddecode program. Some additional changes and fixes. 1348 | 1349 | 2003-10-10 Jean Delvare 1350 | 1351 | * dmidecode.c: Change mmap options to prevent dmidecode from being 1352 | killed by the Linux kernel in some rare cases. Reported by 1353 | Mike Cooper. 1354 | * dmidecode.c: Various code cleanups and optimizations. 1355 | 1356 | 2003-10-09 Jean Delvare 1357 | 1358 | * dmidecode.c: Fix a bug that prevented dmidecode to reach DMI tables 1359 | beyond the 2GB memory limit. Reported by Mike Cooper. 1360 | * ownership.c: Add one reference. Code cleanups. 1361 | * CHANGELOG: Fix typo. 1362 | 1363 | 2003-10-08 Jean Delvare 1364 | 1365 | * biosdecode.c: Fix potentially wrong checksum on Sony-specific entry. 1366 | * biosdecode.c: Unimportant changes (comment, typo...) in 1367 | Compaq-specific section. 1368 | * biosdecode.c: Add support for VPD (vital product data, IBM-specific). 1369 | * CHANGELOG: Various updates. 1370 | 1371 | 2003-10-07 Jean Delvare 1372 | 1373 | * ownership.c: Fix a harmless warning on x86_64. Reported by Mike 1374 | Cooper. 1375 | 1376 | 2003-09-19 Jean Delvare 1377 | 1378 | * dmidecode.c: Explicitly say when no SMBIOS nor DMI entry point 1379 | was found. Implicitly suggested by Sergey Leonovich. 1380 | 1381 | 2003-09-11 Jean Delvare 1382 | 1383 | * Makefile: Don't use $^ since it isn't supported by BSD make. 1384 | Reported by Hugues Lepesant. 1385 | 1386 | 2003-09-05 Jean Delvare 1387 | 1388 | * Makefile: Fix missing ownership dependency for install target. 1389 | Reported by Mario Lang. 1390 | 1391 | 2003-08-08 Jean Delvare 1392 | 1393 | * dmidecode.c: Update the README file (mainly the now solved laptop 1394 | and IA-64 issues, and add a section for biosdecode and ownership). 1395 | * version.h: Set version to 2.2. 1396 | 1397 | 2003-07-18 Jean Delvare 1398 | 1399 | * dmidecode.c: Display CPUID values as hexadecimal, not decimal. 1400 | * dmidecode.c: Shift the I2C slave address by one bit to the right 1401 | (DMI case 38). 1402 | 1403 | 2003-06-27 Jean Delvare 1404 | 1405 | * biosdecode.c: Better display of Compaq-specific entries (thank to 1406 | some documentation). 1407 | 1408 | 2003-06-25 Jean Delvare 1409 | 1410 | * dmidecode.c: Remove fp_last (not useful anymore). Reworded the "table 1411 | is unreachable" message to mention the -DUSE_MMAP solution. 1412 | 1413 | 2003-06-19 Jean Delvare 1414 | 1415 | * dmidecode.c: Add support for IA-64. 1416 | * Makefile: Add new option CFLAGS modifier lines for IA-64. 1417 | 1418 | 2003-06-17 Jean Delvare 1419 | 1420 | * dmidecode.c, biosdecode.c: Move common "util" functions to util.c. 1421 | * util.c, util.h: New. 1422 | * types.h: New. 1423 | * Makefile: Update accordingly. 1424 | * biosdecode.c: Add detection of Compaq-specific entries. 1425 | * ownership.c: New program for finding a machine's ownership tag 1426 | (only found in Compaq machines). Requested by Luc Van de Velde. 1427 | * Makefile: Update again. 1428 | 1429 | 2003-06-10 Jean Delvare 1430 | 1431 | * dmidecode.c: Fix typo in IPMI register spacing table. 1432 | * version.h: Set version to 2.1. 1433 | 1434 | 2003-06-04 Jean Delvare 1435 | 1436 | * Makefile: Restore optional CFLAGS modifier lines. 1437 | * README: New. 1438 | 1439 | 2003-05-30 Jean Delvare 1440 | 1441 | * dmidecode.c: Cleaner handling of unreachable table. 1442 | 1443 | 2003-05-27 Jean Delvare 1444 | 1445 | Update to support Intel AP-485 specification (CPUID) revision 023 1446 | (was 021). 1447 | 1448 | * dmidecode.c: Add SBF flag to processor ID (DMI case 4). Add comment 1449 | about new flags returned in ECX. 1450 | 1451 | 2003-05-26 Jean Delvare 1452 | 1453 | Update to support SMBIOS specification version 2.3.4 (was 2.3.3). 1454 | 1455 | * dmidecode.c: Add processor and processor upgrade names (DMI case 4). 1456 | * dmidecode.c: Add slot names (DMI case 9). 1457 | 1458 | 2003-05-22 Jean Delvare 1459 | 1460 | * dmidecode.c: Fix typo reported by David Wilson (DMI case 6). 1461 | 1462 | 2003-03-08 Jean Delvare 1463 | 1464 | * dmidecode.c: Decode more fields according to the IPMI specification 1465 | (DMI case 38). 1466 | 1467 | 2003-03-07 Jean Delvare 1468 | 1469 | Fixed IPMI device information (DMI case 38). Thanks to Richard Sharpe 1470 | for pointing the bugs out. 1471 | 1472 | * dmidecode.c: Fix IPMI interface type being shifted by one. 1473 | * dmidecode.c: Fix NV storage device being improperly displayed. 1474 | * dmidecode.c: Reword IPMI specification revision into specification 1475 | version, as suggested in the IPMI specification itself. 1476 | * dmidecode.c: Add a reference to the IPMI specification. 1477 | * dmidecode.c: Show I2C address as hexadecimal. 1478 | * dmidecode.c: Base address is a QWORD, not DWORD. 1479 | * dmidecode.c: Decode some extra fields according to the IPMI 1480 | specification. 1481 | 1482 | 2003-03-06 Jean Delvare 1483 | 1484 | * dmidecode.c, biosdecode.c: Move all changelog entries to CHANGELOG. 1485 | * CHANGELOG: New. Format inspired by Heroes' ChangeLog file. 1486 | * dmidecode.c, biosdecode.c, Makefile: Update copyright years. 1487 | * dmidecode.c, biosdecode.c, Makefile: Move version definition to 1488 | version.h. Update dependencies accordingly. 1489 | * version.h: New. 1490 | 1491 | 2002-10-21 Jean Delvare 1492 | 1493 | * dmidecode.c: Change supported log type descriptors display. 1494 | * dmidecode.c: Code optimization in event log status. 1495 | * dmidecode.c: Remove extra newline in voltage probe accuracy. 1496 | * dmidecode.c: Display "OEM-specific" if type is 128 or more. 1497 | * dmidecode.c: Do not display Strings on dump if there are no strings. 1498 | * dmidecode.c: Add ASCII-filtering to dmi_string. 1499 | * dmidecode.c: Convert all dates to ISO 8601. 1500 | 1501 | 2002-10-18 Jean Delvare 1502 | 1503 | * dmidecode.c: Complete rewrite. 1504 | * dmidecode.c: Now complies with SMBIOS specification 2.3.3. 1505 | * dmidecode.c: Move all non-DMI stuff to biosdecode.c. 1506 | * biosdecode.c: New. 1507 | 1508 | 2002-10-15 Jean Delvare 1509 | 1510 | * dmidecode.c: Fix bad index in DMI case 27 (cooling device). 1511 | 1512 | 2002-10-14 Jean Delvare 1513 | 1514 | * dmidecode.c: Fix typo in dmi_memory_array_location. 1515 | * dmidecode.c: Replace Kbyte by kB in DMI case 16. 1516 | * dmidecode.c: Add DDR entry in dmi_memory_device_type. 1517 | * dmidecode.c: Fix extra s in SYSID. 1518 | 1519 | 2002-10-12 Jean Delvare 1520 | 1521 | * dmidecode.c: Fix maximum cache size and installed size being 1522 | inverted. 1523 | * dmidecode.c: Fix typos in port types. 1524 | 1525 | 2002-10-10 Jean Delvare 1526 | 1527 | * dmidecode.c: Remove extra semicolon at the end of 1528 | dmi_memory_array_use. 1529 | * dmidecode.c: Fix compilation warnings. 1530 | * dmidecode.c: Add missing backslash in DMI case 37. 1531 | * dmidecode.c: Fix BIOS ROM size (DMI case 0). 1532 | 1533 | 2002-10-05 Jean Delvare 1534 | 1535 | * dmidecode.c: More ACPI decoded. 1536 | * dmidecode.c: More PNP decoded. 1537 | * dmidecode.c: More SYSID decoded. 1538 | * dmidecode.c: PCI Interrupt Routing decoded. 1539 | * dmidecode.c: BIOS32 Service Directory decoded. 1540 | * dmidecode.c: Sony system detection (unconfirmed). 1541 | * dmidecode.c: Checksums verified whenever possible. 1542 | * dmidecode.c: Better checks on file read and close. 1543 | * dmidecode.c: Define VERSION and display version at beginning. 1544 | * dmidecode.c: More secure decoding (won't run off the table in any 1545 | case). 1546 | * dmidecode.c: Do not try to decode more structures than announced. 1547 | * dmidecode.c: Fix an off-by-one error that caused the last address 1548 | being scanned to be 0x100000, not 0xFFFF0 as it should. 1549 | 1550 | 2002-09-28 Jean Delvare 1551 | 1552 | * dmidecode.c: Fix missing coma in dmi_bus_name. 1553 | * dmidecode.c: Remove unwanted bitmaskings in dmi_mgmt_dev_type, 1554 | dmi_mgmt_addr_type, dmi_fan_type, dmi_volt_loc, dmi_temp_loc and 1555 | dmi_status. 1556 | * dmidecode.c: Fix DMI table read bug ("dmi: read: Success"). 1557 | * dmidecode.c: Make the code pass -W again. 1558 | * dmidecode.c: Fix return value of dmi_card_size. 1559 | 1560 | 2002-09-20 Dave Johnson 1561 | 1562 | * dmidecode.c: Fix comparisons in dmi_bus_name. 1563 | * dmidecode.c: Fix comparison in dmi_processor_type. 1564 | * dmidecode.c: Fix bitmasking in dmi_onboard_type. 1565 | * dmidecode.c: Fix return value of dmi_temp_loc. 1566 | 1567 | 2002-09-17 Larry Lile 1568 | 1569 | * dmidecode.c: Type 16 & 17 structures displayed per SMBIOS 2.3.1 spec. 1570 | 1571 | 2002-08-23 Alan Cox 1572 | 1573 | * dmidecode.c: Make the code pass -Wall -pedantic by fixing a few 1574 | harmless sign of pointer mismatches. 1575 | * dmidecode.c: Correct main() prototype. 1576 | * dmidecode.c: Check for compilers with wrong type sizes. 1577 | 1578 | 2002-08-09 Jean Delvare 1579 | 1580 | * dmidecode.c: Better DMI struct count/size error display. 1581 | * dmidecode.c: More careful memory access in dmi_table. 1582 | * dmidecode.c: DMI case 13 (Language) decoded. 1583 | * dmidecode.c: C++ style comments removed. Commented out code removed. 1584 | * dmidecode.c: DMI 0.0 case handled. 1585 | * dmideocde.c: Fix return value of dmi_port_type and 1586 | dmi_port_connector_type. 1587 | 1588 | 2002-08-06 Jean Delvare 1589 | 1590 | * dmidecode.c: Reposition file pointer after DMI table display. 1591 | * dmidecode.c: Disable first RSD PTR checksum (was not correct anyway). 1592 | * dmidecode.c: Show actual DMI struct count and occupied size. 1593 | * dmidecode.c: Check for NULL after malloc. 1594 | * dmidecode.c: Use SEEK_* constants instead of numeric values. 1595 | * dmidecode.c: Code optimization (and warning fix) in DMI cases 10 and 1596 | 14. 1597 | * dmidecode.c: Add else's to avoid unneeded cascaded if's in main loop. 1598 | * dmidecode.c: Code optimization in DMI information display. 1599 | * dmidecode.c: Fix all compilation warnings. 1600 | 1601 | 2002-08-03 Mark D. Studebaker 1602 | 1603 | * dmidecode.c: Better indent in dump_raw_data. 1604 | * dmidecode.c: Fix return value of dmi_bus_name. 1605 | * dmidecode.c: Additional sensor fields decoded. 1606 | * dmidecode.c: Fix compilation warnings. 1607 | 1608 | 2001-12-13 Arjan van de Ven 1609 | 1610 | * dmidecode.c: Fix memory bank type (DMI case 6). 1611 | 1612 | 2001-07-02 Matt Domsch 1613 | 1614 | * dmidecode.c: Additional structures displayed per SMBIOS 2.3.1 spec. 1615 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # DMI Decode 3 | # BIOS Decode 4 | # VPD Decode 5 | # 6 | # Copyright (C) 2000-2002 Alan Cox 7 | # Copyright (C) 2002-2015 Jean Delvare 8 | # 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2 of the License, or 12 | # (at your option) any later version. 13 | # 14 | 15 | CC = gcc 16 | CFLAGS = -W -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-qual \ 17 | -Wcast-align -Wwrite-strings -Wmissing-prototypes -Winline -Wundef 18 | 19 | # Let lseek and mmap support 64-bit wide offsets 20 | CFLAGS += -D_FILE_OFFSET_BITS=64 21 | 22 | #CFLAGS += -DBIGENDIAN 23 | #CFLAGS += -DALIGNMENT_WORKAROUND 24 | 25 | # When debugging, disable -O2 and enable -g. 26 | CFLAGS += -O2 27 | #CFLAGS += -g 28 | 29 | # Pass linker flags here 30 | LDFLAGS = 31 | 32 | # Flags for Apple macOS 33 | ifeq ($(shell uname -s),Darwin) 34 | CFLAGS += -Wno-constant-logical-operand 35 | LDFLAGS += -framework CoreServices -framework IOKit 36 | endif 37 | 38 | DESTDIR = 39 | prefix = /usr/local 40 | sbindir = $(prefix)/sbin 41 | mandir = $(prefix)/share/man 42 | man8dir = $(mandir)/man8 43 | docdir = $(prefix)/share/doc/dmidecode 44 | 45 | INSTALL := install 46 | INSTALL_DATA := $(INSTALL) -m 644 47 | INSTALL_DIR := $(INSTALL) -m 755 -d 48 | INSTALL_PROGRAM := $(INSTALL) -m 755 49 | RM := rm -f 50 | 51 | # BSD make provides $MACHINE, but GNU make doesn't 52 | MACHINE ?= $(shell uname -m 2>/dev/null) 53 | 54 | # These programs are only useful on x86 55 | PROGRAMS-i386 := biosdecode ownership vpddecode 56 | PROGRAMS-i486 := $(PROGRAMS-i386) 57 | PROGRAMS-i586 := $(PROGRAMS-i386) 58 | PROGRAMS-i686 := $(PROGRAMS-i386) 59 | PROGRAMS-x86_64 := biosdecode ownership vpddecode 60 | PROGRAMS-amd64 := $(PROGRAMS-x86_64) 61 | 62 | PROGRAMS := dmidecode $(PROGRAMS-$(MACHINE)) 63 | 64 | all : $(PROGRAMS) 65 | 66 | # 67 | # Programs 68 | # 69 | 70 | dmidecode : dmidecode.o dmiopt.o dmioem.o util.o 71 | $(CC) $(LDFLAGS) dmidecode.o dmiopt.o dmioem.o util.o -o $@ 72 | 73 | biosdecode : biosdecode.o util.o 74 | $(CC) $(LDFLAGS) biosdecode.o util.o -o $@ 75 | 76 | ownership : ownership.o util.o 77 | $(CC) $(LDFLAGS) ownership.o util.o -o $@ 78 | 79 | vpddecode : vpddecode.o vpdopt.o util.o 80 | $(CC) $(LDFLAGS) vpddecode.o vpdopt.o util.o -o $@ 81 | 82 | # 83 | # Objects 84 | # 85 | 86 | dmidecode.o : dmidecode.c version.h types.h util.h config.h dmidecode.h \ 87 | dmiopt.h dmioem.h 88 | $(CC) $(CFLAGS) -c $< -o $@ 89 | 90 | dmiopt.o : dmiopt.c config.h types.h util.h dmidecode.h dmiopt.h 91 | $(CC) $(CFLAGS) -c $< -o $@ 92 | 93 | dmioem.o : dmioem.c types.h dmidecode.h dmioem.h 94 | $(CC) $(CFLAGS) -c $< -o $@ 95 | 96 | biosdecode.o : biosdecode.c version.h types.h util.h config.h 97 | $(CC) $(CFLAGS) -c $< -o $@ 98 | 99 | ownership.o : ownership.c version.h types.h util.h config.h 100 | $(CC) $(CFLAGS) -c $< -o $@ 101 | 102 | vpddecode.o : vpddecode.c version.h types.h util.h config.h vpdopt.h 103 | $(CC) $(CFLAGS) -c $< -o $@ 104 | 105 | vpdopt.o : vpdopt.c config.h util.h vpdopt.h 106 | $(CC) $(CFLAGS) -c $< -o $@ 107 | 108 | util.o : util.c types.h util.h config.h 109 | $(CC) $(CFLAGS) -c $< -o $@ 110 | 111 | # 112 | # Commands 113 | # 114 | 115 | strip : $(PROGRAMS) 116 | strip $(PROGRAMS) 117 | 118 | install : install-bin install-man install-doc 119 | 120 | uninstall : uninstall-bin uninstall-man uninstall-doc 121 | 122 | install-bin : $(PROGRAMS) 123 | $(INSTALL_DIR) $(DESTDIR)$(sbindir) 124 | for program in $(PROGRAMS) ; do \ 125 | $(INSTALL_PROGRAM) $$program $(DESTDIR)$(sbindir) ; done 126 | 127 | uninstall-bin : 128 | for program in $(PROGRAMS) ; do \ 129 | $(RM) $(DESTDIR)$(sbindir)/$$program ; done 130 | 131 | install-man : 132 | $(INSTALL_DIR) $(DESTDIR)$(man8dir) 133 | for program in $(PROGRAMS) ; do \ 134 | $(INSTALL_DATA) man/$$program.8 $(DESTDIR)$(man8dir) ; done 135 | 136 | uninstall-man : 137 | for program in $(PROGRAMS) ; do \ 138 | $(RM) $(DESTDIR)$(man8dir)/$$program.8 ; done 139 | 140 | install-doc : 141 | $(INSTALL_DIR) $(DESTDIR)$(docdir) 142 | $(INSTALL_DATA) README $(DESTDIR)$(docdir) 143 | $(INSTALL_DATA) CHANGELOG $(DESTDIR)$(docdir) 144 | $(INSTALL_DATA) AUTHORS $(DESTDIR)$(docdir) 145 | 146 | uninstall-doc : 147 | $(RM) -r $(DESTDIR)$(docdir) 148 | 149 | clean : 150 | $(RM) *.o $(PROGRAMS) core 151 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | ** INTRODUCTION ** 2 | 3 | Dmidecode reports information about your system's hardware as described in 4 | your system BIOS according to the SMBIOS/DMI standard. This information 5 | typically includes system manufacturer, model name, serial number, BIOS 6 | version, asset tag as well as a lot of other details of varying level of 7 | interest and reliability depending on the manufacturer. This will often 8 | include usage status for the CPU sockets, expansion slots (e.g. AGP, PCI, 9 | ISA) and memory module slots, and the list of I/O ports (e.g. serial, 10 | parallel, USB). 11 | 12 | DMI data can be used to enable or disable specific portions of kernel code 13 | depending on the specific hardware. Thus, one use of dmidecode is for kernel 14 | developers to detect system "signatures" and add them to the kernel source 15 | code when needed. 16 | 17 | Beware that DMI data have proven to be too unreliable to be blindly trusted. 18 | Dmidecode does not scan your hardware, it only reports what the BIOS told it 19 | to. 20 | 21 | 22 | ** INSTALLATION ** 23 | 24 | The home web page for dmidecode is hosted on Savannah: 25 | http://www.nongnu.org/dmidecode/ 26 | You will find the latest version (including CVS) there, as well as fresh news 27 | and other interesting material, such as a list of related projects and 28 | articles. 29 | 30 | This program was first written for Linux, and has since been reported to work 31 | on FreeBSD, NetBSD, OpenBSD, BeOS and Solaris as well. 32 | 33 | There's no configure script, so simply run "make" to build dmidecode, and 34 | "make install" to install it. You also can use "make uninstall" to remove 35 | all the files you installed. By default, files are installed in /usr/local 36 | but you can change this behavior by editing the Makefile file and setting 37 | prefix to wherever you want. You may change the C compiler and the 38 | compilation flags as well. 39 | 40 | Optionally, you can run "make strip" prior to "make install" if you want 41 | smaller binaries. However, be aware that this will prevent any further 42 | attempt to debug the programs. 43 | 44 | Two parameters can be set in the Makefile file to make dmidecode work on 45 | non-i386 systems. They should be used if your system uses the big endian 46 | byte ordering (Motorola) or doesn't support unaligned memory accesses, 47 | respectively. For example, compiling for a SPARC processor would require 48 | both (but I am not aware of SPARC-based systems implementing SMBIOS). 49 | Compiling for an IA64 processor requires the memory alignment workaround, 50 | and it is enabled automatically. 51 | 52 | 53 | ** DOCUMENTATION ** 54 | 55 | Each tool has a manual page, found in the "man" subdirectory. Manual pages 56 | are installed by "make install". See these manual pages for command line 57 | interface details and tool specific information. 58 | 59 | For an history of the changes made to dmidecode, see the CHANGELOG file. 60 | 61 | If you need help, your best chances are to visit the web page (see the 62 | INSTALLATION section above) or to get in touch with the developers directly. 63 | Have a look at the AUTHORS file and contact one of the maintainers. 64 | 65 | If you want to help with the development of dmidecode, please consider 66 | joining the dmidecode-devel discussion list: 67 | http://lists.nongnu.org/mailman/listinfo/dmidecode-devel 68 | 69 | 70 | ** COMMON PROBLEMS ** 71 | 72 | IA-64 73 | 74 | Non-Linux systems are not yet supported. 75 | 76 | MMAP 77 | 78 | Note that mmap() is now used by default wherever possible, since this seems 79 | to solve a number of problems. This default behavior can be changed in 80 | config.h. Just to make sure this is clear, mmap() is not used for performance 81 | reasons but to increase the number of systems on which dmidecode can be 82 | successfully run. 83 | 84 | CYGWIN 85 | 86 | Dmidecode used to work under Cygwin. However the /dev/mem interface was 87 | removed at some point in time so it no longer works. 88 | 89 | 90 | ** MISCELLANEOUS TOOLS ** 91 | 92 | Three other tools come along with dmidecode: biosdecode, ownership and 93 | vpddecode. These tools are only useful on systems with a BIOS, so they 94 | are not built on IA-64 by default. 95 | 96 | BIOSDECODE 97 | 98 | This one prints all BIOS related information it can find in /dev/mem. 99 | It used to be part of dmidecode itself, but as dmidecode was growing, 100 | we felt that the non-DMI part had to be moved to a separate tool. 101 | 102 | OWNERSHIP 103 | 104 | This tool was written on a request by Luc Van de Velde for use with Novell 105 | tools in his company. It retrieves the "ownership tag" that can be set on 106 | most Compaq computers. Since it uses the same mechanisms dmidecode and 107 | biosdecode use, and could be of some use for other people as well, we 108 | decided to make it part of the project. 109 | 110 | VPDDECODE 111 | 112 | This tool prints the contents of the "vital product data" structure as 113 | found in most IBM and Lenovo computers. It used to have a lookup table 114 | for the machine name, but it was unreliable and hard to maintain so it 115 | was ultimately dropped. It has a command line interface. 116 | -------------------------------------------------------------------------------- /biosdecode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * BIOS Decode 3 | * 4 | * Copyright (C) 2000-2002 Alan Cox 5 | * Copyright (C) 2002-2017 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | * For the avoidance of doubt the "preferred form" of this code is one which 22 | * is in an open unpatent encumbered format. Where cryptographic key signing 23 | * forms part of the process of creating an executable the information 24 | * including keys needed to generate an equivalently functional executable 25 | * are deemed to be part of the source code. 26 | * 27 | * References: 28 | * - DMTF "System Management BIOS (SMBIOS) Reference Specification" 29 | * Version 3.0.0 30 | * http://www.dmtf.org/standards/smbios 31 | * - Intel "Preboot Execution Environment (PXE) Specification" 32 | * Version 2.1 33 | * http://www.intel.com/labs/manage/wfm/wfmspecs.htm 34 | * - ACPI "Advanced Configuration and Power Interface Specification" 35 | * Revision 2.0 36 | * http://www.acpi.info/spec20.htm 37 | * - Phoenix "BIOS32 Service Directory" 38 | * Revision 0.4 39 | * http://www.phoenix.com/en/support/white+papers-specs/ 40 | * - Microsoft "Plug and Play BIOS Specification" 41 | * Version 1.0A 42 | * http://www.microsoft.com/hwdev/tech/PnP/ 43 | * - Microsoft "PCI IRQ Routing Table Specification" 44 | * Version 1.0 45 | * http://www.microsoft.com/hwdev/archive/BUSBIOS/pciirq.asp 46 | * - Compaq "Technical Reference Guide for Compaq Deskpro 4000 and 6000" 47 | * First Edition 48 | * http://h18000.www1.hp.com/support/techpubs/technical_reference_guides/113a1097.html 49 | * - IBM "Using the BIOS Build ID to identify Thinkpad systems" 50 | * Revision 2005-09-19 51 | * http://www-307.ibm.com/pc/support/site.wss/MIGR-45120.html 52 | * - Fujitsu application panel technical details 53 | * As of July 23rd, 2004 54 | * http://apanel.sourceforge.net/tech.php 55 | * - Intel Multiprocessor Specification 56 | * Version 1.4 57 | * http://www.intel.com/design/archives/processors/pro/docs/242016.htm 58 | */ 59 | 60 | #include 61 | #include 62 | #include 63 | #include 64 | #include 65 | 66 | #include "version.h" 67 | #include "config.h" 68 | #include "types.h" 69 | #include "util.h" 70 | 71 | /* Options are global */ 72 | struct opt 73 | { 74 | const char *devmem; 75 | unsigned int flags; 76 | }; 77 | static struct opt opt; 78 | 79 | #define FLAG_VERSION (1 << 0) 80 | #define FLAG_HELP (1 << 1) 81 | 82 | struct bios_entry { 83 | const char *anchor; 84 | size_t anchor_len; /* computed */ 85 | off_t low_address; 86 | off_t high_address; 87 | size_t (*length)(const u8 *); 88 | int (*decode)(const u8*, size_t); 89 | }; 90 | 91 | 92 | /* 93 | * SMBIOS 94 | */ 95 | 96 | static size_t smbios3_length(const u8 *p) 97 | { 98 | return p[0x06]; 99 | } 100 | 101 | static int smbios3_decode(const u8 *p, size_t len) 102 | { 103 | if (len < 0x18 || !checksum(p, p[0x06])) 104 | return 0; 105 | 106 | printf("SMBIOS %u.%u.%u present.\n", 107 | p[0x07], p[0x08], p[0x09]); 108 | printf("\tStructure Table Maximum Length: %u bytes\n", 109 | DWORD(p + 0x0C)); 110 | printf("\tStructure Table 64-bit Address: 0x%08X%08X\n", 111 | QWORD(p + 0x10).h, QWORD(p + 0x10).l); 112 | 113 | return 1; 114 | } 115 | 116 | static size_t smbios_length(const u8 *p) 117 | { 118 | return p[0x05] == 0x1E ? 0x1F : p[0x05]; 119 | } 120 | 121 | static int smbios_decode(const u8 *p, size_t len) 122 | { 123 | if (len < 0x1F || !checksum(p, p[0x05]) 124 | || memcmp("_DMI_", p + 0x10, 5) != 0 125 | || !checksum(p + 0x10, 0x0F)) 126 | return 0; 127 | 128 | printf("SMBIOS %u.%u present.\n", 129 | p[0x06], p[0x07]); 130 | printf("\tStructure Table Length: %u bytes\n", 131 | WORD(p + 0x16)); 132 | printf("\tStructure Table Address: 0x%08X\n", 133 | DWORD(p + 0x18)); 134 | printf("\tNumber Of Structures: %u\n", 135 | WORD(p + 0x1C)); 136 | printf("\tMaximum Structure Size: %u bytes\n", 137 | WORD(p + 0x08)); 138 | 139 | return 1; 140 | } 141 | 142 | static size_t dmi_length(const u8 *p) 143 | { 144 | (void) p; 145 | 146 | return 0x0F; 147 | } 148 | 149 | static int dmi_decode(const u8 *p, size_t len) 150 | { 151 | if (len < 0x0F || !checksum(p, len)) 152 | return 0; 153 | 154 | printf("Legacy DMI %u.%u present.\n", 155 | p[0x0E]>>4, p[0x0E] & 0x0F); 156 | printf("\tStructure Table Length: %u bytes\n", 157 | WORD(p + 0x06)); 158 | printf("\tStructure Table Address: 0x%08X\n", 159 | DWORD(p + 0x08)); 160 | printf("\tNumber Of Structures: %u\n", 161 | WORD(p + 0x0C)); 162 | 163 | return 1; 164 | } 165 | 166 | /* 167 | * SYSID 168 | */ 169 | 170 | static size_t sysid_length(const u8 *p) 171 | { 172 | return WORD(p + 0x08); 173 | } 174 | 175 | static int sysid_decode(const u8 *p, size_t len) 176 | { 177 | if (len < 0x11 || !checksum(p, WORD(p + 0x08))) 178 | return 0; 179 | 180 | printf("SYSID present.\n"); 181 | printf("\tRevision: %u\n", 182 | p[0x10]); 183 | printf("\tStructure Table Address: 0x%08X\n", 184 | DWORD(p + 0x0A)); 185 | printf("\tNumber Of Structures: %u\n", 186 | WORD(p + 0x0E)); 187 | 188 | return 1; 189 | } 190 | 191 | /* 192 | * PnP 193 | */ 194 | 195 | static size_t pnp_length(const u8 *p) 196 | { 197 | return p[0x05]; 198 | } 199 | 200 | static const char *pnp_event_notification(u8 code) 201 | { 202 | static const char *notification[] = { 203 | "Not Supported", /* 0x0 */ 204 | "Polling", 205 | "Asynchronous", 206 | "Unknown" /* 0x3 */ 207 | }; 208 | 209 | return notification[code]; 210 | } 211 | 212 | static int pnp_decode(const u8 *p, size_t len) 213 | { 214 | if (len < 0x21 || !checksum(p, p[0x05])) 215 | return 0; 216 | 217 | printf("PNP BIOS %u.%u present.\n", 218 | p[0x04] >> 4, p[0x04] & 0x0F); 219 | printf("\tEvent Notification: %s\n", 220 | pnp_event_notification(WORD(p + 0x06) & 0x03)); 221 | if ((WORD(p + 0x06) & 0x03) == 0x01) 222 | printf("\tEvent Notification Flag Address: 0x%08X\n", 223 | DWORD(p + 0x09)); 224 | printf("\tReal Mode 16-bit Code Address: %04X:%04X\n", 225 | WORD(p + 0x0F), WORD(p + 0x0D)); 226 | printf("\tReal Mode 16-bit Data Address: %04X:0000\n", 227 | WORD(p + 0x1B)); 228 | printf("\t16-bit Protected Mode Code Address: 0x%08X\n", 229 | DWORD(p + 0x13) + WORD(p + 0x11)); 230 | printf("\t16-bit Protected Mode Data Address: 0x%08X\n", 231 | DWORD(p + 0x1D)); 232 | if (DWORD(p + 0x17) != 0) 233 | printf("\tOEM Device Identifier: %c%c%c%02X%02X\n", 234 | 0x40 + ((p[0x17] >> 2) & 0x1F), 235 | 0x40 + ((p[0x17] & 0x03) << 3) + ((p[0x18] >> 5) & 0x07), 236 | 0x40 + (p[0x18] & 0x1F), p[0x19], p[0x20]); 237 | 238 | return 1; 239 | } 240 | 241 | /* 242 | * ACPI 243 | */ 244 | 245 | static size_t acpi_length(const u8 *p) 246 | { 247 | return p[15] == 2 ? 36 : 20; 248 | } 249 | 250 | static const char *acpi_revision(u8 code) 251 | { 252 | switch (code) 253 | { 254 | case 0: 255 | return " 1.0"; 256 | case 2: 257 | return " 2.0"; 258 | default: 259 | return ""; 260 | } 261 | } 262 | 263 | static int acpi_decode(const u8 *p, size_t len) 264 | { 265 | if (len < 20 || !checksum(p, 20)) 266 | return 0; 267 | 268 | printf("ACPI%s present.\n", 269 | acpi_revision(p[15])); 270 | printf("\tOEM Identifier: %c%c%c%c%c%c\n", 271 | p[9], p[10], p[11], p[12], p[13], p[14]); 272 | printf("\tRSD Table 32-bit Address: 0x%08X\n", 273 | DWORD(p + 16)); 274 | 275 | if (len < 36) 276 | return 1; 277 | 278 | if (DWORD(p + 20) > len || !checksum(p, DWORD(p + 20))) 279 | return 0; 280 | 281 | if (DWORD(p + 20) < 32) return 1; 282 | 283 | printf("\tXSD Table 64-bit Address: 0x%08X%08X\n", 284 | QWORD(p + 24).h, QWORD(p + 24).l); 285 | 286 | return 1; 287 | } 288 | 289 | /* 290 | * Sony 291 | */ 292 | 293 | static size_t sony_length(const u8 *p) 294 | { 295 | return p[0x05]; 296 | } 297 | 298 | static int sony_decode(const u8 *p, size_t len) 299 | { 300 | if (!checksum(p, len)) 301 | return 0; 302 | 303 | printf("Sony system detected.\n"); 304 | 305 | return 1; 306 | } 307 | 308 | /* 309 | * BIOS32 310 | */ 311 | 312 | static size_t bios32_length(const u8 *p) 313 | { 314 | return p[0x09] << 4; 315 | } 316 | 317 | static int bios32_decode(const u8 *p, size_t len) 318 | { 319 | if (len < 0x0A || !checksum(p, p[0x09] << 4)) 320 | return 0; 321 | 322 | printf("BIOS32 Service Directory present.\n"); 323 | printf("\tRevision: %u\n", 324 | p[0x08]); 325 | printf("\tCalling Interface Address: 0x%08X\n", 326 | DWORD(p + 0x04)); 327 | 328 | return 1; 329 | } 330 | 331 | /* 332 | * PIR 333 | */ 334 | 335 | static void pir_irqs(u16 code) 336 | { 337 | if (code == 0) 338 | printf(" None"); 339 | else 340 | { 341 | u8 i; 342 | 343 | for (i = 0; i < 16; i++) 344 | if (code & (1 << i)) 345 | printf(" %u", i); 346 | } 347 | } 348 | 349 | static void pir_slot_number(u8 code) 350 | { 351 | if (code == 0) 352 | printf(" on-board"); 353 | else 354 | printf(" slot number %u", code); 355 | } 356 | 357 | static size_t pir_length(const u8 *p) 358 | { 359 | return WORD(p + 6); 360 | } 361 | 362 | static int pir_decode(const u8 *p, size_t len) 363 | { 364 | int i; 365 | 366 | if (len < 32 || !checksum(p, WORD(p + 6))) 367 | return 0; 368 | 369 | printf("PCI Interrupt Routing %u.%u present.\n", 370 | p[5], p[4]); 371 | printf("\tRouter ID: %02x:%02x.%1x\n", 372 | p[8], p[9]>>3, p[9] & 0x07); 373 | printf("\tExclusive IRQs:"); 374 | pir_irqs(WORD(p + 10)); 375 | printf("\n"); 376 | if (DWORD(p + 12) != 0) 377 | printf("\tCompatible Router: %04x:%04x\n", 378 | WORD(p + 12), WORD(p + 14)); 379 | if (DWORD(p + 16) != 0) 380 | printf("\tMiniport Data: 0x%08X\n", 381 | DWORD(p + 16)); 382 | 383 | for (i = 1; i <= (WORD(p + 6) - 32) / 16; i++) 384 | { 385 | printf("\tSlot Entry %u: ID %02x:%02x,", 386 | i, p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3); 387 | pir_slot_number(p[(i + 1) * 16 + 14]); 388 | printf("\n"); 389 | /* printf("\tSlot Entry %u\n", i); 390 | printf("\t\tID: %02x:%02x\n", 391 | p[(i + 1) * 16], p[(i + 1) * 16 + 1] >> 3); 392 | printf("\t\tLink Value for INTA#: %u\n", 393 | p[(i + 1) * 16 + 2]); 394 | printf("\t\tIRQ Bitmap for INTA#:"); 395 | pir_irqs(WORD(p + (i + 1) * 16 + 3)); 396 | printf("\n"); 397 | printf("\t\tLink Value for INTB#: %u\n", 398 | p[(i + 1) * 16 + 5]); 399 | printf("\t\tIRQ Bitmap for INTB#:"); 400 | pir_irqs(WORD(p + (i + 1) * 16 + 6)); 401 | printf("\n"); 402 | printf("\t\tLink Value for INTC#: %u\n", 403 | p[(i + 1) * 16 + 8]); 404 | printf("\t\tIRQ Bitmap for INTC#:"); 405 | pir_irqs(WORD(p + (i + 1) * 16 + 9)); 406 | printf("\n"); 407 | printf("\t\tLink Value for INTD#: %u\n", 408 | p[(i + 1) * 16 + 11]); 409 | printf("\t\tIRQ Bitmap for INTD#:"); 410 | pir_irqs(WORD(p + (i + 1) * 16 + 12)); 411 | printf("\n"); 412 | printf("\t\tSlot Number:"); 413 | pir_slot_number(p[(i + 1) * 16 + 14]); 414 | printf("\n");*/ 415 | } 416 | 417 | return 1; 418 | } 419 | 420 | /* 421 | * Compaq-specific entries 422 | */ 423 | 424 | static size_t compaq_length(const u8 *p) 425 | { 426 | return p[4] * 10 + 5; 427 | } 428 | 429 | static int compaq_decode(const u8 *p, size_t len) 430 | { 431 | unsigned int i; 432 | (void) len; 433 | 434 | printf("Compaq-specific entries present.\n"); 435 | 436 | /* integrity checking (lack of checksum) */ 437 | for (i = 0; i < p[4]; i++) 438 | { 439 | /* 440 | * We do not check for truncated entries, because the length 441 | * was computed from the number of records in compaq_length 442 | * right above, so it can't be wrong. 443 | */ 444 | if (p[5 + i * 10] != '$' 445 | || !(p[6 + i * 10] >= 'A' && p[6 + i * 10] <= 'Z') 446 | || !(p[7 + i * 10] >= 'A' && p[7 + i * 10] <= 'Z') 447 | || !(p[8 + i * 10] >= 'A' && p[8 + i * 10] <= 'Z')) 448 | { 449 | printf("\t Abnormal entry! Please report. [%02X %02X " 450 | "%02X %02X]\n", p[5 + i * 10], p[6 + i * 10], 451 | p[7 + i * 10], p[8 + i * 10]); 452 | return 0; 453 | } 454 | } 455 | 456 | for (i = 0; i < p[4]; i++) 457 | { 458 | printf("\tEntry %u: %c%c%c%c at 0x%08X (%u bytes)\n", 459 | i + 1, p[5 + i * 10], p[6 + i * 10], p[7 + i * 10], 460 | p[8 + i * 10], DWORD(p + 9 + i * 10), 461 | WORD(p + 13 + i * 10)); 462 | } 463 | 464 | return 1; 465 | } 466 | 467 | /* 468 | * VPD (vital product data, IBM-specific) 469 | */ 470 | 471 | static void vpd_print_entry(const char *name, const u8 *p, size_t len) 472 | { 473 | size_t i; 474 | 475 | printf("\t%s: ", name); 476 | for (i = 0; i < len; i++) 477 | if (p[i] >= 32 && p[i] < 127) 478 | printf("%c", p[i]); 479 | printf("\n"); 480 | } 481 | 482 | static size_t vpd_length(const u8 *p) 483 | { 484 | return p[5]; 485 | } 486 | 487 | static int vpd_decode(const u8 *p, size_t len) 488 | { 489 | if (len < 0x30) 490 | return 0; 491 | 492 | /* XSeries have longer records. */ 493 | if (!(len >= 0x45 && checksum(p, len)) 494 | /* Some Netvista seem to work with this. */ 495 | && !checksum(p, 0x30) 496 | /* The Thinkpad checksum does *not* include the first 13 bytes. */ 497 | && !checksum(p + 0x0D, 0x30 - 0x0D)) 498 | return 0; 499 | 500 | printf("VPD present.\n"); 501 | 502 | vpd_print_entry("BIOS Build ID", p + 0x0D, 9); 503 | vpd_print_entry("Box Serial Number", p + 0x16, 7); 504 | vpd_print_entry("Motherboard Serial Number", p + 0x1D, 11); 505 | vpd_print_entry("Machine Type/Model", p + 0x28, 7); 506 | 507 | if (len < 0x45) 508 | return 1; 509 | 510 | vpd_print_entry("BIOS Release Date", p + 0x30, 8); 511 | 512 | return 1; 513 | } 514 | 515 | /* 516 | * Fujitsu application panel 517 | */ 518 | 519 | static size_t fjkeyinf_length(const u8 *p) 520 | { 521 | (void) p; 522 | /* 523 | * We don't know at this point, it's somewhere between 12 and 32. 524 | * So we return the max, it shouldn't hurt. 525 | */ 526 | return 32; 527 | } 528 | 529 | static int fjkeyinf_decode(const u8 *p, size_t len) 530 | { 531 | int i; 532 | (void) len; 533 | 534 | printf("Fujitsu application panel present.\n"); 535 | 536 | for (i = 0; i < 6; i++) 537 | { 538 | if (*(p + 8 + i * 4) == 0) 539 | return 1; 540 | printf("\tDevice %d: type %u, chip %u", i + 1, 541 | *(p + 8 + i * 4), *(p + 8 + i * 4 + 2)); 542 | if (*(p + 8 + i * 4 + 1)) /* Access method */ 543 | printf(", SMBus address 0x%x", 544 | *(p + 8 + i * 4 + 3) >> 1); 545 | printf("\n"); 546 | } 547 | 548 | return 1; 549 | } 550 | 551 | /* 552 | * Intel Multiprocessor 553 | */ 554 | 555 | static size_t mp_length(const u8 *p) 556 | { 557 | return 16 * p[8]; 558 | } 559 | 560 | static int mp_decode(const u8 *p, size_t len) 561 | { 562 | if (!checksum(p, len)) 563 | return 0; 564 | 565 | printf("Intel Multiprocessor present.\n"); 566 | printf("\tSpecification Revision: %s\n", 567 | p[9] == 0x01 ? "1.1" : p[9] == 0x04 ? "1.4" : "Invalid"); 568 | if (p[11]) 569 | printf("\tDefault Configuration: #%d\n", p[11]); 570 | else 571 | printf("\tConfiguration Table Address: 0x%08X\n", 572 | DWORD(p + 4)); 573 | printf("\tMode: %s\n", p[12] & (1 << 7) ? 574 | "IMCR and PIC" : "Virtual Wire"); 575 | 576 | return 1; 577 | } 578 | 579 | /* 580 | * Main 581 | */ 582 | 583 | static struct bios_entry bios_entries[] = { 584 | { "_SM3_", 0, 0xF0000, 0xFFFFF, smbios3_length, smbios3_decode }, 585 | { "_SM_", 0, 0xF0000, 0xFFFFF, smbios_length, smbios_decode }, 586 | { "_DMI_", 0, 0xF0000, 0xFFFFF, dmi_length, dmi_decode }, 587 | { "_SYSID_", 0, 0xE0000, 0xFFFFF, sysid_length, sysid_decode }, 588 | { "$PnP", 0, 0xF0000, 0xFFFFF, pnp_length, pnp_decode }, 589 | { "RSD PTR ", 0, 0xE0000, 0xFFFFF, acpi_length, acpi_decode }, 590 | { "$SNY", 0, 0xE0000, 0xFFFFF, sony_length, sony_decode }, 591 | { "_32_", 0, 0xE0000, 0xFFFFF, bios32_length, bios32_decode }, 592 | { "$PIR", 0, 0xF0000, 0xFFFFF, pir_length, pir_decode }, 593 | { "32OS", 0, 0xE0000, 0xFFFFF, compaq_length, compaq_decode }, 594 | { "\252\125VPD", 0, 0xF0000, 0xFFFFF, vpd_length, vpd_decode }, 595 | { "FJKEYINF", 0, 0xF0000, 0xFFFFF, fjkeyinf_length, fjkeyinf_decode }, 596 | { "_MP_", 0, 0xE0000, 0xFFFFF, mp_length, mp_decode }, 597 | { NULL, 0, 0, 0, NULL, NULL } 598 | }; 599 | 600 | /* Believe it or not, this is significantly faster than memcmp */ 601 | static int anchor_match(const struct bios_entry *entry, const char *p) 602 | { 603 | size_t i; 604 | 605 | for (i = 0; i < entry->anchor_len; i++) 606 | if (entry->anchor[i] != p[i]) 607 | return 0; 608 | 609 | return 1; 610 | } 611 | 612 | /* Return -1 on error, 0 on success */ 613 | static int parse_command_line(int argc, char * const argv[]) 614 | { 615 | int option; 616 | const char *optstring = "d:hV"; 617 | struct option longopts[] = { 618 | { "dev-mem", required_argument, NULL, 'd' }, 619 | { "help", no_argument, NULL, 'h' }, 620 | { "version", no_argument, NULL, 'V' }, 621 | { NULL, 0, NULL, 0 } 622 | }; 623 | 624 | while ((option = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) 625 | switch (option) 626 | { 627 | case 'd': 628 | opt.devmem = optarg; 629 | break; 630 | case 'h': 631 | opt.flags |= FLAG_HELP; 632 | break; 633 | case 'V': 634 | opt.flags |= FLAG_VERSION; 635 | break; 636 | case '?': 637 | return -1; 638 | } 639 | 640 | return 0; 641 | } 642 | 643 | static void print_help(void) 644 | { 645 | static const char *help = 646 | "Usage: biosdecode [OPTIONS]\n" 647 | "Options are:\n" 648 | " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n" 649 | " -h, --help Display this help text and exit\n" 650 | " -V, --version Display the version and exit\n"; 651 | 652 | printf("%s", help); 653 | } 654 | 655 | int main(int argc, char * const argv[]) 656 | { 657 | u8 *buf; 658 | off_t fp; 659 | int i; 660 | 661 | if (sizeof(u8) != 1 || sizeof(u16) != 2 || sizeof(u32) != 4) 662 | { 663 | fprintf(stderr, "%s: compiler incompatibility\n", argv[0]); 664 | exit(255); 665 | } 666 | 667 | /* Set default option values */ 668 | opt.devmem = DEFAULT_MEM_DEV; 669 | opt.flags = 0; 670 | 671 | if (parse_command_line(argc, argv) < 0) 672 | exit(2); 673 | 674 | if (opt.flags & FLAG_HELP) 675 | { 676 | print_help(); 677 | return 0; 678 | } 679 | 680 | if (opt.flags & FLAG_VERSION) 681 | { 682 | printf("%s\n", VERSION); 683 | return 0; 684 | } 685 | 686 | printf("# biosdecode %s\n", VERSION); 687 | 688 | if ((buf = mem_chunk(0xE0000, 0x20000, opt.devmem)) == NULL) 689 | exit(1); 690 | 691 | /* Compute anchor lengths once and for all */ 692 | for (i = 0; bios_entries[i].anchor != NULL; i++) 693 | bios_entries[i].anchor_len = strlen(bios_entries[i].anchor); 694 | 695 | for (fp = 0xE0000; fp <= 0xFFFF0; fp += 16) 696 | { 697 | u8 *p = buf + fp - 0xE0000; 698 | 699 | for (i = 0; bios_entries[i].anchor != NULL; i++) 700 | { 701 | if (anchor_match(&bios_entries[i], (char *)p) 702 | && fp >= bios_entries[i].low_address 703 | && fp < bios_entries[i].high_address) 704 | { 705 | off_t len = bios_entries[i].length(p); 706 | 707 | if (fp + len - 1 <= bios_entries[i].high_address) 708 | { 709 | if (bios_entries[i].decode(p, len)) 710 | { 711 | fp += (((len - 1) >> 4) << 4); 712 | break; 713 | } 714 | } 715 | } 716 | } 717 | } 718 | 719 | free(buf); 720 | 721 | return 0; 722 | } 723 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Configuration 3 | */ 4 | 5 | #ifndef CONFIG_H 6 | #define CONFIG_H 7 | 8 | /* Default memory device file */ 9 | #if defined(__BEOS__) || defined(__HAIKU__) 10 | #define DEFAULT_MEM_DEV "/dev/misc/mem" 11 | #else 12 | #ifdef __sun 13 | #define DEFAULT_MEM_DEV "/dev/xsvc" 14 | #else 15 | #define DEFAULT_MEM_DEV "/dev/mem" 16 | #endif 17 | #endif 18 | 19 | /* Use mmap or not */ 20 | #ifndef __BEOS__ 21 | #define USE_MMAP 22 | #endif 23 | 24 | /* Use memory alignment workaround or not */ 25 | #if defined(__ia64__) || defined(__LP64__) 26 | #define ALIGNMENT_WORKAROUND 27 | #endif 28 | 29 | #endif 30 | -------------------------------------------------------------------------------- /dmidecode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the dmidecode project. 3 | * 4 | * Copyright (C) 2005-2008 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include "types.h" 22 | 23 | struct dmi_header 24 | { 25 | u8 type; 26 | u8 length; 27 | u16 handle; 28 | u8 *data; 29 | }; 30 | 31 | int is_printable(const u8 *data, int len); 32 | const char *dmi_string(const struct dmi_header *dm, u8 s); 33 | -------------------------------------------------------------------------------- /dmioem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Decoding of OEM-specific entries 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2007-2008 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | #include 24 | 25 | #include "types.h" 26 | #include "dmidecode.h" 27 | #include "dmioem.h" 28 | 29 | /* 30 | * Globals for vendor-specific decodes 31 | */ 32 | 33 | enum DMI_VENDORS 34 | { 35 | VENDOR_UNKNOWN, 36 | VENDOR_HP, 37 | VENDOR_ACER, 38 | }; 39 | 40 | static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN; 41 | 42 | /* 43 | * Remember the system vendor for later use. We only actually store the 44 | * value if we know how to decode at least one specific entry type for 45 | * that vendor. 46 | */ 47 | void dmi_set_vendor(const char *s) 48 | { 49 | int len; 50 | 51 | /* 52 | * Often DMI strings have trailing spaces. Ignore these 53 | * when checking for known vendor names. 54 | */ 55 | len = strlen(s); 56 | while (len && s[len - 1] == ' ') 57 | len--; 58 | 59 | if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0) 60 | dmi_vendor = VENDOR_HP; 61 | else if (strncmp(s, "Acer", len) == 0) 62 | dmi_vendor = VENDOR_ACER; 63 | } 64 | 65 | /* 66 | * HP-specific data structures are decoded here. 67 | * 68 | * Code contributed by John Cagle and Tyler Bell. 69 | */ 70 | 71 | static void dmi_print_hp_net_iface_rec(u8 id, u8 bus, u8 dev, const u8 *mac) 72 | { 73 | /* Some systems do not provide an id. nic_ctr provides an artificial 74 | * id, and assumes the records will be provided "in order". Also, 75 | * using 0xFF marker is not future proof. 256 NICs is a lot, but 76 | * 640K ought to be enough for anybody(said no one, ever). 77 | * */ 78 | static u8 nic_ctr; 79 | 80 | if (id == 0xFF) 81 | id = ++nic_ctr; 82 | 83 | if (dev == 0x00 && bus == 0x00) 84 | printf("\tNIC %d: Disabled\n", id); 85 | else if (dev == 0xFF && bus == 0xFF) 86 | printf("\tNIC %d: Not Installed\n", id); 87 | else 88 | { 89 | printf("\tNIC %d: PCI device %02x:%02x.%x, " 90 | "MAC address %02X:%02X:%02X:%02X:%02X:%02X\n", 91 | id, bus, dev >> 3, dev & 7, 92 | mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]); 93 | } 94 | } 95 | 96 | static int dmi_decode_hp(const struct dmi_header *h) 97 | { 98 | u8 *data = h->data; 99 | int nic, ptr; 100 | u32 feat; 101 | 102 | switch (h->type) 103 | { 104 | case 204: 105 | /* 106 | * Vendor Specific: HP ProLiant System/Rack Locator 107 | */ 108 | printf("HP ProLiant System/Rack Locator\n"); 109 | if (h->length < 0x0B) break; 110 | printf("\tRack Name: %s\n", dmi_string(h, data[0x04])); 111 | printf("\tEnclosure Name: %s\n", dmi_string(h, data[0x05])); 112 | printf("\tEnclosure Model: %s\n", dmi_string(h, data[0x06])); 113 | printf("\tEnclosure Serial: %s\n", dmi_string(h, data[0x0A])); 114 | printf("\tEnclosure Bays: %d\n", data[0x08]); 115 | printf("\tServer Bay: %s\n", dmi_string(h, data[0x07])); 116 | printf("\tBays Filled: %d\n", data[0x09]); 117 | break; 118 | 119 | case 209: 120 | case 221: 121 | /* 122 | * Vendor Specific: HP ProLiant NIC MAC Information 123 | * 124 | * This prints the BIOS NIC number, 125 | * PCI bus/device/function, and MAC address 126 | * 127 | * Type 209: 128 | * Offset | Name | Width | Description 129 | * ------------------------------------- 130 | * 0x00 | Type | BYTE | 0xD1, MAC Info 131 | * 0x01 | Length | BYTE | Length of structure 132 | * 0x02 | Handle | WORD | Unique handle 133 | * 0x04 | Dev No | BYTE | PCI Device/Function No 134 | * 0x05 | Bus No | BYTE | PCI Bus 135 | * 0x06 | MAC | 6B | MAC addr 136 | * 0x0C | NIC #2 | 8B | Repeat 0x04-0x0B 137 | * 138 | * Type 221: is deprecated in the latest docs 139 | */ 140 | printf(h->type == 221 ? 141 | "HP BIOS iSCSI NIC PCI and MAC Information\n" : 142 | "HP BIOS PXE NIC PCI and MAC Information\n"); 143 | nic = 1; 144 | ptr = 4; 145 | while (h->length >= ptr + 8) 146 | { 147 | dmi_print_hp_net_iface_rec(nic, 148 | data[ptr + 0x01], 149 | data[ptr], 150 | &data[ptr + 0x02]); 151 | nic++; 152 | ptr += 8; 153 | } 154 | break; 155 | 156 | case 233: 157 | /* 158 | * Vendor Specific: HP ProLiant NIC MAC Information 159 | * 160 | * This prints the BIOS NIC number, 161 | * PCI bus/device/function, and MAC address 162 | * 163 | * Offset | Name | Width | Description 164 | * ------------------------------------- 165 | * 0x00 | Type | BYTE | 0xE9, NIC structure 166 | * 0x01 | Length | BYTE | Length of structure 167 | * 0x02 | Handle | WORD | Unique handle 168 | * 0x04 | Grp No | WORD | 0 for single segment 169 | * 0x06 | Bus No | BYTE | PCI Bus 170 | * 0x07 | Dev No | BYTE | PCI Device/Function No 171 | * 0x08 | MAC | 32B | MAC addr padded w/ 0s 172 | * 0x28 | Port No| BYTE | Each NIC maps to a Port 173 | */ 174 | printf("HP BIOS PXE NIC PCI and MAC Information\n"); 175 | if (h->length < 0x0E) break; 176 | /* If the record isn't long enough, we don't have an ID 177 | * use 0xFF to use the internal counter. 178 | * */ 179 | nic = h->length > 0x28 ? data[0x28] : 0xFF; 180 | dmi_print_hp_net_iface_rec(nic, data[0x06], data[0x07], 181 | &data[0x08]); 182 | break; 183 | 184 | case 212: 185 | /* 186 | * Vendor Specific: HP 64-bit CRU Information 187 | * 188 | * Source: hpwdt kernel driver 189 | */ 190 | printf("HP 64-bit CRU Information\n"); 191 | if (h->length < 0x18) break; 192 | printf("\tSignature: 0x%08x", DWORD(data + 0x04)); 193 | if (is_printable(data + 0x04, 4)) 194 | printf(" (%c%c%c%c)", data[0x04], data[0x05], 195 | data[0x06], data[0x07]); 196 | printf("\n"); 197 | if (DWORD(data + 0x04) == 0x55524324) 198 | { 199 | u64 paddr = QWORD(data + 0x08); 200 | paddr.l += DWORD(data + 0x14); 201 | if (paddr.l < DWORD(data + 0x14)) 202 | paddr.h++; 203 | printf("\tPhysical Address: 0x%08x%08x\n", 204 | paddr.h, paddr.l); 205 | printf("\tLength: 0x%08x\n", DWORD(data + 0x10)); 206 | } 207 | break; 208 | 209 | case 219: 210 | /* 211 | * Vendor Specific: HP ProLiant Information 212 | * 213 | * Source: hpwdt kernel driver 214 | */ 215 | printf("HP ProLiant Information\n"); 216 | if (h->length < 0x08) break; 217 | printf("\tPower Features: 0x%08x\n", DWORD(data + 0x04)); 218 | if (h->length < 0x0C) break; 219 | printf("\tOmega Features: 0x%08x\n", DWORD(data + 0x08)); 220 | if (h->length < 0x14) break; 221 | feat = DWORD(data + 0x10); 222 | printf("\tMisc. Features: 0x%08x\n", feat); 223 | printf("\t\tiCRU: %s\n", feat & 0x0001 ? "Yes" : "No"); 224 | printf("\t\tUEFI: %s\n", feat & 0x0408 ? "Yes" : "No"); 225 | break; 226 | 227 | default: 228 | return 0; 229 | } 230 | return 1; 231 | } 232 | 233 | /* 234 | * Acer-specific data structures are decoded here. 235 | */ 236 | 237 | static int dmi_decode_acer(const struct dmi_header *h) 238 | { 239 | u8 *data = h->data; 240 | u16 cap; 241 | 242 | switch (h->type) 243 | { 244 | case 170: 245 | /* 246 | * Vendor Specific: Acer Hotkey Function 247 | * 248 | * Source: acer-wmi kernel driver 249 | * 250 | * Probably applies to some laptop models of other 251 | * brands, including Fujitsu-Siemens, Medion, Lenovo, 252 | * and eMachines. 253 | */ 254 | printf("Acer Hotkey Function\n"); 255 | if (h->length < 0x0F) break; 256 | cap = WORD(data + 0x04); 257 | printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap); 258 | printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No"); 259 | printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No"); 260 | printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No"); 261 | printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No"); 262 | printf("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06)); 263 | printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08)); 264 | printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A)); 265 | printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C)); 266 | printf("\tCommunication Function Key Number: %d\n", data[0x0E]); 267 | break; 268 | 269 | default: 270 | return 0; 271 | } 272 | return 1; 273 | } 274 | 275 | /* 276 | * Dispatch vendor-specific entries decoding 277 | * Return 1 if decoding was successful, 0 otherwise 278 | */ 279 | int dmi_decode_oem(const struct dmi_header *h) 280 | { 281 | switch (dmi_vendor) 282 | { 283 | case VENDOR_HP: 284 | return dmi_decode_hp(h); 285 | case VENDOR_ACER: 286 | return dmi_decode_acer(h); 287 | default: 288 | return 0; 289 | } 290 | } 291 | -------------------------------------------------------------------------------- /dmioem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Decoding of OEM-specific entries 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2007-2008 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | struct dmi_header; 23 | 24 | void dmi_set_vendor(const char *s); 25 | int dmi_decode_oem(const struct dmi_header *h); 26 | -------------------------------------------------------------------------------- /dmiopt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line handling of dmidecode 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2005-2008 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | 28 | #include "config.h" 29 | #include "types.h" 30 | #include "util.h" 31 | #include "dmidecode.h" 32 | #include "dmiopt.h" 33 | 34 | 35 | /* Options are global */ 36 | struct opt opt; 37 | 38 | 39 | /* 40 | * Handling of option --type 41 | */ 42 | 43 | struct type_keyword 44 | { 45 | const char *keyword; 46 | const u8 *type; 47 | }; 48 | 49 | static const u8 opt_type_bios[] = { 0, 13, 255 }; 50 | static const u8 opt_type_system[] = { 1, 12, 15, 23, 32, 255 }; 51 | static const u8 opt_type_baseboard[] = { 2, 10, 41, 255 }; 52 | static const u8 opt_type_chassis[] = { 3, 255 }; 53 | static const u8 opt_type_processor[] = { 4, 255 }; 54 | static const u8 opt_type_memory[] = { 5, 6, 16, 17, 255 }; 55 | static const u8 opt_type_cache[] = { 7, 255 }; 56 | static const u8 opt_type_connector[] = { 8, 255 }; 57 | static const u8 opt_type_slot[] = { 9, 255 }; 58 | 59 | static const struct type_keyword opt_type_keyword[] = { 60 | { "bios", opt_type_bios }, 61 | { "system", opt_type_system }, 62 | { "baseboard", opt_type_baseboard }, 63 | { "chassis", opt_type_chassis }, 64 | { "processor", opt_type_processor }, 65 | { "memory", opt_type_memory }, 66 | { "cache", opt_type_cache }, 67 | { "connector", opt_type_connector }, 68 | { "slot", opt_type_slot }, 69 | }; 70 | 71 | static void print_opt_type_list(void) 72 | { 73 | unsigned int i; 74 | 75 | fprintf(stderr, "Valid type keywords are:\n"); 76 | for (i = 0; i < ARRAY_SIZE(opt_type_keyword); i++) 77 | { 78 | fprintf(stderr, " %s\n", opt_type_keyword[i].keyword); 79 | } 80 | } 81 | 82 | static u8 *parse_opt_type(u8 *p, const char *arg) 83 | { 84 | unsigned int i; 85 | 86 | /* Allocate memory on first call only */ 87 | if (p == NULL) 88 | { 89 | p = (u8 *)calloc(256, sizeof(u8)); 90 | if (p == NULL) 91 | { 92 | perror("calloc"); 93 | return NULL; 94 | } 95 | } 96 | 97 | /* First try as a keyword */ 98 | for (i = 0; i < ARRAY_SIZE(opt_type_keyword); i++) 99 | { 100 | if (!strcasecmp(arg, opt_type_keyword[i].keyword)) 101 | { 102 | int j = 0; 103 | while (opt_type_keyword[i].type[j] != 255) 104 | p[opt_type_keyword[i].type[j++]] = 1; 105 | goto found; 106 | } 107 | } 108 | 109 | /* Else try as a number */ 110 | while (*arg != '\0') 111 | { 112 | unsigned long val; 113 | char *next; 114 | 115 | val = strtoul(arg, &next, 0); 116 | if (next == arg) 117 | { 118 | fprintf(stderr, "Invalid type keyword: %s\n", arg); 119 | print_opt_type_list(); 120 | goto exit_free; 121 | } 122 | if (val > 0xff) 123 | { 124 | fprintf(stderr, "Invalid type number: %lu\n", val); 125 | goto exit_free; 126 | } 127 | 128 | p[val] = 1; 129 | arg = next; 130 | while (*arg == ',' || *arg == ' ') 131 | arg++; 132 | } 133 | 134 | found: 135 | return p; 136 | 137 | exit_free: 138 | free(p); 139 | return NULL; 140 | } 141 | 142 | 143 | /* 144 | * Handling of option --string 145 | */ 146 | 147 | /* This lookup table could admittedly be reworked for improved performance. 148 | Due to the low count of items in there at the moment, it did not seem 149 | worth the additional code complexity though. */ 150 | static const struct string_keyword opt_string_keyword[] = { 151 | { "bios-vendor", 0, 0x04 }, 152 | { "bios-version", 0, 0x05 }, 153 | { "bios-release-date", 0, 0x08 }, 154 | { "system-manufacturer", 1, 0x04 }, 155 | { "system-product-name", 1, 0x05 }, 156 | { "system-version", 1, 0x06 }, 157 | { "system-serial-number", 1, 0x07 }, 158 | { "system-uuid", 1, 0x08 }, /* dmi_system_uuid() */ 159 | { "system-family", 1, 0x1a }, 160 | { "baseboard-manufacturer", 2, 0x04 }, 161 | { "baseboard-product-name", 2, 0x05 }, 162 | { "baseboard-version", 2, 0x06 }, 163 | { "baseboard-serial-number", 2, 0x07 }, 164 | { "baseboard-asset-tag", 2, 0x08 }, 165 | { "chassis-manufacturer", 3, 0x04 }, 166 | { "chassis-type", 3, 0x05 }, /* dmi_chassis_type() */ 167 | { "chassis-version", 3, 0x06 }, 168 | { "chassis-serial-number", 3, 0x07 }, 169 | { "chassis-asset-tag", 3, 0x08 }, 170 | { "processor-family", 4, 0x06 }, /* dmi_processor_family() */ 171 | { "processor-manufacturer", 4, 0x07 }, 172 | { "processor-version", 4, 0x10 }, 173 | { "processor-frequency", 4, 0x16 }, /* dmi_processor_frequency() */ 174 | }; 175 | 176 | /* This is a template, 3rd field is set at runtime. */ 177 | static struct string_keyword opt_oem_string_keyword = 178 | { NULL, 11, 0x00 }; 179 | 180 | static void print_opt_string_list(void) 181 | { 182 | unsigned int i; 183 | 184 | fprintf(stderr, "Valid string keywords are:\n"); 185 | for (i = 0; i < ARRAY_SIZE(opt_string_keyword); i++) 186 | { 187 | fprintf(stderr, " %s\n", opt_string_keyword[i].keyword); 188 | } 189 | } 190 | 191 | static int parse_opt_string(const char *arg) 192 | { 193 | unsigned int i; 194 | 195 | if (opt.string) 196 | { 197 | fprintf(stderr, "Only one string can be specified\n"); 198 | return -1; 199 | } 200 | 201 | for (i = 0; i < ARRAY_SIZE(opt_string_keyword); i++) 202 | { 203 | if (!strcasecmp(arg, opt_string_keyword[i].keyword)) 204 | { 205 | opt.string = &opt_string_keyword[i]; 206 | return 0; 207 | } 208 | } 209 | 210 | fprintf(stderr, "Invalid string keyword: %s\n", arg); 211 | print_opt_string_list(); 212 | return -1; 213 | } 214 | 215 | static int parse_opt_oem_string(const char *arg) 216 | { 217 | unsigned long val; 218 | char *next; 219 | 220 | if (opt.string) 221 | { 222 | fprintf(stderr, "Only one string can be specified\n"); 223 | return -1; 224 | } 225 | 226 | /* Return the number of OEM strings */ 227 | if (strcmp(arg, "count") == 0) 228 | goto done; 229 | 230 | val = strtoul(arg, &next, 10); 231 | if (next == arg || val == 0x00 || val > 0xff) 232 | { 233 | fprintf(stderr, "Invalid OEM string number: %s\n", arg); 234 | return -1; 235 | } 236 | 237 | opt_oem_string_keyword.offset = val; 238 | done: 239 | opt.string = &opt_oem_string_keyword; 240 | return 0; 241 | } 242 | 243 | 244 | /* 245 | * Command line options handling 246 | */ 247 | 248 | /* Return -1 on error, 0 on success */ 249 | int parse_command_line(int argc, char * const argv[]) 250 | { 251 | int option; 252 | const char *optstring = "d:hqs:t:uV"; 253 | struct option longopts[] = { 254 | { "dev-mem", required_argument, NULL, 'd' }, 255 | { "help", no_argument, NULL, 'h' }, 256 | { "quiet", no_argument, NULL, 'q' }, 257 | { "string", required_argument, NULL, 's' }, 258 | { "type", required_argument, NULL, 't' }, 259 | { "dump", no_argument, NULL, 'u' }, 260 | { "dump-bin", required_argument, NULL, 'B' }, 261 | { "from-dump", required_argument, NULL, 'F' }, 262 | { "oem-string", required_argument, NULL, 'O' }, 263 | { "no-sysfs", no_argument, NULL, 'S' }, 264 | { "version", no_argument, NULL, 'V' }, 265 | { NULL, 0, NULL, 0 } 266 | }; 267 | 268 | while ((option = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) 269 | switch (option) 270 | { 271 | case 'B': 272 | opt.flags |= FLAG_DUMP_BIN; 273 | opt.dumpfile = optarg; 274 | break; 275 | case 'F': 276 | opt.flags |= FLAG_FROM_DUMP; 277 | opt.dumpfile = optarg; 278 | break; 279 | case 'd': 280 | opt.devmem = optarg; 281 | break; 282 | case 'h': 283 | opt.flags |= FLAG_HELP; 284 | break; 285 | case 'q': 286 | opt.flags |= FLAG_QUIET; 287 | break; 288 | case 's': 289 | if (parse_opt_string(optarg) < 0) 290 | return -1; 291 | opt.flags |= FLAG_QUIET; 292 | break; 293 | case 'O': 294 | if (parse_opt_oem_string(optarg) < 0) 295 | return -1; 296 | opt.flags |= FLAG_QUIET; 297 | break; 298 | case 't': 299 | opt.type = parse_opt_type(opt.type, optarg); 300 | if (opt.type == NULL) 301 | return -1; 302 | break; 303 | case 'u': 304 | opt.flags |= FLAG_DUMP; 305 | break; 306 | case 'S': 307 | opt.flags |= FLAG_NO_SYSFS; 308 | break; 309 | case 'V': 310 | opt.flags |= FLAG_VERSION; 311 | break; 312 | case '?': 313 | switch (optopt) 314 | { 315 | case 's': 316 | fprintf(stderr, "String keyword expected\n"); 317 | print_opt_string_list(); 318 | break; 319 | case 't': 320 | fprintf(stderr, "Type number or keyword expected\n"); 321 | print_opt_type_list(); 322 | break; 323 | } 324 | return -1; 325 | } 326 | 327 | /* Check for mutually exclusive output format options */ 328 | if ((opt.string != NULL) + (opt.type != NULL) 329 | + !!(opt.flags & FLAG_DUMP_BIN) > 1) 330 | { 331 | fprintf(stderr, "Options --string, --type and --dump-bin are mutually exclusive\n"); 332 | return -1; 333 | } 334 | 335 | if ((opt.flags & FLAG_FROM_DUMP) && (opt.flags & FLAG_DUMP_BIN)) 336 | { 337 | fprintf(stderr, "Options --from-dump and --dump-bin are mutually exclusive\n"); 338 | return -1; 339 | } 340 | 341 | return 0; 342 | } 343 | 344 | void print_help(void) 345 | { 346 | static const char *help = 347 | "Usage: dmidecode [OPTIONS]\n" 348 | "Options are:\n" 349 | " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n" 350 | " -h, --help Display this help text and exit\n" 351 | " -q, --quiet Less verbose output\n" 352 | " -s, --string KEYWORD Only display the value of the given DMI string\n" 353 | " -t, --type TYPE Only display the entries of given type\n" 354 | " -u, --dump Do not decode the entries\n" 355 | " --dump-bin FILE Dump the DMI data to a binary file\n" 356 | " --from-dump FILE Read the DMI data from a binary file\n" 357 | " --no-sysfs Do not attempt to read DMI data from sysfs files\n" 358 | " --oem-string N Only display the value of the given OEM string\n" 359 | " -V, --version Display the version and exit\n"; 360 | 361 | printf("%s", help); 362 | } 363 | -------------------------------------------------------------------------------- /dmiopt.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line handling of dmidecode 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2005-2008 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include "types.h" 23 | 24 | struct string_keyword 25 | { 26 | const char *keyword; 27 | u8 type; 28 | u8 offset; 29 | }; 30 | 31 | struct opt 32 | { 33 | const char *devmem; 34 | unsigned int flags; 35 | u8 *type; 36 | const struct string_keyword *string; 37 | char *dumpfile; 38 | }; 39 | extern struct opt opt; 40 | 41 | #define FLAG_VERSION (1 << 0) 42 | #define FLAG_HELP (1 << 1) 43 | #define FLAG_DUMP (1 << 2) 44 | #define FLAG_QUIET (1 << 3) 45 | #define FLAG_DUMP_BIN (1 << 4) 46 | #define FLAG_FROM_DUMP (1 << 5) 47 | #define FLAG_NO_SYSFS (1 << 6) 48 | 49 | int parse_command_line(int argc, char * const argv[]); 50 | void print_help(void); 51 | -------------------------------------------------------------------------------- /man/biosdecode.8: -------------------------------------------------------------------------------- 1 | .TH BIOSDECODE 8 "February 2007" "dmidecode" 2 | .SH NAME 3 | biosdecode \- \s-1BIOS\s0 information decoder 4 | .SH SYNOPSIS 5 | .B biosdecode 6 | .RB [ OPTIONS ] 7 | 8 | .SH DESCRIPTION 9 | .B biosdecode 10 | parses the \s-1BIOS\s0 memory and prints information about all structures (or 11 | entry points) it knows of. Currently known entry point types are: 12 | .IP \(bu "\w'\(bu'u+1n" 13 | \s-1SMBIOS\s0 (System Management \s-1BIOS\s0) 14 | .br 15 | Use 16 | .B dmidecode 17 | for a more detailed output. 18 | .IP \(bu 19 | \s-1DMI\s0 (Desktop Management Interface, a legacy version of \s-1SMBIOS\s0) 20 | .br 21 | Use 22 | .B dmidecode 23 | for a more detailed output. 24 | .IP \(bu 25 | \s-1SYSID\s0 26 | .IP \(bu 27 | \s-1PNP\s0 (Plug and Play) 28 | .IP \(bu 29 | \s-1ACPI\s0 (Advanced Configuration and Power Interface) 30 | .IP \(bu 31 | \s-1BIOS32\s0 (\s-1BIOS32\s0 Service Directory) 32 | .IP \(bu 33 | \s-1PIR\s0 (\s-1PCI\s0 \s-1IRQ\s0 Routing) 34 | .IP \(bu 35 | \s-132OS\s0 (\s-1BIOS32\s0 Extension, Compaq-specific) 36 | .br 37 | See 38 | .B ownership 39 | for a Compaq ownership tag retrieval tool. 40 | .IP \(bu 41 | \s-1SNY\s0 (Sony-specific, not decoded) 42 | .IP \(bu 43 | \s-1VPD\s0 (Vital Product Data, IBM-specific) 44 | .br 45 | Use 46 | .B vpddecode 47 | for a more detailed output. 48 | .IP \(bu 49 | \s-1FJKEYINF\s0 (Application Panel, Fujitsu-specific) 50 | 51 | .PP 52 | .B biosdecode 53 | started its life as a part of 54 | .B dmidecode 55 | but as more entry point types were added, it was moved to a different 56 | program. 57 | 58 | .SH OPTIONS 59 | .TP 60 | .BR "-d" ", " "--dev-mem FILE" 61 | Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) 62 | .TP 63 | .BR "-h" ", " "--help" 64 | Display usage information and exit 65 | .TP 66 | .BR "-V" ", " "--version" 67 | Display the version and exit 68 | 69 | .SH FILES 70 | .I /dev/mem 71 | .SH BUGS 72 | Most of the time, 73 | .B biosdecode 74 | prints too much information (you don't really care about addresses) 75 | or not enough (because it doesn't follow pointers and has no lookup 76 | tables). 77 | .SH AUTHORS 78 | Alan Cox, Jean Delvare 79 | .SH "SEE ALSO" 80 | .BR dmidecode (8), 81 | .BR mem (4), 82 | .BR ownership (8), 83 | .BR vpddecode (8) 84 | -------------------------------------------------------------------------------- /man/dmidecode.8: -------------------------------------------------------------------------------- 1 | .TH DMIDECODE 8 "March 2012" "dmidecode" 2 | .SH NAME 3 | dmidecode \- \s-1DMI\s0 table decoder 4 | .SH SYNOPSIS 5 | .B dmidecode 6 | .RB [ OPTIONS ] 7 | 8 | .SH DESCRIPTION 9 | .B dmidecode 10 | is a tool for dumping a computer's \s-1DMI\s0 (some say \s-1SMBIOS\s0) table 11 | contents in a human-readable format. This table contains a description of the 12 | system's hardware components, as well as other useful pieces of information 13 | such as serial numbers and \s-1BIOS\s0 revision. Thanks to this table, you can 14 | retrieve this information without having to probe for the actual hardware. 15 | While this is a good point in terms of report speed and safeness, this also 16 | makes the presented information possibly unreliable. 17 | 18 | The \s-1DMI\s0 table doesn't only describe what the system is currently made 19 | of, it also can report the possible evolutions (such as the fastest supported 20 | \s-1CPU\s0 or the maximal amount of memory supported). 21 | 22 | \s-1SMBIOS\s0 stands for System Management \s-1BIOS\s0, while \s-1DMI\s0 23 | stands for Desktop Management Interface. Both standards are tightly related 24 | and developed by the \s-1DMTF\s0 (Desktop Management Task Force). 25 | 26 | As you run it, 27 | .B dmidecode 28 | will try to locate the \s-1DMI\s0 table. It will first try to read the DMI table 29 | from sysfs, and next try reading directly from memory if sysfs access failed. 30 | If 31 | .B dmidecode 32 | succeeds in locating a valid DMI table, it will then parse this table 33 | and display a list of records like this one: 34 | 35 | Handle 0x0002, DMI type 2, 8 bytes. 36 | Base Board Information 37 | Manufacturer: Intel 38 | Product Name: C440GX+ 39 | Version: 727281-001 40 | Serial Number: INCY92700942 41 | 42 | Each record has: 43 | .IP \(bu "\w'\(bu'u+1n" 44 | A handle. This is a unique identifier, which allows records to 45 | reference each other. For example, processor records usually reference 46 | cache memory records using their handles. 47 | .IP \(bu 48 | A type. The \s-1SMBIOS\s0 specification defines different types of elements 49 | a computer can be made of. In this example, the type is 2, which 50 | means that the record contains "Base Board Information". 51 | .IP \(bu 52 | A size. Each record has a 4-byte header (2 for the handle, 1 for the type, 53 | 1 for the size), the rest is used by the record data. This value doesn't 54 | take text strings into account (these are placed at the end of the record), 55 | so the actual length of the record may be (and is often) greater than the 56 | displayed value. 57 | .IP \(bu 58 | Decoded values. The information presented of course depends on the type 59 | of record. Here, we learn about the board's manufacturer, model, version 60 | and serial number. 61 | 62 | .SH OPTIONS 63 | .TP 64 | .BR "-d" ", " "--dev-mem FILE" 65 | Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) 66 | .TP 67 | .BR "-q" ", " "--quiet" 68 | Be less verbose. Unknown, inactive and \s-1OEM\s0-specific entries are not 69 | displayed. Meta-data and handle references are hidden. 70 | .TP 71 | .BR "-s" ", " "--string KEYWORD" 72 | Only display the value of the \s-1DMI\s0 string identified by \fBKEYWORD\fR. 73 | \fBKEYWORD\fR must be a keyword from the following list: \fBbios-vendor\fR, 74 | \fBbios-version\fR, \fBbios-release-date\fR, 75 | \fBsystem-manufacturer\fR, \fBsystem-product-name\fR, 76 | \fBsystem-version\fR, \fBsystem-serial-number\fR, 77 | \fBsystem-uuid\fR, \fBsystem-family\fR, 78 | \fBbaseboard-manufacturer\fR, \fBbaseboard-product-name\fR, 79 | \fBbaseboard-version\fR, \fBbaseboard-serial-number\fR, 80 | \fBbaseboard-asset-tag\fR, \fBchassis-manufacturer\fR, 81 | \fBchassis-type\fR, 82 | \fBchassis-version\fR, \fBchassis-serial-number\fR, 83 | \fBchassis-asset-tag\fR, \fBprocessor-family\fR, 84 | \fBprocessor-manufacturer\fR, 85 | \fBprocessor-version\fR, \fBprocessor-frequency\fR. 86 | Each keyword corresponds to a given \s-1DMI\s0 type and a given offset 87 | within this entry type. 88 | Not all strings may be meaningful or even defined on all systems. Some 89 | keywords may return more than one result on some systems (e.g. 90 | \fBprocessor-version\fR on a multi-processor system). 91 | If \fBKEYWORD\fR is not provided or not valid, a list of all valid 92 | keywords is printed and 93 | .B dmidecode 94 | exits with an error. 95 | This option cannot be used more than once. 96 | 97 | Note: on Linux, most of these strings can alternatively be read directly 98 | from 99 | .BR sysfs , 100 | typically from files under 101 | .IR /sys/devices/virtual/dmi/id . 102 | Most of these files are even readable by regular users. 103 | .TP 104 | .BR "-t" ", " "--type TYPE" 105 | Only display the entries of type \fBTYPE\fR. \fBTYPE\fR can be either a 106 | \s-1DMI\s0 type number, or a comma-separated list of type numbers, or a 107 | keyword from the following list: \fBbios\fR, \fBsystem\fR, 108 | \fBbaseboard\fR, \fBchassis\fR, \fBprocessor\fR, \fBmemory\fR, 109 | \fBcache\fR, \fBconnector\fR, \fBslot\fR. Refer to the DMI TYPES section 110 | below for details. 111 | If this option is used more than once, the set of displayed entries will be 112 | the union of all the given types. 113 | If \fBTYPE\fR is not provided or not valid, a list of all valid keywords 114 | is printed and 115 | .B dmidecode 116 | exits with an error. 117 | .TP 118 | .BR "-u" ", " "--dump" 119 | Do not decode the entries, dump their contents as hexadecimal instead. 120 | Note that this is still a text output, no binary data will be thrown upon 121 | you. The strings attached to each entry are displayed as both 122 | hexadecimal and \s-1ASCII\s0. This option is mainly useful for debugging. 123 | .TP 124 | .BR " " " " "--dump-bin FILE" 125 | Do not decode the entries, instead dump the DMI data to a file in binary 126 | form. The generated file is suitable to pass to \fB--from-dump\fR 127 | later. 128 | .TP 129 | .BR " " " " "--from-dump FILE" 130 | Read the DMI data from a binary file previously generated using 131 | \fB--dump-bin\fR. 132 | .TP 133 | .BR " " " " "--no-sysfs" 134 | Do not attempt to read DMI data from sysfs files. This is mainly useful for 135 | debugging. 136 | .TP 137 | .BR " " " " "--oem-string N" 138 | Only display the value of the \s-1OEM\s0 string number \fBN\fR. The first 139 | \s-1OEM\s0 string has number 1. With special value "count", return the 140 | number of OEM strings instead. 141 | .TP 142 | .BR "-h" ", " "--help" 143 | Display usage information and exit 144 | .TP 145 | .BR "-V" ", " "--version" 146 | Display the version and exit 147 | .P 148 | Options --string, --type, --dump-bin and --oem-string 149 | determine the output format and are mutually exclusive. 150 | .P 151 | Please note in case of 152 | .B dmidecode 153 | is run on a system with BIOS that boasts new SMBIOS specification, which 154 | is not supported by the tool yet, it will print out relevant message in 155 | addition to requested data on the very top of the output. Thus informs the 156 | output data is not reliable. 157 | 158 | .SH "DMI TYPES" 159 | The \s-1SMBIOS\s0 specification defines the following \s-1DMI\s0 types: 160 | 161 | .TS 162 | r l 163 | __ 164 | r l. 165 | Type Information 166 | 0 BIOS 167 | 1 System 168 | 2 Baseboard 169 | 3 Chassis 170 | 4 Processor 171 | 5 Memory Controller 172 | 6 Memory Module 173 | 7 Cache 174 | 8 Port Connector 175 | 9 System Slots 176 | 10 On Board Devices 177 | 11 OEM Strings 178 | 12 System Configuration Options 179 | 13 BIOS Language 180 | 14 Group Associations 181 | 15 System Event Log 182 | 16 Physical Memory Array 183 | 17 Memory Device 184 | 18 32-bit Memory Error 185 | 19 Memory Array Mapped Address 186 | 20 Memory Device Mapped Address 187 | 21 Built-in Pointing Device 188 | 22 Portable Battery 189 | 23 System Reset 190 | 24 Hardware Security 191 | 25 System Power Controls 192 | 26 Voltage Probe 193 | 27 Cooling Device 194 | 28 Temperature Probe 195 | 29 Electrical Current Probe 196 | 30 Out-of-band Remote Access 197 | 31 Boot Integrity Services 198 | 32 System Boot 199 | 33 64-bit Memory Error 200 | 34 Management Device 201 | 35 Management Device Component 202 | 36 Management Device Threshold Data 203 | 37 Memory Channel 204 | 38 IPMI Device 205 | 39 Power Supply 206 | 40 Additional Information 207 | 41 Onboard Devices Extended Information 208 | 42 Management Controller Host Interface 209 | .TE 210 | 211 | Additionally, type 126 is used for disabled entries and type 127 is an 212 | end-of-table marker. Types 128 to 255 are for \s-1OEM\s0-specific data. 213 | .B dmidecode 214 | will display these entries by default, but it can only decode them 215 | when the vendors have contributed documentation or code for them. 216 | 217 | Keywords can be used instead of type numbers with \fB--type\fR. 218 | Each keyword is equivalent to a list of type numbers: 219 | 220 | .TS 221 | l l 222 | __ 223 | l l. 224 | Keyword Types 225 | bios 0, 13 226 | system 1, 12, 15, 23, 32 227 | baseboard 2, 10, 41 228 | chassis 3 229 | processor 4 230 | memory 5, 6, 16, 17 231 | cache 7 232 | connector 8 233 | slot 9 234 | .TE 235 | 236 | Keywords are matched case-insensitively. The following command lines are equivalent: 237 | .IP \(bu "\w'\(bu'u+1n" 238 | dmidecode --type 0 --type 13 239 | .IP \(bu 240 | dmidecode --type 0,13 241 | .IP \(bu 242 | dmidecode --type bios 243 | .IP \(bu 244 | dmidecode --type BIOS 245 | 246 | .SH BINARY DUMP FILE FORMAT 247 | The binary dump files generated by --dump-bin and read using --from-dump 248 | are formatted as follows: 249 | .IP \(bu "\w'\(bu'u+1n" 250 | The SMBIOS or DMI entry point is located at offset 0x00. 251 | It is crafted to hard-code the table address at offset 0x20. 252 | .IP \(bu "\w'\(bu'u+1n" 253 | The DMI table is located at offset 0x20. 254 | 255 | .SH FILES 256 | .I /dev/mem 257 | .I /sys/firmware/dmi/tables/smbios_entry_point (Linux only) 258 | .I /sys/firmware/dmi/tables/DMI (Linux only) 259 | .SH BUGS 260 | More often than not, information contained in the \s-1DMI\s0 tables is inaccurate, 261 | incomplete or simply wrong. 262 | .SH AUTHORS 263 | Alan Cox, Jean Delvare 264 | .SH "SEE ALSO" 265 | .BR biosdecode (8), 266 | .BR mem (4), 267 | .BR ownership (8), 268 | .BR vpddecode (8) 269 | -------------------------------------------------------------------------------- /man/ownership.8: -------------------------------------------------------------------------------- 1 | .TH OWNERSHIP 8 "February 2005" "dmidecode" 2 | .SH NAME 3 | ownership \- Compaq ownership tag retriever 4 | .SH SYNOPSIS 5 | .B ownership 6 | .RB [ OPTIONS ] 7 | 8 | .SH DESCRIPTION 9 | .B ownership 10 | retrieves and prints the "ownership tag" that can be set on Compaq 11 | computers. Contrary to all other programs of the 12 | .B dmidecode 13 | package, 14 | .B ownership 15 | doesn't print any version information, nor labels, but only the raw 16 | ownership tag. This should help its integration in scripts. 17 | 18 | .SH OPTIONS 19 | .TP 20 | .BR "-d" ", " "--dev-mem FILE" 21 | Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) 22 | .TP 23 | .BR "-h" ", " "--help" 24 | Display usage information and exit 25 | .TP 26 | .BR "-V" ", " "--version" 27 | Display the version and exit 28 | 29 | .SH FILES 30 | .I /dev/mem 31 | .SH AUTHOR 32 | Jean Delvare 33 | .SH "SEE ALSO" 34 | .BR biosdecode (8), 35 | .BR dmidecode (8), 36 | .BR mem (4), 37 | .BR vpddecode (8) 38 | -------------------------------------------------------------------------------- /man/vpddecode.8: -------------------------------------------------------------------------------- 1 | .TH VPDDECODE 8 "February 2007" "dmidecode" 2 | .SH NAME 3 | vpddecode \- \s-1VPD\s0 structure decoder 4 | .SH SYNOPSIS 5 | .B vpddecode 6 | .RB [ OPTIONS ] 7 | 8 | .SH DESCRIPTION 9 | .B vpddecode 10 | prints the "vital product data" information that can be found in almost 11 | all IBM and Lenovo computers. Available items are: 12 | .IP \(bu "\w'\(bu'u+1n" 13 | \s-1BIOS\s0 Build \s-1ID\s0 14 | .IP \(bu 15 | Box Serial Number 16 | .IP \(bu 17 | Motherboard Serial Number 18 | .IP \(bu 19 | Machine Type/Model 20 | 21 | .PP 22 | Some systems have these additional items: 23 | .IP \(bu "\w'\(bu'u+1n" 24 | BIOS Release Date 25 | .IP \(bu 26 | Default Flash Image File Name 27 | 28 | .PP 29 | Note that these additional items are not documented by IBM, so this is 30 | guess work, and as such should not be blindly trusted. Feedback about 31 | the accuracy of these labels is welcome. 32 | 33 | .SH OPTIONS 34 | .TP 35 | .BR "-d" ", " "--dev-mem FILE" 36 | Read memory from device \fBFILE\fR (default: \fB/dev/mem\fR) 37 | .TP 38 | .BR "-s" ", " "--string KEYWORD" 39 | Only display the value of the \s-1VPD\s0 string identified by \fBKEYWORD\fR. 40 | \fBKEYWORD\fR must be a keyword from the following list: \fBbios-build-id\fR, 41 | \fBbox-serial-number\fR, \fBmotherboard-serial-number\fR, 42 | \fBmachine-type-model\fR, \fBbios-release-date\fR. 43 | Each keyword corresponds to an offset and a length within the \s-1VPD\s0 44 | record. 45 | Not all strings may be defined on all \s-1VPD\s0-enabled systems. 46 | If \fBKEYWORD\fR is not provided or not valid, a list of all valid 47 | keywords is printed and 48 | .B vpddecode 49 | exits with an error. 50 | This option cannot be used more than once. 51 | Mutually exclusive with \fB--dump\fR. 52 | .TP 53 | .BR "-u" ", " "--dump" 54 | Do not decode the VPD records, dump their contents as hexadecimal instead. 55 | Note that this is still a text output, no binary data will be thrown upon 56 | you. ASCII equivalent is displayed when possible. This option is mainly 57 | useful for debugging. 58 | Mutually exclusive with \fB--string\fR. 59 | .TP 60 | .BR "-h" ", " "--help" 61 | Display usage information and exit 62 | .TP 63 | .BR "-V" ", " "--version" 64 | Display the version and exit 65 | 66 | .SH FILES 67 | .I /dev/mem 68 | .SH AUTHOR 69 | Jean Delvare 70 | .SH "SEE ALSO" 71 | .BR biosdecode (8), 72 | .BR dmidecode (8), 73 | .BR mem (4), 74 | .BR ownership (8) 75 | -------------------------------------------------------------------------------- /ownership.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Compaq Ownership Tag 3 | * 4 | * Copyright (C) 2003-2005 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * For the avoidance of doubt the "preferred form" of this code is one which 21 | * is in an open unpatent encumbered format. Where cryptographic key signing 22 | * forms part of the process of creating an executable the information 23 | * including keys needed to generate an equivalently functional executable 24 | * are deemed to be part of the source code. 25 | * 26 | * References: 27 | * - Compaq "Technical Reference Guide for Compaq Deskpro 4000 and 6000" 28 | * First Edition 29 | * http://h18000.www1.hp.com/support/techpubs/technical_reference_guides/113a1097.html 30 | */ 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include "version.h" 39 | #include "config.h" 40 | #include "types.h" 41 | #include "util.h" 42 | 43 | /* Options are global */ 44 | struct opt 45 | { 46 | const char *devmem; 47 | unsigned int flags; 48 | }; 49 | static struct opt opt; 50 | 51 | #define FLAG_VERSION (1 << 0) 52 | #define FLAG_HELP (1 << 1) 53 | 54 | static void ownership(u32 base, const char *pname, const char *devmem) 55 | { 56 | u8 *buf; 57 | int i; 58 | 59 | /* read the ownership tag */ 60 | if ((buf = mem_chunk(base, 0x51, devmem)) == NULL) 61 | { 62 | perror(pname); 63 | return; 64 | } 65 | 66 | /* chop the trailing garbage */ 67 | i = 0x4f; 68 | while (i >= 0 && (buf[i] == 0x20 || buf[i] == 0x00)) 69 | i--; 70 | buf[i + 1] = '\0'; 71 | 72 | /* filter and print */ 73 | if (i >= 0) 74 | { 75 | for (; i >= 0; i--) 76 | { 77 | if (buf[i] < 32 || (buf[i] >= 127 && buf[i] < 160)) 78 | buf[i] = '?'; 79 | } 80 | printf("%s\n", (char *)buf); 81 | } 82 | 83 | free(buf); 84 | } 85 | 86 | static u32 decode(const u8 *p) 87 | { 88 | int i; 89 | 90 | /* integrity checking (lack of checksum) */ 91 | for (i = 0; i < p[4]; i++) 92 | { 93 | if (p[5 + i * 10] != '$' 94 | || !(p[6 + i * 10] >= 'A' && p[6 + i * 10] <= 'Z') 95 | || !(p[7 + i * 10] >= 'A' && p[7 + i * 10] <= 'Z') 96 | || !(p[8 + i * 10] >= 'A' && p[8 + i * 10] <= 'Z')) 97 | { 98 | printf("\t Abnormal Entry! Please report. [%02x %02x %02x %02x]\n", 99 | p[5 + i * 10], p[6 + i * 10], 100 | p[7 + i * 10], p[8 + i * 10]); 101 | return 0; 102 | } 103 | } 104 | 105 | /* search for the right entry */ 106 | for (i = 0; i < p[4]; i++) 107 | if (memcmp(p + 5 + i * 10, "$ERB", 4) == 0) 108 | return DWORD(p + 9 + i * 10); 109 | 110 | return 0; 111 | } 112 | 113 | /* Return -1 on error, 0 on success */ 114 | static int parse_command_line(int argc, char * const argv[]) 115 | { 116 | int option; 117 | const char *optstring = "d:hV"; 118 | struct option longopts[] = { 119 | { "dev-mem", required_argument, NULL, 'd' }, 120 | { "help", no_argument, NULL, 'h' }, 121 | { "version", no_argument, NULL, 'V' }, 122 | { NULL, 0, NULL, 0 } 123 | }; 124 | 125 | while ((option = getopt_long(argc, argv, optstring, longopts, NULL)) != -1) 126 | switch (option) 127 | { 128 | case 'd': 129 | opt.devmem = optarg; 130 | break; 131 | case 'h': 132 | opt.flags |= FLAG_HELP; 133 | break; 134 | case 'V': 135 | opt.flags |= FLAG_VERSION; 136 | break; 137 | case '?': 138 | return -1; 139 | } 140 | 141 | return 0; 142 | } 143 | 144 | static void print_help(void) 145 | { 146 | static const char *help = 147 | "Usage: ownership [OPTIONS]\n" 148 | "Options are:\n" 149 | " -d, --dev-mem FILE Read memory from device FILE (default: " DEFAULT_MEM_DEV ")\n" 150 | " -h, --help Display this help text and exit\n" 151 | " -V, --version Display the version and exit\n"; 152 | 153 | printf("%s", help); 154 | } 155 | 156 | int main(int argc, char * const argv[]) 157 | { 158 | u8 *buf; 159 | off_t fp; 160 | int ok = 0; 161 | 162 | if (sizeof(u8) != 1 || sizeof(u32) != 4) 163 | { 164 | fprintf(stderr, "%s: compiler incompatibility\n", argv[0]); 165 | exit(255); 166 | } 167 | 168 | /* Set default option values */ 169 | opt.devmem = DEFAULT_MEM_DEV; 170 | opt.flags = 0; 171 | 172 | if (parse_command_line(argc, argv)<0) 173 | exit(2); 174 | 175 | if (opt.flags & FLAG_HELP) 176 | { 177 | print_help(); 178 | return 0; 179 | } 180 | 181 | if (opt.flags & FLAG_VERSION) 182 | { 183 | printf("%s\n", VERSION); 184 | return 0; 185 | } 186 | 187 | if ((buf = mem_chunk(0xE0000, 0x20000, opt.devmem)) == NULL) 188 | exit(1); 189 | 190 | for (fp = 0; !ok && fp <= 0x1FFF0; fp += 16) 191 | { 192 | u8 *p = buf + fp; 193 | 194 | if (memcmp((char *)p, "32OS", 4) == 0) 195 | { 196 | off_t len = p[4] * 10 + 5; 197 | 198 | if (fp + len - 1 <= 0x1FFFF) 199 | { 200 | u32 base; 201 | 202 | if ((base = decode(p))) 203 | { 204 | ok = 1; 205 | ownership(base, argv[0], opt.devmem); 206 | } 207 | } 208 | } 209 | } 210 | 211 | free(buf); 212 | 213 | return 0; 214 | } 215 | -------------------------------------------------------------------------------- /types.h: -------------------------------------------------------------------------------- 1 | #ifndef TYPES_H 2 | #define TYPES_H 3 | 4 | #include "config.h" 5 | 6 | typedef unsigned char u8; 7 | typedef unsigned short u16; 8 | typedef signed short i16; 9 | typedef unsigned int u32; 10 | 11 | /* 12 | * You may use the following defines to adjust the type definitions 13 | * depending on the architecture: 14 | * - Define BIGENDIAN on big-endian systems. Untested, as all target 15 | * systems to date are little-endian. 16 | * - Define ALIGNMENT_WORKAROUND if your system doesn't support 17 | * non-aligned memory access. In this case, we use a slower, but safer, 18 | * memory access method. This should be done automatically in config.h 19 | * for architectures which need it. 20 | */ 21 | 22 | #ifdef BIGENDIAN 23 | typedef struct { 24 | u32 h; 25 | u32 l; 26 | } u64; 27 | #else 28 | typedef struct { 29 | u32 l; 30 | u32 h; 31 | } u64; 32 | #endif 33 | 34 | #ifdef ALIGNMENT_WORKAROUND 35 | static inline u64 U64(u32 low, u32 high) 36 | { 37 | u64 self; 38 | 39 | self.l = low; 40 | self.h = high; 41 | 42 | return self; 43 | } 44 | #endif 45 | 46 | #ifdef ALIGNMENT_WORKAROUND 47 | # ifdef BIGENDIAN 48 | # define WORD(x) (u16)((x)[1] + ((x)[0] << 8)) 49 | # define DWORD(x) (u32)((x)[3] + ((x)[2] << 8) + ((x)[1] << 16) + ((x)[0] << 24)) 50 | # define QWORD(x) (U64(DWORD(x + 4), DWORD(x))) 51 | # else /* BIGENDIAN */ 52 | # define WORD(x) (u16)((x)[0] + ((x)[1] << 8)) 53 | # define DWORD(x) (u32)((x)[0] + ((x)[1] << 8) + ((x)[2] << 16) + ((x)[3] << 24)) 54 | # define QWORD(x) (U64(DWORD(x), DWORD(x + 4))) 55 | # endif /* BIGENDIAN */ 56 | #else /* ALIGNMENT_WORKAROUND */ 57 | #define WORD(x) (u16)(*(const u16 *)(x)) 58 | #define DWORD(x) (u32)(*(const u32 *)(x)) 59 | #define QWORD(x) (*(const u64 *)(x)) 60 | #endif /* ALIGNMENT_WORKAROUND */ 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /util.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Common "util" functions 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2002-2017 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | * For the avoidance of doubt the "preferred form" of this code is one which 22 | * is in an open unpatent encumbered format. Where cryptographic key signing 23 | * forms part of the process of creating an executable the information 24 | * including keys needed to generate an equivalently functional executable 25 | * are deemed to be part of the source code. 26 | */ 27 | 28 | #include 29 | #include 30 | 31 | #include "config.h" 32 | 33 | #ifdef USE_MMAP 34 | #include 35 | #ifndef MAP_FAILED 36 | #define MAP_FAILED ((void *) -1) 37 | #endif /* !MAP_FAILED */ 38 | #endif /* USE MMAP */ 39 | 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include "types.h" 48 | #include "util.h" 49 | 50 | static int myread(int fd, u8 *buf, size_t count, const char *prefix) 51 | { 52 | ssize_t r = 1; 53 | size_t r2 = 0; 54 | 55 | while (r2 != count && r != 0) 56 | { 57 | r = read(fd, buf + r2, count - r2); 58 | if (r == -1) 59 | { 60 | if (errno != EINTR) 61 | { 62 | close(fd); 63 | perror(prefix); 64 | return -1; 65 | } 66 | } 67 | else 68 | r2 += r; 69 | } 70 | 71 | if (r2 != count) 72 | { 73 | close(fd); 74 | fprintf(stderr, "%s: Unexpected end of file\n", prefix); 75 | return -1; 76 | } 77 | 78 | return 0; 79 | } 80 | 81 | int checksum(const u8 *buf, size_t len) 82 | { 83 | u8 sum = 0; 84 | size_t a; 85 | 86 | for (a = 0; a < len; a++) 87 | sum += buf[a]; 88 | return (sum == 0); 89 | } 90 | 91 | /* 92 | * Reads all of file from given offset, up to max_len bytes. 93 | * A buffer of max_len bytes is allocated by this function, and 94 | * needs to be freed by the caller. 95 | * This provides a similar usage model to mem_chunk() 96 | * 97 | * Returns pointer to buffer of max_len bytes, or NULL on error, and 98 | * sets max_len to the length actually read. 99 | * 100 | */ 101 | void *read_file(off_t base, size_t *max_len, const char *filename) 102 | { 103 | int fd; 104 | size_t r2 = 0; 105 | ssize_t r; 106 | u8 *p; 107 | 108 | /* 109 | * Don't print error message on missing file, as we will try to read 110 | * files that may or may not be present. 111 | */ 112 | if ((fd = open(filename, O_RDONLY)) == -1) 113 | { 114 | if (errno != ENOENT) 115 | perror(filename); 116 | return NULL; 117 | } 118 | 119 | if (lseek(fd, base, SEEK_SET) == -1) 120 | { 121 | fprintf(stderr, "%s: ", filename); 122 | perror("lseek"); 123 | p = NULL; 124 | goto out; 125 | } 126 | 127 | if ((p = malloc(*max_len)) == NULL) 128 | { 129 | perror("malloc"); 130 | goto out; 131 | } 132 | 133 | do 134 | { 135 | r = read(fd, p + r2, *max_len - r2); 136 | if (r == -1) 137 | { 138 | if (errno != EINTR) 139 | { 140 | perror(filename); 141 | free(p); 142 | p = NULL; 143 | goto out; 144 | } 145 | } 146 | else 147 | r2 += r; 148 | } 149 | while (r != 0); 150 | 151 | *max_len = r2; 152 | out: 153 | close(fd); 154 | 155 | return p; 156 | } 157 | 158 | /* 159 | * Copy a physical memory chunk into a memory buffer. 160 | * This function allocates memory. 161 | */ 162 | void *mem_chunk(off_t base, size_t len, const char *devmem) 163 | { 164 | void *p; 165 | int fd; 166 | #ifdef USE_MMAP 167 | struct stat statbuf; 168 | off_t mmoffset; 169 | void *mmp; 170 | #endif 171 | 172 | if ((fd = open(devmem, O_RDONLY)) == -1) 173 | { 174 | perror(devmem); 175 | return NULL; 176 | } 177 | 178 | if ((p = malloc(len)) == NULL) 179 | { 180 | perror("malloc"); 181 | goto out; 182 | } 183 | 184 | #ifdef USE_MMAP 185 | if (fstat(fd, &statbuf) == -1) 186 | { 187 | fprintf(stderr, "%s: ", devmem); 188 | perror("stat"); 189 | goto err_free; 190 | } 191 | 192 | /* 193 | * mmap() will fail with SIGBUS if trying to map beyond the end of 194 | * the file. 195 | */ 196 | if (S_ISREG(statbuf.st_mode) && base + (off_t)len > statbuf.st_size) 197 | { 198 | fprintf(stderr, "mmap: Can't map beyond end of file %s\n", 199 | devmem); 200 | goto err_free; 201 | } 202 | 203 | #ifdef _SC_PAGESIZE 204 | mmoffset = base % sysconf(_SC_PAGESIZE); 205 | #else 206 | mmoffset = base % getpagesize(); 207 | #endif /* _SC_PAGESIZE */ 208 | /* 209 | * Please note that we don't use mmap() for performance reasons here, 210 | * but to workaround problems many people encountered when trying 211 | * to read from /dev/mem using regular read() calls. 212 | */ 213 | mmp = mmap(NULL, mmoffset + len, PROT_READ, MAP_SHARED, fd, base - mmoffset); 214 | if (mmp == MAP_FAILED) 215 | goto try_read; 216 | 217 | memcpy(p, (u8 *)mmp + mmoffset, len); 218 | 219 | if (munmap(mmp, mmoffset + len) == -1) 220 | { 221 | fprintf(stderr, "%s: ", devmem); 222 | perror("munmap"); 223 | } 224 | 225 | goto out; 226 | 227 | try_read: 228 | #endif /* USE_MMAP */ 229 | if (lseek(fd, base, SEEK_SET) == -1) 230 | { 231 | fprintf(stderr, "%s: ", devmem); 232 | perror("lseek"); 233 | goto err_free; 234 | } 235 | 236 | if (myread(fd, p, len, devmem) == 0) 237 | goto out; 238 | 239 | err_free: 240 | free(p); 241 | p = NULL; 242 | 243 | out: 244 | if (close(fd) == -1) 245 | perror(devmem); 246 | 247 | return p; 248 | } 249 | 250 | int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add) 251 | { 252 | FILE *f; 253 | 254 | f = fopen(dumpfile, add ? "r+b" : "wb"); 255 | if (!f) 256 | { 257 | fprintf(stderr, "%s: ", dumpfile); 258 | perror("fopen"); 259 | return -1; 260 | } 261 | 262 | if (fseek(f, base, SEEK_SET) != 0) 263 | { 264 | fprintf(stderr, "%s: ", dumpfile); 265 | perror("fseek"); 266 | goto err_close; 267 | } 268 | 269 | if (fwrite(data, len, 1, f) != 1) 270 | { 271 | fprintf(stderr, "%s: ", dumpfile); 272 | perror("fwrite"); 273 | goto err_close; 274 | } 275 | 276 | if (fclose(f)) 277 | { 278 | fprintf(stderr, "%s: ", dumpfile); 279 | perror("fclose"); 280 | return -1; 281 | } 282 | 283 | return 0; 284 | 285 | err_close: 286 | fclose(f); 287 | return -1; 288 | } 289 | 290 | /* Returns end - start + 1, assuming start < end */ 291 | u64 u64_range(u64 start, u64 end) 292 | { 293 | u64 res; 294 | 295 | res.h = end.h - start.h; 296 | res.l = end.l - start.l; 297 | 298 | if (end.l < start.l) 299 | res.h--; 300 | if (++res.l == 0) 301 | res.h++; 302 | 303 | return res; 304 | } 305 | -------------------------------------------------------------------------------- /util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the dmidecode project. 3 | * 4 | * Copyright (C) 2003-2017 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | */ 20 | 21 | #include 22 | 23 | #include "types.h" 24 | 25 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0])) 26 | 27 | int checksum(const u8 *buf, size_t len); 28 | void *read_file(off_t base, size_t *len, const char *filename); 29 | void *mem_chunk(off_t base, size_t len, const char *devmem); 30 | int write_dump(size_t base, size_t len, const void *data, const char *dumpfile, int add); 31 | u64 u64_range(u64 start, u64 end); 32 | -------------------------------------------------------------------------------- /version.h: -------------------------------------------------------------------------------- 1 | #define VERSION "3.1" 2 | -------------------------------------------------------------------------------- /vpddecode.c: -------------------------------------------------------------------------------- 1 | /* 2 | * IBM Vital Product Data decoder 3 | * 4 | * Copyright (C) 2003-2007 Jean Delvare 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | * For the avoidance of doubt the "preferred form" of this code is one which 21 | * is in an open unpatent encumbered format. Where cryptographic key signing 22 | * forms part of the process of creating an executable the information 23 | * including keys needed to generate an equivalently functional executable 24 | * are deemed to be part of the source code. 25 | * 26 | * References: 27 | * - IBM "Using the BIOS Build ID to identify Thinkpad systems" 28 | * Revision 2006-01-31 29 | * http://www-307.ibm.com/pc/support/site.wss/MIGR-45120.html 30 | * 31 | * Notes: 32 | * - Main part of the code is taken directly from biosdecode, with an 33 | * additional command line interface and a few experimental features. 34 | */ 35 | 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | #include "version.h" 42 | #include "config.h" 43 | #include "types.h" 44 | #include "util.h" 45 | #include "vpdopt.h" 46 | 47 | static void print_entry(const char *name, const u8 *p, size_t len) 48 | { 49 | size_t i; 50 | 51 | if (name != NULL) 52 | printf("%s: ", name); 53 | for (i = 0; i < len; i++) 54 | { 55 | /* ASCII filtering */ 56 | if (p[i] >= 32 && p[i] < 127) 57 | printf("%c", p[i]); 58 | else if (p[i] != 0) 59 | printf("."); 60 | } 61 | printf("\n"); 62 | } 63 | 64 | static void dump(const u8 *p, u8 len) 65 | { 66 | int done, i, min; 67 | 68 | for (done = 0; done < len; done += 16) 69 | { 70 | printf("%02X:", done); 71 | min = (len - done < 16) ? len - done : 16; 72 | 73 | /* As hexadecimal first */ 74 | for (i = 0; i < min; i++) 75 | printf(" %02X", p[done + i]); 76 | for (; i < 16; i++) /* Complete line if needed */ 77 | printf(" "); 78 | printf(" "); 79 | 80 | /* And now as text, with ASCII filtering */ 81 | for (i = 0; i < min; i++) 82 | printf("%c", (p[done + i] >= 32 && p[done + i] < 127) ? 83 | p[done + i] : '.'); 84 | printf("\n"); 85 | } 86 | } 87 | 88 | static int decode(const u8 *p) 89 | { 90 | if (p[5] < 0x30) 91 | return 0; 92 | 93 | /* XSeries have longer records, exact length seems to vary. */ 94 | if (!(p[5] >= 0x45 && checksum(p, p[5])) 95 | /* Some Netvista seem to work with this. */ 96 | && !(checksum(p, 0x30)) 97 | /* The Thinkpad/Thinkcentre checksum does *not* include the first 98 | 13 bytes. */ 99 | && !(checksum(p + 0x0D, 0x30 - 0x0D))) 100 | { 101 | /* A few systems have a bad checksum (xSeries 325, 330, 335 102 | and 345 with early BIOS) but the record is otherwise 103 | valid. */ 104 | if (!(opt.flags & FLAG_QUIET)) 105 | printf("# Bad checksum!\n"); 106 | } 107 | 108 | if (opt.string != NULL) 109 | { 110 | if (opt.string->offset + opt.string->len < p[5]) 111 | print_entry(NULL, p + opt.string->offset, 112 | opt.string->len); 113 | return 1; 114 | } 115 | 116 | print_entry("BIOS Build ID", p + 0x0D, 9); 117 | print_entry("Box Serial Number", p + 0x16, 7); 118 | print_entry("Motherboard Serial Number", p + 0x1D, 11); 119 | print_entry("Machine Type/Model", p + 0x28, 7); 120 | 121 | if (p[5] < 0x44) 122 | return 1; 123 | 124 | print_entry("BIOS Release Date", p + 0x30, 8); 125 | print_entry("Default Flash Image File Name", p + 0x38, 12); 126 | 127 | if (p[5] >= 0x46 && p[0x44] != 0x00) 128 | { 129 | printf("%s: %u\n", "BIOS Revision", p[0x44]); 130 | } 131 | 132 | return 1; 133 | } 134 | 135 | int main(int argc, char * const argv[]) 136 | { 137 | u8 *buf; 138 | int found = 0; 139 | unsigned int fp; 140 | 141 | if (sizeof(u8) != 1) 142 | { 143 | fprintf(stderr, "%s: compiler incompatibility\n", argv[0]); 144 | exit(255); 145 | } 146 | 147 | /* Set default option values */ 148 | opt.devmem = DEFAULT_MEM_DEV; 149 | opt.flags = 0; 150 | 151 | if (parse_command_line(argc, argv)<0) 152 | exit(2); 153 | 154 | if (opt.flags & FLAG_HELP) 155 | { 156 | print_help(); 157 | return 0; 158 | } 159 | 160 | if (opt.flags & FLAG_VERSION) 161 | { 162 | printf("%s\n", VERSION); 163 | return 0; 164 | } 165 | 166 | if (!(opt.flags & FLAG_QUIET)) 167 | printf("# vpddecode %s\n", VERSION); 168 | 169 | if ((buf = mem_chunk(0xF0000, 0x10000, opt.devmem)) == NULL) 170 | exit(1); 171 | 172 | for (fp = 0; fp <= 0xFFF0; fp += 4) 173 | { 174 | u8 *p = buf + fp; 175 | 176 | if (memcmp((char *)p, "\252\125VPD", 5) == 0 177 | && fp + p[5] - 1 <= 0xFFFF) 178 | { 179 | if (fp % 16 && !(opt.flags & FLAG_QUIET)) 180 | printf("# Unaligned address (%#x)\n", 181 | 0xf0000 + fp); 182 | if (opt.flags & FLAG_DUMP) 183 | { 184 | dump(p, p[5]); 185 | found++; 186 | } 187 | else 188 | { 189 | if (decode(p)) 190 | found++; 191 | } 192 | } 193 | } 194 | 195 | free(buf); 196 | 197 | if (!found && !(opt.flags & FLAG_QUIET)) 198 | printf("# No VPD structure found, sorry.\n"); 199 | 200 | return 0; 201 | } 202 | -------------------------------------------------------------------------------- /vpdopt.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Command line handling of vpddecode 3 | * This file is part of the dmidecode project. 4 | * 5 | * Copyright (C) 2005-2007 Jean Delvare 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #include "config.h" 28 | #include "util.h" 29 | #include "vpdopt.h" 30 | 31 | 32 | /* Options are global */ 33 | struct opt opt; 34 | 35 | 36 | /* 37 | * Handling of option --string 38 | */ 39 | 40 | /* This lookup table could admittedly be reworked for improved performance. 41 | Due to the low count of items in there at the moment, it did not seem 42 | worth the additional code complexity though. */ 43 | static const struct string_keyword opt_string_keyword[] = { 44 | { "bios-build-id", 0x0D, 9 }, 45 | { "box-serial-number", 0x16, 7 }, 46 | { "motherboard-serial-number", 0x1D, 11 }, 47 | { "machine-type-model", 0x28, 7 }, 48 | { "bios-release-date", 0x30, 8 }, 49 | }; 50 | 51 | static void print_opt_string_list(void) 52 | { 53 | unsigned int i; 54 | 55 | fprintf(stderr, "Valid string keywords are:\n"); 56 | for (i = 0; i < ARRAY_SIZE(opt_string_keyword); i++) 57 | { 58 | fprintf(stderr, " %s\n", opt_string_keyword[i].keyword); 59 | } 60 | } 61 | 62 | static int parse_opt_string(const char *arg) 63 | { 64 | unsigned int i; 65 | 66 | if (opt.string) 67 | { 68 | fprintf(stderr, "Only one string can be specified\n"); 69 | return -1; 70 | } 71 | 72 | for (i = 0; i 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | */ 21 | 22 | #include 23 | 24 | struct string_keyword 25 | { 26 | const char *keyword; 27 | off_t offset; 28 | size_t len; 29 | }; 30 | 31 | struct opt 32 | { 33 | const char *devmem; 34 | unsigned int flags; 35 | const struct string_keyword *string; 36 | }; 37 | extern struct opt opt; 38 | 39 | #define FLAG_VERSION (1 << 0) 40 | #define FLAG_HELP (1 << 1) 41 | #define FLAG_DUMP (1 << 2) 42 | #define FLAG_QUIET (1 << 3) 43 | 44 | int parse_command_line(int argc, char * const argv[]); 45 | void print_help(void); 46 | --------------------------------------------------------------------------------