]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c
QemuFwCfgLib: Add QemuFwCfgWriteBytes() function
[mirror_edk2.git] / OvmfPkg / Library / QemuFwCfgLib / QemuFwCfgLib.c
index 8caab42e8b0a9c27c574aed09dbf63cafd07ad6b..7e5ea00bf96b061f6804d6e714a6b8efb4f5da4f 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-  Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2011 - 2013, Intel Corporation. All rights reserved.<BR>\r
 \r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
@@ -50,6 +50,32 @@ IoReadFifo8 (
   OUT     VOID                      *Buffer\r
   );\r
 \r
+/**\r
+  Writes an 8-bit I/O port fifo from a block of memory.\r
+\r
+  Writes the 8-bit I/O fifo port specified by Port.\r
+\r
+  The port is written Count times, and the data are obtained\r
+  from the provided Buffer.\r
+\r
+  This function must guarantee that all I/O read and write operations are\r
+  serialized.\r
+\r
+  If 8-bit I/O port operations are not supported, then ASSERT().\r
+\r
+  @param  Port    The I/O port to read.\r
+  @param  Count   The number of times to read I/O port.\r
+  @param  Buffer  The buffer to store the read data into.\r
+\r
+**/\r
+VOID\r
+EFIAPI\r
+IoWriteFifo8 (\r
+  IN      UINTN                     Port,\r
+  IN      UINTN                     Count,\r
+  OUT     VOID                      *Buffer\r
+  );\r
+\r
 \r
 /**\r
   Returns a boolean indicating if the firmware configuration interface\r
@@ -132,6 +158,29 @@ QemuFwCfgReadBytes (
   }\r
 }\r
 \r
+/**\r
+  Write 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
+  if (mQemuFwCfgSupported) {\r
+    IoWriteFifo8 (0x511, Size, Buffer);\r
+  }\r
+}\r
+\r
 \r
 /**\r
   Reads a UINT8 firmware configuration value\r