]> git.proxmox.com Git - mirror_edk2.git/commitdiff
OvmfPkg: Add QemuFwCfgLibNull
authorRebecca Cran <rebecca@bsdio.com>
Sun, 3 May 2020 23:09:10 +0000 (17:09 -0600)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 5 May 2020 16:57:57 +0000 (16:57 +0000)
Add a null implementation library for QemuFwCfgLib, in order to
support building PciHostBridgeLib for bhyve.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20200503230910.26783-1-rebecca@bsdio.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf [new file with mode: 0644]
OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgNull.c [new file with mode: 0644]

diff --git a/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf b/OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLibNull.inf
new file mode 100644 (file)
index 0000000..e5715a6
--- /dev/null
@@ -0,0 +1,30 @@
+## @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) 2008 - 2012, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2017, AMD Incorporated. All rights reserved.<BR>\r
+#\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
+#\r
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = QemuFwCfgLibNull\r
+  FILE_GUID                      = B9D1A1F2-01E2-4732-982D-C7F9ED51AC6B\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = QemuFwCfgLib\r
+\r
+[Sources]\r
+  QemuFwCfgNull.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+  OvmfPkg/OvmfPkg.dec\r
+\r
+[LibraryClasses]\r
+  DebugLib\r
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