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