]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/IdeControllerInit.h
Add into MdePkg definitions for the EFI SMM Status Code Protocol as defined in the...
[mirror_edk2.git] / MdePkg / Include / Protocol / IdeControllerInit.h
CommitLineData
73c31a3d 1/** @file\r
2 This file declares EFI IDE Controller Init Protocol\r
3 \r
4 The EFI_IDE_CONTROLLER_INIT_PROTOCOL provides the chipset-specific information\r
5 to the IDE bus driver. This protocol is mandatory for IDE controllers if the\r
6 IDE devices behind the controller are to be enumerated by an IDE bus driver.\r
7 \r
8 There can only be one instance of EFI_IDE_CONTROLLER_INIT_PROTOCOL for each IDE\r
9 controller in a system. It is installed on the handle that corresponds to the\r
10 IDE controller. An IDE bus driver that wishes to manage an IDE bus and possibly\r
11 IDE devices in a system will have to retrieve the EFI_IDE_CONTROLLER_INIT_PROTOCOL\r
12 instance that is associated with the controller to be managed.\r
13 \r
14 A device handle for an IDE controller must contain an EFI_DEVICE_PATH_PROTOCOL.\r
15\r
16 Copyright (c) 2007 - 2009, Intel Corporation\r
17 All rights reserved. This program and the accompanying materials\r
18 are licensed and made available under the terms and conditions of the BSD License\r
19 which accompanies this distribution. The full text of the license may be found at\r
20 http://opensource.org/licenses/bsd-license.php\r
21\r
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
24\r
25 @par Revision Reference:\r
26 This Protocol is defined in UEFI Platform Initialization Specification 1.2 \r
27 Volume 5: Standards\r
28 \r
29**/\r
30\r
31#ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_\r
32#define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_\r
33\r
34///\r
35/// Global ID for the EFI_IDE_CONTROLLER_INIT_PROTOCOL\r
36///\r
37#define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \\r
38 { \\r
39 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } \\r
40 }\r
41\r
42///\r
43/// Forward declaration for EFI_IDE_CONTROLLER_INIT_PROTOCOL\r
44///\r
45typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL;\r
46\r
47///\r
48/// The phase of the IDE Controller enumeration\r
49///\r
50typedef enum {\r
51 ///\r
52 /// The IDE bus driver is about to begin enumerating the devices\r
53 /// behind the specified channel. This notification can be used to\r
54 /// perform any chipset-specific programming.\r
55 ///\r
56 EfiIdeBeforeChannelEnumeration,\r
57 ///\r
58 /// The IDE bus driver has completed enumerating the devices\r
59 /// behind the specified channel. This notification can be used to\r
60 /// perform any chipset-specific programming.\r
61 ///\r
62 EfiIdeAfterChannelEnumeration,\r
63 ///\r
64 /// The IDE bus driver is about to reset the devices behind the\r
65 /// specified channel. This notification can be used to perform any\r
66 /// chipset-specific programming.\r
67 ///\r
68 EfiIdeBeforeChannelReset,\r
69 ///\r
70 /// The IDE bus driver has completed resetting the devices behind\r
71 /// the specified channel. This notification can be used to perform\r
72 /// any chipset-specific programming. \r
73 ///\r
74 EfiIdeAfterChannelReset,\r
75 ///\r
76 /// The IDE bus driver is about to detect the presence of devices\r
77 /// behind the specified channel. This notification can be used to\r
78 /// set up the bus signals to default levels or for implementing\r
79 /// predelays.\r
80 ///\r
81 EfiIdeBusBeforeDevicePresenceDetection,\r
82 ///\r
83 /// The IDE bus driver is done with detecting the presence of\r
84 /// devices behind the specified channel. This notification can be\r
85 /// used to perform any chipset-specific programming. \r
86 ///\r
87 EfiIdeBusAfterDevicePresenceDetection,\r
88 ///\r
89 /// The IDE bus is requesting the IDE controller driver to\r
90 /// reprogram the IDE controller hardware and thereby reset all\r
91 /// the mode and timing settings to default settings. \r
92 ///\r
93 EfiIdeResetMode,\r
94 EfiIdeBusPhaseMaximum\r
95} EFI_IDE_CONTROLLER_ENUM_PHASE;\r
96\r
97///\r
98/// This extended mode describes the SATA physical protocol.\r
99/// SATA physical layers can operate at different speeds.\r
100/// These speeds are defined below. Various PATA protocols\r
101/// and associated modes are not applicable to SATA devices.\r
102///\r
103typedef enum {\r
104 EfiAtaSataTransferProtocol\r
105} EFI_ATA_EXT_TRANSFER_PROTOCOL;\r
106\r
107///\r
108/// Automatically detects the optimum SATA speed.\r
109///\r
110#define EFI_SATA_AUTO_SPEED 0\r
111\r
112///\r
113/// Indicates a first-generation (Gen1) SATA speed.\r
114///\r
115#define EFI_SATA_GEN1_SPEED 1\r
116\r
117///\r
118/// Indicates a second-generation (Gen2) SATA speed.\r
119///\r
120#define EFI_SATA_GEN2_SPEED 2\r
121\r
122///\r
123/// EFI_ATA_MODE structure\r
124///\r
125typedef struct {\r
126 BOOLEAN Valid; ///< TRUE if Mode is valid.\r
127 UINT32 Mode; ///< The actual ATA mode. This field is not a bit map.\r
128} EFI_ATA_MODE;\r
129\r
130///\r
131/// EFI_ATA_EXTENDED_MODE structure\r
132///\r
133typedef struct {\r
134 ///\r
135 /// An enumeration defining various transfer protocols other than the protocols\r
136 /// that exist at the time this specification was developed (i.e., PIO, single \r
137 /// word DMA, multiword DMA, and UDMA). Each transfer protocol is associated \r
138 /// with a mode. The various transfer protocols are defined by the ATA/ATAPI \r
139 /// specification. This enumeration makes the interface extensible because we \r
140 /// can support new transport protocols beyond UDMA. Type EFI_ATA_EXT_TRANSFER_PROTOCOL \r
141 /// is defined below.\r
142 ///\r
143 EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol;\r
144 ///\r
145 /// The mode for operating the transfer protocol that is identified by TransferProtocol.\r
146 ///\r
147 UINT32 Mode;\r
148} EFI_ATA_EXTENDED_MODE;\r
149\r
150///\r
151/// EFI_ATA_COLLECTIVE_MODE structure\r
152///\r
153typedef struct {\r
154 ///\r
155 /// This field specifies the PIO mode. PIO modes are defined in the ATA/ATAPI\r
156 /// specification. The ATA/ATAPI specification defines the enumeration. In \r
157 /// other words, a value of 1 in this field means PIO mode 1. The actual meaning\r
158 /// of PIO mode 1 is governed by the ATA/ATAPI specification. Type EFI_ATA_MODE\r
159 /// is defined below.\r
160 ///\r
161 EFI_ATA_MODE PioMode;\r
162 ///\r
163 /// This field specifies the single word DMA mode. Single word DMA modes are defined\r
164 /// in the ATA/ATAPI specification, versions 1 and 2. Single word DMA support was\r
165 /// obsoleted in the ATA/ATAPI specification, version 3; therefore, most devices and\r
166 /// controllers will not support this transfer mode. The ATA/ATAPI specification defines\r
167 /// the enumeration. In other words, a value of 1 in this field means single word DMA\r
168 /// mode 1. The actual meaning of single word DMA mode 1 is governed by the ATA/\r
169 /// ATAPI specification. \r
170 ///\r
171 EFI_ATA_MODE SingleWordDmaMode;\r
172 ///\r
173 /// This field specifies the multiword DMA mode. Various multiword DMA modes are\r
174 /// defined in the ATA/ATAPI specification. A value of 1 in this field means multiword\r
175 /// DMA mode 1. The actual meaning of multiword DMA mode 1 is governed by the\r
176 /// ATA/ATAPI specification. \r
177 ///\r
178 EFI_ATA_MODE MultiWordDmaMode;\r
179 ///\r
180 /// This field specifies the ultra DMA (UDMA) mode. UDMA modes are defined in the\r
181 /// ATA/ATAPI specification. A value of 1 in this field means UDMA mode 1. The\r
182 /// actual meaning of UDMA mode 1 is governed by the ATA/ATAPI specification. \r
183 ///\r
184 EFI_ATA_MODE UdmaMode;\r
185 ///\r
186 /// The number of extended-mode bitmap entries. Extended modes describe transfer\r
187 /// protocols beyond PIO, single word DMA, multiword DMA, and UDMA. This field\r
188 /// can be zero and provides extensibility. \r
189 ///\r
190 UINT32 ExtModeCount;\r
191 ///\r
192 /// ExtModeCount number of entries. Each entry represents a transfer protocol other\r
193 /// than the ones defined above (i.e., PIO, single word DMA, multiword DMA, and\r
194 /// UDMA). This field is defined for extensibility. At this time, only one extended\r
195 /// transfer protocol is defined to cover SATA transfers. Type\r
196 /// EFI_ATA_EXTENDED_MODE is defined below. \r
197 ///\r
198 EFI_ATA_EXTENDED_MODE ExtMode[1];\r
199} EFI_ATA_COLLECTIVE_MODE;\r
200\r
201///\r
202/// EFI_ATA_IDENTIFY_DATA structure\r
203///\r
204/// This structure definition is not part of the protocol\r
205/// definition because the ATA/ATAPI Specification controls\r
206/// the definition of all the fields. The ATA/ATAPI\r
207/// Specification can obsolete old fields or redefine existing\r
208/// fields. This definition is provided here for reference only.\r
209///\r
210#pragma pack(1)\r
211typedef struct {\r
212 UINT16 config; ///< General Configuration\r
213 UINT16 cylinders; ///< Number of Cylinders\r
214 UINT16 reserved_2;\r
215 UINT16 heads; ///< Number of logical heads\r
216 UINT16 vendor_data1;\r
217 UINT16 vendor_data2;\r
218 UINT16 sectors_per_track;\r
219 UINT16 vendor_specific_7_9[3];\r
220 CHAR8 SerialNo[20]; ///< ASCII\r
221 UINT16 vendor_specific_20_21[2];\r
222 UINT16 ecc_bytes_available;\r
223 CHAR8 FirmwareVer[8]; ///< ASCII\r
224 CHAR8 ModelName[40]; ///< ASCII\r
225 UINT16 multi_sector_cmd_max_sct_cnt;\r
226 UINT16 reserved_48;\r
227 UINT16 capabilities;\r
228 UINT16 reserved_50;\r
229 UINT16 pio_cycle_timing;\r
230 UINT16 reserved_52;\r
231 UINT16 field_validity;\r
232 UINT16 current_cylinders;\r
233 UINT16 current_heads;\r
234 UINT16 current_sectors;\r
235 UINT16 CurrentCapacityLsb;\r
236 UINT16 CurrentCapacityMsb;\r
237 UINT16 reserved_59;\r
238 UINT16 user_addressable_sectors_lo;\r
239 UINT16 user_addressable_sectors_hi;\r
240 UINT16 reserved_62;\r
241 UINT16 multi_word_dma_mode;\r
242 UINT16 advanced_pio_modes;\r
243 UINT16 min_multi_word_dma_cycle_time;\r
244 UINT16 rec_multi_word_dma_cycle_time;\r
245 UINT16 min_pio_cycle_time_without_flow_control;\r
246 UINT16 min_pio_cycle_time_with_flow_control;\r
247 UINT16 reserved_69_79[11];\r
248 UINT16 major_version_no;\r
249 UINT16 minor_version_no;\r
250 UINT16 command_set_supported_82; ///< word 82\r
251 UINT16 command_set_supported_83; ///< word 83\r
252 UINT16 command_set_feature_extn; ///< word 84\r
253 UINT16 command_set_feature_enb_85; ///< word 85\r
254 UINT16 command_set_feature_enb_86; ///< word 86\r
255 UINT16 command_set_feature_default; ///< word 87\r
256 UINT16 ultra_dma_mode; ///< word 88\r
257 UINT16 reserved_89_105[17];\r
258 UINT16 phy_logic_sector_support; ///< word 106\r
259 UINT16 reserved_107_116[10];\r
260 UINT16 logic_sector_size_lo; ///< word 117\r
261 UINT16 logic_sector_size_hi; ///< word 118\r
262 UINT16 reserved_119_127[9];\r
263 UINT16 security_status;\r
264 UINT16 vendor_data_129_159[31];\r
265 UINT16 reserved_160_208[49];\r
266 UINT16 alignment_logic_in_phy_blocks; ///< word 209\r
267 UINT16 reserved_210_255[46];\r
268} EFI_ATA_IDENTIFY_DATA;\r
269#pragma pack()\r
270\r
271///\r
272/// EFI_ATAPI_IDENTIFY_DATA structure\r
273///\r
274/// This structure definition is not part of the protocol\r
275/// definition because the ATA/ATAPI Specification controls\r
276/// the definition of all the fields. The ATA/ATAPI\r
277/// Specification can obsolete old fields or redefine existing\r
278/// fields. This definition is provided here for reference only.\r
279///\r
280#pragma pack(1)\r
281typedef struct {\r
282 UINT16 config; ///< General Configuration\r
283 UINT16 obsolete_1;\r
284 UINT16 specific_config;\r
285 UINT16 obsolete_3;\r
286 UINT16 retired_4_5[2];\r
287 UINT16 obsolete_6;\r
288 UINT16 cfa_reserved_7_8[2];\r
289 UINT16 retired_9;\r
290 CHAR8 SerialNo[20]; ///< ASCII\r
291 UINT16 retired_20_21[2];\r
292 UINT16 obsolete_22;\r
293 CHAR8 FirmwareVer[8]; ///< ASCII\r
294 CHAR8 ModelName[40]; ///< ASCII\r
295 UINT16 multi_sector_cmd_max_sct_cnt;\r
296 UINT16 reserved_48;\r
297 UINT16 capabilities_49;\r
298 UINT16 capabilities_50;\r
299 UINT16 obsolete_51_52[2];\r
300 UINT16 field_validity;\r
301 UINT16 obsolete_54_58[5];\r
302 UINT16 mutil_sector_setting;\r
303 UINT16 user_addressable_sectors_lo;\r
304 UINT16 user_addressable_sectors_hi;\r
305 UINT16 obsolete_62;\r
306 UINT16 multi_word_dma_mode;\r
307 UINT16 advanced_pio_modes;\r
308 UINT16 min_multi_word_dma_cycle_time;\r
309 UINT16 rec_multi_word_dma_cycle_time;\r
310 UINT16 min_pio_cycle_time_without_flow_control;\r
311 UINT16 min_pio_cycle_time_with_flow_control;\r
312 UINT16 reserved_69_74[6];\r
313 UINT16 queue_depth;\r
314 UINT16 reserved_76_79[4];\r
315 UINT16 major_version_no;\r
316 UINT16 minor_version_no;\r
317 UINT16 cmd_set_support_82;\r
318 UINT16 cmd_set_support_83;\r
319 UINT16 cmd_feature_support;\r
320 UINT16 cmd_feature_enable_85;\r
321 UINT16 cmd_feature_enable_86;\r
322 UINT16 cmd_feature_default;\r
323 UINT16 ultra_dma_select;\r
324 UINT16 time_required_for_sec_erase;\r
325 UINT16 time_required_for_enhanced_sec_erase;\r
326 UINT16 current_advanced_power_mgmt_value;\r
327 UINT16 master_pwd_revison_code;\r
328 UINT16 hardware_reset_result;\r
329 UINT16 current_auto_acoustic_mgmt_value;\r
330 UINT16 reserved_95_99[5];\r
331 UINT16 max_user_lba_for_48bit_addr[4];\r
332 UINT16 reserved_104_126[23];\r
333 UINT16 removable_media_status_notification_support;\r
334 UINT16 security_status;\r
335 UINT16 vendor_data_129_159[31];\r
336 UINT16 cfa_power_mode;\r
337 UINT16 cfa_reserved_161_175[15];\r
338 UINT16 current_media_serial_no[30];\r
339 UINT16 reserved_206_254[49];\r
340 UINT16 integrity_word;\r
341} EFI_ATAPI_IDENTIFY_DATA;\r
342#pragma pack()\r
343\r
344///\r
345/// This flag indicates whether the IDENTIFY data is a response from an ATA device\r
346/// (EFI_ATA_IDENTIFY_DATA) or response from an ATAPI device \r
347/// (EFI_ATAPI_IDENTIFY_DATA). According to the ATA/ATAPI specification,\r
348/// EFI_IDENTIFY_DATA is for an ATA device if bit 15 of the Config field is zero. \r
349/// The Config field is common to both EFI_ATA_IDENTIFY_DATA and \r
350/// EFI_ATAPI_IDENTIFY_DATA.\r
351///\r
352#define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000\r
353\r
354///\r
355/// EFI_IDENTIFY_DATA structure\r
356///\r
357typedef union {\r
358 ///\r
359 /// The data that is returned by an ATA device upon successful completion \r
360 /// of the ATA IDENTIFY_DEVICE command. \r
361 ///\r
362 EFI_ATA_IDENTIFY_DATA AtaData;\r
363 ///\r
364 /// The data that is returned by an ATAPI device upon successful completion\r
365 /// of the ATA IDENTIFY_PACKET_DEVICE command.\r
366 ///\r
367 EFI_ATAPI_IDENTIFY_DATA AtapiData;\r
368} EFI_IDENTIFY_DATA;\r
369\r
370/**\r
371 Returns the information about the specified IDE channel.\r
372 \r
373 This function can be used to obtain information about a particular IDE channel.\r
374 The IDE bus driver uses this information during the enumeration process. \r
375 \r
376 If Enabled is set to FALSE, the IDE bus driver will not scan the channel. Note \r
377 that it will not prevent an operating system driver from scanning the channel.\r
378 \r
379 For most of today's controllers, MaxDevices will either be 1 or 2. For SATA \r
380 controllers, this value will always be 1. SATA configurations can contain SATA \r
381 port multipliers. SATA port multipliers behave like SATA bridges and can support\r
382 up to 16 devices on the other side. If an SATA port out of the IDE controller \r
383 is connected to a port multiplier, MaxDevices will be set to the number of SATA \r
384 devices that the port multiplier supports. Because today's port multipliers \r
385 support up to 15 SATA devices, this number can be as large as 15. The IDE bus \r
386 driver is required to scan for the presence of port multipliers behind an SATA \r
387 controller and enumerate up to MaxDevices number of devices behind the port \r
388 multiplier. \r
389 \r
390 In this context, the devices behind a port multiplier constitute a channel. \r
391 \r
392 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
393 @param[in] Channel Zero-based channel number.\r
394 @param[out] Enabled TRUE if this channel is enabled. Disabled channels \r
395 are not scanned to see if any devices are present.\r
396 @param[out] MaxDevices The maximum number of IDE devices that the bus driver\r
397 can expect on this channel. For the ATA/ATAPI \r
398 specification, version 6, this number will either be \r
399 1 or 2. For Serial ATA (SATA) configurations with a \r
400 port multiplier, this number can be as large as 15.\r
401\r
402 @retval EFI_SUCCESS Information was returned without any errors.\r
403 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
404\r
405**/\r
406typedef\r
407EFI_STATUS\r
408(EFIAPI *EFI_IDE_CONTROLLER_GET_CHANNEL_INFO)(\r
409 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
410 IN UINT8 Channel,\r
411 OUT BOOLEAN *Enabled,\r
412 OUT UINT8 *MaxDevices\r
413 );\r
414\r
415/**\r
416 The notifications from the IDE bus driver that it is about to enter a certain\r
417 phase of the IDE channel enumeration process.\r
418 \r
419 This function can be used to notify the IDE controller driver to perform \r
420 specific actions, including any chipset-specific initialization, so that the \r
421 chipset is ready to enter the next phase. Seven notification points are defined \r
422 at this time. \r
423 \r
424 More synchronization points may be added as required in the future. \r
425\r
426 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
427 @param[in] Phase The phase during enumeration.\r
428 @param[in] Channel Zero-based channel number.\r
429\r
430 @retval EFI_SUCCESS The notification was accepted without any errors.\r
431 @retval EFI_NOT_SUPPORTED Phase is not supported.\r
432 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
433 @retval EFI_NOT_READY This phase cannot be entered at this time; for \r
434 example, an attempt was made to enter a Phase \r
435 without having entered one or more previous \r
436 Phase.\r
437\r
438**/\r
439typedef\r
440EFI_STATUS\r
441(EFIAPI *EFI_IDE_CONTROLLER_NOTIFY_PHASE)(\r
442 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
443 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,\r
444 IN UINT8 Channel\r
445 );\r
446\r
447/**\r
448 Submits the device information to the IDE controller driver.\r
449\r
450 This function is used by the IDE bus driver to pass detailed information about \r
451 a particular device to the IDE controller driver. The IDE bus driver obtains \r
452 this information by issuing an ATA or ATAPI IDENTIFY_DEVICE command. IdentifyData\r
453 is the pointer to the response data buffer. The IdentifyData buffer is owned \r
454 by the IDE bus driver, and the IDE controller driver must make a local copy \r
455 of the entire buffer or parts of the buffer as needed. The original IdentifyData \r
456 buffer pointer may not be valid when\r
457 \r
458 - EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() or\r
459 - EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode() is called at a later point.\r
460 \r
461 The IDE controller driver may consult various fields of EFI_IDENTIFY_DATA to \r
462 compute the optimum mode for the device. These fields are not limited to the \r
463 timing information. For example, an implementation of the IDE controller driver \r
464 may examine the vendor and type/mode field to match known bad drives. \r
465 \r
466 The IDE bus driver may submit drive information in any order, as long as it \r
467 submits information for all the devices belonging to the enumeration group \r
468 before EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() is called for any device\r
469 in that enumeration group. If a device is absent, EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()\r
470 should be called with IdentifyData set to NULL. The IDE controller driver may \r
471 not have any other mechanism to know whether a device is present or not. Therefore, \r
472 setting IdentifyData to NULL does not constitute an error condition. \r
473 EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData() can be called only once for a \r
474 given (Channel, Device) pair. \r
475 \r
476 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
477 @param[in] Channel Zero-based channel number.\r
478 @param[in] Device Zero-based device number on the Channel.\r
479 @param[in] IdentifyData The device's response to the ATA IDENTIFY_DEVICE command.\r
480\r
481 @retval EFI_SUCCESS The information was accepted without any errors.\r
482 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
483 @retval EFI_INVALID_PARAMETER Device is invalid.\r
484\r
485**/\r
486typedef\r
487EFI_STATUS\r
488(EFIAPI *EFI_IDE_CONTROLLER_SUBMIT_DATA)(\r
489 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
490 IN UINT8 Channel,\r
491 IN UINT8 Device,\r
492 IN EFI_IDENTIFY_DATA *IdentifyData\r
493 );\r
494\r
495/**\r
496 Disqualifies specific modes for an IDE device.\r
497\r
498 This function allows the IDE bus driver or other drivers (such as platform \r
499 drivers) to reject certain timing modes and request the IDE controller driver\r
500 to recalculate modes. This function allows the IDE bus driver and the IDE \r
501 controller driver to negotiate the timings on a per-device basis. This function \r
502 is useful in the case of drives that lie about their capabilities. An example \r
503 is when the IDE device fails to accept the timing modes that are calculated \r
504 by the IDE controller driver based on the response to the Identify Drive command.\r
505\r
506 If the IDE bus driver does not want to limit the ATA timing modes and leave that \r
507 decision to the IDE controller driver, it can either not call this function for \r
508 the given device or call this function and set the Valid flag to FALSE for all \r
509 modes that are listed in EFI_ATA_COLLECTIVE_MODE.\r
510 \r
511 The IDE bus driver may disqualify modes for a device in any order and any number \r
512 of times.\r
513 \r
514 This function can be called multiple times to invalidate multiple modes of the \r
515 same type (e.g., Programmed Input/Output [PIO] modes 3 and 4). See the ATA/ATAPI \r
516 specification for more information on PIO modes. \r
517 \r
518 For Serial ATA (SATA) controllers, this member function can be used to disqualify\r
519 a higher transfer rate mode on a given channel. For example, a platform driver\r
520 may inform the IDE controller driver to not use second-generation (Gen2) speeds \r
521 for a certain SATA drive.\r
522 \r
523 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
524 @param[in] Channel Zero-based channel number.\r
525 @param[in] Device Zero-based device number on the Channel.\r
526 @param[in] BadModes The modes that the device does not support and that\r
527 should be disqualified.\r
528\r
529 @retval EFI_SUCCESS The modes were accepted without any errors.\r
530 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
531 @retval EFI_INVALID_PARAMETER Device is invalid.\r
532 @retval EFI_INVALID_PARAMETER IdentifyData is NULL.\r
533 \r
534**/\r
535typedef\r
536EFI_STATUS\r
537(EFIAPI *EFI_IDE_CONTROLLER_DISQUALIFY_MODE)(\r
538 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
539 IN UINT8 Channel,\r
540 IN UINT8 Device,\r
541 IN EFI_ATA_COLLECTIVE_MODE *BadModes\r
542 );\r
543\r
544/**\r
545 Returns the information about the optimum modes for the specified IDE device.\r
546\r
547 This function is used by the IDE bus driver to obtain the optimum ATA modes for\r
548 a specific device. The IDE controller driver takes into account the following \r
549 while calculating the mode:\r
550 - The IdentifyData inputs to EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()\r
551 - The BadModes inputs to EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode()\r
552\r
553 The IDE bus driver is required to call EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData() \r
554 for all the devices that belong to an enumeration group before calling \r
555 EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() for any device in the same group. \r
556 \r
557 The IDE controller driver will use controller- and possibly platform-specific \r
558 algorithms to arrive at SupportedModes. The IDE controller may base its \r
559 decision on user preferences and other considerations as well. This function \r
560 may be called multiple times because the IDE bus driver may renegotiate the mode \r
561 with the IDE controller driver using EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode().\r
562 \r
563 The IDE bus driver may collect timing information for various devices in any \r
564 order. The IDE bus driver is responsible for making sure that all the dependencies\r
565 are satisfied; for example, the SupportedModes information for device A that \r
566 was previously returned may become stale after a call to \r
567 EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode() for device B.\r
568 \r
569 The buffer SupportedModes is allocated by the callee because the caller does \r
570 not necessarily know the size of the buffer. The type EFI_ATA_COLLECTIVE_MODE \r
571 is defined in a way that allows for future extensibility and can be of variable \r
572 length. This memory pool should be deallocated by the caller when it is no \r
573 longer necessary. \r
574 \r
575 The IDE controller driver for a Serial ATA (SATA) controller can use this \r
576 member function to force a lower speed (first-generation [Gen1] speeds on a \r
577 second-generation [Gen2]-capable hardware). The IDE controller driver can \r
578 also allow the IDE bus driver to stay with the speed that has been negotiated \r
579 by the physical layer.\r
580 \r
581 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
582 @param[in] Channel Zero-based channel number.\r
583 @param[in] Device Zero-based device number on the Channel.\r
584 @param[out] SupportedModes The optimum modes for the device.\r
585\r
586 @retval EFI_SUCCESS SupportedModes was returned.\r
587 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
588 @retval EFI_INVALID_PARAMETER Device is invalid. \r
589 @retval EFI_INVALID_PARAMETER SupportedModes is NULL.\r
590 @retval EFI_NOT_READY Modes cannot be calculated due to a lack of \r
591 data. This error may happen if \r
592 EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData() \r
593 and EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyData() \r
594 were not called for at least one drive in the \r
595 same enumeration group.\r
596\r
597**/\r
598typedef\r
599EFI_STATUS\r
600(EFIAPI *EFI_IDE_CONTROLLER_CALCULATE_MODE)(\r
601 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
602 IN UINT8 Channel,\r
603 IN UINT8 Device,\r
604 OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes\r
605 );\r
606\r
607/**\r
608 Commands the IDE controller driver to program the IDE controller hardware\r
609 so that the specified device can operate at the specified mode.\r
610\r
611 This function is used by the IDE bus driver to instruct the IDE controller \r
612 driver to program the IDE controller hardware to the specified modes. This \r
613 function can be called only once for a particular device. For a Serial ATA \r
614 (SATA) Advanced Host Controller Interface (AHCI) controller, no controller-\r
615 specific programming may be required.\r
616\r
617 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.\r
618 @param[in] Channel Zero-based channel number.\r
619 @param[in] Device Zero-based device number on the Channel.\r
620 @param[in] Modes The modes to set.\r
621\r
622 @retval EFI_SUCCESS The command was accepted without any errors.\r
623 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).\r
624 @retval EFI_INVALID_PARAMETER Device is invalid.\r
625 @retval EFI_NOT_READY Modes cannot be set at this time due to lack of data.\r
626 @retval EFI_DEVICE_ERROR Modes cannot be set due to hardware failure.\r
627 The IDE bus driver should not use this device.\r
628\r
629**/\r
630typedef\r
631EFI_STATUS\r
632(EFIAPI *EFI_IDE_CONTROLLER_SET_TIMING)(\r
633 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,\r
634 IN UINT8 Channel,\r
635 IN UINT8 Device,\r
636 IN EFI_ATA_COLLECTIVE_MODE *Modes\r
637 );\r
638\r
639///\r
640/// Provides the basic interfaces to abstract an IDE controller.\r
641///\r
642struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL {\r
643 ///\r
644 /// Returns the information about a specific channel.\r
645 ///\r
646 EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo;\r
647 \r
648 ///\r
649 /// The notification that the IDE bus driver is about to enter the\r
650 /// specified phase during the enumeration process. \r
651 ///\r
652 EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase;\r
653 \r
654 ///\r
655 /// Submits the Drive Identify data that was returned by the device.\r
656 ///\r
657 EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData;\r
658 \r
659 ///\r
660 /// Submits information about modes that should be disqualified. The specified \r
661 /// IDE device does not support these modes and these modes should not be \r
662 /// returned by EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode()\r
663 ///\r
664 EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode;\r
665 \r
666 ///\r
667 /// Calculates and returns the optimum mode for a particular IDE device.\r
668 ///\r
669 EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode;\r
670 \r
671 ///\r
672 /// Programs the IDE controller hardware to the default timing or per the modes\r
673 /// that were returned by the last call to EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode(). \r
674 ///\r
675 EFI_IDE_CONTROLLER_SET_TIMING SetTiming;\r
676 \r
677 ///\r
678 /// Set to TRUE if the enumeration group includes all the channels that are\r
679 /// produced by this controller. FALSE if an enumeration group consists of\r
680 /// only one channel. \r
681 ///\r
682 BOOLEAN EnumAll;\r
683 \r
684 ///\r
685 /// The number of channels that are produced by this controller. Parallel ATA\r
686 /// (PATA) controllers can support up to two channels. Advanced Host Controller \r
687 /// Interface (AHCI) Serial ATA (SATA) controllers can support up to 32 channels,\r
688 /// each of which can have up to one device. In the presence of a multiplier, \r
689 /// each channel can have 15 devices.\r
690 ///\r
691 UINT8 ChannelCount;\r
692};\r
693\r
694extern EFI_GUID gEfiIdeControllerInitProtocolGuid;\r
695\r
696#endif\r