]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ArmPkg/Universal/MmcDxe/Mmc.h
EmbeddedPkg: Move Universal/MmcDxe from ArmPkg to EmbeddedPkg
[mirror_edk2.git] / ArmPkg / Universal / MmcDxe / Mmc.h
diff --git a/ArmPkg/Universal/MmcDxe/Mmc.h b/ArmPkg/Universal/MmcDxe/Mmc.h
deleted file mode 100644 (file)
index 44ad585..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-/** @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
-\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
-#ifndef __MMC_H\r
-#define __MMC_H\r
-\r
-#include <Uefi.h>\r
-\r
-#include <Protocol/DiskIo.h>\r
-#include <Protocol/BlockIo.h>\r
-#include <Protocol/DevicePath.h>\r
-#include <Protocol/MmcHost.h>\r
-\r
-#include <Library/UefiLib.h>\r
-\r
-#define MMC_TRACE(txt)  DEBUG((EFI_D_BLKIO, "MMC: " txt "\n"))\r
-\r
-#define MMC_IOBLOCKS_READ       0\r
-#define MMC_IOBLOCKS_WRITE      1\r
-\r
-#define MMC_OCR_POWERUP             0x80000000\r
-\r
-#define MMC_CSD_GET_CCC(Response)    (Response[1] >> 20)\r
-#define MMC_CSD_GET_TRANSPEED(Response)    (Response[0] & 0xFF)\r
-#define MMC_CSD_GET_READBLLEN(Response)    ((Response[1] >> 16) & 0xF)\r
-#define MMC_CSD_GET_WRITEBLLEN(Response)  ((Response[3] >> 22) & 0xF)\r
-#define MMC_CSD_GET_FILEFORMAT(Response)  ((Response[3] >> 10) & 0x3)\r
-#define MMC_CSD_GET_FILEFORMATGRP(Response)  ((Response[3] >> 15) & 0x1)\r
-#define MMC_CSD_GET_DEVICESIZE(csd)         (((Response[2] >> 30) & 0x3) | ((Response[1] & 0x3FF) << 2))\r
-#define MMC_CSD_GET_DEVICESIZEMULT(csd)     ((Response[2] >> 15) & 0x7)\r
-\r
-#define MMC_R0_CURRENTSTATE(Response)       ((Response[0] >> 9) & 0xF)\r
-\r
-#define MMC_R0_STATE_IDLE       0\r
-#define MMC_R0_STATE_READY      1\r
-#define MMC_R0_STATE_IDENT      2\r
-#define MMC_R0_STATE_STDBY      3\r
-#define MMC_R0_STATE_TRAN       4\r
-#define MMC_R0_STATE_DATA       5\r
-\r
-typedef enum {\r
-  UNKNOWN_CARD,\r
-  MMC_CARD,              //MMC card\r
-  MMC_CARD_HIGH,         //MMC Card with High capacity\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  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
-} OCR;\r
-\r
-typedef struct {\r
-  UINT32  NOT_USED;   // 1 [0:0]\r
-  UINT32  CRC;        // CRC7 checksum [7:1]\r
-  UINT32  MDT;        // Manufacturing date [19:8]\r
-  UINT32  RESERVED_1; // Reserved [23:20]\r
-  UINT32  PSN;        // Product serial number [55:24]\r
-  UINT8   PRV;        // Product revision [63:56]\r
-  UINT8   PNM[5];     // Product name [64:103]\r
-  UINT16  OID;        // OEM/Application ID [119:104]\r
-  UINT8   MID;        // Manufacturer ID [127:120]\r
-} CID;\r
-\r
-typedef struct {\r
-  UINT8   NOT_USED:           1; // Not used, always 1 [0:0]\r
-  UINT8   CRC:                7; // CRC [7:1]\r
-\r
-  UINT8   RESERVED_1:         2; // Reserved [9:8]\r
-  UINT8   FILE_FORMAT:        2; // File format [11:10]\r
-  UINT8   TMP_WRITE_PROTECT:  1; // Temporary write protection [12:12]\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
-  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
-  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  C_SIZE_MULT:        3; // Device size multiplier [49:47]\r
-  UINT32  VDD_W_CURR_MAX:     3; // Max. write current @ VDD max [52:50]\r
-  UINT32  VDD_W_CURR_MIN:     3; // Max. write current @ VDD min [55:53]\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
-  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  READ_BLK_MISALIGN:  1; // Read block misalignment [77:77]\r
-  UINT32  WRITE_BLK_MISALIGN: 1; // Write block misalignment [78:78]\r
-  UINT32  READ_BL_PARTIAL:    1; // Partial blocks for read allowed [79:79]\r
-  UINT32  READ_BL_LEN:        4; // Max. read data block length [83:80]\r
-  UINT32  CCC:                12;// Card command classes [95:84]\r
-\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
-  UINT8   RESERVED_5:         6; // Reserved [125:120]\r
-  UINT8   CSD_STRUCTURE:      2; // CSD structure [127:126]\r
-} CSD;\r
-\r
-typedef struct  {\r
-  UINT16    RCA;\r
-  CARD_TYPE CardType;\r
-  OCR       OCRData;\r
-  CID       CIDData;\r
-  CSD       CSDData;\r
-} CARD_INFO;\r
-\r
-typedef struct _MMC_HOST_INSTANCE {\r
-  UINTN                     Signature;\r
-  LIST_ENTRY                Link;\r
-  EFI_HANDLE                MmcHandle;\r
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
-\r
-  MMC_STATE                 State;\r
-  EFI_BLOCK_IO_PROTOCOL     BlockIo;\r
-  CARD_INFO                 CardInfo;\r
-  EFI_MMC_HOST_PROTOCOL     *MmcHost;\r
-} MMC_HOST_INSTANCE;\r
-\r
-#define MMC_HOST_INSTANCE_SIGNATURE                 SIGNATURE_32('m', 'm', 'c', 'h')\r
-#define MMC_HOST_INSTANCE_FROM_BLOCK_IO_THIS(a)     CR (a, MMC_HOST_INSTANCE, BlockIo, MMC_HOST_INSTANCE_SIGNATURE)\r
-#define MMC_HOST_INSTANCE_FROM_LINK(a)              CR (a, MMC_HOST_INSTANCE, Link, MMC_HOST_INSTANCE_SIGNATURE)\r
-\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MmcGetDriverName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,\r
-  IN  CHAR8                        *Language,\r
-  OUT CHAR16                       **DriverName\r
-  );\r
-\r
-EFI_STATUS\r
-EFIAPI\r
-MmcGetControllerName (\r
-  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,\r
-  IN  EFI_HANDLE                                      ControllerHandle,\r
-  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,\r
-  IN  CHAR8                                           *Language,\r
-  OUT CHAR16                                          **ControllerName\r
-  );\r
-\r
-extern EFI_COMPONENT_NAME_PROTOCOL  gMmcComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL gMmcComponentName2;\r
-\r
-extern EFI_DRIVER_DIAGNOSTICS2_PROTOCOL gMmcDriverDiagnostics2;\r
-\r
-extern LIST_ENTRY mMmcHostPool;\r
-\r
-/**\r
-  Reset the block device.\r
-\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
-  @param  This                   Indicates a pointer to the calling context.\r
-  @param  ExtendedVerification   Indicates that the driver may perform a more exhaustive\r
-                                 verification operation of the device during reset.\r
-\r
-  @retval EFI_SUCCESS            The block device was reset.\r
-  @retval EFI_DEVICE_ERROR       The block device is not functioning correctly and could not be reset.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmcReset (\r
-  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
-  IN BOOLEAN                  ExtendedVerification\r
-  );\r
-\r
-/**\r
-  Reads the requested number of blocks from the device.\r
-\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
-  @param  This                   Indicates a pointer to the calling context.\r
-  @param  MediaId                The media ID that the read request is for.\r
-  @param  Lba                    The starting logical block address to read from on the device.\r
-  @param  BufferSize             The size of the Buffer in bytes.\r
-                                 This must be a multiple of the intrinsic block size of the device.\r
-  @param  Buffer                 A pointer to the destination buffer for the data. The caller is\r
-                                 responsible for either having implicit or explicit ownership of the buffer.\r
-\r
-  @retval EFI_SUCCESS            The data was read correctly from the device.\r
-  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the read operation.\r
-  @retval EFI_NO_MEDIA           There is no media in the device.\r
-  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
-  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic block size of the device.\r
-  @retval EFI_INVALID_PARAMETER  The read request contains LBAs that are not valid,\r
-                                 or the buffer is not on proper alignment.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmcReadBlocks (\r
-  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
-  IN UINT32                   MediaId,\r
-  IN EFI_LBA                  Lba,\r
-  IN UINTN                    BufferSize,\r
-  OUT VOID                    *Buffer\r
-  );\r
-\r
-/**\r
-  Writes a specified number of blocks to the device.\r
-\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
-  @param  This                   Indicates a pointer to the calling context.\r
-  @param  MediaId                The media ID that the write request is for.\r
-  @param  Lba                    The starting logical block address to be written.\r
-  @param  BufferSize             The size of the Buffer in bytes.\r
-                                 This must be a multiple of the intrinsic block size of the device.\r
-  @param  Buffer                 Pointer to the source buffer for the data.\r
-\r
-  @retval EFI_SUCCESS            The data were written correctly to the device.\r
-  @retval EFI_WRITE_PROTECTED    The device cannot be written to.\r
-  @retval EFI_NO_MEDIA           There is no media in the device.\r
-  @retval EFI_MEDIA_CHANGED      The MediaId is not for the current media.\r
-  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to perform the write operation.\r
-  @retval EFI_BAD_BUFFER_SIZE    The BufferSize parameter is not a multiple of the intrinsic\r
-                                 block size of the device.\r
-  @retval EFI_INVALID_PARAMETER  The write request contains LBAs that are not valid,\r
-                                 or the buffer is not on proper alignment.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmcWriteBlocks (\r
-  IN EFI_BLOCK_IO_PROTOCOL    *This,\r
-  IN UINT32                   MediaId,\r
-  IN EFI_LBA                  Lba,\r
-  IN UINTN                    BufferSize,\r
-  IN VOID                     *Buffer\r
-  );\r
-\r
-/**\r
-  Flushes all modified data to a physical block device.\r
-\r
-  @param  This                   Indicates a pointer to the calling context.\r
-\r
-  @retval EFI_SUCCESS            All outstanding data were written correctly to the device.\r
-  @retval EFI_DEVICE_ERROR       The device reported an error while attempting to write data.\r
-  @retval EFI_NO_MEDIA           There is no media in the device.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-MmcFlushBlocks (\r
-  IN EFI_BLOCK_IO_PROTOCOL  *This\r
-  );\r
-\r
-#endif\r