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