Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
hptiop.h
Go to the documentation of this file.
1 /*
2  * HighPoint RR3xxx/4xxx controller driver for Linux
3  * Copyright (C) 2006-2009 HighPoint Technologies, Inc. All Rights Reserved.
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; version 2 of the License.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * Please report bugs/comments/suggestions to [email protected]
15  *
16  * For more information, visit http://www.highpoint-tech.com
17  */
18 #ifndef _HPTIOP_H_
19 #define _HPTIOP_H_
20 
21 struct hpt_iopmu_itl {
36 };
37 
38 #define IOPMU_QUEUE_EMPTY 0xffffffff
39 #define IOPMU_QUEUE_MASK_HOST_BITS 0xf0000000
40 #define IOPMU_QUEUE_ADDR_HOST_BIT 0x80000000
41 #define IOPMU_QUEUE_REQUEST_SIZE_BIT 0x40000000
42 #define IOPMU_QUEUE_REQUEST_RESULT_BIT 0x40000000
43 
44 #define IOPMU_OUTBOUND_INT_MSG0 1
45 #define IOPMU_OUTBOUND_INT_MSG1 2
46 #define IOPMU_OUTBOUND_INT_DOORBELL 4
47 #define IOPMU_OUTBOUND_INT_POSTQUEUE 8
48 #define IOPMU_OUTBOUND_INT_PCI 0x10
49 
50 #define IOPMU_INBOUND_INT_MSG0 1
51 #define IOPMU_INBOUND_INT_MSG1 2
52 #define IOPMU_INBOUND_INT_DOORBELL 4
53 #define IOPMU_INBOUND_INT_ERROR 8
54 #define IOPMU_INBOUND_INT_POSTQUEUE 0x10
55 
56 #define MVIOP_QUEUE_LEN 512
57 
58 struct hpt_iopmu_mv {
68 };
69 
71  __le32 reserved[0x20400 / 4];
76 };
77 
78 #define MVIOP_MU_QUEUE_ADDR_HOST_MASK (~(0x1full))
79 #define MVIOP_MU_QUEUE_ADDR_HOST_BIT 4
80 
81 #define MVIOP_MU_QUEUE_ADDR_IOP_HIGH32 0xffffffff
82 #define MVIOP_MU_QUEUE_REQUEST_RESULT_BIT 1
83 #define MVIOP_MU_QUEUE_REQUEST_RETURN_CONTEXT 2
84 
85 #define MVIOP_MU_INBOUND_INT_MSG 1
86 #define MVIOP_MU_INBOUND_INT_POSTQUEUE 2
87 #define MVIOP_MU_OUTBOUND_INT_MSG 1
88 #define MVIOP_MU_OUTBOUND_INT_POSTQUEUE 2
89 
91  /* host-to-iop messages */
99  /* iop-to-host messages */
106 };
107 
113  __le32 context; /* host context */
115 };
116 
117 #define IOP_REQUEST_FLAG_SYNC_REQUEST 1
118 #define IOP_REQUEST_FLAG_BIST_REQUEST 2
119 #define IOP_REQUEST_FLAG_REMAPPED 4
120 #define IOP_REQUEST_FLAG_OUTPUT_CONTEXT 8
121 
129 };
130 
140 };
141 
153 };
154 
161 };
162 
163 struct hpt_iopsg {
165  __le32 eot; /* non-zero: end of table */
167 };
168 
175  __le16 command; /* IOP_BLOCK_COMMAND_{READ,WRITE} */
178  struct hpt_iopsg sg_list[1];
179 };
180 
181 #define IOP_BLOCK_COMMAND_READ 1
182 #define IOP_BLOCK_COMMAND_WRITE 2
183 #define IOP_BLOCK_COMMAND_VERIFY 3
184 #define IOP_BLOCK_COMMAND_FLUSH 4
185 #define IOP_BLOCK_COMMAND_SHUTDOWN 5
186 
193  u8 cdb[16];
195  struct hpt_iopsg sg_list[1];
196 };
197 
204  u8 buf[1];
205  /* out data should be put at buf[(inbuf_size+3)&~3] */
206 };
207 
208 #define HPTIOP_MAX_REQUESTS 256u
209 
212  void *req_virt;
214  struct scsi_cmnd *scp;
215  int index;
216 };
217 
219  int mapped;
220  int sgcnt;
222 };
223 
224 #define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp)
225 
226 struct hptiop_hba {
228  union {
229  struct {
231  void __iomem *plx;
232  } itl;
233  struct {
238  } mv;
239  } u;
240 
241  struct Scsi_Host *host;
242  struct pci_dev *pcidev;
243 
244  /* IOP config info */
252 
253  u32 req_size; /* host-allocated request buffer size */
254 
258 
261 
262  /* used to free allocated dma area */
265 
268 
271 };
272 
273 struct hpt_ioctl_k {
274  struct hptiop_hba * hba;
278  void *inbuf;
279  void *outbuf;
281  void (*done)(struct hpt_ioctl_k *);
282  int result; /* HPT_IOCTL_RESULT_ */
283 };
284 
286  int (*iop_wait_ready)(struct hptiop_hba *hba, u32 millisec);
288  int (*internal_memfree)(struct hptiop_hba *hba);
289  int (*map_pci_bar)(struct hptiop_hba *hba);
290  void (*unmap_pci_bar)(struct hptiop_hba *hba);
291  void (*enable_intr)(struct hptiop_hba *hba);
292  void (*disable_intr)(struct hptiop_hba *hba);
293  int (*get_config)(struct hptiop_hba *hba,
295  int (*set_config)(struct hptiop_hba *hba,
297  int (*iop_intr)(struct hptiop_hba *hba);
298  void (*post_msg)(struct hptiop_hba *hba, u32 msg);
299  void (*post_req)(struct hptiop_hba *hba, struct hptiop_request *_req);
301 };
302 
303 #define HPT_IOCTL_RESULT_OK 0
304 #define HPT_IOCTL_RESULT_FAILED (-1)
305 
306 #if 0
307 #define dprintk(fmt, args...) do { printk(fmt, ##args); } while(0)
308 #else
309 #define dprintk(fmt, args...)
310 #endif
311 
312 #endif