Vishal Bhoj | 82c8071 | 2015-12-15 21:13:33 +0530 | [diff] [blame^] | 1 | /** @file
|
| 2 | This file declares EFI IDE Controller Init Protocol
|
| 3 |
|
| 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.
|
| 7 |
|
| 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.
|
| 13 |
|
| 14 | A device handle for an IDE controller must contain an EFI_DEVICE_PATH_PROTOCOL.
|
| 15 |
|
| 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.
|
| 21 |
|
| 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.
|
| 24 |
|
| 25 | @par Revision Reference:
|
| 26 | This Protocol is defined in UEFI Platform Initialization Specification 1.2
|
| 27 | Volume 5: Standards.
|
| 28 |
|
| 29 | **/
|
| 30 |
|
| 31 | #ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
|
| 32 | #define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
|
| 33 |
|
| 34 | #include <IndustryStandard/Atapi.h>
|
| 35 |
|
| 36 | ///
|
| 37 | /// Global ID for the EFI_IDE_CONTROLLER_INIT_PROTOCOL.
|
| 38 | ///
|
| 39 | #define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \
|
| 40 | { \
|
| 41 | 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } \
|
| 42 | }
|
| 43 |
|
| 44 | ///
|
| 45 | /// Forward declaration for EFI_IDE_CONTROLLER_INIT_PROTOCOL.
|
| 46 | ///
|
| 47 | typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL;
|
| 48 |
|
| 49 | ///
|
| 50 | /// The phase of the IDE Controller enumeration.
|
| 51 | ///
|
| 52 | typedef enum {
|
| 53 | ///
|
| 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.
|
| 57 | ///
|
| 58 | EfiIdeBeforeChannelEnumeration,
|
| 59 | ///
|
| 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.
|
| 63 | ///
|
| 64 | EfiIdeAfterChannelEnumeration,
|
| 65 | ///
|
| 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.
|
| 69 | ///
|
| 70 | EfiIdeBeforeChannelReset,
|
| 71 | ///
|
| 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.
|
| 75 | ///
|
| 76 | EfiIdeAfterChannelReset,
|
| 77 | ///
|
| 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
|
| 81 | /// predelays.
|
| 82 | ///
|
| 83 | EfiIdeBusBeforeDevicePresenceDetection,
|
| 84 | ///
|
| 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.
|
| 88 | ///
|
| 89 | EfiIdeBusAfterDevicePresenceDetection,
|
| 90 | ///
|
| 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.
|
| 94 | ///
|
| 95 | EfiIdeResetMode,
|
| 96 | EfiIdeBusPhaseMaximum
|
| 97 | } EFI_IDE_CONTROLLER_ENUM_PHASE;
|
| 98 |
|
| 99 | ///
|
| 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.
|
| 104 | ///
|
| 105 | typedef enum {
|
| 106 | EfiAtaSataTransferProtocol
|
| 107 | } EFI_ATA_EXT_TRANSFER_PROTOCOL;
|
| 108 |
|
| 109 | ///
|
| 110 | /// Automatically detects the optimum SATA speed.
|
| 111 | ///
|
| 112 | #define EFI_SATA_AUTO_SPEED 0
|
| 113 |
|
| 114 | ///
|
| 115 | /// Indicates a first-generation (Gen1) SATA speed.
|
| 116 | ///
|
| 117 | #define EFI_SATA_GEN1_SPEED 1
|
| 118 |
|
| 119 | ///
|
| 120 | /// Indicates a second-generation (Gen2) SATA speed.
|
| 121 | ///
|
| 122 | #define EFI_SATA_GEN2_SPEED 2
|
| 123 |
|
| 124 | ///
|
| 125 | /// EFI_ATA_MODE structure.
|
| 126 | ///
|
| 127 | typedef struct {
|
| 128 | BOOLEAN Valid; ///< TRUE if Mode is valid.
|
| 129 | UINT32 Mode; ///< The actual ATA mode. This field is not a bit map.
|
| 130 | } EFI_ATA_MODE;
|
| 131 |
|
| 132 | ///
|
| 133 | /// EFI_ATA_EXTENDED_MODE structure
|
| 134 | ///
|
| 135 | typedef struct {
|
| 136 | ///
|
| 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.
|
| 144 | ///
|
| 145 | EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol;
|
| 146 | ///
|
| 147 | /// The mode for operating the transfer protocol that is identified by TransferProtocol.
|
| 148 | ///
|
| 149 | UINT32 Mode;
|
| 150 | } EFI_ATA_EXTENDED_MODE;
|
| 151 |
|
| 152 | ///
|
| 153 | /// EFI_ATA_COLLECTIVE_MODE structure.
|
| 154 | ///
|
| 155 | typedef struct {
|
| 156 | ///
|
| 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.
|
| 162 | ///
|
| 163 | EFI_ATA_MODE PioMode;
|
| 164 | ///
|
| 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.
|
| 172 | ///
|
| 173 | EFI_ATA_MODE SingleWordDmaMode;
|
| 174 | ///
|
| 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.
|
| 179 | ///
|
| 180 | EFI_ATA_MODE MultiWordDmaMode;
|
| 181 | ///
|
| 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.
|
| 185 | ///
|
| 186 | EFI_ATA_MODE UdmaMode;
|
| 187 | ///
|
| 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.
|
| 191 | ///
|
| 192 | UINT32 ExtModeCount;
|
| 193 | ///
|
| 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.
|
| 199 | ///
|
| 200 | EFI_ATA_EXTENDED_MODE ExtMode[1];
|
| 201 | } EFI_ATA_COLLECTIVE_MODE;
|
| 202 |
|
| 203 | ///
|
| 204 | /// EFI_ATA_IDENTIFY_DATA & EFI_ATAPI_IDENTIFY_DATA structure
|
| 205 | ///
|
| 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;
|
| 212 |
|
| 213 | ///
|
| 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.
|
| 220 | ///
|
| 221 | #define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000
|
| 222 |
|
| 223 | ///
|
| 224 | /// EFI_IDENTIFY_DATA structure.
|
| 225 | ///
|
| 226 | typedef union {
|
| 227 | ///
|
| 228 | /// The data that is returned by an ATA device upon successful completion
|
| 229 | /// of the ATA IDENTIFY_DEVICE command.
|
| 230 | ///
|
| 231 | EFI_ATA_IDENTIFY_DATA AtaData;
|
| 232 | ///
|
| 233 | /// The data that is returned by an ATAPI device upon successful completion
|
| 234 | /// of the ATA IDENTIFY_PACKET_DEVICE command.
|
| 235 | ///
|
| 236 | EFI_ATAPI_IDENTIFY_DATA AtapiData;
|
| 237 | } EFI_IDENTIFY_DATA;
|
| 238 |
|
| 239 | /**
|
| 240 | Returns the information about the specified IDE channel.
|
| 241 |
|
| 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.
|
| 244 |
|
| 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.
|
| 247 |
|
| 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
|
| 257 | multiplier.
|
| 258 |
|
| 259 | In this context, the devices behind a port multiplier constitute a channel.
|
| 260 |
|
| 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.
|
| 270 |
|
| 271 | @retval EFI_SUCCESS Information was returned without any errors.
|
| 272 | @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
|
| 273 |
|
| 274 | **/
|
| 275 | typedef
|
| 276 | EFI_STATUS
|
| 277 | (EFIAPI *EFI_IDE_CONTROLLER_GET_CHANNEL_INFO)(
|
| 278 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 279 | IN UINT8 Channel,
|
| 280 | OUT BOOLEAN *Enabled,
|
| 281 | OUT UINT8 *MaxDevices
|
| 282 | );
|
| 283 |
|
| 284 | /**
|
| 285 | The notifications from the driver entity that it is about to enter a certain
|
| 286 | phase of the IDE channel enumeration process.
|
| 287 |
|
| 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
|
| 291 | at this time.
|
| 292 |
|
| 293 | More synchronization points may be added as required in the future.
|
| 294 |
|
| 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.
|
| 298 |
|
| 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
|
| 305 | Phase.
|
| 306 |
|
| 307 | **/
|
| 308 | typedef
|
| 309 | EFI_STATUS
|
| 310 | (EFIAPI *EFI_IDE_CONTROLLER_NOTIFY_PHASE)(
|
| 311 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 312 | IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
|
| 313 | IN UINT8 Channel
|
| 314 | );
|
| 315 |
|
| 316 | /**
|
| 317 | Submits the device information to the IDE controller driver.
|
| 318 |
|
| 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
|
| 326 |
|
| 327 | - EFI_IDE_CONTROLLER_INIT_PROTOCOL.CalculateMode() or
|
| 328 | - EFI_IDE_CONTROLLER_INIT_PROTOCOL.DisqualifyMode() is called at a later point.
|
| 329 |
|
| 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.
|
| 334 |
|
| 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.
|
| 344 |
|
| 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.
|
| 349 |
|
| 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.
|
| 353 |
|
| 354 | **/
|
| 355 | typedef
|
| 356 | EFI_STATUS
|
| 357 | (EFIAPI *EFI_IDE_CONTROLLER_SUBMIT_DATA)(
|
| 358 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 359 | IN UINT8 Channel,
|
| 360 | IN UINT8 Device,
|
| 361 | IN EFI_IDENTIFY_DATA *IdentifyData
|
| 362 | );
|
| 363 |
|
| 364 | /**
|
| 365 | Disqualifies specific modes for an IDE device.
|
| 366 |
|
| 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.
|
| 374 |
|
| 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.
|
| 379 |
|
| 380 | The driver entity may disqualify modes for a device in any order and any number
|
| 381 | of times.
|
| 382 |
|
| 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.
|
| 386 |
|
| 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.
|
| 391 |
|
| 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.
|
| 397 |
|
| 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.
|
| 402 |
|
| 403 | **/
|
| 404 | typedef
|
| 405 | EFI_STATUS
|
| 406 | (EFIAPI *EFI_IDE_CONTROLLER_DISQUALIFY_MODE)(
|
| 407 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 408 | IN UINT8 Channel,
|
| 409 | IN UINT8 Device,
|
| 410 | IN EFI_ATA_COLLECTIVE_MODE *BadModes
|
| 411 | );
|
| 412 |
|
| 413 | /**
|
| 414 | Returns the information about the optimum modes for the specified IDE device.
|
| 415 |
|
| 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()
|
| 421 |
|
| 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.
|
| 425 |
|
| 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().
|
| 431 |
|
| 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.
|
| 437 |
|
| 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
|
| 442 | longer necessary.
|
| 443 |
|
| 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.
|
| 449 |
|
| 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.
|
| 454 |
|
| 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.
|
| 465 |
|
| 466 | **/
|
| 467 | typedef
|
| 468 | EFI_STATUS
|
| 469 | (EFIAPI *EFI_IDE_CONTROLLER_CALCULATE_MODE)(
|
| 470 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 471 | IN UINT8 Channel,
|
| 472 | IN UINT8 Device,
|
| 473 | OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
|
| 474 | );
|
| 475 |
|
| 476 | /**
|
| 477 | Commands the IDE controller driver to program the IDE controller hardware
|
| 478 | so that the specified device can operate at the specified mode.
|
| 479 |
|
| 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.
|
| 485 |
|
| 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.
|
| 490 |
|
| 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.
|
| 497 |
|
| 498 | **/
|
| 499 | typedef
|
| 500 | EFI_STATUS
|
| 501 | (EFIAPI *EFI_IDE_CONTROLLER_SET_TIMING)(
|
| 502 | IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
|
| 503 | IN UINT8 Channel,
|
| 504 | IN UINT8 Device,
|
| 505 | IN EFI_ATA_COLLECTIVE_MODE *Modes
|
| 506 | );
|
| 507 |
|
| 508 | ///
|
| 509 | /// Provides the basic interfaces to abstract an IDE controller.
|
| 510 | ///
|
| 511 | struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL {
|
| 512 | ///
|
| 513 | /// Returns the information about a specific channel.
|
| 514 | ///
|
| 515 | EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo;
|
| 516 |
|
| 517 | ///
|
| 518 | /// The notification that the driver entity is about to enter the
|
| 519 | /// specified phase during the enumeration process.
|
| 520 | ///
|
| 521 | EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase;
|
| 522 |
|
| 523 | ///
|
| 524 | /// Submits the Drive Identify data that was returned by the device.
|
| 525 | ///
|
| 526 | EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData;
|
| 527 |
|
| 528 | ///
|
| 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()
|
| 532 | ///
|
| 533 | EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode;
|
| 534 |
|
| 535 | ///
|
| 536 | /// Calculates and returns the optimum mode for a particular IDE device.
|
| 537 | ///
|
| 538 | EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode;
|
| 539 |
|
| 540 | ///
|
| 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().
|
| 543 | ///
|
| 544 | EFI_IDE_CONTROLLER_SET_TIMING SetTiming;
|
| 545 |
|
| 546 | ///
|
| 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.
|
| 550 | ///
|
| 551 | BOOLEAN EnumAll;
|
| 552 |
|
| 553 | ///
|
| 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.
|
| 559 | ///
|
| 560 | UINT8 ChannelCount;
|
| 561 | };
|
| 562 |
|
| 563 | extern EFI_GUID gEfiIdeControllerInitProtocolGuid;
|
| 564 |
|
| 565 | #endif
|