update from osymh@gemini.oscs.montana.edu (Michael L. Hitch) add support

for zthreebus siop scsi drivers and better machine recocgnition.
This commit is contained in:
chopps 1994-05-12 05:56:28 +00:00
parent 82809ca415
commit c1de856362
14 changed files with 964 additions and 722 deletions

View File

@ -1,7 +1,7 @@
/* Authors: Markus Wild, Bryan Ford, Niklas Hallqvist
* Michael L. Hitch - initial 68040 support
*
* $Id: amiga_init.c,v 1.13 1994/05/08 05:52:11 chopps Exp $
* $Id: amiga_init.c,v 1.14 1994/05/12 05:56:28 chopps Exp $
*/
@ -35,6 +35,7 @@
#include <amiga/amiga/cfdev.h>
#include <amiga/amiga/memlist.h>
#include <amiga/dev/ztwobusvar.h>
#include <amiga/dev/zthreebusvar.h>
#ifdef DEBUG
#include <amiga/amiga/color.h>
@ -155,6 +156,8 @@ start_c(id, fastram_start, fastram_size, chipram_size, esym_addr)
u_int zorro2_pt;
#endif
u_int end_loaded;
u_int ncd;
struct cfdev *cd;
orig_fastram_start = fastram_start;
orig_fastram_size = fastram_size;
@ -197,6 +200,14 @@ start_c(id, fastram_start, fastram_size, chipram_size, esym_addr)
}
}
/* look for Z3 boards. For now, no Z3 RAM-extensions are supported, just
I/O boards */
for (ZTHREEAVAIL = 0, cd = cfdev, ncd = ncfdev;
ncd > 0;
ncd--, cd++)
if ((u_int) cd->addr >= ZTHREEBASE && (u_int) cd->addr < ZTHREETOP)
ZTHREEAVAIL += amiga_round_page (cd->size);
#if 0
/* XXX */
{
@ -253,6 +264,8 @@ start_c(id, fastram_start, fastram_size, chipram_size, esym_addr)
pagetable_extra = CHIPMEMSIZE + CIASIZE + ZTWOROMSIZE;
#endif
pagetable_extra += (ZTWOMEMSIZE) / AMIGA_PAGE_SIZE; /* XXX */
if (ZTHREEAVAIL > 0)
pagetable_extra += btoc (ZTHREEAVAIL);
pagetable_size = (Sysptsize + (pagetable_extra + NPTEPG-1)/NPTEPG) << PGSHIFT;
vstart += pagetable_size;
pstart += pagetable_size;
@ -444,6 +457,9 @@ start_c(id, fastram_start, fastram_size, chipram_size, esym_addr)
}
#endif
/* following page tables MAY be allocated to ZORRO3 space, but they're
then later mapped in autoconf.c */
/* Setup page table for process 0.
We set up page table access for the kernel via Usrptmap (usrpt)
@ -498,6 +514,7 @@ start_c(id, fastram_start, fastram_size, chipram_size, esym_addr)
else /* XXX */
CIAADDR = CHIPMEMADDR + CHIPMEMSIZE*AMIGA_PAGE_SIZE;
ZTWOROMADDR = (caddr_t) CIAADDR + CIASIZE*AMIGA_PAGE_SIZE;
ZTHREEADDR = (caddr_t) ZTWOROMADDR + ZTWOROMSIZE*AMIGA_PAGE_SIZE;
CIAADDR += AMIGA_PAGE_SIZE/2; /* not on 8k boundery :-( */
/* just setup the custom chips address, other addresses (like SCSI on

View File

@ -27,7 +27,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: autoconf.c,v 1.18 1994/05/11 19:02:53 chopps Exp $
* $Id: autoconf.c,v 1.19 1994/05/12 05:56:30 chopps Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
@ -35,6 +35,7 @@
#include <sys/conf.h>
#include <sys/device.h>
#include <sys/disklabel.h>
#include <machine/cpu.h>
#include <amiga/amiga/cfdev.h>
#include <amiga/amiga/device.h>
#include <amiga/amiga/custom.h>
@ -190,7 +191,7 @@ mbattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
printf("\n");
printf ("\n");
config_found(dp, "clock", simple_devprint);
config_found(dp, "ser", simple_devprint);
config_found(dp, "par", simple_devprint);
@ -199,6 +200,11 @@ mbattach(pdp, dp, auxp)
config_found(dp, "ztwobus", simple_devprint);
if (is_a3000())
config_found(dp, "ahsc", simple_devprint);
if (is_a3000() || is_a4000()) {
config_found(dp, "zthreebus", simple_devprint);
}
if (is_a4000())
config_found(dp, "idesc", simple_devprint);
}
int
@ -324,6 +330,11 @@ is_a3000()
extern long orig_fastram_start;
short sc;
if ((machineid >> 16) == 3000)
return (1); /* It's an A3000 */
if (machineid >> 16)
return (0); /* It's not an A3000 */
/* Machine type is unknown, so try to guess it */
/* where is fastram on the A4000 ?? */
/* if fastram is below 0x07000000, assume it's not an A3000 */
if (orig_fastram_start < 0x07000000)
@ -360,5 +371,15 @@ is_a3000()
int
is_a4000()
{
return (a4000_flag); /* XXX */
if ((machineid >> 16) == 4000)
return (1); /* It's an A4000 */
if ((custom.deniseid & 0xff) == 0xf8)
return (1);
#ifdef DEBUG
if (a4000_flag)
printf ("Denise ID = %04x\n", (unsigned short)custom.deniseid);
#endif
if (machineid >> 16)
return (0); /* It's not an A4000 */
return (a4000_flag); /* Machine type not set */
}

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: locore.s 1.58 91/04/22$
*
* @(#)locore.s 7.11 (Berkeley) 5/9/91
* $Id: locore.s,v 1.16 1994/05/11 19:02:57 chopps Exp $
* $Id: locore.s,v 1.17 1994/05/12 05:56:32 chopps Exp $
*
* Original (hp300) Author: unknown, maybe Mike Hibler?
* Amiga author: Markus Wild
@ -606,7 +606,7 @@ Lbomrip:
Lstackok:
#endif /* DEBUG */
#endif
#if NZEUSSCSI > 0
#if NZSSC > 0
jbsr _siopintr6 | check for siop (53C710) interrupt
tstl d0
jne Lskipciab | XXX skip CIAB processing

View File

@ -38,7 +38,7 @@
* from: Utah $Hdr: machdep.c 1.63 91/04/24$
*
* @(#)machdep.c 7.16 (Berkeley) 6/3/91
* $Id: machdep.c,v 1.24 1994/05/11 19:02:59 chopps Exp $
* $Id: machdep.c,v 1.25 1994/05/12 05:56:34 chopps Exp $
*/
#include <sys/param.h>
@ -90,6 +90,7 @@
#include <amiga/amiga/cc.h>
#include <amiga/amiga/memlist.h>
#include <amiga/dev/ztwobusvar.h>
#include <amiga/dev/zthreebusvar.h>
/*
* most of these can be killed by adding a server chain for
* int2 (PORTS)
@ -102,10 +103,12 @@
#include "gtsc.h"
#include "zssc.h"
#include "mgnsc.h"
#include "wesc.h"
#include "otgsc.h"
#include "wstsc.h"
#include "ivsc.h"
#include "ser.h"
#include "idesc.h"
/* vm_map_t buffer_map; */
extern vm_offset_t avail_end;
@ -381,6 +384,9 @@ again:
printf ("memory segment %d at %08lx size %08lx\n", i,
mem_list->mem_seg[i].mem_start,
mem_list->mem_seg[i].mem_size);
if (ZTHREEAVAIL)
printf ("Found %d bytes within Zorro III space\n",
ZTHREEAVAIL);
/*
* Set up CPU-specific registers, cache, etc.
*/
@ -1413,7 +1419,11 @@ intrhand(sr)
goto intports_done;
#endif
#if NMGNSC > 0
if (siopintr2())
if (mgnsc_dmaintr())
goto intports_done;
#endif
#if NWESC > 0
if (wesc_dmaintr())
goto intports_done;
#endif
#if (NOTGSC + NWSTSC + NIVSC) > 0
@ -1423,6 +1433,10 @@ intrhand(sr)
#if NLE > 0
if (leintr (0))
goto intports_done;
#endif
#if NIDESC > 0
if (idesc_intr ())
goto intports_done;
#endif
ciaa_intr ();
intports_done:

View File

@ -1,7 +1,7 @@
#
# GENERIC AMIGA
#
# $Id: GENERIC,v 1.7 1994/05/11 19:03:33 chopps Exp $
# $Id: GENERIC,v 1.8 1994/05/12 05:56:59 chopps Exp $
#
# This configuration file contains all possible options
#
@ -33,8 +33,10 @@ atzsc0 at ztwobus0
#ivsc0 at ztwobus0 # IVS scsi
#mlhsc0 at ztwobus0 # Hacker scsi
#otgsc0 at ztwobus0 # 12 gauge scsi
#zssc0 at ztwobus0 # Zues scsi
#mgnsc0 at ztwobus0 # Magnum scsi
zssc0 at ztwobus0 # Zeus scsi
mgnsc0 at ztwobus0 # Magnum scsi
wesc0 at zthreebus0 # Warp Engine scsi
#idesc0 at mainbus0 # A4000(A1200?) IDE
scsibus0 at gtsc0
scsibus1 at ahsc0
@ -43,8 +45,10 @@ scsibus2 at atzsc0
#scsibus3 at ivsc0
#scsibus4 at mlhsc0
#scsibus5 at otgsc0
#scsibus6 at zssc0
#scsibus7 at mgnsc0
scsibus6 at zssc0
scsibus7 at mgnsc0
scsibus8 at wesc0
#scsibus9 at idesc0
# any drives on configured controllers.
sd0 at scsibus? target 0 lun 0
@ -54,6 +58,7 @@ sd3 at scsibus? target 3 lun 0
sd4 at scsibus? target 4 lun 0
sd5 at scsibus? target 5 lun 0
sd6 at scsibus? target 6 lun 0
sd7 at scsibus? target ? lun 0
st0 at scsibus? target ? lun 0
config netbsd swap on generic

View File

@ -1,5 +1,5 @@
#
# $Id: files.amiga,v 1.1 1994/05/08 05:54:39 chopps Exp $
# $Id: files.amiga,v 1.2 1994/05/12 05:57:00 chopps Exp $
#
maxusers 2 8 64
@ -70,7 +70,9 @@ device grfrt at ztwobus: grfbus
file arch/amiga/dev/grf_rt.c grfrt
file arch/amiga/dev/ite_rt.c grfrt ite
# device zthreebus at mainbus {}
# zorro III expansion bus.
device zthreebus at mainbus {}
file arch/amiga/dev/zthreebus.c zthreebus
# handle gvp's odd autoconf info..
device gvpbus at ztwobus {}
@ -109,6 +111,10 @@ file arch/amiga/dev/zssc.c zssc needs-flag
device mgnsc at ztwobus: scsi, siop
file arch/amiga/dev/mgnsc.c mgnsc needs-flag
# MacroSystems Warp Engine
device wesc at zthreebus: scsi, siop
file arch/amiga/dev/wesc.c wesc needs-flag
# ncr 5380 controllers
define sci
file arch/amiga/dev/ncrd.c sci
@ -129,6 +135,10 @@ file arch/amiga/dev/otgsc.c otgsc needs-flag
device mlhsc at ztwobus: scsi, sci
file arch/amiga/dev/mlhsc.c mlhsc needs-flag
# Amiga 4000/1200 IDE
device idesc at mainbus: scsi
file arch/amiga/dev/idesc.c idesc needs-flag
device scsibus at scsi {target = -1, lun = -1}
device cd at scsibus: disk

View File

@ -1,5 +1,5 @@
#
# $Id: files.amiga.newconf,v 1.1 1994/05/08 05:54:39 chopps Exp $
# $Id: files.amiga.newconf,v 1.2 1994/05/12 05:57:00 chopps Exp $
#
maxusers 2 8 64
@ -70,7 +70,9 @@ device grfrt at ztwobus: grfbus
file arch/amiga/dev/grf_rt.c grfrt
file arch/amiga/dev/ite_rt.c grfrt ite
# device zthreebus at mainbus {}
# zorro III expansion bus.
device zthreebus at mainbus {}
file arch/amiga/dev/zthreebus.c zthreebus
# handle gvp's odd autoconf info..
device gvpbus at ztwobus {}
@ -109,6 +111,10 @@ file arch/amiga/dev/zssc.c zssc needs-flag
device mgnsc at ztwobus: scsi, siop
file arch/amiga/dev/mgnsc.c mgnsc needs-flag
# MacroSystems Warp Engine
device wesc at zthreebus: scsi, siop
file arch/amiga/dev/wesc.c wesc needs-flag
# ncr 5380 controllers
define sci
file arch/amiga/dev/ncrd.c sci
@ -129,6 +135,10 @@ file arch/amiga/dev/otgsc.c otgsc needs-flag
device mlhsc at ztwobus: scsi, sci
file arch/amiga/dev/mlhsc.c mlhsc needs-flag
# Amiga 4000/1200 IDE
device idesc at mainbus: scsi
file arch/amiga/dev/idesc.c idesc needs-flag
device scsibus at scsi {target = -1, lun = -1}
device cd at scsibus: disk

View File

@ -1,5 +1,5 @@
# standard amiga information
# $Id: std.amiga,v 1.1 1994/05/08 05:56:53 chopps Exp $
# $Id: std.amiga,v 1.2 1994/05/12 05:57:01 chopps Exp $
machine amiga m68k
mainbus0 at root
@ -9,5 +9,6 @@ ser0 at mainbus0
par0 at mainbus0
kbd0 at mainbus0
ztwobus0 at mainbus0
zthreebus0 at mainbus0
pseudo-device mouse 2

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 1994 Michael L. Hitch
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
@ -31,20 +32,144 @@
* SUCH DAMAGE.
*
* @(#)dma.c
* $Id: mgnsc.c,v 1.1 1994/05/08 05:53:27 chopps Exp $
* $Id: mgnsc.c,v 1.2 1994/05/12 05:57:21 chopps Exp $
*/
/*
* dummy CSA Magnum DMA driver
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cc.h>
#include <amiga/amiga/device.h>
#include <amiga/dev/siopreg.h>
#include <amiga/dev/siopvar.h>
#include <amiga/dev/zthreebusvar.h>
#include "magnumscsi.h"
int mgnscprint __P((void *auxp, char *));
void mgnscattach __P((struct device *, struct device *, void *));
int mgnscmatch __P((struct device *, struct cfdata *, void *));
#if NMAGNUMSCSI > 0
struct scsi_adapter mgnsc_scsiswitch = {
siop_scsicmd,
siop_minphys,
0, /* no lun support */
0, /* no lun support */
siop_adinfo,
"mgnsc",
};
void
magnumdmainit ()
{
}
struct scsi_device mgnsc_scsidev = {
NULL, /* use default error handler */
NULL, /* do not have a start functio */
NULL, /* have no async handler */
NULL, /* Use default done routine */
"mgnsc",
0,
};
#ifdef DEBUG
#endif
struct cfdriver mgnsccd = {
NULL, "mgnsc", mgnscmatch, mgnscattach,
DV_DULL, sizeof(struct siop_softc), NULL, 0 };
/*
* if we are a CSA Magnum 40 SCSI
*/
int
mgnscmatch(pdp, cdp, auxp)
struct device *pdp;
struct cfdata *cdp;
void *auxp;
{
struct zthreebus_args *zap;
zap = auxp;
if (zap->manid == 1058 && zap->prodid == 17)
return(1);
return(0);
}
void
mgnscattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
struct siop_softc *sc;
struct zthreebus_args *zap;
siop_regmap_p rp;
zap = auxp;
sc = (struct siop_softc *)dp;
sc->sc_siopp = rp = zap->va + 0x40000;
/*
* DCNTL = 25.01->37.5MHZ / SCLK/1.5
* CTEST7 = TT1
*/
sc->sc_clock_freq = 0x0240;
siopreset(sc);
sc->sc_link.adapter_softc = sc;
sc->sc_link.adapter_targ = 7;
sc->sc_link.adapter = &mgnsc_scsiswitch;
sc->sc_link.device = &mgnsc_scsidev;
TAILQ_INIT(&sc->sc_xslist);
custom.intreq = INTF_PORTS;
custom.intena = INTF_SETCLR | INTF_PORTS;
/*
* attach all scsi units on us
*/
config_found(dp, &sc->sc_link, mgnscprint);
}
/*
* print diag if pnp is NULL else just extra
*/
int
mgnscprint(auxp, pnp)
void *auxp;
char *pnp;
{
if (pnp == NULL)
return(UNCONF);
return(QUIET);
}
int
mgnsc_dmaintr()
{
siop_regmap_p rp;
struct siop_softc *dev;
int i, found;
u_char istat;
found = 0;
for (i = 0; i < mgnsccd.cd_ndevs; i++) {
dev = mgnsccd.cd_devs[i];
if (dev == NULL)
continue;
rp = dev->sc_siopp;
istat = rp->siop_istat;
if ((istat & (SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0)
continue;
if ((dev->sc_flags & (SIOP_DMA | SIOP_SELECTED)) == SIOP_SELECTED)
continue; /* doing non-interrupt I/O */
found++;
dev->sc_istat = istat;
dev->sc_dstat = rp->siop_dstat;
dev->sc_sstat0 = rp->siop_sstat0;
siopintr(dev);
}
return(found);
}

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)siopreg.h 7.3 (Berkeley) 2/5/91
* $Id: siopreg.h,v 1.3 1994/02/11 07:02:19 chopps Exp $
* $Id: siopreg.h,v 1.4 1994/05/12 05:57:24 chopps Exp $
*/
/*
@ -89,6 +89,7 @@ typedef struct {
volatile unsigned long siop_addr;
} siop_regmap_t;
typedef volatile siop_regmap_t *siop_regmap_p;
/*
* Register defines
@ -303,7 +304,7 @@ typedef struct {
0 --> 37.51..50.00 Mhz, div=2
1 --> 25.01..37.50 Mhz, div=1.5
2 --> 16.67..25.00 Mhz, div=1
3 --> reserved
3 --> 50.01..66.00 Mhz, div=3
*/
#define SIOP_DCNTL_S16 0x20 /* SCRIPTS fetches 16bits at a time */
#define SIOP_DCNTL_SSM 0x10 /* Single step mode */

View File

@ -34,10 +34,25 @@
* SUCH DAMAGE.
*
* @(#)siopvar.h 7.1 (Berkeley) 5/8/90
* $Id: siopvar.h,v 1.2 1994/02/11 07:02:20 chopps Exp $
* $Id: siopvar.h,v 1.3 1994/05/12 05:57:25 chopps Exp $
*/
#ifndef _SIOPVAR_H_
#define _SIOPVAR_H_
struct siop_ds { /* Data Structure */
/*
* The largest single request will be MAXPHYS bytes which will require
* at most MAXPHYS/NBPG+1 chain elements to describe, i.e. if none of
* the buffer pages are physically contiguous (MAXPHYS/NBPG) and the
* buffer is not page aligned (+1).
*/
#define DMAMAXIO (MAXPHYS/NBPG+1)
struct siop_pending {
TAILQ_ENTRY(siop_pending) link;
struct scsi_xfer *xs;
};
struct siop_ds { /* Data Structure for SCRIPTS */
long scsi_addr; /* SCSI ID & sync */
long idlen; /* Identify message */
char *idbuf;
@ -54,13 +69,11 @@ struct siop_ds { /* Data Structure */
struct {
long datalen;
char *databuf;
} chain[MAXPHYS/NBPG+1];
} chain[DMAMAXIO];
};
struct siop_softc {
struct amiga_ctlr *sc_ac;
struct devqueue sc_dq;
struct devqueue sc_sq;
struct device sc_dev;
/* should have one for each target? */
u_char sc_istat;
@ -68,6 +81,12 @@ struct siop_softc {
u_char sc_sstat0;
u_char sc_sstat1;
struct siop_ds sc_ds;
struct scsi_link sc_link; /* proto for sub devices */
siop_regmap_p sc_siopp; /* the SIOP */
volatile void *sc_cregs; /* driver specific regs */
TAILQ_HEAD(,siop_pending) sc_xslist; /* LIFO */
struct siop_pending sc_xsstore[8][8]; /* one for every unit */
struct scsi_xfer *sc_xs; /* transfer from high level code */
u_char sc_flags;
u_char sc_lun;
u_long sc_clock_freq;
@ -93,3 +112,30 @@ struct siop_softc {
#define SYNC_SENT 1 /* we sent sync request, no answer yet */
#define SYNC_DONE 2 /* target accepted our (or inferior) settings,
or it rejected the request and we stay async */
#define MSG_CMD_COMPLETE 0x00
#define MSG_EXT_MESSAGE 0x01
#define MSG_SAVE_DATA_PTR 0x02
#define MSG_RESTORE_PTR 0x03
#define MSG_DISCONNECT 0x04
#define MSG_INIT_DETECT_ERROR 0x05
#define MSG_ABORT 0x06
#define MSG_REJECT 0x07
#define MSG_NOOP 0x08
#define MSG_PARITY_ERROR 0x09
#define MSG_BUS_DEVICE_RESET 0x0C
#define MSG_IDENTIFY 0x80
#define MSG_IDENTIFY_DR 0xc0 /* (disconnect/reconnect allowed) */
#define MSG_SYNC_REQ 0x01
#define STS_CHECKCOND 0x02 /* Check Condition (ie., read sense) */
#define STS_CONDMET 0x04 /* Condition Met (ie., search worked) */
#define STS_BUSY 0x08
#define STS_INTERMED 0x10 /* Intermediate status sent */
#define STS_EXT 0x80 /* Extended status valid */
void siop_minphys __P((struct buf *bp));
u_int siop_adinfo __P((void));
int siop_scsicmd __P((struct scsi_xfer *));
#endif /* _SIOPVAR_H */

View File

@ -1,4 +1,5 @@
/*
* Copyright (c) 1994 Michael L. Hitch
* Copyright (c) 1982, 1990 The Regents of the University of California.
* All rights reserved.
*
@ -31,19 +32,161 @@
* SUCH DAMAGE.
*
* @(#)dma.c
* $Id: zssc.c,v 1.1 1994/05/08 05:53:51 chopps Exp $
* $Id: zssc.c,v 1.2 1994/05/12 05:57:26 chopps Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/device.h>
#include <scsi/scsi_all.h>
#include <scsi/scsiconf.h>
#include <amiga/amiga/custom.h>
#include <amiga/amiga/cc.h>
#include <amiga/amiga/device.h>
#include <amiga/dev/siopreg.h>
#include <amiga/dev/siopvar.h>
#include <amiga/dev/ztwobusvar.h>
int zsscprint __P((void *auxp, char *));
void zsscattach __P((struct device *, struct device *, void *));
int zsscmatch __P((struct device *, struct cfdata *, void *));
int siopintr __P((struct siop_softc *));
struct scsi_adapter zssc_scsiswitch = {
siop_scsicmd,
siop_minphys,
0, /* no lun support */
0, /* no lun support */
siop_adinfo,
"zssc",
};
struct scsi_device zssc_scsidev = {
NULL, /* use default error handler */
NULL, /* do not have a start functio */
NULL, /* have no async handler */
NULL, /* Use default done routine */
"zssc",
0,
};
#ifdef DEBUG
#endif
struct cfdriver zssccd = {
NULL, "zssc", zsscmatch, zsscattach,
DV_DULL, sizeof(struct siop_softc), NULL, 0 };
/*
* dummy PPI Zeus DMA driver
* if we are an PPI Zeus
*/
int
zsscmatch(pdp, cdp, auxp)
struct device *pdp;
struct cfdata *cdp;
void *auxp;
{
struct ztwobus_args *zap;
#include "zeusscsi.h"
#if NZEUSSCSI > 0
zap = auxp;
if (zap->manid == 2026 && zap->prodid == 150)
return(1);
return(0);
}
void
zeusdmainit ()
zsscattach(pdp, dp, auxp)
struct device *pdp, *dp;
void *auxp;
{
}
struct siop_softc *sc;
struct ztwobus_args *zap;
siop_regmap_p rp;
zap = auxp;
sc = (struct siop_softc *)dp;
sc->sc_siopp = rp = zap->va + 0x4000;
/*
* DCNTL = 50.01->66MHZ / SCLK/3
* CTEST7 = 00
*/
sc->sc_clock_freq = 0xc0;
siopreset(sc);
sc->sc_link.adapter_softc = sc;
sc->sc_link.adapter_targ = 7;
sc->sc_link.adapter = &zssc_scsiswitch;
sc->sc_link.device = &zssc_scsidev;
TAILQ_INIT(&sc->sc_xslist);
#if 0
custom.intreq = INTF_EXTER;
custom.intena = INTF_SETCLR | INTF_EXTER;
#endif
/*
* attach all scsi units on us
*/
config_found(dp, &sc->sc_link, zsscprint);
}
/*
* print diag if pnp is NULL else just extra
*/
int
zsscprint(auxp, pnp)
void *auxp;
char *pnp;
{
if (pnp == NULL)
return(UNCONF);
return(QUIET);
}
/*
* Level 6 interrupt processing for the Progressive Peripherals Inc
* Zeus SCSI. Because the level 6 interrupt is above splbio, the
* interrupt status is saved and an sicallback to the level 2 interrupt
* handler scheduled. This way, the actual processing of the interrupt
* can be deferred until splbio is unblocked.
*/
#if 0
int
zssc_dmaintr()
#else
int
siopintr6 ()
#endif
{
siop_regmap_p rp;
struct siop_softc *dev;
int i, istat, found;
found = 0;
for (i = 0; i < zssccd.cd_ndevs; i++) {
dev = zssccd.cd_devs[i];
if (dev == NULL)
continue;
rp = dev->sc_siopp;
istat = rp->siop_istat;
if ((istat & (SIOP_ISTAT_SIP | SIOP_ISTAT_DIP)) == 0)
continue;
if ((dev->sc_flags & (SIOP_DMA | SIOP_SELECTED)) == SIOP_SELECTED)
continue; /* doing non-interrupt I/O */
found++;
dev->sc_istat = istat;
dev->sc_dstat = rp->siop_dstat;
dev->sc_sstat0 = rp->siop_sstat0;
custom.intreq = INTF_EXTER;
add_sicallback (siopintr, dev, NULL);
}
return(found);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: loadbsd.c,v 1.9 1994/03/28 06:16:54 chopps Exp $
* $Id: loadbsd.c,v 1.10 1994/05/12 05:57:33 chopps Exp $
*/
#include <sys/types.h>
@ -10,6 +10,7 @@
#include <exec/types.h>
#include <exec/execbase.h>
#include <exec/memory.h>
#include <exec/resident.h>
#include <libraries/configregs.h>
#include <libraries/expansionbase.h>
#include <graphics/gfxbase.h>
@ -44,6 +45,7 @@ OPTIONS
\t list information being passed to the kernel and also
\t exits without actually starting NetBSD.
\t-S Include kernel symbol table.
\t-D Enter debugger
\t-V Version of loadbsd program.
HISTORY
This version supports Kernel version 720 +
@ -66,14 +68,17 @@ struct GfxBase *GfxBase;
/*
* Version history:
* 1.x Kernel parameter passing version check
* 2.0 Added symbol table end address and symbol table support
* 2.1 03/23/94 - round up end of fastram segment
* check fastram segment size for minimum of 2M
* use largest segment of highest priority if -p option
* print out fastram size in KB if not a multiple of MB
* 2.2 03/24/94 - zero out all unused registers
* started version history comment
* 1.x Kernel parameter passing version check.
* 2.0 Added symbol table end address and symbol table support.
* 2.1 03/23/94 - Round up end of fastram segment.
* Check fastram segment size for minimum of 2M.
* Use largest segment of highest priority if -p option.
* Print out fastram size in KB if not a multiple of MB.
* 2.2 03/24/94 - Zero out all unused registers.
* Started version history comment.
* 2.3 04/26/94 - Added -D option to enter debugger on boot.
* 2.4 04/30/94 - Cpuid includes base machine type.
* Also check if CPU is capable of running NetBSD.
*/
struct MEM_LIST {
@ -93,17 +98,21 @@ int p_opt;
int t_opt;
int m_opt;
int S_opt;
int D_opt;
u_long cpuid;
extern char *optarg;
extern int optind;
void get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size);
void get_cpuid (void);
void Usage (char *program_name);
void Version (void);
static const char _version[] = "$VER: LoadBSD 2.2 (24.3.94)";
static const char _version[] = "$VER: LoadBSD 2.4 (30.4.94)";
int
int
main (int argc, char *argv[])
{
struct exec e;
@ -113,13 +122,13 @@ main (int argc, char *argv[])
if (argc >= 2)
{
if ((fd = open (argv[1], 0)) >= 0)
{
if (read (fd, &e, sizeof (e)) == sizeof (e))
{
if (e.a_magic == NMAGIC)
{
u_char *kernel;
int kernel_size;
{
if (read (fd, &e, sizeof (e)) == sizeof (e))
{
if (e.a_magic == NMAGIC)
{
u_char *kernel;
int kernel_size;
int text_size;
struct ConfigDev *cd;
int num_cd;
@ -129,7 +138,7 @@ main (int argc, char *argv[])
u_short *kern_vers;
char *esym;
int string_size;
GfxBase = (struct GfxBase *) OpenLibrary ("graphics.library", 0);
if (! GfxBase) /* not supposed to fail... */
abort();
@ -137,7 +146,7 @@ main (int argc, char *argv[])
if (! ExpansionBase) /* not supposed to fail... */
abort();
optind = 2;
while ((i = getopt (argc, argv, "kabptVm:S")) != EOF)
while ((i = getopt (argc, argv, "kabptVm:SD")) != EOF)
switch (i) {
case 'k':
k_opt = 1;
@ -157,20 +166,24 @@ main (int argc, char *argv[])
case 'm':
m_opt = atoi (optarg) * 1024;
break;
case 'V':
Version();
break;
case 'S':
S_opt = 1;
break;
default:
Usage(argv[0]);
fprintf(stderr,"Unrecognized option \n");
exit(-1);
case 'V':
Version();
break;
case 'S':
S_opt = 1;
break;
case 'D':
D_opt = 1;
break;
default:
Usage(argv[0]);
fprintf(stderr,"Unrecognized option \n");
exit(-1);
}
for (cd = 0, num_cd = 0; cd = FindConfigDev (cd, -1, -1); num_cd++) ;
get_mem_config (&fastmem_start, &fastmem_size, &chipmem_size);
get_cpuid ();
text_size = (e.a_text + __LDPGSZ - 1) & (-__LDPGSZ);
esym = NULL;
@ -193,7 +206,7 @@ main (int argc, char *argv[])
S_opt = 1; /* sucess! Keep -S option */
}
}
}
}
kernel = (u_char *) malloc (kernel_size);
@ -206,9 +219,9 @@ main (int argc, char *argv[])
mem_list.mem_seg[i].mem_prio);
}
if (kernel)
{
if (read (fd, kernel, e.a_text) == e.a_text
if (kernel)
{
if (read (fd, kernel, e.a_text) == e.a_text
&& read (fd, kernel + text_size, e.a_data) == e.a_data)
{
int *knum_cd;
@ -225,7 +238,7 @@ main (int argc, char *argv[])
{
fastmem_size = m_opt;
}
if (a_opt)
{
printf("Autobooting...");
@ -237,7 +250,12 @@ main (int argc, char *argv[])
printf("Askboot...");
boothowto |= RB_ASKNAME;
}
if (D_opt)
{
boothowto |= RB_KDB;
}
printf ("Using %d%c FASTMEM at 0x%x, %dM CHIPMEM\n",
(fastmem_size & 0xfffff) ? fastmem_size>>10 :
fastmem_size>>20,
@ -250,6 +268,13 @@ main (int argc, char *argv[])
printf ("This kernel requires a newer version of loadbsd: %d\n", *kern_vers);
exit (0);
}
if ((cpuid & AFB_68020) == 0)
{
printf ("Hmmm... You don't seem to have a CPU capable\n");
printf (" of running NetBSD. You need a 68020\n");
printf (" or better\n");
exit (0);
}
/* give them a chance to read the information... */
sleep(2);
@ -284,24 +309,24 @@ main (int argc, char *argv[])
startit (kernel, kernel_size,
e.a_entry, fastmem_start,
fastmem_size, chipmem_size,
boothowto, esym );
boothowto, esym, cpuid );
}
else
fprintf (stderr, "Executable corrupt!\n");
}
else
fprintf (stderr, "Out of memory! (%d)\n", text_size + e.a_data + e.a_bss
}
else
fprintf (stderr, "Out of memory! (%d)\n", text_size + e.a_data + e.a_bss
+ num_cd*sizeof(*cd) + 4
+ mem_list.num_mem*sizeof(struct MEM_SEG) + 4);
}
}
else
fprintf (stderr, "Unsupported executable: %o\n", e.a_magic);
}
else
fprintf (stderr, "Unsupported executable: %o\n", e.a_magic);
}
else
fprintf (stderr, "Can't read header of %s\n", argv[1]);
close (fd);
}
}
else
perror ("open");
}
@ -313,17 +338,17 @@ main (int argc, char *argv[])
void
get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size)
{
extern struct ExecBase *SysBase;
extern struct ExecBase *SysBase;
struct MemHeader *mh, *nmh;
int num_mem = 0;
u_int seg_size;
u_int seg_start;
u_int seg_end;
char mem_pri = -128;
*fastmem_size = 0;
*chipmem_size = 0;
/* walk thru the exec memory list */
Forbid ();
for (mh = (struct MemHeader *) SysBase->MemList.lh_Head;
@ -339,7 +364,7 @@ get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size
mem_list.mem_seg[num_mem].mem_start = seg_start;
if (mh->mh_Attributes & MEMF_CHIP)
{
{
/* there should hardly be more than one entry for chip mem, but
handle it the same nevertheless */
/* chipmem always starts at 0, so include vector area */
@ -351,7 +376,7 @@ get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size
{
*chipmem_size = seg_size;
}
}
}
else
{
/* some heuristics.. */
@ -378,7 +403,7 @@ get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size
continue;
/* if p_opt is set, select memory by priority instead of size */
if ((!p_opt && seg_size > *fastmem_size) ||
(p_opt && mem_pri <= mh->mh_Node.ln_Pri && seg_size > *fastmem_size))
(p_opt && mem_pri <= mh->mh_Node.ln_Pri && seg_size > *fastmem_size))
{
*fastmem_size = seg_size;
*fastmem_start = (void *)seg_start;
@ -390,7 +415,43 @@ get_mem_config (void **fastmem_start, u_long *fastmem_size, u_long *chipmem_size
Permit();
}
/*
* Try to determine the machine ID by searching the resident module list
* for modules only present on specific machines. (Thanks, Bill!)
*/
void
get_cpuid ()
{
extern struct ExecBase *SysBase;
u_long *rl;
struct Resident *rm;
cpuid = SysBase->AttnFlags; /* get FPU and CPU flags */
rl = (u_long *) SysBase->ResModules;
if (rl == NULL)
return;
while (*rl) {
rm = (struct Resident *) *rl;
if (strcmp (rm->rt_Name, "A4000 Bonus") == 0 ||
strcmp (rm->rt_Name, "A1000 Bonus") == 0) {
cpuid |= 4000 << 16;
break;
}
if (strcmp (rm->rt_Name, "A3000 Bonus") == 0) {
cpuid |= 3000 << 16;
break;
}
if (strcmp (rm->rt_Name, "card.resource") == 0) {
cpuid |= 1200 << 16; /* or A600 :-) */
break;
}
++rl;
}
if (*rl == 0) /* Nothing found, it's probably an A2000 or A500 */
cpuid |= 2000 << 16;
}
asm ("
@ -415,6 +476,7 @@ start_super:
| d5: AttnFlags (cpuid)
| d7: boothowto
| a4: esym location
| All other registers zeroed for possible future requirements.
movel a3@(4),a1 | loaded kernel
movel a3@(8),d2 | length of loaded kernel
@ -422,10 +484,9 @@ start_super:
movel a3@(16),a0 | fastmem-start
movel a3@(20),d0 | fastmem-size
movel a3@(24),d1 | chipmem-size
movel #0,d5
movew (ABSEXECBASE)@(0x128),d5 | SysBase->AttnFlags
movel a3@(28),d7 | boothowto
movel a3@(32),a4 | esym
movel a3@(36),d5 | cpuid
subl a5,a5 | target, load to 0
btst #3,(ABSEXECBASE)@(0x129) | AFB_68040,SysBase->AttnFlags