X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fscsi%2Faacraid%2Flinit.c;h=c552191428cfba1f2f70c09d0c37634ded631869;hb=9bf4aaab3e101692164d49b7ca357651eb691cb6;hp=8c4ceaeae781e69e98b830c2e217c586932f2cb6;hpb=db216c3d5e4c040e557a50f8f5d35d5c415e8c1c;p=linux-2.6.git diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 8c4ceaeae..c55219142 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -27,10 +27,11 @@ * Abstract: Linux Driver entry module for Adaptec RAID Array Controller */ -#define AAC_DRIVER_VERSION "1.1.2-lk1" +#define AAC_DRIVER_VERSION "1.1.2-lk2" #define AAC_DRIVER_BUILD_DATE __DATE__ #define AAC_DRIVERNAME "aacraid" +#include #include #include #include @@ -41,6 +42,8 @@ #include #include #include +#include +#include #include #include @@ -168,6 +171,28 @@ static struct aac_driver_ident aac_drivers[] = { { aac_rx_init, "aacraid", "ADAPTEC ", "ASR-2025SA ", 1 }, /* ASR-2025SA (ZCR DIMM SATA) */ }; +#ifdef CONFIG_COMPAT +/* + * Promote 32 bit apps that call get_next_adapter_fib_ioctl to 64 bit version + */ +static int aac_get_next_adapter_fib_ioctl(unsigned int fd, unsigned int cmd, + unsigned long arg, struct file *file) +{ + struct fib_ioctl __user *f; + + f = compat_alloc_user_space(sizeof(*f)); + if (!access_ok(VERIFY_WRITE, f, sizeof(*f))) + return -EFAULT; + + clear_user(f, sizeof(*f)); + if (copy_in_user(f, (void __user *)arg, sizeof(struct fib_ioctl) - sizeof(u32))) + return -EFAULT; + + return sys_ioctl(fd, cmd, (unsigned long)f); +} +#endif + + /** * aac_queuecommand - queue a SCSI command * @cmd: SCSI command to queue @@ -330,7 +355,7 @@ static int aac_slave_configure(struct scsi_device *sdev) return 0; } -static int aac_ioctl(struct scsi_device *sdev, int cmd, void * arg) +static int aac_ioctl(struct scsi_device *sdev, int cmd, void __user * arg) { struct aac_dev *dev = (struct aac_dev *)sdev->host->hostdata; return aac_do_ioctl(dev, cmd, arg); @@ -355,13 +380,15 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) struct Scsi_Host * host = dev->host; struct scsi_cmnd * command; int count; + struct aac_dev * aac; unsigned long flags; printk(KERN_ERR "%s: Host adapter reset request. SCSI hang ?\n", AAC_DRIVERNAME); - if (aac_adapter_check_health((struct aac_dev *)host->hostdata)) { + aac = (struct aac_dev *)host->hostdata; + if (aac_adapter_check_health(aac)) { printk(KERN_ERR "%s: Host adapter appears dead\n", AAC_DRIVERNAME); return -ENODEV; @@ -381,15 +408,13 @@ static int aac_eh_reset(struct scsi_cmnd* cmd) } } spin_unlock_irqrestore(&dev->list_lock, flags); - if (active) - break; + /* + * We can exit If all the commands are complete + */ + if (active == 0) + return SUCCESS; } - /* - * We can exit If all the commands are complete - */ - if (active == 0) - return SUCCESS; spin_unlock_irq(host->host_lock); scsi_sleep(HZ); spin_lock_irq(host->host_lock); @@ -437,7 +462,7 @@ static int aac_cfg_open(struct inode *inode, struct file *file) static int aac_cfg_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { - return aac_do_ioctl(file->private_data, cmd, (void *)arg); + return aac_do_ioctl(file->private_data, cmd, (void __user *)arg); } static struct file_operations aac_cfg_fops = { @@ -461,7 +486,11 @@ static struct scsi_host_template aac_driver_template = { .this_id = 16, .sg_tablesize = 16, .max_sectors = 128, +#if (AAC_NUM_IO_FIB > 256) + .cmd_per_lun = 256, +#else .cmd_per_lun = AAC_NUM_IO_FIB, +#endif .use_clustering = ENABLE_CLUSTERING, }; @@ -521,7 +550,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, for (container = 0; container < MAXIMUM_NUM_CONTAINERS; container++) fsa_dev_ptr->devname[container][0] = '\0'; - if ((*aac_drivers[index].init)(aac , shost->unique_id)) + if ((*aac_drivers[index].init)(aac)) goto out_free_fibs; /* @@ -552,7 +581,7 @@ static int __devinit aac_probe_one(struct pci_dev *pdev, * dmb - we may need to move the setting of these parms somewhere else once * we get a fib that can report the actual numbers */ - shost->max_id = AAC_MAX_TARGET; + shost->max_id = MAXIMUM_NUM_CONTAINERS; shost->max_lun = AAC_MAX_LUN; error = scsi_add_host(shost, &pdev->dev); @@ -643,12 +672,39 @@ static int __init aac_init(void) printk(KERN_WARNING "aacraid: unable to register \"aac\" device.\n"); } +#ifdef CONFIG_COMPAT + register_ioctl32_conversion(FSACTL_MINIPORT_REV_CHECK, NULL); + register_ioctl32_conversion(FSACTL_SENDFIB, NULL); + register_ioctl32_conversion(FSACTL_OPEN_GET_ADAPTER_FIB, NULL); + register_ioctl32_conversion(FSACTL_GET_NEXT_ADAPTER_FIB, + aac_get_next_adapter_fib_ioctl); + register_ioctl32_conversion(FSACTL_CLOSE_GET_ADAPTER_FIB, NULL); + register_ioctl32_conversion(FSACTL_SEND_RAW_SRB, NULL); + register_ioctl32_conversion(FSACTL_GET_PCI_INFO, NULL); + register_ioctl32_conversion(FSACTL_QUERY_DISK, NULL); + register_ioctl32_conversion(FSACTL_DELETE_DISK, NULL); + register_ioctl32_conversion(FSACTL_FORCE_DELETE_DISK, NULL); + register_ioctl32_conversion(FSACTL_GET_CONTAINERS, NULL); +#endif return 0; } static void __exit aac_exit(void) { +#ifdef CONFIG_COMPAT + unregister_ioctl32_conversion(FSACTL_MINIPORT_REV_CHECK); + unregister_ioctl32_conversion(FSACTL_SENDFIB); + unregister_ioctl32_conversion(FSACTL_OPEN_GET_ADAPTER_FIB); + unregister_ioctl32_conversion(FSACTL_GET_NEXT_ADAPTER_FIB); + unregister_ioctl32_conversion(FSACTL_CLOSE_GET_ADAPTER_FIB); + unregister_ioctl32_conversion(FSACTL_SEND_RAW_SRB); + unregister_ioctl32_conversion(FSACTL_GET_PCI_INFO); + unregister_ioctl32_conversion(FSACTL_QUERY_DISK); + unregister_ioctl32_conversion(FSACTL_DELETE_DISK); + unregister_ioctl32_conversion(FSACTL_FORCE_DELETE_DISK); + unregister_ioctl32_conversion(FSACTL_GET_CONTAINERS); +#endif unregister_chrdev(aac_cfg_major, "aac"); pci_unregister_driver(&aac_pci_driver); }