1/*
2 *    Disk Array driver for Compaq SMART2 Controllers
3 *    Copyright 1998 Compaq Computer Corporation
4 *
5 *    This program is free software; you can redistribute it and/or modify
6 *    it under the terms of the GNU General Public License as published by
7 *    the Free Software Foundation; either version 2 of the License, or
8 *    (at your option) any later version.
9 *
10 *    This program is distributed in the hope that it will be useful,
11 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *    MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
13 *    NON INFRINGEMENT.  See the GNU General Public License for more details.
14 *
15 *    You should have received a copy of the GNU General Public License
16 *    along with this program; if not, write to the Free Software
17 *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 *    Questions/Comments/Bugfixes to arrays@compaq.com
20 *
21 *    If you want to make changes, improve or add functionality to this
22 *    driver, you'll probably need the Compaq Array Controller Interface
23 *    Specificiation (Document number ECG086/1198)
24 */
25#ifndef CPQARRAY_H
26#define CPQARRAY_H
27
28#ifdef __KERNEL__
29#include <linux/blkdev.h>
30#include <linux/locks.h>
31#include <linux/slab.h>
32#include <linux/proc_fs.h>
33#include <linux/timer.h>
34#endif
35
36#include "ida_cmd.h"
37
38#define IO_OK		0
39#define IO_ERROR	1
40#define NWD		16
41#define NWD_SHIFT	4
42#define IDA_MAX_PART	16
43
44#define IDA_TIMER	(5*HZ)
45#define IDA_TIMEOUT	(10*HZ)
46
47#define MISC_NONFATAL_WARN	0x01
48
49typedef struct {
50	unsigned blk_size;
51	unsigned nr_blks;
52	unsigned cylinders;
53	unsigned heads;
54	unsigned sectors;
55	int usage_count;
56} drv_info_t;
57
58#ifdef __KERNEL__
59
60struct ctlr_info;
61typedef struct ctlr_info ctlr_info_t;
62
63struct access_method {
64	void (*submit_command)(ctlr_info_t *h, cmdlist_t *c);
65	void (*set_intr_mask)(ctlr_info_t *h, unsigned long val);
66	unsigned long (*fifo_full)(ctlr_info_t *h);
67	unsigned long (*intr_pending)(ctlr_info_t *h);
68	unsigned long (*command_completed)(ctlr_info_t *h);
69};
70
71struct board_type {
72	__u32	board_id;
73	char	*product_name;
74	struct access_method *access;
75};
76
77struct ctlr_info {
78	int	ctlr;
79	char	devname[8];
80	__u32	log_drv_map;
81	__u32	drv_assign_map;
82	__u32	drv_spare_map;
83	__u32	mp_failed_drv_map;
84
85	char	firm_rev[4];
86	struct pci_dev *pdev;
87	int	ctlr_sig;
88
89	int	log_drives;
90	int	highest_lun;
91	int	phys_drives;
92
93	struct pci_dev *pci_dev;    /* NULL if EISA */
94	__u32	board_id;
95	char	*product_name;
96
97	void *vaddr;
98	unsigned long paddr;
99	unsigned long io_mem_addr;
100	unsigned long io_mem_length;
101	int	intr;
102	int	usage_count;
103	drv_info_t	drv[NWD];
104	struct proc_dir_entry *proc;
105
106	struct access_method access;
107
108	cmdlist_t *reqQ;
109	cmdlist_t *cmpQ;
110	cmdlist_t *cmd_pool;
111	dma_addr_t cmd_pool_dhandle;
112	__u32	*cmd_pool_bits;
113
114	unsigned int Qdepth;
115	unsigned int maxQsinceinit;
116
117	unsigned int nr_requests;
118	unsigned int nr_allocs;
119	unsigned int nr_frees;
120	struct timer_list timer;
121	unsigned int misc_tflags;
122	// Disk structures we need to pass back
123	struct gendisk gendisk;
124	// Index by Minor Numbers
125	struct hd_struct	hd[256];
126	int			sizes[256];
127	int			blocksizes[256];
128	int			hardsizes[256];
129};
130#endif
131
132#endif /* CPQARRAY_H */
133