Browse Source
Move from RESET_TO_BL31 boot to a TBBR style boot on N1sdp. Signed-off-by: sahil <sahil@arm.com> Change-Id: I153ccb43a4a013830973c7a183825d62b372c65epull/1986/head
sah01
3 years ago
committed by
sahil
11 changed files with 410 additions and 111 deletions
@ -0,0 +1,19 @@ |
|||
/* |
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <common/tbbr/tbbr_img_def.h> |
|||
|
|||
/dts-v1/; |
|||
/ { |
|||
dtb-registry { |
|||
compatible = "fconf,dyn_cfg-dtb_registry"; |
|||
tb_fw-config { |
|||
load-address = <0x0 0x4001300>; |
|||
max-size = <0x200>; |
|||
id = <TB_FW_CONFIG_ID>; |
|||
}; |
|||
}; |
|||
}; |
@ -0,0 +1,27 @@ |
|||
/* |
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
/dts-v1/; |
|||
/ { |
|||
tb_fw-config { |
|||
compatible = "arm,tb_fw"; |
|||
|
|||
/* Disable authentication for development */ |
|||
disable_auth = <0x0>; |
|||
|
|||
/* |
|||
* The following two entries are placeholders for Mbed TLS |
|||
* heap information. The default values don't matter since |
|||
* they will be overwritten by BL1. |
|||
* In case of having shared Mbed TLS heap between BL1 and BL2, |
|||
* BL1 will populate these two properties with the respective |
|||
* info about the shared heap. This info will be available for |
|||
* BL2 in order to locate and re-use the heap. |
|||
*/ |
|||
mbedtls_heap_addr = <0x0 0x0>; |
|||
mbedtls_heap_size = <0x0>; |
|||
}; |
|||
}; |
@ -0,0 +1,19 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <plat/arm/common/plat_arm.h> |
|||
|
|||
/*******************************************************************************
|
|||
* Perform any BL1 specific platform actions. |
|||
******************************************************************************/ |
|||
|
|||
void soc_css_init_nic400(void) |
|||
{ |
|||
} |
|||
|
|||
void soc_css_init_pcie(void) |
|||
{ |
|||
} |
@ -0,0 +1,89 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <common/debug.h> |
|||
#include <drivers/arm/css/sds.h> |
|||
#include <lib/mmio.h> |
|||
#include <lib/utils.h> |
|||
|
|||
#include "n1sdp_def.h" |
|||
#include <plat/arm/common/plat_arm.h> |
|||
|
|||
struct n1sdp_plat_info { |
|||
bool multichip_mode; |
|||
uint8_t secondary_count; |
|||
uint8_t local_ddr_size; |
|||
uint8_t remote_ddr_size; |
|||
} __packed; |
|||
|
|||
/*
|
|||
* N1SDP platform supports RDIMMs with ECC capability. To use the ECC |
|||
* capability, the entire DDR memory space has to be zeroed out before |
|||
* enabling the ECC bits in DMC620. Zeroing out several gigabytes of |
|||
* memory from SCP is quite time consuming so the following function |
|||
* is added to zero out the DDR memory from application processor which is |
|||
* much faster compared to SCP. |
|||
*/ |
|||
|
|||
void dmc_ecc_setup(uint8_t ddr_size_gb) |
|||
{ |
|||
uint64_t dram2_size; |
|||
|
|||
dram2_size = (ddr_size_gb * 1024UL * 1024UL * 1024UL) - |
|||
ARM_DRAM1_SIZE; |
|||
|
|||
INFO("Zeroing DDR memories\n"); |
|||
zero_normalmem((void *)ARM_DRAM1_BASE, ARM_DRAM1_SIZE); |
|||
flush_dcache_range(ARM_DRAM1_BASE, ARM_DRAM1_SIZE); |
|||
zero_normalmem((void *)ARM_DRAM2_BASE, dram2_size); |
|||
flush_dcache_range(ARM_DRAM2_BASE, dram2_size); |
|||
|
|||
INFO("Enabling ECC on DMCs\n"); |
|||
/* Set DMCs to CONFIG state before writing ERR0CTLR0 register */ |
|||
mmio_write_32(N1SDP_DMC0_MEMC_CMD_REG, N1SDP_DMC_MEMC_CMD_CONFIG); |
|||
mmio_write_32(N1SDP_DMC1_MEMC_CMD_REG, N1SDP_DMC_MEMC_CMD_CONFIG); |
|||
|
|||
/* Enable ECC in DMCs */ |
|||
mmio_setbits_32(N1SDP_DMC0_ERR0CTLR0_REG, N1SDP_DMC_ERR0CTLR0_ECC_EN); |
|||
mmio_setbits_32(N1SDP_DMC1_ERR0CTLR0_REG, N1SDP_DMC_ERR0CTLR0_ECC_EN); |
|||
|
|||
/* Set DMCs to READY state */ |
|||
mmio_write_32(N1SDP_DMC0_MEMC_CMD_REG, N1SDP_DMC_MEMC_CMD_READY); |
|||
mmio_write_32(N1SDP_DMC1_MEMC_CMD_REG, N1SDP_DMC_MEMC_CMD_READY); |
|||
} |
|||
|
|||
void bl2_platform_setup(void) |
|||
{ |
|||
int ret; |
|||
struct n1sdp_plat_info plat_info; |
|||
|
|||
ret = sds_init(); |
|||
if (ret != SDS_OK) { |
|||
ERROR("SDS initialization failed\n"); |
|||
panic(); |
|||
} |
|||
|
|||
ret = sds_struct_read(N1SDP_SDS_PLATFORM_INFO_STRUCT_ID, |
|||
N1SDP_SDS_PLATFORM_INFO_OFFSET, |
|||
&plat_info, |
|||
N1SDP_SDS_PLATFORM_INFO_SIZE, |
|||
SDS_ACCESS_MODE_NON_CACHED); |
|||
if (ret != SDS_OK) { |
|||
ERROR("Error getting platform info from SDS\n"); |
|||
panic(); |
|||
} |
|||
/* Validate plat_info SDS */ |
|||
if ((plat_info.local_ddr_size == 0) |
|||
|| (plat_info.local_ddr_size > N1SDP_MAX_DDR_CAPACITY_GB) |
|||
|| (plat_info.remote_ddr_size > N1SDP_MAX_DDR_CAPACITY_GB) |
|||
|| (plat_info.secondary_count > N1SDP_MAX_SECONDARY_COUNT)) { |
|||
ERROR("platform info SDS is corrupted\n"); |
|||
panic(); |
|||
} |
|||
|
|||
dmc_ecc_setup(plat_info.local_ddr_size); |
|||
arm_bl2_platform_setup(); |
|||
} |
@ -0,0 +1,17 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <plat/arm/common/plat_arm.h> |
|||
|
|||
/*
|
|||
* n1sdp error handler |
|||
*/ |
|||
void __dead2 plat_arm_error_handler(int err) |
|||
{ |
|||
while (true) { |
|||
wfi(); |
|||
} |
|||
} |
@ -0,0 +1,54 @@ |
|||
/*
|
|||
* Copyright (c) 2022, Arm Limited. All rights reserved. |
|||
* |
|||
* SPDX-License-Identifier: BSD-3-Clause |
|||
*/ |
|||
|
|||
#include <stdint.h> |
|||
|
|||
#include <plat/arm/common/plat_arm.h> |
|||
|
|||
/*
|
|||
* Return the non-volatile counter value stored in the platform. The cookie |
|||
* will contain the OID of the counter in the certificate. |
|||
* |
|||
* Return: 0 = success, Otherwise = error |
|||
*/ |
|||
int plat_get_nv_ctr(void *cookie, unsigned int *nv_ctr) |
|||
{ |
|||
*nv_ctr = N1SDP_FW_NVCTR_VAL; |
|||
return 0; |
|||
} |
|||
|
|||
/*
|
|||
* Store a new non-volatile counter value. By default on ARM development |
|||
* platforms, the non-volatile counters are RO and cannot be modified. We expect |
|||
* the values in the certificates to always match the RO values so that this |
|||
* function is never called. |
|||
* |
|||
* Return: 0 = success, Otherwise = error |
|||
*/ |
|||
int plat_set_nv_ctr(void *cookie, unsigned int nv_ctr) |
|||
{ |
|||
return 1; |
|||
} |
|||
|
|||
/*
|
|||
* Return the ROTPK hash in the following ASN.1 structure in DER format: |
|||
* |
|||
* AlgorithmIdentifier ::= SEQUENCE { |
|||
* algorithm OBJECT IDENTIFIER, |
|||
* parameters ANY DEFINED BY algorithm OPTIONAL |
|||
* } |
|||
* |
|||
* DigestInfo ::= SEQUENCE { |
|||
* digestAlgorithm AlgorithmIdentifier, |
|||
* digest OCTET STRING |
|||
* } |
|||
*/ |
|||
int plat_get_rotpk_info(void *cookie, void **key_ptr, unsigned int *key_len, |
|||
unsigned int *flags) |
|||
{ |
|||
return arm_get_rotpk_info(cookie, key_ptr, key_len, flags); |
|||
} |
|||
|
Loading…
Reference in new issue