]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Universal/MmcDxe/Mmc.h
EmbeddedPkg: MmcDxe: move ECSD into CardInfo structure
[mirror_edk2.git] / EmbeddedPkg / Universal / MmcDxe / Mmc.h
index 2904d91484116f497791626724ef4e5e1479f010..f4e0aa0366938bd6cc94b4d64399ee5b50a1d813 100644 (file)
@@ -1,15 +1,15 @@
 /** @file\r
   Main Header file for the MMC DXE driver\r
 \r
 /** @file\r
   Main Header file for the MMC DXE driver\r
 \r
-  Copyright (c) 2011, ARM Limited. All rights reserved.\r
-  \r
-  This program and the accompanying materials                          \r
-  are licensed and made available under the terms and conditions of the BSD License         \r
-  which accompanies this distribution.  The full text of the license may be found at        \r
-  http://opensource.org/licenses/bsd-license.php                                            \r
+  Copyright (c) 2011-2015, ARM Limited. All rights reserved.\r
 \r
 \r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
 \r
 **/\r
 \r
 \r
 **/\r
 \r
@@ -24,6 +24,8 @@
 #include <Protocol/MmcHost.h>\r
 \r
 #include <Library/UefiLib.h>\r
 #include <Protocol/MmcHost.h>\r
 \r
 #include <Library/UefiLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
 \r
 #define MMC_TRACE(txt)  DEBUG((EFI_D_BLKIO, "MMC: " txt "\n"))\r
 \r
 \r
 #define MMC_TRACE(txt)  DEBUG((EFI_D_BLKIO, "MMC: " txt "\n"))\r
 \r
