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, Intel Corporation. All rights reserved.<BR>
7 This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 #ifndef _SD_MMC_PCI_HC_DXE_H_
18 #define _SD_MMC_PCI_HC_DXE_H_
22 #include <IndustryStandard/Pci.h>
23 #include <IndustryStandard/Emmc.h>
24 #include <IndustryStandard/Sd.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/DebugLib.h>
28 #include <Library/UefiBootServicesTableLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/MemoryAllocationLib.h>
31 #include <Library/UefiLib.h>
32 #include <Library/DevicePathLib.h>
34 #include <Protocol/DevicePath.h>
35 #include <Protocol/PciIo.h>
36 #include <Protocol/DriverBinding.h>
37 #include <Protocol/ComponentName.h>
38 #include <Protocol/ComponentName2.h>
39 #include <Protocol/SdMmcOverride.h>
40 #include <Protocol/SdMmcPassThru.h>
42 #include "SdMmcPciHci.h"
44 extern EFI_COMPONENT_NAME_PROTOCOL gSdMmcPciHcComponentName
;
45 extern EFI_COMPONENT_NAME2_PROTOCOL gSdMmcPciHcComponentName2
;
46 extern EFI_DRIVER_BINDING_PROTOCOL gSdMmcPciHcDriverBinding
;
48 extern EDKII_SD_MMC_OVERRIDE
*mOverride
;
50 #define SD_MMC_HC_PRIVATE_SIGNATURE SIGNATURE_32 ('s', 'd', 't', 'f')
52 #define SD_MMC_HC_PRIVATE_FROM_THIS(a) \
53 CR(a, SD_MMC_HC_PRIVATE_DATA, PassThru, SD_MMC_HC_PRIVATE_SIGNATURE)
56 // Generic time out value, 1 microsecond as unit.
58 #define SD_MMC_HC_GENERIC_TIMEOUT 1 * 1000 * 1000
61 // SD/MMC async transfer timer interval, set by experience.
62 // The unit is 100us, takes 1ms as interval.
64 #define SD_MMC_HC_ASYNC_TIMER EFI_TIMER_PERIOD_MILLISECONDS(1)
66 // SD/MMC removable device enumeration timer interval, set by experience.
67 // The unit is 100us, takes 100ms as interval.
69 #define SD_MMC_HC_ENUM_TIMER EFI_TIMER_PERIOD_MILLISECONDS(100)
84 } EFI_SD_MMC_SLOT_TYPE
;
88 EFI_SD_MMC_SLOT_TYPE SlotType
;
91 SD_MMC_CARD_TYPE CardType
;
97 EFI_HANDLE ControllerHandle
;
98 EFI_PCI_IO_PROTOCOL
*PciIo
;
100 EFI_SD_MMC_PASS_THRU_PROTOCOL PassThru
;
102 UINT64 PciAttributes
;
104 // The field is used to record the previous slot in GetNextSlot().
108 // For Non-blocking operation.
110 EFI_EVENT TimerEvent
;
112 // For Sd removable device enumeration.
114 EFI_EVENT ConnectEvent
;
117 SD_MMC_HC_SLOT Slot
[SD_MMC_HC_MAX_SLOT
];
118 SD_MMC_HC_SLOT_CAP Capability
[SD_MMC_HC_MAX_SLOT
];
119 UINT64 MaxCurrent
[SD_MMC_HC_MAX_SLOT
];
120 UINT16 ControllerVersion
[SD_MMC_HC_MAX_SLOT
];
123 // Some controllers may require to override base clock frequency
124 // value stored in Capabilities Register 1.
126 UINT32 BaseClkFreq
[SD_MMC_HC_MAX_SLOT
];
127 } SD_MMC_HC_PRIVATE_DATA
;
129 #define SD_MMC_HC_TRB_SIG SIGNATURE_32 ('T', 'R', 'B', 'T')
132 // TRB (Transfer Request Block) contains information for the cmd request.
141 EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
;
145 EFI_PHYSICAL_ADDRESS DataPhy
;
147 SD_MMC_HC_TRANSFER_MODE Mode
;
148 SD_MMC_HC_ADMA_LENGTH_MODE AdmaLengthMode
;
154 SD_MMC_HC_ADMA_32_DESC_LINE
*Adma32Desc
;
155 SD_MMC_HC_ADMA_64_V3_DESC_LINE
*Adma64V3Desc
;
156 SD_MMC_HC_ADMA_64_V4_DESC_LINE
*Adma64V4Desc
;
157 EFI_PHYSICAL_ADDRESS AdmaDescPhy
;
161 SD_MMC_HC_PRIVATE_DATA
*Private
;
164 #define SD_MMC_HC_TRB_FROM_THIS(a) \
165 CR(a, SD_MMC_HC_TRB, TrbList, SD_MMC_HC_TRB_SIG)
168 // Task for Non-blocking mode.
175 EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
;
179 BOOLEAN InfiniteWait
;
188 Execute card identification procedure.
190 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
191 @param[in] Slot The slot number of the SD card to send the command to.
193 @retval EFI_SUCCESS The card is identified correctly.
194 @retval Others The card can't be identified.
199 (*CARD_TYPE_DETECT_ROUTINE
) (
200 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
205 Sends SD command to an SD card that is attached to the SD controller.
207 The PassThru() function sends the SD command specified by Packet to the SD card
210 If Packet is successfully sent to the SD card, then EFI_SUCCESS is returned.
212 If a device error occurs while sending the Packet, then EFI_DEVICE_ERROR is returned.
214 If Slot is not in a valid range for the SD controller, then EFI_INVALID_PARAMETER
217 If Packet defines a data command but both InDataBuffer and OutDataBuffer are NULL,
218 EFI_INVALID_PARAMETER is returned.
220 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
221 @param[in] Slot The slot number of the SD card to send the command to.
222 @param[in,out] Packet A pointer to the SD command data structure.
223 @param[in] Event If Event is NULL, blocking I/O is performed. If Event is
224 not NULL, then nonblocking I/O is performed, and Event
225 will be signaled when the Packet completes.
227 @retval EFI_SUCCESS The SD Command Packet was sent by the host.
228 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SD
230 @retval EFI_INVALID_PARAMETER Packet, Slot, or the contents of the Packet is invalid.
231 @retval EFI_INVALID_PARAMETER Packet defines a data command but both InDataBuffer and
232 OutDataBuffer are NULL.
233 @retval EFI_NO_MEDIA SD Device not present in the Slot.
234 @retval EFI_UNSUPPORTED The command described by the SD Command Packet is not
235 supported by the host controller.
236 @retval EFI_BAD_BUFFER_SIZE The InTransferLength or OutTransferLength exceeds the
237 limit supported by SD card ( i.e. if the number of bytes
238 exceed the Last LBA).
243 SdMmcPassThruPassThru (
244 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
246 IN OUT EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
,
247 IN EFI_EVENT Event OPTIONAL
251 Used to retrieve next slot numbers supported by the SD controller. The function
252 returns information about all available slots (populated or not-populated).
254 The GetNextSlot() function retrieves the next slot number on an SD controller.
255 If on input Slot is 0xFF, then the slot number of the first slot on the SD controller
258 If Slot is a slot number that was returned on a previous call to GetNextSlot(), then
259 the slot number of the next slot on the SD controller is returned.
261 If Slot is not 0xFF and Slot was not returned on a previous call to GetNextSlot(),
262 EFI_INVALID_PARAMETER is returned.
264 If Slot is the slot number of the last slot on the SD controller, then EFI_NOT_FOUND
267 @param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
268 @param[in,out] Slot On input, a pointer to a slot number on the SD controller.
269 On output, a pointer to the next slot number on the SD controller.
270 An input value of 0xFF retrieves the first slot number on the SD
273 @retval EFI_SUCCESS The next slot number on the SD controller was returned in Slot.
274 @retval EFI_NOT_FOUND There are no more slots on this SD controller.
275 @retval EFI_INVALID_PARAMETER Slot is not 0xFF and Slot was not returned on a previous call
281 SdMmcPassThruGetNextSlot (
282 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
287 Used to allocate and build a device path node for an SD card on the SD controller.
289 The BuildDevicePath() function allocates and builds a single device node for the SD
290 card specified by Slot.
292 If the SD card specified by Slot is not present on the SD controller, then EFI_NOT_FOUND
295 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned.
297 If there are not enough resources to allocate the device path node, then EFI_OUT_OF_RESOURCES
300 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of
301 DevicePath are initialized to describe the SD card specified by Slot, and EFI_SUCCESS is
304 @param[in] This A pointer to the EFI_SD_MMMC_PASS_THRU_PROTOCOL instance.
305 @param[in] Slot Specifies the slot number of the SD card for which a device
306 path node is to be allocated and built.
307 @param[in,out] DevicePath A pointer to a single device path node that describes the SD
308 card specified by Slot. This function is responsible for
309 allocating the buffer DevicePath with the boot service
310 AllocatePool(). It is the caller's responsibility to free
311 DevicePath when the caller is finished with DevicePath.
313 @retval EFI_SUCCESS The device path node that describes the SD card specified by
314 Slot was allocated and returned in DevicePath.
315 @retval EFI_NOT_FOUND The SD card specified by Slot does not exist on the SD controller.
316 @retval EFI_INVALID_PARAMETER DevicePath is NULL.
317 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.
322 SdMmcPassThruBuildDevicePath (
323 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
325 IN OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
329 This function retrieves an SD card slot number based on the input device path.
331 The GetSlotNumber() function retrieves slot number for the SD card specified by
332 the DevicePath node. If DevicePath is NULL, EFI_INVALID_PARAMETER is returned.
334 If DevicePath is not a device path node type that the SD Pass Thru driver supports,
335 EFI_UNSUPPORTED is returned.
337 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
338 @param[in] DevicePath A pointer to the device path node that describes a SD
339 card on the SD controller.
340 @param[out] Slot On return, points to the slot number of an SD card on
343 @retval EFI_SUCCESS SD card slot number is returned in Slot.
344 @retval EFI_INVALID_PARAMETER Slot or DevicePath is NULL.
345 @retval EFI_UNSUPPORTED DevicePath is not a device path node type that the SD
346 Pass Thru driver supports.
351 SdMmcPassThruGetSlotNumber (
352 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
353 IN EFI_DEVICE_PATH_PROTOCOL
*DevicePath
,
358 Resets an SD card that is connected to the SD controller.
360 The ResetDevice() function resets the SD card specified by Slot.
362 If this SD controller does not support a device reset operation, EFI_UNSUPPORTED is
365 If Slot is not in a valid slot number for this SD controller, EFI_INVALID_PARAMETER
368 If the device reset operation is completed, EFI_SUCCESS is returned.
370 @param[in] This A pointer to the EFI_SD_MMC_PASS_THRU_PROTOCOL instance.
371 @param[in] Slot Specifies the slot number of the SD card to be reset.
373 @retval EFI_SUCCESS The SD card specified by Slot was reset.
374 @retval EFI_UNSUPPORTED The SD controller does not support a device reset operation.
375 @retval EFI_INVALID_PARAMETER Slot number is invalid.
376 @retval EFI_NO_MEDIA SD Device not present in the Slot.
377 @retval EFI_DEVICE_ERROR The reset command failed due to a device error
382 SdMmcPassThruResetDevice (
383 IN EFI_SD_MMC_PASS_THRU_PROTOCOL
*This
,
388 // Driver model protocol interfaces
391 Tests to see if this driver supports a given controller. If a child device is provided,
392 it further tests to see if this driver supports creating a handle for the specified child device.
394 This function checks to see if the driver specified by This supports the device specified by
395 ControllerHandle. Drivers will typically use the device path attached to
396 ControllerHandle and/or the services from the bus I/O abstraction attached to
397 ControllerHandle to determine if the driver supports ControllerHandle. This function
398 may be called many times during platform initialization. In order to reduce boot times, the tests
399 performed by this function must be very small, and take as little time as possible to execute. This
400 function must not change the state of any hardware devices, and this function must be aware that the
401 device specified by ControllerHandle may already be managed by the same driver or a
402 different driver. This function must match its calls to AllocatePages() with FreePages(),
403 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().
404 Since ControllerHandle may have been previously started by the same driver, if a protocol is
405 already in the opened state, then it must not be closed with CloseProtocol(). This is required
406 to guarantee the state of ControllerHandle is not modified by this function.
408 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
409 @param[in] ControllerHandle The handle of the controller to test. This handle
410 must support a protocol interface that supplies
411 an I/O abstraction to the driver.
412 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
413 parameter is ignored by device drivers, and is optional for bus
414 drivers. For bus drivers, if this parameter is not NULL, then
415 the bus driver must determine if the bus controller specified
416 by ControllerHandle and the child controller specified
417 by RemainingDevicePath are both supported by this
420 @retval EFI_SUCCESS The device specified by ControllerHandle and
421 RemainingDevicePath is supported by the driver specified by This.
422 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and
423 RemainingDevicePath is already being managed by the driver
425 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and
426 RemainingDevicePath is already being managed by a different
427 driver or an application that requires exclusive access.
428 Currently not implemented.
429 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and
430 RemainingDevicePath is not supported by the driver specified by This.
434 SdMmcPciHcDriverBindingSupported (
435 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
436 IN EFI_HANDLE Controller
,
437 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
441 Starts a device controller or a bus controller.
443 The Start() function is designed to be invoked from the EFI boot service ConnectController().
444 As a result, much of the error checking on the parameters to Start() has been moved into this
445 common boot service. It is legal to call Start() from other locations,
446 but the following calling restrictions must be followed or the system behavior will not be deterministic.
447 1. ControllerHandle must be a valid EFI_HANDLE.
448 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned
449 EFI_DEVICE_PATH_PROTOCOL.
450 3. Prior to calling Start(), the Supported() function for the driver specified by This must
451 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.
453 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
454 @param[in] ControllerHandle The handle of the controller to start. This handle
455 must support a protocol interface that supplies
456 an I/O abstraction to the driver.
457 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This
458 parameter is ignored by device drivers, and is optional for bus
459 drivers. For a bus driver, if this parameter is NULL, then handles
460 for all the children of Controller are created by this driver.
461 If this parameter is not NULL and the first Device Path Node is
462 not the End of Device Path Node, then only the handle for the
463 child device specified by the first Device Path Node of
464 RemainingDevicePath is created by this driver.
465 If the first Device Path Node of RemainingDevicePath is
466 the End of Device Path Node, no child handle is created by this
469 @retval EFI_SUCCESS The device was started.
470 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.
471 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.
472 @retval Others The driver failded to start the device.
477 SdMmcPciHcDriverBindingStart (
478 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
479 IN EFI_HANDLE Controller
,
480 IN EFI_DEVICE_PATH_PROTOCOL
*RemainingDevicePath
484 Stops a device controller or a bus controller.
486 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().
487 As a result, much of the error checking on the parameters to Stop() has been moved
488 into this common boot service. It is legal to call Stop() from other locations,
489 but the following calling restrictions must be followed or the system behavior will not be deterministic.
490 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this
491 same driver's Start() function.
492 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid
493 EFI_HANDLE. In addition, all of these handles must have been created in this driver's
494 Start() function, and the Start() function must have called OpenProtocol() on
495 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.
497 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.
498 @param[in] ControllerHandle A handle to the device being stopped. The handle must
499 support a bus specific I/O protocol for the driver
500 to use to stop the device.
501 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.
502 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL
503 if NumberOfChildren is 0.
505 @retval EFI_SUCCESS The device was stopped.
506 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.
511 SdMmcPciHcDriverBindingStop (
512 IN EFI_DRIVER_BINDING_PROTOCOL
*This
,
513 IN EFI_HANDLE Controller
,
514 IN UINTN NumberOfChildren
,
515 IN EFI_HANDLE
*ChildHandleBuffer
519 // EFI Component Name Functions
522 Retrieves a Unicode string that is the user readable name of the driver.
524 This function retrieves the user readable name of a driver in the form of a
525 Unicode string. If the driver specified by This has a user readable name in
526 the language specified by Language, then a pointer to the driver name is
527 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
528 by This does not support the language specified by Language,
529 then EFI_UNSUPPORTED is returned.
531 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
532 EFI_COMPONENT_NAME_PROTOCOL instance.
534 @param Language[in] A pointer to a Null-terminated ASCII string
535 array indicating the language. This is the
536 language of the driver name that the caller is
537 requesting, and it must match one of the
538 languages specified in SupportedLanguages. The
539 number of languages supported by a driver is up
540 to the driver writer. Language is specified
541 in RFC 4646 or ISO 639-2 language code format.
543 @param DriverName[out] A pointer to the Unicode string to return.
544 This Unicode string is the name of the
545 driver specified by This in the language
546 specified by Language.
548 @retval EFI_SUCCESS The Unicode string for the Driver specified by
549 This and the language specified by Language was
550 returned in DriverName.
552 @retval EFI_INVALID_PARAMETER Language is NULL.
554 @retval EFI_INVALID_PARAMETER DriverName is NULL.
556 @retval EFI_UNSUPPORTED The driver specified by This does not support
557 the language specified by Language.
562 SdMmcPciHcComponentNameGetDriverName (
563 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
565 OUT CHAR16
**DriverName
569 Retrieves a Unicode string that is the user readable name of the controller
570 that is being managed by a driver.
572 This function retrieves the user readable name of the controller specified by
573 ControllerHandle and ChildHandle in the form of a Unicode string. If the
574 driver specified by This has a user readable name in the language specified by
575 Language, then a pointer to the controller name is returned in ControllerName,
576 and EFI_SUCCESS is returned. If the driver specified by This is not currently
577 managing the controller specified by ControllerHandle and ChildHandle,
578 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
579 support the language specified by Language, then EFI_UNSUPPORTED is returned.
581 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
582 EFI_COMPONENT_NAME_PROTOCOL instance.
584 @param ControllerHandle[in] The handle of a controller that the driver
585 specified by This is managing. This handle
586 specifies the controller whose name is to be
589 @param ChildHandle[in] The handle of the child controller to retrieve
590 the name of. This is an optional parameter that
591 may be NULL. It will be NULL for device
592 drivers. It will also be NULL for a bus drivers
593 that wish to retrieve the name of the bus
594 controller. It will not be NULL for a bus
595 driver that wishes to retrieve the name of a
598 @param Language[in] A pointer to a Null-terminated ASCII string
599 array indicating the language. This is the
600 language of the driver name that the caller is
601 requesting, and it must match one of the
602 languages specified in SupportedLanguages. The
603 number of languages supported by a driver is up
604 to the driver writer. Language is specified in
605 RFC 4646 or ISO 639-2 language code format.
607 @param ControllerName[out] A pointer to the Unicode string to return.
608 This Unicode string is the name of the
609 controller specified by ControllerHandle and
610 ChildHandle in the language specified by
611 Language from the point of view of the driver
614 @retval EFI_SUCCESS The Unicode string for the user readable name in
615 the language specified by Language for the
616 driver specified by This was returned in
619 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
621 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
624 @retval EFI_INVALID_PARAMETER Language is NULL.
626 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
628 @retval EFI_UNSUPPORTED The driver specified by This is not currently
629 managing the controller specified by
630 ControllerHandle and ChildHandle.
632 @retval EFI_UNSUPPORTED The driver specified by This does not support
633 the language specified by Language.
638 SdMmcPciHcComponentNameGetControllerName (
639 IN EFI_COMPONENT_NAME_PROTOCOL
*This
,
640 IN EFI_HANDLE ControllerHandle
,
641 IN EFI_HANDLE ChildHandle
, OPTIONAL
643 OUT CHAR16
**ControllerName
647 Create a new TRB for the SD/MMC cmd request.
649 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
650 @param[in] Slot The slot number of the SD card to send the command to.
651 @param[in] Packet A pointer to the SD command data structure.
652 @param[in] Event If Event is NULL, blocking I/O is performed. If Event is
653 not NULL, then nonblocking I/O is performed, and Event
654 will be signaled when the Packet completes.
656 @return Created Trb or NULL.
661 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
663 IN EFI_SD_MMC_PASS_THRU_COMMAND_PACKET
*Packet
,
668 Free the resource used by the TRB.
670 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
675 IN SD_MMC_HC_TRB
*Trb
679 Check if the env is ready for execute specified TRB.
681 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
682 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
684 @retval EFI_SUCCESS The env is ready for TRB execution.
685 @retval EFI_NOT_READY The env is not ready for TRB execution.
686 @retval Others Some erros happen.
691 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
692 IN SD_MMC_HC_TRB
*Trb
696 Wait for the env to be ready for execute specified TRB.
698 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
699 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
701 @retval EFI_SUCCESS The env is ready for TRB execution.
702 @retval EFI_TIMEOUT The env is not ready for TRB execution in time.
703 @retval Others Some erros happen.
708 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
709 IN SD_MMC_HC_TRB
*Trb
713 Execute the specified TRB.
715 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
716 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
718 @retval EFI_SUCCESS The TRB is sent to host controller successfully.
719 @retval Others Some erros happen when sending this request to the host controller.
724 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
725 IN SD_MMC_HC_TRB
*Trb
729 Check the TRB execution result.
731 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
732 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
734 @retval EFI_SUCCESS The TRB is executed successfully.
735 @retval EFI_NOT_READY The TRB is not completed for execution.
736 @retval Others Some erros happen when executing this request.
740 SdMmcCheckTrbResult (
741 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
742 IN SD_MMC_HC_TRB
*Trb
746 Wait for the TRB execution result.
748 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
749 @param[in] Trb The pointer to the SD_MMC_HC_TRB instance.
751 @retval EFI_SUCCESS The TRB is executed successfully.
752 @retval Others Some erros happen when executing this request.
757 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
758 IN SD_MMC_HC_TRB
*Trb
762 Execute EMMC device identification procedure.
764 Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
766 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
767 @param[in] Slot The slot number of the SD card to send the command to.
769 @retval EFI_SUCCESS There is a EMMC card.
770 @retval Others There is not a EMMC card.
775 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
780 Execute EMMC device identification procedure.
782 Refer to EMMC Electrical Standard Spec 5.1 Section 6.4 for details.
784 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
785 @param[in] Slot The slot number of the SD card to send the command to.
787 @retval EFI_SUCCESS There is a EMMC card.
788 @retval Others There is not a EMMC card.
792 SdCardIdentification (
793 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
798 Software reset the specified SD/MMC host controller.
800 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
801 @param[in] Slot The slot number of the SD card to send the command to.
803 @retval EFI_SUCCESS The software reset executes successfully.
804 @retval Others The software reset fails.
809 IN SD_MMC_HC_PRIVATE_DATA
*Private
,
814 Initial SD/MMC host controller with lowest clock frequency, max power and max timeout value
817 @param[in] Private A pointer to the SD_MMC_HC_PRIVATE_DATA instance.
818 @param[in] Slot The slot number of the SD card to send the command to.
820 @retval EFI_SUCCESS The host controller is initialized successfully.
821 @retval Others The host controller isn't initialized successfully.
826 IN SD_MMC_HC_PRIVATE_DATA
*Private
,