GIT 3fd88a1c396b1d9433af89f72b29b2c0c974c6ee git+ssh://master.kernel.org/pub/scm/linux/kernel/git/willy/sym2.git commit 3fd88a1c396b1d9433af89f72b29b2c0c974c6ee Author: Matthew Wilcox Date: Sun Dec 18 10:00:34 2005 -0500 [SCSI] Disable sym2 driver queueing Undef SYM_OPT_HANDLE_DEVICE_QUEUEING. Call sym_put_start_queue instead of sym_start_next_ccbs. Turn asserts into checks that we can send the command to the adapter, and return busy from queuecommand if we can't. Signed-off-by: Matthew Wilcox commit 43561f6ebf40b92ab08261d9fb51449a5ef2c282 Author: Matthew Wilcox Date: Sat Dec 17 00:08:14 2005 -0500 [SCSI] Use ARRAY_SIZE in constants.c Eliminate custom definitions and use ARRAY_SIZE directly. Signed-off-by: Matthew Wilcox commit 6e21ae50ddf96e66f66f1dec19e8f473ab8a6af3 Author: Matthew Wilcox Date: Mon Dec 12 12:07:54 2005 -0500 [SYM2] Mark div_10M array const Patch below is one out of a large series to mark kernel data const when possible, goal is to use .rodata and avoid false sharing Signed-off-by: Arjan van de Ven Signed-off-by: Matthew Wilcox commit 6357aa1effbd4547bb52aca837ee45db75afea20 Author: Matthew Wilcox Date: Tue Dec 6 17:10:24 2005 -0500 [SYM2] Simplify error handling a bit - to_do was never set to SYM_EH_DO_COMPLETE, so remove that code - move the spinlocks inside the common error handler code path Signed-off-by: Matthew Wilcox commit b5d641b0098e2ae2263f6fa8f24fa18fcbe831ef Author: Matthew Wilcox Date: Mon Dec 5 13:55:21 2005 -0500 [SYM2] Use pcibios_resource_to_bus() We had our own code (pci_get_base_address()) to get the bus address of a BAR. We can get this using pcibios_resource_to_bus() instead. Signed-off-by: Matthew Wilcox commit 2742031244eaa8f93da868025f9f9168e5d6afc5 Author: Matthew Wilcox Date: Mon Dec 5 09:26:02 2005 -0500 [SYM2] Change Kconfig option from IOMAPPED to MMIO Most of the Kconfig options for switching between IO Port and MMIO operations use the opposite sense from sym2. Really, this option should be set at a chipset level rather than per-driver. Signed-off-by: Matthew Wilcox commit ad290715ebb20c006171eb297de81111c5ddf348 Author: Matthew Wilcox Date: Thu Nov 17 13:49:32 2005 -0500 [SYM] Version 2.2.2 Update version number to 2.2.2 Signed-off-by: Matthew Wilcox commit 2d9e3ce82a8a754cf84be377165dc7214944e55b Author: Matthew Wilcox Date: Thu Nov 17 13:10:12 2005 -0500 [SYM2] Report disabled devices and LUNs more attractively Rather than print a list of targets at driver init time, print each disabled target as we attempt to scan it. Signed-off-by: Matthew Wilcox commit 334ca2a5a0cd5d4e8b5d68ce81ef1baa0acd3cbc Author: Matthew Wilcox Date: Thu Nov 17 13:05:25 2005 -0500 [SYM2] Allow NVRAM settings to limit speed and width The NVRAM for both Tekram and Symbios boards allows the user to set the speed and width for individual targets. I took that code out in March 2004 when we introduced Domain Validation, but it seems there's still a legitimate need for it in some configurations. Signed-off-by: Matthew Wilcox commit b8a84ef674909ad4f46015e2ad9c512e17ecc6d3 Author: Matthew Wilcox Date: Thu Nov 17 09:46:05 2005 -0500 [SYM2] Use scsi_print_msg sym_show_msg was almost a duplicate of scsi_print_msg, except not as featureful. So use the common code instead. Signed-off-by: Matthew Wilcox commit 719898c8be5a1acdd48dfaf60a337e1b36c32a59 Author: Matthew Wilcox Date: Wed Nov 16 22:58:21 2005 -0500 [SYM2] Negotiate correctly with async-only devices When we got a device only capable of async, we would zero out goal->period which would cause us to try PPR negotiations. Leave goal->period alone, and check goal->offset before doing PPR. Kudos to Daniel Forsgren for figuring this out. Signed-off-by: Matthew Wilcox commit adf11e5111a559aedf0160ebd56708b625ca38d4 Author: Matthew Wilcox Date: Tue Nov 15 14:24:48 2005 -0500 [SYM2] Disable IU and QAS negotiation Enabling these features causes problems with some drives, so disable them until they're debugged Signed-off-by: Matthew Wilcox commit 4ffa94c6b6bf4b80857e22fb0a2813e4b3298402 Author: Matthew Wilcox Date: Tue Nov 15 12:59:09 2005 -0500 [SYM2] Use DMA_40BIT_MASK constant Now that this constant has been added to dma-mapping.h, we don't need our own definition Signed-off-by: Matthew Wilcox commit 15a1cca64aced042ec913e4cf00c7cbad661820b Author: Christoph Hellwig Date: Tue Nov 15 12:57:17 2005 -0500 [SYM2] Remove code to handle DMA_BIDIRECTION requests The upper layer doesn't send these down since 2.4.x (or 2.6 in practice), so no need to handle it. Inline sym_setup_data_pointers into its only caller so we can fail gracefully in the case we'd get one neverless. Signed-off-by: Christoph Hellwig Signed-off-by: Matthew Wilcox commit d1fa3658c5837cd3284f0cee1d03025b6eff4f50 Author: Christoph Hellwig Date: Tue Nov 15 12:55:37 2005 -0500 [SYM2] Manage sym_lcb properly Allocate the lcb in slave_alloc and free it in slave_destroy. This allows us to remove all the code that checks to see if it's already been allocated. From: Christoph Hellwig Signed-off-by: Matthew Wilcox commit 202ebf1182030b892cfd8ae48389eb4504c0b606 Author: Christoph Hellwig Date: Tue Nov 15 12:51:50 2005 -0500 [SYM2] Remove last vestiges of sym_sniff_inquiry The SYM_OPT_SNIFF_INQUIRY define is never set any more, and the sym_sniff_inquiry() function doesn't exist From: Christoph Hellwig Signed-off-by: Matthew Wilcox commit 2af497794dd514ee3ea22fd6de7f62efbdd296b4 Author: Matthew Wilcox Date: Tue Nov 15 12:23:11 2005 -0500 [SYM2] Remove FreeBSD ifdefs Remove FreeBSD ifdefs from sym2 driver Signed-off-by: Matthew Wilcox --- diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 4c42065..724b4bd 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig @@ -1071,7 +1071,7 @@ config SCSI_SYM53C8XX_DMA_ADDRESSING_MOD memory using PCI DAC cycles. config SCSI_SYM53C8XX_DEFAULT_TAGS - int "default tagged command queue depth" + int "Default tagged command queue depth" depends on SCSI_SYM53C8XX_2 default "16" help @@ -1082,7 +1082,7 @@ config SCSI_SYM53C8XX_DEFAULT_TAGS exceed CONFIG_SCSI_SYM53C8XX_MAX_TAGS. config SCSI_SYM53C8XX_MAX_TAGS - int "maximum number of queued commands" + int "Maximum number of queued commands" depends on SCSI_SYM53C8XX_2 default "64" help @@ -1091,13 +1091,14 @@ config SCSI_SYM53C8XX_MAX_TAGS possible. The driver supports up to 256 queued commands per device. This value is used as a compiled-in hard limit. -config SCSI_SYM53C8XX_IOMAPPED - bool "use port IO" +config SCSI_SYM53C8XX_MMIO + bool "Use memory mapped IO" depends on SCSI_SYM53C8XX_2 + default y help - If you say Y here, the driver will use port IO to access - the card. This is significantly slower then using memory - mapped IO. Most people should answer N. + Memory mapped IO is faster than Port IO. Most people should + answer Y here, but some machines may have problems. If you have + to answer N here, please report the problem to the maintainer. config SCSI_IPR tristate "IBM Power Linux RAID adapter support" diff --git a/drivers/scsi/constants.c b/drivers/scsi/constants.c index 30a3353..371dd5e 100644 --- a/drivers/scsi/constants.c +++ b/drivers/scsi/constants.c @@ -114,8 +114,6 @@ static const struct value_name_pair main {0xd, "Report supported task management functions"}, {0xe, "Report priority"}, }; -#define MAINT_IN_SZ \ - (int)(sizeof(maint_in_arr) / sizeof(maint_in_arr[0])) static const struct value_name_pair maint_out_arr[] = { {0x6, "Set device identifier"}, @@ -123,34 +121,24 @@ static const struct value_name_pair main {0xb, "Change aliases"}, {0xe, "Set priority"}, }; -#define MAINT_OUT_SZ \ - (int)(sizeof(maint_out_arr) / sizeof(maint_out_arr[0])) static const struct value_name_pair serv_in12_arr[] = { {0x1, "Read media serial number"}, }; -#define SERV_IN12_SZ \ - (int)(sizeof(serv_in12_arr) / sizeof(serv_in12_arr[0])) static const struct value_name_pair serv_out12_arr[] = { {-1, "dummy entry"}, }; -#define SERV_OUT12_SZ \ - (int)(sizeof(serv_out12_arr) / sizeof(serv_in12_arr[0])) static const struct value_name_pair serv_in16_arr[] = { {0x10, "Read capacity(16)"}, {0x11, "Read long(16)"}, }; -#define SERV_IN16_SZ \ - (int)(sizeof(serv_in16_arr) / sizeof(serv_in16_arr[0])) static const struct value_name_pair serv_out16_arr[] = { {0x11, "Write long(16)"}, {0x1f, "Notify data transfer device(16)"}, }; -#define SERV_OUT16_SZ \ - (int)(sizeof(serv_out16_arr) / sizeof(serv_in16_arr[0])) static const struct value_name_pair variable_length_arr[] = { {0x1, "Rebuild(32)"}, @@ -190,8 +178,6 @@ static const struct value_name_pair vari {0x8f7e, "Perform SCSI command (osd)"}, {0x8f7f, "Perform task management function (osd)"}, }; -#define VARIABLE_LENGTH_SZ \ - (int)(sizeof(variable_length_arr) / sizeof(variable_length_arr[0])) static const char * get_sa_name(const struct value_name_pair * arr, int arr_sz, int service_action) @@ -223,7 +209,7 @@ static void print_opcode_name(unsigned c break; } sa = (cdbp[8] << 8) + cdbp[9]; - name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); + name = get_sa_name(maint_in_arr, ARRAY_SIZE(maint_in_arr), sa); if (name) { printk("%s%s", leadin, name); if ((cdb_len > 0) && (len != cdb_len)) @@ -238,7 +224,7 @@ static void print_opcode_name(unsigned c break; case MAINTENANCE_IN: sa = cdbp[1] & 0x1f; - name = get_sa_name(maint_in_arr, MAINT_IN_SZ, sa); + name = get_sa_name(maint_in_arr, ARRAY_SIZE(maint_in_arr), sa); if (name) printk("%s%s", leadin, name); else @@ -246,7 +232,8 @@ static void print_opcode_name(unsigned c break; case MAINTENANCE_OUT: sa = cdbp[1] & 0x1f; - name = get_sa_name(maint_out_arr, MAINT_OUT_SZ, sa); + name = get_sa_name(maint_out_arr, ARRAY_SIZE(maint_out_arr), + sa); if (name) printk("%s%s", leadin, name); else @@ -254,7 +241,8 @@ static void print_opcode_name(unsigned c break; case SERVICE_ACTION_IN_12: sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_in12_arr, SERV_IN12_SZ, sa); + name = get_sa_name(serv_in12_arr, ARRAY_SIZE(serv_in12_arr), + sa); if (name) printk("%s%s", leadin, name); else @@ -262,7 +250,8 @@ static void print_opcode_name(unsigned c break; case SERVICE_ACTION_OUT_12: sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_out12_arr, SERV_OUT12_SZ, sa); + name = get_sa_name(serv_out12_arr, ARRAY_SIZE(serv_out12_arr), + sa); if (name) printk("%s%s", leadin, name); else @@ -270,7 +259,8 @@ static void print_opcode_name(unsigned c break; case SERVICE_ACTION_IN_16: sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_in16_arr, SERV_IN16_SZ, sa); + name = get_sa_name(serv_in16_arr, ARRAY_SIZE(serv_in16_arr), + sa); if (name) printk("%s%s", leadin, name); else @@ -278,7 +268,8 @@ static void print_opcode_name(unsigned c break; case SERVICE_ACTION_OUT_16: sa = cdbp[1] & 0x1f; - name = get_sa_name(serv_out16_arr, SERV_OUT16_SZ, sa); + name = get_sa_name(serv_out16_arr, ARRAY_SIZE(serv_out16_arr), + sa); if (name) printk("%s%s", leadin, name); else @@ -1293,14 +1284,13 @@ static const char * const hostbyte_table "DID_OK", "DID_NO_CONNECT", "DID_BUS_BUSY", "DID_TIME_OUT", "DID_BAD_TARGET", "DID_ABORT", "DID_PARITY", "DID_ERROR", "DID_RESET", "DID_BAD_INTR", "DID_PASSTHROUGH", "DID_SOFT_ERROR", "DID_IMM_RETRY"}; -#define NUM_HOSTBYTE_STRS (sizeof(hostbyte_table) / sizeof(const char *)) void scsi_print_hostbyte(int scsiresult) { int hb = host_byte(scsiresult); printk("Hostbyte=0x%02x", hb); - if (hb < NUM_HOSTBYTE_STRS) + if (hb < ARRAY_SIZE(hostbyte_table)) printk("(%s) ", hostbyte_table[hb]); else printk("is invalid "); @@ -1317,12 +1307,10 @@ void scsi_print_hostbyte(int scsiresult) static const char * const driverbyte_table[]={ "DRIVER_OK", "DRIVER_BUSY", "DRIVER_SOFT", "DRIVER_MEDIA", "DRIVER_ERROR", "DRIVER_INVALID", "DRIVER_TIMEOUT", "DRIVER_HARD", "DRIVER_SENSE"}; -#define NUM_DRIVERBYTE_STRS (sizeof(driverbyte_table) / sizeof(const char *)) static const char * const driversuggest_table[]={"SUGGEST_OK", "SUGGEST_RETRY", "SUGGEST_ABORT", "SUGGEST_REMAP", "SUGGEST_DIE", "SUGGEST_5", "SUGGEST_6", "SUGGEST_7", "SUGGEST_SENSE"}; -#define NUM_SUGGEST_STRS (sizeof(driversuggest_table) / sizeof(const char *)) void scsi_print_driverbyte(int scsiresult) { @@ -1331,8 +1319,10 @@ void scsi_print_driverbyte(int scsiresul printk("Driverbyte=0x%02x ", driver_byte(scsiresult)); printk("(%s,%s) ", - (dr < NUM_DRIVERBYTE_STRS ? driverbyte_table[dr] : "invalid"), - (su < NUM_SUGGEST_STRS ? driversuggest_table[su] : "invalid")); + (dr < ARRAY_SIZE(driverbyte_table) ? + driverbyte_table[dr] : "invalid"), + (su < ARRAY_SIZE(driversuggest_table) ? + driversuggest_table[su] : "invalid")); } #else void scsi_print_driverbyte(int scsiresult) diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.c b/drivers/scsi/sym53c8xx_2/sym_glue.c index 1fffd2b..a27dd66 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.c +++ b/drivers/scsi/sym53c8xx_2/sym_glue.c @@ -134,45 +134,6 @@ static void sym2_setup_params(void) } } -/* - * We used to try to deal with 64-bit BARs here, but don't any more. - * There are many parts of this driver which would need to be modified - * to handle a 64-bit base address, including scripts. I'm uncomfortable - * with making those changes when I have no way of testing it, so I'm - * just going to disable it. - * - * Note that some machines (eg HP rx8620 and Superdome) have bus addresses - * below 4GB and physical addresses above 4GB. These will continue to work. - */ -static int __devinit -pci_get_base_address(struct pci_dev *pdev, int index, unsigned long *basep) -{ - u32 tmp; - unsigned long base; -#define PCI_BAR_OFFSET(index) (PCI_BASE_ADDRESS_0 + (index<<2)) - - pci_read_config_dword(pdev, PCI_BAR_OFFSET(index++), &tmp); - base = tmp; - if ((tmp & 0x7) == PCI_BASE_ADDRESS_MEM_TYPE_64) { - pci_read_config_dword(pdev, PCI_BAR_OFFSET(index++), &tmp); - if (tmp > 0) { - dev_err(&pdev->dev, - "BAR %d is 64-bit, disabling\n", index - 1); - base = 0; - } - } - - if ((base & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) { - base &= PCI_BASE_ADDRESS_IO_MASK; - } else { - base &= PCI_BASE_ADDRESS_MEM_MASK; - } - - *basep = base; - return index; -#undef PCI_BAR_OFFSET -} - static struct scsi_transport_template *sym2_transport_template = NULL; /* @@ -514,8 +475,6 @@ static inline int sym_setup_cdb(struct s */ int sym_setup_data_and_start(struct sym_hcb *np, struct scsi_cmnd *cmd, struct sym_ccb *cp) { - struct sym_tcb *tp = &np->target[cp->target]; - struct sym_lcb *lp = sym_lp(tp, cp->lun); u32 lastp, goalp; int dir; @@ -596,7 +555,7 @@ int sym_setup_data_and_start(struct sym_ /* * activate this job. */ - sym_start_next_ccbs(np, lp, 2); + sym_put_start_queue(np, cp); return 0; out_abort: @@ -751,7 +710,6 @@ static void sym53c8xx_timer(unsigned lon * What we will do regarding the involved SCSI command. */ #define SYM_EH_DO_IGNORE 0 -#define SYM_EH_DO_COMPLETE 1 #define SYM_EH_DO_WAIT 2 /* @@ -803,25 +761,18 @@ static int sym_eh_handler(int op, char * dev_warn(&cmd->device->sdev_gendev, "%s operation started.\n", opname); + spin_lock_irq(cmd->device->host->host_lock); /* This one is queued in some place -> to wait for completion */ FOR_EACH_QUEUED_ELEMENT(&np->busy_ccbq, qp) { struct sym_ccb *cp = sym_que_entry(qp, struct sym_ccb, link_ccbq); if (cp->cmd == cmd) { to_do = SYM_EH_DO_WAIT; - goto prepare; + break; } } -prepare: - /* Prepare stuff to either ignore, complete or wait for completion */ - switch(to_do) { - default: - case SYM_EH_DO_IGNORE: - break; - case SYM_EH_DO_WAIT: + if (to_do == SYM_EH_DO_WAIT) { init_completion(&ep->done); - /* fall through */ - case SYM_EH_DO_COMPLETE: ep->old_done = cmd->scsi_done; cmd->scsi_done = sym_eh_done; SYM_UCMD_PTR(cmd)->eh_wait = ep; @@ -857,9 +808,6 @@ prepare: } ep->to_do = to_do; - /* Complete the command with locks held as required by the driver */ - if (to_do == SYM_EH_DO_COMPLETE) - sym_xpt_done2(np, cmd, DID_ABORT); /* Wait for completion with locks released, as required by kernel */ if (to_do == SYM_EH_DO_WAIT) { @@ -875,6 +823,7 @@ prepare: if (ep->timed_out) sts = -2; } + spin_unlock_irq(cmd->device->host->host_lock); dev_warn(&cmd->device->sdev_gendev, "%s operation %s.\n", opname, sts==0 ? "complete" :sts==-2 ? "timed-out" : "failed"); return sts ? SCSI_FAILED : SCSI_SUCCESS; @@ -886,46 +835,22 @@ prepare: */ static int sym53c8xx_eh_abort_handler(struct scsi_cmnd *cmd) { - int rc; - - spin_lock_irq(cmd->device->host->host_lock); - rc = sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd); - spin_unlock_irq(cmd->device->host->host_lock); - - return rc; + return sym_eh_handler(SYM_EH_ABORT, "ABORT", cmd); } static int sym53c8xx_eh_device_reset_handler(struct scsi_cmnd *cmd) { - int rc; - - spin_lock_irq(cmd->device->host->host_lock); - rc = sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd); - spin_unlock_irq(cmd->device->host->host_lock); - - return rc; + return sym_eh_handler(SYM_EH_DEVICE_RESET, "DEVICE RESET", cmd); } static int sym53c8xx_eh_bus_reset_handler(struct scsi_cmnd *cmd) { - int rc; - - spin_lock_irq(cmd->device->host->host_lock); - rc = sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd); - spin_unlock_irq(cmd->device->host->host_lock); - - return rc; + return sym_eh_handler(SYM_EH_BUS_RESET, "BUS RESET", cmd); } static int sym53c8xx_eh_host_reset_handler(struct scsi_cmnd *cmd) { - int rc; - - spin_lock_irq(cmd->device->host->host_lock); - rc = sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); - spin_unlock_irq(cmd->device->host->host_lock); - - return rc; + return sym_eh_handler(SYM_EH_HOST_RESET, "HOST RESET", cmd); } /* @@ -944,15 +869,12 @@ static void sym_tune_dev_queuing(struct if (reqtags > lp->s.scdev_depth) reqtags = lp->s.scdev_depth; - lp->started_limit = reqtags ? reqtags : 2; - lp->started_max = 1; lp->s.reqtags = reqtags; if (reqtags != oldtags) { dev_info(&tp->starget->dev, "tagged command queuing %s, command queue depth %d.\n", - lp->s.reqtags ? "enabled" : "disabled", - lp->started_limit); + lp->s.reqtags ? "enabled" : "disabled", reqtags); } } @@ -1866,15 +1788,25 @@ static int __devinit sym_set_workarounds static void __devinit sym_init_device(struct pci_dev *pdev, struct sym_device *device) { - int i; + int i = 2; + struct pci_bus_region bus_addr; device->host_id = SYM_SETUP_HOST_ID; device->pdev = pdev; - i = pci_get_base_address(pdev, 1, &device->mmio_base); - pci_get_base_address(pdev, i, &device->ram_base); + pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[1]); + device->mmio_base = bus_addr.start; + + /* + * If the BAR is 64-bit, resource 2 will be occupied by the + * upper 32 bits + */ + if (!pdev->resource[i].flags) + i++; + pcibios_resource_to_bus(pdev, &bus_addr, &pdev->resource[i]); + device->ram_base = bus_addr.start; -#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED +#ifdef CONFIG_SCSI_SYM53C8XX_MMIO if (device->mmio_base) device->s.ioaddr = pci_iomap(pdev, 1, pci_resource_len(pdev, 1)); diff --git a/drivers/scsi/sym53c8xx_2/sym_glue.h b/drivers/scsi/sym53c8xx_2/sym_glue.h index cc92d0c..a446cda 100644 --- a/drivers/scsi/sym53c8xx_2/sym_glue.h +++ b/drivers/scsi/sym53c8xx_2/sym_glue.h @@ -68,7 +68,7 @@ */ #define SYM_CONF_TIMER_INTERVAL ((HZ+1)/2) -#define SYM_OPT_HANDLE_DEVICE_QUEUEING +#undef SYM_OPT_HANDLE_DEVICE_QUEUEING #define SYM_OPT_LIMIT_COMMAND_REORDERING /* diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.c b/drivers/scsi/sym53c8xx_2/sym_hipd.c index 8260f04..59185ed 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.c +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.c @@ -473,7 +473,7 @@ static int sym_getpciclock (struct sym_h * calculations more simple. */ #define _5M 5000000 -static u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; +static const u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; /* * Get clock factor and sync divisor for a given @@ -972,8 +972,8 @@ static int sym_prepare_setting(struct Sc * * Has to be called with interrupts disabled. */ -#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED -static int sym_regtest (struct sym_hcb *np) +#ifdef CONFIG_SCSI_SYM53C8XX_MMIO +static int sym_regtest(struct sym_hcb *np) { register volatile u32 data; /* @@ -991,20 +991,25 @@ static int sym_regtest (struct sym_hcb * #endif printf ("CACHE TEST FAILED: reg dstat-sstat2 readback %x.\n", (unsigned) data); - return (0x10); + return 0x10; } - return (0); + return 0; +} +#else +static inline int sym_regtest(struct sym_hcb *np) +{ + return 0; } #endif -static int sym_snooptest (struct sym_hcb *np) +static int sym_snooptest(struct sym_hcb *np) { - u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; - int i, err=0; -#ifndef CONFIG_SCSI_SYM53C8XX_IOMAPPED - err |= sym_regtest (np); - if (err) return (err); -#endif + u32 sym_rd, sym_wr, sym_bk, host_rd, host_wr, pc, dstat; + int i, err; + + err = sym_regtest(np); + if (err) + return err; restart_test: /* * Enable Master Parity Checking as we intend @@ -1093,7 +1098,7 @@ restart_test: err |= 4; } - return (err); + return err; } /* @@ -1474,7 +1479,7 @@ static int sym_prepare_nego(struct sym_h /* * Insert a job into the start queue. */ -static void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) +void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp) { u_short qidx; @@ -4624,7 +4629,8 @@ struct sym_ccb *sym_get_ccb (struct sym_ * Debugging purpose. */ #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING - assert(lp->busy_itl == 0); + if (lp->busy_itl != 0) + goto out_free; #endif /* * Allocate resources for tags if not yet. @@ -4669,7 +4675,8 @@ struct sym_ccb *sym_get_ccb (struct sym_ * Debugging purpose. */ #ifndef SYM_OPT_HANDLE_DEVICE_QUEUEING - assert(lp->busy_itl == 0 && lp->busy_itlq == 0); + if (lp->busy_itl != 0 || lp->busy_itlq != 0) + goto out_free; #endif /* * Count this nexus for this LUN. diff --git a/drivers/scsi/sym53c8xx_2/sym_hipd.h b/drivers/scsi/sym53c8xx_2/sym_hipd.h index 2456090..79ab6a1 100644 --- a/drivers/scsi/sym53c8xx_2/sym_hipd.h +++ b/drivers/scsi/sym53c8xx_2/sym_hipd.h @@ -1049,6 +1049,8 @@ int sym_reset_scsi_bus(struct sym_hcb *n struct sym_chip *sym_lookup_chip_table(u_short device_id, u_char revision); #ifdef SYM_OPT_HANDLE_DEVICE_QUEUEING void sym_start_next_ccbs(struct sym_hcb *np, struct sym_lcb *lp, int maxn); +#else +void sym_put_start_queue(struct sym_hcb *np, struct sym_ccb *cp); #endif void sym_start_up(struct sym_hcb *np, int reason); void sym_interrupt(struct sym_hcb *np);