TianoCore EDK2 master
|
#include "SdMmcPciHcDxe.h"
Go to the source code of this file.
Functions | |
EFI_STATUS | SdCardReset (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot) |
EFI_STATUS | SdCardVoltageCheck (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT8 SupplyVoltage, IN UINT8 CheckPattern) |
EFI_STATUS | SdioSendOpCond (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT32 VoltageWindow, IN BOOLEAN S18R) |
EFI_STATUS | SdCardSendOpCond (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN UINT32 VoltageWindow, IN BOOLEAN S18R, IN BOOLEAN Xpc, IN BOOLEAN Hcs, OUT UINT32 *Ocr) |
EFI_STATUS | SdCardAllSendCid (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot) |
EFI_STATUS | SdCardSetRca (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, OUT UINT16 *Rca) |
EFI_STATUS | SdCardSelect (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca) |
EFI_STATUS | SdCardVoltageSwitch (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot) |
EFI_STATUS | SdCardSetBusWidth (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN UINT8 BusWidth) |
EFI_STATUS | SdCardSwitch (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN SD_MMC_BUS_MODE BusTiming, IN UINT8 CommandSystem, IN SD_DRIVER_STRENGTH_TYPE DriverStrength, IN UINT8 PowerLimit, IN BOOLEAN Mode, OUT UINT8 *SwitchResp) |
EFI_STATUS | SdCardSendStatus (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, OUT UINT32 *DevStatus) |
EFI_STATUS | SdCardSendTuningBlk (IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot) |
EFI_STATUS | SdCardTuningClock (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot) |
EFI_STATUS | SdCardSwitchBusWidth (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN UINT8 BusWidth) |
BOOLEAN | SdIsBusTimingSupported (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 CardSupportedBusTimings, IN BOOLEAN IsInUhsI, IN SD_MMC_BUS_MODE BusTiming) |
SD_MMC_BUS_MODE | SdGetTargetBusTiming (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 CardSupportedBusTimings, IN BOOLEAN IsInUhsI) |
UINT8 | SdGetTargetBusWidth (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming) |
UINT32 | SdGetTargetBusClockFreq (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN SD_MMC_BUS_MODE BusTiming) |
EDKII_SD_MMC_DRIVER_STRENGTH | SdGetTargetDriverStrength (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 CardSupportedDriverStrengths, IN SD_MMC_BUS_MODE BusTiming) |
VOID | SdGetTargetBusMode (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 SlotIndex, IN UINT8 *SwitchQueryResp, IN BOOLEAN IsInUhsI, OUT SD_MMC_BUS_SETTINGS *BusMode) |
EFI_STATUS | SdCardSetBusMode (IN EFI_PCI_IO_PROTOCOL *PciIo, IN EFI_SD_MMC_PASS_THRU_PROTOCOL *PassThru, IN UINT8 Slot, IN UINT16 Rca, IN BOOLEAN S18A, IN BOOLEAN SdVersion1) |
EFI_STATUS | SdCardIdentification (IN SD_MMC_HC_PRIVATE_DATA *Private, IN UINT8 Slot) |
This file provides some helper functions which are specific for SD card device.
Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SdDevice.c.
EFI_STATUS SdCardAllSendCid | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot | ||
) |
Broadcast command ALL_SEND_CID to the bus to ask all the SD devices to send the data of their CID registers.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 243 of file SdDevice.c.
EFI_STATUS SdCardIdentification | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | Slot | ||
) |
Execute SD device identification procedure.
Refer to SD Physical Layer Simplified Spec 4.1 Section 3.6 for details.
[in] | Private | A pointer to the SD_MMC_HC_PRIVATE_DATA instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | There is a SD card. |
Others | There is not a SD card. |
Definition at line 1210 of file SdDevice.c.
EFI_STATUS SdCardReset | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot | ||
) |
Send command GO_IDLE_STATE to the device to make it go to Idle State.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The SD device is reset correctly. |
Others | The device reset fails. |
Definition at line 25 of file SdDevice.c.
EFI_STATUS SdCardSelect | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT16 | Rca | ||
) |
Send command SELECT_DESELECT_CARD to the SD device to select/deselect it.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address of selected device. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 330 of file SdDevice.c.
EFI_STATUS SdCardSendOpCond | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT16 | Rca, | ||
IN UINT32 | VoltageWindow, | ||
IN BOOLEAN | S18R, | ||
IN BOOLEAN | Xpc, | ||
IN BOOLEAN | Hcs, | ||
OUT UINT32 * | Ocr | ||
) |
Send command SD_SEND_OP_COND to the device to see whether it is SDIO device.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address of addressed device. |
[in] | VoltageWindow | The supply voltage window. |
[in] | S18R | The boolean to show if it should switch to 1.8v. |
[in] | Xpc | The boolean to show if it should provide 0.36w power control. |
[in] | Hcs | The boolean to show if it support host capacity info. |
[out] | Ocr | The buffer to store returned OCR register value. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 171 of file SdDevice.c.
EFI_STATUS SdCardSendStatus | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT16 | Rca, | ||
OUT UINT32 * | DevStatus | ||
) |
Send command SEND_STATUS to the addressed SD device to get its status register.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address of addressed device. |
[out] | DevStatus | The returned device status. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 580 of file SdDevice.c.
EFI_STATUS SdCardSendTuningBlk | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot | ||
) |
Send command SEND_TUNING_BLOCK to the SD device for HS200 optimal sampling point detection.
It may be sent up to 40 times until the host finishes the tuning procedure.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 629 of file SdDevice.c.
EFI_STATUS SdCardSetBusMode | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, | ||
IN UINT8 | Slot, | ||
IN UINT16 | Rca, | ||
IN BOOLEAN | S18A, | ||
IN BOOLEAN | SdVersion1 | ||
) |
Switch the high speed timing according to request.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 and SD Host Controller Simplified Spec 3.0 section Figure 2-29 for details.
[in] | PciIo | A pointer to the EFI_PCI_IO_PROTOCOL instance. |
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address to be assigned. |
[in] | S18A | The boolean to show if it's a UHS-I SD card. |
[in] | SdVersion1 | The boolean to show if it's a Version 1 SD card. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 1084 of file SdDevice.c.
EFI_STATUS SdCardSetBusWidth | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT16 | Rca, | ||
IN UINT8 | BusWidth | ||
) |
Send command SET_BUS_WIDTH to the SD device to set the bus width.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address of addressed device. |
[in] | BusWidth | The bus width to be set, it could be 1 or 4. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 418 of file SdDevice.c.
EFI_STATUS SdCardSetRca | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
OUT UINT16 * | Rca | ||
) |
Send command SET_RELATIVE_ADDR to the SD device to assign a Relative device Address (RCA).
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[out] | Rca | The relative device address to assign. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 285 of file SdDevice.c.
EFI_STATUS SdCardSwitch | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN SD_MMC_BUS_MODE | BusTiming, | ||
IN UINT8 | CommandSystem, | ||
IN SD_DRIVER_STRENGTH_TYPE | DriverStrength, | ||
IN UINT8 | PowerLimit, | ||
IN BOOLEAN | Mode, | ||
OUT UINT8 * | SwitchResp | ||
) |
Send command SWITCH_FUNC to the SD device to check switchable function or switch card function.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | BusTiming | Target bus timing based on which access group value will be set. |
[in] | CommandSystem | The value for command set group. |
[in] | DriverStrength | The value for driver strength group. |
[in] | PowerLimit | The value for power limit group. |
[in] | Mode | Switch or check function. |
[out] | SwitchResp | The return switch function status. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 486 of file SdDevice.c.
EFI_STATUS SdCardSwitchBusWidth | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, | ||
IN UINT8 | Slot, | ||
IN UINT16 | Rca, | ||
IN UINT8 | BusWidth | ||
) |
Switch the bus width to specified width.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 and SD Host Controller Simplified Spec 3.0 section Figure 3-7 for details.
[in] | PciIo | A pointer to the EFI_PCI_IO_PROTOCOL instance. |
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | Rca | The relative device address to be assigned. |
[in] | BusWidth | The bus width to be set, it could be 4 or 8. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 753 of file SdDevice.c.
EFI_STATUS SdCardTuningClock | ( | IN EFI_PCI_IO_PROTOCOL * | PciIo, |
IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, | ||
IN UINT8 | Slot | ||
) |
Tunning the sampling point of SDR104 or SDR50 bus speed mode.
Command SD_SEND_TUNING_BLOCK may be sent up to 40 times until the host finishes the tuning procedure.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 and SD Host Controller Simplified Spec 3.0 section Figure 3-7 for details.
[in] | PciIo | A pointer to the EFI_PCI_IO_PROTOCOL instance. |
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 679 of file SdDevice.c.
EFI_STATUS SdCardVoltageCheck | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT8 | SupplyVoltage, | ||
IN UINT8 | CheckPattern | ||
) |
Send command SEND_IF_COND to the device to inquiry the SD Memory Card interface condition.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | SupplyVoltage | The supplied voltage by the host. |
[in] | CheckPattern | The check pattern to be sent to the device. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 67 of file SdDevice.c.
EFI_STATUS SdCardVoltageSwitch | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot | ||
) |
Send command VOLTAGE_SWITCH to the SD device to switch the voltage of the device.
Refer to SD Physical Layer Simplified Spec 4.1 Section 4.7 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 375 of file SdDevice.c.
UINT32 SdGetTargetBusClockFreq | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN SD_MMC_BUS_MODE | BusTiming | ||
) |
Get the target clock frequency to be set on the bus.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | BusTiming | Bus timing to be set on the bus |
Definition at line 960 of file SdDevice.c.
VOID SdGetTargetBusMode | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN UINT8 * | SwitchQueryResp, | ||
IN BOOLEAN | IsInUhsI, | ||
OUT SD_MMC_BUS_SETTINGS * | BusMode | ||
) |
Get the target settings for the bus mode.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | SwitchQueryResp | Pointer to switch query response |
[in] | IsInUhsI | Flag indicating if link is in UHS-I mode |
[out] | BusMode | Target configuration of the bus |
Definition at line 1052 of file SdDevice.c.
SD_MMC_BUS_MODE SdGetTargetBusTiming | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN UINT8 | CardSupportedBusTimings, | ||
IN BOOLEAN | IsInUhsI | ||
) |
Get the target bus timing to set on the link. This function will try to select highest bus timing supported by card, controller and the driver.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | CardSupportedBusTimings | Bitmask indicating which bus timings are supported by card |
[in] | IsInUhsI | Flag indicating if link is in UHS-I |
Definition at line 883 of file SdDevice.c.
UINT8 SdGetTargetBusWidth | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN SD_MMC_BUS_MODE | BusTiming | ||
) |
Get the target bus width to be set on the bus.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | BusTiming | Bus timing set on the bus |
Definition at line 919 of file SdDevice.c.
EDKII_SD_MMC_DRIVER_STRENGTH SdGetTargetDriverStrength | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN UINT8 | CardSupportedDriverStrengths, | ||
IN SD_MMC_BUS_MODE | BusTiming | ||
) |
Get the driver strength to be set on bus.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | CardSupportedDriverStrengths | Bitmask indicating which driver strengths are supported on the card |
[in] | BusTiming | Bus timing set on the bus |
Definition at line 1007 of file SdDevice.c.
EFI_STATUS SdioSendOpCond | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | PassThru, |
IN UINT8 | Slot, | ||
IN UINT32 | VoltageWindow, | ||
IN BOOLEAN | S18R | ||
) |
Send command SDIO_SEND_OP_COND to the device to see whether it is SDIO device.
Refer to SDIO Simplified Spec 3 Section 3.2 for details.
[in] | PassThru | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | The slot number of the SD card to send the command to. |
[in] | VoltageWindow | The supply voltage window. |
[in] | S18R | The boolean to show if it should switch to 1.8v. |
EFI_SUCCESS | The operation is done correctly. |
Others | The operation fails. |
Definition at line 118 of file SdDevice.c.
BOOLEAN SdIsBusTimingSupported | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN UINT8 | SlotIndex, | ||
IN UINT8 | CardSupportedBusTimings, | ||
IN BOOLEAN | IsInUhsI, | ||
IN SD_MMC_BUS_MODE | BusTiming | ||
) |
Check if passed BusTiming is supported in both controller and card.
[in] | Private | Pointer to controller private data |
[in] | SlotIndex | Index of the slot in the controller |
[in] | CardSupportedBusTimings | Bitmask indicating which bus timings are supported by card |
[in] | IsInUhsI | Flag indicating if link is in UHS-I |
TRUE | Both card and controller support given BusTiming |
FALSE | Card or controller doesn't support given BusTiming |
Definition at line 801 of file SdDevice.c.