/*
* Copyright (c) 2002 Manuel Bouyer.
*
* 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 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.
*
*/
/* structure and definitions for the siop driver */
/* Number of tag */
#define ESIOP_NTAG 256
/*
* description of a command scheduler slot. The script uses a ring of
* A_ncmd_slots of this.
*/
struct esiop_slot {
uint32_t dsa; /* DSA of the xfer. The first 2 bits holds flags */
} __packed;
/*
* xfer description of the script: tables and reselect script
* In struct siop_common_cmd siop_xfer will point to this.
* If you change this don't forget to update o_cmd_* and cmd_slot_size in script
*/
struct esiop_xfer {
struct siop_common_xfer siop_tables;
uint32_t tlq; /* target/lun/tag loaded in scratchC by script */
uint32_t saved_offset;/* contains scratchA if script saved an offset */
} __packed;
#define ESIOP_XFER(cmd, m) (((struct esiop_xfer *)((cmd)->cmd_tables))->m)
/*
* This describes a command handled by the SCSI controller
* These are chained in either a free list or an active list
* We have one queue per target
*/
/* DSA table descriptor for tags. Free tables are in a list */
struct esiop_dsatbl {
TAILQ_ENTRY (esiop_dsatbl) next;
uint32_t *tbl; /* the table itself */
uint32_t tbl_dsa; /* DSA of base of this table */
bus_addr_t tbl_offset; /* offset of this table in the map */
struct esiop_dsatblblk *tblblk; /* pointer back to our block */
};
/* Number of table per block */
#define ESIOP_NTPB ((PAGE_SIZE) / (sizeof(uint32_t) * ESIOP_NTAG))
/* per lun struct */
struct esiop_lun {
struct esiop_cmd *active; /* active non-tagged command */
struct esiop_cmd *tactive[ESIOP_NTAG]; /* active tagged commands */
int lun_flags; /* per-lun flags */
struct esiop_dsatbl *lun_tagtbl; /* the tag DSA table */
};
/*
* per target struct; siop_common_cmd->target and siop_common_softc->targets[]
* will point to this
*/
struct esiop_target {
struct siop_common_target target_c;
struct esiop_lun *esiop_lun[8]; /* per-lun state */
uint32_t lun_table_offset; /* pointer to our DSA table */
};