cpuset.h revision 1.7 1 1.7 martin /* $NetBSD: cpuset.h,v 1.7 2008/02/28 11:50:40 martin Exp $ */
2 1.1 chs
3 1.1 chs /*-
4 1.1 chs * Copyright (c) 2004 The NetBSD Foundation, Inc.
5 1.1 chs * All rights reserved.
6 1.1 chs *
7 1.1 chs * Redistribution and use in source and binary forms, with or without
8 1.1 chs * modification, are permitted provided that the following conditions
9 1.1 chs * are met:
10 1.1 chs * 1. Redistributions of source code must retain the above copyright
11 1.1 chs * notice, this list of conditions and the following disclaimer.
12 1.1 chs * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 chs * notice, this list of conditions and the following disclaimer in the
14 1.1 chs * documentation and/or other materials provided with the distribution.
15 1.1 chs * 3. All advertising materials mentioning features or use of this software
16 1.1 chs * must display the following acknowledgement:
17 1.1 chs * This product includes software developed by the NetBSD
18 1.1 chs * Foundation, Inc. and its contributors.
19 1.1 chs * 4. Neither the name of The NetBSD Foundation nor the names of its
20 1.1 chs * contributors may be used to endorse or promote products derived
21 1.1 chs * from this software without specific prior written permission.
22 1.1 chs *
23 1.1 chs * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
24 1.1 chs * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
25 1.1 chs * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
26 1.1 chs * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
27 1.1 chs * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 1.1 chs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 1.1 chs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 1.1 chs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 1.1 chs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 1.1 chs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 1.1 chs * POSSIBILITY OF SUCH DAMAGE.
34 1.1 chs */
35 1.1 chs
36 1.1 chs #ifndef _SPARC64_CPUSET_H_
37 1.2 simonb #define _SPARC64_CPUSET_H_
38 1.1 chs
39 1.7 martin #define CPUSET_MAXNUMCPU 64
40 1.6 martin typedef uint64_t sparc64_cpuset_t;
41 1.6 martin extern volatile sparc64_cpuset_t cpus_active;
42 1.1 chs
43 1.6 martin #define CPUSET_SINGLE(cpu) ((sparc64_cpuset_t)1 << (cpu))
44 1.1 chs
45 1.2 simonb #define CPUSET_ADD(set, cpu) ((set) |= CPUSET_SINGLE(cpu))
46 1.1 chs #define CPUSET_DEL(set, cpu) ((set) &= ~CPUSET_SINGLE(cpu))
47 1.1 chs #define CPUSET_SUB(set1, set2) ((set1) &= ~(set2))
48 1.1 chs
49 1.5 mrg #define CPUSET_EXCEPT(set, cpu) ((set) & ~CPUSET_SINGLE(cpu))
50 1.1 chs
51 1.1 chs #define CPUSET_HAS(set, cpu) ((set) & CPUSET_SINGLE(cpu))
52 1.2 simonb #define CPUSET_NEXT(set) (ffs(set) - 1)
53 1.1 chs
54 1.6 martin #define CPUSET_EMPTY(set) ((set) == (sparc64_cpuset_t)0)
55 1.1 chs #define CPUSET_EQUAL(set1, set2) ((set1) == (set2))
56 1.6 martin #define CPUSET_CLEAR(set) ((set) = (sparc64_cpuset_t)0)
57 1.1 chs #define CPUSET_ASSIGN(set1, set2) ((set1) = (set2))
58 1.1 chs
59 1.1 chs #endif /* _SPARC64_CPUSET_H_ */
60