diff options
author | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 1995-12-30 19:02:48 +0000 |
commit | ab124e78b0271ddb904b761b31e5c9a0cf24e070 (patch) | |
tree | 0cf1447720c45721ed3d214a4eaaa6834bda155d /sys/gnu | |
parent | 15748830d0fcd29294a1969a1012655e74908c1e (diff) | |
download | FreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.zip FreeBSD-src-ab124e78b0271ddb904b761b31e5c9a0cf24e070.tar.gz |
recording cvs-1.6 file death
Diffstat (limited to 'sys/gnu')
25 files changed, 0 insertions, 11732 deletions
diff --git a/sys/gnu/i386/fpemul/bde_trapinfo.mail b/sys/gnu/i386/fpemul/bde_trapinfo.mail deleted file mode 100644 index 2749e04..0000000 --- a/sys/gnu/i386/fpemul/bde_trapinfo.mail +++ /dev/null @@ -1,35 +0,0 @@ -From bde@kralizec.zeta.org.au Sun Jun 27 01:18:32 1993 -Received: from ultima.socs.uts.EDU.AU by bsd.coe.montana.edu (5.67/KAOS-1) - id AA11952; Sun, 27 Jun 93 01:18:32 -0600 -Received: by ultima.socs.uts.EDU.AU (5.65+/SMI-3.3) - id AA03033; Sun, 27 Jun 93 17:10:22 +1000 -Received: by kralizec.zeta.org.au (4.0/SMI-4.0) - id AA15074; Sat, 26 Jun 93 02:32:58 EST -Date: Sat, 26 Jun 93 02:32:58 EST -From: bde@kralizec.zeta.org.au (Bruce Evans) -Message-Id: <9306251632.AA15074@kralizec.zeta.org.au> -To: nate@bsd.coe.montana.edu -Subject: Re: Trapframe information -Status: OR - -tf_isp original esp (probably spare - popal ignores it) -tf_trapno s/w trap no (may be spare - trap.c has already looked at it) -tf_err h/w error code (probably spare - gets discarded before iret) - -___fs not stored in 386BSD pcb. Constant anyway unless user has - screwed with it (?). -___gs ditto -___orig_eip in linux, this is on the stack just before the call to the - emulator. The reason that it's not a local variable is to - avoid passing around pointers to it - current->frame (or - whatever) points to everything in the stack frame. The - macros hide a lot of slow memory references - current->frame->var. - ->(And I need to see if I can map orig_eip to one of the three that I'm unsure of ->in the BSD sources) - -tf_isp is the least evil. - -Bruce - diff --git a/sys/gnu/i386/isa/scd.c b/sys/gnu/i386/isa/scd.c deleted file mode 100644 index 92d31de..0000000 --- a/sys/gnu/i386/isa/scd.c +++ /dev/null @@ -1,1530 +0,0 @@ -/*- - * Copyright (c) 1995 Mikael Hybsch - * - * Portions of this file are copied from mcd.c - * which has the following copyrights: - * - * Copyright 1993 by Holger Veit (data part) - * Copyright 1993 by Brian Moore (audio part) - * Changes Copyright 1993 by Gary Clark II - * Changes Copyright (C) 1994 by Andrew A. Chernov - * - * Rewrote probe routine to work on newer Mitsumi drives. - * Additional changes (C) 1994 by Jordan K. Hubbard - * - * The Linux driver cdu31a has been used as a reference when writing this - * code, there fore bringing it under the GNU Public License. The following - * conditions of redistribution therefore apply: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - -/* $Id: scd.c,v 1.7 1995/02/09 11:30:07 jkh Exp $ */ - -/* Please send any comments to micke@dynas.se */ - -#define SCD_DEBUG 0 - -#include "scd.h" -#if NSCD > 0 -#include <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/file.h> -#include <sys/buf.h> -#include <sys/stat.h> -#include <sys/uio.h> -#include <sys/ioctl.h> -#include <sys/cdio.h> -#include <sys/errno.h> -#include <sys/dkbad.h> -#include <sys/disklabel.h> -#include <sys/devconf.h> -#include <machine/stdarg.h> - -#include <i386/isa/isa.h> -#include <i386/isa/isa_device.h> -#include <gnu/i386/isa/scdreg.h> - -#define scd_part(dev) ((minor(dev)) & 7) -#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3) -#define scd_phys(dev) (((minor(dev)) & 0x40) >> 6) -#define RAW_PART 2 - -/* flags */ -#define SCDOPEN 0x0001 /* device opened */ -#define SCDVALID 0x0002 /* parameters loaded */ -#define SCDINIT 0x0004 /* device is init'd */ -#define SCDPROBING 0x0020 /* probing */ -#define SCDTOC 0x0100 /* already read toc */ -#define SCDMBXBSY 0x0200 /* local mbx is busy */ -#define SCDSPINNING 0x0400 /* drive is spun up */ - -#define SCD_S_BEGIN 0 -#define SCD_S_BEGIN1 1 -#define SCD_S_WAITSTAT 2 -#define SCD_S_WAITFIFO 3 -#define SCD_S_WAITSPIN 4 -#define SCD_S_WAITREAD 5 -#define SCD_S_WAITPARAM 6 - -#define RDELAY_WAIT 300 -#define RDELAY_WAITREAD 300 - -#define SCDBLKSIZE 2048 - -#ifdef SCD_DEBUG - int scd_debuglevel = SCD_DEBUG; -# define XDEBUG(level, data) {if (scd_debuglevel >= level) printf data;} -#else -# define XDEBUG(level, data) -#endif - -struct scd_mbx { - short unit; - short port; - short retry; - short nblk; - int sz; - u_long skip; - struct buf *bp; - int p_offset; - short count; -}; - -struct scd_data { - int iobase; - char double_speed; - char *name; - short flags; - int blksize; - u_long disksize; - struct disklabel dlabel; - int openflag; - struct { - unsigned char adr :4; - unsigned char ctl :4; /* xcdplayer needs this */ - unsigned char start_msf[3]; - } toc[MAX_TRACKS]; - short first_track; - short last_track; - struct ioc_play_msf last_play; - - short audio_status; - struct buf head; /* head of buf queue */ - struct scd_mbx mbx; -} scd_data[NSCD]; - -/* prototypes */ -int scdopen(dev_t dev); -int scdclose(dev_t dev); -void scdstrategy(struct buf *bp); -int scdioctl(dev_t dev, int cmd, caddr_t addr, int flags); -int scdsize(dev_t dev); - -static int bcd2bin(bcd_t b); -static bcd_t bin2bcd(int b); -static void hsg2msf(int hsg, bcd_t *msf); -static int msf2hsg(bcd_t *msf); - -static void process_attention(unsigned unit); -static inline void write_control(unsigned port, unsigned data); -static int waitfor_status_bits(int unit, int bits_set, int bits_clear); -static int waitfor_attention(int unit); -static int send_cmd(u_int unit, u_char cmd, u_int nargs, ...); -static void init_drive(unsigned unit); -static int spin_up(unsigned unit); -static int read_toc(dev_t dev); -static int get_result(u_int unit, int result_len, u_char *result); -static void print_error(int unit, int errcode); - -static void scd_start(int unit); -static void scd_doread(int state, struct scd_mbx *mbxin); - -static int scd_eject(int unit); -static int scd_stop(int unit); -static int scd_pause(int unit); -static int scd_resume(int unit); -static int scd_playtracks(int unit, struct ioc_play_track *pt); -static int scd_playmsf(int unit, struct ioc_play_msf *msf); -static int scd_play(int unit, struct ioc_play_msf *msf); -static int scd_subchan(int unit, struct ioc_read_subchannel *sc); -static int read_subcode(int unit, struct sony_subchannel_position_data *sc); - -/* for xcdplayer */ -static int scd_toc_header(int unit, struct ioc_toc_header *th); -static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te); -#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */ - -extern int hz; - -int scd_probe(struct isa_device *dev); -int scd_attach(struct isa_device *dev); -struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; - -static struct kern_devconf kdc_scd[NSCD] = { { - 0, 0, 0, /* filled in by dev_attach */ - "scd", 0, { MDDT_ISA, 0, "bio" }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, - &kdc_isa0, /* parent */ - 0, /* parentdata */ - DC_IDLE, /* status */ - "Sony CD-ROM drive" /* properly filled later */ -} }; - -static inline void -scd_registerdev(struct isa_device *id) -{ - if(id->id_unit) - kdc_scd[id->id_unit] = kdc_scd[0]; - kdc_scd[id->id_unit].kdc_unit = id->id_unit; - kdc_scd[id->id_unit].kdc_isa = id; - dev_attach(&kdc_scd[id->id_unit]); -} - -int scd_attach(struct isa_device *dev) -{ - struct scd_data *cd = scd_data + dev->id_unit; - int i; - - cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ - - scd_registerdev(dev); - /* name filled in probe */ - kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name; - printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name); - - init_drive(dev->id_unit); - - cd->flags = SCDINIT; - cd->audio_status = CD_AS_AUDIO_INVALID; - - return 1; -} - -int -scdopen(dev_t dev) -{ - int unit,part,phys; - int rc; - struct scd_data *cd; - - unit = scd_unit(dev); - if (unit >= NSCD) - return ENXIO; - - cd = scd_data + unit; - part = scd_part(dev); - phys = scd_phys(dev); - - /* not initialized*/ - if (!(cd->flags & SCDINIT)) - return ENXIO; - - /* invalidated in the meantime? mark all open part's invalid */ - if (cd->openflag) - return ENXIO; - - XDEBUG(1,("scd%d: DEBUG: status = 0x%x\n", unit, inb(cd->iobase+IREG_STATUS))); - - if ((rc = spin_up(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - if (!(cd->flags & SCDTOC)) { - int loop_count = 3; - - while (loop_count-- > 0 && (rc = read_toc(dev)) != 0) { - if (rc == ERR_NOT_SPINNING) { - rc = spin_up(unit); - if (rc) { - print_error(unit, rc);\ - return EIO; - } - continue; - } - printf("scd%d: TOC read error 0x%x\n", unit, rc); - return EIO; - } - } - - cd->openflag = 1; - cd->flags |= SCDVALID; - kdc_scd[unit].kdc_state = DC_BUSY; - - return 0; -} - -int -scdclose(dev_t dev) -{ - int unit,part,phys; - struct scd_data *cd; - int rlen; - char rdata[10]; - - unit = scd_unit(dev); - if (unit >= NSCD) - return ENXIO; - - cd = scd_data + unit; - part = scd_part(dev); - phys = scd_phys(dev); - - if (!(cd->flags & SCDINIT) || !cd->openflag) - return ENXIO; - - if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) { - (void)send_cmd(unit, CMD_SPIN_DOWN, 0); - cd->flags &= ~SCDSPINNING; - } - - kdc_scd[unit].kdc_state = DC_IDLE; - - /* close channel */ - cd->openflag = 0; - - return 0; -} - -void -scdstrategy(struct buf *bp) -{ - struct scd_data *cd; - struct buf *qp; - int s; - int unit = scd_unit(bp->b_dev); - - cd = scd_data + unit; - - XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount)); - - if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { - printf("scd%d: strategy failure: blkno = %d, bcount = %d\n", - unit, bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_flags |= B_ERROR; - goto bad; - } - - /* if device invalidated (e.g. media change, door open), error */ - if (!(cd->flags & SCDVALID)) { - printf("scd%d: media changed\n", unit); - bp->b_error = EIO; - goto bad; - } - - /* read only */ - if (!(bp->b_flags & B_READ)) { - bp->b_error = EROFS; - goto bad; - } - - /* no data to read */ - if (bp->b_bcount == 0) - goto done; - - if (!(cd->flags & SCDTOC)) { - bp->b_error = EIO; - goto bad; - } - /* adjust transfer if necessary */ - if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) - goto done; - - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; - - /* queue it */ - qp = &cd->head; - s = splbio(); - disksort(qp,bp); - splx(s); - - /* now check whether we can perform processing */ - scd_start(unit); - return; - -bad: - bp->b_flags |= B_ERROR; -done: - bp->b_resid = bp->b_bcount; - biodone(bp); - return; -} - -static void -scd_start(int unit) -{ - struct scd_data *cd = scd_data + unit; - struct buf *bp, *qp = &cd->head; - struct partition *p; - int part; - register s = splbio(); - - if (cd->flags & SCDMBXBSY) { - splx(s); - return; - } - - if ((bp = qp->b_actf) != 0) { - /* block found to process, dequeue */ - qp->b_actf = bp->b_actf; - cd->flags |= SCDMBXBSY; - splx(s); - } else { - /* nothing to do */ - splx(s); - return; - } - - p = cd->dlabel.d_partitions + scd_part(bp->b_dev); - - cd->mbx.unit = unit; - cd->mbx.port = cd->iobase; - cd->mbx.retry = 3; - cd->mbx.bp = bp; - cd->mbx.p_offset = p->p_offset; - splx(s); - - scd_doread(SCD_S_BEGIN,&(cd->mbx)); - return; -} - -int -scdioctl(dev_t dev, int cmd, caddr_t addr, int flags) -{ - struct scd_data *cd; - int unit,part; - - unit = scd_unit(dev); - part = scd_part(dev); - cd = scd_data + unit; - - XDEBUG(1, ("scd%d: ioctl: cmd=0x%lx\n", unit, cmd)); - - if (!(cd->flags & SCDVALID)) - return EIO; - - switch (cmd) { - case DIOCSBAD: - return EINVAL; - case DIOCGDINFO: - *(struct disklabel *)addr = cd->dlabel; - return 0; - case DIOCGPART: - ((struct partinfo *)addr)->disklab = &cd->dlabel; - ((struct partinfo *)addr)->part = - &cd->dlabel.d_partitions[0]; - return 0; - case CDIOCPLAYTRACKS: - return scd_playtracks(unit, (struct ioc_play_track *) addr); - case CDIOCPLAYBLOCKS: - return EINVAL; - case CDIOCPLAYMSF: - return scd_playmsf(unit, (struct ioc_play_msf *) addr); - case CDIOCREADSUBCHANNEL: - return scd_subchan(unit, (struct ioc_read_subchannel *) addr); - case CDIOREADTOCHEADER: - return scd_toc_header (unit, (struct ioc_toc_header *) addr); - case CDIOREADTOCENTRYS: - return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr); - case CDIOCSETPATCH: - case CDIOCGETVOL: - case CDIOCSETVOL: - case CDIOCSETMONO: - case CDIOCSETSTERIO: - case CDIOCSETMUTE: - case CDIOCSETLEFT: - case CDIOCSETRIGHT: - return EINVAL; - case CDIOCRESUME: - return scd_resume(unit); - case CDIOCPAUSE: - return scd_pause(unit); - case CDIOCSTART: - return EINVAL; - case CDIOCSTOP: - return scd_stop(unit); - case CDIOCEJECT: - return scd_eject(unit); - case CDIOCALLOW: - return 0; - case CDIOCSETDEBUG: -#ifdef SCD_DEBUG - scd_debuglevel++; -#endif - return 0; - case CDIOCCLRDEBUG: -#ifdef SCD_DEBUG - scd_debuglevel = 0; - -#endif - return 0; - default: - printf("scd%d: unsupported ioctl (cmd=0x%lx)\n", unit, cmd); - return ENOTTY; - } -} - -int -scdsize(dev_t dev) -{ - return -1; -} - -void -scdintr() -{ - return; -} - -/*************************************************************** - * lower level of driver starts here - **************************************************************/ - -static int -scd_playtracks(int unit, struct ioc_play_track *pt) -{ - struct scd_data *cd = scd_data + unit; - struct ioc_play_msf msf; - int a = pt->start_track; - int z = pt->end_track; - int rc, i; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - if (rc == -ERR_NOT_SPINNING) { - if (spin_up(unit) != 0) - return EIO; - rc = read_toc(unit); - } - if (rc != 0) { - print_error(unit, rc); - return EIO; - } - } - - XDEBUG(1, ("scd%d: playtracks from %d:%d to %d:%d\n", unit, - a, pt->start_index, z, pt->end_index)); - - if ( a < cd->first_track - || a > cd->last_track - || a > z - || z > cd->last_track) - return EINVAL; - - bcopy(cd->toc[a].start_msf, &msf.start_m, 3); - hsg2msf(msf2hsg(cd->toc[z+1].start_msf)-1, &msf.end_m); - - return scd_play(unit, &msf); -} - -/* The start/end msf is expected to be in bin format */ -static int -scd_playmsf(int unit, struct ioc_play_msf *msfin) -{ - struct ioc_play_msf msf; - - msf.start_m = bin2bcd(msfin->start_m); - msf.start_s = bin2bcd(msfin->start_s); - msf.start_f = bin2bcd(msfin->start_f); - msf.end_m = bin2bcd(msfin->end_m); - msf.end_s = bin2bcd(msfin->end_s); - msf.end_f = bin2bcd(msfin->end_f); - - return scd_play(unit, &msf); -} - -/* The start/end msf is expected to be in bcd format */ -static int -scd_play(int unit, struct ioc_play_msf *msf) -{ - struct scd_data *cd = scd_data + unit; - int i, rc; - - XDEBUG(1, ("scd%d: playing: %02x:%02x:%02x -> %02x:%02x:%02x\n", unit, - msf->start_m, msf->start_s, msf->start_f, - msf->end_m, msf->end_s, msf->end_f)); - - for (i = 0; i < 2; i++) { - rc = send_cmd(unit, CMD_PLAY_AUDIO, 7, - 0x03, - msf->start_m, msf->start_s, msf->start_f, - msf->end_m, msf->end_s, msf->end_f); - if (rc == -ERR_NOT_SPINNING) { - cd->flags &= ~SCDSPINNING; - if (spin_up(unit) != 0) - return EIO; - } else if (rc < 0) { - print_error(unit, rc); - return EIO; - } else { - break; - } - } - cd->audio_status = CD_AS_PLAY_IN_PROGRESS; - bcopy((char *)msf, (char *)&cd->last_play, sizeof(struct ioc_play_msf)); - return 0; -} - -static int -scd_stop(int unit) -{ - struct scd_data *cd = scd_data + unit; - - (void)send_cmd(unit, CMD_STOP_AUDIO, 0); - cd->audio_status = CD_AS_PLAY_COMPLETED; - return 0; -} - -static int -scd_pause(int unit) -{ - struct scd_data *cd = scd_data + unit; - struct sony_subchannel_position_data subpos; - - if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) - return EINVAL; - - if (read_subcode(unit, &subpos) != 0) - return EIO; - - if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0) - return EIO; - - cd->last_play.start_m = subpos.abs_msf[0]; - cd->last_play.start_s = subpos.abs_msf[1]; - cd->last_play.start_f = subpos.abs_msf[2]; - cd->audio_status = CD_AS_PLAY_PAUSED; - - XDEBUG(1, ("scd%d: pause @ %02x:%02x:%02x\n", unit, - cd->last_play.start_m, - cd->last_play.start_s, - cd->last_play.start_f)); - - return 0; -} - -static int -scd_resume(int unit) -{ - if (scd_data[unit].audio_status != CD_AS_PLAY_PAUSED) - return EINVAL; - return scd_play(unit, &scd_data[unit].last_play); -} - -static int -scd_eject(int unit) -{ - struct scd_data *cd = scd_data + unit; - int port = cd->iobase; - - cd->audio_status = CD_AS_AUDIO_INVALID; - cd->flags &= ~(SCDSPINNING|SCDTOC); - - if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0 || - send_cmd(unit, CMD_SPIN_DOWN, 0) != 0 || - send_cmd(unit, CMD_EJECT, 0) != 0) - { - return EIO; - } - return 0; -} - -static int -scd_subchan(int unit, struct ioc_read_subchannel *sc) -{ - struct scd_data *cd = scd_data + unit; - struct sony_subchannel_position_data q; - struct cd_sub_channel_info data; - - XDEBUG(1, ("scd%d: subchan af=%d, df=%d\n", unit, - sc->address_format, - sc->data_format)); - - if (sc->address_format != CD_MSF_FORMAT) - return EINVAL; - - if (sc->data_format != CD_CURRENT_POSITION) - return EINVAL; - - if (read_subcode(unit, &q) != 0) - return EIO; - - data.header.audio_status = cd->audio_status; - data.what.position.data_format = CD_MSF_FORMAT; - data.what.position.track_number = bcd2bin(q.track_number); - data.what.position.reladdr.msf.unused = 0; - data.what.position.reladdr.msf.minute = bcd2bin(q.rel_msf[0]); - data.what.position.reladdr.msf.second = bcd2bin(q.rel_msf[1]); - data.what.position.reladdr.msf.frame = bcd2bin(q.rel_msf[2]); - data.what.position.absaddr.msf.unused = 0; - data.what.position.absaddr.msf.minute = bcd2bin(q.abs_msf[0]); - data.what.position.absaddr.msf.second = bcd2bin(q.abs_msf[1]); - data.what.position.absaddr.msf.frame = bcd2bin(q.abs_msf[2]); - - if (copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len))!=0) - return EFAULT; - return 0; -} - -int -scd_probe(struct isa_device *dev) -{ - struct sony_drive_configuration drive_config; - int unit = dev->id_unit; - int rc; - static char namebuf[8+16+8+3]; - char *s = namebuf; - int loop_count = 0; - - scd_data[unit].flags = SCDPROBING; - scd_data[unit].iobase = dev->id_iobase; - - bzero(&drive_config, sizeof(drive_config)); - -again: - /* Reset drive */ - write_control(dev->id_iobase, CBIT_RESET_DRIVE); - - /* Calm down */ - DELAY(300000); - - /* Only the ATTENTION bit may be set */ - if ((inb(dev->id_iobase+IREG_STATUS) & ~1) != 0) { - XDEBUG(1, ("scd: too many bits set. probe failed.\n")); - return 0; - } - rc = send_cmd(unit, CMD_GET_DRIVE_CONFIG, 0); - if (rc != sizeof(drive_config)) { - /* Sometimes if the drive is playing audio I get */ - /* the bad result 82. Fix by repeating the reset */ - if (rc > 0 && loop_count++ == 0) - goto again; - return 0; - } - if (get_result(unit, rc, (u_char *)&drive_config) != 0) - return 0; - - bcopy(drive_config.vendor, namebuf, 8); - s = namebuf+8; - while (*(s-1) == ' ') /* Strip trailing spaces */ - s--; - *s++ = ' '; - bcopy(drive_config.product, s, 16); - s += 16; - while (*(s-1) == ' ') - s--; - *s++ = ' '; - bcopy(drive_config.revision, s, 8); - s += 8; - while (*(s-1) == ' ') - s--; - *s = 0; - - scd_data[unit].name = namebuf; - - if (drive_config.config & 0x10) - scd_data[unit].double_speed = 1; - else - scd_data[unit].double_speed = 0; - - return 4; -} - -static int -read_subcode(int unit, struct sony_subchannel_position_data *sc) -{ - int rc; - - rc = send_cmd(unit, CMD_GET_SUBCHANNEL_DATA, 0); - if (rc < 0 || rc < sizeof(*sc)) - return EIO; - if (get_result(unit, rc, (u_char *)sc) != 0) - return EIO; - return 0; -} - -/* State machine copied from mcd.c */ - -/* This (and the code in mcd.c) will not work with more than one drive */ -/* because there is only one mbxsave below. Should fix that some day. */ -/* (mbxsave & state should probably be included in the scd_data struct and */ -/* the unit number used as first argument to scd_doread().) /Micke */ - -/* state machine to process read requests - * initialize with SCD_S_BEGIN: reset state machine - * SCD_S_WAITSTAT: wait for ready (!busy) - * SCD_S_WAITSPIN: wait for drive to spin up (if not spinning) - * SCD_S_WAITFIFO: wait for param fifo to get ready, them exec. command. - * SCD_S_WAITREAD: wait for data ready, read data - * SCD_S_WAITPARAM: wait for command result params, read them, error if bad data read. - */ - -static struct scd_mbx *mbxsave; - -static void -scd_doread(int state, struct scd_mbx *mbxin) -{ - struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin; - int unit = mbx->unit; - int port = mbx->port; - struct buf *bp = mbx->bp; - struct scd_data *cd = scd_data + unit; - int reg,i,k,c; - int blknum; - caddr_t addr; - char rdata[10]; - static char sdata[3]; /* Must be preserved between calls to this function */ - -loop: - switch (state) { - case SCD_S_BEGIN: - mbx = mbxsave = mbxin; - - case SCD_S_BEGIN1: - /* get status */ - mbx->count = RDELAY_WAIT; - - process_attention(unit); - goto trystat; - - case SCD_S_WAITSTAT: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSTAT); - if (mbx->count-- <= 0) { - printf("scd%d: timeout. drive busy.\n",unit); - goto harderr; - } - -trystat: - if (IS_BUSY(port)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSTAT,hz/100); /* XXX */ - return; - } - - process_attention(unit); - - /* reject, if audio active */ - if (cd->audio_status & CD_AS_PLAY_IN_PROGRESS) { - printf("scd%d: audio is active\n",unit); - goto harderr; - } - - mbx->sz = cd->blksize; - -firstblock: - /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; - mbx->skip = 0; - -nextblock: - if (!(cd->flags & SCDVALID)) - goto changed; - - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) - + mbx->p_offset + mbx->skip/mbx->sz; - - XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum)); - - /* build parameter block */ - hsg2msf(blknum, sdata); - - write_control(port, CBIT_RESULT_READY_CLEAR); - write_control(port, CBIT_RPARAM_CLEAR); - write_control(port, CBIT_DATA_READY_CLEAR); - - if (FSTATUS_BIT(port, FBIT_WPARAM_READY)) - goto writeparam; - - mbx->count = 100; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */ - return; - - case SCD_S_WAITSPIN: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSPIN); - if (mbx->count-- <= 0) { - printf("scd%d: timeout waiting for drive to spin up.\n", unit); - goto harderr; - } - if (!STATUS_BIT(port, SBIT_RESULT_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */ - return; - } - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((i = inb(port+IREG_RESULT)) & 0xf0) { - case 0x20: - i = inb(port+IREG_RESULT); - print_error(unit, i); - goto harderr; - case 0x00: - (void)inb(port+IREG_RESULT); - cd->flags |= SCDSPINNING; - break; - } - XDEBUG(1, ("scd%d: DEBUG: spin up complete\n", unit)); - - state = SCD_S_BEGIN1; - goto loop; - - case SCD_S_WAITFIFO: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITFIFO); - if (mbx->count-- <= 0) { - printf("scd%d: timeout. write param not ready.\n",unit); - goto harderr; - } - if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */ - return; - } - XDEBUG(1, ("scd%d: mbx->count (writeparamwait) = %d(%d)\n", unit, mbx->count, 100)); - -writeparam: - /* The reason this test isn't done 'till now is to make sure */ - /* that it is ok to send the SPIN_UP cmd below. */ - if (!(cd->flags & SCDSPINNING)) { - XDEBUG(1, ("scd%d: spinning up drive ...\n", unit)); - outb(port+OREG_COMMAND, CMD_SPIN_UP); - mbx->count = 300; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */ - return; - } - - reg = port + OREG_WPARAMS; - /* send the read command */ - disable_intr(); - outb(reg, sdata[0]); - outb(reg, sdata[1]); - outb(reg, sdata[2]); - outb(reg, 0); - outb(reg, 0); - outb(reg, 1); - outb(port+OREG_COMMAND, CMD_READ); - enable_intr(); - - mbx->count = RDELAY_WAITREAD; - for (i = 0; i < 50; i++) { - if (STATUS_BIT(port, SBIT_DATA_READY)) - goto got_data; - DELAY(100); - } - - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */ - return; - - case SCD_S_WAITREAD: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITREAD); - if (mbx->count-- <= 0) { - if (STATUS_BIT(port, SBIT_RESULT_READY)) - goto got_param; - printf("scd%d: timeout while reading data\n",unit); - goto readerr; - } - if (!STATUS_BIT(port, SBIT_DATA_READY)) { - process_attention(unit); - if (!(cd->flags & SCDVALID)) - goto changed; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */ - return; - } - XDEBUG(2, ("scd%d: mbx->count (after RDY_BIT) = %d(%d)\n", unit, mbx->count, RDELAY_WAITREAD)); - -got_data: - /* data is ready */ - addr = bp->b_un.b_addr + mbx->skip; - write_control(port, CBIT_DATA_READY_CLEAR); - insb(port+IREG_DATA, addr, mbx->sz); - - mbx->count = 100; - for (i = 0; i < 20; i++) { - if (STATUS_BIT(port, SBIT_RESULT_READY)) - goto waitfor_param; - DELAY(100); - } - goto waitfor_param; - - case SCD_S_WAITPARAM: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITPARAM); - if (mbx->count-- <= 0) { - printf("scd%d: timeout waiting for params\n",unit); - goto readerr; - } - -waitfor_param: - if (!STATUS_BIT(port, SBIT_RESULT_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITPARAM,hz/100); /* XXX */ - return; - } -#if SCD_DEBUG - if (mbx->count < 100 && scd_debuglevel > 0) - printf("scd%d: mbx->count (paramwait) = %d(%d)\n", unit, mbx->count, 100); -#endif - -got_param: - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((i = inb(port+IREG_RESULT)) & 0xf0) { - case 0x50: - switch (i) { - case ERR_FATAL_READ_ERROR1: - case ERR_FATAL_READ_ERROR2: - printf("scd%d: unrecoverable read error 0x%x\n", unit, i); - goto harderr; - } - break; - case 0x20: - i = inb(port+IREG_RESULT); - switch (i) { - case ERR_NOT_SPINNING: - XDEBUG(1, ("scd%d: read error: drive not spinning\n", unit)); - if (mbx->retry-- > 0) { - state = SCD_S_BEGIN1; - cd->flags &= ~SCDSPINNING; - goto loop; - } - goto harderr; - default: - print_error(unit, i); - goto readerr; - } - case 0x00: - i = inb(port+IREG_RESULT); - break; - } - - if (--mbx->nblk > 0) { - mbx->skip += mbx->sz; - goto nextblock; - } - - /* return buffer */ - bp->b_resid = 0; - biodone(bp); - - cd->flags &= ~SCDMBXBSY; - scd_start(mbx->unit); - return; - } - -readerr: - if (mbx->retry-- > 0) { - printf("scd%d: retrying ...\n",unit); - state = SCD_S_BEGIN1; - goto loop; - } -harderr: - /* invalidate the buffer */ - bp->b_error = EIO; - bp->b_flags |= B_ERROR; - bp->b_resid = bp->b_bcount; - biodone(bp); - - cd->flags &= ~SCDMBXBSY; - scd_start(mbx->unit); - return; - -changed: - printf("scd%d: media changed\n", unit); - goto harderr; -} - -static int -bcd2bin(bcd_t b) -{ - return (b >> 4) * 10 + (b & 15); -} - -static bcd_t -bin2bcd(int b) -{ - return ((b / 10) << 4) | (b % 10); -} - -static void -hsg2msf(int hsg, bcd_t *msf) -{ - hsg += 150; - M_msf(msf) = bin2bcd(hsg / 4500); - hsg %= 4500; - S_msf(msf) = bin2bcd(hsg / 75); - F_msf(msf) = bin2bcd(hsg % 75); -} - -static int -msf2hsg(bcd_t *msf) -{ - return (bcd2bin(M_msf(msf)) * 60 + - bcd2bin(S_msf(msf))) * 75 + - bcd2bin(F_msf(msf)) - 150; -} - -static void -process_attention(unsigned unit) -{ - unsigned port = scd_data[unit].iobase; - unsigned char code; - int count = 0; - int i; - - while (IS_ATTENTION(port) && count++ < 30) { - write_control(port, CBIT_ATTENTION_CLEAR); - code = inb(port+IREG_RESULT); - -#if SCD_DEBUG - if (scd_debuglevel > 0) { - if (count == 1) - printf("scd%d: DEBUG: ATTENTIONS = 0x%x", unit, code); - else - printf(",0x%x", code); - } -#endif - - switch (code) { - case ATTEN_SPIN_DOWN: - scd_data[unit].flags &= ~SCDSPINNING; - break; - - case ATTEN_SPIN_UP_DONE: - scd_data[unit].flags |= SCDSPINNING; - break; - - case ATTEN_AUDIO_DONE: - scd_data[unit].audio_status = CD_AS_PLAY_COMPLETED; - break; - - case ATTEN_DRIVE_LOADED: - scd_data[unit].flags &= ~(SCDTOC|SCDSPINNING|SCDVALID); - scd_data[unit].audio_status = CD_AS_AUDIO_INVALID; - break; - - case ATTEN_EJECT_PUSHED: - scd_data[unit].flags &= ~SCDVALID; - break; - } - DELAY(100); - } -#if SCD_DEBUG - if (scd_debuglevel > 0 && count > 0) - printf("\n"); -#endif -} - -/* Returns 0 OR sony error code */ -static int -spin_up(unsigned unit) -{ - unsigned char res_reg[12]; - unsigned int res_size; - int rc; - int loop_count = 0; - -again: - rc = send_cmd(unit, CMD_SPIN_UP, NULL, 0, res_reg, &res_size); - if (rc != 0) { - XDEBUG(2, ("scd%d: CMD_SPIN_UP error 0x%x\n", unit, rc)); - return rc; - } - - if (!(scd_data[unit].flags & SCDTOC)) { - rc = send_cmd(unit, CMD_READ_TOC, 0); - if (rc == ERR_NOT_SPINNING) { - if (loop_count++ < 3) - goto again; - return rc; - } - if (rc != 0) - return rc; - } - - scd_data[unit].flags |= SCDSPINNING; - - return 0; -} - -static struct sony_tracklist * -get_tl(struct sony_toc *toc, int size) -{ - struct sony_tracklist *tl = &toc->tracks[0]; - - if (tl->track != 0xb0) - return tl; - (char *)tl += 9; - if (tl->track != 0xb1) - return tl; - (char *)tl += 9; - if (tl->track != 0xb2) - return tl; - (char *)tl += 9; - if (tl->track != 0xb3) - return tl; - (char *)tl += 9; - if (tl->track != 0xb4) - return tl; - (char *)tl += 9; - if (tl->track != 0xc0) - return tl; - (char *)tl += 9; - return tl; -} - -static int -read_toc(dev_t dev) -{ - unsigned unit; - struct scd_data *cd; - unsigned part = 0; /* For now ... */ - struct sony_toc toc; - struct sony_tracklist *tl; - int rc, i, j; - u_long first, last; - - unit = scd_unit(dev); - cd = scd_data + unit; - - rc = send_cmd(unit, CMD_GET_TOC, 1, part+1); - if (rc < 0) - return rc; - if (rc > sizeof(toc)) { - printf("scd%d: program error: toc too large (%d)\n", unit, rc); - return EIO; - } - if (get_result(unit, rc, (u_char *)&toc) != 0) - return EIO; - - XDEBUG(1, ("scd%d: toc read. len = %d, sizeof(toc) = %d\n", unit, rc, sizeof(toc))); - - tl = get_tl(&toc, rc); - first = msf2hsg(tl->start_msf); - last = msf2hsg(toc.lead_out_start_msf); - cd->blksize = SCDBLKSIZE; - cd->disksize = last*cd->blksize/DEV_BSIZE; - - XDEBUG(1, ("scd%d: firstsector = %d, lastsector = %d", unit, - first, last)); - - cd->first_track = bcd2bin(toc.first_track); - cd->last_track = bcd2bin(toc.last_track); - if (cd->last_track > (MAX_TRACKS-2)) - cd->last_track = MAX_TRACKS-2; - for (j = 0, i = cd->first_track; i <= cd->last_track; i++, j++) { - cd->toc[i].adr = tl[j].adr; - cd->toc[i].ctl = tl[j].ctl; /* for xcdplayer */ - bcopy(tl[j].start_msf, cd->toc[i].start_msf, 3); -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) { - if ((j % 3) == 0) - printf("\nscd%d: tracks ", unit); - printf("[%03d: %2d %2d %2d] ", i, - bcd2bin(cd->toc[i].start_msf[0]), - bcd2bin(cd->toc[i].start_msf[1]), - bcd2bin(cd->toc[i].start_msf[2])); - } -#endif - } - bcopy(toc.lead_out_start_msf, cd->toc[cd->last_track+1].start_msf, 3); -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) { - i = cd->last_track+1; - printf("[END: %2d %2d %2d]\n", - bcd2bin(cd->toc[i].start_msf[0]), - bcd2bin(cd->toc[i].start_msf[1]), - bcd2bin(cd->toc[i].start_msf[2])); - } -#endif - - bzero(&cd->dlabel,sizeof(struct disklabel)); - /* filled with spaces first */ - strncpy(cd->dlabel.d_typename," ", - sizeof(cd->dlabel.d_typename)); - strncpy(cd->dlabel.d_typename, cd->name, - min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1)); - strncpy(cd->dlabel.d_packname,"unknown ", - sizeof(cd->dlabel.d_packname)); - cd->dlabel.d_secsize = cd->blksize; - cd->dlabel.d_nsectors = 100; - cd->dlabel.d_ntracks = 1; - cd->dlabel.d_ncylinders = (cd->disksize/100)+1; - cd->dlabel.d_secpercyl = 100; - cd->dlabel.d_secperunit = cd->disksize; - cd->dlabel.d_rpm = 300; - cd->dlabel.d_interleave = 1; - cd->dlabel.d_flags = D_REMOVABLE; - cd->dlabel.d_npartitions= 1; - cd->dlabel.d_partitions[0].p_offset = 0; - cd->dlabel.d_partitions[0].p_size = cd->disksize; - cd->dlabel.d_partitions[0].p_fstype = 9; - cd->dlabel.d_magic = DISKMAGIC; - cd->dlabel.d_magic2 = DISKMAGIC; - cd->dlabel.d_checksum = dkcksum(&cd->dlabel); - - cd->flags |= SCDTOC; - - return 0; -} - -static inline void -write_control(unsigned port, unsigned data) -{ - outb(port + OREG_CONTROL, data); -} - -static void -init_drive(unsigned unit) -{ - int rc; - - rc = send_cmd(unit, CMD_SET_DRIVE_PARAM, 2, - 0x05, 0x03 | ((scd_data[unit].double_speed) ? 0x04: 0)); - if (rc != 0) - printf("scd%d: Unable to set parameters. Errcode = 0x%x\n", unit, rc); -} - -/* Returns 0 or errno */ -static int -get_result(u_int unit, int result_len, u_char *result) -{ - unsigned int port = scd_data[unit].iobase; - unsigned int res_reg = port + IREG_RESULT; - unsigned char c; - int loop_index = 2; /* send_cmd() reads two bytes ... */ - - XDEBUG(1, ("scd%d: DEBUG: get_result: bytes=%d\n", unit, result_len)); - - while (result_len-- > 0) { - if (loop_index++ >= 10) { - loop_index = 1; - if (waitfor_status_bits(unit, SBIT_RESULT_READY, 0)) - return EIO; - write_control(port, CBIT_RESULT_READY_CLEAR); - } - if (result) - *result++ = inb(res_reg); - else - (void)inb(res_reg); - } - return 0; -} - -/* Returns -0x100 for timeout, -(drive error code) OR number of result bytes */ -static int -send_cmd(u_int unit, u_char cmd, u_int nargs, ...) -{ - va_list ap; - u_int port = scd_data[unit].iobase; - u_int reg; - u_char c; - int rc; - int i; - - if (waitfor_status_bits(unit, 0, SBIT_BUSY)) { - printf("scd%d: drive busy\n", unit); - return -0x100; - } - - XDEBUG(1,("scd%d: DEBUG: send_cmd: cmd=0x%x nargs=%d", unit, cmd, nargs)); - - write_control(port, CBIT_RESULT_READY_CLEAR); - write_control(port, CBIT_RPARAM_CLEAR); - - for (i = 0; i < 100; i++) - if (FSTATUS_BIT(port, FBIT_WPARAM_READY)) - break; - if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) { - XDEBUG(1, ("\nscd%d: wparam timeout\n", unit)); - return -EIO; - } - - va_start(ap, nargs); - reg = port + OREG_WPARAMS; - for (i = 0; i < nargs; i++) { - c = (u_char)va_arg(ap, int); - outb(reg, c); - XDEBUG(1, (",{0x%x}", c)); - } - va_end(ap); - XDEBUG(1, ("\n")); - - outb(port+OREG_COMMAND, cmd); - - if (rc = waitfor_status_bits(unit, SBIT_RESULT_READY, SBIT_BUSY)) - return -0x100; - - reg = port + IREG_RESULT; - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((rc = inb(reg)) & 0xf0) { - case 0x20: - rc = inb(reg); - /* FALL TROUGH */ - case 0x50: - XDEBUG(1, ("scd%d: DEBUG: send_cmd: drive_error=0x%x\n", unit, rc)); - return -rc; - case 0x00: - default: - rc = inb(reg); - XDEBUG(1, ("scd%d: DEBUG: send_cmd: result_len=%d\n", unit, rc)); - return rc; - } -} - -static void -print_error(int unit, int errcode) -{ - switch (errcode) { - case -ERR_CD_NOT_LOADED: - printf("scd%d: door is open\n", unit); - break; - case -ERR_NO_CD_INSIDE: - printf("scd%d: no cd inside\n", unit); - break; - default: - if (errcode == -0x100 || errcode > 0) - printf("scd%d: device timeout\n", unit); - else - printf("scd%d: unexpected error 0x%x\n", unit, -errcode); - break; - } -} - -/* Returns 0 or errno value */ -static int -waitfor_status_bits(int unit, int bits_set, int bits_clear) -{ - u_int port = scd_data[unit].iobase; - u_int flags = scd_data[unit].flags; - u_int reg = port + IREG_STATUS; - u_int max_loop; - u_char c = 0; - - if (flags & SCDPROBING) { - max_loop = 0; - while (max_loop++ < 1000) { - c = inb(reg); - if (c == 0xff) - return EIO; - if (c & SBIT_ATTENTION) { - process_attention(unit); - continue; - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - break; - } - DELAY(10000); - } - } else { - max_loop = 100; - while (max_loop-- > 0) { - c = inb(reg); - if (c & SBIT_ATTENTION) { - process_attention(unit); - continue; - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - break; - } - tsleep(waitfor_status_bits, PZERO - 1, "waitfor", hz/10); - } - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - return 0; - } -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) - printf("scd%d: DEBUG: waitfor: TIMEOUT (0x%x,(0x%x,0x%x))\n", unit, c, bits_set, bits_clear); - else -#endif - printf("scd%d: timeout.\n", unit); - return EIO; -} - -/* these two routines for xcdplayer - "borrowed" from mcd.c */ -static int -scd_toc_header (int unit, struct ioc_toc_header* th) -{ - struct scd_data *cd = scd_data + unit; - int rc; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - - th->starting_track = cd->first_track; - th->ending_track = cd->last_track; - th->len = 0; /* not used */ - - return 0; -} - -static int -scd_toc_entrys (int unit, struct ioc_read_toc_entry *te) -{ - struct scd_data *cd = scd_data + unit; - struct cd_toc_entry toc_entry; - int rc, i, len = te->data_len; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - - /* find the toc to copy*/ - i = te->starting_track; - if (i == SCD_LASTPLUS1) - i = cd->last_track + 1; - - /* verify starting track */ - if (i < cd->first_track || i > cd->last_track+1) - return EINVAL; - - /* valid length ? */ - if (len < sizeof(struct cd_toc_entry) - || (len % sizeof(struct cd_toc_entry)) != 0) - return EINVAL; - - /* copy the toc data */ - toc_entry.control = cd->toc[i].ctl; - toc_entry.addr_type = te->address_format; - toc_entry.track = i; - if (te->address_format == CD_MSF_FORMAT) { - toc_entry.addr.msf.unused = 0; - toc_entry.addr.msf.minute = bcd2bin(cd->toc[i].start_msf[0]); - toc_entry.addr.msf.second = bcd2bin(cd->toc[i].start_msf[1]); - toc_entry.addr.msf.frame = bcd2bin(cd->toc[i].start_msf[2]); - } - - /* copy the data back */ - if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0) - return EFAULT; - - return 0; -} - - -#endif /* NSCD > 0 */ diff --git a/sys/gnu/i386/isa/scdreg.h b/sys/gnu/i386/isa/scdreg.h deleted file mode 100644 index 93ace5c..0000000 --- a/sys/gnu/i386/isa/scdreg.h +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 1995 Mikael Hybsch - * - * The Linux driver cdu31a has been used as a reference when writing this - * code, therefore bringing it under the GNU Public License. The following - * conditions of redistribution therefore apply: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: scdreg.h,v 1.2 1995/01/29 22:51:41 jkh Exp $ - * - */ - -#ifndef SCD_H -#define SCD_H - -#ifdef __GNUC__ -#if __GNUC__ >= 2 -#pragma pack(1) -#endif -#endif - -typedef unsigned char bcd_t; -#define M_msf(msf) msf[0] -#define S_msf(msf) msf[1] -#define F_msf(msf) msf[2] - -#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0) -#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0) -#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0) -#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0) -#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0) - -#define OREG_COMMAND 0 -#define OREG_WPARAMS 1 -#define OREG_CONTROL 3 -#define CBIT_ATTENTION_CLEAR 0x01 -#define CBIT_RESULT_READY_CLEAR 0x02 -#define CBIT_DATA_READY_CLEAR 0x04 -#define CBIT_RPARAM_CLEAR 0x40 -#define CBIT_RESET_DRIVE 0x80 - -#define IREG_STATUS 0 -#define SBIT_ATTENTION 0x01 -#define SBIT_RESULT_READY 0x02 -#define SBIT_DATA_READY 0x04 -#define SBIT_BUSY 0x80 - -#define IREG_RESULT 1 -#define IREG_DATA 2 -#define IREG_FSTATUS 3 -#define FBIT_WPARAM_READY 0x01 - -#define CMD_GET_DRIVE_CONFIG 0x00 -#define CMD_SET_DRIVE_PARAM 0x10 -#define CMD_GET_SUBCHANNEL_DATA 0x21 -#define CMD_GET_TOC 0x24 -#define CMD_READ_TOC 0x30 -#define CMD_READ 0x34 -#define CMD_PLAY_AUDIO 0x40 -#define CMD_STOP_AUDIO 0x41 -#define CMD_EJECT 0x50 -#define CMD_SPIN_UP 0x51 -#define CMD_SPIN_DOWN 0x52 - -#define ERR_CD_NOT_LOADED 0x20 -#define ERR_NO_CD_INSIDE 0x21 -#define ERR_NOT_SPINNING 0x22 -#define ERR_FATAL_READ_ERROR1 0x53 -#define ERR_FATAL_READ_ERROR2 0x57 - -#define ATTEN_DRIVE_LOADED 0x80 -#define ATTEN_EJECT_PUSHED 0x81 -#define ATTEN_AUDIO_DONE 0x90 -#define ATTEN_SPIN_UP_DONE 0x24 -#define ATTEN_SPIN_DOWN 0x27 -#define ATTEN_EJECT_DONE 0x28 - - -struct sony_drive_configuration { - char vendor[8]; - char product[16]; - char revision[8]; - u_short config; -}; - -/* Almost same as cd_sub_channel_position_data */ -struct sony_subchannel_position_data { - u_char control:4; - u_char addr_type:4; - u_char track_number; - u_char index_number; - u_char rel_msf[3]; - u_char dummy; - u_char abs_msf[3]; -}; - -struct sony_tracklist { - u_char adr :4; /* xcdplayer needs these two values */ - u_char ctl :4; - u_char track; - u_char start_msf[3]; -}; - -#define MAX_TRACKS 100 - -struct sony_toc { - u_char session_number; - - u_char :8; - u_char :8; - u_char first_track; - u_char :8; - u_char :8; - - u_char :8; - u_char :8; - u_char last_track; - u_char :8; - u_char :8; - - u_char :8; - u_char :8; - u_char lead_out_start_msf[3]; - - struct sony_tracklist tracks[MAX_TRACKS]; - - /* The rest is just to take space in case all data is returned */ - - u_char dummy[6*9]; -}; - -#endif /* SCD_H */ diff --git a/sys/gnu/i386/scd.c b/sys/gnu/i386/scd.c deleted file mode 100644 index 2ea212e..0000000 --- a/sys/gnu/i386/scd.c +++ /dev/null @@ -1,1530 +0,0 @@ -/*- - * Copyright (c) 1995 Mikael Hybsch - * - * Portions of this file are copied from mcd.c - * which has the following copyrights: - * - * Copyright 1993 by Holger Veit (data part) - * Copyright 1993 by Brian Moore (audio part) - * Changes Copyright 1993 by Gary Clark II - * Changes Copyright (C) 1994 by Andrew A. Chernov - * - * Rewrote probe routine to work on newer Mitsumi drives. - * Additional changes (C) 1994 by Jordan K. Hubbard - * - * The Linux driver cdu31a has been used as a reference when writing this - * code, there fore bringing it under the GNU Public License. The following - * conditions of redistribution therefore apply: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - -/* $Id: scd.c,v 1.6 1995/02/06 22:35:06 jkh Exp $ */ - -/* Please send any comments to micke@dynas.se */ - -#define SCD_DEBUG 0 - -#include "scd.h" -#if NSCD > 0 -#include <sys/types.h> -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/conf.h> -#include <sys/file.h> -#include <sys/buf.h> -#include <sys/stat.h> -#include <sys/uio.h> -#include <sys/ioctl.h> -#include <sys/cdio.h> -#include <sys/errno.h> -#include <sys/dkbad.h> -#include <sys/disklabel.h> -#include <sys/devconf.h> -#include <machine/stdarg.h> - -#include <i386/isa/isa.h> -#include <i386/isa/isa_device.h> -#include <gnu/i386/scdreg.h> - -#define scd_part(dev) ((minor(dev)) & 7) -#define scd_unit(dev) (((minor(dev)) & 0x38) >> 3) -#define scd_phys(dev) (((minor(dev)) & 0x40) >> 6) -#define RAW_PART 2 - -/* flags */ -#define SCDOPEN 0x0001 /* device opened */ -#define SCDVALID 0x0002 /* parameters loaded */ -#define SCDINIT 0x0004 /* device is init'd */ -#define SCDPROBING 0x0020 /* probing */ -#define SCDTOC 0x0100 /* already read toc */ -#define SCDMBXBSY 0x0200 /* local mbx is busy */ -#define SCDSPINNING 0x0400 /* drive is spun up */ - -#define SCD_S_BEGIN 0 -#define SCD_S_BEGIN1 1 -#define SCD_S_WAITSTAT 2 -#define SCD_S_WAITFIFO 3 -#define SCD_S_WAITSPIN 4 -#define SCD_S_WAITREAD 5 -#define SCD_S_WAITPARAM 6 - -#define RDELAY_WAIT 300 -#define RDELAY_WAITREAD 300 - -#define SCDBLKSIZE 2048 - -#ifdef SCD_DEBUG - int scd_debuglevel = SCD_DEBUG; -# define XDEBUG(level, data) {if (scd_debuglevel >= level) printf data;} -#else -# define XDEBUG(level, data) -#endif - -struct scd_mbx { - short unit; - short port; - short retry; - short nblk; - int sz; - u_long skip; - struct buf *bp; - int p_offset; - short count; -}; - -struct scd_data { - int iobase; - char double_speed; - char *name; - short flags; - int blksize; - u_long disksize; - struct disklabel dlabel; - int openflag; - struct { - unsigned char adr :4; - unsigned char ctl :4; /* xcdplayer needs this */ - unsigned char start_msf[3]; - } toc[MAX_TRACKS]; - short first_track; - short last_track; - struct ioc_play_msf last_play; - - short audio_status; - struct buf head; /* head of buf queue */ - struct scd_mbx mbx; -} scd_data[NSCD]; - -/* prototypes */ -int scdopen(dev_t dev); -int scdclose(dev_t dev); -void scdstrategy(struct buf *bp); -int scdioctl(dev_t dev, int cmd, caddr_t addr, int flags); -int scdsize(dev_t dev); - -static int bcd2bin(bcd_t b); -static bcd_t bin2bcd(int b); -static void hsg2msf(int hsg, bcd_t *msf); -static int msf2hsg(bcd_t *msf); - -static void process_attention(unsigned unit); -static inline void write_control(unsigned port, unsigned data); -static int waitfor_status_bits(int unit, int bits_set, int bits_clear); -static int waitfor_attention(int unit); -static int send_cmd(u_int unit, u_char cmd, u_int nargs, ...); -static void init_drive(unsigned unit); -static int spin_up(unsigned unit); -static int read_toc(dev_t dev); -static int get_result(u_int unit, int result_len, u_char *result); -static void print_error(int unit, int errcode); - -static void scd_start(int unit); -static void scd_doread(int state, struct scd_mbx *mbxin); - -static int scd_eject(int unit); -static int scd_stop(int unit); -static int scd_pause(int unit); -static int scd_resume(int unit); -static int scd_playtracks(int unit, struct ioc_play_track *pt); -static int scd_playmsf(int unit, struct ioc_play_msf *msf); -static int scd_play(int unit, struct ioc_play_msf *msf); -static int scd_subchan(int unit, struct ioc_read_subchannel *sc); -static int read_subcode(int unit, struct sony_subchannel_position_data *sc); - -/* for xcdplayer */ -static int scd_toc_header(int unit, struct ioc_toc_header *th); -static int scd_toc_entrys(int unit, struct ioc_read_toc_entry *te); -#define SCD_LASTPLUS1 170 /* don't ask, xcdplayer passes this in */ - -extern int hz; - -int scd_probe(struct isa_device *dev); -int scd_attach(struct isa_device *dev); -struct isa_driver scddriver = { scd_probe, scd_attach, "scd" }; - -static struct kern_devconf kdc_scd[NSCD] = { { - 0, 0, 0, /* filled in by dev_attach */ - "scd", 0, { MDDT_ISA, 0, "bio" }, - isa_generic_externalize, 0, 0, ISA_EXTERNALLEN, - &kdc_isa0, /* parent */ - 0, /* parentdata */ - DC_IDLE, /* status */ - "Sony CD-ROM drive" /* properly filled later */ -} }; - -static inline void -scd_registerdev(struct isa_device *id) -{ - if(id->id_unit) - kdc_scd[id->id_unit] = kdc_scd[0]; - kdc_scd[id->id_unit].kdc_unit = id->id_unit; - kdc_scd[id->id_unit].kdc_isa = id; - dev_attach(&kdc_scd[id->id_unit]); -} - -int scd_attach(struct isa_device *dev) -{ - struct scd_data *cd = scd_data + dev->id_unit; - int i; - - cd->iobase = dev->id_iobase; /* Already set by probe, but ... */ - - scd_registerdev(dev); - /* name filled in probe */ - kdc_scd[dev->id_unit].kdc_description = scd_data[dev->id_unit].name; - printf("scd%d: <%s>\n", dev->id_unit, scd_data[dev->id_unit].name); - - init_drive(dev->id_unit); - - cd->flags = SCDINIT; - cd->audio_status = CD_AS_AUDIO_INVALID; - - return 1; -} - -int -scdopen(dev_t dev) -{ - int unit,part,phys; - int rc; - struct scd_data *cd; - - unit = scd_unit(dev); - if (unit >= NSCD) - return ENXIO; - - cd = scd_data + unit; - part = scd_part(dev); - phys = scd_phys(dev); - - /* not initialized*/ - if (!(cd->flags & SCDINIT)) - return ENXIO; - - /* invalidated in the meantime? mark all open part's invalid */ - if (cd->openflag) - return ENXIO; - - XDEBUG(1,("scd%d: DEBUG: status = 0x%x\n", unit, inb(cd->iobase+IREG_STATUS))); - - if ((rc = spin_up(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - if (!(cd->flags & SCDTOC)) { - int loop_count = 3; - - while (loop_count-- > 0 && (rc = read_toc(dev)) != 0) { - if (rc == ERR_NOT_SPINNING) { - rc = spin_up(unit); - if (rc) { - print_error(unit, rc);\ - return EIO; - } - continue; - } - printf("scd%d: TOC read error 0x%x\n", unit, rc); - return EIO; - } - } - - cd->openflag = 1; - cd->flags |= SCDVALID; - kdc_scd[unit].kdc_state = DC_BUSY; - - return 0; -} - -int -scdclose(dev_t dev) -{ - int unit,part,phys; - struct scd_data *cd; - int rlen; - char rdata[10]; - - unit = scd_unit(dev); - if (unit >= NSCD) - return ENXIO; - - cd = scd_data + unit; - part = scd_part(dev); - phys = scd_phys(dev); - - if (!(cd->flags & SCDINIT) || !cd->openflag) - return ENXIO; - - if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) { - (void)send_cmd(unit, CMD_SPIN_DOWN, 0); - cd->flags &= ~SCDSPINNING; - } - - kdc_scd[unit].kdc_state = DC_IDLE; - - /* close channel */ - cd->openflag = 0; - - return 0; -} - -void -scdstrategy(struct buf *bp) -{ - struct scd_data *cd; - struct buf *qp; - int s; - int unit = scd_unit(bp->b_dev); - - cd = scd_data + unit; - - XDEBUG(2, ("scd%d: DEBUG: strategy: block=%ld, bcount=%ld\n", unit, bp->b_blkno, bp->b_bcount)); - - if (unit >= NSCD || bp->b_blkno < 0 || (bp->b_bcount % SCDBLKSIZE)) { - printf("scd%d: strategy failure: blkno = %d, bcount = %d\n", - unit, bp->b_blkno, bp->b_bcount); - bp->b_error = EINVAL; - bp->b_flags |= B_ERROR; - goto bad; - } - - /* if device invalidated (e.g. media change, door open), error */ - if (!(cd->flags & SCDVALID)) { - printf("scd%d: media changed\n", unit); - bp->b_error = EIO; - goto bad; - } - - /* read only */ - if (!(bp->b_flags & B_READ)) { - bp->b_error = EROFS; - goto bad; - } - - /* no data to read */ - if (bp->b_bcount == 0) - goto done; - - if (!(cd->flags & SCDTOC)) { - bp->b_error = EIO; - goto bad; - } - /* adjust transfer if necessary */ - if (bounds_check_with_label(bp,&cd->dlabel,1) <= 0) - goto done; - - bp->b_pblkno = bp->b_blkno; - bp->b_resid = 0; - - /* queue it */ - qp = &cd->head; - s = splbio(); - disksort(qp,bp); - splx(s); - - /* now check whether we can perform processing */ - scd_start(unit); - return; - -bad: - bp->b_flags |= B_ERROR; -done: - bp->b_resid = bp->b_bcount; - biodone(bp); - return; -} - -static void -scd_start(int unit) -{ - struct scd_data *cd = scd_data + unit; - struct buf *bp, *qp = &cd->head; - struct partition *p; - int part; - register s = splbio(); - - if (cd->flags & SCDMBXBSY) { - splx(s); - return; - } - - if ((bp = qp->b_actf) != 0) { - /* block found to process, dequeue */ - qp->b_actf = bp->b_actf; - cd->flags |= SCDMBXBSY; - splx(s); - } else { - /* nothing to do */ - splx(s); - return; - } - - p = cd->dlabel.d_partitions + scd_part(bp->b_dev); - - cd->mbx.unit = unit; - cd->mbx.port = cd->iobase; - cd->mbx.retry = 3; - cd->mbx.bp = bp; - cd->mbx.p_offset = p->p_offset; - splx(s); - - scd_doread(SCD_S_BEGIN,&(cd->mbx)); - return; -} - -int -scdioctl(dev_t dev, int cmd, caddr_t addr, int flags) -{ - struct scd_data *cd; - int unit,part; - - unit = scd_unit(dev); - part = scd_part(dev); - cd = scd_data + unit; - - XDEBUG(1, ("scd%d: ioctl: cmd=0x%lx\n", unit, cmd)); - - if (!(cd->flags & SCDVALID)) - return EIO; - - switch (cmd) { - case DIOCSBAD: - return EINVAL; - case DIOCGDINFO: - *(struct disklabel *)addr = cd->dlabel; - return 0; - case DIOCGPART: - ((struct partinfo *)addr)->disklab = &cd->dlabel; - ((struct partinfo *)addr)->part = - &cd->dlabel.d_partitions[0]; - return 0; - case CDIOCPLAYTRACKS: - return scd_playtracks(unit, (struct ioc_play_track *) addr); - case CDIOCPLAYBLOCKS: - return EINVAL; - case CDIOCPLAYMSF: - return scd_playmsf(unit, (struct ioc_play_msf *) addr); - case CDIOCREADSUBCHANNEL: - return scd_subchan(unit, (struct ioc_read_subchannel *) addr); - case CDIOREADTOCHEADER: - return scd_toc_header (unit, (struct ioc_toc_header *) addr); - case CDIOREADTOCENTRYS: - return scd_toc_entrys (unit, (struct ioc_read_toc_entry*) addr); - case CDIOCSETPATCH: - case CDIOCGETVOL: - case CDIOCSETVOL: - case CDIOCSETMONO: - case CDIOCSETSTERIO: - case CDIOCSETMUTE: - case CDIOCSETLEFT: - case CDIOCSETRIGHT: - return EINVAL; - case CDIOCRESUME: - return scd_resume(unit); - case CDIOCPAUSE: - return scd_pause(unit); - case CDIOCSTART: - return EINVAL; - case CDIOCSTOP: - return scd_stop(unit); - case CDIOCEJECT: - return scd_eject(unit); - case CDIOCALLOW: - return 0; - case CDIOCSETDEBUG: -#ifdef SCD_DEBUG - scd_debuglevel++; -#endif - return 0; - case CDIOCCLRDEBUG: -#ifdef SCD_DEBUG - scd_debuglevel = 0; - -#endif - return 0; - default: - printf("scd%d: unsupported ioctl (cmd=0x%lx)\n", unit, cmd); - return ENOTTY; - } -} - -int -scdsize(dev_t dev) -{ - return -1; -} - -void -scdintr() -{ - return; -} - -/*************************************************************** - * lower level of driver starts here - **************************************************************/ - -static int -scd_playtracks(int unit, struct ioc_play_track *pt) -{ - struct scd_data *cd = scd_data + unit; - struct ioc_play_msf msf; - int a = pt->start_track; - int z = pt->end_track; - int rc, i; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - if (rc == -ERR_NOT_SPINNING) { - if (spin_up(unit) != 0) - return EIO; - rc = read_toc(unit); - } - if (rc != 0) { - print_error(unit, rc); - return EIO; - } - } - - XDEBUG(1, ("scd%d: playtracks from %d:%d to %d:%d\n", unit, - a, pt->start_index, z, pt->end_index)); - - if ( a < cd->first_track - || a > cd->last_track - || a > z - || z > cd->last_track) - return EINVAL; - - bcopy(cd->toc[a].start_msf, &msf.start_m, 3); - hsg2msf(msf2hsg(cd->toc[z+1].start_msf)-1, &msf.end_m); - - return scd_play(unit, &msf); -} - -/* The start/end msf is expected to be in bin format */ -static int -scd_playmsf(int unit, struct ioc_play_msf *msfin) -{ - struct ioc_play_msf msf; - - msf.start_m = bin2bcd(msfin->start_m); - msf.start_s = bin2bcd(msfin->start_s); - msf.start_f = bin2bcd(msfin->start_f); - msf.end_m = bin2bcd(msfin->end_m); - msf.end_s = bin2bcd(msfin->end_s); - msf.end_f = bin2bcd(msfin->end_f); - - return scd_play(unit, &msf); -} - -/* The start/end msf is expected to be in bcd format */ -static int -scd_play(int unit, struct ioc_play_msf *msf) -{ - struct scd_data *cd = scd_data + unit; - int i, rc; - - XDEBUG(1, ("scd%d: playing: %02x:%02x:%02x -> %02x:%02x:%02x\n", unit, - msf->start_m, msf->start_s, msf->start_f, - msf->end_m, msf->end_s, msf->end_f)); - - for (i = 0; i < 2; i++) { - rc = send_cmd(unit, CMD_PLAY_AUDIO, 7, - 0x03, - msf->start_m, msf->start_s, msf->start_f, - msf->end_m, msf->end_s, msf->end_f); - if (rc == -ERR_NOT_SPINNING) { - cd->flags &= ~SCDSPINNING; - if (spin_up(unit) != 0) - return EIO; - } else if (rc < 0) { - print_error(unit, rc); - return EIO; - } else { - break; - } - } - cd->audio_status = CD_AS_PLAY_IN_PROGRESS; - bcopy((char *)msf, (char *)&cd->last_play, sizeof(struct ioc_play_msf)); - return 0; -} - -static int -scd_stop(int unit) -{ - struct scd_data *cd = scd_data + unit; - - (void)send_cmd(unit, CMD_STOP_AUDIO, 0); - cd->audio_status = CD_AS_PLAY_COMPLETED; - return 0; -} - -static int -scd_pause(int unit) -{ - struct scd_data *cd = scd_data + unit; - struct sony_subchannel_position_data subpos; - - if (cd->audio_status != CD_AS_PLAY_IN_PROGRESS) - return EINVAL; - - if (read_subcode(unit, &subpos) != 0) - return EIO; - - if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0) - return EIO; - - cd->last_play.start_m = subpos.abs_msf[0]; - cd->last_play.start_s = subpos.abs_msf[1]; - cd->last_play.start_f = subpos.abs_msf[2]; - cd->audio_status = CD_AS_PLAY_PAUSED; - - XDEBUG(1, ("scd%d: pause @ %02x:%02x:%02x\n", unit, - cd->last_play.start_m, - cd->last_play.start_s, - cd->last_play.start_f)); - - return 0; -} - -static int -scd_resume(int unit) -{ - if (scd_data[unit].audio_status != CD_AS_PLAY_PAUSED) - return EINVAL; - return scd_play(unit, &scd_data[unit].last_play); -} - -static int -scd_eject(int unit) -{ - struct scd_data *cd = scd_data + unit; - int port = cd->iobase; - - cd->audio_status = CD_AS_AUDIO_INVALID; - cd->flags &= ~(SCDSPINNING|SCDTOC); - - if (send_cmd(unit, CMD_STOP_AUDIO, 0) != 0 || - send_cmd(unit, CMD_SPIN_DOWN, 0) != 0 || - send_cmd(unit, CMD_EJECT, 0) != 0) - { - return EIO; - } - return 0; -} - -static int -scd_subchan(int unit, struct ioc_read_subchannel *sc) -{ - struct scd_data *cd = scd_data + unit; - struct sony_subchannel_position_data q; - struct cd_sub_channel_info data; - - XDEBUG(1, ("scd%d: subchan af=%d, df=%d\n", unit, - sc->address_format, - sc->data_format)); - - if (sc->address_format != CD_MSF_FORMAT) - return EINVAL; - - if (sc->data_format != CD_CURRENT_POSITION) - return EINVAL; - - if (read_subcode(unit, &q) != 0) - return EIO; - - data.header.audio_status = cd->audio_status; - data.what.position.data_format = CD_MSF_FORMAT; - data.what.position.track_number = bcd2bin(q.track_number); - data.what.position.reladdr.msf.unused = 0; - data.what.position.reladdr.msf.minute = bcd2bin(q.rel_msf[0]); - data.what.position.reladdr.msf.second = bcd2bin(q.rel_msf[1]); - data.what.position.reladdr.msf.frame = bcd2bin(q.rel_msf[2]); - data.what.position.absaddr.msf.unused = 0; - data.what.position.absaddr.msf.minute = bcd2bin(q.abs_msf[0]); - data.what.position.absaddr.msf.second = bcd2bin(q.abs_msf[1]); - data.what.position.absaddr.msf.frame = bcd2bin(q.abs_msf[2]); - - if (copyout(&data, sc->data, min(sizeof(struct cd_sub_channel_info), sc->data_len))!=0) - return EFAULT; - return 0; -} - -int -scd_probe(struct isa_device *dev) -{ - struct sony_drive_configuration drive_config; - int unit = dev->id_unit; - int rc; - static char namebuf[8+16+8+3]; - char *s = namebuf; - int loop_count = 0; - - scd_data[unit].flags = SCDPROBING; - scd_data[unit].iobase = dev->id_iobase; - - bzero(&drive_config, sizeof(drive_config)); - -again: - /* Reset drive */ - write_control(dev->id_iobase, CBIT_RESET_DRIVE); - - /* Calm down */ - DELAY(300000); - - /* Only the ATTENTION bit may be set */ - if ((inb(dev->id_iobase+IREG_STATUS) & ~1) != 0) { - XDEBUG(1, ("scd: too many bits set. probe failed.\n")); - return 0; - } - rc = send_cmd(unit, CMD_GET_DRIVE_CONFIG, 0); - if (rc != sizeof(drive_config)) { - /* Sometimes if the drive is playing audio I get */ - /* the bad result 82. Fix by repeating the reset */ - if (rc > 0 && loop_count++ == 0) - goto again; - return 0; - } - if (get_result(unit, rc, (u_char *)&drive_config) != 0) - return 0; - - bcopy(drive_config.vendor, namebuf, 8); - s = namebuf+8; - while (*(s-1) == ' ') /* Strip trailing spaces */ - s--; - *s++ = ' '; - bcopy(drive_config.product, s, 16); - s += 16; - while (*(s-1) == ' ') - s--; - *s++ = ' '; - bcopy(drive_config.revision, s, 8); - s += 8; - while (*(s-1) == ' ') - s--; - *s = 0; - - scd_data[unit].name = namebuf; - - if (drive_config.config & 0x10) - scd_data[unit].double_speed = 1; - else - scd_data[unit].double_speed = 0; - - return 4; -} - -static int -read_subcode(int unit, struct sony_subchannel_position_data *sc) -{ - int rc; - - rc = send_cmd(unit, CMD_GET_SUBCHANNEL_DATA, 0); - if (rc < 0 || rc < sizeof(*sc)) - return EIO; - if (get_result(unit, rc, (u_char *)sc) != 0) - return EIO; - return 0; -} - -/* State machine copied from mcd.c */ - -/* This (and the code in mcd.c) will not work with more than one drive */ -/* because there is only one mbxsave below. Should fix that some day. */ -/* (mbxsave & state should probably be included in the scd_data struct and */ -/* the unit number used as first argument to scd_doread().) /Micke */ - -/* state machine to process read requests - * initialize with SCD_S_BEGIN: reset state machine - * SCD_S_WAITSTAT: wait for ready (!busy) - * SCD_S_WAITSPIN: wait for drive to spin up (if not spinning) - * SCD_S_WAITFIFO: wait for param fifo to get ready, them exec. command. - * SCD_S_WAITREAD: wait for data ready, read data - * SCD_S_WAITPARAM: wait for command result params, read them, error if bad data read. - */ - -static struct scd_mbx *mbxsave; - -static void -scd_doread(int state, struct scd_mbx *mbxin) -{ - struct scd_mbx *mbx = (state!=SCD_S_BEGIN) ? mbxsave : mbxin; - int unit = mbx->unit; - int port = mbx->port; - struct buf *bp = mbx->bp; - struct scd_data *cd = scd_data + unit; - int reg,i,k,c; - int blknum; - caddr_t addr; - char rdata[10]; - static char sdata[3]; /* Must be preserved between calls to this function */ - -loop: - switch (state) { - case SCD_S_BEGIN: - mbx = mbxsave = mbxin; - - case SCD_S_BEGIN1: - /* get status */ - mbx->count = RDELAY_WAIT; - - process_attention(unit); - goto trystat; - - case SCD_S_WAITSTAT: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSTAT); - if (mbx->count-- <= 0) { - printf("scd%d: timeout. drive busy.\n",unit); - goto harderr; - } - -trystat: - if (IS_BUSY(port)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSTAT,hz/100); /* XXX */ - return; - } - - process_attention(unit); - - /* reject, if audio active */ - if (cd->audio_status & CD_AS_PLAY_IN_PROGRESS) { - printf("scd%d: audio is active\n",unit); - goto harderr; - } - - mbx->sz = cd->blksize; - -firstblock: - /* for first block */ - mbx->nblk = (bp->b_bcount + (mbx->sz-1)) / mbx->sz; - mbx->skip = 0; - -nextblock: - if (!(cd->flags & SCDVALID)) - goto changed; - - blknum = (bp->b_blkno / (mbx->sz/DEV_BSIZE)) - + mbx->p_offset + mbx->skip/mbx->sz; - - XDEBUG(2, ("scd%d: scd_doread: read blknum=%d\n", unit, blknum)); - - /* build parameter block */ - hsg2msf(blknum, sdata); - - write_control(port, CBIT_RESULT_READY_CLEAR); - write_control(port, CBIT_RPARAM_CLEAR); - write_control(port, CBIT_DATA_READY_CLEAR); - - if (FSTATUS_BIT(port, FBIT_WPARAM_READY)) - goto writeparam; - - mbx->count = 100; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */ - return; - - case SCD_S_WAITSPIN: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITSPIN); - if (mbx->count-- <= 0) { - printf("scd%d: timeout waiting for drive to spin up.\n", unit); - goto harderr; - } - if (!STATUS_BIT(port, SBIT_RESULT_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */ - return; - } - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((i = inb(port+IREG_RESULT)) & 0xf0) { - case 0x20: - i = inb(port+IREG_RESULT); - print_error(unit, i); - goto harderr; - case 0x00: - (void)inb(port+IREG_RESULT); - cd->flags |= SCDSPINNING; - break; - } - XDEBUG(1, ("scd%d: DEBUG: spin up complete\n", unit)); - - state = SCD_S_BEGIN1; - goto loop; - - case SCD_S_WAITFIFO: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITFIFO); - if (mbx->count-- <= 0) { - printf("scd%d: timeout. write param not ready.\n",unit); - goto harderr; - } - if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITFIFO,hz/100); /* XXX */ - return; - } - XDEBUG(1, ("scd%d: mbx->count (writeparamwait) = %d(%d)\n", unit, mbx->count, 100)); - -writeparam: - /* The reason this test isn't done 'till now is to make sure */ - /* that it is ok to send the SPIN_UP cmd below. */ - if (!(cd->flags & SCDSPINNING)) { - XDEBUG(1, ("scd%d: spinning up drive ...\n", unit)); - outb(port+OREG_COMMAND, CMD_SPIN_UP); - mbx->count = 300; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITSPIN,hz/100); /* XXX */ - return; - } - - reg = port + OREG_WPARAMS; - /* send the read command */ - disable_intr(); - outb(reg, sdata[0]); - outb(reg, sdata[1]); - outb(reg, sdata[2]); - outb(reg, 0); - outb(reg, 0); - outb(reg, 1); - outb(port+OREG_COMMAND, CMD_READ); - enable_intr(); - - mbx->count = RDELAY_WAITREAD; - for (i = 0; i < 50; i++) { - if (STATUS_BIT(port, SBIT_DATA_READY)) - goto got_data; - DELAY(100); - } - - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */ - return; - - case SCD_S_WAITREAD: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITREAD); - if (mbx->count-- <= 0) { - if (STATUS_BIT(port, SBIT_RESULT_READY)) - goto got_param; - printf("scd%d: timeout while reading data\n",unit); - goto readerr; - } - if (!STATUS_BIT(port, SBIT_DATA_READY)) { - process_attention(unit); - if (!(cd->flags & SCDVALID)) - goto changed; - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITREAD,hz/100); /* XXX */ - return; - } - XDEBUG(2, ("scd%d: mbx->count (after RDY_BIT) = %d(%d)\n", unit, mbx->count, RDELAY_WAITREAD)); - -got_data: - /* data is ready */ - addr = bp->b_un.b_addr + mbx->skip; - write_control(port, CBIT_DATA_READY_CLEAR); - insb(port+IREG_DATA, addr, mbx->sz); - - mbx->count = 100; - for (i = 0; i < 20; i++) { - if (STATUS_BIT(port, SBIT_RESULT_READY)) - goto waitfor_param; - DELAY(100); - } - goto waitfor_param; - - case SCD_S_WAITPARAM: - untimeout((timeout_func_t)scd_doread,(caddr_t)SCD_S_WAITPARAM); - if (mbx->count-- <= 0) { - printf("scd%d: timeout waiting for params\n",unit); - goto readerr; - } - -waitfor_param: - if (!STATUS_BIT(port, SBIT_RESULT_READY)) { - timeout((timeout_func_t)scd_doread, - (caddr_t)SCD_S_WAITPARAM,hz/100); /* XXX */ - return; - } -#if SCD_DEBUG - if (mbx->count < 100 && scd_debuglevel > 0) - printf("scd%d: mbx->count (paramwait) = %d(%d)\n", unit, mbx->count, 100); -#endif - -got_param: - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((i = inb(port+IREG_RESULT)) & 0xf0) { - case 0x50: - switch (i) { - case ERR_FATAL_READ_ERROR1: - case ERR_FATAL_READ_ERROR2: - printf("scd%d: unrecoverable read error 0x%x\n", unit, i); - goto harderr; - } - break; - case 0x20: - i = inb(port+IREG_RESULT); - switch (i) { - case ERR_NOT_SPINNING: - XDEBUG(1, ("scd%d: read error: drive not spinning\n", unit)); - if (mbx->retry-- > 0) { - state = SCD_S_BEGIN1; - cd->flags &= ~SCDSPINNING; - goto loop; - } - goto harderr; - default: - print_error(unit, i); - goto readerr; - } - case 0x00: - i = inb(port+IREG_RESULT); - break; - } - - if (--mbx->nblk > 0) { - mbx->skip += mbx->sz; - goto nextblock; - } - - /* return buffer */ - bp->b_resid = 0; - biodone(bp); - - cd->flags &= ~SCDMBXBSY; - scd_start(mbx->unit); - return; - } - -readerr: - if (mbx->retry-- > 0) { - printf("scd%d: retrying ...\n",unit); - state = SCD_S_BEGIN1; - goto loop; - } -harderr: - /* invalidate the buffer */ - bp->b_error = EIO; - bp->b_flags |= B_ERROR; - bp->b_resid = bp->b_bcount; - biodone(bp); - - cd->flags &= ~SCDMBXBSY; - scd_start(mbx->unit); - return; - -changed: - printf("scd%d: media changed\n", unit); - goto harderr; -} - -static int -bcd2bin(bcd_t b) -{ - return (b >> 4) * 10 + (b & 15); -} - -static bcd_t -bin2bcd(int b) -{ - return ((b / 10) << 4) | (b % 10); -} - -static void -hsg2msf(int hsg, bcd_t *msf) -{ - hsg += 150; - M_msf(msf) = bin2bcd(hsg / 4500); - hsg %= 4500; - S_msf(msf) = bin2bcd(hsg / 75); - F_msf(msf) = bin2bcd(hsg % 75); -} - -static int -msf2hsg(bcd_t *msf) -{ - return (bcd2bin(M_msf(msf)) * 60 + - bcd2bin(S_msf(msf))) * 75 + - bcd2bin(F_msf(msf)) - 150; -} - -static void -process_attention(unsigned unit) -{ - unsigned port = scd_data[unit].iobase; - unsigned char code; - int count = 0; - int i; - - while (IS_ATTENTION(port) && count++ < 30) { - write_control(port, CBIT_ATTENTION_CLEAR); - code = inb(port+IREG_RESULT); - -#if SCD_DEBUG - if (scd_debuglevel > 0) { - if (count == 1) - printf("scd%d: DEBUG: ATTENTIONS = 0x%x", unit, code); - else - printf(",0x%x", code); - } -#endif - - switch (code) { - case ATTEN_SPIN_DOWN: - scd_data[unit].flags &= ~SCDSPINNING; - break; - - case ATTEN_SPIN_UP_DONE: - scd_data[unit].flags |= SCDSPINNING; - break; - - case ATTEN_AUDIO_DONE: - scd_data[unit].audio_status = CD_AS_PLAY_COMPLETED; - break; - - case ATTEN_DRIVE_LOADED: - scd_data[unit].flags &= ~(SCDTOC|SCDSPINNING|SCDVALID); - scd_data[unit].audio_status = CD_AS_AUDIO_INVALID; - break; - - case ATTEN_EJECT_PUSHED: - scd_data[unit].flags &= ~SCDVALID; - break; - } - DELAY(100); - } -#if SCD_DEBUG - if (scd_debuglevel > 0 && count > 0) - printf("\n"); -#endif -} - -/* Returns 0 OR sony error code */ -static int -spin_up(unsigned unit) -{ - unsigned char res_reg[12]; - unsigned int res_size; - int rc; - int loop_count = 0; - -again: - rc = send_cmd(unit, CMD_SPIN_UP, NULL, 0, res_reg, &res_size); - if (rc != 0) { - XDEBUG(2, ("scd%d: CMD_SPIN_UP error 0x%x\n", unit, rc)); - return rc; - } - - if (!(scd_data[unit].flags & SCDTOC)) { - rc = send_cmd(unit, CMD_READ_TOC, 0); - if (rc == ERR_NOT_SPINNING) { - if (loop_count++ < 3) - goto again; - return rc; - } - if (rc != 0) - return rc; - } - - scd_data[unit].flags |= SCDSPINNING; - - return 0; -} - -static struct sony_tracklist * -get_tl(struct sony_toc *toc, int size) -{ - struct sony_tracklist *tl = &toc->tracks[0]; - - if (tl->track != 0xb0) - return tl; - (char *)tl += 9; - if (tl->track != 0xb1) - return tl; - (char *)tl += 9; - if (tl->track != 0xb2) - return tl; - (char *)tl += 9; - if (tl->track != 0xb3) - return tl; - (char *)tl += 9; - if (tl->track != 0xb4) - return tl; - (char *)tl += 9; - if (tl->track != 0xc0) - return tl; - (char *)tl += 9; - return tl; -} - -static int -read_toc(dev_t dev) -{ - unsigned unit; - struct scd_data *cd; - unsigned part = 0; /* For now ... */ - struct sony_toc toc; - struct sony_tracklist *tl; - int rc, i, j; - u_long first, last; - - unit = scd_unit(dev); - cd = scd_data + unit; - - rc = send_cmd(unit, CMD_GET_TOC, 1, part+1); - if (rc < 0) - return rc; - if (rc > sizeof(toc)) { - printf("scd%d: program error: toc too large (%d)\n", unit, rc); - return EIO; - } - if (get_result(unit, rc, (u_char *)&toc) != 0) - return EIO; - - XDEBUG(1, ("scd%d: toc read. len = %d, sizeof(toc) = %d\n", unit, rc, sizeof(toc))); - - tl = get_tl(&toc, rc); - first = msf2hsg(tl->start_msf); - last = msf2hsg(toc.lead_out_start_msf); - cd->blksize = SCDBLKSIZE; - cd->disksize = last*cd->blksize/DEV_BSIZE; - - XDEBUG(1, ("scd%d: firstsector = %d, lastsector = %d", unit, - first, last)); - - cd->first_track = bcd2bin(toc.first_track); - cd->last_track = bcd2bin(toc.last_track); - if (cd->last_track > (MAX_TRACKS-2)) - cd->last_track = MAX_TRACKS-2; - for (j = 0, i = cd->first_track; i <= cd->last_track; i++, j++) { - cd->toc[i].adr = tl[j].adr; - cd->toc[i].ctl = tl[j].ctl; /* for xcdplayer */ - bcopy(tl[j].start_msf, cd->toc[i].start_msf, 3); -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) { - if ((j % 3) == 0) - printf("\nscd%d: tracks ", unit); - printf("[%03d: %2d %2d %2d] ", i, - bcd2bin(cd->toc[i].start_msf[0]), - bcd2bin(cd->toc[i].start_msf[1]), - bcd2bin(cd->toc[i].start_msf[2])); - } -#endif - } - bcopy(toc.lead_out_start_msf, cd->toc[cd->last_track+1].start_msf, 3); -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) { - i = cd->last_track+1; - printf("[END: %2d %2d %2d]\n", - bcd2bin(cd->toc[i].start_msf[0]), - bcd2bin(cd->toc[i].start_msf[1]), - bcd2bin(cd->toc[i].start_msf[2])); - } -#endif - - bzero(&cd->dlabel,sizeof(struct disklabel)); - /* filled with spaces first */ - strncpy(cd->dlabel.d_typename," ", - sizeof(cd->dlabel.d_typename)); - strncpy(cd->dlabel.d_typename, cd->name, - min(strlen(cd->name), sizeof(cd->dlabel.d_typename) - 1)); - strncpy(cd->dlabel.d_packname,"unknown ", - sizeof(cd->dlabel.d_packname)); - cd->dlabel.d_secsize = cd->blksize; - cd->dlabel.d_nsectors = 100; - cd->dlabel.d_ntracks = 1; - cd->dlabel.d_ncylinders = (cd->disksize/100)+1; - cd->dlabel.d_secpercyl = 100; - cd->dlabel.d_secperunit = cd->disksize; - cd->dlabel.d_rpm = 300; - cd->dlabel.d_interleave = 1; - cd->dlabel.d_flags = D_REMOVABLE; - cd->dlabel.d_npartitions= 1; - cd->dlabel.d_partitions[0].p_offset = 0; - cd->dlabel.d_partitions[0].p_size = cd->disksize; - cd->dlabel.d_partitions[0].p_fstype = 9; - cd->dlabel.d_magic = DISKMAGIC; - cd->dlabel.d_magic2 = DISKMAGIC; - cd->dlabel.d_checksum = dkcksum(&cd->dlabel); - - cd->flags |= SCDTOC; - - return 0; -} - -static inline void -write_control(unsigned port, unsigned data) -{ - outb(port + OREG_CONTROL, data); -} - -static void -init_drive(unsigned unit) -{ - int rc; - - rc = send_cmd(unit, CMD_SET_DRIVE_PARAM, 2, - 0x05, 0x03 | ((scd_data[unit].double_speed) ? 0x04: 0)); - if (rc != 0) - printf("scd%d: Unable to set parameters. Errcode = 0x%x\n", unit, rc); -} - -/* Returns 0 or errno */ -static int -get_result(u_int unit, int result_len, u_char *result) -{ - unsigned int port = scd_data[unit].iobase; - unsigned int res_reg = port + IREG_RESULT; - unsigned char c; - int loop_index = 2; /* send_cmd() reads two bytes ... */ - - XDEBUG(1, ("scd%d: DEBUG: get_result: bytes=%d\n", unit, result_len)); - - while (result_len-- > 0) { - if (loop_index++ >= 10) { - loop_index = 1; - if (waitfor_status_bits(unit, SBIT_RESULT_READY, 0)) - return EIO; - write_control(port, CBIT_RESULT_READY_CLEAR); - } - if (result) - *result++ = inb(res_reg); - else - (void)inb(res_reg); - } - return 0; -} - -/* Returns -0x100 for timeout, -(drive error code) OR number of result bytes */ -static int -send_cmd(u_int unit, u_char cmd, u_int nargs, ...) -{ - va_list ap; - u_int port = scd_data[unit].iobase; - u_int reg; - u_char c; - int rc; - int i; - - if (waitfor_status_bits(unit, 0, SBIT_BUSY)) { - printf("scd%d: drive busy\n", unit); - return -0x100; - } - - XDEBUG(1,("scd%d: DEBUG: send_cmd: cmd=0x%x nargs=%d", unit, cmd, nargs)); - - write_control(port, CBIT_RESULT_READY_CLEAR); - write_control(port, CBIT_RPARAM_CLEAR); - - for (i = 0; i < 100; i++) - if (FSTATUS_BIT(port, FBIT_WPARAM_READY)) - break; - if (!FSTATUS_BIT(port, FBIT_WPARAM_READY)) { - XDEBUG(1, ("\nscd%d: wparam timeout\n", unit)); - return -EIO; - } - - va_start(ap, nargs); - reg = port + OREG_WPARAMS; - for (i = 0; i < nargs; i++) { - c = (u_char)va_arg(ap, int); - outb(reg, c); - XDEBUG(1, (",{0x%x}", c)); - } - va_end(ap); - XDEBUG(1, ("\n")); - - outb(port+OREG_COMMAND, cmd); - - if (rc = waitfor_status_bits(unit, SBIT_RESULT_READY, SBIT_BUSY)) - return -0x100; - - reg = port + IREG_RESULT; - write_control(port, CBIT_RESULT_READY_CLEAR); - switch ((rc = inb(reg)) & 0xf0) { - case 0x20: - rc = inb(reg); - /* FALL TROUGH */ - case 0x50: - XDEBUG(1, ("scd%d: DEBUG: send_cmd: drive_error=0x%x\n", unit, rc)); - return -rc; - case 0x00: - default: - rc = inb(reg); - XDEBUG(1, ("scd%d: DEBUG: send_cmd: result_len=%d\n", unit, rc)); - return rc; - } -} - -static void -print_error(int unit, int errcode) -{ - switch (errcode) { - case -ERR_CD_NOT_LOADED: - printf("scd%d: door is open\n", unit); - break; - case -ERR_NO_CD_INSIDE: - printf("scd%d: no cd inside\n", unit); - break; - default: - if (errcode == -0x100 || errcode > 0) - printf("scd%d: device timeout\n", unit); - else - printf("scd%d: unexpected error 0x%x\n", unit, -errcode); - break; - } -} - -/* Returns 0 or errno value */ -static int -waitfor_status_bits(int unit, int bits_set, int bits_clear) -{ - u_int port = scd_data[unit].iobase; - u_int flags = scd_data[unit].flags; - u_int reg = port + IREG_STATUS; - u_int max_loop; - u_char c = 0; - - if (flags & SCDPROBING) { - max_loop = 0; - while (max_loop++ < 1000) { - c = inb(reg); - if (c == 0xff) - return EIO; - if (c & SBIT_ATTENTION) { - process_attention(unit); - continue; - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - break; - } - DELAY(10000); - } - } else { - max_loop = 100; - while (max_loop-- > 0) { - c = inb(reg); - if (c & SBIT_ATTENTION) { - process_attention(unit); - continue; - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - break; - } - tsleep(waitfor_status_bits, PZERO - 1, "waitfor", hz/10); - } - } - if ((c & bits_set) == bits_set && - (c & bits_clear) == 0) - { - return 0; - } -#ifdef SCD_DEBUG - if (scd_debuglevel > 0) - printf("scd%d: DEBUG: waitfor: TIMEOUT (0x%x,(0x%x,0x%x))\n", unit, c, bits_set, bits_clear); - else -#endif - printf("scd%d: timeout.\n", unit); - return EIO; -} - -/* these two routines for xcdplayer - "borrowed" from mcd.c */ -static int -scd_toc_header (int unit, struct ioc_toc_header* th) -{ - struct scd_data *cd = scd_data + unit; - int rc; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - - th->starting_track = cd->first_track; - th->ending_track = cd->last_track; - th->len = 0; /* not used */ - - return 0; -} - -static int -scd_toc_entrys (int unit, struct ioc_read_toc_entry *te) -{ - struct scd_data *cd = scd_data + unit; - struct cd_toc_entry toc_entry; - int rc, i, len = te->data_len; - - if (!(cd->flags & SCDTOC) && (rc = read_toc(unit)) != 0) { - print_error(unit, rc); - return EIO; - } - - /* find the toc to copy*/ - i = te->starting_track; - if (i == SCD_LASTPLUS1) - i = cd->last_track + 1; - - /* verify starting track */ - if (i < cd->first_track || i > cd->last_track+1) - return EINVAL; - - /* valid length ? */ - if (len < sizeof(struct cd_toc_entry) - || (len % sizeof(struct cd_toc_entry)) != 0) - return EINVAL; - - /* copy the toc data */ - toc_entry.control = cd->toc[i].ctl; - toc_entry.addr_type = te->address_format; - toc_entry.track = i; - if (te->address_format == CD_MSF_FORMAT) { - toc_entry.addr.msf.unused = 0; - toc_entry.addr.msf.minute = bcd2bin(cd->toc[i].start_msf[0]); - toc_entry.addr.msf.second = bcd2bin(cd->toc[i].start_msf[1]); - toc_entry.addr.msf.frame = bcd2bin(cd->toc[i].start_msf[2]); - } - - /* copy the data back */ - if (copyout(&toc_entry, te->data, sizeof(struct cd_toc_entry)) != 0) - return EFAULT; - - return 0; -} - - -#endif /* NSCD > 0 */ diff --git a/sys/gnu/i386/scdreg.h b/sys/gnu/i386/scdreg.h deleted file mode 100644 index 93ace5c..0000000 --- a/sys/gnu/i386/scdreg.h +++ /dev/null @@ -1,145 +0,0 @@ -/*- - * Copyright (c) 1995 Mikael Hybsch - * - * The Linux driver cdu31a has been used as a reference when writing this - * code, therefore bringing it under the GNU Public License. The following - * conditions of redistribution therefore apply: - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * $Id: scdreg.h,v 1.2 1995/01/29 22:51:41 jkh Exp $ - * - */ - -#ifndef SCD_H -#define SCD_H - -#ifdef __GNUC__ -#if __GNUC__ >= 2 -#pragma pack(1) -#endif -#endif - -typedef unsigned char bcd_t; -#define M_msf(msf) msf[0] -#define S_msf(msf) msf[1] -#define F_msf(msf) msf[2] - -#define IS_ATTENTION(port) ((inb(port+IREG_STATUS) & SBIT_ATTENTION) != 0) -#define IS_BUSY(port) ((inb(port+IREG_STATUS) & SBIT_BUSY) != 0) -#define IS_DATA_RDY(port) ((inb(port+IREG_STATUS) & SBIT_DATA_READY) != 0) -#define STATUS_BIT(port, bit) ((inb(port+IREG_STATUS) & (bit)) != 0) -#define FSTATUS_BIT(port, bit) ((inb(port+IREG_FSTATUS) & (bit)) != 0) - -#define OREG_COMMAND 0 -#define OREG_WPARAMS 1 -#define OREG_CONTROL 3 -#define CBIT_ATTENTION_CLEAR 0x01 -#define CBIT_RESULT_READY_CLEAR 0x02 -#define CBIT_DATA_READY_CLEAR 0x04 -#define CBIT_RPARAM_CLEAR 0x40 -#define CBIT_RESET_DRIVE 0x80 - -#define IREG_STATUS 0 -#define SBIT_ATTENTION 0x01 -#define SBIT_RESULT_READY 0x02 -#define SBIT_DATA_READY 0x04 -#define SBIT_BUSY 0x80 - -#define IREG_RESULT 1 -#define IREG_DATA 2 -#define IREG_FSTATUS 3 -#define FBIT_WPARAM_READY 0x01 - -#define CMD_GET_DRIVE_CONFIG 0x00 -#define CMD_SET_DRIVE_PARAM 0x10 -#define CMD_GET_SUBCHANNEL_DATA 0x21 -#define CMD_GET_TOC 0x24 -#define CMD_READ_TOC 0x30 -#define CMD_READ 0x34 -#define CMD_PLAY_AUDIO 0x40 -#define CMD_STOP_AUDIO 0x41 -#define CMD_EJECT 0x50 -#define CMD_SPIN_UP 0x51 -#define CMD_SPIN_DOWN 0x52 - -#define ERR_CD_NOT_LOADED 0x20 -#define ERR_NO_CD_INSIDE 0x21 -#define ERR_NOT_SPINNING 0x22 -#define ERR_FATAL_READ_ERROR1 0x53 -#define ERR_FATAL_READ_ERROR2 0x57 - -#define ATTEN_DRIVE_LOADED 0x80 -#define ATTEN_EJECT_PUSHED 0x81 -#define ATTEN_AUDIO_DONE 0x90 -#define ATTEN_SPIN_UP_DONE 0x24 -#define ATTEN_SPIN_DOWN 0x27 -#define ATTEN_EJECT_DONE 0x28 - - -struct sony_drive_configuration { - char vendor[8]; - char product[16]; - char revision[8]; - u_short config; -}; - -/* Almost same as cd_sub_channel_position_data */ -struct sony_subchannel_position_data { - u_char control:4; - u_char addr_type:4; - u_char track_number; - u_char index_number; - u_char rel_msf[3]; - u_char dummy; - u_char abs_msf[3]; -}; - -struct sony_tracklist { - u_char adr :4; /* xcdplayer needs these two values */ - u_char ctl :4; - u_char track; - u_char start_msf[3]; -}; - -#define MAX_TRACKS 100 - -struct sony_toc { - u_char session_number; - - u_char :8; - u_char :8; - u_char first_track; - u_char :8; - u_char :8; - - u_char :8; - u_char :8; - u_char last_track; - u_char :8; - u_char :8; - - u_char :8; - u_char :8; - u_char lead_out_start_msf[3]; - - struct sony_tracklist tracks[MAX_TRACKS]; - - /* The rest is just to take space in case all data is returned */ - - u_char dummy[6*9]; -}; - -#endif /* SCD_H */ diff --git a/sys/gnu/misc/aha274x.seq b/sys/gnu/misc/aha274x.seq deleted file mode 100644 index 9b83b84..0000000 --- a/sys/gnu/misc/aha274x.seq +++ /dev/null @@ -1,1064 +0,0 @@ -# @(#)aic7xxx.seq 1.30 94/11/09 jda -# -# Adaptec 274x device driver for Linux. -# Copyright (c) 1994 The University of Calgary Department of Computer Science. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -VERSION AIC7XXX_SEQ_VERSION 1.30 - -MAXSCB-1 = 0xf - -SCSISEQ = 0x00 -SXFRCTL0 = 0x01 -SXFRCTL1 = 0x02 -SCSISIGI = 0x03 -SCSISIGO = 0x03 -SCSIRATE = 0x04 -SCSIID = 0x05 -SCSIDATL = 0x06 -STCNT = 0x08 -STCNT+0 = 0x08 -STCNT+1 = 0x09 -STCNT+2 = 0x0a -SSTAT0 = 0x0b -CLRSINT1 = 0x0c -SSTAT1 = 0x0c -SIMODE1 = 0x11 -SCSIBUSL = 0x12 -SHADDR = 0x14 -SELID = 0x19 -SBLKCTL = 0x1f -SEQCTL = 0x60 -A = 0x64 # == ACCUM -SINDEX = 0x65 -DINDEX = 0x66 -ALLZEROS = 0x6a -NONE = 0x6a -SINDIR = 0x6c -DINDIR = 0x6d -FUNCTION1 = 0x6e -HADDR = 0x88 -HCNT = 0x8c -HCNT+0 = 0x8c -HCNT+1 = 0x8d -HCNT+2 = 0x8e -SCBPTR = 0x90 -INTSTAT = 0x91 -DFCNTRL = 0x93 -DFSTATUS = 0x94 -DFDAT = 0x99 -QINFIFO = 0x9b -QINCNT = 0x9c -QOUTFIFO = 0x9d - -SCSICONF = 0x5a - -# The two reserved bytes at SCBARRAY+1[23] are expected to be set to -# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag -# to indicate whether or not to reload scatter-gather parameters after -# a disconnect. -# -SCBARRAY+0 = 0xa0 -SCBARRAY+1 = 0xa1 -SCBARRAY+2 = 0xa2 -SCBARRAY+3 = 0xa3 -SCBARRAY+7 = 0xa7 -SCBARRAY+11 = 0xab -SCBARRAY+14 = 0xae -SCBARRAY+15 = 0xaf -SCBARRAY+16 = 0xb0 -SCBARRAY+17 = 0xb1 -SCBARRAY+18 = 0xb2 -SCBARRAY+19 = 0xb3 -SCBARRAY+20 = 0xb4 -SCBARRAY+21 = 0xb5 -SCBARRAY+22 = 0xb6 -SCBARRAY+23 = 0xb7 -SCBARRAY+24 = 0xb8 -SCBARRAY+25 = 0xb9 - -SIGNAL_0 = 0x01 # unknown scsi bus phase -SIGNAL_1 = 0x11 # message reject -SIGNAL_2 = 0x21 # no IDENTIFY after reconnect -SIGNAL_3 = 0x31 # no cmd match for reconnect -SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion -STATUS_ERROR = 0x51 - -# The host adapter card (at least the BIOS) uses 20-2f for SCSI -# device information, 32-33 and 5a-5f as well. Since we don't support -# wide or twin-bus SCSI, 28-2f can be reclaimed. As it turns out, the -# BIOS trashes 20-27 anyway, writing the synchronous negotiation results -# on top of the BIOS values, so we re-use those for our per-target -# scratchspace (actually a value that can be copied directly into -# SCSIRATE). This implies, since we can't get the BIOS config values, -# that all targets will be negotiated with for synchronous transfer. -# NEEDSDTR has one bit per target indicating if an SDTR message is -# needed for that device - this will be set initially, as well as -# after a bus reset condition. -# -# The high bit of DROPATN is set if ATN should be dropped before the ACK -# when outb is called. REJBYTE contains the first byte of a MESSAGE IN -# message, so the driver can report an intelligible error if a message is -# rejected. -# -# RESELECT's high bit is true if we are currently handling a reselect; -# its next-highest bit is true ONLY IF we've seen an IDENTIFY message -# from the reselecting target. If we haven't had IDENTIFY, then we have -# no idea what the lun is, and we can't select the right SCB register -# bank, so force a kernel panic if the target attempts a data in/out or -# command phase instead of corrupting something. -# -# Note that SG_NEXT occupies four bytes. -# -SYNCNEG = 0x20 -DISC_DSB_A = 0x32 - -DROPATN = 0x30 -REJBYTE = 0x31 -RESELECT = 0x34 - -MSG_FLAGS = 0x35 -MSG_LEN = 0x36 -MSG_START+0 = 0x37 -MSG_START+1 = 0x38 -MSG_START+2 = 0x39 -MSG_START+3 = 0x3a -MSG_START+4 = 0x3b -MSG_START+5 = 0x3c --MSG_START+0 = 0xc9 # 2's complement of MSG_START+0 - -ARG_1 = 0x4c # sdtr conversion args & return -ARG_2 = 0x4d -RETURN_1 = 0x4c - -SIGSTATE = 0x4e # value written to SCSISIGO -NEEDSDTR = 0x4f # send SDTR message, 1 bit/trgt - -SG_SIZEOF = 0x8 # sizeof(struct scatterlist) -SG_NOLOAD = 0x50 # load SG pointer/length? -SG_COUNT = 0x51 # working value of SG count -SG_NEXT = 0x52 # working value of SG pointer -SG_NEXT+0 = 0x52 -SG_NEXT+1 = 0x53 -SG_NEXT+2 = 0x54 -SG_NEXT+3 = 0x55 - -SCBCOUNT = 0x56 # the actual number of SCBs -ACTIVE_A = 0x57 - -# Poll QINCNT for work - the lower three bits contain -# the number of entries in the Queue In FIFO. -# -start: - test SCSISIGI,0x4 jnz reselect # BSYI - test QINCNT,MAXSCB-1 jz start - -# We have at least one queued SCB now. Set the SCB pointer -# from the FIFO so we see the right bank of SCB registers, -# then set SCSI options and set the initiator and target -# SCSI IDs. -# - mov SCBPTR,QINFIFO - -# See if there is not already an active SCB for this target. This code -# will have to be modified when we add support for dual and wide busses. - - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - test ACTIVE_A,A jz active -# Place the currently active back on the queue for later processing - mov QINFIFO, SCBPTR - jmp start - -# Mark the current target as busy and get working on the SCB -active: - or ACTIVE_A,A - mov SCBARRAY+1 call initialize - clr SG_NOLOAD - clr RESELECT - -# As soon as we get a successful selection, the target should go -# into the message out phase since we have ATN asserted. Prepare -# the message to send, locking out the device driver. If the device -# driver hasn't beaten us with an ABORT or RESET message, then tack -# on a SDTR negotation if required. -# -# Messages are stored in scratch RAM starting with a flag byte (high bit -# set means active message), one length byte, and then the message itself. -# - mov SCBARRAY+1 call disconnect # disconnect ok? - - and SINDEX,0x7,SCBARRAY+1 # lun - or SINDEX,A # return value from disconnect - or SINDEX,0x80 call mk_mesg # IDENTIFY message - - mov A,SINDEX - cmp MSG_START+0,A jne !message # did driver beat us? - mvi MSG_START+1 call mk_sdtr # build SDTR message if needed - -!message: - -# Enable selection phase as an initiator, and do automatic ATN -# after the selection. -# - mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO - -# Wait for successful arbitration. The AIC-7770 documentation says -# that SELINGO indicates successful arbitration, and that it should -# be used to look for SELDO. However, if the sequencer is paused at -# just the right time - a parallel fsck(8) on two drives did it for -# me - then SELINGO can flip back to false before we've seen it. This -# makes the sequencer sit in the arbitration loop forever. This is -# Not Good. -# -# Therefore, I've added a check in the arbitration loop for SELDO -# too. This could arguably be made a critical section by disabling -# pauses, but I don't want to make a potentially infinite loop a CS. -# I suppose you could fold it into the select loop, too, but since -# I've been hunting this bug for four days it's kinda like a trophy. -# -arbitrate: - test SSTAT0,0x40 jnz *select # SELDO - test SSTAT0,0x10 jz arbitrate # SELINGO - -# Wait for a successful selection. If the hardware selection -# timer goes off, then the driver gets the interrupt, so we don't -# need to worry about it. -# -select: - test SSTAT0,0x40 jz select # SELDO - jmp *select - -# Reselection is being initiated by a target - we've seen the BSY -# line driven active, and we didn't do it! Enable the reselection -# hardware, and wait for it to finish. Make a note that we've been -# reselected, but haven't seen an IDENTIFY message from the target -# yet. -# -reselect: - mvi SCSISEQ,0x10 # ENRSELI - -reselect1: - test SSTAT0,0x20 jz reselect1 # SELDI - mov SELID call initialize - - mvi RESELECT,0x80 # reselected, no IDENTIFY - -# After the [re]selection, make sure that the [re]selection enable -# bit is off. This chip is flaky enough without extra things -# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be -# using it shortly. -# -*select: - clr SCSISEQ - mvi CLRSINT1,0x8 # CLRBUSFREE - -# Main loop for information transfer phases. If BSY is false, then -# we have a bus free condition, expected or not. Otherwise, wait -# for the target to assert REQ before checking MSG, C/D and I/O -# for the bus phase. -# -# We can't simply look at the values of SCSISIGI here (if we want -# to do synchronous data transfer), because the target won't assert -# REQ if it's already sent us some data that we haven't acknowledged -# yet. -# -ITloop: - test SSTAT1,0x8 jnz p_busfree # BUSFREE - test SSTAT1,0x1 jz ITloop # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - - cmp ALLZEROS,A je p_dataout - cmp A,0x40 je p_datain - cmp A,0x80 je p_command - cmp A,0xc0 je p_status - cmp A,0xa0 je p_mesgout - cmp A,0xe0 je p_mesgin - - mvi INTSTAT,SIGNAL_0 # unknown - signal driver - -p_dataout: - mvi 0 call scsisig # !CDO|!IOO|!MSGO - call assert - call sg_load - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+23 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy - - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - -# After a DMA finishes, save the final transfer pointer and count -# back into the SCB, in case a device disconnects in the middle of -# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since -# it's a reflection of how many bytes were transferred on the SCSI -# (as opposed to the host) bus. -# - mvi A,3 - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy - - mvi A,4 - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -p_datain: - mvi 0x40 call scsisig # !CDO|IOO|!MSGO - call assert - call sg_load - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+23 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy - - mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN| - # !DIRECTION|FIFORESET - mvi A,3 - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy - - mvi A,4 - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -# Command phase. Set up the DMA registers and let 'er rip - the -# two bytes after the SCB SCSI_cmd_length are zeroed by the driver, -# so we can copy those three bytes directly into HCNT. -# -p_command: - mvi 0x80 call scsisig # CDO|!IOO|!MSGO - call assert - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+11 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+11 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+7 call bcopy - - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - jmp ITloop - -# Status phase. Wait for the data byte to appear, then read it -# and store it into the SCB. -# -p_status: - mvi 0xc0 call scsisig # CDO|IOO|!MSGO - - mvi SCBARRAY+14 call inb - jmp ITloop - -# Message out phase. If there is no active message, but the target -# took us into this phase anyway, build a no-op message and send it. -# -p_mesgout: - mvi 0xa0 call scsisig # CDO|!IOO|MSGO - mvi 0x8 call mk_mesg # build NOP message - -# Set up automatic PIO transfer from MSG_START. Bit 3 in -# SXFRCTL0 (SPIOEN) is already on. -# - mvi SINDEX,MSG_START+0 - mov DINDEX,MSG_LEN - clr A - -# When target asks for a byte, drop ATN if it's the last one in -# the message. Otherwise, keep going until the message is exhausted. -# (We can't use outb for this since it wants the input in SINDEX.) -# -# Keep an eye out for a phase change, in case the target issues -# a MESSAGE REJECT. -# -p_mesgout2: - test SSTAT0,0x2 jz p_mesgout2 # SPIORDY - test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS - - cmp DINDEX,1 jne p_mesgout3 # last byte? - mvi CLRSINT1,0x40 # CLRATNO - drop ATN - -# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically -# send ACKs in automatic PIO or DMA mode unless you make sure that the -# "expected" bus phase in SCSISIGO matches the actual bus phase. This -# behaviour is completely undocumented and caused me several days of -# grief. -# -# After plugging in different drives to test with and using a longer -# SCSI cable, I found that I/O in Automatic PIO mode ceased to function, -# especially when transferring >1 byte. It seems to be much more stable -# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is -# polled for transfer completion - for both output _and_ input. The -# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL -# is accessed (like the documentation says it does), and that on a longer -# cable run, the sequencer code was fast enough to loop back and see -# an SPIORDY that hadn't dropped yet. -# -p_mesgout3: - call one_stcnt - mov SCSIDATL,SINDIR - -p_mesgout4: - test SSTAT0,0x4 jz p_mesgout4 # SDONE - dec DINDEX - inc A - cmp MSG_LEN,A jne p_mesgout2 - -# If the next bus phase after ATN drops is a message out, it means -# that the target is requesting that the last message(s) be resent. -# -p_mesgout5: - test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE - test SSTAT1,0x1 jz p_mesgout5 # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - cmp A,0xa0 jne p_mesgout6 - mvi 0x10 call scsisig # ATNO - re-assert ATN - - jmp ITloop - -p_mesgout6: - mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS - clr MSG_FLAGS # no active msg - jmp ITloop - -# Message in phase. Bytes are read using Automatic PIO mode, but not -# using inb. This alleviates a race condition, namely that if ATN had -# to be asserted under Automatic PIO mode, it had to beat the SCSI -# circuitry sending an ACK to the target. This showed up under heavy -# loads and really confused things, since ABORT commands wouldn't be -# seen by the drive after an IDENTIFY message in until it had changed -# to a data I/O phase. -# -p_mesgin: - mvi 0xe0 call scsisig # CDO|IOO|MSGO - mvi A call inb_first # read the 1st message byte - mvi REJBYTE,A # save it for the driver - - cmp ALLZEROS,A jne p_mesgin1 - -# We got a "command complete" message, so put the SCB pointer -# into the Queue Out, and trigger a completion interrupt. -# Check status for non zero return and interrupt driver if needed -# This allows the driver to do a sense command to find out the -# source of error. We don't bother to post to the QOUTFIFO in -# the error case since it would require extra work in the kernel -# driver to ensure that the entry was removed before the command -# complete code tried processing it. - -# First, mark this target as free. - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - xor ACTIVE_A,A - - test SCBARRAY+14,0xff jz status_ok # 0 Status? - call inb_last # ack & turn auto PIO back on - mvi INTSTAT,STATUS_ERROR # let driver know - jmp ITloop -status_ok: - mov QOUTFIFO,SCBPTR - mvi INTSTAT,0x2 # CMDCMPLT - jmp p_mesgin_done - -# Is it an extended message? We only support the synchronous data -# transfer request message, which will probably be in response to -# an SDTR message out from us. If it's not an SDTR, reject it - -# apparently this can be done after any message in byte, according -# to the SCSI-2 spec. -# -# XXX - we should really reject this if we didn't initiate the SDTR -# negotiation; this may cause problems with unusual devices. -# -p_mesgin1: - cmp A,1 jne p_mesgin2 # extended message code? - - mvi A call inb_next - cmp A,3 jne p_mesginN # extended mesg length = 3 - mvi A call inb_next - cmp A,1 jne p_mesginN # SDTR code - - mvi ARG_1 call inb_next # xfer period - mvi ARG_2 call inb_next # REQ/ACK offset - mvi INTSTAT,SIGNAL_4 # call driver to convert - - call ndx_sdtr # index sync config for target - mov DINDEX,SINDEX - mov DINDIR,RETURN_1 # save returned value - - not A # turn off "need sdtr" flag - and NEEDSDTR,A - -# Even though the SCSI-2 specification says that a device responding -# to our SDTR message should honor our parameters for transmitting -# to us, it doesn't seem to work too well in real life. In particular, -# a lot of CD-ROM and tape units don't function: try using the SDTR -# parameters the device sent us for both transmitting and receiving. -# - mov SCSIRATE,RETURN_1 - jmp p_mesgin_done - -# Is it a disconnect message? Set a flag in the SCB to remind us -# and await the bus going free. -# -p_mesgin2: - cmp A,4 jne p_mesgin3 # disconnect code? - - or SCBARRAY+0,0x4 # set "disconnected" bit - jmp p_mesgin_done - -# Save data pointers message? Copy working values into the SCB, -# usually in preparation for a disconnect. -# -p_mesgin3: - cmp A,2 jne p_mesgin4 # save data pointers code? - - call sg_ram2scb - jmp p_mesgin_done - -# Restore pointers message? Data pointers are recopied from the -# SCB anyway at the start of any DMA operation, so the only thing -# to copy is the scatter-gather values. -# -p_mesgin4: - cmp A,3 jne p_mesgin5 # restore pointers code? - - call sg_scb2ram - jmp p_mesgin_done - -# Identify message? For a reconnecting target, this tells us the lun -# that the reconnection is for - find the correct SCB and switch to it, -# clearing the "disconnected" bit so we don't "find" it by accident later. -# -p_mesgin5: - test A,0x80 jz p_mesgin6 # identify message? - - test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved - - mov A call findSCB # switch to correct SCB - -# If a active message is present after calling findSCB, then either it -# or the driver is trying to abort the command. Either way, something -# untoward has happened and we should just leave it alone. -# - test MSG_FLAGS,0x80 jnz p_mesgin_done - - xor SCBARRAY+0,0x4 # clear disconnect bit in SCB - mvi RESELECT,0xc0 # make note of IDENTIFY - - call sg_scb2ram # implied restore pointers - # required on reselect - jmp p_mesgin_done - -# Message reject? If we have an outstanding SDTR negotiation, assume -# that it's a response from the target selecting asynchronous transfer, -# otherwise just ignore it since we have no clue what it pertains to. -# -# XXX - I don't have a device that responds this way. Does this code -# actually work? -# -p_mesgin6: - cmp A,7 jne p_mesgin7 # message reject code? - - and FUNCTION1,0x70,SCSIID # outstanding SDTR message? - mov A,FUNCTION1 - test NEEDSDTR,A jz p_mesgin_done # no - ignore rejection - - call ndx_sdtr # note use of asynch xfer - mov DINDEX,SINDEX - clr DINDIR - - not A # turn off "active sdtr" flag - and NEEDSDTR,A - - clr SCSIRATE # select asynch xfer - jmp p_mesgin_done - -# [ ADD MORE MESSAGE HANDLING HERE ] -# -p_mesgin7: - -# We have no idea what this message in is, and there's no way -# to pass it up to the kernel, so we issue a message reject and -# hope for the best. Since we're now using manual PIO mode to -# read in the message, there should no longer be a race condition -# present when we assert ATN. In any case, rejection should be a -# rare occurrence - signal the driver when it happens. -# -p_mesginN: - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - mvi INTSTAT,SIGNAL_1 # let driver know - - mvi 0x7 call mk_mesg # MESSAGE REJECT message - -p_mesgin_done: - call inb_last # ack & turn auto PIO back on - jmp ITloop - -# Bus free phase. It might be useful to interrupt the device -# driver if we aren't expecting this. For now, make sure that -# ATN isn't being asserted and look for a new command. -# -p_busfree: - mvi CLRSINT1,0x40 # CLRATNO - clr SIGSTATE - jmp start - -# Bcopy: number of bytes to transfer should be in A, DINDEX should -# contain the destination address, and SINDEX should contain the -# source address. All input parameters are trashed on return. -# -bcopy: - mov DINDIR,SINDIR - dec A - cmp ALLZEROS,A jne bcopy - ret - -# Locking the driver out, build a one-byte message passed in SINDEX -# if there is no active message already. SINDEX is returned intact. -# -mk_mesg: - mvi SEQCTL,0x40 # PAUSEDIS - test MSG_FLAGS,0x80 jnz mk_mesg1 # active message? - - mvi MSG_FLAGS,0x80 # if not, there is now - mvi MSG_LEN,1 # length = 1 - mov MSG_START+0,SINDEX # 1-byte message - -mk_mesg1: - clr SEQCTL # !PAUSEDIS - ret - -# Input byte in Automatic PIO mode. The address to store the byte -# in should be in SINDEX. DINDEX will be used by this routine. -# -inb: - test SSTAT0,0x2 jz inb # SPIORDY - mov DINDEX,SINDEX - call one_stcnt # xfer one byte - mov DINDIR,SCSIDATL -inb1: - test SSTAT0,0x4 jz inb1 # SDONE - wait to "finish" - ret - -# Carefully read data in Automatic PIO mode. I first tried this using -# Manual PIO mode, but it gave me continual underrun errors, probably -# indicating that I did something wrong, but I feel more secure leaving -# Automatic PIO on all the time. -# -# According to Adaptec's documentation, an ACK is not sent on input from -# the target until SCSIDATL is read from. So we wait until SCSIDATL is -# latched (the usual way), then read the data byte directly off the bus -# using SCSIBUSL. When we have pulled the ATN line, or we just want to -# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI -# spec guarantees that the target will hold the data byte on the bus until -# we send our ACK. -# -# The assumption here is that these are called in a particular sequence, -# and that REQ is already set when inb_first is called. inb_{first,next} -# use the same calling convention as inb. -# -inb_first: - mov DINDEX,SINDEX - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_next: - mov DINDEX,SINDEX # save SINDEX - - call one_stcnt # xfer one byte - mov NONE,SCSIDATL # dummy read from latch to ACK -inb_next1: - test SSTAT0,0x4 jz inb_next1 # SDONE -inb_next2: - test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_last: - call one_stcnt # ACK with dummy read - mov NONE,SCSIDATL -inb_last1: - test SSTAT0,0x4 jz inb_last1 # wait for completion - ret - -# Output byte in Automatic PIO mode. The byte to output should be -# in SINDEX. If DROPATN's high bit is set, then ATN will be dropped -# before the byte is output. -# -outb: - test SSTAT0,0x2 jz outb # SPIORDY - call one_stcnt # xfer one byte - - test DROPATN,0x80 jz outb1 - mvi CLRSINT1,0x40 # CLRATNO - clr DROPATN -outb1: - mov SCSIDATL,SINDEX -outb2: - test SSTAT0,0x4 jz outb2 # SDONE - ret - -# Write the value "1" into the STCNT registers, for Automatic PIO -# transfers. -# -one_stcnt: - clr STCNT+2 - clr STCNT+1 - mvi STCNT+0,1 ret - -# DMA data transfer. HADDR and HCNT must be loaded first, and -# SINDEX should contain the value to load DFCNTRL with - 0x3d for -# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared -# during initialization. -# -dma: - mov DFCNTRL,SINDEX -dma1: -dma2: - test SSTAT0,0x1 jnz dma3 # DMADONE - test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun - -# We will be "done" DMAing when the transfer count goes to zero, or -# the target changes the phase (in light of this, it makes sense that -# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are -# doing a SCSI->Host transfer, flush the data FIFO. -# -dma3: - test SINDEX,0x4 jnz dma5 # DIRECTION - and SINDEX,0xfe # mask out FIFORESET - or DFCNTRL,0x2,SINDEX # FIFOFLUSH -dma4: - test DFCNTRL,0x2 jnz dma4 # FIFOFLUSHACK - -# Now shut the DMA enables off, and copy STCNT (ie. the underrun -# amount, if any) to the SCB registers; SG_COUNT will get copied to -# the SCB's residual S/G count field after sg_advance is called. Make -# sure that the DMA enables are actually off first lest we get an ILLSADDR. -# -dma5: - clr DFCNTRL # disable DMA -dma6: - test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK - - mvi A,3 - mvi DINDEX,SCBARRAY+15 - mvi STCNT call bcopy - - ret - -# Common SCSI initialization for selection and reselection. Expects -# the target SCSI ID to be in the upper four bits of SINDEX, and A's -# contents are stomped on return. -# -initialize: - clr SBLKCTL # channel A, !wide - and SCSIID,0xf0,SINDEX # target ID - and A,0x7,SCSICONF # SCSI_ID_A[210] - or SCSIID,A - -# Esundry initialization. -# - clr DROPATN - clr SIGSTATE - -# Turn on Automatic PIO mode now, before we expect to see an REQ -# from the target. It shouldn't hurt anything to leave it on. Set -# CLRCHN here before the target has entered a data transfer mode - -# with synchronous SCSI, if you do it later, you blow away some -# data in the SCSI FIFO that the target has already sent to you. -# - mvi SXFRCTL0,0xa # SPIOEN|CLRCHN - -# Set SCSI bus parity checking and the selection timeout value, -# and enable the hardware selection timer. Set the SELTO interrupt -# to signal the driver. -# - and A,0x38,SCSICONF # PARITY_ENB_A|SEL_TIM_A[10] - or SXFRCTL1,0x4,A # ENSTIMER - mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR - -# Initialize scatter-gather pointers by setting up the working copy -# in scratch RAM. -# - call sg_scb2ram - -# Initialize SCSIRATE with the appropriate value for this target. -# - call ndx_sdtr - mov SCSIRATE,SINDIR - ret - -# Assert that if we've been reselected, then we've seen an IDENTIFY -# message. -# -assert: - test RESELECT,0x80 jz assert1 # reselected? - test RESELECT,0x40 jnz assert1 # seen IDENTIFY? - - mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic - -assert1: - ret - -# Find out if disconnection is ok from the information the BIOS has left -# us. The target ID should be in the upper four bits of SINDEX; A will -# contain either 0x40 (disconnection ok) or 0x00 (diconnection not ok) -# on exit. -# -# This is the only place the target ID is limited to three bits, so we -# can use the FUNCTION1 register. -# -disconnect: - and FUNCTION1,0x70,SINDEX # strip off extra just in case - mov A,FUNCTION1 - test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled - - clr A ret -disconnect1: - mvi A,0x40 ret - -# Locate the SCB matching the target ID in SELID and the lun in the lower -# three bits of SINDEX, and switch the SCB to it. Have the kernel print -# a warning message if it can't be found, and generate an ABORT message -# to the target. We keep the value of the t/c/l that we are trying to -# in DINDEX so it is not overwritten during our check to see if we are -# at the last SCB. -# -findSCB: - and A,0x7,SINDEX # lun in lower three bits - or DINDEX,A,SELID # can I do this? - and DINDEX,0xf7 # only channel A implemented - - clr SINDEX - -findSCB1: - mov SCBPTR,SINDEX # switch to new SCB - mov A,DINDEX - cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match? - test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected - - ret - -findSCB2: - inc SINDEX - mov A,SCBCOUNT - cmp SINDEX,A jne findSCB1 - - mvi INTSTAT,SIGNAL_3 # not found - signal kernel - mvi 0x6 call mk_mesg # ABORT message - - or SINDEX,0x10,SIGSTATE # assert ATNO - call scsisig - ret - -# Make a working copy of the scatter-gather parameters in the SCB. -# -sg_scb2ram: - mov SG_COUNT,SCBARRAY+2 - - mvi A,4 - mvi DINDEX,SG_NEXT - mvi SCBARRAY+3 call bcopy - - mvi SG_NOLOAD,0x80 - test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g? - clr SG_NOLOAD - -sg_scb2ram1: - ret - -# Copying RAM values back to SCB, for Save Data Pointers message. -# -sg_ram2scb: - mov SCBARRAY+2,SG_COUNT - - mvi A,4 - mvi DINDEX,SCBARRAY+3 - mvi SG_NEXT call bcopy - - and SCBARRAY+0,0xef,SCBARRAY+0 - test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g? - or SCBARRAY+0,0x10 - -sg_ram2scb1: - ret - -# Load a struct scatter if needed and set up the data address and -# length. If the working value of the SG count is nonzero, then -# we need to load a new set of values. -# -# This, like the above DMA, assumes a little-endian host data storage. -# -sg_load: - test SG_COUNT,0xff jz sg_load3 # SG being used? - test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g? - - clr HCNT+2 - clr HCNT+1 - mvi HCNT+0,SG_SIZEOF - - mvi A,4 - mvi DINDEX,HADDR - mvi SG_NEXT call bcopy - - mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET - -# Wait for DMA from host memory to data FIFO to complete, then disable -# DMA and wait for it to acknowledge that it's off. -# -sg_load1: - test DFSTATUS,0x8 jz sg_load1 # HDONE - - clr DFCNTRL # disable DMA -sg_load2: - test DFCNTRL,0x8 jnz sg_load2 # HDMAENACK - -# Copy data from FIFO into SCB data pointer and data count. This assumes -# that the struct scatterlist has this structure (this and sizeof(struct -# scatterlist) == 12 are asserted in aic7xxx.c): -# -# struct scatterlist { -# char *address; /* four bytes, little-endian order */ -# ... /* four bytes, ignored */ -# unsigned short length; /* two bytes, little-endian order */ -# } -# - -# Not in FreeBSD. the scatter list is only 8 bytes. -# -# struct ahc_dma_seg { -# physaddr addr; /* four bytes, little-endian order */ -# long len; /* four bytes, little endian order */ -# }; -# - - mov SCBARRAY+19,DFDAT # new data address - mov SCBARRAY+20,DFDAT - mov SCBARRAY+21,DFDAT - mov SCBARRAY+22,DFDAT - - mov SCBARRAY+23,DFDAT - mov SCBARRAY+24,DFDAT - mov SCBARRAY+25,DFDAT - mov NONE,DFDAT #Only support 24 bit length. - -sg_load3: - ret - -# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled, -# and the SCSI transfer count is zero (note that this should be called -# right after a DMA finishes), then move the working copies of the SG -# pointer/length along. If the SCSI transfer count is not zero, then -# presumably the target is disconnecting - do not reload the SG values -# next time. -# -sg_advance: - test SG_COUNT,0xff jz sg_advance2 # s/g enabled? - - test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero? - test STCNT+1,0xff jnz sg_advance1 - test STCNT+2,0xff jnz sg_advance1 - - clr SG_NOLOAD # reload s/g next time - dec SG_COUNT # one less segment to go - - clr A # add sizeof(struct scatter) - add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0 - adc SG_NEXT+1,A,SG_NEXT+1 - adc SG_NEXT+2,A,SG_NEXT+2 - adc SG_NEXT+3,A,SG_NEXT+3 - - ret - -sg_advance1: - mvi SG_NOLOAD,0x80 # don't reload s/g next time -sg_advance2: - ret - -# Add the array base SYNCNEG to the target offset (the target address -# is in SCSIID), and return the result in SINDEX. The accumulator -# contains the 3->8 decoding of the target ID on return. -# -ndx_sdtr: - shr A,SCSIID,4 - and A,0x7 - add SINDEX,SYNCNEG,A - - and FUNCTION1,0x70,SCSIID # 3-bit target address decode - mov A,FUNCTION1 ret - -# If we need to negotiate transfer parameters, build the SDTR message -# starting at the address passed in SINDEX. DINDEX is modified on return. -# -mk_sdtr: - mov DINDEX,SINDEX # save SINDEX - - call ndx_sdtr - test NEEDSDTR,A jnz mk_sdtr1 # do we need negotiation? - ret - -mk_sdtr1: - mvi DINDIR,1 # extended message - mvi DINDIR,3 # extended message length = 3 - mvi DINDIR,1 # SDTR code - mvi DINDIR,25 # REQ/ACK transfer period - mvi DINDIR,15 # REQ/ACK offset - - add MSG_LEN,-MSG_START+0,DINDEX # update message length - ret - -# Set SCSI bus control signal state. This also saves the last-written -# value into a location where the higher-level driver can read it - if -# it has to send an ABORT or RESET message, then it needs to know this -# so it can assert ATN without upsetting SCSISIGO. The new value is -# expected in SINDEX. Change the actual state last to avoid contention -# from the driver. -# -scsisig: - mov SIGSTATE,SINDEX - mov SCSISIGO,SINDEX ret - diff --git a/sys/gnu/misc/aha274x_seq.c b/sys/gnu/misc/aha274x_seq.c deleted file mode 100644 index 46bb647..0000000 --- a/sys/gnu/misc/aha274x_seq.c +++ /dev/null @@ -1,355 +0,0 @@ -#define AIC7XXX_SEQ_VERSION "1.30" -unsigned char seqprog[] = { - 0x04, 0x03, 0x18, 0x1a, - 0x0f, 0x9c, 0x00, 0x1e, - 0xff, 0x9b, 0x90, 0x02, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x08, 0x1e, - 0xff, 0x90, 0x9b, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0x00, 0x57, 0x57, 0x00, - 0x00, 0xa1, 0xf3, 0x16, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x34, 0x02, - 0x00, 0xa1, 0x05, 0x17, - 0x07, 0xa1, 0x65, 0x02, - 0x00, 0x65, 0x65, 0x00, - 0x80, 0x65, 0xc2, 0x16, - 0xff, 0x65, 0x64, 0x02, - 0x00, 0x37, 0x13, 0x18, - 0x38, 0x6a, 0x53, 0x17, - 0x48, 0x6a, 0x00, 0x00, - 0x40, 0x0b, 0x1c, 0x1a, - 0x10, 0x0b, 0x14, 0x1e, - 0x40, 0x0b, 0x16, 0x1e, - 0x00, 0x65, 0x1c, 0x10, - 0x10, 0x6a, 0x00, 0x00, - 0x20, 0x0b, 0x19, 0x1e, - 0x00, 0x19, 0xf3, 0x16, - 0x80, 0x6a, 0x34, 0x00, - 0xff, 0x6a, 0x00, 0x02, - 0x08, 0x6a, 0x0c, 0x00, - 0x08, 0x0c, 0xbb, 0x1a, - 0x01, 0x0c, 0x1e, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0x00, 0x6a, 0x28, 0x1c, - 0x40, 0x64, 0x3e, 0x1c, - 0x80, 0x64, 0x54, 0x1c, - 0xc0, 0x64, 0x61, 0x1c, - 0xa0, 0x64, 0x64, 0x1c, - 0xe0, 0x64, 0x7c, 0x1c, - 0x01, 0x6a, 0x91, 0x00, - 0x00, 0x6a, 0x5e, 0x17, - 0x00, 0x65, 0x01, 0x17, - 0x00, 0x65, 0x2b, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x40, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x5e, 0x17, - 0x00, 0x65, 0x01, 0x17, - 0x00, 0x65, 0x2b, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x39, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x40, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x80, 0x6a, 0x5e, 0x17, - 0x00, 0x65, 0x01, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xa7, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xc0, 0x6a, 0x5e, 0x17, - 0xae, 0x6a, 0xc9, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xa0, 0x6a, 0x5e, 0x17, - 0x08, 0x6a, 0xc2, 0x16, - 0x37, 0x6a, 0x65, 0x00, - 0xff, 0x36, 0x66, 0x02, - 0xff, 0x6a, 0x64, 0x02, - 0x02, 0x0b, 0x69, 0x1e, - 0x10, 0x0c, 0x79, 0x1a, - 0x01, 0x66, 0x6d, 0x18, - 0x40, 0x6a, 0x0c, 0x00, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x6c, 0x06, 0x02, - 0x04, 0x0b, 0x6f, 0x1e, - 0xff, 0x66, 0x66, 0x06, - 0x01, 0x64, 0x64, 0x06, - 0x00, 0x36, 0x69, 0x18, - 0x08, 0x0c, 0x79, 0x1a, - 0x01, 0x0c, 0x73, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0xa0, 0x64, 0x79, 0x18, - 0x10, 0x6a, 0x5e, 0x17, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x35, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0xe0, 0x6a, 0x5e, 0x17, - 0x64, 0x6a, 0xcf, 0x16, - 0x00, 0x6a, 0x31, 0x00, - 0x00, 0x6a, 0x8a, 0x18, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x57, 0x04, - 0xff, 0xae, 0x87, 0x1e, - 0x00, 0x65, 0xd7, 0x16, - 0x51, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x1e, 0x10, - 0xff, 0x90, 0x9d, 0x02, - 0x02, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x01, 0x64, 0x99, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x03, 0x64, 0xb5, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x01, 0x64, 0xb5, 0x18, - 0x4c, 0x6a, 0xd1, 0x16, - 0x4d, 0x6a, 0xd1, 0x16, - 0x41, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x4e, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x4c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x4c, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x04, 0x64, 0x9c, 0x18, - 0x04, 0xa0, 0xa0, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x02, 0x64, 0x9f, 0x18, - 0x00, 0x65, 0x23, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x03, 0x64, 0xa2, 0x18, - 0x00, 0x65, 0x1b, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x80, 0x64, 0xaa, 0x1e, - 0x78, 0x64, 0xb5, 0x1a, - 0x00, 0x64, 0x0a, 0x17, - 0x80, 0x35, 0xb9, 0x1a, - 0x04, 0xa0, 0xa0, 0x04, - 0xc0, 0x6a, 0x34, 0x00, - 0x00, 0x65, 0x1b, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x07, 0x64, 0xb5, 0x18, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x4f, 0xb9, 0x1e, - 0x00, 0x65, 0x4e, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x6a, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x6a, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5e, 0x17, - 0x11, 0x6a, 0x91, 0x00, - 0x07, 0x6a, 0xc2, 0x16, - 0x00, 0x65, 0xd7, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x4e, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0xff, 0x6c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x06, - 0x00, 0x6a, 0xbe, 0x18, - 0xff, 0x6a, 0x6a, 0x03, - 0x40, 0x6a, 0x60, 0x00, - 0x80, 0x35, 0xc7, 0x1a, - 0x80, 0x6a, 0x35, 0x00, - 0x01, 0x6a, 0x36, 0x00, - 0xff, 0x65, 0x37, 0x02, - 0xff, 0x6a, 0x60, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xc9, 0x1e, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6d, 0x02, - 0x04, 0x0b, 0xcd, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x12, 0x6d, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd4, 0x1e, - 0x02, 0x0b, 0xd5, 0x1e, - 0xff, 0x12, 0x6d, 0x03, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd9, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xdb, 0x1e, - 0x00, 0x65, 0xe3, 0x16, - 0x80, 0x30, 0xe0, 0x1e, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x65, 0x06, 0x02, - 0x04, 0x0b, 0xe1, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x0a, 0x02, - 0xff, 0x6a, 0x09, 0x02, - 0x01, 0x6a, 0x08, 0x01, - 0xff, 0x65, 0x93, 0x02, - 0x01, 0x0b, 0xe9, 0x1a, - 0x10, 0x0c, 0xe7, 0x1e, - 0x04, 0x65, 0xed, 0x1a, - 0xfe, 0x65, 0x65, 0x02, - 0x02, 0x65, 0x93, 0x00, - 0x02, 0x93, 0xec, 0x1a, - 0xff, 0x6a, 0x93, 0x02, - 0x38, 0x93, 0xee, 0x1a, - 0x03, 0x6a, 0x64, 0x00, - 0xaf, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x1f, 0x02, - 0xf0, 0x65, 0x05, 0x02, - 0x07, 0x5a, 0x64, 0x02, - 0x00, 0x05, 0x05, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x6a, 0x4e, 0x02, - 0x0a, 0x6a, 0x01, 0x00, - 0x38, 0x5a, 0x64, 0x02, - 0x04, 0x64, 0x02, 0x00, - 0x84, 0x6a, 0x11, 0x00, - 0x00, 0x65, 0x1b, 0x17, - 0x00, 0x65, 0x4e, 0x17, - 0xff, 0x6c, 0x04, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x34, 0x04, 0x1f, - 0x40, 0x34, 0x04, 0x1b, - 0x21, 0x6a, 0x91, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x70, 0x65, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x32, 0x09, 0x1f, - 0xff, 0x6a, 0x64, 0x03, - 0x40, 0x6a, 0x64, 0x01, - 0x07, 0x65, 0x64, 0x02, - 0x00, 0x19, 0x66, 0x00, - 0xf7, 0x66, 0x66, 0x02, - 0xff, 0x6a, 0x65, 0x02, - 0xff, 0x65, 0x90, 0x02, - 0xff, 0x66, 0x64, 0x02, - 0x00, 0xa1, 0x13, 0x19, - 0x04, 0xa0, 0x13, 0x1f, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x65, 0x65, 0x06, - 0xff, 0x56, 0x64, 0x02, - 0x00, 0x65, 0x0e, 0x19, - 0x31, 0x6a, 0x91, 0x00, - 0x06, 0x6a, 0xc2, 0x16, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5e, 0x17, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0xa2, 0x51, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0x52, 0x6a, 0x66, 0x00, - 0xa3, 0x6a, 0xbe, 0x16, - 0x80, 0x6a, 0x50, 0x00, - 0x10, 0xa0, 0x22, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0xa2, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0xa3, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0xef, 0xa0, 0xa0, 0x02, - 0x80, 0x50, 0x2a, 0x1f, - 0x10, 0xa0, 0xa0, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x3f, 0x1f, - 0x80, 0x50, 0x3f, 0x1b, - 0xff, 0x6a, 0x8e, 0x02, - 0xff, 0x6a, 0x8d, 0x02, - 0x08, 0x6a, 0x8c, 0x00, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0x0d, 0x6a, 0x93, 0x00, - 0x08, 0x94, 0x34, 0x1f, - 0xff, 0x6a, 0x93, 0x02, - 0x08, 0x93, 0x36, 0x1b, - 0xff, 0x99, 0xb3, 0x02, - 0xff, 0x99, 0xb4, 0x02, - 0xff, 0x99, 0xb5, 0x02, - 0xff, 0x99, 0xb6, 0x02, - 0xff, 0x99, 0xb7, 0x02, - 0xff, 0x99, 0xb8, 0x02, - 0xff, 0x99, 0xb9, 0x02, - 0xff, 0x99, 0x6a, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x4d, 0x1f, - 0xff, 0x08, 0x4c, 0x1b, - 0xff, 0x09, 0x4c, 0x1b, - 0xff, 0x0a, 0x4c, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x51, 0x51, 0x06, - 0xff, 0x6a, 0x64, 0x02, - 0x08, 0x52, 0x52, 0x06, - 0x00, 0x53, 0x53, 0x08, - 0x00, 0x54, 0x54, 0x08, - 0x00, 0x55, 0x55, 0x08, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x6a, 0x50, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x4c, 0x05, 0x64, 0x0a, - 0x07, 0x64, 0x64, 0x02, - 0x20, 0x64, 0x65, 0x06, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0x4e, 0x17, - 0x00, 0x4f, 0x57, 0x1b, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x6a, 0x6d, 0x00, - 0x03, 0x6a, 0x6d, 0x00, - 0x01, 0x6a, 0x6d, 0x00, - 0x19, 0x6a, 0x6d, 0x00, - 0x0f, 0x6a, 0x6d, 0x00, - 0xc9, 0x66, 0x36, 0x06, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x4e, 0x02, - 0xff, 0x65, 0x03, 0x03, -}; diff --git a/sys/gnu/misc/aic7770/COPYING b/sys/gnu/misc/aic7770/COPYING deleted file mode 100644 index a43ea21..0000000 --- a/sys/gnu/misc/aic7770/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/sys/gnu/misc/aic7770/COPYRIGHT b/sys/gnu/misc/aic7770/COPYRIGHT deleted file mode 100644 index 905285d..0000000 --- a/sys/gnu/misc/aic7770/COPYRIGHT +++ /dev/null @@ -1,16 +0,0 @@ -Adaptec 274x device driver for Linux. -Copyright (c) 1994 The University of Calgary Department of Computer Science. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/sys/gnu/misc/aic7770/README b/sys/gnu/misc/aic7770/README deleted file mode 100644 index 1e4e5a0..0000000 --- a/sys/gnu/misc/aic7770/README +++ /dev/null @@ -1,94 +0,0 @@ -@(#)README 1.16 94/11/09 jda - -AHA274x/284x DRIVER - -*** THIS SHOULD BE CONSIDERED BETA SOFTWARE *** - -BACKGROUND & LIMITATIONS - -For various reasons, we ended up with one of these cards under the -impression that support was soon forthcoming. In mid-May, I asked -Scott Ferris (the official person who's supposed to be writing this -driver) what documentation he used, _finally_ got it from Adaptec, -and started writing this driver. It is now at what I would consider -a stable state - it runs our news server and is battered by SCSI -requests 24 hours a day without dying. There are a few devices it -reportedly doesn't like working with - those are being sorted out. Due -to some unexpected equipment loans, I am able to support this at least -for the time being. - -YOU MUST HAVE THE BIOS ENABLED OR THIS WILL NOT WORK. The BIOS extracts -some configuration information that I cannot get to portably yet, as -well as provides some self-tests which this driver does not attempt to -duplicate. - -Scott's driver development is stalled for now, and after discussions -with him, this is now officially out of "pre-alpha" status and into -beta until the remaining device problems can be resolved. The latest -patches can be obtained via anonymous ftp from ftp.cpsc.ucalgary.ca in -/pub/systems/linux/aha274x. - -It supports both EISA 274x and VL-bus 284x, either single or twin-bus cards -(but not the second SCSI bus of twin cards - see aha274x.c), and supports -disconnection, synchronous SCSI, and scatter-gather. Unlike previous -versions, abort() and reset() are now implemented, and both hosts.c and -aha274x.c should give a clean compile. Code is now present to detect parity -errors, but has not been tested. - -I wrote this using a 1.0.9 kernel. Unfortunately, I'm getting tired of -#ifdef'ing everything to handle two or three different evolutionary steps -in the SCSI kernel code, so I've upgraded my system to 1.1.49, and will -only leave in code to support versions from about 1.1.45 onward. - -Thanks to patches supplied by Mark Olson <molson@tricord.com>, this driver -will now work with the 284x series (the VL-bus version of this card). The -294x (PCI-bus) support is based on patches sent to me by Mark Olson and -Alan Hourihane <alanh@fairlite.demon.co.uk>. - -Under protest, this driver is subject to the GPL - see the file -COPYING for details. - -Thanks to the following people for bug fixes/code improvements (also -thanks to the people who have sent me feedback): - - "David F. Carlson" <dave@ee.rochester.edu> - Jimen Ching <jiching@wiliki.eng.hawaii.edu> - mday@artisoft.com (Matt Day) - "Dean W. Gehnert" <deang@ims.com> - Darcy Grant <darcy@cpsc.ucalgary.ca> - Alan Hourihane <alanh@fairlite.demon.co.uk> - isely@fncrd8.fnal.gov (Mike Isely) - Mike Jerger <jerger@ux1.cso.uiuc.edu> - tm@netcom.com (Toshiyasu Morita) - neal@interact.org (Neal Norwitz) - Mark Olson <molson@tricord.com> - map@europa.ecn.uoknor.edu (Michael A. Parker) - Thomas Scheunemann <thomas@dagobert.uni-duisburg.de> - -Special thanks to Drew Eckhardt <drew@kinglear.cs.Colorado.EDU> for -fielding my questions about synchronous negotiation. Steffen Moeller -<smoe0024@rz.uni-hildesheim.de> sent me installation instructions which -were previously included in this README. - -David Pirie <pirie@cpsc.ucalgary.ca> was nice enough to loan me his -2842 card for a week so I could track down one bug, as well as his -CD-ROM drive later, and also thanks to Doug Fortune at Riley's Data Share -in Calgary, who arranged a long-term loan of a 2842 board for further work. - -Many thanks to the fearless prerelease testers! Dean Gehnert has been -building Slackware boot disks for the driver, which are available from -ftp.cpsc.ucalgary.ca in /pub/systems/linux/aha274x/slackware_boot. - -Carl Riches <cgr@poplar1.cfr.washington.edu> has set up a mailing list -for aic7xxx driver development. To subscribe, send a message to -aic7770-list@poplar1.cfr.washington.edu with a message body of: - - subscribe AIC7770-LIST <your name here, without the angle brackets> - -Please direct questions and discussions to that list instead of me. When -sending bug reports, please include a description of your hardware, the -release numbers displayed by the driver at boot time, and as accurate a -facsimilie of any error message you're mailing about. - -John Aycock -aycock@cpsc.ucalgary.ca diff --git a/sys/gnu/misc/aic7770/README-FIRST b/sys/gnu/misc/aic7770/README-FIRST deleted file mode 100644 index 056dbc8..0000000 --- a/sys/gnu/misc/aic7770/README-FIRST +++ /dev/null @@ -1,19 +0,0 @@ -This is VERY MUCH ALPHA SOFTWARE. You MUST know what you're doing to -use this, or else!!! - -Ok, everything's been renamed to reference an "aic7xxx" driver instead -of "aha274x", and a merger of the two PCI patches I had has been put in, -along with re-doing the detection and configuration routines. To summarize -the status: it compiles cleanly. I don't expect it to work off the bat, -but it's for the 294x development people to synchronize their code -together. - -The file scsi-diffs-1.1.59 is NOT a proper patch file, but some diffs -to kernel files concatenated together. I've sent these off to Drew, -but if you're testing this you'll have to apply them - it allows a -per-driver-instance can_queue variable, which for the aic7xxx driver -is the number of SCBs the card supports. - -Good luck! I await your comments.. Mark, Alan - let me know where I -broke it, please ;-) -:ja diff --git a/sys/gnu/misc/aic7770/aic7770.1 b/sys/gnu/misc/aic7770/aic7770.1 deleted file mode 100644 index 2009f8c..0000000 --- a/sys/gnu/misc/aic7770/aic7770.1 +++ /dev/null @@ -1,54 +0,0 @@ -.\" Copyright (c) 1994 -.\" Justin T. Gibbs. 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 Justin T. Gibbs. -.\" 4. The name of Justin T. Gibbs may not be used to endorse or promote -.\" products derived from this software without specific prior written -.\" permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY JUSTIN T. GIBBS ``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. -.\" -.\" @(#)aic7770.1 11/15/94 -.\" -.Dd November 11, 1994 -.Dt AIC7770 1 -.Os BSD 4 -.Sh NAME -.Nm aic7770 -.Nd aic7770 SCSI controller assembler -.Sh SYNOPSIS -.Nm aic7770 -.Op Fl o destination -.Ar source-file -.Sh DESCRIPTION -.Ar Source-file -is a file containing Aic7770 compatible assembly code. The output of the -assembler defaults to -.Ar a.out -but can be optionally redirected to -.Ar destination. -.Pp -.Sh AUTHOR -This aic7770 compiler was written by John Aycock (aycock@cpsc.ucalgary.ca) and -is subject to the GNU Public License. - diff --git a/sys/gnu/misc/aic7770/aic7770.c b/sys/gnu/misc/aic7770/aic7770.c deleted file mode 100644 index 417a352..0000000 --- a/sys/gnu/misc/aic7770/aic7770.c +++ /dev/null @@ -1,584 +0,0 @@ -/* - * Adaptec 274x device driver for Linux. - * Copyright (c) 1994 The University of Calgary Department of Computer Science. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * Comments are started by `#' and continue to the end of the line; lines - * may be of the form: - * - * <label>* - * <label>* <undef-sym> = <value> - * <label>* <opcode> <operand>* - * - * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas - * are token separators. - */ - -/* #define _POSIX_SOURCE 1 */ -#define _POSIX_C_SOURCE 2 - -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -#define MEMORY 512 /* 2^9 29-bit words */ -#define MAXLINE 1024 -#define MAXTOKEN 32 -#define ADOTOUT "a.out" -#define NOVALUE -1 - -/* - * AIC-7770 register definitions - */ -#define R_SINDEX 0x65 -#define R_ALLONES 0x69 -#define R_ALLZEROS 0x6a -#define R_NONE 0x6a - -static -char sccsid[] = - "@(#)aic7770.c 1.10 94/07/22 jda"; - -int debug; -int lineno, LC; -char *filename; -FILE *ifp, *ofp; -unsigned char M[MEMORY][4]; - -void error(char *s) -{ - fprintf(stderr, "%s: %s at line %d\n", filename, s, lineno); - exit(EXIT_FAILURE); -} - -void *Malloc(size_t size) -{ - void *p = malloc(size); - if (!p) - error("out of memory"); - return(p); -} - -void *Realloc(void *ptr, size_t size) -{ - void *p = realloc(ptr, size); - if (!p) - error("out of memory"); - return(p); -} - -char *Strdup(char *s) -{ - char *p = (char *)Malloc(strlen(s) + 1); - strcpy(p, s); - return(p); -} - -typedef struct sym_t { - struct sym_t *next; /* MUST BE FIRST */ - char *name; - int value; - int npatch, *patch; -} sym_t; - -sym_t *head; - -void define(char *name, int value) -{ - sym_t *p, *q; - - for (p = head, q = (sym_t *)&head; p; p = p->next) { - if (!strcmp(p->name, name)) - error("redefined symbol"); - q = p; - } - - p = q->next = (sym_t *)Malloc(sizeof(sym_t)); - p->next = NULL; - p->name = Strdup(name); - p->value = value; - p->npatch = 0; - p->patch = NULL; - - if (debug) { - fprintf(stderr, "\"%s\" ", p->name); - if (p->value != NOVALUE) - fprintf(stderr, "defined as 0x%x\n", p->value); - else - fprintf(stderr, "undefined\n"); - } -} - -sym_t *lookup(char *name) -{ - sym_t *p; - - for (p = head; p; p = p->next) - if (!strcmp(p->name, name)) - return(p); - return(NULL); -} - -void patch(sym_t *p, int location) -{ - p->npatch += 1; - p->patch = (int *)Realloc(p->patch, p->npatch * sizeof(int *)); - - p->patch[p->npatch - 1] = location; -} - -void backpatch(void) -{ - int i; - sym_t *p; - - for (p = head; p; p = p->next) { - - if (p->value == NOVALUE) { - fprintf(stderr, - "%s: undefined symbol \"%s\"\n", - filename, p->name); - exit(EXIT_FAILURE); - } - - if (p->npatch) { - if (debug) - fprintf(stderr, - "\"%s\" (0x%x) patched at", - p->name, p->value); - - for (i = 0; i < p->npatch; i++) { - M[p->patch[i]][0] &= ~1; - M[p->patch[i]][0] |= ((p->value >> 8) & 1); - M[p->patch[i]][1] = p->value & 0xff; - - if (debug) - fprintf(stderr, " 0x%x", p->patch[i]); - } - - if (debug) - fputc('\n', stderr); - } - } -} - -/* - * Output words in byte-reversed order (least significant first) - * since the sequencer RAM is loaded that way. - */ -void output(FILE *fp) -{ - int i; - - for (i = 0; i < LC; i++) - fprintf(fp, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", - M[i][3], - M[i][2], - M[i][1], - M[i][0]); -} - -char **getl(int *n) -{ - int i; - char *p; - static char buf[MAXLINE]; - static char *a[MAXTOKEN]; - - i = 0; - - while (fgets(buf, sizeof(buf), ifp)) { - - lineno += 1; - - if (buf[strlen(buf)-1] != '\n') - error("line too long"); - - p = strchr(buf, '#'); - if (p) - *p = '\0'; - - for (p = strtok(buf, ", \t\n"); p; p = strtok(NULL, ", \t\n")) - if (i < MAXTOKEN-1) - a[i++] = p; - else - error("too many tokens"); - if (i) { - *n = i; - return(a); - } - } - return(NULL); -} - -#define A 0x8000 /* `A'ccumulator ok */ -#define I 0x4000 /* use as immediate value */ -#define SL 0x2000 /* shift left */ -#define SR 0x1000 /* shift right */ -#define RL 0x0800 /* rotate left */ -#define RR 0x0400 /* rotate right */ -#define LO 0x8000 /* lookup: ori-{jmp,jc,jnc,call} */ -#define LA 0x4000 /* lookup: and-{jz,jnz} */ -#define LX 0x2000 /* lookup: xor-{je,jne} */ -#define NA -1 /* not applicable */ - -struct { - char *name; - int n; /* number of operands, including opcode */ - unsigned int op; /* immediate or L?|pos_from_0 */ - unsigned int dest; /* NA, pos_from_0, or I|immediate */ - unsigned int src; /* NA, pos_from_0, or I|immediate */ - unsigned int imm; /* pos_from_0, A|pos_from_0, or I|immediate */ - unsigned int addr; /* NA or pos_from_0 */ - int fmt; /* instruction format - 1, 2, or 3 */ -} instr[] = { -/* - * N OP DEST SRC IMM ADDR FMT - */ - "mov", 3, 1, 1, 2, I|0xff, NA, 1, - "mov", 4, LO|2, NA, 1, I|0, 3, 3, - "mvi", 3, 0, 1, I|R_ALLZEROS, A|2, NA, 1, - "mvi", 4, LO|2, NA, I|R_ALLZEROS, 1, 3, 3, - "not", 2, 2, 1, 1, I|0xff, NA, 1, - "not", 3, 2, 1, 2, I|0xff, NA, 1, - "and", 3, 1, 1, 1, A|2, NA, 1, - "and", 4, 1, 1, 3, A|2, NA, 1, - "or", 3, 0, 1, 1, A|2, NA, 1, - "or", 4, 0, 1, 3, A|2, NA, 1, - "or", 5, LO|3, NA, 1, 2, 4, 3, - "xor", 3, 2, 1, 1, A|2, NA, 1, - "xor", 4, 2, 1, 3, A|2, NA, 1, - "nop", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1, - "inc", 2, 3, 1, 1, I|1, NA, 1, - "inc", 3, 3, 1, 2, I|1, NA, 1, - "dec", 2, 3, 1, 1, I|0xff, NA, 1, - "dec", 3, 3, 1, 2, I|0xff, NA, 1, - "jmp", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3, - "jc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3, - "jnc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3, - "call", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3, - "test", 5, LA|3, NA, 1, A|2, 4, 3, - "cmp", 5, LX|3, NA, 1, A|2, 4, 3, - "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1, - "clc", 1, 3, I|R_NONE, I|R_ALLZEROS, I|1, NA, 1, - "clc", 4, 3, 2, I|R_ALLZEROS, A|3, NA, 1, - "stc", 1, 3, I|R_NONE, I|R_ALLONES, I|1, NA, 1, - "stc", 2, 3, 1, I|R_ALLONES, I|1, NA, 1, - "add", 3, 3, 1, 1, A|2, NA, 1, - "add", 4, 3, 1, 3, A|2, NA, 1, - "adc", 3, 4, 1, 1, A|2, NA, 1, - "adc", 4, 4, 1, 3, A|2, NA, 1, - "shl", 3, 5, 1, 1, SL|2, NA, 2, - "shl", 4, 5, 1, 2, SL|3, NA, 2, - "shr", 3, 5, 1, 1, SR|2, NA, 2, - "shr", 4, 5, 1, 2, SR|3, NA, 2, - "rol", 3, 5, 1, 1, RL|2, NA, 2, - "rol", 4, 5, 1, 2, RL|3, NA, 2, - "ror", 3, 5, 1, 1, RR|2, NA, 2, - "ror", 4, 5, 1, 2, RR|3, NA, 2, - /* - * Extensions (note also that mvi allows A) - */ - "clr", 2, 1, 1, I|R_ALLZEROS, I|0xff, NA, 1, - 0 -}; - -int eval_operand(char **a, int spec) -{ - int i; - unsigned int want = spec & (LO|LA|LX); - - static struct { - unsigned int what; - char *name; - int value; - } jmptab[] = { - LO, "jmp", 8, - LO, "jc", 9, - LO, "jnc", 10, - LO, "call", 11, - LA, "jz", 15, - LA, "jnz", 13, - LX, "je", 14, - LX, "jne", 12, - }; - - spec &= ~(LO|LA|LX); - - for (i = 0; i < sizeof(jmptab)/sizeof(jmptab[0]); i++) - if (jmptab[i].what == want && - !strcmp(jmptab[i].name, a[spec])) - { - return(jmptab[i].value); - } - - if (want) - error("invalid jump"); - - return(spec); /* "case 0" - no flags set */ -} - -int eval_sdi(char **a, int spec) -{ - sym_t *p; - unsigned val; - - if (spec == NA) - return(NA); - - switch (spec & (A|I|SL|SR|RL|RR)) { - case SL: - case SR: - case RL: - case RR: - if (isdigit(*a[spec &~ (SL|SR|RL|RR)])) - val = strtol(a[spec &~ (SL|SR|RL|RR)], NULL, 0); - else { - p = lookup(a[spec &~ (SL|SR|RL|RR)]); - if (!p) - error("undefined symbol used"); - val = p->value; - } - - switch (spec & (SL|SR|RL|RR)) { /* blech */ - case SL: - if (val > 7) - return(0xf0); - return(((val % 8) << 4) | - (val % 8)); - case SR: - if (val > 7) - return(0xf0); - return(((val % 8) << 4) | - (1 << 3) | - ((8 - (val % 8)) % 8)); - case RL: - return(val % 8); - case RR: - return((8 - (val % 8)) % 8); - } - case I: - return(spec &~ I); - case A: - /* - * An immediate field of zero selects - * the accumulator. Vigorously object - * if zero is given otherwise - it's - * most likely an error. - */ - spec &= ~A; - if (!strcmp("A", a[spec])) - return(0); - if (isdigit(*a[spec]) && - strtol(a[spec], NULL, 0) == 0) - { - error("immediate value of zero selects accumulator"); - } - /* falls through */ - case 0: - if (isdigit(*a[spec])) - return(strtol(a[spec], NULL, 0)); - p = lookup(a[spec]); - if (p) - return(p->value); - error("undefined symbol used"); - } - - return(NA); /* shut the compiler up */ -} - -int eval_addr(char **a, int spec) -{ - sym_t *p; - - if (spec == NA) - return(NA); - if (isdigit(*a[spec])) - return(strtol(a[spec], NULL, 0)); - - p = lookup(a[spec]); - - if (p) { - if (p->value != NOVALUE) - return(p->value); - patch(p, LC); - } else { - define(a[spec], NOVALUE); - p = lookup(a[spec]); - patch(p, LC); - } - - return(NA); /* will be patched in later */ -} - -int crack(char **a, int n) -{ - int i; - int I_imm, I_addr; - int I_op, I_dest, I_src, I_ret; - - /* - * Check for "ret" at the end of the line; remove - * it unless it's "ret" alone - we still want to - * look it up in the table. - */ - I_ret = (strcmp(a[n-1], "ret") ? 0 : !0); - if (I_ret && n > 1) - n -= 1; - - for (i = 0; instr[i].name; i++) { - /* - * Look for match in table given constraints, - * currently just the name and the number of - * operands. - */ - if (!strcmp(instr[i].name, *a) && instr[i].n == n) - break; - } - if (!instr[i].name) - error("unknown opcode or wrong number of operands"); - - I_op = eval_operand(a, instr[i].op); - I_src = eval_sdi(a, instr[i].src); - I_imm = eval_sdi(a, instr[i].imm); - I_dest = eval_sdi(a, instr[i].dest); - I_addr = eval_addr(a, instr[i].addr); - - switch (instr[i].fmt) { - case 1: - case 2: - M[LC][0] = (I_op << 1) | I_ret; - M[LC][1] = I_dest; - M[LC][2] = I_src; - M[LC][3] = I_imm; - break; - case 3: - if (I_ret) - error("illegal use of \"ret\""); - M[LC][0] = (I_op << 1) | ((I_addr >> 8) & 1); - M[LC][1] = I_addr & 0xff; - M[LC][2] = I_src; - M[LC][3] = I_imm; - break; - } - - return(1); /* no two-byte instructions yet */ -} - -#undef SL -#undef SR -#undef RL -#undef RR -#undef LX -#undef LA -#undef LO -#undef I -#undef A - -void assemble(void) -{ - int n; - char **a; - sym_t *p; - - while ((a = getl(&n))) { - - while (a[0][strlen(*a)-1] == ':') { - a[0][strlen(*a)-1] = '\0'; - p = lookup(*a); - if (p) - p->value = LC; - else - define(*a, LC); - a += 1; - n -= 1; - } - - if (!n) /* line was all labels */ - continue; - - if (n == 3 && !strcmp("VERSION", *a)) - fprintf(ofp, "#define %s \"%s\"\n", a[1], a[2]); - else { - if (n == 3 && !strcmp("=", a[1])) - define(*a, strtol(a[2], NULL, 0)); - else - LC += crack(a, n); - } - } - - backpatch(); - output(ofp); - - if (debug) - output(stderr); -} - -int main(int argc, char **argv) -{ - int c; - - while ((c = getopt(argc, argv, "dho:")) != EOF) { - switch (c) { - case 'd': - debug = !0; - break; - case 'o': - ofp = fopen(optarg, "w"); - if (!ofp) { - perror(optarg); - exit(EXIT_FAILURE); - } - break; - case 'h': - printf("usage: %s [-d] [-ooutput] input\n", *argv); - exit(EXIT_SUCCESS); - case NULL: - /* - * An impossible option to shut the compiler - * up about sccsid[]. - */ - exit((int)sccsid); - default: - exit(EXIT_FAILURE); - } - } - - if (argc - optind != 1) { - fprintf(stderr, "%s: must have one input file\n", *argv); - exit(EXIT_FAILURE); - } - filename = argv[optind]; - - ifp = fopen(filename, "r"); - if (!ifp) { - perror(filename); - exit(EXIT_FAILURE); - } - - if (!ofp) { - ofp = fopen(ADOTOUT, "w"); - if (!ofp) { - perror(ADOTOUT); - exit(EXIT_FAILURE); - } - } - - assemble(); - exit(EXIT_SUCCESS); -} diff --git a/sys/gnu/misc/aic7770/aic7770.seq b/sys/gnu/misc/aic7770/aic7770.seq deleted file mode 100644 index a112033..0000000 --- a/sys/gnu/misc/aic7770/aic7770.seq +++ /dev/null @@ -1,1157 +0,0 @@ -# @(#)aic7xxx.seq 1.31 94/11/25 jda -# -# Adaptec 274x device driver for Linux. -# Copyright (c) 1994 The University of Calgary Department of Computer Science. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -VERSION AIC7XXX_SEQ_VERSION 1.31 - -SCBMASK = 0x1f - -SCSISEQ = 0x00 -SXFRCTL0 = 0x01 -SXFRCTL1 = 0x02 -SCSISIGI = 0x03 -SCSISIGO = 0x03 -SCSIRATE = 0x04 -SCSIID = 0x05 -SCSIDATL = 0x06 -STCNT = 0x08 -STCNT+0 = 0x08 -STCNT+1 = 0x09 -STCNT+2 = 0x0a -SSTAT0 = 0x0b -CLRSINT1 = 0x0c -SSTAT1 = 0x0c -SIMODE1 = 0x11 -SCSIBUSL = 0x12 -SHADDR = 0x14 -SELID = 0x19 -SBLKCTL = 0x1f -SEQCTL = 0x60 -A = 0x64 # == ACCUM -SINDEX = 0x65 -DINDEX = 0x66 -ALLZEROS = 0x6a -NONE = 0x6a -SINDIR = 0x6c -DINDIR = 0x6d -FUNCTION1 = 0x6e -HADDR = 0x88 -HCNT = 0x8c -HCNT+0 = 0x8c -HCNT+1 = 0x8d -HCNT+2 = 0x8e -SCBPTR = 0x90 -INTSTAT = 0x91 -DFCNTRL = 0x93 -DFSTATUS = 0x94 -DFDAT = 0x99 -QINFIFO = 0x9b -QINCNT = 0x9c -QOUTFIFO = 0x9d - -SCSICONF_A = 0x5a -SCSICONF_B = 0x5b - -# The two reserved bytes at SCBARRAY+1[23] are expected to be set to -# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag -# to indicate whether or not to reload scatter-gather parameters after -# a disconnect. -# -SCBARRAY+0 = 0xa0 -SCBARRAY+1 = 0xa1 -SCBARRAY+2 = 0xa2 -SCBARRAY+3 = 0xa3 -SCBARRAY+7 = 0xa7 -SCBARRAY+11 = 0xab -SCBARRAY+14 = 0xae -SCBARRAY+15 = 0xaf -SCBARRAY+16 = 0xb0 -SCBARRAY+17 = 0xb1 -SCBARRAY+18 = 0xb2 -SCBARRAY+19 = 0xb3 -SCBARRAY+20 = 0xb4 -SCBARRAY+21 = 0xb5 -SCBARRAY+22 = 0xb6 -SCBARRAY+23 = 0xb7 -SCBARRAY+24 = 0xb8 -SCBARRAY+25 = 0xb9 - -SIGNAL_0 = 0x01 # unknown scsi bus phase -SIGNAL_1 = 0x11 # message reject -SIGNAL_2 = 0x21 # no IDENTIFY after reconnect -SIGNAL_3 = 0x31 # no cmd match for reconnect -SIGNAL_4 = 0x41 # SDTR -> SCSIRATE conversion -STATUS_ERROR = 0x51 - -# The host adapter card (at least the BIOS) uses 20-2f for SCSI -# device information, 32-33 and 5a-5f as well. As it turns out, the -# BIOS trashes 20-2f, writing the synchronous negotiation results -# on top of the BIOS values, so we re-use those for our per-target -# scratchspace (actually a value that can be copied directly into -# SCSIRATE). The kernel driver will enable synchronous negotiation -# for all targets that have a value other than 0 in the lower four -# bits of the target scratch space. This should work irregardless of -# whether the bios has been installed. NEEDSDTR has one bit per target -# indicating if an SDTR message is needed for that device - this will -# be set initially (based on a search through the target scratch space), -# as well as after a bus reset condition. -# -# The high bit of DROPATN is set if ATN should be dropped before the ACK -# when outb is called. REJBYTE contains the first byte of a MESSAGE IN -# message, so the driver can report an intelligible error if a message is -# rejected. -# -# RESELECT's high bit is true if we are currently handling a reselect; -# its next-highest bit is true ONLY IF we've seen an IDENTIFY message -# from the reselecting target. If we haven't had IDENTIFY, then we have -# no idea what the lun is, and we can't select the right SCB register -# bank, so force a kernel panic if the target attempts a data in/out or -# command phase instead of corrupting something. -# -# Note that SG_NEXT occupies four bytes. -# -SYNCNEG = 0x20 - -DROPATN = 0x30 -REJBYTE = 0x31 -DISC_DSB_A = 0x32 -DISC_DSB_B = 0x33 -RESELECT = 0x34 - -MSG_FLAGS = 0x35 -MSG_LEN = 0x36 -MSG_START+0 = 0x37 -MSG_START+1 = 0x38 -MSG_START+2 = 0x39 -MSG_START+3 = 0x3a -MSG_START+4 = 0x3b -MSG_START+5 = 0x3c --MSG_START+0 = 0xc9 # 2's complement of MSG_START+0 - -ARG_1 = 0x4c # sdtr conversion args & return -RETURN_1 = 0x4c - -SIGSTATE = 0x4d # value written to SCSISIGO -NEEDSDTR_A = 0x4e # send SDTR message, 1 bit/trgt -NEEDSDTR_B = 0x4f - -SG_SIZEOF = 0x8 # sizeof(struct scatterlist) -SG_NOLOAD = 0x50 # load SG pointer/length? -SG_COUNT = 0x51 # working value of SG count -SG_NEXT = 0x52 # working value of SG pointer -SG_NEXT+0 = 0x52 -SG_NEXT+1 = 0x53 -SG_NEXT+2 = 0x54 -SG_NEXT+3 = 0x55 - -SCBCOUNT = 0x56 # the actual number of SCBs -FLAGS = 0x57 # Device configuration flags -TWIN_BUS = 0x01 -WIDE_BUS = 0x02 - -ACTIVE_A = 0x58 -ACTIVE_B = 0x59 - -# Poll QINCNT for work - the lower bits contain -# the number of entries in the Queue In FIFO. -# -start: - test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device? -# For fairness, we check the other bus first, since we just finished a -# transaction on the current channel. - xor SBLKCTL,0x08 # Toggle to the other bus - test SCSISIGI,0x4 jnz reselect # BSYI - xor SBLKCTL,0x08 # Toggle to the original bus -start2: - test SCSISIGI,0x4 jnz reselect # BSYI - test QINCNT,SCBMASK jz start - -# We have at least one queued SCB now. Set the SCB pointer -# from the FIFO so we see the right bank of SCB registers, -# then set SCSI options and set the initiator and target -# SCSI IDs. -# - mov SCBPTR,QINFIFO - -# See if there is not already an active SCB for this target. This code -# locks out on a per target basis instead of target/lun. Although this -# is not ideal for devices that have multiple luns active at the same -# time, it is faster than looping through all SCB's looking for active -# commands. It may be benificial to make findscb a more general procedure -# to see if the added cost of the search is negligible. This code also -# assumes that the kernel driver will clear the active flags on board -# initialization, board reset, and a target's SELTO. - - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - test SCBARRAY+1,0x88 jz test_a # Id < 8 && A channel - - test ACTIVE_B,A jnz requeue - or ACTIVE_B,A # Mark the current target as busy - jmp start_scb - -# Place the currently active back on the queue for later processing -requeue: - mov QINFIFO, SCBPTR - jmp start - -test_a: - test ACTIVE_A,A jnz requeue - or ACTIVE_A,A # Mark the current target as busy - -start_scb: - and A,0x08,SCBARRAY+1 - mov SBLKCTL,A # select channel, !wide - mov SCBARRAY+1 call initialize - clr SG_NOLOAD - clr RESELECT - -# As soon as we get a successful selection, the target should go -# into the message out phase since we have ATN asserted. Prepare -# the message to send, locking out the device driver. If the device -# driver hasn't beaten us with an ABORT or RESET message, then tack -# on an SDTR negotiation if required. -# -# Messages are stored in scratch RAM starting with a flag byte (high bit -# set means active message), one length byte, and then the message itself. -# - mov SCBARRAY+1 call disconnect # disconnect ok? - - and SINDEX,0x7,SCBARRAY+1 # lun - or SINDEX,A # return value from disconnect - or SINDEX,0x80 call mk_mesg # IDENTIFY message - - mov A,SINDEX - cmp MSG_START+0,A jne !message # did driver beat us? - mvi MSG_START+1 call mk_sdtr # build SDTR message if needed - -!message: - -# Enable selection phase as an initiator, and do automatic ATN -# after the selection. -# - mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO - -# Wait for successful arbitration. The AIC-7770 documentation says -# that SELINGO indicates successful arbitration, and that it should -# be used to look for SELDO. However, if the sequencer is paused at -# just the right time - a parallel fsck(8) on two drives did it for -# me - then SELINGO can flip back to false before we've seen it. This -# makes the sequencer sit in the arbitration loop forever. This is -# Not Good. -# -# Therefore, I've added a check in the arbitration loop for SELDO -# too. This could arguably be made a critical section by disabling -# pauses, but I don't want to make a potentially infinite loop a CS. -# I suppose you could fold it into the select loop, too, but since -# I've been hunting this bug for four days it's kinda like a trophy. -# -arbitrate: - test SSTAT0,0x40 jnz *select # SELDO - test SSTAT0,0x10 jz arbitrate # SELINGO - -# Wait for a successful selection. If the hardware selection -# timer goes off, then the driver gets the interrupt, so we don't -# need to worry about it. -# -select: - test SSTAT0,0x40 jz select # SELDO - jmp *select - -# Reselection is being initiated by a target - we've seen the BSY -# line driven active, and we didn't do it! Enable the reselection -# hardware, and wait for it to finish. Make a note that we've been -# reselected, but haven't seen an IDENTIFY message from the target -# yet. -# -reselect: - mvi SCSISEQ,0x10 # ENRSELI - -reselect1: - test SSTAT0,0x20 jz reselect1 # SELDI - mov SELID call initialize - - mvi RESELECT,0x80 # reselected, no IDENTIFY - -# After the [re]selection, make sure that the [re]selection enable -# bit is off. This chip is flaky enough without extra things -# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be -# using it shortly. -# -*select: - clr SCSISEQ - mvi CLRSINT1,0x8 # CLRBUSFREE - -# Main loop for information transfer phases. If BSY is false, then -# we have a bus free condition, expected or not. Otherwise, wait -# for the target to assert REQ before checking MSG, C/D and I/O -# for the bus phase. -# -# We can't simply look at the values of SCSISIGI here (if we want -# to do synchronous data transfer), because the target won't assert -# REQ if it's already sent us some data that we haven't acknowledged -# yet. -# -ITloop: - test SSTAT1,0x8 jnz p_busfree # BUSFREE - test SSTAT1,0x1 jz ITloop # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - - cmp ALLZEROS,A je p_dataout - cmp A,0x40 je p_datain - cmp A,0x80 je p_command - cmp A,0xc0 je p_status - cmp A,0xa0 je p_mesgout - cmp A,0xe0 je p_mesgin - - mvi INTSTAT,SIGNAL_0 # unknown - signal driver - -p_dataout: - mvi 0 call scsisig # !CDO|!IOO|!MSGO - call assert - call sg_load - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+23 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy - - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - -# After a DMA finishes, save the final transfer pointer and count -# back into the SCB, in case a device disconnects in the middle of -# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since -# it's a reflection of how many bytes were transferred on the SCSI -# (as opposed to the host) bus. -# - mvi A,3 - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy - - mvi A,4 - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -p_datain: - mvi 0x40 call scsisig # !CDO|IOO|!MSGO - call assert - call sg_load - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+23 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy - - mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN| - # !DIRECTION|FIFORESET - mvi A,3 - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy - - mvi A,4 - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -# Command phase. Set up the DMA registers and let 'er rip - the -# two bytes after the SCB SCSI_cmd_length are zeroed by the driver, -# so we can copy those three bytes directly into HCNT. -# -p_command: - mvi 0x80 call scsisig # CDO|!IOO|!MSGO - call assert - - mvi A,3 - mvi DINDEX,HCNT - mvi SCBARRAY+11 call bcopy - - mvi A,3 - mvi DINDEX,STCNT - mvi SCBARRAY+11 call bcopy - - mvi A,4 - mvi DINDEX,HADDR - mvi SCBARRAY+7 call bcopy - - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - jmp ITloop - -# Status phase. Wait for the data byte to appear, then read it -# and store it into the SCB. -# -p_status: - mvi 0xc0 call scsisig # CDO|IOO|!MSGO - - mvi SCBARRAY+14 call inb - jmp ITloop - -# Message out phase. If there is no active message, but the target -# took us into this phase anyway, build a no-op message and send it. -# -p_mesgout: - mvi 0xa0 call scsisig # CDO|!IOO|MSGO - mvi 0x8 call mk_mesg # build NOP message - -# Set up automatic PIO transfer from MSG_START. Bit 3 in -# SXFRCTL0 (SPIOEN) is already on. -# - mvi SINDEX,MSG_START+0 - mov DINDEX,MSG_LEN - clr A - -# When target asks for a byte, drop ATN if it's the last one in -# the message. Otherwise, keep going until the message is exhausted. -# (We can't use outb for this since it wants the input in SINDEX.) -# -# Keep an eye out for a phase change, in case the target issues -# a MESSAGE REJECT. -# -p_mesgout2: - test SSTAT0,0x2 jz p_mesgout2 # SPIORDY - test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS - - cmp DINDEX,1 jne p_mesgout3 # last byte? - mvi CLRSINT1,0x40 # CLRATNO - drop ATN - -# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically -# send ACKs in automatic PIO or DMA mode unless you make sure that the -# "expected" bus phase in SCSISIGO matches the actual bus phase. This -# behaviour is completely undocumented and caused me several days of -# grief. -# -# After plugging in different drives to test with and using a longer -# SCSI cable, I found that I/O in Automatic PIO mode ceased to function, -# especially when transferring >1 byte. It seems to be much more stable -# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is -# polled for transfer completion - for both output _and_ input. The -# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL -# is accessed (like the documentation says it does), and that on a longer -# cable run, the sequencer code was fast enough to loop back and see -# an SPIORDY that hadn't dropped yet. -# -p_mesgout3: - call one_stcnt - mov SCSIDATL,SINDIR - -p_mesgout4: - test SSTAT0,0x4 jz p_mesgout4 # SDONE - dec DINDEX - inc A - cmp MSG_LEN,A jne p_mesgout2 - -# If the next bus phase after ATN drops is a message out, it means -# that the target is requesting that the last message(s) be resent. -# -p_mesgout5: - test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE - test SSTAT1,0x1 jz p_mesgout5 # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - cmp A,0xa0 jne p_mesgout6 - mvi 0x10 call scsisig # ATNO - re-assert ATN - - jmp ITloop - -p_mesgout6: - mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS - clr MSG_FLAGS # no active msg - jmp ITloop - -# Message in phase. Bytes are read using Automatic PIO mode, but not -# using inb. This alleviates a race condition, namely that if ATN had -# to be asserted under Automatic PIO mode, it had to beat the SCSI -# circuitry sending an ACK to the target. This showed up under heavy -# loads and really confused things, since ABORT commands wouldn't be -# seen by the drive after an IDENTIFY message in until it had changed -# to a data I/O phase. -# -p_mesgin: - mvi 0xe0 call scsisig # CDO|IOO|MSGO - mvi A call inb_first # read the 1st message byte - mvi REJBYTE,A # save it for the driver - - cmp ALLZEROS,A jne p_mesgin1 - -# We got a "command complete" message, so put the SCB pointer -# into the Queue Out, and trigger a completion interrupt. -# Check status for non zero return and interrupt driver if needed -# This allows the driver to interpret errors only when they occur -# instead of always uploading the scb. If the status is SCSI_CHECK, -# the driver will download a new scb requesting sense, to replace -# the old one and the sequencer code will imediately jump to start -# working on it. If the kernel driver does not wish to request sense, -# the sequencer program counter is incremented by 1, preventing another run -# on the current SCB and the command is allowed to complete. We don't -# bother to post to the QOUTFIFO in the error case since it would require -# extra work in the kernel driver to ensure that the entry was removed -# before the command complete code tried processing it. - - test SCBARRAY+14,0xff jz status_ok # 0 Status? - call inb_last # ack & turn auto PIO back on - mvi INTSTAT,STATUS_ERROR # let driver know - jmp start_scb - -status_ok: - -# First, mark this target as free. - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - test SCBARRAY+1,0x88 jz clear_a - xor ACTIVE_B,A - jmp complete - -clear_a: - xor ACTIVE_A,A - -complete: - mov QOUTFIFO,SCBPTR - mvi INTSTAT,0x02 # CMDCMPLT - jmp p_mesgin_done - -# Is it an extended message? We only support the synchronous data -# transfer request message, which will probably be in response to -# an SDTR message out from us. If it's not an SDTR, reject it - -# apparently this can be done after any message in byte, according -# to the SCSI-2 spec. -# -# XXX - we should really reject this if we didn't initiate the SDTR -# negotiation; this may cause problems with unusual devices. -# -p_mesgin1: - cmp A,1 jne p_mesgin2 # extended message code? - - mvi A call inb_next - cmp A,3 jne p_mesginN # extended mesg length = 3 - mvi A call inb_next - cmp A,1 jne p_mesginN # SDTR code - - mvi ARG_1 call inb_next # xfer period - mvi A call inb_next # REQ/ACK offset - mvi INTSTAT,SIGNAL_4 # call driver to convert - - call ndx_sdtr # index sync config for target - mov DINDEX,SINDEX - not A # turn off "need sdtr" flag - test SBLKCTL,0x08 jnz p_mesgin1_b - test SCSIID,0x80 jnz p_mesgin1_b - and NEEDSDTR_A,A - jmp p_mesgin1_save - -p_mesgin1_b: - and NEEDSDTR_B,A - -p_mesgin1_save: - and A,0x80,SINDIR # get the WIDEXFER flag - or RETURN_1,A # Set WIDEXFER if necessary - mov DINDIR,RETURN_1 # save returned value - -# Even though the SCSI-2 specification says that a device responding -# to our SDTR message should honor our parameters for transmitting -# to us, it doesn't seem to work too well in real life. In particular, -# a lot of CD-ROM and tape units don't function: try using the SDTR -# parameters the device sent us for both transmitting and receiving. -# - mov SCSIRATE,RETURN_1 - jmp p_mesgin_done - -# Is it a disconnect message? Set a flag in the SCB to remind us -# and await the bus going free. -# -p_mesgin2: - cmp A,4 jne p_mesgin3 # disconnect code? - - or SCBARRAY+0,0x4 # set "disconnected" bit - jmp p_mesgin_done - -# Save data pointers message? Copy working values into the SCB, -# usually in preparation for a disconnect. -# -p_mesgin3: - cmp A,2 jne p_mesgin4 # save data pointers code? - - call sg_ram2scb - jmp p_mesgin_done - -# Restore pointers message? Data pointers are recopied from the -# SCB anyway at the start of any DMA operation, so the only thing -# to copy is the scatter-gather values. -# -p_mesgin4: - cmp A,3 jne p_mesgin5 # restore pointers code? - - call sg_scb2ram - jmp p_mesgin_done - -# Identify message? For a reconnecting target, this tells us the lun -# that the reconnection is for - find the correct SCB and switch to it, -# clearing the "disconnected" bit so we don't "find" it by accident later. -# -p_mesgin5: - test A,0x80 jz p_mesgin6 # identify message? - - test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved - - mov A call findSCB # switch to correct SCB - -# If a active message is present after calling findSCB, then either it -# or the driver is trying to abort the command. Either way, something -# untoward has happened and we should just leave it alone. -# - test MSG_FLAGS,0x80 jnz p_mesgin_done - - and SCBARRAY+0,0xfb # clear disconnect bit in SCB - mvi RESELECT,0xc0 # make note of IDENTIFY - - call sg_scb2ram # implied restore pointers - # required on reselect - jmp p_mesgin_done - -# Message reject? If we have an outstanding SDTR negotiation, assume -# that it's a response from the target selecting asynchronous transfer, -# otherwise just ignore it since we have no clue what it pertains to. -# -# XXX - I don't have a device that responds this way. Does this code -# actually work? -# -p_mesgin6: - cmp A,7 jne p_mesgin7 # message reject code? - - and FUNCTION1,0x70,SCSIID # outstanding SDTR message? - mov A,FUNCTION1 - - test SBLKCTL,0x08 jnz p_mesgin6_b - test SCSIID,0x80 jnz p_mesgin6_b - test NEEDSDTR_A,A jz p_mesgin_done # no - ignore rejection - call ndx_sdtr # note use of asynch xfer - mov DINDEX,SINDEX - clr DINDIR - - not A - and NEEDSDTR_A,A - jmp p_mesgin6_done - -p_mesgin6_b: - test NEEDSDTR_B,A jz p_mesgin_done # no - ignore rejection - call ndx_sdtr # note use of asynch xfer - mov DINDEX,SINDEX - clr DINDIR - - not A - and NEEDSDTR_B,A - -p_mesgin6_done: - - clr SCSIRATE # select asynch xfer - jmp p_mesgin_done - -# [ ADD MORE MESSAGE HANDLING HERE ] -# -p_mesgin7: - -# We have no idea what this message in is, and there's no way -# to pass it up to the kernel, so we issue a message reject and -# hope for the best. Since we're now using manual PIO mode to -# read in the message, there should no longer be a race condition -# present when we assert ATN. In any case, rejection should be a -# rare occurrence - signal the driver when it happens. -# -p_mesginN: - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - mvi INTSTAT,SIGNAL_1 # let driver know - - mvi 0x7 call mk_mesg # MESSAGE REJECT message - -p_mesgin_done: - call inb_last # ack & turn auto PIO back on - jmp ITloop - -# Bus free phase. It might be useful to interrupt the device -# driver if we aren't expecting this. For now, make sure that -# ATN isn't being asserted and look for a new command. -# -p_busfree: - mvi CLRSINT1,0x40 # CLRATNO - clr SIGSTATE - jmp start - -# Bcopy: number of bytes to transfer should be in A, DINDEX should -# contain the destination address, and SINDEX should contain the -# source address. All input parameters are trashed on return. -# -bcopy: - mov DINDIR,SINDIR - dec A - cmp ALLZEROS,A jne bcopy - ret - -# Locking the driver out, build a one-byte message passed in SINDEX -# if there is no active message already. SINDEX is returned intact. -# -mk_mesg: - mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE - test MSG_FLAGS,0x80 jnz mk_mesg1 # active message? - - mvi MSG_FLAGS,0x80 # if not, there is now - mvi MSG_LEN,1 # length = 1 - mov MSG_START+0,SINDEX # 1-byte message - -mk_mesg1: - mvi SEQCTL,0x10 # !PAUSEDIS|FASTMODE - ret - -# Input byte in Automatic PIO mode. The address to store the byte -# in should be in SINDEX. DINDEX will be used by this routine. -# -inb: - test SSTAT0,0x2 jz inb # SPIORDY - mov DINDEX,SINDEX - call one_stcnt # xfer one byte - mov DINDIR,SCSIDATL -inb1: - test SSTAT0,0x4 jz inb1 # SDONE - wait to "finish" - ret - -# Carefully read data in Automatic PIO mode. I first tried this using -# Manual PIO mode, but it gave me continual underrun errors, probably -# indicating that I did something wrong, but I feel more secure leaving -# Automatic PIO on all the time. -# -# According to Adaptec's documentation, an ACK is not sent on input from -# the target until SCSIDATL is read from. So we wait until SCSIDATL is -# latched (the usual way), then read the data byte directly off the bus -# using SCSIBUSL. When we have pulled the ATN line, or we just want to -# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI -# spec guarantees that the target will hold the data byte on the bus until -# we send our ACK. -# -# The assumption here is that these are called in a particular sequence, -# and that REQ is already set when inb_first is called. inb_{first,next} -# use the same calling convention as inb. -# -inb_first: - mov DINDEX,SINDEX - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_next: - mov DINDEX,SINDEX # save SINDEX - - call one_stcnt # xfer one byte - mov NONE,SCSIDATL # dummy read from latch to ACK -inb_next1: - test SSTAT0,0x4 jz inb_next1 # SDONE -inb_next2: - test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_last: - call one_stcnt # ACK with dummy read - mov NONE,SCSIDATL -inb_last1: - test SSTAT0,0x4 jz inb_last1 # wait for completion - ret - -# Output byte in Automatic PIO mode. The byte to output should be -# in SINDEX. If DROPATN's high bit is set, then ATN will be dropped -# before the byte is output. -# -outb: - test SSTAT0,0x2 jz outb # SPIORDY - call one_stcnt # xfer one byte - - test DROPATN,0x80 jz outb1 - mvi CLRSINT1,0x40 # CLRATNO - clr DROPATN -outb1: - mov SCSIDATL,SINDEX -outb2: - test SSTAT0,0x4 jz outb2 # SDONE - ret - -# Write the value "1" into the STCNT registers, for Automatic PIO -# transfers. -# -one_stcnt: - clr STCNT+2 - clr STCNT+1 - mvi STCNT+0,1 ret - -# DMA data transfer. HADDR and HCNT must be loaded first, and -# SINDEX should contain the value to load DFCNTRL with - 0x3d for -# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared -# during initialization. -# -dma: - mov DFCNTRL,SINDEX -dma1: -dma2: - test SSTAT0,0x1 jnz dma3 # DMADONE - test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun - -# We will be "done" DMAing when the transfer count goes to zero, or -# the target changes the phase (in light of this, it makes sense that -# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are -# doing a SCSI->Host transfer, the data FIFO should be flushed auto- -# magically on STCNT=0 or a phase change, so just wait for FIFO empty -# status. -# -dma3: - test SINDEX,0x4 jnz dma5 # DIRECTION -dma4: - test DFSTATUS,0x1 jz dma4 # FIFOEMP - -# Now shut the DMA enables off, and copy STCNT (ie. the underrun -# amount, if any) to the SCB registers; SG_COUNT will get copied to -# the SCB's residual S/G count field after sg_advance is called. Make -# sure that the DMA enables are actually off first lest we get an ILLSADDR. -# -dma5: - clr DFCNTRL # disable DMA -dma6: - test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK - - mvi A,3 - mvi DINDEX,SCBARRAY+15 - mvi STCNT call bcopy - - ret - -# Common SCSI initialization for selection and reselection. Expects -# the target SCSI ID to be in the upper four bits of SINDEX, and A's -# contents are stomped on return. -# -initialize: - and SCSIID,0xf0,SINDEX # target ID - test SBLKCTL,0x08 jnz initialize_b - mvi SINDEX,SCSICONF_A - test FLAGS,WIDE_BUS jnz initialize_wide - and A,0x7,SCSICONF_A # SCSI_ID_A[210] - jmp initialize_2 -initialize_b: - and A,0x7,SCSICONF_B # SCSI_ID_B[210] - mvi SCSICONF_B jmp initialize_2 - -initialize_wide: - and A, 0xf,SCSICONF_B - -initialize_2: - or SCSIID,A - -# Esundry initialization. -# - clr DROPATN - clr SIGSTATE - -# Turn on Automatic PIO mode now, before we expect to see an REQ -# from the target. It shouldn't hurt anything to leave it on. Set -# CLRCHN here before the target has entered a data transfer mode - -# with synchronous SCSI, if you do it later, you blow away some -# data in the SCSI FIFO that the target has already sent to you. -# -# DFON is a 7870 bit enabling digital filtering of REQ and ACK signals. -# - mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN - -# Set SCSI bus parity checking and the selection timeout value, -# and enable the hardware selection timer. Set the SELTO interrupt -# to signal the driver. -# -# STPWEN is 7870-specific, enabling an external termination power source. -# - and A,0x38,SINDIR # PARITY_ENB|SEL_TIM[10] - or SXFRCTL1,0x7,A # ENSTIMER|ACTNEGEN|STPWEN - mvi SIMODE1,0x84 # ENSELTIMO|ENSCSIPERR - -# Initialize scatter-gather pointers by setting up the working copy -# in scratch RAM. -# - call sg_scb2ram - -# Initialize SCSIRATE with the appropriate value for this target. -# - call ndx_sdtr - mov SCSIRATE,SINDIR - ret - -# Assert that if we've been reselected, then we've seen an IDENTIFY -# message. -# -assert: - test RESELECT,0x80 jz assert1 # reselected? - test RESELECT,0x40 jnz assert1 # seen IDENTIFY? - - mvi INTSTAT,SIGNAL_2 # no - cause a kernel panic - -assert1: - ret - -# Find out if disconnection is ok from the information the BIOS has left -# us. The tcl from SCBARRAY+1 should be in SINDEX; A will -# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok) -# on exit. -# -# To allow for wide or twin busses, we check the upper bit of the target ID -# and the channel ID and look at the appropriate disconnect register. -# -disconnect: - and FUNCTION1,0x70,SINDEX # strip off extra just in case - mov A,FUNCTION1 - test SINDEX, 0x88 jz disconnect_a - - test DISC_DSB_B,A jz disconnect1 # bit nonzero if DISabled - clr A ret - -disconnect_a: - test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled - clr A ret - -disconnect1: - mvi A,0x40 ret - -# Locate the SCB matching the target ID in SELID and the lun in the lower -# three bits of SINDEX, and switch the SCB to it. Have the kernel print -# a warning message if it can't be found, and generate an ABORT message -# to the target. We keep the value of the t/c/l that we are trying to find -# in DINDEX so it is not overwritten during our check to see if we are -# at the last SCB. -# -findSCB: - and A,0x7,SINDEX # lun in lower three bits - or DINDEX,A,SELID - and DINDEX,0xf7 - and A,0x08,SBLKCTL # B Channel?? - or DINDEX,A - clr SINDEX - -findSCB1: - mov A,DINDEX - mov SCBPTR,SINDEX # switch to new SCB - cmp SCBARRAY+1,A jne findSCB2 # target ID/channel/lun match? - test SCBARRAY+0,0x4 jz findSCB2 # should be disconnected - ret - -findSCB2: - inc SINDEX - mov A,SCBCOUNT - cmp SINDEX,A jne findSCB1 - - mvi INTSTAT,SIGNAL_3 # not found - signal kernel - mvi 0x6 call mk_mesg # ABORT message - - or SINDEX,0x10,SIGSTATE # assert ATNO - call scsisig - ret - -# Make a working copy of the scatter-gather parameters in the SCB. -# -sg_scb2ram: - mov SG_COUNT,SCBARRAY+2 - - mvi A,4 - mvi DINDEX,SG_NEXT - mvi SCBARRAY+3 call bcopy - - mvi SG_NOLOAD,0x80 - test SCBARRAY+0,0x10 jnz sg_scb2ram1 # don't reload s/g? - clr SG_NOLOAD - -sg_scb2ram1: - ret - -# Copying RAM values back to SCB, for Save Data Pointers message. -# -sg_ram2scb: - mov SCBARRAY+2,SG_COUNT - - mvi A,4 - mvi DINDEX,SCBARRAY+3 - mvi SG_NEXT call bcopy - - and SCBARRAY+0,0xef,SCBARRAY+0 - test SG_NOLOAD,0x80 jz sg_ram2scb1 # reload s/g? - or SCBARRAY+0,0x10 - -sg_ram2scb1: - ret - -# Load a struct scatter if needed and set up the data address and -# length. If the working value of the SG count is nonzero, then -# we need to load a new set of values. -# -# This, like the above DMA, assumes a little-endian host data storage. -# -sg_load: - test SG_COUNT,0xff jz sg_load3 # SG being used? - test SG_NOLOAD,0x80 jnz sg_load3 # don't reload s/g? - - clr HCNT+2 - clr HCNT+1 - mvi HCNT+0,SG_SIZEOF - - mvi A,4 - mvi DINDEX,HADDR - mvi SG_NEXT call bcopy - - mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET - -# Wait for DMA from host memory to data FIFO to complete, then disable -# DMA and wait for it to acknowledge that it's off. -# -sg_load1: - test DFSTATUS,0x8 jz sg_load1 # HDONE - - clr DFCNTRL # disable DMA -sg_load2: - test DFCNTRL,0x8 jnz sg_load2 # HDMAENACK - -# Copy data from FIFO into SCB data pointer and data count. This assumes -# that the struct scatterlist has this structure (this and sizeof(struct -# scatterlist) == 12 are asserted in aic7xxx.c): -# -# struct scatterlist { -# char *address; /* four bytes, little-endian order */ -# ... /* four bytes, ignored */ -# unsigned short length; /* two bytes, little-endian order */ -# } -# - -# Not in FreeBSD. the scatter list is only 8 bytes. -# -# struct ahc_dma_seg { -# physaddr addr; /* four bytes, little-endian order */ -# long len; /* four bytes, little endian order */ -# }; -# - - mov SCBARRAY+19,DFDAT # new data address - mov SCBARRAY+20,DFDAT - mov SCBARRAY+21,DFDAT - mov SCBARRAY+22,DFDAT - - mov SCBARRAY+23,DFDAT - mov SCBARRAY+24,DFDAT - mov SCBARRAY+25,DFDAT - mov NONE,DFDAT #Only support 24 bit length. - -sg_load3: - ret - -# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled, -# and the SCSI transfer count is zero (note that this should be called -# right after a DMA finishes), then move the working copies of the SG -# pointer/length along. If the SCSI transfer count is not zero, then -# presumably the target is disconnecting - do not reload the SG values -# next time. -# -sg_advance: - test SG_COUNT,0xff jz sg_advance2 # s/g enabled? - - test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero? - test STCNT+1,0xff jnz sg_advance1 - test STCNT+2,0xff jnz sg_advance1 - - clr SG_NOLOAD # reload s/g next time - dec SG_COUNT # one less segment to go - - clr A # add sizeof(struct scatter) - add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0 - adc SG_NEXT+1,A,SG_NEXT+1 - adc SG_NEXT+2,A,SG_NEXT+2 - adc SG_NEXT+3,A,SG_NEXT+3 - - ret - -sg_advance1: - mvi SG_NOLOAD,0x80 # don't reload s/g next time -sg_advance2: - ret - -# Add the array base SYNCNEG to the target offset (the target address -# is in SCSIID), and return the result in SINDEX. The accumulator -# contains the 3->8 decoding of the target ID on return. -# -ndx_sdtr: - shr A,SCSIID,4 - test SBLKCTL,0x08 jz ndx_sdtr_2 - or A,0x08 # Channel B entries add 8 -ndx_sdtr_2: - add SINDEX,SYNCNEG,A - - and FUNCTION1,0x70,SCSIID # 3-bit target address decode - mov A,FUNCTION1 ret - -# If we need to negotiate transfer parameters, build the SDTR message -# starting at the address passed in SINDEX. DINDEX is modified on return. -# -mk_sdtr: - mov DINDEX,SINDEX # save SINDEX - - call ndx_sdtr - test SCBARRAY+1,0x88 jz mk_sdtr1_a - test NEEDSDTR_B,A jnz mk_sdtr1 # do we need negotiation? - ret -mk_sdtr1_a: - test NEEDSDTR_A,A jnz mk_sdtr1 # do we need negotiation? - ret - -mk_sdtr1: - mvi DINDIR,1 # extended message - mvi DINDIR,3 # extended message length = 3 - mvi DINDIR,1 # SDTR code - mvi DINDIR,25 # REQ/ACK transfer period - mvi DINDIR,15 # REQ/ACK offset - - add MSG_LEN,-MSG_START+0,DINDEX # update message length - ret - -# Set SCSI bus control signal state. This also saves the last-written -# value into a location where the higher-level driver can read it - if -# it has to send an ABORT or RESET message, then it needs to know this -# so it can assert ATN without upsetting SCSISIGO. The new value is -# expected in SINDEX. Change the actual state last to avoid contention -# from the driver. -# -scsisig: - mov SIGSTATE,SINDEX - mov SCSISIGO,SINDEX ret diff --git a/sys/gnu/misc/aic7770/aic7770_seq.h b/sys/gnu/misc/aic7770/aic7770_seq.h deleted file mode 100644 index 24fa91b..0000000 --- a/sys/gnu/misc/aic7770/aic7770_seq.h +++ /dev/null @@ -1,351 +0,0 @@ -#define AIC7XXX_SEQ_VERSION "1.31" - 0x04, 0x03, 0x18, 0x1a, - 0x1f, 0x9c, 0x00, 0x1e, - 0xff, 0x9b, 0x90, 0x02, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x08, 0x1e, - 0xff, 0x90, 0x9b, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0x00, 0x57, 0x57, 0x00, - 0x00, 0xa1, 0xf1, 0x16, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x34, 0x02, - 0x00, 0xa1, 0x03, 0x17, - 0x07, 0xa1, 0x65, 0x02, - 0x00, 0x65, 0x65, 0x00, - 0x80, 0x65, 0xc2, 0x16, - 0xff, 0x65, 0x64, 0x02, - 0x00, 0x37, 0x13, 0x18, - 0x38, 0x6a, 0x51, 0x17, - 0x48, 0x6a, 0x00, 0x00, - 0x40, 0x0b, 0x1c, 0x1a, - 0x10, 0x0b, 0x14, 0x1e, - 0x40, 0x0b, 0x16, 0x1e, - 0x00, 0x65, 0x1c, 0x10, - 0x10, 0x6a, 0x00, 0x00, - 0x20, 0x0b, 0x19, 0x1e, - 0x00, 0x19, 0xf1, 0x16, - 0x80, 0x6a, 0x34, 0x00, - 0xff, 0x6a, 0x00, 0x02, - 0x08, 0x6a, 0x0c, 0x00, - 0x08, 0x0c, 0xbb, 0x1a, - 0x01, 0x0c, 0x1e, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0x00, 0x6a, 0x28, 0x1c, - 0x40, 0x64, 0x3e, 0x1c, - 0x80, 0x64, 0x54, 0x1c, - 0xc0, 0x64, 0x61, 0x1c, - 0xa0, 0x64, 0x64, 0x1c, - 0xe0, 0x64, 0x7c, 0x1c, - 0x01, 0x6a, 0x91, 0x00, - 0x00, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x00, 0x65, 0x29, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x3e, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x00, 0x65, 0x29, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x39, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x3e, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x80, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xa7, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xc0, 0x6a, 0x5c, 0x17, - 0xae, 0x6a, 0xc9, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xa0, 0x6a, 0x5c, 0x17, - 0x08, 0x6a, 0xc2, 0x16, - 0x37, 0x6a, 0x65, 0x00, - 0xff, 0x36, 0x66, 0x02, - 0xff, 0x6a, 0x64, 0x02, - 0x02, 0x0b, 0x69, 0x1e, - 0x10, 0x0c, 0x79, 0x1a, - 0x01, 0x66, 0x6d, 0x18, - 0x40, 0x6a, 0x0c, 0x00, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x6c, 0x06, 0x02, - 0x04, 0x0b, 0x6f, 0x1e, - 0xff, 0x66, 0x66, 0x06, - 0x01, 0x64, 0x64, 0x06, - 0x00, 0x36, 0x69, 0x18, - 0x08, 0x0c, 0x79, 0x1a, - 0x01, 0x0c, 0x73, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0xa0, 0x64, 0x79, 0x18, - 0x10, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x35, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0xe0, 0x6a, 0x5c, 0x17, - 0x64, 0x6a, 0xcf, 0x16, - 0x00, 0x6a, 0x31, 0x00, - 0x00, 0x6a, 0x8a, 0x18, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x57, 0x04, - 0xff, 0xae, 0x87, 0x1e, - 0x00, 0x65, 0xd7, 0x16, - 0x51, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x1e, 0x10, - 0xff, 0x90, 0x9d, 0x02, - 0x02, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x01, 0x64, 0x99, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x03, 0x64, 0xb5, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x01, 0x64, 0xb5, 0x18, - 0x4c, 0x6a, 0xd1, 0x16, - 0x4d, 0x6a, 0xd1, 0x16, - 0x41, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x4c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x4c, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x04, 0x64, 0x9c, 0x18, - 0x04, 0xa0, 0xa0, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x02, 0x64, 0x9f, 0x18, - 0x00, 0x65, 0x21, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x03, 0x64, 0xa2, 0x18, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x80, 0x64, 0xaa, 0x1e, - 0x78, 0x64, 0xb5, 0x1a, - 0x00, 0x64, 0x08, 0x17, - 0x80, 0x35, 0xb9, 0x1a, - 0x04, 0xa0, 0xa0, 0x04, - 0xc0, 0x6a, 0x34, 0x00, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x07, 0x64, 0xb5, 0x18, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x4f, 0xb9, 0x1e, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x6a, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x6a, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5c, 0x17, - 0x11, 0x6a, 0x91, 0x00, - 0x07, 0x6a, 0xc2, 0x16, - 0x00, 0x65, 0xd7, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x4e, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0xff, 0x6c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x06, - 0x00, 0x6a, 0xbe, 0x18, - 0xff, 0x6a, 0x6a, 0x03, - 0x50, 0x6a, 0x60, 0x00, - 0x80, 0x35, 0xc7, 0x1a, - 0x80, 0x6a, 0x35, 0x00, - 0x01, 0x6a, 0x36, 0x00, - 0xff, 0x65, 0x37, 0x02, - 0x10, 0x6a, 0x60, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xc9, 0x1e, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6d, 0x02, - 0x04, 0x0b, 0xcd, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x12, 0x6d, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd4, 0x1e, - 0x02, 0x0b, 0xd5, 0x1e, - 0xff, 0x12, 0x6d, 0x03, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd9, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xdb, 0x1e, - 0x00, 0x65, 0xe3, 0x16, - 0x80, 0x30, 0xe0, 0x1e, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x65, 0x06, 0x02, - 0x04, 0x0b, 0xe1, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x0a, 0x02, - 0xff, 0x6a, 0x09, 0x02, - 0x01, 0x6a, 0x08, 0x01, - 0xff, 0x65, 0x93, 0x02, - 0x01, 0x0b, 0xe9, 0x1a, - 0x10, 0x0c, 0xe7, 0x1e, - 0x04, 0x65, 0xeb, 0x1a, - 0x01, 0x94, 0xea, 0x1e, - 0xff, 0x6a, 0x93, 0x02, - 0x38, 0x93, 0xec, 0x1a, - 0x03, 0x6a, 0x64, 0x00, - 0xaf, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x1f, 0x02, - 0xf0, 0x65, 0x05, 0x02, - 0x07, 0x5a, 0x64, 0x02, - 0x00, 0x05, 0x05, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x6a, 0x4e, 0x02, - 0x8a, 0x6a, 0x01, 0x00, - 0x38, 0x5a, 0x64, 0x02, - 0x05, 0x64, 0x02, 0x00, - 0x84, 0x6a, 0x11, 0x00, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x6c, 0x04, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x34, 0x02, 0x1f, - 0x40, 0x34, 0x02, 0x1b, - 0x21, 0x6a, 0x91, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x70, 0x65, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x32, 0x07, 0x1f, - 0xff, 0x6a, 0x64, 0x03, - 0x40, 0x6a, 0x64, 0x01, - 0x07, 0x65, 0x64, 0x02, - 0x00, 0x19, 0x66, 0x00, - 0xf7, 0x66, 0x66, 0x02, - 0xff, 0x6a, 0x65, 0x02, - 0xff, 0x66, 0x64, 0x02, - 0xff, 0x65, 0x90, 0x02, - 0x00, 0xa1, 0x11, 0x19, - 0x04, 0xa0, 0x11, 0x1f, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x65, 0x65, 0x06, - 0xff, 0x56, 0x64, 0x02, - 0x00, 0x65, 0x0c, 0x19, - 0x31, 0x6a, 0x91, 0x00, - 0x06, 0x6a, 0xc2, 0x16, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5c, 0x17, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0xa2, 0x51, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0x52, 0x6a, 0x66, 0x00, - 0xa3, 0x6a, 0xbe, 0x16, - 0x80, 0x6a, 0x50, 0x00, - 0x10, 0xa0, 0x20, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0xa2, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0xa3, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0xef, 0xa0, 0xa0, 0x02, - 0x80, 0x50, 0x28, 0x1f, - 0x10, 0xa0, 0xa0, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x3d, 0x1f, - 0x80, 0x50, 0x3d, 0x1b, - 0xff, 0x6a, 0x8e, 0x02, - 0xff, 0x6a, 0x8d, 0x02, - 0x08, 0x6a, 0x8c, 0x00, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0x0d, 0x6a, 0x93, 0x00, - 0x08, 0x94, 0x32, 0x1f, - 0xff, 0x6a, 0x93, 0x02, - 0x08, 0x93, 0x34, 0x1b, - 0xff, 0x99, 0xb3, 0x02, - 0xff, 0x99, 0xb4, 0x02, - 0xff, 0x99, 0xb5, 0x02, - 0xff, 0x99, 0xb6, 0x02, - 0xff, 0x99, 0xb7, 0x02, - 0xff, 0x99, 0xb8, 0x02, - 0xff, 0x99, 0xb9, 0x02, - 0xff, 0x99, 0x6a, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x4b, 0x1f, - 0xff, 0x08, 0x4a, 0x1b, - 0xff, 0x09, 0x4a, 0x1b, - 0xff, 0x0a, 0x4a, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x51, 0x51, 0x06, - 0xff, 0x6a, 0x64, 0x02, - 0x08, 0x52, 0x52, 0x06, - 0x00, 0x53, 0x53, 0x08, - 0x00, 0x54, 0x54, 0x08, - 0x00, 0x55, 0x55, 0x08, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x6a, 0x50, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x4c, 0x05, 0x64, 0x0a, - 0x07, 0x64, 0x64, 0x02, - 0x20, 0x64, 0x65, 0x06, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0x4c, 0x17, - 0x00, 0x4f, 0x55, 0x1b, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x6a, 0x6d, 0x00, - 0x03, 0x6a, 0x6d, 0x00, - 0x01, 0x6a, 0x6d, 0x00, - 0x19, 0x6a, 0x6d, 0x00, - 0x0f, 0x6a, 0x6d, 0x00, - 0xc9, 0x66, 0x36, 0x06, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x4e, 0x02, - 0xff, 0x65, 0x03, 0x03, diff --git a/sys/gnu/misc/aic7xxx/COPYING b/sys/gnu/misc/aic7xxx/COPYING deleted file mode 100644 index a43ea21..0000000 --- a/sys/gnu/misc/aic7xxx/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/sys/gnu/misc/aic7xxx/COPYRIGHT b/sys/gnu/misc/aic7xxx/COPYRIGHT deleted file mode 100644 index 905285d..0000000 --- a/sys/gnu/misc/aic7xxx/COPYRIGHT +++ /dev/null @@ -1,16 +0,0 @@ -Adaptec 274x device driver for Linux. -Copyright (c) 1994 The University of Calgary Department of Computer Science. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. diff --git a/sys/gnu/misc/aic7xxx/README b/sys/gnu/misc/aic7xxx/README deleted file mode 100644 index 1e4e5a0..0000000 --- a/sys/gnu/misc/aic7xxx/README +++ /dev/null @@ -1,94 +0,0 @@ -@(#)README 1.16 94/11/09 jda - -AHA274x/284x DRIVER - -*** THIS SHOULD BE CONSIDERED BETA SOFTWARE *** - -BACKGROUND & LIMITATIONS - -For various reasons, we ended up with one of these cards under the -impression that support was soon forthcoming. In mid-May, I asked -Scott Ferris (the official person who's supposed to be writing this -driver) what documentation he used, _finally_ got it from Adaptec, -and started writing this driver. It is now at what I would consider -a stable state - it runs our news server and is battered by SCSI -requests 24 hours a day without dying. There are a few devices it -reportedly doesn't like working with - those are being sorted out. Due -to some unexpected equipment loans, I am able to support this at least -for the time being. - -YOU MUST HAVE THE BIOS ENABLED OR THIS WILL NOT WORK. The BIOS extracts -some configuration information that I cannot get to portably yet, as -well as provides some self-tests which this driver does not attempt to -duplicate. - -Scott's driver development is stalled for now, and after discussions -with him, this is now officially out of "pre-alpha" status and into -beta until the remaining device problems can be resolved. The latest -patches can be obtained via anonymous ftp from ftp.cpsc.ucalgary.ca in -/pub/systems/linux/aha274x. - -It supports both EISA 274x and VL-bus 284x, either single or twin-bus cards -(but not the second SCSI bus of twin cards - see aha274x.c), and supports -disconnection, synchronous SCSI, and scatter-gather. Unlike previous -versions, abort() and reset() are now implemented, and both hosts.c and -aha274x.c should give a clean compile. Code is now present to detect parity -errors, but has not been tested. - -I wrote this using a 1.0.9 kernel. Unfortunately, I'm getting tired of -#ifdef'ing everything to handle two or three different evolutionary steps -in the SCSI kernel code, so I've upgraded my system to 1.1.49, and will -only leave in code to support versions from about 1.1.45 onward. - -Thanks to patches supplied by Mark Olson <molson@tricord.com>, this driver -will now work with the 284x series (the VL-bus version of this card). The -294x (PCI-bus) support is based on patches sent to me by Mark Olson and -Alan Hourihane <alanh@fairlite.demon.co.uk>. - -Under protest, this driver is subject to the GPL - see the file -COPYING for details. - -Thanks to the following people for bug fixes/code improvements (also -thanks to the people who have sent me feedback): - - "David F. Carlson" <dave@ee.rochester.edu> - Jimen Ching <jiching@wiliki.eng.hawaii.edu> - mday@artisoft.com (Matt Day) - "Dean W. Gehnert" <deang@ims.com> - Darcy Grant <darcy@cpsc.ucalgary.ca> - Alan Hourihane <alanh@fairlite.demon.co.uk> - isely@fncrd8.fnal.gov (Mike Isely) - Mike Jerger <jerger@ux1.cso.uiuc.edu> - tm@netcom.com (Toshiyasu Morita) - neal@interact.org (Neal Norwitz) - Mark Olson <molson@tricord.com> - map@europa.ecn.uoknor.edu (Michael A. Parker) - Thomas Scheunemann <thomas@dagobert.uni-duisburg.de> - -Special thanks to Drew Eckhardt <drew@kinglear.cs.Colorado.EDU> for -fielding my questions about synchronous negotiation. Steffen Moeller -<smoe0024@rz.uni-hildesheim.de> sent me installation instructions which -were previously included in this README. - -David Pirie <pirie@cpsc.ucalgary.ca> was nice enough to loan me his -2842 card for a week so I could track down one bug, as well as his -CD-ROM drive later, and also thanks to Doug Fortune at Riley's Data Share -in Calgary, who arranged a long-term loan of a 2842 board for further work. - -Many thanks to the fearless prerelease testers! Dean Gehnert has been -building Slackware boot disks for the driver, which are available from -ftp.cpsc.ucalgary.ca in /pub/systems/linux/aha274x/slackware_boot. - -Carl Riches <cgr@poplar1.cfr.washington.edu> has set up a mailing list -for aic7xxx driver development. To subscribe, send a message to -aic7770-list@poplar1.cfr.washington.edu with a message body of: - - subscribe AIC7770-LIST <your name here, without the angle brackets> - -Please direct questions and discussions to that list instead of me. When -sending bug reports, please include a description of your hardware, the -release numbers displayed by the driver at boot time, and as accurate a -facsimilie of any error message you're mailing about. - -John Aycock -aycock@cpsc.ucalgary.ca diff --git a/sys/gnu/misc/aic7xxx/README-FIRST b/sys/gnu/misc/aic7xxx/README-FIRST deleted file mode 100644 index 056dbc8..0000000 --- a/sys/gnu/misc/aic7xxx/README-FIRST +++ /dev/null @@ -1,19 +0,0 @@ -This is VERY MUCH ALPHA SOFTWARE. You MUST know what you're doing to -use this, or else!!! - -Ok, everything's been renamed to reference an "aic7xxx" driver instead -of "aha274x", and a merger of the two PCI patches I had has been put in, -along with re-doing the detection and configuration routines. To summarize -the status: it compiles cleanly. I don't expect it to work off the bat, -but it's for the 294x development people to synchronize their code -together. - -The file scsi-diffs-1.1.59 is NOT a proper patch file, but some diffs -to kernel files concatenated together. I've sent these off to Drew, -but if you're testing this you'll have to apply them - it allows a -per-driver-instance can_queue variable, which for the aic7xxx driver -is the number of SCBs the card supports. - -Good luck! I await your comments.. Mark, Alan - let me know where I -broke it, please ;-) -:ja diff --git a/sys/gnu/misc/aic7xxx/aic7770_seq.h b/sys/gnu/misc/aic7xxx/aic7770_seq.h deleted file mode 100644 index 24fa91b..0000000 --- a/sys/gnu/misc/aic7xxx/aic7770_seq.h +++ /dev/null @@ -1,351 +0,0 @@ -#define AIC7XXX_SEQ_VERSION "1.31" - 0x04, 0x03, 0x18, 0x1a, - 0x1f, 0x9c, 0x00, 0x1e, - 0xff, 0x9b, 0x90, 0x02, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x08, 0x1e, - 0xff, 0x90, 0x9b, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0x00, 0x57, 0x57, 0x00, - 0x00, 0xa1, 0xf1, 0x16, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x34, 0x02, - 0x00, 0xa1, 0x03, 0x17, - 0x07, 0xa1, 0x65, 0x02, - 0x00, 0x65, 0x65, 0x00, - 0x80, 0x65, 0xc2, 0x16, - 0xff, 0x65, 0x64, 0x02, - 0x00, 0x37, 0x13, 0x18, - 0x38, 0x6a, 0x51, 0x17, - 0x48, 0x6a, 0x00, 0x00, - 0x40, 0x0b, 0x1c, 0x1a, - 0x10, 0x0b, 0x14, 0x1e, - 0x40, 0x0b, 0x16, 0x1e, - 0x00, 0x65, 0x1c, 0x10, - 0x10, 0x6a, 0x00, 0x00, - 0x20, 0x0b, 0x19, 0x1e, - 0x00, 0x19, 0xf1, 0x16, - 0x80, 0x6a, 0x34, 0x00, - 0xff, 0x6a, 0x00, 0x02, - 0x08, 0x6a, 0x0c, 0x00, - 0x08, 0x0c, 0xbb, 0x1a, - 0x01, 0x0c, 0x1e, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0x00, 0x6a, 0x28, 0x1c, - 0x40, 0x64, 0x3e, 0x1c, - 0x80, 0x64, 0x54, 0x1c, - 0xc0, 0x64, 0x61, 0x1c, - 0xa0, 0x64, 0x64, 0x1c, - 0xe0, 0x64, 0x7c, 0x1c, - 0x01, 0x6a, 0x91, 0x00, - 0x00, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x00, 0x65, 0x29, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x3e, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x00, 0x65, 0x29, 0x17, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xb7, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xb3, 0x6a, 0xbe, 0x16, - 0x39, 0x6a, 0xe6, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0xb7, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0xb3, 0x6a, 0x66, 0x00, - 0x14, 0x6a, 0xbe, 0x16, - 0x00, 0x65, 0x3e, 0x17, - 0xff, 0x51, 0xb2, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0x80, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0xff, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x8c, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x03, 0x6a, 0x64, 0x00, - 0x08, 0x6a, 0x66, 0x00, - 0xab, 0x6a, 0xbe, 0x16, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0xa7, 0x6a, 0xbe, 0x16, - 0x3d, 0x6a, 0xe6, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xc0, 0x6a, 0x5c, 0x17, - 0xae, 0x6a, 0xc9, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0xa0, 0x6a, 0x5c, 0x17, - 0x08, 0x6a, 0xc2, 0x16, - 0x37, 0x6a, 0x65, 0x00, - 0xff, 0x36, 0x66, 0x02, - 0xff, 0x6a, 0x64, 0x02, - 0x02, 0x0b, 0x69, 0x1e, - 0x10, 0x0c, 0x79, 0x1a, - 0x01, 0x66, 0x6d, 0x18, - 0x40, 0x6a, 0x0c, 0x00, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x6c, 0x06, 0x02, - 0x04, 0x0b, 0x6f, 0x1e, - 0xff, 0x66, 0x66, 0x06, - 0x01, 0x64, 0x64, 0x06, - 0x00, 0x36, 0x69, 0x18, - 0x08, 0x0c, 0x79, 0x1a, - 0x01, 0x0c, 0x73, 0x1e, - 0xe0, 0x03, 0x64, 0x02, - 0xa0, 0x64, 0x79, 0x18, - 0x10, 0x6a, 0x5c, 0x17, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x35, 0x02, - 0x00, 0x65, 0x1e, 0x10, - 0xe0, 0x6a, 0x5c, 0x17, - 0x64, 0x6a, 0xcf, 0x16, - 0x00, 0x6a, 0x31, 0x00, - 0x00, 0x6a, 0x8a, 0x18, - 0x70, 0xa1, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x57, 0x57, 0x04, - 0xff, 0xae, 0x87, 0x1e, - 0x00, 0x65, 0xd7, 0x16, - 0x51, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x1e, 0x10, - 0xff, 0x90, 0x9d, 0x02, - 0x02, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x01, 0x64, 0x99, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x03, 0x64, 0xb5, 0x18, - 0x64, 0x6a, 0xd1, 0x16, - 0x01, 0x64, 0xb5, 0x18, - 0x4c, 0x6a, 0xd1, 0x16, - 0x4d, 0x6a, 0xd1, 0x16, - 0x41, 0x6a, 0x91, 0x00, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x4c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x4c, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x04, 0x64, 0x9c, 0x18, - 0x04, 0xa0, 0xa0, 0x00, - 0x00, 0x65, 0xb9, 0x10, - 0x02, 0x64, 0x9f, 0x18, - 0x00, 0x65, 0x21, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x03, 0x64, 0xa2, 0x18, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x80, 0x64, 0xaa, 0x1e, - 0x78, 0x64, 0xb5, 0x1a, - 0x00, 0x64, 0x08, 0x17, - 0x80, 0x35, 0xb9, 0x1a, - 0x04, 0xa0, 0xa0, 0x04, - 0xc0, 0x6a, 0x34, 0x00, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0xb9, 0x10, - 0x07, 0x64, 0xb5, 0x18, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x4f, 0xb9, 0x1e, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x6a, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x04, - 0x00, 0x4f, 0x4f, 0x02, - 0xff, 0x6a, 0x04, 0x02, - 0x00, 0x65, 0xb9, 0x10, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5c, 0x17, - 0x11, 0x6a, 0x91, 0x00, - 0x07, 0x6a, 0xc2, 0x16, - 0x00, 0x65, 0xd7, 0x16, - 0x00, 0x65, 0x1e, 0x10, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x4e, 0x02, - 0x00, 0x65, 0x00, 0x10, - 0xff, 0x6c, 0x6d, 0x02, - 0xff, 0x64, 0x64, 0x06, - 0x00, 0x6a, 0xbe, 0x18, - 0xff, 0x6a, 0x6a, 0x03, - 0x50, 0x6a, 0x60, 0x00, - 0x80, 0x35, 0xc7, 0x1a, - 0x80, 0x6a, 0x35, 0x00, - 0x01, 0x6a, 0x36, 0x00, - 0xff, 0x65, 0x37, 0x02, - 0x10, 0x6a, 0x60, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xc9, 0x1e, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6d, 0x02, - 0x04, 0x0b, 0xcd, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0xff, 0x12, 0x6d, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd4, 0x1e, - 0x02, 0x0b, 0xd5, 0x1e, - 0xff, 0x12, 0x6d, 0x03, - 0x00, 0x65, 0xe3, 0x16, - 0xff, 0x06, 0x6a, 0x02, - 0x04, 0x0b, 0xd9, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0x02, 0x0b, 0xdb, 0x1e, - 0x00, 0x65, 0xe3, 0x16, - 0x80, 0x30, 0xe0, 0x1e, - 0x40, 0x6a, 0x0c, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x65, 0x06, 0x02, - 0x04, 0x0b, 0xe1, 0x1e, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x0a, 0x02, - 0xff, 0x6a, 0x09, 0x02, - 0x01, 0x6a, 0x08, 0x01, - 0xff, 0x65, 0x93, 0x02, - 0x01, 0x0b, 0xe9, 0x1a, - 0x10, 0x0c, 0xe7, 0x1e, - 0x04, 0x65, 0xeb, 0x1a, - 0x01, 0x94, 0xea, 0x1e, - 0xff, 0x6a, 0x93, 0x02, - 0x38, 0x93, 0xec, 0x1a, - 0x03, 0x6a, 0x64, 0x00, - 0xaf, 0x6a, 0x66, 0x00, - 0x08, 0x6a, 0xbe, 0x16, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x6a, 0x1f, 0x02, - 0xf0, 0x65, 0x05, 0x02, - 0x07, 0x5a, 0x64, 0x02, - 0x00, 0x05, 0x05, 0x00, - 0xff, 0x6a, 0x30, 0x02, - 0xff, 0x6a, 0x4e, 0x02, - 0x8a, 0x6a, 0x01, 0x00, - 0x38, 0x5a, 0x64, 0x02, - 0x05, 0x64, 0x02, 0x00, - 0x84, 0x6a, 0x11, 0x00, - 0x00, 0x65, 0x19, 0x17, - 0x00, 0x65, 0x4c, 0x17, - 0xff, 0x6c, 0x04, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x34, 0x02, 0x1f, - 0x40, 0x34, 0x02, 0x1b, - 0x21, 0x6a, 0x91, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x70, 0x65, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x02, - 0x00, 0x32, 0x07, 0x1f, - 0xff, 0x6a, 0x64, 0x03, - 0x40, 0x6a, 0x64, 0x01, - 0x07, 0x65, 0x64, 0x02, - 0x00, 0x19, 0x66, 0x00, - 0xf7, 0x66, 0x66, 0x02, - 0xff, 0x6a, 0x65, 0x02, - 0xff, 0x66, 0x64, 0x02, - 0xff, 0x65, 0x90, 0x02, - 0x00, 0xa1, 0x11, 0x19, - 0x04, 0xa0, 0x11, 0x1f, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x65, 0x65, 0x06, - 0xff, 0x56, 0x64, 0x02, - 0x00, 0x65, 0x0c, 0x19, - 0x31, 0x6a, 0x91, 0x00, - 0x06, 0x6a, 0xc2, 0x16, - 0x10, 0x4e, 0x65, 0x00, - 0x00, 0x65, 0x5c, 0x17, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0xa2, 0x51, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0x52, 0x6a, 0x66, 0x00, - 0xa3, 0x6a, 0xbe, 0x16, - 0x80, 0x6a, 0x50, 0x00, - 0x10, 0xa0, 0x20, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0xa2, 0x02, - 0x04, 0x6a, 0x64, 0x00, - 0xa3, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0xef, 0xa0, 0xa0, 0x02, - 0x80, 0x50, 0x28, 0x1f, - 0x10, 0xa0, 0xa0, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x3d, 0x1f, - 0x80, 0x50, 0x3d, 0x1b, - 0xff, 0x6a, 0x8e, 0x02, - 0xff, 0x6a, 0x8d, 0x02, - 0x08, 0x6a, 0x8c, 0x00, - 0x04, 0x6a, 0x64, 0x00, - 0x88, 0x6a, 0x66, 0x00, - 0x52, 0x6a, 0xbe, 0x16, - 0x0d, 0x6a, 0x93, 0x00, - 0x08, 0x94, 0x32, 0x1f, - 0xff, 0x6a, 0x93, 0x02, - 0x08, 0x93, 0x34, 0x1b, - 0xff, 0x99, 0xb3, 0x02, - 0xff, 0x99, 0xb4, 0x02, - 0xff, 0x99, 0xb5, 0x02, - 0xff, 0x99, 0xb6, 0x02, - 0xff, 0x99, 0xb7, 0x02, - 0xff, 0x99, 0xb8, 0x02, - 0xff, 0x99, 0xb9, 0x02, - 0xff, 0x99, 0x6a, 0x02, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x51, 0x4b, 0x1f, - 0xff, 0x08, 0x4a, 0x1b, - 0xff, 0x09, 0x4a, 0x1b, - 0xff, 0x0a, 0x4a, 0x1b, - 0xff, 0x6a, 0x50, 0x02, - 0xff, 0x51, 0x51, 0x06, - 0xff, 0x6a, 0x64, 0x02, - 0x08, 0x52, 0x52, 0x06, - 0x00, 0x53, 0x53, 0x08, - 0x00, 0x54, 0x54, 0x08, - 0x00, 0x55, 0x55, 0x08, - 0xff, 0x6a, 0x6a, 0x03, - 0x80, 0x6a, 0x50, 0x00, - 0xff, 0x6a, 0x6a, 0x03, - 0x4c, 0x05, 0x64, 0x0a, - 0x07, 0x64, 0x64, 0x02, - 0x20, 0x64, 0x65, 0x06, - 0x70, 0x05, 0x6e, 0x02, - 0xff, 0x6e, 0x64, 0x03, - 0xff, 0x65, 0x66, 0x02, - 0x00, 0x65, 0x4c, 0x17, - 0x00, 0x4f, 0x55, 0x1b, - 0xff, 0x6a, 0x6a, 0x03, - 0x01, 0x6a, 0x6d, 0x00, - 0x03, 0x6a, 0x6d, 0x00, - 0x01, 0x6a, 0x6d, 0x00, - 0x19, 0x6a, 0x6d, 0x00, - 0x0f, 0x6a, 0x6d, 0x00, - 0xc9, 0x66, 0x36, 0x06, - 0xff, 0x6a, 0x6a, 0x03, - 0xff, 0x65, 0x4e, 0x02, - 0xff, 0x65, 0x03, 0x03, diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.1 b/sys/gnu/misc/aic7xxx/aic7xxx.1 deleted file mode 100644 index 2ff33b7..0000000 --- a/sys/gnu/misc/aic7xxx/aic7xxx.1 +++ /dev/null @@ -1,70 +0,0 @@ -.\" Copyright (c) 1994, 1995 -.\" Justin T. Gibbs. 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. The name of the author may not be used to endorse or promote products -.\" derived from this software without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. -.\" -.\" -.Dd November 11, 1994 -.Dt AIC7XXX_ASM 1 -.Os BSD 4 -.Sh NAME -.Nm aic7xxx_asm -.Nd Assembler for the Adaptec aic7xxx family of asics -.Sh SYNOPSIS -.Nm aic7xxx_asm -.Op Fl d -.Op Fl D Ar variable=value -.Op Fl v -.Op Fl o Ar file -.Ar source-file -.Sh DESCRIPTION -The Adaptec aic7xxx family of asics are single chip SCSI controllers with a -RISC like command processor. This assembler parses the language outlined -in the Adaptec technical document -.%T "AIC-7770 (EISA/ISA Bus Master Single-Chip SCSI Host Adaptor) Data Book" -and produces ascii output intended for a C byte array. -.Pp -The aic7xxx assembler is required to compile kernels with aic7xxx SCSI -adaptor support (AHA-274x, AHA-284x, AHA-294x controllers) and is compiled, -installed, and used automatically in the kernel compile directory when -necessary. -.Pp -The options are as follows: -.Bl -tag -width Ds -.It Fl D Ar variable=value -Define -.Ar variable -to be -.Ar value -in the global context -.It Fl d -Turn on debugging -.It Fl v -Print version information -.It Fl o Ar file -Redirect assembler output to -.Ar file -.Pp -.Sh AUTHOR -This aic7770 assembler was written by -John Aycock (aycock@cpsc.ucalgary.ca) diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.c b/sys/gnu/misc/aic7xxx/aic7xxx.c deleted file mode 100644 index 5f910d4..0000000 --- a/sys/gnu/misc/aic7xxx/aic7xxx.c +++ /dev/null @@ -1,643 +0,0 @@ -/*+M************************************************************************* - * Adaptec AIC7770/AIC7870 sequencer code assembler. - * - * Copyright (c) 1994 John Aycock - * The University of Calgary Department of Computer Science. - * 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 Calgary - * Department of Computer Science 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 AUTHOR 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 AUTHOR 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. - * - * Comments are started by `#' and continue to the end of the line; lines - * may be of the form: - * <label>* - * <label>* <undef-sym> = <value> - * <label>* <opcode> <operand>* - * - * A <label> is an <undef-sym> ending in a colon. Spaces, tabs, and commas - * are token separators. - * - *-M*************************************************************************/ -static char id[] = "$Id$"; -#include <ctype.h> -#include <stdio.h> -#include <string.h> -#include <stdlib.h> -#include <unistd.h> - -#define MEMORY 448 -#define MAXLINE 1024 -#define MAXTOKEN 32 -#define ADOTOUT "a.out" -#define NOVALUE -1 - -/* - * AIC-7770/AIC-7870 register definitions - */ -#define R_SINDEX 0x65 -#define R_ALLONES 0x69 -#define R_ALLZEROS 0x6a -#define R_NONE 0x6a - -int debug; -int lineno, LC; -char *filename; -FILE *ifp, *ofp; -unsigned char M[MEMORY][4]; - -void -error(char *s) -{ - fprintf(stderr, "%s: %s at line %d\n", filename, s, lineno); - exit(EXIT_FAILURE); -} - -void * -Malloc(size_t size) -{ - void *p = malloc(size); - if (!p) - error("out of memory"); - return(p); -} - -void * -Realloc(void *ptr, size_t size) -{ - void *p = realloc(ptr, size); - if (!p) - error("out of memory"); - return(p); -} - -char * -Strdup(char *s) -{ - char *p = (char *)Malloc(strlen(s) + 1); - strcpy(p, s); - return(p); -} - -typedef struct sym_t { - struct sym_t *next; /* MUST BE FIRST */ - char *name; - int value; - int npatch; - int *patch; -} sym_t; - -sym_t *head; - -void -define(char *name, int value) -{ - sym_t *p, *q; - - for (p = head, q = (sym_t *)&head; p; p = p->next) { - if (!strcmp(p->name, name)) - error("redefined symbol"); - q = p; - } - - p = q->next = (sym_t *)Malloc(sizeof(sym_t)); - p->next = NULL; - p->name = Strdup(name); - p->value = value; - p->npatch = 0; - p->patch = NULL; - - if (debug) { - fprintf(stderr, "\"%s\" ", p->name); - if (p->value != NOVALUE) - fprintf(stderr, "defined as 0x%x\n", p->value); - else - fprintf(stderr, "undefined\n"); - } -} - -sym_t * -lookup(char *name) -{ - sym_t *p; - - for (p = head; p; p = p->next) - if (!strcmp(p->name, name)) - return(p); - return(NULL); -} - -void -patch(sym_t *p, int location) -{ - p->npatch += 1; - p->patch = (int *)Realloc(p->patch, p->npatch * sizeof(int *)); - - p->patch[p->npatch - 1] = location; -} - -void backpatch(void) -{ - int i; - sym_t *p; - - for (p = head; p; p = p->next) { - - if (p->value == NOVALUE) { - fprintf(stderr, - "%s: undefined symbol \"%s\"\n", - filename, p->name); - exit(EXIT_FAILURE); - } - - if (p->npatch) { - if (debug) - fprintf(stderr, - "\"%s\" (0x%x) patched at", - p->name, p->value); - - for (i = 0; i < p->npatch; i++) { - M[p->patch[i]][0] &= ~1; - M[p->patch[i]][0] |= ((p->value >> 8) & 1); - M[p->patch[i]][1] = p->value & 0xff; - - if (debug) - fprintf(stderr, " 0x%x", p->patch[i]); - } - - if (debug) - fputc('\n', stderr); - } - } -} - -/* - * Output words in byte-reversed order (least significant first) - * since the sequencer RAM is loaded that way. - */ -void -output(FILE *fp) -{ - int i; - - for (i = 0; i < LC; i++) - fprintf(fp, "\t0x%02x, 0x%02x, 0x%02x, 0x%02x,\n", - M[i][3], - M[i][2], - M[i][1], - M[i][0]); - printf("%d out of %d instructions used.\n", LC, MEMORY); -} - -char ** -getl(int *n) -{ - int i; - char *p, *quote; - static char buf[MAXLINE]; - static char *a[MAXTOKEN]; - - i = 0; - - while (fgets(buf, sizeof(buf), ifp)) { - - lineno += 1; - - if (buf[strlen(buf)-1] != '\n') - error("line too long"); - - p = strchr(buf, '#'); - if (p) - *p = '\0'; - p = buf; -rescan: - quote = strchr(p, '\"'); - if (quote) - *quote = '\0'; - for (p = strtok(p, ", \t\n"); p; p = strtok(NULL, ", \t\n")) - if (i < MAXTOKEN-1) - a[i++] = p; - else - error("too many tokens"); - if (quote) { - quote++; - p = strchr(quote, '\"'); - if (!p) - error("unterminated string constant"); - else if (i < MAXTOKEN-1) { - a[i++] = quote; - *p = '\0'; - p++; - } - else - error("too many tokens"); - goto rescan; - } - if (i) { - *n = i; - return(a); - } - } - return(NULL); -} - -#define A 0x8000 /* `A'ccumulator ok */ -#define I 0x4000 /* use as immediate value */ -#define SL 0x2000 /* shift left */ -#define SR 0x1000 /* shift right */ -#define RL 0x0800 /* rotate left */ -#define RR 0x0400 /* rotate right */ -#define LO 0x8000 /* lookup: ori-{jmp,jc,jnc,call} */ -#define LA 0x4000 /* lookup: and-{jz,jnz} */ -#define LX 0x2000 /* lookup: xor-{je,jne} */ -#define NA -1 /* not applicable */ - -struct { - char *name; - int n; /* number of operands, including opcode */ - unsigned int op; /* immediate or L?|pos_from_0 */ - unsigned int dest; /* NA, pos_from_0, or I|immediate */ - unsigned int src; /* NA, pos_from_0, or I|immediate */ - unsigned int imm; /* pos_from_0, A|pos_from_0, or I|immediate */ - unsigned int addr; /* NA or pos_from_0 */ - int fmt; /* instruction format - 1, 2, or 3 */ -} instr[] = { -/* - * N OP DEST SRC IMM ADDR FMT - */ - { "mov", 3, 1, 1, 2, I|0xff, NA, 1 }, - { "mov", 4, LO|2, NA, 1, I|0, 3, 3 }, - { "mvi", 3, 0, 1, I|R_ALLZEROS, A|2, NA, 1 }, - { "mvi", 4, LO|2, NA, I|R_ALLZEROS, 1, 3, 3 }, - { "not", 2, 2, 1, 1, I|0xff, NA, 1 }, - { "and", 3, 1, 1, 1, A|2, NA, 1 }, - { "and", 4, 1, 1, 3, A|2, NA, 1 }, - { "or", 3, 0, 1, 1, A|2, NA, 1 }, - { "or", 4, 0, 1, 3, A|2, NA, 1 }, - { "or", 5, LO|3, NA, 1, 2, 4, 3 }, - { "xor", 3, 2, 1, 1, A|2, NA, 1 }, - { "xor", 4, 2, 1, 3, A|2, NA, 1 }, - { "nop", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 }, - { "inc", 2, 3, 1, 1, I|1, NA, 1 }, - { "inc", 3, 3, 1, 2, I|1, NA, 1 }, - { "dec", 2, 3, 1, 1, I|0xff, NA, 1 }, - { "dec", 3, 3, 1, 2, I|0xff, NA, 1 }, - { "jmp", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 }, - { "jc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 }, - { "jnc", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 }, - { "call", 2, LO|0, NA, I|R_SINDEX, I|0, 1, 3 }, - { "test", 5, LA|3, NA, 1, A|2, 4, 3 }, - { "cmp", 5, LX|3, NA, 1, A|2, 4, 3 }, - { "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 }, - { "ret", 1, 1, I|R_NONE, I|R_ALLZEROS, I|0xff, NA, 1 }, - { "clc", 1, 3, I|R_NONE, I|R_ALLZEROS, I|1, NA, 1 }, - { "clc", 4, 3, 2, I|R_ALLZEROS, A|3, NA, 1 }, - { "stc", 2, 3, 1, I|R_ALLONES, I|1, NA, 1 }, - { "add", 3, 3, 1, 1, A|2, NA, 1 }, - { "add", 4, 3, 1, 3, A|2, NA, 1 }, - { "adc", 3, 4, 1, 1, A|2, NA, 1 }, - { "adc", 4, 4, 1, 3, A|2, NA, 1 }, - { "shl", 3, 5, 1, 1, SL|2, NA, 2 }, - { "shl", 4, 5, 1, 2, SL|3, NA, 2 }, - { "shr", 3, 5, 1, 1, SR|2, NA, 2 }, - { "shr", 4, 5, 1, 2, SR|3, NA, 2 }, - { "rol", 3, 5, 1, 1, RL|2, NA, 2 }, - { "rol", 4, 5, 1, 2, RL|3, NA, 2 }, - { "ror", 3, 5, 1, 1, RR|2, NA, 2 }, - { "ror", 4, 5, 1, 2, RR|3, NA, 2 }, - /* - * Extensions (note also that mvi allows A) - */ - { "clr", 2, 1, 1, I|R_ALLZEROS, I|0xff, NA, 1 }, - { 0, 0, 0, 0, 0, 0, 0, 0 } -}; - -int -eval_operand(char **a, int spec) -{ - int i; - unsigned int want = spec & (LO|LA|LX); - - static struct { - unsigned int what; - char *name; - int value; - } jmptab[] = { - { LO, "jmp", 8 }, - { LO, "jc", 9 }, - { LO, "jnc", 10 }, - { LO, "call", 11 }, - { LA, "jz", 15 }, - { LA, "jnz", 13 }, - { LX, "je", 14 }, - { LX, "jne", 12 }, - }; - - spec &= ~(LO|LA|LX); - - for (i = 0; i < sizeof(jmptab)/sizeof(jmptab[0]); i++) - if (jmptab[i].what == want && - !strcmp(jmptab[i].name, a[spec])) - { - return(jmptab[i].value); - } - - if (want) - error("invalid jump"); - - return(spec); /* "case 0" - no flags set */ -} - -int -eval_sdi(char **a, int spec) -{ - sym_t *p; - unsigned val; - - if (spec == NA) - return(NA); - - switch (spec & (A|I|SL|SR|RL|RR)) { - case SL: - case SR: - case RL: - case RR: - if (isdigit(*a[spec &~ (SL|SR|RL|RR)])) - val = strtol(a[spec &~ (SL|SR|RL|RR)], NULL, 0); - else { - p = lookup(a[spec &~ (SL|SR|RL|RR)]); - if (!p) - error("undefined symbol used"); - val = p->value; - } - - switch (spec & (SL|SR|RL|RR)) { /* blech */ - case SL: - if (val > 7) - return(0xf0); - return(((val % 8) << 4) | - (val % 8)); - case SR: - if (val > 7) - return(0xf0); - return(((val % 8) << 4) | - (1 << 3) | - ((8 - (val % 8)) % 8)); - case RL: - return(val % 8); - case RR: - return((8 - (val % 8)) % 8); - } - case I: - return(spec &~ I); - case A: - /* - * An immediate field of zero selects - * the accumulator. Vigorously object - * if zero is given otherwise - it's - * most likely an error. - */ - spec &= ~A; - if (!strcmp("A", a[spec])) - return(0); - if (isdigit(*a[spec]) && - strtol(a[spec], NULL, 0) == 0) - { - error("immediate value of zero selects accumulator"); - } - /* falls through */ - case 0: - if (isdigit(*a[spec])) - return(strtol(a[spec], NULL, 0)); - p = lookup(a[spec]); - if (p) - return(p->value); - error("undefined symbol used"); - } - - return(NA); /* shut the compiler up */ -} - -int -eval_addr(char **a, int spec) -{ - sym_t *p; - - if (spec == NA) - return(NA); - if (isdigit(*a[spec])) - return(strtol(a[spec], NULL, 0)); - - p = lookup(a[spec]); - - if (p) { - if (p->value != NOVALUE) - return(p->value); - patch(p, LC); - } else { - define(a[spec], NOVALUE); - p = lookup(a[spec]); - patch(p, LC); - } - - return(NA); /* will be patched in later */ -} - -int -crack(char **a, int n) -{ - int i; - int I_imm, I_addr; - int I_op, I_dest, I_src, I_ret; - - /* - * Check for "ret" at the end of the line; remove - * it unless it's "ret" alone - we still want to - * look it up in the table. - */ - I_ret = (strcmp(a[n-1], "ret") ? 0 : !0); - if (I_ret && n > 1) - n -= 1; - - for (i = 0; instr[i].name; i++) { - /* - * Look for match in table given constraints, - * currently just the name and the number of - * operands. - */ - if (!strcmp(instr[i].name, *a) && instr[i].n == n) - break; - } - if (!instr[i].name) - error("unknown opcode or wrong number of operands"); - - I_op = eval_operand(a, instr[i].op); - I_src = eval_sdi(a, instr[i].src); - I_imm = eval_sdi(a, instr[i].imm); - I_dest = eval_sdi(a, instr[i].dest); - I_addr = eval_addr(a, instr[i].addr); - - if( LC >= MEMORY ) - error("Memory exhausted!\n"); - - switch (instr[i].fmt) { - case 1: - case 2: - M[LC][0] = (I_op << 1) | I_ret; - M[LC][1] = I_dest; - M[LC][2] = I_src; - M[LC][3] = I_imm; - break; - case 3: - if (I_ret) - error("illegal use of \"ret\""); - M[LC][0] = (I_op << 1) | ((I_addr >> 8) & 1); - M[LC][1] = I_addr & 0xff; - M[LC][2] = I_src; - M[LC][3] = I_imm; - break; - } - - return (1); /* no two-byte instructions yet */ -} - -#undef SL -#undef SR -#undef RL -#undef RR -#undef LX -#undef LA -#undef LO -#undef I -#undef A - -void -assemble(void) -{ - int n; - char **a; - sym_t *p; - - while ((a = getl(&n))) { - - while (a[0][strlen(*a)-1] == ':') { - a[0][strlen(*a)-1] = '\0'; - p = lookup(*a); - if (p) - p->value = LC; - else - define(*a, LC); - a += 1; - n -= 1; - } - - if (!n) /* line was all labels */ - continue; - - if (n == 3 && !strcmp("VERSION", *a)) - fprintf(ofp, "#define %s \"%s\"\n", a[1], a[2]); - else { - if (n == 3 && !strcmp("=", a[1])) - define(*a, strtol(a[2], NULL, 0)); - else - LC += crack(a, n); - } - } - - backpatch(); - output(ofp); - - if (debug) - output(stderr); -} - -int -main(int argc, char **argv) -{ - int c; - - while ((c = getopt(argc, argv, "dho:vD")) != EOF) { - switch (c) { - case 'd': - debug = !0; - break; - case 'D': - { - char *p; - if ((p = strchr(optarg, '=')) != NULL) { - *p = '\0'; - define(optarg, strtol(p + 1, NULL, 0)); - } - else - define(optarg, 1); - break; - } - case 'o': - ofp = fopen(optarg, "w"); - if (!ofp) { - perror(optarg); - exit(EXIT_FAILURE); - } - break; - case 'h': - printf("usage: %s [-d] [-Dname] [-ooutput] input\n", - *argv); - exit(EXIT_SUCCESS); - break; - case 'v': - printf("%s\n", id); - exit(EXIT_SUCCESS); - break; - default: - exit(EXIT_FAILURE); - break; - } - } - - if (argc - optind != 1) { - fprintf(stderr, "%s: must have one input file\n", *argv); - exit(EXIT_FAILURE); - } - filename = argv[optind]; - - ifp = fopen(filename, "r"); - if (!ifp) { - perror(filename); - exit(EXIT_FAILURE); - } - - if (!ofp) { - ofp = fopen(ADOTOUT, "w"); - if (!ofp) { - perror(ADOTOUT); - exit(EXIT_FAILURE); - } - } - - assemble(); - exit(EXIT_SUCCESS); -} diff --git a/sys/gnu/misc/aic7xxx/aic7xxx.seq b/sys/gnu/misc/aic7xxx/aic7xxx.seq deleted file mode 100644 index 435da74..0000000 --- a/sys/gnu/misc/aic7xxx/aic7xxx.seq +++ /dev/null @@ -1,1253 +0,0 @@ -##+M######################################################################### -# Adaptec 274x/284x/294x device driver for Linux and FreeBSD. -# -# Copyright (c) 1994 John Aycock -# The University of Calgary Department of Computer Science. -# All rights reserved. -# -# Modifications/enhancements: -# Copyright (c) 1994, 1995 Justin Gibbs. 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 Calgary -# Department of Computer Science 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 AUTHOR 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 AUTHOR 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. -# -# FreeBSD, Twin, Wide, 2 command per target support, tagged queuing and other -# optimizations provided by Justin T. Gibbs (gibbs@FreeBSD.org) -# -##-M######################################################################### - -VERSION AIC7XXX_SEQ_VER "$Id: aic7xxx.seq,v 1.13 1995/04/09 06:40:16 gibbs Exp $" - -SCBMASK = 0x1f - -SCSISEQ = 0x00 -SXFRCTL0 = 0x01 -SXFRCTL1 = 0x02 -SCSISIGI = 0x03 -SCSISIGO = 0x03 -SCSIRATE = 0x04 -SCSIID = 0x05 -SCSIDATL = 0x06 -STCNT = 0x08 -STCNT+0 = 0x08 -STCNT+1 = 0x09 -STCNT+2 = 0x0a -SSTAT0 = 0x0b -CLRSINT1 = 0x0c -SSTAT1 = 0x0c -SIMODE1 = 0x11 -SCSIBUSL = 0x12 -SHADDR = 0x14 -SELID = 0x19 -SBLKCTL = 0x1f -SEQCTL = 0x60 -A = 0x64 # == ACCUM -SINDEX = 0x65 -DINDEX = 0x66 -ALLZEROS = 0x6a -NONE = 0x6a -SINDIR = 0x6c -DINDIR = 0x6d -FUNCTION1 = 0x6e -HADDR = 0x88 -HADDR+1 = 0x89 -HADDR+2 = 0x8a -HADDR+3 = 0x8b -HCNT = 0x8c -HCNT+0 = 0x8c -HCNT+1 = 0x8d -HCNT+2 = 0x8e -SCBPTR = 0x90 -INTSTAT = 0x91 -DFCNTRL = 0x93 -DFSTATUS = 0x94 -DFDAT = 0x99 -QINFIFO = 0x9b -QINCNT = 0x9c -QOUTFIFO = 0x9d - -SCSICONF_A = 0x5a -SCSICONF_B = 0x5b - -# The two reserved bytes at SCBARRAY+1[23] are expected to be set to -# zero, and the reserved bit in SCBARRAY+0 is used as an internal flag -# to indicate whether or not to reload scatter-gather parameters after -# a disconnect. We also use bits 6 & 7 to indicate whether or not to -# initiate SDTR or WDTR repectively when starting this command. -# -SCBARRAY+0 = 0xa0 - -DISCONNECTED = 0x04 -NEEDDMA = 0x08 -SG_LOAD = 0x10 -TAG_ENB = 0x20 -NEEDSDTR = 0x40 -NEEDWDTR = 0x80 - -SCBARRAY+1 = 0xa1 -SCBARRAY+2 = 0xa2 -SCBARRAY+3 = 0xa3 -SCBARRAY+4 = 0xa4 -SCBARRAY+5 = 0xa5 -SCBARRAY+6 = 0xa6 -SCBARRAY+7 = 0xa7 -SCBARRAY+8 = 0xa8 -SCBARRAY+9 = 0xa9 -SCBARRAY+10 = 0xaa -SCBARRAY+11 = 0xab -SCBARRAY+12 = 0xac -SCBARRAY+13 = 0xad -SCBARRAY+14 = 0xae -SCBARRAY+15 = 0xaf -SCBARRAY+16 = 0xb0 -SCBARRAY+17 = 0xb1 -SCBARRAY+18 = 0xb2 -SCBARRAY+19 = 0xb3 -SCBARRAY+20 = 0xb4 -SCBARRAY+21 = 0xb5 -SCBARRAY+22 = 0xb6 -SCBARRAY+23 = 0xb7 -SCBARRAY+24 = 0xb8 -SCBARRAY+25 = 0xb9 -SCBARRAY+26 = 0xba -SCBARRAY+27 = 0xbb -SCBARRAY+28 = 0xbc -SCBARRAY+29 = 0xbd - -BAD_PHASE = 0x01 # unknown scsi bus phase -CMDCMPLT = 0x02 -SEND_REJECT = 0x11 # sending a message reject -NO_IDENT = 0x21 # no IDENTIFY after reconnect -NO_MATCH = 0x31 # no cmd match for reconnect -MSG_SDTR = 0x41 # SDTR message recieved -MSG_WDTR = 0x51 # WDTR message recieved -MSG_REJECT = 0x61 # Reject message recieved -BAD_STATUS = 0x71 # Bad status from target -RESIDUAL = 0x81 # Residual byte count != 0 -ABORT_TAG = 0x91 # Sent an ABORT_TAG message - -# The host adapter card (at least the BIOS) uses 20-2f for SCSI -# device information, 32-33 and 5a-5f as well. As it turns out, the -# BIOS trashes 20-2f, writing the synchronous negotiation results -# on top of the BIOS values, so we re-use those for our per-target -# scratchspace (actually a value that can be copied directly into -# SCSIRATE). The kernel driver will enable synchronous negotiation -# for all targets that have a value other than 0 in the lower four -# bits of the target scratch space. This should work irregardless of -# whether the bios has been installed. NEEDWDTR and NEEDSDTR are the top -# two bits of the SCB control byte. The kernel driver will set these -# when a WDTR or SDTR message should be sent to the target the SCB's -# command references. -# -# The high bit of DROPATN is set if ATN should be dropped before the ACK -# when outb is called. REJBYTE contains the first byte of a MESSAGE IN -# message, so the driver can report an intelligible error if a message is -# rejected. -# -# FLAGS's high bit is true if we are currently handling a reselect; -# its next-highest bit is true ONLY IF we've seen an IDENTIFY message -# from the reselecting target. If we haven't had IDENTIFY, then we have -# no idea what the lun is, and we can't select the right SCB register -# bank, so force a kernel panic if the target attempts a data in/out or -# command phase instead of corrupting something. -# -# Note that SG_NEXT occupies four bytes. -# -SYNCNEG = 0x20 - -DROPATN = 0x30 -REJBYTE = 0x31 -DISC_DSB_A = 0x32 -DISC_DSB_B = 0x33 - -MSG_LEN = 0x34 -MSG_START+0 = 0x35 -MSG_START+1 = 0x36 -MSG_START+2 = 0x37 -MSG_START+3 = 0x38 -MSG_START+4 = 0x39 -MSG_START+5 = 0x3a --MSG_START+0 = 0xcb # 2's complement of MSG_START+0 - -ARG_1 = 0x4a # sdtr conversion args & return -BUS_16_BIT = 0x01 -RETURN_1 = 0x4a - -SIGSTATE = 0x4b # value written to SCSISIGO - -# Linux users should use 0xc (12) for SG_SIZEOF -SG_SIZEOF = 0x8 # sizeof(struct ahc_dma) -#SG_SIZEOF = 0xc # sizeof(struct scatterlist) -SCB_SIZEOF = 0x13 # sizeof SCB to DMA (19 bytes) - -SG_NOLOAD = 0x4c # load SG pointer/length? -SG_COUNT = 0x4d # working value of SG count -SG_NEXT = 0x4e # working value of SG pointer -SG_NEXT+0 = 0x4e -SG_NEXT+1 = 0x4f -SG_NEXT+2 = 0x50 -SG_NEXT+3 = 0x51 - -SCBCOUNT = 0x52 # the actual number of SCBs -FLAGS = 0x53 # Device configuration flags -TWIN_BUS = 0x01 -WIDE_BUS = 0x02 -MAX_SYNC = 0x08 -SENSE = 0x10 -ACTIVE_MSG = 0x20 -IDENTIFY_SEEN = 0x40 -RESELECTED = 0x80 - -ACTIVE_A = 0x54 -ACTIVE_B = 0x55 -SAVED_TCL = 0x56 -# Poll QINCNT for work - the lower bits contain -# the number of entries in the Queue In FIFO. -# -start: - test FLAGS,SENSE jnz start_sense -start_nosense: - test FLAGS,TWIN_BUS jz start2 # Are we a twin channel device? -# For fairness, we check the other bus first, since we just finished a -# transaction on the current channel. - xor SBLKCTL,0x08 # Toggle to the other bus - test SCSISIGI,0x4 jnz reselect # BSYI - xor SBLKCTL,0x08 # Toggle to the original bus -start2: - test SCSISIGI,0x4 jnz reselect # BSYI - test QINCNT,SCBMASK jz start_nosense - -# We have at least one queued SCB now. Set the SCB pointer -# from the FIFO so we see the right bank of SCB registers, -# then set SCSI options and set the initiator and target -# SCSI IDs. -# - mov SCBPTR,QINFIFO - -# If the control byte of this SCB has the NEEDDMA flag set, we have -# yet to DMA it from host memory - -test SCBARRAY+0,NEEDDMA jz test_busy - clr HCNT+2 - clr HCNT+1 - mvi HCNT+0,SCB_SIZEOF - - mvi DINDEX,HADDR - mvi SCBARRAY+26 call bcopy_4 - - mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET - -# Wait for DMA from host memory to data FIFO to complete, then disable -# DMA and wait for it to acknowledge that it's off. -# - call dma_finish - -# Copy the SCB from the FIFO to the SCBARRAY - - mvi DINDEX, SCBARRAY+0 - call bcopy_3_dfdat - call bcopy_4_dfdat - call bcopy_4_dfdat - call bcopy_4_dfdat - call bcopy_4_dfdat - -# See if there is not already an active SCB for this target. This code -# locks out on a per target basis instead of target/lun. Although this -# is not ideal for devices that have multiple luns active at the same -# time, it is faster than looping through all SCB's looking for active -# commands. It may be benificial to make findscb a more general procedure -# to see if the added cost of the search is negligible. This code also -# assumes that the kernel driver will clear the active flags on board -# initialization, board reset, and a target's SELTO. - -test_busy: - test SCBARRAY+0,0x20 jnz start_scb - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - test SCBARRAY+1,0x88 jz test_a # Id < 8 && A channel - - test ACTIVE_B,A jnz requeue - or ACTIVE_B,A # Mark the current target as busy - jmp start_scb - -start_sense: -# Clear the SENSE flag first, then do a normal start_scb - and FLAGS,0xef - jmp start_scb - -# Place the currently active back on the queue for later processing -requeue: - mov QINFIFO, SCBPTR - jmp start_nosense - -test_a: - test ACTIVE_A,A jnz requeue - or ACTIVE_A,A # Mark the current target as busy - -start_scb: - or SCBARRAY+0,NEEDDMA - and SINDEX,0xf7,SBLKCTL #Clear the channel select bit - and A,0x08,SCBARRAY+1 #Get new channel bit - or SINDEX,A - mov SBLKCTL,SINDEX # select channel - mov SCBARRAY+1 call initialize - clr SG_NOLOAD - and FLAGS,0x3f # !RESELECTING - -# As soon as we get a successful selection, the target should go -# into the message out phase since we have ATN asserted. Prepare -# the message to send, locking out the device driver. If the device -# driver hasn't beaten us with an ABORT or RESET message, then tack -# on an SDTR negotiation if required. -# -# Messages are stored in scratch RAM starting with a flag byte (high bit -# set means active message), one length byte, and then the message itself. -# - mov SCBARRAY+1 call disconnect # disconnect ok? - - and SINDEX,0x7,SCBARRAY+1 # lun - or SINDEX,A # return value from disconnect - or SINDEX,0x80 call mk_mesg # IDENTIFY message - - mov A,SINDEX - test SCBARRAY+0,0xe0 jz !message # WDTR, SDTR or TAG?? - cmp MSG_START+0,A jne !message # did driver beat us? - -# Tag Message if Tag enabled in SCB control block. Use SCBPTR as the tag -# value - -mk_tag: - mvi DINDEX, MSG_START+1 - test SCBARRAY+0,TAG_ENB jz mk_tag_done - and A,0x23,SCBARRAY+0 - mov DINDIR,A - mov DINDIR,SCBPTR - - add MSG_LEN,-MSG_START+0,DINDEX # update message length - -mk_tag_done: - - mov DINDEX call mk_dtr # build DTR message if needed - -!message: - -# Enable selection phase as an initiator, and do automatic ATN -# after the selection. -# - mvi SCSISEQ,0x48 # ENSELO|ENAUTOATNO - -# Wait for successful arbitration. The AIC-7770 documentation says -# that SELINGO indicates successful arbitration, and that it should -# be used to look for SELDO. However, if the sequencer is paused at -# just the right time - a parallel fsck(8) on two drives did it for -# me - then SELINGO can flip back to false before we've seen it. This -# makes the sequencer sit in the arbitration loop forever. This is -# Not Good. -# -# Therefore, I've added a check in the arbitration loop for SELDO -# too. This could arguably be made a critical section by disabling -# pauses, but I don't want to make a potentially infinite loop a CS. -# I suppose you could fold it into the select loop, too, but since -# I've been hunting this bug for four days it's kinda like a trophy. -# -arbitrate: - test SSTAT0,0x40 jnz *select # SELDO - test SSTAT0,0x10 jz arbitrate # SELINGO - -# Wait for a successful selection. If the hardware selection -# timer goes off, then the driver gets the interrupt, so we don't -# need to worry about it. -# -select: - test SSTAT0,0x40 jz select # SELDO - jmp *select - -# Reselection is being initiated by a target - we've seen the BSY -# line driven active, and we didn't do it! Enable the reselection -# hardware, and wait for it to finish. Make a note that we've been -# reselected, but haven't seen an IDENTIFY message from the target -# yet. -# -reselect: - mvi SCSISEQ,0x10 # ENRSELI - -reselect1: - test SSTAT0,0x20 jz reselect1 # SELDI - mov SELID call initialize - - and FLAGS,0x3f # reselected, no IDENTIFY - or FLAGS,RESELECTED - -# After the [re]selection, make sure that the [re]selection enable -# bit is off. This chip is flaky enough without extra things -# turned on. Also clear the BUSFREE bit in SSTAT1 since we'll be -# using it shortly. -# -*select: - clr SCSISEQ - mvi CLRSINT1,0x8 # CLRBUSFREE - -# Main loop for information transfer phases. If BSY is false, then -# we have a bus free condition, expected or not. Otherwise, wait -# for the target to assert REQ before checking MSG, C/D and I/O -# for the bus phase. -# -# We can't simply look at the values of SCSISIGI here (if we want -# to do synchronous data transfer), because the target won't assert -# REQ if it's already sent us some data that we haven't acknowledged -# yet. -# -ITloop: - test SSTAT1,0x8 jnz p_busfree # BUSFREE - test SSTAT1,0x1 jz ITloop # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - - cmp ALLZEROS,A je p_dataout - cmp A,0x40 je p_datain - cmp A,0x80 je p_command - cmp A,0xc0 je p_status - cmp A,0xa0 je p_mesgout - cmp A,0xe0 je p_mesgin - - mvi INTSTAT,BAD_PHASE # unknown - signal driver - -p_dataout: - mvi 0 call scsisig # !CDO|!IOO|!MSGO - call assert - call sg_load - - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy_4 - -# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR - mvi SCBARRAY+23 call bcopy_3 - - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy_3 - -# If we are the last SG block, don't set wideodd. - test SCBARRAY+18,0xff jnz p_dataout_wideodd - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - jmp p_dataout_rest - -p_dataout_wideodd: - mvi 0xbd call dma # WIDEODD|SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - -p_dataout_rest: -# After a DMA finishes, save the final transfer pointer and count -# back into the SCB, in case a device disconnects in the middle of -# a transfer. Use SHADDR and STCNT instead of HADDR and HCNT, since -# it's a reflection of how many bytes were transferred on the SCSI -# (as opposed to the host) bus. -# - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy_3 - - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy_4 - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -p_datain: - mvi 0x40 call scsisig # !CDO|IOO|!MSGO - call assert - call sg_load - - mvi DINDEX,HADDR - mvi SCBARRAY+19 call bcopy_4 - -# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR - mvi SCBARRAY+23 call bcopy_3 - - mvi DINDEX,STCNT - mvi SCBARRAY+23 call bcopy_3 - -# If we are the last SG block, don't set wideodd. - test SCBARRAY+18,0xff jnz p_datain_wideodd - mvi 0x39 call dma # SCSIEN|SDMAEN|HDMAEN| - # !DIRECTION|FIFORESET - jmp p_datain_rest -p_datain_wideodd: - mvi 0xb9 call dma # WIDEODD|SCSIEN|SDMAEN|HDMAEN| - # !DIRECTION|FIFORESET -p_datain_rest: - mvi DINDEX,SCBARRAY+23 - mvi STCNT call bcopy_3 - - mvi DINDEX,SCBARRAY+19 - mvi SHADDR call bcopy_4 - - call sg_advance - mov SCBARRAY+18,SG_COUNT # residual S/G count - - jmp ITloop - -# Command phase. Set up the DMA registers and let 'er rip - the -# two bytes after the SCB SCSI_cmd_length are zeroed by the driver, -# so we can copy those three bytes directly into HCNT. -# -p_command: - mvi 0x80 call scsisig # CDO|!IOO|!MSGO - call assert - - mvi DINDEX,HADDR - mvi SCBARRAY+7 call bcopy_4 - -# mvi DINDEX,HCNT # implicit since HCNT is next to HADDR - mvi SCBARRAY+11 call bcopy_3 - - mvi DINDEX,STCNT - mvi SCBARRAY+11 call bcopy_3 - - mvi 0x3d call dma # SCSIEN|SDMAEN|HDMAEN| - # DIRECTION|FIFORESET - jmp ITloop - -# Status phase. Wait for the data byte to appear, then read it -# and store it into the SCB. -# -p_status: - mvi 0xc0 call scsisig # CDO|IOO|!MSGO - - mvi SCBARRAY+14 call inb_first - jmp p_mesgin_done - -# Message out phase. If there is no active message, but the target -# took us into this phase anyway, build a no-op message and send it. -# -p_mesgout: - mvi 0xa0 call scsisig # CDO|!IOO|MSGO - mvi 0x8 call mk_mesg # build NOP message - - clr STCNT+2 - clr STCNT+1 - -# Set up automatic PIO transfer from MSG_START. Bit 3 in -# SXFRCTL0 (SPIOEN) is already on. -# - mvi SINDEX,MSG_START+0 - mov DINDEX,MSG_LEN - -# When target asks for a byte, drop ATN if it's the last one in -# the message. Otherwise, keep going until the message is exhausted. -# (We can't use outb for this since it wants the input in SINDEX.) -# -# Keep an eye out for a phase change, in case the target issues -# a MESSAGE REJECT. -# -p_mesgout2: - test SSTAT0,0x2 jz p_mesgout2 # SPIORDY - test SSTAT1,0x10 jnz p_mesgout6 # PHASEMIS - - cmp DINDEX,1 jne p_mesgout3 # last byte? - mvi CLRSINT1,0x40 # CLRATNO - drop ATN - -# Write a byte to the SCSI bus. The AIC-7770 refuses to automatically -# send ACKs in automatic PIO or DMA mode unless you make sure that the -# "expected" bus phase in SCSISIGO matches the actual bus phase. This -# behaviour is completely undocumented and caused me several days of -# grief. -# -# After plugging in different drives to test with and using a longer -# SCSI cable, I found that I/O in Automatic PIO mode ceased to function, -# especially when transferring >1 byte. It seems to be much more stable -# if STCNT is set to one before the transfer, and SDONE (in SSTAT0) is -# polled for transfer completion - for both output _and_ input. The -# only theory I have is that SPIORDY doesn't drop right away when SCSIDATL -# is accessed (like the documentation says it does), and that on a longer -# cable run, the sequencer code was fast enough to loop back and see -# an SPIORDY that hadn't dropped yet. -# -p_mesgout3: - mvi STCNT+0, 0x01 - mov SCSIDATL,SINDIR - -p_mesgout4: - test SSTAT0,0x4 jz p_mesgout4 # SDONE - dec DINDEX - test DINDEX,0xff jnz p_mesgout2 - -# If the next bus phase after ATN drops is a message out, it means -# that the target is requesting that the last message(s) be resent. -# -p_mesgout5: - test SSTAT1,0x8 jnz p_mesgout6 # BUSFREE - test SSTAT1,0x1 jz p_mesgout5 # REQINIT - - and A,0xe0,SCSISIGI # CDI|IOI|MSGI - cmp A,0xa0 jne p_mesgout6 - mvi 0x10 call scsisig # ATNO - re-assert ATN - - jmp ITloop - -p_mesgout6: - mvi CLRSINT1,0x40 # CLRATNO - in case of PHASEMIS - and FLAGS,0xdf # no active msg - jmp ITloop - -# Message in phase. Bytes are read using Automatic PIO mode, but not -# using inb. This alleviates a race condition, namely that if ATN had -# to be asserted under Automatic PIO mode, it had to beat the SCSI -# circuitry sending an ACK to the target. This showed up under heavy -# loads and really confused things, since ABORT commands wouldn't be -# seen by the drive after an IDENTIFY message in until it had changed -# to a data I/O phase. -# -p_mesgin: - mvi 0xe0 call scsisig # CDO|IOO|MSGO - mvi A call inb_first # read the 1st message byte - mvi REJBYTE,A # save it for the driver - - cmp ALLZEROS,A jne p_mesgin1 - -# We got a "command complete" message, so put the SCB pointer -# into the Queue Out, and trigger a completion interrupt. -# Check status for non zero return and interrupt driver if needed -# This allows the driver to interpret errors only when they occur -# instead of always uploading the scb. If the status is SCSI_CHECK, -# the driver will download a new scb requesting sense, to replace -# the old one and set the SENSE sequencer flag. If the sense flag is -# set, the sequencer imediately jumps to start working on the sense -# command. If the kernel driver does not wish to request sense, it need -# do nothing, and the command is allowed to complete. We don't -# bother to post to the QOUTFIFO in the error case since it would require -# extra work in the kernel driver to ensure that the entry was removed -# before the command complete code tried processing it. - -# First check for residuals - test SCBARRAY+15,0xff jnz resid - test SCBARRAY+16,0xff jnz resid - test SCBARRAY+17,0xff jnz resid - -check_status: - test SCBARRAY+14,0xff jz status_ok # 0 Status? - mvi INTSTAT,BAD_STATUS # let driver know - test FLAGS,SENSE jz status_ok - jmp p_mesgin_done - -status_ok: -# First, mark this target as free. - test SCBARRAY+0,0x20 jnz complete # Tagged command - and FUNCTION1,0x70,SCBARRAY+1 - mov A,FUNCTION1 - test SCBARRAY+1,0x88 jz clear_a - xor ACTIVE_B,A - jmp complete - -clear_a: - xor ACTIVE_A,A - -complete: - mov QOUTFIFO,SCBPTR - mvi INTSTAT,CMDCMPLT - jmp p_mesgin_done - -# If we have a residual count, interrupt and tell the host. Other -# alternatives are to pause the sequencer on all command completes (yuck), -# dma the resid directly to the host (slick, but a ton of instructions), or -# have the sequencer pause itself when it encounters a non-zero resid -# (unecessary pause just to flag the command -- yuck, but takes few instructions -# and since it shouldn't happen that often is good enough for our purposes). - -resid: - mvi INTSTAT,RESIDUAL - jmp check_status - -# Is it an extended message? We only support the synchronous and wide data -# transfer request messages, which will probably be in response to -# WDTR or SDTR message outs from us. If it's not SDTR or WDTR, reject it - -# apparently this can be done after any message in byte, according -# to the SCSI-2 spec. -# -p_mesgin1: - cmp A,1 jne p_mesgin2 # extended message code? - - mvi ARG_1 call inb_next # extended message length - mvi A call inb_next # extended message code - - cmp A,1 je p_mesginSDTR # Syncronous negotiation message - cmp A,3 je p_mesginWDTR # Wide negotiation message - jmp p_mesginN - -p_mesginWDTR: - cmp ARG_1,2 jne p_mesginN # extended mesg length = 2 - mvi A call inb_next # Width of bus - mvi INTSTAT,MSG_WDTR # let driver know - test RETURN_1,0x80 jz p_mesgin_done# Do we need to send WDTR? - -# We didn't initiate the wide negotiation, so we must respond to the request - and RETURN_1,0x7f # Clear the SEND_WDTR Flag - or FLAGS,ACTIVE_MSG - mvi DINDEX,MSG_START+0 - mvi MSG_START+0 call mk_wdtr # build WDTR message - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - jmp p_mesgin_done - -p_mesginSDTR: - cmp ARG_1,3 jne p_mesginN # extended mesg length = 3 - mvi ARG_1 call inb_next # xfer period - mvi A call inb_next # REQ/ACK offset - mvi INTSTAT,MSG_SDTR # call driver to convert - - test RETURN_1,0xc0 jz p_mesgin_done# Do we need to mk_sdtr or rej? - test RETURN_1,0x40 jnz p_mesginN # Requested SDTR too small - rej - or FLAGS,ACTIVE_MSG - mvi DINDEX, MSG_START+0 - mvi MSG_START+0 call mk_sdtr - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - jmp p_mesgin_done - -# Is it a disconnect message? Set a flag in the SCB to remind us -# and await the bus going free. -# -p_mesgin2: - cmp A,4 jne p_mesgin3 # disconnect code? - - or SCBARRAY+0,0x4 # set "disconnected" bit - jmp p_mesgin_done - -# Save data pointers message? Copy working values into the SCB, -# usually in preparation for a disconnect. -# -p_mesgin3: - cmp A,2 jne p_mesgin4 # save data pointers code? - - call sg_ram2scb - jmp p_mesgin_done - -# Restore pointers message? Data pointers are recopied from the -# SCB anyway at the start of any DMA operation, so the only thing -# to copy is the scatter-gather values. -# -p_mesgin4: - cmp A,3 jne p_mesgin5 # restore pointers code? - - call sg_scb2ram - jmp p_mesgin_done - -# Identify message? For a reconnecting target, this tells us the lun -# that the reconnection is for - find the correct SCB and switch to it, -# clearing the "disconnected" bit so we don't "find" it by accident later. -# -p_mesgin5: - test A,0x80 jz p_mesgin6 # identify message? - - test A,0x78 jnz p_mesginN # !DiscPriv|!LUNTAR|!Reserved - - and A,0x07 # lun in lower three bits - or SAVED_TCL,A,SELID - and SAVED_TCL,0xf7 - and A,0x08,SBLKCTL # B Channel?? - or SAVED_TCL,A - call inb_last # ACK - mov ALLZEROS call findSCB -setup_SCB: - and SCBARRAY+0,0xfb # clear disconnect bit in SCB - or FLAGS,IDENTIFY_SEEN # make note of IDENTIFY - - call sg_scb2ram # implied restore pointers - # required on reselect - jmp ITloop -get_tag: - mvi A call inb_first - cmp A,0x20 jne return # Simple Tag message? - mvi A call inb_next - call inb_last - test A,0xf0 jnz abort_tag # Tag in range? - mov SCBPTR,A - mov A,SAVED_TCL - cmp SCBARRAY+1,A jne abort_tag - test SCBARRAY+0,TAG_ENB jz abort_tag - ret -abort_tag: - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - mvi INTSTAT,ABORT_TAG # let driver know - mvi 0xd call mk_mesg # ABORT TAG message - ret - -# Message reject? Let the kernel driver handle this. If we have an -# outstanding WDTR or SDTR negotiation, assume that it's a response from -# the target selecting 8bit or asynchronous transfer, otherwise just ignore -# it since we have no clue what it pertains to. -# -p_mesgin6: - cmp A,7 jne p_mesgin7 # message reject code? - - mvi INTSTAT, MSG_REJECT - jmp p_mesgin_done - -# [ ADD MORE MESSAGE HANDLING HERE ] -# -p_mesgin7: - -# We have no idea what this message in is, and there's no way -# to pass it up to the kernel, so we issue a message reject and -# hope for the best. Since we're now using manual PIO mode to -# read in the message, there should no longer be a race condition -# present when we assert ATN. In any case, rejection should be a -# rare occurrence - signal the driver when it happens. -# -p_mesginN: - or SINDEX,0x10,SIGSTATE # turn on ATNO - call scsisig - mvi INTSTAT,SEND_REJECT # let driver know - - mvi 0x7 call mk_mesg # MESSAGE REJECT message - -p_mesgin_done: - call inb_last # ack & turn auto PIO back on - jmp ITloop - - -# Bus free phase. It might be useful to interrupt the device -# driver if we aren't expecting this. For now, make sure that -# ATN isn't being asserted and look for a new command. -# -p_busfree: - mvi CLRSINT1,0x40 # CLRATNO - clr SIGSTATE - jmp start - -# Instead of a generic bcopy routine that requires an argument, we unroll -# the two cases that are actually used, and call them explicitly. This -# not only reduces the overhead of doing a bcopy by 2/3rds, but ends up -# saving space in the program since you don't have to put the argument -# into the accumulator before the call. Both functions expect DINDEX to -# contain the destination address and SINDEX to contain the source -# address. -bcopy_3: - mov DINDIR,SINDIR - mov DINDIR,SINDIR - mov DINDIR,SINDIR ret - -bcopy_4: - mov DINDIR,SINDIR - mov DINDIR,SINDIR - mov DINDIR,SINDIR - mov DINDIR,SINDIR ret - -bcopy_3_dfdat: - mov DINDIR,DFDAT - mov DINDIR,DFDAT - mov DINDIR,DFDAT ret - -bcopy_4_dfdat: - mov DINDIR,DFDAT - mov DINDIR,DFDAT - mov DINDIR,DFDAT - mov DINDIR,DFDAT ret - -# Locking the driver out, build a one-byte message passed in SINDEX -# if there is no active message already. SINDEX is returned intact. -# -mk_mesg: - mvi SEQCTL,0x50 # PAUSEDIS|FASTMODE - test FLAGS,ACTIVE_MSG jnz mk_mesg1 # active message? - - or FLAGS,ACTIVE_MSG # if not, there is now - mvi MSG_LEN,1 # length = 1 - mov MSG_START+0,SINDEX # 1-byte message - -mk_mesg1: - mvi SEQCTL,0x10 ret # !PAUSEDIS|FASTMODE - -# Carefully read data in Automatic PIO mode. I first tried this using -# Manual PIO mode, but it gave me continual underrun errors, probably -# indicating that I did something wrong, but I feel more secure leaving -# Automatic PIO on all the time. -# -# According to Adaptec's documentation, an ACK is not sent on input from -# the target until SCSIDATL is read from. So we wait until SCSIDATL is -# latched (the usual way), then read the data byte directly off the bus -# using SCSIBUSL. When we have pulled the ATN line, or we just want to -# acknowledge the byte, then we do a dummy read from SCISDATL. The SCSI -# spec guarantees that the target will hold the data byte on the bus until -# we send our ACK. -# -# The assumption here is that these are called in a particular sequence, -# and that REQ is already set when inb_first is called. inb_{first,next} -# use the same calling convention as inb. -# -inb_first: - clr STCNT+2 - clr STCNT+1 - mov DINDEX,SINDEX - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_next: - mov DINDEX,SINDEX # save SINDEX - - mvi STCNT+0,1 # xfer one byte - mov NONE,SCSIDATL # dummy read from latch to ACK -inb_next1: - test SSTAT0,0x4 jz inb_next1 # SDONE -inb_next2: - test SSTAT0,0x2 jz inb_next2 # SPIORDY - wait for next byte - mov DINDIR,SCSIBUSL ret # read byte directly from bus - -inb_last: - mvi STCNT+0,1 # ACK with dummy read - mov NONE,SCSIDATL -inb_last1: - test SSTAT0,0x4 jz inb_last1 # wait for completion - ret - -# DMA data transfer. HADDR and HCNT must be loaded first, and -# SINDEX should contain the value to load DFCNTRL with - 0x3d for -# host->scsi, or 0x39 for scsi->host. The SCSI channel is cleared -# during initialization. -# -dma: - mov DFCNTRL,SINDEX -dma1: -dma2: - test SSTAT0,0x1 jnz dma3 # DMADONE - test SSTAT1,0x10 jz dma1 # PHASEMIS, ie. underrun - -# We will be "done" DMAing when the transfer count goes to zero, or -# the target changes the phase (in light of this, it makes sense that -# the DMA circuitry doesn't ACK when PHASEMIS is active). If we are -# doing a SCSI->Host transfer, the data FIFO should be flushed auto- -# magically on STCNT=0 or a phase change, so just wait for FIFO empty -# status. -# -dma3: - test SINDEX,0x4 jnz dma5 # DIRECTION -dma4: - test DFSTATUS,0x1 jz dma4 # !FIFOEMP - -# Now shut the DMA enables off, and copy STCNT (ie. the underrun -# amount, if any) to the SCB registers; SG_COUNT will get copied to -# the SCB's residual S/G count field after sg_advance is called. Make -# sure that the DMA enables are actually off first lest we get an ILLSADDR. -# -dma5: - clr DFCNTRL # disable DMA -dma6: - test DFCNTRL,0x38 jnz dma6 # SCSIENACK|SDMAENACK|HDMAENACK - - mvi DINDEX,SCBARRAY+15 - mvi STCNT call bcopy_3 - - ret - -dma_finish: - test DFSTATUS,0x8 jz dma_finish # HDONE - - clr DFCNTRL # disable DMA -dma_finish2: - test DFCNTRL,0x8 jnz dma_finish2 # HDMAENACK - ret - -# Common SCSI initialization for selection and reselection. Expects -# the target SCSI ID to be in the upper four bits of SINDEX, and A's -# contents are stomped on return. -# -initialize: - and SINDEX,0xf0 # Get target ID - and A,0x0f,SCSIID - or SINDEX,A - mov SCSIID,SINDEX - -# Esundry initialization. -# - clr DROPATN - clr SIGSTATE - -# Turn on Automatic PIO mode now, before we expect to see a REQ -# from the target. It shouldn't hurt anything to leave it on. Set -# CLRCHN here before the target has entered a data transfer mode - -# with synchronous SCSI, if you do it later, you blow away some -# data in the SCSI FIFO that the target has already sent to you. -# - mvi SXFRCTL0,0x8a # DFON|SPIOEN|CLRCHN - -# Initialize scatter-gather pointers by setting up the working copy -# in scratch RAM. -# - call sg_scb2ram - -# Initialize SCSIRATE with the appropriate value for this target. -# - call ndx_dtr - mov SCSIRATE,SINDIR ret - -# Assert that if we've been reselected, then we've seen an IDENTIFY -# message. -# -assert: - test FLAGS,RESELECTED jz return # reselected? - test FLAGS,IDENTIFY_SEEN jnz return # seen IDENTIFY? - - mvi INTSTAT,NO_IDENT ret # no - cause a kernel panic - -# Find out if disconnection is ok from the information the BIOS has left -# us. The tcl from SCBARRAY+1 should be in SINDEX; A will -# contain either 0x40 (disconnection ok) or 0x00 (disconnection not ok) -# on exit. -# -# To allow for wide or twin busses, we check the upper bit of the target ID -# and the channel ID and look at the appropriate disconnect register. -# -disconnect: - and FUNCTION1,0x70,SINDEX # strip off extra just in case - mov A,FUNCTION1 - test SINDEX, 0x88 jz disconnect_a - - test DISC_DSB_B,A jz disconnect1 # bit nonzero if DISabled - clr A ret - -disconnect_a: - test DISC_DSB_A,A jz disconnect1 # bit nonzero if DISabled - clr A ret - -disconnect1: - mvi A,0x40 ret - -# Locate the SCB matching the target ID/channel/lun in SAVED_TCL and switch -# the SCB to it. Have the kernel print a warning message if it can't be -# found, and generate an ABORT message to the target. SINDEX should be -# cleared on call. -# -findSCB: - mov A,SAVED_TCL - mov SCBPTR,SINDEX # switch to new SCB - cmp SCBARRAY+1,A jne findSCB1 # target ID/channel/lun match? - test SCBARRAY+0,0x4 jz findSCB1 # should be disconnected - test SCBARRAY+0,TAG_ENB jnz get_tag - ret - -findSCB1: - inc SINDEX - mov A,SCBCOUNT - cmp SINDEX,A jne findSCB - - mvi INTSTAT,NO_MATCH # not found - signal kernel - mvi 0x6 call mk_mesg # ABORT message - - or SINDEX,0x10,SIGSTATE # assert ATNO - call scsisig - ret - -# Make a working copy of the scatter-gather parameters in the SCB. -# -sg_scb2ram: - mov SG_COUNT,SCBARRAY+2 - - mvi DINDEX,SG_NEXT - mvi SCBARRAY+3 call bcopy_4 - - mvi SG_NOLOAD,0x80 - test SCBARRAY+0,0x10 jnz return # don't reload s/g? - clr SG_NOLOAD ret - -# Copying RAM values back to SCB, for Save Data Pointers message. -# -sg_ram2scb: - mov SCBARRAY+2,SG_COUNT - - mvi DINDEX,SCBARRAY+3 - mvi SG_NEXT call bcopy_4 - - and SCBARRAY+0,0xef,SCBARRAY+0 - test SG_NOLOAD,0x80 jz return # reload s/g? - or SCBARRAY+0,SG_LOAD ret - -# Load a struct scatter if needed and set up the data address and -# length. If the working value of the SG count is nonzero, then -# we need to load a new set of values. -# -# This, like the above DMA, assumes a little-endian host data storage. -# -sg_load: - test SG_COUNT,0xff jz return # SG being used? - test SG_NOLOAD,0x80 jnz return # don't reload s/g? - - clr HCNT+2 - clr HCNT+1 - mvi HCNT+0,SG_SIZEOF - - mvi DINDEX,HADDR - mvi SG_NEXT call bcopy_4 - - mvi DFCNTRL,0xd # HDMAEN|DIRECTION|FIFORESET - -# Wait for DMA from host memory to data FIFO to complete, then disable -# DMA and wait for it to acknowledge that it's off. -# - - call dma_finish - -# Copy data from FIFO into SCB data pointer and data count. This assumes -# that the struct scatterlist has this structure (this and sizeof(struct -# scatterlist) == 12 are asserted in aic7xxx.c): -# -# struct scatterlist { -# char *address; /* four bytes, little-endian order */ -# ... /* four bytes, ignored */ -# unsigned short length; /* two bytes, little-endian order */ -# } -# - -# Not in FreeBSD. the scatter list entry is only 8 bytes. -# -# struct ahc_dma_seg { -# physaddr addr; /* four bytes, little-endian order */ -# long len; /* four bytes, little endian order */ -# }; -# - - mvi DINDEX, SCBARRAY+19 - call bcopy_4_dfdat - -# For Linux, we must throw away four bytes since there is a 32bit gap -# in the middle of a struct scatterlist -# mov NONE,DFDAT -# mov NONE,DFDAT -# mov NONE,DFDAT -# mov NONE,DFDAT - - call bcopy_3_dfdat #Only support 24 bit length. - ret - -# Advance the scatter-gather pointers only IF NEEDED. If SG is enabled, -# and the SCSI transfer count is zero (note that this should be called -# right after a DMA finishes), then move the working copies of the SG -# pointer/length along. If the SCSI transfer count is not zero, then -# presumably the target is disconnecting - do not reload the SG values -# next time. -# -sg_advance: - test SG_COUNT,0xff jz return # s/g enabled? - - test STCNT+0,0xff jnz sg_advance1 # SCSI transfer count nonzero? - test STCNT+1,0xff jnz sg_advance1 - test STCNT+2,0xff jnz sg_advance1 - - clr SG_NOLOAD # reload s/g next time - dec SG_COUNT # one less segment to go - - clr A # add sizeof(struct scatter) - add SG_NEXT+0,SG_SIZEOF,SG_NEXT+0 - adc SG_NEXT+1,A,SG_NEXT+1 - adc SG_NEXT+2,A,SG_NEXT+2 - adc SG_NEXT+3,A,SG_NEXT+3 ret - -sg_advance1: - mvi SG_NOLOAD,0x80 ret # don't reload s/g next time - -# Add the array base SYNCNEG to the target offset (the target address -# is in SCSIID), and return the result in SINDEX. The accumulator -# contains the 3->8 decoding of the target ID on return. -# -ndx_dtr: - shr A,SCSIID,4 - test SBLKCTL,0x08 jz ndx_dtr_2 - or A,0x08 # Channel B entries add 8 -ndx_dtr_2: - add SINDEX,SYNCNEG,A - - and FUNCTION1,0x70,SCSIID # 3-bit target address decode - mov A,FUNCTION1 ret - -# If we need to negotiate transfer parameters, build the WDTR or SDTR message -# starting at the address passed in SINDEX. DINDEX is modified on return. -# The SCSI-II spec requires that Wide negotiation occur first and you can -# only negotiat one or the other at a time otherwise in the event of a message -# reject, you wouldn't be able to tell which message was the culpret. -# -mk_dtr: - test SCBARRAY+0,0xc0 jz return # NEEDWDTR|NEEDSDTR - test SCBARRAY+0,NEEDWDTR jnz mk_wdtr_16bit - or FLAGS, MAX_SYNC # Force an offset of 15 - -mk_sdtr: - mvi DINDIR,1 # extended message - mvi DINDIR,3 # extended message length = 3 - mvi DINDIR,1 # SDTR code - call sdtr_to_rate - mov DINDIR,RETURN_1 # REQ/ACK transfer period - test FLAGS, MAX_SYNC jnz mk_sdtr_max_sync - and DINDIR,0xf,SINDIR # Sync Offset - -mk_sdtr_done: - add MSG_LEN,-MSG_START+0,DINDEX ret # update message length - -mk_sdtr_max_sync: -# We're initiating sync negotiation, so request the max offset we can (15) - mvi DINDIR, 0x0f - xor FLAGS, MAX_SYNC - jmp mk_sdtr_done - -mk_wdtr_16bit: - mvi ARG_1,BUS_16_BIT -mk_wdtr: - mvi DINDIR,1 # extended message - mvi DINDIR,2 # extended message length = 2 - mvi DINDIR,3 # WDTR code - mov DINDIR,ARG_1 # bus width - - add MSG_LEN,-MSG_START+0,DINDEX ret # update message length - -# Set SCSI bus control signal state. This also saves the last-written -# value into a location where the higher-level driver can read it - if -# it has to send an ABORT or RESET message, then it needs to know this -# so it can assert ATN without upsetting SCSISIGO. The new value is -# expected in SINDEX. Change the actual state last to avoid contention -# from the driver. -# -scsisig: - mov SIGSTATE,SINDEX - mov SCSISIGO,SINDEX ret - -sdtr_to_rate: - call ndx_dtr # index scratch space for target - shr A,SINDIR,0x4 - dec SINDEX #Preserve SINDEX - and A,0x7 - clr RETURN_1 -sdtr_to_rate_loop: - test A,0x0f jz sdtr_to_rate_done - add RETURN_1,0x18 - dec A - jmp sdtr_to_rate_loop -sdtr_to_rate_done: - shr RETURN_1,0x2 - add RETURN_1,0x18 ret - -return: - ret diff --git a/sys/gnu/scsi/nic5000.c b/sys/gnu/scsi/nic5000.c deleted file mode 100644 index d4271df..0000000 --- a/sys/gnu/scsi/nic5000.c +++ /dev/null @@ -1,1476 +0,0 @@ -static char rcsid[] = "@(#)$Id: nic5000.c,v 1.1 1995/02/14 15:00:37 jkh Exp $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: nic5000.c,v $ - * Revision 1.1 1995/02/14 15:00:37 jkh - * An ISDN driver that supports the EDSS1 and the 1TR6 ISDN interfaces. - * EDSS1 is the "Euro-ISDN", 1TR6 is the soon obsolete german ISDN Interface. - * Obtained from: Dietmar Friede <dfriede@drnhh.neuhaus.de> and - * Juergen Krause <jkr@saarlink.de> - * - * This is only one part - the rest to follow in a couple of hours. - * This part is a benign import, since it doesn't affect anything else. - * - * - ******************************************************************************/ - -/* - * - * Copyright (c) 1994 Dietmar Friede (dietmar@friede.de) All rights reserved. - * FSF/FSAG GNU Copyright applies - * - * A low level driver for the NICCY-5000 ISDN/SCSI device - * - */ - -#include "snic.h" -#if NSNIC > 0 - -#define SPLSNIC splbio -#define ESUCCESS 0 -#define SNIC_RETRIES 8 -#include "sys/types.h" -#include "sys/param.h" -#include "sys/ioctl.h" -#include "sys/malloc.h" -#include "sys/kernel.h" - -#include "scsi/scsi_all.h" -#include "scsi/scsiconf.h" -#include "gnu/isdn/isdn_ioctl.h" -#include "gnu/i386/isa/niccyreg.h" -#include "gnu/scsi/scsi_nic.h" -/* #define NETBSD */ - -#undef SCSI_NOMASK -#define OPEN 1 -#define LOAD_HEAD 2 -#define LOAD_DATA 4 -#define LOAD_ENTITY 8 -#define IS_DIAL(p) (((p)&0x20)==0) -#define IS_LISTEN(p) ((p)&0x20) -#define CHAN(pl) (((pl)&7)-1) -#define C_CHAN(x) ((x)&1) -#define APPL(pl) ((((pl)>>6)&0x7f)-1) -#define CARD(pl) (((pl)>>13)&7) -#define MK_APPL(pl) (((pl)+1)<<6) -#define min(a,b) ((a)<(b)?(a):(b)) - -#define SNICOUTSTANDING 2 - -extern int hz; - -struct snic_data -{ - struct scsi_switch *sc_sw; /* address of scsi low level switch */ - int ctrl; /* so they know which one we want */ - int targ; /* our scsi target ID */ - int lu; /* out scsi lu */ - int cmdscount; /* cmds allowed outstanding by board*/ - int xfer_block_wait; - struct scsi_xfer *free_xfer; - struct scsi_xfer scsi_xfer[SNICOUTSTANDING]; /* XXX */ -}; - -struct snic_driver -{ - int size; - struct snic_data **snic_data; -}*snic_driver; - -static int next_snic_unit = 0; -static unsigned dnlnum = 0; - -static u_char ack_msg= 0xff; -static u_char snic_nxt_b; - -typedef enum -{ - DISCON, ISDISCON, DIAL, CALLED, CONNECT, IDLE, ACTIVE, WAITING, WAIT_ACK -} io_state; - -typedef struct -{ - char ctrl; - u_char msg_nr; - short plci; - short ncci; - short state; - Buffer o_buf; -} chan_t; - -struct snic_softc -{ - short sc_stat; - u_char sc_flags; - u_char sc_unit; - u_char sc_ctrl; - u_char sc_type; - u_short sc_istat; - struct scsi_msg sc_icmd; - Buffer sc_imsg; - Header sc_imsg0; - u_short sc_ostat; - struct scsi_msg sc_ocmd; - Buffer sc_omsg; - chan_t sc_chan[2]; - u_char sc_state_ind[8]; - u_char sc_gotack; -} snic_sc[NSNIC]; - -extern isdn_appl_t isdn_appl[]; -extern isdn_ctrl_t isdn_ctrl[]; -extern u_short isdn_state; -extern int ispy_applnr; -extern int Isdn_Appl, Isdn_Ctrl, Isdn_Typ; -extern void isdn_start_out(); - -static old_spy= 0; -static void snic_interupt(); -static int snic_get_msg(); -static void snic_start(); - -int snic_connect(), snic_listen(), snic_disconnect(), snic_accept(); -int snic_output(); - -#ifdef NETBSD -int snicattach(int ctrl, struct scsi_switch *scsi_switch, int physid, int *sunit) -{ - int targ, lu; -#else /* FreeBSD */ -int snicattach(int ctrl, int targ, int lu, struct scsi_switch *scsi_switch) -{ -#endif - int unit,i; - struct snic_data *snic, **snicrealloc; - struct snic_softc *sc; - int cn; - isdn_ctrl_t *ctrl0, *ctrl1; - -#ifdef NETBSD - targ = physid >> 3; - lu = physid & 7; -#endif - - if(next_snic_unit >= NSNIC) - return(0); - - unit = next_snic_unit; - if (next_snic_unit == 0) - { - snic_driver = - malloc(sizeof(struct snic_driver),M_DEVBUF,M_NOWAIT); - if(!snic_driver) - { - printf("snic%d: malloc failed\n",unit); - return(0); - } - bzero(snic_driver,sizeof(snic_driver)); - snic_driver->size = 0; - } - next_snic_unit++; - - if(unit >= snic_driver->size) - { - snicrealloc = - malloc(sizeof(snic_driver->snic_data) * next_snic_unit, - M_DEVBUF,M_NOWAIT); - if(!snicrealloc) - { - printf("snic%d: malloc failed\n",unit); - return(0); - } - /* Make sure we have something to copy before we copy it */ - bzero(snicrealloc,sizeof(snic_driver->snic_data) * next_snic_unit); - if(snic_driver->size) - { - bcopy(snic_driver->snic_data,snicrealloc, - sizeof(snic_driver->snic_data) * snic_driver->size); - free(snic_driver->snic_data,M_DEVBUF); - } - snic_driver->snic_data = snicrealloc; - snic_driver->snic_data[unit] = NULL; - snic_driver->size++; - } - - if(snic_driver->snic_data[unit]) - { - return(0); - } - - snic = snic_driver->snic_data[unit] = - malloc(sizeof(struct snic_data),M_DEVBUF,M_NOWAIT); - if(!snic) - { - printf("snic%d: malloc failed\n",unit); - return(0); - } -#ifdef NETBSD - *sunit= unit; -#endif - bzero(snic,sizeof(struct snic_data)); - - snic->sc_sw = scsi_switch; - snic->ctrl = ctrl; - snic->targ = targ; - snic->lu = lu; - snic->cmdscount = SNICOUTSTANDING; /* XXX (ask the board) */ - - i = snic->cmdscount; - while(i-- ) - { - snic->scsi_xfer[i].next = snic->free_xfer; - snic->free_xfer = &snic->scsi_xfer[i]; - } - - sc = &snic_sc[unit]; - sc->sc_ctrl = -1; - sc->sc_gotack= 1; - if ((cn = isdn_ctrl_attach(2)) == -1) - { - return (0); - } - sc->sc_ctrl = cn; - - sc->sc_chan[0].plci = sc->sc_chan[1].plci = -1; - - ctrl0 = &isdn_ctrl[cn]; - ctrl1 = &isdn_ctrl[cn + 1]; - sc->sc_chan[0].ctrl = ctrl0->ctrl = cn; - sc->sc_chan[1].ctrl = ctrl1->ctrl = cn + 1; - ctrl0->o_buf = &sc->sc_chan[0].o_buf.Data[5]; - ctrl1->o_buf = &sc->sc_chan[1].o_buf.Data[5]; - - ctrl0->listen = ctrl1->listen = snic_listen; - ctrl0->disconnect = ctrl1->disconnect = snic_disconnect; - ctrl0->accept = ctrl1->accept = snic_accept; - ctrl0->connect = ctrl1->connect = snic_connect; - ctrl0->output = ctrl1->output = snic_output; - ctrl0->unit = ctrl1->unit = unit; - ctrl0->appl = ctrl1->appl = -1; - ctrl0->o_len = ctrl1->o_len = -1; - sc->sc_flags= LOAD_ENTITY; - return(1); -} - -static -struct scsi_xfer *snic_get_xs(int unit) -{ - struct scsi_xfer *xs; - struct snic_data *snic; - int s; - - snic = snic_driver->snic_data[unit]; - if (xs = snic->free_xfer) - { - snic->free_xfer = xs->next; - xs->flags = 0; - } - return(xs); -} - -static void -snic_free_xs(int unit, struct scsi_xfer *xs) -{ - struct snic_data *snic; - - snic = snic_driver->snic_data[unit]; - xs->next = snic->free_xfer; - snic->free_xfer = xs; -} - -static void -snic_timout(int unit) -{ - struct snic_softc * sc= &snic_sc[unit&0xff]; - - if(sc->sc_istat&0x100) - { - snic_interupt(unit); - return; - } - if(sc->sc_istat & 2) - sc->sc_istat= sc->sc_ostat= 0; - else if((sc->sc_istat & 0x200) == 0 ) return; - if(sc->sc_ostat & 0xff) - { - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); - return; - } - if(sc->sc_gotack) snic_start(unit); - snic_get_msg(unit); -} - -static int -isdn_small_interupt(int unit, struct scsi_xfer *xs) -{ - struct snic_data *snic = snic_driver->snic_data[unit]; - struct snic_softc * sc= &snic_sc[unit]; - Header *msg = &sc->sc_imsg0; - int c; - - switch (msg->Type) - { - case 0: - if(sc->sc_istat&0x200) - break; - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); - break; - case 0xff: - sc->sc_gotack= 1; - break; - case 0xfe: -printf("f"); - sc->sc_gotack= 1; - for(c= 0; c < 2; c++) - { - chan_t *chan = &sc->sc_chan[c]; - if(chan->state == WAIT_ACK) - { - chan->state = WAITING; - sc->sc_ostat |= c?0x800:0x400; - } - } - break; - case 0xfd: -printf("fd"); - break; - default: - return(0); - } - sc->sc_istat&= ~0xff; - sc->sc_imsg0.Type= 0; - return(1); -} - -static void -snic_get_done(int unit, struct scsi_xfer *xs) -{ - struct snic_data *snic = snic_driver->snic_data[unit]; - struct snic_softc * sc= &snic_sc[unit]; - Header *msg = &sc->sc_imsg0; - int len, error; - - error= xs->error; - - switch(error) - { - case XS_NOERROR: - if(xs->datalen == 0) - sc->sc_imsg.h.Type= 0; - - if(isdn_small_interupt(unit,xs)) break; - - if(xs->datalen < (len=(msg->DataLen + 10))) - { - struct scsi_msg *scsi_cmd= &sc->sc_icmd; - /* resubmit it */ - - sc->sc_imsg.h.Type= 0xba; - scsi_cmd->len[1]= (len>>8)&0xff; - scsi_cmd->len[2]= len&0xff; - xs->retries= SNIC_RETRIES; - xs->error = XS_NOERROR; - xs->flags &= ~ITSDONE; - xs->data = (char *) &sc->sc_imsg; - xs->datalen = len; - xs->resid = len; - - if ((*(snic->sc_sw->scsi_cmd))(xs) == SUCCESSFULLY_QUEUED) - { - return; - } - error= xs->error | 0x1000; - break; - } - if(xs->datalen <= 10) - { - sc->sc_istat|= 0x400; - sc->sc_imsg.h = sc->sc_imsg0; - } - sc->sc_imsg0.Type= 0; - break; - - case XS_TIMEOUT: - case XS_BUSY: - case XS_DRIVER_STUFFUP: - break; - default: - printf("snic%d: unknown error %x\n",unit,xs->error); - } - - if(error) - { - sc->sc_imsg.h.Type= sc->sc_imsg0.Type= 0; - sc->sc_istat&= 0x200; - if((sc->sc_istat&0x200) == 0) - { - sc->sc_istat= 0x200; - timeout(snic_timout,unit,2); - } - } - - snic_free_xs(unit,xs); - if(sc->sc_istat&0x4ff == 0x400 ) - sc->sc_istat|= 1; - if(sc->sc_istat&0xff) - { - snic_interupt(unit); - return; - } - if(sc->sc_gotack) snic_start(unit); - if(sc->sc_istat & 0x200) - return; - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); -} - -static int -snic_get_msg(unit) -int unit; -{ - struct snic_data *snic = snic_driver->snic_data[unit]; - struct snic_softc * sc= &snic_sc[unit]; - struct scsi_msg *scsi_cmd= &sc->sc_icmd; - struct scsi_xfer *xs; - Header *data= &sc->sc_imsg0; - int retval; - - if(sc->sc_istat&0xff) - return(-1); - sc->sc_istat |= 1; - - data->Type= 0xbb; - sc->sc_istat &= ~0x200; - - bzero(scsi_cmd, sizeof(struct scsi_msg)); - bzero(data,10); - - scsi_cmd->op_code = GET_MSG_COMMAND; - scsi_cmd->len[2]= 10; - - xs = snic_get_xs(unit); - if(!xs) - { - sc->sc_istat&= ~0xff; - data->Type= 0; - return(EBUSY); - } - - xs->flags |= (INUSE | SCSI_DATA_IN | SCSI_NOSLEEP); - xs->adapter = snic->ctrl; - xs->targ = snic->targ; - xs->lu = snic->lu; - xs->retries = SNIC_RETRIES; - xs->timeout = 2000; - xs->cmd = (struct scsi_generic *) scsi_cmd; - xs->cmdlen = sizeof(struct scsi_msg); - xs->data = (char *) data; - xs->datalen = 10; - xs->resid = 10; - xs->when_done = snic_get_done; - xs->done_arg = unit; - xs->done_arg2 = (int)xs; - xs->bp = NULL; - xs->error = XS_NOERROR; - - if(retval = (*(snic->sc_sw->scsi_cmd))(xs)) - { - sc->sc_istat= ~0xff; - data->Type= 0; - snic_free_xs(unit,xs); - } - return (retval); -} - -static void -snic_put_done(int unit, struct scsi_xfer *xs) -{ - int retval; - struct snic_data *snic = snic_driver->snic_data[unit]; - struct snic_softc * sc= &snic_sc[unit]; - Header *b= (Header *) xs->data; - int c; - - sc->sc_ostat&= ~0xff; - if(xs->error != XS_NOERROR) - { - snic_free_xs(unit,xs); - switch(b->Type) - { - case 0: - return; - case 0xff: - sc->sc_ostat|= 0x100; - return; - case BD_DATA_B3_REQ | 0x40: - case BD_DATA_B3_REQ: - sc->sc_ostat|= 0x400; - return; - default: - sc->sc_ostat|= 0x200; - return; - } - } - - snic_free_xs(unit,xs); - - c= 0; - switch(b->Type) - { - case 0xff: break; - case BD_DATA_B3_REQ | 0x40: - c= 1; - case BD_DATA_B3_REQ: - sc->sc_chan[c].state = WAIT_ACK; - break; - default: - b->Type= 0; - } - - if(sc->sc_istat&0x100) - { - snic_interupt(unit); - return; - } - - if(sc->sc_ostat&0x100) - { - sc->sc_ostat&= ~0x100; - if(snic_put_msg(unit,&ack_msg,1,0)) - sc->sc_ostat|= 0x100; - else return; - } - - if(sc->sc_gotack) snic_start(unit); - if(sc->sc_istat&0x200) - return; - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); -} - -static void -snic_start(int unit) -{ - int retval; - struct snic_softc * sc= &snic_sc[unit]; - Header *b; - int c; - - if(sc->sc_ostat&0x200) - { - b= &sc->sc_omsg.h; - sc->sc_ostat&= ~0x200; - if(snic_put_msg(unit,b, b->DataLen+10,2)) - sc->sc_ostat|= 0x200; - else return; - } - - - for(c= 0; c<2; c++) - { - int cc= (snic_nxt_b++)&1; - u_short m= 0x400 << cc; - - if(sc->sc_ostat&m) - { - chan_t *chan= &sc->sc_chan[cc]; - b= &chan->o_buf.h; - sc->sc_ostat&= ~m; - if(chan->state == WAITING) - { - chan->state= ACTIVE; - if(snic_put_msg(unit,b, b->DataLen+10,4)) - { - chan->state= WAITING; - sc->sc_ostat|= m; - } - else return; - } - } - } -} - -int -snic_put_msg(int unit, Header *data, unsigned len, int w) -{ - struct snic_softc *sc = &snic_sc[unit]; - struct scsi_msg *scsi_cmd = &sc->sc_ocmd; - int retval; - struct scsi_xfer *xs; - struct snic_data *snic = snic_driver->snic_data[unit]; - - if(data->Type==0) - return(0); - - if(sc->sc_ostat&0xff) - return(EBUSY); - - sc->sc_ostat |= 1; - if((data->Type == 0xa8) || (data->Type == 0xe8)) - { - if(sc->sc_gotack==0) - { - sc->sc_ostat &= ~0xff; - return(EBUSY); - } - } - if(data->Type != 0xff) - sc->sc_gotack= 0; - bzero(scsi_cmd, sizeof(struct scsi_msg)); - - scsi_cmd->op_code = PUT_MSG_COMMAND; - if(len > 2063) - { - printf("snic%d: unsupported length %d\n",unit,len); - sc->sc_ostat &= ~0xff; - return(ENODEV); - } - scsi_cmd->len[1]= (len >> 8) & 0xff; - scsi_cmd->len[2]= len & 0xff; - - xs = snic_get_xs(unit); - if(!xs) - { - printf("snic pm%d: busy %d\n", unit, w); - sc->sc_ostat &= ~0xff; - return(EBUSY); - } - xs->flags |= (INUSE | SCSI_DATA_OUT | SCSI_NOSLEEP); - xs->adapter = snic->ctrl; - xs->targ = snic->targ; - xs->lu = snic->lu; - xs->retries = SNIC_RETRIES; - xs->timeout = 2000; - xs->cmd = (struct scsi_generic *) scsi_cmd; - xs->cmdlen = sizeof(struct scsi_msg); - xs->data = (char *)data; - xs->datalen = len; - xs->resid = len; - xs->when_done = snic_put_done; - xs->done_arg = unit; - xs->done_arg2 = (int)xs; - xs->bp = NULL; - xs->error = XS_NOERROR; - - if(retval = (*(snic->sc_sw->scsi_cmd))(xs)) - { - sc->sc_ostat &= ~0xff; - snic_free_xs(unit,xs); - return(EBUSY); - } - - return(0); -} - -int -snicopen(dev_t dev, int flag) -{ - struct snic_softc *sc; - u_char unit; - int x; - unsigned error; - u_char b= 0xff; - - unit = minor(dev); - /* minor number out of limits ? */ - if (unit >= next_snic_unit) - return (ENXIO); - sc = &snic_sc[unit]; - - x= splhigh(); - /* Card busy ? */ - if (sc->sc_flags & 7) - { - splx(x); - return (EBUSY); - } - sc->sc_flags |= OPEN; - - if(sc->sc_flags & LOAD_ENTITY) - { - snic_get_msg(unit); -/* - if(snic_put_msg(unit,(Header *) &ack_msg,1,5)) - sc->sc_ostat|= 0x100; -*/ - } - - splx(x); - return (0); -} - -int -snicclose(dev_t dev, int flag) -{ - struct snic_softc *sc = &snic_sc[minor(dev)]; - - sc->sc_flags &= ~7; - return (0); -} - -int -snicioctl(dev_t dev, int cmd, caddr_t data, int flag) -{ - int error; - u_char unit= minor(dev); - int i, x; - struct snic_softc *sc = &snic_sc[minor(dev)]; - Buffer *b= &sc->sc_omsg; - - error = 0; - x= splhigh(); - while(sc->sc_ostat || (sc->sc_gotack==0)) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "ioctl", 2); - if (error != EWOULDBLOCK) - { - splx(x); - return(error); - } - } - - switch (cmd) - { - case NICCY_DEBUG: - data[0]= 0x50; - bcopy(sc->sc_state_ind,data+1,8); - break; - case NICCY_LOAD: - { - struct head *head = (struct head *) data; - int len, l, off; - - bzero(b, 22); - b->h.Type = MD_DNL_MOD_REQ; - sc->sc_type = head->typ; - b->h.SubType = head->typ; - b->h.DataLen = 12; - bcopy(head->nam, b->Data, 8); - bcopy(&head->len, &b->Data[8], 4); - - sc->sc_flags |= LOAD_HEAD; - sc->sc_stat = -1; - while((error= snic_put_msg(unit,(Header *) b,22,6)) == EBUSY) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic1", 1); - if (error != EWOULDBLOCK) - break; - } - if(error == 0) - { - while (sc->sc_flags & LOAD_HEAD) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic2", 1); - if (error != EWOULDBLOCK) - break; - error= 0; - } - } - if (sc->sc_flags & 7) - sc->sc_flags = (sc->sc_flags & ~7 ) | OPEN; - if(error) - { - head->status = sc->sc_stat; - splx(x); - return (error); - } - - len= head->d_len; - off= 0; - while(len > 0) - { - while(sc->sc_ostat || (sc->sc_gotack==0)) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic7", 2); - if (error != EWOULDBLOCK) - { - splx(x); - return(error); - } - } - bzero(b,10); - b->h.Type = MD_DNL_MOD_DATA; - sc->sc_type = head->typ; - b->h.SubType = head->typ; - l= min(len,512); - len-= l; - b->h.DataLen = l + 8; - b->h.Number = dnlnum++; - b->h.MoreData= len>0; - bcopy(head->nam, b->Data, 8); - if(error= copyin(head->data+off, b->Data+8, l)) - { - splx(x); - return(error); - } - off+= l; - sc->sc_flags |= LOAD_DATA; - sc->sc_stat = -1; - - while((error= snic_put_msg(unit,(Header *) b,b->h.DataLen+10,7)) == EBUSY) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic3", 1); - if (error != EWOULDBLOCK) - break; - } - } - - if(error == 0) - { - while (sc->sc_flags & LOAD_DATA) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic4", 1); - if (error != EWOULDBLOCK) - break; - error= 0; - } - } - if (sc->sc_flags & 7) - sc->sc_flags = (sc->sc_flags & ~7 ) | OPEN; - head->status = sc->sc_stat; - splx(x); - return (error); - } - case NICCY_SET_CLOCK: - bzero(b,10); - b->h.Type = MD_SET_CLOCK_REQ; - b->h.DataLen = 14; - bcopy(data, b->Data,14); - while((error= snic_put_msg(unit,(Header *) b,24,8)) == EBUSY) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic5", 1); - if (error != EWOULDBLOCK) - break; - } - splx(x); - return (error); - case NICCY_SPY: - bzero(b,10); - b->h.Type = MD_MANUFACT_REQ; - b->h.SubType = 18; - b->h.DataLen = 1; -/* There are ilegal states. So I use them to toggle */ - if((data[0] == 0) && (old_spy == 0)) data[0]= 255; - else if(data[0] && old_spy ) data[0]= 0; - old_spy= b->Data[0]= data[0]; - while((error= snic_put_msg(unit,(Header *) b,11,9)) == EBUSY) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic6", 1); - if (error != EWOULDBLOCK) - break; - } - splx(x); - return (error); - case NICCY_RESET: - bzero(b,10); - b->h.Type = MD_RESET_REQ; - while((error= snic_put_msg(unit,(Header *) b,10,9)) == EBUSY) - { - error = tsleep((caddr_t) sc, PZERO | PCATCH, "nic6", 1); - if (error != EWOULDBLOCK) - break; - } - sc->sc_flags|= LOAD_ENTITY; - splx(x); - return (error); - - default: - error = ENODEV; - } - splx(x); - return (error); -} - -#define con_b3_req(unit,mb,pl) en_q(unit,mb|BD_CONN_B3_REQ,0,pl,0,NULL) -#define con_act_resp(unit,pl) en_q(unit,DD_CONN_ACT_RSP,0, pl,0,NULL) -#define discon_resp(sc,pl) en_q(unit,DD_DISC_RSP,0, pl,0,NULL) -#define inf_resp(unit,pl) en_q(unit,DD_INFO_RSP,0, pl,0,NULL) -#define listen_b3_req(unit,mb,pl) en_q(unit,mb|BD_LIST_B3_REQ,0,pl,0,NULL) -#define con_resp(unit,pl,rea) en_q(unit,DD_CONN_RSP,0, pl, 1,(u_char *) &rea) - -static int -en_q(int unit, int t, int st, int pl, int l, u_char *val) -{ - struct snic_softc * sc= &snic_sc[unit]; - Buffer *b= &sc->sc_omsg; - int error= 0; - - if(b->h.Type) - { - return(EBUSY); - } - bzero(b,10); -if(( t >= 0x80) && CHAN(pl) && ((t & 0x40) == 0)) -printf("?%x %x",t,pl); -if(t>=0x40) -printf("S%x %x",t,pl); - - b->h.Type = t; - b->h.SubType = st; - b->h.PLCI = pl; - if(l) - { - b->h.DataLen= l; - bcopy(val,b->Data,l); - } - - if((error= snic_put_msg(unit,(Header *) b,10+l,13)) == EBUSY) - { - sc->sc_ostat|= 0x200; - return(0); - } - return(error); -} - -static int -reset_plci(int w, chan_t * chan, short p) -{ - isdn_ctrl_t *ctrl; - - if (p == -1) - return (-1); - - if(chan == NULL) - return(p); - - ctrl = &isdn_ctrl[chan->ctrl]; - if(chan->plci == p) - { - if (ISBUSY(ctrl->appl)) - { - isdn_disconn_ind(ctrl->appl); - isdn_appl[ctrl->appl].ctrl = -1; - isdn_appl[ctrl->appl].state = 0; - } - ctrl->appl = -1; - ctrl->o_len = -1; - chan->plci = -1; - chan->ncci = -1; - chan->state = DISCON; - chan->o_buf.h.Type= 0; - } - return (p); -} - -static int -sel_b2_prot_req(int unit, int c, int pl, dlpd_t * dlpd) -{ - return(en_q(unit, (c ? 0x40 : 0)| BD_SEL_PROT_REQ, 2, pl, sizeof(dlpd_t), (u_char *) dlpd)); -} - -static int -sel_b3_prot_req(int unit, int mb, u_short pl, ncpd_t * ncpd) -{ - return(en_q(unit, mb | BD_SEL_PROT_REQ, 3, pl, sizeof(ncpd_t), (u_char *) ncpd)); -} - -static int -discon_req(int w, int unit , int pl, int rea, int err) -{ - if((pl == 0) || (pl == -1)) - return(0); - return(en_q(unit, DD_DISC_REQ,0, pl, 1, (u_char *) &rea)); -} - -static int -state_ind(int unit, int api, int spv) -{ - u_char buf[3]; - - buf[0]= unit; buf[1]= api; buf[2]= spv; - return(en_q(unit, MD_STATE_IND,0, 0, 3, buf)); -} - -static int -con_b3_resp(int unit, int mb, u_short ncci, u_short pl, u_char reject) -{ - u_char buf[32]; - int l = 4; - - bzero(buf, 32); - *(u_short *) buf = ncci; - buf[2] = reject; - buf[3] = 0; /* ncpi ??? */ - l += 15; - return(en_q(unit, mb | BD_CONN_B3_RSP,0, pl, l, buf)); -} - -int -snic_connect(int cn, int ap, int b_channel, int inf_mask, int out_serv - ,int out_serv_add, int src_subadr, unsigned ad_len - ,char *dest_addr, int spv) -{ - char buf[128]; - - if (ad_len > 118) - return (-1); - - buf[0] = spv ? 0x53 : 0; - buf[1] = b_channel; - if (spv) - inf_mask |= 0x40000000; - *(u_long *) & buf[2] = inf_mask; - buf[6] = out_serv; - buf[7] = out_serv_add; - buf[8] = src_subadr; - buf[9] = ad_len; - bcopy(dest_addr, &buf[10], ad_len); - return (en_q(isdn_ctrl[cn].unit, DD_CONN_REQ, 0, MK_APPL(ap), ad_len + 10, buf)); -} - -int -snic_listen(int cn, int ap, int inf_mask, int subadr_mask, int si_mask, int spv) -{ - u_short sbuf[4]; - - if (spv) - inf_mask |= 0x40000000; - *(u_long *) sbuf = inf_mask; - sbuf[2] = subadr_mask; - sbuf[3] = si_mask; - return (en_q(isdn_ctrl[cn].unit, DD_LISTEN_REQ, 0, MK_APPL(ap), 8, (u_char *) sbuf)); -} - -int -snic_disconnect(int cn, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - chan_t *chan = &snic_sc[ctrl->unit].sc_chan[C_CHAN(cn)]; - int p, err; - u_char buf[16]; - - if(chan->ncci != -1) - { - bzero(buf,16); - *(u_short *) buf = chan->ncci; - err= en_q(ctrl->unit, (C_CHAN(cn)?0x40:0)|BD_DISC_B3_REQ, 0 - , chan->plci, 3+sizeof(ncpi_t), buf); - if((err==0) && (ctrl->o_len == 0)) - ctrl->o_len= -1; - return(err); - } - p = chan->plci; - if ((p == 0) || (p == -1)) - return (ENODEV); - - err= en_q(ctrl->unit, DD_DISC_REQ, 0, p, 1, (u_char *) &rea); - if((err==0) && (ctrl->o_len == 0)) - ctrl->o_len= -1; - return(err); -} - -int -snic_accept(int cn, int an, int rea) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct snic_softc *sc = &snic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - isdn_appl_t *appl = &isdn_appl[an]; - - if(ISFREE(ctrl->appl)) - return(ENODEV); - - if (rea) - { - ctrl->appl= -1; - return(discon_req(1, ctrl->unit, chan->plci, rea, 0)); - } - ctrl->appl= an; - ctrl->lastact = time.tv_sec; - appl->ctrl= cn; - appl->state= 4; - - return(sel_b2_prot_req(ctrl->unit, C_CHAN(cn), chan->plci, &appl->dlpd)); -} - -int -snic_output(int cn) -{ - isdn_ctrl_t *ctrl = &isdn_ctrl[cn]; - struct snic_softc *sc = &snic_sc[ctrl->unit]; - chan_t *chan = &sc->sc_chan[C_CHAN(cn)]; - int len= ctrl->o_len; - Buffer *b= &chan->o_buf; - int error= 0; - - if (sc->sc_state_ind[1] || (chan->ncci == -1)) - return (ENODEV); - - if(chan->state != IDLE) - return(EBUSY); - chan->state= WAITING; - - bzero(b,10); - - b->h.Type = BD_DATA_B3_REQ; - if(C_CHAN(cn)) b->h.Type |= 0x40; - b->h.PLCI = chan->plci; - b->h.DataLen= len+5; - *(u_short *) b->Data = chan->ncci; - *(u_short *) &b->Data[2] = 0; - b->h.Number = b->Data[4] = chan->msg_nr++; - - chan->state = ACTIVE; - ctrl->lastact = time.tv_sec; - - if((error= snic_put_msg(ctrl->unit,(Header *) b,15+len,14)) == EBUSY) - { - sc->sc_ostat|= C_CHAN(cn)?0x800:0x400; - chan->state= WAITING; - return(0); - } - return(error); -} - -static void -badstate(Header *h, int n) -{ - int i; - u_char *p= (u_char *)h; - printf("Niccy: not implemented %x.%x len %d at %d", h->Type, - h->SubType, h->DataLen,n); - if(h->DataLen) - { - p+= 10; - for(i=0; i < h->DataLen ; i++) printf(" %x",p[i]); - } - printf("\n"); -} - -unsigned SavMsgTyp; - -static void -snic_interupt(unsigned unit) -{ - struct snic_softc * sc= &snic_sc[unit&0xff]; - Buffer *msg; - chan_t *chan; - u_short n, mb, c, pl, err = 0; - isdn_ctrl_t *ctrl; - isdn_appl_t *appl; - int error= 0; - - msg = &sc->sc_imsg; - chan= NULL; - ctrl= NULL; - appl= NULL; - -SavMsgTyp= msg->h.Type; - - if(sc->sc_istat & 2) - return; - - if(sc->sc_ostat&0xff) - { - sc->sc_istat|= 0x101; - if(sc->sc_istat&0x200) - return; - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); - return; - } - - mb= 0; - pl = msg->h.PLCI; - if(pl && (msg->h.Type >= 0x40) && (msg->h.Type < 0xfd) && (msg->h.Type != 0x47)) - { - if ((c = CHAN(pl)) < 2) - { - chan = &sc->sc_chan[c]; - ctrl = &isdn_ctrl[chan->ctrl]; - } else - { - c = 0xffff; - chan= NULL; - ctrl= NULL; - } - - if(ctrl && (ctrl->appl & 0xC0) == 0) - appl= &isdn_appl[ctrl->appl]; - else if( APPL(pl) < 0x30) - appl = &isdn_appl[APPL(pl)]; - else if( APPL(pl) < 0x40) - appl= NULL; - else goto fin; - - if(msg->h.Type >= 0x80) - { - mb= msg->h.Type & 0x40; - msg->h.Type &= 0xbf; - } - } -SavMsgTyp|= 0x100; - -if(msg->h.Type>=0x40) -printf("I%x %x %x",msg->h.Type,pl,mb); - switch (msg->h.Type) - { - case 0x01: /* INIT IND */ - case 0x15: /* POLL IND */ - error= en_q(unit,msg->h.Type|0x20,0,0,0,NULL); - break; - case 0x04: /* DNL MOD CONF */ - sc->sc_stat = msg->Data[0]; - if (sc->sc_flags & 7) - sc->sc_flags = (sc->sc_flags & ~7) | OPEN; - break; - case 0x06: /* DNL MOD IND */ - sc->sc_stat = msg->Data[0]; - error= en_q(unit,msg->h.Type|0x20,sc->sc_type,0,1, &msg->Data[1]); - if(sc->sc_flags & LOAD_ENTITY) - { - sc->sc_istat= sc->sc_ostat= 2; - timeout(snic_timout,unit,hz); - msg->h.Type= 0; - return; - } - if (sc->sc_flags) - sc->sc_flags = OPEN; - break; - case 0x0e: /* SET CLOCK CONF */ - error= state_ind(unit,1,0); - break; - case 0x16: /* STATE IND */ - if(sc->sc_flags & LOAD_ENTITY) - { - if(sc->sc_flags & 7) - sc->sc_flags = OPEN; - else sc->sc_flags= 0; - } - bcopy( msg->Data, sc->sc_state_ind, 8); - error= en_q(unit,msg->h.Type|0x20,0,0,0,NULL); - break; - case 0x17: /* STATE RESP */ - bcopy( msg->Data, sc->sc_state_ind, 8); - break; - case 0x1e: /* MANUFACT CONF */ - if(msg->h.SubType == 18) - break; - badstate(&msg->h,1); - break; - case 0x1f: /* MANUFACT IND */ - if(msg->h.SubType == 19) - { - isdn_input(ispy_applnr, msg->h.DataLen, msg->Data,0); - error= en_q(unit,msg->h.Type|0x20,msg->h.SubType,0,0,NULL); - break; - } - badstate(&msg->h,2); - break; - case 0x40: /* CONNECT CONF */ - err = *(u_short *) msg->Data; - if (err || (appl == NULL) || (chan == NULL) || (ctrl == NULL)) - { - if(chan) reset_plci(3, chan, pl); - if(appl) appl->state= 0; - break; - } - if (ISBUSY(ctrl->appl)) - { - error= discon_req(2, unit, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr = 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = APPL(pl); - appl->ctrl = chan->ctrl; - ctrl->islisten= 0; - chan->state = DIAL; - appl->state= 3; - break; - - case 0x41: /* CONNECT IND */ - if (ISBUSY(ctrl->appl)) - { - error= discon_req(3, unit, pl, 0, 0); - break; - } - chan->plci = pl; - chan->msg_nr = 0; - chan->ncci = -1; - ctrl->lastact = time.tv_sec; - ctrl->appl = 0x7f; - ctrl->islisten= 1; - chan->state = CALLED; - msg->Data[msg->Data[3] + 4] = 0; - isdn_accept_con_ind(APPL(pl), chan->ctrl, msg->Data[0], msg->Data[1] - ,msg->Data[2], msg->Data[3], (char *) &msg->Data[4]); - break; - - case 0x42: /* CONNECT ACTIVE IND */ - error= con_act_resp(unit, pl); - if (IS_LISTEN(pl)) - { - isdn_conn_ind(ctrl->appl,chan->ctrl,0); - break; - } - isdn_conn_ind(APPL(pl),chan->ctrl,1); - chan->state = CONNECT; - ctrl->appl = APPL(pl); - appl->ctrl = chan->ctrl; - break; - - case 0x43: /* DISCONNECT CONF */ - reset_plci(4, chan, pl); - break; - - case 0x44: /* DISCONNECT IND */ - error= discon_resp(unit, reset_plci(5, chan, pl)); - break; - - case 0x47: /* LISTEN CONF */ - isdn_state = *(u_short *) msg->Data; - break; - - case 0x4a: /* INFO IND */ - isdn_info(APPL(pl),*(u_short *)msg->Data, msg->Data[2], msg->Data+3); - error= inf_resp(unit, pl); - break; - case 0x80: /* SELECT PROT CONF */ - err = *(u_short *) msg->Data; - if (err) - { - error= discon_req(4, unit, pl, 0, err); - break; - } - - switch (msg->h.SubType) - { - case 2:/* SELECT B2 PROTOCOL */ - if(ISFREE(ctrl->appl)) - break; - error= sel_b3_prot_req(unit, mb, pl, &isdn_appl[ctrl->appl].ncpd); - break; - - case 3:/* SELECT B3 PROTOCOL */ - if (IS_DIAL(pl)) - error= con_b3_req(unit, mb, pl); - else - error= listen_b3_req(unit, mb, pl); - break; - } - break; - - case 0x81: /* LISTEN B3 CONF */ - err = *(u_short *) msg->Data; - if (err) - { - error= discon_req(5, unit, pl, 0, err); - break; - } - error= con_resp(unit, pl, err); - break; - - case 0x82: /* CONNECT B3 CONF */ - err = *(u_short *) (msg->Data + 2); - n = *(u_short *) msg->Data; - - if (err) - { - error= discon_req(6, unit, pl, 0, err); - break; - } - if(ISFREE(ctrl->appl)) - break; - chan->ncci = n; - chan->state = CONNECT; - break; - - case 0x83: /* CONNECT B3 IND */ - if(ISFREE(ctrl->appl)) - break; - n = *(u_short *) msg->Data; - chan->ncci = n; - chan->state = CONNECT; - error= con_b3_resp(unit, mb, n, pl, 0); - break; - - case 0x84: /* CONNECT B3 ACTIVE IND */ - if(ISFREE(ctrl->appl)) - break; - if (chan->state < IDLE) - { - chan->state = IDLE; - ctrl->o_len = 0; - timeout(isdn_start_out,chan->ctrl,hz/5); - } - break; - - case 0x85: /* DISCONNECT B3 CONF */ - if(ISBUSY(ctrl->appl)) - chan->state = ISDISCON; - err = *(u_short *) (msg->Data + 2); - if (err) - { - error= discon_req(7, unit, pl, 0, err); - break; - } - break; - case 0x86: /* DISCONNECT B3 IND */ - if(ISBUSY(ctrl->appl)) - chan->state = ISDISCON; - err = *(u_short *) (msg->Data + 2); - error= discon_req(8, unit, pl, 0, err); - break; - - case 0x88: /* DATA B3 CONF */ - if(ISFREE(ctrl->appl)) - break; - err = *(u_short *) (msg->Data + 2); - if (err) - { -printf("e%x\n",err); - ctrl->send_err++; - isdn_appl[ctrl->appl].send_err++; - } - chan->state = IDLE; - chan->o_buf.h.Type= 0; - ctrl->o_len = 0; - isdn_start_out(chan->ctrl); - break; - - case 0x89: /* DATA B3 IND */ - if(ISFREE(ctrl->appl)) - break; - if(isdn_input(ctrl->appl, msg->h.DataLen-5, msg->Data+5,ctrl->islisten)) - ctrl->lastact = time.tv_sec; - break; - - default: - badstate(&msg->h,3); - break; - } - -fin: - if(error) - { -printf("x%x %x %x %x %x\n",error,msg->h.Type,sc->sc_istat,sc->sc_ostat,sc->sc_omsg.h.Type); - sc->sc_istat|= 0x101; - if(sc->sc_istat&0x200) - return; - sc->sc_istat|= 0x200; - timeout(snic_timout,unit,2); - return; - } - - msg->h.Type= 0; - if(snic_put_msg(unit,(Header *) &ack_msg,1,15)) - sc->sc_ostat|= 0x100; - sc->sc_istat= 0x200; - snic_get_msg(unit); -} - -#endif /* NSNIC > 0 */ diff --git a/sys/gnu/scsi/scsi_nic.h b/sys/gnu/scsi/scsi_nic.h deleted file mode 100644 index 4847df8..0000000 --- a/sys/gnu/scsi/scsi_nic.h +++ /dev/null @@ -1,53 +0,0 @@ -static char rcsid[] = "@(#)$Id: scsi_nic.h,v 1.1 1995/01/25 14:06:18 jkr Exp jkr $"; -/******************************************************************************* - * II - Version 0.1 $Revision: 1.1 $ $State: Exp $ - * - * Copyright 1994 Dietmar Friede - ******************************************************************************* - * Bug reports, patches, comments, suggestions should be sent to: - * - * jkr@saarlink.de or jkrause@guug.de - * - ******************************************************************************* - * $Log: scsi_nic.h,v $ - * - ******************************************************************************/ - -/* - * This file defines the NICCY 5000 Interface. - * Copyright Dr. Neuhaus GmbH, Hamburg and Dietmar Friede - * -*/ -#define GET_MSG_COMMAND 0x08 -#define PUT_MSG_COMMAND 0x0a - -#pragma pack (1) -struct scsi_msg -{ - u_char op_code; - u_char dummy; - u_char len[3]; - u_char control; -}; - -typedef struct -{ - unsigned char Type; - unsigned char SubType; - unsigned short Number ; - unsigned char MoreData ; - unsigned char Reserved[1] ; - unsigned short DataLen ; - unsigned short PLCI; -} Header; - -#define SNIC_BUF_SIZE 2048+15 - -typedef struct -{ - Header h; - unsigned char Data[SNIC_BUF_SIZE]; -} Buffer; - -#pragma pack () - |