2 This file is used to implement the EFI_DISK_INFO_PROTOCOL interface..
4 Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
9 #include "NvmExpress.h"
11 EFI_DISK_INFO_PROTOCOL gNvmExpressDiskInfoProtocolTemplate
= {
12 EFI_DISK_INFO_NVME_INTERFACE_GUID
,
13 NvmExpressDiskInfoInquiry
,
14 NvmExpressDiskInfoIdentify
,
15 NvmExpressDiskInfoSenseData
,
16 NvmExpressDiskInfoWhichIde
20 Initialize the installation of DiskInfo protocol.
22 This function prepares for the installation of DiskInfo protocol on the child handle.
23 By default, it installs DiskInfo protocol with NVME interface GUID.
25 @param[in] Device The pointer of NVME_DEVICE_PRIVATE_DATA.
30 IN NVME_DEVICE_PRIVATE_DATA
*Device
33 CopyMem (&Device
->DiskInfo
, &gNvmExpressDiskInfoProtocolTemplate
, sizeof (EFI_DISK_INFO_PROTOCOL
));
38 Provides inquiry information for the controller type.
40 This function is used to get inquiry data. Data format
41 of Identify data is defined by the Interface GUID.
43 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
44 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.
45 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.
47 @retval EFI_SUCCESS The command was accepted without any errors.
48 @retval EFI_NOT_FOUND Device does not support this data class
49 @retval EFI_DEVICE_ERROR Error reading InquiryData from device
50 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough
55 NvmExpressDiskInfoInquiry (
56 IN EFI_DISK_INFO_PROTOCOL
*This
,
57 IN OUT VOID
*InquiryData
,
58 IN OUT UINT32
*InquiryDataSize
66 Provides identify information for the controller type.
68 This function is used to get identify data. Data format
69 of Identify data is defined by the Interface GUID.
71 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL
73 @param[in, out] IdentifyData Pointer to a buffer for the identify data.
74 @param[in, out] IdentifyDataSize Pointer to the value for the identify data
77 @retval EFI_SUCCESS The command was accepted without any errors.
78 @retval EFI_NOT_FOUND Device does not support this data class
79 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device
80 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough
85 NvmExpressDiskInfoIdentify (
86 IN EFI_DISK_INFO_PROTOCOL
*This
,
87 IN OUT VOID
*IdentifyData
,
88 IN OUT UINT32
*IdentifyDataSize
92 NVME_DEVICE_PRIVATE_DATA
*Device
;
94 Device
= NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO (This
);
96 Status
= EFI_BUFFER_TOO_SMALL
;
97 if (*IdentifyDataSize
>= sizeof (Device
->NamespaceData
)) {
99 CopyMem (IdentifyData
, &Device
->NamespaceData
, sizeof (Device
->NamespaceData
));
101 *IdentifyDataSize
= sizeof (Device
->NamespaceData
);
106 Provides sense data information for the controller type.
108 This function is used to get sense data.
109 Data format of Sense data is defined by the Interface GUID.
111 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
112 @param[in, out] SenseData Pointer to the SenseData.
113 @param[in, out] SenseDataSize Size of SenseData in bytes.
114 @param[out] SenseDataNumber Pointer to the value for the sense data size.
116 @retval EFI_SUCCESS The command was accepted without any errors.
117 @retval EFI_NOT_FOUND Device does not support this data class.
118 @retval EFI_DEVICE_ERROR Error reading SenseData from device.
119 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.
124 NvmExpressDiskInfoSenseData (
125 IN EFI_DISK_INFO_PROTOCOL
*This
,
126 IN OUT VOID
*SenseData
,
127 IN OUT UINT32
*SenseDataSize
,
128 OUT UINT8
*SenseDataNumber
131 return EFI_NOT_FOUND
;
136 This function is used to get controller information.
138 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.
139 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.
140 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.
142 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.
143 @retval EFI_UNSUPPORTED This is not an IDE device.
148 NvmExpressDiskInfoWhichIde (
149 IN EFI_DISK_INFO_PROTOCOL
*This
,
150 OUT UINT32
*IdeChannel
,
151 OUT UINT32
*IdeDevice
154 return EFI_UNSUPPORTED
;