]> git.proxmox.com Git - mirror_edk2.git/blame - Tools/Source/TianoTools/Include/Protocol/BlockIo.h
1. Removed the unnecessary #include statements and include files
[mirror_edk2.git] / Tools / Source / TianoTools / Include / Protocol / BlockIo.h
CommitLineData
21b50a27 1/** @file\r
2 Block IO protocol as defined in the EFI 1.0 specification.\r
3\r
4 The Block IO protocol is used to abstract block devices like hard drives,\r
5 DVD-ROMs and floppy drives.\r
6\r
7 Copyright (c) 2006, Intel Corporation \r
8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
15\r
16 Module Name: BlockIo.h\r
17\r
18**/\r
19\r
20#ifndef __BLOCK_IO_H__\r
21#define __BLOCK_IO_H__\r
22\r
23#define EFI_BLOCK_IO_PROTOCOL_GUID \\r
24 { \\r
25 0x964e5b21, 0x6459, 0x11d2, {0x8e, 0x39, 0x0, 0xa0, 0xc9, 0x69, 0x72, 0x3b } \\r
26 }\r
27\r
28//\r
29// Forward reference for pure ANSI compatability\r
30//\r
31typedef struct _EFI_BLOCK_IO_PROTOCOL EFI_BLOCK_IO_PROTOCOL;\r
32\r
33/**\r
34 Reset the Block Device.\r
35\r
36 @param This Protocol instance pointer.\r
37 @param ExtendedVerification Driver may perform diagnostics on reset.\r
38\r
39 @retval EFI_SUCCESS The device was reset.\r
40 @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r
41 not be reset.\r
42\r
43**/\r
44typedef\r
45EFI_STATUS\r
46(EFIAPI *EFI_BLOCK_RESET) (\r
47 IN EFI_BLOCK_IO_PROTOCOL *This,\r
48 IN BOOLEAN ExtendedVerification\r
49 )\r
50;\r
51\r
52/**\r
53 Read BufferSize bytes from Lba into Buffer.\r
54\r
55 @param This Protocol instance pointer.\r
56 @param MediaId Id of the media, changes every time the media is replaced.\r
57 @param Lba The starting Logical Block Address to read from\r
58 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
59 @param Buffer Buffer containing read data\r
60\r
61 @retval EFI_SUCCESS The data was read correctly from the device.\r
62 @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r
63 @retval EFI_NO_MEDIA There is no media in the device.\r
64 @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r
65 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
66 @retval EFI_INVALID_PARAMETER The read request contains device addresses that are not\r
67 valid for the device.\r
68\r
69**/\r
70typedef\r
71EFI_STATUS\r
72(EFIAPI *EFI_BLOCK_READ) (\r
73 IN EFI_BLOCK_IO_PROTOCOL *This,\r
74 IN UINT32 MediaId,\r
75 IN EFI_LBA Lba,\r
76 IN UINTN BufferSize,\r
77 OUT VOID *Buffer\r
78 )\r
79;\r
80\r
81/**\r
82 Write BufferSize bytes from Lba into Buffer.\r
83\r
84 @param This Protocol instance pointer.\r
85 @param MediaId Id of the media, changes every time the media is replaced.\r
86 @param Lba The starting Logical Block Address to read from\r
87 @param BufferSize Size of Buffer, must be a multiple of device block size.\r
88 @param Buffer Buffer containing read data\r
89\r
90 @retval EFI_SUCCESS The data was written correctly to the device.\r
91 @retval EFI_WRITE_PROTECTED The device can not be written to.\r
92 @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r
93 @retval EFI_NO_MEDIA There is no media in the device.\r
94 @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r
95 @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r
96 @retval EFI_INVALID_PARAMETER The write request contains a LBA that is not\r
97 valid for the device.\r
98\r
99**/\r
100typedef\r
101EFI_STATUS\r
102(EFIAPI *EFI_BLOCK_WRITE) (\r
103 IN EFI_BLOCK_IO_PROTOCOL *This,\r
104 IN UINT32 MediaId,\r
105 IN EFI_LBA Lba,\r
106 IN UINTN BufferSize,\r
107 IN VOID *Buffer\r
108 )\r
109;\r
110\r
111/**\r
112 Flush the Block Device.\r
113\r
114 @param This Protocol instance pointer.\r
115\r
116 @retval EFI_SUCCESS All outstanding data was written to the device\r
117 @retval EFI_DEVICE_ERROR The device reported an error while writting back the data\r
118 @retval EFI_NO_MEDIA There is no media in the device.\r
119\r
120**/\r
121typedef\r
122EFI_STATUS\r
123(EFIAPI *EFI_BLOCK_FLUSH) (\r
124 IN EFI_BLOCK_IO_PROTOCOL *This\r
125 )\r
126;\r
127\r
128/**\r
129 Block IO read only mode data and updated only via members of BlockIO\r
130\r
131**/\r
132typedef struct {\r
133 UINT32 MediaId; ///< The curent media Id. If the media changes, this value is changed.\r
134 BOOLEAN RemovableMedia; ///< TRUE if the media is removable; otherwise, FALSE.\r
135 BOOLEAN MediaPresent; /**< TRUE if there is a media currently present in the device;\r
136 othersise, FALSE. THis field shows the media present status\r
137 as of the most recent ReadBlocks() or WriteBlocks() call.\r
138 **/\r
139 BOOLEAN LogicalPartition; /**< TRUE if LBA 0 is the first block of a partition; otherwise\r
140 FALSE. For media with only one partition this would be TRUE.\r
141 **/\r
142 BOOLEAN ReadOnly; /**< TRUE if the media is marked read-only otherwise, FALSE.\r
143 This field shows the read-only status as of the most recent WriteBlocks () call.\r
144 **/\r
145 BOOLEAN WriteCaching; ///< TRUE if the WriteBlock () function caches write data.\r
146\r
147 UINT32 BlockSize; /**< The intrinsic block size of the device. If the media changes, then\r
148 this field is updated.\r
149 **/\r
150 UINT32 IoAlign; ///< Supplies the alignment requirement for any buffer to read or write block(s).\r
151\r
152 EFI_LBA LastBlock; /**< The last logical block address on the device.\r
153 If the media changes, then this field is updated.\r
154 **/\r
155} EFI_BLOCK_IO_MEDIA;\r
156\r
157#define EFI_BLOCK_IO_PROTOCOL_REVISION 0x00010000\r
158\r
159struct _EFI_BLOCK_IO_PROTOCOL {\r
160 UINT64 Revision;\r
161\r
162 EFI_BLOCK_IO_MEDIA *Media;\r
163\r
164 EFI_BLOCK_RESET Reset;\r
165 EFI_BLOCK_READ ReadBlocks;\r
166 EFI_BLOCK_WRITE WriteBlocks;\r
167 EFI_BLOCK_FLUSH FlushBlocks;\r
168\r
169};\r
170\r
171extern EFI_GUID gEfiBlockIoProtocolGuid;\r
172\r
173#endif\r