From: Sepherosa Ziehau Date: Fri, 27 May 2011 14:04:20 +0000 (+0800) Subject: i386: Move mp_naps from mp_machdep.c to machdep.c X-Git-Tag: v2.12.0~543 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/2abaa0301e1da2de2a151fce51edae183b60f50d i386: Move mp_naps from mp_machdep.c to machdep.c --- diff --git a/sys/platform/pc32/acpica5/acpi_madt.c b/sys/platform/pc32/acpica5/acpi_madt.c index 8fddbb64db..49984f0e39 100644 --- a/sys/platform/pc32/acpica5/acpi_madt.c +++ b/sys/platform/pc32/acpica5/acpi_madt.c @@ -47,6 +47,8 @@ #include "acpi_sdt.h" #include "acpi_sdt_var.h" +extern int naps; + #define MADT_VPRINTF(fmt, arg...) \ do { \ if (bootverbose) \ @@ -373,7 +375,7 @@ madt_lapic_pass2(int bsp_apic_id) panic("madt_iterate_entries(pass2) failed\n"); KKASSERT(arg.bsp_found); - mp_naps = arg.cpu - 1; /* exclude BSP */ + naps = arg.cpu - 1; /* exclude BSP */ sdt_sdth_unmap(&madt->madt_hdr); diff --git a/sys/platform/pc32/apic/lapic.c b/sys/platform/pc32/apic/lapic.c index 236c29ba7b..7e63dd09de 100644 --- a/sys/platform/pc32/apic/lapic.c +++ b/sys/platform/pc32/apic/lapic.c @@ -43,6 +43,8 @@ #include +extern int naps; + volatile lapic_t *lapic; static void lapic_timer_calibrate(void); @@ -668,11 +670,10 @@ lapic_config(void) if (ap_max > MAXCPU - 1) ap_max = MAXCPU - 1; - if (mp_naps > ap_max) { + if (naps > ap_max) { kprintf("LAPIC: Warning use only %d out of %d " - "available APs\n", - ap_max, mp_naps); - mp_naps = ap_max; + "available APs\n", ap_max, naps); + naps = ap_max; } return 0; diff --git a/sys/platform/pc32/i386/machdep.c b/sys/platform/pc32/i386/machdep.c index 41563f9bcf..98f6302f5f 100644 --- a/sys/platform/pc32/i386/machdep.c +++ b/sys/platform/pc32/i386/machdep.c @@ -167,6 +167,8 @@ u_long ebda_addr = 0; int imcr_present = 0; +int naps = 0; /* # of Applications processors */ + static int sysctl_hw_physmem(SYSCTL_HANDLER_ARGS) { diff --git a/sys/platform/pc32/i386/mp_machdep.c b/sys/platform/pc32/i386/mp_machdep.c index 765cb7da4b..8abe880084 100644 --- a/sys/platform/pc32/i386/mp_machdep.c +++ b/sys/platform/pc32/i386/mp_machdep.c @@ -138,8 +138,8 @@ int current_postcode; /** XXX FIXME: what system files declare these??? */ extern struct region_descriptor r_gdt, r_idt; -int mp_naps; /* # of Applications processors */ -extern int nkpt; +extern int nkpt; +extern int naps; int64_t tsc0_offset; extern int64_t tsc_offsets[]; @@ -227,7 +227,7 @@ mp_announce(void) kprintf("DragonFly/MP: Multiprocessor motherboard\n"); kprintf(" cpu0 (BSP): apic id: %2d\n", CPUID_TO_APICID(0)); - for (x = 1; x <= mp_naps; ++x) + for (x = 1; x <= naps; ++x) kprintf(" cpu%d (AP): apic id: %2d\n", x, CPUID_TO_APICID(x)); if (!ioapic_enable) @@ -416,7 +416,7 @@ start_all_aps(u_int boot_addr) cpu_invltlb(); /* start each AP */ - for (x = 1; x <= mp_naps; ++x) { + for (x = 1; x <= naps; ++x) { /* This is a bit verbose, it will go away soon. */ @@ -468,8 +468,8 @@ start_all_aps(u_int boot_addr) kmem_alloc_nofault(&kernel_map, SEG_SIZE, SEG_SIZE); gd->gd_GDMAP1 = &PTD[(vm_offset_t)gd->gd_GDADDR1 >> PDRSHIFT]; - gd->mi.gd_ipiq = (void *)kmem_alloc(&kernel_map, sizeof(lwkt_ipiq) * (mp_naps + 1)); - bzero(gd->mi.gd_ipiq, sizeof(lwkt_ipiq) * (mp_naps + 1)); + gd->mi.gd_ipiq = (void *)kmem_alloc(&kernel_map, sizeof(lwkt_ipiq) * (naps + 1)); + bzero(gd->mi.gd_ipiq, sizeof(lwkt_ipiq) * (naps + 1)); /* * Setup the AP boot stack diff --git a/sys/platform/pc32/i386/mptable.c b/sys/platform/pc32/i386/mptable.c index 3bb3162b17..d0ca204be1 100644 --- a/sys/platform/pc32/i386/mptable.c +++ b/sys/platform/pc32/i386/mptable.c @@ -74,6 +74,7 @@ extern u_long ebda_addr; extern u_int base_memory; extern int imcr_present; +extern int naps; #define BIOS_BASE (0xf0000) #define BIOS_BASE2 (0xe0000) @@ -716,7 +717,7 @@ mptable_lapic_default(void) { int ap_apicid, bsp_apicid; - mp_naps = 1; /* exclude BSP */ + naps = 1; /* exclude BSP */ /* Map local apic before the id field is accessed */ lapic_map(DEFAULT_APIC_BASE); @@ -732,7 +733,7 @@ mptable_lapic_default(void) /* * Configure: - * mp_naps + * naps * APIC ID <-> CPU ID mappings */ static void @@ -780,7 +781,7 @@ mptable_lapic_enumerate(struct lapic_enumerator *e) if (logical_cpus != 0) arg1.cpu_count *= logical_cpus; } - mp_naps = arg1.cpu_count - 1; /* subtract the BSP */ + naps = arg1.cpu_count - 1; /* subtract the BSP */ /* * Link logical CPU id to local apic id diff --git a/sys/platform/pc32/include/smp.h b/sys/platform/pc32/include/smp.h index 7c3901d9d3..be694c0ff3 100644 --- a/sys/platform/pc32/include/smp.h +++ b/sys/platform/pc32/include/smp.h @@ -57,9 +57,6 @@ extern volatile cpumask_t started_cpus; extern volatile u_int checkstate_probed_cpus; extern void (*cpustop_restartfunc) (void); -/* global data in mp_machdep.c */ -extern int mp_naps; - #define APIC_INTMAPSIZE 192 /* * NOTE: