24#define MMC_TRACE(txt) DEBUG((DEBUG_BLKIO, "MMC: " txt "\n"))
26#define MMC_IOBLOCKS_READ 0
27#define MMC_IOBLOCKS_WRITE 1
29#define MMC_OCR_POWERUP 0x80000000
31#define MMC_OCR_ACCESS_MASK 0x3
32#define MMC_OCR_ACCESS_BYTE 0x1
33#define MMC_OCR_ACCESS_SECTOR 0x2
35#define MMC_CSD_GET_CCC(Response) (Response[2] >> 20)
36#define MMC_CSD_GET_TRANSPEED(Response) (Response[3] & 0xFF)
37#define MMC_CSD_GET_READBLLEN(Response) ((Response[2] >> 16) & 0xF)
38#define MMC_CSD_GET_WRITEBLLEN(Response) ((Response[0] >> 22) & 0xF)
39#define MMC_CSD_GET_FILEFORMAT(Response) ((Response[0] >> 10) & 0x3)
40#define MMC_CSD_GET_FILEFORMATGRP(Response) ((Response[0] >> 15) & 0x1)
41#define MMC_CSD_GET_DEVICESIZE(csd) (((Response[1] >> 30) & 0x3) | ((Response[2] & 0x3FF) << 2))
42#define HC_MMC_CSD_GET_DEVICESIZE(Response) ((Response[1] >> 16) | ((Response[2] & 0x40) << 16));
43#define MMC_CSD_GET_DEVICESIZEMULT(csd) ((Response[1] >> 15) & 0x7)
45#define MMC_R0_READY_FOR_DATA (1 << 8)
47#define MMC_R0_CURRENTSTATE(Response) ((Response[0] >> 9) & 0xF)
49#define MMC_R0_STATE_IDLE 0
50#define MMC_R0_STATE_READY 1
51#define MMC_R0_STATE_IDENT 2
52#define MMC_R0_STATE_STDBY 3
53#define MMC_R0_STATE_TRAN 4
54#define MMC_R0_STATE_DATA 5
56#define EMMC_CMD6_ARG_ACCESS(x) (((x) & 0x3) << 24)
57#define EMMC_CMD6_ARG_INDEX(x) (((x) & 0xFF) << 16)
58#define EMMC_CMD6_ARG_VALUE(x) (((x) & 0xFF) << 8)
59#define EMMC_CMD6_ARG_CMD_SET(x) (((x) & 0x7) << 0)
61#define SWITCH_CMD_DATA_LENGTH 64
62#define SD_HIGH_SPEED_SUPPORTED 0x20000
63#define SD_DEFAULT_SPEED 25000000
64#define SD_HIGH_SPEED 50000000
65#define SWITCH_CMD_SUCCESS_MASK 0x0f000000
67#define SD_CARD_CAPACITY 0x00000002
86 UINT32 RESERVED_1 : 5;
87 UINT32 AccessMode : 2;
93 UINT8 SCR_STRUCTURE : 4;
94 UINT8 SD_BUS_WIDTHS : 4;
95 UINT8 DATA_STAT_AFTER_ERASE : 1;
96 UINT8 SD_SECURITY : 3;
97 UINT8 EX_SECURITY_1 : 1;
101 UINT8 EX_SECURITY_2 : 3;
102 UINT8 CMD_SUPPORT : 4;
103 UINT8 RESERVED_2 : 4;
123 UINT8 RESERVED_1 : 2;
124 UINT8 FILE_FORMAT : 2;
125 UINT8 TMP_WRITE_PROTECT : 1;
126 UINT8 PERM_WRITE_PROTECT : 1;
128 UINT8 FILE_FORMAT_GRP : 1;
130 UINT16 RESERVED_2 : 5;
131 UINT16 WRITE_BL_PARTIAL : 1;
132 UINT16 WRITE_BL_LEN : 4;
133 UINT16 R2W_FACTOR : 3;
134 UINT16 RESERVED_3 : 2;
135 UINT16 WP_GRP_ENABLE : 1;
137 UINT32 WP_GRP_SIZE : 7;
138 UINT32 SECTOR_SIZE : 7;
139 UINT32 ERASE_BLK_EN : 1;
140 UINT32 C_SIZE_MULT : 3;
141 UINT32 VDD_W_CURR_MAX : 3;
142 UINT32 VDD_W_CURR_MIN : 3;
143 UINT32 VDD_R_CURR_MAX : 3;
144 UINT32 VDD_R_CURR_MIN : 3;
145 UINT32 C_SIZELow2 : 2;
147 UINT32 C_SIZEHigh10 : 10;
148 UINT32 RESERVED_4 : 2;
150 UINT32 READ_BLK_MISALIGN : 1;
151 UINT32 WRITE_BLK_MISALIGN : 1;
152 UINT32 READ_BL_PARTIAL : 1;
153 UINT32 READ_BL_LEN : 4;
160 UINT8 RESERVED_5 : 2;
162 UINT8 CSD_STRUCTURE : 2;
166 UINT8 RESERVED_1[16];
167 UINT8 SECURE_REMOVAL_TYPE;
168 UINT8 PRODUCT_STATE_AWARENESS_ENABLEMENT;
169 UINT8 MAX_PRE_LOADING_DATA_SIZE[4];
170 UINT8 PRE_LOADING_DATA_SIZE[4];
173 UINT8 MODE_OPERATION_CODES;
178 UINT8 POWER_OFF_NOTIFICATION;
179 UINT8 PACKED_FAILURE_INDEX;
180 UINT8 PACKED_COMMAND_STATUS;
181 UINT8 CONTEXT_CONF[15];
182 UINT8 EXT_PARTITIONS_ATTRIBUTE[2];
183 UINT8 EXCEPTION_EVENTS_STATUS[2];
184 UINT8 EXCEPTION_EVENTS_CTRL[2];
187 UINT8 INI_TIMEOUT_EMU;
188 UINT8 DATA_SECTOR_SIZE;
189 UINT8 USE_NATIVE_SECTOR;
190 UINT8 NATIVE_SECTOR_SIZE;
191 UINT8 VENDOR_SPECIFIC_FIELD[64];
193 UINT8 PROGRAM_CID_CSD_DDR_SUPPORT;
194 UINT8 PERIODIC_WAKEUP;
196 UINT8 PRODUCTION_STATE_AWARENESS;
197 UINT8 SECTOR_BAD_BLK_MGMNT;
199 UINT8 ENH_START_ADDR[4];
200 UINT8 ENH_SIZE_MULT[3];
201 UINT8 GP_SIZE_MULT[12];
202 UINT8 PARTITION_SETTING_COMPLETED;
203 UINT8 PARTITIONS_ATTRIBUTE;
204 UINT8 MAX_ENH_SIZE_MULT[3];
205 UINT8 PARTITIONING_SUPPORT;
207 UINT8 RST_N_FUNCTION;
210 UINT8 SANITIZE_START;
213 UINT8 RPMB_SIZE_MULT;
219 UINT8 BOOT_WP_STATUS;
220 UINT8 ERASE_GROUP_DEF;
222 UINT8 BOOT_BUS_CONDITIONS;
223 UINT8 BOOT_CONFIG_PROT;
224 UINT8 PARTITION_CONFIG;
226 UINT8 ERASED_MEM_CONT;
242 UINT8 DRIVER_STRENGTH;
243 UINT8 OUT_OF_INTERRUPT_TIME;
244 UINT8 PARTITION_SWITCH_TIME;
250 UINT8 MIN_PERF_R_4_26;
251 UINT8 MIN_PERF_W_4_26;
252 UINT8 MIN_PERF_R_8_26_4_52;
253 UINT8 MIN_PERF_W_8_26_4_52;
254 UINT8 MIN_PERF_R_8_52;
255 UINT8 MIN_PERF_W_8_52;
258 UINT8 SLEEP_NOTIFICATION_TIME;
260 UINT8 PRODUCTION_STATE_AWARENESS_TIMEOUT;
263 UINT8 HC_WP_GRP_SIZE;
264 UINT8 REL_WR_SECTOR_C;
265 UINT8 ERASE_TIMEOUT_MULT;
266 UINT8 HC_ERASE_GRP_SIZE;
268 UINT8 BOOT_SIZE_MULTI;
271 UINT8 SECURE_TRIM_MULT;
272 UINT8 SECURE_ERASE_MULT;
273 UINT8 SECURE_FEATURE_SUPPORT;
276 UINT8 MIN_PREF_DDR_R_8_52;
277 UINT8 MIN_PREF_DDR_W_8_52;
278 UINT8 PWR_CL_200_130;
279 UINT8 PWR_CL_200_195;
280 UINT8 PWR_CL_DDR_52_195;
281 UINT8 PWR_CL_DDR_52_360;
283 UINT8 INI_TIMEOUT_AP;
284 UINT8 CORRECTLY_PRG_SECTORS_NUM[4];
286 UINT8 POWER_OFF_LONG_TIME;
287 UINT8 GENERIC_CMD6_TIME;
289 UINT8 PWR_CL_DDR_200_360;
290 UINT8 FIRMWARE_VERSION[8];
291 UINT8 DEVICE_VERSION[2];
292 UINT8 OPTIMAL_TRIM_UNIT_SIZE;
293 UINT8 OPTIMAL_WRITE_SIZE;
294 UINT8 OPTIMAL_READ_SIZE;
296 UINT8 DEVICE_LIFE_TIME_EST_TYP_A;
297 UINT8 DEVICE_LIFE_TIME_EST_TYP_B;
298 UINT8 VENDOR_PROPRIETARY_HEALTH_REPORT[32];
299 UINT8 NUMBER_OF_FW_SECTORS_CORRECTLY_PROGRAMMED[4];
300 UINT8 RESERVED_22[181];
302 UINT8 OPERATION_CODE_TIMEOUT;
304 UINT8 SUPPORTED_MODES;
306 UINT8 LARGE_UNIT_SIZE_M1;
307 UINT8 CONTEXT_CAPABILITIES;
310 UINT8 DATA_TAG_SUPPORT;
311 UINT8 MAX_PACKED_WRITES;
312 UINT8 MAX_PACKED_READS;
316 UINT8 EXT_SECURITY_ERR;
317 UINT8 RESERVED_23[6];
343#define MMC_HOST_INSTANCE_SIGNATURE SIGNATURE_32('m', 'm', 'c', 'h')
344#define MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(a) CR (a, MMC_HOST_INSTANCE, BlockIo, MMC_HOST_INSTANCE_SIGNATURE)
345#define MMC_HOST_INSTANCE_FROM_LINK(a) CR (a, MMC_HOST_INSTANCE, Link, MMC_HOST_INSTANCE_SIGNATURE)
352 OUT CHAR16 **DriverName
362 OUT CHAR16 **ControllerName
391 IN BOOLEAN ExtendedVerification
EFI_STATUS EFIAPI MmcFlushBlocks(IN EFI_BLOCK_IO_PROTOCOL *This)
EFI_STATUS EFIAPI MmcReadBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
EFI_STATUS EFIAPI MmcGetDriverName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN CHAR8 *Language, OUT CHAR16 **DriverName)
EFI_STATUS EFIAPI MmcWriteBlocks(IN EFI_BLOCK_IO_PROTOCOL *This, IN UINT32 MediaId, IN EFI_LBA Lba, IN UINTN BufferSize, IN VOID *Buffer)
EFI_STATUS EFIAPI MmcGetControllerName(IN EFI_COMPONENT_NAME_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_HANDLE ChildHandle OPTIONAL, IN CHAR8 *Language, OUT CHAR16 **ControllerName)
EFI_STATUS EFIAPI MmcReset(IN EFI_BLOCK_IO_PROTOCOL *This, IN BOOLEAN ExtendedVerification)