diff options
author | Chris Metcalf <cmetcalf@tilera.com> | 2010-05-28 23:09:12 -0400 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2010-06-04 17:11:18 -0400 |
commit | 867e359b97c970a60626d5d76bbe2a8fadbf38fb (patch) | |
tree | c5ccbb7f5172e8555977119608ecb1eee3cc37e3 /arch/tile/lib/cpumask.c | |
parent | 5360bd776f73d0a7da571d72a09a03f237e99900 (diff) |
arch/tile: core support for Tilera 32-bit chips.
This change is the core kernel support for TILEPro and TILE64 chips.
No driver support (except the console driver) is included yet.
This includes the relevant Linux headers in asm/; the low-level
low-level "Tile architecture" headers in arch/, which are
shared with the hypervisor, etc., and are build-system agnostic;
and the relevant hypervisor headers in hv/.
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Reviewed-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'arch/tile/lib/cpumask.c')
-rw-r--r-- | arch/tile/lib/cpumask.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/arch/tile/lib/cpumask.c b/arch/tile/lib/cpumask.c new file mode 100644 index 000000000000..af745b3b2559 --- /dev/null +++ b/arch/tile/lib/cpumask.c | |||
@@ -0,0 +1,51 @@ | |||
1 | /* | ||
2 | * Copyright 2010 Tilera Corporation. All Rights Reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation, version 2. | ||
7 | * | ||
8 | * This program is distributed in the hope that it will be useful, but | ||
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | ||
10 | * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or | ||
11 | * NON INFRINGEMENT. See the GNU General Public License for | ||
12 | * more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/cpumask.h> | ||
16 | #include <linux/ctype.h> | ||
17 | #include <linux/errno.h> | ||
18 | |||
19 | /* | ||
20 | * Allow cropping out bits beyond the end of the array. | ||
21 | * Move to "lib" directory if more clients want to use this routine. | ||
22 | */ | ||
23 | int bitmap_parselist_crop(const char *bp, unsigned long *maskp, int nmaskbits) | ||
24 | { | ||
25 | unsigned a, b; | ||
26 | |||
27 | bitmap_zero(maskp, nmaskbits); | ||
28 | do { | ||
29 | if (!isdigit(*bp)) | ||
30 | return -EINVAL; | ||
31 | a = simple_strtoul(bp, (char **)&bp, 10); | ||
32 | b = a; | ||
33 | if (*bp == '-') { | ||
34 | bp++; | ||
35 | if (!isdigit(*bp)) | ||
36 | return -EINVAL; | ||
37 | b = simple_strtoul(bp, (char **)&bp, 10); | ||
38 | } | ||
39 | if (!(a <= b)) | ||
40 | return -EINVAL; | ||
41 | if (b >= nmaskbits) | ||
42 | b = nmaskbits-1; | ||
43 | while (a <= b) { | ||
44 | set_bit(a, maskp); | ||
45 | a++; | ||
46 | } | ||
47 | if (*bp == ',') | ||
48 | bp++; | ||
49 | } while (*bp != '\0' && *bp != '\n'); | ||
50 | return 0; | ||
51 | } | ||