/* SPDX-License-Identifier: GPL-2.0-or-later */ /****************************************************************************** ** Device driver for the PCI-SCSI NCR538XX controller family. ** ** Copyright (C) 1994 Wolfgang Stanglmeier ** Copyright (C) 1998-2001 Gerard Roudier <groudier@free.fr> ** ** **----------------------------------------------------------------------------- ** ** This driver has been ported to Linux from the FreeBSD NCR53C8XX driver ** and is currently maintained by ** ** Gerard Roudier <groudier@free.fr> ** ** Being given that this driver originates from the FreeBSD version, and ** in order to keep synergy on both, any suggested enhancements and corrections ** received on Linux are automatically a potential candidate for the FreeBSD ** version. ** ** The original driver has been written for 386bsd and FreeBSD by ** Wolfgang Stanglmeier <wolf@cologne.de> ** Stefan Esser <se@mi.Uni-Koeln.de> ** ** And has been ported to NetBSD by ** Charles M. Hannum <mycroft@gnu.ai.mit.edu> ** ** NVRAM detection and reading. ** Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk> ** ** Added support for MIPS big endian systems. ** Carsten Langgaard, carstenl@mips.com ** Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. ** ** Added support for HP PARISC big endian systems. ** Copyright (C) 2000 MIPS Technologies, Inc. All rights reserved. ** *******************************************************************************
*/
#ifndef NCR53C8XX_H #define NCR53C8XX_H
#include <scsi/scsi_host.h>
/* ** If you want a driver as small as possible, donnot define the ** following options.
*/ #define SCSI_NCR_BOOT_COMMAND_LINE_SUPPORT #define SCSI_NCR_DEBUG_INFO_SUPPORT
/* ** To disable integrity checking, do not define the ** following option.
*/ #ifdef CONFIG_SCSI_NCR53C8XX_INTEGRITY_CHECK # define SCSI_NCR_ENABLE_INTEGRITY_CHECK #endif
/* --------------------------------------------------------------------- ** Take into account kernel configured parameters. ** Most of these options can be overridden at startup by a command line. ** ---------------------------------------------------------------------
*/
/* * For Ultra2 and Ultra3 SCSI support option, use special features. * * Value (default) means: * bit 0 : all features enabled, except: * bit 1 : PCI Write And Invalidate. * bit 2 : Data Phase Mismatch handling from SCRIPTS. * * Use boot options ncr53c8xx=specf:1 if you want all chip features to be * enabled by the driver.
*/ #define SCSI_NCR_SETUP_SPECIAL_FEATURES (3)
/* * Allow tagged command queuing support if configured with default number * of tags set to max (see above).
*/ #ifdef CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS #define SCSI_NCR_SETUP_DEFAULT_TAGS CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS #elifdefined CONFIG_SCSI_NCR53C8XX_TAGGED_QUEUE #define SCSI_NCR_SETUP_DEFAULT_TAGS SCSI_NCR_MAX_TAGS #else #define SCSI_NCR_SETUP_DEFAULT_TAGS (0) #endif
/* ** Work-around common bridge misbehaviour. ** ** - Do not flush posted writes in the opposite ** direction on read. ** - May reorder DMA writes to memory. ** ** This option should not affect performances ** significantly, so it is the default.
*/ #if SCSI_NCR_PCIQ_WORK_AROUND_OPT == 1 #define SCSI_NCR_PCIQ_MAY_NOT_FLUSH_PW_UPSTREAM #define SCSI_NCR_PCIQ_MAY_REORDER_WRITES #define SCSI_NCR_PCIQ_MAY_MISS_COMPLETIONS
/* ** Same as option 1, but also deal with ** misconfigured interrupts. ** ** - Edge triggered instead of level sensitive. ** - No interrupt line connected. ** - IRQ number misconfigured. ** ** If no interrupt is delivered, the driver will ** catch the interrupt conditions 10 times per ** second. No need to say that this option is ** not recommended.
*/ #elif SCSI_NCR_PCIQ_WORK_AROUND_OPT == 2 #define SCSI_NCR_PCIQ_MAY_NOT_FLUSH_PW_UPSTREAM #define SCSI_NCR_PCIQ_MAY_REORDER_WRITES #define SCSI_NCR_PCIQ_MAY_MISS_COMPLETIONS #define SCSI_NCR_PCIQ_BROKEN_INTR
/* ** Some bridge designers decided to flush ** everything prior to deliver the interrupt. ** This option tries to deal with such a ** behaviour.
*/ #elif SCSI_NCR_PCIQ_WORK_AROUND_OPT == 3 #define SCSI_NCR_PCIQ_SYNC_ON_INTR #endif
/* ** Other parameters not configurable with "make config" ** Avoid to change these constants, unless you know what you are doing.
*/
/* ** Compute some desirable value for CAN_QUEUE ** and CMD_PER_LUN. ** The driver will use lower values if these ** ones appear to be too large.
*/ #define SCSI_NCR_CAN_QUEUE (8*SCSI_NCR_MAX_TAGS + 2*SCSI_NCR_MAX_TARGET) #define SCSI_NCR_CMD_PER_LUN (SCSI_NCR_MAX_TAGS)
#if !defined(__hppa__) && !defined(__mips__) #ifdef SCSI_NCR_BIG_ENDIAN #error"The NCR in BIG ENDIAN addressing mode is not (yet) supported" #endif #endif
#define MEMORY_BARRIER() mb()
/* * If the NCR uses big endian addressing mode over the * PCI, actual io register addresses for byte and word * accesses must be changed according to lane routing. * Btw, ncr_offb() and ncr_offw() macros only apply to * constants and so donnot generate bloated code.
*/
/* * If the CPU and the NCR use same endian-ness addressing, * no byte reordering is needed for script patching. * Macro cpu_to_scr() is to be used for script patching. * Macro scr_to_cpu() is to be used for getting a DWORD * from the script.
*/
/* * Access to the controller chip. * * If the CPU and the NCR use same endian-ness addressing, * no byte reordering is needed for accessing chip io * registers. Functions suffixed by '_raw' are assumed * to access the chip over the PCI without doing byte * reordering. Functions suffixed by '_l2b' are * assumed to perform little-endian to big-endian byte * reordering, those suffixed by '_b2l' blah, blah, * blah, ...
*/
#define OUTONB(r, m) OUTB(r, INB(r) | (m)) #define OUTOFFB(r, m) OUTB(r, INB(r) & ~(m)) #define OUTONW(r, m) OUTW(r, INW(r) | (m)) #define OUTOFFW(r, m) OUTW(r, INW(r) & ~(m)) #define OUTONL(r, m) OUTL(r, INL(r) | (m)) #define OUTOFFL(r, m) OUTL(r, INL(r) & ~(m))
/* * We normally want the chip to have a consistent view * of driver internal data structures when we restart it. * Thus these macros.
*/ #define OUTL_DSP(v) \ do { \
MEMORY_BARRIER(); \
OUTL (nc_dsp, (v)); \
} while (0)
#define OUTONB_STD() \ do { \
MEMORY_BARRIER(); \
OUTONB (nc_dcntl, (STD|NOCOM)); \
} while (0)
/*----------------------------------------------------------- ** ** Memory to memory move ** **----------------------------------------------------------- ** ** COPY (bytecount) ** << source_address >> ** << destination_address >> ** ** SCR_COPY sets the NO FLUSH option by default. ** SCR_COPY_F does not set this option. ** ** For chips which do not support this option, ** ncr_copy_and_bind() will remove this bit. **-----------------------------------------------------------
*/
/*----------------------------------------------------------- ** ** Register move and binary operations ** **----------------------------------------------------------- ** ** SFBR_REG (reg, op, data) reg = SFBR op data ** << 0 >> ** ** REG_SFBR (reg, op, data) SFBR = reg op data ** << 0 >> ** ** REG_REG (reg, op, data) reg = reg op data ** << 0 >> ** **----------------------------------------------------------- ** On 810A, 860, 825A, 875, 895 and 896 chips the content ** of SFBR register can be used as data (SCR_SFBR_DATA). ** The 896 has additional IO registers starting at ** offset 0x80. Bit 7 of register offset is stored in ** bit 7 of the SCRIPTS instruction first DWORD. **-----------------------------------------------------------
*/
/* Build a scatter/gather entry. see sym53c8xx_2/sym_hipd.h for more detailed sym_build_sge() implementation ;)
*/
#define ncr_build_sge(np, data, badd, len) \ do { \
(data)->addr = cpu_to_scr(badd); \
(data)->size = cpu_to_scr(len); \
} while (0)
/*========================================================== ** ** Structures used by the detection routine to transmit ** device configuration to the attach function. ** **==========================================================
*/ struct ncr_slot {
u_long base;
u_long base_2;
u_long base_c;
u_long base_2_c; void __iomem *base_v; void __iomem *base_2_v; int irq; /* port and reg fields to use INB, OUTB macros */ volatilestruct ncr_reg __iomem *reg;
};
/*========================================================== ** ** Structure used by detection routine to save data on ** each detected board for attach. ** **==========================================================
*/ struct ncr_device { struct device *dev; struct ncr_slot slot; struct ncr_chip chip;
u_char host_id;
u8 differential;
};
/* To keep track of the dma mapping (sg/single) that has been set */ struct ncr_cmd_priv { int data_mapped; int data_mapping;
};
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.