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