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