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