]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Sd/SdDxe/SdDiskInfo.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Sd / SdDxe / SdDiskInfo.c
CommitLineData
af6a6bf4
HW
1/** @file\r
2 Implement the EFI_DISK_INFO_PROTOCOL interface on SD memory card devices.\r
3\r
4 Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
af6a6bf4
HW
6\r
7**/\r
8\r
9#include "SdDxe.h"\r
10\r
11/**\r
12 Provides inquiry information for the controller type.\r
13\r
14 This function is used by the driver entity to get inquiry data. Data format of\r
15 Identify data is defined by the Interface GUID.\r
16\r
17 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
18 @param[in,out] InquiryData Pointer to a buffer for the inquiry data.\r
19 @param[in,out] InquiryDataSize Pointer to the value for the inquiry data size.\r
20\r
21 @retval EFI_SUCCESS The command was accepted without any errors.\r
22 @retval EFI_NOT_FOUND Device does not support this data class.\r
23 @retval EFI_DEVICE_ERROR Error reading InquiryData from device.\r
24 @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough.\r
25\r
26**/\r
27EFI_STATUS\r
28EFIAPI\r
29SdDiskInfoInquiry (\r
30 IN EFI_DISK_INFO_PROTOCOL *This,\r
31 IN OUT VOID *InquiryData,\r
32 IN OUT UINT32 *InquiryDataSize\r
33 )\r
34{\r
35 EFI_STATUS Status;\r
36 SD_DEVICE *Device;\r
37\r
38 Device = SD_DEVICE_DATA_FROM_DISKINFO (This);\r
39\r
40 if (*InquiryDataSize >= sizeof (Device->Cid)) {\r
41 Status = EFI_SUCCESS;\r
42 CopyMem (InquiryData, &Device->Cid, sizeof (Device->Cid));\r
43 } else {\r
44 Status = EFI_BUFFER_TOO_SMALL;\r
45 }\r
46\r
47 *InquiryDataSize = sizeof (Device->Cid);\r
48\r
49 return Status;\r
50}\r
51\r
52/**\r
53 Provides identify information for the controller type.\r
54\r
55 This function is used by the driver entity to get identify data. Data format\r
56 of Identify data is defined by the Interface GUID.\r
57\r
58 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r
59 instance.\r
60 @param[in,out] IdentifyData Pointer to a buffer for the identify data.\r
61 @param[in,out] IdentifyDataSize Pointer to the value for the identify data\r
62 size.\r
63\r
64 @retval EFI_SUCCESS The command was accepted without any errors.\r
65 @retval EFI_NOT_FOUND Device does not support this data class.\r
66 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device.\r
67 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough.\r
68\r
69**/\r
70EFI_STATUS\r
71EFIAPI\r
72SdDiskInfoIdentify (\r
73 IN EFI_DISK_INFO_PROTOCOL *This,\r
74 IN OUT VOID *IdentifyData,\r
75 IN OUT UINT32 *IdentifyDataSize\r
76 )\r
77{\r
78 return EFI_NOT_FOUND;\r
79}\r
80\r
81/**\r
82 Provides sense data information for the controller type.\r
83\r
84 This function is used by the driver entity to get sense data. Data format of\r
85 Sense data is defined by the Interface GUID.\r
86\r
87 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
88 @param[in,out] SenseData Pointer to the SenseData.\r
89 @param[in,out] SenseDataSize Size of SenseData in bytes.\r
90 @param[out] SenseDataNumber Pointer to the value for the sense data size.\r
91\r
92 @retval EFI_SUCCESS The command was accepted without any errors.\r
93 @retval EFI_NOT_FOUND Device does not support this data class.\r
94 @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r
95 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r
96\r
97**/\r
98EFI_STATUS\r
99EFIAPI\r
100SdDiskInfoSenseData (\r
101 IN EFI_DISK_INFO_PROTOCOL *This,\r
102 IN OUT VOID *SenseData,\r
103 IN OUT UINT32 *SenseDataSize,\r
104 OUT UINT8 *SenseDataNumber\r
105 )\r
106{\r
107 return EFI_NOT_FOUND;\r
108}\r
109\r
110/**\r
111 Provides IDE channel and device information for the interface.\r
112\r
113 This function is used by the driver entity to get controller information.\r
114\r
115 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
116 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r
117 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r
118\r
119 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r
120 @retval EFI_UNSUPPORTED This is not an IDE device.\r
121\r
122**/\r
123EFI_STATUS\r
124EFIAPI\r
125SdDiskInfoWhichIde (\r
126 IN EFI_DISK_INFO_PROTOCOL *This,\r
127 OUT UINT32 *IdeChannel,\r
128 OUT UINT32 *IdeDevice\r
129 )\r
130{\r
131 return EFI_UNSUPPORTED;\r
132}\r