diff options
author | Richard Braun <rbraun@sceen.net> | 2014-05-05 21:51:31 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2014-05-05 21:51:31 +0200 |
commit | 6ef4f1e3a6c626e5bc2a49efb65e60d170445fd2 (patch) | |
tree | 93a7d68d679631e9bbba16bff71235f73fc4bb28 /kern/cpumap.c | |
parent | dfa3674f5d71f995ce464570dce75ad1dba0c92a (diff) |
kern/cpumap: add cpumap_all function
Diffstat (limited to 'kern/cpumap.c')
-rw-r--r-- | kern/cpumap.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/kern/cpumap.c b/kern/cpumap.c index a76450b..68a84ab 100644 --- a/kern/cpumap.c +++ b/kern/cpumap.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Richard Braun. + * Copyright (c) 2013-2014 Richard Braun. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -19,15 +19,33 @@ #include <kern/cpumap.h> #include <kern/error.h> #include <kern/kmem.h> +#include <kern/param.h> #include <kern/stddef.h> +#include <machine/cpu.h> + +static struct cpumap cpumap_active_cpus __read_mostly; static struct kmem_cache cpumap_cache; void cpumap_setup(void) { + unsigned int i, nr_cpus; + kmem_cache_init(&cpumap_cache, "cpumap", sizeof(struct cpumap), 0, NULL, NULL, NULL, 0); + + cpumap_zero(&cpumap_active_cpus); + nr_cpus = cpu_count(); + + for (i = 0; i < nr_cpus; i++) + cpumap_set(&cpumap_active_cpus, i); +} + +const struct cpumap * +cpumap_all(void) +{ + return &cpumap_active_cpus; } int |