xref: /freebsd/sys/dev/ips/ips.h (revision 2aedd662d8ab5bdd421bbae90f92a79b96e64e57)
12aedd662SScott Long /*-
22aedd662SScott Long  * Copyright (c) 2002 Adaptec Inc.
32aedd662SScott Long  * All rights reserved.
42aedd662SScott Long  *
52aedd662SScott Long  * Written by: David Jeffery
62aedd662SScott Long  *
72aedd662SScott Long  * Redistribution and use in source and binary forms, with or without
82aedd662SScott Long  * modification, are permitted provided that the following conditions
92aedd662SScott Long  * are met:
102aedd662SScott Long  * 1. Redistributions of source code must retain the above copyright
112aedd662SScott Long  *    notice, this list of conditions and the following disclaimer.
122aedd662SScott Long  * 2. Redistributions in binary form must reproduce the above copyright
132aedd662SScott Long  *    notice, this list of conditions and the following disclaimer in the
142aedd662SScott Long  *    documentation and/or other materials provided with the distribution.
152aedd662SScott Long  *
162aedd662SScott Long  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
172aedd662SScott Long  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
182aedd662SScott Long  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
192aedd662SScott Long  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
202aedd662SScott Long  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
212aedd662SScott Long  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
222aedd662SScott Long  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
232aedd662SScott Long  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242aedd662SScott Long  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
252aedd662SScott Long  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
262aedd662SScott Long  * SUCH DAMAGE.
272aedd662SScott Long  *
282aedd662SScott Long  * $FreeBSD$
292aedd662SScott Long  */
302aedd662SScott Long 
312aedd662SScott Long 
322aedd662SScott Long #include <sys/param.h>
332aedd662SScott Long #include <sys/systm.h>
342aedd662SScott Long #include <sys/kernel.h>
352aedd662SScott Long #include <sys/bus.h>
362aedd662SScott Long #include <sys/conf.h>
372aedd662SScott Long #include <sys/types.h>
382aedd662SScott Long #include <sys/queue.h>
392aedd662SScott Long #include <sys/bio.h>
402aedd662SScott Long #include <sys/malloc.h>
412aedd662SScott Long #include <sys/mutex.h>
422aedd662SScott Long 
432aedd662SScott Long #include <machine/bus_memio.h>
442aedd662SScott Long #include <machine/bus.h>
452aedd662SScott Long #include <sys/rman.h>
462aedd662SScott Long #include <machine/resource.h>
472aedd662SScott Long 
482aedd662SScott Long #include <pci/pcireg.h>
492aedd662SScott Long #include <pci/pcivar.h>
502aedd662SScott Long 
512aedd662SScott Long /*
522aedd662SScott Long  *   IPS CONSTANTS
532aedd662SScott Long  */
542aedd662SScott Long #define IPS_VENDOR_ID                   0x1014
552aedd662SScott Long #define IPS_MORPHEUS_DEVICE_ID          0x01BD
562aedd662SScott Long #define IPS_COPPERHEAD_DEVICE_ID        0x002E
572aedd662SScott Long #define IPS_CSL				0xff
582aedd662SScott Long #define IPS_POCL			0x30
592aedd662SScott Long 
602aedd662SScott Long /* amounts of memory to allocate for certain commands */
612aedd662SScott Long #define IPS_ADAPTER_INFO_LEN		(sizeof(ips_adapter_info_t))
622aedd662SScott Long #define IPS_DRIVE_INFO_LEN		(sizeof(ips_drive_info_t))
632aedd662SScott Long #define IPS_COMMAND_LEN			24
642aedd662SScott Long #define IPS_MAX_SG_LEN			(sizeof(ips_sg_element_t) * IPS_MAX_SG_ELEMENTS)
652aedd662SScott Long #define IPS_NVRAM_PAGE_SIZE		128
662aedd662SScott Long /* various flags */
672aedd662SScott Long #define IPS_NOWAIT_FLAG			1
682aedd662SScott Long 
692aedd662SScott Long /* states for the card to be in */
702aedd662SScott Long #define IPS_DEV_OPEN			0x01
712aedd662SScott Long #define IPS_TIMEOUT			0x02 /* command time out, need reset */
722aedd662SScott Long #define IPS_OFFLINE			0x04 /* can't reset card/card failure */
732aedd662SScott Long 
742aedd662SScott Long /* max number of commands set to something low for now */
752aedd662SScott Long #define IPS_MAX_CMD_NUM			128
762aedd662SScott Long #define IPS_MAX_NUM_DRIVES		8
772aedd662SScott Long #define IPS_MAX_SG_ELEMENTS		32
782aedd662SScott Long #define IPS_MAX_IOBUF_SIZE		(64 * 1024)
792aedd662SScott Long #define IPS_BLKSIZE			512
802aedd662SScott Long 
812aedd662SScott Long /* logical drive states */
822aedd662SScott Long 
832aedd662SScott Long #define IPS_LD_OFFLINE               	0x02
842aedd662SScott Long #define IPS_LD_OKAY                  	0x03
852aedd662SScott Long #define IPS_LD_FREE                  	0x00
862aedd662SScott Long #define IPS_LD_SYS                   	0x06
872aedd662SScott Long #define IPS_LD_CRS                   	0x24
882aedd662SScott Long 
892aedd662SScott Long /* register offsets */
902aedd662SScott Long #define MORPHEUS_REG_OMR0               0x0018 /* Outbound Msg. Reg. 0 */
912aedd662SScott Long #define MORPHEUS_REG_OMR1               0x001C /* Outbound Msg. Reg. 1 */
922aedd662SScott Long #define MORPHEUS_REG_IDR		0x0020 /* Inbound Doorbell Reg. */
932aedd662SScott Long #define MORPHEUS_REG_IISR               0x0024 /* Inbound IRQ Status Reg. */
942aedd662SScott Long #define MORPHEUS_REG_IIMR               0x0028 /* Inbound IRQ Mask Reg. */
952aedd662SScott Long #define MORPHEUS_REG_OISR               0x0030 /* Outbound IRQ Status Reg. */
962aedd662SScott Long #define MORPHEUS_REG_OIMR               0x0034 /* Outbound IRQ Status Reg. */
972aedd662SScott Long #define MORPHEUS_REG_IQPR               0x0040 /* Inbound Queue Port Reg. */
982aedd662SScott Long #define MORPHEUS_REG_OQPR               0x0044 /* Outbound Queue Port Reg. */
992aedd662SScott Long 
1002aedd662SScott Long #define COPPER_REG_SCPR			0x05	/* Subsystem Ctrl. Port Reg. */
1012aedd662SScott Long #define COPPER_REG_ISPR			0x06	/* IRQ Status Port Reg. */
1022aedd662SScott Long #define COPPER_REG_CBSP			0x07	/* ? Reg. */
1032aedd662SScott Long #define COPPER_REG_HISR			0x08	/* Host IRQ Status Reg.    */
1042aedd662SScott Long #define COPPER_REG_CCSAR		0x10	/* Cmd. Channel Sys Addr Reg.*/
1052aedd662SScott Long #define COPPER_REG_CCCR			0x14	/* Cmd. Channel Ctrl. Reg. */
1062aedd662SScott Long #define COPPER_REG_SQHR                	0x20    /* Status Queue Head Reg.  */
1072aedd662SScott Long #define COPPER_REG_SQTR                	0x24    /* Status Queue Tail Reg.  */
1082aedd662SScott Long #define COPPER_REG_SQER                	0x28    /* Status Queue End Reg.   */
1092aedd662SScott Long #define COPPER_REG_SQSR                	0x2C    /* Status Queue Start Reg. */
1102aedd662SScott Long 
1112aedd662SScott Long /* bit definitions */
1122aedd662SScott Long #define MORPHEUS_BIT_POST1              0x01
1132aedd662SScott Long #define MORPHEUS_BIT_POST2              0x02
1142aedd662SScott Long #define MORPHEUS_BIT_CMD_IRQ		0x08
1152aedd662SScott Long 
1162aedd662SScott Long #define COPPER_CMD_START		0x101A
1172aedd662SScott Long #define COPPER_SEM_BIT			0x08
1182aedd662SScott Long #define COPPER_EI_BIT			0x80
1192aedd662SScott Long #define COPPER_EBM_BIT			0x02
1202aedd662SScott Long #define COPPER_RESET_BIT		0x80
1212aedd662SScott Long #define COPPER_GHI_BIT			0x04
1222aedd662SScott Long #define COPPER_SCE_BIT			0x01
1232aedd662SScott Long #define COPPER_OP_BIT			0x01
1242aedd662SScott Long #define COPPER_ILE_BIT			0x10
1252aedd662SScott Long 
1262aedd662SScott Long /* status defines */
1272aedd662SScott Long #define IPS_POST1_OK                    0x8000
1282aedd662SScott Long #define IPS_POST2_OK                    0x000f
1292aedd662SScott Long 
1302aedd662SScott Long /* command op codes */
1312aedd662SScott Long #define IPS_READ_CMD			0x02
1322aedd662SScott Long #define IPS_WRITE_CMD			0x03
1332aedd662SScott Long #define IPS_ADAPTER_INFO_CMD		0x05
1342aedd662SScott Long #define IPS_CACHE_FLUSH_CMD		0x0A
1352aedd662SScott Long #define IPS_REBUILD_STATUS_CMD		0x0C
1362aedd662SScott Long #define IPS_ERROR_TABLE_CMD		0x17
1372aedd662SScott Long #define IPS_DRIVE_INFO_CMD		0x19
1382aedd662SScott Long #define IPS_SUBSYS_PARAM_CMD		0x40
1392aedd662SScott Long #define IPS_CONFIG_SYNC_CMD		0x58
1402aedd662SScott Long #define IPS_SG_READ_CMD			0x82
1412aedd662SScott Long #define IPS_SG_WRITE_CMD		0x83
1422aedd662SScott Long #define IPS_RW_NVRAM_CMD		0xBC
1432aedd662SScott Long 
1442aedd662SScott Long /* error information returned by the adapter */
1452aedd662SScott Long #define IPS_MIN_ERROR			0x02
1462aedd662SScott Long #define IPS_ERROR_STATUS		0x13000200 /* ahh, magic numbers */
1472aedd662SScott Long 
1482aedd662SScott Long #define IPS_OS_FREEBSD			10
1492aedd662SScott Long #define IPS_VERSION_MAJOR		"0.90"
1502aedd662SScott Long #define IPS_VERSION_MINOR		".00"
1512aedd662SScott Long 
1522aedd662SScott Long /*
1532aedd662SScott Long  *  IPS MACROS
1542aedd662SScott Long  */
1552aedd662SScott Long 
1562aedd662SScott Long #define ips_read_1(sc,offset)		bus_space_read_1(sc->bustag, sc->bushandle, offset)
1572aedd662SScott Long #define ips_read_2(sc,offset) 		bus_space_read_2(sc->bustag, sc->bushandle, offset)
1582aedd662SScott Long #define ips_read_4(sc,offset)		bus_space_read_4(sc->bustag, sc->bushandle, offset)
1592aedd662SScott Long 
1602aedd662SScott Long #define ips_write_1(sc,offset,value)	bus_space_write_1(sc->bustag, sc->bushandle, offset, value)
1612aedd662SScott Long #define ips_write_2(sc,offset,value) 	bus_space_write_2(sc->bustag, sc->bushandle, offset, value)
1622aedd662SScott Long #define ips_write_4(sc,offset,value)	bus_space_write_4(sc->bustag, sc->bushandle, offset, value)
1632aedd662SScott Long 
1642aedd662SScott Long /* this is ugly.  It zeros the end elements in an ips_command_t struct starting with the status element */
1652aedd662SScott Long #define clear_ips_command(command)	bzero(&((command)->status), (unsigned long)(&(command)[1])-(unsigned long)&((command)->status))
1662aedd662SScott Long 
1672aedd662SScott Long #define ips_read_request(iobuf)		((iobuf)->bio_cmd == BIO_READ)
1682aedd662SScott Long 
1692aedd662SScott Long #define COMMAND_ERROR(status)		(((status)->fields.basic_status & 0x0f) >= IPS_MIN_ERROR)
1702aedd662SScott Long 
1712aedd662SScott Long #ifndef IPS_DEBUG
1722aedd662SScott Long #define DEVICE_PRINTF(x...)
1732aedd662SScott Long #define PRINTF(x...)
1742aedd662SScott Long #else
1752aedd662SScott Long #define DEVICE_PRINTF(level,x...)	if(IPS_DEBUG >= level)device_printf(x)
1762aedd662SScott Long #define PRINTF(level,x...)		if(IPS_DEBUG >= level)printf(x)
1772aedd662SScott Long #endif
1782aedd662SScott Long /*
1792aedd662SScott Long  *   IPS STRUCTS
1802aedd662SScott Long  */
1812aedd662SScott Long 
1822aedd662SScott Long struct ips_softc;
1832aedd662SScott Long 
1842aedd662SScott Long typedef struct{
1852aedd662SScott Long 	u_int8_t	command;
1862aedd662SScott Long 	u_int8_t	id;
1872aedd662SScott Long 	u_int8_t	drivenum;
1882aedd662SScott Long 	u_int8_t	reserve2;
1892aedd662SScott Long 	u_int32_t	lba;
1902aedd662SScott Long 	u_int32_t	buffaddr;
1912aedd662SScott Long 	u_int32_t	reserve3;
1922aedd662SScott Long } __attribute__ ((packed)) ips_generic_cmd;
1932aedd662SScott Long 
1942aedd662SScott Long typedef struct{
1952aedd662SScott Long 	u_int8_t	command;
1962aedd662SScott Long 	u_int8_t	id;
1972aedd662SScott Long 	u_int8_t	drivenum;
1982aedd662SScott Long 	u_int8_t	segnum;
1992aedd662SScott Long 	u_int32_t	lba;
2002aedd662SScott Long 	u_int32_t	buffaddr;
2012aedd662SScott Long 	u_int16_t	length;
2022aedd662SScott Long 	u_int16_t	reserve1;
2032aedd662SScott Long } __attribute__ ((packed)) ips_io_cmd;
2042aedd662SScott Long 
2052aedd662SScott Long typedef struct{
2062aedd662SScott Long 	u_int8_t	command;
2072aedd662SScott Long 	u_int8_t	id;
2082aedd662SScott Long 	u_int8_t	pagenum;
2092aedd662SScott Long 	u_int8_t	rw;
2102aedd662SScott Long 	u_int32_t	reserve1;
2112aedd662SScott Long 	u_int32_t	buffaddr;
2122aedd662SScott Long 	u_int32_t	reserve3;
2132aedd662SScott Long } __attribute__ ((packed)) ips_rw_nvram_cmd;
2142aedd662SScott Long 
2152aedd662SScott Long typedef struct{
2162aedd662SScott Long 	u_int8_t	command;
2172aedd662SScott Long 	u_int8_t	id;
2182aedd662SScott Long 	u_int8_t	drivenum;
2192aedd662SScott Long 	u_int8_t	reserve1;
2202aedd662SScott Long 	u_int32_t	reserve2;
2212aedd662SScott Long 	u_int32_t	buffaddr;
2222aedd662SScott Long 	u_int32_t	reserve3;
2232aedd662SScott Long } __attribute__ ((packed)) ips_drive_cmd;
2242aedd662SScott Long 
2252aedd662SScott Long typedef struct{
2262aedd662SScott Long 	u_int8_t	command;
2272aedd662SScott Long 	u_int8_t	id;
2282aedd662SScott Long 	u_int8_t	reserve1;
2292aedd662SScott Long 	u_int8_t	commandtype;
2302aedd662SScott Long 	u_int32_t	reserve2;
2312aedd662SScott Long 	u_int32_t	buffaddr;
2322aedd662SScott Long 	u_int32_t	reserve3;
2332aedd662SScott Long } __attribute__((packed)) ips_adapter_info_cmd;
2342aedd662SScott Long 
2352aedd662SScott Long typedef union{
2362aedd662SScott Long 	ips_generic_cmd		generic_cmd;
2372aedd662SScott Long 	ips_drive_cmd 		drive_cmd;
2382aedd662SScott Long 	ips_adapter_info_cmd 	adapter_info_cmd;
2392aedd662SScott Long } ips_cmd_buff_t;
2402aedd662SScott Long 
2412aedd662SScott Long typedef struct {
2422aedd662SScott Long    u_int32_t  signature;
2432aedd662SScott Long    u_int8_t   reserved;
2442aedd662SScott Long    u_int8_t   adapter_slot;
2452aedd662SScott Long    u_int16_t  adapter_type;
2462aedd662SScott Long    u_int8_t   bios_high[4];
2472aedd662SScott Long    u_int8_t   bios_low[4];
2482aedd662SScott Long    u_int16_t  reserve2;
2492aedd662SScott Long    u_int8_t   reserve3;
2502aedd662SScott Long    u_int8_t   operating_system;
2512aedd662SScott Long    u_int8_t   driver_high[4];
2522aedd662SScott Long    u_int8_t   driver_low[4];
2532aedd662SScott Long    u_int8_t   reserve4[100];
2542aedd662SScott Long }__attribute__((packed)) ips_nvram_page5;
2552aedd662SScott Long 
2562aedd662SScott Long typedef struct{
2572aedd662SScott Long 	u_int32_t	addr;
2582aedd662SScott Long 	u_int32_t	len;
2592aedd662SScott Long } ips_sg_element_t;
2602aedd662SScott Long 
2612aedd662SScott Long typedef struct{
2622aedd662SScott Long 	u_int8_t	drivenum;
2632aedd662SScott Long 	u_int8_t	merge_id;
2642aedd662SScott Long 	u_int8_t	raid_lvl;
2652aedd662SScott Long 	u_int8_t	state;
2662aedd662SScott Long 	u_int32_t	sector_count;
2672aedd662SScott Long } __attribute__((packed)) ips_drive_t;
2682aedd662SScott Long 
2692aedd662SScott Long typedef struct{
2702aedd662SScott Long 	u_int8_t	drivecount;
2712aedd662SScott Long 	u_int8_t	reserve1;
2722aedd662SScott Long 	u_int16_t	reserve2;
2732aedd662SScott Long 	ips_drive_t drives[IPS_MAX_NUM_DRIVES];
2742aedd662SScott Long }__attribute__((packed)) ips_drive_info_t;
2752aedd662SScott Long 
2762aedd662SScott Long typedef struct{
2772aedd662SScott Long 	u_int8_t	drivecount;
2782aedd662SScott Long 	u_int8_t	miscflags;
2792aedd662SScott Long 	u_int8_t	SLTflags;
2802aedd662SScott Long 	u_int8_t	BSTflags;
2812aedd662SScott Long 	u_int8_t	pwr_chg_count;
2822aedd662SScott Long 	u_int8_t	wrong_addr_count;
2832aedd662SScott Long 	u_int8_t	unident_count;
2842aedd662SScott Long 	u_int8_t	nvram_dev_chg_count;
2852aedd662SScott Long 	u_int8_t	codeblock_version[8];
2862aedd662SScott Long 	u_int8_t	bootblock_version[8];
2872aedd662SScott Long 	u_int32_t	drive_sector_count[IPS_MAX_NUM_DRIVES];
2882aedd662SScott Long 	u_int8_t	max_concurrent_cmds;
2892aedd662SScott Long 	u_int8_t	max_phys_devices;
2902aedd662SScott Long 	u_int16_t	flash_prog_count;
2912aedd662SScott Long 	u_int8_t	defunct_disks;
2922aedd662SScott Long 	u_int8_t	rebuildflags;
2932aedd662SScott Long 	u_int8_t	offline_drivecount;
2942aedd662SScott Long 	u_int8_t	critical_drivecount;
2952aedd662SScott Long 	u_int16_t	config_update_count;
2962aedd662SScott Long 	u_int8_t	blockedflags;
2972aedd662SScott Long 	u_int8_t	psdn_error;
2982aedd662SScott Long 	u_int16_t	addr_dead_disk[4*16];/* ugly, max # channels * max # scsi devices per channel */
2992aedd662SScott Long }__attribute__((packed)) ips_adapter_info_t;
3002aedd662SScott Long 
3012aedd662SScott Long typedef struct {
3022aedd662SScott Long 	u_int32_t 	status[IPS_MAX_CMD_NUM];
3032aedd662SScott Long 	u_int32_t 	base_phys_addr;
3042aedd662SScott Long 	int 		nextstatus;
3052aedd662SScott Long 	bus_dma_tag_t	dmatag;
3062aedd662SScott Long 	bus_dmamap_t	dmamap;
3072aedd662SScott Long } ips_copper_queue_t;
3082aedd662SScott Long 
3092aedd662SScott Long typedef union {
3102aedd662SScott Long    struct {
3112aedd662SScott Long       u_int8_t  reserved;
3122aedd662SScott Long       u_int8_t  command_id;
3132aedd662SScott Long       u_int8_t  basic_status;
3142aedd662SScott Long       u_int8_t  extended_status;
3152aedd662SScott Long    } fields;
3162aedd662SScott Long    volatile u_int32_t    value;
3172aedd662SScott Long } ips_cmd_status_t;
3182aedd662SScott Long 
3192aedd662SScott Long /* used to keep track of current commands to the card */
3202aedd662SScott Long typedef struct ips_command{
3212aedd662SScott Long 	u_int8_t		command_number;
3222aedd662SScott Long 	u_int8_t 		id;
3232aedd662SScott Long 	u_int8_t		timeout;
3242aedd662SScott Long 	struct ips_softc *	sc;
3252aedd662SScott Long 	bus_dmamap_t		command_dmamap;
3262aedd662SScott Long 	void *			command_buffer;
3272aedd662SScott Long 	u_int32_t		command_phys_addr;/*WARNING! must be changed if 64bit addressing ever used*/
3282aedd662SScott Long 	ips_cmd_status_t	status;
3292aedd662SScott Long 	SLIST_ENTRY(ips_command)	next;
3302aedd662SScott Long 	bus_dma_tag_t		data_dmatag;
3312aedd662SScott Long 	bus_dmamap_t		data_dmamap;
3322aedd662SScott Long 	void *			data_buffer;
3332aedd662SScott Long 	void * 			arg;
3342aedd662SScott Long 	void			(* callback)(struct ips_command *command);
3352aedd662SScott Long }ips_command_t;
3362aedd662SScott Long 
3372aedd662SScott Long typedef struct ips_wait_list{
3382aedd662SScott Long 	STAILQ_ENTRY(ips_wait_list) next;
3392aedd662SScott Long 	void 			*data;
3402aedd662SScott Long 	int			(* callback)(ips_command_t *command);
3412aedd662SScott Long }ips_wait_list_t;
3422aedd662SScott Long 
3432aedd662SScott Long typedef struct ips_softc{
3442aedd662SScott Long         struct resource *       iores;
3452aedd662SScott Long         struct resource *       irqres;
3462aedd662SScott Long 	int			state;
3472aedd662SScott Long         int                     iotype;
3482aedd662SScott Long         int                     rid;
3492aedd662SScott Long         int                     irqrid;
3502aedd662SScott Long         void *                  irqcookie;
3512aedd662SScott Long         bus_space_tag_t	        bustag;
3522aedd662SScott Long 	bus_space_handle_t      bushandle;
3532aedd662SScott Long 	bus_dma_tag_t	        adapter_dmatag;
3542aedd662SScott Long 	bus_dma_tag_t		command_dmatag;
3552aedd662SScott Long 	bus_dma_tag_t		sg_dmatag;
3562aedd662SScott Long         device_t                dev;
3572aedd662SScott Long         dev_t                   device_file;
3582aedd662SScott Long 	struct callout_handle	timer;
3592aedd662SScott Long 	ips_adapter_info_t	adapter_info;
3602aedd662SScott Long 	device_t		diskdev[IPS_MAX_NUM_DRIVES];
3612aedd662SScott Long 	ips_drive_t		drives[IPS_MAX_NUM_DRIVES];
3622aedd662SScott Long 	u_int8_t		drivecount;
3632aedd662SScott Long 	u_int8_t		next_drive;
3642aedd662SScott Long 	u_int8_t		max_cmds;
3652aedd662SScott Long 	volatile u_int8_t	used_commands;
3662aedd662SScott Long 	ips_command_t		commandarray[IPS_MAX_CMD_NUM];
3672aedd662SScott Long 	SLIST_HEAD(command_list, ips_command) free_cmd_list;
3682aedd662SScott Long 	STAILQ_HEAD(command_wait_list,ips_wait_list)  cmd_wait_list;
3692aedd662SScott Long 	int			(* ips_adapter_reinit)(struct ips_softc *sc,
3702aedd662SScott Long 						       int force);
3712aedd662SScott Long         void                    (* ips_adapter_intr)(void *sc);
3722aedd662SScott Long 	void			(* ips_issue_cmd)(ips_command_t *command);
3732aedd662SScott Long 	ips_copper_queue_t *	copper_queue;
3742aedd662SScott Long 	struct mtx		cmd_mtx;
3752aedd662SScott Long }ips_softc_t;
3762aedd662SScott Long 
3772aedd662SScott Long /* function defines from ips_ioctl.c */
3782aedd662SScott Long extern int ips_ioctl_request(ips_softc_t *sc, u_long ioctl_cmd, caddr_t addr,
3792aedd662SScott Long 				int32_t flags);
3802aedd662SScott Long /* function defines from ips_disk.c */
3812aedd662SScott Long extern void ipsd_finish(struct bio *iobuf);
3822aedd662SScott Long 
3832aedd662SScott Long /* function defines from ips_commands.c */
3842aedd662SScott Long extern int ips_flush_cache(ips_softc_t *sc);
3852aedd662SScott Long extern void ips_start_io_request(ips_softc_t *sc, struct bio *iobuf);
3862aedd662SScott Long extern int ips_get_drive_info(ips_softc_t *sc);
3872aedd662SScott Long extern int ips_get_adapter_info(ips_softc_t *sc);
3882aedd662SScott Long extern int ips_update_nvram(ips_softc_t *sc);
3892aedd662SScott Long extern int ips_clear_adapter(ips_softc_t *sc);
3902aedd662SScott Long 
3912aedd662SScott Long /* function defines from ips.c */
3922aedd662SScott Long extern int ips_get_free_cmd(ips_softc_t *sc, int (*callback)(ips_command_t *),
3932aedd662SScott Long 				void *data, unsigned long flags);
3942aedd662SScott Long extern void ips_insert_free_cmd(ips_softc_t *sc, ips_command_t *command);
3952aedd662SScott Long extern int ips_adapter_init(ips_softc_t *sc);
3962aedd662SScott Long extern int ips_morpheus_reinit(ips_softc_t *sc, int force);
3972aedd662SScott Long extern int ips_adapter_free(ips_softc_t *sc);
3982aedd662SScott Long extern void ips_morpheus_intr(void *sc);
3992aedd662SScott Long extern void ips_issue_morpheus_cmd(ips_command_t *command);
4002aedd662SScott Long extern int ips_copperhead_reinit(ips_softc_t *sc, int force);
4012aedd662SScott Long extern void ips_copperhead_intr(void *sc);
4022aedd662SScott Long extern void ips_issue_copperhead_cmd(ips_command_t *command);
4032aedd662SScott Long 
404