From e4bc285207107662b5135b1a808687eacb09a07e Mon Sep 17 00:00:00 2001 From: itojun Date: Tue, 30 Nov 1999 13:31:45 +0000 Subject: [PATCH] bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch just for reference purposes. This commit includes 1.4 -> 1.4.1 sync for kame branch. The branch does not compile at all (due to the lack of ALTQ and some other source code). Please do not try to modify the branch, this is just for referenre purposes. synchronization to latest KAME will take place on HEAD branch soon. --- sys/arch/amiga/amiga/disksubr.c | 698 ++++++++++++++++++++++++++++---- sys/arch/amiga/amiga/machdep.c | 2 +- sys/arch/amiga/conf/AMIGA | 441 ++++++++++++++------ 3 files changed, 931 insertions(+), 210 deletions(-) diff --git a/sys/arch/amiga/amiga/disksubr.c b/sys/arch/amiga/amiga/disksubr.c index 713116096ce72..cfbe6f483d747 100644 --- a/sys/arch/amiga/amiga/disksubr.c +++ b/sys/arch/amiga/amiga/disksubr.c @@ -1,9 +1,100 @@ -#include "param.h" -#include "systm.h" -#include "buf.h" -#include "disklabel.h" -#include "syslog.h" +/* $NetBSD: disksubr.c,v 1.28.8.1.4.1 1999/11/30 13:31:45 itojun Exp $ */ +/* + * Copyright (c) 1994 Christian E. Hopps + * 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 +#include +#include +#include +#include +#include + +/* + * In /usr/src/sys/dev/scsipi/sd.c, routine sdstart() adjusts the + * block numbers, it changes from DEV_BSIZE units to physical units: + * blkno = bp->b_blkno / (lp->d_secsize / DEV_BSIZE); + * As long as media with sector sizes of 512 bytes are used, this + * doesn't matter (divide by 1), but for successfull usage of media with + * greater sector sizes (e.g. 640MB MO-media with 2048 bytes/sector) + * we must multiply block numbers with (lp->d_secsize / DEV_BSIZE) + * to keep "unchanged" physical block numbers. + */ +#define SD_C_ADJUSTS_NR + +/* + * bitmap id's + */ +#define RDBLOCK_BID 1 +#define PARTBLOCK_BID 2 +#define BADBLOCK_BID 3 +#define FSBLOCK_BID 4 +#define LSEGBLOCK_BID 5 + +struct rdbmap { + long firstblk; + long lastblk; + int bigtype; + struct { + short next; + short prev; + char shortid; + } big[0]; + struct { + char next; + char prev; + char shortid; + } tab[0]; +}; + +#define b_cylin b_resid +#define baddr(bp) (void *)((bp)->b_un.b_addr) + +u_long rdbchksum __P((void *)); +struct adostype getadostype __P((u_long)); +struct rdbmap *getrdbmap __P((dev_t, void (*)(struct buf *), struct disklabel *, + struct cpu_disklabel *)); + +/* XXX unknown function but needed for /sys/scsi to link */ +void +dk_establish(dk, dev) + struct disk *dk; + struct device *dev; +{ + return; +} /* * Attempt to read a disk label from a device @@ -14,68 +105,356 @@ * Returns null on success and an error string on failure. */ char * -cpu_readdisklabel(dev, strat, lp, osdep) +readdisklabel(dev, strat, lp, clp) dev_t dev; - int (*strat)(); - register struct disklabel *lp; - struct cpu_disklabel *osdep; + void (*strat)(struct buf *); + struct disklabel *lp; + struct cpu_disklabel *clp; { -#ifdef amiga - /* I don't want BSD to fiddle with the RDBs, let the user use - HDToolbox under AmigaDOS to partition disk drives. */ - return "partition drive under AmigaDOS"; -#else - register struct buf *bp; - struct disklabel *dlp; - char *msg = NULL; + struct adostype adt; + struct partition *pp = NULL; + struct partblock *pbp; + struct rdblock *rbp; + struct buf *bp; + char *msg, *bcpls, *s, bcpli; + int cindex, i, nopname; + u_long nextb; + clp->rdblock = RDBNULL; + /* + * give some guarnteed validity to + * the disklabel + */ if (lp->d_secperunit == 0) lp->d_secperunit = 0x1fffffff; - lp->d_npartitions = 1; - if (lp->d_partitions[0].p_size == 0) - lp->d_partitions[0].p_size = 0x1fffffff; - lp->d_partitions[0].p_offset = 0; + if (lp->d_secpercyl == 0) + lp->d_secpercyl = 0x1fffffff; + lp->d_npartitions = RAW_PART + 1; + + for (i = 0; i < MAXPARTITIONS; i++) { + clp->pbindex[i] = -1; + clp->pblist[i] = RDBNULL; + if (i == RAW_PART) + continue; + lp->d_partitions[i].p_size = 0; + lp->d_partitions[i].p_offset = 0; + } + if (lp->d_partitions[RAW_PART].p_size == 0) + lp->d_partitions[RAW_PART].p_size = 0x1fffffff; + lp->d_partitions[RAW_PART].p_offset = 0; + + /* obtain buffer to probe drive with */ + bp = (void *)geteblk((int)lp->d_secsize); - bp = geteblk((int)lp->d_secsize); + /* + * request no partition relocation by driver on I/O operations + */ +#ifdef _KERNEL + bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); +#else bp->b_dev = dev; - bp->b_blkno = LABELSECTOR; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_BUSY | B_READ; - bp->b_cylin = LABELSECTOR / lp->d_secpercyl; - (*strat)(bp); - if (biowait(bp)) { - msg = "I/O error"; - } else for (dlp = (struct disklabel *)bp->b_un.b_addr; - dlp <= (struct disklabel *)(bp->b_un.b_addr+DEV_BSIZE-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"; +#endif + msg = NULL; + + /* + * find the RDB block + * XXX Need to check for a standard label if this fails (fd0 etc..) + */ + for (nextb = 0; nextb < RDB_MAXBLOCKS; nextb++) { + bp->b_blkno = nextb; + bp->b_cylin = bp->b_blkno / lp->d_secpercyl; + bp->b_bcount = lp->d_secsize; + bp->b_flags = B_BUSY | B_READ; +#ifdef SD_C_ADJUSTS_NR + bp->b_blkno *= (lp->d_secsize / DEV_BSIZE); +#endif + strat(bp); + + if (biowait(bp)) { + msg = "rdb scan I/O error"; + goto done; + } + rbp = baddr(bp); + if (rbp->id == RDBLOCK_ID) { + if (rdbchksum(rbp) == 0) + break; + else + msg = "rdb bad checksum"; + } + } + if (nextb == RDB_MAXBLOCKS) { + if (msg == NULL) + msg = "no rdb found"; + goto done; + } else if (msg) { + /* + * maybe we found an invalid one before a valid. + * clear err. + */ + msg = NULL; + } + clp->rdblock = nextb; + + lp->d_secsize = rbp->nbytes; + lp->d_nsectors = rbp->nsectors; + lp->d_ntracks = rbp->nheads; + /* + * should be rdb->ncylinders however this is a bogus value + * sometimes it seems + */ + if (rbp->highcyl == 0) + lp->d_ncylinders = rbp->ncylinders; + else + lp->d_ncylinders = rbp->highcyl + 1; + /* + * I also don't trust rdb->secpercyl + */ + lp->d_secpercyl = min(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks); + if (lp->d_secpercyl == 0) + lp->d_secpercyl = lp->d_nsectors * lp->d_ntracks; +#ifdef DIAGNOSTIC + if (lp->d_ncylinders != rbp->ncylinders) + printf("warning found rdb->ncylinders(%ld) != " + "rdb->highcyl(%ld) + 1\n", rbp->ncylinders, + rbp->highcyl); + if (lp->d_nsectors * lp->d_ntracks != rbp->secpercyl) + printf("warning found rdb->secpercyl(%ld) != " + "rdb->nsectors(%ld) * rdb->nheads(%ld)\n", rbp->secpercyl, + rbp->nsectors, rbp->nheads); +#endif + lp->d_sparespercyl = + max(rbp->secpercyl, lp->d_nsectors * lp->d_ntracks) + - lp->d_secpercyl; + if (lp->d_sparespercyl == 0) + lp->d_sparespertrack = 0; + else { + lp->d_sparespertrack = lp->d_sparespercyl / lp->d_ntracks; +#ifdef DIAGNOSTIC + if (lp->d_sparespercyl % lp->d_ntracks) + printf("warning lp->d_sparespercyl(%d) not multiple " + "of lp->d_ntracks(%d)\n", lp->d_sparespercyl, + lp->d_ntracks); +#endif + } + + lp->d_secperunit = lp->d_secpercyl * lp->d_ncylinders; + lp->d_acylinders = rbp->ncylinders - (rbp->highcyl - rbp->lowcyl + 1); + lp->d_rpm = 3600; /* good guess I suppose. */ + lp->d_interleave = rbp->interleave; + lp->d_headswitch = lp->d_flags = lp->d_trackskew = lp->d_cylskew = 0; + lp->d_trkseek = /* rbp->steprate */ 0; + + /* + * raw partition gets the entire disk + */ + lp->d_partitions[RAW_PART].p_size = rbp->ncylinders * lp->d_secpercyl; + + /* + * scan for partition blocks + */ + nopname = 1; + cindex = 0; + for (nextb = rbp->partbhead; nextb != RDBNULL; nextb = pbp->next) { + bp->b_blkno = nextb; + bp->b_cylin = bp->b_blkno / lp->d_secpercyl; + bp->b_bcount = lp->d_secsize; + bp->b_flags = B_BUSY | B_READ; +#ifdef SD_C_ADJUSTS_NR + bp->b_blkno *= (lp->d_secsize / DEV_BSIZE); +#endif + strat(bp); + + if (biowait(bp)) { + msg = "partition scan I/O error"; + goto done; + } + pbp = baddr(bp); + + if (pbp->id != PARTBLOCK_ID) { + msg = "partition block with bad id"; + goto done; + } + if (rdbchksum(pbp)) { + msg = "partition block bad checksum"; + goto done; + } + + if (pbp->e.tabsize < 11) { + /* + * not enough info, too funky for us. + * I don't want to skip I want it fixed. + */ + msg = "bad partition info (environ < 11)"; + goto done; + continue; + } + + /* + * XXXX should be ">" however some vendors don't know + * what a table size is so, we hack for them. + * the other checks can fail for all I care but this + * is a very common value. *sigh*. + */ + if (pbp->e.tabsize >= 16) + adt = getadostype(pbp->e.dostype); else { - *lp = *dlp; - msg = NULL; + adt.archtype = ADT_UNKNOWN; + adt.fstype = FS_UNUSED; + } + + switch (adt.archtype) { + case ADT_NETBSDROOT: + pp = &lp->d_partitions[0]; + if (pp->p_size) { + printf("WARN: more than one root, ignoring\n"); + clp->rdblock = RDBNULL; /* invlidate cpulab */ + continue; + } + break; + case ADT_NETBSDSWAP: + pp = &lp->d_partitions[1]; + if (pp->p_size) { + printf("WARN: more than one swap, ignoring\n"); + clp->rdblock = RDBNULL; /* invlidate cpulab */ + continue; + } + break; + case ADT_NETBSDUSER: + case ADT_AMIGADOS: + case ADT_AMIX: + case ADT_EXT2: + case ADT_UNKNOWN: + pp = &lp->d_partitions[lp->d_npartitions]; break; } + if (lp->d_npartitions <= (pp - lp->d_partitions)) + lp->d_npartitions = (pp - lp->d_partitions) + 1; + +#ifdef DIAGNOSTIC + if (lp->d_secpercyl * lp->d_secsize != + (pbp->e.secpertrk * pbp->e.numheads * pbp->e.sizeblock<<2)) { + if (pbp->partname[0] < sizeof(pbp->partname)) + pbp->partname[pbp->partname[0] + 1] = 0; + else + pbp->partname[sizeof(pbp->partname) - 1] = 0; + printf("Partition '%s' geometry %ld/%ld differs", + pbp->partname + 1, pbp->e.numheads, + pbp->e.secpertrk); + printf(" from RDB %d/%d\n", lp->d_ntracks, + lp->d_nsectors); + } +#endif + /* + * insert sort in increasing offset order + */ + while ((pp - lp->d_partitions) > RAW_PART + 1) { + daddr_t boff; + + boff = pbp->e.lowcyl * pbp->e.secpertrk + * pbp->e.numheads; + if (boff > (pp - 1)->p_offset) + break; + *pp = *(pp - 1); /* struct copy */ + pp--; + } + i = (pp - lp->d_partitions); + if (nopname || i == 1) { + /* + * either we have no packname yet or we found + * the swap partition. copy BCPL string into packname + * [the reason we use the swap partition: the user + * can supply a decent packname without worry + * of having to access an odly named partition + * under AmigaDos] + */ + s = lp->d_packname; + bcpls = &pbp->partname[1]; + bcpli = pbp->partname[0]; + if (sizeof(lp->d_packname) <= bcpli) + bcpli = sizeof(lp->d_packname) - 1; + while (bcpli--) + *s++ = *bcpls++; + *s = 0; + nopname = 0; + } + + pp->p_size = (pbp->e.highcyl - pbp->e.lowcyl + 1) + * pbp->e.secpertrk * pbp->e.numheads + * ((pbp->e.sizeblock << 2) / lp->d_secsize); + pp->p_offset = pbp->e.lowcyl * pbp->e.secpertrk + * pbp->e.numheads + * ((pbp->e.sizeblock << 2) / lp->d_secsize); + pp->p_fstype = adt.fstype; + if (adt.archtype == ADT_AMIGADOS) { + /* + * Save reserved blocks at begin in cpg and + * adjust size by reserved blocks at end + */ + int bsize, secperblk, minbsize, prefac; + + minbsize = max(512, lp->d_secsize); + + bsize = pbp->e.sizeblock << 2; + secperblk = pbp->e.secperblk; + prefac = pbp->e.prefac; + + while (bsize > minbsize) { + bsize >>= 1; + secperblk <<= 1; + prefac <<= 1; + } + + if (bsize == minbsize) { + pp->p_fsize = bsize; + pp->p_frag = secperblk; + pp->p_cpg = pbp->e.resvblocks; + pp->p_size -= prefac; + } else { + adt.archtype = ADT_UNKNOWN; + adt.fstype = FS_UNUSED; + } + } else if (pbp->e.tabsize > 22 && ISFSARCH_NETBSD(adt)) { + pp->p_fsize = pbp->e.fsize; + pp->p_frag = pbp->e.frag; + pp->p_cpg = pbp->e.cpg; + } else { + pp->p_fsize = 1024; + pp->p_frag = 8; + pp->p_cpg = 0; + } + + /* + * store this partitions block number + */ + clp->pblist[clp->pbindex[i] = cindex++] = nextb; } - bp->b_flags = B_INVAL | B_AGE; + /* + * calulate new checksum. + */ + lp->d_magic = lp->d_magic2 = DISKMAGIC; + lp->d_checksum = 0; + lp->d_checksum = dkcksum(lp); + if (clp->rdblock != RDBNULL) + clp->valid = 1; +done: + if (clp->valid == 0) + clp->rdblock = RDBNULL; + bp->b_flags = B_INVAL | B_AGE | B_READ; brelse(bp); - return (msg); -#endif + return(msg); } /* * Check new disk label for sensibility * before setting it. */ -cpu_setdisklabel(olp, nlp, openmask, osdep) +int +setdisklabel(olp, nlp, openmask, clp) register struct disklabel *olp, *nlp; u_long openmask; - struct cpu_disklabel *osdep; + struct cpu_disklabel *clp; { - register i; + register int i; register struct partition *opp, *npp; if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC || @@ -107,59 +486,198 @@ cpu_setdisklabel(olp, nlp, openmask, osdep) return (0); } -/* encoding of disk minor numbers, should be elsewhere... */ -#define dkunit(dev) (minor(dev) >> 3) -#define dkpart(dev) (minor(dev) & 07) -#define dkminor(unit, part) (((unit) << 3) | (part)) - /* * Write disk label back to device after modification. + * this means write out the Rigid disk blocks to represent the + * label. Hope the user was carefull. */ -cpu_writedisklabel(dev, strat, lp, osdep) +int +writedisklabel(dev, strat, lp, clp) dev_t dev; - int (*strat)(); + void (*strat)(struct buf *); register struct disklabel *lp; - struct cpu_disklabel *osdep; + struct cpu_disklabel *clp; { -#ifdef amiga - return EINVAL; -#else + struct rdbmap *bmap; struct buf *bp; - struct disklabel *dlp; - int labelpart; - int error = 0; - - labelpart = dkpart(dev); - if (lp->d_partitions[labelpart].p_offset != 0) { - if (lp->d_partitions[0].p_offset != 0) - return (EXDEV); /* not quite right */ - labelpart = 0; - } - bp = geteblk((int)lp->d_secsize); - bp->b_dev = makedev(major(dev), dkminor(dkunit(dev), labelpart)); - bp->b_blkno = LABELSECTOR; - bp->b_bcount = lp->d_secsize; - bp->b_flags = B_READ; - (*strat)(bp); - if (error = biowait(bp)) - goto done; - for (dlp = (struct disklabel *)bp->b_un.b_addr; - dlp <= (struct disklabel *) - (bp->b_un.b_addr + 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_WRITE; - (*strat)(bp); - error = biowait(bp); - goto done; + bp = NULL; /* XXX */ + + return(EINVAL); + /* + * get write out partition list iff cpu_label is valid. + */ + if (clp->valid == 0 || + (clp->rdblock <= 0 || clp->rdblock >= RDB_MAXBLOCKS)) + return(EINVAL); + + bmap = getrdbmap(dev, strat, lp, clp); + return(EINVAL); +} + +int +bounds_check_with_label(bp, lp, wlabel) + struct buf *bp; + struct disklabel *lp; + int wlabel; +{ + struct partition *pp; + long maxsz, sz; + + pp = &lp->d_partitions[DISKPART(bp->b_dev)]; + /* + * This routine is called before sd.c adjusts block numbers + * and must take this into account + */ +#ifdef SD_C_ADJUSTS_NR + maxsz = pp->p_size * (lp->d_secsize / DEV_BSIZE); + sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT; +#else + maxsz = pp->p_size; + sz = (bp->b_bcount + lp->d_secsize - 1) / lp->d_secsize; +#endif + if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) { + if (bp->b_blkno == maxsz) { + /* + * trying to get one block beyond return EOF. + */ + bp->b_resid = bp->b_bcount; + return(0); + } + sz = maxsz - bp->b_blkno; + if (sz <= 0 || bp->b_blkno < 0) { + bp->b_error = EINVAL; + bp->b_flags |= B_ERROR; + return(-1); } + /* + * adjust count down + */ + if (bp->b_flags & B_RAW) + bp->b_bcount = sz << DEV_BSHIFT; + else + bp->b_bcount = sz * lp->d_secsize; } - error = ESRCH; -done: - brelse(bp); - return (error); + + /* + * calc cylinder for disksort to order transfers with + */ + bp->b_cylin = (bp->b_blkno + pp->p_offset) / lp->d_secpercyl; + return(1); +} + +u_long +rdbchksum(bdata) + void *bdata; +{ + u_long *blp, cnt, val; + + blp = bdata; + cnt = blp[1]; + val = 0; + + while (cnt--) + val += *blp++; + return(val); +} + +struct adostype +getadostype(dostype) + u_long dostype; +{ + struct adostype adt; + u_long t3, b1; + + t3 = dostype & 0xffffff00; + b1 = dostype & 0x000000ff; + + adt.fstype = b1; + + switch (t3) { + case DOST_NBR: + adt.archtype = ADT_NETBSDROOT; + return(adt); + case DOST_NBS: + adt.archtype = ADT_NETBSDSWAP; + return(adt); + case DOST_NBU: + adt.archtype = ADT_NETBSDUSER; + return(adt); + case DOST_MUFS: + /* check for 'muFS'? */ + adt.archtype = ADT_AMIGADOS; + adt.fstype = FS_ADOS; + return(adt); + case DOST_DOS: + adt.archtype = ADT_AMIGADOS; + if (b1 > 5) + adt.fstype = FS_UNUSED; + else + adt.fstype = FS_ADOS; + return(adt); + + case DOST_AMIX: + adt.archtype = ADT_AMIX; + if (b1 == 2) + adt.fstype = FS_BSDFFS; + else + adt.fstype = FS_UNUSED; + return(adt); + case DOST_XXXBSD: +#ifdef DIAGNOSTIC + printf("found dostype: 0x%lx which is deprecated", dostype); #endif + if (b1 == 'S') { + dostype = DOST_NBS; + dostype |= FS_SWAP; + } else { + if (b1 == 'R') + dostype = DOST_NBR; + else + dostype = DOST_NBU; + dostype |= FS_BSDFFS; + } +#ifdef DIAGNOSTIC + printf(" using: 0x%lx instead\n", dostype); +#endif + return(getadostype(dostype)); + + case DOST_EXT2: + adt.archtype = ADT_EXT2; + adt.fstype = FS_EX2FS; + return(adt); + + default: +#ifdef DIAGNOSTIC + printf("warning unknown dostype: 0x%lx marking unused\n", + dostype); +#endif + adt.archtype = ADT_UNKNOWN; + adt.fstype = FS_UNUSED; + return(adt); + } +} + +/* + * if we find a bad block we kill it (and the chain it belongs to for + * lseg or end the chain for part, badb, fshd) + */ +struct rdbmap * +getrdbmap(dev, strat, lp, clp) + dev_t dev; + void (*strat)(struct buf *); + struct disklabel *lp; + struct cpu_disklabel *clp; +{ + struct buf *bp; + + bp = (void *)geteblk(lp->d_secsize); + /* + * get the raw partition + */ + + bp->b_dev = MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART); + /* XXX finish */ + brelse(bp); + return(NULL); } diff --git a/sys/arch/amiga/amiga/machdep.c b/sys/arch/amiga/amiga/machdep.c index 201043782144d..00f6a7bfe1e1a 100644 --- a/sys/arch/amiga/amiga/machdep.c +++ b/sys/arch/amiga/amiga/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.133.2.1.4.1 1999/06/28 06:36:46 itojun Exp $ */ +/* $NetBSD: machdep.c,v 1.133.2.1.4.2 1999/11/30 13:31:46 itojun Exp $ */ /* * Copyright (c) 1988 University of Utah. diff --git a/sys/arch/amiga/conf/AMIGA b/sys/arch/amiga/conf/AMIGA index 3dfaac2b12e8d..c40b95db59032 100644 --- a/sys/arch/amiga/conf/AMIGA +++ b/sys/arch/amiga/conf/AMIGA @@ -1,119 +1,322 @@ -machine "amiga" -cpu "A3000" -ident GODZILLA - -timezone -1 dst -maxusers 16 - -# Standard options -#options QUOTA -options INET -options NFS,NFSSERVER,NFSCLIENT -options MFS -options ISOFS -options FIFO -options MSDOSFS -options KERNFS -options FDESC -#options ISO -#options TPIP - -options "COMPAT_43" -options "TCP_COMPAT_42" -options "COMPAT_NOMID" -options "HAVE_USL_UFS" -options "PANICWAIT" - -# Options for all HP machines -#options SYSVSHM -#options HPUXCOMPAT - -# Options specific to this host. -options DEBUG,DIAGNOSTIC,FPCOPROC -# options PANICBUTTON -options KTRACE -#options "BUFPAGES=900" -options "NKMEMCLUSTERS=256" -options GENERIC -#options PROFTIMER,"PRF_INTERVAL=500" -#options KGDB,"KGDBDEV=15*256+2","KGDBRATE=19200" -options "PPP_OUTQ_SIZE=4096" - -#config vmunix root on sd6a swap on sd6b -config vmunix swap generic - -# manufacturer 1 is a pseudo and stands for `builtin' -master a3000scsi0 at manufacturer 1 product 1 -master a2091scsi0 at manufacturer 514 product 3 -master gvp11scsi0 at manufacturer 2017 product 11 -#master floppy0 at manufacturer 1 product 2 - -# further builtin devices -device ser0 at manufacturer 1 product 3 -#device clock at manufacturer 1 product 4 -#device kbd at manufacturer 1 product 5 -#device par at manufacturer 1 product 6 -#device mouse at manufacturer 1 product 8 - -disk sd0 at a3000scsi0 slave 0 -disk sd0 at a2091scsi0 slave 0 -disk sd0 at gvp11scsi0 slave 0 - -disk sd1 at a3000scsi0 slave 1 -disk sd1 at a2091scsi0 slave 1 -disk sd1 at gvp11scsi0 slave 1 - -disk sd2 at a3000scsi0 slave 2 -disk sd2 at a2091scsi0 slave 2 -disk sd2 at gvp11scsi0 slave 2 - -disk sd3 at a3000scsi0 slave 3 -disk sd3 at a2091scsi0 slave 3 -disk sd3 at gvp11scsi0 slave 3 - -disk sd4 at a3000scsi0 slave 4 -disk sd4 at a2091scsi0 slave 4 -disk sd4 at gvp11scsi0 slave 4 - -disk sd5 at a3000scsi0 slave 5 -disk sd5 at a2091scsi0 slave 5 -disk sd5 at gvp11scsi0 slave 5 - -disk sd6 at a3000scsi0 slave 6 -disk sd6 at a2091scsi0 slave 6 -disk sd6 at gvp11scsi0 slave 6 - -tape st0 at a3000scsi0 slave ? -tape st0 at a2091scsi0 slave ? -tape st0 at gvp11scsi0 slave ? - -tape st1 at a3000scsi0 slave ? -tape st1 at a2091scsi0 slave ? -tape st1 at gvp11scsi0 slave ? - -device grf0 at manufacturer 1 product 7 -device grf1 at manufacturer 18260 product 6 - -# builtin clock (should all identify as "rtclock") -device rtclocka0 at manufacturer 1 product 4 -device rtclockb0 at manufacturer 1 product 9 - - -# ethernet board -device le0 at manufacturer ? product ? - -# my dear A2410 -#device tiga0 at manufacturer 1030 product 0 - -pseudo-device sl 4 -pseudo-device ppp 4 -pseudo-device bpfilter 16 -pseudo-device ite 2 -pseudo-device pty -pseudo-device loop -pseudo-device ether -pseudo-device vn 10 - -pseudo-device devpager -pseudo-device swappager -pseudo-device vnodepager +# $NetBSD: AMIGA,v 1.13.2.1.4.1 1999/11/30 13:31:47 itojun Exp $ +# +# This file was automatically created. Changes will be +# lost when running make in this directory. +# +# Created from: +#$ NetBSD: GENERIC,v 1.124 1999/05/17 19:42:56 is Exp $ + +include "arch/amiga/conf/std.amiga" + +maxusers 8 +options RTC_OFFSET=0 + +#mainboards to support (in addition to Amiga) + +options BB060STUPIDROM # You need this, if you have a non-DraCo + # MC68060 with an OS ROM up to (at least) + # V40 (OS3.1) and want to boot with the + # bootblock. + # You do not need this if you have a DraCo, + # have no 68060 or NEVER use the bootblock + +#processors this kernel should support + +options M68060 # support for 060 +options M060SP # MC68060 software support (Required for 060) + +options M68040 # support for 040 +options FPSP # MC68040 floating point support +options M68030 # support for 030 +options M68020 # support for 020/851 +options FPU_EMULATE # FPU emulation + +#Networking options + +options INET # IP networking support (Required) +#options GATEWAY # Packet forwarding +#options DIRECTED_BROADCAST # Broadcast across subnets +#options MROUTING # Multicast routing +options NS # XNS +#options NSIP # XNS tunneling over IP +options ISO,TPIP # OSI +options EON # OSI tunneling over IP +options CCITT,LLC,HDLC # X.25 +options NETATALK # AppleTalk networking protocols +options PPP_BSDCOMP # BSD-Compress compression support for PPP +options PPP_DEFLATE # Deflate compression support for PPP +options PPP_FILTER # Active filter support for PPP (requires bpf) +options PFIL_HOOKS # pfil(9) packet filter hooks +options IPFILTER_LOG # ipmon(8) log support + +file-system FFS # Berkeley fast file system +#file-system LFS # log-structured filesystem (experimental) +file-system MFS # Memory based filesystem +file-system NFS # Network File System client side code +file-system ADOSFS # AmigaDOS file system +file-system CD9660 # ISO 9660 + Rock Ridge filesystem +file-system MSDOSFS # MS-DOS filesystem +file-system FDESC # user file descriptor filesystem +file-system KERNFS # kernel data-structure filesystem +file-system NULLFS # loopback filesystem +#file-system PORTAL # Portal filesystem +file-system PROCFS # /proc filesystem +file-system UMAPFS # NULLFS + uid and gid remapping +file-system UNION # union filesystem + +#Filesystem options +options NFSSERVER # Network File System server side code +options QUOTA # User and group quotas in FFS +#options FFS_EI # FFS Endian Independant support + +#Compatability options for various existing systems + +options TCP_COMPAT_42 # compatibility with 4.2BSD TCP/IP +options COMPAT_43 # compatibility with 4.3BSD interfaces +options COMPAT_09 # compatibility with NetBSD 0.9 +options COMPAT_10 # compatibility with NetBSD 1.0 +options COMPAT_12 # compatibility with NetBSD 1.2 +options COMPAT_13 # compatibility with NetBSD 1.3 +options COMPAT_SUNOS # Support to run Sun (m68k) executables +options COMPAT_NOMID # allow nonvalid machine id executables +#options COMPAT_LINUX # Support to run Linux/m68k executables +#options EXEC_ELF32 # 32-bit ELF executables (Linux) + +#Support for System V IPC facilities. + +options SYSVSHM # System V-like shared memory +options SYSVMSG # System V-like messages +options SYSVSEM # System V-like semaphores + +#Support for various kernel options + +options KTRACE # system call tracing support +options LKM # Loadable kernel modules +options NKMEMCLUSTERS=256 # Size of kernel malloc area +options UCONSOLE # anyone can redirect a virtual console +#options INSECURE # allow, among other insecure stuff, LKM + # loading in multi-user mode. +options SCSIVERBOSE # Verbose SCSI errors + +options NTP # NTP phase/frequency locked loop + +#Misc. debugging options + +options DDB # Kernel debugger +#options DDB_HISTORY_SIZE=100 # Enable history editing in DDB +options DIAGNOSTIC # Extra kernel sanity checks +#options DEBUG # Enable misc. kernel debugging code +#options SYSCALL_DEBUG # debug all syscalls. +#options SCSIDEBUG # Add SCSI debugging statements +#options PANICBUTTON # Forced crash via keypress (???) + +#Amiga specific options + +#options LIMITMEM=24 # Do not use more than LIMITMEM MB of the + # first bank of RAM. (default: unlimited) +#options NKPTADD=4 # set this for 4 additional KPT pages +#options NKPTADDSHIFT=24 # set this for 1 additional KPT page + # per 16 MB (1<<24 bytes) of RAM + # define and decrease this, or define and + # increase NKPTADD if you get "out of PT pages" + # panics. + +#ATTENTION: There is NO WARRANTY AT ALL that the sync will be complete +#before the 10 secondinterval ends, or that KBDRESET does work at all. +#options KBDRESET # sync on Ctrl-Amiga-Amiga + +#These options improve performance with the built-in serial port +#on slower Amigas. Try the larger buffers first then lev6_defer. +#options SERIBUF_SIZE=4096 +#options SEROBUF_SIZE=32 +#options LEV6_DEFER # defers l6 to l4 (below serial l5) + +options RETINACONSOLE # enable code to allow retina to be console + +options ULOWELLCONSOLE # enable code to allow a2410 to be console +options CL5426CONSOLE # Cirrus console +options CV64CONSOLE # CyberVision console +options TSENGCONSOLE # Tseng console +options CV3DCONSOLE # CyberVision 64/3D console + +options GRF_ECS # Enhanced Chip Set +options GRF_NTSC # NTSC +options GRF_PAL # PAL +options GRF_A2024 # Support for the A2024 +options GRF_AGA # AGA Chip Set +options GRF_AGA_VGA # AGA VGAONLY timing +options GRF_SUPER72 # AGA Super-72 + +#options KFONT_8X11 # 8x11 font + +#This is how you would tell the kernel the A2410 oscillator frequencies: +#The used frequencies are the defaults, and do not need option setting +#options ULOWELL_OSC1=36000000 +#options ULOWELL_OSC2=66667000 + +#This is how you specify the blitting speed, higher values may speed up blits +#a littel bit. If you raise this value too much some trash may appear. +#the commented version is the default. +#options RH_MEMCLK=61000000 +#this option enables the 64 bit sprite which does not work +#for quite a few people. E.g. The cursor sprite will turn to a block +#when moved to the top of the screen in X. +#options RH_64BIT_SPRITE +#enables fast scroll code appears to now work on 040 systems. +#options RETINA_SPEED_HACK +#enables the Hardwarecursor which does not work on some systems. +#options RH_HARDWARECURSOR + +grfcc0 at mainbus0 # custom chips +grfrt0 at zbus0 # retina II + +grfrh0 at zbus0 # retina III + +grfcl* at zbus0 # Picasso II/Piccalo/Spectrum +grful0 at zbus0 # A2410 +grfcv0 at zbus0 # CyberVision 64 +grfet* at zbus0 # Tseng (oMniBus, Domino, Merlin) +grfcv3d0 at zbus0 # CyberVision 64/3D + +grf0 at grfcc0 +grf1 at grfrt0 + +grf2 at grfrh0 + +grf3 at grfcl? +grf4 at grful0 +grf5 at grfcv0 +grf6 at grfet? +grf7 at grfcv3d0 + +ite0 at grf0 # terminal emulators for grfs +ite1 at grf1 # terminal emulators for grfs + +ite2 at grf2 # terminal emulators for grfs + +ite3 at grf3 # terminal emulators for grfs +ite4 at grf4 # terminal emulators for grfs +ite5 at grf5 # terminal emulators for grfs +ite6 at grf6 # terminal emulators for grfs +ite7 at grf7 # terminal emulators for grfs + +msc0 at zbus0 # A2232 MSC multiport serial. +mfc0 at zbus0 # MultiFaceCard I/O board +mfcs0 at mfc0 unit 0 # MFC serial +mfcs1 at mfc0 unit 1 # MFC serial +#mfcp0 at mfc0 unit 0 # MFC parallel [not available yet] +#mfc1 at zbus0 # MultiFaceCard 2nd I/O board +#mfcs2 at mfc1 unit 0 +#mfcs3 at mfc1 unit 1 +#mfcp1 at mfc1 unit 0 + +hyper* at zbus? # zbus HyperCom3/3+/4/4+ +#hyper* at mainbus0 # not yet: HyperCom1 + HyperCom3 +com* at hyper? port ? # Hypercom3/4 serial ports +lpt* at hyper? port ? # Hypercom3+/4+ parallel port + +#Amiga Mainboard devices (sans graphics and keyboard) + +ser0 at mainbus0 # Amiga onboard serial +par0 at mainbus0 # Amiga onboard parallel +ms* at mainbus0 # Amiga mice +fdc0 at mainbus0 # Amiga FDC +fd* at fdc0 unit ? # floppy disks on the later +a34kbbc0 at mainbus0 # A3000/A4000 battery backed clock +a2kbbc0 at mainbus0 # A2000 battery backed clock +aucc* at mainbus0 # Amiga CC audio +audio* at aucc? + +#Zorro-II, Zorro-III, DraCo Direct-Bus devices (sans graphics) + +#Alas, Melody-Z2 dont configure in the DraCo bus. +melody* at zbus0 # Melody MPEG audio decoder +audio* at melody? + +#Ethernet cards: +le* at zbus0 # A2065, Ameristar, Ariadne +ne* at zbus0 # AriadneII +ed* at zbus0 # Hydra, ASDG LanRover +es* at zbus0 # CEI A4066 EthernetPLUS +qn* at zbus0 # Quicknet + +bah* at zbus0 # C=/Ameristar A2060 / 560 + +#Greater Valley Product Bus +gvpbus* at zbus0 + +#scsi stuff, all possible +gtsc0 at gvpbus? # GVP series II scsi +scsibus* at gtsc0 +ahsc0 at mainbus0 # A3000 scsi +scsibus* at ahsc0 +atzsc0 at zbus0 # A2091 scsi +scsibus* at atzsc0 +wstsc0 at zbus0 # Wordsync II scsi +scsibus* at wstsc0 +ivsc0 at zbus0 # IVS scsi +scsibus* at ivsc0 +mlhsc0 at zbus0 # Hacker scsi +scsibus* at mlhsc0 +otgsc0 at zbus0 # 12 gauge scsi +scsibus* at otgsc0 +zssc0 at zbus0 # Zeus scsi +scsibus* at zssc0 +mgnsc0 at zbus0 # Magnum scsi +scsibus* at mgnsc0 +wesc0 at zbus0 # Warp Engine scsi +scsibus* at wesc0 +afsc0 at zbus0 # A4091 scsi +scsibus* at afsc0 +aftsc0 at mainbus0 # A4000T scsi +scsibus* at aftsc0 +flsc0 at zbus0 # FastlaneZ3 scsi +scsibus* at flsc0 +bzsc0 at zbus0 # Blizzard 1230 I,II scsi +scsibus* at bzsc0 +bzivsc0 at zbus0 # Blizzard 12x0 IV scsi +scsibus* at bzivsc0 +bztzsc0 at zbus0 # Blizzard 2060 scsi +scsibus* at bztzsc0 +cbsc0 at zbus0 # CyberSCSI I +scsibus* at cbsc0 +cbiisc0 at zbus0 # CyberSCSI II +scsibus* at cbiisc0 +cbiiisc0 at zbus0 # Cyberstorm mk.III/Cyberstorm PPC SCSI +scsibus* at cbiiisc0 +empsc0 at zbus0 # Emplant scsi +scsibus* at empsc0 +idesc0 at mainbus0 # A4000 & A1200 IDE +scsibus* at idesc0 + +#each hard drive from low target to high +#will configure to the next available sd unit number +sd* at scsibus? target ? lun ? # scsi disks +st* at scsibus? target ? lun ? # scsi tapes +cd* at scsibus? target ? lun ? # scsi cds +ss* at scsibus? target ? lun ? # scsi scanner +ch* at scsibus? target ? lun ? # scsi autochangers +uk* at scsibus? target ? lun ? # scsi unknown + +pseudo-device loop # loopback network interface +pseudo-device sl 1 # SLIP network interfaces +pseudo-device ppp 1 # PPP network interfaces +pseudo-device tun 1 # network tunnel line discipline +#pseudo-device gre 2 # generic L3 over IP tunnel +#pseudo-device ipip 2 # IP Encapsulation within IP (RFC 2003) +pseudo-device bpfilter 16 # Berkeley packet filter +pseudo-device ipfilter # IP Filter package + +pseudo-device view 10 # views +pseudo-device pty 16 # pseudo ptys + +pseudo-device vnd 4 # vnode pseudo-disks +pseudo-device ccd 4 # concatenated disk devices +#pseudo-device raid 4 # RAIDframe disk driver + +#rnd is EXPERIMENTAL at this point. +#pseudo-device rnd # /dev/random and in-kernel generator +#options RND_COM # use "com" randomness as well (BROKEN) + +config netbsd root on ? type ? +