Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/pmax/pmax + Add prom_getenv(), and use it instead o...



details:   https://anonhg.NetBSD.org/src/rev/db2c3d5679db
branches:  trunk
changeset: 473588:db2c3d5679db
user:      simonb <simonb%NetBSD.org@localhost>
date:      Tue Jun 08 23:40:19 1999 +0000

description:
+ Add prom_getenv(), and use it instead off calling callv->_getenv.
 + Add prom_scsiid() to read and decode the prom scsiidN environment
   variable that says what the host SCSI id should be.
 + Include <pmax/pmax/machdep.h> instead of declaring our own
   prom_*() prototypes.

diffstat:

 sys/arch/pmax/pmax/promcall.c |  42 +++++++++++++++++++++++++++++++++---------
 1 files changed, 33 insertions(+), 9 deletions(-)

diffs (97 lines):

diff -r e61ebe196785 -r db2c3d5679db sys/arch/pmax/pmax/promcall.c
--- a/sys/arch/pmax/pmax/promcall.c     Tue Jun 08 18:28:38 1999 +0000
+++ b/sys/arch/pmax/pmax/promcall.c     Tue Jun 08 23:40:19 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: promcall.c,v 1.2 1999/05/25 07:37:08 nisimura Exp $    */
+/*     $NetBSD: promcall.c,v 1.3 1999/06/08 23:40:19 simonb Exp $      */
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -43,25 +43,24 @@
  */
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: promcall.c,v 1.2 1999/05/25 07:37:08 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promcall.c,v 1.3 1999/06/08 23:40:19 simonb Exp $");
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/device.h>
 #include <sys/reboot.h>
 #include <dev/cons.h>
 
 #include <pmax/pmax/pmaxtype.h>
+#include <pmax/pmax/machdep.h>
 #include <machine/dec_prom.h>
 
-int    prom_systype __P((void));
-void   prom_haltbutton __P((void));
-void   prom_halt __P((int, char *)) __attribute__((__noreturn__));
-void   prom_findcons __P((int *, int *, int *));
-
 static int  romgetc __P((dev_t));
 static void romputc __P((dev_t, int));
 static int  atoi __P((const char *));
 
+#define DEFAULT_SCSIID 7    /* XXX - this should really live somewhere else */
+
 /*
  * Default consdev, for errors or warnings before
  * consinit runs: use the PROM.
@@ -123,7 +122,7 @@
         * Get and parse the "osconsole" environment variable.
         */
        *crtslot = *kbdslot = -1;
-       oscon = (*callv->_getenv)("osconsole");
+       oscon = prom_getenv("osconsole");
        if (oscon && *oscon >= '0' && *oscon <= '9') {
                *kbdslot = *oscon - '0';
                *prom_using_screen = 0;
@@ -161,6 +160,16 @@
 }
 
 /*
+ * Get a prom environment variable.
+ */
+char *
+prom_getenv(name)
+       char *name;
+{
+       return (*callv->_getenv)(name);
+}
+
+/*
  * Get 32bit system type of Digital hardware.
  *     cputype,                u_int8_t [3]
  *     systype,                u_int8_t [2]
@@ -174,7 +183,7 @@
 
        if (callv != &callvec)
                return (*callv->_getsysid)();
-       cp = (*callv->_getenv)("systype");
+       cp = prom_getenv("systype");
        return (cp != NULL) ? atoi(cp) : 0;
 }
 
@@ -211,6 +220,21 @@
 }
 
 /*
+ * Get the host SCSI ID from the PROM.
+ */
+int
+prom_scsiid(cnum)
+       int cnum;
+{
+       char scsiid_var[8];     /* strlen("scsiidX") + NULL */
+       char *cp;
+
+       snprintf(scsiid_var, 8, "scsiid%d", cnum);
+       cp = prom_getenv(scsiid_var);
+       return (cp != NULL) ? atoi(cp) : DEFAULT_SCSIID;
+}
+
+/*
  * over-engineered atoi(3)
  */
 static int



Home | Main Index | Thread Index | Old Index