diff options
Diffstat (limited to 'MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h')
-rw-r--r-- | MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h | 271 |
1 files changed, 137 insertions, 134 deletions
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h index fb69aa4baf..85e09cf114 100644 --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h @@ -35,11 +35,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include "SdMmcPciHci.h"
-extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName;
-extern EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2;
-extern EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding;
+extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName;
+extern EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2;
+extern EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding;
-extern EDKII_SD_MMC_OVERRIDE *mOverride;
+extern EDKII_SD_MMC_OVERRIDE *mOverride;
#define SD_MMC_HC_PRIVATE_SIGNATURE SIGNATURE_32 ('s', 'd', 't', 'f')
@@ -49,18 +49,18 @@ extern EDKII_SD_MMC_OVERRIDE *mOverride; //
// Generic time out value, 1 microsecond as unit.
//
-#define SD_MMC_HC_GENERIC_TIMEOUT 1 * 1000 * 1000
+#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)
+#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)
+#define SD_MMC_HC_ENUM_TIMER EFI_TIMER_PERIOD_MILLISECONDS(100)
typedef enum {
UnknownCardType,
@@ -78,97 +78,97 @@ typedef enum { } EFI_SD_MMC_SLOT_TYPE;
typedef struct {
- BOOLEAN Enable;
- EFI_SD_MMC_SLOT_TYPE SlotType;
- BOOLEAN MediaPresent;
- BOOLEAN Initialized;
- SD_MMC_CARD_TYPE CardType;
- UINT64 CurrentFreq;
- EDKII_SD_MMC_OPERATING_PARAMETERS OperatingParameters;
+ BOOLEAN Enable;
+ EFI_SD_MMC_SLOT_TYPE SlotType;
+ BOOLEAN MediaPresent;
+ BOOLEAN Initialized;
+ SD_MMC_CARD_TYPE CardType;
+ UINT64 CurrentFreq;
+ EDKII_SD_MMC_OPERATING_PARAMETERS OperatingParameters;
} SD_MMC_HC_SLOT;
typedef struct {
- UINTN Signature;
+ UINTN Signature;
- EFI_HANDLE ControllerHandle;
- EFI_PCI_IO_PROTOCOL *PciIo;
+ EFI_HANDLE ControllerHandle;
+ EFI_PCI_IO_PROTOCOL *PciIo;
- EFI_SD_MMC_PASS_THRU_PROTOCOL PassThru;
+ EFI_SD_MMC_PASS_THRU_PROTOCOL PassThru;
- UINT64 PciAttributes;
+ UINT64 PciAttributes;
//
// The field is used to record the previous slot in GetNextSlot().
//
- UINT8 PreviousSlot;
+ UINT8 PreviousSlot;
//
// For Non-blocking operation.
//
- EFI_EVENT TimerEvent;
+ EFI_EVENT TimerEvent;
//
// For Sd removable device enumeration.
//
- EFI_EVENT ConnectEvent;
- LIST_ENTRY Queue;
+ 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];
- UINT16 ControllerVersion[SD_MMC_HC_MAX_SLOT];
+ 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];
+ UINT16 ControllerVersion[SD_MMC_HC_MAX_SLOT];
//
// Some controllers may require to override base clock frequency
// value stored in Capabilities Register 1.
//
- UINT32 BaseClkFreq[SD_MMC_HC_MAX_SLOT];
+ UINT32 BaseClkFreq[SD_MMC_HC_MAX_SLOT];
} SD_MMC_HC_PRIVATE_DATA;
typedef struct {
- SD_MMC_BUS_MODE BusTiming;
- UINT8 BusWidth;
- UINT32 ClockFreq;
- EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength;
+ SD_MMC_BUS_MODE BusTiming;
+ UINT8 BusWidth;
+ UINT32 ClockFreq;
+ EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength;
} SD_MMC_BUS_SETTINGS;
-#define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
+#define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
-#define SD_MMC_TRB_RETRIES 5
+#define SD_MMC_TRB_RETRIES 5
//
// 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;
- SD_MMC_HC_ADMA_LENGTH_MODE AdmaLengthMode;
-
- EFI_EVENT Event;
- BOOLEAN Started;
- BOOLEAN CommandComplete;
- UINT64 Timeout;
- UINT32 Retries;
-
- BOOLEAN PioModeTransferCompleted;
- UINT32 PioBlockIndex;
-
- SD_MMC_HC_ADMA_32_DESC_LINE *Adma32Desc;
- SD_MMC_HC_ADMA_64_V3_DESC_LINE *Adma64V3Desc;
- SD_MMC_HC_ADMA_64_V4_DESC_LINE *Adma64V4Desc;
- EFI_PHYSICAL_ADDRESS AdmaDescPhy;
- VOID *AdmaMap;
- UINT32 AdmaPages;
-
- SD_MMC_HC_PRIVATE_DATA *Private;
+ 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;
+ SD_MMC_HC_ADMA_LENGTH_MODE AdmaLengthMode;
+
+ EFI_EVENT Event;
+ BOOLEAN Started;
+ BOOLEAN CommandComplete;
+ UINT64 Timeout;
+ UINT32 Retries;
+
+ BOOLEAN PioModeTransferCompleted;
+ UINT32 PioBlockIndex;
+
+ SD_MMC_HC_ADMA_32_DESC_LINE *Adma32Desc;
+ SD_MMC_HC_ADMA_64_V3_DESC_LINE *Adma64V3Desc;
+ SD_MMC_HC_ADMA_64_V4_DESC_LINE *Adma64V4Desc;
+ 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) \
@@ -178,22 +178,23 @@ typedef struct { // 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;
+ 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.
@@ -207,8 +208,8 @@ typedef struct { typedef
EFI_STATUS
(*CARD_TYPE_DETECT_ROUTINE) (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
);
/**
@@ -251,10 +252,10 @@ EFI_STATUS 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
+ 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
);
/**
@@ -289,8 +290,8 @@ SdMmcPassThruPassThru ( EFI_STATUS
EFIAPI
SdMmcPassThruGetNextSlot (
- IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
- IN OUT UINT8 *Slot
+ IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
+ IN OUT UINT8 *Slot
);
/**
@@ -330,9 +331,9 @@ SdMmcPassThruGetNextSlot ( EFI_STATUS
EFIAPI
SdMmcPassThruBuildDevicePath (
- IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
- IN UINT8 Slot,
- IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
+ IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
+ IN UINT8 Slot,
+ IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
);
/**
@@ -359,9 +360,9 @@ SdMmcPassThruBuildDevicePath ( EFI_STATUS
EFIAPI
SdMmcPassThruGetSlotNumber (
- IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
- IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
- OUT UINT8 *Slot
+ IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
+ IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
+ OUT UINT8 *Slot
);
/**
@@ -390,13 +391,14 @@ SdMmcPassThruGetSlotNumber ( EFI_STATUS
EFIAPI
SdMmcPassThruResetDevice (
- IN EFI_SD_MMC_PASS_THRU_PROTOCOL *This,
- IN UINT8 Slot
+ 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.
@@ -442,9 +444,9 @@ SdMmcPassThruResetDevice ( EFI_STATUS
EFIAPI
SdMmcPciHcDriverBindingSupported (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -485,9 +487,9 @@ SdMmcPciHcDriverBindingSupported ( EFI_STATUS
EFIAPI
SdMmcPciHcDriverBindingStart (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
+ IN EFI_DRIVER_BINDING_PROTOCOL *This,
+ IN EFI_HANDLE Controller,
+ IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
);
/**
@@ -519,15 +521,16 @@ SdMmcPciHcDriverBindingStart ( EFI_STATUS
EFIAPI
SdMmcPciHcDriverBindingStop (
- IN EFI_DRIVER_BINDING_PROTOCOL *This,
- IN EFI_HANDLE Controller,
- IN UINTN NumberOfChildren,
- IN EFI_HANDLE *ChildHandleBuffer
+ 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.
@@ -570,9 +573,9 @@ SdMmcPciHcDriverBindingStop ( EFI_STATUS
EFIAPI
SdMmcPciHcComponentNameGetDriverName (
- IN EFI_COMPONENT_NAME_PROTOCOL *This,
- IN CHAR8 *Language,
- OUT CHAR16 **DriverName
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN CHAR8 *Language,
+ OUT CHAR16 **DriverName
);
/**
@@ -646,11 +649,11 @@ SdMmcPciHcComponentNameGetDriverName ( 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
+ IN EFI_COMPONENT_NAME_PROTOCOL *This,
+ IN EFI_HANDLE ControllerHandle,
+ IN EFI_HANDLE ChildHandle OPTIONAL,
+ IN CHAR8 *Language,
+ OUT CHAR16 **ControllerName
);
/**
@@ -668,10 +671,10 @@ SdMmcPciHcComponentNameGetControllerName ( **/
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
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot,
+ IN EFI_SD_MMC_PASS_THRU_COMMAND_PACKET *Packet,
+ IN EFI_EVENT Event
);
/**
@@ -682,7 +685,7 @@ SdMmcCreateTrb ( **/
VOID
SdMmcFreeTrb (
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -698,8 +701,8 @@ SdMmcFreeTrb ( **/
EFI_STATUS
SdMmcCheckTrbEnv (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -715,8 +718,8 @@ SdMmcCheckTrbEnv ( **/
EFI_STATUS
SdMmcWaitTrbEnv (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -731,8 +734,8 @@ SdMmcWaitTrbEnv ( **/
EFI_STATUS
SdMmcExecTrb (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -748,8 +751,8 @@ SdMmcExecTrb ( **/
EFI_STATUS
SdMmcCheckTrbResult (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -764,8 +767,8 @@ SdMmcCheckTrbResult ( **/
EFI_STATUS
SdMmcWaitTrbResult (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN SD_MMC_HC_TRB *Trb
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN SD_MMC_HC_TRB *Trb
);
/**
@@ -782,8 +785,8 @@ SdMmcWaitTrbResult ( **/
EFI_STATUS
EmmcIdentification (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
);
/**
@@ -800,8 +803,8 @@ EmmcIdentification ( **/
EFI_STATUS
SdCardIdentification (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
);
/**
@@ -840,8 +843,8 @@ SdMmcHcClockSupply ( **/
EFI_STATUS
SdMmcHcReset (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
);
/**
@@ -857,8 +860,8 @@ SdMmcHcReset ( **/
EFI_STATUS
SdMmcHcInitHost (
- IN SD_MMC_HC_PRIVATE_DATA *Private,
- IN UINT8 Slot
+ IN SD_MMC_HC_PRIVATE_DATA *Private,
+ IN UINT8 Slot
);
#endif
|