3 Provides some data structure definitions used by the SD/MMC host controller driver.
5 Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
6 Copyright (c) 2015 - 2020, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
11 #ifndef _SD_MMC_PCI_HC_DXE_H_
12 #define _SD_MMC_PCI_HC_DXE_H_
16 #include <IndustryStandard/Pci.h>
17 #include <IndustryStandard/Emmc.h>
18 #include <IndustryStandard/Sd.h>
20 #include <Library/UefiDriverEntryPoint.h>
21 #include <Library/DebugLib.h>
22 #include <Library/UefiBootServicesTableLib.h>
23 #include <Library/BaseMemoryLib.h>
24 #include <Library/MemoryAllocationLib.h>
25 #include <Library/UefiLib.h>
26 #include <Library/DevicePathLib.h>
27 #include <Library/PcdLib.h>
29 #include <Protocol/DevicePath.h>
30 #include <Protocol/PciIo.h>
31 #include <Protocol/DriverBinding.h>
32 #include <Protocol/ComponentName.h>
33 #include <Protocol/ComponentName2.h>
34 #include <Protocol/SdMmcOverride.h>
35 #include <Protocol/SdMmcPassThru.h>
37 #include "SdMmcPciHci.h"
39 extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName
;
40 extern EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2
;
41 extern EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding
;
43 extern EDKII_SD_MMC_OVERRIDE
*mOverride
;
45 #define SD_MMC_HC_PRIVATE_SIGNATURE SIGNATURE_32 ('s', 'd', 't', 'f')
47 #define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
48 CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
51 // Generic time out value, 1 microsecond as unit.
53 #define SD_MMC_HC_GENERIC_TIMEOUT (PcdGet32 (PcdSdMmcGenericTimeoutValue))
56 // SD/MMC async transfer timer interval, set by experience.
57 // The unit is 100us, takes 1ms as interval.
59 #define SD_MMC_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS(1)
61 // SD/MMC removable device enumeration timer interval, set by experience.
62 // The unit is 100us, takes 100ms as interval.
64 #define SD_MMC_HC_ENUM_TIMER EFI_TIMER_PERIOD_MILLISECONDS(100)
79 } EFI_SD_MMC_SLOT_TYPE
;
83 EFI_SD_MMC_SLOT_TYPE SlotType
;
86 SD_MMC_CARD_TYPE CardType
;
88 EDKII_SD_MMC_OPERATING_PARAMETERS OperatingParameters
;
94 EFI_HANDLE ControllerHandle
;
95 EFI_PCI_IO_PROTOCOL
*PciIo
;
97 EFI_SD_MMC_PASS_THRU_PROTOCOL PassThru
;
101 // The field is used to record the previous slot in GetNextSlot().
105 // For Non-blocking operation.
107 EFI_EVENT TimerEvent
;
109 // For Sd removable device enumeration.
111 EFI_EVENT ConnectEvent
;
114 SD_MMC_HC_SLOT Slot
[SD_MMC_HC_MAX_SLOT
];
115 SD_MMC_HC_SLOT_CAP Capability
[SD_MMC_HC_MAX_SLOT
];
116 UINT64 MaxCurrent
[SD_MMC_HC_MAX_SLOT
];
117 UINT16 ControllerVersion
[SD_MMC_HC_MAX_SLOT
];
120 // Some controllers may require to override base clock frequency
121 // value stored in Capabilities Register 1.
123 UINT32 BaseClkFreq
[SD_MMC_HC_MAX_SLOT
];
124 } SD_MMC_HC_PRIVATE_DATA
;
127 SD_MMC_BUS_MODE BusTiming
;
130 EDKII_SD_MMC_DRIVER_STRENGTH DriverStrength
;
131 } SD_MMC_BUS_SETTINGS
;
133 #define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
135 #define SD_MMC_TRB_RETRIES 5
138 // TRB (Transfer Request Block) contains information for the cmd request.
147 EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
;
151 EFI_PHYSICAL_ADDRESS DataPhy
;
153 SD_MMC_HC_TRANSFER_MODE Mode
;
154 SD_MMC_HC_ADMA_LENGTH_MODE AdmaLengthMode
;
158 BOOLEAN CommandComplete
;
162 BOOLEAN PioModeTransferCompleted
;
163 UINT32 PioBlockIndex
;
165 SD_MMC_HC_ADMA_32_DESC_LINE
*Adma32Desc
;
166 SD_MMC_HC_ADMA_64_V3_DESC_LINE
*Adma64V3Desc
;
167 SD_MMC_HC_ADMA_64_V4_DESC_LINE
*Adma64V4Desc
;
168 EFI_PHYSICAL_ADDRESS AdmaDescPhy
;
172 SD_MMC_HC_PRIVATE_DATA
*Private
;
175 #define SD_MMC_HC_TRB_FROM_THIS(a) \
176 CR(a, SD_MMC_HC_TRB, TrbList, SD_MMC_HC_TRB_SIG)
179 // Task for Non-blocking mode.
186 EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
;
190 BOOLEAN InfiniteWait
;
200 Execute card identification procedure.
202 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
203 @param[in] Slot The slot number of the SD card to send the command to.
205 @retval EFI_SUCCESS The card is identified correctly.
206 @retval Others The card can't be identified.
211 (*CARD_TYPE_DETECT_ROUTINE
) (
212 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
217 Sends SD command to an SD card that is attached to the SD controller.
219 The PassThru() function sends the SD command specified by Packet to the SD card
222 If Packet is successfully sent to the SD card, then EFI_SUCCESS is returned.
224 If a device error occurs while sending the Packet, then EFI_DEVICE_ERROR is returned.
226 If Slot is not in a valid range for the SD controller, then EFI_INVALID_PARAMETER
229 If Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL,
230 EFI_INVALID_PARAMETER is returned.
232 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
233 @param[in] Slot The slot number of the SD card to send the command to.
234 @param[in,out] Packet A pointer to the SD command data structure.
235 @param[in] Event If Event is NULL, blocking I/O is performed. If Event is
236 not NULL, then nonblocking I/O is performed, and Event
237 will be signaled when the Packet completes.
239 @retval EFI_SUCCESS The SD Command Packet was sent by the host.
240 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SD
242 @retval EFI_INVALID_PARAMETER Packet, Slot, or the contents of the Packet is invalid.
243 @retval EFI_INVALID_PARAMETER Packet defines a data command but both InDataBuffer and
244 OutDataBuffer are NULL.
245 @retval EFI_NO_MEDIA SD Device not present in the Slot.
246 @retval EFI_UNSUPPORTED The command described by the SD Command Packet is not
247 supported by the host controller.
248 @retval EFI_BAD_BUFFER_SIZE The InTransferLength or OutTransferLength exceeds the
249 limit supported by SD card ( i.e. if the number of bytes
250 exceed the Last LBA).
255 SdMmcPassThruPassThru (
256 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
258 IN OUT EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
,
259 IN EFI_EVENT Event OPTIONAL
263 Used to retrieve next slot numbers supported by the SD controller. The function
264 returns information about all available slots (populated or not-populated).
266 The GetNextSlot() function retrieves the next slot number on an SD controller.
267 If on input Slot is 0xFF, then the slot number of the first slot on the SD controller
270 If Slot is a slot number that was returned on a previous call to GetNextSlot(), then
271 the slot number of the next slot on the SD controller is returned.
273 If Slot is not 0xFF and Slot was not returned on a previous call to GetNextSlot(),
274 EFI_INVALID_PARAMETER is returned.
276 If Slot is the slot number of the last slot on the SD controller, then EFI_NOT_FOUND
279 @param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
280 @param[in,out] Slot On input, a pointer to a slot number on the SD controller.
281 On output, a pointer to the next slot number on the SD controller.
282 An input value of 0xFF retrieves the first slot number on the SD
285 @retval EFI_SUCCESS The next slot number on the SD controller was returned in Slot.
286 @retval EFI_NOT_FOUND There are no more slots on this SD controller.
287 @retval EFI_INVALID_PARAMETER Slot is not 0xFF and Slot was not returned on a previous call
293 SdMmcPassThruGetNextSlot (
294 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
299 Used to allocate and build a device path node for an SD card on the SD controller.
301 The BuildDevicePath() function allocates and builds a single device node for the SD
302 card specified by Slot.
304 If the SD card specified by Slot is not present on the SD controller, then EFI_NOT_FOUND
307 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
309 If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES
312 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of
313 DevicePath are initialized to describe the SD card specified by Slot, and EFI_SUCCESS is
316 @param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
317 @param[in] Slot Specifies the slot number of the SD card for which a device
318 path node is to be allocated and built.
319 @param[in,out] DevicePath A pointer to a single device path node that describes the SD
320 card specified by Slot. This function is responsible for
321 allocating the buffer DevicePath with the boot service
322 AllocatePool(). It is the caller's responsibility to free
323 DevicePath when the caller is finished with DevicePath.
325 @retval EFI_SUCCESS The device path node that describes the SD card specified by
326 Slot was allocated and returned in DevicePath.
327 @retval EFI_NOT_FOUND The SD card specified by Slot does not exist on the SD controller.
328 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
329 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
334 SdMmcPassThruBuildDevicePath (
335 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
337 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
341 This function retrieves an SD card slot number based on the input device path.
343 The GetSlotNumber() function retrieves slot number for the SD card specified by
344 the DevicePath node. If DevicePath is NULL, EFI_INVALID_PARAMETER is returned.
346 If DevicePath is not a device path node type that the SD Pass Thru driver supports,
347 EFI_UNSUPPORTED is returned.
349 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
350 @param[in] DevicePath A pointer to the device path node that describes a SD
351 card on the SD controller.
352 @param[out] Slot On return, points to the slot number of an SD card on
355 @retval EFI_SUCCESS SD card slot number is returned in Slot.
356 @retval EFI_INVALID_PARAMETER Slot or DevicePath is NULL.
357 @retval EFI_UNSUPPORTED DevicePath is not a device path node type that the SD
358 Pass Thru driver supports.
363 SdMmcPassThruGetSlotNumber (
364 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
365 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
370 Resets an SD card that is connected to the SD controller.
372 The ResetDevice() function resets the SD card specified by Slot.
374 If this SD controller does not support a device reset operation, EFI_UNSUPPORTED is
377 If Slot is not in a valid slot number for this SD controller, EFI_INVALID_PARAMETER
380 If the device reset operation is completed, EFI_SUCCESS is returned.
382 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
383 @param[in] Slot Specifies the slot number of the SD card to be reset.
385 @retval EFI_SUCCESS The SD card specified by Slot was reset.
386 @retval EFI_UNSUPPORTED The SD controller does not support a device reset operation.
387 @retval EFI_INVALID_PARAMETER Slot number is invalid.
388 @retval EFI_NO_MEDIA SD Device not present in the Slot.
389 @retval EFI_DEVICE_ERROR The reset command failed due to a device error
394 SdMmcPassThruResetDevice (
395 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
400 // Driver model protocol interfaces
404 Tests to see if this driver supports a given controller. If a child device is provided,
405 it further tests to see if this driver supports creating a handle for the specified child device.
407 This function checks to see if the driver specified by This supports the device specified by
408 ControllerHandle. Drivers will typically use the device path attached to
409 ControllerHandle and/or the services from the bus I/O abstraction attached to
410 ControllerHandle to determine if the driver supports ControllerHandle. This function
411 may be called many times during platform initialization. In order to reduce boot times, the tests
412 performed by this function must be very small, and take as little time as possible to execute. This
413 function must not change the state of any hardware devices, and this function must be aware that the
414 device specified by ControllerHandle may already be managed by the same driver or a
415 different driver. This function must match its calls to AllocatePages() with FreePages(),
416 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
417 Since ControllerHandle may have been previously started by the same driver, if a protocol is
418 already in the opened state, then it must not be closed with CloseProtocol(). This is required
419 to guarantee the state of ControllerHandle is not modified by this function.
421 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
422 @param[in] ControllerHandle The handle of the controller to test. This handle
423 must support a protocol interface that supplies
424 an I/O abstraction to the driver.
425 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
426 parameter is ignored by device drivers, and is optional for bus
427 drivers. For bus drivers, if this parameter is not NULL, then
428 the bus driver must determine if the bus controller specified
429 by ControllerHandle and the child controller specified
430 by RemainingDevicePath are both supported by this
433 @retval EFI_SUCCESS The device specified by ControllerHandle and
434 RemainingDevicePath is supported by the driver specified by This.
435 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
436 RemainingDevicePath is already being managed by the driver
438 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
439 RemainingDevicePath is already being managed by a different
440 driver or an application that requires exclusive access.
441 Currently not implemented.
442 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
443 RemainingDevicePath is not supported by the driver specified by This.
447 SdMmcPciHcDriverBindingSupported (
448 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
449 IN EFI_HANDLE Controller
,
450 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
454 Starts a device controller or a bus controller.
456 The Start() function is designed to be invoked from the EFI boot service ConnectController().
457 As a result, much of the error checking on the parameters to Start() has been moved into this
458 common boot service. It is legal to call Start() from other locations,
459 but the following calling restrictions must be followed or the system behavior will not be deterministic.
460 1. ControllerHandle must be a valid EFI_HANDLE.
461 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
462 EFI_DEVICE_PATH_PROTOCOL.
463 3. Prior to calling Start(), the Supported() function for the driver specified by This must
464 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
466 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
467 @param[in] ControllerHandle The handle of the controller to start. This handle
468 must support a protocol interface that supplies
469 an I/O abstraction to the driver.
470 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
471 parameter is ignored by device drivers, and is optional for bus
472 drivers. For a bus driver, if this parameter is NULL, then handles
473 for all the children of Controller are created by this driver.
474 If this parameter is not NULL and the first Device Path Node is
475 not the End of Device Path Node, then only the handle for the
476 child device specified by the first Device Path Node of
477 RemainingDevicePath is created by this driver.
478 If the first Device Path Node of RemainingDevicePath is
479 the End of Device Path Node, no child handle is created by this
482 @retval EFI_SUCCESS The device was started.
483 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
484 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
485 @retval Others The driver failded to start the device.
490 SdMmcPciHcDriverBindingStart (
491 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
492 IN EFI_HANDLE Controller
,
493 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
497 Stops a device controller or a bus controller.
499 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
500 As a result, much of the error checking on the parameters to Stop() has been moved
501 into this common boot service. It is legal to call Stop() from other locations,
502 but the following calling restrictions must be followed or the system behavior will not be deterministic.
503 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
504 same driver's Start() function.
505 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
506 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
507 Start() function, and the Start() function must have called OpenProtocol() on
508 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
510 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
511 @param[in] ControllerHandle A handle to the device being stopped. The handle must
512 support a bus specific I/O protocol for the driver
513 to use to stop the device.
514 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
515 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
516 if NumberOfChildren is 0.
518 @retval EFI_SUCCESS The device was stopped.
519 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
524 SdMmcPciHcDriverBindingStop (
525 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
526 IN EFI_HANDLE Controller
,
527 IN UINTN NumberOfChildren
,
528 IN EFI_HANDLE
*ChildHandleBuffer
532 // EFI Component Name Functions
536 Retrieves a Unicode string that is the user readable name of the driver.
538 This function retrieves the user readable name of a driver in the form of a
539 Unicode string. If the driver specified by This has a user readable name in
540 the language specified by Language, then a pointer to the driver name is
541 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
542 by This does not support the language specified by Language,
543 then EFI_UNSUPPORTED is returned.
545 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
546 EFI_COMPONENT_NAME_PROTOCOL instance.
548 @param Language[in] A pointer to a Null-terminated ASCII string
549 array indicating the language. This is the
550 language of the driver name that the caller is
551 requesting, and it must match one of the
552 languages specified in SupportedLanguages. The
553 number of languages supported by a driver is up
554 to the driver writer. Language is specified
555 in RFC 4646 or ISO 639-2 language code format.
557 @param DriverName[out] A pointer to the Unicode string to return.
558 This Unicode string is the name of the
559 driver specified by This in the language
560 specified by Language.
562 @retval EFI_SUCCESS The Unicode string for the Driver specified by
563 This and the language specified by Language was
564 returned in DriverName.
566 @retval EFI_INVALID_PARAMETER Language is NULL.
568 @retval EFI_INVALID_PARAMETER DriverName is NULL.
570 @retval EFI_UNSUPPORTED The driver specified by This does not support
571 the language specified by Language.
576 SdMmcPciHcComponentNameGetDriverName (
577 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
579 OUT CHAR16
**DriverName
583 Retrieves a Unicode string that is the user readable name of the controller
584 that is being managed by a driver.
586 This function retrieves the user readable name of the controller specified by
587 ControllerHandle and ChildHandle in the form of a Unicode string. If the
588 driver specified by This has a user readable name in the language specified by
589 Language, then a pointer to the controller name is returned in ControllerName,
590 and EFI_SUCCESS is returned. If the driver specified by This is not currently
591 managing the controller specified by ControllerHandle and ChildHandle,
592 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
593 support the language specified by Language, then EFI_UNSUPPORTED is returned.
595 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
596 EFI_COMPONENT_NAME_PROTOCOL instance.
598 @param ControllerHandle[in] The handle of a controller that the driver
599 specified by This is managing. This handle
600 specifies the controller whose name is to be
603 @param ChildHandle[in] The handle of the child controller to retrieve
604 the name of. This is an optional parameter that
605 may be NULL. It will be NULL for device
606 drivers. It will also be NULL for a bus drivers
607 that wish to retrieve the name of the bus
608 controller. It will not be NULL for a bus
609 driver that wishes to retrieve the name of a
612 @param Language[in] A pointer to a Null-terminated ASCII string
613 array indicating the language. This is the
614 language of the driver name that the caller is
615 requesting, and it must match one of the
616 languages specified in SupportedLanguages. The
617 number of languages supported by a driver is up
618 to the driver writer. Language is specified in
619 RFC 4646 or ISO 639-2 language code format.
621 @param ControllerName[out] A pointer to the Unicode string to return.
622 This Unicode string is the name of the
623 controller specified by ControllerHandle and
624 ChildHandle in the language specified by
625 Language from the point of view of the driver
628 @retval EFI_SUCCESS The Unicode string for the user readable name in
629 the language specified by Language for the
630 driver specified by This was returned in
633 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
635 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
638 @retval EFI_INVALID_PARAMETER Language is NULL.
640 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
642 @retval EFI_UNSUPPORTED The driver specified by This is not currently
643 managing the controller specified by
644 ControllerHandle and ChildHandle.
646 @retval EFI_UNSUPPORTED The driver specified by This does not support
647 the language specified by Language.
652 SdMmcPciHcComponentNameGetControllerName (
653 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
654 IN EFI_HANDLE ControllerHandle
,
655 IN EFI_HANDLE ChildHandle OPTIONAL
,
657 OUT CHAR16
**ControllerName
661 Create a new TRB for the SD/MMC cmd request.
663 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
664 @param[in] Slot The slot number of the SD card to send the command to.
665 @param[in] Packet A pointer to the SD command data structure.
666 @param[in] Event If Event is NULL, blocking I/O is performed. If Event is
667 not NULL, then nonblocking I/O is performed, and Event
668 will be signaled when the Packet completes.
670 @return Created Trb or NULL.
675 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
677 IN EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
,
682 Free the resource used by the TRB.
684 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
689 IN SD_MMC_HC_TRB
*Trb
693 Check if the env is ready for execute specified TRB.
695 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
696 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
698 @retval EFI_SUCCESS The env is ready for TRB execution.
699 @retval EFI_NOT_READY The env is not ready for TRB execution.
700 @retval Others Some erros happen.
705 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
706 IN SD_MMC_HC_TRB
*Trb
710 Wait for the env to be ready for execute specified TRB.
712 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
713 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
715 @retval EFI_SUCCESS The env is ready for TRB execution.
716 @retval EFI_TIMEOUT The env is not ready for TRB execution in time.
717 @retval Others Some erros happen.
722 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
723 IN SD_MMC_HC_TRB
*Trb
727 Execute the specified TRB.
729 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
730 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
732 @retval EFI_SUCCESS The TRB is sent to host controller successfully.
733 @retval Others Some erros happen when sending this request to the host controller.
738 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
739 IN SD_MMC_HC_TRB
*Trb
743 Check the TRB execution result.
745 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
746 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
748 @retval EFI_SUCCESS The TRB is executed successfully.
749 @retval EFI_NOT_READY The TRB is not completed for execution.
750 @retval Others Some erros happen when executing this request.
754 SdMmcCheckTrbResult (
755 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
756 IN SD_MMC_HC_TRB
*Trb
760 Wait for the TRB execution result.
762 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
763 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
765 @retval EFI_SUCCESS The TRB is executed successfully.
766 @retval Others Some erros happen when executing this request.
771 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
772 IN SD_MMC_HC_TRB
*Trb
776 Execute EMMC device identification procedure.
778 Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
780 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
781 @param[in] Slot The slot number of the SD card to send the command to.
783 @retval EFI_SUCCESS There is a EMMC card.
784 @retval Others There is not a EMMC card.
789 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
794 Execute EMMC device identification procedure.
796 Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
798 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
799 @param[in] Slot The slot number of the SD card to send the command to.
801 @retval EFI_SUCCESS There is a EMMC card.
802 @retval Others There is not a EMMC card.
806 SdCardIdentification (
807 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
812 SD/MMC card clock supply.
814 Refer to SD Host Controller Simplified spec 3.0 Section 3.2.1 for details.
816 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
817 @param[in] Slot The slot number of the SD card to send the command to.
818 @param[in] BusTiming BusTiming at which the frequency change is done.
819 @param[in] FirstTimeSetup Flag to indicate whether the clock is being setup for the first time.
820 @param[in] ClockFreq The max clock frequency to be set. The unit is KHz.
822 @retval EFI_SUCCESS The clock is supplied successfully.
823 @retval Others The clock isn't supplied successfully.
828 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
830 IN SD_MMC_BUS_MODE BusTiming
,
831 IN BOOLEAN FirstTimeSetup
,
836 Software reset the specified SD/MMC host controller.
838 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
839 @param[in] Slot The slot number of the SD card to send the command to.
841 @retval EFI_SUCCESS The software reset executes successfully.
842 @retval Others The software reset fails.
847 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
852 Initial SD/MMC host controller with lowest clock frequency, max power and max timeout value
855 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
856 @param[in] Slot The slot number of the SD card to send the command to.
858 @retval EFI_SUCCESS The host controller is initialized successfully.
859 @retval Others The host controller isn't initialized successfully.
864 IN SD_MMC_HC_PRIVATE_DATA
*Private
,