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