Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/hpcsh adapted to hpc bootinfo structure.



details:   https://anonhg.NetBSD.org/src/rev/1477f94c4aac
branches:  trunk
changeset: 503510:1477f94c4aac
user:      uch <uch%NetBSD.org@localhost>
date:      Wed Feb 07 15:29:21 2001 +0000

description:
adapted to hpc bootinfo structure.
add memory detect routines.

diffstat:

 sys/arch/hpcsh/conf/JORNADA690    |    10 +-
 sys/arch/hpcsh/conf/files.hpcsh   |    24 +-
 sys/arch/hpcsh/hpcsh/autoconf.c   |   281 +-----
 sys/arch/hpcsh/hpcsh/bus_space.c  |   108 ++
 sys/arch/hpcsh/hpcsh/genassym.cf  |    11 +-
 sys/arch/hpcsh/hpcsh/locore.s     |   220 +----
 sys/arch/hpcsh/hpcsh/machdep.c    |  1541 ++++++++++--------------------------
 sys/arch/hpcsh/hpcsh/mainbus.c    |    42 +-
 sys/arch/hpcsh/hpcsh/md_root.c    |    10 +-
 sys/arch/hpcsh/include/bootinfo.h |     8 +-
 10 files changed, 672 insertions(+), 1583 deletions(-)

diffs (truncated from 2667 to 300 lines):

diff -r a34302700e63 -r 1477f94c4aac sys/arch/hpcsh/conf/JORNADA690
--- a/sys/arch/hpcsh/conf/JORNADA690    Wed Feb 07 15:22:39 2001 +0000
+++ b/sys/arch/hpcsh/conf/JORNADA690    Wed Feb 07 15:29:21 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: JORNADA690,v 1.1 2001/01/17 05:21:48 itojun Exp $
+#      $NetBSD: JORNADA690,v 1.2 2001/02/07 15:29:21 uch Exp $
 #
 #      JORNADA690 uch's Jornada 690
 #
@@ -18,14 +18,6 @@
 options                SH7709A_BROKEN_IPR
 options                PCLOCK=22000000         # 22MHz
 
-options                IOM_ROM_BEGIN=0x00000000        # XXX dummy
-options                IOM_ROM_SIZE=0x00200000         # XXX dummy
-options                IOM_RAM_BEGIN=0x8c000000
-options                IOM_RAM_SIZE=0x01000000         # 16MB XXX first bank only
-options                LED_ADDR=0xa8000000             # XXX dummy
-
-options                DONT_INIT_BSC           # XXX use WindowsCE setting.
-
 # Standard system options
 
 options        RTC_OFFSET=-540 # hardware clock is this many mins. west of GMT
diff -r a34302700e63 -r 1477f94c4aac sys/arch/hpcsh/conf/files.hpcsh
--- a/sys/arch/hpcsh/conf/files.hpcsh   Wed Feb 07 15:22:39 2001 +0000
+++ b/sys/arch/hpcsh/conf/files.hpcsh   Wed Feb 07 15:29:21 2001 +0000
@@ -1,8 +1,5 @@
-#      $NetBSD: files.hpcsh,v 1.4 2001/02/06 16:45:21 uch Exp $
+#      $NetBSD: files.hpcsh,v 1.5 2001/02/07 15:29:21 uch Exp $
 #
-# new style config file for sh3 architecture
-#
-# maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 8
 
 maxusers 2 16 64
@@ -10,6 +7,7 @@
 file   arch/hpcsh/hpcsh/conf.c
 file   arch/hpcsh/hpcsh/machdep.c
 file   arch/hpcsh/hpcsh/autoconf.c
+file   arch/hpcsh/hpcsh/bus_space.c
 file   arch/hpcsh/hpcsh/procfs_machdep.c       procfs
 
 #
@@ -22,20 +20,20 @@
 #
 
 include "dev/scsipi/files.scsipi"
-major  {sd = 4}
-major  {st = 5}
-major  {cd = 6}
+major  {sd = 3}
+major  {st = 4}
+major  {cd = 5}
 
 #
 # Machine-independent ATA drivers
 #
 
 include "dev/ata/files.ata"
