Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 2 | /* |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 3 | * Copyright 2014-2015, Freescale Semiconductor |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 4 | */ |
| 5 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 6 | #ifndef _FSL_LAYERSCAPE_MP_H |
| 7 | #define _FSL_LAYERSCAPE_MP_H |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 8 | |
| 9 | /* |
| 10 | * Each spin table element is defined as |
| 11 | * struct { |
| 12 | * uint64_t entry_addr; |
| 13 | * uint64_t status; |
| 14 | * uint64_t lpid; |
Alison Wang | a6231fe | 2017-06-08 16:15:14 +0800 | [diff] [blame] | 15 | * uint64_t arch_comp; |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 16 | * }; |
| 17 | * we pad this struct to 64 bytes so each entry is in its own cacheline |
| 18 | * the actual spin table is an array of these structures |
| 19 | */ |
| 20 | #define SPIN_TABLE_ELEM_ENTRY_ADDR_IDX 0 |
| 21 | #define SPIN_TABLE_ELEM_STATUS_IDX 1 |
| 22 | #define SPIN_TABLE_ELEM_LPID_IDX 2 |
Alison Wang | a6231fe | 2017-06-08 16:15:14 +0800 | [diff] [blame] | 23 | /* compare os arch and cpu arch */ |
| 24 | #define SPIN_TABLE_ELEM_ARCH_COMP_IDX 3 |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 25 | #define WORDS_PER_SPIN_TABLE_ENTRY 8 /* pad to 64 bytes */ |
| 26 | #define SPIN_TABLE_ELEM_SIZE 64 |
| 27 | |
Alison Wang | a6231fe | 2017-06-08 16:15:14 +0800 | [diff] [blame] | 28 | /* os arch is same as cpu arch */ |
| 29 | #define OS_ARCH_SAME 0 |
| 30 | /* os arch is different from cpu arch */ |
| 31 | #define OS_ARCH_DIFF 1 |
| 32 | |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 33 | #define id_to_core(x) ((x & 3) | (x >> 6)) |
| 34 | #ifndef __ASSEMBLY__ |
York Sun | 77a1097 | 2015-03-20 19:28:08 -0700 | [diff] [blame] | 35 | extern u64 __real_cntfrq; |
Michael Walle | c251f5b | 2020-06-01 21:53:34 +0200 | [diff] [blame] | 36 | extern void *secondary_boot_addr; |
| 37 | extern void *secondary_boot_code_start; |
| 38 | extern size_t secondary_boot_code_size; |
Yuantian Tang | aec3b14 | 2017-04-19 13:27:39 +0800 | [diff] [blame] | 39 | #ifdef CONFIG_MP |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 40 | int fsl_layerscape_wake_seconday_cores(void); |
Yuantian Tang | aec3b14 | 2017-04-19 13:27:39 +0800 | [diff] [blame] | 41 | #else |
| 42 | static inline int fsl_layerscape_wake_seconday_cores(void) { return 0; } |
| 43 | #endif |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 44 | void *get_spin_tbl_addr(void); |
Arnab Basu | 0cb1942 | 2015-01-06 13:18:41 -0800 | [diff] [blame] | 45 | int is_core_online(u64 cpu_id); |
York Sun | ed7fbe3 | 2016-09-13 12:40:30 -0700 | [diff] [blame] | 46 | u32 cpu_pos_mask(void); |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 47 | #endif |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 48 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 49 | #endif /* _FSL_LAYERSCAPE_MP_H */ |