sparc64 uses a different name of storing the CPU number. I'd like to use `ci_cpuid' to be able to use it in MI code without adding another abstraction layer.
Diff below is just a rename, ok? Index: include/cpu.h =================================================================== RCS file: /cvs/src/sys/arch/sparc64/include/cpu.h,v retrieving revision 1.91 diff -u -p -r1.91 cpu.h --- include/cpu.h 29 May 2017 14:19:50 -0000 1.91 +++ include/cpu.h 1 Dec 2017 14:14:29 -0000 @@ -113,7 +113,7 @@ struct cpu_info { struct cpu_info *ci_next; struct proc *ci_fpproc; - int ci_number; + int ci_cpuid; int ci_flags; int ci_upaid; #ifdef MULTIPROCESSOR @@ -174,13 +174,13 @@ extern struct cpu_info *cpus; register struct cpu_info *__curcpu asm ("g7"); #define curcpu() (__curcpu->ci_self) -#define cpu_number() (__curcpu->ci_number) +#define cpu_number() (__curcpu->ci_cpuid) -#define CPU_IS_PRIMARY(ci) ((ci)->ci_number == 0) +#define CPU_IS_PRIMARY(ci) ((ci)->ci_cpuid == 0) #define CPU_INFO_ITERATOR int #define CPU_INFO_FOREACH(cii, ci) \ for (cii = 0, ci = cpus; ci != NULL; ci = ci->ci_next) -#define CPU_INFO_UNIT(ci) ((ci)->ci_number) +#define CPU_INFO_UNIT(ci) ((ci)->ci_cpuid) #define MAXCPUS 256 void cpu_boot_secondary_processors(void); Index: sparc64/cpu.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/cpu.c,v retrieving revision 1.66 diff -u -p -r1.66 cpu.c --- sparc64/cpu.c 25 May 2017 03:19:39 -0000 1.66 +++ sparc64/cpu.c 1 Dec 2017 14:14:29 -0000 @@ -163,7 +163,7 @@ alloc_cpuinfo(struct mainbus_attach_args */ cpi->ci_next = NULL; cpi->ci_curproc = NULL; - cpi->ci_number = ncpus++; + cpi->ci_cpuid = ncpus++; cpi->ci_upaid = portid; cpi->ci_fpproc = NULL; #ifdef MULTIPROCESSOR Index: sparc64/db_interface.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/db_interface.c,v retrieving revision 1.48 diff -u -p -r1.48 db_interface.c --- sparc64/db_interface.c 30 Apr 2017 16:45:45 -0000 1.48 +++ sparc64/db_interface.c 1 Dec 2017 14:14:29 -0000 @@ -341,7 +341,7 @@ db_cpuinfo_cmd(db_expr_t addr, int have_ for (ci = cpus; ci != NULL; ci = ci->ci_next) { db_printf("%c%4d: ", (ci == curcpu()) ? '*' : ' ', - ci->ci_number); + ci->ci_cpuid); switch(ci->ci_ddb_paused) { case CI_DDB_RUNNING: db_printf("running\n"); @@ -373,7 +373,7 @@ db_startproc_cmd(db_expr_t addr, int hav if (have_addr) { for (ci = cpus; ci != NULL; ci = ci->ci_next) { - if (addr == ci->ci_number) { + if (addr == ci->ci_cpuid) { db_startcpu(ci); break; } @@ -395,7 +395,7 @@ db_stopproc_cmd(db_expr_t addr, int have if (have_addr) { for (ci = cpus; ci != NULL; ci = ci->ci_next) { - if (addr == ci->ci_number) { + if (addr == ci->ci_cpuid) { db_stopcpu(ci); break; } @@ -417,7 +417,7 @@ db_ddbproc_cmd(db_expr_t addr, int have_ if (have_addr) { for (ci = cpus; ci != NULL; ci = ci->ci_next) { - if (addr == ci->ci_number && ci != curcpu()) { + if (addr == ci->ci_cpuid && ci != curcpu()) { db_stopcpu(ci); db_switch_to_cpu = ci; db_switch_cpu = 1; @@ -468,7 +468,7 @@ db_enter_ddb(void) if (ddb_active_cpu == cpu_number() && db_switch_cpu) { curcpu()->ci_ddb_paused = CI_DDB_SHOULDSTOP; db_switch_cpu = 0; - ddb_active_cpu = db_switch_to_cpu->ci_number; + ddb_active_cpu = db_switch_to_cpu->ci_cpuid; db_switch_to_cpu->ci_ddb_paused = CI_DDB_ENTERDDB; } Index: sparc64/genassym.cf =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/genassym.cf,v retrieving revision 1.36 diff -u -p -r1.36 genassym.cf --- sparc64/genassym.cf 8 Oct 2016 05:42:38 -0000 1.36 +++ sparc64/genassym.cf 1 Dec 2017 14:14:29 -0000 @@ -137,7 +137,7 @@ member ci_curproc member ci_cpcb member ci_next member ci_fpproc -member ci_number +member ci_cpuid member ci_upaid member ci_want_resched member ci_handled_intr_level Index: sparc64/ipifuncs.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/ipifuncs.c,v retrieving revision 1.16 diff -u -p -r1.16 ipifuncs.c --- sparc64/ipifuncs.c 25 May 2017 03:19:39 -0000 1.16 +++ sparc64/ipifuncs.c 1 Dec 2017 14:14:29 -0000 @@ -164,7 +164,7 @@ sun4u_broadcast_ipi(void (*func)(void), struct cpu_info *ci; for (ci = cpus; ci != NULL; ci = ci->ci_next) { - if (ci->ci_number == cpu_number()) + if (ci->ci_cpuid == cpu_number()) continue; if ((ci->ci_flags & CPUF_RUNNING) == 0) continue; @@ -180,7 +180,7 @@ sun4v_broadcast_ipi(void (*func)(void), int err, i, ncpus = 0; for (ci = cpus; ci != NULL; ci = ci->ci_next) { - if (ci->ci_number == cpu_number()) + if (ci->ci_cpuid == cpu_number()) continue; if ((ci->ci_flags & CPUF_RUNNING) == 0) continue; Index: sparc64/pmap.c =================================================================== RCS file: /cvs/src/sys/arch/sparc64/sparc64/pmap.c,v retrieving revision 1.101 diff -u -p -r1.101 pmap.c --- sparc64/pmap.c 27 May 2017 09:03:22 -0000 1.101 +++ sparc64/pmap.c 1 Dec 2017 14:14:29 -0000 @@ -1202,7 +1202,7 @@ remap_data: cpus->ci_curproc = &proc0; cpus->ci_cpcb = (struct pcb *)u0[0]; /* Need better source */ cpus->ci_upaid = cpu_myid(); - cpus->ci_number = 0; + cpus->ci_cpuid = 0; cpus->ci_flags = CPUF_RUNNING; cpus->ci_fpproc = NULL; cpus->ci_spinup = main; /* Call main when we're running. */