diff -urNp ref/drivers/scsi/BusLogic.c 2.4.20pre5aa1/drivers/scsi/BusLogic.c --- ref/drivers/scsi/BusLogic.c Tue Jan 22 18:56:14 2002 +++ 2.4.20pre5aa1/drivers/scsi/BusLogic.c Fri Aug 30 06:49:52 2002 @@ -2806,6 +2806,8 @@ int BusLogic_DetectHostAdapter(SCSI_Host memcpy(HostAdapter, PrototypeHostAdapter, sizeof(BusLogic_HostAdapter_T)); HostAdapter->SCSI_Host = Host; HostAdapter->HostNumber = Host->host_no; + spin_lock_init(&HostAdapter->HostAdapterLockIH); + Host->lock = &HostAdapter->HostAdapterLockIH; Host->select_queue_depths = BusLogic_SelectQueueDepths; /* Add Host Adapter to the end of the list of registered BusLogic diff -urNp ref/drivers/scsi/BusLogic.h 2.4.20pre5aa1/drivers/scsi/BusLogic.h --- ref/drivers/scsi/BusLogic.h Tue Jan 22 18:52:09 2002 +++ 2.4.20pre5aa1/drivers/scsi/BusLogic.h Fri Aug 30 06:49:52 2002 @@ -1444,6 +1444,7 @@ typedef struct BusLogic_HostAdapter BusLogic_IncomingMailbox_T *LastIncomingMailbox; BusLogic_IncomingMailbox_T *NextIncomingMailbox; BusLogic_TargetStatistics_T TargetStatistics[BusLogic_MaxTargetDevices]; + spinlock_t HostAdapterLockIH; unsigned char MailboxSpace[BusLogic_MaxMailboxes * (sizeof(BusLogic_OutgoingMailbox_T) + sizeof(BusLogic_IncomingMailbox_T))]; @@ -1531,7 +1532,7 @@ static inline void BusLogic_AcquireHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter, ProcessorFlags_T *ProcessorFlags) { - spin_lock_irqsave(&io_request_lock, *ProcessorFlags); + spin_lock_irqsave(&HostAdapter->HostAdapterLockIH, *ProcessorFlags); } @@ -1544,7 +1545,7 @@ static inline void BusLogic_ReleaseHostAdapterLockIH(BusLogic_HostAdapter_T *HostAdapter, ProcessorFlags_T *ProcessorFlags) { - spin_unlock_irqrestore(&io_request_lock, *ProcessorFlags); + spin_unlock_irqrestore(&HostAdapter->HostAdapterLockIH, *ProcessorFlags); } diff -urNp ref/drivers/scsi/aic7xxx_old/aic7xxx.h 2.4.20pre5aa1/drivers/scsi/aic7xxx_old/aic7xxx.h --- ref/drivers/scsi/aic7xxx_old/aic7xxx.h Thu Aug 29 02:13:15 2002 +++ 2.4.20pre5aa1/drivers/scsi/aic7xxx_old/aic7xxx.h Fri Aug 30 06:49:52 2002 @@ -50,7 +50,8 @@ bios_param: aic7xxx_biosparam, \ can_queue: 255, /* max simultaneous cmds */\ this_id: -1, /* scsi id of host adapter */\ - sg_tablesize: 0, /* max scatter-gather cmds */\ + sg_tablesize: 128, /* max scatter-gather cmds */\ + max_sectors: 2048, /* max sectors in a cmnd */\ cmd_per_lun: 3, /* cmds per lun (linked cmds) */\ present: 0, /* number of 7xxx's present */\ unchecked_isa_dma: 0, /* no memory DMA restrictions */\ diff -urNp ref/drivers/scsi/aic7xxx_old.c 2.4.20pre5aa1/drivers/scsi/aic7xxx_old.c --- ref/drivers/scsi/aic7xxx_old.c Tue Jan 22 18:55:54 2002 +++ 2.4.20pre5aa1/drivers/scsi/aic7xxx_old.c Fri Aug 30 06:49:52 2002 @@ -260,7 +260,7 @@ */ #define VIRT_TO_BUS(a) (unsigned int)virt_to_bus((void *)(a)) -#define AIC7XXX_C_VERSION "5.2.4" +#define AIC7XXX_C_VERSION "5.2.5" #define NUMBER(arr) (sizeof(arr) / sizeof(arr[0])) #define MIN(a,b) (((a) < (b)) ? (a) : (b)) @@ -281,26 +281,6 @@ # define MMAPIO #endif -# if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) -# define cpuid smp_processor_id() -# define DRIVER_LOCK_INIT \ - spin_lock_init(&p->spin_lock); -# define DRIVER_LOCK \ - if(!p->cpu_lock_count[cpuid]) { \ - spin_lock_irqsave(&p->spin_lock, cpu_flags); \ - p->cpu_lock_count[cpuid]++; \ - } else { \ - p->cpu_lock_count[cpuid]++; \ - } -# define DRIVER_UNLOCK \ - if(--p->cpu_lock_count[cpuid] == 0) \ - spin_unlock_irqrestore(&p->spin_lock, cpu_flags); -# else -# define DRIVER_LOCK_INIT -# define DRIVER_LOCK -# define DRIVER_UNLOCK -# endif - /* * You can try raising me if tagged queueing is enabled, or lowering * me if you only have 4 SCBs. @@ -661,10 +641,6 @@ struct hw_scatterlist { unsigned int length; }; -/* - * Maximum number of SG segments these cards can support. - */ -#define AIC7XXX_MAX_SG 128 /* * The maximum number of SCBs we could have for ANY type @@ -990,7 +966,7 @@ struct aic7xxx_host { struct timer_list dev_timer; unsigned long dev_expires[MAX_TARGETS]; - spinlock_t spin_lock; + spinlock_t lock; volatile unsigned char cpu_lock_count[NR_CPUS]; unsigned char dev_last_queue_full[MAX_TARGETS]; @@ -2360,16 +2336,10 @@ scbq_init(volatile scb_queue_type *queue static inline void scbq_insert_head(volatile scb_queue_type *queue, struct aic7xxx_scb *scb) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags; -#endif - - DRIVER_LOCK scb->q_next = queue->head; queue->head = scb; if (queue->tail == NULL) /* If list was empty, update tail. */ queue->tail = queue->head; - DRIVER_UNLOCK } /*+F************************************************************************* @@ -2384,17 +2354,12 @@ static inline struct aic7xxx_scb * scbq_remove_head(volatile scb_queue_type *queue) { struct aic7xxx_scb * scbp; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags; -#endif - DRIVER_LOCK scbp = queue->head; if (queue->head != NULL) queue->head = queue->head->q_next; if (queue->head == NULL) /* If list is now empty, update tail. */ queue->tail = NULL; - DRIVER_UNLOCK return(scbp); } @@ -2409,11 +2374,6 @@ scbq_remove_head(volatile scb_queue_type static inline void scbq_remove(volatile scb_queue_type *queue, struct aic7xxx_scb *scb) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags; -#endif - - DRIVER_LOCK if (queue->head == scb) { /* At beginning of queue, remove from head. */ @@ -2442,7 +2402,6 @@ scbq_remove(volatile scb_queue_type *que } } } - DRIVER_UNLOCK } /*+F************************************************************************* @@ -2456,18 +2415,12 @@ scbq_remove(volatile scb_queue_type *que static inline void scbq_insert_tail(volatile scb_queue_type *queue, struct aic7xxx_scb *scb) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags; -#endif - - DRIVER_LOCK scb->q_next = NULL; if (queue->tail != NULL) /* Add the scb at the end of the list. */ queue->tail->q_next = scb; queue->tail = scb; /* Update the tail. */ if (queue->head == NULL) /* If list was empty, update head. */ queue->head = queue->tail; - DRIVER_UNLOCK } /*+F************************************************************************* @@ -2633,7 +2586,7 @@ static int aic7xxx_allocate_scb(struct aic7xxx_host *p) { struct aic7xxx_scb *scbp = NULL; - int scb_size = (sizeof (struct hw_scatterlist) * AIC7XXX_MAX_SG) + 12 + 6; + int scb_size = (sizeof(struct hw_scatterlist) * p->host->sg_tablesize) + 12 + 6; int i; int step = PAGE_SIZE / 1024; unsigned long scb_count = 0; @@ -2682,7 +2635,7 @@ aic7xxx_allocate_scb(struct aic7xxx_host kfree(scb_ap); return(0); } - bufs = (unsigned char *)&hsgp[scb_count * AIC7XXX_MAX_SG]; + bufs = (unsigned char *)&hsgp[scb_count * p->host->sg_tablesize]; #ifdef AIC7XXX_VERBOSE_DEBUGGING if (aic7xxx_verbose > 0xffff) { @@ -2702,7 +2655,7 @@ aic7xxx_allocate_scb(struct aic7xxx_host { scbp = &scb_ap[i]; scbp->hscb = &p->scb_data->hscbs[p->scb_data->numscbs]; - scbp->sg_list = &hsgp[i * AIC7XXX_MAX_SG]; + scbp->sg_list = &hsgp[i * p->host->sg_tablesize]; scbp->sense_cmd = bufs; scbp->cmnd = bufs + 6; bufs += 12 + 6; @@ -2741,17 +2694,13 @@ aic7xxx_queue_cmd_complete(struct aic7xx * aic7xxx_done_cmds_complete * * Description: - * Process the completed command queue. + * Process the completed command queue. Call with the locks already held. *-F*************************************************************************/ static void aic7xxx_done_cmds_complete(struct aic7xxx_host *p) { Scsi_Cmnd *cmd; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned int cpu_flags = 0; -#endif - DRIVER_LOCK while (p->completeq.head != NULL) { cmd = p->completeq.head; @@ -2759,7 +2708,6 @@ aic7xxx_done_cmds_complete(struct aic7xx cmd->host_scribble = NULL; cmd->scsi_done(cmd); } - DRIVER_UNLOCK } /*+F************************************************************************* @@ -3991,7 +3939,7 @@ aic7xxx_reset_channel(struct aic7xxx_hos * * Description: * Scan the awaiting_scbs queue downloading and starting as many - * scbs as we can. + * scbs as we can. Should be called with the controller lock held. *-F*************************************************************************/ static void aic7xxx_run_waiting_queues(struct aic7xxx_host *p) @@ -3999,9 +3947,6 @@ aic7xxx_run_waiting_queues(struct aic7xx struct aic7xxx_scb *scb; int tindex; int sent; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags = 0; -#endif if (p->waiting_scbs.head == NULL) @@ -4012,7 +3957,6 @@ aic7xxx_run_waiting_queues(struct aic7xx /* * First handle SCBs that are waiting but have been assigned a slot. */ - DRIVER_LOCK while ((scb = scbq_remove_head(&p->waiting_scbs)) != NULL) { tindex = TARGET_INDEX(scb->cmd); @@ -4053,7 +3997,6 @@ aic7xxx_run_waiting_queues(struct aic7xx if (p->activescbs > p->max_activescbs) p->max_activescbs = p->activescbs; } - DRIVER_UNLOCK } #ifdef CONFIG_PCI @@ -4124,10 +4067,10 @@ static void aic7xxx_timer(struct aic7xxx_host *p) { int i, j; - unsigned long cpu_flags = 0; + unsigned long flags = 0; struct aic7xxx_scb *scb; - spin_lock_irqsave(&io_request_lock, cpu_flags); + spin_lock_irqsave(&p->lock, flags); p->dev_timer_active &= ~(0x01 << MAX_TARGETS); if ( (p->dev_timer_active & (0x01 << p->scsi_id)) && time_after_eq(jiffies, p->dev_expires[p->scsi_id]) ) @@ -4184,7 +4127,7 @@ aic7xxx_timer(struct aic7xxx_host *p) } aic7xxx_run_waiting_queues(p); - spin_unlock_irqrestore(&io_request_lock, cpu_flags); + spin_unlock_irqrestore(&p->lock, flags); } /*+F************************************************************************* @@ -7005,13 +6948,19 @@ aic7xxx_isr(int irq, void *dev_id, struc static void do_aic7xxx_isr(int irq, void *dev_id, struct pt_regs *regs) { - unsigned long cpu_flags; + unsigned long flags; struct aic7xxx_host *p; p = (struct aic7xxx_host *)dev_id; if(!p) return; - spin_lock_irqsave(&io_request_lock, cpu_flags); + spin_lock_irqsave(&p->lock, flags); + if(p->flags & AHC_IN_ISR) + { + aic7xxx_isr(irq, dev_id, regs); + spin_unlock_irqrestore(&p->lock, flags); + return; + } p->flags |= AHC_IN_ISR; do { @@ -7019,8 +6968,8 @@ do_aic7xxx_isr(int irq, void *dev_id, st } while ( (aic_inb(p, INTSTAT) & INT_PEND) ); aic7xxx_done_cmds_complete(p); aic7xxx_run_waiting_queues(p); + spin_unlock_irqrestore(&p->lock, flags); p->flags &= ~AHC_IN_ISR; - spin_unlock_irqrestore(&io_request_lock, cpu_flags); } /*+F************************************************************************* @@ -8259,11 +8208,6 @@ aic7xxx_register(Scsi_Host_Template *tem host = p->host; - p->scb_data->maxscbs = AIC7XXX_MAXSCB; - host->can_queue = AIC7XXX_MAXSCB; - host->cmd_per_lun = 3; - host->sg_tablesize = AIC7XXX_MAX_SG; - host->select_queue_depths = aic7xxx_select_queue_depth; host->this_id = p->scsi_id; host->io_port = p->base; host->n_io_port = 0xFF; @@ -8859,7 +8803,6 @@ aic7xxx_alloc(Scsi_Host_Template *sht, s memset(p, 0, sizeof(struct aic7xxx_host)); *p = *temp; p->host = host; - host->max_sectors = 512; p->scb_data = kmalloc(sizeof(scb_data_type), GFP_ATOMIC); if (p->scb_data != NULL) @@ -8877,6 +8820,13 @@ aic7xxx_alloc(Scsi_Host_Template *sht, s scsi_unregister(host); return(NULL); } + p->scb_data->maxscbs = host->can_queue = sht->can_queue; + host->cmd_per_lun = sht->cmd_per_lun; + host->sg_tablesize = sht->sg_tablesize; + host->max_sectors = sht->max_sectors; + host->highmem_io = sht->highmem_io; + host->max_cmd_len = 16; + host->select_queue_depths = aic7xxx_select_queue_depth; p->host_no = host->host_no; p->tagenable = 0; p->orderedtag = 0; @@ -8887,7 +8837,8 @@ aic7xxx_alloc(Scsi_Host_Template *sht, s p->transinfo[i].goal_options = 0; p->transinfo[i].goal_width = MSG_EXT_WDTR_BUS_8_BIT; } - DRIVER_LOCK_INIT + spin_lock_init(&p->lock); + p->host->lock = &p->lock; } scsi_set_pci_device(host, p->pdev); return (p); @@ -9510,7 +9461,6 @@ aic7xxx_detect(Scsi_Host_Template *templ #endif template->proc_name = "aic7xxx"; - template->sg_tablesize = AIC7XXX_MAX_SG; #ifdef CONFIG_PCI @@ -9691,8 +9641,6 @@ aic7xxx_detect(Scsi_Host_Template *templ while ((pdev = pci_find_device(aic_pdevs[i].vendor_id, aic_pdevs[i].device_id, pdev))) { - if (pci_enable_device(pdev)) - continue; if ( i == 0 ) /* We found one, but it's the 7810 RAID cont. */ { if (aic7xxx_verbose & (VERBOSE_PROBE|VERBOSE_PROBE2)) @@ -9738,6 +9686,27 @@ aic7xxx_detect(Scsi_Host_Template *templ } if ( temp_p == NULL ) continue; + if (pci_enable_device(pdev)) + { + kfree(temp_p); + continue; + } + if (pci_set_dma_mask(pdev, (u64) 0xffffffff)) + { + printk("aic7xxx: system doesn't support 32bit DMA, attempting to " + "continue.\n"); + if (pci_set_dma_mask(pdev, (u64) 0x3fffffff)) + { + printk("aic7xxx: system doesn't support 30bit DMA, attempting to " + "continue.\n"); + if (pci_set_dma_mask(pdev, (u64) 0x0fffffff)) + { + printk("aic7xxx: system doesn't support 28bit DMA, failing.\n"); + kfree(temp_p); + continue; + } + } + } if (aic7xxx_verbose & VERBOSE_PROBE2) printk("aic7xxx: <%s> at PCI %d/%d\n", board_names[aic_pdevs[i].board_name_index], @@ -10830,11 +10799,9 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn) #ifdef AIC7XXX_VERBOSE_DEBUGGING int tindex = TARGET_INDEX(cmd); #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags = 0; -#endif p = (struct aic7xxx_host *) cmd->host->hostdata; + /* * Check to see if channel was scanned. */ @@ -10872,9 +10839,7 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn) scb = scbq_remove_head(&p->scb_data->free_scbs); if (scb == NULL) { - DRIVER_LOCK aic7xxx_allocate_scb(p); - DRIVER_UNLOCK scb = scbq_remove_head(&p->scb_data->free_scbs); if(scb == NULL) printk(WARN_LEAD "Couldn't get a free SCB.\n", p->host_no, @@ -10893,9 +10858,7 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn) * of commands outstanding to trigger a later interrupt that will do * that for us, so skip it here. */ - DRIVER_LOCK aic7xxx_isr(p->irq, p, NULL); - DRIVER_UNLOCK scb = scbq_remove_head(&p->scb_data->free_scbs); } scb->cmd = cmd; @@ -10921,13 +10884,11 @@ aic7xxx_queue(Scsi_Cmnd *cmd, void (*fn) scb->flags |= SCB_ACTIVE | SCB_WAITINGQ; - DRIVER_LOCK scbq_insert_tail(&p->waiting_scbs, scb); if ( (p->flags & (AHC_IN_ISR | AHC_IN_ABORT | AHC_IN_RESET)) == 0) { aic7xxx_run_waiting_queues(p); } - DRIVER_UNLOCK return (0); } @@ -11166,9 +11127,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) struct aic7xxx_host *p; int result, found=0; unsigned char tmp_char, saved_hscbptr, next_hscbptr, prev_hscbptr; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags = 0; -#endif p = (struct aic7xxx_host *) cmd->host->hostdata; scb = (p->scb_data->scb_array[aic7xxx_position(cmd)]); @@ -11184,8 +11142,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) if (aic7xxx_panic_on_abort) aic7xxx_panic_abort(p, cmd); - DRIVER_LOCK - /* * Run the isr to grab any command in the QOUTFIFO and any other misc. * assundry tasks. This should also set up the bh handler if there is @@ -11207,7 +11163,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) printk(INFO_LEAD "Abort called with bogus Scsi_Cmnd " "pointer.\n", p->host_no, CTL_OF_CMD(cmd)); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_ABORT_NOT_RUNNING); } if (scb->cmd != cmd) /* Hmmm...either this SCB is currently free with a */ @@ -11225,7 +11180,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) printk(INFO_LEAD "Abort called for already completed" " command.\n", p->host_no, CTL_OF_CMD(cmd)); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_ABORT_NOT_RUNNING); } @@ -11260,7 +11214,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) printk(INFO_LEAD "SCB aborted once already, " "escalating.\n", p->host_no, CTL_OF_SCB(scb)); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_ABORT_SNOOZE); } if ( (p->flags & (AHC_RESET_PENDING | AHC_ABORT_PENDING)) || @@ -11271,7 +11224,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) printk(INFO_LEAD "Reset/Abort pending for this " "device, not wasting our time.\n", p->host_no, CTL_OF_SCB(scb)); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_ABORT_PENDING); } @@ -11333,7 +11285,7 @@ aic7xxx_abort(Scsi_Cmnd *cmd) p->flags &= ~AHC_IN_ABORT; scb->flags |= SCB_RECOVERY_SCB; /* Note the fact that we've been */ p->flags |= AHC_ABORT_PENDING; /* here so we will know not to */ - DRIVER_UNLOCK /* muck with other SCBs if this */ + /* muck with other SCBs if this */ return(SCSI_ABORT_PENDING); /* one doesn't complete and clear */ break; /* out. */ default: @@ -11459,7 +11411,6 @@ aic7xxx_abort(Scsi_Cmnd *cmd) } p->flags &= ~AHC_IN_ABORT; unpause_sequencer(p, FALSE); - DRIVER_UNLOCK /* * On the return value. If we found the command and aborted it, then we know @@ -11489,15 +11440,12 @@ aic7xxx_abort(Scsi_Cmnd *cmd) * the SCSI bus reset line. *-F*************************************************************************/ int -aic7xxx_reset(Scsi_Cmnd *cmd, unsigned int flags) +aic7xxx_reset(Scsi_Cmnd *cmd, unsigned int reset_flags) { struct aic7xxx_scb *scb = NULL; struct aic7xxx_host *p; int tindex; int result = -1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - unsigned long cpu_flags = 0; -#endif #define DEVICE_RESET 0x01 #define BUS_RESET 0x02 #define HOST_RESET 0x04 @@ -11527,15 +11475,13 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i if (aic7xxx_panic_on_abort) aic7xxx_panic_abort(p, cmd); - DRIVER_LOCK - pause_sequencer(p); - if(flags & SCSI_RESET_SYNCHRONOUS) + if(reset_flags & SCSI_RESET_SYNCHRONOUS) { if (aic7xxx_verbose & VERBOSE_RESET_MID) - printk(INFO_LEAD "Reset called for a SYNCHRONOUS reset, flags 0x%x, " - "cmd->result 0x%x.\n", p->host_no, CTL_OF_CMD(cmd), flags, + printk(INFO_LEAD "Reset for a SYNCHRONOUS reset, reset_flags 0x%x, " + "cmd->result 0x%x.\n", p->host_no, CTL_OF_CMD(cmd), reset_flags, cmd->result); scb = NULL; action = HOST_RESET; @@ -11548,7 +11494,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i aic7xxx_done_cmds_complete(p); aic7xxx_run_waiting_queues(p); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_RESET_NOT_RUNNING); } else @@ -11556,11 +11501,11 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i if (aic7xxx_verbose & VERBOSE_RESET_MID) printk(INFO_LEAD "Reset called, scb %d, flags " "0x%x\n", p->host_no, CTL_OF_SCB(scb), scb->hscb->tag, scb->flags); - if ( flags & SCSI_RESET_SUGGEST_HOST_RESET ) + if ( reset_flags & SCSI_RESET_SUGGEST_HOST_RESET ) { action = HOST_RESET; } - else if ( flags & SCSI_RESET_SUGGEST_BUS_RESET ) + else if ( reset_flags & SCSI_RESET_SUGGEST_BUS_RESET ) { action = BUS_RESET; } @@ -11585,7 +11530,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i */ aic7xxx_run_waiting_queues(p); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK return(SCSI_RESET_SUCCESS); } @@ -11650,7 +11594,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i case RESET_DELAY: aic7xxx_run_waiting_queues(p); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK if(scb == NULL) return(SCSI_RESET_PUNT); else @@ -11665,7 +11608,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i aic7xxx_run_waiting_queues(p); unpause_sequencer(p, FALSE); p->flags &= ~AHC_IN_RESET; - DRIVER_UNLOCK return(result); break; case BUS_RESET: @@ -11700,7 +11642,7 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i p->msg_len = 0; } #if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,95) - if(flags & SCSI_RESET_SYNCHRONOUS) + if(reset_flags & SCSI_RESET_SYNCHRONOUS) { cmd->result = DID_RESET << 16; cmd->done(cmd); @@ -11716,7 +11658,6 @@ aic7xxx_reset(Scsi_Cmnd *cmd, unsigned i */ aic7xxx_run_waiting_queues(p); unpause_sequencer(p, FALSE); - DRIVER_UNLOCK if(scb == NULL) return(SCSI_RESET_SUCCESS|SCSI_RESET_HOST_RESET); else diff -urNp ref/drivers/scsi/megaraid.c 2.4.20pre5aa1/drivers/scsi/megaraid.c --- ref/drivers/scsi/megaraid.c Thu Aug 29 02:13:15 2002 +++ 2.4.20pre5aa1/drivers/scsi/megaraid.c Fri Aug 30 06:49:52 2002 @@ -586,8 +586,8 @@ MODULE_LICENSE ("GPL"); #define DRIVER_LOCK(p) #define DRIVER_UNLOCK(p) #define IO_LOCK_T unsigned long io_flags = 0 -#define IO_LOCK spin_lock_irqsave(&io_request_lock,io_flags); -#define IO_UNLOCK spin_unlock_irqrestore(&io_request_lock,io_flags); +#define IO_LOCK spin_lock_irqsave(&megaCfg->lock,io_flags); +#define IO_UNLOCK spin_unlock_irqrestore(&megaCfg->lock,io_flags); #define queue_task_irq(a,b) queue_task(a,b) #define queue_task_irq_off(a,b) queue_task(a,b) @@ -2991,6 +2991,8 @@ static int mega_findCard (Scsi_Host_Temp megaCfg->int_qh = NULL; megaCfg->int_qt = NULL; megaCfg->int_qlen = 0; + spin_lock_init(&megaCfg->lock); + host->lock = &megaCfg->lock; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) megaCfg->dev = pdev; @@ -3801,7 +3803,7 @@ int megaraid_queue (Scsi_Cmnd * SCpnt, v if (pScb->SCpnt->cmnd[0] == M_RD_IOCTL_CMD_NEW) { init_MUTEX_LOCKED (&pScb->ioctl_sem); - spin_unlock_irq (&io_request_lock); + spin_unlock_irq (&megaCfg->lock); down (&pScb->ioctl_sem); user_area = (char *)*((u32*)&pScb->SCpnt->cmnd[4]); if (copy_to_user @@ -3810,7 +3812,7 @@ int megaraid_queue (Scsi_Cmnd * SCpnt, v ("megaraid: Error copying ioctl return value to user buffer.\n"); pScb->SCpnt->result = (DID_ERROR << 16); } - spin_lock_irq (&io_request_lock); + spin_lock_irq (&megaCfg->lock); DRIVER_LOCK (megaCfg); kfree (pScb->buff_ptr); pScb->buff_ptr = NULL; @@ -4549,7 +4551,7 @@ static int megadev_ioctl (struct inode * struct uioctl_t *uioc; dma_addr_t dma_addr; u32 length; - mega_host_config *megacfg = NULL; + mega_host_config *megaCfg = NULL; #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) /* 0x020400 */ struct pci_dev pdev; struct pci_dev *pdevp = &pdev; @@ -4687,7 +4689,7 @@ static int megadev_ioctl (struct inode * */ for( shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next ) { if( shpnt->hostdata == (unsigned long *)megaCtlrs[adapno] ) { - megacfg = (mega_host_config *)shpnt->hostdata; + megaCfg = (mega_host_config *)shpnt->hostdata; break; } } @@ -4707,7 +4709,7 @@ static int megadev_ioctl (struct inode * if( outlen || inlen ) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pdevp = &pdev; - memcpy(pdevp, megacfg->dev, sizeof(struct pci_dev)); + memcpy(pdevp, megaCfg->dev, sizeof(struct pci_dev)); pdevp->dma_mask = 0xffffffff; #else pdevp = NULL; @@ -4807,7 +4809,7 @@ static int megadev_ioctl (struct inode * */ for( shpnt = scsi_hostlist; shpnt; shpnt = shpnt->next ) { if( shpnt->hostdata == (unsigned long *)megaCtlrs[adapno] ) { - megacfg = (mega_host_config *)shpnt->hostdata; + megaCfg = (mega_host_config *)shpnt->hostdata; break; } } @@ -4819,14 +4821,14 @@ static int megadev_ioctl (struct inode * */ if( ioc.mbox[0] == FC_DEL_LOGDRV && ioc.mbox[2] == OP_DEL_LOGDRV ) { - if( !megacfg->support_random_del ) { + if( !megaCfg->support_random_del ) { printk("megaraid: logdrv delete on non supporting f/w.\n"); return -EINVAL; } uioc = (struct uioctl_t *)arg; - ret = mega_del_logdrv(megacfg, ioc.mbox[3]); + ret = mega_del_logdrv(megaCfg, ioc.mbox[3]); put_user(1, &uioc->mbox[16]); /* numstatus */ put_user(ret, &uioc->mbox[17]); /* status */ @@ -4849,7 +4851,7 @@ static int megadev_ioctl (struct inode * if (outlen || inlen) { #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) pdevp = &pdev; - memcpy(pdevp, megacfg->dev, sizeof(struct pci_dev)); + memcpy(pdevp, megaCfg->dev, sizeof(struct pci_dev)); pdevp->dma_mask = 0xffffffff; #else pdevp = NULL; @@ -5100,6 +5102,7 @@ mega_del_logdrv(mega_host_config *this_h IO_LOCK_T; DECLARE_WAIT_QUEUE_HEAD(wq); mega_scb *scbp; + mega_host_config *megaCfg = this_hba; /* * Stop sending commands to the controller, queue them internally. diff -urNp ref/drivers/scsi/megaraid.h 2.4.20pre5aa1/drivers/scsi/megaraid.h --- ref/drivers/scsi/megaraid.h Thu Aug 29 02:13:15 2002 +++ 2.4.20pre5aa1/drivers/scsi/megaraid.h Fri Aug 30 06:49:52 2002 @@ -4,6 +4,7 @@ #ifndef LINUX_VERSION_CODE #include #endif +#include /* * For state flag. Do not use LSB(8 bits) which are @@ -782,6 +783,7 @@ typedef struct _mega_host_config { mega_scb *int_qh; /* commands are queued in the internal queue */ mega_scb *int_qt; /* while the hba is quiescent */ int int_qlen; + spinlock_t lock; } mega_host_config; typedef struct _driver_info { diff -urNp ref/drivers/scsi/qlogicfc.c 2.4.20pre5aa1/drivers/scsi/qlogicfc.c --- ref/drivers/scsi/qlogicfc.c Fri Aug 9 14:52:18 2002 +++ 2.4.20pre5aa1/drivers/scsi/qlogicfc.c Fri Aug 30 06:50:23 2002 @@ -1343,7 +1343,7 @@ int isp2x00_queuecommand(Scsi_Cmnd * Cmn num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr); num_free = (num_free > 2) ? num_free - 2 : 0; - host->can_queue = host->host_busy + num_free; + host->can_queue = atomic_read(&host->host_busy) + num_free; if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN) host->can_queue = QLOGICFC_REQ_QUEUE_LEN; host->sg_tablesize = QLOGICFC_MAX_SG(num_free); @@ -1616,7 +1616,7 @@ void isp2x00_intr_handler(int irq, void num_free = QLOGICFC_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr); num_free = (num_free > 2) ? num_free - 2 : 0; - host->can_queue = host->host_busy + num_free; + host->can_queue = atomic_read(&host->host_busy) + num_free; if (host->can_queue > QLOGICFC_REQ_QUEUE_LEN) host->can_queue = QLOGICFC_REQ_QUEUE_LEN; host->sg_tablesize = QLOGICFC_MAX_SG(num_free); diff -urNp ref/drivers/scsi/qlogicisp.c 2.4.20pre5aa1/drivers/scsi/qlogicisp.c --- ref/drivers/scsi/qlogicisp.c Tue Jan 22 18:55:25 2002 +++ 2.4.20pre5aa1/drivers/scsi/qlogicisp.c Fri Aug 30 06:49:52 2002 @@ -957,7 +957,7 @@ int isp1020_queuecommand(Scsi_Cmnd *Cmnd hostdata->req_in_ptr = in_ptr; num_free = QLOGICISP_REQ_QUEUE_LEN - REQ_QUEUE_DEPTH(in_ptr, out_ptr); - host->can_queue = host->host_busy + num_free; + host->can_queue = atomic_read(&host->host_busy) + num_free; host->sg_tablesize = QLOGICISP_MAX_SG(num_free); LEAVE("isp1020_queuecommand"); --- kgdb/drivers/scsi/sg.c.~1~ Fri Aug 9 14:52:18 2002 +++ kgdb/drivers/scsi/sg.c Sun Sep 1 06:34:05 2002 @@ -2974,7 +2974,7 @@ static int sg_proc_dev_info(char * buffe PRINT_PROC("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\t%d\n", scsidp->host->host_no, scsidp->channel, scsidp->id, scsidp->lun, (int)scsidp->type, (int)scsidp->access_count, - (int)scsidp->queue_depth, (int)scsidp->device_busy, + (int)scsidp->queue_depth, (int)atomic_read(&scsidp->device_busy), (int)scsidp->online); else PRINT_PROC("-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\t-1\n");