Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari/atari Add a dirty hack for atari's ancient in...



details:   https://anonhg.NetBSD.org/src/rev/81d9c9979245
branches:  trunk
changeset: 779941:81d9c9979245
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Jun 30 10:37:00 2012 +0000

description:
Add a dirty hack for atari's ancient installation ramdisk:
 Forcibly configure md0, md1, and md2 devices before setroot()
 for atari's traditional "auto-load from floppy on open" md_root device
 which loads installation ramdisk image from floppy.
 md(4) has been changed dynamically configured at first open after 5.0
 and md devices won't appear in "root device:" prompt without this hack.
Tested on TT030.

Should be pulled up to netbsd-6.

diffstat:

 sys/arch/atari/atari/autoconf.c |  48 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 46 insertions(+), 2 deletions(-)

diffs (80 lines):

diff -r 1866aa484833 -r 81d9c9979245 sys/arch/atari/atari/autoconf.c
--- a/sys/arch/atari/atari/autoconf.c   Sat Jun 30 10:20:26 2012 +0000
+++ b/sys/arch/atari/atari/autoconf.c   Sat Jun 30 10:37:00 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $       */
+/*     $NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $    */
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.61 2011/06/05 17:09:18 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.62 2012/06/30 10:37:00 tsutsui Exp $");
+
+#include "opt_md.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -41,10 +43,17 @@
 #include <sys/device.h>
 #include <sys/disklabel.h>
 #include <sys/disk.h>
+#include <sys/malloc.h>
 #include <machine/disklabel.h>
 #include <machine/cpu.h>
 #include <atari/atari/device.h>
 
+#if defined(MEMORY_DISK_HOOKS)
+#include <dev/md.h>
+#endif
+
+#include "ioconf.h"
+
 static void findroot(void);
 int mbmatch(device_t, cfdata_t, void *);
 void mbattach(device_t, device_t, void *);
@@ -75,6 +84,41 @@
 {
 
        findroot();
+#if defined(MEMORY_DISK_HOOKS)
+       /*
+        * XXX
+        * quick hacks for atari's traditional "auto-load from floppy on open"
+        * installation md(4) ramdisk.
+        * See sys/arch/atari/dev/md_root.c for details.
+        */
+#define RAMD_NDEV      3       /* XXX */
+
+       if ((boothowto & RB_ASKNAME) != 0) {
+               int md_major, i;
+               dev_t md_dev;
+               cfdata_t cf;
+               struct md_softc *sc;
+
+               md_major = devsw_name2blk("md", NULL, 0);
+               if (md_major >= 0) {
+                       for (i = 0; i < RAMD_NDEV; i++) {
+                               md_dev = MAKEDISKDEV(md_major, i, RAW_PART);
+                               cf = malloc(sizeof(*cf), M_DEVBUF,
+                                   M_ZERO|M_WAITOK);
+                               if (cf == NULL)
+                                       break;  /* XXX */
+                               cf->cf_name = md_cd.cd_name;
+                               cf->cf_atname = md_cd.cd_name;
+                               cf->cf_unit = i;
+                               cf->cf_fstate = FSTATE_STAR;
+                               /* XXX mutex */
+                               sc = device_private(config_attach_pseudo(cf));
+                               if (sc == NULL)
+                                       break;  /* XXX */
+                       }
+               }
+       }
+#endif
        setroot(booted_device, booted_partition);
 }
 



Home | Main Index | Thread Index | Old Index