MdeModulePkg/SdMmc: Add EDKII SD/MMC stack
This stack includes: 1. Dxe phase support by: 1) SdMmcPciHcDxe driver to consume PciIo and produce SdMmcPassThru. 2) SdDxe driver to consume SdMmcPassThru to produce BlkIo1/BlkIo2. 3) EmmcDxe driver to consume SdMmcPassThru to produce BlkIo1/BlkIo2/SSP. 2. Pei phase support 1) SdBlockIoPei driver to consume SdMmcHostController Ppi and produce VirutalBlkIo1&2. 2) EmmcBlockIoPei driver to consume SdMmcHostController Ppi and produce VirutalBlkIo1&2. 3) SdMmcPciHcPei driver to produce SdMmcHostController Ppi. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Feng Tian <feng.tian@intel.com> Reviewed-by: Hao Wu <hao.a.wu@intel.com>
This commit is contained in:
211
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/ComponentName.c
Normal file
211
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/ComponentName.c
Normal file
@@ -0,0 +1,211 @@
|
||||
/** @file
|
||||
UEFI Component Name(2) protocol implementation for SD/MMC host controller driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "SdMmcPciHcDxe.h"
|
||||
|
||||
//
|
||||
// EFI Component Name Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName = {
|
||||
SdMmcPciHcComponentNameGetDriverName,
|
||||
SdMmcPciHcComponentNameGetControllerName,
|
||||
"eng"
|
||||
};
|
||||
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) SdMmcPciHcComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) SdMmcPciHcComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSdMmcPciHcDriverNameTable[] = {
|
||||
{ "eng;en", L"Edkii Sd/Mmc Host Controller Driver" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mSdMmcPciHcControllerNameTable[] = {
|
||||
{ "eng;en", L"Edkii Sd/Mmc Host Controller" },
|
||||
{ NULL , NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
)
|
||||
{
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mSdMmcPciHcDriverNameTable,
|
||||
DriverName,
|
||||
(BOOLEAN)(This == &gSdMmcPciHcComponentName)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle, OPTIONAL
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
if (Language == NULL || ControllerName == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
//
|
||||
if (ChildHandle != NULL) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
//
|
||||
// Make sure this driver is currently managing ControllerHandle
|
||||
//
|
||||
Status = EfiTestManagedDevice (
|
||||
ControllerHandle,
|
||||
gSdMmcPciHcDriverBinding.DriverBindingHandle,
|
||||
&gEfiPciIoProtocolGuid
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
|
||||
return LookupUnicodeString2 (
|
||||
Language,
|
||||
This->SupportedLanguages,
|
||||
mSdMmcPciHcControllerNameTable,
|
||||
ControllerName,
|
||||
(BOOLEAN)(This == &gSdMmcPciHcComponentName)
|
||||
);
|
||||
}
|
1152
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
Normal file
1152
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
Normal file
File diff suppressed because it is too large
Load Diff
1165
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
Normal file
1165
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
Normal file
File diff suppressed because it is too large
Load Diff
1261
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
Normal file
1261
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
Normal file
File diff suppressed because it is too large
Load Diff
784
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
Normal file
784
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h
Normal file
@@ -0,0 +1,784 @@
|
||||
/** @file
|
||||
|
||||
Provides some data structure definitions used by the SD/MMC host controller driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SD_MMC_PCI_HC_DXE_H_
|
||||
#define _SD_MMC_PCI_HC_DXE_H_
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
#include <IndustryStandard/Emmc.h>
|
||||
#include <IndustryStandard/Sd.h>
|
||||
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Protocol/ComponentName2.h>
|
||||
#include <Protocol/SdMmcPassThru.h>
|
||||
|
||||
#include "SdMmcPciHci.h"
|
||||
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding;
|
||||
|
||||
#define SD_MMC_HC_PRIVATE_SIGNATURE SIGNATURE_32 ('s', 'd', 't', 'f')
|
||||
|
||||
#define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
|
||||
CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
|
||||
|
||||
//
|
||||
// Generic time out value, 1 microsecond as unit.
|
||||
//
|
||||
#define SD_MMC_HC_GENERIC_TIMEOUT 1 * 1000 * 1000
|
||||
|
||||
//
|
||||
// SD/MMC async transfer timer interval, set by experience.
|
||||
// The unit is 100us, takes 1ms as interval.
|
||||
//
|
||||
#define SD_MMC_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS(1)
|
||||
//
|
||||
// SD/MMC removable device enumeration timer interval, set by experience.
|
||||
// The unit is 100us, takes 100ms as interval.
|
||||
//
|
||||
#define SD_MMC_HC_ENUM_TIMER EFI_TIMER_PERIOD_MILLISECONDS(100)
|
||||
|
||||
typedef enum {
|
||||
UnknownCardType,
|
||||
SdCardType,
|
||||
SdioCardType,
|
||||
MmcCardType,
|
||||
EmmcCardType
|
||||
} SD_MMC_CARD_TYPE;
|
||||
|
||||
typedef enum {
|
||||
RemovableSlot,
|
||||
EmbeddedSlot,
|
||||
SharedBusSlot,
|
||||
UnknownSlot
|
||||
} EFI_SD_MMC_SLOT_TYPE;
|
||||
|
||||
typedef struct {
|
||||
BOOLEAN Enable;
|
||||
EFI_SD_MMC_SLOT_TYPE SlotType;
|
||||
BOOLEAN MediaPresent;
|
||||
SD_MMC_CARD_TYPE CardType;
|
||||
} SD_MMC_HC_SLOT;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EFI_HANDLE ControllerHandle;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
EFI_SD_MMC_PASS_THRU_PROTOCOL PassThru;
|
||||
|
||||
UINT64 PciAttributes;
|
||||
//
|
||||
// The field is used to record the previous slot in GetNextSlot().
|
||||
//
|
||||
UINT8 PreviousSlot;
|
||||
//
|
||||
// For Non-blocking operation.
|
||||
//
|
||||
EFI_EVENT TimerEvent;
|
||||
//
|
||||
// For Sd removable device enumeration.
|
||||
//
|
||||
EFI_EVENT ConnectEvent;
|
||||
LIST_ENTRY Queue;
|
||||
|
||||
SD_MMC_HC_SLOT Slot[SD_MMC_HC_MAX_SLOT];
|
||||
SD_MMC_HC_SLOT_CAP Capability[SD_MMC_HC_MAX_SLOT];
|
||||
UINT64 MaxCurrent[SD_MMC_HC_MAX_SLOT];
|
||||
|
||||
UINT32 ControllerVersion;
|
||||
} SD_MMC_HC_PRIVATE_DATA;
|
||||
|
||||
#define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
|
||||
|
||||
//
|
||||
// TRB (Transfer Request Block) contains information for the cmd request.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY TrbList;
|
||||
|
||||
UINT8 Slot;
|
||||
UINT16 BlockSize;
|
||||
|
||||
EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
VOID *Data;
|
||||
UINT32 DataLen;
|
||||
BOOLEAN Read;
|
||||
EFI_PHYSICAL_ADDRESS DataPhy;
|
||||
VOID *DataMap;
|
||||
SD_MMC_HC_TRANSFER_MODE Mode;
|
||||
|
||||
EFI_EVENT Event;
|
||||
BOOLEAN Started;
|
||||
UINT64 Timeout;
|
||||
|
||||
SD_MMC_HC_ADMA_DESC_LINE *AdmaDesc;
|
||||
EFI_PHYSICAL_ADDRESS AdmaDescPhy;
|
||||
VOID *AdmaMap;
|
||||
UINT32 AdmaPages;
|
||||
|
||||
SD_MMC_HC_PRIVATE_DATA *Private;
|
||||
} SD_MMC_HC_TRB;
|
||||
|
||||
#define SD_MMC_HC_TRB_FROM_THIS(a) \
|
||||
CR(a, SD_MMC_HC_TRB, TrbList, SD_MMC_HC_TRB_SIG)
|
||||
|
||||
//
|
||||
// Task for Non-blocking mode.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 Signature;
|
||||
LIST_ENTRY Link;
|
||||
|
||||
UINT8 Slot;
|
||||
EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet;
|
||||
BOOLEAN IsStart;
|
||||
EFI_EVENT Event;
|
||||
UINT64 RetryTimes;
|
||||
BOOLEAN InfiniteWait;
|
||||
VOID *Map;
|
||||
VOID *MapAddress;
|
||||
} SD_MMC_HC_QUEUE;
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
/**
|
||||
Execute card identification procedure.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS The card is identified correctly.
|
||||
@retval Others The card can't be identified.
|
||||
|
||||
**/
|
||||
typedef
|
||||
EFI_STATUS
|
||||
(*CARD_TYPE_DETECT_ROUTINE) (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in,out] Packet A pointer to the SD command data structure.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_SUCCESS The SD Command Packet was sent by the host.
|
||||
@retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SD
|
||||
command Packet.
|
||||
@retval EFI_INVALID_PARAMETER Packet, Slot, or the contents of the Packet is invalid.
|
||||
@retval EFI_INVALID_PARAMETER Packet defines a data command but both InDataBuffer and
|
||||
OutDataBuffer are NULL.
|
||||
@retval EFI_NO_MEDIA SD Device not present in the Slot.
|
||||
@retval EFI_UNSUPPORTED The command described by the SD Command Packet is not
|
||||
supported by the host controller.
|
||||
@retval 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).
|
||||
|
||||
**/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_SUCCESS The next slot number on the SD controller was returned in Slot.
|
||||
@retval EFI_NOT_FOUND There are no more slots on this SD controller.
|
||||
@retval EFI_INVALID_PARAMETER Slot is not 0xFF and Slot was not returned on a previous call
|
||||
to GetNextSlot().
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPassThruGetNextSlot (
|
||||
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
|
||||
IN OUT UINT8 *Slot
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
|
||||
@param[in] Slot Specifies the slot number of the SD card for which a device
|
||||
path node is to be allocated and built.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_SUCCESS The device path node that describes the SD card specified by
|
||||
Slot was allocated and returned in DevicePath.
|
||||
@retval EFI_NOT_FOUND The SD card specified by Slot does not exist on the SD controller.
|
||||
@retval EFI_INVALID_PARAMETER DevicePath is NULL.
|
||||
@retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPassThruBuildDevicePath (
|
||||
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 Slot,
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
|
||||
@param[in] DevicePath A pointer to the device path node that describes a SD
|
||||
card on the SD controller.
|
||||
@param[out] Slot On return, points to the slot number of an SD card on
|
||||
the SD controller.
|
||||
|
||||
@retval EFI_SUCCESS SD card slot number is returned in Slot.
|
||||
@retval EFI_INVALID_PARAMETER Slot or DevicePath is NULL.
|
||||
@retval EFI_UNSUPPORTED DevicePath is not a device path node type that the SD
|
||||
Pass Thru driver supports.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPassThruGetSlotNumber (
|
||||
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
|
||||
OUT 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.
|
||||
|
||||
@param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
|
||||
@param[in] Slot Specifies the slot number of the SD card to be reset.
|
||||
|
||||
@retval EFI_SUCCESS The SD card specified by Slot was reset.
|
||||
@retval EFI_UNSUPPORTED The SD controller does not support a device reset operation.
|
||||
@retval EFI_INVALID_PARAMETER Slot number is invalid.
|
||||
@retval EFI_NO_MEDIA SD Device not present in the Slot.
|
||||
@retval EFI_DEVICE_ERROR The reset command failed due to a device error
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPassThruResetDevice (
|
||||
IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
//
|
||||
// Driver model protocol interfaces
|
||||
//
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||
@param[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.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_SUCCESS The device specified by ControllerHandle and
|
||||
RemainingDevicePath is supported by the driver specified by This.
|
||||
@retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
|
||||
RemainingDevicePath is already being managed by the driver
|
||||
specified by This.
|
||||
@retval 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.
|
||||
@retval EFI_UNSUPPORTED The device specified by ControllerHandle and
|
||||
RemainingDevicePath is not supported by the driver specified by This.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcDriverBindingSupported (
|
||||
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.
|
||||
1. ControllerHandle must be a valid EFI_HANDLE.
|
||||
2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
|
||||
EFI_DEVICE_PATH_PROTOCOL.
|
||||
3. Prior to calling Start(), the Supported() function for the driver specified by This must
|
||||
have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
|
||||
|
||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||
@param[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.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_SUCCESS The device was started.
|
||||
@retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
|
||||
@retval Others The driver failded to start the device.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
|
||||
same driver's Start() function.
|
||||
2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
|
||||
EFI_HANDLE. In addition, all of these handles must have been created in this driver's
|
||||
Start() function, and the Start() function must have called OpenProtocol() on
|
||||
ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
|
||||
|
||||
@param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
|
||||
@param[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.
|
||||
@param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
|
||||
@param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
|
||||
if NumberOfChildren is 0.
|
||||
|
||||
@retval EFI_SUCCESS The device was stopped.
|
||||
@retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
//
|
||||
// EFI Component Name Functions
|
||||
//
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the driver.
|
||||
|
||||
This function retrieves the user readable name of a driver in the form of a
|
||||
Unicode string. If the driver specified by This has a user readable name in
|
||||
the language specified by Language, then a pointer to the driver name is
|
||||
returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
|
||||
by This does not support the language specified by Language,
|
||||
then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified
|
||||
in RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param DriverName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
driver specified by This in the language
|
||||
specified by Language.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the Driver specified by
|
||||
This and the language specified by Language was
|
||||
returned in DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER DriverName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcComponentNameGetDriverName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
|
||||
This function retrieves the user readable name of the controller specified by
|
||||
ControllerHandle and ChildHandle in the form of a Unicode string. If the
|
||||
driver specified by This has a user readable name in the language specified by
|
||||
Language, then a pointer to the controller name is returned in ControllerName,
|
||||
and EFI_SUCCESS is returned. If the driver specified by This is not currently
|
||||
managing the controller specified by ControllerHandle and ChildHandle,
|
||||
then EFI_UNSUPPORTED is returned. If the driver specified by This does not
|
||||
support the language specified by Language, then EFI_UNSUPPORTED is returned.
|
||||
|
||||
@param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
|
||||
EFI_COMPONENT_NAME_PROTOCOL instance.
|
||||
|
||||
@param ControllerHandle[in] The handle of a controller that the driver
|
||||
specified by This is managing. This handle
|
||||
specifies the controller whose name is to be
|
||||
returned.
|
||||
|
||||
@param ChildHandle[in] The handle of the child controller to retrieve
|
||||
the name of. This is an optional parameter that
|
||||
may be NULL. It will be NULL for device
|
||||
drivers. It will also be NULL for a bus drivers
|
||||
that wish to retrieve the name of the bus
|
||||
controller. It will not be NULL for a bus
|
||||
driver that wishes to retrieve the name of a
|
||||
child controller.
|
||||
|
||||
@param Language[in] A pointer to a Null-terminated ASCII string
|
||||
array indicating the language. This is the
|
||||
language of the driver name that the caller is
|
||||
requesting, and it must match one of the
|
||||
languages specified in SupportedLanguages. The
|
||||
number of languages supported by a driver is up
|
||||
to the driver writer. Language is specified in
|
||||
RFC 4646 or ISO 639-2 language code format.
|
||||
|
||||
@param ControllerName[out] A pointer to the Unicode string to return.
|
||||
This Unicode string is the name of the
|
||||
controller specified by ControllerHandle and
|
||||
ChildHandle in the language specified by
|
||||
Language from the point of view of the driver
|
||||
specified by This.
|
||||
|
||||
@retval EFI_SUCCESS The Unicode string for the user readable name in
|
||||
the language specified by Language for the
|
||||
driver specified by This was returned in
|
||||
DriverName.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
|
||||
EFI_HANDLE.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER Language is NULL.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerName is NULL.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This is not currently
|
||||
managing the controller specified by
|
||||
ControllerHandle and ChildHandle.
|
||||
|
||||
@retval EFI_UNSUPPORTED The driver specified by This does not support
|
||||
the language specified by Language.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcPciHcComponentNameGetControllerName (
|
||||
IN EFI_COMPONENT_NAME_PROTOCOL *This,
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN EFI_HANDLE ChildHandle, OPTIONAL
|
||||
IN CHAR8 *Language,
|
||||
OUT CHAR16 **ControllerName
|
||||
);
|
||||
|
||||
/**
|
||||
Create a new TRB for the SD/MMC cmd request.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] Packet A pointer to the SD command data structure.
|
||||
@param[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.
|
||||
|
||||
@return Created Trb or NULL.
|
||||
|
||||
**/
|
||||
SD_MMC_HC_TRB *
|
||||
SdMmcCreateTrb (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN UINT8 Slot,
|
||||
IN EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet,
|
||||
IN EFI_EVENT Event
|
||||
);
|
||||
|
||||
/**
|
||||
Free the resource used by the TRB.
|
||||
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
**/
|
||||
VOID
|
||||
SdMmcFreeTrb (
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Check if the env is ready for execute specified TRB.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
@retval EFI_SUCCESS The env is ready for TRB execution.
|
||||
@retval EFI_NOT_READY The env is not ready for TRB execution.
|
||||
@retval Others Some erros happen.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcCheckTrbEnv (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Wait for the env to be ready for execute specified TRB.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
@retval EFI_SUCCESS The env is ready for TRB execution.
|
||||
@retval EFI_TIMEOUT The env is not ready for TRB execution in time.
|
||||
@retval Others Some erros happen.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcWaitTrbEnv (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Execute the specified TRB.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
@retval EFI_SUCCESS The TRB is sent to host controller successfully.
|
||||
@retval Others Some erros happen when sending this request to the host controller.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcExecTrb (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Check the TRB execution result.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
@retval EFI_SUCCESS The TRB is executed successfully.
|
||||
@retval EFI_NOT_READY The TRB is not completed for execution.
|
||||
@retval Others Some erros happen when executing this request.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcCheckTrbResult (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Wait for the TRB execution result.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
|
||||
|
||||
@retval EFI_SUCCESS The TRB is executed successfully.
|
||||
@retval Others Some erros happen when executing this request.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcWaitTrbResult (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN SD_MMC_HC_TRB *Trb
|
||||
);
|
||||
|
||||
/**
|
||||
Execute EMMC device identification procedure.
|
||||
|
||||
Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS There is a EMMC card.
|
||||
@retval Others There is not a EMMC card.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmmcIdentification (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
Execute EMMC device identification procedure.
|
||||
|
||||
Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
|
||||
|
||||
@param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS There is a EMMC card.
|
||||
@retval Others There is not a EMMC card.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdCardIdentification (
|
||||
IN SD_MMC_HC_PRIVATE_DATA *Private,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
#endif
|
72
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf
Normal file
72
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.inf
Normal file
@@ -0,0 +1,72 @@
|
||||
## @file
|
||||
# SdMmcPciHcDxe driver is used to manage those host controllers which comply with SD
|
||||
# Host Controller Simplified Specifiction version 3.0.
|
||||
#
|
||||
# It will produce EFI_SD_MMC_PASS_THRU_PROTOCOL to allow sending SD/MMC/eMMC cmds
|
||||
# to specified devices from upper layer.
|
||||
#
|
||||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SdMmcPciHcDxe
|
||||
MODULE_UNI_FILE = SdMmcPciHcDxe.uni
|
||||
FILE_GUID = 8E325979-3FE1-4927-AAE2-8F5C4BD2AF0D
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = InitializeSdMmcPciHcDxe
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
# DRIVER_BINDING = gSdMmcPciHcDxeDriverBinding
|
||||
# COMPONENT_NAME = gSdMmcPciHcDxeComponentName
|
||||
# COMPONENT_NAME2 = gSdMmcPciHcDxeComponentName2
|
||||
#
|
||||
#
|
||||
|
||||
[Sources]
|
||||
SdMmcPciHcDxe.h
|
||||
SdMmcPciHcDxe.c
|
||||
EmmcDevice.c
|
||||
SdDevice.c
|
||||
SdMmcPciHci.h
|
||||
SdMmcPciHci.c
|
||||
ComponentName.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DevicePathLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
MemoryAllocationLib
|
||||
BaseMemoryLib
|
||||
UefiLib
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
|
||||
[Protocols]
|
||||
gEfiDevicePathProtocolGuid ## TO_START
|
||||
gEfiPciIoProtocolGuid ## TO_START
|
||||
gEfiSdMmcPassThruProtocolGuid ## BY_START
|
||||
|
||||
# [Event]
|
||||
# EVENT_TYPE_PERIODIC_TIMER ## SOMETIMES_CONSUMES
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
SdMmcPciHcDxeExtra.uni
|
23
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.uni
Normal file
23
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.uni
Normal file
@@ -0,0 +1,23 @@
|
||||
// /** @file
|
||||
// SdMmcPciHcDxe driver is used to manage those host controllers which comply with SD
|
||||
// Host Controller Simplified Specifiction version 3.0.
|
||||
//
|
||||
// It will produce EFI_SD_MMC_PASS_THRU_PROTOCOL to allow sending SD/MMC/eMMC cmds
|
||||
// to specified devices from upper layer.
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "SD/MMC Pci Host Controller driver to manage SD/MMC host controllers"
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "This driver follows the UEFI driver model and produces SD/MMC Pass Thru protocol for upper layer bus driver."
|
||||
|
19
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxeExtra.uni
Normal file
19
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxeExtra.uni
Normal file
@@ -0,0 +1,19 @@
|
||||
// /** @file
|
||||
// SdMmcPciHcDxe Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions of the BSD License
|
||||
// which accompanies this distribution. The full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"SD/MMC Pci Host Controller Driver"
|
||||
|
||||
|
1901
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
Normal file
1901
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c
Normal file
File diff suppressed because it is too large
Load Diff
546
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
Normal file
546
MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h
Normal file
@@ -0,0 +1,546 @@
|
||||
/** @file
|
||||
|
||||
Provides some data structure definitions used by the SD/MMC host controller driver.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SD_MMC_PCI_HCI_H_
|
||||
#define _SD_MMC_PCI_HCI_H_
|
||||
|
||||
//
|
||||
// SD Host Controller SlotInfo Register Offset
|
||||
//
|
||||
#define SD_MMC_HC_SLOT_OFFSET 0x40
|
||||
|
||||
#define SD_MMC_HC_MAX_SLOT 6
|
||||
|
||||
//
|
||||
// SD Host Controller MMIO Register Offset
|
||||
//
|
||||
#define SD_MMC_HC_SDMA_ADDR 0x00
|
||||
#define SD_MMC_HC_ARG2 0x00
|
||||
#define SD_MMC_HC_BLK_SIZE 0x04
|
||||
#define SD_MMC_HC_BLK_COUNT 0x06
|
||||
#define SD_MMC_HC_ARG1 0x08
|
||||
#define SD_MMC_HC_TRANS_MOD 0x0C
|
||||
#define SD_MMC_HC_COMMAND 0x0E
|
||||
#define SD_MMC_HC_RESPONSE 0x10
|
||||
#define SD_MMC_HC_BUF_DAT_PORT 0x20
|
||||
#define SD_MMC_HC_PRESENT_STATE 0x24
|
||||
#define SD_MMC_HC_HOST_CTRL1 0x28
|
||||
#define SD_MMC_HC_POWER_CTRL 0x29
|
||||
#define SD_MMC_HC_BLK_GAP_CTRL 0x2A
|
||||
#define SD_MMC_HC_WAKEUP_CTRL 0x2B
|
||||
#define SD_MMC_HC_CLOCK_CTRL 0x2C
|
||||
#define SD_MMC_HC_TIMEOUT_CTRL 0x2E
|
||||
#define SD_MMC_HC_SW_RST 0x2F
|
||||
#define SD_MMC_HC_NOR_INT_STS 0x30
|
||||
#define SD_MMC_HC_ERR_INT_STS 0x32
|
||||
#define SD_MMC_HC_NOR_INT_STS_EN 0x34
|
||||
#define SD_MMC_HC_ERR_INT_STS_EN 0x36
|
||||
#define SD_MMC_HC_NOR_INT_SIG_EN 0x38
|
||||
#define SD_MMC_HC_ERR_INT_SIG_EN 0x3A
|
||||
#define SD_MMC_HC_AUTO_CMD_ERR_STS 0x3C
|
||||
#define SD_MMC_HC_HOST_CTRL2 0x3E
|
||||
#define SD_MMC_HC_CAP 0x40
|
||||
#define SD_MMC_HC_MAX_CURRENT_CAP 0x48
|
||||
#define SD_MMC_HC_FORCE_EVT_AUTO_CMD 0x50
|
||||
#define SD_MMC_HC_FORCE_EVT_ERR_INT 0x52
|
||||
#define SD_MMC_HC_ADMA_ERR_STS 0x54
|
||||
#define SD_MMC_HC_ADMA_SYS_ADDR 0x58
|
||||
#define SD_MMC_HC_PRESET_VAL 0x60
|
||||
#define SD_MMC_HC_SHARED_BUS_CTRL 0xE0
|
||||
#define SD_MMC_HC_SLOT_INT_STS 0xFC
|
||||
#define SD_MMC_HC_CTRL_VER 0xFE
|
||||
|
||||
//
|
||||
// The transfer modes supported by SD Host Controller
|
||||
// Simplified Spec 3.0 Table 1-2
|
||||
//
|
||||
typedef enum {
|
||||
SdMmcNoData,
|
||||
SdMmcPioMode,
|
||||
SdMmcSdmaMode,
|
||||
SdMmcAdmaMode
|
||||
} SD_MMC_HC_TRANSFER_MODE;
|
||||
|
||||
//
|
||||
// The maximum data length of each descriptor line
|
||||
//
|
||||
#define ADMA_MAX_DATA_PER_LINE 0x10000
|
||||
|
||||
typedef struct {
|
||||
UINT32 Valid:1;
|
||||
UINT32 End:1;
|
||||
UINT32 Int:1;
|
||||
UINT32 Reserved:1;
|
||||
UINT32 Act:2;
|
||||
UINT32 Reserved1:10;
|
||||
UINT32 Length:16;
|
||||
UINT32 Address;
|
||||
} SD_MMC_HC_ADMA_DESC_LINE;
|
||||
|
||||
#define SD_MMC_SDMA_BOUNDARY 512 * 1024
|
||||
#define SD_MMC_SDMA_ROUND_UP(x, n) (((x) + n) & ~(n - 1))
|
||||
|
||||
typedef struct {
|
||||
UINT8 FirstBar:3; // bit 0:2
|
||||
UINT8 Reserved:1; // bit 3
|
||||
UINT8 SlotNum:3; // bit 4:6
|
||||
UINT8 Reserved1:1; // bit 7
|
||||
} SD_MMC_HC_SLOT_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINT32 TimeoutFreq:6; // bit 0:5
|
||||
UINT32 Reserved:1; // bit 6
|
||||
UINT32 TimeoutUnit:1; // bit 7
|
||||
UINT32 BaseClkFreq:8; // bit 8:15
|
||||
UINT32 MaxBlkLen:2; // bit 16:17
|
||||
UINT32 BusWidth8:1; // bit 18
|
||||
UINT32 Adma2:1; // bit 19
|
||||
UINT32 Reserved2:1; // bit 20
|
||||
UINT32 HighSpeed:1; // bit 21
|
||||
UINT32 Sdma:1; // bit 22
|
||||
UINT32 SuspRes:1; // bit 23
|
||||
UINT32 Voltage33:1; // bit 24
|
||||
UINT32 Voltage30:1; // bit 25
|
||||
UINT32 Voltage18:1; // bit 26
|
||||
UINT32 Reserved3:1; // bit 27
|
||||
UINT32 SysBus64:1; // bit 28
|
||||
UINT32 AsyncInt:1; // bit 29
|
||||
UINT32 SlotType:2; // bit 30:31
|
||||
UINT32 Sdr50:1; // bit 32
|
||||
UINT32 Sdr104:1; // bit 33
|
||||
UINT32 Ddr50:1; // bit 34
|
||||
UINT32 Reserved4:1; // bit 35
|
||||
UINT32 DriverTypeA:1; // bit 36
|
||||
UINT32 DriverTypeC:1; // bit 37
|
||||
UINT32 DriverTypeD:1; // bit 38
|
||||
UINT32 DriverType4:1; // bit 39
|
||||
UINT32 TimerCount:4; // bit 40:43
|
||||
UINT32 Reserved5:1; // bit 44
|
||||
UINT32 TuningSDR50:1; // bit 45
|
||||
UINT32 RetuningMod:2; // bit 46:47
|
||||
UINT32 ClkMultiplier:8; // bit 48:55
|
||||
UINT32 Reserved6:7; // bit 56:62
|
||||
UINT32 Hs400:1; // bit 63
|
||||
} SD_MMC_HC_SLOT_CAP;
|
||||
|
||||
/**
|
||||
Dump the content of SD/MMC host controller's Capability Register.
|
||||
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] Capability The buffer to store the capability data.
|
||||
|
||||
**/
|
||||
VOID
|
||||
DumpCapabilityReg (
|
||||
IN UINT8 Slot,
|
||||
IN SD_MMC_HC_SLOT_CAP *Capability
|
||||
);
|
||||
|
||||
/**
|
||||
Read SlotInfo register from SD/MMC host controller pci config space.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[out] FirstBar The buffer to store the first BAR value.
|
||||
@param[out] SlotNum The buffer to store the supported slot number.
|
||||
|
||||
@retval EFI_SUCCESS The operation succeeds.
|
||||
@retval Others The operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcHcGetSlotInfo (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
OUT UINT8 *FirstBar,
|
||||
OUT UINT8 *SlotNum
|
||||
);
|
||||
|
||||
/**
|
||||
Read/Write specified SD/MMC host controller mmio register.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] BarIndex The BAR index of the standard PCI Configuration
|
||||
header to use as the base address for the memory
|
||||
operation to perform.
|
||||
@param[in] Offset The offset within the selected BAR to start the
|
||||
memory operation.
|
||||
@param[in] Read A boolean to indicate it's read or write operation.
|
||||
@param[in] Count The width of the mmio register in bytes.
|
||||
Must be 1, 2 , 4 or 8 bytes.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The PciIo or Data is NULL or the Count is not valid.
|
||||
@retval EFI_SUCCESS The read/write operation succeeds.
|
||||
@retval Others The read/write operation fails.
|
||||
|
||||
**/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
Do OR operation with the value of the specified SD/MMC host controller mmio register.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] BarIndex The BAR index of the standard PCI Configuration
|
||||
header to use as the base address for the memory
|
||||
operation to perform.
|
||||
@param[in] Offset The offset within the selected BAR to start the
|
||||
memory operation.
|
||||
@param[in] Count The width of the mmio register in bytes.
|
||||
Must be 1, 2 , 4 or 8 bytes.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The PciIo or OrData is NULL or the Count is not valid.
|
||||
@retval EFI_SUCCESS The OR operation succeeds.
|
||||
@retval Others The OR operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcHcOrMmio (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT32 Offset,
|
||||
IN UINT8 Count,
|
||||
IN VOID *OrData
|
||||
);
|
||||
|
||||
/**
|
||||
Do AND operation with the value of the specified SD/MMC host controller mmio register.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] BarIndex The BAR index of the standard PCI Configuration
|
||||
header to use as the base address for the memory
|
||||
operation to perform.
|
||||
@param[in] Offset The offset within the selected BAR to start the
|
||||
memory operation.
|
||||
@param[in] Count The width of the mmio register in bytes.
|
||||
Must be 1, 2 , 4 or 8 bytes.
|
||||
@param[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.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The PciIo or AndData is NULL or the Count is not valid.
|
||||
@retval EFI_SUCCESS The AND operation succeeds.
|
||||
@retval Others The AND operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SdMmcHcAndMmio (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 BarIndex,
|
||||
IN UINT32 Offset,
|
||||
IN UINT8 Count,
|
||||
IN VOID *AndData
|
||||
);
|
||||
|
||||
/**
|
||||
Wait for the value of the specified MMIO register set to the test value.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] BarIndex The BAR index of the standard PCI Configuration
|
||||
header to use as the base address for the memory
|
||||
operation to perform.
|
||||
@param[in] Offset The offset within the selected BAR to start the
|
||||
memory operation.
|
||||
@param[in] Count The width of the mmio register in bytes.
|
||||
Must be 1, 2, 4 or 8 bytes.
|
||||
@param[in] MaskValue The mask value of memory.
|
||||
@param[in] TestValue The test value of memory.
|
||||
@param[in] Timeout The time out value for wait memory set, uses 1
|
||||
microsecond as a unit.
|
||||
|
||||
@retval EFI_TIMEOUT The MMIO register hasn't expected value in timeout
|
||||
range.
|
||||
@retval EFI_SUCCESS The MMIO register has expected value.
|
||||
@retval Others The MMIO operation fails.
|
||||
|
||||
**/
|
||||
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
|
||||
);
|
||||
|
||||
/**
|
||||
Software reset the specified SD/MMC host controller.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS The software reset executes successfully.
|
||||
@retval Others The software reset fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcReset (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
Set all interrupt status bits in Normal and Error Interrupt Status Enable
|
||||
register.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS The operation executes successfully.
|
||||
@retval Others The operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcEnableInterrupt (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
Get the capability data from the specified slot.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[out] Capability The buffer to store the capability data.
|
||||
|
||||
@retval EFI_SUCCESS The operation executes successfully.
|
||||
@retval Others The operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcGetCapability (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
OUT SD_MMC_HC_SLOT_CAP *Capability
|
||||
);
|
||||
|
||||
/**
|
||||
Get the maximum current capability data from the specified slot.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[out] MaxCurrent The buffer to store the maximum current capability data.
|
||||
|
||||
@retval EFI_SUCCESS The operation executes successfully.
|
||||
@retval Others The operation fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcGetMaxCurrent (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
OUT UINT64 *MaxCurrent
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[out] MediaPresent The pointer to the media present boolean value.
|
||||
|
||||
@retval EFI_SUCCESS There is no media change happened.
|
||||
@retval EFI_MEDIA_CHANGED There is media change happened.
|
||||
@retval Others The detection fails.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcCardDetect (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
OUT BOOLEAN *MediaPresent
|
||||
);
|
||||
|
||||
/**
|
||||
Stop SD/MMC card clock.
|
||||
|
||||
Refer to SD Host Controller Simplified spec 3.0 Section 3.2.2 for details.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS Succeed to stop SD/MMC clock.
|
||||
@retval Others Fail to stop SD/MMC clock.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcStopClock (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
SD/MMC card clock supply.
|
||||
|
||||
Refer to SD Host Controller Simplified spec 3.0 Section 3.2.1 for details.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] ClockFreq The max clock frequency to be set. The unit is KHz.
|
||||
@param[in] Capability The capability of the slot.
|
||||
|
||||
@retval EFI_SUCCESS The clock is supplied successfully.
|
||||
@retval Others The clock isn't supplied successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcClockSupply (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
IN UINT64 ClockFreq,
|
||||
IN SD_MMC_HC_SLOT_CAP Capability
|
||||
);
|
||||
|
||||
/**
|
||||
SD/MMC bus power control.
|
||||
|
||||
Refer to SD Host Controller Simplified spec 3.0 Section 3.3 for details.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] PowerCtrl The value setting to the power control register.
|
||||
|
||||
@retval TRUE There is a SD/MMC card attached.
|
||||
@retval FALSE There is no a SD/MMC card attached.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcPowerControl (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
IN UINT8 PowerCtrl
|
||||
);
|
||||
|
||||
/**
|
||||
Set the SD/MMC bus width.
|
||||
|
||||
Refer to SD Host Controller Simplified spec 3.0 Section 3.4 for details.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] BusWidth The bus width used by the SD/MMC device, it must be 1, 4 or 8.
|
||||
|
||||
@retval EFI_SUCCESS The bus width is set successfully.
|
||||
@retval Others The bus width isn't set successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcSetBusWidth (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
IN UINT16 BusWidth
|
||||
);
|
||||
|
||||
/**
|
||||
Supply SD/MMC card with lowest clock frequency at initialization.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] Capability The capability of the slot.
|
||||
|
||||
@retval EFI_SUCCESS The clock is supplied successfully.
|
||||
@retval Others The clock isn't supplied successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcInitClockFreq (
|
||||
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.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] Capability The capability of the slot.
|
||||
|
||||
@retval EFI_SUCCESS The voltage is supplied successfully.
|
||||
@retval Others The voltage isn't supplied successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcInitPowerVoltage (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
IN SD_MMC_HC_SLOT_CAP Capability
|
||||
);
|
||||
|
||||
/**
|
||||
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.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
|
||||
@retval EFI_SUCCESS The timeout control register is configured successfully.
|
||||
@retval Others The timeout control register isn't configured successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcInitTimeoutCtrl (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot
|
||||
);
|
||||
|
||||
/**
|
||||
Initial SD/MMC host controller with lowest clock frequency, max power and max timeout value
|
||||
at initialization.
|
||||
|
||||
@param[in] PciIo The PCI IO protocol instance.
|
||||
@param[in] Slot The slot number of the SD card to send the command to.
|
||||
@param[in] Capability The capability of the slot.
|
||||
|
||||
@retval EFI_SUCCESS The host controller is initialized successfully.
|
||||
@retval Others The host controller isn't initialized successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SdMmcHcInitHost (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN UINT8 Slot,
|
||||
IN SD_MMC_HC_SLOT_CAP Capability
|
||||
);
|
||||
|
||||
#endif
|
212
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.c
Normal file
212
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.c
Normal file
@@ -0,0 +1,212 @@
|
||||
/** @file
|
||||
SdMmcPciHcPei driver is used to provide platform-dependent info, mainly SD/MMC
|
||||
host controller MMIO base, to upper layer SD/MMC drivers.
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#include "SdMmcPciHcPei.h"
|
||||
|
||||
EDKII_SD_MMC_HOST_CONTROLLER_PPI mSdMmcHostControllerPpi = { GetSdMmcHcMmioBar };
|
||||
|
||||
EFI_PEI_PPI_DESCRIPTOR mPpiList = {
|
||||
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
|
||||
&gEdkiiPeiSdMmcHostControllerPpiGuid,
|
||||
&mSdMmcHostControllerPpi
|
||||
};
|
||||
|
||||
/**
|
||||
Get the MMIO base address of SD/MMC host controller.
|
||||
|
||||
@param[in] This The protocol instance pointer.
|
||||
@param[in] ControllerId The ID of the SD/MMC host controller.
|
||||
@param[in,out] MmioBar The pointer to store the array of available
|
||||
SD/MMC host controller slot MMIO base addresses.
|
||||
The entry number of the array is specified by BarNum.
|
||||
@param[out] BarNum The pointer to store the supported bar number.
|
||||
|
||||
@retval EFI_SUCCESS The operation succeeds.
|
||||
@retval EFI_INVALID_PARAMETER The parameters are invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetSdMmcHcMmioBar (
|
||||
IN EDKII_SD_MMC_HOST_CONTROLLER_PPI *This,
|
||||
IN UINT8 ControllerId,
|
||||
IN OUT UINTN **MmioBar,
|
||||
OUT UINT8 *BarNum
|
||||
)
|
||||
{
|
||||
SD_MMC_HC_PEI_PRIVATE_DATA *Private;
|
||||
|
||||
if ((This == NULL) || (MmioBar == NULL) || (BarNum == NULL)) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
Private = SD_MMC_HC_PEI_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (ControllerId >= Private->TotalSdMmcHcs) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
*MmioBar = &Private->MmioBar[ControllerId].MmioBarAddr[0];
|
||||
*BarNum = (UINT8)Private->MmioBar[ControllerId].SlotNum;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
The user code starts with this function.
|
||||
|
||||
@param FileHandle Handle of the file being invoked.
|
||||
@param PeiServices Describes the list of possible PEI Services.
|
||||
|
||||
@retval EFI_SUCCESS The driver is successfully initialized.
|
||||
@retval Others Can't initialize the driver.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitializeSdMmcHcPeim (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle,
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
{
|
||||
EFI_BOOT_MODE BootMode;
|
||||
EFI_STATUS Status;
|
||||
UINT16 Bus;
|
||||
UINT16 Device;
|
||||
UINT16 Function;
|
||||
UINT32 Size;
|
||||
UINT64 MmioSize;
|
||||
UINT8 SubClass;
|
||||
UINT8 BaseClass;
|
||||
UINT8 SlotInfo;
|
||||
UINT8 SlotNum;
|
||||
UINT8 FirstBar;
|
||||
UINT8 Index;
|
||||
UINT8 Slot;
|
||||
UINT32 BarAddr;
|
||||
SD_MMC_HC_PEI_PRIVATE_DATA *Private;
|
||||
|
||||
//
|
||||
// Shadow this PEIM to run from memory
|
||||
//
|
||||
if (!EFI_ERROR (PeiServicesRegisterForShadow (FileHandle))) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Status = PeiServicesGetBootMode (&BootMode);
|
||||
///
|
||||
/// We do not expose this in S3 boot path, because it is only for recovery.
|
||||
///
|
||||
if (BootMode == BOOT_ON_S3_RESUME) {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
Private = (SD_MMC_HC_PEI_PRIVATE_DATA *) AllocateZeroPool (sizeof (SD_MMC_HC_PEI_PRIVATE_DATA));
|
||||
if (Private == NULL) {
|
||||
DEBUG ((EFI_D_ERROR, "Failed to allocate memory for SD_MMC_HC_PEI_PRIVATE_DATA! \n"));
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Private->Signature = SD_MMC_HC_PEI_SIGNATURE;
|
||||
Private->SdMmcHostControllerPpi = mSdMmcHostControllerPpi;
|
||||
Private->PpiList = mPpiList;
|
||||
Private->PpiList.Ppi = &Private->SdMmcHostControllerPpi;
|
||||
|
||||
BarAddr = PcdGet32 (PcdSdMmcPciHostControllerMmioBase);
|
||||
for (Bus = 0; Bus < 256; Bus++) {
|
||||
for (Device = 0; Device < 32; Device++) {
|
||||
for (Function = 0; Function < 8; Function++) {
|
||||
SubClass = PciRead8 (PCI_LIB_ADDRESS (Bus, Device, Function, 0x0A));
|
||||
BaseClass = PciRead8 (PCI_LIB_ADDRESS (Bus, Device, Function, 0x0B));
|
||||
|
||||
if ((SubClass == PCI_SUBCLASS_SD_HOST_CONTROLLER) && (BaseClass == PCI_CLASS_SYSTEM_PERIPHERAL)) {
|
||||
//
|
||||
// Get the SD/MMC Pci host controller's Slot Info.
|
||||
//
|
||||
SlotInfo = PciRead8 (PCI_LIB_ADDRESS (Bus, Device, Function, SD_MMC_HC_PEI_SLOT_OFFSET));
|
||||
FirstBar = (*(SD_MMC_HC_PEI_SLOT_INFO*)&SlotInfo).FirstBar;
|
||||
SlotNum = (*(SD_MMC_HC_PEI_SLOT_INFO*)&SlotInfo).SlotNum + 1;
|
||||
ASSERT ((FirstBar + SlotNum) < MAX_SD_MMC_SLOTS);
|
||||
|
||||
for (Index = 0, Slot = FirstBar; Slot < (FirstBar + SlotNum); Index++, Slot++) {
|
||||
//
|
||||
// Get the SD/MMC Pci host controller's MMIO region size.
|
||||
//
|
||||
PciAnd16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), (UINT16)~(EFI_PCI_COMMAND_BUS_MASTER | EFI_PCI_COMMAND_MEMORY_SPACE));
|
||||
PciWrite32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4 * Slot), 0xFFFFFFFF);
|
||||
Size = PciRead32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4 * Slot));
|
||||
|
||||
switch (Size & 0x07) {
|
||||
case 0x0:
|
||||
//
|
||||
// Memory space: anywhere in 32 bit address space
|
||||
//
|
||||
MmioSize = (~(Size & 0xFFFFFFF0)) + 1;
|
||||
break;
|
||||
case 0x4:
|
||||
//
|
||||
// Memory space: anywhere in 64 bit address space
|
||||
//
|
||||
MmioSize = Size & 0xFFFFFFF0;
|
||||
PciWrite32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4), 0xFFFFFFFF);
|
||||
Size = PciRead32 (PCI_LIB_ADDRESS(Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4));
|
||||
//
|
||||
// Fix the length to support some spefic 64 bit BAR
|
||||
//
|
||||
Size |= ((UINT32)(-1) << HighBitSet32 (Size));
|
||||
//
|
||||
// Calculate the size of 64bit bar
|
||||
//
|
||||
MmioSize |= LShiftU64 ((UINT64) Size, 32);
|
||||
MmioSize = (~(MmioSize)) + 1;
|
||||
//
|
||||
// Clean the high 32bits of this 64bit BAR to 0 as we only allow a 32bit BAR.
|
||||
//
|
||||
PciWrite32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4 * Slot + 4), 0);
|
||||
break;
|
||||
default:
|
||||
//
|
||||
// Unknown BAR type
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
continue;
|
||||
};
|
||||
//
|
||||
// Assign resource to the SdMmc Pci host controller's MMIO BAR.
|
||||
// Enable the SdMmc Pci host controller by setting BME and MSE bits of PCI_CMD register.
|
||||
//
|
||||
PciWrite32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET + 4 * Slot), BarAddr);
|
||||
PciOr16 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_COMMAND_OFFSET), (EFI_PCI_COMMAND_BUS_MASTER | EFI_PCI_COMMAND_MEMORY_SPACE));
|
||||
//
|
||||
// Record the allocated Mmio base address.
|
||||
//
|
||||
Private->MmioBar[Private->TotalSdMmcHcs].SlotNum++;
|
||||
Private->MmioBar[Private->TotalSdMmcHcs].MmioBarAddr[Index] = BarAddr;
|
||||
BarAddr += (UINT32)MmioSize;
|
||||
}
|
||||
Private->TotalSdMmcHcs++;
|
||||
ASSERT (Private->TotalSdMmcHcs < MAX_SD_MMC_HCS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
/// Install SdMmc Host Controller PPI
|
||||
///
|
||||
Status = PeiServicesInstallPpi (&Private->PpiList);
|
||||
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
return Status;
|
||||
}
|
86
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.h
Normal file
86
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
http://opensource.org/licenses/bsd-license.php.
|
||||
|
||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SD_MMC_PCI_HOST_CONTROLLER_PEI_H_
|
||||
#define _SD_MMC_PCI_HOST_CONTROLLER_PEI_H_
|
||||
|
||||
#include <PiPei.h>
|
||||
|
||||
#include <Ppi/MasterBootMode.h>
|
||||
#include <Ppi/SdMmcHostController.h>
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PciLib.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
|
||||
#define SD_MMC_HC_PEI_SIGNATURE SIGNATURE_32 ('S', 'D', 'M', 'C')
|
||||
|
||||
#define MAX_SD_MMC_HCS 8
|
||||
#define MAX_SD_MMC_SLOTS 6
|
||||
|
||||
//
|
||||
// SD Host Controller SlotInfo Register Offset
|
||||
//
|
||||
#define SD_MMC_HC_PEI_SLOT_OFFSET 0x40
|
||||
|
||||
typedef struct {
|
||||
UINT8 FirstBar:3; // bit 0:2
|
||||
UINT8 Reserved:1; // bit 3
|
||||
UINT8 SlotNum:3; // bit 4:6
|
||||
UINT8 Reserved1:1; // bit 7
|
||||
} SD_MMC_HC_PEI_SLOT_INFO;
|
||||
|
||||
typedef struct {
|
||||
UINTN SlotNum;
|
||||
UINTN MmioBarAddr[MAX_SD_MMC_SLOTS];
|
||||
} SD_MMC_HC_PEI_BAR;
|
||||
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
EDKII_SD_MMC_HOST_CONTROLLER_PPI SdMmcHostControllerPpi;
|
||||
EFI_PEI_PPI_DESCRIPTOR PpiList;
|
||||
UINTN TotalSdMmcHcs;
|
||||
SD_MMC_HC_PEI_BAR MmioBar[MAX_SD_MMC_HCS];
|
||||
} SD_MMC_HC_PEI_PRIVATE_DATA;
|
||||
|
||||
#define SD_MMC_HC_PEI_PRIVATE_DATA_FROM_THIS(a) CR (a, SD_MMC_HC_PEI_PRIVATE_DATA, SdMmcHostControllerPpi, SD_MMC_HC_PEI_SIGNATURE)
|
||||
|
||||
/**
|
||||
Get the MMIO base address of SD/MMC host controller.
|
||||
|
||||
@param[in] This The protocol instance pointer.
|
||||
@param[in] ControllerId The ID of the SD/MMC host controller.
|
||||
@param[in,out] MmioBar The pointer to store the array of available
|
||||
SD/MMC host controller slot MMIO base addresses.
|
||||
The entry number of the array is specified by BarNum.
|
||||
@param[out] BarNum The pointer to store the supported bar number.
|
||||
|
||||
@retval EFI_SUCCESS The operation succeeds.
|
||||
@retval EFI_INVALID_PARAMETER The parameters are invalid.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetSdMmcHcMmioBar (
|
||||
IN EDKII_SD_MMC_HOST_CONTROLLER_PPI *This,
|
||||
IN UINT8 ControllerId,
|
||||
IN OUT UINTN **MmioBar,
|
||||
OUT UINT8 *BarNum
|
||||
);
|
||||
|
||||
#endif
|
56
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.inf
Normal file
56
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.inf
Normal file
@@ -0,0 +1,56 @@
|
||||
## @file
|
||||
# Component Description File For SD/MMC Pci Host Controller Pei Module.
|
||||
#
|
||||
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
# which accompanies this distribution. The full text of the license may be found at
|
||||
# http://opensource.org/licenses/bsd-license.php.
|
||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SdMmcPciHcPei
|
||||
MODULE_UNI_FILE = SdMmcPciHcPei.uni
|
||||
FILE_GUID = 1BB737EF-427A-4144-8B3B-B76EF38515E6
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
ENTRY_POINT = InitializeSdMmcHcPeim
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
SdMmcPciHcPei.c
|
||||
SdMmcPciHcPei.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
PciLib
|
||||
DebugLib
|
||||
PeiServicesLib
|
||||
MemoryAllocationLib
|
||||
PeimEntryPoint
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdSdMmcPciHostControllerMmioBase ## CONSUMES
|
||||
|
||||
[Ppis]
|
||||
gEdkiiPeiSdMmcHostControllerPpiGuid ## PRODUCES
|
||||
|
||||
[Depex]
|
||||
gEfiPeiMasterBootModePpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
|
||||
|
||||
[UserExtensions.TianoCore."ExtraFiles"]
|
||||
SdMmcPciHcPeiExtra.uni
|
22
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.uni
Normal file
22
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPei.uni
Normal file
@@ -0,0 +1,22 @@
|
||||
// /** @file
|
||||
// The SdMmcPciHcPei driver is used by upper layer to retrieve mmio base address
|
||||
// of managed pci-based SD/MMC host controller at PEI phase.
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions
|
||||
// of the BSD License which accompanies this distribution. The
|
||||
// full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
|
||||
#string STR_MODULE_ABSTRACT #language en-US "Providing interface for upper layer to retrieve mmio base address of managed pci-based SD/MMC host controller at PEI phase."
|
||||
|
||||
#string STR_MODULE_DESCRIPTION #language en-US "It implements the interface of getting mmio base address of managed pci-based SD/MMC host controller at PEI phase."
|
||||
|
21
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPeiExtra.uni
Normal file
21
MdeModulePkg/Bus/Pci/SdMmcPciHcPei/SdMmcPciHcPeiExtra.uni
Normal file
@@ -0,0 +1,21 @@
|
||||
// /** @file
|
||||
// SdMmcPciHcPei Localized Strings and Content
|
||||
//
|
||||
// Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
|
||||
//
|
||||
// This program and the accompanying materials
|
||||
// are licensed and made available under the terms and conditions
|
||||
// of the BSD License which accompanies this distribution. The
|
||||
// full text of the license may be found at
|
||||
// http://opensource.org/licenses/bsd-license.php
|
||||
//
|
||||
// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
//
|
||||
// **/
|
||||
|
||||
#string STR_PROPERTIES_MODULE_NAME
|
||||
#language en-US
|
||||
"SD/MMC PCI-Based HC Module for Recovery"
|
||||
|
||||
|
Reference in New Issue
Block a user