aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMarkus Lidel <Markus.Lidel@shadowconnect.com>2005-06-24 01:02:19 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-24 03:05:28 -0400
commitb2aaee33fbb354a2f08121aa1c1be55841102761 (patch)
tree7567ca61aaf5eed8bb1acd01cd87aa235b854fd4 /include
parentf10378fff658f61307496e0ae00095041725cf07 (diff)
[PATCH] I2O: Adaptec specific SG_IO access, firmware access through sysfs and 2400A workaround
Changes: - Provide SG_IO access to BLOCK and EXECUTIVE class on Adaptec controllers - Use PRIVATE messages in SCSI-OSM because on some controllers normal SCSI class commands like READ or READ CAPACITY cause errors - Use new DMA and SG list creation function - Added workaround to limit sectors per request for Adaptec 2400A controllers Signed-off-by: Markus Lidel <Markus.Lidel@shadowconnect.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/i2o-dev.h22
-rw-r--r--include/linux/i2o.h37
-rw-r--r--include/scsi/sg_request.h26
3 files changed, 74 insertions, 11 deletions
diff --git a/include/linux/i2o-dev.h b/include/linux/i2o-dev.h
index 90c984ecd521..d4a08d29e36d 100644
--- a/include/linux/i2o-dev.h
+++ b/include/linux/i2o-dev.h
@@ -33,6 +33,13 @@ typedef unsigned int u32;
33#endif /* __KERNEL__ */ 33#endif /* __KERNEL__ */
34 34
35/* 35/*
36 * Software module types
37 */
38#define I2O_SOFTWARE_MODULE_IRTOS 0x11
39#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22
40#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23
41
42/*
36 * Vendors 43 * Vendors
37 */ 44 */
38#define I2O_VENDOR_DPT 0x001b 45#define I2O_VENDOR_DPT 0x001b
@@ -125,6 +132,10 @@ struct i2o_evt_get {
125 int lost; 132 int lost;
126}; 133};
127 134
135typedef struct i2o_sg_io_hdr {
136 unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */
137} i2o_sg_io_hdr_t;
138
128/************************************************************************** 139/**************************************************************************
129 * HRT related constants and structures 140 * HRT related constants and structures
130 **************************************************************************/ 141 **************************************************************************/
@@ -403,4 +414,15 @@ typedef struct _i2o_status_block {
403#define ADAPTER_STATE_FAILED 0x10 414#define ADAPTER_STATE_FAILED 0x10
404#define ADAPTER_STATE_FAULTED 0x11 415#define ADAPTER_STATE_FAULTED 0x11
405 416
417
418/*
419 * DPT / Adaptec specific values for i2o_sg_io_hdr flags.
420 */
421#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000
422#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000
423
424#define I2O_DPT_FLASH_FRAG_SIZE 0x10000
425#define I2O_DPT_FLASH_READ 0x0101
426#define I2O_DPT_FLASH_WRITE 0x0102
427
406#endif /* _I2O_DEV_H */ 428#endif /* _I2O_DEV_H */
diff --git a/include/linux/i2o.h b/include/linux/i2o.h
index 497ea574f96b..2039a87c2b91 100644
--- a/include/linux/i2o.h
+++ b/include/linux/i2o.h
@@ -147,10 +147,13 @@ struct i2o_controller {
147 147
148 struct pci_dev *pdev; /* PCI device */ 148 struct pci_dev *pdev; /* PCI device */
149 149
150 unsigned int short_req:1; /* use small block sizes */
151 unsigned int no_quiesce:1; /* dont quiesce before reset */
152 unsigned int raptor:1; /* split bar */
153 unsigned int promise:1; /* Promise controller */ 150 unsigned int promise:1; /* Promise controller */
151 unsigned int adaptec:1; /* DPT / Adaptec controller */
152 unsigned int raptor:1; /* split bar */
153 unsigned int no_quiesce:1; /* dont quiesce before reset */
154 unsigned int short_req:1; /* use small block sizes */
155 unsigned int limit_sectors:1; /* limit number of sectors / request */
156 unsigned int pae_support:1; /* controller has 64-bit SGL support */
154 157
155 struct list_head devices; /* list of I2O devices */ 158 struct list_head devices; /* list of I2O devices */
156 struct list_head list; /* Controller list */ 159 struct list_head list; /* Controller list */
@@ -746,7 +749,21 @@ static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controll
746static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, 749static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
747 size_t len, unsigned int gfp_mask) 750 size_t len, unsigned int gfp_mask)
748{ 751{
752 struct pci_dev *pdev = to_pci_dev(dev);
753 int dma_64 = 0;
754
755 if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
756 dma_64 = 1;
757 if(pci_set_dma_mask(pdev, DMA_32BIT_MASK))
758 return -ENOMEM;
759 }
760
749 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); 761 addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
762
763 if ((sizeof(dma_addr_t) > 4) && dma_64)
764 if(pci_set_dma_mask(pdev, DMA_64BIT_MASK))
765 printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
766
750 if (!addr->virt) 767 if (!addr->virt)
751 return -ENOMEM; 768 return -ENOMEM;
752 769
@@ -946,7 +963,7 @@ extern void i2o_debug_state(struct i2o_controller *c);
946#define I2O_CMD_BLOCK_MEJECT 0x43 963#define I2O_CMD_BLOCK_MEJECT 0x43
947#define I2O_CMD_BLOCK_POWER 0x70 964#define I2O_CMD_BLOCK_POWER 0x70
948 965
949#define I2O_PRIVATE_MSG 0xFF 966#define I2O_CMD_PRIVATE 0xFF
950 967
951/* Command status values */ 968/* Command status values */
952 969
@@ -1095,9 +1112,9 @@ extern void i2o_debug_state(struct i2o_controller *c);
1095#define SGL_OFFSET_8 (0x0080 | I2OVERSION) 1112#define SGL_OFFSET_8 (0x0080 | I2OVERSION)
1096#define SGL_OFFSET_9 (0x0090 | I2OVERSION) 1113#define SGL_OFFSET_9 (0x0090 | I2OVERSION)
1097#define SGL_OFFSET_10 (0x00A0 | I2OVERSION) 1114#define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
1098 1115#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
1099#define TRL_OFFSET_5 (0x0050 | I2OVERSION) 1116#define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
1100#define TRL_OFFSET_6 (0x0060 | I2OVERSION) 1117#define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
1101 1118
1102/* Transaction Reply Lists (TRL) Control Word structure */ 1119/* Transaction Reply Lists (TRL) Control Word structure */
1103#define TRL_SINGLE_FIXED_LENGTH 0x00 1120#define TRL_SINGLE_FIXED_LENGTH 0x00
@@ -1130,7 +1147,6 @@ extern void i2o_debug_state(struct i2o_controller *c);
1130#define HOST_TID 1 1147#define HOST_TID 1
1131 1148
1132#define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */ 1149#define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */
1133#define REPLY_FRAME_SIZE 17
1134#define SG_TABLESIZE 30 1150#define SG_TABLESIZE 30
1135#define NMBR_MSG_FRAMES 128 1151#define NMBR_MSG_FRAMES 128
1136 1152
@@ -1155,11 +1171,10 @@ extern void i2o_debug_state(struct i2o_controller *c);
1155#define I2O_HRT_GET_TRIES 3 1171#define I2O_HRT_GET_TRIES 3
1156#define I2O_LCT_GET_TRIES 3 1172#define I2O_LCT_GET_TRIES 3
1157 1173
1158/* request queue sizes */ 1174/* defines for max_sectors and max_phys_segments */
1159#define I2O_MAX_SECTORS 1024 1175#define I2O_MAX_SECTORS 1024
1176#define I2O_MAX_SECTORS_LIMITED 256
1160#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS 1177#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
1161 1178
1162#define I2O_REQ_MEMPOOL_SIZE 32
1163
1164#endif /* __KERNEL__ */ 1179#endif /* __KERNEL__ */
1165#endif /* _I2O_H */ 1180#endif /* _I2O_H */
diff --git a/include/scsi/sg_request.h b/include/scsi/sg_request.h
new file mode 100644
index 000000000000..57ff525bdd3b
--- /dev/null
+++ b/include/scsi/sg_request.h
@@ -0,0 +1,26 @@
1typedef struct scsi_request Scsi_Request;
2
3static Scsi_Request *dummy_cmdp; /* only used for sizeof */
4
5typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
6 unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */
7 unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */
8 unsigned bufflen; /* Size of (aggregate) data buffer */
9 unsigned b_malloc_len; /* actual len malloc'ed in buffer */
10 void *buffer; /* Data buffer or scatter list (k_use_sg>0) */
11 char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */
12 unsigned char cmd_opcode; /* first byte of command */
13} Sg_scatter_hold;
14
15typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */
16 Scsi_Request *my_cmdp; /* != 0 when request with lower levels */
17 struct sg_request *nextrp; /* NULL -> tail request (slist) */
18 struct sg_fd *parentfp; /* NULL -> not in use */
19 Sg_scatter_hold data; /* hold buffer, perhaps scatter list */
20 sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */
21 unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)];
22 char res_used; /* 1 -> using reserve buffer, 0 -> not ... */
23 char orphan; /* 1 -> drop on sight, 0 -> normal */
24 char sg_io_owned; /* 1 -> packet belongs to SG_IO */
25 volatile char done; /* 0->before bh, 1->before read, 2->read */
26} Sg_request;