Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Merge cpu_sysctl() for all mips ports, based on pow...
details: https://anonhg.NetBSD.org/src/rev/5d0bac930b54
branches: trunk
changeset: 534826:5d0bac930b54
user: gmcgarry <gmcgarry%NetBSD.org@localhost>
date: Sun Aug 04 01:41:23 2002 +0000
description:
Merge cpu_sysctl() for all mips ports, based on powerpc and m68k precedent.
For now, only pmax implements CPU_BOOTED_KERNEL. Need to revisit.
diffstat:
sys/arch/algor/algor/machdep.c | 34 +--------------
sys/arch/evbmips/malta/machdep.c | 31 ++-----------
sys/arch/hpcmips/hpcmips/machdep.c | 10 +--
sys/arch/mips/mips/mips_machdep.c | 64 ++++++++++++++++++++++++++-
sys/arch/mipsco/mipsco/machdep.c | 33 +-------------
sys/arch/newsmips/newsmips/machdep.c | 35 +--------------
sys/arch/playstation2/playstation2/machdep.c | 32 ++-----------
sys/arch/pmax/pmax/machdep.c | 45 +-----------------
sys/arch/sbmips/sbmips/machdep.c | 26 ++---------
sys/arch/sgimips/sgimips/machdep.c | 29 +-----------
10 files changed, 95 insertions(+), 244 deletions(-)
diffs (truncated from 684 to 300 lines):
diff -r 1b0daba0889d -r 5d0bac930b54 sys/arch/algor/algor/machdep.c
--- a/sys/arch/algor/algor/machdep.c Sun Aug 04 01:24:57 2002 +0000
+++ b/sys/arch/algor/algor/machdep.c Sun Aug 04 01:41:23 2002 +0000
@@ -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 @@
#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 @@
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. */
diff -r 1b0daba0889d -r 5d0bac930b54 sys/arch/evbmips/malta/machdep.c
--- a/sys/arch/evbmips/malta/machdep.c Sun Aug 04 01:24:57 2002 +0000
+++ b/sys/arch/evbmips/malta/machdep.c Sun Aug 04 01:41:23 2002 +0000
@@ -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 @@
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 @@
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 @@
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
diff -r 1b0daba0889d -r 5d0bac930b54 sys/arch/hpcmips/hpcmips/machdep.c
--- a/sys/arch/hpcmips/hpcmips/machdep.c Sun Aug 04 01:24:57 2002 +0000
+++ b/sys/arch/hpcmips/hpcmips/machdep.c Sun Aug 04 01:41:23 2002 +0000
@@ -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 @@
#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 @@
#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. */
diff -r 1b0daba0889d -r 5d0bac930b54 sys/arch/mips/mips/mips_machdep.c
--- a/sys/arch/mips/mips/mips_machdep.c Sun Aug 04 01:24:57 2002 +0000
+++ b/sys/arch/mips/mips/mips_machdep.c Sun Aug 04 01:41:23 2002 +0000
@@ -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 @@
#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 <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 @@
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 @@
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 */
};
diff -r 1b0daba0889d -r 5d0bac930b54 sys/arch/mipsco/mipsco/machdep.c
--- a/sys/arch/mipsco/mipsco/machdep.c Sun Aug 04 01:24:57 2002 +0000
+++ b/sys/arch/mipsco/mipsco/machdep.c Sun Aug 04 01:41:23 2002 +0000
@@ -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 @@
Home |
Main Index |
Thread Index |
Old Index