TianoCore EDK2 master
|
Go to the source code of this file.
Data Structures | |
struct | SD_MMC_HC_ADMA_32_DESC_LINE |
struct | SD_MMC_HC_ADMA_64_V3_DESC_LINE |
struct | SD_MMC_HC_ADMA_64_V4_DESC_LINE |
struct | SD_MMC_HC_SLOT_INFO |
struct | SD_MMC_HC_SLOT_CAP |
Provides some data structure definitions used by the SD/MMC host controller driver.
Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2015, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SdMmcPciHci.h.
#define ADMA_MAX_DATA_PER_LINE_16B SIZE_64KB |
Definition at line 100 of file SdMmcPciHci.h.
#define ADMA_MAX_DATA_PER_LINE_26B SIZE_64MB |
Definition at line 101 of file SdMmcPciHci.h.
#define SD_MMC_HC_26_DATA_LEN_ADMA_EN BIT10 |
Definition at line 206 of file SdMmcPciHci.h.
#define SD_MMC_HC_64_ADDR_EN BIT13 |
Definition at line 205 of file SdMmcPciHci.h.
#define SD_MMC_HC_ADMA_ERR_STS 0x54 |
Definition at line 53 of file SdMmcPciHci.h.
#define SD_MMC_HC_ADMA_SYS_ADDR 0x58 |
Definition at line 54 of file SdMmcPciHci.h.
#define SD_MMC_HC_ARG1 0x08 |
Definition at line 28 of file SdMmcPciHci.h.
#define SD_MMC_HC_ARG2 0x00 |
Definition at line 25 of file SdMmcPciHci.h.
#define SD_MMC_HC_AUTO_CMD_ERR_STS 0x3C |
Definition at line 47 of file SdMmcPciHci.h.
#define SD_MMC_HC_BLK_COUNT 0x06 |
Definition at line 27 of file SdMmcPciHci.h.
#define SD_MMC_HC_BLK_GAP_CTRL 0x2A |
Definition at line 36 of file SdMmcPciHci.h.
#define SD_MMC_HC_BLK_SIZE 0x04 |
Definition at line 26 of file SdMmcPciHci.h.
#define SD_MMC_HC_BUF_DAT_PORT 0x20 |
Definition at line 32 of file SdMmcPciHci.h.
#define SD_MMC_HC_CAP 0x40 |
Definition at line 49 of file SdMmcPciHci.h.
#define SD_MMC_HC_CLOCK_CTRL 0x2C |
Definition at line 38 of file SdMmcPciHci.h.
#define SD_MMC_HC_COMMAND 0x0E |
Definition at line 30 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_DRIVER_STRENGTH_MASK 0x0030 |
Definition at line 75 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_MMC_HS200 0x0003 |
Definition at line 72 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_MMC_HS400 0x0005 |
Definition at line 73 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_MMC_HS_DDR 0x0004 |
Definition at line 71 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_MMC_HS_SDR 0x0001 |
Definition at line 70 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_MMC_LEGACY 0x0000 |
Definition at line 69 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_DDR50 0x0004 |
Definition at line 68 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_MASK 0x0007 |
Definition at line 63 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_SDR104 0x0003 |
Definition at line 67 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_SDR12 0x0000 |
Definition at line 64 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_SDR25 0x0001 |
Definition at line 65 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_UHS_SDR50 0x0002 |
Definition at line 66 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER 0xFE |
Definition at line 58 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_100 0x00 |
Definition at line 194 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_200 0x01 |
Definition at line 195 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_300 0x02 |
Definition at line 196 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_400 0x03 |
Definition at line 197 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_410 0x04 |
Definition at line 198 of file SdMmcPciHci.h.
#define SD_MMC_HC_CTRL_VER_420 0x05 |
Definition at line 199 of file SdMmcPciHci.h.
#define SD_MMC_HC_ERR_INT_SIG_EN 0x3A |
Definition at line 46 of file SdMmcPciHci.h.
#define SD_MMC_HC_ERR_INT_STS 0x32 |
Definition at line 42 of file SdMmcPciHci.h.
#define SD_MMC_HC_ERR_INT_STS_EN 0x36 |
Definition at line 44 of file SdMmcPciHci.h.
#define SD_MMC_HC_FORCE_EVT_AUTO_CMD 0x50 |
Definition at line 51 of file SdMmcPciHci.h.
#define SD_MMC_HC_FORCE_EVT_ERR_INT 0x52 |
Definition at line 52 of file SdMmcPciHci.h.
#define SD_MMC_HC_HOST_CTRL1 0x28 |
Definition at line 34 of file SdMmcPciHci.h.
#define SD_MMC_HC_HOST_CTRL2 0x3E |
Definition at line 48 of file SdMmcPciHci.h.
#define SD_MMC_HC_MAX_CURRENT_CAP 0x48 |
Definition at line 50 of file SdMmcPciHci.h.
#define SD_MMC_HC_MAX_SLOT 6 |
Definition at line 19 of file SdMmcPciHci.h.
#define SD_MMC_HC_NOR_INT_SIG_EN 0x38 |
Definition at line 45 of file SdMmcPciHci.h.
#define SD_MMC_HC_NOR_INT_STS 0x30 |
Definition at line 41 of file SdMmcPciHci.h.
#define SD_MMC_HC_NOR_INT_STS_EN 0x34 |
Definition at line 43 of file SdMmcPciHci.h.
#define SD_MMC_HC_POWER_CTRL 0x29 |
Definition at line 35 of file SdMmcPciHci.h.
#define SD_MMC_HC_PRESENT_STATE 0x24 |
Definition at line 33 of file SdMmcPciHci.h.
#define SD_MMC_HC_PRESET_VAL 0x60 |
Definition at line 55 of file SdMmcPciHci.h.
#define SD_MMC_HC_RESPONSE 0x10 |
Definition at line 31 of file SdMmcPciHci.h.
#define SD_MMC_HC_SDMA_ADDR 0x00 |
Definition at line 24 of file SdMmcPciHci.h.
#define SD_MMC_HC_SHARED_BUS_CTRL 0xE0 |
Definition at line 56 of file SdMmcPciHci.h.
#define SD_MMC_HC_SLOT_INT_STS 0xFC |
Definition at line 57 of file SdMmcPciHci.h.
#define SD_MMC_HC_SLOT_OFFSET 0x40 |
Definition at line 17 of file SdMmcPciHci.h.
#define SD_MMC_HC_SW_RST 0x2F |
Definition at line 40 of file SdMmcPciHci.h.
#define SD_MMC_HC_TIMEOUT_CTRL 0x2E |
Definition at line 39 of file SdMmcPciHci.h.
#define SD_MMC_HC_TRANS_MOD 0x0C |
Definition at line 29 of file SdMmcPciHci.h.
#define SD_MMC_HC_V4_EN BIT12 |
Definition at line 204 of file SdMmcPciHci.h.
#define SD_MMC_HC_WAKEUP_CTRL 0x2B |
Definition at line 37 of file SdMmcPciHci.h.
#define SD_MMC_SDMA_BOUNDARY 512 * 1024 |
Definition at line 145 of file SdMmcPciHci.h.
#define SD_MMC_SDMA_ROUND_UP | ( | x, | |
n | |||
) | (((x) + n) & ~(n - 1)) |
Definition at line 146 of file SdMmcPciHci.h.
enum SD_MMC_HC_ADMA_LENGTH_MODE |
Definition at line 92 of file SdMmcPciHci.h.
enum SD_MMC_HC_TRANSFER_MODE |
Definition at line 80 of file SdMmcPciHci.h.
VOID DumpCapabilityReg | ( | IN UINT8 | Slot, |
IN SD_MMC_HC_SLOT_CAP * | Capability | ||
) |
Dump the content of SD/MMC host controller's Capability Register.
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Capability | The buffer to store the capability data. |
Definition at line 25 of file SdMmcPciHci.c.
EFI_STATUS EFIAPI SdMmcHcAndMmio | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | BarIndex, | ||
IN UINT32 | Offset, | ||
IN UINT8 | Count, | ||
IN VOID * | AndData | ||
) |
Do AND operation with the value of the specified SD/MMC host controller mmio register.
[in] | PciIo | The PCI IO protocol instance. |
[in] | BarIndex | The BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform. |
[in] | Offset | The offset within the selected BAR to start the memory operation. |
[in] | Count | The width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes. |
[in] | AndData | The pointer to the data used to do AND operation. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes. |
EFI_INVALID_PARAMETER | The PciIo or AndData is NULL or the Count is not valid. |
EFI_SUCCESS | The AND operation succeeds. |
Others | The AND operation fails. |
Definition at line 283 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcCardDetect | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
OUT BOOLEAN * | MediaPresent | ||
) |
Detect whether there is a SD/MMC card attached at the specified SD/MMC host controller slot.
Refer to SD Host Controller Simplified spec 3.0 Section 3.1 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[out] | MediaPresent | The pointer to the media present boolean value. |
EFI_SUCCESS | There is no media change happened. |
EFI_MEDIA_CHANGED | There is media change happened. |
Others | The detection fails. |
Definition at line 678 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcEnableInterrupt | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot | ||
) |
Set all interrupt status bits in Normal and Error Interrupt Status Enable register.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The operation executes successfully. |
Others | The operation fails. |
Definition at line 580 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcGetCapability | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
OUT SD_MMC_HC_SLOT_CAP * | Capability | ||
) |
Get the capability data from the specified slot.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[out] | Capability | The buffer to store the capability data. |
EFI_SUCCESS | The operation executes successfully. |
Others | The operation fails. |
Definition at line 618 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcGetControllerVersion | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
OUT UINT16 * | Version | ||
) |
Get the controller version information from the specified slot.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[out] | Version | The buffer to store the version information. |
EFI_SUCCESS | The operation executes successfully. |
Others | The operation fails. |
Definition at line 448 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcGetMaxCurrent | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
OUT UINT64 * | MaxCurrent | ||
) |
Get the maximum current capability data from the specified slot.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[out] | MaxCurrent | The buffer to store the maximum current capability data. |
EFI_SUCCESS | The operation executes successfully. |
Others | The operation fails. |
Definition at line 649 of file SdMmcPciHci.c.
EFI_STATUS EFIAPI SdMmcHcGetSlotInfo | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
OUT UINT8 * | FirstBar, | ||
OUT UINT8 * | SlotNum | ||
) |
Read SlotInfo register from SD/MMC host controller pci config space.
[in] | PciIo | The PCI IO protocol instance. |
[out] | FirstBar | The buffer to store the first BAR value. |
[out] | SlotNum | The buffer to store the supported slot number. |
EFI_SUCCESS | The operation succeeds. |
Others | The operation fails. |
Definition at line 92 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcInitPowerVoltage | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
IN SD_MMC_HC_SLOT_CAP | Capability | ||
) |
Supply SD/MMC card with maximum voltage at initialization.
Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Capability | The capability of the slot. |
EFI_SUCCESS | The voltage is supplied successfully. |
Others | The voltage isn't supplied successfully. |
Definition at line 1127 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcInitTimeoutCtrl | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot | ||
) |
Initialize the Timeout Control register with most conservative value at initialization.
Refer to SD Host Controller Simplified spec 3.0 Section 2.2.15 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The timeout control register is configured successfully. |
Others | The timeout control register isn't configured successfully. |
Definition at line 1187 of file SdMmcPciHci.c.
EFI_STATUS EFIAPI SdMmcHcOrMmio | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | BarIndex, | ||
IN UINT32 | Offset, | ||
IN UINT8 | Count, | ||
IN VOID * | OrData | ||
) |
Do OR operation with the value of the specified SD/MMC host controller mmio register.
[in] | PciIo | The PCI IO protocol instance. |
[in] | BarIndex | The BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform. |
[in] | Offset | The offset within the selected BAR to start the memory operation. |
[in] | Count | The width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes. |
[in] | OrData | The pointer to the data used to do OR operation. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes. |
EFI_INVALID_PARAMETER | The PciIo or OrData is NULL or the Count is not valid. |
EFI_SUCCESS | The OR operation succeeds. |
Others | The OR operation fails. |
Definition at line 225 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcPowerControl | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
IN UINT8 | PowerCtrl | ||
) |
SD/MMC bus power control.
Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | PowerCtrl | The value setting to the power control register. |
TRUE | There is a SD/MMC card attached. |
FALSE | There is no a SD/MMC card attached. |
Definition at line 971 of file SdMmcPciHci.c.
EFI_STATUS EFIAPI SdMmcHcRwMmio | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | BarIndex, | ||
IN UINT32 | Offset, | ||
IN BOOLEAN | Read, | ||
IN UINT8 | Count, | ||
IN OUT VOID * | Data | ||
) |
Read/Write specified SD/MMC host controller mmio register.
[in] | PciIo | The PCI IO protocol instance. |
[in] | BarIndex | The BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform. |
[in] | Offset | The offset within the selected BAR to start the memory operation. |
[in] | Read | A boolean to indicate it's read or write operation. |
[in] | Count | The width of the mmio register in bytes. Must be 1, 2 , 4 or 8 bytes. |
[in,out] | Data | For read operations, the destination buffer to store the results. For write operations, the source buffer to write data from. The caller is responsible for having ownership of the data buffer and ensuring its size not less than Count bytes. |
EFI_INVALID_PARAMETER | The PciIo or Data is NULL or the Count is not valid. |
EFI_SUCCESS | The read/write operation succeeds. |
Others | The read/write operation fails. |
Definition at line 143 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcSetBusWidth | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot, | ||
IN UINT16 | BusWidth | ||
) |
Set the SD/MMC bus width.
Refer to SD Host Controller Simplified spec 3.0 Section 3.4 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | BusWidth | The bus width used by the SD/MMC device, it must be 1, 4 or 8. |
EFI_SUCCESS | The bus width is set successfully. |
Others | The bus width isn't set successfully. |
Definition at line 1011 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcStartSdClock | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot | ||
) |
Start the SD clock.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number. |
EFI_SUCCESS | Succeeded to start the SD clock. |
Others | Failed to start the SD clock. |
Definition at line 785 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcStopClock | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | Slot | ||
) |
Stop SD/MMC card clock.
Refer to SD Host Controller Simplified spec 3.0 Section 3.2.2 for details.
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | Succeed to stop SD/MMC clock. |
Others | Fail to stop SD/MMC clock. |
Definition at line 739 of file SdMmcPciHci.c.
EFI_STATUS SdMmcHcUhsSignaling | ( | IN EFI_HANDLE | ControllerHandle, |
IN EFI_PCI_IO_PROTOCOL * | PciIo, | ||
IN UINT8 | Slot, | ||
IN SD_MMC_BUS_MODE | Timing | ||
) |
Set SD Host Controller control 2 registry according to selected speed.
[in] | ControllerHandle | The handle of the controller. |
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Timing | The timing to select. |
EFI_SUCCESS | The timing is set successfully. |
Others | The timing isn't set successfully. |
Set SD Host Controler control 2 registry according to selected speed.
[in] | ControllerHandle | The handle of the controller. |
[in] | PciIo | The PCI IO protocol instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Timing | The timing to select. |
EFI_SUCCESS | The timing is set successfully. |
Others | The timing isn't set successfully. |
Definition at line 1310 of file SdMmcPciHci.c.
EFI_STATUS EFIAPI SdMmcHcWaitMmioSet | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | BarIndex, | ||
IN UINT32 | Offset, | ||
IN UINT8 | Count, | ||
IN UINT64 | MaskValue, | ||
IN UINT64 | TestValue, | ||
IN UINT64 | Timeout | ||
) |
Wait for the value of the specified MMIO register set to the test value.
[in] | PciIo | The PCI IO protocol instance. |
[in] | BarIndex | The BAR index of the standard PCI Configuration header to use as the base address for the memory operation to perform. |
[in] | Offset | The offset within the selected BAR to start the memory operation. |
[in] | Count | The width of the mmio register in bytes. Must be 1, 2, 4 or 8 bytes. |
[in] | MaskValue | The mask value of memory. |
[in] | TestValue | The test value of memory. |
[in] | Timeout | The time out value for wait memory set, uses 1 microsecond as a unit. |
EFI_TIMEOUT | The MMIO register hasn't expected value in timeout range. |
EFI_SUCCESS | The MMIO register has expected value. |
Others | The MMIO operation fails. |
Definition at line 393 of file SdMmcPciHci.c.
EFI_STATUS SdMmcSetDriverStrength | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN UINT8 | SlotIndex, | ||
IN SD_DRIVER_STRENGTH_TYPE | DriverStrength | ||
) |
Set driver strength in host controller.
[in] | PciIo | The PCI IO protocol instance. |
[in] | SlotIndex | The slot index of the card. |
[in] | DriverStrength | DriverStrength to set in the controller. |
EFI_SUCCESS | Driver strength programmed successfully. |
Others | Failed to set driver strength. |
Definition at line 1399 of file SdMmcPciHci.c.