1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @ingroup QorIQ |
---|
5 | * |
---|
6 | * @brief BSP API. |
---|
7 | */ |
---|
8 | |
---|
9 | /* |
---|
10 | * Copyright (c) 2010, 2017 embedded brains GmbH. All rights reserved. |
---|
11 | * |
---|
12 | * embedded brains GmbH |
---|
13 | * Dornierstr. 4 |
---|
14 | * 82178 Puchheim |
---|
15 | * Germany |
---|
16 | * <rtems@embedded-brains.de> |
---|
17 | * |
---|
18 | * The license and distribution terms for this file may be |
---|
19 | * found in the file LICENSE in this distribution or at |
---|
20 | * http://www.rtems.org/license/LICENSE. |
---|
21 | */ |
---|
22 | |
---|
23 | #ifndef LIBBSP_POWERPC_QORIQ_BSP_H |
---|
24 | #define LIBBSP_POWERPC_QORIQ_BSP_H |
---|
25 | |
---|
26 | #include <bspopts.h> |
---|
27 | |
---|
28 | #ifdef QORIQ_IS_HYPERVISOR_GUEST |
---|
29 | #define QORIQ_THREAD_COUNT 1 |
---|
30 | #else |
---|
31 | #define QORIQ_THREAD_COUNT QORIQ_PHYSICAL_THREAD_COUNT |
---|
32 | #endif |
---|
33 | |
---|
34 | #ifndef ASM |
---|
35 | |
---|
36 | #include <rtems.h> |
---|
37 | |
---|
38 | #include <bsp/default-initial-extension.h> |
---|
39 | |
---|
40 | #ifdef __cplusplus |
---|
41 | extern "C" { |
---|
42 | #endif /* __cplusplus */ |
---|
43 | |
---|
44 | #define BSP_FEATURE_IRQ_EXTENSION |
---|
45 | |
---|
46 | #define BSP_FDT_IS_SUPPORTED |
---|
47 | |
---|
48 | #define QORIQ_CHIP(alpha, num) ((alpha) * 10000 + (num)) |
---|
49 | |
---|
50 | #define QORIQ_CHIP_P1020 QORIQ_CHIP('P', 1020) |
---|
51 | |
---|
52 | #define QORIQ_CHIP_T2080 QORIQ_CHIP('T', 2080) |
---|
53 | |
---|
54 | #define QORIQ_CHIP_T4240 QORIQ_CHIP('T', 4240) |
---|
55 | |
---|
56 | #define QORIQ_CHIP_VARIANT QORIQ_CHIP(QORIQ_CHIP_SERIES, QORIQ_CHIP_NUMBER) |
---|
57 | |
---|
58 | #define QORIQ_CHIP_IS_T_VARIANT(variant) ((variant) / 10000 == 'T') |
---|
59 | |
---|
60 | extern unsigned BSP_bus_frequency; |
---|
61 | |
---|
62 | struct rtems_bsdnet_ifconfig; |
---|
63 | |
---|
64 | int BSP_tsec_attach( |
---|
65 | struct rtems_bsdnet_ifconfig *config, |
---|
66 | int attaching |
---|
67 | ); |
---|
68 | |
---|
69 | int qoriq_if_intercom_attach_detach( |
---|
70 | struct rtems_bsdnet_ifconfig *config, |
---|
71 | int attaching |
---|
72 | ); |
---|
73 | |
---|
74 | #if defined(HAS_UBOOT) |
---|
75 | /* Routine to obtain U-Boot environment variables */ |
---|
76 | const char *bsp_uboot_getenv( |
---|
77 | const char *name |
---|
78 | ); |
---|
79 | #endif |
---|
80 | |
---|
81 | void bsp_restart(void *addr) RTEMS_NO_RETURN; |
---|
82 | |
---|
83 | void *bsp_idle_thread( uintptr_t ignored ); |
---|
84 | #define BSP_IDLE_TASK_BODY bsp_idle_thread |
---|
85 | |
---|
86 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH BSP_tsec_attach |
---|
87 | #define RTEMS_BSP_NETWORK_DRIVER_ATTACH4 qoriq_if_intercom_attach_detach |
---|
88 | |
---|
89 | #define RTEMS_BSP_NETWORK_DRIVER_NAME "tsec1" |
---|
90 | #define RTEMS_BSP_NETWORK_DRIVER_NAME2 "tsec2" |
---|
91 | #define RTEMS_BSP_NETWORK_DRIVER_NAME3 "tsec3" |
---|
92 | #define RTEMS_BSP_NETWORK_DRIVER_NAME4 "intercom1" |
---|
93 | |
---|
94 | /* Internal data and functions */ |
---|
95 | |
---|
96 | typedef struct { |
---|
97 | uint64_t addr; |
---|
98 | uint64_t r3; |
---|
99 | uint32_t reserved_0; |
---|
100 | uint32_t pir; |
---|
101 | uint64_t r6; |
---|
102 | uint32_t reserved_1[8]; |
---|
103 | } qoriq_start_spin_table; |
---|
104 | |
---|
105 | extern qoriq_start_spin_table * |
---|
106 | qoriq_start_spin_table_addr[QORIQ_CPU_COUNT / QORIQ_THREAD_COUNT]; |
---|
107 | |
---|
108 | void qoriq_start_thread(void); |
---|
109 | |
---|
110 | void qoriq_restart_secondary_processor( |
---|
111 | const qoriq_start_spin_table *spin_table |
---|
112 | ) RTEMS_NO_RETURN; |
---|
113 | |
---|
114 | void qoriq_initialize_exceptions(void *interrupt_stack_begin); |
---|
115 | |
---|
116 | void qoriq_decrementer_dispatch(void); |
---|
117 | |
---|
118 | extern uint32_t bsp_time_base_frequency; |
---|
119 | |
---|
120 | extern uint32_t qoriq_clock_frequency; |
---|
121 | |
---|
122 | #ifdef __cplusplus |
---|
123 | } |
---|
124 | #endif /* __cplusplus */ |
---|
125 | |
---|
126 | #endif /* ASM */ |
---|
127 | |
---|
128 | #endif /* LIBBSP_POWERPC_QORIQ_BSP_H */ |
---|