]>
Commit | Line | Data |
---|---|---|
79964ac8 | 1 | /** @file\r |
2 | This file declares EFI IDE Controller Init Protocol\r | |
3 | \r | |
4 | Copyright (c) 2007, 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 | |
9 | \r | |
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 | |
12 | \r | |
13 | Module Name: IdeControllerInit.h\r | |
14 | \r | |
15 | @par Revision Reference:\r | |
16 | This Protocol is defined in IDE Controller Initialization Protocol Specification\r | |
17 | Version 0.9\r | |
18 | \r | |
19 | **/\r | |
20 | \r | |
21 | #ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_\r | |
22 | #define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_\r | |
23 | \r | |
b80fbe85 | 24 | #include <PiDxe.h>\r |
25 | \r | |
79964ac8 | 26 | //\r |
27 | // Global ID for the EFI Platform IDE Protocol GUID\r | |
28 | //\r | |
29 | #define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \\r | |
30 | { 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } }\r | |
31 | \r | |
32 | //\r | |
33 | // Forward reference for pure ANSI compatability\r | |
34 | //\r | |
35 | typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL;\r | |
36 | \r | |
37 | //\r | |
38 | //////////////////////////////////////////////////////////////////////////////////////////\r | |
39 | // EFI_IDE_BUS_ENUMERATION_PHASE\r | |
40 | // EFI_IDE_CONTROLLER_ENUM_PHASE\r | |
41 | //\r | |
42 | typedef enum{\r | |
43 | EfiIdeBeforeChannelEnumeration,\r | |
44 | EfiIdeAfterChannelEnumeration,\r | |
45 | EfiIdeBeforeChannelReset,\r | |
46 | EfiIdeAfterChannelReset,\r | |
47 | EfiIdeBusBeforeDevicePresenceDetection,\r | |
48 | EfiIdeBusAfterDevicePresenceDetection,\r | |
49 | EfiIdeResetMode,\r | |
50 | EfiIdeBusPhaseMaximum\r | |
51 | } EFI_IDE_CONTROLLER_ENUM_PHASE;\r | |
52 | \r | |
53 | //\r | |
54 | //******************************************************\r | |
55 | // EFI_ATA_EXT_TRANSFER_PROTOCOL\r | |
56 | //******************************************************\r | |
57 | //\r | |
58 | // This extended mode describes the SATA physical protocol.\r | |
59 | // SATA physical layers can operate at different speeds.\r | |
60 | // These speeds are defined below. Various PATA protocols\r | |
61 | // and associated modes are not applicable to SATA devices.\r | |
62 | //\r | |
63 | \r | |
64 | typedef enum {\r | |
65 | EfiAtaSataTransferProtocol\r | |
66 | } EFI_ATA_EXT_TRANSFER_PROTOCOL;\r | |
67 | \r | |
68 | #define EFI_SATA_AUTO_SPEED 0\r | |
69 | #define EFI_SATA_GEN1_SPEED 1\r | |
70 | #define EFI_SATA_GEN2_SPEED 2\r | |
71 | \r | |
72 | //\r | |
73 | //*******************************************************\r | |
74 | // EFI_IDE_CABLE_TYPE\r | |
75 | //*******************************************************\r | |
76 | //\r | |
77 | typedef enum {\r | |
78 | EfiIdeCableTypeUnknown,\r | |
79 | EfiIdeCableType40pin,\r | |
80 | EfiIdeCableType80Pin,\r | |
81 | EfiIdeCableTypeSerial,\r | |
82 | EfiIdeCableTypeMaximum\r | |
83 | } EFI_IDE_CABLE_TYPE;\r | |
84 | \r | |
85 | //\r | |
86 | //******************************************************\r | |
87 | // EFI_ATA_MODE\r | |
88 | //******************************************************\r | |
89 | //\r | |
90 | typedef struct {\r | |
91 | BOOLEAN Valid;\r | |
92 | UINT32 Mode;\r | |
93 | } EFI_ATA_MODE;\r | |
94 | \r | |
95 | //\r | |
96 | //******************************************************\r | |
97 | // EFI_ATA_EXTENDED_MODE\r | |
98 | //******************************************************\r | |
99 | //\r | |
100 | typedef struct {\r | |
101 | EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol;\r | |
102 | UINT32 Mode;\r | |
103 | } EFI_ATA_EXTENDED_MODE;\r | |
104 | \r | |
105 | //\r | |
106 | //******************************************************\r | |
107 | // EFI_ATA_COLLECTIVE_MODE\r | |
108 | //******************************************************\r | |
109 | //\r | |
110 | typedef struct {\r | |
111 | EFI_ATA_MODE PioMode;\r | |
112 | EFI_ATA_MODE SingleWordDmaMode;\r | |
113 | EFI_ATA_MODE MultiWordDmaMode;\r | |
114 | EFI_ATA_MODE UdmaMode;\r | |
115 | UINT32 ExtModeCount;\r | |
116 | EFI_ATA_EXTENDED_MODE ExtMode[1];\r | |
117 | } EFI_ATA_COLLECTIVE_MODE;\r | |
118 | \r | |
119 | //\r | |
120 | //*******************************************************\r | |
121 | // EFI_ATA_IDENTIFY_DATA\r | |
122 | //*******************************************************\r | |
123 | //\r | |
124 | \r | |
125 | #pragma pack(1)\r | |
126 | \r | |
127 | typedef struct {\r | |
128 | UINT16 config; // General Configuration\r | |
129 | UINT16 cylinders; // Number of Cylinders\r | |
130 | UINT16 reserved_2;\r | |
131 | UINT16 heads; //Number of logical heads\r | |
132 | UINT16 vendor_data1;\r | |
133 | UINT16 vendor_data2;\r | |
134 | UINT16 sectors_per_track;\r | |
135 | UINT16 vendor_specific_7_9[3];\r | |
136 | CHAR8 SerialNo[20]; // ASCII\r | |
137 | UINT16 vendor_specific_20_21[2];\r | |
138 | UINT16 ecc_bytes_available;\r | |
139 | CHAR8 FirmwareVer[8]; // ASCII\r | |
140 | CHAR8 ModelName[40]; // ASCII\r | |
141 | UINT16 multi_sector_cmd_max_sct_cnt;\r | |
142 | UINT16 reserved_48;\r | |
143 | UINT16 capabilities;\r | |
144 | UINT16 reserved_50;\r | |
145 | UINT16 pio_cycle_timing;\r | |
146 | UINT16 reserved_52;\r | |
147 | UINT16 field_validity;\r | |
148 | UINT16 current_cylinders;\r | |
149 | UINT16 current_heads;\r | |
150 | UINT16 current_sectors;\r | |
151 | UINT16 CurrentCapacityLsb;\r | |
152 | UINT16 CurrentCapacityMsb;\r | |
153 | UINT16 reserved_59;\r | |
154 | UINT16 user_addressable_sectors_lo;\r | |
155 | UINT16 user_addressable_sectors_hi;\r | |
156 | UINT16 reserved_62;\r | |
157 | UINT16 multi_word_dma_mode;\r | |
158 | UINT16 advanced_pio_modes;\r | |
159 | UINT16 min_multi_word_dma_cycle_time;\r | |
160 | UINT16 rec_multi_word_dma_cycle_time;\r | |
161 | UINT16 min_pio_cycle_time_without_flow_control;\r | |
162 | UINT16 min_pio_cycle_time_with_flow_control;\r | |
163 | UINT16 reserved_69_79[11];\r | |
164 | UINT16 major_version_no;\r | |
165 | UINT16 minor_version_no;\r | |
166 | UINT16 command_set_supported_82; // word 82\r | |
167 | UINT16 command_set_supported_83; // word 83\r | |
168 | UINT16 command_set_feature_extn; // word 84\r | |
169 | UINT16 command_set_feature_enb_85; // word 85\r | |
170 | UINT16 command_set_feature_enb_86; // word 86\r | |
171 | UINT16 command_set_feature_default; // word 87\r | |
172 | UINT16 ultra_dma_mode; // word 88\r | |
173 | UINT16 reserved_89_127[39];\r | |
174 | UINT16 security_status;\r | |
175 | UINT16 vendor_data_129_159[31];\r | |
176 | UINT16 reserved_160_255[96];\r | |
177 | } EFI_ATA_IDENTIFY_DATA;\r | |
178 | \r | |
179 | #pragma pack()\r | |
180 | //\r | |
181 | //*******************************************************\r | |
182 | // EFI_ATAPI_IDENTIFY_DATA\r | |
183 | //*******************************************************\r | |
184 | //\r | |
185 | #pragma pack(1)\r | |
186 | typedef struct {\r | |
187 | UINT16 config; // General Configuration\r | |
188 | UINT16 obsolete_1;\r | |
189 | UINT16 specific_config;\r | |
190 | UINT16 obsolete_3;\r | |
191 | UINT16 retired_4_5[2];\r | |
192 | UINT16 obsolete_6;\r | |
193 | UINT16 cfa_reserved_7_8[2];\r | |
194 | UINT16 retired_9;\r | |
195 | CHAR8 SerialNo[20]; // ASCII\r | |
196 | UINT16 retired_20_21[2];\r | |
197 | UINT16 obsolete_22;\r | |
198 | CHAR8 FirmwareVer[8]; // ASCII\r | |
199 | CHAR8 ModelName[40]; // ASCII\r | |
200 | UINT16 multi_sector_cmd_max_sct_cnt;\r | |
201 | UINT16 reserved_48;\r | |
202 | UINT16 capabilities_49;\r | |
203 | UINT16 capabilities_50;\r | |
204 | UINT16 obsolete_51_52[2];\r | |
205 | UINT16 field_validity;\r | |
206 | UINT16 obsolete_54_58[5];\r | |
207 | UINT16 mutil_sector_setting;\r | |
208 | UINT16 user_addressable_sectors_lo;\r | |
209 | UINT16 user_addressable_sectors_hi;\r | |
210 | UINT16 obsolete_62;\r | |
211 | UINT16 multi_word_dma_mode;\r | |
212 | UINT16 advanced_pio_modes;\r | |
213 | UINT16 min_multi_word_dma_cycle_time;\r | |
214 | UINT16 rec_multi_word_dma_cycle_time;\r | |
215 | UINT16 min_pio_cycle_time_without_flow_control;\r | |
216 | UINT16 min_pio_cycle_time_with_flow_control;\r | |
217 | UINT16 reserved_69_74[6];\r | |
218 | UINT16 queue_depth;\r | |
219 | UINT16 reserved_76_79[4];\r | |
220 | UINT16 major_version_no;\r | |
221 | UINT16 minor_version_no;\r | |
222 | UINT16 cmd_set_support_82;\r | |
223 | UINT16 cmd_set_support_83;\r | |
224 | UINT16 cmd_feature_support;\r | |
225 | UINT16 cmd_feature_enable_85;\r | |
226 | UINT16 cmd_feature_enable_86;\r | |
227 | UINT16 cmd_feature_default;\r | |
228 | UINT16 ultra_dma_select;\r | |
229 | UINT16 time_required_for_sec_erase;\r | |
230 | UINT16 time_required_for_enhanced_sec_erase;\r | |
231 | UINT16 current_advanced_power_mgmt_value;\r | |
232 | UINT16 master_pwd_revison_code;\r | |
233 | UINT16 hardware_reset_result;\r | |
234 | UINT16 current_auto_acoustic_mgmt_value;\r | |
235 | UINT16 reserved_95_99[5];\r | |
236 | UINT16 max_user_lba_for_48bit_addr[4];\r | |
237 | UINT16 reserved_104_126[23];\r | |
238 | UINT16 removable_media_status_notification_support;\r | |
239 | UINT16 security_status;\r | |
240 | UINT16 vendor_data_129_159[31];\r | |
241 | UINT16 cfa_power_mode;\r | |
242 | UINT16 cfa_reserved_161_175[15];\r | |
243 | UINT16 current_media_serial_no[30];\r | |
244 | UINT16 reserved_206_254[49];\r | |
245 | UINT16 integrity_word;\r | |
246 | } EFI_ATAPI_IDENTIFY_DATA;\r | |
247 | \r | |
248 | #pragma pack()\r | |
249 | //\r | |
250 | //*******************************************************\r | |
251 | // EFI_IDENTIFY_DATA\r | |
252 | //*******************************************************\r | |
253 | //\r | |
254 | typedef union {\r | |
255 | EFI_ATA_IDENTIFY_DATA AtaData;\r | |
256 | EFI_ATAPI_IDENTIFY_DATA AtapiData;\r | |
257 | } EFI_IDENTIFY_DATA;\r | |
258 | \r | |
259 | #define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000\r | |
260 | \r | |
261 | //\r | |
262 | /////////////////////////////////////////////////////////////////////////////////////////\r | |
263 | // Function prototype declaration, for ANSI compatability\r | |
264 | //\r | |
265 | /**\r | |
266 | Returns the information about the specified IDE channel.\r | |
267 | \r | |
268 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
269 | @param Channel Zero-based channel number.\r | |
270 | @param Enabled TRUE if this channel is enabled. Disabled channels are not scanned\r | |
271 | to see if any devices are present.\r | |
272 | @param MaxDevices The maximum number of IDE devices that the bus driver\r | |
273 | can expect on this channel.\r | |
274 | \r | |
275 | @retval EFI_SUCCESS Information was returned without any errors.\r | |
276 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
277 | \r | |
278 | **/\r | |
279 | typedef\r | |
280 | EFI_STATUS\r | |
281 | (EFIAPI *EFI_IDE_CONTROLLER_GET_CHANNEL_INFO) (\r | |
282 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
283 | IN UINT8 Channel,\r | |
284 | OUT BOOLEAN *Enabled,\r | |
285 | OUT UINT8 *MaxDevices\r | |
286 | );\r | |
287 | \r | |
288 | /**\r | |
289 | The notifications from the IDE bus driver that it is about to enter a certain\r | |
290 | phase of the IDE channel enumeration process.\r | |
291 | \r | |
292 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
293 | @param Phase The phase during enumeration.\r | |
294 | @param Channel Zero-based channel number.\r | |
295 | \r | |
296 | @retval EFI_SUCCESS The notification was accepted without any errors.\r | |
297 | @retval EFI_NOT_SUPPORTED Phase is not supported.\r | |
298 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
299 | @retval EFI_NOT_READY This phase cannot be entered at this time.\r | |
300 | \r | |
301 | **/\r | |
302 | typedef\r | |
303 | EFI_STATUS\r | |
304 | (EFIAPI *EFI_IDE_CONTROLLER_NOTIFY_PHASE) (\r | |
305 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
306 | IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,\r | |
307 | IN UINT8 Channel\r | |
308 | );\r | |
309 | \r | |
310 | /**\r | |
311 | Submits the device information to the IDE controller driver.\r | |
312 | \r | |
313 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
314 | @param Channel Zero-based channel number.\r | |
315 | @param Device Zero-based device number on the Channel.\r | |
316 | @param IdentifyData The device's response to the ATA IDENTIFY_DEVICE command.\r | |
317 | \r | |
318 | @retval EFI_SUCCESS The information was accepted without any errors.\r | |
319 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
320 | Or Device is invalid.\r | |
321 | \r | |
322 | **/\r | |
323 | typedef\r | |
324 | EFI_STATUS\r | |
325 | (EFIAPI *EFI_IDE_CONTROLLER_SUBMIT_DATA) (\r | |
326 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
327 | IN UINT8 Channel,\r | |
328 | IN UINT8 Device,\r | |
329 | IN EFI_IDENTIFY_DATA *IdentifyData\r | |
330 | );\r | |
331 | \r | |
332 | /**\r | |
333 | Disqualifies specific modes for an IDE device.\r | |
334 | \r | |
335 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
336 | @param Channel Zero-based channel number.\r | |
337 | @param Device Zero-based device number on the Channel.\r | |
338 | @param BadModes The modes that the device does not support and that\r | |
339 | should be disqualified.\r | |
340 | \r | |
341 | @retval EFI_SUCCESS The modes were accepted without any errors.\r | |
342 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
343 | Or Device is invalid.\r | |
344 | \r | |
345 | **/\r | |
346 | typedef\r | |
347 | EFI_STATUS\r | |
348 | (EFIAPI *EFI_IDE_CONTROLLER_DISQUALIFY_MODE) (\r | |
349 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
350 | IN UINT8 Channel,\r | |
351 | IN UINT8 Device,\r | |
352 | IN EFI_ATA_COLLECTIVE_MODE *BadModes\r | |
353 | );\r | |
354 | \r | |
355 | /**\r | |
356 | Returns the information about the optimum modes for the specified IDE device.\r | |
357 | \r | |
358 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
359 | @param Channel Zero-based channel number.\r | |
360 | @param Device Zero-based device number on the Channel.\r | |
361 | @param SupportedModes The optimum modes for the device.\r | |
362 | \r | |
363 | @retval EFI_SUCCESS SupportedModes was returned.\r | |
364 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
365 | Or Device is invalid. Or SupportedModes is NULL.\r | |
366 | @retval EFI_NOT_READY Modes cannot be calculated due to a lack of data.\r | |
367 | \r | |
368 | **/\r | |
369 | typedef\r | |
370 | EFI_STATUS\r | |
371 | (EFIAPI *EFI_IDE_CONTROLLER_CALCULATE_MODE) (\r | |
372 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
373 | IN UINT8 Channel,\r | |
374 | IN UINT8 Device,\r | |
375 | OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes\r | |
376 | );\r | |
377 | \r | |
378 | /**\r | |
379 | Commands the IDE controller driver to program the IDE controller hardware\r | |
380 | so that the specified device can operate at the specified mode.\r | |
381 | \r | |
382 | @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r | |
383 | @param Channel Zero-based channel number.\r | |
384 | @param Device Zero-based device number on the Channel.\r | |
385 | @param Modes The modes to set.\r | |
386 | \r | |
387 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
388 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r | |
389 | Or Device is invalid.\r | |
390 | @retval EFI_NOT_READY Modes cannot be set at this time due to lack of data.\r | |
391 | @retval EFI_DEVICE_ERROR Modes cannot be set due to hardware failure.\r | |
392 | The IDE bus driver should not use this device.\r | |
393 | \r | |
394 | **/\r | |
395 | typedef\r | |
396 | EFI_STATUS\r | |
397 | (EFIAPI *EFI_IDE_CONTROLLER_SET_TIMING) (\r | |
398 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r | |
399 | IN UINT8 Channel,\r | |
400 | IN UINT8 Device,\r | |
401 | IN EFI_ATA_COLLECTIVE_MODE *Modes\r | |
402 | );\r | |
403 | \r | |
404 | //\r | |
405 | ////////////////////////////////////////////////////////////////////////////////////////////////////\r | |
406 | // Interface structure\r | |
407 | // EFI_IDE_CONTROLLER_INIT_PROTOCOL protocol provides the chipset specific information to the IDE bus driver.\r | |
408 | // An IDE Bus driver wants to manage an IDE bus and possible IDE devices will have to retrieve the\r | |
409 | // EFI_IDE_CONTROLLER_INIT_PROTOCOL instances.\r | |
410 | //\r | |
411 | /**\r | |
412 | @par Protocol Description:\r | |
413 | Provides the basic interfaces to abstract an IDE controller.\r | |
414 | \r | |
415 | @param GetChannelInfo\r | |
416 | Returns the information about a specific channel.\r | |
417 | \r | |
418 | @param NotifyPhase\r | |
419 | The notification that the IDE bus driver is about to enter the\r | |
420 | specified phase during the enumeration process.\r | |
421 | \r | |
422 | @param SubmitData\r | |
423 | Submits the Drive Identify data that was returned by the device.\r | |
424 | \r | |
425 | @param DisqualifyMode\r | |
426 | Submits information about modes that should be disqualified.\r | |
427 | \r | |
428 | @param CalculateMode\r | |
429 | Calculates and returns the optimum mode for a particular IDE device.\r | |
430 | \r | |
431 | @param SetTiming\r | |
432 | Programs the IDE controller hardware to the default timing or per the modes\r | |
433 | that were returned by the last call to CalculateMode().\r | |
434 | \r | |
435 | @param EnumAll\r | |
436 | Set to TRUE if the enumeration group includes all the channels that are\r | |
437 | produced by this controller. FALSE if an enumeration group consists of\r | |
438 | only one channel.\r | |
439 | \r | |
440 | @param ChannelCount\r | |
441 | The number of channels that are produced by this controller.\r | |
442 | \r | |
443 | **/\r | |
444 | struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL {\r | |
445 | EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo;\r | |
446 | EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase;\r | |
447 | EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData;\r | |
448 | EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode;\r | |
449 | EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode;\r | |
450 | EFI_IDE_CONTROLLER_SET_TIMING SetTiming;\r | |
451 | BOOLEAN EnumAll;\r | |
452 | UINT8 ChannelCount;\r | |
453 | };\r | |
454 | \r | |
455 | extern EFI_GUID gEfiIdeControllerInitProtocolGuid;\r | |
456 | \r | |
457 | #endif\r |