]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Include/Protocol/MmcHost.h
Sync up ArmPkg with patch from mailing list. Changed name of BdsLib.h to BdsUnixLib...
[mirror_edk2.git] / ArmPkg / Include / Protocol / MmcHost.h
1 /** @file
2 Definition of the MMC Host Protocol
3
4 Copyright (c) 2011, ARM Limited. All rights reserved.
5
6 This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14 **/
15
16 #ifndef __MMC_HOST_H__
17 #define __MMC_HOST_H__
18
19 ///
20 /// Global ID for the MMC Host Protocol
21 ///
22 #define EFI_MMC_HOST_PROTOCOL_GUID \
23 { 0x3e591c00, 0x9e4a, 0x11df, {0x92, 0x44, 0x00, 0x02, 0xA5, 0xD5, 0xC5, 0x1B } }
24
25 #define MMC_RESPONSE_TYPE_R1 0
26 #define MMC_RESPONSE_TYPE_R1b 0
27 #define MMC_RESPONSE_TYPE_R2 1
28 #define MMC_RESPONSE_TYPE_R3 0
29 #define MMC_RESPONSE_TYPE_R6 0
30 #define MMC_RESPONSE_TYPE_R7 0
31 #define MMC_RESPONSE_TYPE_OCR 0
32 #define MMC_RESPONSE_TYPE_CID 1
33 #define MMC_RESPONSE_TYPE_CSD 1
34 #define MMC_RESPONSE_TYPE_RCA 0
35
36 typedef UINT32 MMC_RESPONSE_TYPE;
37
38 typedef UINT32 MMC_CMD;
39
40 #define MMC_CMD_WAIT_RESPONSE (1 << 16)
41 #define MMC_CMD_LONG_RESPONSE (1 << 17)
42
43 #define MMC_INDX(CMD_INDX) (CMD_INDX & 0xFFFF)
44
45 #define MMC_CMD0 MMC_INDX(0)
46 #define MMC_CMD1 (MMC_INDX(1) | MMC_CMD_WAIT_RESPONSE)
47 #define MMC_CMD2 (MMC_INDX(2) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)
48 #define MMC_CMD3 (MMC_INDX(3) | MMC_CMD_WAIT_RESPONSE)
49 #define MMC_CMD5 (MMC_INDX(5) | MMC_CMD_WAIT_RESPONSE)
50 #define MMC_CMD7 (MMC_INDX(7) | MMC_CMD_WAIT_RESPONSE)
51 #define MMC_CMD8 (MMC_INDX(8) | MMC_CMD_WAIT_RESPONSE)
52 #define MMC_CMD9 (MMC_INDX(9) | MMC_CMD_WAIT_RESPONSE | MMC_CMD_LONG_RESPONSE)
53 #define MMC_CMD11 (MMC_INDX(11) | MMC_CMD_WAIT_RESPONSE)
54 #define MMC_CMD12 (MMC_INDX(12) | MMC_CMD_WAIT_RESPONSE)
55 #define MMC_CMD13 (MMC_INDX(13) | MMC_CMD_WAIT_RESPONSE)
56 #define MMC_CMD16 (MMC_INDX(16) | MMC_CMD_WAIT_RESPONSE)
57 #define MMC_CMD17 (MMC_INDX(17) | MMC_CMD_WAIT_RESPONSE)
58 #define MMC_CMD18 (MMC_INDX(18) | MMC_CMD_WAIT_RESPONSE)
59 #define MMC_CMD20 (MMC_INDX(20) | MMC_CMD_WAIT_RESPONSE)
60 #define MMC_CMD23 (MMC_INDX(23) | MMC_CMD_WAIT_RESPONSE)
61 #define MMC_CMD24 (MMC_INDX(24) | MMC_CMD_WAIT_RESPONSE)
62 #define MMC_CMD55 (MMC_INDX(55) | MMC_CMD_WAIT_RESPONSE)
63 #define MMC_ACMD41 (MMC_INDX(41) | MMC_CMD_WAIT_RESPONSE)
64
65 typedef enum _MMC_STATE {
66 MmcInvalidState = 0,
67 MmcHwInitializationState,
68 MmcIdleState,
69 MmcReadyState,
70 MmcIdentificationState,
71 MmcStandByState,
72 MmcTransferState,
73 MmcSendingDataState,
74 MmcReceiveDataState,
75 MmcProgrammingState,
76 MmcDisconnectState,
77 } MMC_STATE;
78
79 typedef BOOLEAN (*MMC_ISCARDPRESENT)();
80
81 typedef BOOLEAN (*MMC_ISREADONLY)();
82
83 typedef EFI_STATUS (*MMC_BUILDDEVICEPATH)(EFI_DEVICE_PATH_PROTOCOL **DevicePath);
84
85 typedef EFI_STATUS (*MMC_NOTIFYSTATE)(MMC_STATE State);
86
87 typedef EFI_STATUS (*MMC_SENDCOMMAND)(MMC_CMD Cmd, UINT32 Argument);
88
89 typedef EFI_STATUS (*MMC_RECEIVERESPONSE)(MMC_RESPONSE_TYPE Type, UINT32* Buffer);
90
91 typedef EFI_STATUS (*MMC_READBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);
92
93 typedef EFI_STATUS (*MMC_WRITEBLOCKDATA)(EFI_LBA Lba, UINTN Length, UINT32* Buffer);
94
95 typedef struct _EFI_MMC_HOST_PROTOCOL {
96 MMC_ISCARDPRESENT IsCardPresent;
97 MMC_ISREADONLY IsReadOnly;
98 MMC_BUILDDEVICEPATH BuildDevicePath;
99
100 MMC_NOTIFYSTATE NotifyState;
101
102 MMC_SENDCOMMAND SendCommand;
103 MMC_RECEIVERESPONSE ReceiveResponse;
104
105 MMC_READBLOCKDATA ReadBlockData;
106 MMC_WRITEBLOCKDATA WriteBlockData;
107 } EFI_MMC_HOST_PROTOCOL;
108
109 extern EFI_GUID gEfiMmcHostProtocolGuid;
110
111 #endif
112