Re: [PATCH 3/7] aacraid: Fix blocking issue with container probing function (cast update)
Received from Mark Salyzyn, The aac_probe_container call blocks. This is an issue because it is called on occasion in the context of the queuecommand handler. Once in a blue moon this has resulted in a kernel panic sleeping during interrupt; or problems with some embedded system versions of the kernel that depend on queuecommand to not block. This ugly patch rewrites the aac_probe_container call into a new routine _aac_probe_container that is an asynchronous state machine to complete the series of operations. The legacy blocking aac_probe_container call used in other areas of the driver (during initialization scanning for all targets and in the separate hot-add/remove [aacraid] thread) merely issues _aac_probe_container and then simple spins calling schedule() waiting for completion. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-03-15 08:28:03.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-03-15 12:49:46.0 -0700 @@ -258,13 +258,10 @@ int aac_get_containers(struct aac_dev *d u32 index; int status = 0; struct fib * fibptr; - unsigned instance; struct aac_get_container_count *dinfo; struct aac_get_container_count_resp *dresp; int maximum_num_containers = MAXIMUM_NUM_CONTAINERS; - instance = dev->scsi_host_ptr->unique_id; - if (!(fibptr = aac_fib_alloc(dev))) return -ENOMEM; @@ -284,88 +281,35 @@ int aac_get_containers(struct aac_dev *d maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); aac_fib_complete(fibptr); } + aac_fib_free(fibptr); if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) maximum_num_containers = MAXIMUM_NUM_CONTAINERS; - fsa_dev_ptr = kmalloc( - sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); - if (!fsa_dev_ptr) { - aac_fib_free(fibptr); + fsa_dev_ptr = kmalloc(sizeof(*fsa_dev_ptr) * maximum_num_containers, + GFP_KERNEL); + if (!fsa_dev_ptr) return -ENOMEM; - } memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); dev->fsa_dev = fsa_dev_ptr; dev->maximum_num_containers = maximum_num_containers; - for (index = 0; index < dev->maximum_num_containers; index++) { - struct aac_query_mount *dinfo; - struct aac_mount *dresp; - + for (index = 0; index < dev->maximum_num_containers; ) { fsa_dev_ptr[index].devname[0] = '\0'; - aac_fib_init(fibptr); - dinfo = (struct aac_query_mount *) fib_data(fibptr); - - dinfo->command = cpu_to_le32(VM_NameServe); - dinfo->count = cpu_to_le32(index); - dinfo->type = cpu_to_le32(FT_FILESYS); + status = aac_probe_container(dev, index); - status = aac_fib_send(ContainerCommand, - fibptr, - sizeof (struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL); - if (status < 0 ) { + if (status < 0) { printk(KERN_WARNING "aac_get_containers: SendFIB failed.\n"); break; } - dresp = (struct aac_mount *)fib_data(fibptr); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { - dinfo->command = cpu_to_le32(VM_NameServe64); - dinfo->count = cpu_to_le32(index); - dinfo->type = cpu_to_le32(FT_FILESYS); - - if (aac_fib_send(ContainerCommand, - fibptr, - sizeof(struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL) < 0) - continue; - } else - dresp->mnt[0].capacityhigh = 0; - - dprintk ((KERN_DEBUG - "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n", - (int)index, (int)le32_to_cpu(dresp->status), - (int)le32_to_cpu(dresp->mnt[0].vol), - (int)le32_to_cpu(dresp->mnt[0].state), - ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + - (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32))); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(
[PATCH 6/7] aacraid: fix srb ioctl for 64 bits
Received from Mark Salyzyn, The raw srb ioctl is supposed to be able to take packets with 32 and 64 bit virtual address SG elements, it did not handle the frames with 64 bit SG elements well when communicating with 64 bit DMA capable adapters, and it did not handle the 32 bit limited DMA adapters at all. The enclosed patch now handles all four quadrants (32 bit / 64 bit SG elements in SRB requests + 32 bit or 64 bit DMA capable adapters) This fix is required before Java based management applications in a 64 bit user space can submit raw srb requests to the array physical components via the ioctl mechanism, the allocated user memory pool on 64 bit machines under this environment forced the management software's hands to submit 64 bit user space virtual address SG elements in via the ioctl. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:30:16.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:30:21.0 -0700 @@ -5,7 +5,7 @@ * based on the old aacraid driver that is.. * Adaptec aacraid device driver for Linux. * - * Copyright (c) 2000 Adaptec, Inc. ([EMAIL PROTECTED]) + * Copyright (c) 2000-2007 Adaptec, Inc. ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -468,7 +468,7 @@ static int aac_send_raw_srb(struct aac_d void *sg_list[32]; u32 sg_indx = 0; u32 byte_count = 0; - u32 actual_fibsize = 0; + u32 actual_fibsize64, actual_fibsize = 0; int i; @@ -481,7 +481,7 @@ static int aac_send_raw_srb(struct aac_d return -EPERM; } /* -* Allocate and initialize a Fib then setup a BlockWrite command +* Allocate and initialize a Fib then setup a SRB command */ if (!(srbfib = aac_fib_alloc(dev))) { return -ENOMEM; @@ -548,129 +548,183 @@ static int aac_send_raw_srb(struct aac_d rcode = -EINVAL; goto cleanup; } - if (dev->dac_support == 1) { + actual_fibsize = sizeof(struct aac_srb) - sizeof(struct sgentry) + + ((user_srbcmd->sg.count & 0xff) * sizeof(struct sgentry)); + actual_fibsize64 = actual_fibsize + (user_srbcmd->sg.count & 0xff) * + (sizeof(struct sgentry64) - sizeof(struct sgentry)); + /* User made a mistake - should not continue */ + if ((actual_fibsize != fibsize) && (actual_fibsize64 != fibsize)) { + dprintk((KERN_DEBUG"aacraid: Bad Size specified in " + "Raw SRB command calculated fibsize=%lu;%lu " + "user_srbcmd->sg.count=%d aac_srb=%lu sgentry=%lu;%lu " + "issued fibsize=%d\n", + actual_fibsize, actual_fibsize64, user_srbcmd->sg.count, + sizeof(struct aac_srb), sizeof(struct sgentry), + sizeof(struct sgentry64), fibsize)); + rcode = -EINVAL; + goto cleanup; + } + if ((data_dir == DMA_NONE) && user_srbcmd->sg.count) { + dprintk((KERN_DEBUG"aacraid: SG with no direction specified in Raw SRB command\n")); + rcode = -EINVAL; + goto cleanup; + } + byte_count = 0; + if (dev->adapter_info.options & AAC_OPT_SGMAP_HOST64) { struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg; struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; - struct user_sgmap* usg; - byte_count = 0; /* * This should also catch if user used the 32 bit sgmap */ - actual_fibsize = sizeof(struct aac_srb) - - sizeof(struct sgentry) + - ((upsg->count & 0xff) * - sizeof(struct sgentry)); - if(actual_fibsize != fibsize){ // User made a mistake - should not continue - dprintk((KERN_DEBUG"aacraid: Bad Size specified in Raw SRB command\n")); - rcode = -EINVAL; - goto cleanup; - } - usg = kmalloc(actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap), GFP_KERNEL); - if (!usg) { - dprintk((KERN_DEBUG"aacraid: Allocation error in Raw SRB command\n")); - rcode = -ENOMEM; - goto cleanup; - } - memcpy (usg, upsg, actual_fibsize - sizeof(struct aac_srb) - + sizeof(struct sgmap)); - actual_fibsize = sizeof(struct aac_srb) - -
[PATCH 7/7] aacraid: Improved error handling
Received from Mark Salyzyn, This set of fixes improve error handling stability of the driver. A popular manifestation of the problems is an NULL pointer reference in the interrupt handler when referencing portions of the scsi command context, or in the scsi_done handling when an offlined device is referenced. The aacraid driver currently does not get notification of orphaned command completions due to devices going offline. The driver also fails to handle the commands that are finished by the error handler, and thus can complete again later at the hands of the adapter causing situations of completion of an invalid scsi command context. Test Unit Ready calls abort assuming that the abort was successful, but are not, and thus when the interrupt from the adapter occurs, they reference invalid command contexts. We add in a TIMED_OUT flag to inform the aacraid FIB context that the interrupt service should merely release the driver resources and not complete the command up. We take advantage of this with the abort handler as well for select abortable commands. And we detect and react if a command that can not be aborted is currently still outstanding to the controller when reissued by the retry mechanism. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-03-15 08:30:19.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-03-15 08:30:23.0 -0700 @@ -5,7 +5,7 @@ * based on the old aacraid driver that is.. * Adaptec aacraid device driver for Linux. * - * Copyright (c) 2000 Adaptec, Inc. ([EMAIL PROTECTED]) + * Copyright (c) 2000-2007 Adaptec, Inc. ([EMAIL PROTECTED]) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -172,6 +172,30 @@ MODULE_PARM_DESC(acbsize, "Request a spe int expose_physicals = -1; module_param(expose_physicals, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); + + +static inline int aac_valid_context(struct scsi_cmnd *scsicmd, + struct fib *fibptr) { + struct scsi_device *device; + + if (unlikely(!scsicmd || !scsicmd->scsi_done )) { + dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n")) +; +aac_fib_complete(fibptr); +aac_fib_free(fibptr); +return 0; +} + scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; + device = scsicmd->device; + if (unlikely(!device || !scsi_device_online(device))) { + dprintk((KERN_WARNING "aac_valid_context: scsi device corrupt\n")); + aac_fib_complete(fibptr); + aac_fib_free(fibptr); + return 0; + } + return 1; +} + /** * aac_get_config_status - check the adapter configuration * @common: adapter to query @@ -342,6 +366,9 @@ static void get_container_name_callback( scsicmd = (struct scsi_cmnd *) context; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; + if (!aac_valid_context(scsicmd, fibptr)) + return; + dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); BUG_ON(fibptr == NULL); @@ -431,9 +458,14 @@ static int aac_probe_container_callback2 static int _aac_probe_container2(void * context, struct fib * fibptr) { - struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; - struct fsa_dev_info *fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev; + struct fsa_dev_info *fsa_dev_ptr; int (*callback)(struct scsi_cmnd *); + struct scsi_cmnd * scsicmd = (struct scsi_cmnd *)context; + + if (!aac_valid_context(scsicmd, fibptr)) + return 0; + + fsa_dev_ptr = ((struct aac_dev *)(scsicmd->device->host->hostdata))->fsa_dev; scsicmd->SCp.Status = 0; if (fsa_dev_ptr) { @@ -477,6 +509,9 @@ static int _aac_probe_container1(void * scsicmd = (struct scsi_cmnd *) context; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; + if (!aac_valid_context(scsicmd, fibptr)) + return 0; + aac_fib_init(fibptr); dinfo = (struct aac_query_mount *)fib_data(fibptr); @@ -1287,6 +1322,9 @@ static void io_callback(void *context, s scsicmd = (struct scsi_cmnd *) context; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; + if (!aac_valid_context(scsicmd, fibptr)) + return; + dev = (struct aac_dev *)scsicmd->device->host->hostdata; cid = scmd_id(scsicmd); @@ -1534,6 +1572,9 @@ static void synchronize_callback(void *c cmd = context; cmd->SCp.phase = AAC_OWNER_MIDLEVEL; + if (!aac_valid_context(c
[PATCH 4/7] aacraid: Fix ioctl handling when adapter resets
Received from Mark Salyzyn, Outstanding ioctl calls still have some problems with aborting cleanly in the face of a reset iop recovery action should the adapter ever enter into a Firmware Assert (BlinkLED) condition. The enclosed patch resolves some uncovered flawed handling. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:30:12.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:30:16.0 -0700 @@ -64,6 +64,9 @@ static int ioctl_send_fib(struct aac_dev unsigned size; int retval; + if (dev->in_reset) { + return -EBUSY; + } fibptr = aac_fib_alloc(dev); if(fibptr == NULL) { return -ENOMEM; @@ -469,6 +472,10 @@ static int aac_send_raw_srb(struct aac_d int i; + if (dev->in_reset) { + dprintk((KERN_DEBUG"aacraid: send raw srb -EBUSY\n")); + return -EBUSY; + } if (!capable(CAP_SYS_ADMIN)){ dprintk((KERN_DEBUG"aacraid: No permission to send raw srb\n")); return -EPERM; --- scsi-misc-aac.orig/drivers/scsi/aacraid/commsup.c 2007-03-15 08:30:12.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commsup.c2007-03-15 08:30:16.0 -0700 @@ -513,15 +513,15 @@ int aac_fib_send(u16 command, struct fib } udelay(5); } - } else if (down_interruptible(&fibptr->event_wait)) { - spin_lock_irqsave(&fibptr->event_lock, flags); - if (fibptr->done == 0) { - fibptr->done = 2; /* Tell interrupt we aborted */ - spin_unlock_irqrestore(&fibptr->event_lock, flags); - return -EINTR; - } + } else + (void)down_interruptible(&fibptr->event_wait); + spin_lock_irqsave(&fibptr->event_lock, flags); + if (fibptr->done == 0) { + fibptr->done = 2; /* Tell interrupt we aborted */ spin_unlock_irqrestore(&fibptr->event_lock, flags); + return -EINTR; } + spin_unlock_irqrestore(&fibptr->event_lock, flags); BUG_ON(fibptr->done == 0); if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){ @@ -1062,7 +1062,7 @@ static int _aac_reset_adapter(struct aac /* * Loop through the fibs, close the synchronous FIBS */ - for (index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) { + for (retval = 1, index = 0; index < (aac->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB); index++) { struct fib *fib = &aac->fibs[index]; if (!(fib->hw_fib_va->header.XferState & cpu_to_le32(NoResponseExpected | Async)) && (fib->hw_fib_va->header.XferState & cpu_to_le32(ResponseExpected))) { @@ -1071,8 +1071,12 @@ static int _aac_reset_adapter(struct aac up(&fib->event_wait); spin_unlock_irqrestore(&fib->event_lock, flagv); schedule(); + retval = 0; } } + /* Give some extra time for ioctls to complete. */ + if (retval == 0) + ssleep(2); index = aac->cardtype; /* -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 2/7] aacraid: Fix struct element name issue
Received from Mark Salyzyn, This patch is to resolve a namespace issue that will result from a patch expected in the future that adds a new interface; rationalized as correcting a long term issue where hw_fib, instead of hw_fib_va, refers to the virtual address space and hw_fib_pa refers to the physical address space. A small fragment of this patch also cleans up an unused variable that was close to the patch fragments. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aacraid.h 2007-03-15 08:30:07.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aacraid.h2007-03-15 08:30:12.0 -0700 @@ -834,7 +834,7 @@ struct fib { */ struct list_headfiblink; void*data; - struct hw_fib *hw_fib;/* Actual shared object */ + struct hw_fib *hw_fib_va; /* Actual shared object */ dma_addr_t hw_fib_pa; /* physical address of hw_fib*/ }; @@ -1821,7 +1821,7 @@ int aac_fib_send(u16 command, struct fib int aac_consumer_get(struct aac_dev * dev, struct aac_queue * q, struct aac_entry **entry); void aac_consumer_free(struct aac_dev * dev, struct aac_queue * q, u32 qnum); int aac_fib_complete(struct fib * context); -#define fib_data(fibctx) ((void *)(fibctx)->hw_fib->data) +#define fib_data(fibctx) ((void *)(fibctx)->hw_fib_va->data) struct aac_dev *aac_init_adapter(struct aac_dev *dev); int aac_get_config_status(struct aac_dev *dev, int commit_flag); int aac_get_containers(struct aac_dev *dev); --- scsi-misc-aac.orig/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:28:04.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commctrl.c 2007-03-15 08:30:12.0 -0700 @@ -69,7 +69,7 @@ static int ioctl_send_fib(struct aac_dev return -ENOMEM; } - kfib = fibptr->hw_fib; + kfib = fibptr->hw_fib_va; /* * First copy in the header so that we can check the size field. */ @@ -91,9 +91,9 @@ static int ioctl_send_fib(struct aac_dev goto cleanup; } /* Highjack the hw_fib */ - hw_fib = fibptr->hw_fib; + hw_fib = fibptr->hw_fib_va; hw_fib_pa = fibptr->hw_fib_pa; - fibptr->hw_fib = kfib = pci_alloc_consistent(dev->pdev, size, &fibptr->hw_fib_pa); + fibptr->hw_fib_va = kfib = pci_alloc_consistent(dev->pdev, size, &fibptr->hw_fib_pa); memset(((char *)kfib) + dev->max_fib_size, 0, size - dev->max_fib_size); memcpy(kfib, hw_fib, dev->max_fib_size); } @@ -137,7 +137,7 @@ cleanup: if (hw_fib) { pci_free_consistent(dev->pdev, size, kfib, fibptr->hw_fib_pa); fibptr->hw_fib_pa = hw_fib_pa; - fibptr->hw_fib = hw_fib; + fibptr->hw_fib_va = hw_fib; } if (retval != -EINTR) aac_fib_free(fibptr); @@ -282,15 +282,15 @@ return_fib: fib = list_entry(entry, struct fib, fiblink); fibctx->count--; spin_unlock_irqrestore(&dev->fib_lock, flags); - if (copy_to_user(f.fib, fib->hw_fib, sizeof(struct hw_fib))) { - kfree(fib->hw_fib); + if (copy_to_user(f.fib, fib->hw_fib_va, sizeof(struct hw_fib))) { + kfree(fib->hw_fib_va); kfree(fib); return -EFAULT; } /* * Free the space occupied by this copy of the fib. */ - kfree(fib->hw_fib); + kfree(fib->hw_fib_va); kfree(fib); status = 0; } else { @@ -340,7 +340,7 @@ int aac_close_fib_context(struct aac_dev /* * Free the space occupied by this copy of the fib. */ - kfree(fib->hw_fib); + kfree(fib->hw_fib_va); kfree(fib); } /* --- scsi-misc-aac.orig/drivers/scsi/aacraid/commsup.c 2007-03-15 08:30:07.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commsup.c2007-03-15 08:30:12.0 -0700 @@ -94,7 +94,7 @@ void aac_fib_map_free(struct aac_dev *de int aac_fib_setup(struct aac_dev * dev) { struct fib *fibptr; - struct hw_fib *hw_fib_va; + struct hw_fib *hw_fib; dma_addr_t hw_fib_pa; int i; @@ -106,24 +106,24 @@ int aac_fib_setup(struct aac_dev * dev) if (i<0) return -ENOMEM; - hw_fib_va = dev->hw_fib_va; + hw_fib = dev->hw_fib_va; hw_fib_pa = dev->hw_fib_pa; - memset(h
[PATCH 3/7] aacraid: Fix blocking issue with container probing function
Received from Mark Salyzyn, The aac_probe_container call blocks. This is an issue because it is called on occasion in the context of the queuecommand handler. Once in a blue moon this has resulted in a kernel panic sleeping during interrupt; or problems with some embedded system versions of the kernel that depend on queuecommand to not block. This ugly patch rewrites the aac_probe_container call into a new routine _aac_probe_container that is an asynchronous state machine to complete the series of operations. The legacy blocking aac_probe_container call used in other areas of the driver (during initialization scanning for all targets and in the separate hot-add/remove [aacraid] thread) merely issues _aac_probe_container and then simple spins calling schedule() waiting for completion. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-03-15 08:28:03.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-03-15 08:30:15.0 -0700 @@ -258,13 +258,10 @@ int aac_get_containers(struct aac_dev *d u32 index; int status = 0; struct fib * fibptr; - unsigned instance; struct aac_get_container_count *dinfo; struct aac_get_container_count_resp *dresp; int maximum_num_containers = MAXIMUM_NUM_CONTAINERS; - instance = dev->scsi_host_ptr->unique_id; - if (!(fibptr = aac_fib_alloc(dev))) return -ENOMEM; @@ -284,88 +281,35 @@ int aac_get_containers(struct aac_dev *d maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); aac_fib_complete(fibptr); } + aac_fib_free(fibptr); if (maximum_num_containers < MAXIMUM_NUM_CONTAINERS) maximum_num_containers = MAXIMUM_NUM_CONTAINERS; - fsa_dev_ptr = kmalloc( + fsa_dev_ptr = (struct fsa_dev_info *) kmalloc( sizeof(*fsa_dev_ptr) * maximum_num_containers, GFP_KERNEL); - if (!fsa_dev_ptr) { - aac_fib_free(fibptr); + if (!fsa_dev_ptr) return -ENOMEM; - } memset(fsa_dev_ptr, 0, sizeof(*fsa_dev_ptr) * maximum_num_containers); dev->fsa_dev = fsa_dev_ptr; dev->maximum_num_containers = maximum_num_containers; - for (index = 0; index < dev->maximum_num_containers; index++) { - struct aac_query_mount *dinfo; - struct aac_mount *dresp; - + for (index = 0; index < dev->maximum_num_containers; ) { fsa_dev_ptr[index].devname[0] = '\0'; - aac_fib_init(fibptr); - dinfo = (struct aac_query_mount *) fib_data(fibptr); - - dinfo->command = cpu_to_le32(VM_NameServe); - dinfo->count = cpu_to_le32(index); - dinfo->type = cpu_to_le32(FT_FILESYS); + status = aac_probe_container(dev, index); - status = aac_fib_send(ContainerCommand, - fibptr, - sizeof (struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL); - if (status < 0 ) { + if (status < 0) { printk(KERN_WARNING "aac_get_containers: SendFIB failed.\n"); break; } - dresp = (struct aac_mount *)fib_data(fibptr); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { - dinfo->command = cpu_to_le32(VM_NameServe64); - dinfo->count = cpu_to_le32(index); - dinfo->type = cpu_to_le32(FT_FILESYS); - - if (aac_fib_send(ContainerCommand, - fibptr, - sizeof(struct aac_query_mount), - FsaNormal, - 1, 1, - NULL, NULL) < 0) - continue; - } else - dresp->mnt[0].capacityhigh = 0; - - dprintk ((KERN_DEBUG - "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n", - (int)index, (int)le32_to_cpu(dresp->status), - (int)le32_to_cpu(dresp->mnt[0].vol), - (int)le32_to_cpu(dresp->mnt[0].state), - ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + - (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32))); - if ((le32_to_cpu(dresp->status) == ST_OK) && - (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && -
[PATCH 5/7] aacraid: remove un-needed references to container id (cid)
Received from Mark Salyzyn, This little patch removes the ',cid)' container identification argument from some of the functions. The argument is used in some cases as merely a debug helper and thus not used, and in others, the value can be quickly acquired from the scsi command in their single solitary use in the procedure rather than wasting resources on passing the argument in from above. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-03-15 08:30:15.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-03-15 08:30:19.0 -0700 @@ -375,7 +375,7 @@ static void get_container_name_callback( /** * aac_get_container_name - get container name, none blocking. */ -static int aac_get_container_name(struct scsi_cmnd * scsicmd, int cid) +static int aac_get_container_name(struct scsi_cmnd * scsicmd) { int status; struct aac_get_name *dinfo; @@ -392,7 +392,7 @@ static int aac_get_container_name(struct dinfo->command = cpu_to_le32(VM_ContainerConfig); dinfo->type = cpu_to_le32(CT_READ_NAME); - dinfo->cid = cpu_to_le32(cid); + dinfo->cid = cpu_to_le32(scmd_id(scsicmd)); dinfo->count = cpu_to_le32(sizeof(((struct aac_get_name_resp *)NULL)->data)); status = aac_fib_send(ContainerCommand, @@ -1361,7 +1361,7 @@ static void io_callback(void *context, s scsicmd->scsi_done(scsicmd); } -static int aac_read(struct scsi_cmnd * scsicmd, int cid) +static int aac_read(struct scsi_cmnd * scsicmd) { u64 lba; u32 count; @@ -1375,7 +1375,7 @@ static int aac_read(struct scsi_cmnd * s */ switch (scsicmd->cmnd[0]) { case READ_6: - dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", cid)); + dprintk((KERN_DEBUG "aachba: received a read(6) command on id %d.\n", scmd_id(scsicmd))); lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; @@ -1385,7 +1385,7 @@ static int aac_read(struct scsi_cmnd * s count = 256; break; case READ_16: - dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", cid)); + dprintk((KERN_DEBUG "aachba: received a read(16) command on id %d.\n", scmd_id(scsicmd))); lba = ((u64)scsicmd->cmnd[2] << 56) | ((u64)scsicmd->cmnd[3] << 48) | @@ -1399,7 +1399,7 @@ static int aac_read(struct scsi_cmnd * s (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; break; case READ_12: - dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", cid)); + dprintk((KERN_DEBUG "aachba: received a read(12) command on id %d.\n", scmd_id(scsicmd))); lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | @@ -1409,7 +1409,7 @@ static int aac_read(struct scsi_cmnd * s (scsicmd->cmnd[8] << 8) | scsicmd->cmnd[9]; break; default: - dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", cid)); + dprintk((KERN_DEBUG "aachba: received a read(10) command on id %d.\n", scmd_id(scsicmd))); lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) | @@ -1449,7 +1449,7 @@ static int aac_read(struct scsi_cmnd * s return 0; } -static int aac_write(struct scsi_cmnd * scsicmd, int cid) +static int aac_write(struct scsi_cmnd * scsicmd) { u64 lba; u32 count; @@ -1468,7 +1468,7 @@ static int aac_write(struct scsi_cmnd * if (count == 0) count = 256; } else if (scsicmd->cmnd[0] == WRITE_16) { /* 16 byte command */ - dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", cid)); + dprintk((KERN_DEBUG "aachba: received a write(16) command on id %d.\n", scmd_id(scsicmd))); lba = ((u64)scsicmd->cmnd[2] << 56) | ((u64)scsicmd->cmnd[3] << 48) | @@ -1480,14 +1480,14 @@ static int aac_write(struct scsi_cmnd * count = (scsicmd->cmnd[10] << 24) | (scsicmd->cmnd[11] << 16) | (scsicmd->cmnd[12] << 8) | scsicmd->cmnd[13]; } else if (scsicmd->cmnd[0] == WRITE_12) { /* 12 byte command */ - dprintk((KERN_DEBUG "aachba: received a write(12) command on id %d.\n", cid)); + dprintk
[PATCH 0/7] aacraid: DRiver updates
The following 7 patches contain various updates described in each mail. Patches apply to the scsi-misc-2.6 tree. aachba.c | 386 ++- aacraid.h |9 - commctrl.c | 282 ++--- commsup.c | 106 +- dpcsup.c | 32 ++-- linit.c| 64 +++- rx.c | 43 +++-- -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/7] aacraid: add restart adapter platform function
Received from Mark Salyzyn, This patch updates the adapter restart function to deal with some adapters that have specific IOP reset needs. Since the code for restarting the adapter was in two places, changed over to utilizing a platform function in one place. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aacraid.h 2007-03-15 08:28:05.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/aacraid.h2007-03-15 08:30:07.0 -0700 @@ -497,6 +497,7 @@ struct adapter_ops void (*adapter_enable_int)(struct aac_dev *dev); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4); int (*adapter_check_health)(struct aac_dev *dev); + int (*adapter_restart)(struct aac_dev *dev, int bled); /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); irqreturn_t (*adapter_intr)(int irq, void *dev_id); @@ -1060,6 +1061,9 @@ struct aac_dev #define aac_adapter_check_health(dev) \ (dev)->a_ops.adapter_check_health(dev) +#define aac_adapter_restart(dev,bled) \ + (dev)->a_ops.adapter_restart(dev,bled) + #define aac_adapter_ioremap(dev, size) \ (dev)->a_ops.adapter_ioremap(dev, size) --- scsi-misc-aac.orig/drivers/scsi/aacraid/commsup.c 2007-03-15 08:28:05.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/commsup.c2007-03-15 08:30:07.0 -0700 @@ -1035,7 +1035,6 @@ static void aac_handle_aif(struct aac_de static int _aac_reset_adapter(struct aac_dev *aac) { int index, quirks; - u32 ret; int retval; struct Scsi_Host *host; struct scsi_device *dev; @@ -1059,20 +1058,10 @@ static int _aac_reset_adapter(struct aac * If a positive health, means in a known DEAD PANIC * state and the adapter could be reset to `try again'. */ - retval = aac_adapter_check_health(aac); - if (retval == 0) - retval = aac_adapter_sync_cmd(aac, IOP_RESET_ALWAYS, - 0, 0, 0, 0, 0, 0, &ret, NULL, NULL, NULL, NULL); - if (retval) - retval = aac_adapter_sync_cmd(aac, IOP_RESET, - 0, 0, 0, 0, 0, 0, &ret, NULL, NULL, NULL, NULL); + retval = aac_adapter_restart(aac, aac_adapter_check_health(aac)); if (retval) goto out; - if (ret != 0x0001) { - retval = -ENODEV; - goto out; - } /* * Loop through the fibs, close the synchronous FIBS --- scsi-misc-aac.orig/drivers/scsi/aacraid/rx.c2007-03-15 08:28:05.0 -0700 +++ scsi-misc-aac/drivers/scsi/aacraid/rx.c 2007-03-15 08:30:07.0 -0700 @@ -460,22 +460,31 @@ static int aac_rx_ioremap(struct aac_dev return 0; } -static int aac_rx_restart_adapter(struct aac_dev *dev) +static int aac_rx_restart_adapter(struct aac_dev *dev, int bled) { u32 var; - printk(KERN_ERR "%s%d: adapter kernel panic'd.\n", - dev->name, dev->id); - - if (aac_rx_check_health(dev) <= 0) - return 1; - if (rx_sync_cmd(dev, IOP_RESET, 0, 0, 0, 0, 0, 0, - &var, NULL, NULL, NULL, NULL)) - return 1; + if (bled) + printk(KERN_ERR "%s%d: adapter kernel panic'd %x.\n", + dev->name, dev->id, bled); + else + bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS, + 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL); + if (bled) + bled = aac_adapter_sync_cmd(dev, IOP_RESET, + 0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL); + + if (bled) + return -EINVAL; + if (var == 0x3803000F) { /* USE_OTHER_METHOD */ + rx_writel(dev, MUnit.reserved2, 3); + msleep(5000); /* Delay 5 seconds */ + var = 0x0001; + } if (var != 0x0001) -return 1; + return -EINVAL; if (rx_readl(dev, MUnit.OMRx[0]) & KERNEL_PANIC) - return 1; + return -ENODEV; return 0; } @@ -532,9 +541,12 @@ int _aac_rx_init(struct aac_dev *dev) * Check to see if the board panic'd while booting. */ status = rx_readl(dev, MUnit.OMRx[0]); - if (status & KERNEL_PANIC) - if (aac_rx_restart_adapter(dev)) + if (status & KERNEL_PANIC) { + if ((status = aac_rx_check_health(dev)) <= 0) + goto error_iounmap; + if (aac_rx_restart_adapter(dev, status)) goto error_iounmap; + } /* * Check to see if the board failed any self tests
RE: [PATCH] scsi spi transport: SCSI domain validation after reset
On Mon, 2007-02-12 at 15:45 -0600, James Bottomley wrote: > On Mon, 2007-02-12 at 08:14 -0800, Mark Haverkamp wrote: > > This patch fixed my looping DV problem. > > As far as I can tell, this is identical to Eric's patch, but is done > using the existing dv_in_progress flag ... can you test it out and see > if it actually works? No, it still loops doing dv. I think that the problem is that I have two devices that won't run at advertised speeds. Target 0 and Target 8. When Target 0 causes a reset, there is no problem yet. Later when Target 8 causes a reset and dv is re-scheduled on Targets 0-8 is when the problem starts. Target 0 is no longer pending so it will start dv and fail causing a reset scheduling another round of dv. Then 8 will fail again since by this time it isn't pending anymore, etc.. Here is a section of the messages file. The machine is still looping. Feb 12 14:12:26 odt2-006 kernel: SCSI subsystem initialized Feb 12 14:12:27 odt2-006 kernel: Fusion MPT base driver 3.04.04 Feb 12 14:12:27 odt2-006 kernel: Copyright (c) 1999-2007 LSI Logic Corporation Feb 12 14:12:27 odt2-006 kernel: Fusion MPT misc device (ioctl) driver 3.04.04 Feb 12 14:12:27 odt2-006 kernel: mptctl: Registered with Fusion MPT base driver Feb 12 14:12:27 odt2-006 kernel: mptctl: /dev/mptctl @ (major,minor=10,220) Feb 12 14:12:38 odt2-006 kernel: Fusion MPT SPI Host driver 3.04.04 Feb 12 14:12:38 odt2-006 kernel: ACPI: PCI Interrupt :03:03.0[A] -> GSI 27 (level, low) -> IRQ 27 Feb 12 14:12:38 odt2-006 kernel: mptbase: Initiating ioc0 bringup Feb 12 14:12:38 odt2-006 kernel: ioc0: 53C1030: Capabilities={Initiator} Feb 12 14:12:39 odt2-006 kernel: scsi0 : ioc0: LSI53C1030, FwRev=01030a00h, Ports=1, MaxQ=222, IRQ=27 Feb 12 14:12:40 odt2-006 kernel: scsi 0:0:0:0: Direct-Access HP 18.2G MAP3367NC#HJ HPC6 PQ: 0 ANSI: 3 Feb 12 14:12:40 odt2-006 kernel: target0:0:0: Beginning Domain Validation Feb 12 14:12:50 odt2-006 kernel: mptscsih: ioc0: attempting task abort! (sc=810076871b00) Feb 12 14:12:50 odt2-006 kernel: scsi 0:0:0:0: Feb 12 14:12:50 odt2-006 kernel: command: Inquiry: 12 00 00 00 60 00 Feb 12 14:12:52 odt2-006 kernel: mptbase: Initiating ioc0 recovery Feb 12 14:13:16 odt2-006 kernel: mptscsih: ioc0: Issue of TaskMgmt failed! Feb 12 14:13:16 odt2-006 kernel: mptscsih: ioc0: task abort: FAILED (sc=810076871b00) Feb 12 14:13:16 odt2-006 kernel: mptscsih: ioc0: attempting target reset! (sc=810076871b00) Feb 12 14:13:16 odt2-006 kernel: scsi 0:0:0:0: Feb 12 14:13:16 odt2-006 kernel: command: Inquiry: 12 00 00 00 60 00 Feb 12 14:13:16 odt2-006 kernel: target0:0:0: asynchronous Feb 12 14:13:16 odt2-006 kernel: mptscsih: ioc0: target reset: SUCCESS (sc=810076871b00) Feb 12 14:13:26 odt2-006 kernel: mptscsih: ioc0: attempting task abort! (sc=810076871b00) Feb 12 14:13:26 odt2-006 kernel: scsi 0:0:0:0: Feb 12 14:13:26 odt2-006 kernel: command: Test Unit Ready: 00 00 00 00 00 00 Feb 12 14:13:28 odt2-006 kernel: mptbase: Initiating ioc0 recovery Feb 12 14:13:51 odt2-006 kernel: mptscsih: ioc0: Issue of TaskMgmt failed! Feb 12 14:13:51 odt2-006 kernel: mptscsih: ioc0: task abort: FAILED (sc=810076871b00) Feb 12 14:13:51 odt2-006 kernel: mptscsih: ioc0: attempting target reset! (sc=810076871b00) Feb 12 14:13:51 odt2-006 kernel: scsi 0:0:0:0: Feb 12 14:13:51 odt2-006 kernel: command: Test Unit Ready: 00 00 00 00 00 00 Feb 12 14:13:51 odt2-006 kernel: target0:0:0: asynchronous Feb 12 14:13:51 odt2-006 kernel: mptscsih: ioc0: target reset: SUCCESS (sc=810076871b00) Feb 12 14:13:51 odt2-006 kernel: mptscsih: ioc0: attempting bus reset! (sc=810076871b00) Feb 12 14:13:51 odt2-006 kernel: scsi 0:0:0:0: Feb 12 14:13:51 odt2-006 kernel: command: Inquiry: 12 00 00 00 60 00 Feb 12 14:13:52 odt2-006 kernel: mptscsih: ioc0: bus reset: SUCCESS (sc=810076871b00) Feb 12 14:14:02 odt2-006 kernel: target0:0:0: Domain Validation detected failure, dropping back Feb 12 14:14:02 odt2-006 kernel: target0:0:0: Domain Validation skipping write tests Feb 12 14:14:02 odt2-006 kernel: target0:0:0: Ending Domain Validation Feb 12 14:14:02 odt2-006 kernel: target0:0:0: asynchronous Feb 12 14:14:02 odt2-006 kernel: scsi 0:0:1:0: Direct-Access HP 18.2GB C 80-H008 H008 PQ: 0 ANSI: 2 Feb 12 14:14:02 odt2-006 kernel: target0:0:1: Beginning Domain Validation Feb 12 14:14:02 odt2-006 kernel: target0:0:1: Ending Domain Validation Feb 12 14:14:02 odt2-006 kernel: target0:0:1: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 126) Feb 12 14:14:02 odt2-006 kernel: scsi 0:0:2:0: Direct-Access HP 18.2GB C 80-H008 H008 PQ: 0 ANSI: 2 Feb 12 14:14:02 odt2-006 kernel: target0:0:2: Beginning Domain Validation Feb 12 14:14:02 odt2-006 kernel: target0:0:2: Ending Domain Validation Feb 12 14:14:02 odt2-006 kernel: target0:0:2: FAST-80 WIDE SCSI 160.0 MB/s DT (12.5 ns, offset 126) Feb
RE: [PATCH] scsi spi transport: SCSI domain validation after reset
On Wed, 2007-02-07 at 16:51 -0700, Eric Moore wrote: > > -Original Message- > > From: James Bottomley [mailto:[EMAIL PROTECTED] > > Sent: Monday, February 05, 2007 2:50 PM > > To: Mark Haverkamp > > Cc: linux-scsi; Moore, Eric > > Subject: Re: [PATCH] scsi spi transport: SCSI domain > > validation after reset > > > > On Mon, 2007-02-05 at 12:49 -0800, Mark Haverkamp wrote: > > > James, > > > > > > Some months ago, I had problems with a mis-behaving disk that failed > > > domain validation on a fusion card resulting in an infinite loop of > > > domain validation. At the time Eric proposed a patch to the mptspi > > > driver to reload devices with parameters previously > > negotiated when a > > > reset occurred. You indicated that a more generic solution > > should be > > > done. > > > > > > This patch updates spi_dv_device_internal() to check if domain > > > validation has already been performed on a device and just sets it > > > previously negotiated parameters. This solved the "infinite domain > > > validation" loop for me when a reset is performed as a > > result of command > > > timeout with the mis-behaving device. > > > > Er,but this code basically disabled domain revalidation after a reset, > > doesn't it? If we could do it that way, we could simply take > > the calls > > to spi_dv_device() out of the fusion driver and instead set the > > parameters up in its place without having to modify the > > transport class. > > > > Here is a patch that does exactly that. > > After host reset, the device are programmed to default asyn narrow nego. > We need to reprogram the parameter back to previous values. If the host > reset is called as a result of spi_dv_device() commands timing out, its > possible to get into an infinite loop of dv to host reset. This will > prevent that case, as we merely program old values. If host reset is > called outside context of domain validation, then we can call > spi_dv_device. Please apply. > > This applies over scsi-misc tree. > > Signed-off-by: Eric Moore <[EMAIL PROTECTED]> [ ... ] This patch fixed my looping DV problem. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] scsi spi transport: SCSI domain validation after reset
On Mon, 2007-02-05 at 15:50 -0600, James Bottomley wrote: > On Mon, 2007-02-05 at 12:49 -0800, Mark Haverkamp wrote: > > James, > > > > Some months ago, I had problems with a mis-behaving disk that failed > > domain validation on a fusion card resulting in an infinite loop of > > domain validation. At the time Eric proposed a patch to the mptspi > > driver to reload devices with parameters previously negotiated when a > > reset occurred. You indicated that a more generic solution should be > > done. > > > > This patch updates spi_dv_device_internal() to check if domain > > validation has already been performed on a device and just sets it > > previously negotiated parameters. This solved the "infinite domain > > validation" loop for me when a reset is performed as a result of command > > timeout with the mis-behaving device. > > Er,but this code basically disabled domain revalidation after a reset, > doesn't it? Yes it does. The problem I am seeing is that a device that fails validation can cause a reset to occur. If it does, then all devices are now re-validated. Including any that have failed validation previously. Which can cause another reset and another validation, etc. forever. I'm not sure how else to break out of this cycle. > If we could do it that way, we could simply take the calls > to spi_dv_device() out of the fusion driver and instead set the > parameters up in its place without having to modify the transport class. If I understand your comment, I believe that is what Eric proposed at one point. But it seems other drivers/adapters could have a similar problem. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] scsi spi transport: SCSI domain validation after reset
James, Some months ago, I had problems with a mis-behaving disk that failed domain validation on a fusion card resulting in an infinite loop of domain validation. At the time Eric proposed a patch to the mptspi driver to reload devices with parameters previously negotiated when a reset occurred. You indicated that a more generic solution should be done. This patch updates spi_dv_device_internal() to check if domain validation has already been performed on a device and just sets it previously negotiated parameters. This solved the "infinite domain validation" loop for me when a reset is performed as a result of command timeout with the mis-behaving device. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- Applies to scsi-misc-2.6 --- Index: scsi-misc-2.6/drivers/scsi/scsi_transport_spi.c === --- scsi-misc-2.6.orig/drivers/scsi/scsi_transport_spi.c +++ scsi-misc-2.6/drivers/scsi/scsi_transport_spi.c @@ -363,6 +363,7 @@ static int child_iter(struct device *dev { struct scsi_device *sdev = to_scsi_device(dev); + spi_initial_dv(sdev->sdev_target) = 0; spi_dv_device(sdev); return 1; } @@ -787,6 +788,29 @@ spi_dv_device_internal(struct scsi_devic struct scsi_target *starget = sdev->sdev_target; struct Scsi_Host *shost = sdev->host; int len = sdev->inquiry_len; + + /* +* If dv has been done already on this target, just set its + * previously determined parameters. + */ + if (spi_initial_dv(starget)) { + DV_SET(dt, spi_dt(starget)); + DV_SET(iu, spi_iu(starget)); + DV_SET(width, spi_width(starget)); + DV_SET(offset, spi_offset(starget)); + DV_SET(period, spi_period(starget)); + DV_SET(qas, spi_qas(starget)); + DV_SET(rd_strm, spi_rd_strm(starget)); + DV_SET(wr_flow, spi_wr_flow(starget)); + DV_SET(rti, spi_rti(starget)); + DV_SET(pcomp_en, spi_pcomp_en(starget)); + if (spi_dv_device_compare_inquiry(sdev, buffer, + buffer, DV_LOOPS) == SPI_COMPARE_SUCCESS) + return; + starget_printk(KERN_ERR, starget, + "Domain Validation Inquiry Failed\n"); + } + /* first set us up for narrow async */ DV_SET(offset, 0); DV_SET(width, 0); @@ -917,8 +941,10 @@ spi_dv_device(struct scsi_device *sdev) if (unlikely(scsi_device_get(sdev))) return; - if (unlikely(spi_dv_in_progress(starget))) + if (unlikely(spi_dv_in_progress(starget))) { + scsi_device_put(sdev); return; + } spi_dv_in_progress(starget) = 1; buffer = kzalloc(len, GFP_KERNEL); -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] aacraid: expanded expose physical device code (new)
Received from Mark Salyzyn, Take the expose_physicals flag and allow the user to select default (physicals available via /dev/sg), exposed (physicals available via /dev/sd for experimental reasons) and hidden (physicals blocked from all access). This expands the functionality of the previous expose_physicals insmod parameter which was added to support some experimental configurations. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- The patch has been updated after talking with Mark about Christoph's comments on the previous version of the patch. --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-01-25 14:18:02.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-01-25 14:19:39.0 -0800 @@ -170,9 +170,9 @@ module_param(acbsize, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512, 2048, 4096 and 8192. Default is to use suggestion from Firmware."); -int expose_physicals = 0; +int expose_physicals = -1; module_param(expose_physicals, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. 0=off, 1=on"); +MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); /** * aac_get_config_status - check the adapter configuration * @common: adapter to query --- scsi-misc-aac.orig/drivers/scsi/aacraid/linit.c 2007-01-25 14:18:02.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/linit.c 2007-01-25 14:52:13.0 -0800 @@ -398,11 +398,15 @@ sdev->skip_ms_page_3f = 1; } if ((sdev->type == TYPE_DISK) && - !expose_physicals && (sdev_channel(sdev) != CONTAINER_CHANNEL)) { - struct aac_dev *aac = (struct aac_dev *)sdev->host->hostdata; - if (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) - sdev->no_uld_attach = 1; + if (expose_physicals == 0) + return -ENXIO; + if (expose_physicals < 0) { + struct aac_dev *aac = + (struct aac_dev *)sdev->host->hostdata; + if (!aac->raid_scsi_mode || (sdev_channel(sdev) != 2)) + sdev->no_uld_attach = 1; + } } if (sdev->tagged_supported && (sdev->type == TYPE_DISK) && (sdev_channel(sdev) == CONTAINER_CHANNEL)) { -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
compile error in NCR_D700
Fix a typo in NCR_D700 Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-2.6.orig/drivers/scsi/NCR_D700.c 2007-01-15 09:18:58.0 -0800 +++ scsi-misc-2.6/drivers/scsi/NCR_D700.c 2007-01-24 09:27:02.0 -0800 @@ -200,7 +200,7 @@ hostdata->base = ioport_map(region, 64); hostdata->differential = (((1<clock = NCR_D700_CLOCK_MHZ; - hostdata->busrt_length = 8; + hostdata->burst_length = 8; /* and register the siop */ host = NCR_700_detect(&NCR_D700_driver_template, hostdata, p->dev); -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [Patch 2/4] aacraid: expanded expose physical device code
On Wed, 2007-01-24 at 05:49 +, Christoph Hellwig wrote: > > + if ((scsicmd->cmnd[0] == INQUIRY) && (expose_physicals <= 0)) { > > + u8 b; > > + u8 b1; > > + /* We can't expose disk devices because we can't > > +* tell whether they are the raw container drives > > +* or stand alone drives. If they have the removable > > +* bit set then we should expose them though. > > +*/ > > + b = (*(u8*)scsicmd->request_buffer)&0x1f; > > + b1 = ((u8*)scsicmd->request_buffer)[1]; > > + if (b == TYPE_TAPE || b == TYPE_WORM || > > + b == TYPE_ROM || b==TYPE_MOD || > > + b == TYPE_MEDIUM_CHANGER || > > + (b == TYPE_DISK && (b1 & 0x80))) { > > + scsicmd->result = DID_OK << 16 | > > + COMMAND_COMPLETE << 8; > > This can't work at all. request_buffer is always a scatterlist these days. > Besides this implementation bug it's also not the wrong way to do it either. > Please just return -ENXIO in ->slave_configure if sdev->type is not to > your liking instead of failing the INQUIRY command. Christoph, I talked to Mark Salyzyn about this. He wants to drop this patch for the time being and re-think it. James, The other patches still apply with this one removed (One applies with fuzz). Is that OK or should I re-diff and resend them. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/4] aacraid: rework packet support code
Received from Mark Salyzyn, Replace all if/else packet formations with platform function calls. This is in recognition of the proliferation of read and write packet types, and in the need to migrate to up-and-coming packets for new products. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-01-18 10:11:26.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-01-18 10:11:30.0 -0800 @@ -706,6 +706,309 @@ } } +static int aac_bounds_32(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba) +{ + if (lba & 0xLL) { + int cid = scmd_id(cmd); + dprintk((KERN_DEBUG "aacraid: Illegal lba\n")); + cmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | + SAM_STAT_CHECK_CONDITION; + set_sense((u8 *) &dev->fsa_dev[cid].sense_data, + HARDWARE_ERROR, + SENCODE_INTERNAL_TARGET_FAILURE, + ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, + 0, 0); + memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, + (sizeof(dev->fsa_dev[cid].sense_data) > sizeof(cmd->sense_buffer)) + ? sizeof(cmd->sense_buffer) + : sizeof(dev->fsa_dev[cid].sense_data)); + cmd->scsi_done(cmd); + return 1; + } + return 0; +} + +static int aac_bounds_64(struct aac_dev * dev, struct scsi_cmnd * cmd, u64 lba) +{ + return 0; +} + +static void io_callback(void *context, struct fib * fibptr); + +static int aac_read_raw_io(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) +{ + u16 fibsize; + struct aac_raw_io *readcmd; + aac_fib_init(fib); + readcmd = (struct aac_raw_io *) fib_data(fib); + readcmd->block[0] = cpu_to_le32((u32)(lba&0x)); + readcmd->block[1] = cpu_to_le32((u32)((lba&0xLL)>>32)); + readcmd->count = cpu_to_le32(count<<9); + readcmd->cid = cpu_to_le16(scmd_id(cmd)); + readcmd->flags = cpu_to_le16(1); + readcmd->bpTotal = 0; + readcmd->bpComplete = 0; + + aac_build_sgraw(cmd, &readcmd->sg); + fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw)); + BUG_ON(fibsize > (fib->dev->max_fib_size - sizeof(struct aac_fibhdr))); + /* +* Now send the Fib to the adapter +*/ + return aac_fib_send(ContainerRawIo, + fib, + fibsize, + FsaNormal, + 0, 1, + (fib_callback) io_callback, + (void *) cmd); +} + +static int aac_read_block64(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) +{ + u16 fibsize; + struct aac_read64 *readcmd; + aac_fib_init(fib); + readcmd = (struct aac_read64 *) fib_data(fib); + readcmd->command = cpu_to_le32(VM_CtHostRead64); + readcmd->cid = cpu_to_le16(scmd_id(cmd)); + readcmd->sector_count = cpu_to_le16(count); + readcmd->block = cpu_to_le32((u32)(lba&0x)); + readcmd->pad = 0; + readcmd->flags = 0; + + aac_build_sg64(cmd, &readcmd->sg); + fibsize = sizeof(struct aac_read64) + + ((le32_to_cpu(readcmd->sg.count) - 1) * +sizeof (struct sgentry64)); + BUG_ON (fibsize > (fib->dev->max_fib_size - + sizeof(struct aac_fibhdr))); + /* +* Now send the Fib to the adapter +*/ + return aac_fib_send(ContainerCommand64, + fib, + fibsize, + FsaNormal, + 0, 1, + (fib_callback) io_callback, + (void *) cmd); +} + +static int aac_read_block(struct fib * fib, struct scsi_cmnd * cmd, u64 lba, u32 count) +{ + u16 fibsize; + struct aac_read *readcmd; + aac_fib_init(fib); + readcmd = (struct aac_read *) fib_data(fib); + readcmd->command = cpu_to_le32(VM_CtBlockRead); + readcmd->cid = cpu_to_le16(scmd_id(cmd)); + readcmd->block = cpu_to_le32((u32)(lba&0x)); + readcmd->count = cpu_to_le32(count * 512); + + aac_build_sg(cmd, &readcmd->sg); + fibsize = sizeof(struct aac_read) + + ((le32_to_cpu(readcmd->sg.count) - 1) * +sizeof (struct sgentry)); + BUG_ON (fibsize > (fib->dev->max_fib_size - + sizeof(struct aac_fibhdr))); + /* +
[Patch 2/4] aacraid: expanded expose physical device code
Received from Mark Salyzyn, Take the expose_physicals flag and allow the user to select default (physicals available via /dev/sg), exposed (physicals available via /dev/sd for experimental reasons) and hidden (physicals blocked from all access). This expands the functionality of the previous expose_physicals insmod parameter which was added to support some experimental configurations. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aachba.c2007-01-18 10:06:55.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/aachba.c 2007-01-18 10:11:26.0 -0800 @@ -170,9 +170,9 @@ module_param(acbsize, int, S_IRUGO|S_IWUSR); MODULE_PARM_DESC(acbsize, "Request a specific adapter control block (FIB) size. Valid values are 512, 2048, 4096 and 8192. Default is to use suggestion from Firmware."); -int expose_physicals = 0; +int expose_physicals = -1; module_param(expose_physicals, int, S_IRUGO|S_IWUSR); -MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. 0=off, 1=on"); +MODULE_PARM_DESC(expose_physicals, "Expose physical components of the arrays. -1=protect 0=off, 1=on"); /** * aac_get_config_status - check the adapter configuration * @common: adapter to query @@ -1973,7 +1973,41 @@ case SRB_STATUS_ERROR_RECOVERY: case SRB_STATUS_PENDING: case SRB_STATUS_SUCCESS: - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; + if ((scsicmd->cmnd[0] == INQUIRY) && (expose_physicals <= 0)) { + u8 b; + u8 b1; + /* We can't expose disk devices because we can't +* tell whether they are the raw container drives +* or stand alone drives. If they have the removable +* bit set then we should expose them though. +*/ + b = (*(u8*)scsicmd->request_buffer)&0x1f; + b1 = ((u8*)scsicmd->request_buffer)[1]; + if (b == TYPE_TAPE || b == TYPE_WORM || + b == TYPE_ROM || b==TYPE_MOD || + b == TYPE_MEDIUM_CHANGER || + (b == TYPE_DISK && (b1 & 0x80))) { + scsicmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8; + /* +* We will allow disk devices if in RAID/SCSI mode and +* the channel is 2 +*/ + } else if ((dev->raid_scsi_mode) && + (scmd_channel(scsicmd) == 2)) { + scsicmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8; + } else if (expose_physicals) { + scsicmd->device->no_uld_attach = 1; + scsicmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8; + } else { + scsicmd->result = DID_NO_CONNECT << 16 | + COMMAND_COMPLETE << 8; + } + } else { + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8; + } break; case SRB_STATUS_DATA_OVERRUN: switch(scsicmd->cmnd[0]){ @@ -1993,7 +2027,41 @@ scsicmd->result = DID_ERROR << 16 | COMMAND_COMPLETE << 8; break; case INQUIRY: { + if (expose_physicals <= 0) { + u8 b; + u8 b1; + /* We can't expose disk devices because we can't tell +* whether they are the raw container drives or +* stand alone drives +*/ + b = (*(u8*)scsicmd->request_buffer)&0x0f; + b1 = ((u8*)scsicmd->request_buffer)[1]; + if (b == TYPE_TAPE || b == TYPE_WORM || + b == TYPE_ROM || b == TYPE_MOD || + b == TYPE_MEDIUM_CHANGER || + (b == TYPE_DISK && (b1&0x80))) { + scsicmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8; + /* +* We will allow disk devices if in RAID/SCSI mode and +
[PATCH 3/4] aacraid: Begin adding support for new adapter type
Received from Mark Salyzyn, Add in the NEMER/ARK physical register mapping, represented in up and coming products currently under test at Adaptec. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aacraid.h 2007-01-18 10:06:54.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/aacraid.h2007-01-18 10:11:28.0 -0800 @@ -1810,6 +1810,7 @@ int aac_do_ioctl(struct aac_dev * dev, int cmd, void __user *arg); int aac_rx_init(struct aac_dev *dev); int aac_rkt_init(struct aac_dev *dev); +int aac_nark_init(struct aac_dev *dev); int aac_sa_init(struct aac_dev *dev); int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify); unsigned int aac_response_normal(struct aac_queue * q); --- scsi-misc-aac.orig/drivers/scsi/aacraid/linit.c 2007-01-18 10:11:26.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/linit.c 2007-01-18 10:11:28.0 -0800 @@ -157,6 +157,7 @@ { 0x9005, 0x0285, 0x17aa, PCI_ANY_ID, 0, 0, 58 }, /* Legend Catchall */ { 0x9005, 0x0285, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 59 }, /* Adaptec Catch All */ { 0x9005, 0x0286, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 60 }, /* Adaptec Rocket Catch All */ + { 0x9005, 0x0288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 61 }, /* Adaptec NEMER/ARK Catch All */ { 0,} }; MODULE_DEVICE_TABLE(pci, aac_pci_tbl); @@ -230,7 +231,8 @@ { aac_rx_init, "aacraid", "DELL", "RAID", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Dell Catchall */ { aac_rx_init, "aacraid", "Legend ", "RAID", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Legend Catchall */ { aac_rx_init, "aacraid", "ADAPTEC ", "RAID", 2, AAC_QUIRK_31BIT | AAC_QUIRK_34SG }, /* Adaptec Catch All */ - { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID", 2 } /* Adaptec Rocket Catch All */ + { aac_rkt_init, "aacraid", "ADAPTEC ", "RAID", 2 }, /* Adaptec Rocket Catch All */ + { aac_nark_init, "aacraid", "ADAPTEC ", "RAID", 2 } /* Adaptec NEMER/ARK Catch All */ }; /** @@ -804,7 +806,6 @@ .emulated = 1, }; - static int __devinit aac_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) { --- scsi-misc-aac.orig/drivers/scsi/aacraid/Makefile2007-01-18 10:06:54.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/Makefile 2007-01-18 10:11:28.0 -0800 @@ -3,6 +3,6 @@ obj-$(CONFIG_SCSI_AACRAID) := aacraid.o aacraid-objs := linit.o aachba.o commctrl.o comminit.o commsup.o \ - dpcsup.o rx.o sa.o rkt.o + dpcsup.o rx.o sa.o rkt.o nark.o EXTRA_CFLAGS := -Idrivers/scsi --- /dev/null 1970-01-01 00:00:00.0 + +++ scsi-misc-aac/drivers/scsi/aacraid/nark.c 2007-01-18 10:11:28.0 -0800 @@ -0,0 +1,87 @@ +/* + * Adaptec AAC series RAID controller driver + * (c) Copyright 2001 Red Hat Inc. <[EMAIL PROTECTED]> + * + * based on the old aacraid driver that is.. + * Adaptec aacraid device driver for Linux. + * + * Copyright (c) 2000 Adaptec, Inc. ([EMAIL PROTECTED]) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + * Module Name: + * nark.c + * + * Abstract: Hardware Device Interface for NEMER/ARK + * + */ + +#include +#include + +#include + +#include "aacraid.h" + +/** + * aac_nark_ioremap + * @size: mapping resize request + * + */ +static int aac_nark_ioremap(struct aac_dev * dev, u32 size) +{ + if (!size) { + iounmap(dev->regs.rx); + dev->regs.rx = NULL; + iounmap(dev->base); + dev->base = NULL; + return 0; + } + dev->scsi_host_ptr->base = pci_resource_start(dev->pdev, 2); + dev->regs.rx = ioremap((u64)pci_resource_start(dev->pdev, 0) | + ((u64)pci_resource_start(dev->pdev, 1) << 32), + sizeof(struct rx_registers) - sizeof(struct rx_inbound)); + dev->base = NULL; + if (
[PATCH 1/4] aacraid: rework communication support code
Received from Mark Salyzyn, Replace all if/else communication transports with a platform function call. This is in recognition of the need to migrate to up-and-coming transports. Currently the Linux driver does not support two available communication transports provided by our products, these will be added in future patches, and will expand the platform function set. Signed-off-by Mark Haverkamp <[EMAIL PROTECTED]> --- --- scsi-misc-aac.orig/drivers/scsi/aacraid/aacraid.h 2007-01-15 10:20:19.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/aacraid.h2007-01-18 10:06:54.0 -0800 @@ -5,6 +5,7 @@ #define _nblank(x) #x #define nblank(x) _nblank(x)[0] +#include /*-- * D E F I N E S @@ -488,13 +489,20 @@ struct adapter_ops { + /* Low level operations */ void (*adapter_interrupt)(struct aac_dev *dev); void (*adapter_notify)(struct aac_dev *dev, u32 event); void (*adapter_disable_int)(struct aac_dev *dev); + void (*adapter_enable_int)(struct aac_dev *dev); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4); int (*adapter_check_health)(struct aac_dev *dev); - int (*adapter_send)(struct fib * fib); + /* Transport operations */ int (*adapter_ioremap)(struct aac_dev * dev, u32 size); + irqreturn_t (*adapter_intr)(int irq, void *dev_id); + /* Packet operations */ + int (*adapter_deliver)(struct fib * fib); + /* Administrative operations */ + int (*adapter_comm)(struct aac_dev * dev, int comm); }; /* @@ -1018,7 +1026,9 @@ u8 nondasd_support; u8 dac_support; u8 raid_scsi_mode; - u8 new_comm_interface; + u8 comm_interface; +# define AAC_COMM_PRODUCER 0 +# define AAC_COMM_MESSAGE 1 /* macro side-effects BEWARE */ # define raw_io_interface \ init->InitStructRevision==cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4) @@ -1036,18 +1046,24 @@ #define aac_adapter_disable_int(dev) \ (dev)->a_ops.adapter_disable_int(dev) +#define aac_adapter_enable_int(dev) \ + (dev)->a_ops.adapter_enable_int(dev) + #define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) \ (dev)->a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) #define aac_adapter_check_health(dev) \ (dev)->a_ops.adapter_check_health(dev) -#define aac_adapter_send(fib) \ - ((fib)->dev)->a_ops.adapter_send(fib) - #define aac_adapter_ioremap(dev, size) \ (dev)->a_ops.adapter_ioremap(dev, size) +#define aac_adapter_deliver(fib) \ + ((fib)->dev)->a_ops.adapter_deliver(fib) + +#define aac_adapter_comm(dev,comm) \ + (dev)->a_ops.adapter_comm(dev, comm) + #define FIB_CONTEXT_FLAG_TIMED_OUT (0x0001) /* @@ -1795,6 +1811,7 @@ int aac_rx_init(struct aac_dev *dev); int aac_rkt_init(struct aac_dev *dev); int aac_sa_init(struct aac_dev *dev); +int aac_queue_get(struct aac_dev * dev, u32 * index, u32 qid, struct hw_fib * hw_fib, int wait, struct fib * fibptr, unsigned long *nonotify); unsigned int aac_response_normal(struct aac_queue * q); unsigned int aac_command_normal(struct aac_queue * q); unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index); --- scsi-misc-aac.orig/drivers/scsi/aacraid/comminit.c 2007-01-15 10:24:10.0 -0800 +++ scsi-misc-aac/drivers/scsi/aacraid/comminit.c 2007-01-15 10:24:43.0 -0800 @@ -95,7 +95,7 @@ init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES); init->InitFlags = 0; - if (dev->new_comm_interface) { + if (dev->comm_interface == AAC_COMM_MESSAGE) { init->InitFlags = cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED); dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n")); } @@ -297,21 +297,23 @@ - sizeof(struct aac_fibhdr) - sizeof(struct aac_write) + sizeof(struct sgentry)) / sizeof(struct sgentry); - dev->new_comm_interface = 0; + dev->comm_interface = AAC_COMM_PRODUCER; dev->raw_io_64 = 0; if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) && (status[0] == 0x0001)) { if (status[1] & AAC_OPT_NEW_COMM_64) dev->raw_io_64 = 1; - if (status[1] & AAC_OPT_NEW_COMM) - dev->new_comm_interface = dev->a
[PATCH 0/4] aacraid: Driver updates
The following 4 patches contain various updates described in each mail. Patches apply to the scsi-misc-2.6 tree. Makefile |2 aachba.c | 672 - aacraid.h | 46 +++- comminit.c | 14 - commsup.c | 40 --- linit.c|7 rkt.c | 64 +++-- rx.c | 263 +++ sa.c | 33 ++ 9 files changed, 682 insertions(+), 459 deletions(-) -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: mptfc problems
On Fri, 2007-01-12 at 15:37 -0800, Mark Haverkamp wrote: > Eric, > Please ignore this. It was a kernel configuration error. > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
mptfc problems
et # # Pseudo filesystems # CONFIG_PROC_FS=y CONFIG_PROC_KCORE=y CONFIG_PROC_SYSCTL=y CONFIG_SYSFS=y CONFIG_TMPFS=y CONFIG_TMPFS_POSIX_ACL=y CONFIG_HUGETLBFS=y CONFIG_HUGETLB_PAGE=y CONFIG_RAMFS=y # CONFIG_CONFIGFS_FS is not set # # Miscellaneous filesystems # # CONFIG_ADFS_FS is not set # CONFIG_AFFS_FS is not set # CONFIG_HFS_FS is not set # CONFIG_HFSPLUS_FS is not set # CONFIG_BEFS_FS is not set # CONFIG_BFS_FS is not set # CONFIG_EFS_FS is not set # CONFIG_CRAMFS is not set # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set # CONFIG_QNX4FS_FS is not set # CONFIG_SYSV_FS is not set # CONFIG_UFS_FS is not set # # Network File Systems # CONFIG_NFS_FS=y CONFIG_NFS_V3=y # CONFIG_NFS_V3_ACL is not set # CONFIG_NFS_V4 is not set # CONFIG_NFS_DIRECTIO is not set CONFIG_NFSD=y CONFIG_NFSD_V3=y # CONFIG_NFSD_V3_ACL is not set # CONFIG_NFSD_V4 is not set CONFIG_NFSD_TCP=y CONFIG_ROOT_NFS=y CONFIG_LOCKD=y CONFIG_LOCKD_V4=y CONFIG_EXPORTFS=y CONFIG_NFS_COMMON=y CONFIG_SUNRPC=y # CONFIG_RPCSEC_GSS_KRB5 is not set # CONFIG_RPCSEC_GSS_SPKM3 is not set # CONFIG_SMB_FS is not set # CONFIG_CIFS is not set # CONFIG_NCP_FS is not set # CONFIG_CODA_FS is not set # CONFIG_AFS_FS is not set # CONFIG_9P_FS is not set # # Partition Types # # CONFIG_PARTITION_ADVANCED is not set CONFIG_MSDOS_PARTITION=y # # Native Language Support # CONFIG_NLS=y CONFIG_NLS_DEFAULT="iso8859-1" CONFIG_NLS_CODEPAGE_437=y # CONFIG_NLS_CODEPAGE_737 is not set # CONFIG_NLS_CODEPAGE_775 is not set # CONFIG_NLS_CODEPAGE_850 is not set # CONFIG_NLS_CODEPAGE_852 is not set # CONFIG_NLS_CODEPAGE_855 is not set # CONFIG_NLS_CODEPAGE_857 is not set # CONFIG_NLS_CODEPAGE_860 is not set # CONFIG_NLS_CODEPAGE_861 is not set # CONFIG_NLS_CODEPAGE_862 is not set # CONFIG_NLS_CODEPAGE_863 is not set # CONFIG_NLS_CODEPAGE_864 is not set # CONFIG_NLS_CODEPAGE_865 is not set # CONFIG_NLS_CODEPAGE_866 is not set # CONFIG_NLS_CODEPAGE_869 is not set # CONFIG_NLS_CODEPAGE_936 is not set # CONFIG_NLS_CODEPAGE_950 is not set # CONFIG_NLS_CODEPAGE_932 is not set # CONFIG_NLS_CODEPAGE_949 is not set # CONFIG_NLS_CODEPAGE_874 is not set # CONFIG_NLS_ISO8859_8 is not set # CONFIG_NLS_CODEPAGE_1250 is not set # CONFIG_NLS_CODEPAGE_1251 is not set CONFIG_NLS_ASCII=y CONFIG_NLS_ISO8859_1=y # CONFIG_NLS_ISO8859_2 is not set # CONFIG_NLS_ISO8859_3 is not set # CONFIG_NLS_ISO8859_4 is not set # CONFIG_NLS_ISO8859_5 is not set # CONFIG_NLS_ISO8859_6 is not set # CONFIG_NLS_ISO8859_7 is not set # CONFIG_NLS_ISO8859_9 is not set # CONFIG_NLS_ISO8859_13 is not set # CONFIG_NLS_ISO8859_14 is not set CONFIG_NLS_ISO8859_15=y # CONFIG_NLS_KOI8_R is not set # CONFIG_NLS_KOI8_U is not set CONFIG_NLS_UTF8=y # # Distributed Lock Manager # # CONFIG_DLM is not set # # Instrumentation Support # CONFIG_PROFILING=y CONFIG_OPROFILE=m CONFIG_KPROBES=y # # Kernel hacking # CONFIG_TRACE_IRQFLAGS_SUPPORT=y # CONFIG_PRINTK_TIME is not set # CONFIG_ENABLE_MUST_CHECK is not set CONFIG_MAGIC_SYSRQ=y CONFIG_UNUSED_SYMBOLS=y CONFIG_DEBUG_FS=y # CONFIG_HEADERS_CHECK is not set CONFIG_DEBUG_KERNEL=y CONFIG_LOG_BUF_SHIFT=18 CONFIG_DETECT_SOFTLOCKUP=y # CONFIG_SCHEDSTATS is not set # CONFIG_DEBUG_SLAB is not set # CONFIG_DEBUG_RT_MUTEXES is not set # CONFIG_RT_MUTEX_TESTER is not set # CONFIG_DEBUG_SPINLOCK is not set # CONFIG_DEBUG_MUTEXES is not set # CONFIG_DEBUG_RWSEMS is not set # CONFIG_DEBUG_LOCK_ALLOC is not set # CONFIG_PROVE_LOCKING is not set # CONFIG_DEBUG_SPINLOCK_SLEEP is not set # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set # CONFIG_DEBUG_KOBJECT is not set CONFIG_DEBUG_BUGVERBOSE=y CONFIG_DEBUG_INFO=y # CONFIG_DEBUG_VM is not set # CONFIG_DEBUG_LIST is not set # CONFIG_FRAME_POINTER is not set # CONFIG_FORCED_INLINING is not set # CONFIG_RCU_TORTURE_TEST is not set # CONFIG_LKDTM is not set # CONFIG_DEBUG_RODATA is not set # CONFIG_IOMMU_DEBUG is not set CONFIG_DEBUG_STACKOVERFLOW=y # CONFIG_DEBUG_STACK_USAGE is not set # # Security options # # CONFIG_KEYS is not set # CONFIG_SECURITY is not set # # Cryptographic options # # CONFIG_CRYPTO is not set # # Library routines # CONFIG_BITREVERSE=y # CONFIG_CRC_CCITT is not set # CONFIG_CRC16 is not set CONFIG_CRC32=y # CONFIG_LIBCRC32C is not set CONFIG_ZLIB_INFLATE=y CONFIG_PLIST=y CONFIG_IOMAP_COPY=y -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aic94xx panic on module load
On Tue, 2006-11-28 at 10:01 -0800, Darrick J. Wong wrote: > Mark Haverkamp wrote: > > I got this panic when loading the aic94xx module. The adapter is > > connected to an HP MSA50 SAS enclosure with 3 72GB SAS disks. > > > > Kernel 2.6.19-rc6-scsi-misc on an x86_64 > > > sas: task finished with resp:0x0, stat:0x89 > > sas: sas_discover_sata() for device 500508b300a27a2c at > > 500508b300a27a2f:0xc returned 0xff06 > > kobject_add failed for port-2:0:12 with -EEXIST, don't try to register > > things with the same name in the same directory. > > Your expander is reporting your SAS disks to aic94xx as SATA disks, > which is why the sas_discover_sata fails. I don't know why it would do > that... flaky hardware? I'm not really sure what to do when we're given > bad information. > > > Kernel BUG at drivers/scsi/libsas/sas_expander.c:603 > > I believe this BUG is fixed by a few patches in aic94xx-sas. For sure > you'll want the patch named "libsas: better error handling in > sas_ex_discover_end_dev()" patch; see commit > 82f6bc0849b6fce9a965dde11dd6f685adc7285e. > > There are some dependencies: > e384a0bdd9d3abb5ba2f6eac9ac4d0ac61e1c6a1 -> > 1f8787b198c4ba058a0bfc06c2ca7f301168a5dd -> > 82f6bc0849b6fce9a965dde11dd6f685adc7285e. I tried out the aic94xx-sas-2.6 kernel on my system. It didn't panic and did find the disks. It looks like those fixes that you mentioned did it. Do you know when they may be propagated towards one of the scsi trees or the main kernel tree? Thanks, Mark. Nov 29 11:29:10 odt2-003 kernel: aic94xx: Adaptec aic94xx SAS/SATA driver version 1.0.2 unloaded Nov 29 11:29:19 odt2-003 kernel: aic94xx: Adaptec aic94xx SAS/SATA driver version 1.0.2 loaded Nov 29 11:29:19 odt2-003 kernel: PCI: Enabling device :08:01.0 (0110 -> 0113) Nov 29 11:29:19 odt2-003 kernel: ACPI: PCI Interrupt :08:01.0[A] -> GSI 28 (level, low) -> IRQ 28 Nov 29 11:29:19 odt2-003 kernel: aic94xx: found Adaptec AIC-9410W SAS/SATA Host Adapter, device :08:01.0 Nov 29 11:29:19 odt2-003 kernel: scsi3 : aic94xx Nov 29 11:29:19 odt2-003 kernel: aic94xx: BIOS present (1,2), 1673 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ue num:3, ue size:88 Nov 29 11:29:19 odt2-003 kernel: aic94xx: manuf sect SAS_ADDR 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: manuf sect PCBA SN 0BD0C625005W Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: num_phy_desc: 8 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy0: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy1: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy2: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy3: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy4: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy5: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy6: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: phy7: ENEBLEABLE Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: max_phys:0x8, num_phys:0x8 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ms: enabled_phys:0xff Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy0: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy1: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy2: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy3: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy4: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy5: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy6: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: ctrla: phy7: sas_addr: 5d100045af00, sas rate:0x9-0x8, sata rate:0x0-0x0, flags:0x0 Nov 29 11:29:19 odt2-003 kernel: aic94xx: max_scbs:512, max_ddbs:128 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy0 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy1 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy2 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy3 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy4 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy5 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy6 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 kernel: aic94xx: setting phy7 addr to 5d100045af00 Nov 29 11:29:19 odt2-003 k
Re: aic94xx panic on module load
On Tue, 2006-11-28 at 20:52 -0500, Douglas Gilbert wrote: > Mark Haverkamp wrote: > > On Tue, 2006-11-28 at 13:46 -0800, Mark Haverkamp wrote: > >> On Tue, 2006-11-28 at 13:44 -0500, Douglas Gilbert wrote: > >> > >> [ ... ] > >> > > > > I don't know if this helps, but I found the verbose option. Here is a > > little debug output. > > > > > > ./smp_discover -v -p 12 -s 0x500508b300a27a2f /dev/mptctl > > Discover request: 40 10 00 02 00 00 00 00 00 0c 00 00 00 00 00 00 > > send_req_mpt: subvalue=0 SAS address=0x500508b300a27a2f > > mptctl two scatter gather list interface > > IOCStatus=0x1 > > IOCStatus=0x1 IOCLogInfo=0xA27A2F SASStatus=0x0 > > smp_send_req failed, res=-1 > > Mark, > The iocnum may be greater than 0 (especially if you have > other MPT Fusion HBAs (any kind) in that computer). > Have a look in the log around where the mptsas driver > is registered and look for the string "ioc". The number > following "ioc" is what you need. If you find "ioc3" then > try: > > ./smp_discover -p 12 -s 0x500508b300a27a2f /dev/mptctl,3 OK thanks, I do have an mptspi card too. # ./smp_discover -v -p 12 -s 0x500508b300a27a2f /dev/mptctl,2 Discover request: 40 10 00 02 00 00 00 00 00 0c 00 00 00 00 00 00 send_req_mpt: subvalue=2 SAS address=0x500508b300a27a2f mptctl two scatter gather list interface Discover response: expander change count: 0 phy identifier: 12 attached device type: end device negotiated physical link rate: phy enabled; 3 Gbps attached initiator: ssp=0 stp=0 smp=0 sata_host=0 attached sata port selector: 0 attached target: ssp=0 stp=1 smp=0 sata_device=0 SAS address: 0x500508b300a27a2f attached SAS address: 0x500508b300a27a2c attached phy identifier: 0 attached inside ZPSDS persistent: 0 attached requested inside ZPSDS: 0 attached break_reply capable: 0 programmed minimum physical link rate: 3 Gbps hardware minimum physical link rate: 3 Gbps programmed maximum physical link rate: 3 Gbps hardware maximum physical link rate: 3 Gbps phy change count: 105 virtual phy: 1 partial pathway timeout value: 7 us routing attribute: direct connector type: No information connector element index: 0 connector physical link: 0 > > To verify that expander SAS address, try this: > find /sys -name "sas_device:expander*" > cd to any directory found and try "cat sas_address". 0x500508b300a27a2f > > > BTW there is a smp_utils version 0.92 beta at > http://www.torque.net/sg > the error messages are somewhat clearer. > > > Doug Gilbert > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aic94xx panic on module load
On Tue, 2006-11-28 at 13:46 -0800, Mark Haverkamp wrote: > On Tue, 2006-11-28 at 13:44 -0500, Douglas Gilbert wrote: > > [ ... ] > I don't know if this helps, but I found the verbose option. Here is a little debug output. ./smp_discover -v -p 12 -s 0x500508b300a27a2f /dev/mptctl Discover request: 40 10 00 02 00 00 00 00 00 0c 00 00 00 00 00 00 send_req_mpt: subvalue=0 SAS address=0x500508b300a27a2f mptctl two scatter gather list interface IOCStatus=0x1 IOCStatus=0x1 IOCLogInfo=0xA27A2F SASStatus=0x0 smp_send_req failed, res=-1 > > > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aic94xx panic on module load
On Tue, 2006-11-28 at 13:44 -0500, Douglas Gilbert wrote: [ ... ] > So this is an interesting expander setup within the enclosure. > There are two expanders (500508b300a27a2f + 500508b300a27a3f) > interconnected via a two wide link (0,1 <-> 10,11 (T-S)) with > a four wide link back to the 94xx HBA (4,5,6,7 <-> 0,1,2,3). > My guess is that 500508b300a27a2f:12 is virtual and contains a > SES target. That leaves SAS disks on 500508b300a27a3f:0, > 500508b300a27a3f,2 and 500508b300a27a3f,4 > > The pain starts immediately after the sas transport layer > tries to process those expander SMP DISCOVER responses. > The trace seems to suggest the device at 500508b300a27a2f:12 > is SATA: extremely unlikely. > > Mark, do you have a LSI MPT Fusion SAS HBA handy? If > so you might connect the enclosure to it, get smp_utils > and do something like: > # modprobe mptctl > # smp_discover -p 12 -s 0x500508b300a27a2f /dev/mptctl > > and post the output. I'm not sure how to interpret this, but it looks like something didn't work right. After the modprobe I see this: Nov 28 13:42:28 odt2-003 kernel: Fusion MPT misc device (ioctl) driver 3.04.02 Nov 28 13:42:28 odt2-003 kernel: mptctl: Registered with Fusion MPT base driver Nov 28 13:42:28 odt2-003 kernel: mptctl: /dev/mptctl @ (major,minor=10,220) Then running the smp_discover command: # ./smp_discover -p 12 -s 0x500508b300a27a2f /dev/mptctl smp_send_req failed, res=-1 gets this in the log: Nov 28 13:43:17 odt2-003 kernel: mptbase: ioc0: IOCStatus(0x0001): Invalid Function > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aic94xx panic on module load
On Tue, 2006-11-28 at 13:44 -0500, Douglas Gilbert wrote: > Mark Haverkamp wrote: > > I got this panic when loading the aic94xx module. The adapter is > > connected to an HP MSA50 SAS enclosure with 3 72GB SAS disks. > > > > Kernel 2.6.19-rc6-scsi-misc on an x86_64 [ ... ] > So this is an interesting expander setup within the enclosure. > There are two expanders (500508b300a27a2f + 500508b300a27a3f) > interconnected via a two wide link (0,1 <-> 10,11 (T-S)) with > a four wide link back to the 94xx HBA (4,5,6,7 <-> 0,1,2,3). > My guess is that 500508b300a27a2f:12 is virtual and contains a > SES target. That leaves SAS disks on 500508b300a27a3f:0, > 500508b300a27a3f,2 and 500508b300a27a3f,4 > > The pain starts immediately after the sas transport layer > tries to process those expander SMP DISCOVER responses. > The trace seems to suggest the device at 500508b300a27a2f:12 > is SATA: extremely unlikely. > > Mark, do you have a LSI MPT Fusion SAS HBA handy? If > so you might connect the enclosure to it, get smp_utils > and do something like: > # modprobe mptctl > # smp_discover -p 12 -s 0x500508b300a27a2f /dev/mptctl > > and post the output. I do have one on another machine. I'll get it installed in this machine and give it a try. We do have LSI cards connected to these kinds of enclosures and disks and they seem to be working OK. Mark. > > BTW Darrick, SATA disks connected to an expander usually > get SAS addresses like where > "n" is small. The device attached to 500508b300a27a2f:12 > is in that region: 500508b300a27a2c > > Doug Gilbert > > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 2/8] aacraid: AIF preallocation (Updated)
On Thu, 2005-09-08 at 13:50 -0700, Mark Haverkamp wrote: > Aif pre-allocation is used to pull the kmalloc outside of the locks. > It looks like part of this patch was lost somehow. Here is an updated version that includes the missing piece. - - - - - Recevied from Mark Salyzyn from Adaptec. Aif pre-allocation is used to pull the kmalloc outside of the locks. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/commsup.c 2005-09-08 11:00:20.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c 2005-09-09 07:58:15.0 -0700 @@ -805,7 +805,6 @@ { struct hw_fib *hw_fib, *hw_newfib; struct fib *fib, *newfib; - struct aac_queue_block *queues = dev->queues; struct aac_fib_context *fibctx; unsigned long flags; DECLARE_WAITQUEUE(wait, current); @@ -825,21 +824,22 @@ * Let the DPC know it has a place to send the AIF's to. */ dev->aif_thread = 1; - add_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); + add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); set_current_state(TASK_INTERRUPTIBLE); + dprintk ((KERN_INFO "aac_command_thread start\n")); while(1) { - spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags); - while(!list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) { + spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); + while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { struct list_head *entry; struct aac_aifcmd * aifcmd; set_current_state(TASK_RUNNING); - - entry = queues->queue[HostNormCmdQueue].cmdq.next; + + entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; list_del(entry); - - spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); + + spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); fib = list_entry(entry, struct fib, fiblink); /* * We will process the FIB here or pass it to a @@ -869,9 +869,54 @@ u32 time_now, time_last; unsigned long flagv; + unsigned num; + struct hw_fib ** hw_fib_pool, ** hw_fib_p; + struct fib ** fib_pool, ** fib_p; time_now = jiffies/HZ; + /* +* Warning: no sleep allowed while +* holding spinlock. We take the estimate +* and pre-allocate a set of fibs outside the +* lock. +*/ + num = le32_to_cpu(dev->init->AdapterFibsSize) + / sizeof(struct hw_fib); /* some extra */ + spin_lock_irqsave(&dev->fib_lock, flagv); + entry = dev->fib_list.next; + while (entry != &dev->fib_list) { + entry = entry->next; + ++num; + } + spin_unlock_irqrestore(&dev->fib_lock, flagv); + hw_fib_pool = NULL; + fib_pool = NULL; + if (num +&& ((hw_fib_pool = kmalloc(sizeof(struct hw_fib *) * num, GFP_ATOMIC|GFP_KERNEL))) +&& ((fib_pool = kmalloc(sizeof(struct fib *) * num, GFP_ATOMIC|GFP_KERNEL { + hw_fib_p = hw_fib_pool; + fib_p = fib_pool; + while (hw_fib_p < &hw_fib_pool[num]) { + if (!(*(hw_fib_p++) = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC|GFP_KERNEL))) { + --hw_fib_p; + break; + } +
[PATCH 6/8] aacraid: initialization timeout
Received from Mark Salyzyn from Adaptec. In the rare instances where the adapter, or the motherboard, is misbehaving; driver initialization or shutdown becomes problematic. By introducing a 3 minute timeout on the first interrupt driven command during initialization, or the issuance of the adapter shutdown command during driver unload, we can resolve the lockup problems induced by common (but rare) hardware misbehaviors. The timeout during initialization, should it occur, is accompanied by a message presented to the console and the logs indicating that the user should inspect and resolve problems with interrupt routing. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:23.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:36.0 -0700 @@ -692,7 +692,7 @@ fibptr, sizeof(*info), FsaNormal, -1, 1, +-1, 1, /* First `interrupt' command uses special wait */ NULL, NULL); Index: scsi-misc-aac-2/drivers/scsi/aacraid/comminit.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/comminit.c2005-09-08 11:32:04.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/comminit.c 2005-09-08 11:32:36.0 -0700 @@ -195,7 +195,7 @@ fibctx, sizeof(struct aac_close), FsaNormal, - 1, 1, + -2 /* Timeout silently */, 1, NULL, NULL); if (status == 0) Index: scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:23.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:36.0 -0700 @@ -41,6 +41,7 @@ #include #include #include +#include #include "aacraid.h" @@ -541,7 +542,34 @@ if (wait) { spin_unlock_irqrestore(&fibptr->event_lock, flags); - down(&fibptr->event_wait); + /* Only set for first known interruptable command */ + if (wait < 0) { + /* +* *VERY* Dangerous to time out a command, the +* assumption is made that we have no hope of +* functioning because an interrupt routing or other +* hardware failure has occurred. +*/ + unsigned long count = 3600L; /* 3 minutes */ + unsigned long qflags; + while (down_trylock(&fibptr->event_wait)) { + if (--count == 0) { + spin_lock_irqsave(q->lock, qflags); + q->numpending--; + list_del(&fibptr->queue); + spin_unlock_irqrestore(q->lock, qflags); + if (wait == -1) { + printk(KERN_ERR "aacraid: fib_send: first asynchronous command timed out.\n" + "Usually a result of a PCI interrupt routing problem;\n" + "update mother board BIOS or consider utilizing one of\n" + "the SAFE mode kernel options (acpi, apic etc)\n"); + } + return -ETIMEDOUT; + } + udelay(5); + } + } else + down(&fibptr->event_wait); if(fibptr->done == 0) BUG(); -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/8] aacraid: error return checking
Received from Mark Salyzyn from Adaptec This patch adds some additional error return checking and error return value propagation during initialization. Also, the deprecation of pci_module_init with pci_register_driver along with the change in return values. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/linit.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/linit.c 2005-09-08 11:32:27.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/linit.c2005-09-08 11:32:30.0 -0700 @@ -748,7 +748,8 @@ unique_id++; } - if (pci_enable_device(pdev)) + error = pci_enable_device(pdev); + if (error) goto out; if (pci_set_dma_mask(pdev, 0xULL) || @@ -801,7 +802,9 @@ goto out_free_fibs; aac->maximum_num_channels = aac_drivers[index].channels; - aac_get_adapter_info(aac); + error = aac_get_adapter_info(aac); + if (error < 0) + goto out_deinit; /* * Lets override negotiations and drop the maximum SG limit to 34 @@ -929,9 +932,14 @@ printk(KERN_INFO "Adaptec %s driver (%s)\n", AAC_DRIVERNAME, aac_driver_version); - error = pci_module_init(&aac_pci_driver); - if (error) + error = pci_register_driver(&aac_pci_driver); + if (error < 0 || list_empty(&aac_devices)) { + if (error >= 0) { + pci_unregister_driver(&aac_pci_driver); + error = -ENODEV; + } return error; + } aac_cfg_major = register_chrdev( 0, "aac", &aac_cfg_fops); if (aac_cfg_major < 0) { -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 8/8] aacraid: remove aac_insert_entry
Received from Mark Salyzyn from Adaptec. High Priority Queues have *never* been used in the entire history of the aac based adapters. Associated with this, aac_insert_entry can be removed, SavedIrql can be removed & padding variable can be removed. With the movement of SavedIrql out & replaced with an automatic variable qflags, the locking can be refined somewhat. The sparse warnings did not catch the need for byte swapping in the 'dprintk' debugging print macros, so fixed this up when this code was moved outside of the now refined locking. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aacraid.h 2005-09-08 11:32:23.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aacraid.h 2005-09-08 11:32:45.0 -0700 @@ -306,7 +306,6 @@ */ #defineFsaNormal 1 -#defineFsaHigh 2 /* * Define the FIB. The FIB is the where all the requested data and @@ -550,8 +549,6 @@ /* This is only valid for adapter to host command queues. */ spinlock_t *lock; /* Spinlock for this queue must take this lock before accessing the lock */ spinlock_t lockdata; /* Actual lock (used only on one side of the lock) */ - unsigned long SavedIrql; /* Previous IRQL when the spin lock is taken */ - u32 padding;/* Padding - FIXME - can remove I believe */ struct list_headcmdq; /* A queue of FIBs which need to be prcessed by the FS thread. This is */ /* only valid for command queues which receive entries from the adapter. */ struct list_headpendingq; /* A queue of outstanding fib's to the adapter. */ Index: scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:36.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:45.0 -0700 @@ -271,40 +271,22 @@ /* Interrupt Moderation, only interrupt for first two entries */ if (idx != le32_to_cpu(*(q->headers.consumer))) { if (--idx == 0) { - if (qid == AdapHighCmdQueue) - idx = ADAP_HIGH_CMD_ENTRIES; - else if (qid == AdapNormCmdQueue) + if (qid == AdapNormCmdQueue) idx = ADAP_NORM_CMD_ENTRIES; - else if (qid == AdapHighRespQueue) - idx = ADAP_HIGH_RESP_ENTRIES; - else if (qid == AdapNormRespQueue) + else idx = ADAP_NORM_RESP_ENTRIES; } if (idx != le32_to_cpu(*(q->headers.consumer))) *nonotify = 1; } - if (qid == AdapHighCmdQueue) { - if (*index >= ADAP_HIGH_CMD_ENTRIES) - *index = 0; - } else if (qid == AdapNormCmdQueue) { + if (qid == AdapNormCmdQueue) { if (*index >= ADAP_NORM_CMD_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ - } - else if (qid == AdapHighRespQueue) - { - if (*index >= ADAP_HIGH_RESP_ENTRIES) - *index = 0; - } - else if (qid == AdapNormRespQueue) - { + } else { if (*index >= ADAP_NORM_RESP_ENTRIES) *index = 0; /* Wrap to front of the Producer Queue. */ } - else { - printk("aacraid: invalid qid\n"); - BUG(); - } if ((*index + 1) == le32_to_cpu(*(q->headers.consumer))) { /* Queue is full */ printk(KERN_WARNING "Queue %d full, %u outstanding.\n", @@ -336,12 +318,8 @@ { struct aac_entry * entry = NULL; int map = 0; - struct aac_queue * q = &dev->queues->queue[qid]; - - spin_lock_irqsave(q->lock, q->SavedIrql); - if (qid == AdapHighCmdQueue || qid == AdapNormCmdQueue) - { + if (qid == AdapNormCmdQueue) { /* if no entries wait for some if caller wants to */ while (!aac_get_entry(dev, qid, &entry, index, nonotify)) { @@ -352,9 +330,7 @@ */ entry->size = cpu_to_le32(le16_to_cpu(hw_fib->header.Size)); map = 1; - } - else if (qid == AdapHighRespQueue || qid == AdapNormRespQueue) -
[PATCH 7/8] aacraid: fib size math fix
Received from Mark Salyzyn from Adaptec. The size of the command packet's scatter gather list maximum size was miscalculated in the low range leading to the driver initialization limiting the maximum i/o size that could go to the Adapter. There were no negative operational side effects resulting from this bad math, only a subtle limit in performance of the Adapter at the top end of the range. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:36.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:39.0 -0700 @@ -843,8 +843,8 @@ if (!(dev->raw_io_interface)) { dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgmap)) / - sizeof(struct sgmap); + sizeof(struct aac_write) + sizeof(struct sgentry)) / + sizeof(struct sgentry); if (dev->dac_support) { /* * 38 scatter gather elements @@ -853,8 +853,8 @@ (dev->max_fib_size - sizeof(struct aac_fibhdr) - sizeof(struct aac_write64) + - sizeof(struct sgmap64)) / - sizeof(struct sgmap64); + sizeof(struct sgentry64)) / + sizeof(struct sgentry64); } dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { Index: scsi-misc-aac-2/drivers/scsi/aacraid/comminit.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/comminit.c2005-09-08 11:32:36.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/comminit.c 2005-09-08 11:32:39.0 -0700 @@ -313,8 +313,8 @@ dev->max_fib_size = sizeof(struct hw_fib); dev->sg_tablesize = host->sg_tablesize = (dev->max_fib_size - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgmap)) - / sizeof(struct sgmap); + - sizeof(struct aac_write) + sizeof(struct sgentry)) + / sizeof(struct sgentry); dev->raw_io_64 = 0; if ((!aac_adapter_sync_cmd(dev, GET_ADAPTER_PROPERTIES, 0, 0, 0, 0, 0, 0, status+0, status+1, status+2, NULL, NULL)) && @@ -349,8 +349,8 @@ dev->max_fib_size = 512; dev->sg_tablesize = host->sg_tablesize = (512 - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgmap)) -/ sizeof(struct sgmap); + - sizeof(struct aac_write) + sizeof(struct sgentry)) +/ sizeof(struct sgentry); host->can_queue = AAC_NUM_IO_FIB; } else if (acbsize == 2048) { host->max_sectors = 512; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/8] aacraid: handle AIF hotplug events
Received from Mark Salyzyn from Adaptec. Hotplug sniffs the AIFs (events) from the adapter and if a container change resulting in the device going offline (container zero), online (container zero completed) or changing capacity (morph) it will take actions by calling the appropriate API. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:04.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:23.0 -0700 @@ -479,7 +479,7 @@ * is updated in the struct fsa_dev_info structure rather than returned. */ -static int probe_container(struct aac_dev *dev, int cid) +int probe_container(struct aac_dev *dev, int cid) { struct fsa_dev_info *fsa_dev_ptr; int status; @@ -1455,6 +1455,8 @@ case TEST_UNIT_READY: spin_unlock_irq(host->host_lock); probe_container(dev, cid); + if ((fsa_dev_ptr[cid].valid & 1) == 0) + fsa_dev_ptr[cid].valid = 0; spin_lock_irq(host->host_lock); if (fsa_dev_ptr[cid].valid == 0) { scsicmd->result = DID_NO_CONNECT << 16; Index: scsi-misc-aac-2/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aacraid.h 2005-09-08 11:32:04.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aacraid.h 2005-09-08 11:32:23.0 -0700 @@ -780,7 +780,9 @@ u64 last; u64 size; u32 type; + u32 config_waiting_on; u16 queue_depth; + u8 config_needed; u8 valid; u8 ro; u8 locked; @@ -1715,6 +1717,7 @@ #defineAifCmdJobProgress 2 /* Progress report */ #defineAifJobCtrZero 101 /* Array Zero progress */ #defineAifJobStsSuccess 1 /* Job completes */ +#defineAifJobStsRunning 102/* Job running */ #defineAifCmdAPIReport 3 /* Report from other user of API */ #defineAifCmdDriverNotify 4 /* Notify host driver of event */ #defineAifDenMorphComplete 200 /* A morph operation completed */ @@ -1785,6 +1788,7 @@ struct aac_driver_ident* aac_get_driver_ident(int devtype); int aac_get_adapter_info(struct aac_dev* dev); int aac_send_shutdown(struct aac_dev *dev); +int probe_container(struct aac_dev *dev, int cid); extern int numacb; extern int acbsize; extern char aac_driver_version[]; Index: scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:17.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:23.0 -0700 @@ -39,6 +39,7 @@ #include #include #include +#include #include #include "aacraid.h" @@ -791,6 +792,291 @@ memset(cp, 0, 256); } + +/** + * aac_handle_aif - Handle a message from the firmware + * @dev: Which adapter this fib is from + * @fibptr: Pointer to fibptr from adapter + * + * This routine handles a driver notify fib from the adapter and + * dispatches it to the appropriate routine for handling. + */ + +static void aac_handle_aif(struct aac_dev * dev, struct fib * fibptr) +{ + struct hw_fib * hw_fib = fibptr->hw_fib; + struct aac_aifcmd * aifcmd = (struct aac_aifcmd *)hw_fib->data; + int busy; + u32 container; + struct scsi_device *device; + enum { + NOTHING, + DELETE, + ADD, + CHANGE + } device_config_needed; + + /* Sniff for container changes */ + + if (!dev) + return; + container = (u32)-1; + + /* +* We have set this up to try and minimize the number of +* re-configures that take place. As a result of this when +* certain AIF's come in we will set a flag waiting for another +* type of AIF before setting the re-config flag. +*/ + switch (le32_to_cpu(aifcmd->command)) { + case AifCmdDriverNotify: + switch (le32_to_cpu(((u32 *)aifcmd->data)[0])) { + /* +* Morph or Expand complete +
[PATCH 2/8] aacraid: AIF preallocation
Recevied from Mark Salyzyn from Adaptec. Aif pre-allocation is used to pull the kmalloc outside of the locks. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/commsup.c 2005-09-08 11:00:20.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/commsup.c 2005-09-08 11:32:17.0 -0700 @@ -805,7 +805,6 @@ { struct hw_fib *hw_fib, *hw_newfib; struct fib *fib, *newfib; - struct aac_queue_block *queues = dev->queues; struct aac_fib_context *fibctx; unsigned long flags; DECLARE_WAITQUEUE(wait, current); @@ -825,21 +824,22 @@ * Let the DPC know it has a place to send the AIF's to. */ dev->aif_thread = 1; - add_wait_queue(&queues->queue[HostNormCmdQueue].cmdready, &wait); + add_wait_queue(&dev->queues->queue[HostNormCmdQueue].cmdready, &wait); set_current_state(TASK_INTERRUPTIBLE); + dprintk ((KERN_INFO "aac_command_thread start\n")); while(1) { - spin_lock_irqsave(queues->queue[HostNormCmdQueue].lock, flags); - while(!list_empty(&(queues->queue[HostNormCmdQueue].cmdq))) { + spin_lock_irqsave(dev->queues->queue[HostNormCmdQueue].lock, flags); + while(!list_empty(&(dev->queues->queue[HostNormCmdQueue].cmdq))) { struct list_head *entry; struct aac_aifcmd * aifcmd; set_current_state(TASK_RUNNING); - - entry = queues->queue[HostNormCmdQueue].cmdq.next; + + entry = dev->queues->queue[HostNormCmdQueue].cmdq.next; list_del(entry); - - spin_unlock_irqrestore(queues->queue[HostNormCmdQueue].lock, flags); + + spin_unlock_irqrestore(dev->queues->queue[HostNormCmdQueue].lock, flags); fib = list_entry(entry, struct fib, fiblink); /* * We will process the FIB here or pass it to a @@ -869,9 +869,54 @@ u32 time_now, time_last; unsigned long flagv; + unsigned num; + struct hw_fib ** hw_fib_pool, ** hw_fib_p; + struct fib ** fib_pool, ** fib_p; time_now = jiffies/HZ; + /* +* Warning: no sleep allowed while +* holding spinlock. We take the estimate +* and pre-allocate a set of fibs outside the +* lock. +*/ + num = le32_to_cpu(dev->init->AdapterFibsSize) + / sizeof(struct hw_fib); /* some extra */ + spin_lock_irqsave(&dev->fib_lock, flagv); + entry = dev->fib_list.next; + while (entry != &dev->fib_list) { + entry = entry->next; + ++num; + } + spin_unlock_irqrestore(&dev->fib_lock, flagv); + hw_fib_pool = NULL; + fib_pool = NULL; + if (num +&& ((hw_fib_pool = kmalloc(sizeof(struct hw_fib *) * num, GFP_ATOMIC|GFP_KERNEL))) +&& ((fib_pool = kmalloc(sizeof(struct fib *) * num, GFP_ATOMIC|GFP_KERNEL { + hw_fib_p = hw_fib_pool; + fib_p = fib_pool; + while (hw_fib_p < &hw_fib_pool[num]) { + if (!(*(hw_fib_p++) = kmalloc(sizeof(struct hw_fib), GFP_ATOMIC|GFP_KERNEL))) { + --hw_fib_p; + break; + } + if (!(*(fib_p++) = kmalloc(sizeof(struct fib), GFP_ATOMIC|GFP_KERNEL))) { + kfree(*(--hw_fib_p)); + break; +
[PATCH 4/8] aacraid: add name to driver template
Received from Mark Salyzyn from Adaptec. This permits the system log to report the Adapter's branded name rather than the generic 'AAC' that it currently reports. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/linit.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/linit.c 2005-09-08 11:32:04.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/linit.c2005-09-08 11:32:27.0 -0700 @@ -765,6 +765,7 @@ pci_set_master(pdev); + aac_driver_template.name = aac_drivers[index].name; shost = scsi_host_alloc(&aac_driver_template, sizeof(struct aac_dev)); if (!shost) goto out_disable_pdev; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/8] aacraid driver updates
The following 8 patches contain various aacraid driver updates described in each mail. Patches apply to the latest scsi-misc-2.6 git tree. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 1/8] aacraid: Greater than 2TB capacity support
Received from Mark Salyzyn from Adaptec. Greater than 2TB capacity patch. There are a few adapters that are capable of creating devices with this large of a capacity, but now that we have the large fib support in, the management applications will be capable of generating them. The problem is, once they are created, the driver will not be able to access the devices correctly without this patch. Applies to the scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-2.orig/drivers/scsi/aacraid/aachba.c 2005-09-08 11:31:18.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/aacraid/aachba.c 2005-09-08 11:32:04.0 -0700 @@ -313,18 +313,37 @@ } dresp = (struct aac_mount *)fib_data(fibptr); + if ((le32_to_cpu(dresp->status) == ST_OK) && + (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { + dinfo->command = cpu_to_le32(VM_NameServe64); + dinfo->count = cpu_to_le32(index); + dinfo->type = cpu_to_le32(FT_FILESYS); + + if (fib_send(ContainerCommand, + fibptr, + sizeof(struct aac_query_mount), + FsaNormal, + 1, 1, + NULL, NULL) < 0) + continue; + } else + dresp->mnt[0].capacityhigh = 0; + dprintk ((KERN_DEBUG - "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%u\n", + "VM_NameServe cid=%d status=%d vol=%d state=%d cap=%llu\n", (int)index, (int)le32_to_cpu(dresp->status), (int)le32_to_cpu(dresp->mnt[0].vol), (int)le32_to_cpu(dresp->mnt[0].state), - (unsigned)le32_to_cpu(dresp->mnt[0].capacity))); + ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + + (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32))); if ((le32_to_cpu(dresp->status) == ST_OK) && (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { fsa_dev_ptr[index].valid = 1; fsa_dev_ptr[index].type = le32_to_cpu(dresp->mnt[0].vol); - fsa_dev_ptr[index].size = le32_to_cpu(dresp->mnt[0].capacity); + fsa_dev_ptr[index].size + = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + + (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32); if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) fsa_dev_ptr[index].ro = 1; } @@ -497,11 +516,29 @@ dresp = (struct aac_mount *) fib_data(fibptr); if ((le32_to_cpu(dresp->status) == ST_OK) && + (le32_to_cpu(dresp->mnt[0].vol) == CT_NONE)) { + dinfo->command = cpu_to_le32(VM_NameServe64); + dinfo->count = cpu_to_le32(cid); + dinfo->type = cpu_to_le32(FT_FILESYS); + + if (fib_send(ContainerCommand, + fibptr, + sizeof(struct aac_query_mount), + FsaNormal, + 1, 1, + NULL, NULL) < 0) + goto error; + } else + dresp->mnt[0].capacityhigh = 0; + + if ((le32_to_cpu(dresp->status) == ST_OK) && (le32_to_cpu(dresp->mnt[0].vol) != CT_NONE) && (le32_to_cpu(dresp->mnt[0].state) != FSCS_HIDDEN)) { fsa_dev_ptr[cid].valid = 1; fsa_dev_ptr[cid].type = le32_to_cpu(dresp->mnt[0].vol); - fsa_dev_ptr[cid].size = le32_to_cpu(dresp->mnt[0].capacity); + fsa_dev_ptr[cid].size + = ((u64)le32_to_cpu(dresp->mnt[0].capacity)) + + (((u64)le32_to_cpu(dresp->mnt[0].capacityhigh)) << 32); if (le32_to_cpu(dresp->mnt[0].state) & FSCS_READONLY) fsa_dev_ptr[cid].ro = 1; } @@ -854,7 +891,34 @@ dev = (struct aac_dev *)scsicmd->device->host->hostdata; cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); - dprintk((KERN_DEBUG "io_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] <<
[PATCH] aacraid: 2.6.13 aacraid bad BUG_ON fix
This was noticed by Doug Bazamic and the fix found by Mark Salyzyn at Adaptec. There was an error in the BUG_ON() statement that validated the calculated fib size which can cause the driver to panic. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> --- a/drivers/scsi/aacraid/aachba.c 2005-08-28 19:41:01.0 -0400 +++ b/drivers/scsi/aacraid/aachba.c 2005-09-01 08:05:29.118304656 -0400 @@ -968,7 +968,7 @@ fibsize = sizeof(struct aac_read64) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentry64)); - BUG_ON (fibsize > (sizeof(struct hw_fib) - + BUG_ON (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr))); /* * Now send the Fib to the adapter -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] scsi: /proc/scsi/scsi patch for large number of devices
I'm not sure if people care about /proc/scsi, but here is a patch so you can cat /proc/scsi/scsi when you have a large number of scsi devices. I have over 4000 devices configured and when I would cat /proc/scsi/scsi I would see a memory allocation error. I instead used the seq_file iterator to display the devices. The patch is a little brute force, but it only took about 2.5 seconds to display 4000 devices. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-2/drivers/scsi/scsi_proc.c === --- scsi-misc-aac-2.orig/drivers/scsi/scsi_proc.c 2005-08-22 11:53:41.0 -0700 +++ scsi-misc-aac-2/drivers/scsi/scsi_proc.c2005-08-23 08:45:09.0 -0700 @@ -43,6 +43,10 @@ /* Protect sht->present and sht->proc_dir */ static DECLARE_MUTEX(global_host_template_sem); +static struct device *proc_dev; +static loff_t dev_skip; +static DECLARE_MUTEX(proc_dev_sem); + static int proc_scsi_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data) { @@ -142,53 +146,6 @@ remove_proc_entry(name, shost->hostt->proc_dir); } -static int proc_print_scsidevice(struct device *dev, void *data) -{ - struct scsi_device *sdev = to_scsi_device(dev); - struct seq_file *s = data; - int i; - - seq_printf(s, - "Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n Vendor: ", - sdev->host->host_no, sdev->channel, sdev->id, sdev->lun); - for (i = 0; i < 8; i++) { - if (sdev->vendor[i] >= 0x20) - seq_printf(s, "%c", sdev->vendor[i]); - else - seq_printf(s, " "); - } - - seq_printf(s, " Model: "); - for (i = 0; i < 16; i++) { - if (sdev->model[i] >= 0x20) - seq_printf(s, "%c", sdev->model[i]); - else - seq_printf(s, " "); - } - - seq_printf(s, " Rev: "); - for (i = 0; i < 4; i++) { - if (sdev->rev[i] >= 0x20) - seq_printf(s, "%c", sdev->rev[i]); - else - seq_printf(s, " "); - } - - seq_printf(s, "\n"); - - seq_printf(s, " Type: %s ", -sdev->type < MAX_SCSI_DEVICE_CODE ? - scsi_device_types[(int) sdev->type] : "Unknown "); - seq_printf(s, " ANSI" -" SCSI revision: %02x", (sdev->scsi_level - 1) ? -sdev->scsi_level - 1 : 1); - if (sdev->scsi_level == 2) - seq_printf(s, " CCS\n"); - else - seq_printf(s, "\n"); - - return 0; -} static int scsi_add_single_device(uint host, uint channel, uint id, uint lun) { @@ -284,20 +241,101 @@ return err; } -static int proc_scsi_show(struct seq_file *s, void *p) + +static int proc_set_scsidevice(struct device *dev, void *data) +{ + if (dev_skip--) + return 0; + + proc_dev = dev; + return -ENXIO; +} + +static void *proc_dev_start(struct seq_file *s, loff_t *pos) { - seq_printf(s, "Attached devices:\n"); - bus_for_each_dev(&scsi_bus_type, NULL, s, proc_print_scsidevice); + down(&proc_dev_sem); + proc_dev = NULL; + dev_skip = *pos; + bus_for_each_dev(&scsi_bus_type, NULL, + NULL, proc_set_scsidevice); + return proc_dev; +} + +static void *proc_dev_next(struct seq_file *part, void *v, loff_t *pos) +{ + dev_skip = ++*pos; + proc_dev = NULL; + bus_for_each_dev(&scsi_bus_type, NULL, + NULL, proc_set_scsidevice); + return proc_dev; +} + +static void proc_dev_stop(struct seq_file *part, void *v) +{ + up(&proc_dev_sem); +} + +static int proc_dev_show(struct seq_file *s, void *data) +{ + struct scsi_device *sdev = to_scsi_device((struct device*)data); + int i; + + seq_printf(s, + "Host: scsi%d Channel: %02d Id: %02d Lun: %02d\n Vendor: ", + sdev->host->host_no, sdev->channel, + sdev->id, sdev->lun); + for (i = 0; i < 8; i++) { + if (sdev->vendor[i] >= 0x20) + seq_printf(s, "%c", sdev->vendor[i]); + else + seq_printf(s, " "); + } + + seq_printf(s, " Model: "); + for (i = 0; i < 16; i++) { + if (sdev->model[i] >= 0x20) + seq_printf(s, "%c&quo
RE: [PATCH] aacraid 2.6: Fix aacraid probe breakageinscsi-block-2.6.git (updated)
On Mon, 2005-08-15 at 13:28 -0400, Salyzyn, Mark wrote: > BTW, while applying this patch to my code, I discovered a missing > component (applied post patch) > > @@ -1389,4 +1369,5 @@ > setinqstr(cardtype, (void *) > (inq_data.inqd_vid), (sizeof(container_types)/sizeof(char *))); > inq_data.inqd_pdt = INQD_PDT_PROC; /* > Processor device */ > + aac_internal_transfer(scsicmd, > &inq_data, 0, sizeof(inq_data)); > scsicmd->result = DID_OK << 16 | > COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; > scsicmd->scsi_done(scsicmd); Your patch got line wrapped. I added you line to my patch and here is the complete one again. This patch fixes the bad assumption of the aacraid driver with use_sg. I used the 3w- driver fix as a guide for this. The patch applies to the scsi-block-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-block-2.6/drivers/scsi/aacraid/aachba.c === --- scsi-block-2.6.orig/drivers/scsi/aacraid/aachba.c 2005-08-10 09:10:56.0 -0700 +++ scsi-block-2.6/drivers/scsi/aacraid/aachba.c2005-08-15 10:44:07.0 -0700 @@ -348,6 +348,27 @@ spin_unlock_irqrestore(host->host_lock, cpu_flags); } +static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) +{ + void *buf; + unsigned int transfer_len; + struct scatterlist *sg = scsicmd->request_buffer; + + if (scsicmd->use_sg) { + buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; + transfer_len = min(sg->length, len + offset); + } else { + buf = scsicmd->request_buffer; + transfer_len = min(scsicmd->request_bufflen, len + offset); + } + + memcpy(buf + offset, data, transfer_len - offset); + + if (scsicmd->use_sg) + kunmap_atomic(buf - sg->offset, KM_IRQ0); + +} + static void get_container_name_callback(void *context, struct fib * fibptr) { struct aac_get_name_resp * get_name_reply; @@ -363,18 +384,22 @@ /* Failure is irrelevant, using default value instead */ if ((le32_to_cpu(get_name_reply->status) == CT_OK) && (get_name_reply->data[0] != '\0')) { - intcount; - char * dp; - char * sp = get_name_reply->data; + char *sp = get_name_reply->data; sp[sizeof(((struct aac_get_name_resp *)NULL)->data)-1] = '\0'; while (*sp == ' ') ++sp; - count = sizeof(((struct inquiry_data *)NULL)->inqd_pid); - dp = ((struct inquiry_data *)scsicmd->request_buffer)->inqd_pid; - if (*sp) do { - *dp++ = (*sp) ? *sp++ : ' '; - } while (--count > 0); + if (*sp) { + char d[sizeof(((struct inquiry_data *)NULL)->inqd_pid)]; + int count = sizeof(d); + char *dp = d; + do { + *dp++ = (*sp) ? *sp++ : ' '; + } while (--count > 0); + aac_internal_transfer(scsicmd, d, + offsetof(struct inquiry_data, inqd_pid), sizeof(d)); + } } + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; fib_complete(fibptr); @@ -1340,44 +1365,45 @@ switch (scsicmd->cmnd[0]) { case INQUIRY: { - struct inquiry_data *inq_data_ptr; + struct inquiry_data inq_data; dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id)); - inq_data_ptr = (struct inquiry_data *)scsicmd->request_buffer; - memset(inq_data_ptr, 0, sizeof (struct inquiry_data)); + memset(&inq_data, 0, sizeof (struct inquiry_data)); - inq_data_ptr->inqd_ver = 2; /* claim compliance to SCSI-2 */ - inq_data_ptr->inqd_dtq = 0x80; /* set RMB bit to one indicating that the medium is removable */ - inq_data_ptr->inqd_rdf = 2; /* A response data format value of two indicates that the data shall be in the format specified in SCSI-2 */ - inq_data_ptr->inqd_len = 31; + inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ + inq_data.inqd_dtq = 0x80; /* set RMB bit to one indicating that the medium is removable */ + inq_data.inqd_rdf = 2; /* A response data format value of two indicates
[PATCH] aacraid 2.6: Fix aacraid probe breakage in scsi-block-2.6.git
On Wed, 2005-08-10 at 12:27 -0500, James Bottomley wrote: > On Wed, 2005-08-10 at 10:20 -0700, Mark Haverkamp wrote: > > While trying out a recent mm kernel I noticed that when I loaded the > > aacraid driver I saw errors probing the disks: > > > > sdc : sector size 0 reported, assuming 512. > > SCSI device sdc: 1 512-byte hdwr sectors (0 MB) > > Sigh, I guess this is because aacraid is making illegal assumptions > about the format of certain commands it emulates? > > We had a similar issue with 3w- which assumed commands like INQUIRY, > READ_CAPACITY and MODE_SENSE only came from the kernel, so would never > have use_sg != 0. This is, of course, wrong, since such commands can > and do come from SG_IO. > > The fix is probably similar to the 3w- one. > > James This patch fixes the bad assumption of the aacraid driver with use_sg. I used the 3w- driver fix as a guide for this. The patch applies to the scsi-block-2.6 git tree. Is that the right place for the patch? Should it be applied to the scsi-misc or the scsi- rc-fixes tree instead? Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-block-2.6/drivers/scsi/aacraid/aachba.c === --- scsi-block-2.6.orig/drivers/scsi/aacraid/aachba.c 2005-08-10 09:10:56.0 -0700 +++ scsi-block-2.6/drivers/scsi/aacraid/aachba.c2005-08-12 14:20:32.0 -0700 @@ -348,6 +348,27 @@ spin_unlock_irqrestore(host->host_lock, cpu_flags); } +static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigned int offset, unsigned int len) +{ + void *buf; + unsigned int transfer_len; + struct scatterlist *sg = scsicmd->request_buffer; + + if (scsicmd->use_sg) { + buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; + transfer_len = min(sg->length, len + offset); + } else { + buf = scsicmd->request_buffer; + transfer_len = min(scsicmd->request_bufflen, len + offset); + } + + memcpy(buf + offset, data, transfer_len - offset); + + if (scsicmd->use_sg) + kunmap_atomic(buf - sg->offset, KM_IRQ0); + +} + static void get_container_name_callback(void *context, struct fib * fibptr) { struct aac_get_name_resp * get_name_reply; @@ -363,18 +384,22 @@ /* Failure is irrelevant, using default value instead */ if ((le32_to_cpu(get_name_reply->status) == CT_OK) && (get_name_reply->data[0] != '\0')) { - intcount; - char * dp; - char * sp = get_name_reply->data; + char *sp = get_name_reply->data; sp[sizeof(((struct aac_get_name_resp *)NULL)->data)-1] = '\0'; while (*sp == ' ') ++sp; - count = sizeof(((struct inquiry_data *)NULL)->inqd_pid); - dp = ((struct inquiry_data *)scsicmd->request_buffer)->inqd_pid; - if (*sp) do { - *dp++ = (*sp) ? *sp++ : ' '; - } while (--count > 0); + if (*sp) { + char d[sizeof(((struct inquiry_data *)NULL)->inqd_pid)]; + int count = sizeof(d); + char *dp = d; + do { + *dp++ = (*sp) ? *sp++ : ' '; + } while (--count > 0); + aac_internal_transfer(scsicmd, d, + offsetof(struct inquiry_data, inqd_pid), sizeof(d)); + } } + scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; fib_complete(fibptr); @@ -1340,44 +1365,44 @@ switch (scsicmd->cmnd[0]) { case INQUIRY: { - struct inquiry_data *inq_data_ptr; + struct inquiry_data inq_data; dprintk((KERN_DEBUG "INQUIRY command, ID: %d.\n", scsicmd->device->id)); - inq_data_ptr = (struct inquiry_data *)scsicmd->request_buffer; - memset(inq_data_ptr, 0, sizeof (struct inquiry_data)); + memset(&inq_data, 0, sizeof (struct inquiry_data)); - inq_data_ptr->inqd_ver = 2; /* claim compliance to SCSI-2 */ - inq_data_ptr->inqd_dtq = 0x80; /* set RMB bit to one indicating that the medium is removable */ - inq_data_ptr->inqd_rdf = 2; /* A response data format value of two indicates that the data shall be in the format specified in SCSI-2 */ - inq_data_ptr->inqd_len = 31; + inq_data.inqd_ver = 2; /* claim compliance to SCSI-2 */ + inq_data.inqd_dtq = 0x80;
aacraid probe breaks in scsi-block-2.6.git
While trying out a recent mm kernel I noticed that when I loaded the aacraid driver I saw errors probing the disks: sdc : sector size 0 reported, assuming 512. SCSI device sdc: 1 512-byte hdwr sectors (0 MB) Normally I see: SCSI device sdc: 71091456 512-byte hdwr sectors (36399 MB) I went back and tried scsi-misc-2.6 and was OK, I tried scsi-rc-2.6 and was OK, then I tried scsi-block-2.6 and got the same errors. I didn't see any kind of I/O errors on the console on in the log. I've included my .config. I'll try to look through the changes in the git tree, but if anyone has an idea for debugging it, or other information that I could provide, would be appreciated. Thanks, Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> # # Automatically generated make config: don't edit # Linux kernel version: 2.6.13-rc3 # Wed Aug 10 09:21:36 2005 # CONFIG_X86=y CONFIG_MMU=y CONFIG_UID16=y CONFIG_GENERIC_ISA_DMA=y CONFIG_GENERIC_IOMAP=y # # Code maturity level options # CONFIG_EXPERIMENTAL=y CONFIG_CLEAN_COMPILE=y CONFIG_LOCK_KERNEL=y CONFIG_INIT_ENV_ARG_LIMIT=32 # # General setup # CONFIG_LOCALVERSION="-sblk" CONFIG_SWAP=y CONFIG_SYSVIPC=y # CONFIG_POSIX_MQUEUE is not set CONFIG_BSD_PROCESS_ACCT=y # CONFIG_BSD_PROCESS_ACCT_V3 is not set CONFIG_SYSCTL=y # CONFIG_AUDIT is not set CONFIG_HOTPLUG=y CONFIG_KOBJECT_UEVENT=y CONFIG_IKCONFIG=y CONFIG_IKCONFIG_PROC=y # CONFIG_CPUSETS is not set # CONFIG_EMBEDDED is not set CONFIG_KALLSYMS=y # CONFIG_KALLSYMS_ALL is not set # CONFIG_KALLSYMS_EXTRA_PASS is not set CONFIG_PRINTK=y CONFIG_BUG=y CONFIG_BASE_FULL=y CONFIG_FUTEX=y CONFIG_EPOLL=y CONFIG_SHMEM=y CONFIG_CC_ALIGN_FUNCTIONS=0 CONFIG_CC_ALIGN_LABELS=0 CONFIG_CC_ALIGN_LOOPS=0 CONFIG_CC_ALIGN_JUMPS=0 # CONFIG_TINY_SHMEM is not set CONFIG_BASE_SMALL=0 # # Loadable module support # CONFIG_MODULES=y CONFIG_MODULE_UNLOAD=y CONFIG_MODULE_FORCE_UNLOAD=y CONFIG_OBSOLETE_MODPARM=y # CONFIG_MODVERSIONS is not set # CONFIG_MODULE_SRCVERSION_ALL is not set # CONFIG_KMOD is not set CONFIG_STOP_MACHINE=y # # Processor type and features # CONFIG_X86_PC=y # CONFIG_X86_ELAN is not set # CONFIG_X86_VOYAGER is not set # CONFIG_X86_NUMAQ is not set # CONFIG_X86_SUMMIT is not set # CONFIG_X86_BIGSMP is not set # CONFIG_X86_VISWS is not set # CONFIG_X86_GENERICARCH is not set # CONFIG_X86_ES7000 is not set # CONFIG_M386 is not set # CONFIG_M486 is not set # CONFIG_M586 is not set # CONFIG_M586TSC is not set # CONFIG_M586MMX is not set # CONFIG_M686 is not set # CONFIG_MPENTIUMII is not set CONFIG_MPENTIUMIII=y # CONFIG_MPENTIUMM is not set # CONFIG_MPENTIUM4 is not set # CONFIG_MK6 is not set # CONFIG_MK7 is not set # CONFIG_MK8 is not set # CONFIG_MCRUSOE is not set # CONFIG_MEFFICEON is not set # CONFIG_MWINCHIPC6 is not set # CONFIG_MWINCHIP2 is not set # CONFIG_MWINCHIP3D is not set # CONFIG_MGEODEGX1 is not set # CONFIG_MCYRIXIII is not set # CONFIG_MVIAC3_2 is not set CONFIG_X86_GENERIC=y CONFIG_X86_CMPXCHG=y CONFIG_X86_XADD=y CONFIG_X86_L1_CACHE_SHIFT=7 CONFIG_RWSEM_XCHGADD_ALGORITHM=y CONFIG_GENERIC_CALIBRATE_DELAY=y CONFIG_X86_WP_WORKS_OK=y CONFIG_X86_INVLPG=y CONFIG_X86_BSWAP=y CONFIG_X86_POPAD_OK=y CONFIG_X86_GOOD_APIC=y CONFIG_X86_INTEL_USERCOPY=y CONFIG_X86_USE_PPRO_CHECKSUM=y CONFIG_HPET_TIMER=y CONFIG_SMP=y CONFIG_NR_CPUS=8 # CONFIG_SCHED_SMT is not set CONFIG_PREEMPT_NONE=y # CONFIG_PREEMPT_VOLUNTARY is not set # CONFIG_PREEMPT is not set CONFIG_PREEMPT_BKL=y CONFIG_X86_LOCAL_APIC=y CONFIG_X86_IO_APIC=y CONFIG_X86_TSC=y CONFIG_X86_MCE=y # CONFIG_X86_MCE_NONFATAL is not set # CONFIG_X86_MCE_P4THERMAL is not set # CONFIG_TOSHIBA is not set # CONFIG_I8K is not set # CONFIG_X86_REBOOTFIXUPS is not set CONFIG_MICROCODE=y CONFIG_X86_MSR=y CONFIG_X86_CPUID=y # # Firmware Drivers # # CONFIG_EDD is not set # CONFIG_NOHIGHMEM is not set # CONFIG_HIGHMEM4G is not set CONFIG_HIGHMEM64G=y CONFIG_HIGHMEM=y CONFIG_X86_PAE=y CONFIG_SELECT_MEMORY_MODEL=y CONFIG_FLATMEM_MANUAL=y # CONFIG_DISCONTIGMEM_MANUAL is not set # CONFIG_SPARSEMEM_MANUAL is not set CONFIG_FLATMEM=y CONFIG_FLAT_NODE_MEM_MAP=y CONFIG_HIGHPTE=y # CONFIG_MATH_EMULATION is not set CONFIG_MTRR=y CONFIG_IRQBALANCE=y CONFIG_HAVE_DEC_LOCK=y # CONFIG_REGPARM is not set CONFIG_SECCOMP=y # CONFIG_HZ_100 is not set # CONFIG_HZ_250 is not set CONFIG_HZ_1000=y CONFIG_HZ=1000 CONFIG_PHYSICAL_START=0x10 # CONFIG_KEXEC is not set # # Power management options (ACPI, APM) # CONFIG_PM=y # CONFIG_PM_DEBUG is not set # CONFIG_SOFTWARE_SUSPEND is not set # # ACPI (Advanced Configuration and Power Interface) Support # # CONFIG_ACPI is not set # # APM (Advanced Power Management) BIOS Support # # CONFIG_APM is not set # # CPU Frequency scaling # # CONFIG_CPU_FREQ is not set # # Bus options (PCI, PCMCIA, EISA, MCA, ISA) # CONFIG_PCI=y # CONFIG_PCI_GOBIOS is not set # CONFIG_PCI_GOMMCONFIG is not set # CONFIG_PCI_GODIRECT is not set CONFIG_PCI_GOANY=y CONFIG_PCI_BIOS=y CONFIG_PCI_DIRECT=y # CONFIG_PCIEPORTBUS is not set # CONFIG_PCI_MSI is not set
[PATCH] aacraid: adapter support update
Received from Mark Salyzyn This patch adds the product ID for the ICP9067MA adapter. The entries for the ICP9085LI, ICP5085BR, IBM8k & ASR4810SAS were incorrect and would not initialize the adapters correctly. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/linit.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/linit.c 2005-08-08 09:11:56.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/linit.c2005-08-08 11:04:51.0 -0700 @@ -120,36 +120,39 @@ { 0x9005, 0x0286, 0x9005, 0x02a3, 0, 0, 29 }, /* ICP5085AU (Hurricane) */ { 0x9005, 0x0285, 0x9005, 0x02a4, 0, 0, 30 }, /* ICP9085LI (Marauder-X) */ { 0x9005, 0x0285, 0x9005, 0x02a5, 0, 0, 31 }, /* ICP5085BR (Marauder-E) */ - { 0x9005, 0x0287, 0x9005, 0x0800, 0, 0, 32 }, /* Themisto Jupiter Platform */ - { 0x9005, 0x0200, 0x9005, 0x0200, 0, 0, 32 }, /* Themisto Jupiter Platform */ - { 0x9005, 0x0286, 0x9005, 0x0800, 0, 0, 33 }, /* Callisto Jupiter Platform */ - { 0x9005, 0x0285, 0x9005, 0x028e, 0, 0, 34 }, /* ASR-2020SA SATA PCI-X ZCR (Skyhawk) */ - { 0x9005, 0x0285, 0x9005, 0x028f, 0, 0, 35 }, /* ASR-2025SA SATA SO-DIMM PCI-X ZCR (Terminator) */ - { 0x9005, 0x0285, 0x9005, 0x0290, 0, 0, 36 }, /* AAR-2410SA PCI SATA 4ch (Jaguar II) */ - { 0x9005, 0x0285, 0x1028, 0x0291, 0, 0, 37 }, /* CERC SATA RAID 2 PCI SATA 6ch (DellCorsair) */ - { 0x9005, 0x0285, 0x9005, 0x0292, 0, 0, 38 }, /* AAR-2810SA PCI SATA 8ch (Corsair-8) */ - { 0x9005, 0x0285, 0x9005, 0x0293, 0, 0, 39 }, /* AAR-21610SA PCI SATA 16ch (Corsair-16) */ - { 0x9005, 0x0285, 0x9005, 0x0294, 0, 0, 40 }, /* ESD SO-DIMM PCI-X SATA ZCR (Prowler) */ - { 0x9005, 0x0285, 0x103C, 0x3227, 0, 0, 41 }, /* AAR-2610SA PCI SATA 6ch */ - { 0x9005, 0x0285, 0x9005, 0x0296, 0, 0, 42 }, /* ASR-2240S (SabreExpress) */ - { 0x9005, 0x0285, 0x9005, 0x0297, 0, 0, 43 }, /* ASR-4005SAS */ - { 0x9005, 0x0285, 0x1014, 0x02F2, 0, 0, 44 }, /* IBM 8i (AvonPark) */ - { 0x9005, 0x0285, 0x1014, 0x0312, 0, 0, 44 }, /* IBM 8i (AvonPark Lite) */ - { 0x9005, 0x0285, 0x9005, 0x0298, 0, 0, 45 }, /* ASR-4000SAS (BlackBird) */ - { 0x9005, 0x0285, 0x9005, 0x0299, 0, 0, 46 }, /* ASR-4800SAS (Marauder-X) */ - { 0x9005, 0x0285, 0x9005, 0x029a, 0, 0, 47 }, /* ASR-4805SAS (Marauder-E) */ - { 0x9005, 0x0286, 0x9005, 0x02a2, 0, 0, 48 }, /* ASR-4810SAS (Hurricane */ - - { 0x9005, 0x0285, 0x1028, 0x0287, 0, 0, 49 }, /* Perc 320/DC*/ - { 0x1011, 0x0046, 0x9005, 0x0365, 0, 0, 50 }, /* Adaptec 5400S (Mustang)*/ - { 0x1011, 0x0046, 0x9005, 0x0364, 0, 0, 51 }, /* Adaptec 5400S (Mustang)*/ - { 0x1011, 0x0046, 0x9005, 0x1364, 0, 0, 52 }, /* Dell PERC2/QC */ - { 0x1011, 0x0046, 0x103c, 0x10c2, 0, 0, 53 }, /* HP NetRAID-4M */ - - { 0x9005, 0x0285, 0x1028, PCI_ANY_ID, 0, 0, 54 }, /* Dell Catchall */ - { 0x9005, 0x0285, 0x17aa, PCI_ANY_ID, 0, 0, 55 }, /* Legend Catchall */ - { 0x9005, 0x0285, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 56 }, /* Adaptec Catch All */ - { 0x9005, 0x0286, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 57 }, /* Adaptec Rocket Catch All */ + { 0x9005, 0x0286, 0x9005, 0x02a6, 0, 0, 32 }, /* ICP9067MA (Intruder-6) */ + { 0x9005, 0x0287, 0x9005, 0x0800, 0, 0, 33 }, /* Themisto Jupiter Platform */ + { 0x9005, 0x0200, 0x9005, 0x0200, 0, 0, 33 }, /* Themisto Jupiter Platform */ + { 0x9005, 0x0286, 0x9005, 0x0800, 0, 0, 34 }, /* Callisto Jupiter Platform */ + { 0x9005, 0x0285, 0x9005, 0x028e, 0, 0, 35 }, /* ASR-2020SA SATA PCI-X ZCR (Skyhawk) */ + { 0x9005, 0x0285, 0x9005, 0x028f, 0, 0, 36 }, /* ASR-2025SA SATA SO-DIMM PCI-X ZCR (Terminator) */ + { 0x9005, 0x0285, 0x9005, 0x0290, 0, 0, 37 }, /* AAR-2410SA PCI SATA 4ch (Jaguar II) */ + { 0x9005, 0x0285, 0x1028, 0x0291, 0, 0, 38 }, /* CERC SATA RAID 2 PCI SATA 6ch (DellCorsair) */ + { 0x9005, 0x0285, 0x9005, 0x0292, 0, 0, 39 }, /* AAR-2810SA PCI SATA 8ch (Corsair-8) */ + { 0x9005, 0x0285, 0x9005, 0x0293, 0, 0, 40 }, /* AAR-21610SA PCI SATA 16ch (Corsair-16) */ + { 0x9005, 0x0285, 0x9005, 0x0294, 0, 0, 41 }, /* ESD SO-DIMM PCI-X SATA ZCR (Prowler) */ + { 0x9005, 0x0285, 0x103C, 0x3227, 0, 0, 42 }, /* AAR-2610SA PCI SATA 6ch */ + { 0x9005, 0x0285, 0x9005, 0x0296, 0, 0, 43 }, /* ASR-2240S (SabreExpress) */ + { 0x9005, 0x0285, 0x9005, 0x0297, 0, 0, 44 }, /* ASR-4005SAS */ + { 0x9005, 0x0285, 0x1014, 0x02F2, 0, 0, 45 }, /* IBM 8i (AvonPark) */ + { 0x9005, 0x0285, 0x1014, 0x0312, 0, 0, 45 }, /* IBM 8i (AvonPark Lite) */ + { 0x9005, 0x0286, 0x1014, 0x9580, 0, 0, 46 }, /* IBM 8k/8k-l8 (Aurora) */ + { 0x9005, 0x0286, 0x1014, 0x9540, 0, 0, 47 }, /* IBM 8k/8k-l4 (Aurora Lite) */ + { 0x9005, 0x0285, 0x9005, 0x0298
Re: [PATCH] aacraid: correct use of cmd->timeout field
On Fri, 2005-08-05 at 16:31 -0500, James Bottomley wrote: > The cmd->timeout field has been obsolete for a while now. While looking > to remove it, I came across this use in the aacraid driver. It looks > like you want to initialise the firmware with the current timeout of the > command (in seconds), so the value I think you should be using is cmd- > >timeout_per_command. It looks that way to me too. Is scsicmd->timeout even set anywhere? I didn't find any. Mark. > > James > > diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c > --- a/drivers/scsi/aacraid/aachba.c > +++ b/drivers/scsi/aacraid/aachba.c > @@ -1894,7 +1893,7 @@ static int aac_send_srb_fib(struct scsi_ > srbcmd->id = cpu_to_le32(scsicmd->device->id); > srbcmd->lun = cpu_to_le32(scsicmd->device->lun); > srbcmd->flags= cpu_to_le32(flag); > - timeout = (scsicmd->timeout-jiffies)/HZ; > + timeout = scsicmd->timeout_per_command/HZ; > if(timeout == 0){ > timeout = 1; > } > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH 7/7] aacraid: sgraw command support
On Thu, 2005-08-04 at 07:40 -0400, Salyzyn, Mark wrote: > In these cases, the 'addr' is an u64, so is it necessary to perform this > modification? Arjan, Do you agree with the above? If so, is the patch OK as is? Thanks, Mark. > > I will do a critical analysis of the remaining code in the driver for > any values that are, or have a risk of being on some platforms, a 32 bit > entity and undergo this kind of shift action. > > Sincerely -- Mark Salyzyn > > -Original Message- > From: Arjan van de Ven [mailto:[EMAIL PROTECTED] > Sent: Thursday, August 04, 2005 4:17 AM > To: Mark Haverkamp > Cc: Salyzyn, Mark; linux-scsi; James Bottomley > Subject: Re: [PATCH 7/7] aacraid: sgraw command support > > On Wed, 2005-08-03 at 15:39 -0700, Mark Haverkamp wrote: > > + psg->sg[0].addr[1] = cpu_to_le32((u32)(addr>>32)); > > this is very risky code; if addr is a 32 bit entity, then this is > undefined behavior (which due to the vagities of x86 asm might get > optimized out entirely). It is a lot safer to do (addr>>16)>>16 > > gcc will optimize that just fine, the difference is that it's still > defined C behavior regardless of the type of addr. > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 0/7] aacraid driver updates
The following 7 patches contain various aacraid driver updates described in each mail. Some patches have been sent out previously. All have been re-diffed to make sure that they apply to the latest scsi-misc-2.6 git tree. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 7/7] aacraid: sgraw command support
Received from Mark Salyzyn from Adaptec: This patch adds support for the new raw io command. This new command offers much larger io commands, is more friendly to the internal firmware structure requiring less translation efforts by the firmware and offers support for targets greater than 2TB (patch to support >2TB will be sent in the future). Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/aachba.c 2005-07-05 13:55:51.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/aachba.c 2005-07-05 15:12:05.0 -0700 @@ -133,6 +133,7 @@ static unsigned long aac_build_sg(struct scsi_cmnd* scsicmd, struct sgmap* sgmap); static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg); +static unsigned long aac_build_sgraw(struct scsi_cmnd* scsicmd, struct sgmapraw* psg); static int aac_send_srb_fib(struct scsi_cmnd* scsicmd); #ifdef AAC_DETAILED_STATUS_INFO static char *aac_get_status_string(u32 status); @@ -777,34 +778,36 @@ /* * 57 scatter gather elements */ - dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write) + sizeof(struct sgmap)) / - sizeof(struct sgmap); - if (dev->dac_support) { - /* -* 38 scatter gather elements -*/ - dev->scsi_host_ptr->sg_tablesize = - (dev->max_fib_size - + if (!(dev->raw_io_interface)) { + dev->scsi_host_ptr->sg_tablesize = (dev->max_fib_size - sizeof(struct aac_fibhdr) - - sizeof(struct aac_write64) + - sizeof(struct sgmap64)) / - sizeof(struct sgmap64); - } - dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; - if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { - /* -* Worst case size that could cause sg overflow when -* we break up SG elements that are larger than 64KB. -* Would be nice if we could tell the SCSI layer what -* the maximum SG element size can be. Worst case is -* (sg_tablesize-1) 4KB elements with one 64KB -* element. -* 32bit -> 468 or 238KB 64bit -> 424 or 212KB -*/ - dev->scsi_host_ptr->max_sectors = - (dev->scsi_host_ptr->sg_tablesize * 8) + 112; + sizeof(struct aac_write) + sizeof(struct sgmap)) / + sizeof(struct sgmap); + if (dev->dac_support) { + /* +* 38 scatter gather elements +*/ + dev->scsi_host_ptr->sg_tablesize = + (dev->max_fib_size - + sizeof(struct aac_fibhdr) - + sizeof(struct aac_write64) + + sizeof(struct sgmap64)) / + sizeof(struct sgmap64); + } + dev->scsi_host_ptr->max_sectors = AAC_MAX_32BIT_SGBCOUNT; + if(!(dev->adapter_info.options & AAC_OPT_NEW_COMM)) { + /* +* Worst case size that could cause sg overflow when +* we break up SG elements that are larger than 64KB. +* Would be nice if we could tell the SCSI layer what +* the maximum SG element size can be. Worst case is +* (sg_tablesize-1) 4KB elements with one 64KB +* element. +* 32bit -> 468 or 238KB 64bit -> 424 or 212KB +*/ + dev->scsi_host_ptr->max_sectors = + (dev->scsi_host_ptr->sg_tablesize * 8) + 112; + } } fib_complete(fibptr); @@ -905,7 +908,32 @@ fib_init(cmd_fibcontext); - if (dev->dac_support == 1) { + if (dev->raw_io_interface) { + struct aac_raw_io *readcmd; + readcmd = (struct aac_raw_io *) fib_data(cmd_fibcontext); + readcmd->block[0] = cpu_to_le32(lba); + readcmd->block[1] = 0; + readcmd->count = cpu_to_le32(count<<9); + readcmd->cid = cpu_to_le16(cid); + readcmd->flags = cpu_to_le16(1); + readcmd->bpTotal = 0; + readcmd->bpComple
[PATCH 6/7] aacraid: unlock around kfree
Received from Mark Salyzyn from Adaptec: kfree has the possibility of sleeping. It is generally considered poor manners to hold on to a lock with the possibility of a system call induced sleep. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/commctrl.c2005-07-05 14:18:07.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c 2005-07-05 14:59:24.0 -0700 @@ -324,8 +324,10 @@ /* * Free the space occupied by this copy of the fib. */ + spin_unlock_irq(&dev->fib_lock); kfree(fib->hw_fib); kfree(fib); + spin_lock_irq(&dev->fib_lock); } /* * Remove the Context from the AdapterFibContext List @@ -338,7 +340,9 @@ /* * Free the space occupied by the Context */ + spin_unlock_irq(&dev->fib_lock); kfree(fibctx); + spin_lock_irq(&dev->fib_lock); return 0; } -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 5/7] aacraid: aif registration timeout fix
Received from Mark Salyzyn from Adaptec: If the Adapter is quiet and does not produce an AIF event packets to be picked up by the management applications for longer than the timeout interval of two minutes, the cleanup code that deals with aging out registrants could erroneously drop the registration. The timeout is there to clean up should the management application die and fail to poll for updated AIF event packets. Moving the timer update from the ioctl code that delivers an AIF to the polling registrant to the bottom of the ioctl means the timeout is reset with any management application polling activity regardless if an AIF is delivered or not removing the erroneous timeout cleanups. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/commctrl.c2005-07-01 11:49:36.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c 2005-07-05 14:18:07.0 -0700 @@ -287,7 +287,6 @@ kfree(fib->hw_fib); kfree(fib); status = 0; - fibctx->jiffies = jiffies/HZ; } else { spin_unlock_irqrestore(&dev->fib_lock, flags); if (f.wait) { @@ -302,6 +301,7 @@ status = -EAGAIN; } } + fibctx->jiffies = jiffies/HZ; return status; } -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 4/7] aacraid: remove duplcate io callback code
Received from Mark Salyzyn from Adaptec: This patch removes the duplicate code in the write_callback command completion handler, and renames read_callback to io_callback. Optimized the lba calculation into the debug print routine macro to optimize the i/o code path. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/aachba.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/aachba.c 2005-07-01 11:43:00.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/aachba.c 2005-07-05 13:55:51.0 -0700 @@ -814,12 +814,11 @@ } -static void read_callback(void *context, struct fib * fibptr) +static void io_callback(void *context, struct fib * fibptr) { struct aac_dev *dev; struct aac_read_reply *readreply; struct scsi_cmnd *scsicmd; - u32 lba; u32 cid; scsicmd = (struct scsi_cmnd *) context; @@ -827,8 +826,7 @@ dev = (struct aac_dev *)scsicmd->device->host->hostdata; cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); - lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; - dprintk((KERN_DEBUG "read_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), lba, jiffies)); + dprintk((KERN_DEBUG "io_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3], jiffies)); if (fibptr == NULL) BUG(); @@ -847,7 +845,7 @@ scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; else { #ifdef AAC_DETAILED_STATUS_INFO - printk(KERN_WARNING "read_callback: io failed, status = %d\n", + printk(KERN_WARNING "io_callback: io failed, status = %d\n", le32_to_cpu(readreply->status)); #endif scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; @@ -867,53 +865,6 @@ aac_io_done(scsicmd); } -static void write_callback(void *context, struct fib * fibptr) -{ - struct aac_dev *dev; - struct aac_write_reply *writereply; - struct scsi_cmnd *scsicmd; - u32 lba; - u32 cid; - - scsicmd = (struct scsi_cmnd *) context; - dev = (struct aac_dev *)scsicmd->device->host->hostdata; - cid = ID_LUN_TO_CONTAINER(scsicmd->device->id, scsicmd->device->lun); - - lba = ((scsicmd->cmnd[1] & 0x1F) << 16) | (scsicmd->cmnd[2] << 8) | scsicmd->cmnd[3]; - dprintk((KERN_DEBUG "write_callback[cpu %d]: lba = %u, t = %ld.\n", smp_processor_id(), lba, jiffies)); - if (fibptr == NULL) - BUG(); - - if(scsicmd->use_sg) - pci_unmap_sg(dev->pdev, - (struct scatterlist *)scsicmd->buffer, - scsicmd->use_sg, - scsicmd->sc_data_direction); - else if(scsicmd->request_bufflen) - pci_unmap_single(dev->pdev, scsicmd->SCp.dma_handle, -scsicmd->request_bufflen, -scsicmd->sc_data_direction); - - writereply = (struct aac_write_reply *) fib_data(fibptr); - if (le32_to_cpu(writereply->status) == ST_OK) - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; - else { - printk(KERN_WARNING "write_callback: write failed, status = %d\n", writereply->status); - scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; - set_sense((u8 *) &dev->fsa_dev[cid].sense_data, - HARDWARE_ERROR, - SENCODE_INTERNAL_TARGET_FAILURE, - ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, - 0, 0); - memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, - sizeof(struct sense_data)); - } - - fib_complete(fibptr); - fib_free(fibptr); - aac_io_done(scsicmd); -} - static int aac_read(struct scsi_cmnd * scsicmd, int cid) { u32 lba; @@ -978,7 +929,7 @@ fibsize, FsaNormal, 0, 1, - (fib_callback) read_callback, + (fib_callback) io_callback, (void *) scsicmd); } else { struct aac_read *readcmd; @@ -1002,7 +953,
[PATCH 2/7] aacraid: driver version update
Received from Mark Salyzyn from Adaptec. Fixes a bug in check_revision. It should return the driver version not the firmware version. Update driver version number. Update driver version string. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/aacraid.h 2005-07-01 11:43:00.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/aacraid.h 2005-07-01 11:49:36.0 -0700 @@ -1512,11 +1512,12 @@ struct revision { - u32 compat; - u32 version; - u32 build; + __le32 compat; + __le32 version; + __le32 build; }; + /* * Ugly - non Linux like ioctl coding for back compat. */ @@ -1737,3 +1738,4 @@ int aac_send_shutdown(struct aac_dev *dev); extern int numacb; extern int acbsize; +extern char aac_driver_version[]; Index: scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/commctrl.c2005-07-01 11:43:00.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/commctrl.c 2005-07-01 11:49:36.0 -0700 @@ -405,10 +405,20 @@ static int check_revision(struct aac_dev *dev, void __user *arg) { struct revision response; + char *driver_version = aac_driver_version; + u32 version; - response.compat = 1; - response.version = le32_to_cpu(dev->adapter_info.kernelrev); - response.build = le32_to_cpu(dev->adapter_info.kernelbuild); + response.compat = cpu_to_le32(1); + version = (simple_strtol(driver_version, + &driver_version, 10) << 24) | 0x0400; + version += simple_strtol(driver_version + 1, &driver_version, 10) << 16; + version += simple_strtol(driver_version + 1, NULL, 10); + response.version = cpu_to_le32(version); +# if (defined(AAC_DRIVER_BUILD)) + response.build = cpu_to_le32(AAC_DRIVER_BUILD); +# else + response.build = cpu_to_le32(); +# endif if (copy_to_user(arg, &response, sizeof(response))) return -EFAULT; Index: scsi-misc-aac-1/drivers/scsi/aacraid/linit.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/linit.c 2005-07-01 11:43:01.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/linit.c2005-07-01 11:49:36.0 -0700 @@ -27,8 +27,11 @@ * Abstract: Linux Driver entry module for Adaptec RAID Array Controller */ -#define AAC_DRIVER_VERSION "1.1.2-lk2" -#define AAC_DRIVER_BUILD_DATE __DATE__ +#define AAC_DRIVER_VERSION "1.1-4" +#ifndef AAC_DRIVER_BRANCH +#define AAC_DRIVER_BRANCH "" +#endif +#define AAC_DRIVER_BUILD_DATE __DATE__ " " __TIME__ #define AAC_DRIVERNAME "aacraid" #include @@ -58,16 +61,24 @@ #include "aacraid.h" +#ifdef AAC_DRIVER_BUILD +#define _str(x) #x +#define str(x) _str(x) +#define AAC_DRIVER_FULL_VERSIONAAC_DRIVER_VERSION "[" str(AAC_DRIVER_BUILD) "]" AAC_DRIVER_BRANCH +#else +#define AAC_DRIVER_FULL_VERSIONAAC_DRIVER_VERSION AAC_DRIVER_BRANCH " " AAC_DRIVER_BUILD_DATE +#endif MODULE_AUTHOR("Red Hat Inc and Adaptec"); MODULE_DESCRIPTION("Dell PERC2, 2/Si, 3/Si, 3/Di, " "Adaptec Advanced Raid Products, " "and HP NetRAID-4M SCSI driver"); MODULE_LICENSE("GPL"); -MODULE_VERSION(AAC_DRIVER_VERSION); +MODULE_VERSION(AAC_DRIVER_FULL_VERSION); static LIST_HEAD(aac_devices); static int aac_cfg_major = -1; +char aac_driver_version[] = AAC_DRIVER_FULL_VERSION; /* * Because of the way Linux names scsi devices, the order in this table has @@ -896,8 +907,8 @@ { int error; - printk(KERN_INFO "Red Hat/Adaptec aacraid driver (%s %s)\n", - AAC_DRIVER_VERSION, AAC_DRIVER_BUILD_DATE); + printk(KERN_INFO "Adaptec %s driver (%s)\n", + AAC_DRIVERNAME, aac_driver_version); error = pci_module_init(&aac_pci_driver); if (error) -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 3/7] aacraid: driver shutdown method
Add in pci shutdown method so that the adapter shuts down correctly and flushes its cache. Shutdown should also disable the adapter's interrupt when shutdown (in particularly if the driver is rmmod'd) to prevent spurious hardware activities. Patch against scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/aacraid.h 2005-07-01 11:49:36.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/aacraid.h 2005-07-01 11:52:07.0 -0700 @@ -460,6 +460,7 @@ { void (*adapter_interrupt)(struct aac_dev *dev); void (*adapter_notify)(struct aac_dev *dev, u32 event); + void (*adapter_disable_int)(struct aac_dev *dev); int (*adapter_sync_cmd)(struct aac_dev *dev, u32 command, u32 p1, u32 p2, u32 p3, u32 p4, u32 p5, u32 p6, u32 *status, u32 *r1, u32 *r2, u32 *r3, u32 *r4); int (*adapter_check_health)(struct aac_dev *dev); }; @@ -994,6 +995,9 @@ #define aac_adapter_notify(dev, event) \ (dev)->a_ops.adapter_notify(dev, event) +#define aac_adapter_disable_int(dev) \ + (dev)->a_ops.adapter_disable_int(dev) + #define aac_adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) \ (dev)->a_ops.adapter_sync_cmd(dev, command, p1, p2, p3, p4, p5, p6, status, r1, r2, r3, r4) Index: scsi-misc-aac-1/drivers/scsi/aacraid/linit.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/linit.c 2005-07-01 11:49:36.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/linit.c2005-07-01 11:52:07.0 -0700 @@ -849,11 +849,12 @@ return 0; -out_deinit: + out_deinit: kill_proc(aac->thread_pid, SIGKILL, 0); wait_for_completion(&aac->aif_completion); aac_send_shutdown(aac); + aac_adapter_disable_int(aac); fib_map_free(aac); pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); kfree(aac->queues); @@ -870,6 +871,13 @@ return error; } +static void aac_shutdown(struct pci_dev *dev) +{ + struct Scsi_Host *shost = pci_get_drvdata(dev); + struct aac_dev *aac = (struct aac_dev *)shost->hostdata; + aac_send_shutdown(aac); +} + static void __devexit aac_remove_one(struct pci_dev *pdev) { struct Scsi_Host *shost = pci_get_drvdata(pdev); @@ -881,6 +889,7 @@ wait_for_completion(&aac->aif_completion); aac_send_shutdown(aac); + aac_adapter_disable_int(aac); fib_map_free(aac); pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys); @@ -901,6 +910,7 @@ .id_table = aac_pci_tbl, .probe = aac_probe_one, .remove = __devexit_p(aac_remove_one), + .shutdown = aac_shutdown, }; static int __init aac_init(void) @@ -919,6 +929,7 @@ printk(KERN_WARNING "aacraid: unable to register \"aac\" device.\n"); } + return 0; } Index: scsi-misc-aac-1/drivers/scsi/aacraid/rkt.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/rkt.c 2005-07-01 11:43:01.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/rkt.c 2005-07-01 11:52:07.0 -0700 @@ -88,6 +88,16 @@ } /** + * aac_rkt_disable_interrupt - Disable interrupts + * @dev: Adapter + */ + +static void aac_rkt_disable_interrupt(struct aac_dev *dev) +{ + rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xff); +} + +/** * rkt_sync_cmd- send a command and wait * @dev: Adapter * @command: Command to execute @@ -412,10 +422,19 @@ * Fill in the function dispatch table. */ dev->a_ops.adapter_interrupt = aac_rkt_interrupt_adapter; + dev->a_ops.adapter_disable_int = aac_rkt_disable_interrupt; dev->a_ops.adapter_notify = aac_rkt_notify_adapter; dev->a_ops.adapter_sync_cmd = rkt_sync_cmd; dev->a_ops.adapter_check_health = aac_rkt_check_health; + /* +* First clear out all interrupts. Then enable the one's that we +* can handle. +*/ + rkt_writeb(dev, MUnit.OIMR, 0xff); + rkt_writel(dev, MUnit.ODR, 0x); + rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xfb); + if (aac_init_adapter(dev) == NULL) goto error_irq; /* @@ -438,6 +457,7 @@ kfree(dev->queues); error_irq: + rkt_writeb(dev, MUnit.OIMR, dev->OIMR = 0xff); free_irq(dev->scsi_host_ptr->irq, (void *)dev); error_iounmap: Index: scsi-misc-aac-1/d
[PATCH 1/7] aacraid: interupt mitigation
Received from Mark Salyzyn from Adaptec: If more than two commands are outstanding to the controller, there is no need to notify the adapter via a PCI bus transaction of additional commands added into the queue; it will get to them when it works through the produce/consumer indexes. This reduced the PCI traffic in the driver to submit a command to the queue to near zero allowing a significant number of commands to be turned around with no need to block for the PCI bridge to flush the notify request to the adapter. Interrupt mitigation has always been present in the driver; it was turned off because of a bug that prevented one from realizing the usefulness of the feature. This bug is fixed in this patch. Applies to scsi-misc-2.6 git tree Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-aac-1/drivers/scsi/aacraid/comminit.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/comminit.c2005-07-01 11:43:01.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/comminit.c 2005-07-01 11:47:10.0 -0700 @@ -44,7 +44,9 @@ #include "aacraid.h" -struct aac_common aac_config; +struct aac_common aac_config = { + .irq_mod = 1 +}; static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign) { Index: scsi-misc-aac-1/drivers/scsi/aacraid/commsup.c === --- scsi-misc-aac-1.orig/drivers/scsi/aacraid/commsup.c 2005-07-01 11:43:01.0 -0700 +++ scsi-misc-aac-1/drivers/scsi/aacraid/commsup.c 2005-07-01 11:47:10.0 -0700 @@ -254,6 +254,7 @@ static int aac_get_entry (struct aac_dev * dev, u32 qid, struct aac_entry **entry, u32 * index, unsigned long *nonotify) { struct aac_queue * q; + unsigned long idx; /* * All of the queues wrap when they reach the end, so we check @@ -263,10 +264,23 @@ */ q = &dev->queues->queue[qid]; - - *index = le32_to_cpu(*(q->headers.producer)); - if ((*index - 2) == le32_to_cpu(*(q->headers.consumer))) + + idx = *index = le32_to_cpu(*(q->headers.producer)); + /* Interrupt Moderation, only interrupt for first two entries */ + if (idx != le32_to_cpu(*(q->headers.consumer))) { + if (--idx == 0) { + if (qid == AdapHighCmdQueue) + idx = ADAP_HIGH_CMD_ENTRIES; + else if (qid == AdapNormCmdQueue) + idx = ADAP_NORM_CMD_ENTRIES; + else if (qid == AdapHighRespQueue) + idx = ADAP_HIGH_RESP_ENTRIES; + else if (qid == AdapNormRespQueue) + idx = ADAP_NORM_RESP_ENTRIES; + } + if (idx != le32_to_cpu(*(q->headers.consumer))) *nonotify = 1; + } if (qid == AdapHighCmdQueue) { if (*index >= ADAP_HIGH_CMD_ENTRIES) -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Fix sgmap error (resend)
The wrong sgmap structure is being assigned in aac_send_raw_srb. Patch against scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-2.6/drivers/scsi/aacraid/commctrl.c === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/commctrl.c 2005-06-24 10:51:16.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/commctrl.c 2005-07-07 13:17:21.0 -0700 @@ -517,7 +517,7 @@ } if (dev->dac_support == 1) { struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg; - struct sgmap64* psg = (struct sgmap64*)&user_srbcmd->sg; + struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; struct user_sgmap* usg; byte_count = 0; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Fix for controller load based timeouts (resend)
Martin Drab found that he could get aacraid timeouts with high load on his controller / disk drive combinations. After some experimentation Mark Salyzyn has come up with a patch to reduce the default max_sectors to something that will keep the controller from being overloaded and will eliminate the timeout issues. Patch against scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-2.6/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/aacraid.h 2005-07-08 09:22:20.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/aacraid.h2005-07-08 09:23:52.0 -0700 @@ -15,11 +15,7 @@ #define AAC_MAX_LUN(8) #define AAC_MAX_HOSTPHYSMEMPAGES (0xf) -/* - * max_sectors is an unsigned short, otherwise limit is 0x1 / 512 - * Linux has starvation problems if we permit larger than 4MB I/O ... - */ -#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192) +#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) /* * These macros convert from physical channels to virtual channels Index: scsi-misc-2.6/drivers/scsi/aacraid/linit.c === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/linit.c 2005-06-27 09:57:38.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/linit.c 2005-07-08 09:23:52.0 -0700 @@ -374,7 +374,8 @@ else scsi_adjust_queue_depth(sdev, 0, 1); - if (host->max_sectors < AAC_MAX_32BIT_SGBCOUNT) + if (!(((struct aac_dev *)host->hostdata)->adapter_info.options + & AAC_OPT_NEW_COMM)) blk_queue_max_segment_size(sdev->request_queue, 65536); return 0; -- Mark Haverkamp <[EMAIL PROTECTED]> -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 2.6 aacraid: Fix for controller load based timeouts
On Fri, 2005-07-08 at 13:41 -0400, Ryan Anderson wrote: > On Fri, 2005-07-08 at 10:36 -0700, Mark Haverkamp wrote: > > Martin Drab found that he could get aacraid timeouts with high load on > > his controller / disk drive combinations. After some experimentation > > Mark Salyzyn has come up with a patch to reduce the default max_sectors > > to something that will keep the controller from being overloaded and > > will eliminate the timeout issues. > > Would hitting this timeout issue cause the container to go offline? Yes, the usual results of the overload timeouts are that the container goes offline. > > If so, I think this may fix the issues I was having 6 months ago. (We > ended up taking the aacraid controller out of our production > environment, in frustration.) > > I'll try to get some testing time in on this next week, though, the > problems I've run into were very hard to reproduce on demand. > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Fix for controller load based timeouts
Martin Drab found that he could get aacraid timeouts with high load on his controller / disk drive combinations. After some experimentation Mark Salyzyn has come up with a patch to reduce the default max_sectors to something that will keep the controller from being overloaded and will eliminate the timeout issues. Patch against scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-2.6/drivers/scsi/aacraid/aacraid.h === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/aacraid.h 2005-07-08 09:22:20.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/aacraid.h2005-07-08 09:23:52.0 -0700 @@ -15,11 +15,7 @@ #define AAC_MAX_LUN(8) #define AAC_MAX_HOSTPHYSMEMPAGES (0xf) -/* - * max_sectors is an unsigned short, otherwise limit is 0x1 / 512 - * Linux has starvation problems if we permit larger than 4MB I/O ... - */ -#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192) +#define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) /* * These macros convert from physical channels to virtual channels Index: scsi-misc-2.6/drivers/scsi/aacraid/linit.c === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/linit.c 2005-06-27 09:57:38.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/linit.c 2005-07-08 09:23:52.0 -0700 @@ -374,7 +374,8 @@ else scsi_adjust_queue_depth(sdev, 0, 1); - if (host->max_sectors < AAC_MAX_32BIT_SGBCOUNT) + if (!(((struct aac_dev *)host->hostdata)->adapter_info.options + & AAC_OPT_NEW_COMM)) blk_queue_max_segment_size(sdev->request_queue, 65536); return 0; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Fix sgmap error
The wrong sgmap structure is being assigned in aac_send_raw_srb. Patch against scsi-misc-2.6 git tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> Index: scsi-misc-2.6/drivers/scsi/aacraid/commctrl.c === --- scsi-misc-2.6.orig/drivers/scsi/aacraid/commctrl.c 2005-06-24 10:51:16.0 -0700 +++ scsi-misc-2.6/drivers/scsi/aacraid/commctrl.c 2005-07-07 13:17:21.0 -0700 @@ -517,7 +517,7 @@ } if (dev->dac_support == 1) { struct user_sgmap64* upsg = (struct user_sgmap64*)&user_srbcmd->sg; - struct sgmap64* psg = (struct sgmap64*)&user_srbcmd->sg; + struct sgmap64* psg = (struct sgmap64*)&srbcmd->sg; struct user_sgmap* usg; byte_count = 0; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: Kernel OOPS with aacraid driver
On Fri, 2005-04-22 at 00:08 -0700, Yum Rayan wrote: > > > BTW, this says that this is the second oops: "[#2]". > > > What was the first one? > > Apr 21 10:53:27 www adaptec-smbe: aiomgrd startup succeeded > > Apr 21 10:53:27 www kernel: Unable to handle kernel NULL > > pointer dereference > > at virtual address 0034 > > Seems to me like someone is issuing IOCTL's against devices that do > not exist. Does this patch against linux-2.6.12-rc3 make sense and > applicable to you? > A fix for this was submitted to the list last week. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Address sparse warnings (update)
This patch addresses the sparse -Wbitwise warnings that Christoph wanted me to eliminate. This mostly consisted of making data structure elements of hardware associated structures the __le* equivalent. Although there were a couple places where there was mixing of cpu and le variable math. These changes have been tested on both an x86 and ppc machine running bonnie++. The usage of the LE32_ALL_ONES macro has been eliminated. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/aachba.c 1.35 vs edited = --- 1.35/drivers/scsi/aacraid/aachba.c 2005-03-30 09:40:26 -08:00 +++ edited/drivers/scsi/aacraid/aachba.c2005-04-11 09:34:45 -07:00 @@ -562,7 +562,7 @@ inqstrcpy ("V1.0", str->prl); } -void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code, +static void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code, u8 a_sense_code, u8 incorrect_length, u8 bit_pointer, u16 field_pointer, u32 residue) @@ -813,7 +813,7 @@ aac_io_done(scsicmd); } -int aac_read(struct scsi_cmnd * scsicmd, int cid) +static int aac_read(struct scsi_cmnd * scsicmd, int cid) { u32 lba; u32 count; @@ -1893,7 +1893,9 @@ } /* hba wants the size to be exact */ if(byte_count > scsicmd->request_bufflen){ - psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); + u32 temp = le32_to_cpu(psg->sg[i-1].count) - + (byte_count - scsicmd->request_bufflen); + psg->sg[i-1].count = cpu_to_le32(temp); byte_count = scsicmd->request_bufflen; } /* Check for command underflow */ @@ -1922,7 +1924,7 @@ { struct aac_dev *dev; unsigned long byte_count = 0; - u64 le_addr; + u64 addr; dev = (struct aac_dev *)scsicmd->device->host->hostdata; // Get rid of old data @@ -1943,16 +1945,18 @@ byte_count = 0; for (i = 0; i < sg_count; i++) { - le_addr = cpu_to_le64(sg_dma_address(sg)); - psg->sg[i].addr[1] = (u32)(le_addr>>32); - psg->sg[i].addr[0] = (u32)(le_addr & 0x); + addr = sg_dma_address(sg); + psg->sg[i].addr[0] = cpu_to_le32(addr & 0x); + psg->sg[i].addr[1] = cpu_to_le32(addr>>32); psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); byte_count += sg_dma_len(sg); sg++; } /* hba wants the size to be exact */ if(byte_count > scsicmd->request_bufflen){ - psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); + u32 temp = le32_to_cpu(psg->sg[i-1].count) - + (byte_count - scsicmd->request_bufflen); + psg->sg[i-1].count = cpu_to_le32(temp); byte_count = scsicmd->request_bufflen; } /* Check for command underflow */ @@ -1962,15 +1966,14 @@ } } else if(scsicmd->request_bufflen) { - dma_addr_t addr; + u64 addr; addr = pci_map_single(dev->pdev, scsicmd->request_buffer, scsicmd->request_bufflen, scsicmd->sc_data_direction); psg->count = cpu_to_le32(1); - le_addr = cpu_to_le64(addr); - psg->sg[0].addr[1] = (u32)(le_addr>>32); - psg->sg[0].addr[0] = (u32)(le_addr & 0x); + psg->sg[0].addr[0] = cpu_to_le32(addr & 0x); + psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); scsicmd->SCp.dma_handle = addr; byte_count = scsicmd->request_bufflen; = drivers/scsi/aacraid/aacraid.h 1.30 vs edited = --- 1.30/drivers/scsi/aacraid/aacraid.h 2005-03-29 09:31:47 -08:00 +++ edited/drivers/scsi/aacraid/aacraid.h 2005-04-13 14:27:51 -07:00 @@ -89,11 +89,21 @@ * on 64 bit systems not all cards support the 64 bit version */ struct sgentry { + __le32 addr; /* 32-bit address. */ + __le32 count; /* Length. */ +}; + +struct user_sgentry { u32 addr; /* 32-bit address. */ u32 count; /* Length. */ }; struct sgentry64 { + __le32 addr[2];/* 64-bit addr. 2 pieces for data alignment */ + __le32 count; /* Length. */ +}; + +struct user
[PATCH] 2.6 aacraid: Fix adapter open error
This fixes an error on the device open code that allows a non-existent device to be opened causing later panic problems. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/linit.c 1.47 vs edited = --- 1.47/drivers/scsi/aacraid/linit.c 2005-03-10 10:36:35 -08:00 +++ edited/drivers/scsi/aacraid/linit.c 2005-04-13 10:34:12 -07:00 @@ -450,7 +450,7 @@ } } - return 0; + return err; } /** -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: aacraid: kernel NULL pointer dereference
On Wed, 2005-04-13 at 13:24 -0400, Salyzyn, Mark wrote: > This is a can't happen, as aac_cfg_open should have reported an (-ENODEV) > error when it found no matching controller device ... Maybe the way that it should work, but: static int aac_cfg_open(struct inode *inode, struct file *file) { struct aac_dev *aac; unsigned minor = iminor(inode); int err = -ENODEV; list_for_each_entry(aac, &aac_devices, entry) { if (aac->id == minor) { file->private_data = aac; err = 0; break; } } return 0; } This should be easy to fix. Mark. > > Sincerely -- Mark Salyzyn > > -----Original Message- > From: Mark Haverkamp [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 13, 2005 12:59 PM > To: Ralf Müller > Cc: linux-scsi; Salyzyn, Mark > Subject: Re: aacraid: kernel NULL pointer dereference > > On Wed, 2005-04-13 at 18:02 +0200, Ralf Müller wrote: > > I currently try to set up a server with an Adaptec 2810SA RAID controller. > > While testing the Adaptec command line utility aacraid (actually the > > command "controller list") with a vanilla 2.6.12-rc2 kernel I got the > > following kernel oops - maybe someone is interested, maybe someone as > > some help for me: > > I was able to reproduce this on my machine. What I found was that if I > had some aacX devices in /dev that didn't exist that I got this fault. > You may try, as a work around for now, to delete any aac devices in /dev > that don't really exist and see it that helps. > > Mark. > > > > > > Unable to handle kernel NULL pointer dereference at virtual address 002c > > printing eip: > > c02e62fa > > *pde = > > Oops: 0002 [#1] > > PREEMPT SMP > > Modules linked in: nvram ipv6 speedstep_lib freq_table processor edd evdev > > joydev st sr_mod af_packet sg 3c59x mii ehci_hcd uhci_hcd e1000 usbcore > > i2c_i801 i2c_core intel_agp agpgart parport_pc lp parport video1394 > > ohci1394 raw1394 ieee1394 capability commoncap dm_mod reiserfs ide_cd cdrom > > ide_disk aacraid piix ide_core sd_mod scsi_mod > > CPU:0 > > EIP:0060:[]Not tainted VLI > > EFLAGS: 00010046 (2.6.12-rc2-smp) > > EIP is at _spin_lock_irqsave+0x1a/0x80 > > eax: ebx: 002c ecx: 0001 edx: 0286 > > esi: f6116000 edi: 002c ebp: bf8a4440 esp: f6117f34 > > ds: 007b es: 007b ss: 0068 > > Process aaccli (pid: 6691, threadinfo=f6116000 task=f5f18a60) > > Stack: 00042008 f886980f 00042008 f886888d > > 00042008 > >bf8a4440 bf8a4440 f8869243 f88708a0 f5331d80 ffe7 > > c0170888 > >bf8a4440 00042008 f5331d80 0005 f6116000 c0170a05 > > f6116000 > > Call Trace: > > [] fib_alloc+0xf/0x60 [aacraid] > > [] ioctl_send_fib+0xd/0x100 [aacraid] > > [] aac_do_ioctl+0xb3/0xb8 [aacraid] > > [] do_ioctl+0x48/0x70 > > [] vfs_ioctl+0x55/0x1d0 > > [] sys_ioctl+0x46/0x60 > > [] sysenter_past_esp+0x54/0x79 > > Code: eb db e8 9a ef ff ff eb c0 90 8d b4 26 00 00 00 00 56 53 89 c3 b8 01 > > 00 00 00 e8 12 65 e3 ff be 00 e0 ff ff 21 e6 9c 5a fa 31 c0 <86> 03 84 c0 > > 7e 0c c7 43 04 00 00 00 00 89 d0 5b 5e c3 52 9d b8 > > <6>note: aaccli[6691] exited with preempt_count 1 > > > > The system is a newly installed SuSE 9.3. If you need more > > information - please ask. > > > > Regard > > Ralf > > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: aacraid: kernel NULL pointer dereference
On Wed, 2005-04-13 at 18:02 +0200, Ralf Müller wrote: > I currently try to set up a server with an Adaptec 2810SA RAID controller. > While testing the Adaptec command line utility aacraid (actually the > command "controller list") with a vanilla 2.6.12-rc2 kernel I got the > following kernel oops - maybe someone is interested, maybe someone as > some help for me: I was able to reproduce this on my machine. What I found was that if I had some aacX devices in /dev that didn't exist that I got this fault. You may try, as a work around for now, to delete any aac devices in /dev that don't really exist and see it that helps. Mark. > > Unable to handle kernel NULL pointer dereference at virtual address 002c > printing eip: > c02e62fa > *pde = > Oops: 0002 [#1] > PREEMPT SMP > Modules linked in: nvram ipv6 speedstep_lib freq_table processor edd evdev > joydev st sr_mod af_packet sg 3c59x mii ehci_hcd uhci_hcd e1000 usbcore > i2c_i801 i2c_core intel_agp agpgart parport_pc lp parport video1394 ohci1394 > raw1394 ieee1394 capability commoncap dm_mod reiserfs ide_cd cdrom ide_disk > aacraid piix ide_core sd_mod scsi_mod > CPU:0 > EIP:0060:[]Not tainted VLI > EFLAGS: 00010046 (2.6.12-rc2-smp) > EIP is at _spin_lock_irqsave+0x1a/0x80 > eax: ebx: 002c ecx: 0001 edx: 0286 > esi: f6116000 edi: 002c ebp: bf8a4440 esp: f6117f34 > ds: 007b es: 007b ss: 0068 > Process aaccli (pid: 6691, threadinfo=f6116000 task=f5f18a60) > Stack: 00042008 f886980f 00042008 f886888d 00042008 >bf8a4440 bf8a4440 f8869243 f88708a0 f5331d80 ffe7 c0170888 >bf8a4440 00042008 f5331d80 0005 f6116000 c0170a05 f6116000 > Call Trace: > [] fib_alloc+0xf/0x60 [aacraid] > [] ioctl_send_fib+0xd/0x100 [aacraid] > [] aac_do_ioctl+0xb3/0xb8 [aacraid] > [] do_ioctl+0x48/0x70 > [] vfs_ioctl+0x55/0x1d0 > [] sys_ioctl+0x46/0x60 > [] sysenter_past_esp+0x54/0x79 > Code: eb db e8 9a ef ff ff eb c0 90 8d b4 26 00 00 00 00 56 53 89 c3 b8 01 00 > 00 00 e8 12 65 e3 ff be 00 e0 ff ff 21 e6 9c 5a fa 31 c0 <86> 03 84 c0 7e 0c > c7 43 04 00 00 00 00 89 d0 5b 5e c3 52 9d b8 > <6>note: aaccli[6691] exited with preempt_count 1 > > The system is a newly installed SuSE 9.3. If you need more > information - please ask. > > Regard > Ralf > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] aacraid 2.6: Address sparse warnings
On Fri, 2005-04-08 at 08:13 +0100, Christoph Hellwig wrote: > > + u32 temp = le32_to_cpu(psg->sg[i-1].count) - > > + (byte_count - scsicmd->request_bufflen); > > + psg->sg[i-1].count = cpu_to_le32(temp); > > You really want {be,le}*_{add,sub} helpers. I needed them on various > occasions, too. Al, what do you think about adding these helpers to a > common header somewhere? Do you have helper functions already that you've used elsewhere? If so, you could add them in somewhere and I could fix these spots later. > > > +#define LE32_ALL_ONES ((__force __le32)0x) > > I don't like having this in an actual driver. It might make sense to > either have this in a common header or actually allowing to assign all > ones to __l32*/__be* variables. Al? I'll put these back to the cpu_to_le32(0x) Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] aacraid 2.6: Address sparse warnings
This patch addresses the sparse -Wbitwise warnings that Christoph wanted me to eliminate. This mostly consisted of making data structure elements of hardware associated structures the __le* equivalent. Although there were a couple places where there was mixing of cpu and le variable math. These changes have been tested on both an x86 and ppc machine running bonnie++. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/aachba.c 1.35 vs edited = --- 1.35/drivers/scsi/aacraid/aachba.c 2005-03-30 09:40:26 -08:00 +++ edited/drivers/scsi/aacraid/aachba.c2005-04-04 11:25:30 -07:00 @@ -562,7 +562,7 @@ inqstrcpy ("V1.0", str->prl); } -void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code, +static void set_sense(u8 *sense_buf, u8 sense_key, u8 sense_code, u8 a_sense_code, u8 incorrect_length, u8 bit_pointer, u16 field_pointer, u32 residue) @@ -813,7 +813,7 @@ aac_io_done(scsicmd); } -int aac_read(struct scsi_cmnd * scsicmd, int cid) +static int aac_read(struct scsi_cmnd * scsicmd, int cid) { u32 lba; u32 count; @@ -1893,7 +1893,9 @@ } /* hba wants the size to be exact */ if(byte_count > scsicmd->request_bufflen){ - psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); + u32 temp = le32_to_cpu(psg->sg[i-1].count) - + (byte_count - scsicmd->request_bufflen); + psg->sg[i-1].count = cpu_to_le32(temp); byte_count = scsicmd->request_bufflen; } /* Check for command underflow */ @@ -1922,7 +1924,7 @@ { struct aac_dev *dev; unsigned long byte_count = 0; - u64 le_addr; + u64 addr; dev = (struct aac_dev *)scsicmd->device->host->hostdata; // Get rid of old data @@ -1943,16 +1945,18 @@ byte_count = 0; for (i = 0; i < sg_count; i++) { - le_addr = cpu_to_le64(sg_dma_address(sg)); - psg->sg[i].addr[1] = (u32)(le_addr>>32); - psg->sg[i].addr[0] = (u32)(le_addr & 0x); + addr = sg_dma_address(sg); + psg->sg[i].addr[0] = cpu_to_le32(addr & 0x); + psg->sg[i].addr[1] = cpu_to_le32(addr>>32); psg->sg[i].count = cpu_to_le32(sg_dma_len(sg)); byte_count += sg_dma_len(sg); sg++; } /* hba wants the size to be exact */ if(byte_count > scsicmd->request_bufflen){ - psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen); + u32 temp = le32_to_cpu(psg->sg[i-1].count) - + (byte_count - scsicmd->request_bufflen); + psg->sg[i-1].count = cpu_to_le32(temp); byte_count = scsicmd->request_bufflen; } /* Check for command underflow */ @@ -1962,15 +1966,14 @@ } } else if(scsicmd->request_bufflen) { - dma_addr_t addr; + u64 addr; addr = pci_map_single(dev->pdev, scsicmd->request_buffer, scsicmd->request_bufflen, scsicmd->sc_data_direction); psg->count = cpu_to_le32(1); - le_addr = cpu_to_le64(addr); - psg->sg[0].addr[1] = (u32)(le_addr>>32); - psg->sg[0].addr[0] = (u32)(le_addr & 0x); + psg->sg[0].addr[0] = cpu_to_le32(addr & 0x); + psg->sg[0].addr[1] = cpu_to_le32(addr >> 32); psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen); scsicmd->SCp.dma_handle = addr; byte_count = scsicmd->request_bufflen; = drivers/scsi/aacraid/aacraid.h 1.30 vs edited = --- 1.30/drivers/scsi/aacraid/aacraid.h 2005-03-29 09:31:47 -08:00 +++ edited/drivers/scsi/aacraid/aacraid.h 2005-04-04 11:17:51 -07:00 @@ -15,6 +15,8 @@ #define AAC_MAX_HOSTPHYSMEMPAGES (0xf) +#define LE32_ALL_ONES ((__force __le32)0x) + /* * These macros convert from physical channels to virtual channels */ @@ -89,11 +91,21 @@ * on 64 bit systems not all cards support the 64 bit version */ struct sgentry { + __le32 addr; /* 32-bit address. */ + __le32 count; /* Length. */ +}; + +struct user_sgentry { u32 addr; /* 32-bit address. */ u32 count; /* Length. */ }; struct sgentr
[PATCH] 2.6 aacraid: endian cleanup (update)
An update to the patch from Adaptec with byte order changes: - drop byte swapping on all 0's and all 1's content - fix up missing swapping directives - ensure swapping on 16 bit values does not use 32 bit swap - Made hardware registers __le* types. - hopefully caught the style issues. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/aachba.c 1.34 vs edited = --- 1.34/drivers/scsi/aacraid/aachba.c 2005-02-02 00:12:13 -08:00 +++ edited/drivers/scsi/aacraid/aachba.c2005-03-30 09:40:26 -08:00 @@ -195,10 +195,12 @@ = (struct aac_get_config_status_resp *) fib_data(fibptr); dprintk((KERN_WARNING "aac_get_config_status: response=%d status=%d action=%d\n", - reply->response, reply->status, reply->data.action)); - if ((reply->response != ST_OK) -|| (reply->status != CT_OK) -|| (reply->data.action > CFACT_PAUSE)) { + le32_to_cpu(reply->response), + le32_to_cpu(reply->status), + le32_to_cpu(reply->data.action))); + if ((le32_to_cpu(reply->response) != ST_OK) || +(le32_to_cpu(reply->status) != CT_OK) || +(le32_to_cpu(reply->data.action) > CFACT_PAUSE)) { printk(KERN_WARNING "aac_get_config_status: Will not issue the Commit Configuration\n"); status = -EINVAL; } @@ -265,7 +267,7 @@ NULL, NULL); if (status >= 0) { dresp = (struct aac_get_container_count_resp *)fib_data(fibptr); - maximum_num_containers = dresp->ContainerSwitchEntries; + maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); fib_complete(fibptr); } @@ -624,25 +626,28 @@ memcpy(&dev->adapter_info, info, sizeof(struct aac_adapter_info)); - tmp = dev->adapter_info.kernelrev; - printk(KERN_INFO"%s%d: kernel %d.%d.%d build %d\n", + tmp = le32_to_cpu(dev->adapter_info.kernelrev); + printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d]\n", + dev->name, + dev->id, + tmp>>24, + (tmp>>16)&0xff, + tmp&0xff, + le32_to_cpu(dev->adapter_info.kernelbuild)); + tmp = le32_to_cpu(dev->adapter_info.monitorrev); + printk(KERN_INFO "%s%d: monitor %d.%d-%d[%d]\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff, - dev->adapter_info.kernelbuild); - tmp = dev->adapter_info.monitorrev; - printk(KERN_INFO"%s%d: monitor %d.%d.%d build %d\n", + tmp>>24,(tmp>>16)&0xff,tmp&0xff, + le32_to_cpu(dev->adapter_info.monitorbuild)); + tmp = le32_to_cpu(dev->adapter_info.biosrev); + printk(KERN_INFO "%s%d: bios %d.%d-%d[%d]\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff, - dev->adapter_info.monitorbuild); - tmp = dev->adapter_info.biosrev; - printk(KERN_INFO"%s%d: bios %d.%d.%d build %d\n", + tmp>>24,(tmp>>16)&0xff,tmp&0xff, + le32_to_cpu(dev->adapter_info.biosbuild)); + if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) + printk(KERN_INFO "%s%d: serial %x\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff, - dev->adapter_info.biosbuild); - printk(KERN_INFO"%s%d: serial %x%x\n", - dev->name, dev->id, - dev->adapter_info.serial[0], - dev->adapter_info.serial[1]); + le32_to_cpu(dev->adapter_info.serial[0])); dev->nondasd_support = 0; dev->raid_scsi_mode = 0; @@ -742,7 +747,8 @@ if (le32_to_cpu(readreply->status) == ST_OK) scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; else { - printk(KERN_WARNING "read_callback: read failed, status = %d\n", readreply->status); + printk(KERN_WARNING "read_callback: read failed, status = %d\n", + le32_to_cpu(readreply->status)); scsicmd->result = DID_OK << 16 | COMMAND_COMPLETE << 8
Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote: > On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote: > > A patch from Adaptec with byte order changes: > > - drop byte swapping on all 0's and all 1's content > > - fix up missing swapping directives > > - ensure swapping on 16 bit values does not use 32 bit swap > > - reconcile the readl/writel auto-swapping in only most of the > > configurations. > > that last bit is bogus. readl/writel are defined to swap bytes on > big endian systems. Whatever broken Mvista/Windriver or whatever port > doesn't do that should be fixed. > > Also please remove unrelated changes like the new cardtypes from the patch, > follow normal kernel codingstyle (e.g. ||, && at the end of the line) and > switch to __le* types for harware structures and make sure it's passing > sparse -Wbitwise. I ran sparse on the driver and without the -Wbitwise, it only has 7 warnings such as: CHECK drivers/scsi/aacraid/linit.c drivers/scsi/aacraid/linit.c:218:12: warning: symbol 'aac_info' was not declared. Should it be static? With -Wbitwise there are about 200 warnings of this sort: drivers/scsi/aacraid/aachba.c:180:18: warning: incorrect type in assignment (different base types) drivers/scsi/aacraid/aachba.c:180:18:expected unsigned int [unsigned] [usertype] command drivers/scsi/aacraid/aachba.c:180:18:got restricted unsigned int [usertype] [force] What is your preference, I could clean up the existing patch and re- submit and then address the sparse warnings with a follow-up patch. Or try to fix everything in one patch. Thanks, Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, 2005-03-28 at 15:28 -0800, Mark Haverkamp wrote: > On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote: > > On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote: > > > A patch from Adaptec with byte order changes: > > > - drop byte swapping on all 0's and all 1's content > > > - fix up missing swapping directives > > > - ensure swapping on 16 bit values does not use 32 bit swap > > > - reconcile the readl/writel auto-swapping in only most of the > > > configurations. > > > > that last bit is bogus. readl/writel are defined to swap bytes on > > big endian systems. Whatever broken Mvista/Windriver or whatever port > > doesn't do that should be fixed. > > > > Also please remove unrelated changes like the new cardtypes from the patch, > > follow normal kernel codingstyle (e.g. ||, && at the end of the line) and > > switch to __le* types for harware structures and make sure it's passing > > sparse -Wbitwise. > > Sorry if this is a dumb question, but I haven't used sparse before. If > I do a make C=1, will that run sparse with the appropriate options? Never mind, I found the instructions in the Documentation directory. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote: > On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote: > > A patch from Adaptec with byte order changes: > > - drop byte swapping on all 0's and all 1's content > > - fix up missing swapping directives > > - ensure swapping on 16 bit values does not use 32 bit swap > > - reconcile the readl/writel auto-swapping in only most of the > > configurations. > > that last bit is bogus. readl/writel are defined to swap bytes on > big endian systems. Whatever broken Mvista/Windriver or whatever port > doesn't do that should be fixed. > > Also please remove unrelated changes like the new cardtypes from the patch, > follow normal kernel codingstyle (e.g. ||, && at the end of the line) and > switch to __le* types for harware structures and make sure it's passing > sparse -Wbitwise. Sorry if this is a dumb question, but I haven't used sparse before. If I do a make C=1, will that run sparse with the appropriate options? Thanks, Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, 2005-03-28 at 22:59 +0100, Christoph Hellwig wrote: > On Mon, Mar 21, 2005 at 10:41:23AM -0800, Mark Haverkamp wrote: > > A patch from Adaptec with byte order changes: > > - drop byte swapping on all 0's and all 1's content > > - fix up missing swapping directives > > - ensure swapping on 16 bit values does not use 32 bit swap > > - reconcile the readl/writel auto-swapping in only most of the > > configurations. > > that last bit is bogus. readl/writel are defined to swap bytes on > big endian systems. Whatever broken Mvista/Windriver or whatever port > doesn't do that should be fixed. Yes, I just got something similar from James. I'll fix it. > > Also please remove unrelated changes like the new cardtypes from the patch, > follow normal kernel codingstyle (e.g. ||, && at the end of the line) and > switch to __le* types for harware structures and make sure it's passing > sparse -Wbitwise. OK, I'll take a look. Mark. -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] 2.6 aacraid: endian cleanup
On Mon, 2005-03-28 at 15:58 -0600, James Bottomley wrote: > On Mon, 2005-03-21 at 10:41 -0800, Mark Haverkamp wrote: > > + Adaptec 2130S That was in the TODO file I think. There isn't a new card supported in this patch set. > > Why are we getting updated card support in an endian cleanup patch? > > > +/* > > + * Some configurations of BE Linux have writel and readl automatically > > perform > > + * byte swapping, and some configurations (embedded) do not. Typically > > + * AAC_IO_USES_CPU_ORDER needs to be defined since most BE ports are > > working > > + * with drivers that have not been coded to support BE. > > + */ > > +#define AAC_IO_USES_CPU_ORDER 1 > > +#ifdef AAC_IO_USES_CPU_ORDER > > +# define aac_io_le32_to_cpu > > +# define aac_io_cpu_to_le16 > > +# define aac_io_cpu_to_le32 > > +#else > > +# define aac_io_le32_to_cpu le32_to_cpu > > +# define aac_io_cpu_to_le16 cpu_to_le16 > > +# define aac_io_cpu_to_le32 cpu_to_le32 > > +#endif > > What exactly is this for? I know of no platforms that implement readl > and friends incorrectly, so all of this should be unnecessary. I wondered about this. Mark S. thought that there were some. If there aren't, I can remove all that code. Mark. > > James > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: Add sysfs files for aacraid information
This patch adds some files into the /sys/class/scsi_host/hostN directories for aacraid adapters. The file names are pretty much self- explanitory: aac_driver_version: Driver version and date aac_bios_version: Adapter's bios version aac_kernel_version: Adapter's kernel version aac_monitor_version: Adapter's monitor version aac_model: Adapter's model name/number aac_serial_number: Adapter's serial number This is information that used to be supplied by the /proc interface. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/linit.c 1.47 vs edited = --- 1.47/drivers/scsi/aacraid/linit.c 2005-03-10 10:36:35 -08:00 +++ edited/drivers/scsi/aacraid/linit.c 2005-03-23 09:50:53 -08:00 @@ -524,8 +524,137 @@ { return aac_compat_do_ioctl((struct aac_dev *)file->private_data, cmd, arg); } + #endif +static ssize_t aac_show_host_version(struct class_device *class_dev, + char *buf) +{ + int len; + + len = snprintf(buf, PAGE_SIZE, "Adaptec Raid Controller: %s %s\n", + AAC_DRIVER_VERSION, + AAC_DRIVER_BUILD_DATE); + return len; +} + +static ssize_t aac_show_model(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len; + + len = snprintf(buf, PAGE_SIZE, "Vendor: %s Model: %s\n", + aac_drivers[dev->cardtype].vname, + aac_drivers[dev->cardtype].model); + return len; +} + +static ssize_t aac_show_kernel_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.kernelrev); + len = snprintf(buf, PAGE_SIZE, "kernel: %d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.kernelbuild)); + return len; +} + +static ssize_t aac_show_monitor_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.monitorrev); + len = snprintf(buf, PAGE_SIZE, "monitor: %d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.monitorbuild)); + return len; +} + +static ssize_t aac_show_bios_version(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len, tmp; + + tmp = le32_to_cpu(dev->adapter_info.biosrev); + len = snprintf(buf, PAGE_SIZE, "bios: %d.%d-%d[%d]\n", + tmp >> 24, (tmp >> 16) & 0xff, tmp & 0xff, + le32_to_cpu(dev->adapter_info.biosbuild)); + return len; +} + +static ssize_t aac_show_serial_number(struct class_device *class_dev, + char *buf) +{ + struct aac_dev *dev = (struct aac_dev*)class_to_shost(class_dev)->hostdata; + int len = 0; + + if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) + len = snprintf(buf, PAGE_SIZE, "serial: %x\n", + le32_to_cpu(dev->adapter_info.serial[0])); + return len; +} + + +static struct class_device_attribute aac_host_version = { + .attr = { + .name = "aac_driver_version", + .mode = S_IRUGO, + }, + .show = aac_show_host_version, +}; +static struct class_device_attribute aac_model = { + .attr = { + .name = "aac_model", + .mode = S_IRUGO, + }, + .show = aac_show_model, +}; +static struct class_device_attribute aac_kernel_version = { + .attr = { + .name = "aac_kernel_version", + .mode = S_IRUGO, + }, + .show = aac_show_kernel_version, +}; +static struct class_device_attribute aac_monitor_version = { + .attr = { + .name = "aac_monitor_version", + .mode = S_IRUGO, + }, + .show = aac_show_monitor_version, +}; +static struct class_device_attribute aac_bios_version = { + .attr = { + .name = "aac_bios_version", + .mode = S_IRUGO, + }, + .show = aac_show_bios_version, +}; +static struct class_device_attribute aac_serial_number = { + .attr = { + .name = "aac_serial_number", + .mode = S_IRUGO, + }, + .show = aac_show_serial_number, +}; + +static struct class_device_attribute *aac_attrs[] = { + &aac_host_version, + &aac_model, + &aac_kern
[PATCH] 2.6 aacraid: endian cleanup
A patch from Adaptec with byte order changes: - drop byte swapping on all 0's and all 1's content - fix up missing swapping directives - ensure swapping on 16 bit values does not use 32 bit swap - reconcile the readl/writel auto-swapping in only most of the configurations. I tested this on a ppc64 machine and the driver loaded and configured the attached disks. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/README 1.8 vs edited = --- 1.8/drivers/scsi/aacraid/README 2004-11-24 10:24:16 -08:00 +++ edited/drivers/scsi/aacraid/README 2005-03-03 13:01:32 -08:00 @@ -13,6 +13,7 @@ Adaptec 2020S Adaptec 2025S Adaptec 2120S + Adaptec 2130S Adaptec 2200S Adaptec 2230S Adaptec 2240S @@ -35,6 +36,7 @@ HP NetRAID-4M Legend S220 Legend S230 + IBM ServeRAID 8i People - = drivers/scsi/aacraid/TODO 1.2 vs edited = --- 1.2/drivers/scsi/aacraid/TODO 2004-05-30 09:41:11 -07:00 +++ edited/drivers/scsi/aacraid/TODO2005-03-03 13:01:32 -08:00 @@ -1,6 +1,4 @@ o Testing o More testing -o Feature request: display the firmware/bios/etc revisions in the - /proc info -o Drop irq_mask, basically unused o I/O size increase +o add sysfs interface = drivers/scsi/aacraid/aachba.c 1.34 vs edited = --- 1.34/drivers/scsi/aacraid/aachba.c 2005-02-02 00:12:13 -08:00 +++ edited/drivers/scsi/aacraid/aachba.c2005-03-03 13:46:22 -08:00 @@ -195,10 +195,12 @@ = (struct aac_get_config_status_resp *) fib_data(fibptr); dprintk((KERN_WARNING "aac_get_config_status: response=%d status=%d action=%d\n", - reply->response, reply->status, reply->data.action)); - if ((reply->response != ST_OK) -|| (reply->status != CT_OK) -|| (reply->data.action > CFACT_PAUSE)) { + le32_to_cpu(reply->response), + le32_to_cpu(reply->status), + le32_to_cpu(reply->data.action))); + if ((le32_to_cpu(reply->response) != ST_OK) +|| (le32_to_cpu(reply->status) != CT_OK) +|| (le32_to_cpu(reply->data.action) > CFACT_PAUSE)) { printk(KERN_WARNING "aac_get_config_status: Will not issue the Commit Configuration\n"); status = -EINVAL; } @@ -265,7 +267,7 @@ NULL, NULL); if (status >= 0) { dresp = (struct aac_get_container_count_resp *)fib_data(fibptr); - maximum_num_containers = dresp->ContainerSwitchEntries; + maximum_num_containers = le32_to_cpu(dresp->ContainerSwitchEntries); fib_complete(fibptr); } @@ -624,25 +626,28 @@ memcpy(&dev->adapter_info, info, sizeof(struct aac_adapter_info)); - tmp = dev->adapter_info.kernelrev; - printk(KERN_INFO"%s%d: kernel %d.%d.%d build %d\n", + tmp = le32_to_cpu(dev->adapter_info.kernelrev); + printk(KERN_INFO "%s%d: kernel %d.%d-%d[%d]\n", + dev->name, + dev->id, + tmp>>24, + (tmp>>16)&0xff, + tmp&0xff, + le32_to_cpu(dev->adapter_info.kernelbuild)); + tmp = le32_to_cpu(dev->adapter_info.monitorrev); + printk(KERN_INFO "%s%d: monitor %d.%d-%d[%d]\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff, - dev->adapter_info.kernelbuild); - tmp = dev->adapter_info.monitorrev; - printk(KERN_INFO"%s%d: monitor %d.%d.%d build %d\n", + tmp>>24,(tmp>>16)&0xff,tmp&0xff, + le32_to_cpu(dev->adapter_info.monitorbuild)); + tmp = le32_to_cpu(dev->adapter_info.biosrev); + printk(KERN_INFO "%s%d: bios %d.%d-%d[%d]\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&0xff,(tmp>>8)&0xff, - dev->adapter_info.monitorbuild); - tmp = dev->adapter_info.biosrev; - printk(KERN_INFO"%s%d: bios %d.%d.%d build %d\n", + tmp>>24,(tmp>>16)&0xff,tmp&0xff, + le32_to_cpu(dev->adapter_info.biosbuild)); + if (le32_to_cpu(dev->adapter_info.serial[0]) != 0xBAD0) + printk(KERN_INFO "%s%d: serial %x\n", dev->name, dev->id, - tmp>>24,(tmp>>16)&
RE: adaptec 2120S software under RedHat 8.0 and FC2
On Wed, 2005-03-16 at 08:02 -0500, Salyzyn, Mark wrote: > The applications require the Adaptec Branch of the driver in order to > function (mainly because the kernel.org branch drops the > /proc/scsi/aacraid entry). I have submitted a patch to Mark Haverkamp > for consideration where we add the information back to the /sys > filesystem, and the /proc filesystem (with CONFIG_PROC_FS defined) that > will help re-enable the applications. The proc info code was removed almost two years ago. I assume that it was removed because of the move away from using /proc and towards using /sys. Christoph, is that the reason for its removal? Mark. > > There is also a Public GPL daemon, aeventd, that provides event services > that you may consider. > > I will provide the sources for both under separate cover. > > Sincerely -- Mark Salyzyn > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Ross Macintyre > Sent: Wednesday, March 16, 2005 6:20 AM > To: linux-scsi@vger.kernel.org > Subject: adaptec 2120S software under RedHat 8.0 and FC2 > > Could someone possibly help? > > I have upgraded a machine from RedHat 8.0 to FC2 and the > adaptec-browser1 and adaptec-smbe software that I installed is not > working > properly. It looks ok at first glance but if I pull a disk out I only > get > informed of the 'informational' type messages. > (Also the browser interface to the RAID doesn't notice that the disk has > been pulled) > > These are the RPMs that I installed from adaptec: > adaptec-browser-1.2b-2 > adaptec-smbe-1.01.005-0 > > and I am running this kernel: 2.6.8-1.521smp > > Note the mail part works ok and I do get informational messages when I > use > the browser interface and I tell it to rescan, (the array is rebuilt > ok), > but after the disk is pulled, from the browser interface it still shows > the disk as being there, and it is only when I tell it to rescan that it > starts sending out the informational messages and rebuilds. > The messages are logged to /var/log/messages but it seems that anotifyd > is > not picking them up. > > Maybe I just need to upgrade the firmware and put on the latest RPMs? > I think I am at firmware revision 7244. > > I have attached the anotify.conf file. > > Thanks in advance, > Ross > -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] 2.6 aacraid: adapter naming fix
>From Mark Salyzyn at Adaptec. This fixes the way the aac device's id is calculated. Applies to scsi-misc-2.6 tree. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/linit.c 1.46 vs edited = --- 1.46/drivers/scsi/aacraid/linit.c 2005-02-03 18:48:49 -08:00 +++ edited/drivers/scsi/aacraid/linit.c 2005-03-10 10:36:35 -08:00 @@ -573,10 +573,9 @@ int unique_id = 0; list_for_each_entry(aac, &aac_devices, entry) { - if (aac->id > unique_id) { - insert = &aac->entry; + if (aac->id > unique_id) break; - } + insert = &aac->entry; unique_id++; } -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: Possible use of uninitialized variable in sd.c
On Fri, 2005-02-25 at 21:06 +, Kenn Humborg wrote: > In drivers/scsi/sd.c:sd_probe: > > int index; > ... > spin_lock(&sd_index_lock); > error = idr_get_new(&sd_index_idr, NULL, &index); > spin_unlock(&sd_index_lock); > > if (index >= SD_MAX_DISKS) > error = -EBUSY; > if (error) > goto out_put; > > Note that if idr_get_new() fails, index remains uninitialized. If it > happens to be >= SD_MAX_DISKS, the error returned from idr_get_new will > be clobbered. Patch initializes index to zero. I wonder if it wouldn't be better to just check the error return before the index value. > > Signed-off-by: Kenn Humborg <[EMAIL PROTECTED]> > > > --- src/drivers/scsi/sd.c-2.6.10 2005-02-25 21:02:17.035529833 + > +++ src/drivers/scsi/sd.c 2005-02-25 21:03:09.057517937 + > @@ -1409,7 +1409,7 @@ > struct scsi_device *sdp = to_scsi_device(dev); > struct scsi_disk *sdkp; > struct gendisk *gd; > - u32 index; > + u32 index = 0; > int error; > > error = -ENODEV; > - > To unsubscribe from this list: send the line "unsubscribe linux-scsi" in > the body of a message to [EMAIL PROTECTED] > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] (7/27) *really* dumb typo in aacraid (cast to pointer to structure that doesn't exist ;-)
On Wed, 2005-02-02 at 16:32 -0500, Salyzyn, Mark wrote: > Cool! A good catch that could only be caught with many eyes looking at > the code. > > Wasn't in my branch though, but it looks like a common typo ;-/. It was my fault. I was asked to take the cast out but when I did I got a compile warning. When I put it back in, I made a typo. The c and v keys are close together :-) I don't recall seeing a warning. > But the > sad part of this is that I use casts around voids to improve type > checking (and enforce/document intentions) and it now appears to be a > waste. I assume you did not see a warning message from your compile > environment, right? > > Sincerely -- Mark Salyzyn > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Al Viro > Sent: Wednesday, February 02, 2005 2:14 PM > To: Linus Torvalds > Cc: linux-scsi@vger.kernel.org > Subject: [PATCH] (7/27) *really* dumb typo in aacraid (cast to pointer > to structure that doesn't exist ;-) > > spot the typo... It's harmless, in a sense that code compiles > right, > but... [...] -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] aacraid 2.6: add scsi synchronize cache support. (Update)
Christoph, On Thu, 2005-01-20 at 11:31 +, Christoph Hellwig wrote: Fixed whitespace, 80 column wrap, casts, braces, parenthesis, etc. > > > + set_sense((u8 *) &dev->fsa_dev[cid].sense_data, > > sense_data is u8 already. sense_data is "struct sense_data" and I get a compiler warning without the cast. > > > + memcpy(scsicmd->sense_buffer, &dev->fsa_dev[cid].sense_data, > > + (sizeof(dev->fsa_dev[cid].sense_data) > > > sizeof(scsicmd->sense_buffer)) > > + ? sizeof(scsicmd->sense_buffer) > > + : sizeof(dev->fsa_dev[cid].sense_data)); > > Use max here? I think min() is what is needed here. -- James, If this addresses Christoph's issues, here is the updated patch. - This is an update from the Adaptec driver that adds support for the scsi synchronize cache command. It essentially blocks further commands until data has been flushed to the disks. Signed-off-by: Mark Haverkamp <[EMAIL PROTECTED]> = drivers/scsi/aacraid/aachba.c 1.32 vs edited = --- 1.32/drivers/scsi/aacraid/aachba.c 2005-01-07 21:44:25 -08:00 +++ edited/drivers/scsi/aacraid/aachba.c2005-01-20 08:51:37 -08:00 @@ -1029,6 +1029,114 @@ return 0; } +static void synchronize_callback(void *context, struct fib *fibptr) +{ + struct aac_synchronize_reply *synchronizereply; + struct scsi_cmnd *cmd; + + cmd = context; + + dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", + smp_processor_id(), jiffies)); + BUG_ON(fibptr == NULL); + + + synchronizereply = fib_data(fibptr); + if (le32_to_cpu(synchronizereply->status) == CT_OK) + cmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8 | SAM_STAT_GOOD; + else { + struct scsi_device *sdev = cmd->device; + struct aac_dev *dev = (struct aav_dev *)sdev->host->hostdata; + u32 cid = ID_LUN_TO_CONTAINER(sdev->id, sdev->lun); + printk(KERN_WARNING +"synchronize_callback: synchronize failed, status = %d\n", +synchronizereply->status); + cmd->result = DID_OK << 16 | + COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION; + set_sense((u8 *)&dev->fsa_dev[cid].sense_data, + HARDWARE_ERROR, + SENCODE_INTERNAL_TARGET_FAILURE, + ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0, + 0, 0); + memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data, + min(sizeof(dev->fsa_dev[cid].sense_data), + sizeof(cmd->sense_buffer))); + } + + fib_complete(fibptr); + fib_free(fibptr); + aac_io_done(cmd); +} + +static int aac_synchronize(struct scsi_cmnd *scsicmd, int cid) +{ + int status; + struct fib *cmd_fibcontext; + struct aac_synchronize *synchronizecmd; + struct scsi_cmnd *cmd; + struct scsi_device *sdev = scsicmd->device; + int active = 0; + unsigned long flags; + + /* +* Wait for all commands to complete to this specific +* target (block). +*/ + spin_lock_irqsave(&sdev->list_lock, flags); + list_for_each_entry(cmd, &sdev->cmd_list, list) + if (cmd != scsicmd && cmd->serial_number != 0) { + ++active; + break; + } + + spin_unlock_irqrestore(&sdev->list_lock, flags); + + /* +* Yield the processor (requeue for later) +*/ + if (active) + return SCSI_MLQUEUE_DEVICE_BUSY; + + /* +* Alocate and initialize a Fib +*/ + if (!(cmd_fibcontext = + fib_alloc((struct aac_dev *)scsicmd->device->host->hostdata))) + return SCSI_MLQUEUE_HOST_BUSY; + + fib_init(cmd_fibcontext); + + synchronizecmd = fib_data(cmd_fibcontext); + synchronizecmd->command = cpu_to_le32(VM_ContainerConfig); + synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE); + synchronizecmd->cid = cpu_to_le32(cid); + synchronizecmd->count = +cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data)); + + /* +* Now send the Fib to the adapter +*/ + status = fib_send(ContainerCommand, + cmd_fibcontext, + sizeof(struct aac_synchronize), + FsaNormal, + 0, 1, + (fib_callback)synchronize_callback, + (void *)scsicmd);
[PATCH] aacraid 2.6: add scsi synchronize cache support.
1380,11 @@ ret = aac_write(scsicmd, cid); spin_lock_irq(host->host_lock); return ret; + + case SYNCHRONIZE_CACHE: + /* Issue FIB to tell Firmware to flush it's cache */ + return aac_synchronize(scsicmd, cid); + default: /* * Unhandled commands = drivers/scsi/aacraid/aacraid.h 1.28 vs edited = --- 1.28/drivers/scsi/aacraid/aacraid.h 2004-12-27 10:28:37 -08:00 +++ edited/drivers/scsi/aacraid/aacraid.h 2005-01-06 08:17:45 -08:00 @@ -1069,6 +1069,30 @@ u32 committed; }; +#define CT_FLUSH_CACHE 129 +struct aac_synchronize { + u32 command;/* VM_ContainerConfig */ + u32 type; /* CT_FLUSH_CACHE */ + u32 cid; + u32 parm1; + u32 parm2; + u32 parm3; + u32 parm4; + u32 count; /* sizeof(((struct aac_synchronize_reply *)NULL)->data) */ +}; + +struct aac_synchronize_reply { + u32 dummy0; + u32 dummy1; + u32 status; /* CT_OK */ + u32 parm1; + u32 parm2; + u32 parm3; + u32 parm4; + u32 parm5; + u8 data[16]; +}; + struct aac_srb { u32 function; -- Mark Haverkamp <[EMAIL PROTECTED]> - To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html