--- sys/arch/dreamcast.orig/conf/files.dreamcast Tue Apr 24 20:18:54 2001
+++ sys/arch/dreamcast/conf/files.dreamcast Fri Aug 3 00:16:08 2001
@@ -20,7 +20,7 @@
file arch/dreamcast/dreamcast/autoconf.c
file arch/dreamcast/dreamcast/procfs_machdep.c procfs
file arch/dreamcast/dreamcast/clock.c
-file arch/sh3/sh3/disksubr.c disk
+file arch/dreamcast/dreamcast/disksubr.c disk
defopt opt_memsize.h IOM_ROM_BEGIN IOM_ROM_SIZE IOM_RAM_BEGIN IOM_RAM_SIZE
defopt opt_led_addr.h LED_ADDR
@@ -90,3 +90,14 @@
file arch/dreamcast/dev/g2/gapspci.c gapspci
file arch/dreamcast/dev/g2/gapspci_dma.c gapspci
file arch/dreamcast/dev/g2/gapspci_pci.c gapspci
+
+device dppbus { }
+attach dppbus at shb
+file arch/dreamcast/dev/dpp/dppbus.c dppbus
+file arch/dreamcast/dev/dpp/dppbus_bus_mem.c dppbus
+
+attach wdc at dppbus with wdc_dppbus
+file arch/dreamcast/dev/dpp/wdc_dppbus.c wdc_dppbus
+
+#attach ne at dppbus with ne_dppbus: rtl80x9
+#file arch/dreamcast/dev/dpp/if_ne_dppbus.c ne_dppbus
--- sys/arch/dreamcast.orig/conf/shl.x Mon Mar 5 20:50:58 2001
+++ sys/arch/dreamcast/conf/shl.x Fri May 18 01:07:46 2001
@@ -1,4 +1,5 @@
-OUTPUT_FORMAT("elf32-shl-unx")
+/*OUTPUT_FORMAT("elf32-shl-unx")*/
+OUTPUT_FORMAT("coff-shl")
OUTPUT_ARCH(sh)
MEMORY
{
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/dreamcast/disksubr.c Fri Aug 3 00:14:42 2001
@@ -0,0 +1,515 @@
+/* $NetBSD: disksubr.c,v 1.43 2000/11/20 08:24:15 chs Exp $ */
+
+/*
+ * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/disklabel.h>
+#include <sys/disk.h>
+#include <sys/syslog.h>
+
+#include "opt_mbr.h"
+
+int fat_types[] = { MBR_PTYPE_FAT12, MBR_PTYPE_FAT16S,
+ MBR_PTYPE_FAT16B, MBR_PTYPE_FAT32,
+ MBR_PTYPE_FAT32L, MBR_PTYPE_FAT16L,
+ -1 };
+
+#define NO_MBR_SIGNATURE ((struct mbr_partition *) -1)
+
+static struct mbr_partition *
+mbr_findslice __P((struct mbr_partition* dp, struct buf *bp));
+
+/*
+ * Scan MBR for NetBSD partittion. Return NO_MBR_SIGNATURE if no MBR found
+ * Otherwise, copy valid MBR partition-table into dp, and if a NetBSD
+ * partition is found, return a pointer to it; else return NULL.
+ */
+static
+struct mbr_partition *
+mbr_findslice(dp, bp)
+ struct mbr_partition *dp;
+ struct buf *bp;
+{
+ struct mbr_partition *ourdp = NULL;
+ u_int16_t *mbrmagicp;
+ int i;
+
+ /* Note: Magic number is little-endian. */
+ mbrmagicp = (u_int16_t *)(bp->b_data + MBR_MAGICOFF);
+ if (*mbrmagicp != MBR_MAGIC)
+ return (NO_MBR_SIGNATURE);
+
+ /* XXX how do we check veracity/bounds of this? */
+ memcpy(dp, bp->b_data + MBR_PARTOFF, NMBRPART * sizeof(*dp));
+
+ /* look for NetBSD partition */
+ for (i = 0; i < NMBRPART; i++) {
+ if (dp[i].mbrp_typ == MBR_PTYPE_NETBSD) {
+ ourdp = &dp[i];
+ break;
+ }
+ }
+
+#ifdef COMPAT_386BSD_MBRPART
+ /* didn't find it -- look for 386BSD partition */
+ if (!ourdp) {
+ for (i = 0; i < NMBRPART; i++) {
+ if (dp[i].mbrp_typ == MBR_PTYPE_386BSD) {
+ printf("WARNING: old BSD partition ID!\n");
+ ourdp = &dp[i];
+ /*
+ * If more than one matches, take last,
+ * as NetBSD install tool does.
+ */
+#if 0
+ break;
+#endif
+ }
+ }
+ }
+#endif /* COMPAT_386BSD_MBRPART */
+
+ return (ourdp);
+}
+
+
+/*
+ * Attempt to read a disk label from a device
+ * using the indicated stategy routine.
+ * The label must be partly set up before this:
+ * secpercyl, secsize and anything required for a block i/o read
+ * operation in the driver's strategy/start routines
+ * must be filled in before calling us.
+ *
+ * If dos partition table requested, attempt to load it and
+ * find disklabel inside a DOS partition. Also, if bad block
+ * table needed, attempt to extract it as well. Return buffer
+ * for use in signalling errors if requested.
+ *
+ * Returns null on success and an error string on failure.
+ */
+char *
+readdisklabel(dev, strat, lp, osdep)
+ dev_t dev;
+ void (*strat) __P((struct buf *));
+ struct disklabel *lp;
+ struct cpu_disklabel *osdep;
+{
+ struct mbr_partition *dp;
+ struct partition *pp;
+ struct dkbad *bdp;
+ struct buf *bp;
+ struct disklabel *dlp;
+ char *msg = NULL;
+ int dospartoff, cyl, i, *ip;
+
+ /* minimal requirements for archtypal disk label */
+ if (lp->d_secsize == 0)
+ lp->d_secsize = DEV_BSIZE;
+ if (lp->d_secperunit == 0)
+ lp->d_secperunit = 0x1fffffff;
+#if 0
+ if (lp->d_ncylinders == 16383) {
+ printf("disklabel: Disk > 8G ... readjusting chs %d/%d/%d to ",
+ lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
+ lp->d_ncylinders = lp->d_secperunit / lp->d_ntracks / lp->d_nsectors;
+ printf("%d/%d/%d\n",
+ lp->d_ncylinders, lp->d_ntracks, lp->d_nsectors);
+ }
+#endif
+ lp->d_npartitions = RAW_PART + 1;
+ for (i = 0; i < RAW_PART; i++) {
+ lp->d_partitions[i].p_size = 0;
+ lp->d_partitions[i].p_offset = 0;
+ }
+ if (lp->d_partitions[i].p_size == 0)
+ lp->d_partitions[i].p_size = 0x1fffffff;
+ lp->d_partitions[i].p_offset = 0;
+
+ /* get a buffer and initialize it */
+ bp = geteblk((int)lp->d_secsize);
+ bp->b_dev = dev;
+
+ /* do dos partitions in the process of getting disklabel? */
+ dospartoff = 0;
+ cyl = LABELSECTOR / lp->d_secpercyl;
+ if (!osdep)
+ goto nombrpart;
+ dp = osdep->dosparts;
+
+ /* read master boot record */
+ bp->b_blkno = MBR_BBSECTOR;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_flags |= B_READ;
+ bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
+ (*strat)(bp);
+
+ /* if successful, wander through dos partition table */
+ if (biowait(bp)) {
+ msg = "dos partition I/O error";
+ goto done;
+ } else {
+ struct mbr_partition *ourdp = NULL;
+
+ ourdp = mbr_findslice(dp, bp);
+ if (ourdp == NO_MBR_SIGNATURE)
+ goto nombrpart;
+
+ for (i = 0; i < NMBRPART; i++, dp++) {
+ /* Install in partition e, f, g, or h. */
+ pp = &lp->d_partitions[RAW_PART + 1 + i];
+ pp->p_offset = dp->mbrp_start;
+ pp->p_size = dp->mbrp_size;
+ for (ip = fat_types; *ip != -1; ip++) {
+ if (dp->mbrp_typ == *ip)
+ pp->p_fstype = FS_MSDOS;
+ }
+ if (dp->mbrp_typ == MBR_PTYPE_LNXEXT2)
+ pp->p_fstype = FS_EX2FS;
+
+ if (dp->mbrp_typ == MBR_PTYPE_NTFS)
+ pp->p_fstype = FS_NTFS;
+
+ /* is this ours? */
+ if (dp == ourdp) {
+ /* need sector address for SCSI/IDE,
+ cylinder for ESDI/ST506/RLL */
+ dospartoff = dp->mbrp_start;
+ cyl = MBR_PCYL(dp->mbrp_scyl, dp->mbrp_ssect);
+
+ /* update disklabel with details */
+ lp->d_partitions[2].p_size =
+ dp->mbrp_size;
+ lp->d_partitions[2].p_offset =
+ dp->mbrp_start;
+#if 0
+ if (lp->d_ntracks != dp->mbrp_ehd + 1 ||
+ lp->d_nsectors != DPSECT(dp->mbrp_esect)) {
+ printf("disklabel: BIOS sees chs %d/%d/%d as ",
+ lp->d_ncylinders, lp->d_ntracks,
+ lp->d_nsectors);
+ lp->d_ntracks = dp->mbrp_ehd + 1;
+ lp->d_nsectors = DPSECT(dp->mbrp_esect);
+ lp->d_secpercyl = lp->d_ntracks * lp->d_nsectors;
+ lp->d_ncylinders = lp->d_secperunit / lp->d_secpercyl;
+ if (! lp->d_ncylinders)
+ lp->d_ncylinders = 1;
+ printf("%d/%d/%d\n",
+ lp->d_ncylinders, lp->d_ntracks,
+ lp->d_nsectors);
+ }
+#endif
+ }
+ }
+ lp->d_npartitions = RAW_PART + 1 + i;
+ }
+
+nombrpart:
+ /* next, dig out disk label */
+ bp->b_blkno = dospartoff + LABELSECTOR;
+ bp->b_cylinder = cyl;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
+ (*strat)(bp);
+
+ /* if successful, locate disk label within block and validate */
+ if (biowait(bp)) {
+ msg = "disk label I/O error";
+ goto done;
+ }
+ for (dlp = (struct disklabel *)bp->b_data;
+ dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
+ dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
+ if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
+ if (msg == NULL)
+ msg = "no disk label";
+ } else if (dlp->d_npartitions > MAXPARTITIONS ||
+ dkcksum(dlp) != 0)
+ msg = "disk label corrupted";
+ else {
+ *lp = *dlp;
+ msg = NULL;
+ break;
+ }
+ }
+
+ if (msg)
+ goto done;
+
+ /* obtain bad sector table if requested and present */
+ if (osdep && (lp->d_flags & D_BADSECT)) {
+ struct dkbad *db;
+
+ bdp = &osdep->bad;
+ i = 0;
+ do {
+ /* read a bad sector table */
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
+ bp->b_blkno = lp->d_secperunit - lp->d_nsectors + i;
+ if (lp->d_secsize > DEV_BSIZE)
+ bp->b_blkno *= lp->d_secsize / DEV_BSIZE;
+ else
+ bp->b_blkno /= DEV_BSIZE / lp->d_secsize;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_cylinder = lp->d_ncylinders - 1;
+ (*strat)(bp);
+
+ /* if successful, validate, otherwise try another */
+ if (biowait(bp)) {
+ msg = "bad sector table I/O error";
+ } else {
+ db = (struct dkbad *)(bp->b_data);
+#define DKBAD_MAGIC 0x4321
+ if (db->bt_mbz == 0
+ && db->bt_flag == DKBAD_MAGIC) {
+ msg = NULL;
+ *bdp = *db;
+ break;
+ } else
+ msg = "bad sector table corrupted";
+ }
+ } while ((bp->b_flags & B_ERROR) && (i += 2) < 10 &&
+ i < lp->d_nsectors);
+ }
+
+done:
+ brelse(bp);
+ return (msg);
+}
+
+/*
+ * Check new disk label for sensibility
+ * before setting it.
+ */
+int
+setdisklabel(olp, nlp, openmask, osdep)
+ struct disklabel *olp, *nlp;
+ u_long openmask;
+ struct cpu_disklabel *osdep;
+{
+ int i;
+ struct partition *opp, *npp;
+
+ /* sanity clause */
+ if (nlp->d_secpercyl == 0 || nlp->d_secsize == 0
+ || (nlp->d_secsize % DEV_BSIZE) != 0)
+ return(EINVAL);
+
+ /* special case to allow disklabel to be invalidated */
+ if (nlp->d_magic == 0xffffffff) {
+ *olp = *nlp;
+ return (0);
+ }
+
+ if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
+ dkcksum(nlp) != 0)
+ return (EINVAL);
+
+ /* XXX missing check if other dos partitions will be overwritten */
+
+ while (openmask != 0) {
+ i = ffs(openmask) - 1;
+ openmask &= ~(1 << i);
+ if (nlp->d_npartitions <= i)
+ return (EBUSY);
+ opp = &olp->d_partitions[i];
+ npp = &nlp->d_partitions[i];
+ if (npp->p_offset != opp->p_offset || npp->p_size < opp->p_size)
+ return (EBUSY);
+ /*
+ * Copy internally-set partition information
+ * if new label doesn't include it. XXX
+ */
+ if (npp->p_fstype == FS_UNUSED && opp->p_fstype != FS_UNUSED) {
+ npp->p_fstype = opp->p_fstype;
+ npp->p_fsize = opp->p_fsize;
+ npp->p_frag = opp->p_frag;
+ npp->p_cpg = opp->p_cpg;
+ }
+ }
+ nlp->d_checksum = 0;
+ nlp->d_checksum = dkcksum(nlp);
+ *olp = *nlp;
+ return (0);
+}
+
+
+/*
+ * Write disk label back to device after modification.
+ */
+int
+writedisklabel(dev, strat, lp, osdep)
+ dev_t dev;
+ void (*strat) __P((struct buf *));
+ struct disklabel *lp;
+ struct cpu_disklabel *osdep;
+{
+ struct mbr_partition *dp;
+ struct buf *bp;
+ struct disklabel *dlp;
+ int error, dospartoff, cyl;
+
+ /* get a buffer and initialize it */
+ bp = geteblk((int)lp->d_secsize);
+ bp->b_dev = dev;
+
+ /* do dos partitions in the process of getting disklabel? */
+ dospartoff = 0;
+ cyl = LABELSECTOR / lp->d_secpercyl;
+ if (!osdep)
+ goto nombrpart;
+ dp = osdep->dosparts;
+
+ /* read master boot record */
+ bp->b_blkno = MBR_BBSECTOR;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_flags |= B_READ;
+ bp->b_cylinder = MBR_BBSECTOR / lp->d_secpercyl;
+ (*strat)(bp);
+
+ if ((error = biowait(bp)) == 0) {
+ struct mbr_partition *ourdp = NULL;
+
+ ourdp = mbr_findslice(dp, bp);
+ if (ourdp == NO_MBR_SIGNATURE)
+ goto nombrpart;
+
+ if (ourdp) {
+ /* need sector address for SCSI/IDE,
+ cylinder for ESDI/ST506/RLL */
+ dospartoff = ourdp->mbrp_start;
+ cyl = MBR_PCYL(ourdp->mbrp_scyl, ourdp->mbrp_ssect);
+ }
+ }
+
+nombrpart:
+#ifdef maybe
+ /* disklabel in appropriate location? */
+ if (lp->d_partitions[2].p_offset != 0
+ && lp->d_partitions[2].p_offset != dospartoff) {
+ error = EXDEV;
+ goto done;
+ }
+#endif
+
+ /* next, dig out disk label */
+ bp->b_blkno = dospartoff + LABELSECTOR;
+ bp->b_cylinder = cyl;
+ bp->b_bcount = lp->d_secsize;
+ bp->b_flags &= ~(B_DONE);
+ bp->b_flags |= B_READ;
+ (*strat)(bp);
+
+ /* if successful, locate disk label within block and validate */
+ if ((error = biowait(bp)) != 0)
+ goto done;
+ for (dlp = (struct disklabel *)bp->b_data;
+ dlp <= (struct disklabel *)(bp->b_data + lp->d_secsize - sizeof(*dlp));
+ dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
+ if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
+ dkcksum(dlp) == 0) {
+ *dlp = *lp;
+ bp->b_flags &= ~(B_READ|B_DONE);
+ bp->b_flags |= B_WRITE;
+ (*strat)(bp);
+ error = biowait(bp);
+ goto done;
+ }
+ }
+ error = ESRCH;
+
+done:
+ brelse(bp);
+ return (error);
+}
+
+/*
+ * Determine the size of the transfer, and make sure it is
+ * within the boundaries of the partition. Adjust transfer
+ * if needed, and signal errors or early completion.
+ */
+int
+bounds_check_with_label(bp, lp, wlabel)
+ struct buf *bp;
+ struct disklabel *lp;
+ int wlabel;
+{
+ struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
+ int labelsector = lp->d_partitions[2].p_offset + LABELSECTOR;
+ int sz;
+
+ sz = howmany(bp->b_bcount, lp->d_secsize);
+
+ if (bp->b_blkno + sz > p->p_size) {
+ sz = p->p_size - bp->b_blkno;
+ if (sz == 0) {
+ /* If exactly at end of disk, return EOF. */
+ bp->b_resid = bp->b_bcount;
+ goto done;
+ }
+ if (sz < 0) {
+ /* If past end of disk, return EINVAL. */
+ bp->b_error = EINVAL;
+ goto bad;
+ }
+ /* Otherwise, truncate request. */
+ bp->b_bcount = sz << DEV_BSHIFT;
+ }
+
+ /* Overwriting disk label? */
+ if (bp->b_blkno + p->p_offset <= labelsector &&
+#if LABELSECTOR != 0
+ bp->b_blkno + p->p_offset + sz > labelsector &&
+#endif
+ (bp->b_flags & B_READ) == 0 && !wlabel) {
+ bp->b_error = EROFS;
+ goto bad;
+ }
+
+ /* calculate cylinder for disksort to order transfers with */
+ bp->b_cylinder = (bp->b_blkno + p->p_offset) /
+ (lp->d_secsize / DEV_BSIZE) / lp->d_secpercyl;
+ return (1);
+
+bad:
+ bp->b_flags |= B_ERROR;
+done:
+ return (0);
+}
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/conf/WDC Mon Jul 30 03:10:04 2001
@@ -0,0 +1,175 @@
+# $NetBSD: GENERIC,v 1.9 2001/02/14 04:57:44 itojun Exp $
+#
+# GENERIC -- everything that's currently supported
+#
+
+include "arch/dreamcast/conf/std.dreamcast"
+
+# Enable the hooks used for initializing the root memory-disk.
+#options MEMORY_DISK_HOOKS
+#options MEMORY_DISK_IS_ROOT # force root on memory disk
+#options MEMORY_DISK_SERVER=0 # no userspace memory disk support
+#options MINIROOTSIZE=2880 # size of memory disk, in blocks
+#options MINIROOTSIZE=6000
+
+options DONT_INIT_BSC
+
+# wscons options
+options WSEMUL_VT100 # VT100 / VT220 emulation
+options FONT_BOLD8x16
+
+maxusers 16 # estimated number of users
+
+# CPU support
+options SH7750
+options SH4
+options DREAMCAST
+# options SH4_PCMCIA
+options EVBSH4
+#options MMEYE
+options PCLOCK=50000000 # 50MHz
+options IOM_ROM_BEGIN=0x00000000
+options IOM_ROM_SIZE=0x00100000 # 1MB
+options IOM_RAM_BEGIN=0x8c000000
+options IOM_RAM_SIZE=0x01000000 # 16MB
+#options INITTODR_ALWAYS_USE_RTC
+#options BRAINS
+#options USE_RTCCLK
+#options SYNC_CLOCK_TO_RTC
+
+#options LED_ADDR=0xa8000000
+
+# Standard system options
+#options UCONSOLE # users can use TIOCCONS (for xconsole)
+#options INSECURE # disable kernel security levels
+
+#options RTC_OFFSET=-540
+options HZ=100 # clock interrupt generates every 1/HZ sec
+#options NTP # NTP phase/frequency locked loop
+
+#options KTRACE # system call tracing via ktrace(1)
+
+#options SYSVMSG # System V-like message queues
+#options SYSVSEM # System V-like semaphores
+#options SYSVSHM # System V-like memory sharing
+#options SHMMAXPGS=1024 # 1024 pages is the default
+
+# Diagnostic/debugging support options
+#options DIAGNOSTIC # cheap kernel consistency checks
+#options DEBUG # expensive debugging checks/support
+#options DDB # in-kernel debugger
+#makeoptions DEBUG="-g" # compile full symbol table
+#options SYSCALL_DEBUG
+#options UVMHIST
+#options UVMHIST_PRINT
+
+# Compatibility options
+#options COMPAT_13 # NetBSD 1.3
+#options COMPAT_14 # NetBSD 1.4,
+#options COMPAT_43 # and 4.3BSD
+
+# Executable format options
+options EXEC_COFF # COFF executables
+options EXEC_ELF32 # 32-bit ELF executables
+
+# File systems
+file-system FFS # UFS
+file-system MFS # memory file system
+file-system NFS # Network File System client
+file-system PROCFS # /proc
+file-system KERNFS # /kern
+file-system NULLFS # loopback file system
+file-system UMAPFS # NULLFS + uid and gid remapping
+file-system CD9660 # CD-ROM file system
+
+# File system options
+options QUOTA # UFS quotas
+options NFSSERVER # Network File System server
+
+# Networking options
+options INET # IP + ICMP + TCP + UDP
+options NFS_BOOT_DHCP # Support DHCP NFS root
+
+#options PCIVERBOSE # verbose PCI device autoconfig messages
+#options PCI_CONFIG_DUMP # verbosely dump PCI config space
+#options PCMCIAVERBOSE # verbose PCMCIA configuration messages
+
+# Kernel root file system and dump configuration.
+#config netbsd root on ? type nfs
+#config netbsd root on wd0a type ffs
+config netbsd root on ? type ?
+
+#
+# Device configuration
+#
+
+mainbus0 at root
+
+shb* at mainbus?
+
+# Serial Devices
+options SCIFCN_SPEED=57600
+scif0 at shb? port 0xffe80000 irq 12
+
+pvr0 at shb?
+wsdisplay* at pvr? console ?
+
+maple0 at shb?
+mkbd* at maple? port ? subunit ?
+wskbd* at mkbd? console ?
+
+gdrom0 at shb?
+
+#g2bus0 at shb?
+#gapspci* at g2bus? # GAPS PCI bridge
+#pci* at gapspci?
+#rtk* at pci? dev ? function ? # SEGA Broadband Adapter
+#ukphy* at mii? phy ?
+
+# DC-PP bus
+dppbus0 at shb?
+wdc* at dppbus?
+wd* at wdc? drive?
+#ne0 at dppbus?
+
+# ATAPI bus support
+atapibus* at wdc? channel ?
+
+# ATAPI devices
+# flags have the same meaning as for IDE drives.
+cd* at atapibus? drive ? flags 0x0000 # ATAPI CD-ROM drives
+sd* at atapibus? drive ? flags 0x0000 # ATAPI disk drives
+uk* at atapibus? drive ? flags 0x0000 # ATAPI unknown
+
+# SH PCMCIA controllers
+#shpcic0 at shb? port 0xb000000a iomem 0xb8000000 iosiz 0x1000000
+#shpcic1 at shb? port 0xb000000c iomem 0xb9000000 iosiz 0x1000000
+
+# PCMCIA bus support
+#pcmcia* at shpcic? controller ? socket ?
+
+#com* at pcmcia? function ? # Modems and serial cards
+#wdc* at pcmcia? function ?
+#wd* at wdc? drive ? # the drives themselves
+
+#ep* at pcmcia? function ? # 3Com 3c589 and 3c562 Ethernet
+#mbe* at pcmcia? function ? # MB8696x based Ethernet
+#ne* at pcmcia? function ? # NE2000-compatible Ethernet
+#sm* at pcmcia? function ? # Megahertz Ethernet
+
+#pseudo-device vnd 4 # disk-like interface to files
+#pseudo-device bpfilter 8 # Berkeley packet filter
+#pseudo-device ipfilter # IP filter (firewall) and NAT
+pseudo-device loop # network loopback
+pseudo-device pty # pseudo-terminals
+#pseudo-device ppp 2 # Point-to-Point Protocol
+#pseudo-device tun 2 # network tunneling over tty
+pseudo-device rnd # /dev/random and in-kernel generator
+
+# Enable the hooks used for initializing the root memory-disk.
+#options MEMORY_DISK_HOOKS
+#options MEMORY_DISK_IS_ROOT # force root on memory disk
+#options MEMORY_DISK_SERVER=0 # no userspace memory disk support
+#options MINIROOTSIZE=3074 # size of memory disk, in blocks
+
+#pseudo-device md 1 # memory disk device (ramdisk)
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/dev/dpp/wdc_dppbus.c Wed Aug 1 22:23:26 2001
@@ -0,0 +1,173 @@
+/* $NetBSD: wdc_isa.c,v 1.19 2000/04/02 02:07:52 itojun Exp $ */
+
+/*-
+ * Copyright (c) 1998 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum and by Onno van der Linden.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+#include <sys/malloc.h>
+#include <sys/callout.h>
+
+#include <machine/bus.h>
+#include <machine/intr.h>
+#include <sh3/bscreg.h>
+#include <machine/shbvar.h>
+#include <machine/sysasicvar.h>
+
+#include <arch/dreamcast/dev/dpp/dppbusvar.h>
+
+#include <dev/ata/atavar.h>
+#include <dev/ic/wdcvar.h>
+
+#define WDC_DPPBUS_REG 0xb4000020
+#define WDC_DPPBUS_REG_NPORTS 8
+#define WDC_DPPBUS_AUXREG_OFFSET 0x38
+#define WDC_DPPBUS_AUXREG_NPORTS 1
+#define WDC_DPPBUS_IRQADDR 0xb4000080
+#define WDC_DPPBUS_IRQBIT 0x0001
+
+struct wdc_dppbus_softc {
+ struct wdc_softc sc_wdcdev;
+ struct channel_softc *wdc_chanptr;
+ struct channel_softc wdc_channel;
+ struct callout sc_intremu;
+ int sc_drq;
+ void *sc_ih;
+};
+
+int wdc_dppbus_match __P((struct device *, struct cfdata *, void *));
+void wdc_dppbus_attach __P((struct device *, struct device *, void *));
+void wdc_dppbus_intr __P((void *));
+
+struct cfattach wdc_dppbus_ca = {
+ sizeof(struct wdc_dppbus_softc), wdc_dppbus_match, wdc_dppbus_attach
+};
+
+void
+wdc_dppbus_intr(v)
+ void *v;
+{
+ struct wdc_dppbus_softc *sc = v;
+ int s;
+ u_int16_t irqs;
+
+ irqs = (*(__volatile u_int16_t *)WDC_DPPBUS_IRQADDR);
+ if((irqs & WDC_DPPBUS_IRQBIT) == WDC_DPPBUS_IRQBIT) {
+ s = splbio();
+ wdcintr(&sc->wdc_channel);
+ splx(s);
+ }
+
+ callout_reset(&sc->sc_intremu, 1, wdc_dppbus_intr, sc);
+}
+
+int
+wdc_dppbus_match(parent, match, aux)
+ struct device *parent;
+ struct cfdata *match;
+ void *aux;
+{
+ struct channel_softc ch;
+ struct dppbus_attach_args *da = aux;
+ int result = 0;
+
+ memset(&ch, 0, sizeof(ch));
+
+ ch.cmd_iot = da->da_memt;
+ if (bus_space_map(ch.cmd_iot, WDC_DPPBUS_REG, WDC_DPPBUS_REG_NPORTS, 0,
+ &ch.cmd_ioh))
+ goto out;
+
+ ch.ctl_iot = da->da_memt;
+ if (bus_space_map(ch.ctl_iot, WDC_DPPBUS_REG + WDC_DPPBUS_AUXREG_OFFSET,
+ WDC_DPPBUS_AUXREG_NPORTS, 0, &ch.ctl_ioh))
+ goto outunmap;
+
+ result = wdcprobe(&ch);
+
+ bus_space_unmap(ch.ctl_iot, ch.ctl_ioh, WDC_DPPBUS_AUXREG_NPORTS);
+outunmap:
+ bus_space_unmap(ch.cmd_iot, ch.cmd_ioh, WDC_DPPBUS_REG_NPORTS);
+out:
+ return (result);
+}
+
+void
+wdc_dppbus_attach(parent, self, aux)
+ struct device *parent, *self;
+ void *aux;
+{
+ struct wdc_dppbus_softc *sc = (void *)self;
+ struct dppbus_attach_args *da = aux;
+
+ printf("\n");
+
+ sc->wdc_channel.cmd_iot = da->da_memt;
+ sc->wdc_channel.ctl_iot = da->da_memt;
+ if (bus_space_map(sc->wdc_channel.cmd_iot, WDC_DPPBUS_REG,
+ WDC_DPPBUS_REG_NPORTS, 0, &sc->wdc_channel.cmd_ioh) ||
+ bus_space_map(sc->wdc_channel.ctl_iot,
+ WDC_DPPBUS_REG+WDC_DPPBUS_AUXREG_OFFSET, WDC_DPPBUS_AUXREG_NPORTS,
+ 0, &sc->wdc_channel.ctl_ioh)) {
+ printf("%s: couldn't map registers\n",
+ sc->sc_wdcdev.sc_dev.dv_xname);
+ }
+ sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
+ sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh;
+
+ callout_init(&sc->sc_intremu);
+ callout_reset(&sc->sc_intremu, 1,
+ wdc_dppbus_intr, sc);
+
+ sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA;
+ sc->sc_wdcdev.PIO_cap = 0;
+ sc->wdc_chanptr = &sc->wdc_channel;
+ sc->sc_wdcdev.channels = &sc->wdc_chanptr;
+ sc->sc_wdcdev.nchannels = 1;
+ sc->wdc_channel.channel = 0;
+ sc->wdc_channel.wdc = &sc->sc_wdcdev;
+ sc->wdc_channel.ch_queue = malloc(sizeof(struct channel_queue),
+ M_DEVBUF, M_NOWAIT);
+ if (sc->wdc_channel.ch_queue == NULL) {
+ printf("%s: can't allocate memory for command queue",
+ sc->sc_wdcdev.sc_dev.dv_xname);
+ return;
+ }
+ wdcattach(&sc->wdc_channel);
+}
+
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/dev/dpp/dppbus_bus_mem.c Wed Aug 1 21:28:38 2001
@@ -0,0 +1,325 @@
+/* $NetBSD: g2bus_bus_mem.c,v 1.3 2001/02/01 01:01:50 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Bus space implementation for the SEGA G2 bus.
+ *
+ * NOTE: We only implement a small subset of what the bus_space(9)
+ * API specifies. Right now, the GAPS PCI bridge is only used for
+ * the Dreamcast Broadband Adatper, so we only provide what the
+ * pci(4) and rtk(4) drivers need.
+ */
+
+#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/device.h>
+
+#include <machine/cpu.h>
+#include <machine/bus.h>
+#include <machine/cpufunc.h>
+
+#include <dreamcast/dev/dpp/dppbusvar.h>
+
+#define DPPBUS_STRIDE 2
+
+int dppbus_bus_mem_map(void *, bus_addr_t, bus_size_t, int,
+ bus_space_handle_t *);
+void dppbus_bus_mem_unmap(void *, bus_space_handle_t, bus_size_t);
+
+u_int8_t dppbus_bus_mem_read_1(void *, bus_space_handle_t, bus_size_t);
+u_int16_t dppbus_bus_mem_read_2(void *, bus_space_handle_t, bus_size_t);
+u_int32_t dppbus_bus_mem_read_4(void *, bus_space_handle_t, bus_size_t);
+
+void dppbus_bus_mem_write_1(void *, bus_space_handle_t, bus_size_t,
+ u_int8_t);
+void dppbus_bus_mem_write_2(void *, bus_space_handle_t, bus_size_t,
+ u_int16_t);
+void dppbus_bus_mem_write_4(void *, bus_space_handle_t, bus_size_t,
+ u_int32_t);
+
+void dppbus_bus_mem_read_region_1(void *, bus_space_handle_t, bus_size_t,
+ u_int8_t *, bus_size_t);
+
+void dppbus_bus_mem_read_multi_1(void *, bus_space_handle_t, bus_size_t,
+ u_int8_t *, bus_size_t);
+
+void dppbus_bus_mem_read_multi_2(void *, bus_space_handle_t, bus_size_t,
+ u_int16_t *, bus_size_t);
+
+void dppbus_bus_mem_write_region_1(void *, bus_space_handle_t, bus_size_t,
+ const u_int8_t *, bus_size_t);
+
+void dppbus_bus_mem_write_multi_1(void *, bus_space_handle_t, bus_size_t,
+ const u_int8_t *, bus_size_t);
+
+void dppbus_bus_mem_write_multi_2(void *, bus_space_handle_t, bus_size_t,
+ const u_int16_t *, bus_size_t);
+
+int dppbus_space_subregion(void *, bus_space_handle_t, bus_size_t,
+ bus_size_t, bus_space_handle_t *);
+
+
+void
+dppbus_bus_mem_init(struct dppbus_softc *sc)
+{
+ bus_space_tag_t t = &sc->sc_memt;
+
+ memset(t, 0, sizeof(*t));
+
+ t->dbs_map = dppbus_bus_mem_map;
+ t->dbs_unmap = dppbus_bus_mem_unmap;
+
+ t->dbs_r_1 = dppbus_bus_mem_read_1;
+ t->dbs_r_2 = dppbus_bus_mem_read_2;
+// t->dbs_r_4 = dppbus_bus_mem_read_4;
+
+ t->dbs_w_1 = dppbus_bus_mem_write_1;
+ t->dbs_w_2 = dppbus_bus_mem_write_2;
+// t->dbs_w_4 = dppbus_bus_mem_write_4;
+
+ t->dbs_rr_1 = dppbus_bus_mem_read_region_1;
+
+ t->dbs_wr_1 = dppbus_bus_mem_write_region_1;
+
+ t->dbs_rm_1 = dppbus_bus_mem_read_multi_1;
+ t->dbs_rm_2 = dppbus_bus_mem_read_multi_2;
+
+ t->dbs_wm_1 = dppbus_bus_mem_write_multi_1;
+ t->dbs_wm_2 = dppbus_bus_mem_write_multi_2;
+
+ t->dbs_subregion = dppbus_space_subregion;
+}
+
+int
+dppbus_bus_mem_map(void *v, bus_addr_t addr, bus_size_t size, int flags,
+ bus_space_handle_t *shp)
+{
+
+ //KASSERT((addr & SH3_PHYS_MASK) == addr);
+ *shp = SH3_PHYS_TO_P2SEG(addr);
+
+ return (0);
+}
+
+void
+dppbus_bus_mem_unmap(void *v, bus_space_handle_t sh, bus_size_t size)
+{
+
+ //KASSERT(sh >= SH3_P2SEG_BASE && sh <= SH3_P2SEG_END);
+ /* Nothing to do. */
+}
+
+int
+dppbus_space_subregion(void *v, bus_space_handle_t handle,
+ bus_size_t offset, bus_size_t size, bus_space_handle_t *nhandlep)
+{
+ *nhandlep = handle + (offset<<DPPBUS_STRIDE);
+ return (0);
+}
+
+#define DPP_DELAY
+#define DPP_DELAY_ENTER DPP_DELAY
+#define DPP_DELAY_EXIT
+#define DPP_DELAY_WRITE_ENTER DPP_DELAY
+#define DPP_DELAY_WRITE_EXIT
+
+u_int8_t
+dppbus_bus_mem_read_1(void *v, bus_space_handle_t sh, bus_size_t off)
+{
+ u_int8_t rv;
+
+ DPP_DELAY_ENTER;
+
+ rv = (*(__volatile u_int16_t *)(sh + (off<<DPPBUS_STRIDE))) & 0xff;
+
+ DPP_DELAY_EXIT;
+
+ return (rv);
+}
+
+u_int16_t
+dppbus_bus_mem_read_2(void *v, bus_space_handle_t sh, bus_size_t off)
+{
+ u_int16_t rv;
+
+ DPP_DELAY_ENTER;
+
+ rv = *(__volatile u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ DPP_DELAY_EXIT;
+
+ return (rv);
+}
+
+u_int32_t
+dppbus_bus_mem_read_4(void *v, bus_space_handle_t sh, bus_size_t off)
+{
+ u_int32_t rv;
+
+ DPP_DELAY_ENTER;
+
+ rv = *(__volatile u_int32_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ DPP_DELAY_EXIT;
+
+ return (rv);
+}
+
+void
+dppbus_bus_mem_write_1(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int8_t val)
+{
+
+ DPP_DELAY_WRITE_ENTER;
+
+ *(__volatile u_int16_t *)(sh + (off<<DPPBUS_STRIDE)) = val & 0xff;
+
+ DPP_DELAY_WRITE_EXIT;
+}
+
+void
+dppbus_bus_mem_write_2(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int16_t val)
+{
+
+ DPP_DELAY_WRITE_ENTER;
+
+ *(__volatile u_int16_t *)(sh + (off<<DPPBUS_STRIDE)) = val;
+
+ DPP_DELAY_WRITE_EXIT;
+}
+
+void
+dppbus_bus_mem_write_4(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int32_t val)
+{
+
+ DPP_DELAY_WRITE_ENTER;
+
+ *(__volatile u_int16_t *)(sh + (off<<DPPBUS_STRIDE)) = val;
+
+ DPP_DELAY_WRITE_EXIT;
+}
+
+void
+dppbus_bus_mem_read_region_1(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int8_t *addr, bus_size_t len)
+{
+ __volatile const u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+
+ while (len--) {
+ DPP_DELAY_ENTER;
+ *addr++ = *baddr++;
+ baddr++;
+ DPP_DELAY_EXIT;
+ }
+
+}
+
+void
+dppbus_bus_mem_read_multi_1(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int8_t *addr, bus_size_t len)
+{
+ __volatile const u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ while (len--) {
+ DPP_DELAY_ENTER;
+ *addr++ = (*baddr) & 0xff;
+ DPP_DELAY_EXIT;
+ }
+
+}
+
+void
+dppbus_bus_mem_read_multi_2(void *v, bus_space_handle_t sh, bus_size_t off,
+ u_int16_t *addr, bus_size_t len)
+{
+ __volatile const u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ while (len--) {
+ DPP_DELAY_ENTER;
+ *addr++ = *baddr;
+ DPP_DELAY_EXIT;
+ }
+}
+
+void
+dppbus_bus_mem_write_region_1(void *v, bus_space_handle_t sh, bus_size_t off,
+ const u_int8_t *addr, bus_size_t len)
+{
+ __volatile u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ while (len--) {
+ DPP_DELAY_WRITE_ENTER;
+ *baddr++ = *addr++;
+ baddr++;
+ DPP_DELAY_WRITE_EXIT;
+ }
+}
+
+void
+dppbus_bus_mem_write_multi_1(void *v, bus_space_handle_t sh, bus_size_t off,
+ const u_int8_t *addr, bus_size_t len)
+{
+ __volatile u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+
+ while (len--) {
+ DPP_DELAY_WRITE_ENTER;
+ *baddr = (*addr++) & 0xff;
+ DPP_DELAY_WRITE_EXIT;
+ }
+}
+
+void
+dppbus_bus_mem_write_multi_2(void *v, bus_space_handle_t sh, bus_size_t off,
+ const u_int16_t *addr, bus_size_t len)
+{
+ __volatile u_int16_t *baddr = (u_int16_t *)(sh + (off<<DPPBUS_STRIDE));
+
+ while (len--) {
+ DPP_DELAY_WRITE_ENTER;
+ *baddr = *addr++;
+ DPP_DELAY_WRITE_EXIT;
+ }
+}
+
+
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/dev/dpp/dppbus.c Wed Aug 1 21:12:09 2001
@@ -0,0 +1,100 @@
+/* $NetBSD: g2bus.c,v 1.1 2001/01/31 18:33:24 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2001 Marcus Comstedt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Marcus Comstedt.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/conf.h>
+#include <sys/malloc.h>
+#include <sys/device.h>
+#include <sys/proc.h>
+
+#include <dreamcast/dev/dpp/dppbusvar.h>
+
+int dppbusmatch(struct device *, struct cfdata *, void *);
+void dppbusattach(struct device *, struct device *, void *);
+int dppbusprint(void *, const char *);
+
+struct cfattach dppbus_ca = {
+ sizeof(struct dppbus_softc), dppbusmatch, dppbusattach
+};
+
+int dppbussearch(struct device *, struct cfdata *, void *);
+
+int
+dppbusmatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+ struct shb_attach_args *sa = aux;
+
+ if (strcmp("dppbus", cf->cf_driver->cd_name))
+ return (0);
+
+ sa->ia_iosize = 0 /* */;
+ return (1);
+}
+
+void
+dppbusattach(struct device *parent, struct device *self, void *aux)
+{
+ struct dppbus_softc *sc = (void *) self;
+ struct dppbus_attach_args da;
+
+ printf("\n");
+
+ TAILQ_INIT(&sc->sc_subdevs);
+
+ dppbus_bus_mem_init(sc);
+
+ da.da_memt = &sc->sc_memt;
+
+ config_search(dppbussearch, self, &da);
+}
+
+int
+dppbusprint(void *aux, const char *pnp)
+{
+
+ return (UNCONF);
+}
+
+int
+dppbussearch(struct device *parent, struct cfdata *cf, void *aux)
+{
+
+ if ((*cf->cf_attach->ca_match)(parent, cf, aux) > 0)
+ config_attach(parent, cf, aux, dppbusprint);
+
+ return (0);
+}
+
--- /dev/null Fri Aug 3 00:29:59 2001
+++ sys/arch/dreamcast/dev/dpp/dppbusvar.h Wed Aug 1 21:37:13 2001
@@ -0,0 +1,70 @@
+/* $NetBSD: g2busvar.h,v 1.1 2001/01/31 18:33:24 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 2001 Marcus Comstedt
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by Marcus Comstedt.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _DREAMCAST_DPPBUSVAR_H_
+#define _DREAMCAST_DPPBUSVAR_H_
+
+#include <sh3/shbvar.h>
+
+/*
+ * DC-PP driver attach arguments
+ */
+struct dppbus_attach_args {
+ bus_space_tag_t da_memt;
+};
+
+/*
+ * Per-device DC-PP variables
+ */
+struct dppbusdev {
+ struct device *dd_dev; /* back pointer to generic */
+ TAILQ_ENTRY(dppbusdev)
+ dd_bchain; /* bus chain */
+};
+
+/*
+ * master bus
+ */
+struct dppbus_softc {
+ struct device sc_dev; /* base device */
+ struct dreamcast_bus_space sc_memt;
+ TAILQ_HEAD(, dppbusdev)
+ sc_subdevs; /* list of all children */
+};
+
+void dppbus_bus_mem_init(struct dppbus_softc *);
+
+#endif /* _DREAMCAST_DPPBUSVAR_H_ */
+
+
This page is the sole property of Kiyoshi Ikehara and merely mirrored by FuzzyMuzzle.com. Please direct all questions regarding this mirror's content to Kiyoshi Ikehera himself.