summaryrefslogtreecommitdiffstats
path: root/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h
diff options
context:
space:
mode:
authorLaszlo Ersek <lersek@redhat.com>2020-12-16 22:10:40 +0100
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-12-21 17:16:23 +0000
commitb55d6622d4f4d795d71e930da1fcda7c78a7fe96 (patch)
tree51c7fd519a83ae90aa4ec61cbd6d56ecce0e2eec /OvmfPkg/VirtioFsDxe/VirtioFsDxe.h
parentfbc3e1267a430a20e8909ae8a6dfe1b98de9b7bc (diff)
downloadedk2-b55d6622d4f4d795d71e930da1fcda7c78a7fe96.tar.gz
edk2-b55d6622d4f4d795d71e930da1fcda7c78a7fe96.tar.bz2
edk2-b55d6622d4f4d795d71e930da1fcda7c78a7fe96.zip
OvmfPkg/VirtioFsDxe: DriverBinding: open VirtioDevice, install SimpleFs
Complete the Supported, Start, and Stop member functions of EFI_DRIVER_BINDING_PROTOCOL sufficiently for exercising the UEFI driver model: - bind virtio-fs devices, - produce placeholder EFI_SIMPLE_FILE_SYSTEM_PROTOCOL instances on them. On the "TO_START" (= Virtio) side, the VirtioFsBindingSupported() function verifies the Virtio subsystem ID for the virtio-fs device (decimal 26 -- see <https://github.com/oasis-tcs/virtio-spec/blob/87fa6b5d8155/virtio-fs.tex>). Beyond that, no actual Virtio setup is performed for now. Those bits are going to be implemented later in this series. On the "BY_START" (= UEFI filesystem) side, the VirtioFsOpenVolume() function -- which is the sole EFI_SIMPLE_FILE_SYSTEM_PROTOCOL member function -- is a stub; it always returns EFI_NO_MEDIA, for now. The "CONNECT", "DISCONNECT", and "MAP -R" UEFI Shell commands can be used to test this patch. Cc: Ard Biesheuvel <ard.biesheuvel@arm.com> Cc: Jordan Justen <jordan.l.justen@intel.com> Cc: Philippe Mathieu-Daudé <philmd@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3097 Signed-off-by: Laszlo Ersek <lersek@redhat.com> Message-Id: <20201216211125.19496-4-lersek@redhat.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Diffstat (limited to 'OvmfPkg/VirtioFsDxe/VirtioFsDxe.h')
-rw-r--r--OvmfPkg/VirtioFsDxe/VirtioFsDxe.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h b/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h
new file mode 100644
index 0000000000..287defd21f
--- /dev/null
+++ b/OvmfPkg/VirtioFsDxe/VirtioFsDxe.h
@@ -0,0 +1,52 @@
+/** @file
+ Internal macro definitions, type definitions, and function declarations for
+ the Virtio Filesystem device driver.
+
+ Copyright (C) 2020, Red Hat, Inc.
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+**/
+
+#ifndef VIRTIO_FS_DXE_H_
+#define VIRTIO_FS_DXE_H_
+
+#include <Base.h> // SIGNATURE_64()
+#include <Library/DebugLib.h> // CR()
+#include <Protocol/SimpleFileSystem.h> // EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
+#include <Protocol/VirtioDevice.h> // VIRTIO_DEVICE_PROTOCOL
+
+#define VIRTIO_FS_SIG SIGNATURE_64 ('V', 'I', 'R', 'T', 'I', 'O', 'F', 'S')
+
+//
+// Main context structure, expressing an EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
+// interface on top of the Virtio Filesystem device.
+//
+typedef struct {
+ //
+ // Parts of this structure are initialized / torn down in various functions
+ // at various call depths. The table to the right should make it easier to
+ // track them.
+ //
+ // field init function init depth
+ // ----------- ------------------ ----------
+ UINT64 Signature; // DriverBindingStart 0
+ VIRTIO_DEVICE_PROTOCOL *Virtio; // DriverBindingStart 0
+ EFI_SIMPLE_FILE_SYSTEM_PROTOCOL SimpleFs; // DriverBindingStart 0
+} VIRTIO_FS;
+
+#define VIRTIO_FS_FROM_SIMPLE_FS(SimpleFsReference) \
+ CR (SimpleFsReference, VIRTIO_FS, SimpleFs, VIRTIO_FS_SIG);
+
+//
+// EFI_SIMPLE_FILE_SYSTEM_PROTOCOL member functions for the Virtio Filesystem
+// driver.
+//
+
+EFI_STATUS
+EFIAPI
+VirtioFsOpenVolume (
+ IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
+ OUT EFI_FILE_PROTOCOL **Root
+ );
+
+#endif // VIRTIO_FS_DXE_H_