2 This file is used to implement the EFI_DISK_INFO_PROTOCOL interface..
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 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.
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.
15 #include "NvmExpress.h"
17 EFI_DISK_INFO_PROTOCOL gNvmExpressDiskInfoProtocolTemplate
= {
18 EFI_DISK_INFO_NVME_INTERFACE_GUID
,
19 NvmExpressDiskInfoInquiry
,
20 NvmExpressDiskInfoIdentify
,
21 NvmExpressDiskInfoSenseData
,
22 NvmExpressDiskInfoWhichIde
26 Initialize the installation of DiskInfo protocol.
28 This function prepares for the installation of DiskInfo protocol on the child handle.
29 By default, it installs DiskInfo protocol with NVME interface GUID.
31 @param[in] Device The pointer of NVME_DEVICE_PRIVATE_DATA.
36 IN NVME_DEVICE_PRIVATE_DATA
*Device
39 CopyMem (&Device
->DiskInfo
, &gNvmExpressDiskInfoProtocolTemplate
, sizeof (EFI_DISK_INFO_PROTOCOL
));
44 Provides inquiry information for the controller type.
46 This function is used to get inquiry data. Data format
47 of Identify data is defined by the Interface GUID.
49 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
50 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
51 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
53 @retval EFI_SUCCESS The command was accepted without any errors.
54 @retval EFI_NOT_FOUND Device does not support this data class
55 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
56 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
61 NvmExpressDiskInfoInquiry (
62 IN EFI_DISK_INFO_PROTOCOL
*This
,
63 IN OUT VOID
*InquiryData
,
64 IN OUT UINT32
*InquiryDataSize
72 Provides identify information for the controller type.
74 This function is used to get identify data. Data format
75 of Identify data is defined by the Interface GUID.
77 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
79 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
80 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
83 @retval EFI_SUCCESS The command was accepted without any errors.
84 @retval EFI_NOT_FOUND Device does not support this data class
85 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
86 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
91 NvmExpressDiskInfoIdentify (
92 IN EFI_DISK_INFO_PROTOCOL
*This
,
93 IN OUT VOID
*IdentifyData
,
94 IN OUT UINT32
*IdentifyDataSize
98 NVME_DEVICE_PRIVATE_DATA
*Device
;
100 Device
= NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO (This
);
102 Status
= EFI_BUFFER_TOO_SMALL
;
103 if (*IdentifyDataSize
>= sizeof (Device
->NamespaceData
)) {
104 Status
= EFI_SUCCESS
;
105 CopyMem (IdentifyData
, &Device
->NamespaceData
, sizeof (Device
->NamespaceData
));
107 *IdentifyDataSize
= sizeof (Device
->NamespaceData
);
112 Provides sense data information for the controller type.
114 This function is used to get sense data.
115 Data format of Sense data is defined by the Interface GUID.
117 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
118 @param[in, out] SenseData Pointer to the SenseData.
119 @param[in, out] SenseDataSize Size of SenseData in bytes.
120 @param[out] SenseDataNumber Pointer to the value for the sense data size.
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 SenseData from device.
125 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
130 NvmExpressDiskInfoSenseData (
131 IN EFI_DISK_INFO_PROTOCOL
*This
,
132 IN OUT VOID
*SenseData
,
133 IN OUT UINT32
*SenseDataSize
,
134 OUT UINT8
*SenseDataNumber
137 return EFI_NOT_FOUND
;
142 This function is used to get controller information.
144 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
145 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
146 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
148 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
149 @retval EFI_UNSUPPORTED This is not an IDE device.
154 NvmExpressDiskInfoWhichIde (
155 IN EFI_DISK_INFO_PROTOCOL
*This
,
156 OUT UINT32
*IdeChannel
,
157 OUT UINT32
*IdeDevice
160 return EFI_UNSUPPORTED
;