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