Commit b2aaee33 authored by Markus Lidel's avatar Markus Lidel Committed by Linus Torvalds

[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: default avatarMarkus Lidel <Markus.Lidel@shadowconnect.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent f10378ff
...@@ -24,6 +24,24 @@ config I2O ...@@ -24,6 +24,24 @@ config I2O
If unsure, say N. If unsure, say N.
config I2O_EXT_ADAPTEC
bool "Enable Adaptec extensions"
depends on I2O
default y
---help---
Say Y for support of raidutils for Adaptec I2O controllers. You also
have to say Y to "I2O Configuration support", "I2O SCSI OSM" below
and to "SCSI generic support" under "SCSI device configuration".
config I2O_EXT_ADAPTEC_DMA64
bool "Enable 64-bit DMA"
depends on I2O_EXT_ADAPTEC && ( 64BIT || HIGHMEM64G )
default y
---help---
Say Y for support of 64-bit DMA transfer mode on Adaptec I2O
controllers.
Note: You need at least firmware version 3709.
config I2O_CONFIG config I2O_CONFIG
tristate "I2O Configuration support" tristate "I2O Configuration support"
depends on PCI && I2O depends on PCI && I2O
......
...@@ -56,6 +56,12 @@ ...@@ -56,6 +56,12 @@
#define I2O_BLOCK_RETRY_TIME HZ/4 #define I2O_BLOCK_RETRY_TIME HZ/4
#define I2O_BLOCK_MAX_OPEN_REQUESTS 50 #define I2O_BLOCK_MAX_OPEN_REQUESTS 50
/* request queue sizes */
#define I2O_BLOCK_REQ_MEMPOOL_SIZE 32
#define KERNEL_SECTOR_SHIFT 9
#define KERNEL_SECTOR_SIZE (1 << KERNEL_SECTOR_SHIFT)
/* I2O Block OSM mempool struct */ /* I2O Block OSM mempool struct */
struct i2o_block_mempool { struct i2o_block_mempool {
kmem_cache_t *slab; kmem_cache_t *slab;
......
...@@ -515,6 +515,7 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp) ...@@ -515,6 +515,7 @@ static int i2o_cfg_evt_get(unsigned long arg, struct file *fp)
return 0; return 0;
} }
#ifdef CONFIG_I2O_EXT_ADAPTEC
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long arg) static int i2o_cfg_passthru32(struct file *file, unsigned cmnd, unsigned long arg)
{ {
...@@ -964,6 +965,7 @@ static int i2o_cfg_passthru(unsigned long arg) ...@@ -964,6 +965,7 @@ static int i2o_cfg_passthru(unsigned long arg)
kfree(reply); kfree(reply);
return rcode; return rcode;
} }
#endif
/* /*
* IOCTL Handler * IOCTL Handler
...@@ -1018,9 +1020,11 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd, ...@@ -1018,9 +1020,11 @@ static int i2o_cfg_ioctl(struct inode *inode, struct file *fp, unsigned int cmd,
ret = i2o_cfg_evt_get(arg, fp); ret = i2o_cfg_evt_get(arg, fp);
break; break;
#ifdef CONFIG_I2O_EXT_ADAPTEC
case I2OPASSTHRU: case I2OPASSTHRU:
ret = i2o_cfg_passthru(arg); ret = i2o_cfg_passthru(arg);
break; break;
#endif
default: default:
osm_debug("unknown ioctl called!\n"); osm_debug("unknown ioctl called!\n");
......
This diff is collapsed.
...@@ -362,11 +362,33 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev, ...@@ -362,11 +362,33 @@ static int __devinit i2o_pci_probe(struct pci_dev *pdev,
c->promise = 1; c->promise = 1;
} }
if (pdev->subsystem_vendor == PCI_VENDOR_ID_DPT)
c->adaptec = 1;
/* Cards that go bananas if you quiesce them before you reset them. */ /* Cards that go bananas if you quiesce them before you reset them. */
if (pdev->vendor == PCI_VENDOR_ID_DPT) { if (pdev->vendor == PCI_VENDOR_ID_DPT) {
c->no_quiesce = 1; c->no_quiesce = 1;
if (pdev->device == 0xa511) if (pdev->device == 0xa511)
c->raptor = 1; c->raptor = 1;
if (pdev->subsystem_device == 0xc05a) {
c->limit_sectors = 1;
printk(KERN_INFO
"%s: limit sectors per request to %d\n", c->name,
I2O_MAX_SECTORS_LIMITED);
}
#ifdef CONFIG_I2O_EXT_ADAPTEC_DMA64
if (sizeof(dma_addr_t) > 4) {
if (pci_set_dma_mask(pdev, DMA_64BIT_MASK))
printk(KERN_INFO "%s: 64-bit DMA unavailable\n",
c->name);
else {
c->pae_support = 1;
printk(KERN_INFO "%s: using 64-bit DMA\n",
c->name);
}
}
#endif
} }
if ((rc = i2o_pci_alloc(c))) { if ((rc = i2o_pci_alloc(c))) {
......
...@@ -32,6 +32,13 @@ typedef unsigned int u32; ...@@ -32,6 +32,13 @@ typedef unsigned int u32;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
/*
* Software module types
*/
#define I2O_SOFTWARE_MODULE_IRTOS 0x11
#define I2O_SOFTWARE_MODULE_IOP_PRIVATE 0x22
#define I2O_SOFTWARE_MODULE_IOP_CONFIG 0x23
/* /*
* Vendors * Vendors
*/ */
...@@ -125,6 +132,10 @@ struct i2o_evt_get { ...@@ -125,6 +132,10 @@ struct i2o_evt_get {
int lost; int lost;
}; };
typedef struct i2o_sg_io_hdr {
unsigned int flags; /* see I2O_DPT_SG_IO_FLAGS */
} i2o_sg_io_hdr_t;
/************************************************************************** /**************************************************************************
* HRT related constants and structures * HRT related constants and structures
**************************************************************************/ **************************************************************************/
...@@ -403,4 +414,15 @@ typedef struct _i2o_status_block { ...@@ -403,4 +414,15 @@ typedef struct _i2o_status_block {
#define ADAPTER_STATE_FAILED 0x10 #define ADAPTER_STATE_FAILED 0x10
#define ADAPTER_STATE_FAULTED 0x11 #define ADAPTER_STATE_FAULTED 0x11
/*
* DPT / Adaptec specific values for i2o_sg_io_hdr flags.
*/
#define I2O_DPT_SG_FLAG_INTERPRET 0x00010000
#define I2O_DPT_SG_FLAG_PHYSICAL 0x00020000
#define I2O_DPT_FLASH_FRAG_SIZE 0x10000
#define I2O_DPT_FLASH_READ 0x0101
#define I2O_DPT_FLASH_WRITE 0x0102
#endif /* _I2O_DEV_H */ #endif /* _I2O_DEV_H */
...@@ -147,10 +147,13 @@ struct i2o_controller { ...@@ -147,10 +147,13 @@ struct i2o_controller {
struct pci_dev *pdev; /* PCI device */ struct pci_dev *pdev; /* PCI device */
unsigned int short_req:1; /* use small block sizes */
unsigned int no_quiesce:1; /* dont quiesce before reset */
unsigned int raptor:1; /* split bar */
unsigned int promise:1; /* Promise controller */ unsigned int promise:1; /* Promise controller */
unsigned int adaptec:1; /* DPT / Adaptec controller */
unsigned int raptor:1; /* split bar */
unsigned int no_quiesce:1; /* dont quiesce before reset */
unsigned int short_req:1; /* use small block sizes */
unsigned int limit_sectors:1; /* limit number of sectors / request */
unsigned int pae_support:1; /* controller has 64-bit SGL support */
struct list_head devices; /* list of I2O devices */ struct list_head devices; /* list of I2O devices */
struct list_head list; /* Controller list */ struct list_head list; /* Controller list */
...@@ -746,7 +749,21 @@ static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controll ...@@ -746,7 +749,21 @@ static inline struct i2o_message __iomem *i2o_msg_in_to_virt(struct i2o_controll
static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr, static inline int i2o_dma_alloc(struct device *dev, struct i2o_dma *addr,
size_t len, unsigned int gfp_mask) size_t len, unsigned int gfp_mask)
{ {
struct pci_dev *pdev = to_pci_dev(dev);
int dma_64 = 0;
if ((sizeof(dma_addr_t) > 4) && (pdev->dma_mask == DMA_64BIT_MASK)) {
dma_64 = 1;
if(pci_set_dma_mask(pdev, DMA_32BIT_MASK))
return -ENOMEM;
}
addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask); addr->virt = dma_alloc_coherent(dev, len, &addr->phys, gfp_mask);
if ((sizeof(dma_addr_t) > 4) && dma_64)
if(pci_set_dma_mask(pdev, DMA_64BIT_MASK))
printk(KERN_WARNING "i2o: unable to set 64-bit DMA");
if (!addr->virt) if (!addr->virt)
return -ENOMEM; return -ENOMEM;
...@@ -946,7 +963,7 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -946,7 +963,7 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define I2O_CMD_BLOCK_MEJECT 0x43 #define I2O_CMD_BLOCK_MEJECT 0x43
#define I2O_CMD_BLOCK_POWER 0x70 #define I2O_CMD_BLOCK_POWER 0x70
#define I2O_PRIVATE_MSG 0xFF #define I2O_CMD_PRIVATE 0xFF
/* Command status values */ /* Command status values */
...@@ -1095,9 +1112,9 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -1095,9 +1112,9 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define SGL_OFFSET_8 (0x0080 | I2OVERSION) #define SGL_OFFSET_8 (0x0080 | I2OVERSION)
#define SGL_OFFSET_9 (0x0090 | I2OVERSION) #define SGL_OFFSET_9 (0x0090 | I2OVERSION)
#define SGL_OFFSET_10 (0x00A0 | I2OVERSION) #define SGL_OFFSET_10 (0x00A0 | I2OVERSION)
#define SGL_OFFSET_11 (0x00B0 | I2OVERSION)
#define TRL_OFFSET_5 (0x0050 | I2OVERSION) #define SGL_OFFSET_12 (0x00C0 | I2OVERSION)
#define TRL_OFFSET_6 (0x0060 | I2OVERSION) #define SGL_OFFSET(x) (((x)<<4) | I2OVERSION)
/* Transaction Reply Lists (TRL) Control Word structure */ /* Transaction Reply Lists (TRL) Control Word structure */
#define TRL_SINGLE_FIXED_LENGTH 0x00 #define TRL_SINGLE_FIXED_LENGTH 0x00
...@@ -1130,7 +1147,6 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -1130,7 +1147,6 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define HOST_TID 1 #define HOST_TID 1
#define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */ #define MSG_FRAME_SIZE 128 /* i2o_scsi assumes >= 32 */
#define REPLY_FRAME_SIZE 17
#define SG_TABLESIZE 30 #define SG_TABLESIZE 30
#define NMBR_MSG_FRAMES 128 #define NMBR_MSG_FRAMES 128
...@@ -1155,11 +1171,10 @@ extern void i2o_debug_state(struct i2o_controller *c); ...@@ -1155,11 +1171,10 @@ extern void i2o_debug_state(struct i2o_controller *c);
#define I2O_HRT_GET_TRIES 3 #define I2O_HRT_GET_TRIES 3
#define I2O_LCT_GET_TRIES 3 #define I2O_LCT_GET_TRIES 3
/* request queue sizes */ /* defines for max_sectors and max_phys_segments */
#define I2O_MAX_SECTORS 1024 #define I2O_MAX_SECTORS 1024
#define I2O_MAX_SECTORS_LIMITED 256
#define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS #define I2O_MAX_PHYS_SEGMENTS MAX_PHYS_SEGMENTS
#define I2O_REQ_MEMPOOL_SIZE 32
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
#endif /* _I2O_H */ #endif /* _I2O_H */
typedef struct scsi_request Scsi_Request;
static Scsi_Request *dummy_cmdp; /* only used for sizeof */
typedef struct sg_scatter_hold { /* holding area for scsi scatter gather info */
unsigned short k_use_sg; /* Count of kernel scatter-gather pieces */
unsigned short sglist_len; /* size of malloc'd scatter-gather list ++ */
unsigned bufflen; /* Size of (aggregate) data buffer */
unsigned b_malloc_len; /* actual len malloc'ed in buffer */
void *buffer; /* Data buffer or scatter list (k_use_sg>0) */
char dio_in_use; /* 0->indirect IO (or mmap), 1->dio */
unsigned char cmd_opcode; /* first byte of command */
} Sg_scatter_hold;
typedef struct sg_request { /* SG_MAX_QUEUE requests outstanding per file */
Scsi_Request *my_cmdp; /* != 0 when request with lower levels */
struct sg_request *nextrp; /* NULL -> tail request (slist) */
struct sg_fd *parentfp; /* NULL -> not in use */
Sg_scatter_hold data; /* hold buffer, perhaps scatter list */
sg_io_hdr_t header; /* scsi command+info, see <scsi/sg.h> */
unsigned char sense_b[sizeof (dummy_cmdp->sr_sense_buffer)];
char res_used; /* 1 -> using reserve buffer, 0 -> not ... */
char orphan; /* 1 -> drop on sight, 0 -> normal */
char sg_io_owned; /* 1 -> packet belongs to SG_IO */
volatile char done; /* 0->before bh, 1->before read, 2->read */
} Sg_request;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment