From 67ea948043ecb2abd5a9c940bf630f94b262a031 Mon Sep 17 00:00:00 2001 From: Jason Wright Date: Wed, 27 Mar 2002 15:12:23 +0000 Subject: Need APERTURE so we can read/write pci configuration with securelevel > 0 --- sys/arch/sparc64/conf/GENERIC | 3 ++- sys/arch/sparc64/include/cpu.h | 6 ++++-- sys/arch/sparc64/sparc64/machdep.c | 21 ++++++++++++++++++++- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/sys/arch/sparc64/conf/GENERIC b/sys/arch/sparc64/conf/GENERIC index f9ca4a0a6a8..dcca8ff87cb 100644 --- a/sys/arch/sparc64/conf/GENERIC +++ b/sys/arch/sparc64/conf/GENERIC @@ -1,4 +1,4 @@ -# $OpenBSD: GENERIC,v 1.54 2002/03/20 18:58:13 jason Exp $ +# $OpenBSD: GENERIC,v 1.55 2002/03/27 15:12:22 jason Exp $ # $NetBSD: GENERIC32,v 1.18 2001/07/20 00:07:12 eeh Exp $ machine sparc64 @@ -10,6 +10,7 @@ option _LP64 option PCIVERBOSE option USER_PCICONF # user-space PCI configuration +option APERTURE maxusers 64 diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h index c9df2248502..05847ed1de6 100644 --- a/sys/arch/sparc64/include/cpu.h +++ b/sys/arch/sparc64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.9 2002/03/14 03:16:00 millert Exp $ */ +/* $OpenBSD: cpu.h,v 1.10 2002/03/27 15:12:22 jason Exp $ */ /* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */ /* @@ -53,12 +53,14 @@ */ #define CPU_BOOTED_KERNEL 1 /* string: booted kernel name */ #define CPU_LED_BLINK 2 /* int: blink leds? */ -#define CPU_MAXID 3 /* number of valid machdep ids */ +#define CPU_ALLOWAPERTURE 3 /* allow xf86 operations */ +#define CPU_MAXID 4 /* number of valid machdep ids */ #define CTL_MACHDEP_NAMES { \ { 0, 0 }, \ { "booted_kernel", CTLTYPE_STRING }, \ { "led_blink", CTLTYPE_INT }, \ + { "allowaperture", CTLTYPE_INT }, \ } #ifdef _KERNEL diff --git a/sys/arch/sparc64/sparc64/machdep.c b/sys/arch/sparc64/sparc64/machdep.c index ae6a28e500b..fd97bc20753 100644 --- a/sys/arch/sparc64/sparc64/machdep.c +++ b/sys/arch/sparc64/sparc64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.40 2002/03/23 13:28:34 espie Exp $ */ +/* $OpenBSD: machdep.c,v 1.41 2002/03/27 15:12:22 jason Exp $ */ /* $NetBSD: machdep.c,v 1.108 2001/07/24 19:30:14 eeh Exp $ */ /*- @@ -171,6 +171,14 @@ extern caddr_t msgbufaddr; int sparc_led_blink; #endif +#ifdef APERTURE +#ifdef INSECURE +int allowaperture = 1; +#else +int allowaperture = 0; +#endif +#endif + /* * Maximum number of DMA segments we'll allow in dmamem_load() * routines. Can be overridden in config files, etc. @@ -592,6 +600,17 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p) return (ret); #else return (EOPNOTSUPP); +#endif + case CPU_ALLOWAPERTURE: +#ifdef APERTURE + if (securelevel > 0) + return (sysctl_rdint(oldp, oldlenp, newp, + allowaperture)); + else + return (sysctl_int(oldp, oldlenp, newp, newlen, + &allowaperture)); +#else + return (sysctl_rdint(oldp, oldlenp, newp, 0)); #endif default: return (EOPNOTSUPP); -- cgit v1.2.3