]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c
OvmfPkg: Add QemuFwCfgLibNull
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgLib / QemuFwCfgNull.c
diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c
new file mode 100644 (file)
index 0000000..edd97db
--- /dev/null
@@ -0,0 +1,209 @@
+/** @file\r
+\r
+  Null implementation of the fw_cfg library.\r
+\r
+  Copyright (C) 2020, Rebecca Cran <rebecca@bsdio.com>\r
+  Copyright (C) 2013, Red Hat, Inc.\r
+  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2017, Advanced Micro Devices. All rights reserved.<BR>\r
+\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+**/\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/QemuFwCfgLib.h>\r
+\r
+/**\r
+  Returns a boolean indicating if the firmware configuration interface\r
+  is available or not.\r
+\r
+  This function may change fw_cfg state.\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
+  return FALSE;\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
+  ASSERT (FALSE);\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
+  ASSERT (FALSE);\r
+}\r
+\r
+\r
+/**\r
+  Writes firmware configuration bytes from a buffer\r
+\r
+  If called multiple times, then the data written will\r
+  continue at the offset of the firmware configuration\r
+  item where the previous write ended.\r
+\r
+  @param[in] Size - Size in bytes to write\r
+  @param[in] Buffer - Buffer to read data from\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+QemuFwCfgWriteBytes (\r
+  IN UINTN                  Size,\r
+  IN VOID                   *Buffer\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+}\r
+\r
+\r
+/**\r
+  Skip bytes in the firmware configuration item.\r
+\r
+  Increase the offset of the firmware configuration item without transferring\r
+  bytes between the item and a caller-provided buffer. Subsequent read, write\r
+  or skip operations will commence at the increased offset.\r
+\r
+  @param[in] Size  Number of bytes to skip.\r
+**/\r
+VOID\r
+EFIAPI\r
+QemuFwCfgSkipBytes (\r
+  IN UINTN                  Size\r
+  )\r
+{\r
+  ASSERT (FALSE);\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
+  ASSERT (FALSE);\r
+  return 0;\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
+  ASSERT (FALSE);\r
+  return 0;\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
+  ASSERT (FALSE);\r
+  return 0;\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
+  ASSERT (FALSE);\r
+  return 0;\r
+}\r
+\r
+\r
+/**\r
+  Find the configuration item corresponding to the firmware configuration file.\r
+\r
+  @param[in]  Name - Name of file to look up.\r
+  @param[out] Item - Configuration item corresponding to the file, to be passed\r
+                     to QemuFwCfgSelectItem ().\r
+  @param[out] Size - Number of bytes in the file.\r
+\r
+  @return    RETURN_SUCCESS       If file is found.\r
+             RETURN_NOT_FOUND     If file is not found.\r
+             RETURN_UNSUPPORTED   If firmware configuration is unavailable.\r
+\r
+**/\r
+RETURN_STATUS\r
+EFIAPI\r
+QemuFwCfgFindFile (\r
+  IN   CONST CHAR8           *Name,\r
+  OUT  FIRMWARE_CONFIG_ITEM  *Item,\r
+  OUT  UINTN                 *Size\r
+  )\r
+{\r
+  return RETURN_UNSUPPORTED;\r
+}\r
+\r