]>
Commit | Line | Data |
---|---|---|
4b738c76 HT |
1 | /** @file\r |
2 | This file is used to implement the EFI_DISK_INFO_PROTOCOL interface..\r | |
3 | \r | |
4 | Copyright (c) 2013, Intel Corporation. All rights reserved.<BR>\r | |
9d510e61 | 5 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
4b738c76 HT |
6 | \r |
7 | **/\r | |
8 | \r | |
9 | #include "NvmExpress.h"\r | |
10 | \r | |
11 | EFI_DISK_INFO_PROTOCOL gNvmExpressDiskInfoProtocolTemplate = {\r | |
12 | EFI_DISK_INFO_NVME_INTERFACE_GUID,\r | |
13 | NvmExpressDiskInfoInquiry,\r | |
14 | NvmExpressDiskInfoIdentify,\r | |
15 | NvmExpressDiskInfoSenseData,\r | |
16 | NvmExpressDiskInfoWhichIde\r | |
17 | };\r | |
18 | \r | |
19 | /**\r | |
20 | Initialize the installation of DiskInfo protocol.\r | |
21 | \r | |
22 | This function prepares for the installation of DiskInfo protocol on the child handle.\r | |
23 | By default, it installs DiskInfo protocol with NVME interface GUID.\r | |
24 | \r | |
25 | @param[in] Device The pointer of NVME_DEVICE_PRIVATE_DATA.\r | |
26 | \r | |
27 | **/\r | |
28 | VOID\r | |
29 | InitializeDiskInfo (\r | |
30 | IN NVME_DEVICE_PRIVATE_DATA *Device\r | |
31 | )\r | |
32 | {\r | |
33 | CopyMem (&Device->DiskInfo, &gNvmExpressDiskInfoProtocolTemplate, sizeof (EFI_DISK_INFO_PROTOCOL));\r | |
34 | }\r | |
35 | \r | |
36 | \r | |
37 | /**\r | |
38 | Provides inquiry information for the controller type.\r | |
39 | \r | |
40 | This function is used to get inquiry data. Data format\r | |
41 | of Identify data is defined by the Interface GUID.\r | |
42 | \r | |
43 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r | |
44 | @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r | |
45 | @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r | |
46 | \r | |
47 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
48 | @retval EFI_NOT_FOUND Device does not support this data class\r | |
49 | @retval EFI_DEVICE_ERROR Error reading InquiryData from device\r | |
50 | @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough\r | |
51 | \r | |
52 | **/\r | |
53 | EFI_STATUS\r | |
54 | EFIAPI\r | |
55 | NvmExpressDiskInfoInquiry (\r | |
56 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
57 | IN OUT VOID *InquiryData,\r | |
58 | IN OUT UINT32 *InquiryDataSize\r | |
59 | )\r | |
60 | {\r | |
61 | return EFI_NOT_FOUND;\r | |
62 | }\r | |
63 | \r | |
64 | \r | |
65 | /**\r | |
66 | Provides identify information for the controller type.\r | |
67 | \r | |
68 | This function is used to get identify data. Data format\r | |
69 | of Identify data is defined by the Interface GUID.\r | |
70 | \r | |
71 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r | |
72 | instance.\r | |
73 | @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r | |
74 | @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r | |
75 | size.\r | |
76 | \r | |
77 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
78 | @retval EFI_NOT_FOUND Device does not support this data class\r | |
79 | @retval EFI_DEVICE_ERROR Error reading IdentifyData from device\r | |
80 | @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough\r | |
81 | \r | |
82 | **/\r | |
83 | EFI_STATUS\r | |
84 | EFIAPI\r | |
85 | NvmExpressDiskInfoIdentify (\r | |
86 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
87 | IN OUT VOID *IdentifyData,\r | |
88 | IN OUT UINT32 *IdentifyDataSize\r | |
89 | )\r | |
90 | {\r | |
91 | EFI_STATUS Status;\r | |
92 | NVME_DEVICE_PRIVATE_DATA *Device;\r | |
93 | \r | |
94 | Device = NVME_DEVICE_PRIVATE_DATA_FROM_DISK_INFO (This);\r | |
95 | \r | |
96 | Status = EFI_BUFFER_TOO_SMALL;\r | |
97 | if (*IdentifyDataSize >= sizeof (Device->NamespaceData)) {\r | |
98 | Status = EFI_SUCCESS;\r | |
99 | CopyMem (IdentifyData, &Device->NamespaceData, sizeof (Device->NamespaceData));\r | |
100 | }\r | |
101 | *IdentifyDataSize = sizeof (Device->NamespaceData);\r | |
102 | return Status;\r | |
103 | }\r | |
104 | \r | |
105 | /**\r | |
106 | Provides sense data information for the controller type.\r | |
107 | \r | |
108 | This function is used to get sense data.\r | |
109 | Data format of Sense data is defined by the Interface GUID.\r | |
110 | \r | |
111 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r | |
112 | @param[in, out] SenseData Pointer to the SenseData.\r | |
113 | @param[in, out] SenseDataSize Size of SenseData in bytes.\r | |
114 | @param[out] SenseDataNumber Pointer to the value for the sense data size.\r | |
115 | \r | |
116 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
117 | @retval EFI_NOT_FOUND Device does not support this data class.\r | |
118 | @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r | |
119 | @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r | |
120 | \r | |
121 | **/\r | |
122 | EFI_STATUS\r | |
123 | EFIAPI\r | |
124 | NvmExpressDiskInfoSenseData (\r | |
125 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
126 | IN OUT VOID *SenseData,\r | |
127 | IN OUT UINT32 *SenseDataSize,\r | |
128 | OUT UINT8 *SenseDataNumber\r | |
129 | )\r | |
130 | {\r | |
131 | return EFI_NOT_FOUND;\r | |
132 | }\r | |
133 | \r | |
134 | \r | |
135 | /**\r | |
136 | This function is used to get controller information.\r | |
137 | \r | |
138 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r | |
139 | @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r | |
140 | @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r | |
141 | \r | |
142 | @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r | |
143 | @retval EFI_UNSUPPORTED This is not an IDE device.\r | |
144 | \r | |
145 | **/\r | |
146 | EFI_STATUS\r | |
147 | EFIAPI\r | |
148 | NvmExpressDiskInfoWhichIde (\r | |
149 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
150 | OUT UINT32 *IdeChannel,\r | |
151 | OUT UINT32 *IdeDevice\r | |
152 | )\r | |
153 | {\r | |
154 | return EFI_UNSUPPORTED;\r | |
155 | }\r | |
156 | \r |