Add support for machdep.console_device, machdep.booted_device,

and machdep.booted_kernel sysctl variables on arm32.  (booted_kernel
only currently available on Sharks)
This commit is contained in:
matt 2000-06-07 04:59:28 +00:00
parent a98dd470c6
commit d3649351f1
3 changed files with 53 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.78 2000/05/26 21:19:31 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.79 2000/06/07 04:59:28 matt Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@ -57,6 +57,7 @@
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/msgbuf.h>
#include <sys/device.h>
#include <vm/vm.h>
#include <sys/sysctl.h>
#include <sys/syscallargs.h>
@ -142,6 +143,10 @@ extern void dumpsys __P((void));
extern void pmap_debug __P((int level));
#endif /* PMAP_DEBUG */
#if defined(SHARK)
int shark_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen, struct proc *p);
#endif
/*
* Debug function just to park the CPU
*/
@ -773,6 +778,31 @@ cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
case CPU_DEBUG:
return(sysctl_int(oldp, oldlenp, newp, newlen, &kernel_debug));
case CPU_BOOTED_DEVICE:
if (booted_device != NULL)
return (sysctl_rdstring(oldp, oldlenp, newp,
booted_device->dv_xname));
return (EOPNOTSUPP);
case CPU_CONSDEV: {
dev_t consdev;
if (cn_tab != NULL)
consdev = cn_tab->cn_dev;
else
consdev = NODEV;
return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
sizeof consdev));
}
#if defined(SHARK)
case CPU_BOOTED_KERNEL: {
extern char *boot_kernel;
if (boot_kernel != NULL && boot_kernel[0] != '\0')
return sysctl_rdstring(oldp, oldlenp, newp,
boot_kernel);
return (EOPNOTSUPP);
}
#endif
default:
return (EOPNOTSUPP);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.20 2000/05/26 21:19:32 thorpej Exp $ */
/* $NetBSD: cpu.h,v 1.21 2000/06/07 04:59:29 matt Exp $ */
/*
* Copyright (c) 1994-1996 Mark Brinicombe.
@ -283,11 +283,17 @@ void child_return __P((void *));
* CTL_MACHDEP definitions.
*/
#define CPU_DEBUG 1 /* int: misc kernel debug control */
#define CPU_MAXID 2 /* number of valid machdep ids */
#define CPU_BOOTED_DEVICE 2 /* string: device we booted from */
#define CPU_BOOTED_KERNEL 3 /* string: kernel we booted */
#define CPU_CONSDEV 4 /* struct: dev_t of our console */
#define CPU_MAXID 5 /* number of valid machdep ids */
#define CTL_MACHDEP_NAMES { \
{ 0, 0 }, \
{ "debug", CTLTYPE_INT }, \
{ "booted_device", CTLTYPE_STRING }, \
{ "booted_kernel", CTLTYPE_STRING }, \
{ "console_device", CTLTYPE_STRUCT }, \
}
#endif /* !_ARM32_CPU_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: shark_machdep.c,v 1.16 2000/06/06 20:17:36 matt Exp $ */
/* $NetBSD: shark_machdep.c,v 1.17 2000/06/07 04:59:30 matt Exp $ */
/*
* Copyright 1997
@ -119,6 +119,7 @@ void ofbus_attach __P((struct device *, struct device *, void *));
BootConfig bootconfig;
char *boot_args = NULL;
char *boot_file = NULL;
char *boot_kernel = NULL;
#ifndef PMAP_STATIC_L1S
int max_processes = 64; /* Default number */
#endif /* !PMAP_STATIC_L1S */
@ -398,8 +399,19 @@ ofw_device_register(struct device *dev, void *aux)
char name[64];
int i;
if (boot_component == NULL)
if (boot_component == NULL) {
char *cp;
boot_component = boot_file;
if (boot_component == NULL)
return;
cp = strrchr(boot_component, ':');
if (cp != NULL) {
*cp++ = '\0';
if (cp[0] == '\\')
cp++;
boot_kernel = cp;
}
}
if (booted_device != NULL
|| boot_component == NULL