aac.h revision 830d82f7f87041e48127cac2e92b5cb2d878202e
/*
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright 2005-06 Adaptec, Inc.
* Copyright (c) 2005-06 Adaptec Inc., Achim Leubner
* Copyright (c) 2000 Michael Smith
* Copyright (c) 2001 Scott Long
* 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
*
* 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.
*
*/
#ifndef _AAC_H_
#define _AAC_H_
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/* #define AAC_DEBUG 0 */
#ifdef AAC_DEBUG
extern void aac_print_fib(struct aac_fib *);
#define AACDB_PRINT_FUNC() \
#define AACDB_PRINT_FIB(x) aac_print_fib(x)
#define AACDB_PRINT_SCMD(x) aac_print_scmd(x)
#define AACDB_PRINT_AIF(x) aac_print_aif(x)
do { \
AACDB_PRINT_FUNC(); \
#else
#define AACDB_PRINT(fmt)
#define AACDB_PRINT_FIB(x)
#define AACDB_PRINT_SCMD(x)
#define AACDB_PRINT_AIF(x)
#endif /* AAC_DEBUG */
#define AAC_ROUNDUP(x, y) (((x) + (y) - 1) / (y) * (y))
#define AAC_TYPE_DEVO 1
#define AAC_TYPE_ALPHA 2
#define AAC_TYPE_BETA 3
#define AAC_TYPE_RELEASE 4
#ifndef AAC_DRIVER_BUILD
#define AAC_DRIVER_BUILD 1
#endif
#define AAC_DRIVER_MAJOR_VERSION 2
#define AAC_DRIVER_MINOR_VERSION 1
#define AAC_DRIVER_BUGFIX_LEVEL 10
#define AAC_DRIVER_TYPE AAC_TYPE_RELEASE
#define AACOK 0
#define AACERR -1
#define AAC_MAX_ADAPTERS 64
/* Definitions for mode sense */
#define MODE_FORMAT_SIZE (sizeof (struct mode_format))
#ifndef SD_MODE_SENSE_PAGE3_CODE
#define SD_MODE_SENSE_PAGE3_CODE 0x03
#endif
#ifndef SD_MODE_SENSE_PAGE4_CODE
#define SD_MODE_SENSE_PAGE4_CODE 0x04
#endif
#ifndef SCMD_SYNCHRONIZE_CACHE
#define SCMD_SYNCHRONIZE_CACHE 0x35
#endif
#define AAC_SECTOR_SIZE 512
#define AAC_NUMBER_OF_HEADS 255
#define AAC_SECTORS_PER_TRACK 63
#define AAC_ROTATION_SPEED 10000
#define AAC_MAX_PFN 0xfffff
#define AAC_ADDITIONAL_LEN 31
#define AAC_ANSI_VER 2
#define AAC_RESP_DATA_FORMAT 2
/*
* The controller reports status events in AIFs. We hang on to a number of
* these in order to pass them out to user-space management tools.
*/
#define AAC_AIFQ_LENGTH 64
/* Adapter hardware interface types */
#define AAC_HWIF_UNKNOWN 0
#define AAC_HWIF_I960RX 1
#define AAC_HWIF_RKT 2
#define AAC_TYPE_UNKNOWN 0
#define AAC_TYPE_SCSI 1
#define AAC_TYPE_SATA 2
#define AAC_TYPE_SAS 3
struct aac_card_type {
char *vid; /* ASCII data for INQUIRY command vendor id */
char *desc; /* ASCII data for INQUIRY command product id */
};
struct aac_container {
};
struct sync_mode_res {
};
struct aac_cmd_queue {
};
/*
* The firmware can support a lot of outstanding commands. Each aac_slot
* is corresponding to one of such commands. It records the command and
* associated DMA resource for FIB command.
*/
struct aac_slot {
int next; /* index of next slot */
int index; /* index of this slot if used, or -1 if free */
};
/* flags for attach tracking */
#define AAC_ATTACH_SOFTSTATE_ALLOCED (1 << 0)
/* driver running states */
#define AAC_STATE_STOPPED 0
#define AAC_STATE_RUN 1
#define AAC_STATE_QUIESCE 2
#define AAC_STATE_RESET 3
#define AAC_STATE_DEAD 4
/* flags for aac firmware */
struct aac_softstate;
struct aac_interface {
int (*aif_get_fwstatus)(struct aac_softstate *);
};
struct aac_fib_context {
int ctx_idx;
int ctx_wrap;
};
struct aac_softstate {
int card; /* index to aac_cards */
/* mapped to address the card */
/* dma attributes */
char *pci_mem_base_addr;
/* adapter hardware interface */
struct aac_interface aac_if;
int container_count; /* max container id */
struct sync_mode_res sync_mode;
/* the following is communication space */
struct aac_comm_space *comm_space;
/* the following is about message queues */
struct aac_queue_table *qtablep;
/* the following is used for soft int */
/*
* Command queues
* Each aac command flows through wait(or wait_sync) queue,
* io_slot and comp queue sequentially.
*/
/* aac I/O slots and FIBs */
int total_slots; /* total slots allocated */
int total_fibs; /* total FIBs allocated */
int free_io_slot_head;
int free_io_slot_tail;
int free_io_slot_len;
int slot_hold; /* hold slots from being used */
int flags; /* firmware features enabled */
int state; /* driver state */
/* for ioctl_send_fib() */
/* AIF */
int aifq_idx;
int aifq_filled;
struct aac_fib_context *fibctx;
int devcfg_wait_on; /* AIF event waited for rescan */
/* new comm. interface */
};
/* aac_cmd flags */
#define AAC_CMD_CONSISTENT (1 << 0)
/* aac_cmd states */
#define AAC_CMD_INCMPLT 0
#define AAC_CMD_CMPLT 1
#define AAC_CMD_ABORT 2
struct aac_cmd {
int cmdlen;
int flags;
int state;
/* For non-aligned buffer and SRB */
/*
* NOTE: should be the last field, because New Comm. FIBs may
* take more space than sizeof (struct aac_fib).
*/
};
#ifdef __cplusplus
}
#endif
#endif /* _AAC_H_ */