TianoCore EDK2 master
|
#include "SdMmcPciHcDxe.h"
Go to the source code of this file.
Macros | |
#define | SLOT_INIT_TEMPLATE |
This driver is used to manage SD/MMC PCI host controllers which are compliance with SD Host Controller Simplified Specification version 3.00 plus the 64-bit System Addressing support in SD Host Controller Simplified Specification version 4.20.
It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use.
Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file SdMmcPciHcDxe.c.
#define SLOT_INIT_TEMPLATE |
Definition at line 31 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI InitializeSdMmcPciHcDxe | ( | IN EFI_HANDLE | ImageHandle, |
IN EFI_SYSTEM_TABLE * | SystemTable | ||
) |
The entry point for SD host controller driver, used to install this driver on the ImageHandle.
[in] | ImageHandle | The firmware allocated handle for this driver image. |
[in] | SystemTable | Pointer to the EFI system table. |
EFI_SUCCESS | Driver loaded. |
other | Driver not loaded. |
Definition at line 122 of file SdMmcPciHcDxe.c.
Call back function when the timer event is signaled.
[in] | Event | The Event this notify function registered to. |
[in] | Context | Pointer to the context data registered to the Event. |
Definition at line 152 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPassThruBuildDevicePath | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | This, |
IN UINT8 | Slot, | ||
IN OUT EFI_DEVICE_PATH_PROTOCOL ** | DevicePath | ||
) |
Used to allocate and build a device path node for an SD card on the SD controller.
The BuildDevicePath() function allocates and builds a single device node for the SD card specified by Slot.
If the SD card specified by Slot is not present on the SD controller, then EFI_NOT_FOUND is returned.
If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.
Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of DevicePath are initialized to describe the SD card specified by Slot, and EFI_SUCCESS is returned.
[in] | This | A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | Specifies the slot number of the SD card for which a device path node is to be allocated and built. |
[in,out] | DevicePath | A pointer to a single device path node that describes the SD card specified by Slot. This function is responsible for allocating the buffer DevicePath with the boot service AllocatePool(). It is the caller's responsibility to free DevicePath when the caller is finished with DevicePath. |
EFI_SUCCESS | The device path node that describes the SD card specified by Slot was allocated and returned in DevicePath. |
EFI_NOT_FOUND | The SD card specified by Slot does not exist on the SD controller. |
EFI_INVALID_PARAMETER | DevicePath is NULL. |
EFI_OUT_OF_RESOURCES | There are not enough resources to allocate DevicePath. |
Definition at line 1266 of file SdMmcPciHcDxe.c.
EFI_STATUS SdMmcPassThruExecSyncTrb | ( | IN SD_MMC_HC_PRIVATE_DATA * | Private, |
IN SD_MMC_HC_TRB * | Trb | ||
) |
Execute TRB synchronously.
[in] | Private | Pointer to driver private data. |
[in] | Trb | Pointer to TRB to execute. |
EFI_SUCCESS | TRB executed successfully. |
Other | TRB failed. |
Definition at line 1018 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPassThruGetNextSlot | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | This, |
IN OUT UINT8 * | Slot | ||
) |
Used to retrieve next slot numbers supported by the SD controller. The function returns information about all available slots (populated or not-populated).
The GetNextSlot() function retrieves the next slot number on an SD controller. If on input Slot is 0xFF, then the slot number of the first slot on the SD controller is returned.
If Slot is a slot number that was returned on a previous call to GetNextSlot(), then the slot number of the next slot on the SD controller is returned.
If Slot is not 0xFF and Slot was not returned on a previous call to GetNextSlot(), EFI_INVALID_PARAMETER is returned.
If Slot is the slot number of the last slot on the SD controller, then EFI_NOT_FOUND is returned.
[in] | This | A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance. |
[in,out] | Slot | On input, a pointer to a slot number on the SD controller. On output, a pointer to the next slot number on the SD controller. An input value of 0xFF retrieves the first slot number on the SD controller. |
EFI_SUCCESS | The next slot number on the SD controller was returned in Slot. |
EFI_NOT_FOUND | There are no more slots on this SD controller. |
EFI_INVALID_PARAMETER | Slot is not 0xFF and Slot was not returned on a previous call to GetNextSlot(). |
Definition at line 1191 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPassThruGetSlotNumber | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | This, |
IN EFI_DEVICE_PATH_PROTOCOL * | DevicePath, | ||
OUT UINT8 * | Slot | ||
) |
This function retrieves an SD card slot number based on the input device path.
The GetSlotNumber() function retrieves slot number for the SD card specified by the DevicePath node. If DevicePath is NULL, EFI_INVALID_PARAMETER is returned.
If DevicePath is not a device path node type that the SD Pass Thru driver supports, EFI_UNSUPPORTED is returned.
[in] | This | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | DevicePath | A pointer to the device path node that describes a SD card on the SD controller. |
[out] | Slot | On return, points to the slot number of an SD card on the SD controller. |
EFI_SUCCESS | SD card slot number is returned in Slot. |
EFI_INVALID_PARAMETER | Slot or DevicePath is NULL. |
EFI_UNSUPPORTED | DevicePath is not a device path node type that the SD Pass Thru driver supports. |
Definition at line 1337 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPassThruPassThru | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | This, |
IN UINT8 | Slot, | ||
IN OUT EFI_SD_MMC_PASS_THRU_COMMAND_PACKET * | Packet, | ||
IN EFI_EVENT Event | OPTIONAL | ||
) |
Sends SD command to an SD card that is attached to the SD controller.
The PassThru() function sends the SD command specified by Packet to the SD card specified by Slot.
If Packet is successfully sent to the SD card, then EFI_SUCCESS is returned.
If a device error occurs while sending the Packet, then EFI_DEVICE_ERROR is returned.
If Slot is not in a valid range for the SD controller, then EFI_INVALID_PARAMETER is returned.
If Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL, EFI_INVALID_PARAMETER is returned.
[in] | This | 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,out] | Packet | A pointer to the SD command data structure. |
[in] | Event | If Event is NULL, blocking I/O is performed. If Event is not NULL, then nonblocking I/O is performed, and Event will be signaled when the Packet completes. |
EFI_SUCCESS | The SD Command Packet was sent by the host. |
EFI_DEVICE_ERROR | A device error occurred while attempting to send the SD command Packet. |
EFI_INVALID_PARAMETER | Packet, Slot, or the contents of the Packet is invalid. |
EFI_INVALID_PARAMETER | Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL. |
EFI_NO_MEDIA | SD Device not present in the Slot. |
EFI_UNSUPPORTED | The command described by the SD Command Packet is not supported by the host controller. |
EFI_BAD_BUFFER_SIZE | The InTransferLength or OutTransferLength exceeds the limit supported by SD card ( i.e. if the number of bytes exceed the Last LBA). |
Definition at line 1100 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPassThruResetDevice | ( | IN EFI_SD_MMC_PASS_THRU_PROTOCOL * | This, |
IN UINT8 | Slot | ||
) |
Resets an SD card that is connected to the SD controller.
The ResetDevice() function resets the SD card specified by Slot.
If this SD controller does not support a device reset operation, EFI_UNSUPPORTED is returned.
If Slot is not in a valid slot number for this SD controller, EFI_INVALID_PARAMETER is returned.
If the device reset operation is completed, EFI_SUCCESS is returned.
[in] | This | A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance. |
[in] | Slot | Specifies the slot number of the SD card to be reset. |
EFI_SUCCESS | The SD card specified by Slot was reset. |
EFI_UNSUPPORTED | The SD controller does not support a device reset operation. |
EFI_INVALID_PARAMETER | Slot number is invalid. |
EFI_NO_MEDIA | SD Device not present in the Slot. |
EFI_DEVICE_ERROR | The reset command failed due to a device error |
Definition at line 1411 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPciHcDriverBindingStart | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Starts a device controller or a bus controller.
The Start() function is designed to be invoked from the EFI boot service ConnectController(). As a result, much of the error checking on the parameters to Start() has been moved into this common boot service. It is legal to call Start() from other locations, but the following calling restrictions must be followed or the system behavior will not be deterministic.
[in] | This | A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. |
[in] | ControllerHandle | The handle of the controller to start. This handle must support a protocol interface that supplies an I/O abstraction to the driver. |
[in] | RemainingDevicePath | A pointer to the remaining portion of a device path. This parameter is ignored by device drivers, and is optional for bus drivers. For a bus driver, if this parameter is NULL, then handles for all the children of Controller are created by this driver. If this parameter is not NULL and the first Device Path Node is not the End of Device Path Node, then only the handle for the child device specified by the first Device Path Node of RemainingDevicePath is created by this driver. If the first Device Path Node of RemainingDevicePath is the End of Device Path Node, no child handle is created by this driver. |
EFI_SUCCESS | The device was started. |
EFI_DEVICE_ERROR | The device could not be started due to a device error.Currently not implemented. |
EFI_OUT_OF_RESOURCES | The request could not be completed due to a lack of resources. |
Others | The driver failded to start the device. |
Definition at line 537 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPciHcDriverBindingStop | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN UINTN | NumberOfChildren, | ||
IN EFI_HANDLE * | ChildHandleBuffer | ||
) |
Stops a device controller or a bus controller.
The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). As a result, much of the error checking on the parameters to Stop() has been moved into this common boot service. It is legal to call Stop() from other locations, but the following calling restrictions must be followed or the system behavior will not be deterministic.
[in] | This | A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. |
[in] | ControllerHandle | A handle to the device being stopped. The handle must support a bus specific I/O protocol for the driver to use to stop the device. |
[in] | NumberOfChildren | The number of child device handles in ChildHandleBuffer. |
[in] | ChildHandleBuffer | An array of child handles to be freed. May be NULL if NumberOfChildren is 0. |
EFI_SUCCESS | The device was stopped. |
EFI_DEVICE_ERROR | The device could not be stopped due to a device error. |
Definition at line 911 of file SdMmcPciHcDxe.c.
EFI_STATUS EFIAPI SdMmcPciHcDriverBindingSupported | ( | IN EFI_DRIVER_BINDING_PROTOCOL * | This, |
IN EFI_HANDLE | Controller, | ||
IN EFI_DEVICE_PATH_PROTOCOL * | RemainingDevicePath | ||
) |
Tests to see if this driver supports a given controller. If a child device is provided, it further tests to see if this driver supports creating a handle for the specified child device.
This function checks to see if the driver specified by This supports the device specified by ControllerHandle. Drivers will typically use the device path attached to ControllerHandle and/or the services from the bus I/O abstraction attached to ControllerHandle to determine if the driver supports ControllerHandle. This function may be called many times during platform initialization. In order to reduce boot times, the tests performed by this function must be very small, and take as little time as possible to execute. This function must not change the state of any hardware devices, and this function must be aware that the device specified by ControllerHandle may already be managed by the same driver or a different driver. This function must match its calls to AllocatePages() with FreePages(), AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). Since ControllerHandle may have been previously started by the same driver, if a protocol is already in the opened state, then it must not be closed with CloseProtocol(). This is required to guarantee the state of ControllerHandle is not modified by this function.
[in] | This | A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance. |
[in] | ControllerHandle | The handle of the controller to test. This handle must support a protocol interface that supplies an I/O abstraction to the driver. |
[in] | RemainingDevicePath | A pointer to the remaining portion of a device path. This parameter is ignored by device drivers, and is optional for bus drivers. For bus drivers, if this parameter is not NULL, then the bus driver must determine if the bus controller specified by ControllerHandle and the child controller specified by RemainingDevicePath are both supported by this bus driver. |
EFI_SUCCESS | The device specified by ControllerHandle and RemainingDevicePath is supported by the driver specified by This. |
EFI_ALREADY_STARTED | The device specified by ControllerHandle and RemainingDevicePath is already being managed by the driver specified by This. |
EFI_ACCESS_DENIED | The device specified by ControllerHandle and RemainingDevicePath is already being managed by a different driver or an application that requires exclusive access. Currently not implemented. |
EFI_UNSUPPORTED | The device specified by ControllerHandle and RemainingDevicePath is not supported by the driver specified by This. |
Definition at line 396 of file SdMmcPciHcDxe.c.
Sd removable device enumeration callback function when the timer event is signaled.
[in] | Event | The Event this notify function registered to. |
[in] | Context | Pointer to the context data registered to the Event. |
Definition at line 242 of file SdMmcPciHcDxe.c.
EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding |
Definition at line 22 of file SdMmcPciHcDxe.c.
SD_MMC_HC_PRIVATE_DATA gSdMmcPciHcTemplate |
Definition at line 39 of file SdMmcPciHcDxe.c.
CARD_TYPE_DETECT_ROUTINE mCardTypeDetectRoutineTable[] |
Definition at line 104 of file SdMmcPciHcDxe.c.
EMMC_DEVICE_PATH mEmmcDpTemplate |
Definition at line 88 of file SdMmcPciHcDxe.c.
EDKII_SD_MMC_OVERRIDE* mOverride |
Definition at line 17 of file SdMmcPciHcDxe.c.
SD_DEVICE_PATH mSdDpTemplate |
Definition at line 76 of file SdMmcPciHcDxe.c.