aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/include
diff options
context:
space:
mode:
authorAttilio Rao <attilio@FreeBSD.org>2011-05-06 21:53:29 +0000
committerAttilio Rao <attilio@FreeBSD.org>2011-05-06 21:53:29 +0000
commit0d9fa7bd31504dfa7f68e7063784f04d5c13ecbf (patch)
treea245b94b00192e665e8b8f8c843e3316300cd6d3 /sys/sparc64/include
parent2953224e269071e67fec7c234a793eff81299904 (diff)
downloadsrc-0d9fa7bd31504dfa7f68e7063784f04d5c13ecbf.tar.gz
src-0d9fa7bd31504dfa7f68e7063784f04d5c13ecbf.zip
Add sparc64 support.
Compiled (and helped) by: pluknet
Notes
Notes: svn path=/projects/largeSMP/; revision=221554
Diffstat (limited to 'sys/sparc64/include')
-rw-r--r--sys/sparc64/include/_types.h1
-rw-r--r--sys/sparc64/include/pmap.h3
-rw-r--r--sys/sparc64/include/smp.h47
3 files changed, 31 insertions, 20 deletions
diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h
index f810c159a6ef..7e993c4c370a 100644
--- a/sys/sparc64/include/_types.h
+++ b/sys/sparc64/include/_types.h
@@ -55,7 +55,6 @@ typedef unsigned long __uint64_t;
* Standard type definitions.
*/
typedef __int32_t __clock_t; /* clock()... */
-typedef unsigned int __cpumask_t;
typedef __int64_t __critical_t;
typedef double __double_t;
typedef float __float_t;
diff --git a/sys/sparc64/include/pmap.h b/sys/sparc64/include/pmap.h
index e16ea9776029..adad2575598e 100644
--- a/sys/sparc64/include/pmap.h
+++ b/sys/sparc64/include/pmap.h
@@ -40,6 +40,7 @@
#define _MACHINE_PMAP_H_
#include <sys/queue.h>
+#include <sys/_cpuset.h>
#include <sys/_lock.h>
#include <sys/_mutex.h>
#include <machine/cache.h>
@@ -61,7 +62,7 @@ struct pmap {
struct mtx pm_mtx;
struct tte *pm_tsb;
vm_object_t pm_tsb_obj;
- cpumask_t pm_active;
+ cpuset_t pm_active;
u_int pm_context[MAXCPU];
struct pmap_statistics pm_stats;
};
diff --git a/sys/sparc64/include/smp.h b/sys/sparc64/include/smp.h
index 3ca8e0380444..f8f7d1c192b2 100644
--- a/sys/sparc64/include/smp.h
+++ b/sys/sparc64/include/smp.h
@@ -38,6 +38,7 @@
#ifndef LOCORE
+#include <sys/cpuset.h>
#include <sys/proc.h>
#include <sys/sched.h>
@@ -76,17 +77,17 @@ struct cpu_start_args {
};
struct ipi_cache_args {
- cpumask_t ica_mask;
+ cpuset_t ica_mask;
vm_paddr_t ica_pa;
};
struct ipi_rd_args {
- cpumask_t ira_mask;
+ cpuset_t ira_mask;
register_t *ira_val;
};
struct ipi_tlb_args {
- cpumask_t ita_mask;
+ cpuset_t ita_mask;
struct pmap *ita_pmap;
u_long ita_start;
u_long ita_end;
@@ -100,7 +101,7 @@ extern struct pcb stoppcbs[];
void cpu_mp_bootstrap(struct pcpu *pc);
void cpu_mp_shutdown(void);
-typedef void cpu_ipi_selected_t(u_int, u_long, u_long, u_long);
+typedef void cpu_ipi_selected_t(cpuset_t, u_long, u_long, u_long);
extern cpu_ipi_selected_t *cpu_ipi_selected;
typedef void cpu_ipi_single_t(u_int, u_long, u_long, u_long);
extern cpu_ipi_single_t *cpu_ipi_single;
@@ -140,7 +141,7 @@ ipi_all_but_self(u_int ipi)
}
static __inline void
-ipi_selected(u_int cpus, u_int ipi)
+ipi_selected(cpuset_t cpus, u_int ipi)
{
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_level, ipi);
@@ -197,7 +198,8 @@ ipi_rd(u_int cpu, void *func, u_long *val)
sched_pin();
ira = &ipi_rd_args;
mtx_lock_spin(&ipi_mtx);
- ira->ira_mask = 1 << cpu | PCPU_GET(cpumask);
+ ira->ira_mask = PCPU_GET(cpumask);
+ CPU_SET(cpu, &ira->ira_mask);
ira->ira_val = val;
cpu_ipi_single(cpu, 0, (u_long)func, (u_long)ira);
return (&ira->ira_mask);
@@ -207,18 +209,21 @@ static __inline void *
ipi_tlb_context_demap(struct pmap *pm)
{
struct ipi_tlb_args *ita;
- cpumask_t cpus;
+ cpuset_t cpus;
if (smp_cpus == 1)
return (NULL);
sched_pin();
- if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0) {
+ cpus = pm->pm_active;
+ CPU_AND(&cpus, PCPU_PTR(other_cpus));
+ if (CPU_EMPTY(&cpus)) {
sched_unpin();
return (NULL);
}
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
- ita->ita_mask = cpus | PCPU_GET(cpumask);
+ CPU_OR(&cpus, PCPU_PTR(cpumask));
+ ita->ita_mask = cpus;
ita->ita_pmap = pm;
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_context_demap,
(u_long)ita);
@@ -229,18 +234,21 @@ static __inline void *
ipi_tlb_page_demap(struct pmap *pm, vm_offset_t va)
{
struct ipi_tlb_args *ita;
- cpumask_t cpus;
+ cpuset_t cpus;
if (smp_cpus == 1)
return (NULL);
sched_pin();
- if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0) {
+ cpus = pm->pm_active;
+ CPU_AND(&cpus, PCPU_PTR(other_cpus));
+ if (CPU_EMPTY(&cpus)) {
sched_unpin();
return (NULL);
}
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
- ita->ita_mask = cpus | PCPU_GET(cpumask);
+ CPU_OR(&cpus, PCPU_PTR(cpumask));
+ ita->ita_mask = cpus;
ita->ita_pmap = pm;
ita->ita_va = va;
cpu_ipi_selected(cpus, 0, (u_long)tl_ipi_tlb_page_demap, (u_long)ita);
@@ -251,18 +259,21 @@ static __inline void *
ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end)
{
struct ipi_tlb_args *ita;
- cpumask_t cpus;
+ cpuset_t cpus;
if (smp_cpus == 1)
return (NULL);
sched_pin();
- if ((cpus = (pm->pm_active & PCPU_GET(other_cpus))) == 0) {
+ cpus = pm->pm_active;
+ CPU_AND(&cpus, PCPU_PTR(other_cpus));
+ if (CPU_EMPTY(&cpus)) {
sched_unpin();
return (NULL);
}
ita = &ipi_tlb_args;
mtx_lock_spin(&ipi_mtx);
- ita->ita_mask = cpus | PCPU_GET(cpumask);
+ CPU_OR(&cpus, PCPU_PTR(cpumask));
+ ita->ita_mask = cpus;
ita->ita_pmap = pm;
ita->ita_start = start;
ita->ita_end = end;
@@ -274,11 +285,11 @@ ipi_tlb_range_demap(struct pmap *pm, vm_offset_t start, vm_offset_t end)
static __inline void
ipi_wait(void *cookie)
{
- volatile cpumask_t *mask;
+ volatile cpuset_t *mask;
if ((mask = cookie) != NULL) {
- atomic_clear_int(mask, PCPU_GET(cpumask));
- while (*mask != 0)
+ CPU_NAND_ATOMIC(mask, PCPU_PTR(cpumask));
+ while (!CPU_EMPTY(mask))
;
mtx_unlock_spin(&ipi_mtx);
sched_unpin();