Replacement of the NCR driver by the Leo Weppelman NCR driver as

ported by Matthias Pfaller (Thanks to both!) and a RCS id.
This commit is contained in:
phil 1995-06-09 04:36:14 +00:00
parent 695670c5fa
commit a8674363a7
5 changed files with 2033 additions and 1059 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,145 +0,0 @@
/* $NetBSD: ncr_5380.h,v 1.2 1994/10/26 08:24:13 cgd Exp $ */
/*
* Mach Operating System
* Copyright (c) 1991,1990,1989 Carnegie Mellon University
* All Rights Reserved.
*
* Permission to use, copy, modify and distribute this software and its
* documentation is hereby granted, provided that both the copyright
* notice and this permission notice appear in all copies of the
* software, derivative works or modified versions, and any portions
* thereof, and that both notices appear in supporting documentation.
*
* CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS
* CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
* ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
*
* Carnegie Mellon requests users of this software to return to
*
* Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
* School of Computer Science
* Carnegie Mellon University
* Pittsburgh PA 15213-3890
*
* any improvements or extensions that they make and grant Carnegie the
* rights to redistribute these changes.
*/
/*
* File: scsi_5380.h
* Author: Alessandro Forin, Carnegie Mellon University
* Date: 5/91
*
* Defines for the NCR 5380 (SCSI chip), aka Am5380
*
* Modified for the pc532 by Phil Nelson. 1/94
*/
/*
* Register map
*/
typedef struct {
volatile unsigned char sci_data; /* r: Current data */
#define sci_odata sci_data /* w: Out data */
volatile unsigned char sci_icmd; /* rw: Initiator command */
volatile unsigned char sci_mode; /* rw: Mode */
volatile unsigned char sci_tcmd; /* rw: Target command */
volatile unsigned char sci_bus_csr; /* r: Bus Status */
#define sci_sel_enb sci_bus_csr /* w: Select enable */
volatile unsigned char sci_csr; /* r: Status */
#define sci_dma_send sci_csr /* w: Start dma send data */
volatile unsigned char sci_idata; /* r: Input data */
#define sci_trecv sci_idata /* w: Start dma receive, target */
volatile unsigned char sci_iack; /* r: Interrupt Acknowledge */
#define sci_irecv sci_iack /* w: Start dma receive, initiator */
} sci_regmap_t;
/*
* Initiator command register
*/
#define SCI_ICMD_DATA 0x01 /* rw: Assert data bus */
#define SCI_ICMD_ATN 0x02 /* rw: Assert ATN signal */
#define SCI_ICMD_SEL 0x04 /* rw: Assert SEL signal */
#define SCI_ICMD_BSY 0x08 /* rw: Assert BSY signal */
#define SCI_ICMD_ACK 0x10 /* rw: Assert ACK signal */
#define SCI_ICMD_LST 0x20 /* r: Lost arbitration */
#define SCI_ICMD_DIFF SCI_ICMD_LST /* w: Differential cable */
#define SCI_ICMD_AIP 0x40 /* r: Arbitration in progress */
#define SCI_ICMD_TEST SCI_ICMD_AIP /* w: Test mode */
#define SCI_ICMD_RST 0x80 /* rw: Assert RST signal */
/*
* Mode register
*/
#define SCI_MODE_ARB 0x01 /* rw: Start arbitration */
#define SCI_MODE_DMA 0x02 /* rw: Enable DMA xfers */
#define SCI_MODE_MONBSY 0x04 /* rw: Monitor BSY signal */
#define SCI_MODE_DMA_IE 0x08 /* rw: Enable DMA complete interrupt */
#define SCI_MODE_PERR_IE 0x10 /* rw: Interrupt on parity errors */
#define SCI_MODE_PAR_CHK 0x20 /* rw: Check parity */
#define SCI_MODE_TARGET 0x40 /* rw: Target mode (Initiator if 0) */
#define SCI_MODE_BLOCKDMA 0x80 /* rw: Block-mode DMA handshake (MBZ) */
/*
* Target command register
*/
#define SCI_TCMD_IO 0x01 /* rw: Assert I/O signal */
#define SCI_TCMD_CD 0x02 /* rw: Assert C/D signal */
#define SCI_TCMD_MSG 0x04 /* rw: Assert MSG signal */
#define SCI_TCMD_PHASE_MASK 0x07 /* r: Mask for current bus phase */
#define SCI_TCMD_REQ 0x08 /* rw: Assert REQ signal */
#define SCI_TCMD_LAST_SENT 0x80 /* ro: Last byte was xferred
* (not on 5380/1) */
#define SCI_PHASE(x) SCSI_PHASE(x)
/*
* Current (SCSI) Bus status
*/
#define SCI_BUS_DBP 0x01 /* r: Data Bus parity */
#define SCI_BUS_SEL 0x02 /* r: SEL signal */
#define SCI_BUS_IO 0x04 /* r: I/O signal */
#define SCI_BUS_CD 0x08 /* r: C/D signal */
#define SCI_BUS_MSG 0x10 /* r: MSG signal */
#define SCI_BUS_REQ 0x20 /* r: REQ signal */
#define SCI_BUS_BSY 0x40 /* r: BSY signal */
#define SCI_BUS_RST 0x80 /* r: RST signal */
#define SCI_CUR_PHASE(x) SCSI_PHASE((x)>>2)
/*
* Bus and Status register
*/
#define SCI_CSR_ACK 0x01 /* r: ACK signal */
#define SCI_CSR_ATN 0x02 /* r: ATN signal */
#define SCI_CSR_DISC 0x04 /* r: Disconnected (BSY==0) */
#define SCI_CSR_PHASE_MATCH 0x08 /* r: Bus and SCI_TCMD match */
#define SCI_CSR_INT 0x10 /* r: Interrupt request */
#define SCI_CSR_PERR 0x20 /* r: Parity error */
#define SCI_CSR_DREQ 0x40 /* r: DMA request */
#define SCI_CSR_DONE 0x80 /* r: DMA count is zero */
/* icu scsi chip switching */
#define ICU_ADR 0xfffffe00
#define ICU_IO (ICU_ADR+20)
#define ICU_DIR (ICU_ADR+21)
#define ICU_DATA (ICU_ADR+19)
#define ICU_SCSI_BIT 0x80

