173149Snyan/* $FreeBSD: releng/10.3/sys/dev/ct/ctvar.h 240325 2012-09-10 18:49:49Z jhb $ */ 279697Snon/* $NecBSD: ctvar.h,v 1.4.14.3 2001/06/20 06:13:34 honda Exp $ */ 373149Snyan/* $NetBSD$ */ 473149Snyan 5139749Simp/*- 673149Snyan * [NetBSD for NEC PC-98 series] 779697Snon * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 873149Snyan * NetBSD/pc98 porting staff. All rights reserved. 979697Snon * Copyright (c) 1995, 1996, 1997, 1998, 1999, 2000, 2001 1073149Snyan * Naofumi HONDA. All rights reserved. 1173149Snyan * 1273149Snyan * Redistribution and use in source and binary forms, with or without 1373149Snyan * modification, are permitted provided that the following conditions 1473149Snyan * are met: 1573149Snyan * 1. Redistributions of source code must retain the above copyright 1673149Snyan * notice, this list of conditions and the following disclaimer. 1773149Snyan * 2. Redistributions in binary form must reproduce the above copyright 1873149Snyan * notice, this list of conditions and the following disclaimer in the 1973149Snyan * documentation and/or other materials provided with the distribution. 2073149Snyan * 3. The name of the author may not be used to endorse or promote products 2173149Snyan * derived from this software without specific prior written permission. 2273149Snyan * 2373149Snyan * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 2473149Snyan * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 2573149Snyan * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 2673149Snyan * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 2773149Snyan * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 2873149Snyan * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 2973149Snyan * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 3073149Snyan * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 3173149Snyan * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 3273149Snyan * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 3373149Snyan * POSSIBILITY OF SUCH DAMAGE. 3473149Snyan */ 3573149Snyan 3673149Snyan#ifndef _CTVAR_H_ 3773149Snyan#define _CTVAR_H_ 3873149Snyan/* 3973149Snyan * ctvar.h 4073149Snyan * Generic wd33c93 chip driver's definitions 4173149Snyan */ 4273149Snyan 4373149Snyan/***************************************************************** 4473149Snyan * Host adapter structure 4573149Snyan *****************************************************************/ 4679697Snonstruct ct_bus_access_handle { 4779697Snon bus_space_tag_t ch_iot; /* core chip ctrl port tag */ 4879697Snon bus_space_tag_t ch_delayt; /* delay port tag */ 4979697Snon bus_space_tag_t ch_datat; /* data port tag (pio) */ 5079697Snon bus_space_tag_t ch_memt; /* data port tag (shm) */ 5179697Snon 5279697Snon bus_space_handle_t ch_ioh; 5379697Snon bus_space_handle_t ch_delaybah; 5479697Snon bus_space_handle_t ch_datah; 5579697Snon bus_space_handle_t ch_memh; 5679697Snon 5792739Salfred void (*ch_bus_weight)(struct ct_bus_access_handle *); 5879697Snon 5979697Snon#ifdef CT_USE_RELOCATE_OFFSET 6079697Snon bus_addr_t ch_offset[4]; 6179697Snon#endif /* CT_USE_RELOCATE_OFFSET */ 6279697Snon}; 6379697Snon 6473149Snyanstruct ct_softc { 6573149Snyan struct scsi_low_softc sc_sclow; /* generic data */ 6673149Snyan 6779697Snon struct ct_bus_access_handle sc_ch; /* bus access handle */ 6879697Snon 6973149Snyan struct resource *port_res; 7073149Snyan struct resource *mem_res; 7173149Snyan struct resource *irq_res; 7273149Snyan struct resource *drq_res; 7373149Snyan 7473149Snyan bus_dma_tag_t sc_dmat; /* data DMA tag */ 7573149Snyan bus_dmamap_t sc_dmamapt; /* data DMAMAP tag */ 7673149Snyan 7773149Snyan void *sc_ih; 7873149Snyan 7973149Snyan int sc_chiprev; /* chip version */ 8079697Snon#define CT_WD33C93 0x00000 8179697Snon#define CT_WD33C93_A 0x10000 8279697Snon#define CT_AM33C93_A 0x10001 8379697Snon#define CT_WD33C93_B 0x20000 8479697Snon#define CT_WD33C93_C 0x30000 8573149Snyan 8673149Snyan int sc_xmode; 8773149Snyan#define CT_XMODE_PIO 1 8873149Snyan#define CT_XMODE_DMA 2 8973149Snyan 9073149Snyan int sc_dma; /* dma transfer start */ 9173149Snyan#define CT_DMA_PIOSTART 1 9273149Snyan#define CT_DMA_DMASTART 2 9373149Snyan 9473149Snyan int sc_satgo; /* combination cmd start */ 9573149Snyan#define CT_SAT_GOING 1 9673149Snyan 9779697Snon int sc_tmaxcnt; 9873149Snyan int sc_atten; /* attention */ 9973149Snyan u_int8_t sc_creg; /* control register value */ 10073149Snyan 10173149Snyan int sc_chipclk; /* chipclk 0, 10, 15, 20 */ 10273149Snyan struct ct_synch_data { 10373149Snyan u_int cs_period; 10473149Snyan u_int cs_syncr; 10573149Snyan } *sc_sdp; /* synchronous data table pt */ 10673149Snyan 10779697Snon struct ct_synch_data sc_default_sdt[16]; 10879697Snon 10973149Snyan /* 11073149Snyan * Machdep stuff. 11173149Snyan */ 11273149Snyan void *ct_hw; /* point to bshw_softc etc ... */ 11392739Salfred int (*ct_dma_xfer_start)(struct ct_softc *); 11492739Salfred int (*ct_pio_xfer_start)(struct ct_softc *); 11592739Salfred void (*ct_dma_xfer_stop)(struct ct_softc *); 11692739Salfred void (*ct_pio_xfer_stop)(struct ct_softc *); 11792739Salfred void (*ct_bus_reset)(struct ct_softc *); 11892739Salfred void (*ct_synch_setup)(struct ct_softc *, struct targ_info *); 11973149Snyan}; 12073149Snyan 12173149Snyan/***************************************************************** 12279697Snon * Lun information 12373149Snyan *****************************************************************/ 12473149Snyanstruct ct_targ_info { 12573149Snyan struct targ_info cti_ti; 12673149Snyan 12773149Snyan u_int8_t cti_syncreg; 12873149Snyan}; 12973149Snyan 13073149Snyan/***************************************************************** 13173149Snyan * PROTO 13273149Snyan *****************************************************************/ 13392739Salfredint ctprobesubr(struct ct_bus_access_handle *, u_int, int, u_int, int *); 13492739Salfredvoid ctattachsubr(struct ct_softc *); 13592739Salfredint ctintr(void *); 13673149Snyan#endif /* !_CTVAR_H_ */ 137