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