Home | History | Annotate | Line # | Download | only in ic
siisatavar.h revision 1.2.8.1
      1  1.2.8.1      jym /* $NetBSD: siisatavar.h,v 1.2.8.1 2009/07/23 23:31:48 jym Exp $ */
      2      1.1  jnemeth 
      3      1.1  jnemeth /* from ahcisatavar.h */
      4      1.1  jnemeth 
      5      1.1  jnemeth /*
      6      1.1  jnemeth  * Copyright (c) 2006 Manuel Bouyer.
      7      1.1  jnemeth  *
      8      1.1  jnemeth  * Redistribution and use in source and binary forms, with or without
      9      1.1  jnemeth  * modification, are permitted provided that the following conditions
     10      1.1  jnemeth  * are met:
     11      1.1  jnemeth  * 1. Redistributions of source code must retain the above copyright
     12      1.1  jnemeth  *    notice, this list of conditions and the following disclaimer.
     13      1.1  jnemeth  * 2. Redistributions in binary form must reproduce the above copyright
     14      1.1  jnemeth  *    notice, this list of conditions and the following disclaimer in the
     15      1.1  jnemeth  *    documentation and/or other materials provided with the distribution.
     16      1.1  jnemeth  * 3. All advertising materials mentioning features or use of this software
     17      1.1  jnemeth  *    must display the following acknowledgement:
     18      1.1  jnemeth  *	This product includes software developed by Manuel Bouyer.
     19      1.1  jnemeth  * 4. The name of the author may not be used to endorse or promote products
     20      1.1  jnemeth  *    derived from this software without specific prior written permission.
     21      1.1  jnemeth  *
     22      1.1  jnemeth  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     23      1.1  jnemeth  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     24      1.1  jnemeth  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     25      1.1  jnemeth  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     26      1.1  jnemeth  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     27      1.1  jnemeth  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     28      1.1  jnemeth  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     29      1.1  jnemeth  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     30      1.1  jnemeth  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     31      1.1  jnemeth  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     32      1.1  jnemeth  *
     33      1.1  jnemeth  */
     34      1.1  jnemeth 
     35      1.1  jnemeth /*-
     36  1.2.8.1      jym  * Copyright (c) 2007, 2008, 2009 Jonathan A. Kollasch.
     37      1.1  jnemeth  * All rights reserved.
     38      1.1  jnemeth  *
     39      1.1  jnemeth  * Redistribution and use in source and binary forms, with or without
     40      1.1  jnemeth  * modification, are permitted provided that the following conditions
     41      1.1  jnemeth  * are met:
     42      1.1  jnemeth  * 1. Redistributions of source code must retain the above copyright
     43      1.1  jnemeth  *    notice, this list of conditions and the following disclaimer.
     44      1.1  jnemeth  * 2. Redistributions in binary form must reproduce the above copyright
     45      1.1  jnemeth  *    notice, this list of conditions and the following disclaimer in the
     46      1.1  jnemeth  *    documentation and/or other materials provided with the distribution.
     47      1.1  jnemeth  *
     48      1.1  jnemeth  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     49      1.1  jnemeth  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     50      1.1  jnemeth  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     51      1.1  jnemeth  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     52      1.1  jnemeth  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     53      1.1  jnemeth  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     54      1.1  jnemeth  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     55      1.1  jnemeth  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     56      1.1  jnemeth  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     57      1.1  jnemeth  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     58      1.1  jnemeth  *
     59      1.1  jnemeth  */
     60      1.1  jnemeth 
     61      1.1  jnemeth #ifndef _IC_SIISATAVAR_H_
     62      1.1  jnemeth #define _IC_SIISATAVAR_H_
     63      1.1  jnemeth 
     64      1.1  jnemeth #include <dev/ic/siisatareg.h>
     65      1.1  jnemeth #include <dev/ata/atavar.h>
     66      1.1  jnemeth 
     67      1.1  jnemeth #define DEBUG_INTR   0x01
     68      1.1  jnemeth #define DEBUG_XFERS  0x02
     69      1.1  jnemeth #define DEBUG_FUNCS  0x08
     70      1.1  jnemeth #define DEBUG_PROBE  0x10
     71      1.1  jnemeth #define DEBUG_DETACH 0x20
     72      1.1  jnemeth #define DEBUG_DEBUG 0x80000000
     73      1.1  jnemeth #ifdef SIISATA_DEBUG
     74      1.1  jnemeth extern int siisata_debug_mask;
     75      1.1  jnemeth #define SIISATA_DEBUG_PRINT(args, level) \
     76      1.1  jnemeth 	if (siisata_debug_mask & (level)) \
     77      1.1  jnemeth 		printf args
     78      1.1  jnemeth #else
     79      1.1  jnemeth #define SIISATA_DEBUG_PRINT(args, level)
     80      1.1  jnemeth #endif
     81      1.1  jnemeth 
     82      1.1  jnemeth struct siisata_softc {
     83      1.1  jnemeth 	struct atac_softc sc_atac;
     84      1.1  jnemeth 	bus_space_tag_t sc_grt;
     85      1.1  jnemeth 	bus_space_handle_t sc_grh;
     86  1.2.8.1      jym 	bus_size_t sc_grs;
     87      1.1  jnemeth 	bus_space_tag_t sc_prt;
     88      1.1  jnemeth 	bus_space_handle_t sc_prh;
     89  1.2.8.1      jym 	bus_size_t sc_prs;
     90      1.1  jnemeth 	bus_dma_tag_t sc_dmat;
     91      1.1  jnemeth 
     92      1.1  jnemeth 	struct ata_channel *sc_chanarray[SIISATA_MAX_PORTS];
     93      1.1  jnemeth 	struct siisata_channel {
     94      1.1  jnemeth 		struct ata_channel ata_channel;
     95      1.1  jnemeth 		bus_space_handle_t sch_scontrol;
     96      1.1  jnemeth 		bus_space_handle_t sch_sstatus;
     97      1.1  jnemeth 		bus_space_handle_t sch_serror;
     98      1.1  jnemeth 
     99      1.1  jnemeth 		/* command activation PRBs */
    100      1.1  jnemeth 		bus_dmamap_t sch_prbd;
    101      1.1  jnemeth 		struct siisata_prb *sch_prb[SIISATA_MAX_SLOTS];
    102      1.1  jnemeth 		bus_addr_t sch_bus_prb[SIISATA_MAX_SLOTS];
    103      1.1  jnemeth 
    104      1.1  jnemeth 		bus_dmamap_t sch_datad[SIISATA_MAX_SLOTS];
    105      1.1  jnemeth 
    106      1.1  jnemeth 		uint32_t sch_active_slots;
    107      1.1  jnemeth 	} sc_channels[SIISATA_MAX_PORTS];
    108      1.1  jnemeth };
    109      1.1  jnemeth 
    110      1.1  jnemeth #define SIISATANAME(sc) (device_xname((sc)->sc_atac.atac_dev))
    111      1.1  jnemeth 
    112      1.1  jnemeth #define GRREAD(sc, reg) bus_space_read_4((sc)->sc_grt, (sc)->sc_grh, (reg))
    113      1.1  jnemeth #define GRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_grt, (sc)->sc_grh, (reg), (val))
    114      1.1  jnemeth #define PRREAD(sc, reg) bus_space_read_4((sc)->sc_prt, (sc)->sc_prh, (reg))
    115      1.1  jnemeth #define PRWRITE(sc, reg, val) bus_space_write_4((sc)->sc_prt, (sc)->sc_prh, (reg), (val))
    116      1.1  jnemeth 
    117      1.1  jnemeth #define SIISATA_PRB_SYNC(sc, schp, slot, op) bus_dmamap_sync((sc)->sc_dmat, \
    118      1.1  jnemeth     (schp)->sch_prbd, slot * SIISATA_CMD_SIZE, SIISATA_CMD_SIZE, (op))
    119      1.1  jnemeth 
    120      1.1  jnemeth #define SIISATA_NON_NCQ_SLOT 27
    121      1.1  jnemeth 
    122  1.2.8.1      jym void siisata_attach(struct siisata_softc *);
    123  1.2.8.1      jym int siisata_detach(struct siisata_softc *, int);
    124      1.1  jnemeth void siisata_resume(struct siisata_softc *);
    125  1.2.8.1      jym int siisata_intr(void *);
    126      1.1  jnemeth 
    127      1.1  jnemeth #endif  /* !_IC_SIISATAVAR_H_ */
    128