]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/Include/Protocol/EmuBlockIo.h
MdeModulePkg-DxeCore: rename CoreGetMemoryMapPropertiesTable
[mirror_edk2.git] / EmulatorPkg / Include / Protocol / EmuBlockIo.h
CommitLineData
d59326d3 1/** @file\r
2 Emu Block IO2 protocol as defined in the UEFI 2.3.1 specification.\r
3\r
4 The Block IO2 protocol defines an extension to the Block IO protocol which\r
5 enables the ability to read and write data at a block level in a non-blocking\r
6 manner.\r
7\r
8 Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
d18d8a1d 9 This program and the accompanying materials\r
10 are licensed and made available under the terms and conditions of the BSD License\r
11 which accompanies this distribution. The full text of the license may be found at\r
12 http://opensource.org/licenses/bsd-license.php\r
d59326d3 13\r
d18d8a1d 14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
d59326d3 16\r
17**/\r
18\r
19#ifndef __EMU_BLOCK_IO_H__\r
20#define __EMU_BLOCK_IO_H__\r
21\r
22#include <Protocol/BlockIo.h>\r
23#include <Protocol/BlockIo2.h>\r
24\r
25#define EMU_BLOCK_IO_PROTOCOL_GUID \\r
033d0e5f 26{ 0x6888A4AE, 0xAFCE, 0xE84B, { 0x91, 0x02, 0xF7, 0xB9, 0xDA, 0xE6, 0xA0, 0x30 } }\r
d59326d3 27\r
28typedef struct _EMU_BLOCK_IO_PROTOCOL EMU_BLOCK_IO_PROTOCOL;\r
29\r
30\r
31\r
32/**\r
33 Reset the block device hardware.\r
34\r
35 @param[in] This Indicates a pointer to the calling context.\r
36 @param[in] ExtendedVerification Indicates that the driver may perform a more\r
37 exhausive verfication operation of the device\r
38 during reset.\r
39\r
40 @retval EFI_SUCCESS The device was reset.\r
41 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
42 not be reset.\r
43\r
44**/\r
45typedef\r
46EFI_STATUS\r
47(EFIAPI *EMU_BLOCK_RESET) (\r
48 IN EMU_BLOCK_IO_PROTOCOL *This,\r
49 IN BOOLEAN ExtendedVerification\r
50 );\r
51\r
52/**\r
53 Read BufferSize bytes from Lba into Buffer.\r
d18d8a1d 54\r
d59326d3 55 This function reads the requested number of blocks from the device. All the\r
56 blocks are read, or an error is returned.\r
57 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and\r
58 non-blocking I/O is being used, the Event associated with this request will\r
59 not be signaled.\r
60\r
61 @param[in] This Indicates a pointer to the calling context.\r
d18d8a1d 62 @param[in] MediaId Id of the media, changes every time the media is\r
d59326d3 63 replaced.\r
64 @param[in] Lba The starting Logical Block Address to read from.\r
65 @param[in, out] Token A pointer to the token associated with the transaction.\r
d18d8a1d 66 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
67 @param[out] Buffer A pointer to the destination buffer for the data. The\r
68 caller is responsible for either having implicit or\r
d59326d3 69 explicit ownership of the buffer.\r
70\r
71 @retval EFI_SUCCESS The read request was queued if Token->Event is\r
72 not NULL.The data was read correctly from the\r
73 device if the Token->Event is NULL.\r
74 @retval EFI_DEVICE_ERROR The device reported an error while performing\r
75 the read.\r
76 @retval EFI_NO_MEDIA There is no media in the device.\r
77 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
78 @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r
79 intrinsic block size of the device.\r
d18d8a1d 80 @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r
d59326d3 81 or the buffer is not on proper alignment.\r
82 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
83 of resources.\r
84**/\r
85typedef\r
86EFI_STATUS\r
87(EFIAPI *EMU_BLOCK_READ) (\r
88 IN EMU_BLOCK_IO_PROTOCOL *This,\r
89 IN UINT32 MediaId,\r
90 IN EFI_LBA LBA,\r
91 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
92 IN UINTN BufferSize,\r
033d0e5f 93 OUT VOID *Buffer\r
d59326d3 94 );\r
95\r
96/**\r
97 Write BufferSize bytes from Lba into Buffer.\r
98\r
99 This function writes the requested number of blocks to the device. All blocks\r
100 are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,\r
101 EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is\r
102 being used, the Event associated with this request will not be signaled.\r
103\r
104 @param[in] This Indicates a pointer to the calling context.\r
105 @param[in] MediaId The media ID that the write request is for.\r
106 @param[in] Lba The starting logical block address to be written. The\r
107 caller is responsible for writing to only legitimate\r
108 locations.\r
109 @param[in, out] Token A pointer to the token associated with the transaction.\r
110 @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r
111 @param[in] Buffer A pointer to the source buffer for the data.\r
112\r
113 @retval EFI_SUCCESS The write request was queued if Event is not NULL.\r
114 The data was written correctly to the device if\r
115 the Event is NULL.\r
116 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
117 @retval EFI_NO_MEDIA There is no media in the device.\r
118 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
119 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
120 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
d18d8a1d 121 @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r
d59326d3 122 or the buffer is not on proper alignment.\r
123 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
124 of resources.\r
125\r
126**/\r
127typedef\r
128EFI_STATUS\r
129(EFIAPI *EMU_BLOCK_WRITE) (\r
033d0e5f 130 IN EMU_BLOCK_IO_PROTOCOL *This,\r
d59326d3 131 IN UINT32 MediaId,\r
132 IN EFI_LBA LBA,\r
133 IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r
134 IN UINTN BufferSize,\r
135 IN VOID *Buffer\r
136 );\r
137\r
138/**\r
139 Flush the Block Device.\r
d18d8a1d 140\r
d59326d3 141 If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED\r
142 is returned and non-blocking I/O is being used, the Event associated with\r
d18d8a1d 143 this request will not be signaled.\r
d59326d3 144\r
145 @param[in] This Indicates a pointer to the calling context.\r
146 @param[in,out] Token A pointer to the token associated with the transaction\r
147\r
148 @retval EFI_SUCCESS The flush request was queued if Event is not NULL.\r
149 All outstanding data was written correctly to the\r
150 device if the Event is NULL.\r
151 @retval EFI_DEVICE_ERROR The device reported an error while writting back\r
152 the data.\r
153 @retval EFI_WRITE_PROTECTED The device cannot be written to.\r
154 @retval EFI_NO_MEDIA There is no media in the device.\r
155 @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r
156 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r
157 of resources.\r
158\r
159**/\r
160typedef\r
161EFI_STATUS\r
162(EFIAPI *EMU_BLOCK_FLUSH) (\r
163 IN EMU_BLOCK_IO_PROTOCOL *This,\r
164 IN OUT EFI_BLOCK_IO2_TOKEN *Token\r
165 );\r
166\r
167\r
168typedef\r
169EFI_STATUS\r
170(EFIAPI *EMU_BLOCK_CREATE_MAPPING) (\r
171 IN EMU_BLOCK_IO_PROTOCOL *This,\r
172 IN EFI_BLOCK_IO_MEDIA *Media\r
173 );\r
174\r
175\r
176///\r
177/// The Block I/O2 protocol defines an extension to the Block I/O protocol which\r
178/// enables the ability to read and write data at a block level in a non-blocking\r
179// manner.\r
180///\r
181struct _EMU_BLOCK_IO_PROTOCOL {\r
182 EMU_BLOCK_RESET Reset;\r
183 EMU_BLOCK_READ ReadBlocks;\r
184 EMU_BLOCK_WRITE WriteBlocks;\r
185 EMU_BLOCK_FLUSH FlushBlocks;\r
186 EMU_BLOCK_CREATE_MAPPING CreateMapping;\r
187};\r
188\r
189extern EFI_GUID gEmuBlockIoProtocolGuid;\r
190\r
191#endif\r
192\r