SMP - fixed compilation and removed warnings
This commit is contained in:
parent
84662ec4b3
commit
9cd53f1cc0
9 changed files with 16 additions and 13 deletions
|
@ -185,6 +185,10 @@ PUBLIC int register_local_timer_handler(const irq_handler_t handler)
|
||||||
|
|
||||||
PUBLIC void cycles_accounting_init(void)
|
PUBLIC void cycles_accounting_init(void)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_SMP
|
||||||
|
unsigned cpu = cpuid;
|
||||||
|
#endif
|
||||||
|
|
||||||
read_tsc_64(get_cpu_var_ptr(cpu, tsc_ctr_switch));
|
read_tsc_64(get_cpu_var_ptr(cpu, tsc_ctr_switch));
|
||||||
|
|
||||||
make_zero64(get_cpu_var(cpu, cpu_last_tsc));
|
make_zero64(get_cpu_var(cpu, cpu_last_tsc));
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "arch_proto.h"
|
#include "arch_proto.h"
|
||||||
#include "kernel/glo.h"
|
#include "kernel/glo.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <machine/cmos.h>
|
#include <machine/cmos.h>
|
||||||
#include <machine/bios.h>
|
#include <machine/bios.h>
|
||||||
#include <minix/portio.h>
|
#include <minix/portio.h>
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
#include "kernel/smp.h"
|
#include "kernel/smp.h"
|
||||||
#include "apic.h"
|
#include "apic.h"
|
||||||
#include "acpi.h"
|
#include "acpi.h"
|
||||||
|
#include "clock.h"
|
||||||
|
|
||||||
#include "glo.h"
|
#include "glo.h"
|
||||||
|
|
||||||
|
@ -46,7 +48,6 @@ PUBLIC unsigned char cpuid2apicid[CONFIG_MAX_CPUS];
|
||||||
SPINLOCK_DEFINE(smp_cpu_lock)
|
SPINLOCK_DEFINE(smp_cpu_lock)
|
||||||
SPINLOCK_DEFINE(dispq_lock)
|
SPINLOCK_DEFINE(dispq_lock)
|
||||||
|
|
||||||
FORWARD _PROTOTYPE(void smp_init_vars, (void));
|
|
||||||
FORWARD _PROTOTYPE(void smp_reinit_vars, (void));
|
FORWARD _PROTOTYPE(void smp_reinit_vars, (void));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -55,12 +56,11 @@ FORWARD _PROTOTYPE(void smp_reinit_vars, (void));
|
||||||
PRIVATE phys_bytes copy_trampoline(void)
|
PRIVATE phys_bytes copy_trampoline(void)
|
||||||
{
|
{
|
||||||
char * s, *end;
|
char * s, *end;
|
||||||
phys_bytes tramp_base;
|
phys_bytes tramp_base = 0;
|
||||||
unsigned tramp_size;
|
unsigned tramp_size;
|
||||||
|
|
||||||
tramp_size = (unsigned) &__trampoline_end - (unsigned)&trampoline;
|
tramp_size = (unsigned) &__trampoline_end - (unsigned)&trampoline;
|
||||||
s = env_get("memory");
|
s = env_get("memory");
|
||||||
s = (char *) get_value(params_buffer, "memory");
|
|
||||||
if (!s)
|
if (!s)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
@ -175,8 +175,6 @@ PUBLIC void smp_halt_cpu (void)
|
||||||
PUBLIC void smp_shutdown_aps(void)
|
PUBLIC void smp_shutdown_aps(void)
|
||||||
{
|
{
|
||||||
unsigned cpu;
|
unsigned cpu;
|
||||||
unsigned aid = apicid();
|
|
||||||
unsigned local_cpu = cpuid;
|
|
||||||
|
|
||||||
if (ncpus == 1)
|
if (ncpus == 1)
|
||||||
goto exit_shutdown_aps;
|
goto exit_shutdown_aps;
|
||||||
|
@ -267,7 +265,6 @@ PUBLIC void smp_ap_boot(void)
|
||||||
|
|
||||||
PRIVATE void smp_reinit_vars(void)
|
PRIVATE void smp_reinit_vars(void)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
lapic_addr = lapic_eoi_addr = 0;
|
lapic_addr = lapic_eoi_addr = 0;
|
||||||
ioapic_enabled = 0;
|
ioapic_enabled = 0;
|
||||||
|
|
||||||
|
|
|
@ -511,8 +511,6 @@ PRIVATE void dump_bkl_usage(void)
|
||||||
|
|
||||||
PRIVATE void reset_bkl_usage(void)
|
PRIVATE void reset_bkl_usage(void)
|
||||||
{
|
{
|
||||||
unsigned cpu;
|
|
||||||
|
|
||||||
memset(kernel_ticks, 0, sizeof(kernel_ticks));
|
memset(kernel_ticks, 0, sizeof(kernel_ticks));
|
||||||
memset(bkl_ticks, 0, sizeof(bkl_ticks));
|
memset(bkl_ticks, 0, sizeof(bkl_ticks));
|
||||||
memset(bkl_tries, 0, sizeof(bkl_tries));
|
memset(bkl_tries, 0, sizeof(bkl_tries));
|
||||||
|
|
|
@ -178,6 +178,7 @@ extern void * k_stacks;
|
||||||
#define get_k_stack_top(cpu) ((void *)(((char*)(k_stacks)) \
|
#define get_k_stack_top(cpu) ((void *)(((char*)(k_stacks)) \
|
||||||
+ 2 * ((cpu) + 1) * K_STACK_SIZE))
|
+ 2 * ((cpu) + 1) * K_STACK_SIZE))
|
||||||
|
|
||||||
|
_PROTOTYPE( void, mfence(void));
|
||||||
#define barrier() do { mfence(); } while(0)
|
#define barrier() do { mfence(); } while(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -908,7 +908,6 @@ PUBLIC int arch_phys_map(const int index,
|
||||||
if(lapic_addr)
|
if(lapic_addr)
|
||||||
lapic_mapping_index = freeidx++;
|
lapic_mapping_index = freeidx++;
|
||||||
if (ioapic_enabled) {
|
if (ioapic_enabled) {
|
||||||
int i;
|
|
||||||
ioapic_first_index = freeidx;
|
ioapic_first_index = freeidx;
|
||||||
assert(nioapics > 0);
|
assert(nioapics > 0);
|
||||||
freeidx += nioapics;
|
freeidx += nioapics;
|
||||||
|
|
|
@ -226,7 +226,7 @@ PRIVATE int mb_set_param(char *name, char *value)
|
||||||
PRIVATE void get_parameters(multiboot_info_t *mbi)
|
PRIVATE void get_parameters(multiboot_info_t *mbi)
|
||||||
{
|
{
|
||||||
char mem_value[40], temp[ITOA_BUFFER_SIZE];
|
char mem_value[40], temp[ITOA_BUFFER_SIZE];
|
||||||
int i, processor;
|
int i;
|
||||||
int dev;
|
int dev;
|
||||||
int ctrlr;
|
int ctrlr;
|
||||||
int disk, prim, sub;
|
int disk, prim, sub;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "smp.h"
|
#include "smp.h"
|
||||||
#include "interrupt.h"
|
#include "interrupt.h"
|
||||||
|
#include "clock.h"
|
||||||
|
|
||||||
unsigned ncpus;
|
unsigned ncpus;
|
||||||
unsigned ht_per_core;
|
unsigned ht_per_core;
|
||||||
|
|
|
@ -53,6 +53,7 @@ SPINLOCK_DECLARE(boot_lock)
|
||||||
|
|
||||||
_PROTOTYPE(void wait_for_APs_to_finish_booting, (void));
|
_PROTOTYPE(void wait_for_APs_to_finish_booting, (void));
|
||||||
_PROTOTYPE(void ap_boot_finished, (unsigned cpu));
|
_PROTOTYPE(void ap_boot_finished, (unsigned cpu));
|
||||||
|
_PROTOTYPE(void smp_shutdown_aps, (void ));
|
||||||
|
|
||||||
/* IPI handlers */
|
/* IPI handlers */
|
||||||
_PROTOTYPE(void smp_ipi_halt_handler, (void));
|
_PROTOTYPE(void smp_ipi_halt_handler, (void));
|
||||||
|
|
|
@ -28,6 +28,8 @@ typedef struct spinlock {
|
||||||
#define spinlock_lock(sl)
|
#define spinlock_lock(sl)
|
||||||
#define spinlock_unlock(sl)
|
#define spinlock_unlock(sl)
|
||||||
#else
|
#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_lock(sl) arch_spinlock_lock((atomic_t*) sl)
|
||||||
#define spinlock_unlock(sl) arch_spinlock_unlock((atomic_t*) sl)
|
#define spinlock_unlock(sl) arch_spinlock_unlock((atomic_t*) sl)
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue