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