diff --git a/bsps/aarch64/xen/console/console.c b/bsps/aarch64/xen/console/console.c new file mode 100644 index 0000000000..4e9a58b90c --- /dev/null +++ b/bsps/aarch64/xen/console/console.c @@ -0,0 +1,72 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the console configuration. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include +#include +#include + +#include + +arm_pl011_context xen_vpl011_context = { + .base = RTEMS_TERMIOS_DEVICE_CONTEXT_INITIALIZER("PL011"), + .regs = (arm_pl011_uart *) BSP_XEN_VPL011_BASE, + .irq = BSP_XEN_VPL011_SPI, + .initial_baud = 115200, + .clock = 24000000 +}; + +const console_device console_device_table[] = { + { + .device_file = "/dev/ttyS0", + .probe = console_device_probe_default, + .handler = &arm_pl011_fns, + .context = &xen_vpl011_context.base + } +}; + +const size_t console_device_count = RTEMS_ARRAY_SIZE(console_device_table); + +static void output_char( char c ) +{ + arm_pl011_write_polled(&xen_vpl011_context.base, c); +} + +BSP_output_char_function_type BSP_output_char = output_char; + +BSP_polling_getchar_function_type BSP_poll_char = NULL; diff --git a/bsps/aarch64/xen/include/bsp.h b/bsps/aarch64/xen/include/bsp.h new file mode 100644 index 0000000000..fcbeebd211 --- /dev/null +++ b/bsps/aarch64/xen/include/bsp.h @@ -0,0 +1,82 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the base BSP definitions. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LIBBSP_AARCH64_XEN_BSP_H +#define LIBBSP_AARCH64_XEN_BSP_H + +/** + * @addtogroup RTEMSBSPsARM + * + * @{ + */ + +#include + +#define BSP_FEATURE_IRQ_EXTENSION + +#define BSP_START_IMAGE_HEADER_LOAD_OFFSET BSP_XEN_LOAD_OFFSET + +#ifndef ASM + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define BSP_ARM_GIC_CPUIF_BASE 0x03002000 +#define BSP_ARM_GIC_CPUIF_LENGTH 0x2000 + +#define BSP_ARM_GIC_DIST_BASE 0x03001000 +#define BSP_ARM_GIC_DIST_LENGTH 0x1000 + +#define BSP_XEN_VPL011_BASE 0x22000000 +#define BSP_XEN_VPL011_LENGTH 0x1000 + +BSP_START_TEXT_SECTION void xen_setup_mmu_and_cache( void ); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ASM */ + +/** @} */ + +#endif /* LIBBSP_AARCH64_XEN_BSP_H */ diff --git a/bsps/aarch64/xen/include/bsp/irq.h b/bsps/aarch64/xen/include/bsp/irq.h new file mode 100644 index 0000000000..011d96f5e8 --- /dev/null +++ b/bsps/aarch64/xen/include/bsp/irq.h @@ -0,0 +1,67 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the BSP IRQ definitions. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef LIBBSP_AARCH64_XEN_IRQ_H +#define LIBBSP_AARCH64_XEN_IRQ_H + +#ifndef ASM + +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#define BSP_INTERRUPT_VECTOR_COUNT 1019 + +#define BSP_TIMER_VIRT_PPI 27 +#define BSP_TIMER_PHYS_S_PPI 29 +#define BSP_TIMER_PHYS_NS_PPI 30 +#define BSP_XEN_EVTCHN_PPI 31 +#define BSP_XEN_VPL011_SPI 32 + +/** @} */ + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + +#endif /* ASM */ + +#endif /* LIBBSP_AARCH64_XEN_IRQ_H */ diff --git a/bsps/aarch64/xen/include/tm27.h b/bsps/aarch64/xen/include/tm27.h new file mode 100644 index 0000000000..7677df20c1 --- /dev/null +++ b/bsps/aarch64/xen/include/tm27.h @@ -0,0 +1,46 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the TM27 test definitions. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _RTEMS_TMTEST27 +#error "This is an RTEMS internal file you must not include directly." +#endif + +#ifndef __tm27_h +#define __tm27_h + +#include + +#endif /* __tm27_h */ diff --git a/bsps/aarch64/xen/start/bspstart.c b/bsps/aarch64/xen/start/bspstart.c new file mode 100644 index 0000000000..42b5a75ddb --- /dev/null +++ b/bsps/aarch64/xen/start/bspstart.c @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the implementation of start hooks. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include + +#include + +void bsp_start( void ) +{ + bsp_interrupt_initialize(); + rtems_cache_coherent_add_area( + bsp_section_nocacheheap_begin, + (uintptr_t) bsp_section_nocacheheap_size + ); +} diff --git a/bsps/aarch64/xen/start/bspstarthooks.c b/bsps/aarch64/xen/start/bspstarthooks.c new file mode 100644 index 0000000000..63b0782fcb --- /dev/null +++ b/bsps/aarch64/xen/start/bspstarthooks.c @@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the implementation of start hooks. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +BSP_START_TEXT_SECTION void bsp_start_hook_1( void ) +{ + AArch64_start_set_vector_base(); + xen_setup_mmu_and_cache(); + bsp_start_clear_bss(); +} diff --git a/bsps/aarch64/xen/start/bspstartmmu.c b/bsps/aarch64/xen/start/bspstartmmu.c new file mode 100644 index 0000000000..229b0d99fc --- /dev/null +++ b/bsps/aarch64/xen/start/bspstartmmu.c @@ -0,0 +1,58 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the default MMU tables and setup. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include +#include + +BSP_START_TEXT_SECTION void +xen_setup_mmu_and_cache( void ) +{ + aarch64_mmu_control *control = &aarch64_mmu_instance; + + aarch64_mmu_setup(); + + aarch64_mmu_setup_translation_table( + control, + &aarch64_mmu_config_table[ 0 ], + aarch64_mmu_config_table_size + ); + + aarch64_mmu_enable( control ); +} diff --git a/bsps/aarch64/xen/start/mmu-config.c b/bsps/aarch64/xen/start/mmu-config.c new file mode 100644 index 0000000000..d42c93fb5e --- /dev/null +++ b/bsps/aarch64/xen/start/mmu-config.c @@ -0,0 +1,70 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @ingroup RTEMSBSPsAArch64Xen + * + * @brief This source file contains the definition of ::aarch64_mmu_config_table + * and ::aarch64_mmu_config_table_size. + */ + +/* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + +BSP_START_DATA_SECTION const aarch64_mmu_config_entry +aarch64_mmu_config_table[] = { + AARCH64_MMU_DEFAULT_SECTIONS, + { + .begin = 0xf9000000U, + .end = 0xf9100000U, + .flags = AARCH64_MMU_DEVICE + }, { + .begin = 0xfd000000U, + .end = 0xffc00000U, + .flags = AARCH64_MMU_DEVICE + }, { + .begin = BSP_XEN_VPL011_BASE, + .end = BSP_XEN_VPL011_BASE + BSP_XEN_VPL011_LENGTH, + .flags = AARCH64_MMU_DEVICE + }, { + .begin = BSP_ARM_GIC_CPUIF_BASE, + .end = BSP_ARM_GIC_CPUIF_BASE + BSP_ARM_GIC_CPUIF_LENGTH, + .flags = AARCH64_MMU_DEVICE + }, { + .begin = BSP_ARM_GIC_DIST_BASE, + .end = BSP_ARM_GIC_DIST_BASE + BSP_ARM_GIC_DIST_LENGTH, + .flags = AARCH64_MMU_DEVICE + } +}; + +BSP_START_DATA_SECTION const size_t aarch64_mmu_config_table_size = + RTEMS_ARRAY_SIZE(aarch64_mmu_config_table); diff --git a/spec/build/bsps/aarch64/optstartel3.yml b/spec/build/bsps/aarch64/optstartel3.yml index e426c2a4db..bbf7642b8f 100644 --- a/spec/build/bsps/aarch64/optstartel3.yml +++ b/spec/build/bsps/aarch64/optstartel3.yml @@ -6,7 +6,9 @@ build-type: option copyrights: - Copyright (C) 2024 embedded brains GmbH & Co. KG default: -- enabled-by: bsps/aarch64/xilinx-zynqmp +- enabled-by: + - bsps/aarch64/xilinx-zynqmp + - bsps/aarch64/xen value: false - enabled-by: true value: true diff --git a/spec/build/bsps/aarch64/xen/abi.yml b/spec/build/bsps/aarch64/xen/abi.yml new file mode 100644 index 0000000000..0ddba49c31 --- /dev/null +++ b/spec/build/bsps/aarch64/xen/abi.yml @@ -0,0 +1,21 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-append: null +build-type: option +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +default: +- enabled-by: true + value: + - -mno-outline-atomics + - -mcpu=cortex-a53 + - -mfix-cortex-a53-835769 + - -mfix-cortex-a53-843419 +description: | + ABI flags +enabled-by: true +links: [] +name: ABI_FLAGS +type: build diff --git a/spec/build/bsps/aarch64/xen/bspxen.yml b/spec/build/bsps/aarch64/xen/bspxen.yml new file mode 100644 index 0000000000..54a0e5be6f --- /dev/null +++ b/spec/build/bsps/aarch64/xen/bspxen.yml @@ -0,0 +1,19 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +arch: aarch64 +bsp: xen +build-type: bsp +cflags: [] +copyrights: +- Copyright (C) 2025 On-Line Applications Research +cppflags: [] +enabled-by: true +family: xen +includes: [] +install: [] +links: +- role: build-dependency + uid: grp +- role: build-dependency + uid: linkcmds +source: [] +type: build diff --git a/spec/build/bsps/aarch64/xen/grp.yml b/spec/build/bsps/aarch64/xen/grp.yml new file mode 100644 index 0000000000..78a5302016 --- /dev/null +++ b/spec/build/bsps/aarch64/xen/grp.yml @@ -0,0 +1,61 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: group +cflags: [] +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +cppflags: [] +cxxflags: [] +enabled-by: true +includes: [] +install: [] +ldflags: [] +links: +- role: build-dependency + uid: abi +- role: build-dependency + uid: obj +- role: build-dependency + uid: optloadoff +- role: build-dependency + uid: optnocachelen +- role: build-dependency + uid: optramlen +- role: build-dependency + uid: optramori +- role: build-dependency + uid: ../../optgentmunmask +- role: build-dependency + uid: ../optimghdr +- role: build-dependency + uid: ../grp +- role: build-dependency + uid: ../objclockarmgenerictimer +- role: build-dependency + uid: ../optgtusevirt +- role: build-dependency + uid: ../optmmupabits +- role: build-dependency + uid: ../optmmupages +- role: build-dependency + uid: ../start +- role: build-dependency + uid: ../../bspopts +- role: build-dependency + uid: ../../dev/irq/objarmgicv2 +- role: build-dependency + uid: ../../obj +- role: build-dependency + uid: ../../objirq +- role: build-dependency + uid: ../../objmem +- role: build-dependency + uid: ../../optcachedata +- role: build-dependency + uid: ../../optcacheinst +- role: build-dependency + uid: ../../opto2 +- role: build-dependency + uid: ../../objdevserialarmpl011 +type: build +use-after: [] +use-before: [] diff --git a/spec/build/bsps/aarch64/xen/linkcmds.yml b/spec/build/bsps/aarch64/xen/linkcmds.yml new file mode 100644 index 0000000000..053484a22a --- /dev/null +++ b/spec/build/bsps/aarch64/xen/linkcmds.yml @@ -0,0 +1,94 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: config-file +content: | + /* SPDX-License-Identifier: BSD-2-Clause */ + + /* + * Copyright (C) 2025 On-Line Applications Research Corporation (OAR) + * Written by Kinsey Moore + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + + DDRMC_REGION_0_BASE = 0x00000000000; + DDRMC_REGION_0_LENGTH = 0x00080000000; + + BSP_RAM_BASE = ${BSP_XEN_RAM_BASE}; + + BSP_R0_RAM_BASE = DDRMC_REGION_0_BASE; + BSP_R0_RAM_LENGTH = + ${BSP_XEN_RAM_LENGTH} >= DDRMC_REGION_0_LENGTH ? + DDRMC_REGION_0_LENGTH - BSP_RAM_BASE : ${BSP_XEN_RAM_LENGTH}; + BSP_R0_RAM_END = BSP_RAM_BASE + BSP_R0_RAM_LENGTH; + + AARCH64_MMU_TT_PAGES_SIZE = 0x1000 * ${AARCH64_MMU_TRANSLATION_TABLE_PAGES}; + + MEMORY { + RAM : ORIGIN = BSP_RAM_BASE + ${BSP_XEN_LOAD_OFFSET}, + LENGTH = BSP_R0_RAM_LENGTH - ${BSP_XEN_LOAD_OFFSET} - ${BSP_XEN_NOCACHE_LENGTH} - AARCH64_MMU_TT_PAGES_SIZE + NOCACHE : ORIGIN = BSP_RAM_BASE + BSP_R0_RAM_LENGTH - AARCH64_MMU_TT_PAGES_SIZE - ${BSP_XEN_NOCACHE_LENGTH}, + LENGTH = ${BSP_XEN_NOCACHE_LENGTH} + RAM_MMU : ORIGIN = BSP_R0_RAM_END - AARCH64_MMU_TT_PAGES_SIZE, + LENGTH = AARCH64_MMU_TT_PAGES_SIZE + } + + REGION_ALIAS ("REGION_START", RAM); + REGION_ALIAS ("REGION_VECTOR", RAM); + REGION_ALIAS ("REGION_TEXT", RAM); + REGION_ALIAS ("REGION_TEXT_LOAD", RAM); + REGION_ALIAS ("REGION_RODATA", RAM); + REGION_ALIAS ("REGION_RODATA_LOAD", RAM); + REGION_ALIAS ("REGION_DATA", RAM); + REGION_ALIAS ("REGION_DATA_LOAD", RAM); + REGION_ALIAS ("REGION_FAST_TEXT", RAM); + REGION_ALIAS ("REGION_FAST_TEXT_LOAD", RAM); + REGION_ALIAS ("REGION_FAST_DATA", RAM); + REGION_ALIAS ("REGION_FAST_DATA_LOAD", RAM); + REGION_ALIAS ("REGION_BSS", RAM); + REGION_ALIAS ("REGION_WORK", RAM); + REGION_ALIAS ("REGION_STACK", RAM); + REGION_ALIAS ("REGION_NOCACHE", NOCACHE); + REGION_ALIAS ("REGION_NOCACHE_LOAD", NOCACHE); + + bsp_stack_exception_size = DEFINED (bsp_stack_exception_size) ? bsp_stack_exception_size : 1024; + + bsp_section_rwbarrier_align = DEFINED (bsp_section_rwbarrier_align) ? bsp_section_rwbarrier_align : 1M; + + bsp_vector_table_in_start_section = 1; + + bsp_r0_ram_base = DDRMC_REGION_0_BASE; + bsp_r0_ram_end = ORIGIN (RAM) + LENGTH (RAM); + + bsp_translation_table_base = ORIGIN (RAM_MMU); + bsp_translation_table_end = ORIGIN (RAM_MMU) + LENGTH (RAM_MMU); + + OUTPUT_FORMAT ("elf64-littleaarch64") + OUTPUT_ARCH (aarch64) + + INCLUDE linkcmds.base +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +enabled-by: true +install-path: ${BSP_LIBDIR} +links: [] +target: linkcmds +type: build diff --git a/spec/build/bsps/aarch64/xen/obj.yml b/spec/build/bsps/aarch64/xen/obj.yml new file mode 100644 index 0000000000..27aea09667 --- /dev/null +++ b/spec/build/bsps/aarch64/xen/obj.yml @@ -0,0 +1,38 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: objects +cflags: [] +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +cppflags: [] +cxxflags: [] +enabled-by: true +includes: [] +install: +- destination: ${BSP_INCLUDEDIR} + source: + - bsps/aarch64/xen/include/bsp.h +- destination: ${BSP_INCLUDEDIR}/bsp + source: + - bsps/aarch64/xen/include/bsp/irq.h + - bsps/aarch64/include/bsp/aarch64-mmu.h +links: [] +source: +- bsps/aarch64/shared/cache/cache.c +- bsps/aarch64/shared/mmu/mmu-setup.c +- bsps/aarch64/shared/mmu/vmsav8-64.c +- bsps/aarch64/shared/start/start-cpu-mpidr.S +- bsps/aarch64/xen/console/console.c +- bsps/aarch64/xen/start/bspstart.c +- bsps/aarch64/xen/start/bspstarthooks.c +- bsps/aarch64/xen/start/bspstartmmu.c +- bsps/aarch64/xen/start/mmu-config.c +- bsps/shared/dev/btimer/btimer-cpucounter.c +- bsps/shared/dev/getentropy/getentropy-cpucounter.c +- bsps/shared/dev/irq/arm-gicv2-get-attributes.c +- bsps/shared/dev/serial/console-termios-init.c +- bsps/shared/dev/serial/console-termios.c +- bsps/shared/irq/irq-default-handler.c +- bsps/shared/start/bspreset-arm-psci.S +- bsps/shared/start/gettargethash-default.c +- bsps/shared/start/sbrk.c +type: build diff --git a/spec/build/bsps/aarch64/xen/optloadoff.yml b/spec/build/bsps/aarch64/xen/optloadoff.yml new file mode 100644 index 0000000000..3f193043af --- /dev/null +++ b/spec/build/bsps/aarch64/xen/optloadoff.yml @@ -0,0 +1,19 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- assert-uint32: null +- env-assign: null +- format-and-define: null +build-type: option +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +default: +- enabled-by: true + value: 0x00008000 +description: | + offset of RAM region from memory area base +enabled-by: true +format: '{:#010x}' +links: [] +name: BSP_XEN_LOAD_OFFSET +type: build diff --git a/spec/build/bsps/aarch64/xen/optnocachelen.yml b/spec/build/bsps/aarch64/xen/optnocachelen.yml new file mode 100644 index 0000000000..1fd501f10c --- /dev/null +++ b/spec/build/bsps/aarch64/xen/optnocachelen.yml @@ -0,0 +1,19 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- assert-uint32: null +- env-assign: null +- format-and-define: null +build-type: option +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +default: +- enabled-by: true + value: 0x00100000 +description: | + length of nocache RAM region +enabled-by: true +format: '{:#010x}' +links: [] +name: BSP_XEN_NOCACHE_LENGTH +type: build diff --git a/spec/build/bsps/aarch64/xen/optramlen.yml b/spec/build/bsps/aarch64/xen/optramlen.yml new file mode 100644 index 0000000000..3c9dfc67c5 --- /dev/null +++ b/spec/build/bsps/aarch64/xen/optramlen.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- assert-uint64: null +- env-assign: null +- format-and-define: null +build-type: option +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +default: +- enabled-by: true + value: 0x00800000 +description: | + This option defines the length in bytes of the DDR memory area which is + statically available to the application. +enabled-by: true +format: '{:#010x}' +links: [] +name: BSP_XEN_RAM_LENGTH +type: build diff --git a/spec/build/bsps/aarch64/xen/optramori.yml b/spec/build/bsps/aarch64/xen/optramori.yml new file mode 100644 index 0000000000..30074d7648 --- /dev/null +++ b/spec/build/bsps/aarch64/xen/optramori.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- assert-uint64: null +- env-assign: null +- format-and-define: null +build-type: option +copyrights: +- Copyright (C) 2025 On-Line Applications Research (OAR) +default: +- enabled-by: true + value: 0x40000000 +description: | + This option defines the base address of the DDR memory area which is + statically available to the application. +enabled-by: true +format: '{:#010x}' +links: [] +name: BSP_XEN_RAM_BASE +type: build