]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Usb/UsbMassStorageDxe/UsbMassDiskInfo.c
MdeModulePkg: Clean up source files
[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
39840c50 5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#include "UsbMass.h"\r
16\r
17EFI_DISK_INFO_PROTOCOL gUsbDiskInfoProtocolTemplate = {\r
18 EFI_DISK_INFO_USB_INTERFACE_GUID,\r
19 UsbDiskInfoInquiry,\r
20 UsbDiskInfoIdentify,\r
21 UsbDiskInfoSenseData,\r
22 UsbDiskInfoWhichIde\r
23};\r
24\r
25/**\r
26 Initialize the installation of DiskInfo protocol.\r
27\r
28 This function prepares for the installation of DiskInfo protocol on the child handle.\r
d1102dba 29 By default, it installs DiskInfo protocol with USB interface GUID.\r
39840c50 30\r
31 @param[in] UsbMass The pointer of USB_MASS_DEVICE.\r
32\r
33**/\r
34VOID\r
35InitializeDiskInfo (\r
36 IN USB_MASS_DEVICE *UsbMass\r
37 )\r
38{\r
39 CopyMem (&UsbMass->DiskInfo, &gUsbDiskInfoProtocolTemplate, sizeof (gUsbDiskInfoProtocolTemplate));\r
40}\r
41\r
42\r
43/**\r
44 Provides inquiry information for the controller type.\r
d1102dba 45\r
39840c50 46 This function is used to get inquiry data. Data format\r
47 of Identify data is defined by the Interface GUID.\r
48\r
49 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
50 @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r
51 @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r
52\r
53 @retval EFI_SUCCESS The command was accepted without any errors.\r
d1102dba
LG
54 @retval EFI_NOT_FOUND Device does not support this data class\r
55 @retval EFI_DEVICE_ERROR Error reading InquiryData from device\r
56 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough\r
39840c50 57\r
58**/\r
59EFI_STATUS\r
60EFIAPI\r
61UsbDiskInfoInquiry (\r
62 IN EFI_DISK_INFO_PROTOCOL *This,\r
63 IN OUT VOID *InquiryData,\r
64 IN OUT UINT32 *InquiryDataSize\r
65 )\r
66{\r
67 EFI_STATUS Status;\r
68 USB_MASS_DEVICE *UsbMass;\r
69\r
70 UsbMass = USB_MASS_DEVICE_FROM_DISK_INFO (This);\r
71\r
72 Status = EFI_BUFFER_TOO_SMALL;\r
73 if (*InquiryDataSize >= sizeof (UsbMass->InquiryData)) {\r
74 Status = EFI_SUCCESS;\r
75 CopyMem (InquiryData, &UsbMass->InquiryData, sizeof (UsbMass->InquiryData));\r
76 }\r
77 *InquiryDataSize = sizeof (UsbMass->InquiryData);\r
78 return Status;\r
79}\r
80\r
81\r
82/**\r
83 Provides identify information for the controller type.\r
84\r
85 This function is used to get identify data. Data format\r
86 of Identify data is defined by the Interface GUID.\r
87\r
d1102dba 88 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r
39840c50 89 instance.\r
90 @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r
91 @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r
92 size.\r
93\r
94 @retval EFI_SUCCESS The command was accepted without any errors.\r
d1102dba
LG
95 @retval EFI_NOT_FOUND Device does not support this data class\r
96 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device\r
97 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough\r
39840c50 98\r
99**/\r
100EFI_STATUS\r
101EFIAPI\r
102UsbDiskInfoIdentify (\r
103 IN EFI_DISK_INFO_PROTOCOL *This,\r
104 IN OUT VOID *IdentifyData,\r
105 IN OUT UINT32 *IdentifyDataSize\r
106 )\r
107{\r
108 return EFI_NOT_FOUND;\r
109}\r
110\r
111/**\r
112 Provides sense data information for the controller type.\r
d1102dba
LG
113\r
114 This function is used to get sense data.\r
39840c50 115 Data format of Sense data is defined by the Interface GUID.\r
116\r
117 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
118 @param[in, out] SenseData Pointer to the SenseData.\r
119 @param[in, out] SenseDataSize Size of SenseData in bytes.\r
120 @param[out] SenseDataNumber Pointer to the value for the sense data size.\r
121\r
122 @retval EFI_SUCCESS The command was accepted without any errors.\r
123 @retval EFI_NOT_FOUND Device does not support this data class.\r
124 @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r
125 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r
126\r
127**/\r
128EFI_STATUS\r
129EFIAPI\r
130UsbDiskInfoSenseData (\r
131 IN EFI_DISK_INFO_PROTOCOL *This,\r
132 IN OUT VOID *SenseData,\r
133 IN OUT UINT32 *SenseDataSize,\r
134 OUT UINT8 *SenseDataNumber\r
135 )\r
136{\r
137 return EFI_NOT_FOUND;\r
138}\r
139\r
140\r
141/**\r
142 This function is used to get controller information.\r
143\r
d1102dba 144 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
39840c50 145 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r
146 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r
147\r
148 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r
149 @retval EFI_UNSUPPORTED This is not an IDE device.\r
150\r
151**/\r
152EFI_STATUS\r
153EFIAPI\r
154UsbDiskInfoWhichIde (\r
155 IN EFI_DISK_INFO_PROTOCOL *This,\r
156 OUT UINT32 *IdeChannel,\r
157 OUT UINT32 *IdeDevice\r
158 )\r
159{\r
160 return EFI_UNSUPPORTED;\r
161}\r
162\r