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