X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=EmbeddedPkg%2FUniversal%2FMmcDxe%2FMmc.h;h=e84c3c1cdf1b803df5cc70732ba06c20a4b71e5e;hp=542355f1ad358f44386141c14c2cba05aba97b43;hb=b4fdedc2543c6d193c70ae5339a56824a9729e68;hpb=b9d5fe03e660b6b3c423d9ceefd10864cbfcdc6c diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h index 542355f1ad..e84c3c1cdf 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h @@ -1,7 +1,7 @@ /** @file Main Header file for the MMC DXE driver - Copyright (c) 2011, ARM Limited. All rights reserved. + Copyright (c) 2011-2014, ARM Limited. All rights reserved. This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -24,6 +24,7 @@ #include #include +#include #define MMC_TRACE(txt) DEBUG((EFI_D_BLKIO, "MMC: " txt "\n")) @@ -32,14 +33,15 @@ #define MMC_OCR_POWERUP 0x80000000 -#define MMC_CSD_GET_CCC(Response) (Response[1] >> 20) -#define MMC_CSD_GET_TRANSPEED(Response) (Response[0] & 0xFF) -#define MMC_CSD_GET_READBLLEN(Response) ((Response[1] >> 16) & 0xF) -#define MMC_CSD_GET_WRITEBLLEN(Response) ((Response[3] >> 22) & 0xF) -#define MMC_CSD_GET_FILEFORMAT(Response) ((Response[3] >> 10) & 0x3) -#define MMC_CSD_GET_FILEFORMATGRP(Response) ((Response[3] >> 15) & 0x1) -#define MMC_CSD_GET_DEVICESIZE(csd) (((Response[2] >> 30) & 0x3) | ((Response[1] & 0x3FF) << 2)) -#define MMC_CSD_GET_DEVICESIZEMULT(csd) ((Response[2] >> 15) & 0x7) +#define MMC_CSD_GET_CCC(Response) (Response[2] >> 20) +#define MMC_CSD_GET_TRANSPEED(Response) (Response[3] & 0xFF) +#define MMC_CSD_GET_READBLLEN(Response) ((Response[2] >> 16) & 0xF) +#define MMC_CSD_GET_WRITEBLLEN(Response) ((Response[0] >> 22) & 0xF) +#define MMC_CSD_GET_FILEFORMAT(Response) ((Response[0] >> 10) & 0x3) +#define MMC_CSD_GET_FILEFORMATGRP(Response) ((Response[0] >> 15) & 0x1) +#define MMC_CSD_GET_DEVICESIZE(csd) (((Response[1] >> 30) & 0x3) | ((Response[2] & 0x3FF) << 2)) +#define HC_MMC_CSD_GET_DEVICESIZE(Response) ((Response[1] >> 16) | ((Response[2] & 0x40) << 16)); +#define MMC_CSD_GET_DEVICESIZEMULT(csd) ((Response[1] >> 15) & 0x7) #define MMC_R0_READY_FOR_DATA (1 << 8) @@ -56,6 +58,7 @@ typedef enum { UNKNOWN_CARD, MMC_CARD, //MMC card MMC_CARD_HIGH, //MMC Card with High capacity + EMMC_CARD, //eMMC 4.41 card SD_CARD, //SD 1.1 card SD_CARD_2, //SD 2.0 or above standard card SD_CARD_2_HIGH //SD 2.0 or above high capacity card @@ -68,7 +71,7 @@ typedef struct { UINT32 V270_V360: 9; // 2.70V - 3.60V UINT32 RESERVED_1: 5; // Reserved UINT32 AccessMode: 2; // 00b (byte mode), 10b (sector mode) - UINT32 Busy: 1; // This bit is set to LOW if the card has not finished the power up routine + UINT32 PowerUp: 1; // This bit is set to LOW if the card has not finished the power up routine } OCR; typedef struct { @@ -146,6 +149,8 @@ typedef struct _MMC_HOST_INSTANCE { EFI_BLOCK_IO_PROTOCOL BlockIo; CARD_INFO CardInfo; EFI_MMC_HOST_PROTOCOL *MmcHost; + + BOOLEAN Initialized; } MMC_HOST_INSTANCE; #define MMC_HOST_INSTANCE_SIGNATURE SIGNATURE_32('m', 'm', 'c', 'h') @@ -285,4 +290,47 @@ MmcFlushBlocks ( IN EFI_BLOCK_IO_PROTOCOL *This ); +EFI_STATUS +MmcNotifyState ( + IN MMC_HOST_INSTANCE *MmcHostInstance, + IN MMC_STATE State + ); + +EFI_STATUS +InitializeMmcDevice ( + IN MMC_HOST_INSTANCE *MmcHost + ); + +VOID +EFIAPI +CheckCardsCallback ( + IN EFI_EVENT Event, + IN VOID *Context + ); + +VOID +PrintCSD ( + IN UINT32* Csd + ); + +VOID +PrintRCA ( + IN UINT32 Rca + ); + +VOID +PrintOCR ( + IN UINT32 Ocr + ); + +VOID +PrintResponseR1 ( + IN UINT32 Response + ); + +VOID +PrintCID ( + IN UINT32* Cid + ); + #endif