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