]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Sd/EmmcDxe/EmmcDiskInfo.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Sd / EmmcDxe / EmmcDiskInfo.c
CommitLineData
19b2cb5c
HW
1/** @file\r
2 Implement the EFI_DISK_INFO_PROTOCOL interface on EMMC 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
19b2cb5c
HW
6\r
7**/\r
8\r
9#include "EmmcDxe.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
29EmmcDiskInfoInquiry (\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 EMMC_PARTITION *Partition;\r
37 EMMC_DEVICE *Device;\r
38\r
39 Partition = EMMC_PARTITION_DATA_FROM_DISKINFO (This);\r
40 Device = Partition->Device;\r
41\r
42 if (*InquiryDataSize >= sizeof (Device->Cid)) {\r
43 Status = EFI_SUCCESS;\r
44 CopyMem (InquiryData, &Device->Cid, sizeof (Device->Cid));\r
45 } else {\r
46 Status = EFI_BUFFER_TOO_SMALL;\r
47 }\r
48\r
49 *InquiryDataSize = sizeof (Device->Cid);\r
50\r
51 return Status;\r
52}\r
53\r
54/**\r
55 Provides identify information for the controller type.\r
56\r
57 This function is used by the driver entity to get identify data. Data format\r
58 of Identify data is defined by the Interface GUID.\r
59\r
60 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r
61 instance.\r
62 @param[in,out] IdentifyData Pointer to a buffer for the identify data.\r
63 @param[in,out] IdentifyDataSize Pointer to the value for the identify data\r
64 size.\r
65\r
66 @retval EFI_SUCCESS The command was accepted without any errors.\r
67 @retval EFI_NOT_FOUND Device does not support this data class.\r
68 @retval EFI_DEVICE_ERROR Error reading IdentifyData from device.\r
69 @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough.\r
70\r
71**/\r
72EFI_STATUS\r
73EFIAPI\r
74EmmcDiskInfoIdentify (\r
75 IN EFI_DISK_INFO_PROTOCOL *This,\r
76 IN OUT VOID *IdentifyData,\r
77 IN OUT UINT32 *IdentifyDataSize\r
78 )\r
79{\r
80 return EFI_NOT_FOUND;\r
81}\r
82\r
83/**\r
84 Provides sense data information for the controller type.\r
85\r
86 This function is used by the driver entity to get sense data. Data format of\r
87 Sense data is defined by the Interface GUID.\r
88\r
89 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
90 @param[in,out] SenseData Pointer to the SenseData.\r
91 @param[in,out] SenseDataSize Size of SenseData in bytes.\r
92 @param[out] SenseDataNumber Pointer to the value for the sense data size.\r
93\r
94 @retval EFI_SUCCESS The command was accepted without any errors.\r
95 @retval EFI_NOT_FOUND Device does not support this data class.\r
96 @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r
97 @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r
98\r
99**/\r
100EFI_STATUS\r
101EFIAPI\r
102EmmcDiskInfoSenseData (\r
103 IN EFI_DISK_INFO_PROTOCOL *This,\r
104 IN OUT VOID *SenseData,\r
105 IN OUT UINT32 *SenseDataSize,\r
106 OUT UINT8 *SenseDataNumber\r
107 )\r
108{\r
109 return EFI_NOT_FOUND;\r
110}\r
111\r
112/**\r
113 Provides IDE channel and device information for the interface.\r
114\r
115 This function is used by the driver entity to get controller information.\r
116\r
117 @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r
118 @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r
119 @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r
120\r
121 @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r
122 @retval EFI_UNSUPPORTED This is not an IDE device.\r
123\r
124**/\r
125EFI_STATUS\r
126EFIAPI\r
127EmmcDiskInfoWhichIde (\r
128 IN EFI_DISK_INFO_PROTOCOL *This,\r
129 OUT UINT32 *IdeChannel,\r
130 OUT UINT32 *IdeDevice\r
131 )\r
132{\r
133 return EFI_UNSUPPORTED;\r
134}\r