1 1.8 martin /* $NetBSD: cpuset.h,v 1.8 2008/04/28 20:23:37 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 * 16 1.1 chs * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 17 1.1 chs * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 18 1.1 chs * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 19 1.1 chs * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 20 1.1 chs * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 1.1 chs * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 1.1 chs * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 1.1 chs * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 1.1 chs * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 1.1 chs * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 1.1 chs * POSSIBILITY OF SUCH DAMAGE. 27 1.1 chs */ 28 1.1 chs 29 1.1 chs #ifndef _SPARC64_CPUSET_H_ 30 1.2 simonb #define _SPARC64_CPUSET_H_ 31 1.1 chs 32 1.7 martin #define CPUSET_MAXNUMCPU 64 33 1.6 martin typedef uint64_t sparc64_cpuset_t; 34 1.6 martin extern volatile sparc64_cpuset_t cpus_active; 35 1.1 chs 36 1.6 martin #define CPUSET_SINGLE(cpu) ((sparc64_cpuset_t)1 << (cpu)) 37 1.1 chs 38 1.2 simonb #define CPUSET_ADD(set, cpu) ((set) |= CPUSET_SINGLE(cpu)) 39 1.1 chs #define CPUSET_DEL(set, cpu) ((set) &= ~CPUSET_SINGLE(cpu)) 40 1.1 chs #define CPUSET_SUB(set1, set2) ((set1) &= ~(set2)) 41 1.1 chs 42 1.5 mrg #define CPUSET_EXCEPT(set, cpu) ((set) & ~CPUSET_SINGLE(cpu)) 43 1.1 chs 44 1.1 chs #define CPUSET_HAS(set, cpu) ((set) & CPUSET_SINGLE(cpu)) 45 1.2 simonb #define CPUSET_NEXT(set) (ffs(set) - 1) 46 1.1 chs 47 1.6 martin #define CPUSET_EMPTY(set) ((set) == (sparc64_cpuset_t)0) 48 1.1 chs #define CPUSET_EQUAL(set1, set2) ((set1) == (set2)) 49 1.6 martin #define CPUSET_CLEAR(set) ((set) = (sparc64_cpuset_t)0) 50 1.1 chs #define CPUSET_ASSIGN(set1, set2) ((set1) = (set2)) 51 1.1 chs 52 1.1 chs #endif /* _SPARC64_CPUSET_H_ */ 53