summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-11-14 23:12:47 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-11-14 23:12:47 +0000
commit6a02f03ac5dd25da89ab09d3fda006dfe33cdf94 (patch)
tree6032f8bf7127771263329a93d2a76183b15d8846
parentcffe5c052bb6a0cb72b83f6abe81b5662497d569 (diff)
Merge the ci_alive and ci_primary boolean values of struct cpu_info into
a single ci_flags bitfield. Also, set_cpu_number() will no longer set CIF_PRIMARY on the primary processor, it's up to the initialization code to do this.
-rw-r--r--sys/arch/aviion/aviion/machdep.c3
-rw-r--r--sys/arch/luna88k/luna88k/m8820x.c4
-rw-r--r--sys/arch/luna88k/luna88k/machdep.c5
-rw-r--r--sys/arch/m88k/include/cpu.h14
-rw-r--r--sys/arch/m88k/m88k/db_interface.c5
-rw-r--r--sys/arch/m88k/m88k/genassym.cf5
-rw-r--r--sys/arch/m88k/m88k/m8820x_machdep.c8
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c9
-rw-r--r--sys/arch/m88k/m88k/pmap.c9
-rw-r--r--sys/arch/mvme88k/mvme88k/locore.S10
-rw-r--r--sys/arch/mvme88k/mvme88k/machdep.c10
11 files changed, 37 insertions, 45 deletions
diff --git a/sys/arch/aviion/aviion/machdep.c b/sys/arch/aviion/aviion/machdep.c
index 588900afba2..6beb6d78b53 100644
--- a/sys/arch/aviion/aviion/machdep.c
+++ b/sys/arch/aviion/aviion/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.13 2007/11/06 21:42:55 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.14 2007/11/14 23:12:44 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -808,6 +808,7 @@ aviion_bootstrap()
setup_board_config();
master_cpu = cmmu_init();
set_cpu_number(master_cpu);
+ SET(curcpu()->ci_flags, CIF_ALIVE | CIF_PRIMARY);
/*
* Now that set_cpu_number() set us with a valid cpu_info pointer,
diff --git a/sys/arch/luna88k/luna88k/m8820x.c b/sys/arch/luna88k/luna88k/m8820x.c
index 75974aceb43..5b9273a9c50 100644
--- a/sys/arch/luna88k/luna88k/m8820x.c
+++ b/sys/arch/luna88k/luna88k/m8820x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m8820x.c,v 1.13 2006/10/30 14:32:27 aoyama Exp $ */
+/* $OpenBSD: m8820x.c,v 1.14 2007/11/14 23:12:45 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
*
@@ -139,8 +139,6 @@ m8820x_setup_board_config()
cr = m8820x_cmmu[num << cmmu_shift].cmmu_regs;
- m88k_cpus[num].ci_alive = 1; /* This cpu installed... */
-
type = CMMU_TYPE(cr[CMMU_IDR]);
printf("CPU%d is associated to %d MC8820%c CMMUs\n",
num, 1 << cmmu_shift, type == M88204_ID ? '4' : '0');
diff --git a/sys/arch/luna88k/luna88k/machdep.c b/sys/arch/luna88k/luna88k/machdep.c
index 42a7fa8895f..261fd1b2167 100644
--- a/sys/arch/luna88k/luna88k/machdep.c
+++ b/sys/arch/luna88k/luna88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.47 2007/11/06 21:42:56 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.48 2007/11/14 23:12:45 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -1008,6 +1008,7 @@ luna88k_bootstrap()
setup_board_config();
master_cpu = cmmu_init();
set_cpu_number(master_cpu);
+ SET(curcpu()->ci_flags, CIF_ALIVE | CIF_PRIMARY);
m88100_apply_patches();
@@ -1054,8 +1055,6 @@ luna88k_bootstrap()
for (cpu = 0; cpu < max_cpus; cpu++) {
if (cpu == master_cpu)
continue;
- if (m88k_cpus[cpu].ci_alive == 0)
- continue;
m8820x_initialize_cpu(cpu);
cmmu_set_sapr(cpu, kernel_pmap->pm_apr);
}
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index 5c6b24c7726..97b691f082b 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.29 2007/11/06 21:48:42 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.30 2007/11/14 23:12:45 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -82,7 +82,9 @@ extern u_int max_cpus;
*/
struct cpu_info {
- u_int ci_alive; /* nonzero if CPU present */
+ u_int ci_flags;
+#define CIF_ALIVE 0x01 /* cpu initialized */
+#define CIF_PRIMARY 0x02 /* primary cpu */
struct proc *ci_curproc; /* current process... */
struct pcb *ci_curpcb; /* ...and its pcb */
@@ -101,13 +103,13 @@ struct cpu_info {
u_long ci_spin_locks; /* spin locks counter */
- volatile int ci_ddb_state; /* ddb status */
+ int ci_ddb_state; /* ddb status */
#define CI_DDB_RUNNING 0
#define CI_DDB_ENTERDDB 1
#define CI_DDB_INDDB 2
#define CI_DDB_PAUSE 3
- volatile int ci_ipi; /* pending ipis */
+ int ci_ipi; /* pending ipis */
#define CI_IPI_NOTIFY 0x00000001
#define CI_IPI_HARDCLOCK 0x00000002
#define CI_IPI_STATCLOCK 0x00000004
@@ -121,7 +123,7 @@ extern struct cpu_info m88k_cpus[MAX_CPUS];
#define CPU_INFO_ITERATOR cpuid_t
#define CPU_INFO_FOREACH(cii, ci) \
for ((cii) = 0; (cii) < MAX_CPUS; (cii)++) \
- if (((ci) = &m88k_cpus[cii])->ci_alive != 0)
+ if (((ci) = &m88k_cpus[cii])->ci_flags & CIF_ALIVE)
#define CPU_INFO_UNIT(ci) ((ci)->ci_cpuid)
#if defined(MULTIPROCESSOR)
@@ -135,7 +137,7 @@ curcpu(void)
return cpuptr;
}
-#define CPU_IS_PRIMARY(ci) ((ci)->ci_primary != 0)
+#define CPU_IS_PRIMARY(ci) ((ci)->ci_flags & CIF_PRIMARY)
void cpu_boot_secondary_processors(void);
__dead void cpu_emergency_disable(void);
diff --git a/sys/arch/m88k/m88k/db_interface.c b/sys/arch/m88k/m88k/db_interface.c
index ca313f6a300..7db78c45ae3 100644
--- a/sys/arch/m88k/m88k/db_interface.c
+++ b/sys/arch/m88k/m88k/db_interface.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_interface.c,v 1.9 2007/11/14 17:54:25 miod Exp $ */
+/* $OpenBSD: db_interface.c,v 1.10 2007/11/14 23:12:46 miod Exp $ */
/*
* Mach Operating System
* Copyright (c) 1993-1991 Carnegie Mellon University
@@ -631,7 +631,8 @@ m88k_db_cpu_cmd(db_expr_t addr, int have_addr, db_expr_t count, char *modif)
/* switch to another processor if requested */
if (have_addr) {
cpu = (cpuid_t)addr;
- if (cpu >= 0 && cpu < MAX_CPUS && m88k_cpus[cpu].ci_alive) {
+ if (cpu >= 0 && cpu < MAX_CPUS &&
+ ISSET(m88k_cpus[cpu].ci_flags, CIF_ALIVE)) {
ddb_mp_nextcpu = cpu;
db_cmd_loop_done = 1;
} else {
diff --git a/sys/arch/m88k/m88k/genassym.cf b/sys/arch/m88k/m88k/genassym.cf
index bc3a96c2e71..af886904abf 100644
--- a/sys/arch/m88k/m88k/genassym.cf
+++ b/sys/arch/m88k/m88k/genassym.cf
@@ -1,4 +1,4 @@
-# $OpenBSD: genassym.cf,v 1.10 2007/11/06 21:42:56 miod Exp $
+# $OpenBSD: genassym.cf,v 1.11 2007/11/14 23:12:46 miod Exp $
#
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -28,7 +28,7 @@
# SUCH DAMAGE.
#
# @(#)genassym.c 7.8 (Berkeley) 5/7/91
-# $Id: genassym.cf,v 1.10 2007/11/06 21:42:56 miod Exp $
+# $Id: genassym.cf,v 1.11 2007/11/14 23:12:46 miod Exp $
#
include <sys/param.h>
@@ -60,7 +60,6 @@ export SONPROC
struct cpu_info
member ci_curproc
member ci_curpcb
-member ci_primary
member ci_pfsr_i0
member ci_pfsr_i1
member ci_pfsr_d0
diff --git a/sys/arch/m88k/m88k/m8820x_machdep.c b/sys/arch/m88k/m88k/m8820x_machdep.c
index a9b11b00c03..f6fe89996fc 100644
--- a/sys/arch/m88k/m88k/m8820x_machdep.c
+++ b/sys/arch/m88k/m88k/m8820x_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m8820x_machdep.c,v 1.29 2007/11/11 13:05:28 miod Exp $ */
+/* $OpenBSD: m8820x_machdep.c,v 1.30 2007/11/14 23:12:46 miod Exp $ */
/*
* Copyright (c) 2004, Miodrag Vallat.
*
@@ -756,7 +756,8 @@ m8820x_dma_cachectl(pmap_t pmap, vaddr_t _va, vsize_t _size, int op)
/* invalidate on all... */
if (flusher != m8820x_cmmu_sync_cache) {
for (cpu = 0; cpu < MAX_CPUS; cpu++) {
- if (m88k_cpus[cpu].ci_alive == 0)
+ if (!ISSET(m88k_cpus[cpu].ci_flags,
+ CIF_ALIVE))
continue;
(*flusher)(cpu, pa, count);
}
@@ -823,7 +824,8 @@ m8820x_dma_cachectl_pa(paddr_t _pa, psize_t _size, int op)
/* invalidate on all... */
if (flusher != m8820x_cmmu_sync_cache) {
for (cpu = 0; cpu < MAX_CPUS; cpu++) {
- if (m88k_cpus[cpu].ci_alive == 0)
+ if (!ISSET(m88k_cpus[cpu].ci_flags,
+ CIF_ALIVE))
continue;
(*flusher)(cpu, pa, count);
}
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index ede3f353edc..70fbdff129f 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.28 2007/11/09 17:08:44 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.29 2007/11/14 23:12:46 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -285,13 +285,6 @@ set_cpu_number(cpuid_t number)
__asm__ __volatile__ ("stcr %0, cr17" :: "r" (ci));
flush_pipeline();
-
-#ifdef MULTIPROCESSOR
- if (number == master_cpu)
-#endif
- {
- ci->ci_primary = 1;
- }
}
/*
diff --git a/sys/arch/m88k/m88k/pmap.c b/sys/arch/m88k/m88k/pmap.c
index b2256ae0dde..d2f6e88e62d 100644
--- a/sys/arch/m88k/m88k/pmap.c
+++ b/sys/arch/m88k/m88k/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.32 2007/11/06 21:45:46 miod Exp $ */
+/* $OpenBSD: pmap.c,v 1.33 2007/11/14 23:12:46 miod Exp $ */
/*
* Copyright (c) 2001-2004, Miodrag Vallat
* Copyright (c) 1998-2001 Steve Murphree, Jr.
@@ -211,10 +211,7 @@ flush_atc_entry(pmap_t pmap, vaddr_t va)
kernel = pmap == kernel_pmap;
while ((cpu = ff1(users)) != 32) {
-#ifdef DIAGNOSTIC
- if (m88k_cpus[cpu].ci_alive)
-#endif
- cmmu_flush_tlb(cpu, kernel, va, 1);
+ cmmu_flush_tlb(cpu, kernel, va, 1);
users ^= 1 << cpu;
}
#else /* MULTIPROCESSOR */
@@ -491,7 +488,7 @@ pmap_cache_ctrl(pmap_t pmap, vaddr_t s, vaddr_t e, u_int mode)
pa = ptoa(PG_PFNUM(opte));
#ifdef MULTIPROCESSOR
for (cpu = 0; cpu < MAX_CPUS; cpu++)
- if (m88k_cpus[cpu].ci_alive != 0)
+ if (ISSET(m88k_cpus[cpu].ci_flags, CIF_ALIVE))
#else
cpu = cpu_number();
#endif
diff --git a/sys/arch/mvme88k/mvme88k/locore.S b/sys/arch/mvme88k/mvme88k/locore.S
index c0690a808a6..558b1da00b9 100644
--- a/sys/arch/mvme88k/mvme88k/locore.S
+++ b/sys/arch/mvme88k/mvme88k/locore.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: locore.S,v 1.52 2007/11/06 21:42:56 miod Exp $ */
+/* $OpenBSD: locore.S,v 1.53 2007/11/14 23:12:46 miod Exp $ */
/*
* Copyright (c) 2005, Miodrag Vallat.
* Copyright (c) 1998 Steve Murphree, Jr.
@@ -425,10 +425,10 @@ GLOBAL(proc0paddr)
#ifdef MULTIPROCESSOR
/* Dummy cpuinfo structure, for cpu_number() to work early. */
ASLOCAL(dummy_cpu)
- word 1 /* ci_alive */
- word 0 /* ci_curproc */
- word 0 /* ci_curpcb */
- word 0 /* ci_cpuid */
+ word 3 /* CIF_ALIVE | CIF_PRIMARY */ /* ci_flags */
+ word 0 /* ci_curproc */
+ word 0 /* ci_curpcb */
+ word 0 /* ci_cpuid */
#endif /* MULTIPROCESSOR */
#if defined(DDB) || NKSYMS > 0
diff --git a/sys/arch/mvme88k/mvme88k/machdep.c b/sys/arch/mvme88k/mvme88k/machdep.c
index b881f9a5190..3caa3ffe208 100644
--- a/sys/arch/mvme88k/mvme88k/machdep.c
+++ b/sys/arch/mvme88k/mvme88k/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.198 2007/11/06 21:42:56 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.199 2007/11/14 23:12:46 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -731,7 +731,7 @@ secondary_main()
microuptime(&ci->ci_schedstate.spc_runtime);
ci->ci_curproc = NULL;
- ci->ci_alive = 1;
+ SET(ci->ci_flags, CIF_ALIVE);
set_psr(get_psr() & ~PSR_IND);
spl0();
@@ -982,7 +982,7 @@ mvme_bootstrap()
setup_board_config();
master_cpu = cmmu_init();
set_cpu_number(master_cpu);
- curcpu()->ci_alive = 1;
+ SET(curcpu()->ci_flags, CIF_ALIVE | CIF_PRIMARY);
#ifdef M88100
if (CPU_IS88100) {
@@ -1167,7 +1167,7 @@ m88k_send_ipi(int ipi, cpuid_t cpu)
struct cpu_info *ci;
ci = &m88k_cpus[cpu];
- if (ci->ci_alive)
+ if (ISSET(ci->ci_flags, CIF_ALIVE))
(*md_send_ipi)(ipi, cpu);
}
@@ -1181,7 +1181,7 @@ m88k_broadcast_ipi(int ipi)
if (ci == curcpu())
continue;
- if (ci->ci_alive)
+ if (ISSET(ci->ci_flags, CIF_ALIVE))
(*md_send_ipi)(ipi, ci->ci_cpuid);
}
}