diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2023-11-05 16:33:51 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2023-11-05 16:33:51 +0000 |
commit | 84cce45629e72c5acbd62e5c08a874dc49d76157 (patch) | |
tree | 7f31fcffc94a41beacbf9e6f376a40f59ceb12fb /sys | |
parent | ec832ca53da436820028afc96a3a9014e960d4e2 (diff) |
Provide simpler cpu_number, CPU_INFO_UNIT and CPU_IS_XXX macros in the
non-MULTIPROCESSOR case, as done on all other platforms.
ok deraadt@ kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/hppa/include/cpu.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/arch/hppa/include/cpu.h b/sys/arch/hppa/include/cpu.h index 6b21bcb0742..cbb6e403c40 100644 --- a/sys/arch/hppa/include/cpu.h +++ b/sys/arch/hppa/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.101 2023/08/23 01:55:46 cheloha Exp $ */ +/* $OpenBSD: cpu.h,v 1.102 2023/11/05 16:33:50 miod Exp $ */ /* * Copyright (c) 2000-2004 Michael Shalayeff @@ -131,6 +131,8 @@ extern struct cpu_info cpu_info[HPPA_MAXCPUS]; #define MAXCPUS HPPA_MAXCPUS +#ifdef MULTIPROCESSOR + static __inline struct cpu_info * curcpu(void) { @@ -146,6 +148,19 @@ curcpu(void) #define CPU_INFO_UNIT(ci) ((ci)->ci_dev ? (ci)->ci_dev->dv_unit : 0) #define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0) #define CPU_IS_RUNNING(ci) ((ci)->ci_flags & CPUF_RUNNING) + +#else + +#define curcpu() (&cpu_info[0]) + +#define cpu_number() 0 + +#define CPU_INFO_UNIT(ci) 0 +#define CPU_IS_PRIMARY(ci) 1 +#define CPU_IS_RUNNING(ci) 1 + +#endif + #define CPU_INFO_ITERATOR int #define CPU_INFO_FOREACH(cii, ci) \ for (cii = 0, ci = &cpu_info[0]; cii < ncpus; cii++, ci++) |