TianoCore EDK2 master
Loading...
Searching...
No Matches
VirtioBlk.h
Go to the documentation of this file.
1
12#ifndef _VIRTIO_BLK_DXE_H_
13#define _VIRTIO_BLK_DXE_H_
14
15#include <Protocol/BlockIo.h>
18
20
21#define VBLK_SIG SIGNATURE_32 ('V', 'B', 'L', 'K')
22
23typedef struct {
24 //
25 // Parts of this structure are initialized / torn down in various functions
26 // at various call depths. The table to the right should make it easier to
27 // track them.
28 //
29 // field init function init dpth
30 // --------------------- ------------------ ---------
31 UINT32 Signature; // DriverBindingStart 0
32 VIRTIO_DEVICE_PROTOCOL *VirtIo; // DriverBindingStart 0
33 EFI_EVENT ExitBoot; // DriverBindingStart 0
34 VRING Ring; // VirtioRingInit 2
35 EFI_BLOCK_IO_PROTOCOL BlockIo; // VirtioBlkInit 1
36 EFI_BLOCK_IO_MEDIA BlockIoMedia; // VirtioBlkInit 1
37 VOID *RingMap; // VirtioRingMap 2
38} VBLK_DEV;
39
40#define VIRTIO_BLK_FROM_BLOCK_IO(BlockIoPointer) \
41 CR (BlockIoPointer, VBLK_DEV, BlockIo, VBLK_SIG)
42
80EFIAPI
83 IN EFI_HANDLE DeviceHandle,
84 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
85 );
86
117EFIAPI
120 IN EFI_HANDLE DeviceHandle,
121 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
122 );
123
148EFIAPI
151 IN EFI_HANDLE DeviceHandle,
152 IN UINTN NumberOfChildren,
153 IN EFI_HANDLE *ChildHandleBuffer
154 );
155
156//
157// UEFI Spec 2.3.1 + Errata C, 12.8 EFI Block I/O Protocol
158// Driver Writer's Guide for UEFI 2.3.1 v1.01,
159// 24.2 Block I/O Protocol Implementations
160//
162EFIAPI
163VirtioBlkReset (
165 IN BOOLEAN ExtendedVerification
166 );
167
187EFIAPI
190 IN UINT32 MediaId,
191 IN EFI_LBA Lba,
192 IN UINTN BufferSize,
193 OUT VOID *Buffer
194 );
195
215EFIAPI
218 IN UINT32 MediaId,
219 IN EFI_LBA Lba,
220 IN UINTN BufferSize,
221 IN VOID *Buffer
222 );
223
242EFIAPI
245 );
246
247//
248// The purpose of the following scaffolding (EFI_COMPONENT_NAME_PROTOCOL and
249// EFI_COMPONENT_NAME2_PROTOCOL implementation) is to format the driver's name
250// in English, for display on standard console devices. This is recommended for
251// UEFI drivers that follow the UEFI Driver Model. Refer to the Driver Writer's
252// Guide for UEFI 2.3.1 v1.01, 11 UEFI Driver and Controller Names.
253//
254// Device type names ("Virtio Block Device") are not formatted because the
255// driver supports only that device type. Therefore the driver name suffices
256// for unambiguous identification.
257//
258
260EFIAPI
261VirtioBlkGetDriverName (
263 IN CHAR8 *Language,
264 OUT CHAR16 **DriverName
265 );
266
268EFIAPI
269VirtioBlkGetDeviceName (
271 IN EFI_HANDLE DeviceHandle,
272 IN EFI_HANDLE ChildHandle,
273 IN CHAR8 *Language,
274 OUT CHAR16 **ControllerName
275 );
276
277#endif // _VIRTIO_BLK_DXE_H_
UINT64 UINTN
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
UINT64 EFI_LBA
Definition: UefiBaseType.h:45
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
EFI_STATUS EFIAPI VirtioBlkDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
Definition: VirtioBlk.c:1197
EFI_STATUS EFIAPI VirtioBlkReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
Definition: VirtioBlk.c:489
EFI_STATUS EFIAPI VirtioBlkWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
Definition: VirtioBlk.c:543
EFI_STATUS EFIAPI VirtioBlkFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
Definition: VirtioBlk.c:596
EFI_STATUS EFIAPI VirtioBlkDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: VirtioBlk.c:652
EFI_STATUS EFIAPI VirtioBlkDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE DeviceHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
Definition: VirtioBlk.c:1092