1 /** @file
2   Provides the basic interfaces to abstract platform information regarding an
3   IDE controller.
4 
5   Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
6   SPDX-License-Identifier: BSD-2-Clause-Patent
7 
8   @par Revision Reference:
9   This Protocol is defined in UEFI Platform Initialization Specification 1.6
10   Volume 5: Standards
11 
12 **/
13 
14 #ifndef __DISK_INFO_H__
15 #define __DISK_INFO_H__
16 
17 ///
18 /// Global ID for EFI_DISK_INFO_PROTOCOL
19 ///
20 #define EFI_DISK_INFO_PROTOCOL_GUID \
21   { \
22     0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27 } \
23   }
24 
25 ///
26 /// Forward declaration for EFI_DISK_INFO_PROTOCOL
27 ///
28 typedef struct _EFI_DISK_INFO_PROTOCOL EFI_DISK_INFO_PROTOCOL;
29 
30 ///
31 /// Global ID for an IDE interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
32 ///
33 #define EFI_DISK_INFO_IDE_INTERFACE_GUID \
34   { \
35     0x5e948fe3, 0x26d3, 0x42b5, {0xaf, 0x17, 0x61, 0x2, 0x87, 0x18, 0x8d, 0xec } \
36   }
37 
38 ///
39 /// Global ID for a SCSI interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
40 ///
41 #define EFI_DISK_INFO_SCSI_INTERFACE_GUID \
42   { \
43     0x8f74baa, 0xea36, 0x41d9, {0x95, 0x21, 0x21, 0xa7, 0xf, 0x87, 0x80, 0xbc } \
44   }
45 
46 ///
47 /// Global ID for a USB interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
48 ///
49 #define EFI_DISK_INFO_USB_INTERFACE_GUID \
50   { \
51     0xcb871572, 0xc11a, 0x47b5, {0xb4, 0x92, 0x67, 0x5e, 0xaf, 0xa7, 0x77, 0x27 } \
52   }
53 
54 ///
55 /// Global ID for an AHCI interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
56 ///
57 #define EFI_DISK_INFO_AHCI_INTERFACE_GUID \
58   { \
59     0x9e498932, 0x4abc, 0x45af, {0xa3, 0x4d, 0x2, 0x47, 0x78, 0x7b, 0xe7, 0xc6 } \
60   }
61 
62 ///
63 /// Global ID for a NVME interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
64 ///
65 #define EFI_DISK_INFO_NVME_INTERFACE_GUID \
66   { \
67     0x3ab14680, 0x5d3f, 0x4a4d, {0xbc, 0xdc, 0xcc, 0x38, 0x0, 0x18, 0xc7, 0xf7 } \
68   }
69 
70 ///
71 /// Global ID for a UFS interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
72 ///
73 #define EFI_DISK_INFO_UFS_INTERFACE_GUID \
74   { \
75     0x4b3029cc, 0x6b98, 0x47fb, { 0xbc, 0x96, 0x76, 0xdc, 0xb8, 0x4, 0x41, 0xf0 } \
76   }
77 
78 ///
79 /// Global ID for an SD/MMC interface.  Used to fill in EFI_DISK_INFO_PROTOCOL.Interface
80 ///
81 #define EFI_DISK_INFO_SD_MMC_INTERFACE_GUID \
82   { \
83     0x8deec992, 0xd39c, 0x4a5c, { 0xab, 0x6b, 0x98, 0x6e, 0x14, 0x24, 0x2b, 0x9d } \
84   }
85 
86 /**
87   Provides inquiry information for the controller type.
88 
89   This function is used by the IDE bus driver to get inquiry data.  Data format
90   of Identify data is defined by the Interface GUID.
91 
92   @param[in]     This              Pointer to the EFI_DISK_INFO_PROTOCOL instance.
93   @param[in,out] InquiryData       Pointer to a buffer for the inquiry data.
94   @param[in,out] InquiryDataSize   Pointer to the value for the inquiry data size.
95 
96   @retval EFI_SUCCESS            The command was accepted without any errors.
97   @retval EFI_NOT_FOUND          Device does not support this data class
98   @retval EFI_DEVICE_ERROR       Error reading InquiryData from device
99   @retval EFI_BUFFER_TOO_SMALL   InquiryDataSize not big enough
100 
101 **/
102 typedef
103 EFI_STATUS
104 (EFIAPI *EFI_DISK_INFO_INQUIRY)(
105   IN     EFI_DISK_INFO_PROTOCOL  *This,
106   IN OUT VOID                    *InquiryData,
107   IN OUT UINT32                  *InquiryDataSize
108   );
109 
110 /**
111   Provides identify information for the controller type.
112 
113   This function is used by the IDE bus driver to get identify data.  Data format
114   of Identify data is defined by the Interface GUID.
115 
116   @param[in]     This               Pointer to the EFI_DISK_INFO_PROTOCOL
117                                     instance.
118   @param[in,out] IdentifyData       Pointer to a buffer for the identify data.
119   @param[in,out] IdentifyDataSize   Pointer to the value for the identify data
120                                     size.
121 
122   @retval EFI_SUCCESS            The command was accepted without any errors.
123   @retval EFI_NOT_FOUND          Device does not support this data class
124   @retval EFI_DEVICE_ERROR       Error reading IdentifyData from device
125   @retval EFI_BUFFER_TOO_SMALL   IdentifyDataSize not big enough
126 
127 **/
128 typedef
129 EFI_STATUS
130 (EFIAPI *EFI_DISK_INFO_IDENTIFY)(
131   IN     EFI_DISK_INFO_PROTOCOL  *This,
132   IN OUT VOID                    *IdentifyData,
133   IN OUT UINT32                  *IdentifyDataSize
134   );
135 
136 /**
137   Provides sense data information for the controller type.
138 
139   This function is used by the IDE bus driver to get sense data.
140   Data format of Sense data is defined by the Interface GUID.
141 
142   @param[in]     This              Pointer to the EFI_DISK_INFO_PROTOCOL instance.
143   @param[in,out] SenseData         Pointer to the SenseData.
144   @param[in,out] SenseDataSize     Size of SenseData in bytes.
145   @param[out]    SenseDataNumber   Pointer to the value for the sense data size.
146 
147   @retval EFI_SUCCESS            The command was accepted without any errors.
148   @retval EFI_NOT_FOUND          Device does not support this data class.
149   @retval EFI_DEVICE_ERROR       Error reading SenseData from device.
150   @retval EFI_BUFFER_TOO_SMALL   SenseDataSize not big enough.
151 
152 **/
153 typedef
154 EFI_STATUS
155 (EFIAPI *EFI_DISK_INFO_SENSE_DATA)(
156   IN     EFI_DISK_INFO_PROTOCOL  *This,
157   IN OUT VOID                    *SenseData,
158   IN OUT UINT32                  *SenseDataSize,
159   OUT    UINT8                   *SenseDataNumber
160   );
161 
162 /**
163   This function is used by the IDE bus driver to get controller information.
164 
165   @param[in]  This         Pointer to the EFI_DISK_INFO_PROTOCOL instance.
166   @param[out] IdeChannel   Pointer to the Ide Channel number.  Primary or secondary.
167   @param[out] IdeDevice    Pointer to the Ide Device number.  Master or slave.
168 
169   @retval EFI_SUCCESS       IdeChannel and IdeDevice are valid.
170   @retval EFI_UNSUPPORTED   This is not an IDE device.
171 
172 **/
173 typedef
174 EFI_STATUS
175 (EFIAPI *EFI_DISK_INFO_WHICH_IDE)(
176   IN  EFI_DISK_INFO_PROTOCOL  *This,
177   OUT UINT32                  *IdeChannel,
178   OUT UINT32                  *IdeDevice
179   );
180 
181 ///
182 /// The EFI_DISK_INFO_PROTOCOL provides controller specific information.
183 ///
184 struct _EFI_DISK_INFO_PROTOCOL {
185   ///
186   /// A GUID that defines the format of buffers for the other member functions
187   /// of this protocol.
188   ///
189   EFI_GUID                    Interface;
190   ///
191   /// Return the results of the Inquiry command to a drive in InquiryData. Data
192   /// format of Inquiry data is defined by the Interface GUID.
193   ///
194   EFI_DISK_INFO_INQUIRY       Inquiry;
195   ///
196   /// Return the results of the Identify command to a drive in IdentifyData. Data
197   /// format of Identify data is defined by the Interface GUID.
198   ///
199   EFI_DISK_INFO_IDENTIFY      Identify;
200   ///
201   /// Return the results of the Request Sense command to a drive in SenseData. Data
202   /// format of Sense data is defined by the Interface GUID.
203   ///
204   EFI_DISK_INFO_SENSE_DATA    SenseData;
205   ///
206   /// Specific controller.
207   ///
208   EFI_DISK_INFO_WHICH_IDE     WhichIde;
209 };
210 
211 extern EFI_GUID  gEfiDiskInfoProtocolGuid;
212 
213 extern EFI_GUID  gEfiDiskInfoIdeInterfaceGuid;
214 extern EFI_GUID  gEfiDiskInfoScsiInterfaceGuid;
215 extern EFI_GUID  gEfiDiskInfoUsbInterfaceGuid;
216 extern EFI_GUID  gEfiDiskInfoAhciInterfaceGuid;
217 extern EFI_GUID  gEfiDiskInfoNvmeInterfaceGuid;
218 extern EFI_GUID  gEfiDiskInfoUfsInterfaceGuid;
219 extern EFI_GUID  gEfiDiskInfoSdMmcInterfaceGuid;
220 
221 #endif
222