Source-Changes-HG archive

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

[src/netbsd-6]: src Pull up following revision(s) (requested by tsutsui in ti...



details:   https://anonhg.NetBSD.org/src/rev/48797d209183
branches:  netbsd-6
changeset: 775438:48797d209183
user:      riz <riz%NetBSD.org@localhost>
date:      Sun Nov 18 19:05:16 2012 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #645):
        sys/arch/x68k/stand/newdisk/newdisk.c: revision 1.10
        sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile: revision 1.1
        sys/arch/x68k/stand/xxboot/xx.c: revision 1.1
        sys/arch/x68k/stand/Makefile: revision 1.10
        sys/arch/x68k/stand/Makefile: revision 1.11
        sys/arch/x68k/stand/boot/conf.c: revision 1.9
        sys/arch/x68k/stand/Makefile: revision 1.12
        sys/arch/x68k/stand/Makefile: revision 1.13
        sys/arch/x68k/include/loadfile_machdep.h: revision 1.7
        sys/arch/x68k/stand/xxboot/consio1.c: revision 1.1
        sys/arch/x68k/stand/libsa/sdcd.c: revision 1.12
        sys/arch/x68k/stand/libsa/libx68k.h: revision 1.6
        sys/arch/x68k/stand/boot/ne.c: revision 1.1
        sys/arch/x68k/stand/xxboot/boot.S: revision 1.1
        sys/arch/x68k/stand/libsa/sdcd.c: revision 1.13
        sys/arch/x68k/stand/netboot/boot.c: revision 1.1
        sys/arch/x68k/stand/libsa/devopen.c: revision 1.6
        sys/arch/x68k/stand/libsa/clock.c: revision 1.1
        sys/arch/x68k/stand/boot/ne.h: revision 1.1
        sys/arch/x68k/stand/netboot/conf.c: revision 1.1
        sys/arch/x68k/stand/boot/version: revision 1.5
        sys/arch/x68k/stand/boot/version: revision 1.6
        sys/arch/x68k/stand/netboot/version: revision 1.1
        sys/arch/x68k/stand/xxboot/Makefile.xxboot: revision 1.1
        sys/arch/x68k/stand/boot/if_ne.c: revision 1.1
        sys/arch/x68k/stand/boot/dp8390.h: revision 1.1
        sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile: revision 1.1
        sys/arch/x68k/stand/boot/dp8390.c: revision 1.1
        sys/arch/x68k/stand/xxboot/bootmain.c: revision 1.1
        sys/arch/x68k/stand/installboot/installboot.c: revision 1.6
        sys/arch/x68k/stand/xxboot/conf.c: revision 1.1
        sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile: revision 1.1
        sys/arch/x68k/stand/libsa/Makefile.inc: revision 1.2
        distrib/sets/lists/base/md.x68k: revision 1.44
        sys/arch/x68k/stand/boot/conf.c: revision 1.10
        sys/arch/x68k/stand/boot/boot.ldscript: revision 1.3
        distrib/sets/lists/base/md.x68k: revision 1.45
        sys/arch/x68k/stand/xxboot/xxboot.ldscript: revision 1.1
        sys/arch/x68k/stand/xxboot/Makefile: revision 1.15
        sys/arch/x68k/stand/libsa/Makefile: revision 1.29
        sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile: revision 1.1
        sys/arch/x68k/stand/netboot/Makefile: revision 1.1
        sys/arch/x68k/stand/libsa/consio.c: revision 1.10
        sys/arch/x68k/stand/xxboot/version: revision 1.1
        sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile: revision 1.1
Comment fix.
Add FFSv2 support.
Fix CD support.
Initial support for xxboot (cdboot_cd9660, specifically).
Add xxboot (stage1) support.
put library first.
Fix CD support (again!).
Descend to xxboot.
Add xxboot_?fsv?.
Change to the 2-clauses license.
Tweak SUBDIR build order and add comments about each dir.
Fix a bug in check_getchar() (called from awaitkey_1sec()).
It didn't clear input key data when non ASCII keys (CTRL, OPT.1 etc)
were pressed so it couldn't detect further key inputs and
"any other key for boot menu" interrupt during boot didn't work
in that case.
The problem was tracked by Y.Sugahara,
and tested on X68030 and XM6i by me.
Bump version to denote check_getchar() bug fix.
First cut at x68k network bootloader via NE2000 on Neptune-X and Nereid.
Written by isaki@ back in 2003 based on x86's NE2000 netboot, and
misc debug and improvements by tsutsui@ and Y.Sugahara.
Tested on XM6i (emulating Nereid Ethernet) and X68030 + Neptune-X by me,
also on X68030 + Nereid and X68000 PRO-II + Xellent30 + Nereid by isaki@.
Note:
- X680x0 IPLROM doesn't support bootstrap from Neptune-X or Nereid,
  so this network bootloader needs to be loaded from floppy or harddisk.
- Currently netboot support is not merged into the secondary Multi-boot
  (/usr/mdec/boot) due to size restriction.
- Primary loaders assumes that the secondary bootloader name is /boot,
  so /usr/mdec/netboot needs to be installed as /boot into the target
  bootstrap device.
Add new /usr/mdec/netboot.
Check lp->d_npartitions before calling dkcksum()
(which is in src/sbin/disklabel/dkcksum.c) because
it doesn't check range and could cause coredump during
installboot against floppy that includes garbage in LABELSECTOR.

diffstat:

 distrib/sets/lists/base/md.x68k                   |    8 +-
 sys/arch/x68k/include/loadfile_machdep.h          |   19 +-
 sys/arch/x68k/stand/Makefile                      |   17 +-
 sys/arch/x68k/stand/boot/boot.ldscript            |    2 +-
 sys/arch/x68k/stand/boot/conf.c                   |   13 +-
 sys/arch/x68k/stand/boot/dp8390.c                 |  300 +++++++++++++
 sys/arch/x68k/stand/boot/dp8390.h                 |   36 +
 sys/arch/x68k/stand/boot/if_ne.c                  |  156 +++++++
 sys/arch/x68k/stand/boot/ne.c                     |  272 ++++++++++++
 sys/arch/x68k/stand/boot/ne.h                     |   38 +
 sys/arch/x68k/stand/boot/version                  |    5 +-
 sys/arch/x68k/stand/installboot/installboot.c     |    5 +-
 sys/arch/x68k/stand/libsa/Makefile                |    3 +-
 sys/arch/x68k/stand/libsa/Makefile.inc            |    6 +-
 sys/arch/x68k/stand/libsa/clock.c                 |  112 +++++
 sys/arch/x68k/stand/libsa/consio.c                |   15 +-
 sys/arch/x68k/stand/libsa/devopen.c               |   23 +-
 sys/arch/x68k/stand/libsa/libx68k.h               |    7 +-
 sys/arch/x68k/stand/libsa/sdcd.c                  |   13 +-
 sys/arch/x68k/stand/netboot/Makefile              |   72 +++
 sys/arch/x68k/stand/netboot/boot.c                |  249 +++++++++++
 sys/arch/x68k/stand/netboot/conf.c                |   64 ++
 sys/arch/x68k/stand/netboot/version               |    7 +
 sys/arch/x68k/stand/newdisk/newdisk.c             |    7 +-
 sys/arch/x68k/stand/xxboot/Makefile               |    5 +
 sys/arch/x68k/stand/xxboot/Makefile.xxboot        |  116 +++++
 sys/arch/x68k/stand/xxboot/boot.S                 |  474 ++++++++++++++++++++++
 sys/arch/x68k/stand/xxboot/bootmain.c             |  135 ++++++
 sys/arch/x68k/stand/xxboot/cdboot_cd9660/Makefile |   13 +
 sys/arch/x68k/stand/xxboot/conf.c                 |   32 +
 sys/arch/x68k/stand/xxboot/consio1.c              |   52 ++
 sys/arch/x68k/stand/xxboot/version                |    7 +
 sys/arch/x68k/stand/xxboot/xx.c                   |   57 ++
 sys/arch/x68k/stand/xxboot/xxboot.ldscript        |   49 ++
 sys/arch/x68k/stand/xxboot/xxboot_ffsv1/Makefile  |   10 +
 sys/arch/x68k/stand/xxboot/xxboot_ffsv2/Makefile  |   10 +
 sys/arch/x68k/stand/xxboot/xxboot_lfsv1/Makefile  |   10 +
 sys/arch/x68k/stand/xxboot/xxboot_lfsv2/Makefile  |   10 +
 38 files changed, 2388 insertions(+), 41 deletions(-)

diffs (truncated from 2756 to 300 lines):

diff -r feef2d3722dc -r 48797d209183 distrib/sets/lists/base/md.x68k
--- a/distrib/sets/lists/base/md.x68k   Sun Nov 18 19:01:44 2012 +0000
+++ b/distrib/sets/lists/base/md.x68k   Sun Nov 18 19:05:16 2012 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.x68k,v 1.43 2011/11/19 12:27:42 isaki Exp $
+# $NetBSD: md.x68k,v 1.43.2.1 2012/11/18 19:05:23 riz Exp $
 ./dev/pow0                                     base-obsolete           obsolete
 ./dev/pow1                                     base-obsolete           obsolete
 ./usr/bin/bellctrl                             base-util-bin
@@ -14,10 +14,16 @@
 ./usr/mdec/installboot.new                     base-obsolete           obsolete
 ./usr/mdec/loadbsd.x                           base-sysutil-bin
 ./usr/mdec/mboot                               base-sysutil-bin
+./usr/mdec/netboot                             base-sysutil-bin
 ./usr/mdec/newdisk                             base-sysutil-bin
 ./usr/mdec/sdboot_ufs                          base-sysutil-bin
 ./usr/mdec/xxboot                              base-obsolete           obsolete
 ./usr/mdec/xxboot_ufs                          base-sysutil-bin
+./usr/mdec/xxboot_cd9660                       base-sysutil-bin
+./usr/mdec/xxboot_ffsv1                                base-sysutil-bin
+./usr/mdec/xxboot_ffsv2                                base-sysutil-bin
+./usr/mdec/xxboot_lfsv1                                base-sysutil-bin
+./usr/mdec/xxboot_lfsv2                                base-sysutil-bin
 ./usr/sbin/memswitch                           base-sysutil-bin
 ./usr/sbin/poffd                               base-obsolete           obsolete
 ./usr/share/keymaps/x68k/ascii_kmap            base-sys-share
diff -r feef2d3722dc -r 48797d209183 sys/arch/x68k/include/loadfile_machdep.h
--- a/sys/arch/x68k/include/loadfile_machdep.h  Sun Nov 18 19:01:44 2012 +0000
+++ b/sys/arch/x68k/include/loadfile_machdep.h  Sun Nov 18 19:05:16 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: loadfile_machdep.h,v 1.6 2008/04/28 20:23:40 martin Exp $       */
+/*     $NetBSD: loadfile_machdep.h,v 1.6.40.1 2012/11/18 19:05:20 riz Exp $     */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -33,13 +33,16 @@
 #define        _X68K_LOADFILE_MACHDEP_H_
 
 #define BOOT_AOUT
+#ifndef BOOT_STAGE1
 #define BOOT_ELF32
+#endif
 
 #define LOAD_KERNEL    LOAD_ALL
 #define COUNT_KERNEL   COUNT_ALL
 
 #ifdef _STANDALONE
 
+#ifndef BOOT_STAGE1
 #define LOADADDR(a)            ((a) + offset)
 #define ALIGNENTRY(a)          0
 #define READ(f, b, c)          pread((f), (void *)LOADADDR(b), (c))
@@ -51,7 +54,19 @@
 #define PROGRESS(a)            (void) printf a
 #define ALLOC(a)               alloc(a)
 #define DEALLOC(a, b)          dealloc(a, b)
-#define OKMAGIC(a)             ((a) == NMAGIC)
+#define OKMAGIC(a)             (((a) == NMAGIC) || ((a) == OMAGIC))
+#else
+#define LOADADDR(a)            ((a) + offset)
+#define ALIGNENTRY(a)          0
+#define READ(f, b, c)          pread((f), (void *)LOADADDR(b), (c))
+#define BCOPY(s, d, c)         vpbcopy((s), (void *)LOADADDR(d), (c))
+#define BZERO(d, c)            pbzero((void *)LOADADDR(d), (c))
+#define WARN(a)                        /* nothing */
+#define PROGRESS(a)            /* nothing */
+#define ALLOC(a)               alloc(a)
+#define DEALLOC(a, b)          dealloc(a, b)
+#define OKMAGIC(a)             (((a) == NMAGIC) || ((a) == OMAGIC))
+#endif
 
 #define        vpbcopy bcopy
 #define        pbzero  bzero
diff -r feef2d3722dc -r 48797d209183 sys/arch/x68k/stand/Makefile
--- a/sys/arch/x68k/stand/Makefile      Sun Nov 18 19:01:44 2012 +0000
+++ b/sys/arch/x68k/stand/Makefile      Sun Nov 18 19:05:16 2012 +0000
@@ -1,6 +1,17 @@
-#      $NetBSD: Makefile,v 1.8.162.1 2012/04/09 18:08:32 riz Exp $
+#      $NetBSD: Makefile,v 1.8.162.2 2012/11/18 19:05:18 riz Exp $
+
+# host tools
+SUBDIR= newdisk installboot
+
+# standalone libs
+SUBDIR+= libdos libiocs libsa .WAIT
 
-SUBDIR= newdisk aout2hux libdos libiocs .WAIT loadbsd # common
-SUBDIR+= libsa .WAIT mboot boot boot_ufs boot_ustar installboot
+# standalone bootloaders
+SUBDIR+= mboot
+SUBDIR+= boot_ufs boot_ustar xxboot
+SUBDIR+= boot netboot
+
+# Human68k utility
+SUBDIR+= aout2hux .WAIT loadbsd
 
 .include <bsd.subdir.mk>
diff -r feef2d3722dc -r 48797d209183 sys/arch/x68k/stand/boot/boot.ldscript
--- a/sys/arch/x68k/stand/boot/boot.ldscript    Sun Nov 18 19:01:44 2012 +0000
+++ b/sys/arch/x68k/stand/boot/boot.ldscript    Sun Nov 18 19:05:16 2012 +0000
@@ -1,4 +1,4 @@
-/* /boot must be a.out, OMAGIC starting from 0x8000. */
+/* /boot must be a.out, OMAGIC starting from 0x6000. */
 OUTPUT_FORMAT("a.out-m68k-netbsd", "a.out-m68k-netbsd",
              "a.out-m68k-netbsd")
 OUTPUT_ARCH(m68k)
diff -r feef2d3722dc -r 48797d209183 sys/arch/x68k/stand/boot/conf.c
--- a/sys/arch/x68k/stand/boot/conf.c   Sun Nov 18 19:01:44 2012 +0000
+++ b/sys/arch/x68k/stand/boot/conf.c   Sun Nov 18 19:05:16 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: conf.c,v 1.8 2005/12/11 12:19:44 christos Exp $        */
+/*     $NetBSD: conf.c,v 1.8.118.1 2012/11/18 19:05:18 riz Exp $       */
 
 /*
  * Copyright (c) 2001 Minoura Makoto
@@ -45,14 +45,15 @@
 int ndevs = sizeof(devsw) / sizeof(devsw[0]);
 
 const struct devspec devspec[] = {
-       { "sd", 0, 7 },
-       { "cd", 1, 7 },
-       { "fd", 2, 3 },
-       { 0, 0, 0 }
+       { "sd", 0, 7, 0 },
+       { "cd", 1, 7, 0 },
+       { "fd", 2, 3, 0 },
+       { NULL, 0, 0, 0 }
 };
 
 struct fs_ops file_system[] = {
-       FS_OPS(ufs),
+       FS_OPS(ffsv1),
+       FS_OPS(ffsv2),
        FS_OPS(lfsv1),
        FS_OPS(lfsv2),
        FS_OPS(cd9660),
diff -r feef2d3722dc -r 48797d209183 sys/arch/x68k/stand/boot/dp8390.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/x68k/stand/boot/dp8390.c Sun Nov 18 19:05:16 2012 +0000
@@ -0,0 +1,300 @@
+/*     $NetBSD: dp8390.c,v 1.2.2.2 2012/11/18 19:05:19 riz Exp $       */
+/*     Id: dp8390.c,v 1.14 2011/10/05 13:16:20 isaki Exp       */
+
+/*
+ * This file is derived from sys/arch/i386/stand/lib/netif/dp8390.c
+ * NetBSD: dp8390.c,v 1.6 2008/12/14 18:46:33 christos Exp
+ */
+
+/*
+ * Polling driver for National Semiconductor DS8390/WD83C690 based
+ * ethernet adapters.
+ *
+ * Copyright (c) 1998 Matthias Drochner.  All rights reserved.
+ *
+ * Copyright (c) 1994, 1995 Charles M. Hannum.  All rights reserved.
+ *
+ * Copyright (C) 1993, David Greenman.  This software may be used, modified,
+ * copied, distributed, and sold, in both source and binary form provided that
+ * the above copyright and these terms are retained.  Under no circumstances is
+ * the author responsible for the proper functioning of this software, nor does
+ * the author assume any responsibility for damages incurred with its use.
+ */
+
+
+#include <sys/types.h>
+
+#include <lib/libsa/stand.h>
+#include <libx68k.h>
+
+#include <dev/ic/dp8390reg.h>
+#include "dp8390.h"
+#include "ne.h"
+
+int dp8390_iobase, dp8390_membase, dp8390_memsize;
+#if defined(SUPPORT_WD80X3) && defined(SUPPORT_SMC_ULTRA)
+int dp8390_is790;
+#endif
+uint8_t dp8390_cr_proto;
+uint8_t dp8390_dcr_reg;
+
+#define WE_IOBASE dp8390_iobase
+
+static u_short rec_page_start;
+static u_short rec_page_stop;
+static u_short next_packet;
+
+extern u_char eth_myaddr[6];
+
+static void dp8390_read(int, char *, u_short);
+
+#define NIC_GET(reg) inb(WE_IOBASE + (reg) * 2)
+#define NIC_PUT(reg, val) outb(WE_IOBASE + (reg) * 2, val)
+
+static void
+dp8390_init(void)
+{
+       int i;
+
+       /*
+        * Initialize the NIC in the exact order outlined in the NS manual.
+        * This init procedure is "mandatory"...don't change what or when
+        * things happen.
+        */
+
+       /* Set interface for page 0, remote DMA complete, stopped. */
+       NIC_PUT(ED_P0_CR, dp8390_cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+       if ((dp8390_dcr_reg & ED_DCR_LS)) {
+               NIC_PUT(ED_P0_DCR, dp8390_dcr_reg);
+       } else {
+               /*
+                * Set FIFO threshold to 8, No auto-init Remote DMA, byte
+                * order=80x86, byte-wide DMA xfers,
+                */
+               NIC_PUT(ED_P0_DCR, ED_DCR_FT1 | ED_DCR_LS);
+       }
+
+       /* Clear remote byte count registers. */
+       NIC_PUT(ED_P0_RBCR0, 0);
+       NIC_PUT(ED_P0_RBCR1, 0);
+
+       /* Tell RCR to do nothing for now. */
+       NIC_PUT(ED_P0_RCR, ED_RCR_MON);
+
+       /* Place NIC in internal loopback mode. */
+       NIC_PUT(ED_P0_TCR, ED_TCR_LB0);
+
+       /* Set lower bits of byte addressable framing to 0. */
+       if (dp8390_is790)
+               NIC_PUT(0x09, 0);
+
+       /* Initialize receive buffer ring. */
+       NIC_PUT(ED_P0_BNRY, rec_page_start);
+       NIC_PUT(ED_P0_PSTART, rec_page_start);
+       NIC_PUT(ED_P0_PSTOP, rec_page_stop);
+
+       /*
+        * Clear all interrupts.  A '1' in each bit position clears the
+        * corresponding flag.
+        */
+       NIC_PUT(ED_P0_ISR, 0xff);
+
+       /*
+        * Disable all interrupts.
+        */
+       NIC_PUT(ED_P0_IMR, 0);
+
+       /* Program command register for page 1. */
+       NIC_PUT(ED_P0_CR, dp8390_cr_proto | ED_CR_PAGE_1 | ED_CR_STP);
+
+       /* Copy out our station address. */
+       for (i = 0; i < 6; i++)
+               NIC_PUT(ED_P1_PAR0 + i, eth_myaddr[i]);
+
+       /*
+        * Set current page pointer to one page after the boundary pointer, as
+        * recommended in the National manual.
+        */
+       next_packet = rec_page_start + 1;
+       NIC_PUT(ED_P1_CURR, next_packet);
+
+       /* Program command register for page 0. */
+       NIC_PUT(ED_P1_CR, dp8390_cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+       /* directed and broadcast */
+       NIC_PUT(ED_P0_RCR, ED_RCR_AB);
+
+       /* Take interface out of loopback. */
+       NIC_PUT(ED_P0_TCR, 0);
+
+       /* Fire up the interface. */
+       NIC_PUT(ED_P0_CR, dp8390_cr_proto | ED_CR_PAGE_0 | ED_CR_STA);
+}
+
+int
+dp8390_config(void)
+{
+
+       rec_page_start = TX_PAGE_START + ED_TXBUF_SIZE;
+       rec_page_stop = TX_PAGE_START + (dp8390_memsize >> ED_PAGE_SHIFT);
+
+       dp8390_init();
+
+       return 0;
+}
+
+void
+dp8390_stop(void)
+{
+       int n = 5000;
+
+       /* Stop everything on the interface, and select page 0 registers. */
+       NIC_PUT(ED_P0_CR, dp8390_cr_proto | ED_CR_PAGE_0 | ED_CR_STP);
+
+       /*
+        * Wait for interface to enter stopped state, but limit # of checks to
+        * 'n' (about 5ms).  It shouldn't even take 5us on modern DS8390's, but
+        * just in case it's an old one.
+        */
+       while (((NIC_GET(ED_P0_ISR) & ED_ISR_RST) == 0) && --n)



Home | Main Index | Thread Index | Old Index