diff options
author | Ronald Cron <ronald.cron@arm.com> | 2018-05-30 16:11:02 +0200 |
---|---|---|
committer | Ronald Cron <ronald.cron@arm.com> | 2018-06-08 11:46:12 +0200 |
commit | cf5c8712b0f8ba718e3d5a948c16e519f73b8824 (patch) | |
tree | 9da62c2a209c99154f78b654aefb908e8a1cf4cf /arch/src/host.c | |
parent | 3bd63de8453e42c8f3ac34b6d6fc87cf58c3547e (diff) |
Add the SCP-firmware framework
Please see doc/framework.md for details.
Co-authored-by: Filipe Rinaldi <filipe.rinaldi@arm.com>
Co-authored-by: Paul Beesley <paul.beesley@arm.com>
Co-authored-by: Chris Kay <chris.kay@arm.com>
Co-authored-by: Elieva Pignat <elieva.pignat@arm.com>
Co-authored-by: Pedro Custodio <pedro.krewinkelcustodio@arm.com>
Change-Id: I1744c60eca295c60b3fabcfafb522fbff5d7306c
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
Diffstat (limited to 'arch/src/host.c')
-rw-r--r-- | arch/src/host.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/src/host.c b/arch/src/host.c new file mode 100644 index 00000000..7682a2b8 --- /dev/null +++ b/arch/src/host.c @@ -0,0 +1,51 @@ +/* + * Arm SCP/MCP Software + * Copyright (c) 2015-2018, Arm Limited and Contributors. All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include <stdio.h> +#include <stdlib.h> +#include <fwk_arch.h> +#include <fwk_errno.h> + +extern int host_interrupt_init(struct fwk_arch_interrupt_driver **driver); + +/* + * Catches early failures in the initialization. + */ +static void __attribute__((noreturn)) panic(void) +{ + printf("Panic!\n"); + exit(1); +} + +static int mm_init(struct fwk_arch_mm_data *data) +{ + const size_t size = 1024 * 1024; /* 1MB of heap */ + void *mem; + + mem = malloc(size); + if (mem == NULL) + return FWK_E_NOMEM; + + data->start = (uintptr_t)mem; + data->size = size; + + return FWK_SUCCESS; +} + +static const struct fwk_arch_init_driver arch_init_driver = { + .mm = mm_init, + .interrupt = host_interrupt_init, +}; + +int main(void) +{ + int status; + + status = fwk_arch_init(&arch_init_driver); + if (status != FWK_SUCCESS) + panic(); +} |