Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 1900 → Rev 1901

/trunk/kernel/generic/include/smp/smp.h
35,10 → 35,15
#ifndef KERN_SMP_H_
#define KERN_SMP_H_
 
#include <synch/waitq.h>
 
extern waitq_t ap_completion_wq;
 
#ifdef CONFIG_SMP
extern void smp_init(void);
extern void kmp(void *arg);
#else
#define smp_init() ;
#define smp_init()
#endif /* CONFIG_SMP */
 
#endif /* __SMP_H__ */
/trunk/kernel/generic/include/arch.h
75,6 → 75,7
extern void arch_pre_main(void);
extern void arch_pre_mm_init(void);
extern void arch_post_mm_init(void);
extern void arch_post_cpu_init(void);
extern void arch_pre_smp_init(void);
extern void arch_post_smp_init(void);
extern void calibrate_delay_loop(void);
/trunk/kernel/generic/src/main/kinit.c
63,7 → 63,7
#include <security/cap.h>
 
#ifdef CONFIG_SMP
#include <arch/smp/mps.h>
#include <smp/smp.h>
#endif /* CONFIG_SMP */
 
#include <synch/waitq.h>
94,6 → 94,7
 
#ifdef CONFIG_SMP
if (config.cpu_count > 1) {
waitq_initialize(&ap_completion_wq);
/*
* Create the kmp thread and wait for its completion.
* cpu1 through cpuN-1 will come up consecutively and
/trunk/kernel/generic/src/main/main.c
79,11 → 79,6
#include <macros.h>
#include <adt/btree.h>
#include <console/klog.h>
 
#ifdef CONFIG_SMP
#include <arch/smp/apic.h>
#include <arch/smp/mps.h>
#endif /* CONFIG_SMP */
#include <smp/smp.h>
 
/** Global configuration structure. */
271,7 → 266,7
/** Main kernel routine for application CPUs.
*
* Executed by application processors, temporary stack
* is at ctx.sp which was set during BP boot.
* is at ctx.sp which was set during BSP boot.
* This function passes control directly to
* main_ap_separated_stack().
*
282,9 → 277,8
{
/*
* Incrementing the active CPU counter will guarantee that the
* pm_init() will not attempt to build GDT and IDT tables again.
* Neither frame_init() will do the complete thing. Neither cpu_init()
* will do.
* *_init() functions can find out that they need to
* do initialization for AP only.
*/
config.cpu_active++;
 
300,12 → 294,9
arch_post_mm_init();
cpu_init();
calibrate_delay_loop();
arch_post_cpu_init();
 
l_apic_init();
l_apic_debug();
 
the_copy(THE, (the_t *) CPU->stack);
 
/*
/trunk/kernel/generic/src/smp/smp.c
0,0 → 1,46
/*
* Copyright (C) 2006 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
 
/** @addtogroup generic
* @{
*/
 
/**
* @file
*/
#include <smp/smp.h>
 
#ifdef CONFIG_SMP
 
waitq_t ap_completion_wq;
 
#endif /* CONFIG_SMP */
 
/** @}
*/
/trunk/kernel/Makefile
191,6 → 191,7
generic/src/synch/waitq.c \
generic/src/synch/futex.c \
generic/src/smp/ipi.c \
generic/src/smp/smp.c \
generic/src/ipc/ipc.c \
generic/src/ipc/sysipc.c \
generic/src/ipc/ipcrsc.c \
/trunk/kernel/arch/xen32/src/xen32.c
151,6 → 151,10
}
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
if (config.cpu_active == 1) {
/trunk/kernel/arch/sparc64/src/sparc64.c
78,6 → 78,10
standalone_sparc64_console_init();
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
}
/trunk/kernel/arch/ia64/src/ia64.c
89,6 → 89,10
ski_set_console_sysinfo();
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
}
/trunk/kernel/arch/ppc32/src/ppc32.c
82,6 → 82,10
}
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
memory_print_map();
/trunk/kernel/arch/amd64/src/amd64.c
45,6 → 45,10
#include <arch/drivers/i8254.h>
#include <arch/drivers/i8259.h>
 
#ifdef CONFIG_SMP
#include <arch/smp/apic.h>
#endif
 
#include <arch/bios/bios.h>
#include <arch/mm/memory_init.h>
#include <arch/cpu.h>
156,6 → 160,16
}
 
void arch_post_cpu_init()
{
#ifdef CONFIG_SMP
if (config.cpu_active > 1) {
l_apic_init();
l_apic_debug();
}
#endif
}
 
void arch_pre_smp_init(void)
{
if (config.cpu_active == 1) {
/trunk/kernel/arch/ppc64/src/ppc64.c
75,6 → 75,10
}
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
memory_print_map();
/trunk/kernel/arch/mips32/src/mips32.c
131,6 → 131,10
sysinfo_set_item_val("machine." STRING(MACHINE),NULL,1);
}
 
void arch_post_cpu_init(void)
{
}
 
void arch_pre_smp_init(void)
{
}
/trunk/kernel/arch/ia32/include/smp/mps.h
120,13 → 120,9
uint8_t dst_l_apic_pin;
} __attribute__ ((packed));
 
 
extern waitq_t ap_completion_wq;
 
extern struct smp_config_operations mps_config_operations;
 
extern void mps_init(void);
extern void kmp(void *arg);
 
#endif
 
/trunk/kernel/arch/ia32/src/ia32.c
62,6 → 62,10
#include <syscall/syscall.h>
#include <console/console.h>
 
#ifdef CONFIG_SMP
#include <arch/smp/apic.h>
#endif
 
void arch_pre_mm_init(void)
{
pm_init();
99,6 → 103,16
}
}
 
void arch_post_cpu_init()
{
#ifdef CONFIG_SMP
if (config.cpu_active > 1) {
l_apic_init();
l_apic_debug();
}
#endif
}
 
void arch_pre_smp_init(void)
{
if (config.cpu_active == 1) {
/trunk/kernel/arch/ia32/src/smp/mps.c
84,8 → 84,6
int io_intr_entry_cnt = 0;
int l_intr_entry_cnt = 0;
 
waitq_t ap_completion_wq;
 
/*
* Implementation of IA-32 SMP configuration interface.
*/
/trunk/kernel/arch/ia32/src/smp/smp.c
104,8 → 104,6
ASSERT(ops != NULL);
 
waitq_initialize(&ap_completion_wq);
 
/*
* We need to access data in frame 0.
* We boldly make use of kernel address space mapping.