Add MKAPIC and MKACPI options

This commit is contained in:
Arun Thomas 2011-07-31 16:20:34 +02:00
parent fcc2c77af2
commit ae561b8f12
16 changed files with 47 additions and 38 deletions

View file

@ -35,7 +35,7 @@
#define IRQ8_VECTOR 0x70 /* no need to move IRQ8-15 */
/* Hardware interrupt numbers. */
#ifndef CONFIG_APIC
#ifndef USE_APIC
#define NR_IRQ_VECTORS 16
#else
#define NR_IRQ_VECTORS 64

View file

@ -10,8 +10,8 @@ SCRIPTS=newroot
PROGRAMS+= ahci ext2
.endif
# acpi is not compiled with ack or if MKEMBED
.if ${COMPILER_TYPE} == "gnu" && ${MKEMBED} != "yes"
# acpi is not compiled with ack
.if ${COMPILER_TYPE} == "gnu" && ${MKACPI} != "no"
PROGRAMS+= acpi
.endif

View file

@ -49,6 +49,16 @@ SRCS+= watchdog.c arch_watchdog.c
CPPFLAGS+= -DUSE_WATCHDOG
.endif
.if ${USE_ACPI} != "no"
SRCS+= acpi.c
CPPFLAGS+= -DUSE_ACPI
.endif
.if ${USE_APIC} != "no"
SRCS+= apic.c apic_asm.S
CPPFLAGS+= -DUSE_APIC
.endif
# These come last, so the profiling buffer is at the end of the data segment
SRCS+= profile.c do_sprofile.c

View file

@ -27,10 +27,7 @@ SRCS+= arch_do_vmctl.c \
oxpcie.c \
protect.c \
arch_system.c \
apic.c \
apic_asm.S \
pre_init.c \
acpi.c
pre_init.c
.ifdef CONFIG_SMP
SRCS += arch_smp.c trampoline.S

View file

@ -820,7 +820,7 @@ PRIVATE struct gate_table_s gate_table_smp[] = {
};
#endif
#ifdef CONFIG_APIC_DEBUG
#ifdef APIC_DEBUG
PRIVATE void lapic_set_dummy_handlers(void)
{
char * handler;
@ -852,7 +852,7 @@ PUBLIC void apic_idt_init(const int reset)
return;
}
#ifdef CONFIG_APIC_DEBUG
#ifdef APIC_DEBUG
if (is_bsp)
printf("APIC debugging is enabled\n");
lapic_set_dummy_handlers();

View file

@ -83,7 +83,7 @@ ENTRY(apic_ipi_halt_intr)
#endif /* CONFIG_SMP */
#ifdef CONFIG_APIC_DEBUG
#ifdef APIC_DEBUG
.data
lapic_intr_dummy_handler_msg:
@ -426,4 +426,4 @@ LABEL(lapic_intr_dummy_handles_start)
LABEL(lapic_intr_dummy_handles_end)
#endif /* CONFIG_APIC_DEBUG */
#endif /* APIC_DEBUG */

View file

@ -77,9 +77,9 @@ _PROTOTYPE(void apic_error_intr, (void));
#endif
#define CONFIG_APIC_DEBUG
#define APIC_DEBUG
#ifdef CONFIG_APIC_DEBUG
#ifdef APIC_DEBUG
#define LAPIC_INTR_DUMMY_HANDLER_SIZE 32
@ -88,6 +88,6 @@ EXTERN char lapic_intr_dummy_handles_start;
EXTERN char lapic_intr_dummy_handles_end;
#endif
#endif /* CONFIG_APIC_DEBUG */
#endif /* APIC_DEBUG */
#endif /* __APIC_ASM_H__ */

View file

