Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.

For now, only pmax implements CPU_BOOTED_KERNEL.  Need to revisit.
This commit is contained in:
gmcgarry 2002-08-04 01:41:23 +00:00
parent 26945b2c8b
commit 3647e0d293
10 changed files with 95 additions and 244 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.14 2001/11/22 03:08:01 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.15 2002/08/04 01:41:31 gmcgarry Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -98,7 +98,6 @@
#include <sys/kcore.h>
#include <sys/boot_flag.h>
#include <sys/termios.h>
#include <sys/sysctl.h>
#include <net/if.h>
#include <net/if_ether.h>
@ -152,9 +151,7 @@ struct p6032_config p6032_configuration;
#endif
/* The following are used externally (sysctl_hw). */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
char cpu_model[64];
extern char cpu_model[];
struct user *proc0paddr;
@ -709,33 +706,6 @@ cpu_startup(void)
bufinit();
}
/*
* Machine-dependent system variables.
*/
int
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
void *newp, size_t newlen, struct proc *p)
{
dev_t consdev;
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
switch (name[0]) {
case CPU_CONSDEV:
if (cn_tab != NULL)
consdev = cn_tab->cn_dev;
else
consdev = NODEV;
return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
sizeof consdev));
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
int waittime = -1;
struct user dumppcb; /* Actually, struct pcb would do. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.4 2002/07/12 00:40:00 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.5 2002/08/04 01:41:31 gmcgarry Exp $ */
/*
* Copyright 2001, 2002 Wasabi Systems, Inc.
@ -89,7 +89,6 @@
#include <sys/mount.h>
#include <sys/kcore.h>
#include <sys/boot_flag.h>
#include <sys/sysctl.h>
#include <sys/termios.h>
#include <uvm/uvm_extern.h>
@ -122,10 +121,8 @@ int comcnrate = 38400; /* XXX should be config option */
struct malta_config malta_configuration;
/* For sysctl. */
char machine[] = MACHINE;
char machine_arch[] = MACHINE_ARCH;
char cpu_model[] = "MIPS Malta Evaluation Board";
/* For sysctl_hw. */
exterm char cpu_model[];
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;
@ -235,6 +232,8 @@ mach_init(int argc, char **argv, yamon_env_var *envp, u_long memsize)
mem_clusters[0].size = ctob(physmem);
mem_cluster_cnt = 1;
strcpy(cpu_model, "MIPS Malta Evaluation Board");
/*
* XXX: check argv[0] - do something if "gdb"???
*/
@ -416,26 +415,6 @@ cpu_startup()
bufinit();
}
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return ENOTDIR;
switch (name[0]) {
default:
return EOPNOTSUPP;
}
}
int waittime = -1;
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.74 2002/04/27 23:24:55 shin Exp $ */
/* $NetBSD: machdep.c,v 1.75 2002/08/04 01:41:23 gmcgarry Exp $ */
/*-
* Copyright (c) 1999 Shin Takemura, All rights reserved.
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.74 2002/04/27 23:24:55 shin Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.75 2002/08/04 01:41:23 gmcgarry Exp $");
#include "opt_vr41xx.h"
#include "opt_tx39xx.h"
@ -97,7 +97,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.74 2002/04/27 23:24:55 shin Exp $");
#include <sys/buf.h>
#include <sys/reboot.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <sys/boot_flag.h>
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
@ -151,10 +150,9 @@ static int __bicons_enable;
#endif
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
char cpu_model[128];
extern cpu_model[128];
char cpu_name[40]; /* set cpu depend xx_init() */
struct cpu_info cpu_info_store; /* only one cpu */
int cpuspeed = 1; /* approx # instr per usec. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: mips_machdep.c,v 1.136 2002/07/26 00:43:55 simonb Exp $ */
/* $NetBSD: mips_machdep.c,v 1.137 2002/08/04 01:41:25 gmcgarry Exp $ */
/*
* Copyright 2002 Wasabi Systems, Inc.
@ -120,7 +120,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.136 2002/07/26 00:43:55 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.137 2002/08/04 01:41:25 gmcgarry Exp $");
#include "opt_cputype.h"
#include "opt_compat_netbsd.h"
@ -137,22 +137,29 @@ __KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.136 2002/07/26 00:43:55 simonb Ex
#include <sys/signal.h>
#include <sys/signalvar.h>
#include <sys/syscallargs.h>
#include <sys/sysctl.h>
#include <sys/user.h>
#include <sys/msgbuf.h>
#include <sys/conf.h>
#include <sys/core.h>
#include <sys/kcore.h>
#include <machine/kcore.h>
#include <uvm/uvm_extern.h>
#include <dev/cons.h>
#include <mips/cache.h>
#include <mips/regnum.h>
#include <mips/locore.h>
#include <mips/psl.h>
#include <mips/pte.h>
#include <machine/cpu.h>
#ifdef __pmax__
#include <machine/bootinfo.h> /* XXX pmax only so far */
#endif
#if defined(MIPS32) || defined(MIPS64)
#include <mips/mipsNN.h> /* MIPS32/MIPS64 registers */
#endif
@ -210,6 +217,11 @@ caddr_t msgbufaddr;
int default_pg_mask = 0x00001800;
#endif
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
char cpu_model[128];
struct pridtab {
int cpu_cid;
int cpu_pid;
@ -1082,6 +1094,52 @@ setregs(p, pack, stack)
p->p_md.md_ss_addr = 0;
}
/*
* Machine dependent system variables.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
#if defined(__pmax__)
struct btinfo_bootpath *bibp;
#endif
dev_t consdev;
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
switch (name[0]) {
case CPU_CONSDEV:
if (cn_tab != NULL)
consdev = cn_tab->cn_dev;
else
consdev = NODEV;
return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
sizeof consdev));
#if defined(__pmax__)
case CPU_BOOTED_KERNEL:
bibp = lookup_bootinfo(BTINFO_BOOTPATH);
if(!bibp)
return (ENOENT); /* ??? */
return (sysctl_rdstring(oldp, oldlenp, newp, bibp->bootpath));
#endif
case CPU_ROOT_DEVICE:
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
struct sigframe {
struct sigcontext sf_sc; /* actual context */
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.30 2001/09/15 01:19:38 wdk Exp $ */
/* $NetBSD: machdep.c,v 1.31 2002/08/04 01:41:30 gmcgarry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2001/09/15 01:19:38 wdk Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.31 2002/08/04 01:41:30 gmcgarry Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@ -67,7 +67,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2001/09/15 01:19:38 wdk Exp $");
#include <sys/device.h>
#include <sys/user.h>
#include <sys/exec.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/kcore.h>
@ -105,9 +104,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.30 2001/09/15 01:19:38 wdk Exp $");
#include "com.h" /* XXX */
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH;
char cpu_model[40];
extern char cpu_model[];
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;
@ -482,30 +479,6 @@ cpu_startup()
bufinit();
}
/*
* machine dependent system variables.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
switch (name[0]) {
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
/*
* Look up information in bootinfo of boot loader.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.61 2002/03/05 16:13:57 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.62 2002/08/04 01:41:27 gmcgarry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.61 2002/03/05 16:13:57 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.62 2002/08/04 01:41:27 gmcgarry Exp $");
/* from: Utah Hdr: machdep.c 1.63 91/04/24 */
@ -73,7 +73,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.61 2002/03/05 16:13:57 simonb Exp $");
#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
@ -107,9 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.61 2002/03/05 16:13:57 simonb Exp $");
#include <dev/cons.h>
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH;
char cpu_model[30];
extern char cpu_model[];
/* Our exported CPU info; we can have only one. */
struct cpu_info cpu_info_store;
@ -514,32 +511,6 @@ cpu_startup()
bufinit();
}
/*
* machine dependent system variables.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
switch (name[0]) {
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
/*
* lookup_bootinfo:
* Look up information in bootinfo of boot loader.

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.3 2002/01/31 16:25:56 uch Exp $ */
/* $NetBSD: machdep.c,v 1.4 2002/08/04 01:41:32 gmcgarry Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -43,7 +43,6 @@
#include <sys/buf.h>
#include <sys/reboot.h>
#include <sys/mount.h>
#include <sys/sysctl.h>
#include <sys/kcore.h>
#include <sys/boot_flag.h>
@ -68,10 +67,8 @@
#include <playstation2/playstation2/kloader.h>
#endif
/* For sysctl. */
char machine[] = MACHINE;
char machine_arch[] = MACHINE_ARCH;
char cpu_model[] = "SONY PlayStation 2";
/* For sysctl_hw */
extern char cpu_model[];
struct cpu_info cpu_info_store;
@ -146,6 +143,8 @@ mach_init()
uvm_page_physload(atop(start), atop(start + size),
atop(start), atop(start + size), VM_FREELIST_DEFAULT);
strcpy(cpu_model, "SONY PlayStation 2");
/*
* Initialize error message buffer (at end of core).
*/
@ -271,27 +270,6 @@ cpu_startup()
bufinit();
}
/*
* Machine dependent system variables.
*/
int
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return (ENOTDIR);
switch (name[0]) {
case CPU_CONSDEV:
return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tab->cn_dev,
sizeof cn_tab->cn_dev));
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
void
cpu_reboot(int howto, char *bootstr)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.199 2002/03/05 16:14:28 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.200 2002/08/04 01:41:28 gmcgarry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -43,7 +43,7 @@
*/
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2002/03/05 16:14:28 simonb Exp $");
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.200 2002/08/04 01:41:28 gmcgarry Exp $");
#include "fs_mfs.h"
#include "opt_ddb.h"
@ -60,8 +60,6 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2002/03/05 16:14:28 simonb Exp $")
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
#include <dev/cons.h>
#include <ufs/mfs/mfs_extern.h> /* mfs_initminiroot() */
@ -89,9 +87,8 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2002/03/05 16:14:28 simonb Exp $")
#include "opt_dec_3maxplus.h"
/* the following is used externally (sysctl_hw) */
char machine[] = MACHINE; /* from <machine/param.h> */
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
char cpu_model[40];
extern char cpu_model[];
unsigned ssir; /* simulated interrupt register */
/* Our exported CPU info; we can have only one. */
@ -515,40 +512,6 @@ cpu_startup()
bufinit();
}
/*
* Machine dependent system variables.
*/
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
struct btinfo_bootpath *bibp;
/* all sysctl names at this level are terminal */
if (namelen != 1)
return (ENOTDIR); /* overloaded */
switch (name[0]) {
case CPU_CONSDEV:
return (sysctl_rdstruct(oldp, oldlenp, newp, &cn_tab->cn_dev,
sizeof cn_tab->cn_dev));
case CPU_BOOTED_KERNEL:
bibp = lookup_bootinfo(BTINFO_BOOTPATH);
if(!bibp)
return (ENOENT); /* ??? */
return (sysctl_rdstring(oldp, oldlenp, newp, bibp->bootpath));
default:
return (EOPNOTSUPP);
}
/* NOTREACHED */
}
/*
* Look up information in bootinfo of boot loader.
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.7 2002/06/07 01:34:03 simonb Exp $ */
/* $NetBSD: machdep.c,v 1.8 2002/08/04 01:41:33 gmcgarry Exp $ */
/*
* Copyright 2000, 2001
@ -76,7 +76,6 @@
#include <sys/device.h>
#include <sys/user.h>
#include <sys/exec.h>
#include <sys/sysctl.h>
#include <sys/mount.h>
#include <sys/syscallargs.h>
#include <sys/kcore.h>
@ -118,10 +117,8 @@
#include <sbmips/ikos/ikosvar.h>
#endif
/* For sysctl. */
char machine[] = MACHINE;
char machine_arch[] = MACHINE_ARCH;
char cpu_model[] = "sb1250";
/* For sysctl_hw. */
extern char cpu_model[];
/* Our exported CPU info. Only one for now */
struct cpu_info cpu_info_store;
@ -232,6 +229,8 @@ mach_init(long fwhandle, long magic, long bootdata, long reserved)
(u_int)fwhandle, (u_int)magic, (u_int)bootdata, (u_int)reserved);
#endif
strcpy(cpu_model, "sb1250");
if (magic == BOOTINFO_MAGIC) {
int idx;
int added;
@ -460,21 +459,6 @@ cpu_startup(void)
bufinit();
}
int
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen, struct proc *p)
{
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return ENOTDIR;
switch (name[0]) {
default:
return EOPNOTSUPP;
}
}
int waittime = -1;
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.37 2002/05/03 01:49:22 rafal Exp $ */
/* $NetBSD: machdep.c,v 1.38 2002/08/04 01:41:29 gmcgarry Exp $ */
/*
* Copyright (c) 2000 Soren S. Jorvang
@ -59,7 +59,6 @@
#include <sys/kcore.h>
#include <uvm/uvm_extern.h>
#include <sys/sysctl.h>
#include <machine/cpu.h>
#include <machine/reg.h>
@ -89,10 +88,8 @@
#include <dev/cons.h>
/* For sysctl(3). */
char machine[] = MACHINE;
char machine_arch[] = MACHINE_ARCH;
char cpu_model[64 + 1]; /* sizeof(arcbios_system_identifier) */
/* For sysctl_hw. */
extern char cpu_model[];
struct sgimips_intrhand intrtab[NINTR];
@ -629,26 +626,6 @@ cpu_startup()
bufinit();
}
int
cpu_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
int *name;
u_int namelen;
void *oldp;
size_t *oldlenp;
void *newp;
size_t newlen;
struct proc *p;
{
/* All sysctl names at this level are terminal. */
if (namelen != 1)
return ENOTDIR;
switch (name[0]) {
default:
return EOPNOTSUPP;
}
}
int waittime = -1;
void