summaryrefslogtreecommitdiff
path: root/Include/Protocol/AtaPassThru.h
blob: 0196ee46b6a0c3f8f97e8c1d172b2f1c5f0ea094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************

//*************************************************************************
// $Header: /Alaska/BIN/Core/Include/Protocol/AtaPassThru.h 1     6/13/11 6:35p Artems $
//
// $Revision: 1 $
//
// $Date: 6/13/11 6:35p $
//*************************************************************************
// Revision History
// ----------------
// $Log: /Alaska/BIN/Core/Include/Protocol/AtaPassThru.h $
// 
// 1     6/13/11 6:35p Artems
// 
//*************************************************************************
//<AMI_FHDR_START>
//
//  Name: AtaPassThru.h
//
//  Description:
//  EFI_DRIVER_HEALTH_PROTOCOL definition file
//
//<AMI_FHDR_END>
//*************************************************************************
#ifndef __ATA_PASS_THRU_PROTOCOL__H__
#define __ATA_PASS_THRU_PROTOCOL__H__
#ifdef __cplusplus
extern "C" {
#endif

#include <EFI.h>
#include <Protocol/DevicePath.h>

#define EFI_ATA_PASS_THRU_PROTOCOL_GUID \
    { 0x1d3de7f0, 0x807, 0x424f, 0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f }

GUID_VARIABLE_DECLARATION(gEfiAtaPassThruProtocolGuid, EFI_ATA_PASS_THRU_PROTOCOL_GUID);

typedef struct _EFI_ATA_PASS_THRU_PROTOCOL EFI_ATA_PASS_THRU_PROTOCOL;

typedef struct {
    UINT32 Attributes;
    UINT32 IoAlign;
} EFI_ATA_PASS_THRU_MODE;

#define EFI_ATA_PASS_THRU_ATTRIBUTES_PHYSICAL   0x0001
#define EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL    0x0002
#define EFI_ATA_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004

typedef struct _EFI_ATA_COMMAND_BLOCK {
    UINT8 Reserved1[2];
    UINT8 AtaCommand;
    UINT8 AtaFeatures;
    UINT8 AtaSectorNumber;
    UINT8 AtaCylinderLow;
    UINT8 AtaCylinderHigh;
    UINT8 AtaDeviceHead;
    UINT8 AtaSectorNumberExp;
    UINT8 AtaCylinderLowExp;
    UINT8 AtaCylinderHighExp;
    UINT8 AtaFeaturesExp;
    UINT8 AtaSectorCount;
    UINT8 AtaSectorCountExp;
    UINT8 Reserved2[6];
} EFI_ATA_COMMAND_BLOCK;

typedef struct _EFI_ATA_STATUS_BLOCK {
    UINT8 Reserved1[2];
    UINT8 AtaStatus;
    UINT8 AtaError;
    UINT8 AtaSectorNumber;
    UINT8 AtaCylinderLow;
    UINT8 AtaCylinderHigh;
    UINT8 AtaDeviceHead;
    UINT8 AtaSectorNumberExp;
    UINT8 AtaCylinderLowExp;
    UINT8 AtaCylinderHighExp;
    UINT8 Reserved2;
    UINT8 AtaSectorCount;
    UINT8 AtaSectorCountExp;
    UINT8 Reserved3[6];
} EFI_ATA_STATUS_BLOCK;

typedef UINT8 EFI_ATA_PASS_THRU_CMD_PROTOCOL;

#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_HARDWARE_RESET 0x00
#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_SOFTWARE_RESET 0x01
#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA       0x02
#define EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN        0x04
#define EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT       0x05
#define EFI_ATA_PASS_THRU_PROTOCOL_DMA                0x06
#define EFI_ATA_PASS_THRU_PROTOCOL_DMA_QUEUED         0x07
#define EFI_ATA_PASS_THRU_PROTOCOL_DEVICE_DIAGNOSTIC  0x08
#define EFI_ATA_PASS_THRU_PROTOCOL_DEVICE_RESET       0x09
#define EFI_ATA_PASS_THRU_PROTOCOL_UDMA_DATA_IN       0x0A
#define EFI_ATA_PASS_THRU_PROTOCOL_UDMA_DATA_OUT      0x0B
#define EFI_ATA_PASS_THRU_PROTOCOL_FPDMA              0x0C
#define EFI_ATA_PASS_THRU_PROTOCOL_RETURN_RESPONSE    0xFF

typedef UINT8 EFI_ATA_PASS_THRU_LENGTH;

#define EFI_ATA_PASS_THRU_LENGTH_BYTES            0x80
#define EFI_ATA_PASS_THRU_LENGTH_MASK             0x70
#define EFI_ATA_PASS_THRU_LENGTH_NO_DATA_TRANSFER 0x00
#define EFI_ATA_PASS_THRU_LENGTH_FEATURES         0x10
#define EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT     0x20
#define EFI_ATA_PASS_THRU_LENGTH_TPSIU            0x30
#define EFI_ATA_PASS_THRU_LENGTH_COUNT            0x0F

typedef struct {
    EFI_ATA_STATUS_BLOCK           *Asb;
    EFI_ATA_COMMAND_BLOCK          *Acb;
    UINT64                         Timeout;
    VOID                           *InDataBuffer;
    VOID                           *OutDataBuffer;
    UINT32                         InTransferLength;
    UINT32                         OutTransferLength;
    EFI_ATA_PASS_THRU_CMD_PROTOCOL Protocol;
    EFI_ATA_PASS_THRU_LENGTH       Length;
} EFI_ATA_PASS_THRU_COMMAND_PACKET;

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_PASSTHRU) (
    IN     EFI_ATA_PASS_THRU_PROTOCOL       *This,
    IN     UINT16                           Port,
    IN     UINT16                           PortMultiplierPort,
    IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,
    IN     EFI_EVENT                        Event OPTIONAL
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_GET_NEXT_PORT) (
    IN     EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN OUT UINT16                     *Port
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_GET_NEXT_DEVICE) (
    IN     EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN     UINT16                     Port,
    IN OUT UINT16                     *PortMultiplierPort
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_BUILD_DEVICE_PATH) (
    IN     EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN     UINT16                     Port,
    IN     UINT16                     PortMultiplierPort,
    IN OUT EFI_DEVICE_PATH_PROTOCOL   **DevicePath
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_GET_DEVICE) (
    IN  EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN  EFI_DEVICE_PATH_PROTOCOL   *DevicePath,
    OUT UINT16                     *Port,
    OUT UINT16                     *PortMultiplierPort
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_RESET_PORT) (
    IN EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN UINT16                     Port
);

