1*75f3e8e4SGabriel SomloWhat: /sys/firmware/qemu_fw_cfg/ 2*75f3e8e4SGabriel SomloDate: August 2015 3*75f3e8e4SGabriel SomloContact: Gabriel Somlo <somlo@cmu.edu> 4*75f3e8e4SGabriel SomloDescription: 5*75f3e8e4SGabriel Somlo Several different architectures supported by QEMU (x86, arm, 6*75f3e8e4SGabriel Somlo sun4*, ppc/mac) are provisioned with a firmware configuration 7*75f3e8e4SGabriel Somlo (fw_cfg) device, originally intended as a way for the host to 8*75f3e8e4SGabriel Somlo provide configuration data to the guest firmware. Starting 9*75f3e8e4SGabriel Somlo with QEMU v2.4, arbitrary fw_cfg file entries may be specified 10*75f3e8e4SGabriel Somlo by the user on the command line, which makes fw_cfg additionally 11*75f3e8e4SGabriel Somlo useful as an out-of-band, asynchronous mechanism for providing 12*75f3e8e4SGabriel Somlo configuration data to the guest userspace. 13*75f3e8e4SGabriel Somlo 14*75f3e8e4SGabriel Somlo The authoritative guest-side hardware interface documentation 15*75f3e8e4SGabriel Somlo to the fw_cfg device can be found in "docs/specs/fw_cfg.txt" 16*75f3e8e4SGabriel Somlo in the QEMU source tree. 17*75f3e8e4SGabriel Somlo 18*75f3e8e4SGabriel Somlo === SysFS fw_cfg Interface === 19*75f3e8e4SGabriel Somlo 20*75f3e8e4SGabriel Somlo The fw_cfg sysfs interface described in this document is only 21*75f3e8e4SGabriel Somlo intended to display discoverable blobs (i.e., those registered 22*75f3e8e4SGabriel Somlo with the file directory), as there is no way to determine the 23*75f3e8e4SGabriel Somlo presence or size of "legacy" blobs (with selector keys between 24*75f3e8e4SGabriel Somlo 0x0002 and 0x0018) programmatically. 25*75f3e8e4SGabriel Somlo 26*75f3e8e4SGabriel Somlo All fw_cfg information is shown under: 27*75f3e8e4SGabriel Somlo 28*75f3e8e4SGabriel Somlo /sys/firmware/qemu_fw_cfg/ 29*75f3e8e4SGabriel Somlo 30*75f3e8e4SGabriel Somlo The only legacy blob displayed is the fw_cfg device revision: 31*75f3e8e4SGabriel Somlo 32*75f3e8e4SGabriel Somlo /sys/firmware/qemu_fw_cfg/rev 33*75f3e8e4SGabriel Somlo 34*75f3e8e4SGabriel Somlo --- Discoverable fw_cfg blobs by selector key --- 35*75f3e8e4SGabriel Somlo 36*75f3e8e4SGabriel Somlo All discoverable blobs listed in the fw_cfg file directory are 37*75f3e8e4SGabriel Somlo displayed as entries named after their unique selector key 38*75f3e8e4SGabriel Somlo value, e.g.: 39*75f3e8e4SGabriel Somlo 40*75f3e8e4SGabriel Somlo /sys/firmware/qemu_fw_cfg/by_key/32 41*75f3e8e4SGabriel Somlo /sys/firmware/qemu_fw_cfg/by_key/33 42*75f3e8e4SGabriel Somlo /sys/firmware/qemu_fw_cfg/by_key/34 43*75f3e8e4SGabriel Somlo ... 44*75f3e8e4SGabriel Somlo 45*75f3e8e4SGabriel Somlo Each such fw_cfg sysfs entry has the following values exported 46*75f3e8e4SGabriel Somlo as attributes: 47*75f3e8e4SGabriel Somlo 48*75f3e8e4SGabriel Somlo name : The 56-byte nul-terminated ASCII string used as the 49*75f3e8e4SGabriel Somlo blob's 'file name' in the fw_cfg directory. 50*75f3e8e4SGabriel Somlo size : The length of the blob, as given in the fw_cfg 51*75f3e8e4SGabriel Somlo directory. 52*75f3e8e4SGabriel Somlo key : The value of the blob's selector key as given in the 53*75f3e8e4SGabriel Somlo fw_cfg directory. This value is the same as used in 54*75f3e8e4SGabriel Somlo the parent directory name. 55*75f3e8e4SGabriel Somlo raw : The raw bytes of the blob, obtained by selecting the 56*75f3e8e4SGabriel Somlo entry via the control register, and reading a number 57*75f3e8e4SGabriel Somlo of bytes equal to the blob size from the data 58*75f3e8e4SGabriel Somlo register. 59