In IdeBus driver block I/O read/write interface, it will always try to use UDMA mode...
[mirror_edk2.git] / EdkModulePkg / Bus / Pci / IdeBus / Dxe / idebus.h
CommitLineData
ed72955c 1/** @file\r
2 Header file for IDE Bus Driver.\r
878ddf1f 3\r
ed72955c 4 Copyright (c) 2006, Intel Corporation \r
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
878ddf1f 9\r
ed72955c 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
878ddf1f 12\r
ed72955c 13**/\r
878ddf1f 14\r
878ddf1f 15#ifndef _IDE_BUS_H\r
16#define _IDE_BUS_H\r
17\r
18\r
f0ec738d 19#include <IndustryStandard/pci22.h>\r
878ddf1f 20#include "idedata.h"\r
21\r
22//\r
23// Extra Definition to porting\r
24//\r
25#define EFI_MIN(a, b) (((a) < (b)) ? (a) : (b))\r
26\r
27#define MAX_IDE_DEVICE 4\r
28#define MAX_IDE_CHANNELS 2\r
29#define MAX_IDE_DRIVES 2\r
30\r
a98f11c5 31#define INVALID_DEVICE_TYPE 0xff\r
32#define ATA_DEVICE_TYPE 0x00\r
33#define ATAPI_DEVICE_TYPE 0x01\r
34\r
878ddf1f 35typedef struct {\r
36 BOOLEAN HaveScannedDevice[MAX_IDE_DEVICE];\r
37 BOOLEAN DeviceFound[MAX_IDE_DEVICE];\r
38 BOOLEAN DeviceProcessed[MAX_IDE_DEVICE];\r
39} IDE_BUS_DRIVER_PRIVATE_DATA;\r
40\r
41#define IDE_BLK_IO_DEV_SIGNATURE EFI_SIGNATURE_32 ('i', 'b', 'i', 'd')\r
42\r
43typedef struct {\r
44 UINT32 Signature;\r
45\r
46 EFI_HANDLE Handle;\r
47 EFI_BLOCK_IO_PROTOCOL BlkIo;\r
48 EFI_BLOCK_IO_MEDIA BlkMedia;\r
49 EFI_DISK_INFO_PROTOCOL DiskInfo;\r
50 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
51 EFI_PCI_IO_PROTOCOL *PciIo;\r
52 IDE_BUS_DRIVER_PRIVATE_DATA *IdeBusDriverPrivateData;\r
53\r
54 //\r
55 // Local Data for IDE interface goes here\r
56 //\r
57 EFI_IDE_CHANNEL Channel;\r
58 EFI_IDE_DEVICE Device;\r
59 UINT16 Lun;\r
60 IDE_DEVICE_TYPE Type;\r
61\r
62 IDE_BASE_REGISTERS *IoPort;\r
63 UINT16 AtapiError;\r
64\r
65 INQUIRY_DATA *pInquiryData;\r
66 EFI_IDENTIFY_DATA *pIdData;\r
67 ATA_PIO_MODE PioMode;\r
bc4e770c 68 EFI_ATA_MODE UdmaMode;\r
878ddf1f 69 CHAR8 ModelName[41];\r
70 REQUEST_SENSE_DATA *SenseData;\r
71 UINT8 SenseDataNumber;\r
72 UINT8 *Cache;\r
73\r
a98f11c5 74 //\r
75 // ExitBootService Event, it is used to clear pending IDE interrupt\r
76 //\r
77 EFI_EVENT ExitBootServiceEvent;\r
78\r
878ddf1f 79 EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r
80} IDE_BLK_IO_DEV;\r
81\r
82#include "ComponentName.h"\r
83\r
84#define IDE_BLOCK_IO_DEV_FROM_THIS(a) CR (a, IDE_BLK_IO_DEV, BlkIo, IDE_BLK_IO_DEV_SIGNATURE)\r
85#define IDE_BLOCK_IO_DEV_FROM_DISK_INFO_THIS(a) CR (a, IDE_BLK_IO_DEV, DiskInfo, IDE_BLK_IO_DEV_SIGNATURE)\r
86\r
87//\r
88// Global Variables\r
89//\r
90extern EFI_DRIVER_BINDING_PROTOCOL gIDEBusDriverBinding;\r
91\r
92#include "ide.h"\r
93\r
94//\r
95// Prototypes\r
96// Driver model protocol interface\r
97//\r
ed72955c 98/**\r
99 TODO: Add function description\r
100\r
101 @param ImageHandle TODO: add argument description\r
102 @param SystemTable TODO: add argument description\r
103\r
104 TODO: add return values\r
105\r
106**/\r
878ddf1f 107EFI_STATUS\r
108EFIAPI\r
109IDEBusControllerDriverEntryPoint (\r
110 IN EFI_HANDLE ImageHandle,\r
111 IN EFI_SYSTEM_TABLE *SystemTable\r
112 )\r
ed72955c 113;\r
878ddf1f 114\r
ed72955c 115/**\r
878ddf1f 116 TODO: Add function description\r
117\r
ed72955c 118 @param This TODO: add argument description\r
119 @param Controller TODO: add argument description\r
120 @param RemainingDevicePath TODO: add argument description\r
878ddf1f 121\r
122 TODO: add return values\r
123\r
ed72955c 124**/\r
878ddf1f 125EFI_STATUS\r
126EFIAPI\r
127IDEBusDriverBindingSupported (\r
128 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
129 IN EFI_HANDLE Controller,\r
130 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
131 )\r
ed72955c 132;\r
878ddf1f 133\r
ed72955c 134/**\r
878ddf1f 135 TODO: Add function description\r
136\r
ed72955c 137 @param This TODO: add argument description\r
138 @param Controller TODO: add argument description\r
139 @param RemainingDevicePath TODO: add argument description\r
878ddf1f 140\r
141 TODO: add return values\r
142\r
ed72955c 143**/\r
878ddf1f 144EFI_STATUS\r
145EFIAPI\r
146IDEBusDriverBindingStart (\r
147 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
148 IN EFI_HANDLE Controller,\r
149 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
150 )\r
ed72955c 151;\r
878ddf1f 152\r
ed72955c 153/**\r
878ddf1f 154 TODO: Add function description\r
155\r
ed72955c 156 @param This TODO: add argument description\r
157 @param Controller TODO: add argument description\r
158 @param NumberOfChildren TODO: add argument description\r
159 @param ChildHandleBuffer TODO: add argument description\r
878ddf1f 160\r
161 TODO: add return values\r
162\r
ed72955c 163**/\r
878ddf1f 164EFI_STATUS\r
165EFIAPI\r
166IDEBusDriverBindingStop (\r
167 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
168 IN EFI_HANDLE Controller,\r
169 IN UINTN NumberOfChildren,\r
170 IN EFI_HANDLE *ChildHandleBuffer\r
171 )\r
ed72955c 172;\r
878ddf1f 173\r
92dda53e 174//\r
175// EFI Driver Configuration Functions\r
176//\r
177EFI_STATUS\r
178IDEBusDriverConfigurationSetOptions (\r
179 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
180 IN EFI_HANDLE ControllerHandle,\r
181 IN EFI_HANDLE ChildHandle OPTIONAL,\r
182 IN CHAR8 *Language,\r
183 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired\r
184 );\r
185\r
186EFI_STATUS\r
187IDEBusDriverConfigurationOptionsValid (\r
188 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
189 IN EFI_HANDLE ControllerHandle,\r
190 IN EFI_HANDLE ChildHandle OPTIONAL\r
191 );\r
192\r
193EFI_STATUS\r
194IDEBusDriverConfigurationForceDefaults (\r
195 IN EFI_DRIVER_CONFIGURATION_PROTOCOL *This,\r
196 IN EFI_HANDLE ControllerHandle,\r
197 IN EFI_HANDLE ChildHandle OPTIONAL,\r
198 IN UINT32 DefaultType,\r
199 OUT EFI_DRIVER_CONFIGURATION_ACTION_REQUIRED *ActionRequired\r
200 );\r
201\r
202//\r
203// EFI Driver Diagnostics Functions\r
204//\r
205EFI_STATUS\r
206IDEBusDriverDiagnosticsRunDiagnostics (\r
207 IN EFI_DRIVER_DIAGNOSTICS_PROTOCOL *This,\r
208 IN EFI_HANDLE ControllerHandle,\r
209 IN EFI_HANDLE ChildHandle OPTIONAL,\r
210 IN EFI_DRIVER_DIAGNOSTIC_TYPE DiagnosticType,\r
211 IN CHAR8 *Language,\r
212 OUT EFI_GUID **ErrorType,\r
213 OUT UINTN *BufferSize,\r
214 OUT CHAR16 **Buffer\r
215 );\r
216\r
ed72955c 217//\r
218// Block I/O Protocol Interface\r
219//\r
220/**\r
878ddf1f 221 TODO: Add function description\r
222\r
ed72955c 223 @param This TODO: add argument description\r
224 @param ExtendedVerification TODO: add argument description\r
878ddf1f 225\r
226 TODO: add return values\r
227\r
ed72955c 228**/\r
878ddf1f 229EFI_STATUS\r
230EFIAPI\r
231IDEBlkIoReset (\r
232 IN EFI_BLOCK_IO_PROTOCOL *This,\r
233 IN BOOLEAN ExtendedVerification\r
234 )\r
ed72955c 235;\r
878ddf1f 236\r
ed72955c 237/**\r
878ddf1f 238 TODO: Add function description\r
239\r
ed72955c 240 @param This TODO: add argument description\r
241 @param MediaId TODO: add argument description\r
242 @param LBA TODO: add argument description\r
243 @param BufferSize TODO: add argument description\r
244 @param Buffer TODO: add argument description\r
878ddf1f 245\r
246 TODO: add return values\r
247\r
ed72955c 248**/\r
878ddf1f 249EFI_STATUS\r
250EFIAPI\r
251IDEBlkIoReadBlocks (\r
252 IN EFI_BLOCK_IO_PROTOCOL *This,\r
253 IN UINT32 MediaId,\r
254 IN EFI_LBA LBA,\r
255 IN UINTN BufferSize,\r
256 OUT VOID *Buffer\r
257 )\r
ed72955c 258;\r
878ddf1f 259\r
ed72955c 260/**\r
878ddf1f 261 TODO: Add function description\r
262\r
ed72955c 263 @param This TODO: add argument description\r
264 @param MediaId TODO: add argument description\r
265 @param LBA TODO: add argument description\r
266 @param BufferSize TODO: add argument description\r
267 @param Buffer TODO: add argument description\r
878ddf1f 268\r
269 TODO: add return values\r
270\r
ed72955c 271**/\r
878ddf1f 272EFI_STATUS\r
273EFIAPI\r
274IDEBlkIoWriteBlocks (\r
275 IN EFI_BLOCK_IO_PROTOCOL *This,\r
276 IN UINT32 MediaId,\r
277 IN EFI_LBA LBA,\r
278 IN UINTN BufferSize,\r
279 IN VOID *Buffer\r
280 )\r
ed72955c 281;\r
878ddf1f 282\r
ed72955c 283/**\r
878ddf1f 284 TODO: Add function description\r
285\r
ed72955c 286 @param This TODO: add argument description\r
878ddf1f 287\r
288 TODO: add return values\r
289\r
ed72955c 290**/\r
878ddf1f 291EFI_STATUS\r
292EFIAPI\r
293IDEBlkIoFlushBlocks (\r
294 IN EFI_BLOCK_IO_PROTOCOL *This\r
295 )\r
ed72955c 296;\r
878ddf1f 297\r
ed72955c 298/**\r
878ddf1f 299 TODO: Add function description\r
300\r
ed72955c 301 @param PciIo TODO: add argument description\r
302 @param Enable TODO: add argument description\r
878ddf1f 303\r
304 TODO: add return values\r
305\r
ed72955c 306**/\r
878ddf1f 307EFI_STATUS\r
308IDERegisterDecodeEnableorDisable (\r
309 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
310 IN BOOLEAN Enable\r
311 )\r
ed72955c 312;\r
878ddf1f 313\r
ed72955c 314/**\r
878ddf1f 315 TODO: Add function description\r
316\r
ed72955c 317 @param This TODO: add argument description\r
318 @param InquiryData TODO: add argument description\r
319 @param IntquiryDataSize TODO: add argument description\r
878ddf1f 320\r
321 TODO: add return values\r
322\r
ed72955c 323**/\r
878ddf1f 324EFI_STATUS\r
325EFIAPI\r
326IDEDiskInfoInquiry (\r
327 IN EFI_DISK_INFO_PROTOCOL *This,\r
328 IN OUT VOID *InquiryData,\r
329 IN OUT UINT32 *IntquiryDataSize\r
330 )\r
ed72955c 331;\r
878ddf1f 332\r
ed72955c 333/**\r
878ddf1f 334 TODO: Add function description\r
335\r
ed72955c 336 @param This TODO: add argument description\r
337 @param IdentifyData TODO: add argument description\r
338 @param IdentifyDataSize TODO: add argument description\r
878ddf1f 339\r
340 TODO: add return values\r
341\r
ed72955c 342**/\r
878ddf1f 343EFI_STATUS\r
344EFIAPI\r
345IDEDiskInfoIdentify (\r
346 IN EFI_DISK_INFO_PROTOCOL *This,\r
347 IN OUT VOID *IdentifyData,\r
348 IN OUT UINT32 *IdentifyDataSize\r
349 )\r
ed72955c 350;\r
878ddf1f 351\r
ed72955c 352/**\r
878ddf1f 353 TODO: Add function description\r
354\r
ed72955c 355 @param This TODO: add argument description\r
356 @param SenseData TODO: add argument description\r
357 @param SenseDataSize TODO: add argument description\r
358 @param SenseDataNumber TODO: add argument description\r
878ddf1f 359\r
360 TODO: add return values\r
361\r
ed72955c 362**/\r
878ddf1f 363EFI_STATUS\r
364EFIAPI\r
365IDEDiskInfoSenseData (\r
366 IN EFI_DISK_INFO_PROTOCOL *This,\r
367 IN OUT VOID *SenseData,\r
368 IN OUT UINT32 *SenseDataSize,\r
369 OUT UINT8 *SenseDataNumber\r
370 )\r
ed72955c 371;\r
878ddf1f 372\r
ed72955c 373/**\r
878ddf1f 374 TODO: Add function description\r
375\r
ed72955c 376 @param This TODO: add argument description\r
377 @param IdeChannel TODO: add argument description\r
378 @param IdeDevice TODO: add argument description\r
878ddf1f 379\r
380 TODO: add return values\r
381\r
ed72955c 382**/\r
878ddf1f 383EFI_STATUS\r
384EFIAPI\r
385IDEDiskInfoWhichIde (\r
386 IN EFI_DISK_INFO_PROTOCOL *This,\r
387 OUT UINT32 *IdeChannel,\r
388 OUT UINT32 *IdeDevice\r
389 )\r
878ddf1f 390;\r
391\r
392#endif\r