/*
* Copyright (c) 2003 Wasabi Systems, Inc.
* All rights reserved.
*
* Written by Jason R. Thorpe for Wasabi Systems, Inc.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed for the NetBSD Project by
* Wasabi Systems, Inc.
* 4. The name of Wasabi Systems, Inc. may not be used to endorse
* or promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``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 WASABI SYSTEMS, INC
* 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 by Greg Ansley, Adam Prewett
*
* Partially derived from Matt Jacobs ISP driver.
*
* 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 immediately at the beginning of the file, without modification,
* this list of conditions, and the following disclaimer.
* 2. 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 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
*/
/*
* Additional Copyright (c) 2002 by Matthew Jacob under same license.
*/
/*
* mpt_netbsd.h:
*
* NetBSD-specific definitions for LSI Fusion adapters.
*
* Adapted from the FreeBSD "mpt" driver by Jason R. Thorpe for
* Wasabi Systems, Inc.
*
* Additional contributions by Garrett D'Amore on behalf of TELES AG.
*/
/*
* We cannot tell prior to getting IOC facts how big the IOC's request
* area is. Because of this we cannot tell at compile time how many
* simple SG elements we can fit within an IOC request prior to having
* to put in a chain element.
*
* Experimentally we know that the Ultra4 parts have a 96 byte request
* element size and the Fibre Channel units have a 144 byte request
* element size. Therefore, if we have 512-32 (== 480) bytes of request
* area to play with, we have room for between 3 and 5 request sized
* regions- the first of which is the command plus a simple SG list,
* the rest of which are chained continuation SG lists. Given that the
* normal request we use is 48 bytes w/o the first SG element, we can
* assume we have 480-48 == 432 bytes to have simple SG elements and/or
* chain elements. If we assume 32 bit addressing, this works out to
* 54 SG or chain elements. If we assume 5 chain elements, then we have
* a maximum of 49 separate actual SG segments.
*/
#define MPT_SGL_MAX 49
/*
* Convert a physical address returned from IOC to a virtual address
* needed to access the data.
*/
#define MPT_REPLY_PTOV(m, x) \
((void *)(&(m)->reply[(((x) << 1) - (m)->reply_phys)]))
enum mpt_req_state {
REQ_FREE,
REQ_IN_PROGRESS,
REQ_TIMEOUT,
REQ_ON_CHIP,
REQ_DONE
};
typedef struct req_entry {
uint16_t index; /* index of this entry */
struct scsipi_xfer *xfer; /* scsipi xfer request */
void *req_vbuf; /* virtual address of entry */
void *sense_vbuf; /* virtual address of sense data */
bus_addr_t req_pbuf; /* physical address of entry */
bus_addr_t sense_pbuf; /* physical address of sense data */
bus_dmamap_t dmap; /* DMA map for data buffer */
SLIST_ENTRY(req_entry) link; /* pointer to next in list */
enum mpt_req_state debug; /* debugging */
uint32_t sequence; /* sequence number */
} request_t;