typedef EFI_STATUS (EFIAPI *EFI_ATA_PASS_THRU_RESET_DEVICE) (
    IN EFI_ATA_PASS_THRU_PROTOCOL *This,
    IN UINT16                     Port,
    IN UINT16                     PortMultiplierPort
);

struct _EFI_ATA_PASS_THRU_PROTOCOL {
    EFI_ATA_PASS_THRU_MODE              *Mode;
    EFI_ATA_PASS_THRU_PASSTHRU          PassThru;
    EFI_ATA_PASS_THRU_GET_NEXT_PORT     GetNextPort;
    EFI_ATA_PASS_THRU_GET_NEXT_DEVICE   GetNextDevice;
    EFI_ATA_PASS_THRU_BUILD_DEVICE_PATH BuildDevicePath;
    EFI_ATA_PASS_THRU_GET_DEVICE        GetDevice;
    EFI_ATA_PASS_THRU_RESET_PORT        ResetPort;
    EFI_ATA_PASS_THRU_RESET_DEVICE      ResetDevice;
};


/****** DO NOT WRITE BELOW THIS LINE *******/
#ifdef __cplusplus
}
#endif
#endif
//*************************************************************************
//*************************************************************************
//**                                                                     **
//**        (C)Copyright 1985-2011, American Megatrends, Inc.            **
//**                                                                     **
//**                       All Rights Reserved.                          **
//**                                                                     **
//**      5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093           **
//**                                                                     **
//**                       Phone: (770)-246-8600                         **
//**                                                                     **
//*************************************************************************
//*************************************************************************