York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 1 | /* |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 2 | * Copyright 2014-2015, Freescale Semiconductor |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 7 | #ifndef _FSL_LAYERSCAPE_MP_H |
| 8 | #define _FSL_LAYERSCAPE_MP_H |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 9 | |
| 10 | /* |
| 11 | * Each spin table element is defined as |
| 12 | * struct { |
| 13 | * uint64_t entry_addr; |
| 14 | * uint64_t status; |
| 15 | * uint64_t lpid; |
Alison Wang | 876c7e1 | 2016-11-10 10:49:04 +0800 | [diff] [blame] | 16 | * uint64_t os_arch; |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 17 | * }; |
| 18 | * we pad this struct to 64 bytes so each entry is in its own cacheline |
| 19 | * the actual spin table is an array of these structures |
| 20 | */ |
| 21 | #define SPIN_TABLE_ELEM_ENTRY_ADDR_IDX 0 |
| 22 | #define SPIN_TABLE_ELEM_STATUS_IDX 1 |
| 23 | #define SPIN_TABLE_ELEM_LPID_IDX 2 |
Alison Wang | 876c7e1 | 2016-11-10 10:49:04 +0800 | [diff] [blame] | 24 | #define SPIN_TABLE_ELEM_OS_ARCH_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 | |
| 28 | #define id_to_core(x) ((x & 3) | (x >> 6)) |
| 29 | #ifndef __ASSEMBLY__ |
| 30 | extern u64 __spin_table[]; |
York Sun | 77a1097 | 2015-03-20 19:28:08 -0700 | [diff] [blame] | 31 | extern u64 __real_cntfrq; |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 32 | extern u64 *secondary_boot_code; |
| 33 | extern size_t __secondary_boot_code_size; |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 34 | int fsl_layerscape_wake_seconday_cores(void); |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 35 | void *get_spin_tbl_addr(void); |
| 36 | phys_addr_t determine_mp_bootpg(void); |
| 37 | void secondary_boot_func(void); |
Arnab Basu | 0cb1942 | 2015-01-06 13:18:41 -0800 | [diff] [blame] | 38 | int is_core_online(u64 cpu_id); |
York Sun | ed7fbe3 | 2016-09-13 12:40:30 -0700 | [diff] [blame] | 39 | u32 cpu_pos_mask(void); |
York Sun | 56cc3db | 2014-09-08 12:20:00 -0700 | [diff] [blame] | 40 | #endif |
Alison Wang | 73818d5 | 2016-11-10 10:49:03 +0800 | [diff] [blame] | 41 | |
| 42 | #define IH_ARCH_ARM 2 /* ARM */ |
| 43 | #define IH_ARCH_ARM64 22 /* ARM64 */ |
| 44 | |
Mingkai Hu | 0e58b51 | 2015-10-26 19:47:50 +0800 | [diff] [blame] | 45 | #endif /* _FSL_LAYERSCAPE_MP_H */ |