de-duplication police arrests sysctl.
This commit is contained in:
parent
e62494976f
commit
37ddcb991e
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.193 2013/04/02 13:28:41 taca Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.194 2013/04/12 16:59:40 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
|
||||
@ -111,7 +111,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.193 2013/04/02 13:28:41 taca Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.194 2013/04/12 16:59:40 christos Exp $");
|
||||
|
||||
/* #define XENDEBUG_LOW */
|
||||
|
||||
@ -515,65 +515,10 @@ cpu_init_tss(struct cpu_info *ci)
|
||||
ci->ci_tss_sel = tss_alloc(tss);
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
static int
|
||||
sysctl_machdep_booted_kernel(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct btinfo_bootpath *bibp;
|
||||
struct sysctlnode node;
|
||||
|
||||
bibp = lookup_bootinfo(BTINFO_BOOTPATH);
|
||||
if(!bibp)
|
||||
return(ENOENT); /* ??? */
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = bibp->bootpath;
|
||||
node.sysctl_size = sizeof(bibp->bootpath);
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct sysctlnode node;
|
||||
|
||||
if (x86_alldisks == NULL)
|
||||
return (ENOENT);
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = x86_alldisks;
|
||||
node.sysctl_size = sizeof(struct disklist) +
|
||||
(x86_ndisks - 1) * sizeof(struct nativedisk_info);
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
||||
{
|
||||
extern uint64_t tsc_freq;
|
||||
x86_sysctl_machdep_setup(clog);
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_NODE, "machdep", NULL,
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_MACHDEP, CTL_EOL);
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "console_device", NULL,
|
||||
sysctl_consdev, 0, NULL, sizeof(dev_t),
|
||||
CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRING, "booted_kernel", NULL,
|
||||
sysctl_machdep_booted_kernel, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "diskinfo", NULL,
|
||||
sysctl_machdep_diskinfo, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT | CTLFLAG_IMMEDIATE,
|
||||
CTLTYPE_INT, "fpu_present", NULL,
|
||||
@ -589,25 +534,6 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
||||
CTLTYPE_INT, "sse2", NULL,
|
||||
NULL, 1, NULL, 0,
|
||||
CTL_MACHDEP, CPU_SSE2, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_QUAD, "tsc_freq", NULL,
|
||||
NULL, 0, &tsc_freq, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "pae",
|
||||
SYSCTL_DESCR("Whether the kernel uses PAE"),
|
||||
NULL, 0, &use_pae, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
#ifndef NO_SPARSE_DUMP
|
||||
/* XXXjld Does this really belong under machdep, and not e.g. kern? */
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||
CTLTYPE_INT, "sparse_dump", NULL,
|
||||
NULL, 0, &sparse_dump, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.c,v 1.733 2012/10/03 18:58:32 dsl Exp $ */
|
||||
/* $NetBSD: machdep.c,v 1.734 2013/04/12 16:59:38 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
|
||||
@ -67,7 +67,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.733 2012/10/03 18:58:32 dsl Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.734 2013/04/12 16:59:38 christos Exp $");
|
||||
|
||||
#include "opt_beep.h"
|
||||
#include "opt_compat_ibcs2.h"
|
||||
@ -590,60 +590,13 @@ cpu_init_tss(struct cpu_info *ci)
|
||||
}
|
||||
#endif /* XEN */
|
||||
|
||||
/*
|
||||
* sysctl helper routine for machdep.booted_kernel
|
||||
*/
|
||||
static int
|
||||
sysctl_machdep_booted_kernel(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct btinfo_bootpath *bibp;
|
||||
struct sysctlnode node;
|
||||
|
||||
bibp = lookup_bootinfo(BTINFO_BOOTPATH);
|
||||
if(!bibp)
|
||||
return(ENOENT); /* ??? */
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = bibp->bootpath;
|
||||
node.sysctl_size = sizeof(bibp->bootpath);
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
/*
|
||||
* sysctl helper routine for machdep.diskinfo
|
||||
*/
|
||||
static int
|
||||
sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct sysctlnode node;
|
||||
|
||||
node = *rnode;
|
||||
if (x86_alldisks == NULL)
|
||||
return(EOPNOTSUPP);
|
||||
node.sysctl_data = x86_alldisks;
|
||||
node.sysctl_size = sizeof(struct disklist) +
|
||||
(x86_ndisks - 1) * sizeof(struct nativedisk_info);
|
||||
return (sysctl_lookup(SYSCTLFN_CALL(&node)));
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
||||
{
|
||||
extern uint64_t tsc_freq;
|
||||
x86_sysctl_machdep_setup(clog);
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_NODE, "machdep", NULL,
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_MACHDEP, CTL_EOL);
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "console_device", NULL,
|
||||
sysctl_consdev, 0, NULL, sizeof(dev_t),
|
||||
CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
|
||||
#ifndef XEN
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
@ -658,24 +611,14 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
||||
#endif /* XEN */
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRING, "booted_kernel", NULL,
|
||||
sysctl_machdep_booted_kernel, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "diskinfo", NULL,
|
||||
sysctl_machdep_diskinfo, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
|
||||
CTLTYPE_INT, "osfxsr", NULL,
|
||||
NULL, 0, &i386_use_fxsave, 0,
|
||||
CTL_MACHDEP, CPU_OSFXSR, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "fpu_present", NULL,
|
||||
NULL, 0, &i386_fpu_present, 0,
|
||||
CTL_MACHDEP, CPU_FPU_PRESENT, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "osfxsr", NULL,
|
||||
NULL, 0, &i386_use_fxsave, 0,
|
||||
CTL_MACHDEP, CPU_OSFXSR, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "sse", NULL,
|
||||
@ -686,27 +629,6 @@ SYSCTL_SETUP(sysctl_machdep_setup, "sysctl machdep subtree setup")
|
||||
CTLTYPE_INT, "sse2", NULL,
|
||||
NULL, 0, &i386_has_sse2, 0,
|
||||
CTL_MACHDEP, CPU_SSE2, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRING, "cpu_brand", NULL,
|
||||
NULL, 0, cpu_brand_string, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||
CTLTYPE_INT, "sparse_dump", NULL,
|
||||
NULL, 0, &sparse_dump, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_QUAD, "tsc_freq", NULL,
|
||||
NULL, 0, &tsc_freq, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "pae",
|
||||
SYSCTL_DESCR("Whether the kernel uses PAE"),
|
||||
NULL, 0, &use_pae, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: machdep.h,v 1.5 2010/10/21 11:17:54 yamt Exp $ */
|
||||
/* $NetBSD: machdep.h,v 1.6 2013/04/12 16:59:41 christos Exp $ */
|
||||
/*
|
||||
* Copyright (c) 2000, 2007 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -33,6 +33,7 @@ extern int mem_cluster_cnt;
|
||||
|
||||
struct btinfo_memmap;
|
||||
struct extent;
|
||||
struct sysctllog;
|
||||
|
||||
void x86_cpu_idle_init(void);
|
||||
void x86_cpu_idle_get(void (**)(void), char *, size_t);
|
||||
@ -43,5 +44,6 @@ int initx86_fake_memmap(struct extent *);
|
||||
int initx86_load_memmap(paddr_t first_avail);
|
||||
|
||||
void x86_startup(void);
|
||||
void x86_sysctl_machdep_setup(struct sysctllog **);
|
||||
|
||||
#endif /* _X86_MACHDEP_H_ */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: x86_machdep.c,v 1.57 2011/11/28 07:56:54 tls Exp $ */
|
||||
/* $NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.57 2011/11/28 07:56:54 tls Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.58 2013/04/12 16:59:40 christos Exp $");
|
||||
|
||||
#include "opt_modular.h"
|
||||
#include "opt_physmem.h"
|
||||
@ -1007,3 +1007,88 @@ x86_startup(void)
|
||||
nmi_init();
|
||||
#endif /* !defined(XEN) */
|
||||
}
|
||||
|
||||
/*
|
||||
* machine dependent system variables.
|
||||
*/
|
||||
static int
|
||||
sysctl_machdep_booted_kernel(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct btinfo_bootpath *bibp;
|
||||
struct sysctlnode node;
|
||||
|
||||
bibp = lookup_bootinfo(BTINFO_BOOTPATH);
|
||||
if(!bibp)
|
||||
return ENOENT; /* ??? */
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = bibp->bootpath;
|
||||
node.sysctl_size = sizeof(bibp->bootpath);
|
||||
return sysctl_lookup(SYSCTLFN_CALL(&node));
|
||||
}
|
||||
|
||||
static int
|
||||
sysctl_machdep_diskinfo(SYSCTLFN_ARGS)
|
||||
{
|
||||
struct sysctlnode node;
|
||||
extern struct bi_devmatch *x86_alldisks;
|
||||
extern int x86_ndisks;
|
||||
|
||||
if (x86_alldisks == NULL)
|
||||
return EOPNOTSUPP;
|
||||
|
||||
node = *rnode;
|
||||
node.sysctl_data = x86_alldisks;
|
||||
node.sysctl_size = sizeof(struct disklist) +
|
||||
(x86_ndisks - 1) * sizeof(struct nativedisk_info);
|
||||
return sysctl_lookup(SYSCTLFN_CALL(&node));
|
||||
}
|
||||
|
||||
void
|
||||
x86_sysctl_machdep_setup(struct sysctllog **clog) {
|
||||
extern uint64_t tsc_freq;
|
||||
extern int sparse_dump;
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_NODE, "machdep", NULL,
|
||||
NULL, 0, NULL, 0,
|
||||
CTL_MACHDEP, CTL_EOL);
|
||||
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "console_device", NULL,
|
||||
sysctl_consdev, 0, NULL, sizeof(dev_t),
|
||||
CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRING, "booted_kernel", NULL,
|
||||
sysctl_machdep_booted_kernel, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_BOOTED_KERNEL, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRUCT, "diskinfo", NULL,
|
||||
sysctl_machdep_diskinfo, 0, NULL, 0,
|
||||
CTL_MACHDEP, CPU_DISKINFO, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_STRING, "cpu_brand", NULL,
|
||||
NULL, 0, cpu_brand_string, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
|
||||
CTLTYPE_INT, "sparse_dump", NULL,
|
||||
NULL, 0, &sparse_dump, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_QUAD, "tsc_freq", NULL,
|
||||
NULL, 0, &tsc_freq, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
sysctl_createv(clog, 0, NULL, NULL,
|
||||
CTLFLAG_PERMANENT,
|
||||
CTLTYPE_INT, "pae",
|
||||
SYSCTL_DESCR("Whether the kernel uses PAE"),
|
||||
NULL, 0, &use_pae, 0,
|
||||
CTL_MACHDEP, CTL_CREATE, CTL_EOL);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user