summaryrefslogtreecommitdiff
path: root/src/soc/cavium/cn81xx/include/soc/cpu.h
blob: 1c6a30dda9f0d9fe480f692b5046feb61c485b4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/*
 * This file is part of the coreboot project.
 *
 * Copyright 2017-present Facebook, Inc.
 * Copyright 2003-2017    Cavium Inc.  <support@cavium.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __SOC_CAVIUM_CN81XX_CPU_H__
#define __SOC_CAVIUM_CN81XX_CPU_H__

#include <stdint.h>

/**
 * Number of the Core on which the program is currently running.
 *
 * @return Number of cores
 */
size_t cpu_self_get_core_id(void);

/**
 * Return a mask representing this core in a 64bit bitmask
 *
 * @return The mask of active core.
 */
uint64_t cpu_self_get_core_mask(void);

/**
 * Return the mask of available cores.
 *
 * @return Mask of available cores
 */
uint64_t cpu_get_available_core_mask(void);

/**
 * Return the number of cores available in the chip.
 *
 * @return The number of available cores.
 */
size_t cpu_get_num_available_cores(void);

/**
 * Init secondary core and call the provided entry for given core.
 * A stack of size CONFIG_STACK_SIZE is set up for each core in REGION
 * stack_sec. The unique core id is passed to the entry point functions.
 *
 * @return zero on success
 */
size_t start_cpu(size_t cpu, void (*entry_64)(size_t core_id));

/**
 * Secondary ASM CPU entry point.
 * For internal use only.
 */
void secondary_init(void);

/**
 * Secondary CPU C entry point.
 * For internal use only.
 */
void secondary_cpu_init(size_t core_id);

/* Symbols in memlayout.ld */

extern u8 _stack_sec[];
extern u8 _estack_sec[];
#define _stack_sec_size (_estack_sec - _stack_sec)

#endif	/* __SOC_CAVIUM_CN81XX_CPU_H__ */