/* * Adaptec AIC7xxx device driver for Linux. * * Copyright (c) 1994 John Aycock * The University of Calgary Department of Computer Science. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * * Copyright (c) 2000-2003 Adaptec Inc. * 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, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * substantially similar to the "NO WARRANTY" disclaimer below * ("Disclaimer") and any redistribution must be conditioned upon * including a substantially similar Disclaimer requirement for further * binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR 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 DAMAGES. * * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7xxx_osm.h#151 $ *
*/ #ifndef _AIC7XXX_LINUX_H_ #define _AIC7XXX_LINUX_H_
#define BUS_DMA_WAITOK 0x0 #define BUS_DMA_NOWAIT 0x1 #define BUS_DMA_ALLOCNOW 0x2 #define BUS_DMA_LOAD_SEGS 0x4 /* * Argument is an S/G list not * a single buffer.
*/
/* * XXX * ahc_dmamap_sync is only used on buffers allocated with * the dma_alloc_coherent() API. Although I'm not sure how * this works on architectures with a write buffer, Linux does * not have an API to sync "coherent" memory. Perhaps we need * to do an mb()?
*/ #define ahc_dmamap_sync(ahc, dma_tag, dmamap, offset, len, op)
/***************************** SMP support ************************************/ #include <linux/spinlock.h>
#define AIC7XXX_DRIVER_VERSION "7.0"
/*************************** Device Data Structures ***************************/ /* * A per probed device structure used to deal with some error recovery * scenarios that the Linux mid-layer code just doesn't know how to * handle. The structure allocated for a device only becomes persistent * after a successfully completed inquiry command to the target when * that inquiry data indicates a lun is present.
*/ typedefenum {
AHC_DEV_FREEZE_TIL_EMPTY = 0x02, /* Freeze queue until active == 0 */
AHC_DEV_Q_BASIC = 0x10, /* Allow basic device queuing */
AHC_DEV_Q_TAGGED = 0x20, /* Allow full SCSI2 command queueing */
AHC_DEV_PERIODIC_OTAG = 0x40, /* Send OTAG to prevent starvation */
} ahc_linux_dev_flags;
struct ahc_linux_device { /* * The number of transactions currently * queued to the device.
*/ int active;
/* * The currently allowed number of * transactions that can be queued to * the device. Must be signed for * conversion from tagged to untagged * mode where the device may have more * than one outstanding active transaction.
*/ int openings;
/* * A positive count indicates that this * device's queue is halted.
*/
u_int qfrozen;
/* * The number of tagged transactions when * running at our current opening level * that have been successfully received by * this device since the last QUEUE FULL.
*/
u_int tag_success_count; #define AHC_TAG_SUCCESS_INTERVAL 50
ahc_linux_dev_flags flags;
/* * The high limit for the tags variable.
*/
u_int maxtags;
/* * The computed number of tags outstanding * at the time of the last QUEUE FULL event.
*/
u_int tags_on_last_queuefull;
/* * How many times we have seen a queue full * with the same number of tags. This is used * to stop our adaptive queue depth algorithm * on devices with a fixed number of tags.
*/
u_int last_queuefull_same_count; #define AHC_LOCK_TAGS_COUNT 50
/* * How many transactions have been queued * without the device going idle. We use * this statistic to determine when to issue * an ordered tag to prevent transaction * starvation. This statistic is only updated * if the AHC_DEV_PERIODIC_OTAG flag is set * on this device.
*/
u_int commands_since_idle_or_otag; #define AHC_OTAG_THRESH 500
};
/********************* Definitions Required by the Core ***********************/ /* * Number of SG segments we require. So long as the S/G segments for * a particular transaction are allocated in a physically contiguous * manner and are allocated below 4GB, the number of S/G segments is * unrestricted.
*/ #define AHC_NSEG 128
/* * Define a structure used for each host adapter. All members are * aligned on a boundary >= the size of the member to honor the * alignment restrictions of the various platforms supported by * this driver.
*/ struct ahc_platform_data { /* * Fields accessed from interrupt context.
*/ struct scsi_target *starget[AHC_NUM_TARGETS];
spinlock_t spin_lock;
u_int qfrozen; struct completion *eh_done; struct Scsi_Host *host; /* pointer to scsi host */ #define AHC_LINUX_NOIRQ ((uint32_t)~0)
uint32_t irq; /* IRQ for this adapter */
uint32_t bios_address;
resource_size_t mem_busaddr; /* Mem Base Addr */
};
void ahc_delay(long);
/***************************** Low Level I/O **********************************/
uint8_t ahc_inb(struct ahc_softc * ahc, long port); void ahc_outb(struct ahc_softc * ahc, long port, uint8_t val); void ahc_outsb(struct ahc_softc * ahc, long port,
uint8_t *, int count); void ahc_insb(struct ahc_softc * ahc, long port,
uint8_t *, int count);
/**************************** Initialization **********************************/ int ahc_linux_register_host(struct ahc_softc *, struct scsi_host_template *);
/******************************** Locking *************************************/ /* Lock protecting internal data structures */
staticinline void ahc_set_transaction_tag(struct scb *scb, int enabled, u_int type)
{ /* * Nothing to do for linux as the incoming transaction * has no concept of tag/non tagged, etc.
*/
}
staticinline int ahc_perform_autosense(struct scb *scb)
{ /* * We always perform autosense in Linux. * On other platforms this is set on a * per-transaction basis.
*/ return (1);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.6Bemerkung:
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.