]> git.proxmox.com Git - mirror_edk2.git/blob - IntelFrameworkPkg/Include/Protocol/IdeControllerInit.h
Adding top-level Conf directory for next generation of EDK II build infrastructure...
[mirror_edk2.git] / IntelFrameworkPkg / Include / Protocol / IdeControllerInit.h
1 /** @file
2 This file declares EFI IDE Controller Init Protocol
3
4 Copyright (c) 2007, Intel Corporation
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 Module Name: IdeControllerInit.h
14
15 @par Revision Reference:
16 This Protocol is defined in IDE Controller Initialization Protocol Specification
17 Version 0.9
18
19 **/
20
21 #ifndef _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
22 #define _EFI_IDE_CONTROLLER_INIT_PROTOCOL_H_
23
24 //
25 // Global ID for the EFI Platform IDE Protocol GUID
26 //
27 #define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \
28 { 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9 } }
29
30 //
31 // Forward reference for pure ANSI compatability
32 //
33 typedef struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL EFI_IDE_CONTROLLER_INIT_PROTOCOL;
34
35 //
36 //////////////////////////////////////////////////////////////////////////////////////////
37 // EFI_IDE_BUS_ENUMERATION_PHASE
38 // EFI_IDE_CONTROLLER_ENUM_PHASE
39 //
40 typedef enum{
41 EfiIdeBeforeChannelEnumeration,
42 EfiIdeAfterChannelEnumeration,
43 EfiIdeBeforeChannelReset,
44 EfiIdeAfterChannelReset,
45 EfiIdeBusBeforeDevicePresenceDetection,
46 EfiIdeBusAfterDevicePresenceDetection,
47 EfiIdeResetMode,
48 EfiIdeBusPhaseMaximum
49 } EFI_IDE_CONTROLLER_ENUM_PHASE;
50
51 //
52 //******************************************************
53 // EFI_ATA_EXT_TRANSFER_PROTOCOL
54 //******************************************************
55 //
56 // This extended mode describes the SATA physical protocol.
57 // SATA physical layers can operate at different speeds.
58 // These speeds are defined below. Various PATA protocols
59 // and associated modes are not applicable to SATA devices.
60 //
61
62 typedef enum {
63 EfiAtaSataTransferProtocol
64 } EFI_ATA_EXT_TRANSFER_PROTOCOL;
65
66 #define EFI_SATA_AUTO_SPEED 0
67 #define EFI_SATA_GEN1_SPEED 1
68 #define EFI_SATA_GEN2_SPEED 2
69
70 //
71 //*******************************************************
72 // EFI_IDE_CABLE_TYPE
73 //*******************************************************
74 //
75 typedef enum {
76 EfiIdeCableTypeUnknown,
77 EfiIdeCableType40pin,
78 EfiIdeCableType80Pin,
79 EfiIdeCableTypeSerial,
80 EfiIdeCableTypeMaximum
81 } EFI_IDE_CABLE_TYPE;
82
83 //
84 //******************************************************
85 // EFI_ATA_MODE
86 //******************************************************
87 //
88 typedef struct {
89 BOOLEAN Valid;
90 UINT32 Mode;
91 } EFI_ATA_MODE;
92
93 //
94 //******************************************************
95 // EFI_ATA_EXTENDED_MODE
96 //******************************************************
97 //
98 typedef struct {
99 EFI_ATA_EXT_TRANSFER_PROTOCOL TransferProtocol;
100 UINT32 Mode;
101 } EFI_ATA_EXTENDED_MODE;
102
103 //
104 //******************************************************
105 // EFI_ATA_COLLECTIVE_MODE
106 //******************************************************
107 //
108 typedef struct {
109 EFI_ATA_MODE PioMode;
110 EFI_ATA_MODE SingleWordDmaMode;
111 EFI_ATA_MODE MultiWordDmaMode;
112 EFI_ATA_MODE UdmaMode;
113 UINT32 ExtModeCount;
114 EFI_ATA_EXTENDED_MODE ExtMode[1];
115 } EFI_ATA_COLLECTIVE_MODE;
116
117 //
118 //*******************************************************
119 // EFI_ATA_IDENTIFY_DATA
120 //*******************************************************
121 //
122
123 #pragma pack(1)
124
125 typedef struct {
126 UINT16 config; // General Configuration
127 UINT16 cylinders; // Number of Cylinders
128 UINT16 reserved_2;
129 UINT16 heads; //Number of logical heads
130 UINT16 vendor_data1;
131 UINT16 vendor_data2;
132 UINT16 sectors_per_track;
133 UINT16 vendor_specific_7_9[3];
134 CHAR8 SerialNo[20]; // ASCII
135 UINT16 vendor_specific_20_21[2];
136 UINT16 ecc_bytes_available;
137 CHAR8 FirmwareVer[8]; // ASCII
138 CHAR8 ModelName[40]; // ASCII
139 UINT16 multi_sector_cmd_max_sct_cnt;
140 UINT16 reserved_48;
141 UINT16 capabilities;
142 UINT16 reserved_50;
143 UINT16 pio_cycle_timing;
144 UINT16 reserved_52;
145 UINT16 field_validity;
146 UINT16 current_cylinders;
147 UINT16 current_heads;
148 UINT16 current_sectors;
149 UINT16 CurrentCapacityLsb;
150 UINT16 CurrentCapacityMsb;
151 UINT16 reserved_59;
152 UINT16 user_addressable_sectors_lo;
153 UINT16 user_addressable_sectors_hi;
154 UINT16 reserved_62;
155 UINT16 multi_word_dma_mode;
156 UINT16 advanced_pio_modes;
157 UINT16 min_multi_word_dma_cycle_time;
158 UINT16 rec_multi_word_dma_cycle_time;
159 UINT16 min_pio_cycle_time_without_flow_control;
160 UINT16 min_pio_cycle_time_with_flow_control;
161 UINT16 reserved_69_79[11];
162 UINT16 major_version_no;
163 UINT16 minor_version_no;
164 UINT16 command_set_supported_82; // word 82
165 UINT16 command_set_supported_83; // word 83
166 UINT16 command_set_feature_extn; // word 84
167 UINT16 command_set_feature_enb_85; // word 85
168 UINT16 command_set_feature_enb_86; // word 86
169 UINT16 command_set_feature_default; // word 87
170 UINT16 ultra_dma_mode; // word 88
171 UINT16 reserved_89_127[39];
172 UINT16 security_status;
173 UINT16 vendor_data_129_159[31];
174 UINT16 reserved_160_255[96];
175 } EFI_ATA_IDENTIFY_DATA;
176
177 #pragma pack()
178 //
179 //*******************************************************
180 // EFI_ATAPI_IDENTIFY_DATA
181 //*******************************************************
182 //
183 #pragma pack(1)
184 typedef struct {
185 UINT16 config; // General Configuration
186 UINT16 obsolete_1;
187 UINT16 specific_config;
188 UINT16 obsolete_3;
189 UINT16 retired_4_5[2];
190 UINT16 obsolete_6;
191 UINT16 cfa_reserved_7_8[2];
192 UINT16 retired_9;
193 CHAR8 SerialNo[20]; // ASCII
194 UINT16 retired_20_21[2];
195 UINT16 obsolete_22;
196 CHAR8 FirmwareVer[8]; // ASCII
197 CHAR8 ModelName[40]; // ASCII
198 UINT16 multi_sector_cmd_max_sct_cnt;
199 UINT16 reserved_48;
200 UINT16 capabilities_49;
201 UINT16 capabilities_50;
202 UINT16 obsolete_51_52[2];
203 UINT16 field_validity;
204 UINT16 obsolete_54_58[5];
205 UINT16 mutil_sector_setting;
206 UINT16 user_addressable_sectors_lo;
207 UINT16 user_addressable_sectors_hi;
208 UINT16 obsolete_62;
209 UINT16 multi_word_dma_mode;
210 UINT16 advanced_pio_modes;
211 UINT16 min_multi_word_dma_cycle_time;
212 UINT16 rec_multi_word_dma_cycle_time;
213 UINT16 min_pio_cycle_time_without_flow_control;
214 UINT16 min_pio_cycle_time_with_flow_control;
215 UINT16 reserved_69_74[6];
216 UINT16 queue_depth;
217 UINT16 reserved_76_79[4];
218 UINT16 major_version_no;
219 UINT16 minor_version_no;
220 UINT16 cmd_set_support_82;
221 UINT16 cmd_set_support_83;
222 UINT16 cmd_feature_support;
223 UINT16 cmd_feature_enable_85;
224 UINT16 cmd_feature_enable_86;
225 UINT16 cmd_feature_default;
226 UINT16 ultra_dma_select;
227 UINT16 time_required_for_sec_erase;
228 UINT16 time_required_for_enhanced_sec_erase;
229 UINT16 current_advanced_power_mgmt_value;
230 UINT16 master_pwd_revison_code;
231 UINT16 hardware_reset_result;
232 UINT16 current_auto_acoustic_mgmt_value;
233 UINT16 reserved_95_99[5];
234 UINT16 max_user_lba_for_48bit_addr[4];
235 UINT16 reserved_104_126[23];
236 UINT16 removable_media_status_notification_support;
237 UINT16 security_status;
238 UINT16 vendor_data_129_159[31];
239 UINT16 cfa_power_mode;
240 UINT16 cfa_reserved_161_175[15];
241 UINT16 current_media_serial_no[30];
242 UINT16 reserved_206_254[49];
243 UINT16 integrity_word;
244 } EFI_ATAPI_IDENTIFY_DATA;
245
246 #pragma pack()
247 //
248 //*******************************************************
249 // EFI_IDENTIFY_DATA
250 //*******************************************************
251 //
252 typedef union {
253 EFI_ATA_IDENTIFY_DATA AtaData;
254 EFI_ATAPI_IDENTIFY_DATA AtapiData;
255 } EFI_IDENTIFY_DATA;
256
257 #define EFI_ATAPI_DEVICE_IDENTIFY_DATA 0x8000
258
259 //
260 /////////////////////////////////////////////////////////////////////////////////////////
261 // Function prototype declaration, for ANSI compatability
262 //
263 /**
264 Returns the information about the specified IDE channel.
265
266 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
267 @param Channel Zero-based channel number.
268 @param Enabled TRUE if this channel is enabled. Disabled channels are not scanned
269 to see if any devices are present.
270 @param MaxDevices The maximum number of IDE devices that the bus driver
271 can expect on this channel.
272
273 @retval EFI_SUCCESS Information was returned without any errors.
274 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
275
276 **/
277 typedef
278 EFI_STATUS
279 (EFIAPI *EFI_IDE_CONTROLLER_GET_CHANNEL_INFO) (
280 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
281 IN UINT8 Channel,
282 OUT BOOLEAN *Enabled,
283 OUT UINT8 *MaxDevices
284 );
285
286 /**
287 The notifications from the IDE bus driver that it is about to enter a certain
288 phase of the IDE channel enumeration process.
289
290 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
291 @param Phase The phase during enumeration.
292 @param Channel Zero-based channel number.
293
294 @retval EFI_SUCCESS The notification was accepted without any errors.
295 @retval EFI_NOT_SUPPORTED Phase is not supported.
296 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
297 @retval EFI_NOT_READY This phase cannot be entered at this time.
298
299 **/
300 typedef
301 EFI_STATUS
302 (EFIAPI *EFI_IDE_CONTROLLER_NOTIFY_PHASE) (
303 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
304 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
305 IN UINT8 Channel
306 );
307
308 /**
309 Submits the device information to the IDE controller driver.
310
311 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
312 @param Channel Zero-based channel number.
313 @param Device Zero-based device number on the Channel.
314 @param IdentifyData The device's response to the ATA IDENTIFY_DEVICE command.
315
316 @retval EFI_SUCCESS The information was accepted without any errors.
317 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
318 Or Device is invalid.
319
320 **/
321 typedef
322 EFI_STATUS
323 (EFIAPI *EFI_IDE_CONTROLLER_SUBMIT_DATA) (
324 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
325 IN UINT8 Channel,
326 IN UINT8 Device,
327 IN EFI_IDENTIFY_DATA *IdentifyData
328 );
329
330 /**
331 Disqualifies specific modes for an IDE device.
332
333 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
334 @param Channel Zero-based channel number.
335 @param Device Zero-based device number on the Channel.
336 @param BadModes The modes that the device does not support and that
337 should be disqualified.
338
339 @retval EFI_SUCCESS The modes were accepted without any errors.
340 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
341 Or Device is invalid.
342
343 **/
344 typedef
345 EFI_STATUS
346 (EFIAPI *EFI_IDE_CONTROLLER_DISQUALIFY_MODE) (
347 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
348 IN UINT8 Channel,
349 IN UINT8 Device,
350 IN EFI_ATA_COLLECTIVE_MODE *BadModes
351 );
352
353 /**
354 Returns the information about the optimum modes for the specified IDE device.
355
356 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
357 @param Channel Zero-based channel number.
358 @param Device Zero-based device number on the Channel.
359 @param SupportedModes The optimum modes for the device.
360
361 @retval EFI_SUCCESS SupportedModes was returned.
362 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
363 Or Device is invalid. Or SupportedModes is NULL.
364 @retval EFI_NOT_READY Modes cannot be calculated due to a lack of data.
365
366 **/
367 typedef
368 EFI_STATUS
369 (EFIAPI *EFI_IDE_CONTROLLER_CALCULATE_MODE) (
370 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
371 IN UINT8 Channel,
372 IN UINT8 Device,
373 OUT EFI_ATA_COLLECTIVE_MODE **SupportedModes
374 );
375
376 /**
377 Commands the IDE controller driver to program the IDE controller hardware
378 so that the specified device can operate at the specified mode.
379
380 @param This Pointer to the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
381 @param Channel Zero-based channel number.
382 @param Device Zero-based device number on the Channel.
383 @param Modes The modes to set.
384
385 @retval EFI_SUCCESS The command was accepted without any errors.
386 @retval EFI_INVALID_PARAMETER Channel is invalid (Channel >= ChannelCount).
387 Or Device is invalid.
388 @retval EFI_NOT_READY Modes cannot be set at this time due to lack of data.
389 @retval EFI_DEVICE_ERROR Modes cannot be set due to hardware failure.
390 The IDE bus driver should not use this device.
391
392 **/
393 typedef
394 EFI_STATUS
395 (EFIAPI *EFI_IDE_CONTROLLER_SET_TIMING) (
396 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
397 IN UINT8 Channel,
398 IN UINT8 Device,
399 IN EFI_ATA_COLLECTIVE_MODE *Modes
400 );
401
402 //
403 ////////////////////////////////////////////////////////////////////////////////////////////////////
404 // Interface structure
405 // EFI_IDE_CONTROLLER_INIT_PROTOCOL protocol provides the chipset specific information to the IDE bus driver.
406 // An IDE Bus driver wants to manage an IDE bus and possible IDE devices will have to retrieve the
407 // EFI_IDE_CONTROLLER_INIT_PROTOCOL instances.
408 //
409 /**
410 @par Protocol Description:
411 Provides the basic interfaces to abstract an IDE controller.
412
413 @param GetChannelInfo
414 Returns the information about a specific channel.
415
416 @param NotifyPhase
417 The notification that the IDE bus driver is about to enter the
418 specified phase during the enumeration process.
419
420 @param SubmitData
421 Submits the Drive Identify data that was returned by the device.
422
423 @param DisqualifyMode
424 Submits information about modes that should be disqualified.
425
426 @param CalculateMode
427 Calculates and returns the optimum mode for a particular IDE device.
428
429 @param SetTiming
430 Programs the IDE controller hardware to the default timing or per the modes
431 that were returned by the last call to CalculateMode().
432
433 @param EnumAll
434 Set to TRUE if the enumeration group includes all the channels that are
435 produced by this controller. FALSE if an enumeration group consists of
436 only one channel.
437
438 @param ChannelCount
439 The number of channels that are produced by this controller.
440
441 **/
442 struct _EFI_IDE_CONTROLLER_INIT_PROTOCOL {
443 EFI_IDE_CONTROLLER_GET_CHANNEL_INFO GetChannelInfo;
444 EFI_IDE_CONTROLLER_NOTIFY_PHASE NotifyPhase;
445 EFI_IDE_CONTROLLER_SUBMIT_DATA SubmitData;
446 EFI_IDE_CONTROLLER_DISQUALIFY_MODE DisqualifyMode;
447 EFI_IDE_CONTROLLER_CALCULATE_MODE CalculateMode;
448 EFI_IDE_CONTROLLER_SET_TIMING SetTiming;
449 BOOLEAN EnumAll;
450 UINT8 ChannelCount;
451 };
452
453 extern EFI_GUID gEfiIdeControllerInitProtocolGuid;
454
455 #endif