| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 1 | What:		/sys/firmware/dmi/ | 
|  | 2 | Date:		February 2011 | 
|  | 3 | Contact:	Mike Waychison <mikew@google.com> | 
|  | 4 | Description: | 
|  | 5 | Many machines' firmware (x86 and ia64) export DMI / | 
|  | 6 | SMBIOS tables to the operating system.  Getting at this | 
|  | 7 | information is often valuable to userland, especially in | 
|  | 8 | cases where there are OEM extensions used. | 
|  | 9 |  | 
|  | 10 | The kernel itself does not rely on the majority of the | 
|  | 11 | information in these tables being correct.  It equally | 
|  | 12 | cannot ensure that the data as exported to userland is | 
|  | 13 | without error either. | 
|  | 14 |  | 
|  | 15 | DMI is structured as a large table of entries, where | 
|  | 16 | each entry has a common header indicating the type and | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 17 | length of the entry, as well as a firmware-provided | 
|  | 18 | 'handle' that is supposed to be unique amongst all | 
|  | 19 | entries. | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 20 |  | 
|  | 21 | Some entries are required by the specification, but many | 
|  | 22 | others are optional.  In general though, users should | 
|  | 23 | never expect to find a specific entry type on their | 
|  | 24 | system unless they know for certain what their firmware | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 25 | is doing.  Machine to machine experiences will vary. | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 26 |  | 
|  | 27 | Multiple entries of the same type are allowed.  In order | 
|  | 28 | to handle these duplicate entry types, each entry is | 
|  | 29 | assigned by the operating system an 'instance', which is | 
|  | 30 | derived from an entry type's ordinal position.  That is | 
|  | 31 | to say, if there are 'N' multiple entries with the same type | 
|  | 32 | 'T' in the DMI tables (adjacent or spread apart, it | 
|  | 33 | doesn't matter), they will be represented in sysfs as | 
|  | 34 | entries "T-0" through "T-(N-1)": | 
|  | 35 |  | 
|  | 36 | Example entry directories: | 
|  | 37 |  | 
|  | 38 | /sys/firmware/dmi/entries/17-0 | 
|  | 39 | /sys/firmware/dmi/entries/17-1 | 
|  | 40 | /sys/firmware/dmi/entries/17-2 | 
|  | 41 | /sys/firmware/dmi/entries/17-3 | 
|  | 42 | ... | 
|  | 43 |  | 
|  | 44 | Instance numbers are used in lieu of the firmware | 
|  | 45 | assigned entry handles as the kernel itself makes no | 
|  | 46 | guarantees that handles as exported are unique, and | 
|  | 47 | there are likely firmware images that get this wrong in | 
|  | 48 | the wild. | 
|  | 49 |  | 
|  | 50 | Each DMI entry in sysfs has the common header values | 
|  | 51 | exported as attributes: | 
|  | 52 |  | 
|  | 53 | handle	: The 16bit 'handle' that is assigned to this | 
|  | 54 | entry by the firmware.  This handle may be | 
|  | 55 | referred to by other entries. | 
|  | 56 | length	: The length of the entry, as presented in the | 
|  | 57 | entry itself.  Note that this is _not the | 
|  | 58 | total count of bytes associated with the | 
|  | 59 | entry_.  This value represents the length of | 
|  | 60 | the "formatted" portion of the entry.  This | 
|  | 61 | "formatted" region is sometimes followed by | 
|  | 62 | the "unformatted" region composed of nul | 
|  | 63 | terminated strings, with termination signalled | 
|  | 64 | by a two nul characters in series. | 
|  | 65 | raw	: The raw bytes of the entry. This includes the | 
|  | 66 | "formatted" portion of the entry, the | 
|  | 67 | "unformatted" strings portion of the entry, | 
|  | 68 | and the two terminating nul characters. | 
|  | 69 | type	: The type of the entry.  This value is the same | 
|  | 70 | as found in the directory name.  It indicates | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 71 | how the rest of the entry should be interpreted. | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 72 | instance: The instance ordinal of the entry for the | 
|  | 73 | given type.  This value is the same as found | 
|  | 74 | in the parent directory name. | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 75 | position: The ordinal position (zero-based) of the entry | 
|  | 76 | within the entirety of the DMI entry table. | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 77 |  | 
|  | 78 | === Entry Specialization === | 
|  | 79 |  | 
|  | 80 | Some entry types may have other information available in | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 81 | sysfs.  Not all types are specialized. | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 82 |  | 
|  | 83 | --- Type 15 - System Event Log --- | 
|  | 84 |  | 
|  | 85 | This entry allows the firmware to export a log of | 
|  | 86 | events the system has taken.  This information is | 
|  | 87 | typically backed by nvram, but the implementation | 
| Mike Waychison | 695cca8 | 2011-03-18 16:50:03 -0700 | [diff] [blame] | 88 | details are abstracted by this table.  This entry's data | 
| Mike Waychison | 9effd82 | 2011-02-22 17:53:36 -0800 | [diff] [blame] | 89 | is exported in the directory: | 
|  | 90 |  | 
|  | 91 | /sys/firmware/dmi/entries/15-0/system_event_log | 
|  | 92 |  | 
|  | 93 | and has the following attributes (documented in the | 
|  | 94 | SMBIOS / DMI specification under "System Event Log (Type 15)": | 
|  | 95 |  | 
|  | 96 | area_length | 
|  | 97 | header_start_offset | 
|  | 98 | data_start_offset | 
|  | 99 | access_method | 
|  | 100 | status | 
|  | 101 | change_token | 
|  | 102 | access_method_address | 
|  | 103 | header_format | 
|  | 104 | per_log_type_descriptor_length | 
|  | 105 | type_descriptors_supported_count | 
|  | 106 |  | 
|  | 107 | As well, the kernel exports the binary attribute: | 
|  | 108 |  | 
|  | 109 | raw_event_log	: The raw binary bits of the event log | 
|  | 110 | as described by the DMI entry. |