View File

@ -1,57 +0,0 @@
/* $NetBSD: ncr_defs.h,v 1.2 1994/10/26 08:24:14 cgd Exp $ */
/*-
* Copyright (C) 1993 Allen K. Briggs, Chris P. Caputo,
* Michael L. Finch, Bradley A. Grantham, and
* Lawrence A. Kesteloot
* 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 Alice Group.
* 4. The names of the Alice Group or any of its members may not be used
* to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE ALICE GROUP ``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 ALICE GROUP BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCSI_DEFS_H
#define _SCSI_DEFS_H
#define SCSI_PHASE_DATA_OUT 0x0
#define SCSI_PHASE_DATA_IN 0x1
#define SCSI_PHASE_CMD 0x2
#define SCSI_PHASE_STATUS 0x3
#define SCSI_PHASE_UNSPEC1 0x4
#define SCSI_PHASE_UNSPEC2 0x5
#define SCSI_PHASE_MESSAGE_OUT 0x6
#define SCSI_PHASE_MESSAGE_IN 0x7
#define SCSI_PHASE(x) ((x)&0x7)
/* These should be fixed up. */
#define SCSI_RET_SUCCESS 0
#define SCSI_RET_RETRY 1
#define SCSI_RET_DEVICE_DOWN 2
#define SCSI_RET_COMMAND_FAIL 3
#endif

145
sys/arch/pc532/dev/ncrreg.h Normal file
View File

