]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Protocol/SdMmcOverride.h
f948befba5b1989a283d864d8807c886b21d74a3
[mirror_edk2.git] / MdeModulePkg / Include / Protocol / SdMmcOverride.h
1 /** @file
2 Protocol to describe overrides required to support non-standard SDHCI
3 implementations
4
5 Copyright (c) 2017 - 2018, Linaro, Ltd. All rights reserved.<BR>
6
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
11
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14
15 **/
16
17 #ifndef __SD_MMC_OVERRIDE_H__
18 #define __SD_MMC_OVERRIDE_H__
19
20 #include <Protocol/SdMmcPassThru.h>
21
22 #define EDKII_SD_MMC_OVERRIDE_PROTOCOL_GUID \
23 { 0xeaf9e3c1, 0xc9cd, 0x46db, { 0xa5, 0xe5, 0x5a, 0x12, 0x4c, 0x83, 0x23, 0x23 } }
24
25 #define EDKII_SD_MMC_OVERRIDE_PROTOCOL_VERSION 0x1
26
27 typedef struct _EDKII_SD_MMC_OVERRIDE EDKII_SD_MMC_OVERRIDE;
28
29 //
30 // Bus timing modes
31 //
32 typedef enum {
33 SdMmcUhsSdr12,
34 SdMmcUhsSdr25,
35 SdMmcUhsSdr50,
36 SdMmcUhsSdr104,
37 SdMmcUhsDdr50,
38 SdMmcMmcLegacy,
39 SdMmcMmcHsSdr,
40 SdMmcMmcHsDdr,
41 SdMmcMmcHs200,
42 SdMmcMmcHs400,
43 } SD_MMC_BUS_MODE;
44
45 typedef enum {
46 EdkiiSdMmcResetPre,
47 EdkiiSdMmcResetPost,
48 EdkiiSdMmcInitHostPre,
49 EdkiiSdMmcInitHostPost,
50 EdkiiSdMmcUhsSignaling,
51 } EDKII_SD_MMC_PHASE_TYPE;
52
53 /**
54
55 Override function for SDHCI capability bits
56
57 @param[in] ControllerHandle The EFI_HANDLE of the controller.
58 @param[in] Slot The 0 based slot index.
59 @param[in,out] SdMmcHcSlotCapability The SDHCI capability structure.
60
61 @retval EFI_SUCCESS The override function completed successfully.
62 @retval EFI_NOT_FOUND The specified controller or slot does not exist.
63 @retval EFI_INVALID_PARAMETER SdMmcHcSlotCapability is NULL
64
65 **/
66 typedef
67 EFI_STATUS
68 (EFIAPI * EDKII_SD_MMC_CAPABILITY) (
69 IN EFI_HANDLE ControllerHandle,
70 IN UINT8 Slot,
71 IN OUT VOID *SdMmcHcSlotCapability
72 );
73
74 /**
75
76 Override function for SDHCI controller operations
77
78 @param[in] ControllerHandle The EFI_HANDLE of the controller.
79 @param[in] Slot The 0 based slot index.
80 @param[in] PhaseType The type of operation and whether the
81 hook is invoked right before (pre) or
82 right after (post)
83 @param[in,out] PhaseData The pointer to a phase-specific data.
84
85 @retval EFI_SUCCESS The override function completed successfully.
86 @retval EFI_NOT_FOUND The specified controller or slot does not exist.
87 @retval EFI_INVALID_PARAMETER PhaseType is invalid
88
89 **/
90 typedef
91 EFI_STATUS
92 (EFIAPI * EDKII_SD_MMC_NOTIFY_PHASE) (
93 IN EFI_HANDLE ControllerHandle,
94 IN UINT8 Slot,
95 IN EDKII_SD_MMC_PHASE_TYPE PhaseType,
96 IN OUT VOID *PhaseData
97 );
98
99 struct _EDKII_SD_MMC_OVERRIDE {
100 //
101 // Protocol version of this implementation
102 //
103 UINTN Version;
104 //
105 // Callback to override SD/MMC host controller capability bits
106 //
107 EDKII_SD_MMC_CAPABILITY Capability;
108 //
109 // Callback to invoke SD/MMC override hooks
110 //
111 EDKII_SD_MMC_NOTIFY_PHASE NotifyPhase;
112 };
113
114 extern EFI_GUID gEdkiiSdMmcOverrideProtocolGuid;
115
116 #endif