Commit 5416edba authored by Andrew Morton's avatar Andrew Morton Committed by James Bottomley

[PATCH] megaraid 2.20.4.1 Driver

From: "Bagalkote, Sreenivas" <sreenib@lsil.com>

We are releasing megaraid 2.20.4.1 driver. This version fixes two issues -

- Handle IOCTL command timeouts properly

- Replace incorrectly introduced pci_dma_sync_{sg,single}_for_cpu with
  correct pci_dma_sync_{sg,single}_for_device.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 59859fb8
Release Date : Thu Nov 4 18:24:56 EST 2004 - Sreenivas Bagalkote <sreenib@lsil.com>
Current Version : 2.20.4.1 (scsi module), 2.20.2.2 (cmm module)
Older Version : 2.20.4.0 (scsi module), 2.20.2.1 (cmm module)
i. Handle IOCTL cmd timeouts more properly.
ii. pci_dma_sync_{sg,single}_for_cpu was introduced into megaraid_mbox
incorrectly (instead of _for_device). Changed to appropriate
pci_dma_sync_{sg,single}_for_device.
Release Date : Wed Oct 06 11:15:29 EDT 2004 - Sreenivas Bagalkote <sreenib@lsil.com> Release Date : Wed Oct 06 11:15:29 EDT 2004 - Sreenivas Bagalkote <sreenib@lsil.com>
Current Version : 2.20.4.0 (scsi module), 2.20.2.1 (cmm module) Current Version : 2.20.4.0 (scsi module), 2.20.2.1 (cmm module)
Older Version : 2.20.4.0 (scsi module), 2.20.2.0 (cmm module) Older Version : 2.20.4.0 (scsi module), 2.20.2.0 (cmm module)
......
...@@ -145,6 +145,8 @@ typedef struct uioc { ...@@ -145,6 +145,8 @@ typedef struct uioc {
uint8_t pool_index; uint8_t pool_index;
uint8_t free_buf; uint8_t free_buf;
uint8_t timedout;
} __attribute__ ((aligned(1024),packed)) uioc_t; } __attribute__ ((aligned(1024),packed)) uioc_t;
...@@ -247,6 +249,7 @@ typedef struct mm_dmapool { ...@@ -247,6 +249,7 @@ typedef struct mm_dmapool {
* @pdev : pci dev; used for allocating dma'ble memory * @pdev : pci dev; used for allocating dma'ble memory
* @issue_uioc : Driver supplied routine to issue uioc_t commands * @issue_uioc : Driver supplied routine to issue uioc_t commands
* : issue_uioc(drvr_data, kioc, ISSUE/ABORT, uioc_done) * : issue_uioc(drvr_data, kioc, ISSUE/ABORT, uioc_done)
* @quiescent : flag to indicate if ioctl can be issued to this adp
* @list : attach with the global list of adapters * @list : attach with the global list of adapters
* @kioc_list : block of mem for @max_kioc number of kiocs * @kioc_list : block of mem for @max_kioc number of kiocs
* @kioc_pool : pool of free kiocs * @kioc_pool : pool of free kiocs
...@@ -264,7 +267,7 @@ typedef struct mraid_mmadp { ...@@ -264,7 +267,7 @@ typedef struct mraid_mmadp {
uint32_t unique_id; uint32_t unique_id;
uint32_t drvr_type; uint32_t drvr_type;
unsigned long drvr_data; unsigned long drvr_data;
uint8_t timeout; uint16_t timeout;
uint8_t max_kioc; uint8_t max_kioc;
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -272,6 +275,7 @@ typedef struct mraid_mmadp { ...@@ -272,6 +275,7 @@ typedef struct mraid_mmadp {
int(*issue_uioc)(unsigned long, uioc_t *, uint32_t); int(*issue_uioc)(unsigned long, uioc_t *, uint32_t);
/* Maintained by common module */ /* Maintained by common module */
uint32_t quiescent;
struct list_head list; struct list_head list;
uioc_t *kioc_list; uioc_t *kioc_list;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
* FILE : megaraid_mbox.c * FILE : megaraid_mbox.c
* Version : v2.20.4 (September 27 2004) * Version : v2.20.4.1 (Nov 04 2004)
* *
* Authors: * Authors:
* Atul Mukker <Atul.Mukker@lsil.com> * Atul Mukker <Atul.Mukker@lsil.com>
...@@ -1559,12 +1559,12 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb) ...@@ -1559,12 +1559,12 @@ mbox_post_cmd(adapter_t *adapter, scb_t *scb)
if (scb->dma_direction == PCI_DMA_TODEVICE) { if (scb->dma_direction == PCI_DMA_TODEVICE) {
if (!scb->scp->use_sg) { // sg list not used if (!scb->scp->use_sg) { // sg list not used
pci_dma_sync_single_for_cpu(adapter->pdev, ccb->buf_dma_h, pci_dma_sync_single_for_device(adapter->pdev, ccb->buf_dma_h,
scb->scp->request_bufflen, scb->scp->request_bufflen,
PCI_DMA_TODEVICE); PCI_DMA_TODEVICE);
} }
else { else {
pci_dma_sync_sg_for_cpu(adapter->pdev, scb->scp->request_buffer, pci_dma_sync_sg_for_device(adapter->pdev, scb->scp->request_buffer,
scb->scp->use_sg, PCI_DMA_TODEVICE); scb->scp->use_sg, PCI_DMA_TODEVICE);
} }
} }
...@@ -3596,7 +3596,7 @@ megaraid_cmm_register(adapter_t *adapter) ...@@ -3596,7 +3596,7 @@ megaraid_cmm_register(adapter_t *adapter)
adp.drvr_data = (unsigned long)adapter; adp.drvr_data = (unsigned long)adapter;
adp.pdev = adapter->pdev; adp.pdev = adapter->pdev;
adp.issue_uioc = megaraid_mbox_mm_handler; adp.issue_uioc = megaraid_mbox_mm_handler;
adp.timeout = 30; adp.timeout = 300;
adp.max_kioc = MBOX_MAX_USER_CMDS; adp.max_kioc = MBOX_MAX_USER_CMDS;
if ((rval = mraid_mm_register_adp(&adp)) != 0) { if ((rval = mraid_mm_register_adp(&adp)) != 0) {
......
...@@ -21,8 +21,8 @@ ...@@ -21,8 +21,8 @@
#include "megaraid_ioctl.h" #include "megaraid_ioctl.h"
#define MEGARAID_VERSION "2.20.4.0" #define MEGARAID_VERSION "2.20.4.1"
#define MEGARAID_EXT_VERSION "(Release Date: Mon Sep 27 22:15:07 EDT 2004)" #define MEGARAID_EXT_VERSION "(Release Date: Thu Nov 4 17:44:59 EST 2004)"
/* /*
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
* *
* FILE : megaraid_mm.c * FILE : megaraid_mm.c
* Version : v2.20.2.1 (Oct 06 2004) * Version : v2.20.2.2 (Nov 04 2004)
* *
* Common management module * Common management module
*/ */
...@@ -155,6 +155,17 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, ...@@ -155,6 +155,17 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
return rval; return rval;
} }
/*
* Check if adapter can accept ioctl. We may have marked it offline
* if any previous kioc had timedout on this controller.
*/
if (!adp->quiescent) {
con_log(CL_ANN, (KERN_WARNING
"megaraid cmm: controller cannot accept cmds due to "
"earlier errors\n" ));
return -EFAULT;
}
/* /*
* The following call will block till a kioc is available * The following call will block till a kioc is available
*/ */
...@@ -171,10 +182,15 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd, ...@@ -171,10 +182,15 @@ mraid_mm_ioctl(struct inode *inode, struct file *filep, unsigned int cmd,
kioc->done = ioctl_done; kioc->done = ioctl_done;
/* /*
* Issue the IOCTL to the low level driver * Issue the IOCTL to the low level driver. After the IOCTL completes
* release the kioc if and only if it was _not_ timedout. If it was
* timedout, that means that resources are still with low level driver.
*/ */
if ((rval = lld_ioctl(adp, kioc))) { if ((rval = lld_ioctl(adp, kioc))) {
mraid_mm_dealloc_kioc(adp, kioc);
if (!kioc->timedout)
mraid_mm_dealloc_kioc(adp, kioc);
return rval; return rval;
} }
...@@ -581,6 +597,7 @@ mraid_mm_alloc_kioc(mraid_mmadp_t *adp) ...@@ -581,6 +597,7 @@ mraid_mm_alloc_kioc(mraid_mmadp_t *adp)
kioc->user_data = NULL; kioc->user_data = NULL;
kioc->user_data_len = 0; kioc->user_data_len = 0;
kioc->user_pthru = NULL; kioc->user_pthru = NULL;
kioc->timedout = 0;
return kioc; return kioc;
} }
...@@ -667,6 +684,14 @@ lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc) ...@@ -667,6 +684,14 @@ lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc)
del_timer_sync(tp); del_timer_sync(tp);
} }
/*
* If the command had timedout, we mark the controller offline
* before returning
*/
if (kioc->timedout) {
adp->quiescent = 0;
}
return kioc->status; return kioc->status;
} }
...@@ -679,6 +704,10 @@ lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc) ...@@ -679,6 +704,10 @@ lld_ioctl(mraid_mmadp_t *adp, uioc_t *kioc)
static void static void
ioctl_done(uioc_t *kioc) ioctl_done(uioc_t *kioc)
{ {
uint32_t adapno;
int iterator;
mraid_mmadp_t* adapter;
/* /*
* When the kioc returns from driver, make sure it still doesn't * When the kioc returns from driver, make sure it still doesn't
* have ENODATA in status. Otherwise, driver will hang on wait_event * have ENODATA in status. Otherwise, driver will hang on wait_event
...@@ -691,7 +720,32 @@ ioctl_done(uioc_t *kioc) ...@@ -691,7 +720,32 @@ ioctl_done(uioc_t *kioc)
kioc->status = -EINVAL; kioc->status = -EINVAL;
} }
wake_up(&wait_q); /*
* Check if this kioc was timedout before. If so, nobody is waiting
* on this kioc. We don't have to wake up anybody. Instead, we just
* have to free the kioc
*/
if (kioc->timedout) {
iterator = 0;
adapter = NULL;
adapno = kioc->adapno;
con_log(CL_ANN, ( KERN_WARNING "megaraid cmm: completed "
"ioctl that was timedout before\n"));
list_for_each_entry(adapter, &adapters_list_g, list) {
if (iterator++ == adapno) break;
}
kioc->timedout = 0;
if (adapter) {
mraid_mm_dealloc_kioc( adapter, kioc );
}
}
else {
wake_up(&wait_q);
}
} }
...@@ -706,6 +760,7 @@ lld_timedout(unsigned long ptr) ...@@ -706,6 +760,7 @@ lld_timedout(unsigned long ptr)
uioc_t *kioc = (uioc_t *)ptr; uioc_t *kioc = (uioc_t *)ptr;
kioc->status = -ETIME; kioc->status = -ETIME;
kioc->timedout = 1;
con_log(CL_ANN, (KERN_WARNING "megaraid cmm: ioctl timed out\n")); con_log(CL_ANN, (KERN_WARNING "megaraid cmm: ioctl timed out\n"));
...@@ -850,6 +905,7 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp) ...@@ -850,6 +905,7 @@ mraid_mm_register_adp(mraid_mmadp_t *lld_adp)
adapter->issue_uioc = lld_adp->issue_uioc; adapter->issue_uioc = lld_adp->issue_uioc;
adapter->timeout = lld_adp->timeout; adapter->timeout = lld_adp->timeout;
adapter->max_kioc = lld_adp->max_kioc; adapter->max_kioc = lld_adp->max_kioc;
adapter->quiescent = 1;
/* /*
* Allocate single blocks of memory for all required kiocs, * Allocate single blocks of memory for all required kiocs,
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#include "megaraid_ioctl.h" #include "megaraid_ioctl.h"
#define LSI_COMMON_MOD_VERSION "2.20.2.1" #define LSI_COMMON_MOD_VERSION "2.20.2.2"
#define LSI_COMMON_MOD_EXT_VERSION \ #define LSI_COMMON_MOD_EXT_VERSION \
"(Release Date: Wed Oct 06 11:15:29 EDT 2004)" "(Release Date: Thu Nov 4 17:46:29 EST 2004)"
#define LSI_DBGLVL dbglevel #define LSI_DBGLVL dbglevel
......
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