Add support for the Alchemy Semiconductor Pb1000 evaluation board for
their Au1000 CPU. Should also work with little or no tweaking for the Pb1500 board for the Au1500 CPU as well.
This commit is contained in:
parent
3f8c0bc7c5
commit
10a72d78d1
|
@ -0,0 +1,129 @@
|
|||
/* $NetBSD: autoconf.c,v 1.1 2002/07/29 16:22:55 simonb 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/conf.h>
|
||||
|
||||
#include <sys/socket.h> /* these three just to get ETHER_ADDR_LEN(!) */
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/yamon.h>
|
||||
|
||||
#include <mips/alchemy/include/aureg.h>
|
||||
#include <mips/alchemy/include/auvar.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
|
||||
static struct device *booted_device;
|
||||
static int booted_partition;
|
||||
|
||||
/*
|
||||
* Configure all devices on system
|
||||
*/
|
||||
void
|
||||
cpu_configure(void)
|
||||
{
|
||||
|
||||
intr_init();
|
||||
|
||||
/* Kick off autoconfiguration. */
|
||||
(void)splhigh();
|
||||
if (config_rootfound("mainbus", "mainbus") == NULL)
|
||||
panic("no mainbus found");
|
||||
(void)spl0();
|
||||
}
|
||||
|
||||
void
|
||||
cpu_rootconf(void)
|
||||
{
|
||||
|
||||
setroot(booted_device, booted_partition);
|
||||
}
|
||||
|
||||
void
|
||||
device_register(struct device *dev, void *aux)
|
||||
{
|
||||
struct cfdata *cf = dev->dv_cfdata;
|
||||
struct cfdriver *cd = cf->cf_driver;
|
||||
struct aubus_attach_args *aa = aux;
|
||||
|
||||
/*
|
||||
* We don't ever know the boot device. But that's because the
|
||||
* firmware only loads from the network.
|
||||
*/
|
||||
|
||||
/* Fetch the MAC addresses from YAMON. */
|
||||
if (strcmp(cd->cd_name, "aumac") == 0) {
|
||||
uint8_t ethaddr[ETHER_ADDR_LEN];
|
||||
char prop_name[sizeof("0xffffffff:mac-addr") + 1];
|
||||
const char *cp;
|
||||
char *cp0;
|
||||
int i;
|
||||
|
||||
/* Get the Ethernet address of the first on-board Ethernet. */
|
||||
#if defined(ETHADDR)
|
||||
cp = ETHADDR;
|
||||
#else
|
||||
cp = yamon_getenv("ethaddr");
|
||||
#endif
|
||||
if (cp != NULL) {
|
||||
for (i = 0; i < ETHER_ADDR_LEN; i++) {
|
||||
ethaddr[i] = strtoul(cp, &cp0, 16);
|
||||
cp = cp0 + 1;
|
||||
}
|
||||
if (aa->aa_addr != MAC0_BASE) {
|
||||
/* XXX
|
||||
* The PROM has a variable for the MAC address
|
||||
* of the first interface. For now, just add
|
||||
* 0x10 to the second last octet(!) for the
|
||||
* second interface (Linux does the same).
|
||||
*/
|
||||
ethaddr[4] += 0x10;
|
||||
}
|
||||
|
||||
snprintf(prop_name, sizeof(prop_name), "%p:mac-addr",
|
||||
dev);
|
||||
if (alchemy_info_set(prop_name, ethaddr,
|
||||
sizeof(ethaddr), 0, 0))
|
||||
panic("can't set mac address property for "
|
||||
"aumac");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/* $NetBSD: conf.c,v 1.1 2002/07/29 16:22:56 simonb Exp $ */
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
|
||||
__KERNEL_RCSID(0, "$NetBSD: conf.c,v 1.1 2002/07/29 16:22:56 simonb Exp $");
|
||||
|
||||
#undef CONF_HAVE_ISDN
|
||||
#undef CONF_HAVE_PCI
|
||||
#undef CONF_HAVE_SCSIPI
|
||||
#define CONF_HAVE_USB
|
||||
#undef CONF_HAVE_WSCONS
|
||||
#undef CONF_HAVE_SPKR
|
||||
#undef CONF_HAVE_ISA /* XXX needs a better name */
|
||||
#define CONF_HAVE_ALCHEMY
|
||||
|
||||
#include "arch/evbmips/evbmips/conf_common.c"
|
|
@ -0,0 +1,67 @@
|
|||
/* $NetBSD: cpu.c,v 1.1 2002/07/29 16:22:56 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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/device.h>
|
||||
#include <sys/systm.h>
|
||||
|
||||
static int cpu_match(struct device *, struct cfdata *, void *);
|
||||
static void cpu_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach cpu_ca = {
|
||||
sizeof(struct device), cpu_match, cpu_attach
|
||||
};
|
||||
|
||||
static int
|
||||
cpu_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
cpu_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
|
||||
printf(": %lu.%02luMHz (hz cycles = %lu, delay divisor = %lu)\n",
|
||||
curcpu()->ci_cpu_freq / 1000000,
|
||||
(curcpu()->ci_cpu_freq % 1000000) / 10000,
|
||||
curcpu()->ci_cycles_per_hz, curcpu()->ci_divisor_delay);
|
||||
|
||||
printf("%s: ", self->dv_xname);
|
||||
cpu_identify();
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: aupcmcia.c,v 1.1 2002/07/29 16:23:00 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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/device.h>
|
||||
|
||||
#include <mips/alchemy/include/aureg.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
|
||||
static int aupcmcia_match(struct device *, struct cfdata *, void *);
|
||||
static void aupcmcia_attach(struct device *, struct device *, void *);
|
||||
|
||||
struct cfattach aupcmcia_ca = {
|
||||
sizeof (struct device), aupcmcia_match, aupcmcia_attach,
|
||||
};
|
||||
|
||||
int
|
||||
aupcmcia_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
struct aubus_attach_args *aa = aux;
|
||||
|
||||
return (0); /* XXX unimplemented! */
|
||||
if (strcmp(aa->aa_name, match->cf_driver->cd_name) == 0)
|
||||
return (1);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
aupcmcia_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
|
||||
printf(": Au1000 PCMCIA\n"); /* \n in clockattach */
|
||||
}
|
|
@ -0,0 +1,275 @@
|
|||
/* $NetBSD: disksubr.c,v 1.1 2002/07/29 16:22:56 simonb 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.
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/disklabel.h>
|
||||
#include <sys/disk.h>
|
||||
|
||||
/*
|
||||
* Attempt to read a disk label from a device
|
||||
* using the indicated stategy routine.
|
||||
* The label must be partly set up before this:
|
||||
* secpercyl and anything required in the strategy routine
|
||||
* (e.g., sector size) must be filled in before calling us.
|
||||
* Returns null on success and an error string on failure.
|
||||
*/
|
||||
char *
|
||||
readdisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
||||
struct cpu_disklabel *clp)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
struct dkbad *bdp;
|
||||
char *msg = NULL;
|
||||
int i;
|
||||
|
||||
/* 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;
|
||||
lp->d_npartitions = RAW_PART + 1;
|
||||
if (lp->d_partitions[RAW_PART].p_size == 0)
|
||||
lp->d_partitions[RAW_PART].p_size =
|
||||
lp->d_secperunit * (lp->d_secsize / DEV_BSIZE);
|
||||
lp->d_partitions[RAW_PART].p_offset = 0;
|
||||
|
||||
/* obtain buffer to probe drive with */
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
|
||||
/* next, dig out disk label */
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_cylinder = 0;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ;
|
||||
(*strat)(bp);
|
||||
|
||||
/* if successful, locate disk label within block and validate */
|
||||
if (biowait(bp)) {
|
||||
msg = "disk label read 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 (clp && (bdp = &clp->bad) != NULL && (lp->d_flags & D_BADSECT)) {
|
||||
struct dkbad *db;
|
||||
|
||||
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(struct disklabel *olp, struct disklabel *nlp, u_long openmask,
|
||||
struct cpu_disklabel *clp)
|
||||
{
|
||||
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);
|
||||
|
||||
if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
|
||||
dkcksum(nlp) != 0)
|
||||
return (EINVAL);
|
||||
|
||||
while ((i = ffs(openmask)) != 0) {
|
||||
i--;
|
||||
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.
|
||||
* this means write out the Rigid disk blocks to represent the
|
||||
* label. Hope the user was carefull.
|
||||
*/
|
||||
int
|
||||
writedisklabel(dev_t dev, void (*strat)(struct buf *), struct disklabel *lp,
|
||||
struct cpu_disklabel *clp)
|
||||
{
|
||||
struct buf *bp;
|
||||
struct disklabel *dlp;
|
||||
int error = 0;
|
||||
|
||||
bp = geteblk((int)lp->d_secsize);
|
||||
bp->b_dev = dev;
|
||||
bp->b_blkno = LABELSECTOR;
|
||||
bp->b_cylinder = 0;
|
||||
bp->b_bcount = lp->d_secsize;
|
||||
bp->b_flags |= B_READ; /* get current label */
|
||||
(*strat)(bp);
|
||||
if ((error = biowait(bp)) != 0)
|
||||
goto done;
|
||||
|
||||
dlp = (struct disklabel *)(bp->b_data + LABELOFFSET);
|
||||
*dlp = *lp; /* struct assignment */
|
||||
|
||||
bp->b_flags &= ~(B_READ|B_DONE);
|
||||
bp->b_flags |= B_WRITE;
|
||||
(*strat)(bp);
|
||||
error = biowait(bp);
|
||||
|
||||
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(struct buf *bp, struct disklabel *lp, int wlabel)
|
||||
{
|
||||
struct partition *p = lp->d_partitions + DISKPART(bp->b_dev);
|
||||
int labelsector = lp->d_partitions[RAW_PART].p_offset + LABELSECTOR;
|
||||
int maxsz = p->p_size;
|
||||
int sz = (bp->b_bcount + DEV_BSIZE - 1) >> DEV_BSHIFT;
|
||||
|
||||
/* Overwriting disk label? */
|
||||
/* XXX should also protect bootstrap in first 8K */
|
||||
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 == 0) {
|
||||
bp->b_error = EROFS;
|
||||
goto bad;
|
||||
}
|
||||
|
||||
/* beyond partition? */
|
||||
if (bp->b_blkno < 0 || bp->b_blkno + sz > maxsz) {
|
||||
/* if exactly at end of disk, return an EOF */
|
||||
if (bp->b_blkno == maxsz) {
|
||||
bp->b_resid = bp->b_bcount;
|
||||
return(0);
|
||||
}
|
||||
/* or truncate if part of it fits */
|
||||
sz = maxsz - bp->b_blkno;
|
||||
if (sz <= 0) {
|
||||
bp->b_error = EINVAL;
|
||||
goto bad;
|
||||
}
|
||||
bp->b_bcount = sz << DEV_BSHIFT;
|
||||
}
|
||||
|
||||
/* calculate cylinder for disksort to order transfers with */
|
||||
bp->b_resid = (bp->b_blkno + p->p_offset) / lp->d_secpercyl;
|
||||
return (1);
|
||||
bad:
|
||||
bp->b_flags |= B_ERROR;
|
||||
return (0);
|
||||
}
|
|
@ -0,0 +1,509 @@
|
|||
/* $NetBSD: machdep.c,v 1.1 2002/07/29 16:22:57 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988 University of Utah.
|
||||
* Copyright (c) 1992, 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* the Systems Programming Group of the University of Utah Computer
|
||||
* Science Department, The Mach Operating System project at
|
||||
* Carnegie-Mellon University and Ralph Campbell.
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* @(#)machdep.c 8.3 (Berkeley) 1/12/94
|
||||
* from: Utah Hdr: machdep.c 1.63 91/04/24
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
|
||||
__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.1 2002/07/29 16:22:57 simonb Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "opt_kgdb.h"
|
||||
|
||||
#include "opt_memsize.h"
|
||||
#include "opt_ethaddr.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/buf.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/kcore.h>
|
||||
#include <sys/boot_flag.h>
|
||||
#include <sys/termios.h>
|
||||
|
||||
#include <net/if.h>
|
||||
#include <net/if_ether.h>
|
||||
|
||||
#include <uvm/uvm_extern.h>
|
||||
|
||||
#include <sys/sysctl.h>
|
||||
|
||||
#include <dev/cons.h>
|
||||
|
||||
#ifdef DDB
|
||||
#include <machine/db_machdep.h>
|
||||
#include <ddb/db_extern.h>
|
||||
#endif
|
||||
|
||||
#include <mips/cache.h>
|
||||
#include <mips/locore.h>
|
||||
#include <machine/yamon.h>
|
||||
|
||||
#include <evbmips/alchemy/pb1000var.h>
|
||||
#include <mips/alchemy/include/aureg.h>
|
||||
#include <mips/alchemy/include/auvar.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
|
||||
#include "aucom.h"
|
||||
#if NAUCOM > 0
|
||||
#include <mips/alchemy/dev/aucomvar.h>
|
||||
|
||||
#ifndef CONSPEED
|
||||
#define CONSPEED TTYDEF_SPEED
|
||||
#endif
|
||||
int aucomcnrate = CONSPEED;
|
||||
#endif /* NAUCOM > 0 */
|
||||
|
||||
/* The following are used externally (sysctl_hw). */
|
||||
char machine[] = MACHINE; /* from <machine/param.h> */
|
||||
char machine_arch[] = MACHINE_ARCH; /* from <machine/param.h> */
|
||||
char cpu_model[64] = "Alchemy Semiconductor Pb1000";
|
||||
|
||||
struct user *proc0paddr;
|
||||
|
||||
/* Our exported CPU info; we can have only one. */
|
||||
struct cpu_info cpu_info_store;
|
||||
|
||||
/* Maps for VM objects. */
|
||||
struct vm_map *exec_map = NULL;
|
||||
struct vm_map *mb_map = NULL;
|
||||
struct vm_map *phys_map = NULL;
|
||||
|
||||
int physmem; /* # pages of physical memory */
|
||||
int maxmem; /* max memory per process */
|
||||
|
||||
int mem_cluster_cnt;
|
||||
phys_ram_seg_t mem_clusters[VM_PHYSSEG_MAX];
|
||||
|
||||
yamon_env_var *yamon_envp;
|
||||
struct pb1000_config pb1000_configuration;
|
||||
struct propdb *alchemy_prop_info;
|
||||
|
||||
void mach_init(int, char **, yamon_env_var *, u_long); /* XXX */
|
||||
|
||||
void
|
||||
mach_init(int argc, char **argv, yamon_env_var *envp, u_long memsize)
|
||||
{
|
||||
struct pb1000_config *pbc = &pb1000_configuration;
|
||||
bus_space_handle_t sh;
|
||||
caddr_t kernend;
|
||||
const char *cp;
|
||||
u_long first, last;
|
||||
caddr_t v;
|
||||
int howto, i;
|
||||
|
||||
extern char edata[], end[]; /* XXX */
|
||||
|
||||
/* clear the BSS segment */
|
||||
kernend = (caddr_t)mips_round_page(end);
|
||||
memset(edata, 0, kernend - (caddr_t)edata);
|
||||
|
||||
/* save the yamon environment pointer */
|
||||
yamon_envp = envp;
|
||||
|
||||
/* Use YAMON callbacks for early console I/O */
|
||||
cn_tab = &yamon_promcd;
|
||||
|
||||
/*
|
||||
* Set up the exception vectors and cpu-specific function
|
||||
* vectors early on. We need the wbflush() vector set up
|
||||
* before comcnattach() is called (or at least before the
|
||||
* first printf() after that is called).
|
||||
* Also clears the I+D caches.
|
||||
*/
|
||||
mips_vector_init();
|
||||
|
||||
/*
|
||||
* Set the VM page size.
|
||||
*/
|
||||
uvm_setpagesize();
|
||||
|
||||
/*
|
||||
* Initialize bus space tags.
|
||||
*/
|
||||
au_cpureg_bus_mem_init(&pbc->pc_cpuregt, pbc);
|
||||
aubus_st = &pbc->pc_cpuregt; /* XXX: for aubus.c */
|
||||
|
||||
/*
|
||||
* Calibrate the timer, delay() relies on this.
|
||||
*/
|
||||
bus_space_map(&pbc->pc_cpuregt, PC_BASE, PC_SIZE, 0, &sh);
|
||||
au_cal_timers(&pbc->pc_cpuregt, sh);
|
||||
bus_space_unmap(&pbc->pc_cpuregt, sh, PC_SIZE);
|
||||
|
||||
/*
|
||||
* Bring up the console.
|
||||
*/
|
||||
#if NAUCOM > 0
|
||||
/*
|
||||
* Delay to allow firmware putchars to complete.
|
||||
* FIFO depth * character time.
|
||||
* character time = (1000000 / (defaultrate / 10))
|
||||
*/
|
||||
delay(160000000 / aucomcnrate);
|
||||
if (aucomcnattach(&pbc->pc_cpuregt, UART0_BASE, aucomcnrate,
|
||||
curcpu()->ci_cpu_freq / 4,
|
||||
(TTYDEF_CFLAG & ~(CSIZE | PARENB)) | CS8) != 0)
|
||||
panic("pb1000: unable to initialize serial console");
|
||||
#else
|
||||
panic("pb1000: not configured to use serial console");
|
||||
#endif /* NAUCOM > 0 */
|
||||
|
||||
/*
|
||||
* Look at arguments passed to us and compute boothowto.
|
||||
*/
|
||||
boothowto = RB_AUTOBOOT;
|
||||
#ifdef KADB
|
||||
boothowto |= RB_KDB;
|
||||
#endif
|
||||
for (i = 1; i < argc; i++) {
|
||||
for (cp = argv[i]; *cp; cp++) {
|
||||
/* Ignore superfluous '-', if there is one */
|
||||
if (*cp == '-')
|
||||
continue;
|
||||
|
||||
howto = 0;
|
||||
BOOT_FLAG(*cp, howto);
|
||||
if (! howto)
|
||||
printf("bootflag '%c' not recognised\n", *cp);
|
||||
else
|
||||
boothowto |= howto;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine the memory size. Use the `memsize' PMON
|
||||
* variable. If that's not available, panic.
|
||||
*
|
||||
* Note: Reserve the first page! That's where the trap
|
||||
* vectors are located.
|
||||
*/
|
||||
|
||||
#if defined(MEMSIZE)
|
||||
size = MEMSIZE;
|
||||
#else
|
||||
if (memsize == 0) {
|
||||
if ((cp = yamon_getenv("memsize")) != NULL)
|
||||
memsize = strtoul(cp, NULL, 0);
|
||||
else {
|
||||
printf("FATAL: `memsize' YAMON variable not set. Set it to\n");
|
||||
printf(" the amount of memory (in MB) and try again.\n");
|
||||
printf(" Or, build a kernel with the `MEMSIZE' "
|
||||
"option.\n");
|
||||
panic("pb1000_init");
|
||||
}
|
||||
}
|
||||
#endif /* MEMSIZE */
|
||||
printf("Memory size: 0x%08lx\n", memsize);
|
||||
physmem = btoc(memsize);
|
||||
|
||||
mem_clusters[mem_cluster_cnt].start = NBPG;
|
||||
mem_clusters[mem_cluster_cnt].size =
|
||||
memsize - mem_clusters[mem_cluster_cnt].start;
|
||||
mem_cluster_cnt++;
|
||||
|
||||
/*
|
||||
* Load the rest of the available pages into the VM system.
|
||||
*/
|
||||
first = round_page(MIPS_KSEG0_TO_PHYS(kernend));
|
||||
last = mem_clusters[0].start + mem_clusters[0].size;
|
||||
uvm_page_physload(atop(first), atop(last), atop(first), atop(last),
|
||||
VM_FREELIST_DEFAULT);
|
||||
|
||||
/*
|
||||
* Initialize message buffer (at end of core).
|
||||
*/
|
||||
mips_init_msgbuf();
|
||||
|
||||
/*
|
||||
* Compute the size of system data structures. pmap_bootstrap()
|
||||
* needs some of this information.
|
||||
*/
|
||||
memsize = (u_long)allocsys(NULL, NULL);
|
||||
|
||||
/*
|
||||
* Initialize the virtual memory system.
|
||||
*/
|
||||
pmap_bootstrap();
|
||||
|
||||
/*
|
||||
* Init mapping for u page(s) for proc0.
|
||||
*/
|
||||
v = (caddr_t) uvm_pageboot_alloc(USPACE);
|
||||
proc0.p_addr = proc0paddr = (struct user *) v;
|
||||
proc0.p_md.md_regs = (struct frame *)(v + USPACE) - 1;
|
||||
curpcb = &proc0.p_addr->u_pcb;
|
||||
curpcb->pcb_context[11] = MIPS_INT_MASK | MIPS_SR_INT_IE; /* SR */
|
||||
|
||||
/*
|
||||
* Allocate space for system data structures. These data structures
|
||||
* are allocated here instead of cpu_startup() because physical
|
||||
* memory is directly addressable. We don't have to map these into
|
||||
* the virtual address space.
|
||||
*/
|
||||
v = (caddr_t)uvm_pageboot_alloc(memsize);
|
||||
if ((allocsys(v, NULL) - v) != memsize)
|
||||
panic("mach_init: table size inconsistency");
|
||||
|
||||
/*
|
||||
* Initialize debuggers, and break into them, if appropriate.
|
||||
*/
|
||||
#ifdef DDB
|
||||
ddb_init(0, 0, 0);
|
||||
if (boothowto & RB_KDB)
|
||||
Debugger();
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
consinit(void)
|
||||
{
|
||||
|
||||
/*
|
||||
* Everything related to console initialization is done
|
||||
* in mach_init().
|
||||
*/
|
||||
}
|
||||
|
||||
void
|
||||
cpu_startup(void)
|
||||
{
|
||||
char pbuf[9];
|
||||
vaddr_t minaddr, maxaddr;
|
||||
vsize_t size;
|
||||
int base, residual;
|
||||
u_int i;
|
||||
#ifdef DEBUG
|
||||
extern int pmapdebug; /* XXX */
|
||||
int opmapdebug = pmapdebug;
|
||||
|
||||
pmapdebug = 0; /* Shut up pmap debug during bootstrap */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Good {morning,afternoon,evening,night}.
|
||||
*/
|
||||
printf(version);
|
||||
printf("%s\n", cpu_model);
|
||||
format_bytes(pbuf, sizeof(pbuf), ctob(physmem));
|
||||
printf("total memory = %s\n", pbuf);
|
||||
|
||||
/*
|
||||
* Allocate virtual address space for file I/O buffers.
|
||||
* Note they are different than the array of headers, 'buf',
|
||||
* and usually occupy more virtual memory than physical.
|
||||
*/
|
||||
size = MAXBSIZE * nbuf;
|
||||
if (uvm_map(kernel_map, (vaddr_t *)&buffers, round_page(size),
|
||||
NULL, UVM_UNKNOWN_OFFSET, 0,
|
||||
UVM_MAPFLAG(UVM_PROT_NONE, UVM_PROT_NONE, UVM_INH_NONE,
|
||||
UVM_ADV_NORMAL, 0)) != 0)
|
||||
panic("cpu_startup: cannot allocate VM for buffers");
|
||||
|
||||
minaddr = (vaddr_t)buffers;
|
||||
if ((bufpages / nbuf) >= btoc(MAXBSIZE)) {
|
||||
bufpages = btoc(MAXBSIZE) * nbuf; /* do not overallocate RAM */
|
||||
}
|
||||
base = bufpages / nbuf;
|
||||
residual = bufpages % nbuf;
|
||||
|
||||
/* now allocate RAM for buffers */
|
||||
for (i = 0; i < nbuf; i++) {
|
||||
vsize_t curbufsize;
|
||||
vaddr_t curbuf;
|
||||
struct vm_page *pg;
|
||||
|
||||
/*
|
||||
* Each buffer has MAXBSIZE bytes of VM space allocated. Of
|
||||
* that MAXBSIZE space, we allocate and map (base+1) pages
|
||||
* for the first "residual" buffers, and then we allocate
|
||||
* "base" pages for the rest.
|
||||
*/
|
||||
curbuf = (vaddr_t)buffers + (i * MAXBSIZE);
|
||||
curbufsize = NBPG * ((i < residual) ? (base+1) : base);
|
||||
|
||||
while (curbufsize) {
|
||||
pg = uvm_pagealloc(NULL, 0, NULL, 0);
|
||||
if (pg == NULL)
|
||||
panic("cpu_startup: not enough memory for "
|
||||
"buffer cache");
|
||||
pmap_kenter_pa(curbuf, VM_PAGE_TO_PHYS(pg),
|
||||
VM_PROT_READ|VM_PROT_WRITE);
|
||||
curbuf += PAGE_SIZE;
|
||||
curbufsize -= PAGE_SIZE;
|
||||
}
|
||||
}
|
||||
pmap_update(pmap_kernel());
|
||||
|
||||
/*
|
||||
* Allocate a submap for exec arguments. This map effectively
|
||||
* limits the number of processes exec'ing at any time.
|
||||
*/
|
||||
exec_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
16 * NCARGS, VM_MAP_PAGEABLE, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* Allocate a submap for physio
|
||||
*/
|
||||
phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
|
||||
VM_PHYS_SIZE, 0, FALSE, NULL);
|
||||
|
||||
/*
|
||||
* No need to allocate an mbuf cluster submap. Mbuf clusters
|
||||
* are allocated via the pool allocator, and we use KSEG to
|
||||
* map those pages.
|
||||
*/
|
||||
|
||||
#ifdef DEBUG
|
||||
pmapdebug = opmapdebug;
|
||||
#endif
|
||||
format_bytes(pbuf, sizeof(pbuf), ptoa(uvmexp.free));
|
||||
printf("avail memory = %s\n", pbuf);
|
||||
format_bytes(pbuf, sizeof(pbuf), bufpages * NBPG);
|
||||
printf("using %d buffers containing %s of memory\n", nbuf, pbuf);
|
||||
|
||||
/*
|
||||
* Set up buffers, so they can be used to read disklabels.
|
||||
*/
|
||||
bufinit();
|
||||
|
||||
/*
|
||||
* Set up the chip/board properties database.
|
||||
*/
|
||||
if (!(alchemy_prop_info = propdb_create("board info")))
|
||||
panic("Cannot create board info database");
|
||||
}
|
||||
|
||||
/*
|
||||
* Machine-dependent system variables.
|
||||
*/
|
||||
int
|
||||
cpu_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
|
||||
void *newp, size_t newlen, struct proc *p)
|
||||
{
|
||||
dev_t consdev;
|
||||
|
||||
/* All sysctl names at this level are terminal. */
|
||||
if (namelen != 1)
|
||||
return (ENOTDIR); /* overloaded */
|
||||
|
||||
switch (name[0]) {
|
||||
case CPU_CONSDEV:
|
||||
if (cn_tab != NULL)
|
||||
consdev = cn_tab->cn_dev;
|
||||
else
|
||||
consdev = NODEV;
|
||||
return (sysctl_rdstruct(oldp, oldlenp, newp, &consdev,
|
||||
sizeof consdev));
|
||||
default:
|
||||
return (EOPNOTSUPP);
|
||||
}
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
void
|
||||
cpu_reboot(int howto, char *bootstr)
|
||||
{
|
||||
static int waittime = -1;
|
||||
|
||||
/* Take a snapshot before clobbering any registers. */
|
||||
if (curproc)
|
||||
savectx((struct user *)curpcb);
|
||||
|
||||
/* If "always halt" was specified as a boot flag, obey. */
|
||||
if (boothowto & RB_HALT)
|
||||
howto |= RB_HALT;
|
||||
|
||||
boothowto = howto;
|
||||
|
||||
/* If system is cold, just halt. */
|
||||
if (cold) {
|
||||
boothowto |= RB_HALT;
|
||||
goto haltsys;
|
||||
}
|
||||
|
||||
if ((boothowto & RB_NOSYNC) == 0 && waittime < 0) {
|
||||
waittime = 0;
|
||||
|
||||
/*
|
||||
* Synchronize the disks....
|
||||
*/
|
||||
vfs_shutdown();
|
||||
|
||||
/*
|
||||
* If we've been adjusting the clock, the todr
|
||||
* will be out of synch; adjust it now.
|
||||
*/
|
||||
resettodr();
|
||||
}
|
||||
|
||||
/* Disable interrupts. */
|
||||
splhigh();
|
||||
|
||||
if (boothowto & RB_DUMP)
|
||||
dumpsys();
|
||||
|
||||
haltsys:
|
||||
/* Run any shutdown hooks. */
|
||||
doshutdownhooks();
|
||||
|
||||
#if 1
|
||||
/* XXX
|
||||
* For some reason we are leaving the ethernet MAC in a state where
|
||||
* YAMON isn't happy with it. So just call the reset vector (grr,
|
||||
* Alchemy YAMON doesn't have a "reset" command).
|
||||
*/
|
||||
printf("reseting board...\n\n");
|
||||
mips_icache_sync_all();
|
||||
mips_dcache_wbinv_all();
|
||||
asm volatile("jr %0" :: "r"(MIPS_RESET_EXC_VEC));
|
||||
#else
|
||||
printf("%s\n\n", ((howto & RB_HALT) != 0) ? "halted." : "rebooting...");
|
||||
yamon_exit(boothowto);
|
||||
printf("Oops, back from yamon_exit()\n\nSpinning...");
|
||||
#endif
|
||||
for (;;)
|
||||
/* spin forever */ ; /* XXX */
|
||||
/*NOTREACHED*/
|
||||
}
|
|
@ -0,0 +1,115 @@
|
|||
/* $NetBSD: mainbus.c,v 1.1 2002/07/29 16:22:57 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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/device.h>
|
||||
|
||||
#include <mips/cache.h>
|
||||
#include <mips/cpuregs.h>
|
||||
|
||||
// #include <evbmips/malta/autoconf.h>
|
||||
// #include <evbmips/malta/maltareg.h>
|
||||
// #include <evbmips/malta/maltavar.h>
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
static int mainbus_match(struct device *, struct cfdata *, void *);
|
||||
static void mainbus_attach(struct device *, struct device *, void *);
|
||||
static int mainbus_submatch(struct device *, struct cfdata *, void *);
|
||||
static int mainbus_print(void *, const char *);
|
||||
|
||||
struct cfattach mainbus_ca = {
|
||||
sizeof(struct device), mainbus_match, mainbus_attach
|
||||
};
|
||||
|
||||
/* There can be only one. */
|
||||
int mainbus_found;
|
||||
|
||||
struct mainbusdev {
|
||||
const char *md_name;
|
||||
};
|
||||
|
||||
struct mainbusdev mainbusdevs[] = {
|
||||
{ "cpu", },
|
||||
{ "aubus", },
|
||||
{ "obio", },
|
||||
{ NULL, }
|
||||
};
|
||||
|
||||
static int
|
||||
mainbus_match(parent, match, aux)
|
||||
struct device *parent;
|
||||
struct cfdata *match;
|
||||
void *aux;
|
||||
{
|
||||
|
||||
if (mainbus_found)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
mainbus_attach(parent, self, aux)
|
||||
struct device *parent;
|
||||
struct device *self;
|
||||
void *aux;
|
||||
{
|
||||
struct mainbusdev *md;
|
||||
|
||||
mainbus_found = 1;
|
||||
printf("\n");
|
||||
|
||||
for (md = mainbusdevs; md->md_name != NULL; md++) {
|
||||
config_found_sm(self, NULL, mainbus_print, mainbus_submatch);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
mainbus_submatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
|
||||
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
|
||||
}
|
||||
|
||||
static int
|
||||
mainbus_print(void *aux, const char *pnp)
|
||||
{
|
||||
|
||||
return (UNCONF);
|
||||
}
|
|
@ -0,0 +1,97 @@
|
|||
/* $NetBSD: pb1000_intr.c,v 1.1 2002/07/29 16:22:58 simonb 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Platform-specific interrupt support for the Alchemy Semiconductor Pb1000.
|
||||
*
|
||||
* The Alchemy Semiconductor Pb1000's interrupts are wired to two internal
|
||||
* interrupt controllers.
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/queue.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/device.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
#include <machine/intr.h>
|
||||
|
||||
#include <mips/locore.h>
|
||||
#include <mips/alchemy/include/auvar.h>
|
||||
|
||||
#include <evbmips/evbmips/clockvar.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
#include <evbmips/alchemy/pb1000reg.h>
|
||||
#include <evbmips/alchemy/pb1000var.h>
|
||||
|
||||
#include <dev/ic/mc146818reg.h>
|
||||
#include <dev/pci/pcireg.h>
|
||||
#include <dev/pci/pcivar.h>
|
||||
|
||||
void
|
||||
evbmips_intr_init(void)
|
||||
{
|
||||
au_intr_init();
|
||||
}
|
||||
|
||||
void *
|
||||
pb1000_intr_establish(int irq, int req, int level, int type,
|
||||
int (*func)(void *), void *arg)
|
||||
{
|
||||
|
||||
return (au_intr_establish(irq, req, level, type, func, arg));
|
||||
}
|
||||
|
||||
void
|
||||
pb1000_intr_disestablish(void *cookie)
|
||||
{
|
||||
|
||||
return (au_intr_disestablish(cookie));
|
||||
}
|
||||
|
||||
void
|
||||
evbmips_iointr(u_int32_t status, u_int32_t cause, u_int32_t pc,
|
||||
u_int32_t ipending)
|
||||
{
|
||||
|
||||
au_iointr(status, cause, pc, ipending);
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
/* $NetBSD: pb1000_obio.c,v 1.1 2002/07/29 16:22:58 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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/device.h>
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mips/cache.h>
|
||||
#include <mips/cpuregs.h>
|
||||
|
||||
#include <evbmips/alchemy/pb1000reg.h>
|
||||
#include <evbmips/alchemy/pb1000_obiovar.h>
|
||||
|
||||
#include "locators.h"
|
||||
|
||||
static int obio_match(struct device *, struct cfdata *, void *);
|
||||
static void obio_attach(struct device *, struct device *, void *);
|
||||
static int obio_submatch(struct device *, struct cfdata *, void *);
|
||||
static int obio_print(void *, const char *);
|
||||
|
||||
struct cfattach obio_ca = {
|
||||
sizeof(struct device), obio_match, obio_attach
|
||||
};
|
||||
|
||||
/* There can be only one. */
|
||||
int obio_found;
|
||||
|
||||
struct obiodev {
|
||||
const char *od_name;
|
||||
bus_addr_t od_addr;
|
||||
int od_irq;
|
||||
};
|
||||
|
||||
struct obiodev obiodevs[] = {
|
||||
{ "pcmcia", -1, -1 },
|
||||
{ "lcd", -1, -1 },
|
||||
{ "flash", -1, -1 },
|
||||
{ NULL, 0, 0 },
|
||||
};
|
||||
|
||||
static int
|
||||
obio_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
{
|
||||
|
||||
if (obio_found)
|
||||
return (0);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
||||
static void
|
||||
obio_attach(struct device *parent, struct device *self, void *aux)
|
||||
{
|
||||
struct obio_attach_args oa;
|
||||
struct obiodev *od;
|
||||
|
||||
obio_found = 1;
|
||||
printf("\n");
|
||||
|
||||
for (od = obiodevs; od->od_name != NULL; od++) {
|
||||
oa.oba_name = od->od_name;
|
||||
oa.oba_addr = od->od_addr;
|
||||
oa.oba_irq = od->od_irq;
|
||||
(void) config_found_sm(self, &oa, obio_print,
|
||||
obio_submatch);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
obio_submatch(struct device *parent, struct cfdata *cf, void *aux)
|
||||
{
|
||||
struct obio_attach_args *oa = aux;
|
||||
|
||||
if (cf->cf_loc[OBIOCF_ADDR] != OBIOCF_ADDR_DEFAULT &&
|
||||
cf->cf_loc[OBIOCF_ADDR] != oa->oba_addr)
|
||||
return (0);
|
||||
|
||||
return ((*cf->cf_attach->ca_match)(parent, cf, aux));
|
||||
}
|
||||
|
||||
static int
|
||||
obio_print(void *aux, const char *pnp)
|
||||
{
|
||||
struct obio_attach_args *oa = aux;
|
||||
|
||||
if (pnp)
|
||||
printf("%s at %s", oa->oba_name, pnp);
|
||||
if (oa->oba_addr != OBIOCF_ADDR_DEFAULT)
|
||||
printf(" addr 0x%lx", oa->oba_addr);
|
||||
|
||||
return (UNCONF);
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
/* $NetBSD: pb1000_obiovar.h,v 1.1 2002/07/29 16:22:58 simonb Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2002 Wasabi Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Written by Simon Burge for Wasabi Systems, Inc.
|
||||
*
|
||||
* 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 for the NetBSD Project by
|
||||
* Wasabi Systems, Inc.
|
||||
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
|
||||
* or promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
|
||||
* 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 _PB1000_OBIOVAR_H_
|
||||
#define _PB1000_OBIOVAR_H_
|
||||
|
||||
struct obio_attach_args {
|
||||
const char *oba_name; /* name of device */
|
||||
bus_space_tag_t oba_st; /* bus space tag */
|
||||
bus_addr_t oba_addr; /* address of device */
|
||||
int oba_irq; /* CPLD interrupt bit # */
|
||||
};
|
||||
|
||||
// extern struct bus_space obio_bs_tag;
|
||||
|
||||
#endif /* _PB1000_OBIOVAR_H_ */
|
|
@ -0,0 +1,69 @@
|
|||
/* $NetBSD: pb1000reg.h,v 1.1 2002/07/29 16:22:59 simonb 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Memory map and register definitions for the Alchemy Semiconductor Pb1000.
|
||||
*/
|
||||
|
||||
/* RAM addresses */
|
||||
#define PB1000_SDRAM_BASE 0x00000000
|
||||
#define PB1000_SDRAM_SIZE 0x04000000
|
||||
|
||||
/* Static RAM */
|
||||
#define PB1000_SRAM_BASE 0x1c000000
|
||||
#define PB1000_SRAM_SIZE 0x00040000
|
||||
|
||||
/* PCMCIA addresses */
|
||||
#define PB1000_PCMCIA_CONTROL 0x1e000000
|
||||
#define PB1000_PCMCIA_DATA 0x1e000004
|
||||
#define PB1000_PCMCIA_STATUS 0x1e000008
|
||||
|
||||
/* CPLD addresses */
|
||||
#define PB1000_CPLD_AUX0 0x1e00000c
|
||||
#define PB1000_CPLD_AUX1 0x1e000010
|
||||
#define PB1000_CPLD_AUX2 0x1e000014
|
||||
|
||||
/* Flash addresses */
|
||||
#define PB1000_FLASH_BASE 0x1f800000
|
||||
#define PB1000_FLASH_SIZE 0x00800000
|
||||
|
||||
#define LCD_BASE 0xe ## 00000000
|
||||
#define LCD_SIZE 0x1 ## 00000000
|
||||
|
||||
#define PCMCIA_BASE 0xf ## 00000000
|
||||
#define PCMCIA_SIZE 0x1 ## 00000000
|
|
@ -0,0 +1,53 @@
|
|||
/* $NetBSD: pb1000var.h,v 1.1 2002/07/29 16:22:59 simonb 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.
|
||||
*/
|
||||
|
||||
#include <machine/bus.h>
|
||||
|
||||
#include <mips/alchemy/include/auvar.h>
|
||||
#include <mips/alchemy/include/aubusvar.h>
|
||||
|
||||
struct pb1000_config {
|
||||
struct mips_bus_space pc_cpuregt;
|
||||
};
|
||||
|
||||
#ifdef _KERNEL
|
||||
extern struct pb1000_config pb1000_configuration;
|
||||
|
||||
void *pb1000_intr_establish(int, int, int, int, int (*)(void *), void *);
|
||||
void pb1000_intr_disestablish(void *);
|
||||
#endif /* _KERNEL */
|
|
@ -0,0 +1,210 @@
|
|||
# $NetBSD: PB1000,v 1.1 2002/07/29 16:23:01 simonb Exp $
|
||||
|
||||
#include "arch/evbmips/conf/std.pb1000.eb" # big-endian mode
|
||||
include "arch/evbmips/conf/std.pb1000.el" # little-endian mode
|
||||
|
||||
#ident "GENERIC-$Revision: 1.1 $"
|
||||
|
||||
maxusers 32
|
||||
|
||||
options MIPS32
|
||||
options NOFPU # No FPU
|
||||
options SOFTFLOAT # emulate FPU insn
|
||||
options MIPS3_L2CACHE_ABSENT
|
||||
options CONSPEED=115200 # YAMON default
|
||||
options HZ=512 # for profiling
|
||||
|
||||
#options LOCKDEBUG
|
||||
options SOSEND_LOAN
|
||||
options SOSEND_COUNTERS
|
||||
options INET_CSUM_COUNTERS
|
||||
options TCP_CSUM_COUNTERS
|
||||
options UDP_CSUM_COUNTERS
|
||||
options TCP_OUTPUT_COUNTERS
|
||||
|
||||
# Standard system options
|
||||
options KTRACE # system call tracing support
|
||||
options SYSVMSG # System V message queues
|
||||
options SYSVSEM # System V semaphores
|
||||
options SYSVSHM # System V shared memory
|
||||
#options SHMMAXPGS=1024 # 1024 pages is the default
|
||||
#options LKM # loadable kernel modules
|
||||
options NTP # network time protocol
|
||||
#options UCONSOLE # users can redirect console (unsafe)
|
||||
|
||||
# Debugging options
|
||||
options DIAGNOSTIC # extra kernel sanity checking
|
||||
options DEBUG # extra kernel debugging support
|
||||
#options KMEMSTATS # kernel memory statistics (vmstat -m)
|
||||
options DDB # kernel dynamic debugger
|
||||
options DDB_HISTORY_SIZE=100 # enable history editing in DDB
|
||||
makeoptions DEBUG="-g" # compile full symbol table
|
||||
options SYMTAB_SPACE=180000 # size for embedded symbol table
|
||||
|
||||
# Compatibility options
|
||||
#options COMPAT_43 # compatibility with 4.3BSD binaries
|
||||
#options COMPAT_10 # NetBSD 0.9 binary compatibility
|
||||
#options COMPAT_10 # NetBSD 1.0 binary compatibility
|
||||
#options COMPAT_11 # NetBSD 1.1 binary compatibility
|
||||
#options COMPAT_12 # NetBSD 1.2 binary compatibility
|
||||
#options COMPAT_13 # NetBSD 1.3 binary compatibility
|
||||
#options COMPAT_14 # NetBSD 1.4 binary compatibility
|
||||
#options EXEC_ECOFF # exec ECOFF binaries
|
||||
#options COMPAT_ULTRIX # binary compatibility with Ultrix
|
||||
|
||||
# File systems
|
||||
file-system FFS # Berkeley Fast Filesystem
|
||||
file-system MFS # memory-based filesystem
|
||||
#file-system EXT2FS # second extended file system (linux)
|
||||
file-system NFS # Sun NFS-compatible filesystem client
|
||||
#file-system KERNFS # kernel data-structure filesystem
|
||||
#file-system NULLFS # NULL layered filesystem
|
||||
#file-system OVERLAY # overlay file system
|
||||
file-system FDESC # user file descriptor filesystem
|
||||
#file-system UMAPFS # uid/gid remapping filesystem
|
||||
#file-system LFS # Log-based filesystem (still experimental)
|
||||
#file-system PORTAL # portal filesystem (still experimental)
|
||||
#file-system PROCFS # /proc
|
||||
#file-system CD9660 # ISO 9660 + Rock Ridge file system
|
||||
#file-system UNION # union file system
|
||||
#file-system MSDOSFS # MS-DOS FAT filesystem(s).
|
||||
#file-system CODA # Coda File System; also needs vcoda (below)
|
||||
|
||||
# File system options
|
||||
#options NFSSERVER # Sun NFS-compatible filesystem server
|
||||
#options QUOTA # FFS quotas
|
||||
#options FFS_EI # FFS Endian Independant support
|
||||
#options SOFTDEP # FFS soft updates support.
|
||||
#options EXT2FS_SYSTEM_FLAGS # makes ext2fs file flags (append and
|
||||
# immutable) behave as system flags.
|
||||
|
||||
# Networking options
|
||||
#options GATEWAY # IP packet forwarding
|
||||
options INET # Internet protocols
|
||||
#options INET6 # IPV6
|
||||
#options IPSEC # IP security
|
||||
#options IPSEC_ESP # IP security (encryption part; define w/IPSEC)
|
||||
#options IPSEC_DEBUG # debug for IP security
|
||||
#options MROUTING # packet forwarding of multicast packets
|
||||
#options NS # Xerox NS networking
|
||||
#options NSIP # Xerox NS tunneling over IP
|
||||
#options ISO,TPIP # OSI networking
|
||||
#options EON # OSI tunneling over IP
|
||||
#options CCITT,LLC,HDLC # X.25
|
||||
#options NETATALK # AppleTalk (over Ethernet) protocol
|
||||
#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
|
||||
|
||||
# Compatibility with 4.2BSD implementation of TCP/IP. Not recommended.
|
||||
#options TCP_COMPAT_42
|
||||
|
||||
# These options enable verbose messages for several subsystems.
|
||||
# Warning, these may compile large string tables into the kernel!
|
||||
options PCIVERBOSE # verbose PCI device autoconfig messages
|
||||
#options PCI_CONFIG_DUMP # verbosely dump PCI config space
|
||||
options SCSIVERBOSE # human readable SCSI error messages
|
||||
#options MIIVERBOSE # verbose PHY autoconfig messages
|
||||
|
||||
options NFS_BOOT_DHCP
|
||||
## options NFS_BOOT_RWSIZE=1024 # XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
||||
|
||||
# Pretty much only one device to use for the root file system.
|
||||
#config netbsd root on aumac0 type ?
|
||||
config netbsd root on ? type ?
|
||||
|
||||
mainbus0 at root
|
||||
|
||||
cpu0 at mainbus?
|
||||
|
||||
aubus0 at mainbus?
|
||||
|
||||
# no RTC! fake with one of the programmable clocks
|
||||
aurtc* at aubus? addr ?
|
||||
|
||||
# UARTs
|
||||
aucom* at aubus? addr ?
|
||||
|
||||
# Ethernet MACs
|
||||
aumac* at aubus? addr ?
|
||||
options AUMAC_EVENT_COUNTERS
|
||||
|
||||
# MII/PHY support
|
||||
amhphy* at mii? phy ? # AMD 79c901 Ethernet PHYs
|
||||
bmtphy* at mii? phy ? # Broadcom BCM5201/BCM5202 PHYs
|
||||
|
||||
# USB
|
||||
ohci* at aubus? addr ? # USB Open Host Controller
|
||||
|
||||
# USB bus support
|
||||
#usb* at uhci?
|
||||
#usb* at ohci?
|
||||
|
||||
# USB Hubs
|
||||
#uhub* at usb?
|
||||
#uhub* at uhub? port ? configuration ? interface ?
|
||||
|
||||
# ....
|
||||
|
||||
# USB Generic driver
|
||||
#ugen* at uhub? port ?
|
||||
|
||||
# Audio support
|
||||
auaudio* at aubus? addr ? # STAC9745 audio codec
|
||||
audio* at auaudio?
|
||||
|
||||
# On-board devices
|
||||
obio* at mainbus?
|
||||
|
||||
aupcmcia* at obio? addr ?
|
||||
pcmcia* at aupcmcia?
|
||||
|
||||
#pbpci* at obio? addr ?
|
||||
#pci* at pbpci?
|
||||
|
||||
#flash* at obio? addr ?
|
||||
#lcd* at obio? addr ?
|
||||
|
||||
#pchb* at pci? dev ? function ?
|
||||
#pcib* at pci? dev ? function ?
|
||||
|
||||
# PCMCIA devices
|
||||
wi* at pcmcia? function ? # Lucent WaveLan IEEE (802.11)
|
||||
|
||||
# Pseudo-devices
|
||||
|
||||
# Disk/mass storage pseudo-devices
|
||||
#pseudo-device ccd 4 # concatenated disk devices
|
||||
#pseudo-device raid 4 # RAIDframe disk driver
|
||||
#options RAID_AUTOCONFIG # auto-configuration of RAID
|
||||
#pseudo-device md 1 # memory disk device (ramdisk)
|
||||
pseudo-device vnd 4 # disk-like interface to files
|
||||
|
||||
# Network pseudo-devices
|
||||
pseudo-device bpfilter 8 # Berkeley packet filter
|
||||
pseudo-device ipfilter # IP filter (firewall) and NAT
|
||||
pseudo-device loop # network loopback
|
||||
#pseudo-device ppp 2 # Point-to-Point Protocol
|
||||
#pseudo-device sl 2 # Serial Line IP
|
||||
#pseudo-device strip 2 # Starmode Radio IP (Metricom)
|
||||
#pseudo-device tun 2 # network tunneling over tty
|
||||
#pseudo-device gre 2 # generic L3 over IP tunnel
|
||||
#pseudo-device ipip 2 # RFC 2003 IP Encapsulation
|
||||
#pseudo-device gif 4 # RFC1933 tunnel
|
||||
#pseudo-device faith 1 # IPv[46] tcp relay translation
|
||||
#pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
|
||||
pseudo-device vlan # IEEE 802.1q encapsulation
|
||||
pseudo-device bridge # simple inter-network bridging
|
||||
|
||||
# Miscellaneous pseudo-devices
|
||||
pseudo-device pty # pseudo-terminals
|
||||
#pseudo-device tb 1 # tablet line discipline
|
||||
#pseudo-device sequencer 1 # MIDI sequencer
|
||||
# rnd works; RND_COM does not on port i386 yet.
|
||||
pseudo-device rnd # /dev/random & kernel generator
|
||||
#options RND_COM # use "com" randomness (BROKEN)
|
||||
|
||||
# A pseudo device needed for Coda # also needs CODA (above)
|
||||
#pseudo-device vcoda 4 # coda minicache <-> venus comm.
|
|
@ -0,0 +1,43 @@
|
|||
# $NetBSD: files.pb1000,v 1.1 2002/07/29 16:23:01 simonb Exp $
|
||||
|
||||
file arch/evbmips/alchemy/pb1000_intr.c
|
||||
|
||||
file arch/evbmips/alchemy/autoconf.c
|
||||
file arch/evbmips/alchemy/conf.c
|
||||
file arch/evbmips/alchemy/disksubr.c
|
||||
file arch/evbmips/alchemy/machdep.c
|
||||
|
||||
file arch/mips/mips/bus_dma.c
|
||||
file arch/evbmips/evbmips/clock.c
|
||||
file arch/evbmips/evbmips/interrupt.c
|
||||
file arch/evbmips/evbmips/yamon.c
|
||||
|
||||
# System bus
|
||||
device mainbus { }
|
||||
attach mainbus at root
|
||||
file arch/evbmips/alchemy/mainbus.c mainbus
|
||||
|
||||
device cpu
|
||||
attach cpu at mainbus
|
||||
file arch/evbmips/alchemy/cpu.c cpu
|
||||
|
||||
# Pb1000 on-board devices
|
||||
device obio { [addr=-1] }
|
||||
attach obio at mainbus
|
||||
file arch/evbmips/alchemy/pb1000_obio.c obio
|
||||
#file arch/evbmips/alchemy/pb1000_obio_space.c obio
|
||||
|
||||
device aupcmcia: pcmciabus
|
||||
attach aupcmcia at obio
|
||||
file arch/evbmips/alchemy/dev/aupcmcia.c aupcmcia
|
||||
|
||||
# Machine-independent USB device support
|
||||
include "dev/usb/files.usb"
|
||||
|
||||
# Machine-independent PCMCIA drivers
|
||||
device fdc {drive = -1} # files.pcmcia requires.
|
||||
include "dev/pcmcia/files.pcmcia"
|
||||
|
||||
# Memory Disk
|
||||
file dev/md_root.c memory_disk_hooks
|
||||
major { md = 6 }
|
|
@ -0,0 +1,17 @@
|
|||
# $NetBSD: std.pb1000.common,v 1.1 2002/07/29 16:23:01 simonb Exp $
|
||||
|
||||
machine evbmips mips
|
||||
|
||||
options MIPS3_ENABLE_CLOCK_INTR
|
||||
|
||||
# Platform support
|
||||
options ALCHEMY_PB1000
|
||||
|
||||
options EXEC_ELF32 # exec ELF32 binaries
|
||||
options EXEC_SCRIPT # exec #! scripts
|
||||
|
||||
makeoptions DEFTEXTADDR="0x800a0000"
|
||||
makeoptions BOARDTYPE="pb1000"
|
||||
|
||||
include "arch/evbmips/conf/files.pb1000"
|
||||
include "arch/mips/conf/files.alchemy"
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: std.pb1000.eb,v 1.1 2002/07/29 16:23:02 simonb Exp $
|
||||
|
||||
include "arch/evbmips/conf/std.pb1000.common"
|
||||
|
||||
makeoptions MACHINE_ARCH="mipseb"
|
|
@ -0,0 +1,5 @@
|
|||
# $NetBSD: std.pb1000.el,v 1.1 2002/07/29 16:23:02 simonb Exp $
|
||||
|
||||
include "arch/evbmips/conf/std.pb1000.common"
|
||||
|
||||
makeoptions MACHINE_ARCH="mipsel"
|
Loading…
Reference in New Issue