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