@ -0,0 +1,145 @@
/* $NetBSD: ncrreg.h,v 1.1 1995/06/09 04:36:26 phil Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman.
* PC532-Port by Matthias Pfaller.
* 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 Leo Weppelman.
* 4. 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.
*/
#ifndef _NCR5380REG_H
#define _NCR5380REG_H
#define PDMA_ADDRESS ((volatile u_char *) 0xffe00000)
#define SCSI_5380 ((volatile struct scsi_5380 *) 0xffd00000)
struct scsi_5380 {
volatile u_char scsi_5380[8]; /* use only the odd bytes */
};
#define scsi_data scsi_5380[0] /* Data register */
#define scsi_icom scsi_5380[1] /* Initiator command register */
#define scsi_mode scsi_5380[2] /* Mode register */
#define scsi_tcom scsi_5380[3] /* Target command register */
#define scsi_idstat scsi_5380[4] /* Bus status register */
#define scsi_dmstat scsi_5380[5] /* DMA status register */
#define scsi_trcv scsi_5380[6] /* Target receive register */
#define scsi_ircv scsi_5380[7] /* Initiator receive register */
/*
* Definitions for Initiator command register.
*/
#define SC_A_RST 0x80 /* RW - Assert RST */
#define SC_TEST 0x40 /* W - Test mode */
#define SC_AIP 0x40 /* R - Arbitration in progress */
#define SC_LA 0x20 /* R - Lost arbitration */
#define SC_A_ACK 0x10 /* RW - Assert ACK */
#define SC_A_BSY 0x08 /* RW - Assert BSY */
#define SC_A_SEL 0x04 /* RW - Assert SEL */
#define SC_A_ATN 0x02 /* RW - Assert ATN */
#define SC_ADTB 0x01 /* RW - Assert Data To Bus */
/*
* Definitions for mode register
*/
#define SC_B_DMA 0x80 /* RW - Block mode DMA (not on TT!) */
#define SC_T_MODE 0x40 /* RW - Target mode */
#define SC_E_PAR 0x20 /* RW - Enable parity check */
#define SC_E_PARI 0x10 /* RW - Enable parity interrupt */
#define SC_E_EOPI 0x08 /* RW - Enable End Of Process Interrupt */
#define SC_MON_BSY 0x04 /* RW - Monitor BSY */
#define SC_M_DMA 0x02 /* RW - Set DMA mode */
#define SC_ARBIT 0x01 /* RW - Arbitrate */
/*
* Definitions for tcom register
*/
#define SC_LBS 0x80 /* RW - Last Byte Send (not on TT!) */
#define SC_A_REQ 0x08 /* RW - Assert REQ */
#define SC_A_MSG 0x04 /* RW - Assert MSG */
#define SC_A_CD 0x02 /* RW - Assert C/D */
#define SC_A_IO 0x01 /* RW - Assert I/O */
/*
* Definitions for idstat register
*/
#define SC_S_RST 0x80 /* R - RST is set */
#define SC_S_BSY 0x40 /* R - BSY is set */
#define SC_S_REQ 0x20 /* R - REQ is set */
#define SC_S_MSG 0x10 /* R - MSG is set */
#define SC_S_CD 0x08 /* R - C/D is set */
#define SC_S_IO 0x04 /* R - I/O is set */
#define SC_S_SEL 0x02 /* R - SEL is set */
#define SC_S_PAR 0x01 /* R - Parity bit */
/*
* Definitions for dmastat register
*/
#define SC_END_DMA 0x80 /* R - End of DMA */
#define SC_DMA_REQ 0x40 /* R - DMA request */
#define SC_PAR_ERR 0x20 /* R - Parity error */
#define SC_IRQ_SET 0x10 /* R - IRQ is active */
#define SC_PHS_MTCH 0x08 /* R - Phase Match */
#define SC_BSY_ERR 0x04 /* R - Busy error */
#define SC_ATN_STAT 0x02 /* R - State of ATN line */
#define SC_ACK_STAT 0x01 /* R - State of ACK line */
#define SC_S_SEND 0x00 /* W - Start DMA output */
#define SC_CLINT { /* Clear interrupts */ \
int i = SCSI_5380->scsi_ircv; \
}
/*
* Definition of SCSI-bus phases. The values are determined by signals
* on the SCSI-bus. DO NOT CHANGE!
* The values must be used to index the pointers in SCSI-PARMS.
*/
#define NR_PHASE 8
#define PH_DATAOUT 0
#define PH_DATAIN 1
#define PH_CMD 2
#define PH_STATUS 3
#define PH_RES1 4
#define PH_RES2 5
#define PH_MSGOUT 6
#define PH_MSGIN 7
#define PH_OUT(phase) (!(phase & 1)) /* TRUE if output phase */
#define PH_IN(phase) (phase & 1) /* TRUE if input phase */
/*
* Id of Host-adapter
*/
#define SC_HOST_ID 0x80
/*
* Base setting for 5380 mode register
*/
#define IMODE_BASE SC_E_PAR
#endif /* _NCR5380REG_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: scn.c,v 1.17 1995/05/16 07:30:38 phil Exp $ */
/* $NetBSD: scn.c,v 1.18 1995/06/09 04:36:30 phil Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.