summaryrefslogtreecommitdiffstats
path: root/src/include/kernel/cpumgr.H
blob: 47ec78c4dd195df766385721bc338166522da41c (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
#ifndef __KERNEL_CPUMGR_H
#define __KERNEL_CPUMGR_H

#include <kernel/types.h>

class CpuManager
{
    public:
	enum { MAXCPUS = 8 };
	
	/** @fn getCurrentCPU 
	 *  Returns a pointer to the current CPU structure by using the
	 *  task structure in SPRG3.
	 */
	static cpu_t* getCurrentCPU();
	static cpu_t* getCpu(size_t i) { return cv_cpus[i]; };

	static void init();
	static void init_slave_smp(cpu_t*);

    protected:
	CpuManager();
	~CpuManager() {};

	/** @fn startCPU
	 *  Starts the requested CPU. Default of -1 implies current CPU.
	 */
	void startCPU(ssize_t i = -1);
	void startSlaveCPU(cpu_t*);

    private:
	static cpu_t* cv_cpus[MAXCPUS]; // Need to be able to access this
					// from start.S to get initial stacks
					// of secondary cpus / threads.
};

#endif
OpenPOWER on IntegriCloud