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