summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Bus/Pci/UfsPciHcPei
diff options
context:
space:
mode:
authorGuo Mang <mang.guo@intel.com>2016-12-22 15:55:38 +0800
committerGuo Mang <mang.guo@intel.com>2016-12-26 19:14:37 +0800
commit7f05fa00f73038b425002566d3afe6c3ade2ccdb (patch)
tree297e208d4ade33a8bb3d5d20f72c53e0d134e003 /MdeModulePkg/Bus/Pci/UfsPciHcPei
parented2ecce34b3830562c4239093a41ba92d76d5f31 (diff)
downloadedk2-platforms-7f05fa00f73038b425002566d3afe6c3ade2ccdb.tar.xz
MdeModulePkg: Move to new location
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Guo Mang <mang.guo@intel.com>
Diffstat (limited to 'MdeModulePkg/Bus/Pci/UfsPciHcPei')
-rw-r--r--MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.c152
-rw-r--r--MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.h62
-rw-r--r--MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.inf56
-rw-r--r--MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.unibin2076 -> 0 bytes
-rw-r--r--MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPeiExtra.unibin1372 -> 0 bytes
5 files changed, 0 insertions, 270 deletions
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.c b/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.c
deleted file mode 100644
index 36325641e7..0000000000
--- a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.c
+++ /dev/null
@@ -1,152 +0,0 @@
-/** @file
- UfsPciHcPei driver is used to provide platform-dependent info, mainly UFS host controller
- MMIO base, to upper layer UFS drivers.
-
- Copyright (c) 2014, 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 "UfsPciHcPei.h"
-
-EDKII_UFS_HOST_CONTROLLER_PPI mUfsHostControllerPpi = { GetUfsHcMmioBar };
-
-EFI_PEI_PPI_DESCRIPTOR mPpiList = {
- (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
- &gEdkiiPeiUfsHostControllerPpiGuid,
- &mUfsHostControllerPpi
-};
-
-/**
- Get the MMIO base address of UFS host controller.
-
- @param[in] This The protocol instance pointer.
- @param[in] ControllerId The ID of the UFS host controller.
- @param[out] MmioBar Pointer to the UFS host controller MMIO base address.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-GetUfsHcMmioBar (
- IN EDKII_UFS_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *MmioBar
- )
-{
- UFS_HC_PEI_PRIVATE_DATA *Private;
-
- if ((This == NULL) || (MmioBar == NULL)) {
- return EFI_INVALID_PARAMETER;
- }
-
- Private = UFS_HC_PEI_PRIVATE_DATA_FROM_THIS (This);
-
- if (ControllerId >= Private->TotalUfsHcs) {
- return EFI_INVALID_PARAMETER;
- }
-
- *MmioBar = (UINTN)Private->UfsHcPciAddr[ControllerId];
-
- 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
-InitializeUfsHcPeim (
- 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;
- UINT8 SubClass;
- UINT8 BaseClass;
- UFS_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 export this in S3 boot path, because it is only for recovery.
- ///
- if (BootMode == BOOT_ON_S3_RESUME) {
- return EFI_SUCCESS;
- }
-
- Private = (UFS_HC_PEI_PRIVATE_DATA *) AllocateZeroPool (sizeof (UFS_HC_PEI_PRIVATE_DATA));
- if (Private == NULL) {
- DEBUG ((EFI_D_ERROR, "Failed to allocate memory for UFS_HC_PEI_PRIVATE_DATA! \n"));
- return EFI_OUT_OF_RESOURCES;
- }
-
- Private->Signature = UFS_HC_PEI_SIGNATURE;
- Private->UfsHostControllerPpi = mUfsHostControllerPpi;
- Private->PpiList = mPpiList;
- Private->PpiList.Ppi = &Private->UfsHostControllerPpi;
-
- 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 == 0x09) && (BaseClass == PCI_CLASS_MASS_STORAGE)) {
- //
- // Get the Ufs 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), 0xFFFFFFFF);
- Size = PciRead32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET));
- //
- // Assign resource to the Ufs Pci host controller's MMIO BAR.
- // Enable the Ufs Pci host controller by setting BME and MSE bits of PCI_CMD register.
- //
- PciWrite32 (PCI_LIB_ADDRESS (Bus, Device, Function, PCI_BASE_ADDRESSREG_OFFSET), (UINT32)(PcdGet32 (PcdUfsPciHostControllerMmioBase) + Size * Private->TotalUfsHcs));
- 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->UfsHcPciAddr[Private->TotalUfsHcs] = PcdGet32 (PcdUfsPciHostControllerMmioBase) + Size * Private->TotalUfsHcs;
- Private->TotalUfsHcs++;
- ASSERT (Private->TotalUfsHcs < MAX_UFS_HCS);
- }
- }
- }
- }
-
- ///
- /// Install Ufs Host Controller PPI
- ///
- Status = PeiServicesInstallPpi (&Private->PpiList);
-
- ASSERT_EFI_ERROR (Status);
- return Status;
-}
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.h b/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.h
deleted file mode 100644
index 2405dd76d8..0000000000
--- a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/** @file
- Copyright (c) 2014, 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 _UFS_PCI_HOST_CONTROLLER_PEI_H_
-#define _UFS_PCI_HOST_CONTROLLER_PEI_H_
-
-#include <PiPei.h>
-
-#include <Ppi/MasterBootMode.h>
-#include <Ppi/UfsHostController.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 UFS_HC_PEI_SIGNATURE SIGNATURE_32 ('U', 'F', 'S', 'P')
-#define MAX_UFS_HCS 8
-
-typedef struct {
- UINTN Signature;
- EDKII_UFS_HOST_CONTROLLER_PPI UfsHostControllerPpi;
- EFI_PEI_PPI_DESCRIPTOR PpiList;
- UINTN TotalUfsHcs;
- UINTN UfsHcPciAddr[MAX_UFS_HCS];
-} UFS_HC_PEI_PRIVATE_DATA;
-
-#define UFS_HC_PEI_PRIVATE_DATA_FROM_THIS(a) CR (a, UFS_HC_PEI_PRIVATE_DATA, UfsHostControllerPpi, UFS_HC_PEI_SIGNATURE)
-
-/**
- Get the MMIO base address of UFS host controller.
-
- @param[in] This The protocol instance pointer.
- @param[in] ControllerId The ID of the UFS host controller.
- @param[out] MmioBar Pointer to the UFS host controller MMIO base address.
-
- @retval EFI_SUCCESS The operation succeeds.
- @retval EFI_INVALID_PARAMETER The parameters are invalid.
-
-**/
-EFI_STATUS
-EFIAPI
-GetUfsHcMmioBar (
- IN EDKII_UFS_HOST_CONTROLLER_PPI *This,
- IN UINT8 ControllerId,
- OUT UINTN *MmioBar
- );
-
-#endif
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.inf b/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.inf
deleted file mode 100644
index b16935628c..0000000000
--- a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.inf
+++ /dev/null
@@ -1,56 +0,0 @@
-## @file
-# Component Description File For Universal Flash Storage Pci Host Controller Pei Module.
-#
-# Copyright (c) 2014 - 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 = UfsPciHcPei
- MODULE_UNI_FILE = UfsPciHcPei.uni
- FILE_GUID = 905DC1AD-C44D-4965-98AC-B6B4444BFD65
- MODULE_TYPE = PEIM
- VERSION_STRING = 0.9
-
- ENTRY_POINT = InitializeUfsHcPeim
-
-#
-# The following information is for reference only and not required by the build tools.
-#
-# VALID_ARCHITECTURES = IA32 X64 IPF EBC
-#
-
-[Sources]
- UfsPciHcPei.c
- UfsPciHcPei.h
-
-[Packages]
- MdePkg/MdePkg.dec
- MdeModulePkg/MdeModulePkg.dec
-
-[LibraryClasses]
- PciLib
- DebugLib
- PeiServicesLib
- MemoryAllocationLib
- PeimEntryPoint
-
-[Pcd]
- gEfiMdeModulePkgTokenSpaceGuid.PcdUfsPciHostControllerMmioBase ## CONSUMES
-
-[Ppis]
- gEdkiiPeiUfsHostControllerPpiGuid ## PRODUCES
-
-[Depex]
- gEfiPeiMasterBootModePpiGuid AND gEfiPeiMemoryDiscoveredPpiGuid
-
-[UserExtensions.TianoCore."ExtraFiles"]
- UfsPciHcPeiExtra.uni \ No newline at end of file
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.uni b/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.uni
deleted file mode 100644
index 7b7ea3af7b..0000000000
--- a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPei.uni
+++ /dev/null
Binary files differ
diff --git a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPeiExtra.uni b/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPeiExtra.uni
deleted file mode 100644
index 4487eb968f..0000000000
--- a/MdeModulePkg/Bus/Pci/UfsPciHcPei/UfsPciHcPeiExtra.uni
+++ /dev/null
Binary files differ