]> git.proxmox.com Git - mirror_edk2.git/commit
ArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if available
authorLaszlo Ersek <lersek@redhat.com>
Fri, 27 Jan 2017 06:29:12 +0000 (07:29 +0100)
committerLaszlo Ersek <lersek@redhat.com>
Mon, 30 Jan 2017 23:14:39 +0000 (00:14 +0100)
commite8ae381f608ae02662f4dcc7379898162645d2ca
treed1221e27c63e9aef8dafaecae1e76dd92d3bb59a
parent4175356fb4bfe89415677aed8fb4e6928ced2ff1
ArmVirtPkg/QemuFwCfgLib: use DMA for QemuFwCfgWriteBytes() if available

We use the "InternalQemuFwCfgReadBytes" static function pointer to
dispatch the reading of fw_cfg bytes between MMIO and DMA. This pointer is
initialized to MMIO, and we set it to DMA in the library constructor if
DMA is available.

Unlike the above, we write fw_cfg bytes only with MMIO at the moment.
Extend the write functionality so that it follows the read pattern:
- introduce the new function typedef WRITE_BYTES_FUNCTION,
- extract the current (MMIO-only) write internals from
  QemuFwCfgWriteBytes() to MmioWriteBytes(),
- provide a DMA-based implementation in DmaWriteBytes() -- a thin wrapper
  around DmaTransferBytes(),
- set the new static function pointer "InternalQemuFwCfgWriteBytes"
  according to the DMA feature provided by QEMU,
- In QemuFwCfgWriteBytes(), call the best available method through
  "InternalQemuFwCfgWriteBytes".

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=359
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
ArmVirtPkg/Library/QemuFwCfgLib/QemuFwCfgLib.c