]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Include/Library/QemuFwCfgLib.h
OvmfPkg: Add QemuFwCfgLib library class and implementation
[mirror_edk2.git] / OvmfPkg / Include / Library / QemuFwCfgLib.h
diff --git a/OvmfPkg/Include/Library/QemuFwCfgLib.h b/OvmfPkg/Include/Library/QemuFwCfgLib.h
new file mode 100644 (file)
index 0000000..5a3db7e
--- /dev/null
@@ -0,0 +1,157 @@
+/** @file\r
+  QEMU/KVM Firmware Configuration access\r
+\r
+  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef __FW_CFG_LIB__\r
+#define __FW_CFG_LIB__\r
+\r
+typedef enum {\r
+  QemuFwCfgItemSignature            = 0x0000,\r
+  QemuFwCfgItemInterfaceVersion     = 0x0001,\r
+  QemuFwCfgItemSystemUuid           = 0x0002,\r
+  QemuFwCfgItemRamSize              = 0x0003,\r
+  QemuFwCfgItemGraphicsEnabled      = 0x0004,\r
+  QemuFwCfgItemSmpCpuCount          = 0x0005,\r
+  QemuFwCfgItemMachineId            = 0x0006,\r
+  QemuFwCfgItemKernelAddress        = 0x0007,\r
+  QemuFwCfgItemKernelSize           = 0x0008,\r
+  QemuFwCfgItemKernelCommandLine    = 0x0009,\r
+  QemuFwCfgItemInitrdAddress        = 0x000a,\r
+  QemuFwCfgItemInitrdSize           = 0x000b,\r
+  QemuFwCfgItemBootDevice           = 0x000c,\r
+  QemuFwCfgItemNumaData             = 0x000d,\r
+  QemuFwCfgItemBootMenu             = 0x000e,\r
+  QemuFwCfgItemMaximumCpuCount      = 0x000f,\r
+  QemuFwCfgItemKernelEntry          = 0x0010,\r
+  QemuFwCfgItemKernelData           = 0x0011,\r
+  QemuFwCfgItemInitrdData           = 0x0012,\r
+  QemuFwCfgItemCommandLineAddress   = 0x0013,\r
+  QemuFwCfgItemCommandLineSize      = 0x0014,\r
+  QemuFwCfgItemCommandLineData      = 0x0015,\r
+  QemuFwCfgItemKernelSetupAddress   = 0x0016,\r
+  QemuFwCfgItemKernelSetupSize      = 0x0017,\r
+  QemuFwCfgItemKernelSetupData      = 0x0018,\r
+\r
+  QemuFwCfgItemX86AcpiTables        = 0x8000,\r
+  QemuFwCfgItemX86SmbiosTables      = 0x8001,\r
+  QemuFwCfgItemX86Irq0Override      = 0x8002,\r
+  QemuFwCfgItemX86E820Table         = 0x8003,\r
+  QemuFwCfgItemX86HpetData          = 0x8004,\r
+\r
+} FIRMWARE_CONFIG_ITEM;\r
+\r
+\r
+/**\r
+  Returns a boolean indicating if the firmware configuration interface\r
+  is available or not.\r
+\r
+  @retval    TRUE   The interface is available\r
+  @retval    FALSE  The interface is not available\r
+\r
+**/\r
+BOOLEAN\r
+EFIAPI\r
+QemuFwCfgIsAvailable (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Selects a firmware configuration item for reading.\r
+\r
+  Following this call, any data read from this item will start from\r
+  the beginning of the configuration item's data.\r
+\r
+  @param[in] QemuFwCfgItem - Firmware Configuration item to read\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+QemuFwCfgSelectItem (\r
+  IN FIRMWARE_CONFIG_ITEM   QemuFwCfgItem\r
+  );\r
+\r
+\r
+/**\r
+  Reads firmware configuration bytes into a buffer\r
+\r
+  If called multiple times, then the data read will\r
+  continue at the offset of the firmware configuration\r
+  item where the previous read ended.\r
+\r
+  @param[in] Size - Size in bytes to read\r
+  @param[in] Buffer - Buffer to store data into\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+QemuFwCfgReadBytes (\r
+  IN UINTN                  Size,\r
+  IN VOID                   *Buffer  OPTIONAL\r
+  );\r
+\r
+\r
+/**\r
+  Reads a UINT8 firmware configuration value\r
+\r
+  @return    Value of Firmware Configuration item read\r
+\r
+**/\r
+UINT8\r
+EFIAPI\r
+QemuFwCfgRead8 (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Reads a UINT16 firmware configuration value\r
+\r
+  @return    Value of Firmware Configuration item read\r
+\r
+**/\r
+UINT16\r
+EFIAPI\r
+QemuFwCfgRead16 (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Reads a UINT32 firmware configuration value\r
+\r
+  @return    Value of Firmware Configuration item read\r
+\r
+**/\r
+UINT32\r
+EFIAPI\r
+QemuFwCfgRead32 (\r
+  VOID\r
+  );\r
+\r
+\r
+/**\r
+  Reads a UINT64 firmware configuration value\r
+\r
+  @return    Value of Firmware Configuration item read\r
+\r
+**/\r
+UINT64\r
+EFIAPI\r
+QemuFwCfgRead64 (\r
+  VOID\r
+  );\r
+\r
+\r
+#endif\r
+\r