blob: 88f40c08978f5ebbccec57fa415a566e60f4f966 [file] [log] [blame]
York Sun56cc3db2014-09-08 12:20:00 -07001/*
Mingkai Hu0e58b512015-10-26 19:47:50 +08002 * Copyright 2014-2015, Freescale Semiconductor
York Sun56cc3db2014-09-08 12:20:00 -07003 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
Mingkai Hu0e58b512015-10-26 19:47:50 +08007#ifndef _FSL_LAYERSCAPE_MP_H
8#define _FSL_LAYERSCAPE_MP_H
York Sun56cc3db2014-09-08 12:20:00 -07009
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 Wanga6231fe2017-06-08 16:15:14 +080016* uint64_t arch_comp;
York Sun56cc3db2014-09-08 12:20:00 -070017* };
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 Wanga6231fe2017-06-08 16:15:14 +080024/* compare os arch and cpu arch */
25#define SPIN_TABLE_ELEM_ARCH_COMP_IDX 3
York Sun56cc3db2014-09-08 12:20:00 -070026#define WORDS_PER_SPIN_TABLE_ENTRY 8 /* pad to 64 bytes */
27#define SPIN_TABLE_ELEM_SIZE 64
28
Alison Wanga6231fe2017-06-08 16:15:14 +080029/* os arch is same as cpu arch */
30#define OS_ARCH_SAME 0
31/* os arch is different from cpu arch */
32#define OS_ARCH_DIFF 1
33
York Sun56cc3db2014-09-08 12:20:00 -070034#define id_to_core(x) ((x & 3) | (x >> 6))
35#ifndef __ASSEMBLY__
36extern u64 __spin_table[];
York Sun77a10972015-03-20 19:28:08 -070037extern u64 __real_cntfrq;
York Sun56cc3db2014-09-08 12:20:00 -070038extern u64 *secondary_boot_code;
39extern size_t __secondary_boot_code_size;
Yuantian Tangaec3b142017-04-19 13:27:39 +080040#ifdef CONFIG_MP
Mingkai Hu0e58b512015-10-26 19:47:50 +080041int fsl_layerscape_wake_seconday_cores(void);
Yuantian Tangaec3b142017-04-19 13:27:39 +080042#else
43static inline int fsl_layerscape_wake_seconday_cores(void) { return 0; }
44#endif
York Sun56cc3db2014-09-08 12:20:00 -070045void *get_spin_tbl_addr(void);
46phys_addr_t determine_mp_bootpg(void);
47void secondary_boot_func(void);
Arnab Basu0cb19422015-01-06 13:18:41 -080048int is_core_online(u64 cpu_id);
York Suned7fbe32016-09-13 12:40:30 -070049u32 cpu_pos_mask(void);
York Sun56cc3db2014-09-08 12:20:00 -070050#endif
Alison Wang73818d52016-11-10 10:49:03 +080051
Mingkai Hu0e58b512015-10-26 19:47:50 +080052#endif /* _FSL_LAYERSCAPE_MP_H */