]> Zhao Yanbai Git Server - minix.git/commitdiff
SMP - fixed compilation and removed warnings
authorTomas Hruby <tom@minix3.org>
Thu, 15 Dec 2011 09:56:08 +0000 (09:56 +0000)
committerTomas Hruby <tom@minix3.org>
Tue, 20 Dec 2011 12:58:20 +0000 (12:58 +0000)
kernel/arch/i386/arch_clock.c
kernel/arch/i386/arch_smp.c
kernel/arch/i386/arch_system.c
kernel/arch/i386/include/arch_proto.h
kernel/arch/i386/memory.c
kernel/arch/i386/pre_init.c
kernel/smp.c
kernel/smp.h
kernel/spinlock.h

index d07e17366b21b0940aefbbf4db42154a053cfa32..5a64a836770aab9b8cb80a8dbfddf7005e2ce947 100644 (file)
@@ -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));
index d9c2977aae52bdedac47d2c4466b15b63ce211dd..19d380694b7728468e319ee80bdddbed0518c72f 100644 (file)
@@ -11,6 +11,7 @@
 #include "arch_proto.h"
 #include "kernel/glo.h"
 #include <unistd.h>
+#include <stdlib.h>
 #include <machine/cmos.h>
 #include <machine/bios.h>
 #include <minix/portio.h>
@@ -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;
 
index d095b150bf799e8a540a4a0ef362013938d37212..3001df55124516601bbf0272bfbbbeedf4c6deb6 100644 (file)
@@ -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));
index 145a3d79e19cb5dc06d351ce515271ee67448f09..215724e16f03cf2d5a583d982ffc0b134936ed18 100644 (file)
@@ -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)
 
 
index 5abfbbc725ca222a7024e6b92533f9f53a12e11d..8098355c5df8739f29ae0e2e59832df3f73b4c7b 100644 (file)
@@ -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;
index affb287af62cdf8de0d3cebfa30a34ed06d8f703..9dbd07491990fd39df6ce5cf7de4f6d30a35824f 100644 (file)
@@ -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;
index 1fc322012a18cbbe7d39aa14373ef5c09b1310e4..aa03f691ea4ba6ba9c8d0536618387806562f288 100644 (file)
@@ -2,6 +2,7 @@
 
 #include "smp.h"
 #include "interrupt.h"
+#include "clock.h"
 
 unsigned ncpus;
 unsigned ht_per_core;
index ad23ce9ce98654e87b47cb3baad7275fa8c71a67..b637ad3726615e5481ec150a1e06ef39a438b25d 100644 (file)
@@ -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));
index 946a57a550ed1e0cda2e34c970fc82e68432a627..55e354b2c04f750c561e371a27ab6c994158378a 100644 (file)
@@ -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