162306a36Sopenharmony_ciWhat:		/sys/firmware/dmi/entries/
262306a36Sopenharmony_ciDate:		February 2011
362306a36Sopenharmony_ciContact:	Mike Waychison <mikew@google.com>
462306a36Sopenharmony_ciDescription:
562306a36Sopenharmony_ci		Many machines' firmware (x86 and ia64) export DMI /
662306a36Sopenharmony_ci		SMBIOS tables to the operating system.  Getting at this
762306a36Sopenharmony_ci		information is often valuable to userland, especially in
862306a36Sopenharmony_ci		cases where there are OEM extensions used.
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci		The kernel itself does not rely on the majority of the
1162306a36Sopenharmony_ci		information in these tables being correct.  It equally
1262306a36Sopenharmony_ci		cannot ensure that the data as exported to userland is
1362306a36Sopenharmony_ci		without error either.
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci		DMI is structured as a large table of entries, where
1662306a36Sopenharmony_ci		each entry has a common header indicating the type and
1762306a36Sopenharmony_ci		length of the entry, as well as a firmware-provided
1862306a36Sopenharmony_ci		'handle' that is supposed to be unique amongst all
1962306a36Sopenharmony_ci		entries.
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci		Some entries are required by the specification, but many
2262306a36Sopenharmony_ci		others are optional.  In general though, users should
2362306a36Sopenharmony_ci		never expect to find a specific entry type on their
2462306a36Sopenharmony_ci		system unless they know for certain what their firmware
2562306a36Sopenharmony_ci		is doing.  Machine to machine experiences will vary.
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci		Multiple entries of the same type are allowed.  In order
2862306a36Sopenharmony_ci		to handle these duplicate entry types, each entry is
2962306a36Sopenharmony_ci		assigned by the operating system an 'instance', which is
3062306a36Sopenharmony_ci		derived from an entry type's ordinal position.  That is
3162306a36Sopenharmony_ci		to say, if there are 'N' multiple entries with the same type
3262306a36Sopenharmony_ci		'T' in the DMI tables (adjacent or spread apart, it
3362306a36Sopenharmony_ci		doesn't matter), they will be represented in sysfs as
3462306a36Sopenharmony_ci		entries "T-0" through "T-(N-1)":
3562306a36Sopenharmony_ci
3662306a36Sopenharmony_ci		Example entry directories::
3762306a36Sopenharmony_ci
3862306a36Sopenharmony_ci			/sys/firmware/dmi/entries/17-0
3962306a36Sopenharmony_ci			/sys/firmware/dmi/entries/17-1
4062306a36Sopenharmony_ci			/sys/firmware/dmi/entries/17-2
4162306a36Sopenharmony_ci			/sys/firmware/dmi/entries/17-3
4262306a36Sopenharmony_ci			...
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci		Instance numbers are used in lieu of the firmware
4562306a36Sopenharmony_ci		assigned entry handles as the kernel itself makes no
4662306a36Sopenharmony_ci		guarantees that handles as exported are unique, and
4762306a36Sopenharmony_ci		there are likely firmware images that get this wrong in
4862306a36Sopenharmony_ci		the wild.
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci		Each DMI entry in sysfs has the common header values
5162306a36Sopenharmony_ci		exported as attributes:
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci		========  =================================================
5462306a36Sopenharmony_ci		handle	  The 16bit 'handle' that is assigned to this
5562306a36Sopenharmony_ci			  entry by the firmware.  This handle may be
5662306a36Sopenharmony_ci			  referred to by other entries.
5762306a36Sopenharmony_ci		length	  The length of the entry, as presented in the
5862306a36Sopenharmony_ci			  entry itself.  Note that this is _not the
5962306a36Sopenharmony_ci			  total count of bytes associated with the
6062306a36Sopenharmony_ci			  entry.  This value represents the length of
6162306a36Sopenharmony_ci			  the "formatted" portion of the entry.  This
6262306a36Sopenharmony_ci			  "formatted" region is sometimes followed by
6362306a36Sopenharmony_ci			  the "unformatted" region composed of nul
6462306a36Sopenharmony_ci			  terminated strings, with termination signalled
6562306a36Sopenharmony_ci			  by a two nul characters in series.
6662306a36Sopenharmony_ci		raw	  The raw bytes of the entry. This includes the
6762306a36Sopenharmony_ci			  "formatted" portion of the entry, the
6862306a36Sopenharmony_ci			  "unformatted" strings portion of the entry,
6962306a36Sopenharmony_ci			  and the two terminating nul characters.
7062306a36Sopenharmony_ci		type	  The type of the entry.  This value is the same
7162306a36Sopenharmony_ci			  as found in the directory name.  It indicates
7262306a36Sopenharmony_ci			  how the rest of the entry should be interpreted.
7362306a36Sopenharmony_ci		instance  The instance ordinal of the entry for the
7462306a36Sopenharmony_ci			  given type.  This value is the same as found
7562306a36Sopenharmony_ci			  in the parent directory name.
7662306a36Sopenharmony_ci		position  The ordinal position (zero-based) of the entry
7762306a36Sopenharmony_ci			  within the entirety of the DMI entry table.
7862306a36Sopenharmony_ci		========  =================================================
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci		**Entry Specialization**
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci		Some entry types may have other information available in
8362306a36Sopenharmony_ci		sysfs.  Not all types are specialized.
8462306a36Sopenharmony_ci
8562306a36Sopenharmony_ci		**Type 15 - System Event Log**
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ci		This entry allows the firmware to export a log of
8862306a36Sopenharmony_ci		events the system has taken.  This information is
8962306a36Sopenharmony_ci		typically backed by nvram, but the implementation
9062306a36Sopenharmony_ci		details are abstracted by this table.  This entry's data
9162306a36Sopenharmony_ci		is exported in the directory::
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci		  /sys/firmware/dmi/entries/15-0/system_event_log
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci		and has the following attributes (documented in the
9662306a36Sopenharmony_ci		SMBIOS / DMI specification under "System Event Log (Type 15)":
9762306a36Sopenharmony_ci
9862306a36Sopenharmony_ci		- area_length
9962306a36Sopenharmony_ci		- header_start_offset
10062306a36Sopenharmony_ci		- data_start_offset
10162306a36Sopenharmony_ci		- access_method
10262306a36Sopenharmony_ci		- status
10362306a36Sopenharmony_ci		- change_token
10462306a36Sopenharmony_ci		- access_method_address
10562306a36Sopenharmony_ci		- header_format
10662306a36Sopenharmony_ci		- per_log_type_descriptor_length
10762306a36Sopenharmony_ci		- type_descriptors_supported_count
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci		As well, the kernel exports the binary attribute:
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci		=============	  ====================================
11262306a36Sopenharmony_ci		raw_event_log	  The raw binary bits of the event log
11362306a36Sopenharmony_ci				  as described by the DMI entry.
11462306a36Sopenharmony_ci		=============	  ====================================
115