diff options
| author | Mike Smith <msmith@FreeBSD.org> | 1999-09-02 23:57:04 +0000 |
|---|---|---|
| committer | Mike Smith <msmith@FreeBSD.org> | 1999-09-02 23:57:04 +0000 |
| commit | 98548f56e6b22ce4de3e6c15b3478659f57e046f (patch) | |
| tree | bcba698cc5dafe4600a71e22b22d3da4c7acbfae | |
| parent | 39ef10c47210522d96b39fb2886807ff27f64af4 (diff) | |
Notes
| -rw-r--r-- | sys/i386/i386/mp_machdep.c | 24 | ||||
| -rw-r--r-- | sys/i386/i386/pmap.c | 95 | ||||
| -rw-r--r-- | sys/i386/isa/apic_vector.s | 2 | ||||
| -rw-r--r-- | sys/i386/isa/intr_machdep.h | 3 | ||||
| -rw-r--r-- | sys/pci/pcisupport.c | 26 |
5 files changed, 18 insertions, 132 deletions
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c index c135d8afd2c3..a688c3e8cb13 100644 --- a/sys/i386/i386/mp_machdep.c +++ b/sys/i386/i386/mp_machdep.c @@ -39,6 +39,8 @@ #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> +#include <sys/malloc.h> +#include <sys/memrange.h> #include <sys/proc.h> #include <sys/sysctl.h> #ifdef BETTER_CLOCK @@ -61,7 +63,10 @@ #include <machine/smp.h> #include <machine/apic.h> +#include <machine/atomic.h> +#include <machine/cpufunc.h> #include <machine/mpapic.h> +#include <machine/psl.h> #include <machine/segments.h> #include <machine/smptests.h> /** TEST_DEFAULT_CONFIG, TEST_TEST1 */ #include <machine/tss.h> @@ -496,9 +501,6 @@ init_secondary(void) PTD[0] = 0; pmap_set_opt((unsigned *)PTD); - putmtrr(); - pmap_setvidram(); - invltlb(); } @@ -556,9 +558,6 @@ mp_enable(u_int boot_addr) u_int ux; #endif /* APIC_IO */ - getmtrr(); - pmap_setvidram(); - POSTCODE(MP_ENABLE_POST); /* turn on 4MB of V == P addressing so we can get to MP table */ @@ -605,6 +604,10 @@ mp_enable(u_int boot_addr) setidt(XCPUCHECKSTATE_OFFSET, Xcpucheckstate, SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); #endif + + /* install an inter-CPU IPI for all-CPU rendezvous */ + setidt(XRENDEZVOUS_OFFSET, Xrendezvous, + SDT_SYS386IGT, SEL_KPL, GSEL(GCODE_SEL, SEL_KPL)); /* install an inter-CPU IPI for forcing an additional software trap */ setidt(XCPUAST_OFFSET, Xcpuast, @@ -1723,6 +1726,9 @@ struct simplelock com_lock; struct simplelock clock_lock; #endif /* USE_CLOCKLOCK */ +/* lock around the MP rendezvous */ +static struct simplelock smp_rv_lock; + static void init_locks(void) { @@ -1747,6 +1753,7 @@ init_locks(void) s_lock_init((struct simplelock*)&intr_lock); s_lock_init((struct simplelock*)&imen_lock); s_lock_init((struct simplelock*)&cpl_lock); + s_lock_init(&smp_rv_lock); #ifdef USE_COMLOCK s_lock_init((struct simplelock*)&com_lock); @@ -2243,11 +2250,12 @@ ap_init() panic("cpuid mismatch! boom!!"); } - getmtrr(); - /* Init local apic for irq's */ apic_initialize(); + /* Set memory range attributes for this CPU to match the BSP */ + mem_range_AP_init(); + /* * Activate smp_invltlb, although strictly speaking, this isn't * quite correct yet. We should have a bitfield for cpus willing diff --git a/sys/i386/i386/pmap.c b/sys/i386/i386/pmap.c index 0af45f300add..c3ae6b4dd534 100644 --- a/sys/i386/i386/pmap.c +++ b/sys/i386/i386/pmap.c @@ -184,11 +184,6 @@ static caddr_t CADDR2; static pt_entry_t *msgbufmap; struct msgbuf *msgbufp=0; -/* - * PPro_vmtrr - */ -struct ppro_vmtrr PPro_vmtrr[NPPROVMTRR]; - /* AIO support */ extern struct vmspace *aiovmspace; @@ -464,96 +459,6 @@ pmap_bootstrap(firstaddr, loadaddr) } -void -getmtrr() -{ - int i; - - if (cpu_class == CPUCLASS_686) { - for(i = 0; i < NPPROVMTRR; i++) { - PPro_vmtrr[i].base = rdmsr(PPRO_VMTRRphysBase0 + i * 2); - PPro_vmtrr[i].mask = rdmsr(PPRO_VMTRRphysMask0 + i * 2); - } - } -} - -void -putmtrr() -{ - int i; - - if (cpu_class == CPUCLASS_686) { - wbinvd(); - for(i = 0; i < NPPROVMTRR; i++) { - wrmsr(PPRO_VMTRRphysBase0 + i * 2, PPro_vmtrr[i].base); - wrmsr(PPRO_VMTRRphysMask0 + i * 2, PPro_vmtrr[i].mask); - } - } -} - -void -pmap_setvidram(void) -{ -#if 0 - if (cpu_class == CPUCLASS_686) { - wbinvd(); - /* - * Set memory between 0-640K to be WB - */ - wrmsr(0x250, 0x0606060606060606LL); - wrmsr(0x258, 0x0606060606060606LL); - /* - * Set normal, PC video memory to be WC - */ - wrmsr(0x259, 0x0101010101010101LL); - } -#endif -} - -void -pmap_setdevram(unsigned long long basea, vm_offset_t sizea) -{ - int i, free, skip; - unsigned basepage, basepaget; - unsigned long long base; - unsigned long long mask; - - if (cpu_class != CPUCLASS_686) - return; - - free = -1; - skip = 0; - basea &= ~0xfff; - base = basea | 0x1; - mask = (long long) (0xfffffffffLL - ((long) sizea - 1)) | (long long) 0x800; - mask &= ~0x7ff; - - basepage = (long long) (base >> 12); - for(i = 0; i < NPPROVMTRR; i++) { - PPro_vmtrr[i].base = rdmsr(PPRO_VMTRRphysBase0 + i * 2); - PPro_vmtrr[i].mask = rdmsr(PPRO_VMTRRphysMask0 + i * 2); - basepaget = (long long) (PPro_vmtrr[i].base >> 12); - if (basepage == basepaget) - skip = 1; - if ((PPro_vmtrr[i].mask & 0x800) == 0) { - if (free == -1) - free = i; - } - } - - if (!skip && free != -1) { - wbinvd(); - PPro_vmtrr[free].base = base; - PPro_vmtrr[free].mask = mask; - wrmsr(PPRO_VMTRRphysBase0 + free * 2, base); - wrmsr(PPRO_VMTRRphysMask0 + free * 2, mask); - printf( - "pmap: added WC mapping at page: 0x%x %x, size: %u mask: 0x%x %x\n", - (u_int)(base >> 32), (u_int)base, sizea, - (u_int)(mask >> 32), (u_int)mask); - } -} - /* * Set 4mb pdir for mp startup, and global flags */ diff --git a/sys/i386/isa/apic_vector.s b/sys/i386/isa/apic_vector.s index 609cce032c08..63a44fd1f6b3 100644 --- a/sys/i386/isa/apic_vector.s +++ b/sys/i386/isa/apic_vector.s @@ -924,8 +924,6 @@ _Xrendezvous: movl $KDSEL, %eax movl %ax, %ds /* use KERNEL data segment */ movl %ax, %es - movl $KPSEL, %eax - movl %ax, %fs call smp_rendezvous_action diff --git a/sys/i386/isa/intr_machdep.h b/sys/i386/isa/intr_machdep.h index dfaa0ab10e4b..e8f542e095a3 100644 --- a/sys/i386/isa/intr_machdep.h +++ b/sys/i386/isa/intr_machdep.h @@ -182,7 +182,8 @@ inthand_t Xcpuast, /* Additional software trap on other cpu */ Xforward_irq, /* Forward irq to cpu holding ISR lock */ Xcpustop, /* CPU stops & waits for another CPU to restart it */ - Xspuriousint; /* handle APIC "spurious INTs" */ + Xspuriousint, /* handle APIC "spurious INTs" */ + Xrendezvous; /* handle CPU rendezvous */ #ifdef TEST_TEST1 inthand_t diff --git a/sys/pci/pcisupport.c b/sys/pci/pcisupport.c index f4be9f7b7c56..8d3317ccec09 100644 --- a/sys/pci/pcisupport.c +++ b/sys/pci/pcisupport.c @@ -1223,37 +1223,11 @@ static const char* vga_probe (pcici_t tag, pcidi_t typea) if (vendor && chip) { char *buf; int len; -#if 0 - int i; - int reqmapmem; -#endif if (type == 0) { type = "SVGA controller"; } -#if 0 - reqmapmem = PCI_MAPMEM; - for (i = 0; i < tag->nummaps; i++) { - pcimap *m = &tag->map[i]; - if (m->type & PCI_MAPMEMP) - reqmapmem |= PCI_MAPMEMP; - } - - for (i = 0; i < tag->nummaps; i++) { - unsigned mapaddr; - pcimap *m = &tag->map[i]; - mapaddr = (m->base >> 12); - if (m->type == reqmapmem) { - pmap_setdevram(m->base, (1 << m->ln2size)); - } - } -#endif - -#ifdef __i386__ - pmap_setvidram(); -#endif - len = strlen(vendor) + strlen(chip) + strlen(type) + 4; MALLOC(buf, char *, len, M_TEMP, M_NOWAIT); if (buf) |
