forked from Imagelibrary/rtems
bsps/aarch64: Add Xen BSP
This commit is contained in:
committed by
Kinsey Moore
parent
dc0d3149e5
commit
ec6566dee9
72
bsps/aarch64/xen/console/console.c
Normal file
72
bsps/aarch64/xen/console/console.c
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <rtems/bspIo.h>
|
||||
|
||||
#include <bsp.h>
|
||||
#include <dev/serial/arm-pl011.h>
|
||||
#include <bsp/console-termios.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
|
||||
#include <bspopts.h>
|
||||
|
||||
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;
|
||||
82
bsps/aarch64/xen/include/bsp.h
Normal file
82
bsps/aarch64/xen/include/bsp.h
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <bspopts.h>
|
||||
|
||||
#define BSP_FEATURE_IRQ_EXTENSION
|
||||
|
||||
#define BSP_START_IMAGE_HEADER_LOAD_OFFSET BSP_XEN_LOAD_OFFSET
|
||||
|
||||
#ifndef ASM
|
||||
|
||||
#include <bsp/default-initial-extension.h>
|
||||
#include <bsp/start.h>
|
||||
|
||||
#include <rtems.h>
|
||||
|
||||
#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 */
|
||||
67
bsps/aarch64/xen/include/bsp/irq.h
Normal file
67
bsps/aarch64/xen/include/bsp/irq.h
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <rtems/irq.h>
|
||||
#include <rtems/irq-extension.h>
|
||||
|
||||
#include <dev/irq/arm-gic-irq.h>
|
||||
|
||||
#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 */
|
||||
46
bsps/aarch64/xen/include/tm27.h
Normal file
46
bsps/aarch64/xen/include/tm27.h
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <dev/irq/arm-gic-tm27.h>
|
||||
|
||||
#endif /* __tm27_h */
|
||||
52
bsps/aarch64/xen/start/bspstart.c
Normal file
52
bsps/aarch64/xen/start/bspstart.c
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <bsp.h>
|
||||
#include <bsp/bootcard.h>
|
||||
#include <bsp/irq-generic.h>
|
||||
#include <bsp/linker-symbols.h>
|
||||
#include <dev/clock/arm-generic-timer.h>
|
||||
|
||||
#include <rtems/score/aarch64-system-registers.h>
|
||||
|
||||
void bsp_start( void )
|
||||
{
|
||||
bsp_interrupt_initialize();
|
||||
rtems_cache_coherent_add_area(
|
||||
bsp_section_nocacheheap_begin,
|
||||
(uintptr_t) bsp_section_nocacheheap_size
|
||||
);
|
||||
}
|
||||
45
bsps/aarch64/xen/start/bspstarthooks.c
Normal file
45
bsps/aarch64/xen/start/bspstarthooks.c
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <bsp.h>
|
||||
#include <bsp/start.h>
|
||||
|
||||
BSP_START_TEXT_SECTION void bsp_start_hook_1( void )
|
||||
{
|
||||
AArch64_start_set_vector_base();
|
||||
xen_setup_mmu_and_cache();
|
||||
bsp_start_clear_bss();
|
||||
}
|
||||
58
bsps/aarch64/xen/start/bspstartmmu.c
Normal file
58
bsps/aarch64/xen/start/bspstartmmu.c
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <bsp.h>
|
||||
#include <bsp/aarch64-mmu.h>
|
||||
#include <libcpu/mmu-vmsav8-64.h>
|
||||
|
||||
#include <rtems/malloc.h>
|
||||
#include <rtems/sysinit.h>
|
||||
|
||||
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 );
|
||||
}
|
||||
70
bsps/aarch64/xen/start/mmu-config.c
Normal file
70
bsps/aarch64/xen/start/mmu-config.c
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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 <bsp.h>
|
||||
#include <bsp/aarch64-mmu.h>
|
||||
#include <bsp/start.h>
|
||||
#include <libcpu/mmu-vmsav8-64.h>
|
||||
|
||||
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);
|
||||
@@ -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
|
||||
|
||||
21
spec/build/bsps/aarch64/xen/abi.yml
Normal file
21
spec/build/bsps/aarch64/xen/abi.yml
Normal file
@@ -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
|
||||
19
spec/build/bsps/aarch64/xen/bspxen.yml
Normal file
19
spec/build/bsps/aarch64/xen/bspxen.yml
Normal file
@@ -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
|
||||
61
spec/build/bsps/aarch64/xen/grp.yml
Normal file
61
spec/build/bsps/aarch64/xen/grp.yml
Normal file
@@ -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: []
|
||||
94
spec/build/bsps/aarch64/xen/linkcmds.yml
Normal file
94
spec/build/bsps/aarch64/xen/linkcmds.yml
Normal file
@@ -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 <kinsey.moore@oarcorp.com>
|
||||
*
|
||||
* 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
|
||||
38
spec/build/bsps/aarch64/xen/obj.yml
Normal file
38
spec/build/bsps/aarch64/xen/obj.yml
Normal file
@@ -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
|
||||
19
spec/build/bsps/aarch64/xen/optloadoff.yml
Normal file
19
spec/build/bsps/aarch64/xen/optloadoff.yml
Normal file
@@ -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
|
||||
19
spec/build/bsps/aarch64/xen/optnocachelen.yml
Normal file
19
spec/build/bsps/aarch64/xen/optnocachelen.yml
Normal file
@@ -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
|
||||
20
spec/build/bsps/aarch64/xen/optramlen.yml
Normal file
20
spec/build/bsps/aarch64/xen/optramlen.yml
Normal file
@@ -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
|
||||
20
spec/build/bsps/aarch64/xen/optramori.yml
Normal file
20
spec/build/bsps/aarch64/xen/optramori.yml
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user