175f3e8e4SGabriel SomloWhat:		/sys/firmware/qemu_fw_cfg/
275f3e8e4SGabriel SomloDate:		August 2015
375f3e8e4SGabriel SomloContact:	Gabriel Somlo <somlo@cmu.edu>
475f3e8e4SGabriel SomloDescription:
575f3e8e4SGabriel Somlo		Several different architectures supported by QEMU (x86, arm,
675f3e8e4SGabriel Somlo		sun4*, ppc/mac) are provisioned with a firmware configuration
775f3e8e4SGabriel Somlo		(fw_cfg) device, originally intended as a way for the host to
875f3e8e4SGabriel Somlo		provide configuration data to the guest firmware. Starting
975f3e8e4SGabriel Somlo		with QEMU v2.4, arbitrary fw_cfg file entries may be specified
1075f3e8e4SGabriel Somlo		by the user on the command line, which makes fw_cfg additionally
1175f3e8e4SGabriel Somlo		useful as an out-of-band, asynchronous mechanism for providing
1275f3e8e4SGabriel Somlo		configuration data to the guest userspace.
1375f3e8e4SGabriel Somlo
1475f3e8e4SGabriel Somlo		The authoritative guest-side hardware interface documentation
1575f3e8e4SGabriel Somlo		to the fw_cfg device can be found in "docs/specs/fw_cfg.txt"
1675f3e8e4SGabriel Somlo		in the QEMU source tree.
1775f3e8e4SGabriel Somlo
1875f3e8e4SGabriel Somlo		=== SysFS fw_cfg Interface ===
1975f3e8e4SGabriel Somlo
2075f3e8e4SGabriel Somlo		The fw_cfg sysfs interface described in this document is only
2175f3e8e4SGabriel Somlo		intended to display discoverable blobs (i.e., those registered
2275f3e8e4SGabriel Somlo		with the file directory), as there is no way to determine the
2375f3e8e4SGabriel Somlo		presence or size of "legacy" blobs (with selector keys between
2475f3e8e4SGabriel Somlo		0x0002 and 0x0018) programmatically.
2575f3e8e4SGabriel Somlo
2675f3e8e4SGabriel Somlo		All fw_cfg information is shown under:
2775f3e8e4SGabriel Somlo
2875f3e8e4SGabriel Somlo			/sys/firmware/qemu_fw_cfg/
2975f3e8e4SGabriel Somlo
3075f3e8e4SGabriel Somlo		The only legacy blob displayed is the fw_cfg device revision:
3175f3e8e4SGabriel Somlo
3275f3e8e4SGabriel Somlo			/sys/firmware/qemu_fw_cfg/rev
3375f3e8e4SGabriel Somlo
3475f3e8e4SGabriel Somlo		--- Discoverable fw_cfg blobs by selector key ---
3575f3e8e4SGabriel Somlo
3675f3e8e4SGabriel Somlo		All discoverable blobs listed in the fw_cfg file directory are
3775f3e8e4SGabriel Somlo		displayed as entries named after their unique selector key
3875f3e8e4SGabriel Somlo		value, e.g.:
3975f3e8e4SGabriel Somlo
4075f3e8e4SGabriel Somlo			/sys/firmware/qemu_fw_cfg/by_key/32
4175f3e8e4SGabriel Somlo			/sys/firmware/qemu_fw_cfg/by_key/33
4275f3e8e4SGabriel Somlo			/sys/firmware/qemu_fw_cfg/by_key/34
4375f3e8e4SGabriel Somlo			...
4475f3e8e4SGabriel Somlo
4575f3e8e4SGabriel Somlo		Each such fw_cfg sysfs entry has the following values exported
4675f3e8e4SGabriel Somlo		as attributes:
4775f3e8e4SGabriel Somlo
4875f3e8e4SGabriel Somlo		name  	: The 56-byte nul-terminated ASCII string used as the
4975f3e8e4SGabriel Somlo			  blob's 'file name' in the fw_cfg directory.
5075f3e8e4SGabriel Somlo		size  	: The length of the blob, as given in the fw_cfg
5175f3e8e4SGabriel Somlo			  directory.
5275f3e8e4SGabriel Somlo		key	: The value of the blob's selector key as given in the
5375f3e8e4SGabriel Somlo			  fw_cfg directory. This value is the same as used in
5475f3e8e4SGabriel Somlo			  the parent directory name.
5575f3e8e4SGabriel Somlo		raw	: The raw bytes of the blob, obtained by selecting the
5675f3e8e4SGabriel Somlo			  entry via the control register, and reading a number
5775f3e8e4SGabriel Somlo			  of bytes equal to the blob size from the data
5875f3e8e4SGabriel Somlo			  register.
59