1 /** @file
2   Copyright (c) 2014, Intel Corporation. All rights reserved.<BR>
3   This program and the accompanying materials
4   are licensed and made available under the terms and conditions of the BSD License
5   which accompanies this distribution.  The full text of the license may be found at
6   http://opensource.org/licenses/bsd-license.php.
7 
8   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10 
11 **/
12 
13 #ifndef _UFS_PCI_HOST_CONTROLLER_PEI_H_
14 #define _UFS_PCI_HOST_CONTROLLER_PEI_H_
15 
16 #include <PiPei.h>
17 
18 #include <Ppi/MasterBootMode.h>
19 #include <Ppi/UfsHostController.h>
20 
21 #include <IndustryStandard/Pci.h>
22 
23 #include <Library/DebugLib.h>
24 #include <Library/BaseLib.h>
25 #include <Library/BaseMemoryLib.h>
26 #include <Library/PciLib.h>
27 #include <Library/PeiServicesLib.h>
28 #include <Library/MemoryAllocationLib.h>
29 
30 #define UFS_HC_PEI_SIGNATURE    SIGNATURE_32 ('U', 'F', 'S', 'P')
31 #define MAX_UFS_HCS             8
32 
33 typedef struct {
34   UINTN                         Signature;
35   EDKII_UFS_HOST_CONTROLLER_PPI UfsHostControllerPpi;
36   EFI_PEI_PPI_DESCRIPTOR        PpiList;
37   UINTN                         TotalUfsHcs;
38   UINTN                         UfsHcPciAddr[MAX_UFS_HCS];
39 } UFS_HC_PEI_PRIVATE_DATA;
40 
41 #define UFS_HC_PEI_PRIVATE_DATA_FROM_THIS(a)  CR (a, UFS_HC_PEI_PRIVATE_DATA, UfsHostControllerPpi, UFS_HC_PEI_SIGNATURE)
42 
43 /**
44   Get the MMIO base address of UFS host controller.
45 
46   @param[in]  This               The protocol instance pointer.
47   @param[in]  ControllerId       The ID of the UFS host controller.
48   @param[out] MmioBar            Pointer to the UFS host controller MMIO base address.
49 
50   @retval EFI_SUCCESS            The operation succeeds.
51   @retval EFI_INVALID_PARAMETER  The parameters are invalid.
52 
53 **/
54 EFI_STATUS
55 EFIAPI
56 GetUfsHcMmioBar (
57   IN     EDKII_UFS_HOST_CONTROLLER_PPI *This,
58   IN     UINT8                         ControllerId,
59      OUT UINTN                         *MmioBar
60   );
61 
62 #endif
63