2 This file declares EFI IDE Controller Init Protocol
4 The EFI_IDE_CONTROLLER_INIT_PROTOCOL provides the chipset-specific information
5 to the driver entity. This protocol is mandatory for IDE controllers if the
6 IDE devices behind the controller are to be enumerated by a driver entity.
8 There can only be one instance of EFI_IDE_CONTROLLER_INIT_PROTOCOL for each IDE
9 controller in a system. It is installed on the handle that corresponds to the
10 IDE controller. A driver entity that wishes to manage an IDE bus and possibly
11 IDE devices in a system will have to retrieve the EFI_IDE_CONTROLLER_INIT_PROTOCOL
12 instance that is associated with the controller to be managed.
14 A device handle for an IDE controller must contain an EFI_DEVICE_PATH_PROTOCOL.
16 Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
17 This program and the accompanying materials are licensed and made available under
18 the terms and conditions of the BSD License that accompanies this distribution.
19 The full text of the license may be found at
20 http://opensource.org/licenses/bsd-license.php.
22 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
23 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
25 @par Revision Reference:
26 This Protocol is defined in UEFI Platform Initialization Specification 1.2
31 #ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
32 #define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
34 #include <IndustryStandard/Atapi.h>
37 /// Global ID for the EFI_IDE_CONTROLLER_INIT_PROTOCOL.
39 #define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \
41 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } \
45 /// Forward declaration for EFI_IDE_CONTROLLER_INIT_PROTOCOL.
47 typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL
;
50 /// The phase of the IDE Controller enumeration.
54 /// The driver entity is about to begin enumerating the devices
55 /// behind the specified channel. This notification can be used to
56 /// perform any chipset-specific programming.
58 EfiIdeBeforeChannelEnumeration
,
60 /// The driver entity has completed enumerating the devices
61 /// behind the specified channel. This notification can be used to
62 /// perform any chipset-specific programming.
64 EfiIdeAfterChannelEnumeration
,
66 /// The driver entity is about to reset the devices behind the
67 /// specified channel. This notification can be used to perform any
68 /// chipset-specific programming.
70 EfiIdeBeforeChannelReset
,
72 /// The driver entity has completed resetting the devices behind
73 /// the specified channel. This notification can be used to perform
74 /// any chipset-specific programming.
76 EfiIdeAfterChannelReset
,
78 /// The driver entity is about to detect the presence of devices
79 /// behind the specified channel. This notification can be used to
80 /// set up the bus signals to default levels or for implementing
83 EfiIdeBusBeforeDevicePresenceDetection
,
85 /// The driver entity is done with detecting the presence of
86 /// devices behind the specified channel. This notification can be
87 /// used to perform any chipset-specific programming.
89 EfiIdeBusAfterDevicePresenceDetection
,
91 /// The IDE bus is requesting the IDE controller driver to
92 /// reprogram the IDE controller hardware and thereby reset all
93 /// the mode and timing settings to default settings.
97 } EFI_IDE_CONTROLLER_ENUM_PHASE
;
100 /// This extended mode describes the SATA physical protocol.
101 /// SATA physical layers can operate at different speeds.
102 /// These speeds are defined below. Various PATA protocols
103 /// and associated modes are not applicable to SATA devices.
106 EfiAtaSataTransferProtocol
107 } EFI_ATA_EXT_TRANSFER_PROTOCOL
;
110 /// Automatically detects the optimum SATA speed.
112 #define EFI_SATA_AUTO_SPEED 0
115 /// Indicates a first-generation (Gen1) SATA speed.
117 #define EFI_SATA_GEN1_SPEED 1
120 /// Indicates a second-generation (Gen2) SATA speed.
122 #define EFI_SATA_GEN2_SPEED 2
125 /// EFI_ATA_MODE structure.
128 BOOLEAN Valid
; ///< TRUE if Mode is valid.
129 UINT32 Mode
; ///< The actual ATA mode. This field is not a bit map.
133 /// EFI_ATA_EXTENDED_MODE structure
137 /// An enumeration defining various transfer protocols other than the protocols
138 /// that exist at the time this specification was developed (i.e., PIO, single
139 /// word DMA, multiword DMA, and UDMA). Each transfer protocol is associated
140 /// with a mode. The various transfer protocols are defined by the ATA/ATAPI
141 /// specification. This enumeration makes the interface extensible because we
142 /// can support new transport protocols beyond UDMA. Type EFI_ATA_EXT_TRANSFER_PROTOCOL
143 /// is defined below.
145 EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol
;
147 /// The mode for operating the transfer protocol that is identified by TransferProtocol.
150 } EFI_ATA_EXTENDED_MODE
;
153 /// EFI_ATA_COLLECTIVE_MODE structure.
157 /// This field specifies the PIO mode. PIO modes are defined in the ATA/ATAPI
158 /// specification. The ATA/ATAPI specification defines the enumeration. In
159 /// other words, a value of 1 in this field means PIO mode 1. The actual meaning
160 /// of PIO mode 1 is governed by the ATA/ATAPI specification. Type EFI_ATA_MODE
161 /// is defined below.
163 EFI_ATA_MODE PioMode
;
165 /// This field specifies the single word DMA mode. Single word DMA modes are defined
166 /// in the ATA/ATAPI specification, versions 1 and 2. Single word DMA support was
167 /// obsoleted in the ATA/ATAPI specification, version 3. Therefore, most devices and
168 /// controllers will not support this transfer mode. The ATA/ATAPI specification defines
169 /// the enumeration. In other words, a value of 1 in this field means single word DMA
170 /// mode 1. The actual meaning of single word DMA mode 1 is governed by the ATA/
171 /// ATAPI specification.
173 EFI_ATA_MODE SingleWordDmaMode
;
175 /// This field specifies the multiword DMA mode. Various multiword DMA modes are
176 /// defined in the ATA/ATAPI specification. A value of 1 in this field means multiword
177 /// DMA mode 1. The actual meaning of multiword DMA mode 1 is governed by the
178 /// ATA/ATAPI specification.
180 EFI_ATA_MODE MultiWordDmaMode
;
182 /// This field specifies the ultra DMA (UDMA) mode. UDMA modes are defined in the
183 /// ATA/ATAPI specification. A value of 1 in this field means UDMA mode 1. The
184 /// actual meaning of UDMA mode 1 is governed by the ATA/ATAPI specification.
186 EFI_ATA_MODE UdmaMode
;
188 /// The number of extended-mode bitmap entries. Extended modes describe transfer
189 /// protocols beyond PIO, single word DMA, multiword DMA, and UDMA. This field
190 /// can be zero and provides extensibility.
194 /// ExtModeCount number of entries. Each entry represents a transfer protocol other
195 /// than the ones defined above (i.e., PIO, single word DMA, multiword DMA, and
196 /// UDMA). This field is defined for extensibility. At this time, only one extended
197 /// transfer protocol is defined to cover SATA transfers. Type
198 /// EFI_ATA_EXTENDED_MODE is defined below.
200 EFI_ATA_EXTENDED_MODE ExtMode
[1];
201 } EFI_ATA_COLLECTIVE_MODE
;
204 /// EFI_ATA_IDENTIFY_DATA & EFI_ATAPI_IDENTIFY_DATA structure
206 /// The definition of these two structures is not part of the protocol
207 /// definition because the ATA/ATAPI Specification controls the definition
208 /// of all the fields. The ATA/ATAPI Specification can obsolete old fields
209 /// or redefine existing fields.
210 typedef ATA_IDENTIFY_DATA EFI_ATA_IDENTIFY_DATA
;
211 typedef ATAPI_IDENTIFY_DATA EFI_ATAPI_IDENTIFY_DATA
;
214 /// This flag indicates whether the IDENTIFY data is a response from an ATA device
215 /// (EFI_ATA_IDENTIFY_DATA) or response from an ATAPI device
216 /// (EFI_ATAPI_IDENTIFY_DATA). According to the ATA/ATAPI specification,
217 /// EFI_IDENTIFY_DATA is for an ATA device if bit 15 of the Config field is zero.
218 /// The Config field is common to both EFI_ATA_IDENTIFY_DATA and
219 /// EFI_ATAPI_IDENTIFY_DATA.
221 #define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000
224 /// EFI_IDENTIFY_DATA structure.
228 /// The data that is returned by an ATA device upon successful completion
229 /// of the ATA IDENTIFY_DEVICE command.
231 EFI_ATA_IDENTIFY_DATA AtaData
;
233 /// The data that is returned by an ATAPI device upon successful completion
234 /// of the ATA IDENTIFY_PACKET_DEVICE command.
236 EFI_ATAPI_IDENTIFY_DATA AtapiData
;
240 Returns the information about the specified IDE channel.
242 This function can be used to obtain information about a particular IDE channel.
243 The driver entity uses this information during the enumeration process.
245 If Enabled is set to FALSE, the driver entity will not scan the channel. Note
246 that it will not prevent an operating system driver from scanning the channel.
248 For most of today's controllers, MaxDevices will either be 1 or 2. For SATA
249 controllers, this value will always be 1. SATA configurations can contain SATA
250 port multipliers. SATA port multipliers behave like SATA bridges and can support
251 up to 16 devices on the other side. If a SATA port out of the IDE controller
252 is connected to a port multiplier, MaxDevices will be set to the number of SATA
253 devices that the port multiplier supports. Because today's port multipliers
254 support up to fifteen SATA devices, this number can be as large as fifteen. The IDE
255 bus driver is required to scan for the presence of port multipliers behind an SATA
256 controller and enumerate up to MaxDevices number of devices behind the port
259 In this context, the devices behind a port multiplier constitute a channel.
261 @param[in] This The pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
262 @param[in] Channel Zero-based channel number.
263 @param[out] Enabled TRUE if this channel is enabled. Disabled channels
264 are not scanned to see if any devices are present.
265 @param[out] MaxDevices The maximum number of IDE devices that the bus driver
266 can expect on this channel. For the ATA/ATAPI
267 specification, version 6, this number will either be
268 one or two. For Serial ATA (SATA) configurations with a
269 port multiplier, this number can be as large as fifteen.
271 @retval EFI_SUCCESS Information was returned without any errors.
272 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
277 (EFIAPI
*EFI_IDE_CONTROLLER_GET_CHANNEL_INFO
)(
278 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
280 OUT BOOLEAN
*Enabled
,
281 OUT UINT8
*MaxDevices
285 The notifications from the driver entity that it is about to enter a certain
286 phase of the IDE channel enumeration process.
288 This function can be used to notify the IDE controller driver to perform
289 specific actions, including any chipset-specific initialization, so that the
290 chipset is ready to enter the next phase. Seven notification points are defined
293 More synchronization points may be added as required in the future.
295 @param[in] This The pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
296 @param[in] Phase The phase during enumeration.
297 @param[in] Channel Zero-based channel number.
299 @retval EFI_SUCCESS The notification was accepted without any errors.
300 @retval EFI_UNSUPPORTED Phase is not supported.
301 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
302 @retval EFI_NOT_READY This phase cannot be entered at this time; for
303 example, an attempt was made to enter a Phase
304 without having entered one or more previous
310 (EFIAPI
*EFI_IDE_CONTROLLER_NOTIFY_PHASE
)(
311 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
312 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase
,
317 Submits the device information to the IDE controller driver.
319 This function is used by the driver entity to pass detailed information about
320 a particular device to the IDE controller driver. The driver entity obtains
321 this information by issuing an ATA or ATAPI IDENTIFY_DEVICE command. IdentifyData
322 is the pointer to the response data buffer. The IdentifyData buffer is owned
323 by the driver entity, and the IDE controller driver must make a local copy
324 of the entire buffer or parts of the buffer as needed. The original IdentifyData
325 buffer pointer may not be valid when
327 - EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() or
328 - EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode() is called at a later point.
330 The IDE controller driver may consult various fields of EFI_IDENTIFY_DATA to
331 compute the optimum mode for the device. These fields are not limited to the
332 timing information. For example, an implementation of the IDE controller driver
333 may examine the vendor and type/mode field to match known bad drives.
335 The driver entity may submit drive information in any order, as long as it
336 submits information for all the devices belonging to the enumeration group
337 before EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() is called for any device
338 in that enumeration group. If a device is absent, EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()
339 should be called with IdentifyData set to NULL. The IDE controller driver may
340 not have any other mechanism to know whether a device is present or not. Therefore,
341 setting IdentifyData to NULL does not constitute an error condition.
342 EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData() can be called only once for a
343 given (Channel, Device) pair.
345 @param[in] This A pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
346 @param[in] Channel Zero-based channel number.
347 @param[in] Device Zero-based device number on the Channel.
348 @param[in] IdentifyData The device's response to the ATA IDENTIFY_DEVICE command.
350 @retval EFI_SUCCESS The information was accepted without any errors.
351 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
352 @retval EFI_INVALID_PARAMETER Device is invalid.
357 (EFIAPI
*EFI_IDE_CONTROLLER_SUBMIT_DATA
)(
358 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
361 IN EFI_IDENTIFY_DATA
*IdentifyData
365 Disqualifies specific modes for an IDE device.
367 This function allows the driver entity or other drivers (such as platform
368 drivers) to reject certain timing modes and request the IDE controller driver
369 to recalculate modes. This function allows the driver entity and the IDE
370 controller driver to negotiate the timings on a per-device basis. This function
371 is useful in the case of drives that lie about their capabilities. An example
372 is when the IDE device fails to accept the timing modes that are calculated
373 by the IDE controller driver based on the response to the Identify Drive command.
375 If the driver entity does not want to limit the ATA timing modes and leave that
376 decision to the IDE controller driver, it can either not call this function for
377 the given device or call this function and set the Valid flag to FALSE for all
378 modes that are listed in EFI_ATA_COLLECTIVE_MODE.
380 The driver entity may disqualify modes for a device in any order and any number
383 This function can be called multiple times to invalidate multiple modes of the
384 same type (e.g., Programmed Input/Output [PIO] modes 3 and 4). See the ATA/ATAPI
385 specification for more information on PIO modes.
387 For Serial ATA (SATA) controllers, this member function can be used to disqualify
388 a higher transfer rate mode on a given channel. For example, a platform driver
389 may inform the IDE controller driver to not use second-generation (Gen2) speeds
390 for a certain SATA drive.
392 @param[in] This The pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
393 @param[in] Channel The zero-based channel number.
394 @param[in] Device The zero-based device number on the Channel.
395 @param[in] BadModes The modes that the device does not support and that
396 should be disqualified.
398 @retval EFI_SUCCESS The modes were accepted without any errors.
399 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
400 @retval EFI_INVALID_PARAMETER Device is invalid.
401 @retval EFI_INVALID_PARAMETER IdentifyData is NULL.
406 (EFIAPI
*EFI_IDE_CONTROLLER_DISQUALIFY_MODE
)(
407 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
410 IN EFI_ATA_COLLECTIVE_MODE
*BadModes
414 Returns the information about the optimum modes for the specified IDE device.
416 This function is used by the driver entity to obtain the optimum ATA modes for
417 a specific device. The IDE controller driver takes into account the following
418 while calculating the mode:
419 - The IdentifyData inputs to EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()
420 - The BadModes inputs to EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode()
422 The driver entity is required to call EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()
423 for all the devices that belong to an enumeration group before calling
424 EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() for any device in the same group.
426 The IDE controller driver will use controller- and possibly platform-specific
427 algorithms to arrive at SupportedModes. The IDE controller may base its
428 decision on user preferences and other considerations as well. This function
429 may be called multiple times because the driver entity may renegotiate the mode
430 with the IDE controller driver using EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode().
432 The driver entity may collect timing information for various devices in any
433 order. The driver entity is responsible for making sure that all the dependencies
434 are satisfied. For example, the SupportedModes information for device A that
435 was previously returned may become stale after a call to
436 EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode() for device B.
438 The buffer SupportedModes is allocated by the callee because the caller does
439 not necessarily know the size of the buffer. The type EFI_ATA_COLLECTIVE_MODE
440 is defined in a way that allows for future extensibility and can be of variable
441 length. This memory pool should be deallocated by the caller when it is no
444 The IDE controller driver for a Serial ATA (SATA) controller can use this
445 member function to force a lower speed (first-generation [Gen1] speeds on a
446 second-generation [Gen2]-capable hardware). The IDE controller driver can
447 also allow the driver entity to stay with the speed that has been negotiated
448 by the physical layer.
450 @param[in] This The pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
451 @param[in] Channel A zero-based channel number.
452 @param[in] Device A zero-based device number on the Channel.
453 @param[out] SupportedModes The optimum modes for the device.
455 @retval EFI_SUCCESS SupportedModes was returned.
456 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
457 @retval EFI_INVALID_PARAMETER Device is invalid.
458 @retval EFI_INVALID_PARAMETER SupportedModes is NULL.
459 @retval EFI_NOT_READY Modes cannot be calculated due to a lack of
460 data. This error may happen if
461 EFI_IDE_CONTROLLER_INIT_PROTOCOL.SubmitData()
462 and EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyData()
463 were not called for at least one drive in the
464 same enumeration group.
469 (EFIAPI
*EFI_IDE_CONTROLLER_CALCULATE_MODE
)(
470 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
473 OUT EFI_ATA_COLLECTIVE_MODE
**SupportedModes
477 Commands the IDE controller driver to program the IDE controller hardware
478 so that the specified device can operate at the specified mode.
480 This function is used by the driver entity to instruct the IDE controller
481 driver to program the IDE controller hardware to the specified modes. This
482 function can be called only once for a particular device. For a Serial ATA
483 (SATA) Advanced Host Controller Interface (AHCI) controller, no controller-
484 specific programming may be required.
486 @param[in] This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
487 @param[in] Channel Zero-based channel number.
488 @param[in] Device Zero-based device number on the Channel.
489 @param[in] Modes The modes to set.
491 @retval EFI_SUCCESS The command was accepted without any errors.
492 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
493 @retval EFI_INVALID_PARAMETER Device is invalid.
494 @retval EFI_NOT_READY Modes cannot be set at this time due to lack of data.
495 @retval EFI_DEVICE_ERROR Modes cannot be set due to hardware failure.
496 The driver entity should not use this device.
501 (EFIAPI
*EFI_IDE_CONTROLLER_SET_TIMING
)(
502 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL
*This
,
505 IN EFI_ATA_COLLECTIVE_MODE
*Modes
509 /// Provides the basic interfaces to abstract an IDE controller.
511 struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL
{
513 /// Returns the information about a specific channel.
515 EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo
;
518 /// The notification that the driver entity is about to enter the
519 /// specified phase during the enumeration process.
521 EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase
;
524 /// Submits the Drive Identify data that was returned by the device.
526 EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData
;
529 /// Submits information about modes that should be disqualified. The specified
530 /// IDE device does not support these modes and these modes should not be
531 /// returned by EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode()
533 EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode
;
536 /// Calculates and returns the optimum mode for a particular IDE device.
538 EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode
;
541 /// Programs the IDE controller hardware to the default timing or per the modes
542 /// that were returned by the last call to EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode().
544 EFI_IDE_CONTROLLER_SET_TIMING SetTiming
;
547 /// Set to TRUE if the enumeration group includes all the channels that are
548 /// produced by this controller. Set to FALSE if an enumeration group consists of
549 /// only one channel.
554 /// The number of channels that are produced by this controller. Parallel ATA
555 /// (PATA) controllers can support up to two channels. Advanced Host Controller
556 /// Interface (AHCI) Serial ATA (SATA) controllers can support up to 32 channels,
557 /// each of which can have up to one device. In the presence of a multiplier,
558 /// each channel can have fifteen devices.
563 extern EFI_GUID gEfiIdeControllerInitProtocolGuid
;