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 */ #define IRQ8_VECTOR 0x70 /* no need to move IRQ8-15 */
/* Hardware interrupt numbers. */ /* Hardware interrupt numbers. */
#ifndef CONFIG_APIC #ifndef USE_APIC
#define NR_IRQ_VECTORS 16 #define NR_IRQ_VECTORS 16
#else #else
#define NR_IRQ_VECTORS 64 #define NR_IRQ_VECTORS 64

View file

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

View file

@ -49,6 +49,16 @@ SRCS+= watchdog.c arch_watchdog.c
CPPFLAGS+= -DUSE_WATCHDOG CPPFLAGS+= -DUSE_WATCHDOG
.endif .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 # These come last, so the profiling buffer is at the end of the data segment
SRCS+= profile.c do_sprofile.c SRCS+= profile.c do_sprofile.c

View file

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

View file

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

View file

@ -83,7 +83,7 @@ ENTRY(apic_ipi_halt_intr)
#endif /* CONFIG_SMP */ #endif /* CONFIG_SMP */
#ifdef CONFIG_APIC_DEBUG #ifdef APIC_DEBUG
.data .data
lapic_intr_dummy_handler_msg: lapic_intr_dummy_handler_msg:
@ -426,4 +426,4 @@ LABEL(lapic_intr_dummy_handles_start)
LABEL(lapic_intr_dummy_handles_end) 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 #endif
#define CONFIG_APIC_DEBUG #define APIC_DEBUG
#ifdef CONFIG_APIC_DEBUG #ifdef APIC_DEBUG
#define LAPIC_INTR_DUMMY_HANDLER_SIZE 32 #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; EXTERN char lapic_intr_dummy_handles_end;
#endif #endif
#endif /* CONFIG_APIC_DEBUG */ #endif /* APIC_DEBUG */
#endif /* __APIC_ASM_H__ */ #endif /* __APIC_ASM_H__ */

View file

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

View file

@ -29,11 +29,13 @@
#include "glo.h" #include "glo.h"
#ifdef CONFIG_APIC #ifdef USE_APIC
#include "apic.h" #include "apic.h"
#endif #endif
#ifdef USE_ACPI
#include "acpi.h" #include "acpi.h"
#endif
PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */ PRIVATE int osfxsr_feature; /* FXSAVE/FXRSTOR instructions support (SSEx) */
@ -348,7 +350,7 @@ PUBLIC void cpu_identify(void)
PUBLIC void arch_init(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 * 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 * value is high enough to reach local APIC nad IOAPICs before paging is
@ -379,9 +381,11 @@ PUBLIC void arch_init(void)
ser_init(); ser_init();
#endif #endif
#ifdef USE_ACPI
acpi_init(); acpi_init();
#endif
#if defined(CONFIG_APIC) && !defined(CONFIG_SMP) #if defined(USE_APIC) && !defined(CONFIG_SMP)
if (config_no_apic) { if (config_no_apic) {
BOOT_VERBOSE(printf("APIC disabled, using legacy PIC\n")); 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('8', VF_SCHEDULING)
TOGGLECASE('9', VF_PICKPROC) TOGGLECASE('9', VF_PICKPROC)
#endif #endif
#ifdef CONFIG_APIC #ifdef USE_APIC
case 'I': case 'I':
dump_apic_irq_state(); dump_apic_irq_state();
break; 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 * configurations. ACPI would be another option, however we don't support it
* either * either
*/ */
#if defined(CONFIG_APIC) #if defined(USE_APIC)
#include "arch/i386/apic.h" #include "arch/i386/apic.h"
#define hw_intr_mask(irq) ioapic_mask_irq(irq) #define hw_intr_mask(irq) ioapic_mask_irq(irq)

View file

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

View file

@ -57,7 +57,7 @@
* the maximum needed by any given driver. The number of interrupt hooks may * the maximum needed by any given driver. The number of interrupt hooks may
* be incremented on systems with many device drivers. * be incremented on systems with many device drivers.
*/ */
#ifndef CONFIG_APIC #ifndef USE_APIC
#define NR_IRQ_HOOKS 16 /* number of interrupt hooks */ #define NR_IRQ_HOOKS 16 /* number of interrupt hooks */
#else #else
#define NR_IRQ_HOOKS 64 /* number of interrupt hooks */ #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; EXTERN int verboseflags;
#endif #endif
#ifdef CONFIG_APIC #ifdef USE_APIC
EXTERN int config_no_apic; /* optionaly turn off apic */ EXTERN int config_no_apic; /* optionaly turn off apic */
EXTERN int config_apic_timer_x; /* apic timer slowdown factor */ EXTERN int config_apic_timer_x; /* apic timer slowdown factor */
#endif #endif

View file

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

View file

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

View file

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