qemu_fw_cfg.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* SPDX-License-Identifier: BSD-3-Clause */
  2. #ifndef _LINUX_FW_CFG_H
  3. #define _LINUX_FW_CFG_H
  4. #include <linux/types.h>
  5. #define FW_CFG_ACPI_DEVICE_ID "QEMU0002"
  6. /* selector key values for "well-known" fw_cfg entries */
  7. #define FW_CFG_SIGNATURE 0x00
  8. #define FW_CFG_ID 0x01
  9. #define FW_CFG_UUID 0x02
  10. #define FW_CFG_RAM_SIZE 0x03
  11. #define FW_CFG_NOGRAPHIC 0x04
  12. #define FW_CFG_NB_CPUS 0x05
  13. #define FW_CFG_MACHINE_ID 0x06
  14. #define FW_CFG_KERNEL_ADDR 0x07
  15. #define FW_CFG_KERNEL_SIZE 0x08
  16. #define FW_CFG_KERNEL_CMDLINE 0x09
  17. #define FW_CFG_INITRD_ADDR 0x0a
  18. #define FW_CFG_INITRD_SIZE 0x0b
  19. #define FW_CFG_BOOT_DEVICE 0x0c
  20. #define FW_CFG_NUMA 0x0d
  21. #define FW_CFG_BOOT_MENU 0x0e
  22. #define FW_CFG_MAX_CPUS 0x0f
  23. #define FW_CFG_KERNEL_ENTRY 0x10
  24. #define FW_CFG_KERNEL_DATA 0x11
  25. #define FW_CFG_INITRD_DATA 0x12
  26. #define FW_CFG_CMDLINE_ADDR 0x13
  27. #define FW_CFG_CMDLINE_SIZE 0x14
  28. #define FW_CFG_CMDLINE_DATA 0x15
  29. #define FW_CFG_SETUP_ADDR 0x16
  30. #define FW_CFG_SETUP_SIZE 0x17
  31. #define FW_CFG_SETUP_DATA 0x18
  32. #define FW_CFG_FILE_DIR 0x19
  33. #define FW_CFG_FILE_FIRST 0x20
  34. #define FW_CFG_FILE_SLOTS_MIN 0x10
  35. #define FW_CFG_WRITE_CHANNEL 0x4000
  36. #define FW_CFG_ARCH_LOCAL 0x8000
  37. #define FW_CFG_ENTRY_MASK (~(FW_CFG_WRITE_CHANNEL | FW_CFG_ARCH_LOCAL))
  38. #define FW_CFG_INVALID 0xffff
  39. /* width in bytes of fw_cfg control register */
  40. #define FW_CFG_CTL_SIZE 0x02
  41. /* fw_cfg "file name" is up to 56 characters (including terminating nul) */
  42. #define FW_CFG_MAX_FILE_PATH 56
  43. /* size in bytes of fw_cfg signature */
  44. #define FW_CFG_SIG_SIZE 4
  45. /* FW_CFG_ID bits */
  46. #define FW_CFG_VERSION 0x01
  47. #define FW_CFG_VERSION_DMA 0x02
  48. /* fw_cfg file directory entry type */
  49. struct fw_cfg_file {
  50. __be32 size;
  51. __be16 select;
  52. __u16 reserved;
  53. char name[FW_CFG_MAX_FILE_PATH];
  54. };
  55. /* FW_CFG_DMA_CONTROL bits */
  56. #define FW_CFG_DMA_CTL_ERROR 0x01
  57. #define FW_CFG_DMA_CTL_READ 0x02
  58. #define FW_CFG_DMA_CTL_SKIP 0x04
  59. #define FW_CFG_DMA_CTL_SELECT 0x08
  60. #define FW_CFG_DMA_CTL_WRITE 0x10
  61. #define FW_CFG_DMA_SIGNATURE 0x51454d5520434647ULL /* "QEMU CFG" */
  62. /* Control as first field allows for different structures selected by this
  63. * field, which might be useful in the future
  64. */
  65. struct fw_cfg_dma_access {
  66. __be32 control;
  67. __be32 length;
  68. __be64 address;
  69. };
  70. #define FW_CFG_VMCOREINFO_FILENAME "etc/vmcoreinfo"
  71. #define FW_CFG_VMCOREINFO_FORMAT_NONE 0x0
  72. #define FW_CFG_VMCOREINFO_FORMAT_ELF 0x1
  73. struct fw_cfg_vmcoreinfo {
  74. __le16 host_format;
  75. __le16 guest_format;
  76. __le32 size;
  77. __le64 paddr;
  78. };
  79. #endif