blob: 00aa91b0a20c60bf3c334d4ea940413558787d6b [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
York Sun56cc3db2014-09-08 12:20:00 -07002/*
Mingkai Hu0e58b512015-10-26 19:47:50 +08003 * Copyright 2014-2015, Freescale Semiconductor
York Sun56cc3db2014-09-08 12:20:00 -07004 */
5
Mingkai Hu0e58b512015-10-26 19:47:50 +08006#ifndef _FSL_LAYERSCAPE_MP_H
7#define _FSL_LAYERSCAPE_MP_H
York Sun56cc3db2014-09-08 12:20:00 -07008
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 Wanga6231fe2017-06-08 16:15:14 +080015* uint64_t arch_comp;
York Sun56cc3db2014-09-08 12:20:00 -070016* };
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 Wanga6231fe2017-06-08 16:15:14 +080023/* compare os arch and cpu arch */
24#define SPIN_TABLE_ELEM_ARCH_COMP_IDX 3
York Sun56cc3db2014-09-08 12:20:00 -070025#define WORDS_PER_SPIN_TABLE_ENTRY 8 /* pad to 64 bytes */
26#define SPIN_TABLE_ELEM_SIZE 64
27
Alison Wanga6231fe2017-06-08 16:15:14 +080028/* 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 Sun56cc3db2014-09-08 12:20:00 -070033#define id_to_core(x) ((x & 3) | (x >> 6))
34#ifndef __ASSEMBLY__
35extern u64 __spin_table[];
York Sun77a10972015-03-20 19:28:08 -070036extern u64 __real_cntfrq;
York Sun56cc3db2014-09-08 12:20:00 -070037extern u64 *secondary_boot_code;
38extern size_t __secondary_boot_code_size;
Yuantian Tangaec3b142017-04-19 13:27:39 +080039#ifdef CONFIG_MP
Mingkai Hu0e58b512015-10-26 19:47:50 +080040int fsl_layerscape_wake_seconday_cores(void);
Yuantian Tangaec3b142017-04-19 13:27:39 +080041#else
42static inline int fsl_layerscape_wake_seconday_cores(void) { return 0; }
43#endif
York Sun56cc3db2014-09-08 12:20:00 -070044void *get_spin_tbl_addr(void);
45phys_addr_t determine_mp_bootpg(void);
46void secondary_boot_func(void);
Arnab Basu0cb19422015-01-06 13:18:41 -080047int is_core_online(u64 cpu_id);
York Suned7fbe32016-09-13 12:40:30 -070048u32 cpu_pos_mask(void);
York Sun56cc3db2014-09-08 12:20:00 -070049#endif
Alison Wang73818d52016-11-10 10:49:03 +080050
Mingkai Hu0e58b512015-10-26 19:47:50 +080051#endif /* _FSL_LAYERSCAPE_MP_H */