-major  {wd = 0}
+major  {wd = 1}
 
 # Memory Disk for install floppy
 file arch/hpcsh/hpcsh/md_root.c                        memory_disk_hooks
-major  {md = 17}
+major  {md = 6}
 
 #
 # System bus types
@@ -59,11 +57,3 @@
 # Workstation Console
 #
 include "dev/wscons/files.wscons"
-
-
-defopt opt_memsize.h   IOM_ROM_BEGIN IOM_ROM_SIZE IOM_RAM_BEGIN IOM_RAM_SIZE
-defopt  opt_led_addr.h LED_ADDR
-defopt opt_initbsc.h   BSC_BCR1_VAL BSC_BCR2_VAL BSC_WCR1_VAL BSC_WCR2_VAL
-                       BSC_WCR3_VAL BSC_MCR_VAL BSC_SDMR2_VAL BSC_SDMR3_VAL
-                       BSC_RTCSR_VAL BSC_RTCNT_VAL BSC_RTCOR_VAL BSC_RFCR_VAL
-                       BSC_PCR_VAL FRQCR_VAL PFC_SCPCR_VAL
diff -r a34302700e63 -r 1477f94c4aac sys/arch/hpcsh/hpcsh/autoconf.c
--- a/sys/arch/hpcsh/hpcsh/autoconf.c   Wed Feb 07 15:22:39 2001 +0000
+++ b/sys/arch/hpcsh/hpcsh/autoconf.c   Wed Feb 07 15:29:21 2001 +0000
@@ -1,11 +1,13 @@
-/*     $NetBSD: autoconf.c,v 1.1 2001/02/06 16:45:21 uch Exp $ */
+/*     $NetBSD: autoconf.c,v 1.2 2001/02/07 15:29:21 uch Exp $ */
 
-/*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+/*
+ * Copyright (c) 1988 University of Utah.
+ * Copyright (c) 1992, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * This code is derived from software contributed to Berkeley by
- * William Jolitz.
+ * the Systems Programming Group of the University of Utah Computer
+ * Science Department and Ralph Campbell.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -35,261 +37,118 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- *     @(#)autoconf.c  7.1 (Berkeley) 5/9/91
+ * from: Utah Hdr: autoconf.c 1.31 91/01/21
+ *
+ *     @(#)autoconf.c  8.1 (Berkeley) 6/10/93
  */
 
+#include <sys/cdefs.h>
 /*
  * Setup the system to run on the current machine.
  *
- * Configure() is called at boot time and initializes the vba
- * device tables and the memory controller monitoring.  Available
+ * Configure() is called at boot time.  Available
  * devices are determined (from possibilities mentioned in ioconf.c),
  * and the drivers are initialized.
  */
+
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/map.h>
 #include <sys/buf.h>
 #include <sys/dkstat.h>
+#include <sys/conf.h>
 #include <sys/disklabel.h>
-#include <sys/conf.h>
 #include <sys/reboot.h>
 #include <sys/device.h>
-#include <sys/vnode.h>
-#include <sys/fcntl.h>
-#include <sys/dkio.h>
 
-#include <machine/pte.h>
 #include <machine/cpu.h>
-#include <machine/bootinfo.h>
+#include <machine/bus.h>
 
-static int match_harddisk __P((struct device *, struct btinfo_bootdisk *));
+#include <machine/config_hook.h>
 
-struct device *booted_device;
-int booted_partition;
+void makebootdev (const char *);
 
