diff --git a/sys/conf/options.pc98 b/sys/conf/options.pc98 index 620d05bfb34e..9a19da0ff2ba 100644 --- a/sys/conf/options.pc98 +++ b/sys/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.26 1997/06/04 10:29:17 kato Exp $ +# $Id: options.pc98,v 1.27 1997/06/06 13:07:18 kato Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -40,12 +40,6 @@ NAPIC opt_smp.h NINTR opt_smp.h SMP_TIMER_NC opt_smp.h -# These three are known to be broken, don't enable them. -SMP_PRIVPAGES opt_smp_privpages.h -SMP_AUTOSTART opt_smp_autostart.h - -SERIAL_DEBUG opt_serial.h - AHC_TAGENABLE opt_aic7xxx.h AHC_SCBPAGING_ENABLE opt_aic7xxx.h AHC_ALLOW_MEMIO opt_aic7xxx.h diff --git a/sys/pc98/conf/options.pc98 b/sys/pc98/conf/options.pc98 index 620d05bfb34e..9a19da0ff2ba 100644 --- a/sys/pc98/conf/options.pc98 +++ b/sys/pc98/conf/options.pc98 @@ -1,4 +1,4 @@ -# $Id: options.pc98,v 1.26 1997/06/04 10:29:17 kato Exp $ +# $Id: options.pc98,v 1.27 1997/06/06 13:07:18 kato Exp $ BOUNCEPAGES opt_bounce.h USER_LDT MATH_EMULATE opt_math_emulate.h @@ -40,12 +40,6 @@ NAPIC opt_smp.h NINTR opt_smp.h SMP_TIMER_NC opt_smp.h -# These three are known to be broken, don't enable them. -SMP_PRIVPAGES opt_smp_privpages.h -SMP_AUTOSTART opt_smp_autostart.h - -SERIAL_DEBUG opt_serial.h - AHC_TAGENABLE opt_aic7xxx.h AHC_SCBPAGING_ENABLE opt_aic7xxx.h AHC_ALLOW_MEMIO opt_aic7xxx.h diff --git a/sys/pc98/i386/machdep.c b/sys/pc98/i386/machdep.c index 67b8ae71ee6e..85d5ec1fbbfa 100644 --- a/sys/pc98/i386/machdep.c +++ b/sys/pc98/i386/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.44 1997/06/09 13:38:21 kato Exp $ + * $Id: machdep.c,v 1.45 1997/06/15 16:35:13 kato Exp $ */ #include "apm.h" @@ -229,12 +229,6 @@ cpu_startup(dummy) * Good {morning,afternoon,evening,night}. */ printf(version); -#ifdef SMP -#if defined(LATE_START) - mp_start(); /* fire up the APs and APICs */ -#endif /* LATE_START */ - mp_announce(); -#endif /* SMP */ earlysetcpuclass(); startrtclock(); printcpuinfo(); @@ -370,23 +364,6 @@ cpu_startup(dummy) u_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, (maxproc*UPAGES*PAGE_SIZE), FALSE); -#if defined(SMP) && defined(SMP_PRIVPAGES) - /* Per-cpu pages.. (the story so far is... subject to change) - * ========= For the per-cpu data page ======== - * 1 private data page - * 1 PDE (per-cpu PTD entry page) - * 1 PT (per-cpu page table page) - * ============ For the idle loop ============= - * 2 UPAGEs (per-cpu idle procs) - * 1 PTD (for per-cpu equiv of IdlePTD) - * ============================================ - * = total of 6 pages per cpu. The BSP reuses the ones allocated - * by locore.s during boot to remove special cases at runtime. - */ - ppage_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, - (NCPU*6*PAGE_SIZE), FALSE); -#endif - /* * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. @@ -430,6 +407,14 @@ cpu_startup(dummy) printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count), ptoa(cnt.v_free_count) / 1024); +#ifdef SMP + /* + * OK, enough kmem_alloc/malloc state should be up, lets get on with it! + */ + mp_start(); /* fire up the APs and APICs */ + mp_announce(); +#endif /* SMP */ + /* * Set up buffers, so they can be used to read disk labels. */ @@ -815,8 +800,7 @@ struct region_descriptor r_gdt, r_idt; #endif #ifdef SMP -struct i386tss SMPcommon_tss[NCPU]; /* One tss per cpu */ -struct i386tss *SMPcommon_tss_ptr[NCPU]; /* for the benefit of asmp code */ +extern struct i386tss common_tss; /* One tss per cpu */ #else struct i386tss common_tss; #endif @@ -893,11 +877,7 @@ struct soft_segment_descriptor gdt_segs[ 0 /* limit granularity (byte/page units)*/ }, /* GPROC0_SEL 6 Proc 0 Tss Descriptor */ { -#ifdef SMP - (int) &SMPcommon_tss[0],/* segment base address */ -#else (int) &common_tss, /* segment base address */ -#endif sizeof(struct i386tss)-1,/* length - all address space */ SDT_SYS386TSS, /* segment type */ 0, /* segment descriptor priority level */ @@ -1090,12 +1070,11 @@ init386(first) #ifdef SMP /* - * Oh puke! + * Spin these up now. init_secondary() grabs them. We could use + * #for(x,y,z) / #endfor cpp directives if they existed. */ for (x = 0; x < NCPU; x++) { - SMPcommon_tss_ptr[x] = &SMPcommon_tss[x]; gdt_segs[NGDT + x] = gdt_segs[GPROC0_SEL]; - gdt_segs[NGDT + x].ssd_base = (int) SMPcommon_tss_ptr[x]; ssdtosd(&gdt_segs[NGDT + x], &gdt[NGDT + x].sd); } #endif @@ -1301,6 +1280,11 @@ init386(first) Maxmem = idp->id_msize / 4; #endif +#ifdef SMP + /* look for the MP hardware - needed for apic addresses */ + mp_probe(); +#endif + /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); @@ -1436,40 +1420,18 @@ init386(first) avail_end + off, VM_PROT_ALL, TRUE); msgbufmapped = 1; -#ifdef SMP - /* look for the MP hardware */ - mp_probe(); - - /* make the initial tss so cpu can get interrupt stack on syscall! */ - for(x = 0; x < NCPU; x++) { - SMPcommon_tss[x].tss_esp0 = (int) proc0.p_addr + UPAGES*PAGE_SIZE; - SMPcommon_tss[x].tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; - SMPcommon_tss[x].tss_ioopt = (sizeof SMPcommon_tss[x]) << 16; - } -#if 0 - /** XXX FIXME: - * We can't access the LOCAL APIC till mp_enable() runs. Since - * this is run by the BSP, cpunumber() should always equal 0 anyway. - */ - gsel_tss = GSEL(NGDT + cpunumber(), SEL_KPL); -#else - gsel_tss = GSEL(NGDT /** + 0 */, SEL_KPL); -#endif /** 0 */ - ltr(gsel_tss); -#else /* make an initial tss so cpu can get interrupt stack on syscall! */ common_tss.tss_esp0 = (int) proc0.p_addr + UPAGES*PAGE_SIZE; common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; common_tss.tss_ioopt = (sizeof common_tss) << 16; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); -#endif /* SMP */ dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 = dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)]; dblfault_tss.tss_ss = dblfault_tss.tss_ss0 = dblfault_tss.tss_ss1 = dblfault_tss.tss_ss2 = GSEL(GDATA_SEL, SEL_KPL); - dblfault_tss.tss_cr3 = IdlePTD; + dblfault_tss.tss_cr3 = (int)IdlePTD; dblfault_tss.tss_eip = (int) dblfault_handler; dblfault_tss.tss_eflags = PSL_KERNEL; dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs = @@ -1503,14 +1465,8 @@ init386(first) /* setup proc 0's pcb */ proc0.p_addr->u_pcb.pcb_flags = 0; - proc0.p_addr->u_pcb.pcb_cr3 = IdlePTD; + proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; proc0.p_addr->u_pcb.pcb_mpnest = 1; - -#ifdef SMP -#if !defined(LATE_START) - mp_start(); /* fire up the APs and APICs */ -#endif /* LATE_START */ -#endif /* SMP */ } int diff --git a/sys/pc98/i386/microtime.s b/sys/pc98/i386/microtime.s index a853257af17a..cf9ee937c6df 100644 --- a/sys/pc98/i386/microtime.s +++ b/sys/pc98/i386/microtime.s @@ -32,14 +32,11 @@ * SUCH DAMAGE. * * from: Steve McCanne's microtime code - * $Id: microtime.s,v 1.9 1997/04/27 13:22:02 kato Exp $ + * $Id: microtime.s,v 1.10 1997/05/30 10:00:58 kato Exp $ */ #include "opt_cpu.h" -#ifdef APIC_IO -#include -#endif /* APIC_IO */ #include #include @@ -129,8 +126,7 @@ ENTRY(microtime) jbe 1f #if defined(APIC_IO) - movl _apic_base, %eax - movl APIC_IRR1(%eax), %eax /** XXX assumption: IRQ0-24 */ + movl lapic_irr1, %eax /** XXX assumption: IRQ0-24 */ testl %eax, _mask8254 /* is a hard timer interrupt pending? */ #else inb $IO_ICU1, %al /* read IRR in ICU */ diff --git a/sys/pc98/i386/trap.c b/sys/pc98/i386/trap.c index b62f24dc5388..88431745b7ce 100644 --- a/sys/pc98/i386/trap.c +++ b/sys/pc98/i386/trap.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)trap.c 7.4 (Berkeley) 5/13/91 - * $Id: trap.c,v 1.23 1997/06/02 15:45:32 kato Exp $ + * $Id: trap.c,v 1.24 1997/06/09 13:38:21 kato Exp $ */ /* @@ -87,11 +87,7 @@ #include "isa.h" #include "npx.h" -#ifdef SMP -extern struct i386tss *SMPcommon_tss_ptr[]; -#else extern struct i386tss common_tss; -#endif int (*pmath_emulate) __P((struct trapframe *)); @@ -754,7 +750,7 @@ trap_fatal(frame) type, trap_msg[type], ISPL(frame->tf_cs) == SEL_UPL ? "user" : "kernel"); #ifdef SMP - printf("cpunumber = %d\n", cpunumber()); + printf("cpuid = %d\n", cpuid); #endif if (type == T_PAGEFLT) { printf("fault virtual address = 0x%x\n", eva); @@ -840,19 +836,12 @@ trap_fatal(frame) void dblfault_handler() { -#ifdef SMP - int x = cpunumber(); -#endif - printf("\nFatal double fault:\n"); -#ifdef SMP - printf("eip = 0x%x\n", SMPcommon_tss_ptr[x]->tss_eip); - printf("esp = 0x%x\n", SMPcommon_tss_ptr[x]->tss_esp); - printf("ebp = 0x%x\n", SMPcommon_tss_ptr[x]->tss_ebp); -#else printf("eip = 0x%x\n", common_tss.tss_eip); printf("esp = 0x%x\n", common_tss.tss_esp); printf("ebp = 0x%x\n", common_tss.tss_ebp); +#ifdef SMP + printf("cpuid = %d\n", cpuid); #endif panic("double fault"); } diff --git a/sys/pc98/pc98/machdep.c b/sys/pc98/pc98/machdep.c index 67b8ae71ee6e..85d5ec1fbbfa 100644 --- a/sys/pc98/pc98/machdep.c +++ b/sys/pc98/pc98/machdep.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)machdep.c 7.4 (Berkeley) 6/3/91 - * $Id: machdep.c,v 1.44 1997/06/09 13:38:21 kato Exp $ + * $Id: machdep.c,v 1.45 1997/06/15 16:35:13 kato Exp $ */ #include "apm.h" @@ -229,12 +229,6 @@ cpu_startup(dummy) * Good {morning,afternoon,evening,night}. */ printf(version); -#ifdef SMP -#if defined(LATE_START) - mp_start(); /* fire up the APs and APICs */ -#endif /* LATE_START */ - mp_announce(); -#endif /* SMP */ earlysetcpuclass(); startrtclock(); printcpuinfo(); @@ -370,23 +364,6 @@ cpu_startup(dummy) u_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, (maxproc*UPAGES*PAGE_SIZE), FALSE); -#if defined(SMP) && defined(SMP_PRIVPAGES) - /* Per-cpu pages.. (the story so far is... subject to change) - * ========= For the per-cpu data page ======== - * 1 private data page - * 1 PDE (per-cpu PTD entry page) - * 1 PT (per-cpu page table page) - * ============ For the idle loop ============= - * 2 UPAGEs (per-cpu idle procs) - * 1 PTD (for per-cpu equiv of IdlePTD) - * ============================================ - * = total of 6 pages per cpu. The BSP reuses the ones allocated - * by locore.s during boot to remove special cases at runtime. - */ - ppage_map = kmem_suballoc(kernel_map, &minaddr, &maxaddr, - (NCPU*6*PAGE_SIZE), FALSE); -#endif - /* * Finally, allocate mbuf pool. Since mclrefcnt is an off-size * we use the more space efficient malloc in place of kmem_alloc. @@ -430,6 +407,14 @@ cpu_startup(dummy) printf("avail memory = %d (%dK bytes)\n", ptoa(cnt.v_free_count), ptoa(cnt.v_free_count) / 1024); +#ifdef SMP + /* + * OK, enough kmem_alloc/malloc state should be up, lets get on with it! + */ + mp_start(); /* fire up the APs and APICs */ + mp_announce(); +#endif /* SMP */ + /* * Set up buffers, so they can be used to read disk labels. */ @@ -815,8 +800,7 @@ struct region_descriptor r_gdt, r_idt; #endif #ifdef SMP -struct i386tss SMPcommon_tss[NCPU]; /* One tss per cpu */ -struct i386tss *SMPcommon_tss_ptr[NCPU]; /* for the benefit of asmp code */ +extern struct i386tss common_tss; /* One tss per cpu */ #else struct i386tss common_tss; #endif @@ -893,11 +877,7 @@ struct soft_segment_descriptor gdt_segs[ 0 /* limit granularity (byte/page units)*/ }, /* GPROC0_SEL 6 Proc 0 Tss Descriptor */ { -#ifdef SMP - (int) &SMPcommon_tss[0],/* segment base address */ -#else (int) &common_tss, /* segment base address */ -#endif sizeof(struct i386tss)-1,/* length - all address space */ SDT_SYS386TSS, /* segment type */ 0, /* segment descriptor priority level */ @@ -1090,12 +1070,11 @@ init386(first) #ifdef SMP /* - * Oh puke! + * Spin these up now. init_secondary() grabs them. We could use + * #for(x,y,z) / #endfor cpp directives if they existed. */ for (x = 0; x < NCPU; x++) { - SMPcommon_tss_ptr[x] = &SMPcommon_tss[x]; gdt_segs[NGDT + x] = gdt_segs[GPROC0_SEL]; - gdt_segs[NGDT + x].ssd_base = (int) SMPcommon_tss_ptr[x]; ssdtosd(&gdt_segs[NGDT + x], &gdt[NGDT + x].sd); } #endif @@ -1301,6 +1280,11 @@ init386(first) Maxmem = idp->id_msize / 4; #endif +#ifdef SMP + /* look for the MP hardware - needed for apic addresses */ + mp_probe(); +#endif + /* call pmap initialization to make new kernel address space */ pmap_bootstrap (first, 0); @@ -1436,40 +1420,18 @@ init386(first) avail_end + off, VM_PROT_ALL, TRUE); msgbufmapped = 1; -#ifdef SMP - /* look for the MP hardware */ - mp_probe(); - - /* make the initial tss so cpu can get interrupt stack on syscall! */ - for(x = 0; x < NCPU; x++) { - SMPcommon_tss[x].tss_esp0 = (int) proc0.p_addr + UPAGES*PAGE_SIZE; - SMPcommon_tss[x].tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; - SMPcommon_tss[x].tss_ioopt = (sizeof SMPcommon_tss[x]) << 16; - } -#if 0 - /** XXX FIXME: - * We can't access the LOCAL APIC till mp_enable() runs. Since - * this is run by the BSP, cpunumber() should always equal 0 anyway. - */ - gsel_tss = GSEL(NGDT + cpunumber(), SEL_KPL); -#else - gsel_tss = GSEL(NGDT /** + 0 */, SEL_KPL); -#endif /** 0 */ - ltr(gsel_tss); -#else /* make an initial tss so cpu can get interrupt stack on syscall! */ common_tss.tss_esp0 = (int) proc0.p_addr + UPAGES*PAGE_SIZE; common_tss.tss_ss0 = GSEL(GDATA_SEL, SEL_KPL) ; common_tss.tss_ioopt = (sizeof common_tss) << 16; gsel_tss = GSEL(GPROC0_SEL, SEL_KPL); ltr(gsel_tss); -#endif /* SMP */ dblfault_tss.tss_esp = dblfault_tss.tss_esp0 = dblfault_tss.tss_esp1 = dblfault_tss.tss_esp2 = (int) &dblfault_stack[sizeof(dblfault_stack)]; dblfault_tss.tss_ss = dblfault_tss.tss_ss0 = dblfault_tss.tss_ss1 = dblfault_tss.tss_ss2 = GSEL(GDATA_SEL, SEL_KPL); - dblfault_tss.tss_cr3 = IdlePTD; + dblfault_tss.tss_cr3 = (int)IdlePTD; dblfault_tss.tss_eip = (int) dblfault_handler; dblfault_tss.tss_eflags = PSL_KERNEL; dblfault_tss.tss_ds = dblfault_tss.tss_es = dblfault_tss.tss_fs = @@ -1503,14 +1465,8 @@ init386(first) /* setup proc 0's pcb */ proc0.p_addr->u_pcb.pcb_flags = 0; - proc0.p_addr->u_pcb.pcb_cr3 = IdlePTD; + proc0.p_addr->u_pcb.pcb_cr3 = (int)IdlePTD; proc0.p_addr->u_pcb.pcb_mpnest = 1; - -#ifdef SMP -#if !defined(LATE_START) - mp_start(); /* fire up the APs and APICs */ -#endif /* LATE_START */ -#endif /* SMP */ } int diff --git a/sys/pc98/pc98/npx.c b/sys/pc98/pc98/npx.c index 19282fd65ce3..450a29d46bc5 100644 --- a/sys/pc98/pc98/npx.c +++ b/sys/pc98/pc98/npx.c @@ -32,7 +32,7 @@ * SUCH DAMAGE. * * from: @(#)npx.c 7.2 (Berkeley) 5/12/91 - * $Id: npx.c,v 1.19 1997/05/31 12:43:17 kato Exp $ + * $Id: npx.c,v 1.20 1997/06/02 15:45:40 kato Exp $ */ #include "npx.h" @@ -63,6 +63,7 @@ #include #include #if defined(APIC_IO) +#include #include #include #endif /* APIC_IO */ @@ -144,10 +145,8 @@ SYSCTL_INT(_hw,HW_FLOATINGPT, floatingpoint, "Floatingpoint instructions executed in hardware"); static u_int npx0_imask = SWI_CLOCK_MASK; -#ifdef SMP -#define npxproc (SMPnpxproc[cpunumber()]) -struct proc *SMPnpxproc[NCPU]; -#else + +#ifndef SMP /* XXX per-cpu on smp */ struct proc *npxproc; #endif @@ -176,8 +175,8 @@ asm ss incl " __XSTRING(CNAME(npx_intrs_while_probing)) " pushl %eax - movl " __XSTRING(CNAME(apic_base)) ",%eax # EOI to local APIC - movl $0,0xb0(,%eax,1) # movl $0, APIC_EOI(%eax) + movl $lapic_eoi,%eax # EOI to local APIC + movl $0,(%eax) # movl $0, APIC_EOI(%eax) movb $0,%al #ifdef PC98 outb %al,$0xf8 # clear BUSY# latch