GK SDK 源码库: XMIPCLinuxV100R005C00SPC030 (kernel/tools/open_source excluded)
This commit is contained in:
+61
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright 2018-2020 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BL31_DATA_H
|
||||
#define BL31_DATA_H
|
||||
|
||||
#define SECURE_DATA_BASE NXP_OCRAM_ADDR
|
||||
#define SECURE_DATA_SIZE NXP_OCRAM_SIZE
|
||||
#define SECURE_DATA_TOP (SECURE_DATA_BASE + SECURE_DATA_SIZE)
|
||||
#define SMC_REGION_SIZE 0x80
|
||||
#define SMC_GLBL_BASE (SECURE_DATA_TOP - SMC_REGION_SIZE)
|
||||
#define BC_PSCI_DATA_SIZE 0xC0
|
||||
#define BC_PSCI_BASE (SMC_GLBL_BASE - BC_PSCI_DATA_SIZE)
|
||||
#define SECONDARY_TOP BC_PSCI_BASE
|
||||
|
||||
#define SEC_PSCI_DATA_SIZE 0xC0
|
||||
#define SEC_REGION_SIZE SEC_PSCI_DATA_SIZE
|
||||
|
||||
/* SMC global data */
|
||||
#define BOOTLOC_OFFSET 0x0
|
||||
#define BOOT_SVCS_OSET 0x8
|
||||
|
||||
/* offset to prefetch disable mask */
|
||||
#define PREFETCH_DIS_OFFSET 0x10
|
||||
/* must reference last smc global entry */
|
||||
#define LAST_SMC_GLBL_OFFSET 0x18
|
||||
|
||||
#define SMC_TASK_OFFSET 0xC
|
||||
#define TSK_START_OFFSET 0x0
|
||||
#define TSK_DONE_OFFSET 0x4
|
||||
#define TSK_CORE_OFFSET 0x8
|
||||
#define SMC_TASK1_BASE (SMC_GLBL_BASE + 32)
|
||||
#define SMC_TASK2_BASE (SMC_TASK1_BASE + SMC_TASK_OFFSET)
|
||||
#define SMC_TASK3_BASE (SMC_TASK2_BASE + SMC_TASK_OFFSET)
|
||||
#define SMC_TASK4_BASE (SMC_TASK3_BASE + SMC_TASK_OFFSET)
|
||||
|
||||
/* psci data area offsets */
|
||||
#define CORE_STATE_DATA 0x0
|
||||
#define SPSR_EL3_DATA 0x8
|
||||
#define CNTXT_ID_DATA 0x10
|
||||
#define START_ADDR_DATA 0x18
|
||||
#define LINK_REG_DATA 0x20
|
||||
#define GICC_CTLR_DATA 0x28
|
||||
#define ABORT_FLAG_DATA 0x30
|
||||
#define SCTLR_DATA 0x38
|
||||
#define CPUECTLR_DATA 0x40
|
||||
#define AUX_01_DATA 0x48 /* usage defined per SoC */
|
||||
#define AUX_02_DATA 0x50 /* usage defined per SoC */
|
||||
#define AUX_03_DATA 0x58 /* usage defined per SoC */
|
||||
#define AUX_04_DATA 0x60 /* usage defined per SoC */
|
||||
#define AUX_05_DATA 0x68 /* usage defined per SoC */
|
||||
#define AUX_06_DATA 0x70 /* usage defined per SoC */
|
||||
#define AUX_07_DATA 0x78 /* usage defined per SoC */
|
||||
#define SCR_EL3_DATA 0x80
|
||||
#define HCR_EL2_DATA 0x88
|
||||
|
||||
#endif /* BL31_DATA_H */
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright 2020 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LS_EL3_INTRPT_MGMT_H
|
||||
#define LS_EL3_INTRPT_MGMT_H
|
||||
|
||||
#include <bl31/interrupt_mgmt.h>
|
||||
|
||||
#define MAX_INTR_EL3 128
|
||||
|
||||
/*
|
||||
* Register handler to specific GIC entrance
|
||||
* for INTR_TYPE_EL3 type of interrupt
|
||||
*/
|
||||
int request_intr_type_el3(uint32_t id, interrupt_type_handler_t handler);
|
||||
|
||||
void ls_el3_interrupt_config(void);
|
||||
|
||||
#endif /* LS_EL3_INTRPT_MGMT_H */
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2018-2020 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef MMU_MAP_DEF_H
|
||||
#define MMU_MAP_DEF_H
|
||||
|
||||
#include <lib/xlat_tables/xlat_tables_defs.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
|
||||
#define LS_MAP_CCSR MAP_REGION_FLAT(NXP_CCSR_ADDR, \
|
||||
NXP_CCSR_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
|
||||
#ifdef NXP_DCSR_ADDR
|
||||
#define LS_MAP_DCSR MAP_REGION_FLAT(NXP_DCSR_ADDR, \
|
||||
NXP_DCSR_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
#endif
|
||||
|
||||
#define LS_MAP_CONSOLE MAP_REGION_FLAT(NXP_DUART1_ADDR, \
|
||||
NXP_DUART_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_NS)
|
||||
|
||||
#define LS_MAP_OCRAM MAP_REGION_FLAT(NXP_OCRAM_ADDR, \
|
||||
NXP_OCRAM_SIZE, \
|
||||
MT_DEVICE | MT_RW | MT_SECURE)
|
||||
|
||||
#endif /* MMU_MAP_DEF_H */
|
||||
+152
@@ -0,0 +1,152 @@
|
||||
/*
|
||||
* Copyright 2018-2021 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLAT_COMMON_H
|
||||
#define PLAT_COMMON_H
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <dcfg.h>
|
||||
#include <lib/el3_runtime/cpu_data.h>
|
||||
|
||||
#include <platform_def.h>
|
||||
|
||||
#ifdef IMAGE_BL31
|
||||
|
||||
#define BL31_END (uintptr_t)(&__BL31_END__)
|
||||
|
||||
/*******************************************************************************
|
||||
* This structure represents the superset of information that can be passed to
|
||||
* BL31 e.g. while passing control to it from BL2. The BL32 parameters will be
|
||||
* populated only if BL2 detects its presence. A pointer to a structure of this
|
||||
* type should be passed in X0 to BL31's cold boot entrypoint.
|
||||
*
|
||||
* Use of this structure and the X0 parameter is not mandatory: the BL31
|
||||
* platform code can use other mechanisms to provide the necessary information
|
||||
* about BL32 and BL33 to the common and SPD code.
|
||||
*
|
||||
* BL31 image information is mandatory if this structure is used. If either of
|
||||
* the optional BL32 and BL33 image information is not provided, this is
|
||||
* indicated by the respective image_info pointers being zero.
|
||||
******************************************************************************/
|
||||
typedef struct bl31_params {
|
||||
param_header_t h;
|
||||
image_info_t *bl31_image_info;
|
||||
entry_point_info_t *bl32_ep_info;
|
||||
image_info_t *bl32_image_info;
|
||||
entry_point_info_t *bl33_ep_info;
|
||||
image_info_t *bl33_image_info;
|
||||
} bl31_params_t;
|
||||
|
||||
/* BL3 utility functions */
|
||||
void ls_bl31_early_platform_setup(void *from_bl2,
|
||||
void *plat_params_from_bl2);
|
||||
/* LS Helper functions */
|
||||
unsigned int plat_my_core_mask(void);
|
||||
unsigned int plat_core_mask(u_register_t mpidr);
|
||||
unsigned int plat_core_pos(u_register_t mpidr);
|
||||
//unsigned int plat_my_core_pos(void);
|
||||
|
||||
/* BL31 Data API(s) */
|
||||
void _init_global_data(void);
|
||||
void _initialize_psci(void);
|
||||
uint32_t _getCoreState(u_register_t core_mask);
|
||||
void _setCoreState(u_register_t core_mask, u_register_t core_state);
|
||||
|
||||
/* SoC defined structure and API(s) */
|
||||
void soc_runtime_setup(void);
|
||||
void soc_init(void);
|
||||
void soc_platform_setup(void);
|
||||
void soc_early_platform_setup2(void);
|
||||
#endif /* IMAGE_BL31 */
|
||||
|
||||
#ifdef IMAGE_BL2
|
||||
void soc_early_init(void);
|
||||
void soc_mem_access(void);
|
||||
void soc_preload_setup(void);
|
||||
void soc_bl2_prepare_exit(void);
|
||||
|
||||
/* IO storage utility functions */
|
||||
int plat_io_setup(void);
|
||||
int open_backend(const uintptr_t spec);
|
||||
|
||||
void ls_bl2_plat_arch_setup(void);
|
||||
void ls_bl2_el3_plat_arch_setup(void);
|
||||
|
||||
enum boot_device {
|
||||
BOOT_DEVICE_IFC_NOR,
|
||||
BOOT_DEVICE_IFC_NAND,
|
||||
BOOT_DEVICE_QSPI,
|
||||
BOOT_DEVICE_EMMC,
|
||||
BOOT_DEVICE_SDHC2_EMMC,
|
||||
BOOT_DEVICE_FLEXSPI_NOR,
|
||||
BOOT_DEVICE_FLEXSPI_NAND,
|
||||
BOOT_DEVICE_NONE
|
||||
};
|
||||
|
||||
enum boot_device get_boot_dev(void);
|
||||
|
||||
/* DDR Related functions */
|
||||
#if DDR_INIT
|
||||
#ifdef NXP_WARM_BOOT
|
||||
long long init_ddr(uint32_t wrm_bt_flg);
|
||||
#else
|
||||
long long init_ddr(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Board specific weak functions */
|
||||
bool board_enable_povdd(void);
|
||||
bool board_disable_povdd(void);
|
||||
|
||||
void mmap_add_ddr_region_dynamically(void);
|
||||
#endif /* IMAGE_BL2 */
|
||||
|
||||
typedef struct {
|
||||
uint64_t addr;
|
||||
uint64_t size;
|
||||
} region_info_t;
|
||||
|
||||
typedef struct {
|
||||
uint64_t num_dram_regions;
|
||||
int64_t total_dram_size;
|
||||
region_info_t region[NUM_DRAM_REGIONS];
|
||||
} dram_regions_info_t;
|
||||
|
||||
dram_regions_info_t *get_dram_regions_info(void);
|
||||
|
||||
void ls_setup_page_tables(uintptr_t total_base,
|
||||
size_t total_size,
|
||||
uintptr_t code_start,
|
||||
uintptr_t code_limit,
|
||||
uintptr_t rodata_start,
|
||||
uintptr_t rodata_limit
|
||||
#if USE_COHERENT_MEM
|
||||
, uintptr_t coh_start,
|
||||
uintptr_t coh_limit
|
||||
#endif
|
||||
);
|
||||
|
||||
#define SOC_NAME_MAX_LEN (20)
|
||||
|
||||
/* Structure to define SoC personality */
|
||||
struct soc_type {
|
||||
char name[SOC_NAME_MAX_LEN];
|
||||
uint32_t version;
|
||||
uint8_t num_clusters;
|
||||
uint8_t cores_per_cluster;
|
||||
};
|
||||
void get_cluster_info(const struct soc_type *soc_list, uint8_t ps_count,
|
||||
uint8_t *num_clusters, uint8_t *cores_per_cluster);
|
||||
|
||||
#define SOC_ENTRY(n, v, ncl, nc) { \
|
||||
.name = #n, \
|
||||
.version = SVR_##v, \
|
||||
.num_clusters = (ncl), \
|
||||
.cores_per_cluster = (nc)}
|
||||
|
||||
#endif /* PLAT_COMMON_H */
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
* Copyright 2018-2020 NXP
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PLAT_MACROS_S
|
||||
#define PLAT_MACROS_S
|
||||
|
||||
/* ---------------------------------------------
|
||||
* The below required platform porting macro
|
||||
* prints out relevant GIC and CCI registers
|
||||
* whenever an unhandled exception is taken in
|
||||
* BL31.
|
||||
* Clobbers: x0 - x10, x16, x17, sp
|
||||
* ---------------------------------------------
|
||||
*/
|
||||
.macro plat_crash_print_regs
|
||||
.endm
|
||||
|
||||
#endif /* PLAT_MACROS_S */
|
||||
Reference in New Issue
Block a user