From 0a78c9e13aa8e200c4fc27486208ec53b005f3f0 Mon Sep 17 00:00:00 2001 From: pk Date: Fri, 3 Jan 2003 15:44:55 +0000 Subject: [PATCH] Define a few XCALL? shorthand macros to avoid clutter. --- sys/arch/sparc/sparc/cache.c | 12 ++++++------ sys/arch/sparc/sparc/cpuvar.h | 23 +++++++++++++++++++---- sys/arch/sparc/sparc/machdep.c | 5 ++--- sys/arch/sparc/sparc/pmap.c | 12 ++++++------ sys/arch/sparc/sparc/trap.c | 7 +++---- sys/arch/sparc/sparc/vm_machdep.c | 8 +++----- 6 files changed, 39 insertions(+), 28 deletions(-) diff --git a/sys/arch/sparc/sparc/cache.c b/sys/arch/sparc/sparc/cache.c index d077ca96aa06..757583dc19b5 100644 --- a/sys/arch/sparc/sparc/cache.c +++ b/sys/arch/sparc/sparc/cache.c @@ -1,4 +1,4 @@ -/* $NetBSD: cache.c,v 1.69 2003/01/03 09:19:03 pk Exp $ */ +/* $NetBSD: cache.c,v 1.70 2003/01/03 15:44:55 pk Exp $ */ /* * Copyright (c) 1996 @@ -1008,7 +1008,7 @@ smp_vcache_flush_page(va, ctx) int va; int ctx; { - xcall((xcall_func_t)cpuinfo.sp_vcache_flush_page, va, ctx, 0, 0, 0); + XCALL2(cpuinfo.sp_vcache_flush_page, va, ctx, CPUSET_ALL); } void @@ -1016,7 +1016,7 @@ smp_vcache_flush_segment(vr, vs, ctx) int vr, vs; int ctx; { - xcall((xcall_func_t)cpuinfo.sp_vcache_flush_segment, vr, vs, ctx, 0, 0); + XCALL3(cpuinfo.sp_vcache_flush_segment, vr, vs, ctx, CPUSET_ALL); } void @@ -1024,14 +1024,14 @@ smp_vcache_flush_region(vr, ctx) int vr; int ctx; { - xcall((xcall_func_t)cpuinfo.sp_vcache_flush_region, vr, ctx, 0, 0, 0); + XCALL2(cpuinfo.sp_vcache_flush_region, vr, ctx, CPUSET_ALL); } void smp_vcache_flush_context(ctx) int ctx; { - xcall((xcall_func_t)cpuinfo.sp_vcache_flush_context, ctx, 0, 0, 0, 0); + XCALL1(cpuinfo.sp_vcache_flush_context, ctx, CPUSET_ALL); } void @@ -1040,6 +1040,6 @@ smp_cache_flush(va, size, ctx) u_int size; int ctx; { - xcall((xcall_func_t)cpuinfo.sp_cache_flush, (int)va, (int)size, ctx, 0, 0); + XCALL3(cpuinfo.sp_cache_flush, va, size, ctx, CPUSET_ALL); } #endif /* MULTIPROCESSOR */ diff --git a/sys/arch/sparc/sparc/cpuvar.h b/sys/arch/sparc/sparc/cpuvar.h index 5b2c43a776f5..30cb96c4afce 100644 --- a/sys/arch/sparc/sparc/cpuvar.h +++ b/sys/arch/sparc/sparc/cpuvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpuvar.h,v 1.46 2002/12/31 15:04:49 pk Exp $ */ +/* $NetBSD: cpuvar.h,v 1.47 2003/01/03 15:44:55 pk Exp $ */ /* * Copyright (c) 1996 The NetBSD Foundation, Inc. @@ -426,11 +426,26 @@ void getcpuinfo (struct cpu_info *sc, int node); void mmu_install_tables (struct cpu_info *); void pmap_alloc_cpu (struct cpu_info *); void pmap_globalize_boot_cpu (struct cpu_info *); + #if defined(MULTIPROCESSOR) -void raise_ipi_wait_and_unlock (struct cpu_info *); typedef int (*xcall_func_t)(int, int, int, int); -void xcall (xcall_func_t, int, int, int, int, int); -#endif +void xcall(xcall_func_t, int, int, int, int, u_int); +#define CPUSET_ALL 0xffffffffU /* xcall to all configured CPUs */ +/* Shorthand */ +#define XCALL0(f,cpuset) \ + xcall((xcall_func_t)f, 0, 0, 0, 0, cpuset) +#define XCALL1(f,a1,cpuset) \ + xcall((xcall_func_t)f, (int)a1, 0, 0, 0, cpuset) +#define XCALL2(f,a1,a2,cpuset) \ + xcall((xcall_func_t)f, (int)a1, (int)a2, 0, 0, cpuset) +#define XCALL3(f,a1,a2,a3,cpuset) \ + xcall((xcall_func_t)f, (int)a1, (int)a2, (int)a3, 0, cpuset) +#else +#define XCALL0(f,cpuset) /**/ +#define XCALL1(f,a1,cpuset) /**/ +#define XCALL2(f,a1,a2,cpuset) /**/ +#define XCALL3(f,a1,a2,a3,cpuset) /**/ +#endif /* MULTIPROCESSOR */ extern struct cpu_info **cpus; diff --git a/sys/arch/sparc/sparc/machdep.c b/sys/arch/sparc/sparc/machdep.c index eb028c8107f0..119731b410ea 100644 --- a/sys/arch/sparc/sparc/machdep.c +++ b/sys/arch/sparc/sparc/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.212 2003/01/03 15:12:02 pk Exp $ */ +/* $NetBSD: machdep.c,v 1.213 2003/01/03 15:44:56 pk Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -421,8 +421,7 @@ setregs(p, pack, stack) savefpstate(fs); #if defined(MULTIPROCESSOR) else - xcall((xcall_func_t)savefpstate, - (int)fs, 0, 0, 0, 1 << cpi->ci_cpuid); + XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif cpi->fpproc = NULL; } diff --git a/sys/arch/sparc/sparc/pmap.c b/sys/arch/sparc/sparc/pmap.c index 7089dfdd0639..cee9342d3f2e 100644 --- a/sys/arch/sparc/sparc/pmap.c +++ b/sys/arch/sparc/sparc/pmap.c @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.218 2003/01/01 15:56:11 pk Exp $ */ +/* $NetBSD: pmap.c,v 1.219 2003/01/03 15:44:55 pk Exp $ */ /* * Copyright (c) 1996 @@ -631,7 +631,7 @@ static __inline__ void smp_tlb_flush_page(int va, int ctx) { INCR_COUNT(smp_tlb_fp_cnt); - xcall((xcall_func_t)sp_tlb_flush_page, va, ctx, 0, 0, 0); + XCALL2(sp_tlb_flush_page, va, ctx, CPUSET_ALL); } static __inline__ void @@ -639,7 +639,7 @@ smp_tlb_flush_segment(int va, int ctx) { INCR_COUNT(smp_tlb_fs_cnt); - xcall((xcall_func_t)sp_tlb_flush_segment, va, ctx, 0, 0, 0); + XCALL2(sp_tlb_flush_segment, va, ctx, CPUSET_ALL); } static __inline__ void @@ -647,7 +647,7 @@ smp_tlb_flush_region(int va, int ctx) { INCR_COUNT(smp_tlb_fr_cnt); - xcall((xcall_func_t)sp_tlb_flush_region, va, ctx, 0, 0, 0); + XCALL2(sp_tlb_flush_region, va, ctx, CPUSET_ALL); } static __inline__ void @@ -655,7 +655,7 @@ smp_tlb_flush_context(int ctx) { INCR_COUNT(smp_tlb_fc_cnt); - xcall((xcall_func_t)sp_tlb_flush_context, ctx, 0, 0, 0, 0); + XCALL1(sp_tlb_flush_context, ctx, CPUSET_ALL); } static __inline__ void @@ -663,7 +663,7 @@ smp_tlb_flush_all() { INCR_COUNT(smp_tlb_fa_cnt); - xcall((xcall_func_t)sp_tlb_flush_all, 0, 0, 0, 0, 0); + XCALL0(sp_tlb_flush_all, CPUSET_ALL); } #endif diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index 9bdfe33de0d7..07f4297c04b2 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.120 2003/01/03 15:12:03 pk Exp $ */ +/* $NetBSD: trap.c,v 1.121 2003/01/03 15:44:55 pk Exp $ */ /* * Copyright (c) 1996 @@ -324,7 +324,7 @@ trap(type, psr, pc, tf) (*cpuinfo.pure_vcache_flush)(); #if defined(MULTIPROCESSOR) /* Broadcast to other CPUs */ - /* e.g. xcall(cpuinfo.pure_vcache_flush, 0, 0, 0, 0);*/ + /* e.g. XCALL0(cpuinfo.pure_vcache_flush, CPUSET_ALL);*/ #endif ADVANCE; return; @@ -485,8 +485,7 @@ badtrap: panic("FPU(%d): state for %p", cpi->ci_cpuid, p); #if defined(MULTIPROCESSOR) - xcall((xcall_func_t)savefpstate, - (int)fs, 0, 0, 0, 1 << cpi->ci_cpuid); + XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif cpi->fpproc = NULL; } diff --git a/sys/arch/sparc/sparc/vm_machdep.c b/sys/arch/sparc/sparc/vm_machdep.c index 15c72e8ed8ef..f5f2586e41a2 100644 --- a/sys/arch/sparc/sparc/vm_machdep.c +++ b/sys/arch/sparc/sparc/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.65 2003/01/03 15:12:03 pk Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.66 2003/01/03 15:44:56 pk Exp $ */ /* * Copyright (c) 1996 @@ -241,8 +241,7 @@ cpu_fork(p1, p2, stack, stacksize, func, arg) savefpstate(p1->p_md.md_fpstate); #if defined(MULTIPROCESSOR) else - xcall((xcall_func_t)savefpstate, - (int)p1->p_md.md_fpstate, 0, 0, 0, + XCALL1(savefpstate, p1->p_md.md_fpstate, 1 << cpi->ci_cpuid); #endif } @@ -322,8 +321,7 @@ cpu_exit(p) savefpstate(fs); #if defined(MULTIPROCESSOR) else - xcall((xcall_func_t)savefpstate, - (int)fs, 0, 0, 0, 1 << cpi->ci_cpuid); + XCALL1(savefpstate, fs, 1 << cpi->ci_cpuid); #endif cpi->fpproc = NULL; }