diff options
| author | Warner Losh <imp@FreeBSD.org> | 2018-10-22 02:35:26 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2018-10-22 02:35:26 +0000 |
| commit | 2dfd3588656c006ad258e45a1cfc0df091929de3 (patch) | |
| tree | aa50a67e9b13c9c7b01c4a1e33da058bc5816a41 | |
| parent | e9b5375b04c09098136d215ea63d9db46025bce6 (diff) | |
Notes
| -rw-r--r-- | share/man/man4/Makefile | 1 | ||||
| -rw-r--r-- | share/man/man4/ncv.4 | 131 | ||||
| -rw-r--r-- | sys/amd64/conf/NOTES | 2 | ||||
| -rw-r--r-- | sys/conf/files | 4 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500.c | 1240 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500_pccard.c | 340 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500hw.h | 71 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500hwtab.h | 51 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500reg.h | 189 | ||||
| -rw-r--r-- | sys/dev/ncv/ncr53c500var.h | 85 | ||||
| -rw-r--r-- | sys/i386/conf/NOTES | 2 | ||||
| -rw-r--r-- | sys/modules/Makefile | 2 | ||||
| -rw-r--r-- | sys/modules/ncv/Makefile | 10 |
13 files changed, 1 insertions, 2127 deletions
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 380fa18c90b8..24e8efe40483 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -305,7 +305,6 @@ MAN= aac.4 \ nand.4 \ nandsim.4 \ ncr.4 \ - ncv.4 \ ${_ndis.4} \ net80211.4 \ netdump.4 \ diff --git a/share/man/man4/ncv.4 b/share/man/man4/ncv.4 deleted file mode 100644 index c7bdc30c523b..000000000000 --- a/share/man/man4/ncv.4 +++ /dev/null @@ -1,131 +0,0 @@ -.\" Copyright (C) 2003 The FreeBSD Project. All rights reserved. -.\" Copyright (c) 2003 Noriaki Mitsunaga. 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. -.\" -.\" THIS SOFTWARE IS PROVIDED BY 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 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$ -.\" -.Dd August 10, 2004 -.Dt NCV 4 -.Os -.Sh NAME -.Nm ncv -.Nd "NCR 53C500 based SCSI host adapter driver" -.Sh SYNOPSIS -To compile this driver into the kernel, -place the following lines in your -kernel configuration file: -.Bd -ragged -offset indent -.Cd "device scbus" -.Cd "device ncv" -.Ed -.Pp -Alternatively, to load the driver as a -module at boot time, place the following line in -.Xr loader.conf 5 : -.Bd -literal -offset indent -ncv_load="YES" -.Ed -.Sh DESCRIPTION -The -.Nm -driver provides access to the -.Tn SCSI -bus -connected to an NCR 53C500 based -PC-Card -.Tn SCSI -host adapter or an Adaptec AHA-2920 on the -.Tn PCI -bus. -.Sh HARDWARE -The following devices are currently supported by the -.Nm -driver: -.Pp -.Bl -bullet -compact -.It -I-O DATA PCSC-DV -.It -KME KXLC002 (TAXAN ICD-400PN, etc.), KXLC004, and UJDCD450 -.It -Macnica Miracle SCSI-II mPS110 -.It -Media Intelligent MSC-110, MSC-200 -.It -New Media Corporation BASICS SCSI -.It -Qlogic Fast SCSI -.It -RATOC REX-9530, REX-5572 (SCSI only) -.El -.Sh DIAGNOSTICS -The following error messages are sometimes returned: -.Bl -diag -.It "SCSI BUS RESET failed" -Usually returned when a failure occurs during -the bus reset. -.It "CMD_NOP failed" -No operation or the operation has failed. -.It "CMD_NOP|CMD_DMA" -A failure occurred during the -.Tn DMA -read/write operations. -.El -.Pp -The -.Nm -driver should return -.Bq Er ENODEV -when any of the previously noted failures occur. -.Sh SEE ALSO -.Xr cardbus 4 , -.Xr cd 4 , -.Xr da 4 , -.Xr pccard 4 , -.Xr sa 4 , -.Xr scsi 4 -.Sh HISTORY -The -.Nm -device driver has been developed for -.Nx Ns / Ns Tn pc98 -and ported to -.Fx . -The -.Nm -driver first appeared in -.Fx 2.2 -with -.Tn PAO -and merged in -.Fx 4.2 . -.Sh AUTHORS -.An -nosplit -The -.Nm -driver was written by -.An Naofumi Honda . -This manual page was written by -.An Tom Rhodes Aq Mt trhodes@FreeBSD.org -and -.An Noriaki Mitsunaga Aq Mt non@FreeBSD.org . diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index c56b13592a8a..c9e26c0ce05b 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -428,11 +428,9 @@ device twa # 3ware 9000 series PATA/SATA RAID # # SCSI host adapters: # -# ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # stg: TMC 18C30, 18C50 based SCSI host adapters. -device ncv device nsp device stg diff --git a/sys/conf/files b/sys/conf/files index 3097278f84d3..1113096a3f81 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -113,7 +113,7 @@ cam/ctl/scsi_ctl.c optional ctl cam/mmc/mmc_xpt.c optional scbus mmccam cam/mmc/mmc_da.c optional scbus mmccam da cam/scsi/scsi_da.c optional da -cam/scsi/scsi_low.c optional ncv | nsp | stg +cam/scsi/scsi_low.c optional nsp | stg cam/scsi/scsi_pass.c optional pass cam/scsi/scsi_pt.c optional pt cam/scsi/scsi_sa.c optional sa @@ -2511,8 +2511,6 @@ dev/nand/nandsim_log.c optional nandsim nand dev/nand/nandsim_swap.c optional nandsim nand dev/nand/nfc_if.m optional nand dev/ncr/ncr.c optional ncr pci -dev/ncv/ncr53c500.c optional ncv -dev/ncv/ncr53c500_pccard.c optional ncv pccard dev/netmap/if_ptnet.c optional netmap inet dev/netmap/netmap.c optional netmap dev/netmap/netmap_freebsd.c optional netmap diff --git a/sys/dev/ncv/ncr53c500.c b/sys/dev/ncv/ncr53c500.c deleted file mode 100644 index 5a9b0d8d33b8..000000000000 --- a/sys/dev/ncv/ncr53c500.c +++ /dev/null @@ -1,1240 +0,0 @@ -/* $NecBSD: ncr53c500.c,v 1.30.12.3 2001/06/26 07:31:41 honda Exp $ */ -/* $NetBSD$ */ - -#define NCV_DEBUG -#define NCV_STATICS -#define NCV_IO_CONTROL_FLAGS (0) - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/systm.h> -#include <sys/kernel.h> -#include <sys/bio.h> -#include <sys/buf.h> -#include <sys/queue.h> -#include <sys/malloc.h> -#include <sys/errno.h> -#include <sys/rman.h> - -#include <machine/cpu.h> -#include <machine/bus.h> - -#include <compat/netbsd/dvcfg.h> - -#include <cam/scsi/scsi_low.h> - -#include <dev/ncv/ncr53c500reg.h> -#include <dev/ncv/ncr53c500hw.h> -#include <dev/ncv/ncr53c500var.h> - -#include <dev/ncv/ncr53c500hwtab.h> - -#define NCV_MAX_DATA_SIZE (64 * 1024) -#define NCV_DELAY_MAX (2 * 1000 * 1000) -#define NCV_DELAY_INTERVAL (1) -#define NCV_PADDING_SIZE (32) - -/*************************************************** - * IO control - ***************************************************/ -#define NCV_READ_INTERRUPTS_DRIVEN 0x0001 -#define NCV_WRITE_INTERRUPTS_DRIVEN 0x0002 -#define NCV_ENABLE_FAST_SCSI 0x0010 -#define NCV_FAST_INTERRUPTS 0x0100 - -u_int ncv_io_control = NCV_IO_CONTROL_FLAGS; -int ncv_data_read_bytes = 4096; -int ncv_data_write_bytes = 4096; - -/*************************************************** - * DEBUG - ***************************************************/ -#ifdef NCV_DEBUG -static int ncv_debug; -#endif /* NCV_DEBUG */ - -#ifdef NCV_STATICS -static struct ncv_statics { - int disconnect; - int reselect; -} ncv_statics; -#endif /* NCV_STATICS */ - -/*************************************************** - * DEVICE STRUCTURE - ***************************************************/ -extern struct cfdriver ncv_cd; - -/************************************************************** - * DECLARE - **************************************************************/ -/* static */ -static void ncv_pio_read(struct ncv_softc *, u_int8_t *, u_int); -static void ncv_pio_write(struct ncv_softc *, u_int8_t *, u_int); -static int ncv_msg(struct ncv_softc *, struct targ_info *, u_int); -static int ncv_reselected(struct ncv_softc *); -static int ncv_disconnected(struct ncv_softc *, struct targ_info *); - -static __inline void ncvhw_set_count(struct resource *, int); -static __inline u_int ncvhw_get_count(struct resource *); -static __inline void ncvhw_select_register_0(struct resource *, struct ncv_hw *); -static __inline void ncvhw_select_register_1(struct resource *, struct ncv_hw *); -static __inline void ncvhw_fpush(struct resource *, u_int8_t *, int); - -static void ncv_pdma_end(struct ncv_softc *sc, struct targ_info *); -static int ncv_world_start(struct ncv_softc *, int); -static void ncvhw_bus_reset(struct ncv_softc *); -static void ncvhw_reset(struct resource *, struct ncv_hw *); -static int ncvhw_check(struct resource *, struct ncv_hw *); -static void ncvhw_init(struct resource *, struct ncv_hw *); -static int ncvhw_start_selection(struct ncv_softc *sc, struct slccb *); -static void ncvhw_attention(struct ncv_softc *); -static int ncv_ccb_nexus_establish(struct ncv_softc *); -static int ncv_lun_nexus_establish(struct ncv_softc *); -static int ncv_target_nexus_establish(struct ncv_softc *); -static int ncv_targ_init(struct ncv_softc *, struct targ_info *, int); -static int ncv_catch_intr(struct ncv_softc *); -#ifdef NCV_POWER_CONTROL -static int ncvhw_power(struct ncv_softc *, u_int); -#endif /* NCV_POWER_CONTROL */ -static __inline void ncv_setup_and_start_pio(struct ncv_softc *, u_int); - -struct scsi_low_funcs ncv_funcs = { - SC_LOW_INIT_T ncv_world_start, - SC_LOW_BUSRST_T ncvhw_bus_reset, - SC_LOW_TARG_INIT_T ncv_targ_init, - SC_LOW_LUN_INIT_T NULL, - - SC_LOW_SELECT_T ncvhw_start_selection, - SC_LOW_NEXUS_T ncv_lun_nexus_establish, - SC_LOW_NEXUS_T ncv_ccb_nexus_establish, - - SC_LOW_ATTEN_T ncvhw_attention, - SC_LOW_MSG_T ncv_msg, - - SC_LOW_TIMEOUT_T NULL, - SC_LOW_POLL_T ncvintr, - - NULL, /* SC_LOW_POWER_T ncvhw_power, */ -}; - -/************************************************************** - * hwfuncs - **************************************************************/ -static __inline void -ncvhw_select_register_0(struct resource *res, struct ncv_hw *hw) -{ - - bus_write_1(res, cr0_cfg4, hw->hw_cfg4); -} - -static __inline void -ncvhw_select_register_1(struct resource *res, struct ncv_hw *hw) -{ - - bus_write_1(res, cr1_cfg5, hw->hw_cfg5); -} - -static __inline void -ncvhw_fpush(struct resource *res, u_int8_t *buf, int len) -{ - int ptr; - - for (ptr = 0; ptr < len; ptr ++) - bus_write_1(res, cr0_sfifo, buf[ptr]); -} - -static __inline void -ncvhw_set_count(struct resource *res, int count) -{ - - bus_write_1(res, cr0_tclsb, (u_int8_t) count); - bus_write_1(res, cr0_tcmsb, (u_int8_t) (count >> NBBY)); - bus_write_1(res, cr0_tchsb, (u_int8_t) (count >> (NBBY * 2))); -} - -static __inline u_int -ncvhw_get_count(struct resource *res) -{ - u_int count; - - count = (u_int) bus_read_1(res, cr0_tclsb); - count |= ((u_int) bus_read_1(res, cr0_tcmsb)) << NBBY; - count |= ((u_int) bus_read_1(res, cr0_tchsb)) << (NBBY * 2); - return count; -} - -static int -ncvhw_check(struct resource *res, struct ncv_hw *hw) -{ - u_int8_t stat; - - ncvhw_select_register_0(res, hw); - bus_write_1(res, cr0_cmd, CMD_NOP | CMD_DMA); - if (bus_read_1(res, cr0_cmd) != (CMD_NOP | CMD_DMA)) - { -#ifdef NCV_DEBUG - printf("ncv: cr0_cmd CMD_NOP|CMD_DMA failed\n"); -#endif /* NCV_DEBUG */ - return ENODEV; - } - - bus_write_1(res, cr0_cmd, CMD_NOP); - if (bus_read_1(res, cr0_cmd) != CMD_NOP) - { -#ifdef NCV_DEBUG - printf("ncv: cr0_cmd CMD_NOP failed\n"); -#endif /* NCV_DEBUG */ - return ENODEV; - } - - /* hardware reset */ - ncvhw_reset(res, hw); - ncvhw_init(res, hw); - - /* bus reset */ - ncvhw_select_register_0(res, hw); - bus_write_1(res, cr0_cmd, CMD_FLUSH); - bus_write_1(res, cr0_cmd, CMD_RSTSCSI); - bus_write_1(res, cr0_cmd, CMD_NOP | CMD_DMA); - DELAY(100 * 1000); - - /* check response */ - bus_read_1(res, cr0_stat); - stat = bus_read_1(res, cr0_istat); - DELAY(1000); - - if (((stat & INTR_SBR) == 0) || - (bus_read_1(res, cr0_istat) & INTR_SBR)) - { -#ifdef NCV_DEBUG - printf("ncv: cr0_istat SCSI BUS RESET failed\n"); -#endif /* NCV_DEBUG */ - return ENODEV; - } - - return 0; -} - -static void -ncvhw_reset(struct resource *res, struct ncv_hw *hw) -{ - - ncvhw_select_register_0(res, hw); - - /* dummy cmd twice */ - bus_write_1(res, cr0_cmd, CMD_NOP); - bus_write_1(res, cr0_cmd, CMD_NOP); - - /* chip reset */ - bus_write_1(res, cr0_cmd, CMD_RSTCHIP); - - /* again dummy cmd twice */ - bus_write_1(res, cr0_cmd, CMD_NOP); - bus_write_1(res, cr0_cmd, CMD_NOP); -} - -static void -ncvhw_init(struct resource *res, struct ncv_hw *hw) -{ - - ncvhw_select_register_0(res, hw); - bus_write_1(res, cr0_clk, hw->hw_clk); - bus_write_1(res, cr0_srtout, SEL_TOUT); - bus_write_1(res, cr0_period, 0); - bus_write_1(res, cr0_offs, 0); - - bus_write_1(res, cr0_cfg1, hw->hw_cfg1); - bus_write_1(res, cr0_cfg2, hw->hw_cfg2); - bus_write_1(res, cr0_cfg3, hw->hw_cfg3); - bus_write_1(res, cr0_tchsb, 0); - - ncvhw_select_register_1(res, hw); - bus_write_1(res, cr1_fstat, 0x0); - bus_write_1(res, cr1_pflag, 0x0); - bus_write_1(res, cr1_atacmd, ATACMD_ENGAGE); - - ncvhw_select_register_0(res, hw); -} - -#ifdef NCV_POWER_CONTROL -static int -ncvhw_power(sc, flags) - struct ncv_softc *sc; - u_int flags; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - - if (flags == SCSI_LOW_POWDOWN) - { - device_printf(slp->sl_dev, "power down\n"); - ncvhw_select_register_1(res, &sc->sc_hw); - bus_write_1(res, cr1_atacmd, ATACMD_POWDOWN); - } - else - { - switch (sc->sc_rstep) - { - case 0: - device_printf(slp->sl_dev, "resume step O\n"); - ncvhw_select_register_1(res, &sc->sc_hw); - bus_write_1(res, cr1_atacmd, ATACMD_ENGAGE); - break; - - case 1: - device_printf(slp->sl_dev, "resume step I\n"); - ncvhw_reset(res, &sc->sc_hw); - ncvhw_init(res, &sc->sc_hw); - break; - } - } - - return 0; -} -#endif /* NCV_POWER_CONTROL */ - -/************************************************************** - * scsi low interface - **************************************************************/ -static void -ncvhw_attention(sc) - struct ncv_softc *sc; -{ - - bus_write_1(sc->port_res, cr0_cmd, CMD_SETATN); - DELAY(10); -} - -static void -ncvhw_bus_reset(sc) - struct ncv_softc *sc; -{ - - ncvhw_select_register_0(sc->port_res, &sc->sc_hw); - bus_write_1(sc->port_res, cr0_cmd, CMD_FLUSH); - bus_write_1(sc->port_res, cr0_cmd, CMD_RSTSCSI); - bus_write_1(sc->port_res, cr0_cmd, CMD_NOP | CMD_DMA); -} - -static int -ncvhw_start_selection(sc, cb) - struct ncv_softc *sc; - struct slccb *cb; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - struct targ_info *ti = cb->ti; - int len; - u_int flags; - u_int8_t cmd; - - sc->sc_tmaxcnt = cb->ccb_tcmax * 1000 * 1000; - sc->sc_compseq = 0; - if (scsi_low_is_msgout_continue(ti, SCSI_LOW_MSG_IDENTIFY) == 0) - { - cmd = CMD_SELATN; - sc->sc_selstop = 0; - flags = SCSI_LOW_MSGOUT_UNIFY | SCSI_LOW_MSGOUT_INIT; - } - else if (scsi_low_is_msgout_continue(ti, - SCSI_LOW_MSG_IDENTIFY | SCSI_LOW_MSG_SIMPLE_QTAG) == 0) - { - cmd = CMD_SELATN3; - sc->sc_selstop = 0; - flags = SCSI_LOW_MSGOUT_UNIFY | SCSI_LOW_MSGOUT_INIT; - } - else - { - cmd = CMD_SELATNS; - sc->sc_selstop = 1; - flags = SCSI_LOW_MSGOUT_INIT; - } - - ncvhw_select_register_0(res, &sc->sc_hw); - if ((bus_read_1(res, cr0_stat) & STAT_INT) != 0) - return SCSI_LOW_START_FAIL; - - ncv_target_nexus_establish(sc); - - len = scsi_low_msgout(slp, ti, flags); - if (sc->sc_selstop == 0) - scsi_low_cmd(slp, ti); - - if ((bus_read_1(res, cr0_stat) & STAT_INT) != 0) - return SCSI_LOW_START_FAIL; - - bus_write_1(res, cr0_dstid, ti->ti_id); - bus_write_1(res, cr0_cmd, CMD_FLUSH); - ncvhw_fpush(res, ti->ti_msgoutstr, len); - if (sc->sc_selstop == 0) - { - ncvhw_fpush(res, - slp->sl_scp.scp_cmd, slp->sl_scp.scp_cmdlen); - } - bus_write_1(res, cr0_cmd, cmd); - - SCSI_LOW_SETUP_PHASE(ti, PH_SELSTART); - return SCSI_LOW_START_OK; -} - -static int -ncv_world_start(sc, fdone) - struct ncv_softc *sc; - int fdone; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - u_int8_t stat; - - if ((slp->sl_cfgflags & CFG_NOPARITY) == 0) - sc->sc_hw.hw_cfg1 |= C1_PARENB; - else - sc->sc_hw.hw_cfg1 &= ~C1_PARENB; - - ncvhw_reset(res, &sc->sc_hw); - ncvhw_init(res, &sc->sc_hw); - - scsi_low_bus_reset(slp); - - ncvhw_select_register_0(res, &sc->sc_hw); - bus_read_1(res, cr0_stat); - stat = bus_read_1(res, cr0_istat); - DELAY(1000); - - if (((stat & INTR_SBR) == 0) || - (bus_read_1(res, cr0_istat) & INTR_SBR)) - return ENODEV; - - return 0; -} - -static int -ncv_msg(sc, ti, msg) - struct ncv_softc *sc; - struct targ_info *ti; - u_int msg; -{ - struct resource *res = sc->port_res; - struct ncv_targ_info *nti = (void *) ti; - u_int hwcycle, period; - - if ((msg & SCSI_LOW_MSG_WIDE) != 0) - { - if (ti->ti_width != SCSI_LOW_BUS_WIDTH_8) - { - ti->ti_width = SCSI_LOW_BUS_WIDTH_8; - return EINVAL; - } - return 0; - } - - if ((msg & SCSI_LOW_MSG_SYNCH) == 0) - return 0; - - period = ti->ti_maxsynch.period; - hwcycle = (sc->sc_hw.hw_clk == 0) ? 40 : (5 * sc->sc_hw.hw_clk); - hwcycle = 1000 / hwcycle; - - if (period < 200 / 4 && period >= 100 / 4) - nti->nti_reg_cfg3 |= sc->sc_hw.hw_cfg3_fscsi; - else - nti->nti_reg_cfg3 &= ~sc->sc_hw.hw_cfg3_fscsi; - - period = ((period * 40 / hwcycle) + 5) / 10; - nti->nti_reg_period = period & 0x1f; - nti->nti_reg_offset = ti->ti_maxsynch.offset; - - bus_write_1(res, cr0_period, nti->nti_reg_period); - bus_write_1(res, cr0_offs, nti->nti_reg_offset); - bus_write_1(res, cr0_cfg3, nti->nti_reg_cfg3); - return 0; -} - -static int -ncv_targ_init(sc, ti, action) - struct ncv_softc *sc; - struct targ_info *ti; - int action; -{ - struct ncv_targ_info *nti = (void *) ti; - - if (action == SCSI_LOW_INFO_ALLOC || action == SCSI_LOW_INFO_REVOKE) - { - ti->ti_width = SCSI_LOW_BUS_WIDTH_8; - ti->ti_maxsynch.period = sc->sc_hw.hw_mperiod; - ti->ti_maxsynch.offset = sc->sc_hw.hw_moffset; - - nti->nti_reg_cfg3 = sc->sc_hw.hw_cfg3; - nti->nti_reg_period = 0; - nti->nti_reg_offset = 0; - } - return 0; -} - -/************************************************************** - * General probe attach - **************************************************************/ -static int ncv_setup_img(struct ncv_hw *, u_int, int); - -static int -ncv_setup_img(hw, dvcfg, hostid) - struct ncv_hw *hw; - u_int dvcfg; - int hostid; -{ - - if (NCV_CLKFACTOR(dvcfg) > CLK_35M_F) - { - printf("ncv: invalid dvcfg flags\n"); - return EINVAL; - } - - if (NCV_C5IMG(dvcfg) != 0) - { - hw->hw_cfg5 = NCV_C5IMG(dvcfg); - hw->hw_clk = NCV_CLKFACTOR(dvcfg); - - if ((ncv_io_control & NCV_ENABLE_FAST_SCSI) != 0 && - (NCV_SPECIAL(dvcfg) & NCVHWCFG_MAX10M) != 0) - hw->hw_mperiod = 100 / 4; - - if (NCV_SPECIAL(dvcfg) & NCVHWCFG_FIFOBUG) - hw->hw_cfg3_fclk = 0x04; - - if (NCV_SPECIAL(dvcfg) & NCVHWCFG_SCSI1) - hw->hw_cfg2 &= ~C2_SCSI2; - - if (NCV_SPECIAL(dvcfg) & NCVHWCFG_SLOW) - hw->hw_cfg1 |= C1_SLOW; - } - - /* setup configuration image 3 */ - if (hw->hw_clk != CLK_40M_F && hw->hw_clk <= CLK_25M_F) - hw->hw_cfg3 &= ~hw->hw_cfg3_fclk; - else - hw->hw_cfg3 |= hw->hw_cfg3_fclk; - - /* setup configuration image 1 */ - hw->hw_cfg1 = (hw->hw_cfg1 & 0xf0) | hostid; - return 0; -} - -int -ncvprobesubr(struct resource *res, u_int dvcfg, int hsid) -{ - struct ncv_hw hwtab; - - hwtab = ncv_template; - if (ncv_setup_img(&hwtab, dvcfg, hsid)) - return 0; - if (ncvhw_check(res, &hwtab) != 0) - return 0; - - return 1; -} - -void -ncvattachsubr(sc) - struct ncv_softc *sc; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - - printf("\n"); - sc->sc_hw = ncv_template; - ncv_setup_img(&sc->sc_hw, slp->sl_cfgflags, slp->sl_hostid); - slp->sl_funcs = &ncv_funcs; - slp->sl_flags |= HW_READ_PADDING; - sc->sc_tmaxcnt = SCSI_LOW_MIN_TOUT * 1000 * 1000; /* default */ - - (void) scsi_low_attach(slp, 0, NCV_NTARGETS, NCV_NLUNS, - sizeof(struct ncv_targ_info), 0); -} - -/************************************************************** - * PDMA - **************************************************************/ -static __inline void -ncv_setup_and_start_pio(sc, reqlen) - struct ncv_softc *sc; - u_int reqlen; -{ - struct resource *res = sc->port_res; - - ncvhw_select_register_0(res, &sc->sc_hw); - ncvhw_set_count(res, reqlen); - bus_write_1(res, cr0_cmd, CMD_TRANS | CMD_DMA); - - ncvhw_select_register_1(res, &sc->sc_hw); - bus_write_1(res, cr1_fstat, FIFO_EN); -} - -static void -ncv_pdma_end(sc, ti) - struct ncv_softc *sc; - struct targ_info *ti; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - int len; - - slp->sl_flags &= ~HW_PDMASTART; - if (slp->sl_Qnexus == NULL) - { - slp->sl_error |= PDMAERR; - goto out; - } - - if (ti->ti_phase == PH_DATA) - { - len = ncvhw_get_count(res); - if (slp->sl_scp.scp_direction == SCSI_LOW_WRITE) - len += (bus_read_1(res, - cr0_sffl) & CR0_SFFLR_BMASK); - - if ((u_int) len <= (u_int) sc->sc_sdatalen) - { - if ((slp->sl_scp.scp_direction == SCSI_LOW_READ) && - sc->sc_tdatalen != len) - goto bad; - - len = sc->sc_sdatalen - len; - if ((u_int) len > (u_int) slp->sl_scp.scp_datalen) - goto bad; - - slp->sl_scp.scp_data += len; - slp->sl_scp.scp_datalen -= len; - } - else - { -bad: - if ((slp->sl_error & PDMAERR) == 0) - { - device_printf(slp->sl_dev, - "strange cnt hw 0x%x soft 0x%x\n", len, - slp->sl_scp.scp_datalen); - } - slp->sl_error |= PDMAERR; - } - scsi_low_data_finish(slp); - } - else - { - device_printf(slp->sl_dev, "data phase miss\n"); - slp->sl_error |= PDMAERR; - } - -out: - ncvhw_select_register_1(res, &sc->sc_hw); - bus_write_1(res, cr1_fstat, 0); - ncvhw_select_register_0(res, &sc->sc_hw); -} - -static void -ncv_pio_read(sc, buf, reqlen) - struct ncv_softc *sc; - u_int8_t *buf; - u_int reqlen; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - int tout; - register u_int8_t fstat; - - ncv_setup_and_start_pio(sc, reqlen); - slp->sl_flags |= HW_PDMASTART; - sc->sc_sdatalen = reqlen; - tout = sc->sc_tmaxcnt; - - while (reqlen >= FIFO_F_SZ && tout -- > 0) - { - fstat = bus_read_1(res, cr1_fstat); - if (fstat == (u_int8_t) -1) - goto out; - if (fstat & FIFO_F) - { -#define NCV_FAST32_ACCESS -#ifdef NCV_FAST32_ACCESS - bus_read_multi_4(res, cr1_fdata, - (u_int32_t *) buf, FIFO_F_SZ / 4); -#else /* !NCV_FAST32_ACCESS */ - bus_read_multi_2(res, cr1_fdata, - (u_int16_t *) buf, FIFO_F_SZ / 2); -#endif /* !NCV_FAST32_ACCESS */ - buf += FIFO_F_SZ; - reqlen -= FIFO_F_SZ; - } - else - { - if (fstat & FIFO_BRK) - break; - - DELAY(1); - } - } - - while (reqlen > 0 && tout -- > 0) - { - fstat = bus_read_1(res, cr1_fstat); - if ((fstat & FIFO_E) == 0) - { - *buf++ = bus_read_1(res, cr1_fdata); - reqlen --; - } - else - { - if (fstat & FIFO_BRK) - break; - - DELAY(1); - } - } - -out: - ncvhw_select_register_0(res, &sc->sc_hw); - sc->sc_tdatalen = reqlen; -} - -static void -ncv_pio_write(sc, buf, reqlen) - struct ncv_softc *sc; - u_int8_t *buf; - u_int reqlen; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - int tout; - register u_int8_t fstat; - - ncv_setup_and_start_pio(sc, reqlen); - sc->sc_sdatalen = reqlen; - tout = sc->sc_tmaxcnt; - slp->sl_flags |= HW_PDMASTART; - - while (reqlen >= FIFO_F_SZ && tout -- > 0) - { - fstat = bus_read_1(res, cr1_fstat); - if (fstat & FIFO_BRK) - goto done; - - if ((fstat & FIFO_E) != 0) - { -#ifdef NCV_FAST32_ACCESS - bus_write_multi_4(res, cr1_fdata, - (u_int32_t *) buf, FIFO_F_SZ / 4); -#else /* !NCV_FAST32_ACCESS */ - bus_write_multi_2(res, cr1_fdata, - (u_int16_t *) buf, FIFO_F_SZ / 2); -#endif /* !NCV_FAST32_ACCESS */ - buf += FIFO_F_SZ; - reqlen -= FIFO_F_SZ; - } - else - { - DELAY(1); - } - } - - while (reqlen > 0 && tout -- > 0) - { - fstat = bus_read_1(res, cr1_fstat); - if (fstat & FIFO_BRK) - break; - - if ((fstat & FIFO_F) == 0) /* fifo not full */ - { - bus_write_1(res, cr1_fdata, *buf++); - reqlen --; - } - else - { - DELAY(1); - } - } - -done: - ncvhw_select_register_0(res, &sc->sc_hw); -} - -/************************************************************** - * disconnect & reselect (HW low) - **************************************************************/ -static int -ncv_reselected(sc) - struct ncv_softc *sc; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - struct targ_info *ti; - u_int sid; - - if ((bus_read_1(res, cr0_sffl) & CR0_SFFLR_BMASK) != 2) - { - device_printf(slp->sl_dev, "illegal fifo bytes\n"); - scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, "chip confused"); - return EJUSTRETURN; - } - - sid = (u_int) bus_read_1(res, cr0_sfifo); - sid &= ~(1 << slp->sl_hostid); - sid = ffs(sid) - 1; - ti = scsi_low_reselected((struct scsi_low_softc *) sc, sid); - if (ti == NULL) - return EJUSTRETURN; - -#ifdef NCV_STATICS - ncv_statics.reselect ++; -#endif /* NCV_STATICS */ - bus_write_1(res, cr0_dstid, sid); - return 0; -} - -static int -ncv_disconnected(sc, ti) - struct ncv_softc *sc; - struct targ_info *ti; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - - bus_write_1(res, cr0_cmd, CMD_FLUSH); - bus_write_1(res, cr0_cmd, CMD_ENSEL); - -#ifdef NCV_STATICS - ncv_statics.disconnect ++; -#endif /* NCV_STATICS */ - - scsi_low_disconnected(slp, ti); - return 1; -} - -/************************************************************** - * SEQUENCER - **************************************************************/ -static int -ncv_target_nexus_establish(sc) - struct ncv_softc *sc; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct targ_info *ti = slp->sl_Tnexus; - struct ncv_targ_info *nti = (void *) ti; - struct resource *res = sc->port_res; - - bus_write_1(res, cr0_period, nti->nti_reg_period); - bus_write_1(res, cr0_offs, nti->nti_reg_offset); - bus_write_1(res, cr0_cfg3, nti->nti_reg_cfg3); - return 0; -} - -static int -ncv_lun_nexus_establish(sc) - struct ncv_softc *sc; -{ - - return 0; -} - -static int -ncv_ccb_nexus_establish(sc) - struct ncv_softc *sc; -{ - struct scsi_low_softc *slp = &sc->sc_sclow; - struct slccb *cb = slp->sl_Qnexus; - - sc->sc_tmaxcnt = cb->ccb_tcmax * 1000 * 1000; - return 0; -} - -static int -ncv_catch_intr(sc) - struct ncv_softc *sc; -{ - struct resource *res = sc->port_res; - int wc; - register u_int8_t status; - - for (wc = 0; wc < NCV_DELAY_MAX / NCV_DELAY_INTERVAL; wc ++) - { - status = bus_read_1(res, cr0_stat); - if ((status & STAT_INT) != 0) - return 0; - - DELAY(NCV_DELAY_INTERVAL); - } - return EJUSTRETURN; -} - -int -ncvintr(arg) - void *arg; -{ - struct ncv_softc *sc = arg; - struct scsi_low_softc *slp = &sc->sc_sclow; - struct resource *res = sc->port_res; - struct targ_info *ti; - struct buf *bp; - u_int derror, flags; - int len; - u_int8_t regv, status, ireason; - -again: - if (slp->sl_flags & HW_INACTIVE) - return 0; - - /******************************************** - * Status - ********************************************/ - ncvhw_select_register_0(res, &sc->sc_hw); - status = bus_read_1(res, cr0_stat); - if ((status & STAT_INT) == 0 || status == (u_int8_t) -1) - return 0; - - ireason = bus_read_1(res, cr0_istat); - if ((ireason & INTR_SBR) != 0) - { - u_int8_t val; - - /* avoid power off hangup */ - val = bus_read_1(res, cr0_cfg1); - bus_write_1(res, cr0_cfg1, val | C1_SRR); - - /* status init */ - scsi_low_restart(slp, SCSI_LOW_RESTART_SOFT, - "bus reset (power off?)"); - return 1; - } - - /******************************************** - * Debug section - ********************************************/ -#ifdef NCV_DEBUG - if (ncv_debug) - { - scsi_low_print(slp, NULL); - device_printf(slp->sl_dev, "st %x ist %x\n\n", - status, ireason); -#ifdef KDB - if (ncv_debug > 1) - kdb_enter(KDB_WHY_CAM, "ncv"); -#endif /* KDB */ - } -#endif /* NCV_DEBUG */ - - /******************************************** - * Reselect or Disconnect or Nexus check - ********************************************/ - /* (I) reselect */ - if (ireason == INTR_RESELECT) - { - if (ncv_reselected(sc) == EJUSTRETURN) - return 1; - } - - /* (II) nexus */ - if ((ti = slp->sl_Tnexus) == NULL) - return 0; - - derror = 0; - if ((status & (STAT_PE | STAT_GE)) != 0) - { - slp->sl_error |= PARITYERR; - if ((status & PHASE_MASK) == MESSAGE_IN_PHASE) - scsi_low_assert_msg(slp, ti, SCSI_LOW_MSG_PARITY, 0); - else - scsi_low_assert_msg(slp, ti, SCSI_LOW_MSG_ERROR, 1); - derror = SCSI_LOW_DATA_PE; - } - - if ((ireason & (INTR_DIS | INTR_ILL)) != 0) - { - if ((ireason & INTR_ILL) == 0) - return ncv_disconnected(sc, ti); - - slp->sl_error |= FATALIO; - scsi_low_restart(slp, SCSI_LOW_RESTART_HARD, "illegal cmd"); - return 1; - } - - /******************************************** - * Internal scsi phase - ********************************************/ - switch (ti->ti_phase) - { - case PH_SELSTART: - scsi_low_arbit_win(slp); - SCSI_LOW_SETUP_PHASE(ti, PH_SELECTED); - - if (sc->sc_selstop == 0) - { - /* XXX: - * Here scsi phases expected are - * DATA PHASE: - * MSGIN : target wants to disconnect the host. - * STATUSIN : immediate command completed. - * CMD PHASE : command out failed - * MSGOUT : identify command failed. - */ - if ((status & PHASE_MASK) != MESSAGE_OUT_PHASE) - break; - } - else - { - if ((status & PHASE_MASK) != MESSAGE_OUT_PHASE) - break; - if ((ireason & INTR_FC) != 0) - { - SCSI_LOW_ASSERT_ATN(slp); - } - } - SCSI_LOW_SETUP_PHASE(ti, PH_MSGOUT); - break; - - case PH_RESEL: - ncv_target_nexus_establish(sc); - if ((status & PHASE_MASK) != MESSAGE_IN_PHASE) - { - device_printf(slp->sl_dev, - "unexpected phase after reselect\n"); - slp->sl_error |= FATALIO; - scsi_low_assert_msg(slp, ti, SCSI_LOW_MSG_ABORT, 1); - return 1; - } - break; - - default: - if ((slp->sl_flags & HW_PDMASTART) != 0) - { - ncv_pdma_end(sc, ti); - } - break; - } - - /******************************************** - * Scsi phase sequencer - ********************************************/ - switch (status & PHASE_MASK) - { - case DATA_OUT_PHASE: /* data out */ - SCSI_LOW_SETUP_PHASE(ti, PH_DATA); - if (scsi_low_data(slp, ti, &bp, SCSI_LOW_WRITE) != 0) - { - scsi_low_attention(slp); - } - - if (slp->sl_scp.scp_datalen <= 0) - { - if ((ireason & INTR_BS) == 0) - break; - - if ((slp->sl_error & PDMAERR) == 0) - device_printf(slp->sl_dev, "data underrun\n"); - slp->sl_error |= PDMAERR; - - if ((slp->sl_flags & HW_WRITE_PADDING) != 0) - { - u_int8_t padding[NCV_PADDING_SIZE]; - - bzero(padding, sizeof(padding)); - ncv_pio_write(sc, padding, sizeof(padding)); - } - else - { - device_printf(slp->sl_dev, - "write padding required\n"); - } - } - else - { - len = slp->sl_scp.scp_datalen; - if ((ncv_io_control & NCV_WRITE_INTERRUPTS_DRIVEN) != 0) - { - if (len > ncv_data_write_bytes) - len = ncv_data_write_bytes; - } - ncv_pio_write(sc, slp->sl_scp.scp_data, len); - } - break; - - case DATA_IN_PHASE: /* data in */ - SCSI_LOW_SETUP_PHASE(ti, PH_DATA); - if (scsi_low_data(slp, ti, &bp, SCSI_LOW_READ) != 0) - { - scsi_low_attention(slp); - } - - if (slp->sl_scp.scp_datalen <= 0) - { - if ((ireason & INTR_BS) == 0) - break; - - if ((slp->sl_error & PDMAERR) == 0) - device_printf(slp->sl_dev, "data overrun\n"); - slp->sl_error |= PDMAERR; - - if ((slp->sl_flags & HW_READ_PADDING) != 0) - { - u_int8_t padding[NCV_PADDING_SIZE]; - - ncv_pio_read(sc, padding, sizeof(padding)); - } - else - { - device_printf(slp->sl_dev, - "read padding required\n"); - break; - } - } - else - { - len = slp->sl_scp.scp_datalen; - if ((ncv_io_control & NCV_READ_INTERRUPTS_DRIVEN) != 0) - { - if (len > ncv_data_read_bytes) - len = ncv_data_read_bytes; - } - ncv_pio_read(sc, slp->sl_scp.scp_data, len); - } - break; - - case COMMAND_PHASE: /* cmd out */ - SCSI_LOW_SETUP_PHASE(ti, PH_CMD); - if (scsi_low_cmd(slp, ti) != 0) - { - scsi_low_attention(slp); - } - - bus_write_1(res, cr0_cmd, CMD_FLUSH); - ncvhw_fpush(res, - slp->sl_scp.scp_cmd, slp->sl_scp.scp_cmdlen); - bus_write_1(res, cr0_cmd, CMD_TRANS); - break; - - case STATUS_PHASE: /* status in */ - SCSI_LOW_SETUP_PHASE(ti, PH_STAT); - bus_write_1(res, cr0_cmd, CMD_FLUSH); - bus_write_1(res, cr0_cmd, CMD_ICCS); - sc->sc_compseq = 1; - break; - - default: - break; - - case MESSAGE_OUT_PHASE: /* msg out */ - SCSI_LOW_SETUP_PHASE(ti, PH_MSGOUT); - bus_write_1(res, cr0_cmd, CMD_FLUSH); - - flags = SCSI_LOW_MSGOUT_UNIFY; - if (ti->ti_ophase != ti->ti_phase) - flags |= SCSI_LOW_MSGOUT_INIT; - len = scsi_low_msgout(slp, ti, flags); - - if (len > 1 && slp->sl_atten == 0) - { - scsi_low_attention(slp); - } - - ncvhw_fpush(res, ti->ti_msgoutstr, len); - bus_write_1(res, cr0_cmd, CMD_TRANS); - SCSI_LOW_DEASSERT_ATN(slp); - break; - - case MESSAGE_IN_PHASE: /* msg in */ - SCSI_LOW_SETUP_PHASE(ti, PH_MSGIN); - - len = bus_read_1(res, cr0_sffl) & CR0_SFFLR_BMASK; - if (sc->sc_compseq != 0) - { - sc->sc_compseq = 0; - if ((ireason & INTR_FC) && len == 2) - { - regv = bus_read_1(res, cr0_sfifo); - scsi_low_statusin(slp, ti, regv | derror); - len --; - } - else - { - slp->sl_error |= FATALIO; - scsi_low_assert_msg(slp, ti, - SCSI_LOW_MSG_ABORT, 1); - bus_write_1(res, cr0_cmd, CMD_MSGOK); - break; - } - } - else if (ireason & INTR_BS) - { - bus_write_1(res, cr0_cmd, CMD_FLUSH); - bus_write_1(res, cr0_cmd, CMD_TRANS); - if ((ncv_io_control & NCV_FAST_INTERRUPTS) != 0) - { - if (ncv_catch_intr(sc) == 0) - goto again; - } - break; - } - - if ((ireason & INTR_FC) && len == 1) - { - regv = bus_read_1(res, cr0_sfifo); - if (scsi_low_msgin(slp, ti, regv | derror) == 0) - { - if (scsi_low_is_msgout_continue(ti, 0) != 0) - { - scsi_low_attention(slp); - } - } - bus_write_1(res, cr0_cmd, CMD_MSGOK); - if ((ncv_io_control & NCV_FAST_INTERRUPTS) != 0) - { - /* XXX: - * clear a pending interrupt and sync with - * a next interrupt! - */ - ncv_catch_intr(sc); - } - } - else - { - slp->sl_error |= FATALIO; - scsi_low_assert_msg(slp, ti, SCSI_LOW_MSG_ABORT, 1); - bus_write_1(res, cr0_cmd, CMD_MSGOK); - } - break; - } - - return 1; -} diff --git a/sys/dev/ncv/ncr53c500_pccard.c b/sys/dev/ncv/ncr53c500_pccard.c deleted file mode 100644 index 49cbd8f29e68..000000000000 --- a/sys/dev/ncv/ncr53c500_pccard.c +++ /dev/null @@ -1,340 +0,0 @@ -/* $NecBSD: ncr53c500_pisa.c,v 1.28 1998/11/26 01:59:11 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [Ported for FreeBSD] - * Copyright (c) 2000 - * Noriaki Mitsunaga, Mitsuru Iwasaki and Takanori Watanabe. - * All rights reserved. - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998 - * Naofumi HONDA. 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. - */ - -#include <sys/cdefs.h> -__FBSDID("$FreeBSD$"); - -#include <sys/param.h> -#include <sys/errno.h> -#include <sys/kernel.h> -#include <sys/malloc.h> -#include <sys/module.h> -#include <sys/systm.h> - -#include <machine/bus.h> -#include <machine/resource.h> -#include <sys/rman.h> -#include <compat/netbsd/dvcfg.h> - -#include <sys/bus.h> - -#include <dev/pccard/pccardvar.h> - -#include <cam/scsi/scsi_low.h> - -#include <dev/ncv/ncr53c500reg.h> -#include <dev/ncv/ncr53c500hw.h> -#include <dev/ncv/ncr53c500var.h> - -#define KME_KXLC004_01 0x100 -#define OFFSET_KME_KXLC004_01 0x10 - - -#include "pccarddevs.h" - -static int ncvprobe(device_t devi); -static int ncvattach(device_t devi); - -static void ncv_card_unload(device_t); - -static const struct ncv_product { - struct pccard_product prod; - int flags; -} ncv_products[] = { - { PCMCIA_CARD(EPSON, SC200), 0}, - { PCMCIA_CARD(PANASONIC, KXLC002), 0xb4d00000 }, - { PCMCIA_CARD(PANASONIC, KXLC003), 0xb4d00000 }, /* untested */ - { PCMCIA_CARD(PANASONIC, KXLC004), 0xb4d00100 }, - { PCMCIA_CARD(MACNICA, MPS100), 0xb6250000 }, - { PCMCIA_CARD(MACNICA, MPS110), 0 }, - { PCMCIA_CARD(NEC, PC9801N_J03R), 0 }, - { PCMCIA_CARD(NEWMEDIA, BASICS_SCSI), 0 }, - { PCMCIA_CARD(QLOGIC, PC05), 0x84d00000 }, -#define FLAGS_REX5572 0x84d00000 - { PCMCIA_CARD(RATOC, REX5572), FLAGS_REX5572 }, - { PCMCIA_CARD(RATOC, REX9530), 0x84d00000 }, - { { NULL }, 0 } -}; - -/* - * Additional code for FreeBSD new-bus PCCard frontend - */ - -static void -ncv_pccard_intr(void * arg) -{ - struct ncv_softc *sc; - - sc = arg; - SCSI_LOW_LOCK(&sc->sc_sclow); - ncvintr(arg); - SCSI_LOW_UNLOCK(&sc->sc_sclow); -} - -static void -ncv_release_resource(device_t dev) -{ - struct ncv_softc *sc = device_get_softc(dev); - - if (sc->ncv_intrhand) { - bus_teardown_intr(dev, sc->irq_res, sc->ncv_intrhand); - } - - if (sc->port_res) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->port_rid, sc->port_res); - } - - if (sc->port_res_dmy) { - bus_release_resource(dev, SYS_RES_IOPORT, - sc->port_rid_dmy, sc->port_res_dmy); - } - - if (sc->irq_res) { - bus_release_resource(dev, SYS_RES_IRQ, - sc->irq_rid, sc->irq_res); - } - - if (sc->mem_res) { - bus_release_resource(dev, SYS_RES_MEMORY, - sc->mem_rid, sc->mem_res); - } - mtx_destroy(&sc->sc_sclow.sl_lock); -} - -static int -ncv_alloc_resource(device_t dev) -{ - struct ncv_softc *sc = device_get_softc(dev); - u_int32_t flags = device_get_flags(dev); - rman_res_t ioaddr, iosize, maddr, msize; - int error; - bus_addr_t offset = 0; - - if(flags & KME_KXLC004_01) - offset = OFFSET_KME_KXLC004_01; - - error = bus_get_resource(dev, SYS_RES_IOPORT, 0, &ioaddr, &iosize); - if (error || (iosize < (offset + NCVIOSZ))) { - return(ENOMEM); - } - - mtx_init(&sc->sc_sclow.sl_lock, "ncv", NULL, MTX_DEF); - sc->port_rid = 0; - sc->port_res = bus_alloc_resource(dev, SYS_RES_IOPORT, &sc->port_rid, - ioaddr+offset, ioaddr+iosize-offset, - iosize-offset, RF_ACTIVE); - if (sc->port_res == NULL) { - ncv_release_resource(dev); - return(ENOMEM); - } - - if (offset != 0) { - sc->port_rid_dmy = 0; - sc->port_res_dmy = bus_alloc_resource(dev, SYS_RES_IOPORT, - &sc->port_rid_dmy, - ioaddr, ioaddr+offset, offset, - RF_ACTIVE); - if (sc->port_res_dmy == NULL) { - printf("Warning: cannot allocate IOPORT partially.\n"); - } - } else { - sc->port_rid_dmy = 0; - sc->port_res_dmy = NULL; - } - - sc->irq_rid = 0; - sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &sc->irq_rid, - RF_ACTIVE); - if (sc->irq_res == NULL) { - ncv_release_resource(dev); - return(ENOMEM); - } - - error = bus_get_resource(dev, SYS_RES_MEMORY, 0, &maddr, &msize); - if (error) { - return(0); /* XXX */ - } - - /* no need to allocate memory if not configured */ - if (maddr == 0 || msize == 0) { - return(0); - } - - sc->mem_rid = 0; - sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &sc->mem_rid, - RF_ACTIVE); - if (sc->mem_res == NULL) { - ncv_release_resource(dev); - return(ENOMEM); - } - - return(0); -} - -static int -ncv_pccard_probe(device_t dev) -{ - const struct ncv_product *pp; - const char *vendorstr; - const char *prodstr; - - if ((pp = (const struct ncv_product *) pccard_product_lookup(dev, - (const struct pccard_product *) ncv_products, - sizeof(ncv_products[0]), NULL)) != NULL) { - if (pp->prod.pp_name != NULL) - device_set_desc(dev, pp->prod.pp_name); - device_set_flags(dev, pp->flags); - return(0); - } - if (pccard_get_vendor_str(dev, &vendorstr)) - return(EIO); - if (pccard_get_product_str(dev, &prodstr)) - return(EIO); - if (strcmp(vendorstr, "RATOC System Inc.") == 0 && - strncmp(prodstr, "SOUND/SCSI2 CARD", 16) == 0) { - device_set_desc(dev, "RATOC REX-5572"); - device_set_flags(dev, FLAGS_REX5572); - return (BUS_PROBE_DEFAULT); - } - return(EIO); -} - -static int -ncv_pccard_attach(device_t dev) -{ - struct ncv_softc *sc = device_get_softc(dev); - int error; - - error = ncv_alloc_resource(dev); - if (error) { - return(error); - } - - if (ncvprobe(dev) == 0) { - ncv_release_resource(dev); - return(ENXIO); - } - error = bus_setup_intr(dev, sc->irq_res, INTR_TYPE_CAM | INTR_ENTROPY | - INTR_MPSAFE, NULL, ncv_pccard_intr, sc, &sc->ncv_intrhand); - if (error) { - ncv_release_resource(dev); - return(error); - } - - if (ncvattach(dev) == 0) { - ncv_release_resource(dev); - return(ENXIO); - } - gone_in_dev(dev, 12, "ncv(4) driver"); - - return(0); -} - -static int -ncv_pccard_detach(device_t dev) -{ - ncv_card_unload(dev); - ncv_release_resource(dev); - - return (0); -} - -static device_method_t ncv_pccard_methods[] = { - /* Device interface */ - DEVMETHOD(device_probe, ncv_pccard_probe), - DEVMETHOD(device_attach, ncv_pccard_attach), - DEVMETHOD(device_detach, ncv_pccard_detach), - - { 0, 0 } -}; - -static driver_t ncv_pccard_driver = { - "ncv", - ncv_pccard_methods, - sizeof(struct ncv_softc), -}; - -static devclass_t ncv_devclass; - -MODULE_DEPEND(ncv, scsi_low, 1, 1, 1); -DRIVER_MODULE(ncv, pccard, ncv_pccard_driver, ncv_devclass, 0, 0); -PCCARD_PNP_INFO(ncv_products); - -static void -ncv_card_unload(device_t devi) -{ - struct ncv_softc *sc = device_get_softc(devi); - - scsi_low_deactivate(&sc->sc_sclow); - scsi_low_detach(&sc->sc_sclow); -} - -static int -ncvprobe(device_t devi) -{ - int rv; - struct ncv_softc *sc = device_get_softc(devi); - u_int32_t flags = device_get_flags(devi); - - rv = ncvprobesubr(sc->port_res, - flags, NCV_HOSTID); - - return rv; -} - -static int -ncvattach(device_t devi) -{ - struct ncv_softc *sc; - struct scsi_low_softc *slp; - u_int32_t flags = device_get_flags(devi); - - sc = device_get_softc(devi); - - slp = &sc->sc_sclow; - slp->sl_dev = devi; - slp->sl_hostid = NCV_HOSTID; - slp->sl_cfgflags = flags; - - ncvattachsubr(sc); - - return(NCVIOSZ); -} diff --git a/sys/dev/ncv/ncr53c500hw.h b/sys/dev/ncv/ncr53c500hw.h deleted file mode 100644 index 26e40b467f8a..000000000000 --- a/sys/dev/ncv/ncr53c500hw.h +++ /dev/null @@ -1,71 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ncr53c500hw.h,v 1.6.18.1 2001/06/08 06:27:44 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1996, 1997, 1998 - * Naofumi HONDA. 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. - */ - -#ifndef __NCR53C500HW_H_ -#define __NCR53C500HW_H_ - -#define NCV_HOSTID 7 -#define NCV_NTARGETS 8 -#define NCV_NLUNS 8 - -struct ncv_hw { - /* configuration images */ - u_int8_t hw_cfg1; - u_int8_t hw_cfg2; - u_int8_t hw_cfg3; - u_int8_t hw_cfg4; - u_int8_t hw_cfg5; - - /* synch */ - u_int8_t hw_clk; - u_int8_t hw_mperiod; - u_int8_t hw_moffset; - - /* cfg3 quirks */ - u_int8_t hw_cfg3_fscsi; - u_int8_t hw_cfg3_fclk; -}; - -/* dvcfg */ -#define NCV_C5IMG(flags) ((DVCFG_MAJOR(flags) >> 8) & 0xff) -#define NCV_CLKFACTOR(flags) (DVCFG_MAJOR(flags) & 0x0f) -#define NCVHWCFG_MAX10M 0x01 -#define NCVHWCFG_SCSI1 0x02 -#define NCVHWCFG_SLOW 0x04 -#define NCVHWCFG_FIFOBUG 0x08 -#define NCV_SPECIAL(flags) ((DVCFG_MAJOR(flags) >> 4) & 0x0f) -#endif /* !__NCR53C500HW_H_ */ diff --git a/sys/dev/ncv/ncr53c500hwtab.h b/sys/dev/ncv/ncr53c500hwtab.h deleted file mode 100644 index 9e70f17cb8bc..000000000000 --- a/sys/dev/ncv/ncr53c500hwtab.h +++ /dev/null @@ -1,51 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ncr53c500hwtab.h,v 1.2.18.1 2001/06/08 06:27:44 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1996, 1997, 1998 - * Naofumi HONDA. 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. - */ - -static struct ncv_hw ncv_template = { - 0, /* CFG1 img */ - C2_FE | C2_SCSI2, /* CFG2 img */ - 0, /* CFG3 img */ - C4_ANE, /* CFG4 img */ - 0x80, /* CFG5 img */ - - CLK_40M_F, /* clock */ - 200 / 4, /* max period */ - 15, /* max offset */ - - 0x10, /* CFG3_FSCSI bit */ - 0x08, /* CFG3_FCLK bit */ -}; diff --git a/sys/dev/ncv/ncr53c500reg.h b/sys/dev/ncv/ncr53c500reg.h deleted file mode 100644 index 927d45c89c94..000000000000 --- a/sys/dev/ncv/ncr53c500reg.h +++ /dev/null @@ -1,189 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ncr53c500reg.h,v 1.5.14.1 2001/06/08 06:27:44 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998 - * Naofumi HONDA. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998 - * Kouichi Matsuda. 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. - */ - -#ifndef _NCR53C500REG_H_ -#define _NCR53C500REG_H_ - -/* Control Register Set 0 */ -#define NCVIOSZ 0x10 - -#define cr0_tclsb 0x00 /* RW - Transfer Count Low */ -#define cr0_tcmsb 0x01 /* RW - Transfer Count Mid */ -#define cr0_sfifo 0x02 /* RW - FIFO data */ -#define cr0_cmd 0x03 /* RW - Command (2 deep) */ -#define cr0_stat 0x04 /* RO - Status */ -#define cr0_dstid 0x04 /* WO - Select/Reselect Bus ID */ -#define cr0_istat 0x05 /* RO - Interrupt */ -#define cr0_srtout 0x05 /* WO - Select/Reselect Timeout */ -#define cr0_seq 0x06 /* RO - Sequence Step */ -#define cr0_period 0x06 /* WO - Synch Transfer Period */ -#define cr0_sffl 0x07 /* RO - FIFO FLags */ -#define cr0_offs 0x07 /* WO - Synch Ofset */ -#define cr0_cfg1 0x08 /* RW - Configuration #1 */ -#define cr0_clk 0x09 /* WO - Clock Conversion Factor */ -#define cr0_tst 0x0a /* WO - Test (Chip Test Only) */ -#define cr0_cfg2 0x0b /* RW - Configuration #2 */ -#define cr0_cfg3 0x0c /* RW - Configuration #3 */ -#define cr0_cfg4 0x0d /* RW - Configuration #4 */ -#define cr0_tchsb 0x0e /* RW - Transfer Count High */ -#define cr0_fifo_bottom 0x0f /* WO - FIFO bottom */ - -/* Control Register Set 1 */ -#define cr1_jumper 0x00 /* RW - Jumper Sense Port */ -#define cr1_sram_ptr 0x01 /* RW - SRAM Address Pointer */ -#define cr1_sram_data 0x02 /* RW - SRAM Data */ -#define cr1_fdata 0x04 /* RW - PIO FIFO */ -#define cr1_fstat 0x08 /* RW - PIO Status */ -#define cr1_atacmd 0x09 /* RW - ATA Command/Status */ -#define cr1_ataerr 0x0a /* RW - ATA Features/Error */ -#define cr1_pflag 0x0b /* RW - PIO Flag Interrupt Enable */ -#define cr1_cfg5 0x0d /* RW - Configuration #5 */ -#define cr1_sig 0x0e /* RO - Signature */ -#define cr1_cfg6 0x0f /* RW - Configuration #6 */ - -/* atacmd (MPS110 ONLY) */ -#define ATACMD_POWDOWN 0x2d -#define ATACMD_ENGAGE 0x24 - -/* cr0_sffl regster */ -#define CR0_SFFLR_BMASK 0x1f /* scsi fifo byte mask */ - -/* cfg4 */ -#define C4_ANE 0x04 - -/* cfg2 */ -#define C2_SCSI2 0x08 /* SCSI-2 Enable */ -#define C2_FE 0x40 /* Features Enable */ - -/* cfg1 */ -#define C1_SLOW 0x80 /* Slow Cable Mode */ -#define C1_SRR 0x40 /* SCSI Reset Rep Int Dis */ -#define C1_PARENB 0x10 /* Enable Parity Check */ - -/* clk factor */ -#define CLK_40M_F 0x00 -#define CLK_25M_F 0x05 -#define CLK_30M_F 0x06 -#define CLK_35M_F 0x07 - -/* interrupt status register */ -#define INTR_SBR 0x80 /* SCSI Bus Reset */ -#define INTR_ILL 0x40 /* Illegal Command */ -#define INTR_DIS 0x20 /* Disconnect */ -#define INTR_BS 0x10 /* Bus Service */ -#define INTR_FC 0x08 /* Function Complete */ -#define INTR_RESEL 0x04 /* Reselected */ -#define INTR_SELATN 0x02 /* Select with ATN */ -#define INTR_SEL 0x01 /* Selected */ -#define INTR_RESELECT (INTR_RESEL | INTR_FC) - -/* status register */ -#define STAT_INT 0x80 /* Interrupt */ -#define STAT_GE 0x40 /* Gross Error */ -#define STAT_PE 0x20 /* Parity Error */ -#define STAT_TC 0x10 /* Terminal Count */ - -/* phase bits */ -#define IOI 0x01 -#define CDI 0x02 -#define MSGI 0x04 - -/* Information transfer phases */ -#define DATA_OUT_PHASE (0) -#define DATA_IN_PHASE (IOI) -#define COMMAND_PHASE (CDI) -#define STATUS_PHASE (CDI|IOI) -#define MESSAGE_OUT_PHASE (MSGI|CDI) -#define MESSAGE_IN_PHASE (MSGI|CDI|IOI) - -#define PHASE_MASK (MSGI|CDI|IOI) - -/* fifo status register */ -#define FIFO_SMASK 0x1e -#define FIFO_E 0x10 /* fifo empty */ -#define FIFO_B 0x00 /* there exists any */ -#define FIFO_1 0x08 /* 1/3 <= bytes < 2/3 */ -#define FIFO_2 0x04 /* 2/3 <= bytes < full */ -#define FIFO_F 0x02 /* full */ -#define FIFO_EN 0x01 /* fifo direction */ -#define FIFO_BRK 0x40 /* phase miss */ - -#define FIFO_F_SZ 128 -#define FIFO_1_SZ 44 -#define FIFO_2_SZ 84 - -/* pflags */ -#define PFR_WRITE 0x01 - -/* Commands */ -#define CMD_DMA 0x80 /* DMA Bit */ -#define CMD_NOP 0x00 /* No Operation */ -#define CMD_FLUSH 0x01 /* Flush FIFO */ -#define CMD_RSTCHIP 0x02 /* Reset Chip */ -#define CMD_RSTSCSI 0x03 /* Reset SCSI Bus */ -#define CMD_RESEL 0x40 /* Reselect Sequence */ -#define CMD_SELNATN 0x41 /* Select without ATN */ -#define CMD_SELATN 0x42 /* Select with ATN */ -#define CMD_SELATNS 0x43 /* Select with ATN & Stop */ -#define CMD_ENSEL 0x44 /* Enable (Re)Selection */ -#define CMD_DISSEL 0x45 /* Disable (Re)Selection */ -#define CMD_SELATN3 0x46 /* Select with ATN3 */ -#define CMD_RESEL3 0x47 /* Reselect3 Sequence */ -#define CMD_SNDMSG 0x20 /* Send Message */ -#define CMD_SNDSTAT 0x21 /* Send Status */ -#define CMD_SNDDATA 0x22 /* Send Data */ -#define CMD_DISCSEQ 0x23 /* Disconnect Sequence */ -#define CMD_TERMSEQ 0x24 /* Terminate Sequence */ -#define CMD_TCCS 0x25 /* Target Command Comp Seq */ -#define CMD_DISC 0x27 /* Disconnect */ -#define CMD_RECMSG 0x28 /* Receive Message */ -#define CMD_RECCMD 0x29 /* Receive Command */ -#define CMD_RECDATA 0x2a /* Receive Data */ -#define CMD_RECCSEQ 0x2b /* Receive Command Sequence */ -#define CMD_ABORT 0x04 /* Target Abort DMA */ -#define CMD_TRANS 0x10 /* Transfer Information */ -#define CMD_ICCS 0x11 /* Initiator Cmd Comp Seq */ -#define CMD_MSGOK 0x12 /* Message Accepted */ -#define CMD_TRPAD 0x18 /* Transfer Pad */ -#define CMD_SETATN 0x1a /* Set ATN */ -#define CMD_RSTATN 0x1b /* Reset ATN */ - -/* Default timeout */ -#define SEL_TOUT 0xa3 -#endif /* !_NCR53C500REG_H_ */ diff --git a/sys/dev/ncv/ncr53c500var.h b/sys/dev/ncv/ncr53c500var.h deleted file mode 100644 index 3b966e1d80e8..000000000000 --- a/sys/dev/ncv/ncr53c500var.h +++ /dev/null @@ -1,85 +0,0 @@ -/* $FreeBSD$ */ -/* $NecBSD: ncr53c500var.h,v 1.11.18.1 2001/06/08 06:27:45 honda Exp $ */ -/* $NetBSD$ */ - -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * [NetBSD for NEC PC-98 series] - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * NetBSD/pc98 porting staff. All rights reserved. - * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 - * Naofumi HONDA. 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. - */ - -#ifndef _NCR53C500VAR_H_ -#define _NCR53C500VAR_H_ - -/***************************************************************** - * Host adapter structure - *****************************************************************/ -struct ncv_softc { - struct scsi_low_softc sc_sclow; /* generic data */ - - int port_rid; - int port_rid_dmy; - int irq_rid; - int mem_rid; - struct resource *port_res; - struct resource *port_res_dmy; - struct resource *irq_res; - struct resource *mem_res; - - void *ncv_intrhand; - - int sc_tmaxcnt; - int sc_selstop; /* sel atn stop asserted */ - int sc_compseq; /* completion seq cmd asserted */ - int sc_sdatalen; /* start datalen */ - int sc_tdatalen; /* temp xfer data len */ - - struct ncv_hw sc_hw; /* hardware register images */ -}; - -/***************************************************************** - * Lun information - *****************************************************************/ -struct ncv_targ_info { - struct targ_info nti_ti; - - u_int8_t nti_reg_cfg3; /* cfg3 images per lun */ - u_int8_t nti_reg_offset; /* synch offset register per lun */ - u_int8_t nti_reg_period; /* synch period register per lun */ -}; - -/***************************************************************** - * Proto - *****************************************************************/ -int ncvprobesubr(struct resource *, u_int, int); -void ncvattachsubr(struct ncv_softc *); -int ncvintr(void *); - -#endif /* !_NCR53C500VAR_H_ */ diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index 6c09b8666a4b..d054ab93af3d 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -659,11 +659,9 @@ device twa # 3ware 9000 series PATA/SATA RAID # # SCSI host adapters: # -# ncv: NCR 53C500 based SCSI host adapters. # nsp: Workbit Ninja SCSI-3 based PC Card SCSI host adapters. # stg: TMC 18C30, 18C50 based SCSI host adapters. -device ncv device nsp device stg hint.stg.0.at="isa" diff --git a/sys/modules/Makefile b/sys/modules/Makefile index 19a37fe57430..2e6ea4dad4e0 100644 --- a/sys/modules/Makefile +++ b/sys/modules/Makefile @@ -268,7 +268,6 @@ SUBDIR= \ ${_nandsim} \ ${_ncr} \ ${_nctgpio} \ - ${_ncv} \ ${_ndis} \ ${_netgraph} \ ${_nfe} \ @@ -757,7 +756,6 @@ _glxiic= glxiic _glxsb= glxsb #_ibcs2= ibcs2 _ncr= ncr -_ncv= ncv _nsp= nsp _pcfclock= pcfclock _pst= pst diff --git a/sys/modules/ncv/Makefile b/sys/modules/ncv/Makefile deleted file mode 100644 index 3d66308576bf..000000000000 --- a/sys/modules/ncv/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $FreeBSD$ - -.PATH: ${SRCTOP}/sys/dev/ncv - -KMOD= ncv -SRCS= ncr53c500_pccard.c ncr53c500.c -SRCS+= device_if.h bus_if.h pci_if.h isa_if.h card_if.h pccarddevs.h -SRCS+= opt_cam.h opt_scsi.h opt_ddb.h - -.include <bsd.kmod.mk> |
