/*
Linux Driver for BusLogic MultiMaster and FlashPoint SCSI Host Adapters
Copyright 1995-1998 by Leonard N. Zubkoff <lnz@dandelion.com>
This program is free software; you may redistribute and/or modify it under
the terms of the GNU General Public License Version 2 as published by the
Free Software Foundation.
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 complete details.
The author respectfully requests that any modifications to this software be
sent directly to him for evaluation and testing.
Special thanks to Wayne Yen, Jin-Lon Hon, and Alex Win of BusLogic, whose
advice has been invaluable, to David Gentzel, for writing the original Linux
BusLogic driver, and to Paul Gortmaker, for being such a dedicated test site.
Finally, special thanks to Mylex/BusLogic for making the FlashPoint SCCB
Manager available as freely redistributable source code.
*/
#ifndef _BUSLOGIC_H
#define _BUSLOGIC_H
#ifndef PACKED
#define PACKED __attribute__((packed))
#endif
/*
Define the maximum number of BusLogic Host Adapters supported by this driver.
*/
#define BLOGIC_MAX_ADAPTERS 16
/*
Define the maximum number of Target Devices supported by this driver.
*/
#define BLOGIC_MAXDEV 16
/*
Define the maximum number of Scatter/Gather Segments used by this driver.
For optimal performance, it is important that this limit be at least as
large as the largest single request generated by the I/O Subsystem.
*/
#define BLOGIC_SG_LIMIT 128
/*
Define the maximum, maximum automatic, minimum automatic, and default Queue
Depth to allow for Target Devices depending on whether or not they support
Tagged Queuing and whether or not ISA Bounce Buffers are required.
*/
#define BLOGIC_MAX_TAG_DEPTH 64
#define BLOGIC_MAX_AUTO_TAG_DEPTH 28
#define BLOGIC_MIN_AUTO_TAG_DEPTH 7
#define BLOGIC_TAG_DEPTH_BB 3
#define BLOGIC_UNTAG_DEPTH 3
#define BLOGIC_UNTAG_DEPTH_BB 2
/*
Define the default amount of time in seconds to wait between a Host Adapter
Hard Reset which initiates a SCSI Bus Reset and issuing any SCSI commands.
Some SCSI devices get confused if they receive SCSI commands too soon after
a SCSI Bus Reset.
*/
#define BLOGIC_BUS_SETTLE_TIME 2
/*
Define the maximum number of Mailboxes that should be used for MultiMaster
Host Adapters. This number is chosen to be larger than the maximum Host
Adapter Queue Depth and small enough so that the Host Adapter structure
does not cross an allocation block size boundary.
*/
#define BLOGIC_MAX_MAILBOX 211
/*
Define the number of CCBs that should be allocated as a group to optimize
Kernel memory allocation.
*/
#define BLOGIC_CCB_GRP_ALLOCSIZE 7
/*
Define the Host Adapter Line and Message Buffer Sizes.
*/
#define BLOGIC_LINEBUF_SIZE 100
#define BLOGIC_MSGBUF_SIZE 9700
/*
Define the Driver Message Levels.
*/
enum blogic_msglevel {
BLOGIC_ANNOUNCE_LEVEL = 0,
BLOGIC_INFO_LEVEL = 1,
BLOGIC_NOTICE_LEVEL = 2,
BLOGIC_WARN_LEVEL = 3,
BLOGIC_ERR_LEVEL = 4
};
static char *blogic_msglevelmap[] = { KERN_NOTICE, KERN_NOTICE, KERN_NOTICE, KERN_WARNING, KERN_ERR };
/*
Define Driver Message macros.
*/
#define blogic_announce(format, args...) \
blogic_msg(BLOGIC_ANNOUNCE_LEVEL, format, ##args)
#define blogic_info(format, args...) \
blogic_msg(BLOGIC_INFO_LEVEL, format, ##args)
#define blogic_notice(format, args...) \
blogic_msg(BLOGIC_NOTICE_LEVEL, format, ##args)
#define blogic_warn(format, args...) \
blogic_msg(BLOGIC_WARN_LEVEL, format, ##args)
#define blogic_err(format, args...) \
blogic_msg(BLOGIC_ERR_LEVEL, format, ##args)
/*
Define the types of BusLogic Host Adapters that are supported and the number
of I/O Addresses required by each type.
*/
enum blogic_adapter_type {
BLOGIC_MULTIMASTER = 1,
BLOGIC_FLASHPOINT = 2
} PACKED;
#define BLOGIC_MULTIMASTER_ADDR_COUNT 4
#define BLOGIC_FLASHPOINT_ADDR_COUNT 256
static int blogic_adapter_addr_count[3] = { 0, BLOGIC_MULTIMASTER_ADDR_COUNT, BLOGIC_FLASHPOINT_ADDR_COUNT };
/*
Define macros for testing the Host Adapter Type.
*/
#ifdef CONFIG_SCSI_FLASHPOINT
#define blogic_multimaster_type(adapter) \
(adapter->adapter_type == BLOGIC_MULTIMASTER)
#define blogic_flashpoint_type(adapter) \
(adapter->adapter_type == BLOGIC_FLASHPOINT)
#else
#define blogic_multimaster_type(adapter) (true)
#define blogic_flashpoint_type(adapter) (false)
#endif
/*
Define the possible Host Adapter Bus Types.
*/
enum blogic_adapter_bus_type {
BLOGIC_UNKNOWN_BUS = 0,
BLOGIC_ISA_BUS = 1,
BLOGIC_EISA_BUS = 2,
BLOGIC_PCI_BUS = 3,
BLOGIC_VESA_BUS = 4,
BLOGIC_MCA_BUS = 5
} PACKED;
static char *blogic_adapter_busnames[] = { "Unknown", "ISA", "EISA", "PCI", "VESA", "MCA" };
static