aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hptiop.h
diff options
context:
space:
mode:
authorHighPoint Linux Team <linux@highpoint-tech.com>2007-12-13 19:14:26 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 19:28:06 -0500
commit00f5970193e22c48f399a2430635d6416b51befe (patch)
treeccab0b0ba3e9c093e5edf16f2d23e9f979d2b6d4 /drivers/scsi/hptiop.h
parenta7ed0448e28ce6154390bf690b8b5c37853732dc (diff)
[SCSI] hptiop: add more adapter models and other fixes
Most code changes were made to support adapters based on Marvell IOP, plus some other fixes. - add more PCI device IDs - support for adapters based on Marvell IOP - fix a result code translation error on big-endian systems - fix resource releasing bug when scsi_host_alloc() fail in hptiop_probe() - update scsi_cmnd.resid when finishing a request - correct some coding style issues [akpm@linux-foundation.org: type fixes] Signed-off-by: HighPoint Linux Team <linux@highpoint-tech.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/hptiop.h')
-rw-r--r--drivers/scsi/hptiop.h124
1 files changed, 89 insertions, 35 deletions
diff --git a/drivers/scsi/hptiop.h b/drivers/scsi/hptiop.h
index 2a5e46e001cb..a0289f219752 100644
--- a/drivers/scsi/hptiop.h
+++ b/drivers/scsi/hptiop.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * HighPoint RR3xxx controller driver for Linux 2 * HighPoint RR3xxx/4xxx controller driver for Linux
3 * Copyright (C) 2006-2007 HighPoint Technologies, Inc. All Rights Reserved. 3 * Copyright (C) 2006-2007 HighPoint Technologies, Inc. All Rights Reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
@@ -18,8 +18,7 @@
18#ifndef _HPTIOP_H_ 18#ifndef _HPTIOP_H_
19#define _HPTIOP_H_ 19#define _HPTIOP_H_
20 20
21struct hpt_iopmu 21struct hpt_iopmu_itl {
22{
23 __le32 resrved0[4]; 22 __le32 resrved0[4];
24 __le32 inbound_msgaddr0; 23 __le32 inbound_msgaddr0;
25 __le32 inbound_msgaddr1; 24 __le32 inbound_msgaddr1;
@@ -54,6 +53,40 @@ struct hpt_iopmu
54#define IOPMU_INBOUND_INT_ERROR 8 53#define IOPMU_INBOUND_INT_ERROR 8
55#define IOPMU_INBOUND_INT_POSTQUEUE 0x10 54#define IOPMU_INBOUND_INT_POSTQUEUE 0x10
56 55
56#define MVIOP_QUEUE_LEN 512
57
58struct hpt_iopmu_mv {
59 __le32 inbound_head;
60 __le32 inbound_tail;
61 __le32 outbound_head;
62 __le32 outbound_tail;
63 __le32 inbound_msg;
64 __le32 outbound_msg;
65 __le32 reserve[10];
66 __le64 inbound_q[MVIOP_QUEUE_LEN];
67 __le64 outbound_q[MVIOP_QUEUE_LEN];
68};
69
70struct hpt_iopmv_regs {
71 __le32 reserved[0x20400 / 4];
72 __le32 inbound_doorbell;
73 __le32 inbound_intmask;
74 __le32 outbound_doorbell;
75 __le32 outbound_intmask;
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
57enum hpt_iopmu_message { 90enum hpt_iopmu_message {
58 /* host-to-iop messages */ 91 /* host-to-iop messages */
59 IOPMU_INBOUND_MSG0_NOP = 0, 92 IOPMU_INBOUND_MSG0_NOP = 0,
@@ -72,8 +105,7 @@ enum hpt_iopmu_message {
72 IOPMU_OUTBOUND_MSG0_REVALIDATE_DEVICE_MAX = 0x3ff, 105 IOPMU_OUTBOUND_MSG0_REVALIDATE_DEVICE_MAX = 0x3ff,
73}; 106};
74 107
75struct hpt_iop_request_header 108struct hpt_iop_request_header {
76{
77 __le32 size; 109 __le32 size;
78 __le32 type; 110 __le32 type;
79 __le32 flags; 111 __le32 flags;
@@ -104,11 +136,10 @@ enum hpt_iop_result_type {
104 IOP_RESULT_RESET, 136 IOP_RESULT_RESET,
105 IOP_RESULT_INVALID_REQUEST, 137 IOP_RESULT_INVALID_REQUEST,
106 IOP_RESULT_BAD_TARGET, 138 IOP_RESULT_BAD_TARGET,
107 IOP_RESULT_MODE_SENSE_CHECK_CONDITION, 139 IOP_RESULT_CHECK_CONDITION,
108}; 140};
109 141
110struct hpt_iop_request_get_config 142struct hpt_iop_request_get_config {
111{
112 struct hpt_iop_request_header header; 143 struct hpt_iop_request_header header;
113 __le32 interface_version; 144 __le32 interface_version;
114 __le32 firmware_version; 145 __le32 firmware_version;
@@ -121,8 +152,7 @@ struct hpt_iop_request_get_config
121 __le32 sdram_size; 152 __le32 sdram_size;
122}; 153};
123 154
124struct hpt_iop_request_set_config 155struct hpt_iop_request_set_config {
125{
126 struct hpt_iop_request_header header; 156 struct hpt_iop_request_header header;
127 __le32 iop_id; 157 __le32 iop_id;
128 __le16 vbus_id; 158 __le16 vbus_id;
@@ -130,15 +160,13 @@ struct hpt_iop_request_set_config
130 __le32 reserve[6]; 160 __le32 reserve[6];
131}; 161};
132 162
133struct hpt_iopsg 163struct hpt_iopsg {
134{
135 __le32 size; 164 __le32 size;
136 __le32 eot; /* non-zero: end of table */ 165 __le32 eot; /* non-zero: end of table */
137 __le64 pci_address; 166 __le64 pci_address;
138}; 167};
139 168
140struct hpt_iop_request_block_command 169struct hpt_iop_request_block_command {
141{
142 struct hpt_iop_request_header header; 170 struct hpt_iop_request_header header;
143 u8 channel; 171 u8 channel;
144 u8 target; 172 u8 target;
@@ -156,8 +184,7 @@ struct hpt_iop_request_block_command
156#define IOP_BLOCK_COMMAND_FLUSH 4 184#define IOP_BLOCK_COMMAND_FLUSH 4
157#define IOP_BLOCK_COMMAND_SHUTDOWN 5 185#define IOP_BLOCK_COMMAND_SHUTDOWN 5
158 186
159struct hpt_iop_request_scsi_command 187struct hpt_iop_request_scsi_command {
160{
161 struct hpt_iop_request_header header; 188 struct hpt_iop_request_header header;
162 u8 channel; 189 u8 channel;
163 u8 target; 190 u8 target;
@@ -168,8 +195,7 @@ struct hpt_iop_request_scsi_command
168 struct hpt_iopsg sg_list[1]; 195 struct hpt_iopsg sg_list[1];
169}; 196};
170 197
171struct hpt_iop_request_ioctl_command 198struct hpt_iop_request_ioctl_command {
172{
173 struct hpt_iop_request_header header; 199 struct hpt_iop_request_header header;
174 __le32 ioctl_code; 200 __le32 ioctl_code;
175 __le32 inbuf_size; 201 __le32 inbuf_size;
@@ -182,11 +208,11 @@ struct hpt_iop_request_ioctl_command
182#define HPTIOP_MAX_REQUESTS 256u 208#define HPTIOP_MAX_REQUESTS 256u
183 209
184struct hptiop_request { 210struct hptiop_request {
185 struct hptiop_request * next; 211 struct hptiop_request *next;
186 void * req_virt; 212 void *req_virt;
187 u32 req_shifted_phy; 213 u32 req_shifted_phy;
188 struct scsi_cmnd * scp; 214 struct scsi_cmnd *scp;
189 int index; 215 int index;
190}; 216};
191 217
192struct hpt_scsi_pointer { 218struct hpt_scsi_pointer {
@@ -198,9 +224,21 @@ struct hpt_scsi_pointer {
198#define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp) 224#define HPT_SCP(scp) ((struct hpt_scsi_pointer *)&(scp)->SCp)
199 225
200struct hptiop_hba { 226struct hptiop_hba {
201 struct hpt_iopmu __iomem * iop; 227 struct hptiop_adapter_ops *ops;
202 struct Scsi_Host * host; 228 union {
203 struct pci_dev * pcidev; 229 struct {
230 struct hpt_iopmu_itl __iomem *iop;
231 } itl;
232 struct {
233 struct hpt_iopmv_regs *regs;
234 struct hpt_iopmu_mv __iomem *mu;
235 void *internal_req;
236 dma_addr_t internal_req_phy;
237 } mv;
238 } u;
239
240 struct Scsi_Host *host;
241 struct pci_dev *pcidev;
204 242
205 /* IOP config info */ 243 /* IOP config info */
206 u32 interface_version; 244 u32 interface_version;
@@ -213,15 +251,15 @@ struct hptiop_hba {
213 251
214 u32 req_size; /* host-allocated request buffer size */ 252 u32 req_size; /* host-allocated request buffer size */
215 253
216 int iopintf_v2: 1; 254 u32 iopintf_v2: 1;
217 int initialized: 1; 255 u32 initialized: 1;
218 int msg_done: 1; 256 u32 msg_done: 1;
219 257
220 struct hptiop_request * req_list; 258 struct hptiop_request * req_list;
221 struct hptiop_request reqs[HPTIOP_MAX_REQUESTS]; 259 struct hptiop_request reqs[HPTIOP_MAX_REQUESTS];
222 260
223 /* used to free allocated dma area */ 261 /* used to free allocated dma area */
224 void * dma_coherent; 262 void *dma_coherent;
225 dma_addr_t dma_coherent_handle; 263 dma_addr_t dma_coherent_handle;
226 264
227 atomic_t reset_count; 265 atomic_t reset_count;
@@ -231,19 +269,35 @@ struct hptiop_hba {
231 wait_queue_head_t ioctl_wq; 269 wait_queue_head_t ioctl_wq;
232}; 270};
233 271
234struct hpt_ioctl_k 272struct hpt_ioctl_k {
235{
236 struct hptiop_hba * hba; 273 struct hptiop_hba * hba;
237 u32 ioctl_code; 274 u32 ioctl_code;
238 u32 inbuf_size; 275 u32 inbuf_size;
239 u32 outbuf_size; 276 u32 outbuf_size;
240 void * inbuf; 277 void *inbuf;
241 void * outbuf; 278 void *outbuf;
242 u32 * bytes_returned; 279 u32 *bytes_returned;
243 void (*done)(struct hpt_ioctl_k *); 280 void (*done)(struct hpt_ioctl_k *);
244 int result; /* HPT_IOCTL_RESULT_ */ 281 int result; /* HPT_IOCTL_RESULT_ */
245}; 282};
246 283
284struct hptiop_adapter_ops {
285 int (*iop_wait_ready)(struct hptiop_hba *hba, u32 millisec);
286 int (*internal_memalloc)(struct hptiop_hba *hba);
287 int (*internal_memfree)(struct hptiop_hba *hba);
288 int (*map_pci_bar)(struct hptiop_hba *hba);
289 void (*unmap_pci_bar)(struct hptiop_hba *hba);
290 void (*enable_intr)(struct hptiop_hba *hba);
291 void (*disable_intr)(struct hptiop_hba *hba);
292 int (*get_config)(struct hptiop_hba *hba,
293 struct hpt_iop_request_get_config *config);
294 int (*set_config)(struct hptiop_hba *hba,
295 struct hpt_iop_request_set_config *config);
296 int (*iop_intr)(struct hptiop_hba *hba);
297 void (*post_msg)(struct hptiop_hba *hba, u32 msg);
298 void (*post_req)(struct hptiop_hba *hba, struct hptiop_request *_req);
299};
300
247#define HPT_IOCTL_RESULT_OK 0 301#define HPT_IOCTL_RESULT_OK 0
248#define HPT_IOCTL_RESULT_FAILED (-1) 302#define HPT_IOCTL_RESULT_FAILED (-1)
249 303