From: Arun Thomas Date: Sun, 31 Jul 2011 14:20:34 +0000 (+0200) Subject: Add MKAPIC and MKACPI options X-Git-Tag: v3.2.0~396 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/migration-4to9?a=commitdiff_plain;h=ae561b8f124e1481bd4fb1882d4760ef558a6588;p=minix.git Add MKAPIC and MKACPI options --- diff --git a/common/include/arch/i386/interrupt.h b/common/include/arch/i386/interrupt.h index 01311979c..86b9447ff 100644 --- a/common/include/arch/i386/interrupt.h +++ b/common/include/arch/i386/interrupt.h @@ -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 diff --git a/drivers/ramdisk/Makefile b/drivers/ramdisk/Makefile index 6edb431ce..2f7d9ce4e 100644 --- a/drivers/ramdisk/Makefile +++ b/drivers/ramdisk/Makefile @@ -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 diff --git a/kernel/Makefile b/kernel/Makefile index b098f1772..6cae964ce 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -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 diff --git a/kernel/arch/i386/Makefile.inc b/kernel/arch/i386/Makefile.inc index f64341bbe..4d9f7db13 100644 --- a/kernel/arch/i386/Makefile.inc +++ b/kernel/arch/i386/Makefile.inc @@ -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 diff --git a/kernel/arch/i386/apic.c b/kernel/arch/i386/apic.c index a7f921818..b73b98f1a 100644 --- a/kernel/arch/i386/apic.c +++ b/kernel/arch/i386/apic.c @@ -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(); diff --git a/kernel/arch/i386/apic_asm.S b/kernel/arch/i386/apic_asm.S index ec51950ed..33a379d15 100644 --- a/kernel/arch/i386/apic_asm.S +++ b/kernel/arch/i386/apic_asm.S @@ -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 */ diff --git a/kernel/arch/i386/apic_asm.h b/kernel/arch/i386/apic_asm.h index ff06334da..d3da2037b 100644 --- a/kernel/arch/i386/apic_asm.h +++ b/kernel/arch/i386/apic_asm.h @@ -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__ */ diff --git a/kernel/arch/i386/arch_clock.c b/kernel/arch/i386/arch_clock.c index 31c4d8358..d07e17366 100644 --- a/kernel/arch/i386/arch_clock.c +++ b/kernel/arch/i386/arch_clock.c @@ -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")); diff --git a/kernel/arch/i386/arch_system.c b/kernel/arch/i386/arch_system.c index 2c32b82c6..bb48c2afd 100644 --- a/kernel/arch/i386/arch_system.c +++ b/kernel/arch/i386/arch_system.c @@ -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; diff --git a/kernel/arch/i386/include/hw_intr.h b/kernel/arch/i386/include/hw_intr.h index f49cb2b09..1f3f0a706 100644 --- a/kernel/arch/i386/include/hw_intr.h +++ b/kernel/arch/i386/include/hw_intr.h @@ -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) diff --git a/kernel/arch/i386/memory.c b/kernel/arch/i386/memory.c index fd49ff270..e2a05c479 100644 --- a/kernel/arch/i386/memory.c +++ b/kernel/arch/i386/memory.c @@ -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 */ diff --git a/kernel/config.h b/kernel/config.h index 29f54056f..f235944e3 100644 --- a/kernel/config.h +++ b/kernel/config.h @@ -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 */ diff --git a/kernel/glo.h b/kernel/glo.h index 177a3b7a2..51adb7583 100644 --- a/kernel/glo.h +++ b/kernel/glo.h @@ -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 diff --git a/kernel/kernel.h b/kernel/kernel.h index 030f60860..73f375a4e 100644 --- a/kernel/kernel.h +++ b/kernel/kernel.h @@ -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 diff --git a/kernel/start.c b/kernel/start.c index 8b2e0eb3a..55f8a28bf 100644 --- a/kernel/start.c +++ b/kernel/start.c @@ -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); diff --git a/share/mk/bsd.own.mk b/share/mk/bsd.own.mk index 46a1928c7..d3f119712 100644 --- a/share/mk/bsd.own.mk +++ b/share/mk/bsd.own.mk @@ -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