18c2ecf20Sopenharmony_ciWhat:		/sys/firmware/dmi/entries/
28c2ecf20Sopenharmony_ciDate:		February 2011
38c2ecf20Sopenharmony_ciContact:	Mike Waychison <mikew@google.com>
48c2ecf20Sopenharmony_ciDescription:
58c2ecf20Sopenharmony_ci		Many machines' firmware (x86 and ia64) export DMI /
68c2ecf20Sopenharmony_ci		SMBIOS tables to the operating system.  Getting at this
78c2ecf20Sopenharmony_ci		information is often valuable to userland, especially in
88c2ecf20Sopenharmony_ci		cases where there are OEM extensions used.
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci		The kernel itself does not rely on the majority of the
118c2ecf20Sopenharmony_ci		information in these tables being correct.  It equally
128c2ecf20Sopenharmony_ci		cannot ensure that the data as exported to userland is
138c2ecf20Sopenharmony_ci		without error either.
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci		DMI is structured as a large table of entries, where
168c2ecf20Sopenharmony_ci		each entry has a common header indicating the type and
178c2ecf20Sopenharmony_ci		length of the entry, as well as a firmware-provided
188c2ecf20Sopenharmony_ci		'handle' that is supposed to be unique amongst all
198c2ecf20Sopenharmony_ci		entries.
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci		Some entries are required by the specification, but many
228c2ecf20Sopenharmony_ci		others are optional.  In general though, users should
238c2ecf20Sopenharmony_ci		never expect to find a specific entry type on their
248c2ecf20Sopenharmony_ci		system unless they know for certain what their firmware
258c2ecf20Sopenharmony_ci		is doing.  Machine to machine experiences will vary.
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci		Multiple entries of the same type are allowed.  In order
288c2ecf20Sopenharmony_ci		to handle these duplicate entry types, each entry is
298c2ecf20Sopenharmony_ci		assigned by the operating system an 'instance', which is
308c2ecf20Sopenharmony_ci		derived from an entry type's ordinal position.  That is
318c2ecf20Sopenharmony_ci		to say, if there are 'N' multiple entries with the same type
328c2ecf20Sopenharmony_ci		'T' in the DMI tables (adjacent or spread apart, it
338c2ecf20Sopenharmony_ci		doesn't matter), they will be represented in sysfs as
348c2ecf20Sopenharmony_ci		entries "T-0" through "T-(N-1)":
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci		Example entry directories::
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci			/sys/firmware/dmi/entries/17-0
398c2ecf20Sopenharmony_ci			/sys/firmware/dmi/entries/17-1
408c2ecf20Sopenharmony_ci			/sys/firmware/dmi/entries/17-2
418c2ecf20Sopenharmony_ci			/sys/firmware/dmi/entries/17-3
428c2ecf20Sopenharmony_ci			...
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci		Instance numbers are used in lieu of the firmware
458c2ecf20Sopenharmony_ci		assigned entry handles as the kernel itself makes no
468c2ecf20Sopenharmony_ci		guarantees that handles as exported are unique, and
478c2ecf20Sopenharmony_ci		there are likely firmware images that get this wrong in
488c2ecf20Sopenharmony_ci		the wild.
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ci		Each DMI entry in sysfs has the common header values
518c2ecf20Sopenharmony_ci		exported as attributes:
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci		========  =================================================
548c2ecf20Sopenharmony_ci		handle	  The 16bit 'handle' that is assigned to this
558c2ecf20Sopenharmony_ci			  entry by the firmware.  This handle may be
568c2ecf20Sopenharmony_ci			  referred to by other entries.
578c2ecf20Sopenharmony_ci		length	  The length of the entry, as presented in the
588c2ecf20Sopenharmony_ci			  entry itself.  Note that this is _not the
598c2ecf20Sopenharmony_ci			  total count of bytes associated with the
608c2ecf20Sopenharmony_ci			  entry.  This value represents the length of
618c2ecf20Sopenharmony_ci			  the "formatted" portion of the entry.  This
628c2ecf20Sopenharmony_ci			  "formatted" region is sometimes followed by
638c2ecf20Sopenharmony_ci			  the "unformatted" region composed of nul
648c2ecf20Sopenharmony_ci			  terminated strings, with termination signalled
658c2ecf20Sopenharmony_ci			  by a two nul characters in series.
668c2ecf20Sopenharmony_ci		raw	  The raw bytes of the entry. This includes the
678c2ecf20Sopenharmony_ci			  "formatted" portion of the entry, the
688c2ecf20Sopenharmony_ci			  "unformatted" strings portion of the entry,
698c2ecf20Sopenharmony_ci			  and the two terminating nul characters.
708c2ecf20Sopenharmony_ci		type	  The type of the entry.  This value is the same
718c2ecf20Sopenharmony_ci			  as found in the directory name.  It indicates
728c2ecf20Sopenharmony_ci			  how the rest of the entry should be interpreted.
738c2ecf20Sopenharmony_ci		instance  The instance ordinal of the entry for the
748c2ecf20Sopenharmony_ci			  given type.  This value is the same as found
758c2ecf20Sopenharmony_ci			  in the parent directory name.
768c2ecf20Sopenharmony_ci		position  The ordinal position (zero-based) of the entry
778c2ecf20Sopenharmony_ci			  within the entirety of the DMI entry table.
788c2ecf20Sopenharmony_ci		========  =================================================
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci		**Entry Specialization**
818c2ecf20Sopenharmony_ci
828c2ecf20Sopenharmony_ci		Some entry types may have other information available in
838c2ecf20Sopenharmony_ci		sysfs.  Not all types are specialized.
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci		**Type 15 - System Event Log**
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci		This entry allows the firmware to export a log of
888c2ecf20Sopenharmony_ci		events the system has taken.  This information is
898c2ecf20Sopenharmony_ci		typically backed by nvram, but the implementation
908c2ecf20Sopenharmony_ci		details are abstracted by this table.  This entry's data
918c2ecf20Sopenharmony_ci		is exported in the directory::
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci		  /sys/firmware/dmi/entries/15-0/system_event_log
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci		and has the following attributes (documented in the
968c2ecf20Sopenharmony_ci		SMBIOS / DMI specification under "System Event Log (Type 15)":
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci		- area_length
998c2ecf20Sopenharmony_ci		- header_start_offset
1008c2ecf20Sopenharmony_ci		- data_start_offset
1018c2ecf20Sopenharmony_ci		- access_method
1028c2ecf20Sopenharmony_ci		- status
1038c2ecf20Sopenharmony_ci		- change_token
1048c2ecf20Sopenharmony_ci		- access_method_address
1058c2ecf20Sopenharmony_ci		- header_format
1068c2ecf20Sopenharmony_ci		- per_log_type_descriptor_length
1078c2ecf20Sopenharmony_ci		- type_descriptors_supported_count
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci		As well, the kernel exports the binary attribute:
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci		=============	  ====================================
1128c2ecf20Sopenharmony_ci		raw_event_log	  The raw binary bits of the event log
1138c2ecf20Sopenharmony_ci				  as described by the DMI entry.
1148c2ecf20Sopenharmony_ci		=============	  ====================================
115