28 UFS_HC_PRIVATE_DATA_SIGNATURE,
66 if ((This ==
NULL) || (MmioBar ==
NULL)) {
67 return EFI_INVALID_PARAMETER;
71 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
72 PciIo = Private->PciIo;
73 BarIndex = Private->BarIndex;
75 Status = PciIo->GetBarAttributes (
81 if (EFI_ERROR (Status)) {
85 *MmioBar = (
UINTN)BarDesc->AddrRangeMin;
116 IN VOID *HostAddress,
126 if ((This ==
NULL) || (HostAddress ==
NULL) || (NumberOfBytes ==
NULL) || (DeviceAddress ==
NULL) || (Mapping ==
NULL)) {
127 return EFI_INVALID_PARAMETER;
130 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
131 PciIo = Private->PciIo;
158 if ((This ==
NULL) || (Mapping ==
NULL)) {
159 return EFI_INVALID_PARAMETER;
162 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
163 PciIo = Private->PciIo;
165 Status = PciIo->Unmap (PciIo, Mapping);
196 OUT VOID **HostAddress,
204 if ((This ==
NULL) || (HostAddress ==
NULL)) {
205 return EFI_INVALID_PARAMETER;
208 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
209 PciIo = Private->PciIo;
211 Status = PciIo->AllocateBuffer (PciIo, Type, MemoryType, Pages, HostAddress, Attributes);
239 if ((This ==
NULL) || (HostAddress ==
NULL)) {
240 return EFI_INVALID_PARAMETER;
243 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
244 PciIo = Private->PciIo;
246 Status = PciIo->FreeBuffer (PciIo, Pages, HostAddress);
271 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
272 PciIo = Private->PciIo;
274 Status = PciIo->Flush (PciIo);
300 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width,
311 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
312 PciIo = Private->PciIo;
313 BarIndex = Private->BarIndex;
342 IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width,
353 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (This);
354 PciIo = Private->PciIo;
355 BarIndex = Private->BarIndex;
419 ParentDevicePath =
NULL;
426 Status =
gBS->OpenProtocol (
428 &gEfiDevicePathProtocolGuid,
429 (VOID *)&ParentDevicePath,
430 This->DriverBindingHandle,
432 EFI_OPEN_PROTOCOL_BY_DRIVER
434 if (EFI_ERROR (Status)) {
446 &gEfiDevicePathProtocolGuid,
447 This->DriverBindingHandle,
454 Status =
gBS->OpenProtocol (
456 &gEfiPciIoProtocolGuid,
458 This->DriverBindingHandle,
460 EFI_OPEN_PROTOCOL_BY_DRIVER
462 if (EFI_ERROR (Status)) {
470 Status = PciIo->Pci.
Read (
477 if (EFI_ERROR (Status)) {
480 &gEfiPciIoProtocolGuid,
481 This->DriverBindingHandle,
484 return EFI_UNSUPPORTED;
492 &gEfiPciIoProtocolGuid,
493 This->DriverBindingHandle,
500 if (PciData.Hdr.ClassCode[2] == PCI_CLASS_MASS_STORAGE) {
501 if (PciData.Hdr.ClassCode[1] == 0x09 ) {
508 return EFI_UNSUPPORTED;
572 Status =
gBS->OpenProtocol (
574 &gEfiPciIoProtocolGuid,
576 This->DriverBindingHandle,
578 EFI_OPEN_PROTOCOL_BY_DRIVER
588 if (EFI_ERROR (Status)) {
596 if (Private ==
NULL) {
597 Status = EFI_OUT_OF_RESOURCES;
601 Private->PciIo = PciIo;
603 for (BarIndex = 0; BarIndex < PCI_MAX_BAR; BarIndex++) {
604 Status = PciIo->GetBarAttributes (
610 if (Status == EFI_UNSUPPORTED) {
612 }
else if (EFI_ERROR (Status)) {
616 if (BarDesc->ResType == ACPI_ADDRESS_SPACE_TYPE_MEM) {
617 Private->BarIndex = BarIndex;
625 Status = PciIo->Attributes (
629 &Private->PciAttributes
632 if (EFI_ERROR (Status)) {
636 Status = PciIo->Attributes (
643 if (!EFI_ERROR (Status)) {
644 Supports &= (UINT64)EFI_PCI_DEVICE_ENABLE;
645 Status = PciIo->Attributes (
658 Status =
gBS->InstallProtocolInterface (
662 (VOID *)&(Private->UfsHc)
666 if (EFI_ERROR (Status)) {
667 if ((Private !=
NULL) && (Private->PciAttributes != 0)) {
674 Private->PciAttributes,
681 &gEfiPciIoProtocolGuid,
682 This->DriverBindingHandle,
685 if (Private !=
NULL) {
735 Status =
gBS->OpenProtocol (
739 This->DriverBindingHandle,
741 EFI_OPEN_PROTOCOL_GET_PROTOCOL
744 if (EFI_ERROR (Status)) {
745 return EFI_DEVICE_ERROR;
748 Private = UFS_HOST_CONTROLLER_PRIVATE_DATA_FROM_UFSHC (UfsHc);
750 Status =
gBS->UninstallProtocolInterface (
755 if (!EFI_ERROR (Status)) {
759 Status = Private->PciIo->Attributes (
762 Private->PciAttributes,
772 &gEfiPciIoProtocolGuid,
773 This->DriverBindingHandle,
805 &gUfsHcDriverBinding,
807 &gUfsHcComponentName,
808 &gUfsHcComponentName2
PACKED struct @89 EFI_ACPI_ADDRESS_SPACE_DESCRIPTOR
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
EFI_PCI_IO_PROTOCOL_WIDTH
@ EfiPciIoAttributeOperationGet
@ EfiPciIoAttributeOperationEnable
@ EfiPciIoAttributeOperationSet
@ EfiPciIoAttributeOperationSupported
EFI_PCI_IO_PROTOCOL_OPERATION
EFI_GUID gEdkiiUfsHostControllerProtocolGuid
EDKII_UFS_HOST_CONTROLLER_OPERATION
UINT64 EFI_PHYSICAL_ADDRESS
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_STATUS EFIAPI UfsHcFlush(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This)
EFI_STATUS EFIAPI UfsHcMmioRead(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
EFI_STATUS EFIAPI UfsHcMmioWrite(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL_WIDTH Width, IN UINT64 Offset, IN UINTN Count, IN OUT VOID *Buffer)
EFI_STATUS EFIAPI UfsHcDriverEntry(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI UfsHcGetMmioBar(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, OUT UINTN *MmioBar)
EFI_STATUS EFIAPI UfsHcDriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer)
EFI_STATUS EFIAPI UfsHcDriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI UfsHcAllocateBuffer(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EFI_ALLOCATE_TYPE Type, IN EFI_MEMORY_TYPE MemoryType, IN UINTN Pages, OUT VOID **HostAddress, IN UINT64 Attributes)
EFI_STATUS EFIAPI UfsHcMap(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN EDKII_UFS_HOST_CONTROLLER_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS EFIAPI UfsHcUnmap(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN VOID *Mapping)
EFI_STATUS EFIAPI UfsHcDriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE Controller, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath)
EFI_STATUS EFIAPI UfsHcFreeBuffer(IN EDKII_UFS_HOST_CONTROLLER_PROTOCOL *This, IN UINTN Pages, IN VOID *HostAddress)
EFI_PCI_IO_PROTOCOL_IO_MEM Write
EFI_PCI_IO_PROTOCOL_IO_MEM Read
EFI_PCI_IO_PROTOCOL_CONFIG Read