blob: a05f27c813812031736aba600996027926cf0669 [file] [log] [blame]
Vishal Bhoj82c80712015-12-15 21:13:33 +05301/** @file
2 BlockIo function declaration for Xen PV block driver.
3
4 Copyright (C) 2014, Citrix Ltd.
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14**/
15
16/**
17 Read BufferSize bytes from Lba into Buffer.
18
19 @param This Indicates a pointer to the calling context.
20 @param MediaId Id of the media, changes every time the media is replaced.
21 @param Lba The starting Logical Block Address to read from
22 @param BufferSize Size of Buffer, must be a multiple of device block size.
23 @param Buffer A pointer to the destination buffer for the data. The caller is
24 responsible for either having implicit or explicit ownership of the buffer.
25
26 @retval EFI_SUCCESS The data was read correctly from the device.
27 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.
28 @retval EFI_NO_MEDIA There is no media in the device.
29 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.
30 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
31 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
32 or the buffer is not on proper alignment.
33
34**/
35EFI_STATUS
36EFIAPI
37XenPvBlkDxeBlockIoReadBlocks (
38 IN EFI_BLOCK_IO_PROTOCOL *This,
39 IN UINT32 MediaId,
40 IN EFI_LBA Lba,
41 IN UINTN BufferSize,
42 OUT VOID *Buffer
43 );
44
45/**
46 Write BufferSize bytes from Lba into Buffer.
47
48 @param This Indicates a pointer to the calling context.
49 @param MediaId The media ID that the write request is for.
50 @param Lba The starting logical block address to be written. The caller is
51 responsible for writing to only legitimate locations.
52 @param BufferSize Size of Buffer, must be a multiple of device block size.
53 @param Buffer A pointer to the source buffer for the data.
54
55 @retval EFI_SUCCESS The data was written correctly to the device.
56 @retval EFI_WRITE_PROTECTED The device can not be written to.
57 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.
58 @retval EFI_NO_MEDIA There is no media in the device.
59 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
60 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
61 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
62 or the buffer is not on proper alignment.
63
64**/
65EFI_STATUS
66EFIAPI
67XenPvBlkDxeBlockIoWriteBlocks (
68 IN EFI_BLOCK_IO_PROTOCOL *This,
69 IN UINT32 MediaId,
70 IN EFI_LBA Lba,
71 IN UINTN BufferSize,
72 IN VOID *Buffer
73 );
74
75/**
76 Flush the Block Device.
77
78 @param This Indicates a pointer to the calling context.
79
80 @retval EFI_SUCCESS All outstanding data was written to the device
81 @retval EFI_DEVICE_ERROR The device reported an error while writting back the data
82 @retval EFI_NO_MEDIA There is no media in the device.
83
84**/
85EFI_STATUS
86EFIAPI
87XenPvBlkDxeBlockIoFlushBlocks (
88 IN EFI_BLOCK_IO_PROTOCOL *This
89 );
90
91/**
92 Reset the block device hardware.
93
94 @param[in] This Indicates a pointer to the calling context.
95 @param[in] ExtendedVerification Not used.
96
97 @retval EFI_SUCCESS The device was reset.
98
99**/
100EFI_STATUS
101EFIAPI
102XenPvBlkDxeBlockIoReset (
103 IN EFI_BLOCK_IO_PROTOCOL *This,
104 IN BOOLEAN ExtendedVerification
105 );
106
107extern EFI_BLOCK_IO_MEDIA gXenPvBlkDxeBlockIoMedia;
108extern EFI_BLOCK_IO_PROTOCOL gXenPvBlkDxeBlockIo;