Synchronize with StatusCode Specification.
[mirror_edk2.git] / IntelFrameworkModulePkg / Bus / Pci / IdeBusDxe / idebus.h
CommitLineData
ead42efc 1/** @file\r
2 Header file for IDE Bus Driver.\r
3\r
4 Copyright (c) 2006 - 2007 Intel Corporation. <BR>\r
694b922c 5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
ead42efc 9\r
694b922c 10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
ead42efc 12\r
13**/\r
14\r
15#ifndef _IDE_BUS_H\r
16#define _IDE_BUS_H\r
17\r
18\r
ed7748fe 19\r
694b922c 20#include <FrameworkDxe.h>\r
ed7748fe 21\r
ead42efc 22#include <Protocol/IdeControllerInit.h>\r
23#include <Protocol/BlockIo.h>\r
24#include <Protocol/PciIo.h>\r
25#include <Protocol/DiskInfo.h>\r
26#include <Protocol/DevicePath.h>\r
ed7748fe 27\r
ead42efc 28#include <Library/DebugLib.h>\r
29#include <Library/UefiDriverEntryPoint.h>\r
30#include <Library/BaseLib.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/BaseMemoryLib.h>\r
33#include <Library/ReportStatusCodeLib.h>\r
34#include <Library/MemoryAllocationLib.h>\r
35#include <Library/PerformanceLib.h>\r
36#include <Library/UefiBootServicesTableLib.h>\r
37#include <Library/UefiRuntimeServicesTableLib.h>\r
38#include <Library/DevicePathLib.h>\r
39\r
40#include <IndustryStandard/pci22.h>\r
41#include "idedata.h"\r
42\r
43//\r
44// Extra Definition to porting\r
45//\r
46#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))\r
47\r
48#define MAX_IDE_DEVICE 4\r
49#define MAX_IDE_CHANNELS 2\r
50#define MAX_IDE_DRIVES 2\r
51\r
52#define INVALID_DEVICE_TYPE 0xff\r
53#define ATA_DEVICE_TYPE 0x00\r
54#define ATAPI_DEVICE_TYPE 0x01\r
55\r
2697c171 56#define EFI_IOB_ATA_BUS_SMART_ENABLE (EFI_SUBCLASS_SPECIFIC | 0x00000000)\r
57#define EFI_IOB_ATA_BUS_SMART_DISABLE (EFI_SUBCLASS_SPECIFIC | 0x00000001)\r
58#define EFI_IOB_ATA_BUS_SMART_OVERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000002)\r
59#define EFI_IOB_ATA_BUS_SMART_UNDERTHRESHOLD (EFI_SUBCLASS_SPECIFIC | 0x00000003)\r
60\r
ead42efc 61typedef struct {\r
62 BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];\r
63 BOOLEAN DeviceFound[MAX_IDE_DEVICE];\r
64 BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];\r
65} IDE_BUS_DRIVER_PRIVATE_DATA;\r
66\r
67#define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')\r
68\r
69typedef struct {\r
70 UINT32 Signature;\r
71\r
72 EFI_HANDLE Handle;\r
73 EFI_BLOCK_IO_PROTOCOL BlkIo;\r
74 EFI_BLOCK_IO_MEDIA BlkMedia;\r
75 EFI_DISK_INFO_PROTOCOL DiskInfo;\r
76 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
77 EFI_PCI_IO_PROTOCOL *PciIo;\r
78 IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;\r
79\r
80 //\r
81 // Local Data for IDE interface goes here\r
82 //\r
83 EFI_IDE_CHANNEL Channel;\r
84 EFI_IDE_DEVICE Device;\r
85 UINT16 Lun;\r
86 IDE_DEVICE_TYPE Type;\r
87\r
88 IDE_BASE_REGISTERS *IoPort;\r
89 UINT16 AtapiError;\r
90\r
1e23bd8d 91 ATAPI_INQUIRY_DATA *pInquiryData;\r
ead42efc 92 EFI_IDENTIFY_DATA *pIdData;\r
93 ATA_PIO_MODE PioMode;\r
94 EFI_ATA_MODE UdmaMode;\r
95 CHAR8 ModelName[41];\r
1e23bd8d 96 ATAPI_REQUEST_SENSE_DATA *SenseData;\r
ead42efc 97 UINT8 SenseDataNumber;\r
98 UINT8 *Cache;\r
99\r
100 //\r
101 // ExitBootService Event, it is used to clear pending IDE interrupt\r
102 //\r
103 EFI_EVENT ExitBootServiceEvent;\r
104\r
105 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
106} IDE_BLK_IO_DEV;\r
107\r
108#include "ComponentName.h"\r
109\r
110#define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)\r
111#define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)\r
112\r
113//\r
114// Global Variables\r
115//\r
116extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;\r
117\r
118#include "ide.h"\r
119\r
120//\r
121// Prototypes\r
122// Driver model protocol interface\r
123//\r
124/**\r
125 TODO: Add function description\r
126\r
127 @param ImageHandle TODO: add argument description\r
128 @param SystemTable TODO: add argument description\r
129\r
130 TODO: add return values\r
131\r
132**/\r
133EFI_STATUS\r
134EFIAPI\r
135IDEBusControllerDriverEntryPoint (\r
136 IN EFI_HANDLE ImageHandle,\r
137 IN EFI_SYSTEM_TABLE *SystemTable\r
138 )\r
139;\r
140\r
141/**\r
142 TODO: Add function description\r
143\r
144 @param This TODO: add argument description\r
145 @param Controller TODO: add argument description\r
146 @param RemainingDevicePath TODO: add argument description\r
147\r
148 TODO: add return values\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153IDEBusDriverBindingSupported (\r
154 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
155 IN EFI_HANDLE Controller,\r
156 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
157 )\r
158;\r
159\r
160/**\r
161 TODO: Add function description\r
162\r
163 @param This TODO: add argument description\r
164 @param Controller TODO: add argument description\r
165 @param RemainingDevicePath TODO: add argument description\r
166\r
167 TODO: add return values\r
168\r
169**/\r
170EFI_STATUS\r
171EFIAPI\r
172IDEBusDriverBindingStart (\r
173 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
174 IN EFI_HANDLE Controller,\r
175 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
176 )\r
177;\r
178\r
179/**\r
180 TODO: Add function description\r
181\r
182 @param This TODO: add argument description\r
183 @param Controller TODO: add argument description\r
184 @param NumberOfChildren TODO: add argument description\r
185 @param ChildHandleBuffer TODO: add argument description\r
186\r
187 TODO: add return values\r
188\r
189**/\r
190EFI_STATUS\r
191EFIAPI\r
192IDEBusDriverBindingStop (\r
193 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
194 IN EFI_HANDLE Controller,\r
195 IN UINTN NumberOfChildren,\r
196 IN EFI_HANDLE *ChildHandleBuffer\r
197 )\r
198;\r
199\r
200//\r
201// EFI Driver Configuration Functions\r
202//\r
203EFI_STATUS\r
204IDEBusDriverConfigurationSetOptions (\r
205 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
206 IN EFI_HANDLE ControllerHandle,\r
207 IN EFI_HANDLE ChildHandle OPTIONAL,\r
208 IN CHAR8 *Language,\r
209 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired\r
210 );\r
211\r
212EFI_STATUS\r
213IDEBusDriverConfigurationOptionsValid (\r
214 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
215 IN EFI_HANDLE ControllerHandle,\r
216 IN EFI_HANDLE ChildHandle OPTIONAL\r
217 );\r
218\r
219EFI_STATUS\r
220IDEBusDriverConfigurationForceDefaults (\r
221 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
222 IN EFI_HANDLE ControllerHandle,\r
223 IN EFI_HANDLE ChildHandle OPTIONAL,\r
224 IN UINT32 DefaultType,\r
225 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired\r
226 );\r
227\r
228//\r
229// EFI Driver Diagnostics Functions\r
230//\r
231EFI_STATUS\r
232IDEBusDriverDiagnosticsRunDiagnostics (\r
233 IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,\r
234 IN EFI_HANDLE ControllerHandle,\r
235 IN EFI_HANDLE ChildHandle OPTIONAL,\r
236 IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,\r
237 IN CHAR8 *Language,\r
238 OUT EFI_GUID **ErrorType,\r
239 OUT UINTN *BufferSize,\r
240 OUT CHAR16 **Buffer\r
241 );\r
242\r
243//\r
244// Block I/O Protocol Interface\r
245//\r
246/**\r
247 TODO: Add function description\r
248\r
249 @param This TODO: add argument description\r
250 @param ExtendedVerification TODO: add argument description\r
251\r
252 TODO: add return values\r
253\r
254**/\r
255EFI_STATUS\r
256EFIAPI\r
257IDEBlkIoReset (\r
258 IN EFI_BLOCK_IO_PROTOCOL *This,\r
259 IN BOOLEAN ExtendedVerification\r
260 )\r
261;\r
262\r
263/**\r
264 TODO: Add function description\r
265\r
266 @param This TODO: add argument description\r
267 @param MediaId TODO: add argument description\r
268 @param LBA TODO: add argument description\r
269 @param BufferSize TODO: add argument description\r
270 @param Buffer TODO: add argument description\r
271\r
272 TODO: add return values\r
273\r
274**/\r
275EFI_STATUS\r
276EFIAPI\r
277IDEBlkIoReadBlocks (\r
278 IN EFI_BLOCK_IO_PROTOCOL *This,\r
279 IN UINT32 MediaId,\r
280 IN EFI_LBA LBA,\r
281 IN UINTN BufferSize,\r
282 OUT VOID *Buffer\r
283 )\r
284;\r
285\r
286/**\r
287 TODO: Add function description\r
288\r
289 @param This TODO: add argument description\r
290 @param MediaId TODO: add argument description\r
291 @param LBA TODO: add argument description\r
292 @param BufferSize TODO: add argument description\r
293 @param Buffer TODO: add argument description\r
294\r
295 TODO: add return values\r
296\r
297**/\r
298EFI_STATUS\r
299EFIAPI\r
300IDEBlkIoWriteBlocks (\r
301 IN EFI_BLOCK_IO_PROTOCOL *This,\r
302 IN UINT32 MediaId,\r
303 IN EFI_LBA LBA,\r
304 IN UINTN BufferSize,\r
305 IN VOID *Buffer\r
306 )\r
307;\r
308\r
309/**\r
310 TODO: Add function description\r
311\r
312 @param This TODO: add argument description\r
313\r
314 TODO: add return values\r
315\r
316**/\r
317EFI_STATUS\r
318EFIAPI\r
319IDEBlkIoFlushBlocks (\r
320 IN EFI_BLOCK_IO_PROTOCOL *This\r
321 )\r
322;\r
323\r
324/**\r
325 TODO: Add function description\r
326\r
327 @param PciIo TODO: add argument description\r
328 @param Enable TODO: add argument description\r
329\r
330 TODO: add return values\r
331\r
332**/\r
333EFI_STATUS\r
334IDERegisterDecodeEnableorDisable (\r
335 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
336 IN BOOLEAN Enable\r
337 )\r
338;\r
339\r
340/**\r
341 TODO: Add function description\r
342\r
343 @param This TODO: add argument description\r
344 @param InquiryData TODO: add argument description\r
345 @param IntquiryDataSize TODO: add argument description\r
346\r
347 TODO: add return values\r
348\r
349**/\r
350EFI_STATUS\r
351EFIAPI\r
352IDEDiskInfoInquiry (\r
353 IN EFI_DISK_INFO_PROTOCOL *This,\r
354 IN OUT VOID *InquiryData,\r
355 IN OUT UINT32 *IntquiryDataSize\r
356 )\r
357;\r
358\r
359/**\r
360 TODO: Add function description\r
361\r
362 @param This TODO: add argument description\r
363 @param IdentifyData TODO: add argument description\r
364 @param IdentifyDataSize TODO: add argument description\r
365\r
366 TODO: add return values\r
367\r
368**/\r
369EFI_STATUS\r
370EFIAPI\r
371IDEDiskInfoIdentify (\r
372 IN EFI_DISK_INFO_PROTOCOL *This,\r
373 IN OUT VOID *IdentifyData,\r
374 IN OUT UINT32 *IdentifyDataSize\r
375 )\r
376;\r
377\r
378/**\r
379 TODO: Add function description\r
380\r
381 @param This TODO: add argument description\r
382 @param SenseData TODO: add argument description\r
383 @param SenseDataSize TODO: add argument description\r
384 @param SenseDataNumber TODO: add argument description\r
385\r
386 TODO: add return values\r
387\r
388**/\r
389EFI_STATUS\r
390EFIAPI\r
391IDEDiskInfoSenseData (\r
392 IN EFI_DISK_INFO_PROTOCOL *This,\r
393 IN OUT VOID *SenseData,\r
394 IN OUT UINT32 *SenseDataSize,\r
395 OUT UINT8 *SenseDataNumber\r
396 )\r
397;\r
398\r
399/**\r
400 TODO: Add function description\r
401\r
402 @param This TODO: add argument description\r
403 @param IdeChannel TODO: add argument description\r
404 @param IdeDevice TODO: add argument description\r
405\r
406 TODO: add return values\r
407\r
408**/\r
409EFI_STATUS\r
410EFIAPI\r
411IDEDiskInfoWhichIde (\r
412 IN EFI_DISK_INFO_PROTOCOL *This,\r
413 OUT UINT32 *IdeChannel,\r
414 OUT UINT32 *IdeDevice\r
415 )\r
416;\r
417\r
418#endif\r