@@ -57,19 +59,20 @@ typedef enum {
   UNKNOWN_CARD,\r
   MMC_CARD,              //MMC card\r
   MMC_CARD_HIGH,         //MMC Card with High capacity\r
   UNKNOWN_CARD,\r
   MMC_CARD,              //MMC card\r
   MMC_CARD_HIGH,         //MMC Card with High capacity\r
+  EMMC_CARD,             //eMMC 4.41 card\r
   SD_CARD,               //SD 1.1 card\r
   SD_CARD_2,             //SD 2.0 or above standard card\r
   SD_CARD_2_HIGH         //SD 2.0 or above high capacity card\r
 } CARD_TYPE;\r
 \r
 typedef struct {\r
   SD_CARD,               //SD 1.1 card\r
   SD_CARD_2,             //SD 2.0 or above standard card\r
   SD_CARD_2_HIGH         //SD 2.0 or above high capacity card\r
 } CARD_TYPE;\r
 \r
 typedef struct {\r
-  UINT32  Reserved0:   7; // 0 \r
+  UINT32  Reserved0:   7; // 0\r
   UINT32  V170_V195:   1; // 1.70V - 1.95V\r
   UINT32  V200_V260:   7; // 2.00V - 2.60V\r
   UINT32  V270_V360:   9; // 2.70V - 3.60V\r
   UINT32  RESERVED_1:  5; // Reserved\r
   UINT32  V170_V195:   1; // 1.70V - 1.95V\r
   UINT32  V200_V260:   7; // 2.00V - 2.60V\r
   UINT32  V270_V360:   9; // 2.70V - 3.60V\r
   UINT32  RESERVED_1:  5; // Reserved\r
-  UINT32  AccessMode:  2; // 00b (byte mode), 10b (sector mode) \r
-  UINT32  Busy:        1; // This bit is set to LOW if the card has not finished the power up routine\r
+  UINT32  AccessMode:  2; // 00b (byte mode), 10b (sector mode)\r
+  UINT32  PowerUp:     1; // This bit is set to LOW if the card has not finished the power up routine\r
 } OCR;\r
 \r
 typedef struct {\r
 } OCR;\r
 \r
 typedef struct {\r
@@ -94,14 +97,14 @@ typedef struct {
   UINT8   PERM_WRITE_PROTECT: 1; // Permanent write protection [13:13]\r
   UINT8   COPY:               1; // Copy flag (OTP) [14:14]\r
   UINT8   FILE_FORMAT_GRP:    1; // File format group [15:15]\r
   UINT8   PERM_WRITE_PROTECT: 1; // Permanent write protection [13:13]\r
   UINT8   COPY:               1; // Copy flag (OTP) [14:14]\r
   UINT8   FILE_FORMAT_GRP:    1; // File format group [15:15]\r
-  \r
+\r
   UINT16  RESERVED_2:         5; // Reserved [20:16]\r
   UINT16  WRITE_BL_PARTIAL:   1; // Partial blocks for write allowed [21:21]\r
   UINT16  WRITE_BL_LEN:       4; // Max. write data block length [25:22]\r
   UINT16  R2W_FACTOR:         3; // Write speed factor [28:26]\r
   UINT16  RESERVED_3:         2; // Reserved [30:29]\r
   UINT16  WP_GRP_ENABLE:      1; // Write protect group enable [31:31]\r
   UINT16  RESERVED_2:         5; // Reserved [20:16]\r
   UINT16  WRITE_BL_PARTIAL:   1; // Partial blocks for write allowed [21:21]\r
   UINT16  WRITE_BL_LEN:       4; // Max. write data block length [25:22]\r
   UINT16  R2W_FACTOR:         3; // Write speed factor [28:26]\r
   UINT16  RESERVED_3:         2; // Reserved [30:29]\r
   UINT16  WP_GRP_ENABLE:      1; // Write protect group enable [31:31]\r
-  \r
+\r
   UINT32  WP_GRP_SIZE:        7; // Write protect group size [38:32]\r
   UINT32  SECTOR_SIZE:        7; // Erase sector size [45:39]\r
   UINT32  ERASE_BLK_EN:       1; // Erase single block enable [46:46]\r
   UINT32  WP_GRP_SIZE:        7; // Write protect group size [38:32]\r
   UINT32  SECTOR_SIZE:        7; // Erase sector size [45:39]\r
   UINT32  ERASE_BLK_EN:       1; // Erase single block enable [46:46]\r
@@ -111,7 +114,7 @@ typedef struct {
   UINT32  VDD_R_CURR_MAX:     3; // Max. read current @ VDD max [58:56]\r
   UINT32  VDD_R_CURR_MIN:     3; // Max. read current @ VDD min [61:59]\r
   UINT32  C_SIZELow2:         2; // Device size [63:62]\r
   UINT32  VDD_R_CURR_MAX:     3; // Max. read current @ VDD max [58:56]\r
   UINT32  VDD_R_CURR_MIN:     3; // Max. read current @ VDD min [61:59]\r
   UINT32  C_SIZELow2:         2; // Device size [63:62]\r
-  \r
+\r
   UINT32  C_SIZEHigh10:       10;// Device size [73:64]\r
   UINT32  RESERVED_4:         2; // Reserved [75:74]\r
   UINT32  DSR_IMP:            1; // DSR implemented [76:76]\r
   UINT32  C_SIZEHigh10:       10;// Device size [73:64]\r
   UINT32  RESERVED_4:         2; // Reserved [75:74]\r
   UINT32  DSR_IMP:            1; // DSR implemented [76:76]\r
@@ -124,7 +127,7 @@ typedef struct {
   UINT8   TRAN_SPEED          ;  // Max. bus clock frequency [103:96]\r
   UINT8   NSAC                ;  // Data read access-time 2 in CLK cycles (NSAC*100) [111:104]\r
   UINT8   TAAC                ;  // Data read access-time 1 [119:112]\r
   UINT8   TRAN_SPEED          ;  // Max. bus clock frequency [103:96]\r
   UINT8   NSAC                ;  // Data read access-time 2 in CLK cycles (NSAC*100) [111:104]\r
   UINT8   TAAC                ;  // Data read access-time 1 [119:112]\r
-  \r
+\r
   UINT8   RESERVED_5:         6; // Reserved [125:120]\r
   UINT8   CSD_STRUCTURE:      2; // CSD structure [127:126]\r
 } CSD;\r
   UINT8   RESERVED_5:         6; // Reserved [125:120]\r
   UINT8   CSD_STRUCTURE:      2; // CSD structure [127:126]\r
 } CSD;\r
@@ -135,6 +138,7 @@ typedef struct  {
   OCR       OCRData;\r
   CID       CIDData;\r
   CSD       CSDData;\r
   OCR       OCRData;\r
   CID       CIDData;\r
   CSD       CSDData;\r
+  UINT32    ECSD[128];      // MMC V4 extended card specific\r
 } CARD_INFO;\r
 \r
 typedef struct _MMC_HOST_INSTANCE {\r
 } CARD_INFO;\r
 \r
 typedef struct _MMC_HOST_INSTANCE {\r
@@ -147,7 +151,7 @@ typedef struct _MMC_HOST_INSTANCE {
   EFI_BLOCK_IO_PROTOCOL     BlockIo;\r
   CARD_INFO                 CardInfo;\r
   EFI_MMC_HOST_PROTOCOL     *MmcHost;\r
   EFI_BLOCK_IO_PROTOCOL     BlockIo;\r
   CARD_INFO                 CardInfo;\r
   EFI_MMC_HOST_PROTOCOL     *MmcHost;\r
-  \r
+\r
   BOOLEAN                   Initialized;\r
 } MMC_HOST_INSTANCE;\r
 \r
   BOOLEAN                   Initialized;\r
 } MMC_HOST_INSTANCE;\r
 \r
@@ -184,7 +188,7 @@ extern LIST_ENTRY mMmcHostPool;
 /**\r
   Reset the block device.\r
 \r
 /**\r
   Reset the block device.\r
 \r
-  This function implements EFI_BLOCK_IO_PROTOCOL.Reset(). \r
+  This function implements EFI_BLOCK_IO_PROTOCOL.Reset().\r
   It resets the block device hardware.\r
   ExtendedVerification is ignored in this implementation.\r
 \r
   It resets the block device hardware.\r
   ExtendedVerification is ignored in this implementation.\r
 \r
@@ -206,7 +210,7 @@ MmcReset (
 /**\r
   Reads the requested number of blocks from the device.\r
 \r
 /**\r
   Reads the requested number of blocks from the device.\r
 \r
-  This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks(). \r
+  This function implements EFI_BLOCK_IO_PROTOCOL.ReadBlocks().\r
   It reads the requested number of blocks from the device.\r
   All the blocks are read, or an error is returned.\r
 \r
   It reads the requested number of blocks from the device.\r
   All the blocks are read, or an error is returned.\r
 \r
@@ -240,7 +244,7 @@ MmcReadBlocks (
 /**\r
   Writes a specified number of blocks to the device.\r
 \r
 /**\r
   Writes a specified number of blocks to the device.\r
 \r
-  This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks(). \r
+  This function implements EFI_BLOCK_IO_PROTOCOL.WriteBlocks().\r
   It writes a specified number of blocks to the device.\r
   All blocks are written, or an error is returned.\r
 \r
   It writes a specified number of blocks to the device.\r
   All blocks are written, or an error is returned.\r
 \r
@@ -288,4 +292,47 @@ MmcFlushBlocks (
   IN EFI_BLOCK_IO_PROTOCOL  *This\r
   );\r
 \r
   IN EFI_BLOCK_IO_PROTOCOL  *This\r
   );\r
 \r
+EFI_STATUS\r
+MmcNotifyState (\r
+  IN MMC_HOST_INSTANCE      *MmcHostInstance,\r
+  IN MMC_STATE               State\r
+  );\r
+\r
+EFI_STATUS\r
+InitializeMmcDevice (\r
+  IN  MMC_HOST_INSTANCE     *MmcHost\r
+  );\r
+\r
+VOID\r
+EFIAPI\r
+CheckCardsCallback (\r
+  IN  EFI_EVENT   Event,\r
+  IN  VOID        *Context\r
+  );\r
+\r
+VOID\r
+PrintCSD (\r
+  IN UINT32* Csd\r
+  );\r
+\r
+VOID\r
+PrintRCA (\r
+  IN UINT32 Rca\r
+  );\r
+\r
+VOID\r
+PrintOCR (\r
+  IN UINT32 Ocr\r
+  );\r
+\r
+VOID\r
+PrintResponseR1 (\r
+  IN  UINT32 Response\r
+  );\r
+\r
+VOID\r
+PrintCID (\r
+  IN UINT32* Cid\r
+  );\r
+\r
 #endif\r
 #endif\r