@ -14,7 +14,7 @@
#include "profile.h"
#ifdef CONFIG_APIC
#ifdef USE_APIC
#include "apic.h"
#endif
#include "spinlock.h"
@ -121,7 +121,7 @@ PRIVATE void estimate_cpu_freq(void)
PUBLIC int init_local_timer(unsigned freq)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
/* if we know the address, lapic is enabled and we should use it */
if (lapic_addr) {
unsigned cpu = cpuid;
@ -144,7 +144,7 @@ PUBLIC int init_local_timer(unsigned freq)
PUBLIC void stop_local_timer(void)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
if (lapic_addr) {
lapic_stop_timer();
apic_eoi();
@ -157,7 +157,7 @@ PUBLIC void stop_local_timer(void)
PUBLIC void restart_local_timer(void)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
if (lapic_addr) {
lapic_restart_timer();
}
@ -166,7 +166,7 @@ PUBLIC void restart_local_timer(void)
PUBLIC int register_local_timer_handler(const irq_handler_t handler)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
if (lapic_addr) {
/* Using APIC, it is configured in apic_idt_init() */
BOOT_VERBOSE(printf("Using LAPIC timer as tick source\n"));

View file

@ -29,11 +29,13 @@
#include "glo.h"
#ifdef CONFIG_APIC
#ifdef USE_APIC
#include "apic.h"
#endif
#ifdef USE_ACPI
#include "acpi.h"
#endif
PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
@ -348,7 +350,7 @@ PUBLIC void cpu_identify(void)
PUBLIC void arch_init(void)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
/*
* this is setting kernel segments to cover most of the phys memory. The
* value is high enough to reach local APIC nad IOAPICs before paging is
@ -379,9 +381,11 @@ PUBLIC void arch_init(void)
ser_init();
#endif
#ifdef USE_ACPI
acpi_init();
#endif
#if defined(CONFIG_APIC) && !defined(CONFIG_SMP)
#if defined(USE_APIC) && !defined(CONFIG_SMP)
if (config_no_apic) {
BOOT_VERBOSE(printf("APIC disabled, using legacy PIC\n"));
}
@ -555,7 +559,7 @@ PRIVATE void ser_debug(const int c)
TOGGLECASE('8', VF_SCHEDULING)
TOGGLECASE('9', VF_PICKPROC)
#endif
#ifdef CONFIG_APIC
#ifdef USE_APIC
case 'I':
dump_apic_irq_state();
break;

View file

@ -16,7 +16,7 @@ _PROTOTYPE(void eoi_8259_slave,(void));
* configurations. ACPI would be another option, however we don't support it
* either
*/
#if defined(CONFIG_APIC)
#if defined(USE_APIC)
#include "arch/i386/apic.h"
#define hw_intr_mask(irq) ioapic_mask_irq(irq)

View file

@ -20,7 +20,7 @@
#include "kernel/proto.h"
#include "kernel/debug.h"
#ifdef CONFIG_APIC
#ifdef USE_APIC
#include "apic.h"
#ifdef USE_WATCHDOG
#include "kernel/watchdog.h"
@ -901,7 +901,7 @@ PUBLIC int arch_phys_map(const int index,
static char *ser_var = NULL;
if(first) {
#ifdef CONFIG_APIC
#ifdef USE_APIC
if(lapic_addr)
freeidx++;
if (ioapic_enabled)
@ -920,7 +920,7 @@ PUBLIC int arch_phys_map(const int index,
first = 0;
}
#ifdef CONFIG_APIC
#ifdef USE_APIC
/* map the local APIC if enabled */
if (index == 0) {
if (!lapic_addr)
@ -952,7 +952,7 @@ PUBLIC int arch_phys_map(const int index,
PUBLIC int arch_phys_map_reply(const int index, const vir_bytes addr)
{
#ifdef CONFIG_APIC
#ifdef USE_APIC
/* if local APIC is enabled */
if (index == 0 && lapic_addr) {
lapic_addr_vaddr = addr;
@ -1021,7 +1021,7 @@ PUBLIC int arch_enable_paging(struct proc * caller, const message * m_ptr)
if (newmap(caller, caller, ep_data.mem_map) != OK)
panic("arch_enable_paging: newmap failed");
#ifdef CONFIG_APIC
#ifdef USE_APIC
/* start using the virtual addresses */
/* if local APIC is enabled */

View file

@ -57,7 +57,7 @@
* the maximum needed by any given driver. The number of interrupt hooks may
* be incremented on systems with many device drivers.
*/
#ifndef CONFIG_APIC
#ifndef USE_APIC
#define NR_IRQ_HOOKS 16 /* number of interrupt hooks */
#else
#define NR_IRQ_HOOKS 64 /* number of interrupt hooks */

View file

@ -54,7 +54,7 @@ EXTERN u32_t magictest; /* global magic number */
EXTERN int verboseflags;
#endif
#ifdef CONFIG_APIC
#ifdef USE_APIC
EXTERN int config_no_apic; /* optionaly turn off apic */
EXTERN int config_apic_timer_x; /* apic timer slowdown factor */
#endif

View file

@ -1,10 +1,6 @@
#ifndef KERNEL_H
#define KERNEL_H
/* APIC is turned on by default */
#ifndef CONFIG_APIC
#define CONFIG_APIC
#endif
/* boot verbose */
#define CONFIG_BOOT_VERBOSE

View file

@ -93,7 +93,7 @@ PUBLIC void cstart(
if (value) serial_debug_baud = atoi(value);
}
#ifdef CONFIG_APIC
#ifdef USE_APIC
value = env_get("no_apic");
if(value)
config_no_apic = atoi(value);

View file

@ -758,7 +758,7 @@ _MKVARS.yes= \
MKYP
#MINIX-specific vars
_MKVARS.yes+= \
MKWATCHDOG
MKWATCHDOG MKACPI MKAPIC
.for var in ${_MKVARS.yes}
${var}?= yes
.endfor
@ -819,6 +819,8 @@ MKNLS:= no
# MINIX
.if ${MKEMBED} == "yes"
MKWATCHDOG:= no
MKACPI:= no
MKAPIC:= no
.endif
#
@ -880,7 +882,7 @@ ${var}?= no
# variable is set to "no".
#
.for var in USE_HESIOD USE_INET6 USE_KERBEROS USE_LDAP USE_PAM USE_YP \
USE_WATCHDOG
USE_WATCHDOG USE_ACPI USE_APIC
.if (${${var:S/USE_/MK/}} == "no")
${var}:= no
.else