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