]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIo.h
Update the file description to be more descriptive.
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / DiskIoDxe / DiskIo.h
CommitLineData
adbcbf8f 1/** @file\r
2 DiskIo driver that layers it's self on every Block IO protocol in the system.\r
3 DiskIo converts a block oriented device to a byte oriented device.\r
4\r
5 Copyright (c) 2006 - 2007, Intel Corporation \r
6 All rights reserved. This program and the accompanying materials \r
7 are licensed and made available under the terms and conditions of the BSD License \r
8 which accompanies this distribution. The full text of the license may be found at \r
9 http://opensource.org/licenses/bsd-license.php \r
10\r
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
13\r
14**/\r
15\r
16#ifndef _DISK_IO_H\r
17#define _DISK_IO_H\r
18\r
19#include <Uefi.h>\r
20#include <Protocol/BlockIo.h>\r
21#include <Protocol/ComponentName.h>\r
22#include <Protocol/DriverBinding.h>\r
23#include <Protocol/DiskIo.h>\r
24#include <Library/DebugLib.h>\r
25#include <Library/UefiDriverEntryPoint.h>\r
26#include <Library/UefiLib.h>\r
27#include <Library/BaseLib.h>\r
28#include <Library/BaseMemoryLib.h>\r
29#include <Library/MemoryAllocationLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31\r
32\r
33#define DISK_IO_PRIVATE_DATA_SIGNATURE EFI_SIGNATURE_32 ('d', 's', 'k', 'I')\r
34\r
35#define DATA_BUFFER_BLOCK_NUM (64)\r
36\r
37typedef struct {\r
38 UINTN Signature;\r
39 EFI_DISK_IO_PROTOCOL DiskIo;\r
40 EFI_BLOCK_IO_PROTOCOL *BlockIo;\r
41} DISK_IO_PRIVATE_DATA;\r
42\r
43#define DISK_IO_PRIVATE_DATA_FROM_THIS(a) CR (a, DISK_IO_PRIVATE_DATA, DiskIo, DISK_IO_PRIVATE_DATA_SIGNATURE)\r
44\r
45//\r
46// Global Variables\r
47//\r
d38a0f44 48extern EFI_DRIVER_BINDING_PROTOCOL gDiskIoDriverBinding;\r
49extern EFI_COMPONENT_NAME_PROTOCOL gDiskIoComponentName;\r
50extern EFI_COMPONENT_NAME2_PROTOCOL gDiskIoComponentName2;\r
adbcbf8f 51\r
52//\r
53// Prototypes\r
54// Driver model protocol interface\r
55//\r
56EFI_STATUS\r
57EFIAPI\r
58DiskIoDriverBindingSupported (\r
59 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
60 IN EFI_HANDLE ControllerHandle,\r
61 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
62 );\r
63\r
64EFI_STATUS\r
65EFIAPI\r
66DiskIoDriverBindingStart (\r
67 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
68 IN EFI_HANDLE ControllerHandle,\r
69 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
70 );\r
71\r
72EFI_STATUS\r
73EFIAPI\r
74DiskIoDriverBindingStop (\r
75 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
76 IN EFI_HANDLE ControllerHandle,\r
77 IN UINTN NumberOfChildren,\r
78 IN EFI_HANDLE *ChildHandleBuffer\r
79 );\r
80\r
81//\r
82// Disk I/O Protocol Interface\r
83//\r
84EFI_STATUS\r
85EFIAPI\r
86DiskIoReadDisk (\r
87 IN EFI_DISK_IO_PROTOCOL *This,\r
88 IN UINT32 MediaId,\r
89 IN UINT64 Offset,\r
90 IN UINTN BufferSize,\r
91 OUT VOID *Buffer\r
92 );\r
93\r
94EFI_STATUS\r
95EFIAPI\r
96DiskIoWriteDisk (\r
97 IN EFI_DISK_IO_PROTOCOL *This,\r
98 IN UINT32 MediaId,\r
99 IN UINT64 Offset,\r
100 IN UINTN BufferSize,\r
101 IN VOID *Buffer\r
102 );\r
103\r
104//\r
105// EFI Component Name Functions\r
106//\r
d38a0f44 107/**\r
108 Retrieves a Unicode string that is the user readable name of the driver.\r
109\r
110 This function retrieves the user readable name of a driver in the form of a\r
111 Unicode string. If the driver specified by This has a user readable name in\r
112 the language specified by Language, then a pointer to the driver name is\r
113 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
114 by This does not support the language specified by Language,\r
115 then EFI_UNSUPPORTED is returned.\r
116\r
117 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
118 EFI_COMPONENT_NAME_PROTOCOL instance.\r
119\r
120 @param Language[in] A pointer to a Null-terminated ASCII string\r
121 array indicating the language. This is the\r
122 language of the driver name that the caller is\r
123 requesting, and it must match one of the\r
124 languages specified in SupportedLanguages. The\r
125 number of languages supported by a driver is up\r
126 to the driver writer. Language is specified\r
127 in RFC 3066 or ISO 639-2 language code format.\r
128\r
129 @param DriverName[out] A pointer to the Unicode string to return.\r
130 This Unicode string is the name of the\r
131 driver specified by This in the language\r
132 specified by Language.\r
133\r
134 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
135 This and the language specified by Language was\r
136 returned in DriverName.\r
137\r
138 @retval EFI_INVALID_PARAMETER Language is NULL.\r
139\r
140 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
141\r
142 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
143 the language specified by Language.\r
144\r
145**/\r
adbcbf8f 146EFI_STATUS\r
147EFIAPI\r
148DiskIoComponentNameGetDriverName (\r
149 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
150 IN CHAR8 *Language,\r
151 OUT CHAR16 **DriverName\r
152 );\r
153\r
d38a0f44 154\r
155/**\r
156 Retrieves a Unicode string that is the user readable name of the controller\r
157 that is being managed by a driver.\r
158\r
159 This function retrieves the user readable name of the controller specified by\r
160 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
161 driver specified by This has a user readable name in the language specified by\r
162 Language, then a pointer to the controller name is returned in ControllerName,\r
163 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
164 managing the controller specified by ControllerHandle and ChildHandle,\r
165 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
166 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
167\r
168 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
169 EFI_COMPONENT_NAME_PROTOCOL instance.\r
170\r
171 @param ControllerHandle[in] The handle of a controller that the driver\r
172 specified by This is managing. This handle\r
173 specifies the controller whose name is to be\r
174 returned.\r
175\r
176 @param ChildHandle[in] The handle of the child controller to retrieve\r
177 the name of. This is an optional parameter that\r
178 may be NULL. It will be NULL for device\r
179 drivers. It will also be NULL for a bus drivers\r
180 that wish to retrieve the name of the bus\r
181 controller. It will not be NULL for a bus\r
182 driver that wishes to retrieve the name of a\r
183 child controller.\r
184\r
185 @param Language[in] A pointer to a Null-terminated ASCII string\r
186 array indicating the language. This is the\r
187 language of the driver name that the caller is\r
188 requesting, and it must match one of the\r
189 languages specified in SupportedLanguages. The\r
190 number of languages supported by a driver is up\r
191 to the driver writer. Language is specified in\r
192 RFC 3066 or ISO 639-2 language code format.\r
193\r
194 @param ControllerName[out] A pointer to the Unicode string to return.\r
195 This Unicode string is the name of the\r
196 controller specified by ControllerHandle and\r
197 ChildHandle in the language specified by\r
198 Language from the point of view of the driver\r
199 specified by This.\r
200\r
201 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
202 the language specified by Language for the\r
203 driver specified by This was returned in\r
204 DriverName.\r
205\r
206 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r
207\r
208 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
209 EFI_HANDLE.\r
210\r
211 @retval EFI_INVALID_PARAMETER Language is NULL.\r
212\r
213 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
214\r
215 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
216 managing the controller specified by\r
217 ControllerHandle and ChildHandle.\r
218\r
219 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
220 the language specified by Language.\r
221\r
222**/\r
adbcbf8f 223EFI_STATUS\r
224EFIAPI\r
225DiskIoComponentNameGetControllerName (\r
226 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
227 IN EFI_HANDLE ControllerHandle,\r
228 IN EFI_HANDLE ChildHandle OPTIONAL,\r
229 IN CHAR8 *Language,\r
230 OUT CHAR16 **ControllerName\r
231 );\r
232\r
d38a0f44 233\r
adbcbf8f 234#endif\r