Home | History | Annotate | Download | only in Armada70x0Lib
      1 /**Based on ArmPlatformPkg/Library/ArmPlatformLibNull/ArmPlatformLibNull.c
      2 *
      3 *  Copyright (c) 2011-2012, ARM Limited. All rights reserved.
      4 *  Copyright (c) 2016, Marvell International Ltd. All rights reserved.
      5 *
      6 *  This program and the accompanying materials are licensed and made available
      7 *  under the terms and conditions of the BSD License which accompanies this
      8 *  distribution. The full text of the license may be found at
      9 *  http://opensource.org/licenses/bsd-license.php
     10 *
     11 *  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     12 *  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     13 *
     14 **/
     15 
     16 #include <Library/ArmLib.h>
     17 #include <Library/ArmPlatformLib.h>
     18 #include <Library/MppLib.h>
     19 #include <Library/MvComPhyLib.h>
     20 #include <Library/UtmiPhyLib.h>
     21 #include <Ppi/ArmMpCoreInfo.h>
     22 
     23 
     24 ARM_CORE_INFO mArmada7040MpCoreInfoTable[] = {
     25   {
     26     // Cluster 0, Core 0
     27     0x0, 0x0,
     28 
     29     // MP Core MailBox Set/Get/Clear Addresses and Clear Value
     30     (EFI_PHYSICAL_ADDRESS)0,
     31     (EFI_PHYSICAL_ADDRESS)0,
     32     (EFI_PHYSICAL_ADDRESS)0,
     33     (UINT64)0xFFFFFFFF
     34   },
     35   {
     36     // Cluster 0, Core 1
     37     0x0, 0x1,
     38 
     39     // MP Core MailBox Set/Get/Clear Addresses and Clear Value
     40     (EFI_PHYSICAL_ADDRESS)0,
     41     (EFI_PHYSICAL_ADDRESS)0,
     42     (EFI_PHYSICAL_ADDRESS)0,
     43     (UINT64)0xFFFFFFFF
     44   },
     45   {
     46     // Cluster 0, Core 2
     47     0x0, 0x2,
     48 
     49     // MP Core MailBox Set/Get/Clear Addresses and Clear Value
     50     (EFI_PHYSICAL_ADDRESS)0,
     51     (EFI_PHYSICAL_ADDRESS)0,
     52     (EFI_PHYSICAL_ADDRESS)0,
     53     (UINT64)0xFFFFFFFF
     54   },
     55   {
     56     // Cluster 0, Core 3
     57     0x0, 0x3,
     58 
     59     // MP Core MailBox Set/Get/Clear Addresses and Clear Value
     60     (EFI_PHYSICAL_ADDRESS)0,
     61     (EFI_PHYSICAL_ADDRESS)0,
     62     (EFI_PHYSICAL_ADDRESS)0,
     63     (UINT64)0xFFFFFFFF
     64   }
     65 };
     66 
     67 /**
     68   Return the current Boot Mode
     69 
     70   This function returns the boot reason on the platform
     71 
     72 **/
     73 EFI_BOOT_MODE
     74 ArmPlatformGetBootMode (
     75   VOID
     76   )
     77 {
     78   return BOOT_WITH_FULL_CONFIGURATION;
     79 }
     80 
     81 /**
     82   Initialize controllers that must setup in the normal world
     83 
     84   This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
     85   in the PEI phase.
     86 
     87 **/
     88 RETURN_STATUS
     89 ArmPlatformInitialize (
     90   IN  UINTN                     MpId
     91   )
     92 {
     93   if (!ArmPlatformIsPrimaryCore (MpId)) {
     94     return RETURN_SUCCESS;
     95   }
     96 
     97   MvComPhyInit ();
     98   UtmiPhyInit ();
     99   MppInitialize ();
    100   return RETURN_SUCCESS;
    101 }
    102 
    103 /**
    104   Initialize the system (or sometimes called permanent) memory
    105 
    106   This memory is generally represented by the DRAM.
    107 
    108 **/
    109 VOID
    110 ArmPlatformInitializeSystemMemory (
    111   VOID
    112   )
    113 {
    114   //TODO: Initialize DRAM controller here
    115 }
    116 
    117 EFI_STATUS
    118 PrePeiCoreGetMpCoreInfo (
    119   OUT UINTN                   *CoreCount,
    120   OUT ARM_CORE_INFO           **ArmCoreTable
    121   )
    122 {
    123   if (ArmIsMpCore()) {
    124     *CoreCount    = sizeof(mArmada7040MpCoreInfoTable) / sizeof(ARM_CORE_INFO);
    125     *ArmCoreTable = mArmada7040MpCoreInfoTable;
    126     return EFI_SUCCESS;
    127   } else {
    128     return EFI_UNSUPPORTED;
    129   }
    130 }
    131 
    132 ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
    133 
    134 EFI_PEI_PPI_DESCRIPTOR      gPlatformPpiTable[] = {
    135   {
    136     EFI_PEI_PPI_DESCRIPTOR_PPI,
    137     &gArmMpCoreInfoPpiGuid,
    138     &mMpCoreInfoPpi
    139   }
    140 };
    141 
    142 VOID
    143 ArmPlatformGetPlatformPpiList (
    144   OUT UINTN                   *PpiListSize,
    145   OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList
    146   )
    147 {
    148   if (ArmIsMpCore()) {
    149     *PpiListSize = sizeof(gPlatformPpiTable);
    150     *PpiList = gPlatformPpiTable;
    151   } else {
    152     *PpiListSize = 0;
    153     *PpiList = NULL;
    154   }
    155 }
    156 
    157 
    158