/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Andrew Doran, Thor Lancelot Simon, and Eric Haszlakiewicz.
*
* 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 NETBSD FOUNDATION, INC. 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 THE FOUNDATION 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.
*/
/*-
* Copyright (c) 2000, 2001 Michael Smith
* Copyright (c) 2000 BSDi
* 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 THE 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 THE 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.
*
* from FreeBSD: mlyvar.h,v 1.3 2001/07/14 00:12:22 msmith Exp
*/
#ifndef _PCI_MLYVAR_H_
#define _PCI_MLYVAR_H_
/*
* The firmware interface allows for a 16-bit command identifier. We cap
* ourselves at a reasonable limit. Note that we reserve a small number of
* CCBs for control operations.
*/
#define MLY_MAX_CCBS 256
#define MLY_CCBS_RESV 4
/*
* The firmware interface allows for a 16-bit s/g list length. We limit
* ourselves to a reasonable maximum.
*/
#define MLY_MAX_SEGS 17
#define MLY_SGL_SIZE (MLY_MAX_SEGS * sizeof(struct mly_sg_entry))
/*
* The interval at which we poke the controller for status updates (in
* seconds).
*/
#define MLY_PERIODIC_INTERVAL 5
/*
* Command slot regulation. We can't use slot 0 due to the memory mailbox
* implementation.
*/
#define MLY_SLOT_START 1
#define MLY_SLOT_MAX (MLY_SLOT_START + MLY_MAX_CCBS)
/*
* Per-device structure, used to save persistent state on devices.
*
* Note that this isn't really Bus/Target/Lun since we don't support lun !=
* 0 at this time.
*/
struct mly_btl {
int mb_flags;
int mb_state; /* See 8.1 */
int mb_type; /* See 8.2 */
/* Physical devices only. */
int mb_speed; /* Interface transfer rate */
int mb_width; /* Interface width */
};
#define MLY_BTL_PHYSICAL 0x01 /* physical device */
#define MLY_BTL_LOGICAL 0x02 /* logical device */
#define MLY_BTL_PROTECTED 0x04 /* I/O not allowed */
#define MLY_BTL_TQING 0x08 /* tagged queueing */
#define MLY_BTL_SCANNING 0x10 /* scan in progress */
#define MLY_BTL_RESCAN 0x20 /* need to re-scan */
/*
* Per-command context.
*/
struct mly_softc;
struct mly_ccb {
union {
SLIST_ENTRY(mly_ccb) slist;
SIMPLEQ_ENTRY(mly_ccb) simpleq;
} mc_link; /* list linkage */
u_int mc_slot; /* command slot we occupy */
u_int mc_flags; /* status flags */
u_int mc_status; /* command completion status */
u_int mc_sense; /* sense data length */
int32_t mc_resid; /* I/O residual count */
union mly_cmd_packet *mc_packet;/* our controller command */
bus_addr_t mc_packetphys; /* physical address of the mapped packet */
void *mc_data; /* data buffer */
size_t mc_length; /* data length */
bus_dmamap_t mc_datamap; /* DMA map for data */
u_int mc_sgoff; /* S/G list offset */