-static void findroot __P((void));
+static struct device *booted_device;
+static int booted_partition;
+static char booted_device_name[16];
+static void get_device(char *name);
 
 /*
- * Determine i/o configuration for a machine.
+ * Determine mass storage and memory configuration for a machine.
+ * Print cpu type, and then iterate over an array of devices
+ * found on the baseboard or in turbochannel option slots.
+ * Once devices are configured, enable interrupts, and probe
+ * for attached scsi devices.
  */
 void
 cpu_configure()
 {
+       /* Kick off autoconfiguration. */
+       (void)splhigh();
+
+       config_hook_init();
 
        startrtclock();
 
-       if (config_rootfound("mainbus", NULL) == NULL)
-               panic("configure: mainbus not configured");
+       if (config_rootfound("mainbus", "mainbus") == NULL)
+               panic("no mainbus found");
 
-       printf("biomask %0x netmask %0x ttymask %0x\n",
-              imask[IPL_BIO], imask[IPL_NET], imask[IPL_TTY]);
-
-       spl0();
+       /* Configuration is finished, turn on interrupts. */
+       spl0(); /* enable all source forcing SOFT_INTs cleared */
 }
 
 void
 cpu_rootconf()
 {
-       findroot();
+       get_device(booted_device_name);
 
        printf("boot device: %s\n",
-           booted_device ? booted_device->dv_xname : "<unknown>");
+              booted_device ? booted_device->dv_xname : "<unknown>");
 
        setroot(booted_device, booted_partition);
 }
 
-u_long bootdev = 0;            /* should be dev_t, but not until 32 bits */
-struct device *booted_device;
-
-/*
- * helper function for "findroot()":
- * return nonzero if disk device matches bootinfo
- */
-static int
-match_harddisk(dv, bid)
-       struct device *dv;
-       struct btinfo_bootdisk *bid;
+void
+makebootdev(const char *cp)
 {
-       struct devnametobdevmaj *i;
-       struct vnode *tmpvn;
-       int error;
-       struct disklabel label;
-       int found = 0;
-
-       /*
-        * A disklabel is required here.  The
-        * bootblocks don't refuse to boot from
-        * a disk without a label, but this is
-        * normally not wanted.
-        */
-       if (bid->labelsector == -1)
-               return(0);
-
-       /*
-        * lookup major number for disk block device
-        */
-       i = dev_name2blk;
-       while (i->d_name &&
-              strcmp(i->d_name, dv->dv_cfdata->cf_driver->cd_name))
-               i++;
-       if (i->d_name == NULL)
-               return(0); /* XXX panic() ??? */
-
-       /*
-        * Fake a temporary vnode for the disk, open
-        * it, and read the disklabel for comparison.
-        */
-       if (bdevvp(MAKEDISKDEV(i->d_maj, dv->dv_unit, bid->partition), &tmpvn))
-               panic("findroot can't alloc vnode");
-       error = VOP_OPEN(tmpvn, FREAD, NOCRED, 0);
-       if (error) {
-#ifndef DEBUG
-               /*
-                * Ignore errors caused by missing
-                * device, partition or medium.
-                */
-               if (error != ENXIO && error != ENODEV)
-#endif
-                       printf("findroot: can't open dev %s%c (%d)\n",
-                              dv->dv_xname, 'a' + bid->partition, error);
-               vrele(tmpvn);
-               return(0);
-       }
-       error = VOP_IOCTL(tmpvn, DIOCGDINFO, (caddr_t)&label, FREAD, NOCRED, 0);
-       if (error) {
-               /*
-                * XXX can't happen - open() would
-                * have errored out (or faked up one)
-                */
-               printf("can't get label for dev %s%c (%d)\n",
-                      dv->dv_xname, 'a' + bid->partition, error);
-               goto closeout;
-       }
-
-       /* compare with our data */
-       if (label.d_type == bid->label.type &&
-           label.d_checksum == bid->label.checksum &&
-           !strncmp(label.d_packname, bid->label.packname, 16))
-               found = 1;
-
-closeout:
-       VOP_CLOSE(tmpvn, FREAD, NOCRED, 0);
-       vrele(tmpvn);
-
-       return(found);
+       strncpy(booted_device_name, cp, 16);
 }
 
-/*
- * Attempt to find the device from which we were booted.
- * If we can do so, and not instructed not to do so,
- * change rootdev to correspond to the load device.
- */
-void
-findroot(void)
+static void
+get_device(char *name)
 {
-       struct btinfo_bootdisk *bid;
+       int loop, unit, part;
+       char buf[32], *cp;
        struct device *dv;



Home | Main Index | Thread Index | Old Index