OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [include/] [l4/] [generic/] [smp.h] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
/*
2
 * Copyright 2010 B Labs Ltd.
3
 *
4
 * Author: Prem Mallappa <prem.mallappa@b-labs.co.uk>
5
 */
6
 
7
#ifndef __GENERIC_SMP_H__
8
#define __GENERIC_SMP_H__
9
 
10
#include INC_SUBARCH(cpu.h)
11
 
12
/* IPIs, we define more as we go */
13
/* we have limited IPI's on ARM, exactly 15 */
14
#define IPI_TLB_FLUSH   0x00000001
15
#define IPI_SCHEDULE    0x00000002
16
#define IPI_CACH_FLUSH  0x00000003
17
 
18
#if !defined (CONFIG_NCPU)
19
#define CONFIG_NCPU     1
20
#define smp_get_cpuid()         0
21
#endif
22
 
23
/* All cpus in the SMP system */
24
static inline unsigned int cpu_mask_all(void)
25
{
26
        unsigned int mask = 0;
27
 
28
        for (int i = 0; i < CONFIG_NCPU; i++)
29
                mask |= (1 << i);
30
        return mask;
31
}
32
 
33
/* All but not self */
34
static inline unsigned int cpu_mask_others(void)
35
{
36
        unsigned int mask = 0;
37
 
38
        for (int i = 0; i < CONFIG_NCPU; i++)
39
                if (i != smp_get_cpuid())
40
                        mask |= (1 << i);
41
        return mask;
42
}
43
 
44
/* Only self */
45
static inline unsigned int cpu_mask_self(void)
46
{
47
        return 1 << smp_get_cpuid();
48
}
49
 
50
#endif  /* __GENERIC_SMP_H__ */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.