summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/acpi_machdep.c7
-rw-r--r--sys/arch/amd64/amd64/cpu.c12
-rw-r--r--sys/arch/amd64/amd64/ipifuncs.c8
-rw-r--r--sys/arch/amd64/amd64/mem.c13
-rw-r--r--sys/arch/amd64/amd64/mtrr.c9
-rw-r--r--sys/arch/amd64/conf/GENERIC3
-rw-r--r--sys/arch/amd64/conf/files.amd645
-rw-r--r--sys/arch/i386/conf/GENERIC4
-rw-r--r--sys/arch/i386/conf/files.i3866
-rw-r--r--sys/arch/i386/i386/acpi_machdep.c7
-rw-r--r--sys/arch/i386/i386/cpu.c11
-rw-r--r--sys/arch/i386/i386/ipifuncs.c7
-rw-r--r--sys/arch/i386/i386/mem.c12
-rw-r--r--sys/arch/i386/i386/mtrr.c9
-rw-r--r--sys/sys/memrange.h3
15 files changed, 56 insertions, 60 deletions
diff --git a/sys/arch/amd64/amd64/acpi_machdep.c b/sys/arch/amd64/amd64/acpi_machdep.c
index 8be34857637..5467d471aab 100644
--- a/sys/arch/amd64/amd64/acpi_machdep.c
+++ b/sys/arch/amd64/amd64/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.55 2013/07/01 10:08:08 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.56 2013/12/19 21:30:02 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -341,10 +341,13 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
void
acpi_resume_cpu(struct acpi_softc *sc)
{
+ fpuinit(&cpu_info_primary);
+
+ cpu_init(&cpu_info_primary);
+
/* Re-initialise memory range handling on BSP */
if (mem_range_softc.mr_op != NULL)
mem_range_softc.mr_op->initAP(&mem_range_softc);
- fpuinit(&cpu_info_primary);
}
#ifdef MULTIPROCESSOR
diff --git a/sys/arch/amd64/amd64/cpu.c b/sys/arch/amd64/amd64/cpu.c
index 530a21b7c3f..ee1a97f2cd9 100644
--- a/sys/arch/amd64/amd64/cpu.c
+++ b/sys/arch/amd64/amd64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.57 2013/10/05 16:58:30 guenther Exp $ */
+/* $OpenBSD: cpu.c,v 1.58 2013/12/19 21:30:02 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*-
@@ -474,6 +474,9 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
ci->ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
cpu_intr_init(ci);
identifycpu(ci);
+#ifdef MTRR
+ mem_range_attach();
+#endif /* MTRR */
cpu_init(ci);
break;
@@ -482,6 +485,9 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
ci->ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
cpu_intr_init(ci);
identifycpu(ci);
+#ifdef MTRR
+ mem_range_attach();
+#endif /* MTRR */
cpu_init(ci);
#if NLAPIC > 0
@@ -722,12 +728,12 @@ cpu_hatch(void *v)
lldt(0);
+ cpu_init(ci);
+
/* Re-initialise memory range handling on AP */
if (mem_range_softc.mr_op != NULL)
mem_range_softc.mr_op->initAP(&mem_range_softc);
- cpu_init(ci);
-
s = splhigh();
lcr8(0);
enable_intr();
diff --git a/sys/arch/amd64/amd64/ipifuncs.c b/sys/arch/amd64/amd64/ipifuncs.c
index 5bdb86f6943..a698ebaa05d 100644
--- a/sys/arch/amd64/amd64/ipifuncs.c
+++ b/sys/arch/amd64/amd64/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.20 2013/10/18 15:09:22 mlarkin Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.21 2013/12/19 21:30:02 deraadt Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1 2003/04/26 18:39:28 fvdl Exp $ */
/*-
@@ -36,8 +36,6 @@
* Interprocessor interrupt handlers.
*/
-#include "mtrr.h"
-
#include <sys/param.h>
#include <sys/device.h>
#include <sys/memrange.h>
@@ -67,7 +65,7 @@ void x86_64_ipi_halt_realmode(struct cpu_info *);
extern void hibernate_drop_to_real_mode(void);
#endif /* HIBERNATE */
-#if NMTRR > 0
+#ifdef MTRR
void x86_64_ipi_reload_mtrr(struct cpu_info *);
#else
#define x86_64_ipi_reload_mtrr NULL
@@ -128,7 +126,7 @@ x86_64_ipi_synch_fpu(struct cpu_info *ci)
fpusave_cpu(ci, 1);
}
-#if NMTRR > 0
+#ifdef MTRR
void
x86_64_ipi_reload_mtrr(struct cpu_info *ci)
{
diff --git a/sys/arch/amd64/amd64/mem.c b/sys/arch/amd64/amd64/mem.c
index 9a20c20c33f..3961bdef896 100644
--- a/sys/arch/amd64/amd64/mem.c
+++ b/sys/arch/amd64/amd64/mem.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mem.c,v 1.15 2010/12/26 15:40:59 miod Exp $ */
+/* $OpenBSD: mem.c,v 1.16 2013/12/19 21:30:02 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@@ -63,8 +63,6 @@
#include <uvm/uvm_extern.h>
-#include "mtrr.h"
-
caddr_t zeropage;
extern int start, end, etext;
@@ -81,7 +79,7 @@ extern int allowaperture;
#define BIOS_END 0xFFFFF
#endif
-#if NMTRR > 0
+#ifdef MTRR
struct mem_range_softc mem_range_softc;
int mem_ioctl(dev_t, u_long, caddr_t, int, struct proc *);
int mem_range_attr_get(struct mem_range_desc *, int *);
@@ -250,7 +248,7 @@ mmmmap(dev_t dev, off_t off, int prot)
int
mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
{
-#if NMTRR > 0
+#ifdef MTRR
switch (minor(dev)) {
case 0:
case 4:
@@ -260,7 +258,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (ENODEV);
}
-#if NMTRR > 0
+#ifdef MTRR
/*
* Operations for changing memory attributes.
*
@@ -346,4 +344,5 @@ mem_range_attr_set(struct mem_range_desc *mrd, int *arg)
return (mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg));
}
-#endif /* NMTRR > 0 */
+#endif /* MTRR */
+
diff --git a/sys/arch/amd64/amd64/mtrr.c b/sys/arch/amd64/amd64/mtrr.c
index 04cde53edc7..ff725aa1c33 100644
--- a/sys/arch/amd64/amd64/mtrr.c
+++ b/sys/arch/amd64/amd64/mtrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrr.c,v 1.3 2013/08/24 04:26:15 mlarkin Exp $ */
+/* $OpenBSD: mtrr.c,v 1.4 2013/12/19 21:30:02 deraadt Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* Copyright (c) 1999 Brian Fundakowski Feldman
@@ -35,16 +35,11 @@
extern struct mem_range_ops mrops;
-void mtrrattach(int);
-
void
-mtrrattach(int num)
+mem_range_attach(void)
{
int family, model, step;
- if (num > 1)
- return;
-
family = (cpu_id >> 8) & 0xf;
model = (cpu_id >> 4) & 0xf;
step = (cpu_id >> 0) & 0xf;
diff --git a/sys/arch/amd64/conf/GENERIC b/sys/arch/amd64/conf/GENERIC
index a0918411932..b42cd90411c 100644
--- a/sys/arch/amd64/conf/GENERIC
+++ b/sys/arch/amd64/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.353 2013/11/15 19:42:20 sasano Exp $
+# $OpenBSD: GENERIC,v 1.354 2013/12/19 21:30:02 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -596,7 +596,6 @@ owctr* at onewire? # Counter device
pseudo-device pctr 1
pseudo-device nvram 1
pseudo-device hotplug 1 # devices hot plugging
-pseudo-device mtrr 1 # Memory range attributes control
# mouse & keyboard multiplexor pseudo-devices
pseudo-device wsmux 2
diff --git a/sys/arch/amd64/conf/files.amd64 b/sys/arch/amd64/conf/files.amd64
index 0f50e3b4a47..f283f4c50fc 100644
--- a/sys/arch/amd64/conf/files.amd64
+++ b/sys/arch/amd64/conf/files.amd64
@@ -1,4 +1,4 @@
-# $OpenBSD: files.amd64,v 1.72 2013/12/12 21:04:50 kettenis Exp $
+# $OpenBSD: files.amd64,v 1.73 2013/12/19 21:30:02 deraadt Exp $
maxpartitions 16
maxusers 2 16 128
@@ -16,6 +16,7 @@ file arch/amd64/amd64/aesni.c crypto
file arch/amd64/amd64/amd64errata.c
file arch/amd64/amd64/mem.c
file arch/amd64/amd64/amd64_mem.c mtrr
+file arch/amd64/amd64/mtrr.c mtrr
file arch/amd64/amd64/pmap.c
file arch/amd64/amd64/process_machdep.c
file arch/amd64/amd64/sys_machdep.c
@@ -194,8 +195,6 @@ file dev/isa/fd.c fd needs-flag
pseudo-device pctr
file arch/amd64/amd64/pctr.c pctr needs-flag
-pseudo-device mtrr
-file arch/amd64/amd64/mtrr.c mtrr needs-flag
pseudo-device nvram
file arch/amd64/amd64/nvram.c nvram needs-flag
diff --git a/sys/arch/i386/conf/GENERIC b/sys/arch/i386/conf/GENERIC
index f82e559f111..7e87a0e94fe 100644
--- a/sys/arch/i386/conf/GENERIC
+++ b/sys/arch/i386/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.761 2013/11/15 19:42:20 sasano Exp $
+# $OpenBSD: GENERIC,v 1.762 2013/12/19 21:30:02 deraadt Exp $
#
# For further information on compiling OpenBSD kernels, see the config(8)
# man page.
@@ -19,6 +19,7 @@ option USER_PCICONF # user-space PCI configuration
option KVM86 # Kernel Virtual 8086 emulation
option USER_LDT # user-settable LDT; see i386_set_ldt(2)
option APERTURE # in-kernel aperture driver for XFree86
+option MTRR # CPU memory range attributes control
#option KGDB # Remote debugger support; exclusive of DDB
#option "KGDB_DEVNAME=\"com\"",KGDBADDR=0x2f8,KGDBRATE=9600
@@ -778,7 +779,6 @@ owtemp* at onewire? # Temperature
owctr* at onewire? # Counter device
pseudo-device pctr 1
-pseudo-device mtrr 1 # Memory range attributes control
pseudo-device nvram 1
pseudo-device hotplug 1 # devices hot plugging
diff --git a/sys/arch/i386/conf/files.i386 b/sys/arch/i386/conf/files.i386
index a75d57237bd..2f234fa0bc5 100644
--- a/sys/arch/i386/conf/files.i386
+++ b/sys/arch/i386/conf/files.i386
@@ -1,4 +1,4 @@
-# $OpenBSD: files.i386,v 1.215 2013/12/12 21:04:50 kettenis Exp $
+# $OpenBSD: files.i386,v 1.216 2013/12/19 21:30:02 deraadt Exp $
#
# new style config file for i386 architecture
#
@@ -29,6 +29,7 @@ file arch/i386/i386/longrun.c !small_kernel
file arch/i386/i386/mem.c
file arch/i386/i386/i686_mem.c mtrr
file arch/i386/i386/k6_mem.c mtrr
+file arch/i386/i386/mtrr.c mtrr
file arch/i386/i386/p4tcc.c !small_kernel
file arch/i386/i386/pmap.c
file arch/i386/i386/powernow.c !small_kernel
@@ -224,9 +225,6 @@ file arch/i386/isa/ahc_isa.c ahc_isa
pseudo-device pctr
file arch/i386/i386/pctr.c pctr needs-flag
-pseudo-device mtrr
-file arch/i386/i386/mtrr.c mtrr needs-flag
-
pseudo-device nvram
file arch/i386/i386/nvram.c nvram needs-flag
diff --git a/sys/arch/i386/i386/acpi_machdep.c b/sys/arch/i386/i386/acpi_machdep.c
index 3297a6822c6..e6c65befa40 100644
--- a/sys/arch/i386/i386/acpi_machdep.c
+++ b/sys/arch/i386/i386/acpi_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpi_machdep.c,v 1.49 2013/07/01 09:37:04 kettenis Exp $ */
+/* $OpenBSD: acpi_machdep.c,v 1.50 2013/12/19 21:30:02 deraadt Exp $ */
/*
* Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com>
*
@@ -366,10 +366,13 @@ acpi_sleep_cpu(struct acpi_softc *sc, int state)
void
acpi_resume_cpu(struct acpi_softc *sc)
{
+ npxinit(&cpu_info_primary);
+
+ cpu_init(&cpu_info_primary);
+
/* Re-initialise memory range handling on BSP */
if (mem_range_softc.mr_op != NULL)
mem_range_softc.mr_op->initAP(&mem_range_softc);
- npxinit(&cpu_info_primary);
}
#ifdef MULTIPROCESSOR
diff --git a/sys/arch/i386/i386/cpu.c b/sys/arch/i386/i386/cpu.c
index e3a4bd65d13..bfb026acc1f 100644
--- a/sys/arch/i386/i386/cpu.c
+++ b/sys/arch/i386/i386/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.51 2013/10/09 01:48:40 guenther Exp $ */
+/* $OpenBSD: cpu.c,v 1.52 2013/12/19 21:30:02 deraadt Exp $ */
/* $NetBSD: cpu.c,v 1.1.2.7 2000/06/26 02:04:05 sommerfeld Exp $ */
/*-
@@ -330,6 +330,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
printf("(uniprocessor)\n");
ci->ci_flags |= CPUF_PRESENT | CPUF_SP | CPUF_PRIMARY;
identifycpu(ci);
+ mem_range_attach();
cpu_init(ci);
break;
@@ -337,6 +338,7 @@ cpu_attach(struct device *parent, struct device *self, void *aux)
printf("apid %d (boot processor)\n", caa->cpu_number);
ci->ci_flags |= CPUF_PRESENT | CPUF_BSP | CPUF_PRIMARY;
identifycpu(ci);
+ mem_range_attach();
cpu_init(ci);
#if NLAPIC > 0
@@ -590,16 +592,17 @@ cpu_hatch(void *v)
lapic_set_lvt();
gdt_init_cpu(ci);
cpu_init_ldt(ci);
- npxinit(ci);
lldt(GSEL(GLDT_SEL, SEL_KPL));
+ npxinit(ci);
+
+ cpu_init(ci);
+
/* Re-initialise memory range handling on AP */
if (mem_range_softc.mr_op != NULL)
mem_range_softc.mr_op->initAP(&mem_range_softc);
- cpu_init(ci);
-
s = splhigh(); /* XXX prevent softints from running here.. */
lapic_tpr = 0;
enable_intr();
diff --git a/sys/arch/i386/i386/ipifuncs.c b/sys/arch/i386/i386/ipifuncs.c
index f3ba957a08e..5d7bc599431 100644
--- a/sys/arch/i386/i386/ipifuncs.c
+++ b/sys/arch/i386/i386/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.21 2013/03/20 21:23:05 kettenis Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.22 2013/12/19 21:30:02 deraadt Exp $ */
/* $NetBSD: ipifuncs.c,v 1.1.2.3 2000/06/26 02:04:06 sommerfeld Exp $ */
/*-
@@ -36,7 +36,6 @@
* Interprocessor interrupt handlers.
*/
-#include "mtrr.h"
#include "npx.h"
#include <sys/param.h>
@@ -64,7 +63,7 @@ void i386_ipi_flush_fpu(struct cpu_info *);
#define i386_ipi_flush_fpu NULL
#endif
-#if NMTRR > 0
+#ifdef MTRR
void i386_ipi_reload_mtrr(struct cpu_info *);
#else
#define i386_ipi_reload_mtrr 0
@@ -126,7 +125,7 @@ i386_ipi_synch_fpu(struct cpu_info *ci)
}
#endif
-#if NMTRR > 0
+#ifdef MTRR
void
i386_ipi_reload_mtrr(struct cpu_info *ci)
{
diff --git a/sys/arch/i386/i386/mem.c b/sys/arch/i386/i386/mem.c
index fb64e1ec472..50071b9a624 100644
--- a/sys/arch/i386/i386/mem.c
+++ b/sys/arch/i386/i386/mem.c
@@ -1,5 +1,5 @@
/* $NetBSD: mem.c,v 1.31 1996/05/03 19:42:19 christos Exp $ */
-/* $OpenBSD: mem.c,v 1.37 2010/12/26 15:40:59 miod Exp $ */
+/* $OpenBSD: mem.c,v 1.38 2013/12/19 21:30:02 deraadt Exp $ */
/*
* Copyright (c) 1988 University of Utah.
* Copyright (c) 1982, 1986, 1990, 1993
@@ -55,8 +55,6 @@
#include <uvm/uvm_extern.h>
-#include "mtrr.h"
-
extern char *vmmap; /* poor name! */
caddr_t zeropage;
@@ -69,7 +67,7 @@ extern int allowaperture;
#define BIOS_END 0xFFFFF
#endif
-#if NMTRR > 0
+#ifdef MTRR
struct mem_range_softc mem_range_softc;
static int mem_ioctl(dev_t, u_long, caddr_t, int, struct proc *);
#endif
@@ -250,7 +248,7 @@ mmmmap(dev_t dev, off_t off, int prot)
int
mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
{
-#if NMTRR > 0
+#ifdef MTRR
switch (minor(dev)) {
case 0:
case 4:
@@ -260,7 +258,7 @@ mmioctl(dev_t dev, u_long cmd, caddr_t data, int flags, struct proc *p)
return (ENODEV);
}
-#if NMTRR > 0
+#ifdef MTRR
/*
* Operations for changing memory attributes.
*
@@ -347,5 +345,5 @@ mem_range_attr_set(struct mem_range_desc *mrd, int *arg)
return (mem_range_softc.mr_op->set(&mem_range_softc, mrd, arg));
}
-#endif /* NMTRR > 0 */
+#endif /* MTRR */
diff --git a/sys/arch/i386/i386/mtrr.c b/sys/arch/i386/i386/mtrr.c
index 6da64026304..ebfa559c190 100644
--- a/sys/arch/i386/i386/mtrr.c
+++ b/sys/arch/i386/i386/mtrr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mtrr.c,v 1.12 2013/08/24 04:26:16 mlarkin Exp $ */
+/* $OpenBSD: mtrr.c,v 1.13 2013/12/19 21:30:02 deraadt Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* Copyright (c) 1999 Brian Fundakowski Feldman
@@ -36,16 +36,11 @@
extern struct mem_range_ops mrops;
extern struct mem_range_ops k6_mrops;
-void mtrrattach(int);
-
void
-mtrrattach(int num)
+mem_range_attach(void)
{
int family, model, step;
- if (num > 1)
- return;
-
family = (cpu_id >> 8) & 0xf;
model = (cpu_id >> 4) & 0xf;
step = (cpu_id >> 0) & 0xf;
diff --git a/sys/sys/memrange.h b/sys/sys/memrange.h
index 5d947efffd0..fc7c707361d 100644
--- a/sys/sys/memrange.h
+++ b/sys/sys/memrange.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: memrange.h,v 1.7 2013/08/24 04:26:16 mlarkin Exp $ */
+/* $OpenBSD: memrange.h,v 1.8 2013/12/19 21:30:02 deraadt Exp $ */
/*-
* Copyright (c) 1999 Michael Smith <msmith@freebsd.org>
* All rights reserved.
@@ -84,6 +84,7 @@ struct mem_range_softc {
extern struct mem_range_softc mem_range_softc;
__BEGIN_DECLS
+extern void mem_range_attach(void);
extern int mem_range_attr_get(struct mem_range_desc *mrd, int *arg);
extern int mem_range_attr_set(struct mem_range_desc *mrd, int *arg);
extern void mem_range_AP_init(void);