Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:23:57

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @ingroup RTEMSBSPsPowerPCQorIQ
0007  *
0008  * @brief Global BSP definitions.
0009  */
0010 
0011 /*
0012  * Copyright (C) 2010, 2017 embedded brains GmbH & Co. KG
0013  *
0014  * Redistribution and use in source and binary forms, with or without
0015  * modification, are permitted provided that the following conditions
0016  * are met:
0017  * 1. Redistributions of source code must retain the above copyright
0018  *    notice, this list of conditions and the following disclaimer.
0019  * 2. Redistributions in binary form must reproduce the above copyright
0020  *    notice, this list of conditions and the following disclaimer in the
0021  *    documentation and/or other materials provided with the distribution.
0022  *
0023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0024  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0025  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0026  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0027  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0028  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0029  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0030  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0031  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0032  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0033  * POSSIBILITY OF SUCH DAMAGE.
0034  */
0035 
0036 #ifndef LIBBSP_POWERPC_QORIQ_BSP_H
0037 #define LIBBSP_POWERPC_QORIQ_BSP_H
0038 
0039 /**
0040  * @defgroup RTEMSBSPsPowerPCQorIQ NXP QorIQ
0041  *
0042  * @ingroup RTEMSBSPsPowerPC
0043  *
0044  * @brief NXP QorIQ Board Support Package.
0045  *
0046  * @{
0047  */
0048 
0049 #include <bspopts.h>
0050 
0051 #ifdef QORIQ_IS_HYPERVISOR_GUEST
0052 #define QORIQ_THREAD_COUNT 1
0053 #else
0054 #define QORIQ_THREAD_COUNT QORIQ_PHYSICAL_THREAD_COUNT
0055 #endif
0056 
0057 #ifndef ASM
0058 
0059 #include <rtems.h>
0060 
0061 #include <bsp/default-initial-extension.h>
0062 
0063 #ifdef __cplusplus
0064 extern "C" {
0065 #endif /* __cplusplus */
0066 
0067 #define BSP_FEATURE_IRQ_EXTENSION
0068 
0069 #define BSP_FDT_IS_SUPPORTED
0070 
0071 #define QORIQ_CHIP(alpha, num) ((alpha) * 10000 + (num))
0072 
0073 #define QORIQ_CHIP_P1020 QORIQ_CHIP('P', 1020)
0074 
0075 #define QORIQ_CHIP_T2080 QORIQ_CHIP('T', 2080)
0076 
0077 #define QORIQ_CHIP_T4240 QORIQ_CHIP('T', 4240)
0078 
0079 #define QORIQ_CHIP_VARIANT QORIQ_CHIP(QORIQ_CHIP_SERIES, QORIQ_CHIP_NUMBER)
0080 
0081 #define QORIQ_CHIP_IS_T_VARIANT(variant) ((variant) / 10000 == 'T')
0082 
0083 extern unsigned BSP_bus_frequency;
0084 
0085 struct rtems_bsdnet_ifconfig;
0086 
0087 int BSP_tsec_attach(
0088   struct rtems_bsdnet_ifconfig *config,
0089   int attaching
0090 );
0091 
0092 int qoriq_if_intercom_attach_detach(
0093   struct rtems_bsdnet_ifconfig *config,
0094   int attaching
0095 );
0096 
0097 #if defined(HAS_UBOOT)
0098   /* Routine to obtain U-Boot environment variables */
0099   const char *bsp_uboot_getenv(
0100     const char *name
0101   );
0102 #endif
0103 
0104 RTEMS_NO_RETURN void bsp_restart(void *addr);
0105 
0106 void *bsp_idle_thread( uintptr_t ignored );
0107 #define BSP_IDLE_TASK_BODY bsp_idle_thread
0108 
0109 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_tsec_attach
0110 #define RTEMS_BSP_NETWORK_DRIVER_ATTACH4 qoriq_if_intercom_attach_detach
0111 
0112 #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1"
0113 #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2"
0114 #define RTEMS_BSP_NETWORK_DRIVER_NAME3 "tsec3"
0115 #define RTEMS_BSP_NETWORK_DRIVER_NAME4 "intercom1"
0116 
0117 /* Internal data and functions */
0118 
0119 typedef struct {
0120   uint64_t addr;
0121   uint64_t r3;
0122   uint32_t reserved_0;
0123   uint32_t pir;
0124   uint64_t r6;
0125   uint32_t reserved_1[8];
0126 } qoriq_start_spin_table;
0127 
0128 extern qoriq_start_spin_table *
0129 qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT];
0130 
0131 struct Per_CPU_Control;
0132 
0133 void qoriq_start_thread(struct Per_CPU_Control *);
0134 
0135 RTEMS_NO_RETURN void qoriq_restart_secondary_processor(
0136   const qoriq_start_spin_table *spin_table
0137 );
0138 
0139 void qoriq_initialize_exceptions(void *interrupt_stack_begin);
0140 
0141 void qoriq_decrementer_dispatch(void);
0142 
0143 extern uint32_t bsp_time_base_frequency;
0144 
0145 extern uint32_t qoriq_clock_frequency;
0146 
0147 #ifdef __cplusplus
0148 }
0149 #endif /* __cplusplus */
0150 
0151 #endif /* ASM */
0152 
0153 /** @} */
0154 
0155 #endif /* LIBBSP_POWERPC_QORIQ_BSP_H */