]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/XenPvBlkDxe/BlockIo.h
OvmfPkg/Csm/LegacyBiosDxe: Fix Legacy16GetTableAddress call for E820 data
[mirror_edk2.git] / OvmfPkg / XenPvBlkDxe / BlockIo.h
1 /** @file
2 BlockIo function declaration for Xen PV block driver.
3
4 Copyright (C) 2014, Citrix Ltd.
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 /**
11 Read BufferSize bytes from Lba into Buffer.
12
13 @param This Indicates a pointer to the calling context.
14 @param MediaId Id of the media, changes every time the media is replaced.
15 @param Lba The starting Logical Block Address to read from
16 @param BufferSize Size of Buffer, must be a multiple of device block size.
17 @param Buffer A pointer to the destination buffer for the data. The caller is
18 responsible for either having implicit or explicit ownership of the buffer.
19
20 @retval EFI_SUCCESS The data was read correctly from the device.
21 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
22 @retval EFI_NO_MEDIA There is no media in the device.
23 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
24 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
25 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
26 or the buffer is not on proper alignment.
27
28 **/
29 EFI_STATUS
30 EFIAPI
31 XenPvBlkDxeBlockIoReadBlocks (
32 IN EFI_BLOCK_IO_PROTOCOL *This,
33 IN UINT32 MediaId,
34 IN EFI_LBA Lba,
35 IN UINTN BufferSize,
36 OUT VOID *Buffer
37 );
38
39 /**
40 Write BufferSize bytes from Lba into Buffer.
41
42 @param This Indicates a pointer to the calling context.
43 @param MediaId The media ID that the write request is for.
44 @param Lba The starting logical block address to be written. The caller is
45 responsible for writing to only legitimate locations.
46 @param BufferSize Size of Buffer, must be a multiple of device block size.
47 @param Buffer A pointer to the source buffer for the data.
48
49 @retval EFI_SUCCESS The data was written correctly to the device.
50 @retval EFI_WRITE_PROTECTED The device can not be written to.
51 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
52 @retval EFI_NO_MEDIA There is no media in the device.
53 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
54 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
55 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
56 or the buffer is not on proper alignment.
57
58 **/
59 EFI_STATUS
60 EFIAPI
61 XenPvBlkDxeBlockIoWriteBlocks (
62 IN EFI_BLOCK_IO_PROTOCOL *This,
63 IN UINT32 MediaId,
64 IN EFI_LBA Lba,
65 IN UINTN BufferSize,
66 IN VOID *Buffer
67 );
68
69 /**
70 Flush the Block Device.
71
72 @param This Indicates a pointer to the calling context.
73
74 @retval EFI_SUCCESS All outstanding data was written to the device
75 @retval EFI_DEVICE_ERROR The device reported an error while writting back the data
76 @retval EFI_NO_MEDIA There is no media in the device.
77
78 **/
79 EFI_STATUS
80 EFIAPI
81 XenPvBlkDxeBlockIoFlushBlocks (
82 IN EFI_BLOCK_IO_PROTOCOL *This
83 );
84
85 /**
86 Reset the block device hardware.
87
88 @param[in] This Indicates a pointer to the calling context.
89 @param[in] ExtendedVerification Not used.
90
91 @retval EFI_SUCCESS The device was reset.
92
93 **/
94 EFI_STATUS
95 EFIAPI
96 XenPvBlkDxeBlockIoReset (
97 IN EFI_BLOCK_IO_PROTOCOL *This,
98 IN BOOLEAN ExtendedVerification
99 );
100
101 extern EFI_BLOCK_IO_MEDIA gXenPvBlkDxeBlockIoMedia;
102 extern EFI_BLOCK_IO_PROTOCOL gXenPvBlkDxeBlockIo;