From: Tomas Hruby Date: Thu, 15 Dec 2011 09:56:08 +0000 (+0000) Subject: SMP - fixed compilation and removed warnings X-Git-Tag: v3.2.0~171 X-Git-Url: http://zhaoyanbai.com/repos/icons/debian/static/datamaps.china.min.js?a=commitdiff_plain;h=9cd53f1cc0fda6f942fd6e5b3841b46bb25dfcc6;p=minix.git SMP - fixed compilation and removed warnings --- diff --git a/kernel/arch/i386/arch_clock.c b/kernel/arch/i386/arch_clock.c index d07e17366..5a64a8367 100644 --- a/kernel/arch/i386/arch_clock.c +++ b/kernel/arch/i386/arch_clock.c @@ -185,6 +185,10 @@ PUBLIC int register_local_timer_handler(const irq_handler_t handler) PUBLIC void cycles_accounting_init(void) { +#ifdef CONFIG_SMP + unsigned cpu = cpuid; +#endif + read_tsc_64(get_cpu_var_ptr(cpu, tsc_ctr_switch)); make_zero64(get_cpu_var(cpu, cpu_last_tsc)); diff --git a/kernel/arch/i386/arch_smp.c b/kernel/arch/i386/arch_smp.c index d9c2977aa..19d380694 100644 --- a/kernel/arch/i386/arch_smp.c +++ b/kernel/arch/i386/arch_smp.c @@ -11,6 +11,7 @@ #include "arch_proto.h" #include "kernel/glo.h" #include +#include #include #include #include @@ -19,6 +20,7 @@ #include "kernel/smp.h" #include "apic.h" #include "acpi.h" +#include "clock.h" #include "glo.h" @@ -46,7 +48,6 @@ PUBLIC unsigned char cpuid2apicid[CONFIG_MAX_CPUS]; SPINLOCK_DEFINE(smp_cpu_lock) SPINLOCK_DEFINE(dispq_lock) -FORWARD _PROTOTYPE(void smp_init_vars, (void)); FORWARD _PROTOTYPE(void smp_reinit_vars, (void)); /* @@ -55,15 +56,14 @@ FORWARD _PROTOTYPE(void smp_reinit_vars, (void)); PRIVATE phys_bytes copy_trampoline(void) { char * s, *end; - phys_bytes tramp_base; + phys_bytes tramp_base = 0; unsigned tramp_size; tramp_size = (unsigned) &__trampoline_end - (unsigned)&trampoline; s = env_get("memory"); - s = (char *) get_value(params_buffer, "memory"); if (!s) return 0; - + while (*s != 0) { phys_bytes base = 0xfffffff; unsigned size; @@ -175,12 +175,10 @@ PUBLIC void smp_halt_cpu (void) PUBLIC void smp_shutdown_aps(void) { unsigned cpu; - unsigned aid = apicid(); - unsigned local_cpu = cpuid; - + if (ncpus == 1) goto exit_shutdown_aps; - + /* we must let the other cpus enter the kernel mode */ BKL_UNLOCK(); @@ -267,7 +265,6 @@ PUBLIC void smp_ap_boot(void) PRIVATE void smp_reinit_vars(void) { - int i; lapic_addr = lapic_eoi_addr = 0; ioapic_enabled = 0; diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index d095b150b..3001df551 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -511,8 +511,6 @@ PRIVATE void dump_bkl_usage(void) PRIVATE void reset_bkl_usage(void) { - unsigned cpu; - memset(kernel_ticks, 0, sizeof(kernel_ticks)); memset(bkl_ticks, 0, sizeof(bkl_ticks)); memset(bkl_tries, 0, sizeof(bkl_tries)); diff --git a/kernel/arch/i386/include/arch_proto.h b/kernel/arch/i386/include/arch_proto.h index 145a3d79e..215724e16 100644 --- a/kernel/arch/i386/include/arch_proto.h +++ b/kernel/arch/i386/include/arch_proto.h @@ -178,6 +178,7 @@ extern void * k_stacks; #define get_k_stack_top(cpu) ((void *)(((char*)(k_stacks)) \ + 2 * ((cpu) + 1) * K_STACK_SIZE)) +_PROTOTYPE( void, mfence(void)); #define barrier() do { mfence(); } while(0) diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index 5abfbbc72..8098355c5 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -908,7 +908,6 @@ PUBLIC int arch_phys_map(const int index, if(lapic_addr) lapic_mapping_index = freeidx++; if (ioapic_enabled) { - int i; ioapic_first_index = freeidx; assert(nioapics > 0); freeidx += nioapics; diff --git a/kernel/arch/i386/pre_init.c b/kernel/arch/i386/pre_init.c index affb287af..9dbd07491 100644 --- a/kernel/arch/i386/pre_init.c +++ b/kernel/arch/i386/pre_init.c @@ -226,7 +226,7 @@ PRIVATE int mb_set_param(char *name, char *value) PRIVATE void get_parameters(multiboot_info_t *mbi) { char mem_value[40], temp[ITOA_BUFFER_SIZE]; - int i, processor; + int i; int dev; int ctrlr; int disk, prim, sub; diff --git a/kernel/smp.c b/kernel/smp.c index 1fc322012..aa03f691e 100644 --- a/kernel/smp.c +++ b/kernel/smp.c @@ -2,6 +2,7 @@ #include "smp.h" #include "interrupt.h" +#include "clock.h" unsigned ncpus; unsigned ht_per_core; diff --git a/kernel/smp.h b/kernel/smp.h index ad23ce9ce..b637ad372 100644 --- a/kernel/smp.h +++ b/kernel/smp.h @@ -53,6 +53,7 @@ SPINLOCK_DECLARE(boot_lock) _PROTOTYPE(void wait_for_APs_to_finish_booting, (void)); _PROTOTYPE(void ap_boot_finished, (unsigned cpu)); +_PROTOTYPE(void smp_shutdown_aps, (void )); /* IPI handlers */ _PROTOTYPE(void smp_ipi_halt_handler, (void)); diff --git a/kernel/spinlock.h b/kernel/spinlock.h index 946a57a55..55e354b2c 100644 --- a/kernel/spinlock.h +++ b/kernel/spinlock.h @@ -28,6 +28,8 @@ typedef struct spinlock { #define spinlock_lock(sl) #define spinlock_unlock(sl) #else +void arch_spinlock_lock(atomic_t * sl); +void arch_spinlock_unlock(atomic_t * sl); #define spinlock_lock(sl) arch_spinlock_lock((atomic_t*) sl) #define spinlock_unlock(sl) arch_spinlock_unlock((atomic_t*) sl) #endif