Lines Matching +full:bp +full:- +full:disabled +full:- +full:ports

1 // SPDX-License-Identifier: GPL-2.0-or-later
7 * Copyright (C) 2001-2004 Jes Sorensen, Wild Open Source Inc.
8 * Copyright (C) 2003-2004 Christoph Hellwig
15 - Retain firmware image for error recovery.
17 - General code cleanup.
18 - Improve error recovery.
20 - Ditch all < 2.6 support
22 - use pci_map_single to map non-S/G requests
23 - remove qla1280_proc_info
25 - add support for ISP1020/1040
26 - don't include "scsi.h" anymore for 2.6.x
28 - restructure firmware loading, cleanup initialization code
29 - prepare support for ISP1020/1040 chips
31 - Handle PCI DMA mask settings correctly
32 - Correct order of error handling in probe_one, free_irq should not
35 - Big endian fixes (James)
36 - Remove bogus IOCB content on zero data transfer commands (Andrew)
38 - Initialize completion queue to avoid OOPS on probe
39 - Handle interrupts during mailbox testing
41 - use struct list_head for completion queue
42 - avoid old Scsi_FOO typedefs
43 - cleanup 2.4 compat glue a bit
44 - use <scsi/scsi_*.h> headers on 2.6 instead of "scsi.h"
45 - make initialization for memory mapped vs port I/O more similar
46 - remove broken pci config space manipulation
47 - kill more cruft
48 - this is an almost perfect 2.6 scsi driver now! ;)
50 - Delete completion queue from srb if mailbox command failed to
53 - Reduce arguments for qla1280_done
55 - Convert to new-style hotplugable driver for 2.6
56 - Fix missing scsi_unregister/scsi_host_put on HBA removal
57 - Kill some more cruft
59 - Make MMIO depend on CONFIG_X86_VISWS instead of yet another
61 - Clean up locking in probe path
63 - queuecommand only ever receives new commands - clear flags
64 - Reintegrate lost fixes from Linux 2.5
66 - Build against 2.6
68 - Remove pointless TRUE/FALSE macros
69 - Clean up vchan handling
71 - Don't define register access macros before define determining MMIO.
73 - Don't try and read from the card while it is in reset as
76 - Basic support for boot time arguments
78 - Reduce boot time messages
80 - Do not enable sync/wide/ppr before it has been determined
82 - Enable DMA arbitration for multi channel controllers
84 - Port to 2.5.69
86 - Eliminate duplicate marker commands on bus resets
87 - Handle outstanding commands appropriately on bus/device resets
89 - Remove bogus input queue code, let the Linux SCSI layer do the work
90 - Clean up NVRAM handling, only read it once from the card
91 - Add a number of missing default nvram parameters
93 - Use completion queue for mailbox commands instead of busy wait
95 - Migrate to use new error handling code
97 - Big endian support
98 - Cleanup data direction code
100 - Switch to using MMIO instead of PIO
102 - Fix PCI parity problem with 12160 during reset.
104 - Use pci_map_page()/pci_unmap_page() instead of map_single version.
106 - Remove < 2.4.x support
107 - Introduce HOST_LOCK to make the spin lock changes portable.
108 - Remove a bunch of idiotic and unnecessary typedef's
109 - Kill all leftovers of target-mode support which never worked anyway
111 - Do qla1280_pci_config() before calling request_irq() and
113 - Use pci_dma_hi32() to handle upper word of DMA addresses instead
115 - Hand correct arguments to free_irq() in case of failure
117 - Run source through Lindent and clean up the output
119 - Update SCSI firmware to qla1280 v8.15.00 and qla12160 v10.04.32
121 - Rely on mailbox commands generating interrupts - do not
123 - Remove device_reg_t
124 - Integrate ql12160_set_target_parameters() with 1280 version
125 - Make qla1280_setup() non static
126 - Do not call qla1280_check_for_dead_scsi_bus() on every I/O request
127 sent to the card - this command pauses the firmware!!!
129 - Clean up qla1280.h - remove obsolete QL_DEBUG_LEVEL_x definitions
130 - Remove a pile of pointless and confusing (srb_t **) and
132 - Explicit mark that we do not use the new error handling (for now)
133 - Remove scsi_qla_host_t and use 'struct' instead
134 - Remove in_abort, watchdog_enabled, dpc, dpc_sched, bios_enabled,
136 - Grab host->host_lock while calling qla1280_isr() from abort()
137 - Use spin_lock()/spin_unlock() in qla1280_intr_handler() - we
139 - Enable interrupts early (before any mailbox access) in preparation
142 - Further cleanups. Remove all trace of QL_DEBUG_LEVEL_x and replace
144 - Make qla1280_print_scsi_cmd() and qla1280_dump_buffer() both take
146 - Add KERN_* info to printk()
148 - Significant cosmetic cleanups
149 - Change debug code to use dprintk() and remove #if mess
151 - More cosmetic cleanups, fix places treating return as function
152 - use cpu_relax() in qla1280_debounce_register()
154 - Make it compile under 2.5.5
156 - Do no typecast short * to long * in QL1280BoardTbl, this
159 - Remove pre 2.2 hack for checking for reentrance in interrupt handler
160 - Make data types used to receive from SCSI_{BUS,TCN,LUN}_32
163 - Remove bogus timer_t typedef from qla1280.h
164 - Remove obsolete pre 2.2 PCI setup code, use proper #define's
166 - Fix memleak of qla1280_buffer on module unload
167 - Only compile module parsing code #ifdef MODULE - should be
169 - Remove dummy_buffer that was never modified nor printed
170 - ENTER()/LEAVE() are noops unless QL_DEBUG_LEVEL_3, hence remove
172 - Remove \r from print statements, this is Linux, not DOS
173 - Remove obsolete QLA1280_{SCSILU,INTR,RING}_{LOCK,UNLOCK}
175 - Remove C++ compile hack in header file as Linux driver are not
177 - Kill MS_64BITS macro as it makes the code more readable
178 - Remove unnecessary flags.in_interrupts bit
180 - Dont' check for set flags on q->q_flag one by one in qla1280_next()
181 - Check whether the interrupt was generated by the QLA1280 before
183 - qla1280_status_entry(): Only zero out part of sense_buffer that
185 - Remove more superflouous typecasts
186 - qla1280_32bit_start_scsi() replace home-brew memcpy() with memcpy()
188 - Don't walk the entire list in qla1280_putq_t() just to directly
191 - Don't use IRQF_DISABLED, it's use is deprecated for this kinda driver
193 - Set dev->max_sectors to 1024
195 - Provide compat macros for pci_enable_device(), pci_find_subsys()
197 - Call scsi_set_pci_device() for all devices
198 - Reduce size of kernel version dependent device probe code
199 - Move duplicate probe/init code to separate function
200 - Handle error if qla1280_mem_alloc() fails
201 - Kill OFFSET() macro and use Linux's PCI definitions instead
202 - Kill private structure defining PCI config space (struct config_reg)
203 - Only allocate I/O port region if not in MMIO mode
204 - Remove duplicate (unused) sanity check of sife of srb_t
206 - Change home-brew memset() implementations to use memset()
207 - Remove all references to COMTRACE() - accessing a PC's COM2 serial
210 - Remove pre 2.2 kernel support
211 - clean up 64 bit DMA setting to use 2.4 API (provide backwards compat)
212 - Fix MMIO access to use readl/writel instead of directly
214 - Nuke MSDOS debugging code
215 - Change true/false data types to int from uint8_t
216 - Use int for counters instead of uint8_t etc.
217 - Clean up size & byte order conversion macro usage
219 - Added check of device_id when handling non
222 - Changed queue_task() to schedule_task()
224 Note: 2.4.0-testxx kernels released prior to
230 - Added -DCONFIG_SMP in addition to -D__SMP__
233 - Changed criteria of 64/32 Bit mode of HBA
236 so that the HBA auto-configures without the need
239 - Added priority handling to IA-64 onboard SCSI
241 - Added irqrestore for qla1280_intr_handler.
242 - Enabled /proc/scsi/qla1280 interface.
243 - Clear /proc/scsi/qla1280 counters in detect().
245 - Declare driver_template for new kernel
247 - Update /proc/scsi entry for 2.3.18 kernels and
250 - Changed scan order of adapters to map
253 - Removed warnings for 32 bit 2.4.x compiles
254 - Corrected declared size for request and response
257 - Corrected 64 bit addressing issue on IA-64
261 - Modified qla1280_setup_chip to properly load
262 ISP firmware for greater that 4 Gig memory on IA-64
264 - Added setting of dma_mask to full 64 bit
267 - Use new PCI DMA mapping APIs for 2.4.x kernel
269 - Added check of pci_enable_device to detect() for 2.3.x
270 - Use pci_resource_start() instead of
271 pdev->resource[0].start in detect() for 2.3.x
272 - Updated driver version
274 - Updated SCSI Firmware to following versions:
277 - Updated driver version to 3.11
279 - Added filtering of AMI SubSys Vendor ID devices
281 - DEBUG_QLA1280 undefined and new version BN Qlogic
283 - Added logic to check against AMI subsystem vendor ID
285 - Added logic to check for PCI subsystem ID.
287 - Updated SCSI Firmware to following versions:
291 - Internal revision; not released
293 - Edit correction for virt_to_bus and PROC.
295 - Merge changes from ia64 port.
297 - Increase version to reflect new code drop with compile fix
300 - Merge qla1280_proc_info from 2.10 code base
302 - Corrected code to compile on a 2.2.x kernel.
304 - Added 64-bit support.
306 - Added new routine to set target parameters for ISP12160.
308 - Added support for ISP12160 Ultra 3 chip.
310 - Modified code to remove errors generated when compiling with
312 - Changed conversion of pointers to unsigned longs instead of integers.
313 - Changed type of I/O port variables from uint32_t to unsigned long.
314 - Modified OFFSET macro to work with 64-bit as well as 32-bit.
315 - Changed sprintf and printk format specifiers for pointers to %p.
316 - Changed some int to long type casts where needed in sprintf & printk.
317 - Added l modifiers to sprintf and printk format specifiers for longs.
318 - Removed unused local variables.
321 - Added SCSI exclusive access lock (io_request_lock) when accessing
323 - Added changes for the new LINUX interface template. Some new error
326 - Initial Beta Release.
345 #include <linux/dma-mapping.h>
363 * 0 - Disable and 1 - Enable
379 #define IS_ISP1040(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020)
380 #define IS_ISP1x40(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1020 || \
381 ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP1240)
382 #define IS_ISP1x160(ha) (ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP10160 || \
383 ha->pdev->device == PCI_DEVICE_ID_QLOGIC_ISP12160)
443 switch(cmnd->sc_data_direction) { in qla1280_data_direction()
480 #define CMD_CDBLEN(Cmnd) Cmnd->cmd_len
481 #define CMD_CDBP(Cmnd) Cmnd->cmnd
482 #define CMD_SNSP(Cmnd) Cmnd->sense_buffer
484 #define CMD_RESULT(Cmnd) Cmnd->result
485 #define CMD_HANDLE(Cmnd) Cmnd->host_scribble
487 #define CMD_HOST(Cmnd) Cmnd->device->host
488 #define SCSI_BUS_32(Cmnd) Cmnd->device->channel
489 #define SCSI_TCN_32(Cmnd) Cmnd->device->id
490 #define SCSI_LUN_32(Cmnd) Cmnd->device->lun
499 int numPorts; /* Number of SCSI ports */
544 {.name = " ", .numPorts = 0, .fw_index = -1},
582 printk(KERN_INFO "scsi(%ld): Reading NVRAM\n", ha->host_no); in qla1280_read_nvram()
584 wptr = (uint16_t *)&ha->nvram; in qla1280_read_nvram()
585 nv = &ha->nvram; in qla1280_read_nvram()
594 if (nv->id0 != 'I' || nv->id1 != 'S' || in qla1280_read_nvram()
595 nv->id2 != 'P' || nv->id3 != ' ' || nv->version < 1) { in qla1280_read_nvram()
608 " version %i\n", nv->id0, nv->id1, nv->id2, nv->id3, in qla1280_read_nvram()
609 nv->version); in qla1280_read_nvram()
616 "settings\n", ha->host_no); in qla1280_read_nvram()
617 ha->nvram_valid = 0; in qla1280_read_nvram()
619 ha->nvram_valid = 1; in qla1280_read_nvram()
637 nv->isp_parameter = cpu_to_le16(nv->isp_parameter); in qla1280_read_nvram()
638 nv->firmware_feature.w = cpu_to_le16(nv->firmware_feature.w); in qla1280_read_nvram()
640 nv->bus[i].selection_timeout = cpu_to_le16(nv->bus[i].selection_timeout); in qla1280_read_nvram()
641 nv->bus[i].max_queue_depth = cpu_to_le16(nv->bus[i].max_queue_depth); in qla1280_read_nvram()
657 char *bp; in qla1280_info() local
661 bp = &qla1280_scsi_name_buffer[0]; in qla1280_info()
662 ha = (struct scsi_qla_host *)host->hostdata; in qla1280_info()
663 bdp = &ql1280_board_tbl[ha->devnum]; in qla1280_info()
664 memset(bp, 0, sizeof(qla1280_scsi_name_buffer)); in qla1280_info()
666 sprintf (bp, in qla1280_info()
669 &bdp->name[0], ha->fwver1, ha->fwver2, ha->fwver3, in qla1280_info()
671 return bp; in qla1280_info()
679 * The mid-level driver tries to ensures that queuecommand never gets invoked
681 * interrupt handler may call this routine as part of request-completion
687 struct Scsi_Host *host = cmd->device->host; in qla1280_queuecommand_lck()
688 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; in qla1280_queuecommand_lck()
692 sp->cmd = cmd; in qla1280_queuecommand_lck()
693 sp->flags = 0; in qla1280_queuecommand_lck()
694 sp->wait = NULL; in qla1280_queuecommand_lck()
727 reg = ha->iobase; in qla1280_mailbox_timeout()
729 ha->mailbox_out[0] = RD_REG_WORD(&reg->mailbox0); in qla1280_mailbox_timeout()
731 "ictrl %04x, istatus %04x\n", ha->host_no, ha->mailbox_out[0], in qla1280_mailbox_timeout()
732 RD_REG_WORD(&reg->ictrl), RD_REG_WORD(&reg->istatus)); in qla1280_mailbox_timeout()
733 complete(ha->mailbox_wait); in qla1280_mailbox_timeout()
741 struct scsi_cmnd *cmd = sp->cmd; in _qla1280_wait_for_single_command()
743 spin_unlock_irq(ha->host->host_lock); in _qla1280_wait_for_single_command()
745 spin_lock_irq(ha->host->host_lock); in _qla1280_wait_for_single_command()
746 sp->wait = NULL; in _qla1280_wait_for_single_command()
759 sp->wait = &wait; in qla1280_wait_for_single_command()
778 sp = ha->outstanding_cmds[cnt]; in qla1280_wait_for_pending_commands()
780 cmd = sp->cmd; in qla1280_wait_for_pending_commands()
817 int wait_for_bus=-1; in qla1280_error_action()
818 int wait_for_target = -1; in qla1280_error_action()
823 ha = (struct scsi_qla_host *)(CMD_HOST(cmd)->hostdata); in qla1280_error_action()
830 RD_REG_WORD(&ha->iobase->istatus)); in qla1280_error_action()
833 RD_REG_WORD(&ha->iobase->host_cmd), in qla1280_error_action()
834 RD_REG_WORD(&ha->iobase->ictrl), jiffies); in qla1280_error_action()
839 ha->host_no, cmd, CMD_HANDLE(cmd), action); in qla1280_error_action()
847 found = -1; in qla1280_error_action()
849 if (sp == ha->outstanding_cmds[i]) { in qla1280_error_action()
851 sp->wait = &wait; /* we'll wait for it to complete */ in qla1280_error_action()
861 "already completed.\n", ha->host_no, bus, in qla1280_error_action()
883 "command.\n", ha->host_no, bus, target, lun); in qla1280_error_action()
894 "reset.\n", ha->host_no, bus); in qla1280_error_action()
906 ha->host_no); in qla1280_error_action()
908 "continue automatically\n", ha->host_no); in qla1280_error_action()
910 ha->flags.reset_active = 1; in qla1280_error_action()
916 ha->flags.reset_active = 0; in qla1280_error_action()
922 * Wait for the command passed in by the mid-layer if it in qla1280_error_action()
935 ha->host_no, bus, target, lun); in qla1280_error_action()
939 * If the command passed in by the mid-layer has been in qla1280_error_action()
968 spin_lock_irq(cmd->device->host->host_lock); in qla1280_eh_abort()
970 spin_unlock_irq(cmd->device->host->host_lock); in qla1280_eh_abort()
984 spin_lock_irq(cmd->device->host->host_lock); in qla1280_eh_device_reset()
986 spin_unlock_irq(cmd->device->host->host_lock); in qla1280_eh_device_reset()
1000 spin_lock_irq(cmd->device->host->host_lock); in qla1280_eh_bus_reset()
1002 spin_unlock_irq(cmd->device->host->host_lock); in qla1280_eh_bus_reset()
1016 spin_lock_irq(cmd->device->host->host_lock); in qla1280_eh_adapter_reset()
1018 spin_unlock_irq(cmd->device->host->host_lock); in qla1280_eh_adapter_reset()
1052 WRT_REG_WORD(&ha->iobase->ictrl, 0); in qla1280_disable_intrs()
1053 RD_REG_WORD(&ha->iobase->ictrl); /* PCI Posted Write flush */ in qla1280_disable_intrs()
1060 WRT_REG_WORD(&ha->iobase->ictrl, (ISP_EN_INT | ISP_EN_RISC)); in qla1280_enable_intrs()
1061 RD_REG_WORD(&ha->iobase->ictrl); /* PCI Posted Write flush */ in qla1280_enable_intrs()
1079 spin_lock(ha->host->host_lock); in qla1280_intr_handler()
1081 ha->isr_count++; in qla1280_intr_handler()
1082 reg = ha->iobase; in qla1280_intr_handler()
1086 data = qla1280_debounce_register(&reg->istatus); in qla1280_intr_handler()
1089 qla1280_isr(ha, &ha->done_q); in qla1280_intr_handler()
1092 if (!list_empty(&ha->done_q)) in qla1280_intr_handler()
1095 spin_unlock(ha->host->host_lock); in qla1280_intr_handler()
1112 nv = &ha->nvram; in qla1280_set_target_parameters()
1119 mb[2] = nv->bus[bus].target[target].parameter.renegotiate_on_error << 8; in qla1280_set_target_parameters()
1120 mb[2] |= nv->bus[bus].target[target].parameter.stop_queue_on_check << 9; in qla1280_set_target_parameters()
1121 mb[2] |= nv->bus[bus].target[target].parameter.auto_request_sense << 10; in qla1280_set_target_parameters()
1122 mb[2] |= nv->bus[bus].target[target].parameter.tag_queuing << 11; in qla1280_set_target_parameters()
1123 mb[2] |= nv->bus[bus].target[target].parameter.enable_sync << 12; in qla1280_set_target_parameters()
1124 mb[2] |= nv->bus[bus].target[target].parameter.enable_wide << 13; in qla1280_set_target_parameters()
1125 mb[2] |= nv->bus[bus].target[target].parameter.parity_checking << 14; in qla1280_set_target_parameters()
1126 mb[2] |= nv->bus[bus].target[target].parameter.disconnect_allowed << 15; in qla1280_set_target_parameters()
1129 mb[2] |= nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr << 5; in qla1280_set_target_parameters()
1130 mb[3] = (nv->bus[bus].target[target].flags.flags1x160.sync_offset << 8); in qla1280_set_target_parameters()
1131 mb[6] = (nv->bus[bus].target[target].ppr_1x160.flags.ppr_options << 8) | in qla1280_set_target_parameters()
1132 nv->bus[bus].target[target].ppr_1x160.flags.ppr_bus_width; in qla1280_set_target_parameters()
1135 mb[3] = (nv->bus[bus].target[target].flags.flags1x80.sync_offset << 8); in qla1280_set_target_parameters()
1137 mb[3] |= nv->bus[bus].target[target].sync_period; in qla1280_set_target_parameters()
1146 mb[2] = nv->bus[bus].max_queue_depth; in qla1280_set_target_parameters()
1147 mb[3] = nv->bus[bus].target[target].execution_throttle; in qla1280_set_target_parameters()
1154 ha->host_no, bus, target); in qla1280_set_target_parameters()
1175 int bus = device->channel; in qla1280_slave_configure()
1176 int target = device->id; in qla1280_slave_configure()
1181 ha = (struct scsi_qla_host *)device->host->hostdata; in qla1280_slave_configure()
1182 nv = &ha->nvram; in qla1280_slave_configure()
1187 if (device->tagged_supported && in qla1280_slave_configure()
1188 (ha->bus_settings[bus].qtag_enables & (BIT_0 << target))) { in qla1280_slave_configure()
1189 scsi_change_queue_depth(device, ha->bus_settings[bus].hiwat); in qla1280_slave_configure()
1194 nv->bus[bus].target[target].parameter.enable_sync = device->sdtr; in qla1280_slave_configure()
1195 nv->bus[bus].target[target].parameter.enable_wide = device->wdtr; in qla1280_slave_configure()
1196 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = device->ppr; in qla1280_slave_configure()
1201 nv->bus[bus].target[target].parameter.enable_sync = 0; in qla1280_slave_configure()
1205 nv->bus[bus].target[target].parameter.enable_wide = 0; in qla1280_slave_configure()
1210 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 0; in qla1280_slave_configure()
1213 spin_lock_irqsave(ha->host->host_lock, flags); in qla1280_slave_configure()
1214 if (nv->bus[bus].target[target].parameter.enable_sync) in qla1280_slave_configure()
1217 spin_unlock_irqrestore(ha->host->host_lock, flags); in qla1280_slave_configure()
1239 done_q = &ha->done_q; in qla1280_done()
1242 sp = list_entry(done_q->next, struct srb, list); in qla1280_done()
1244 list_del(&sp->list); in qla1280_done()
1246 cmd = sp->cmd; in qla1280_done()
1253 if (!ha->flags.abort_isp_active) in qla1280_done()
1257 sp->flags &= ~SRB_ABORT_PENDING; in qla1280_done()
1258 sp->flags |= SRB_ABORTED; in qla1280_done()
1267 /* Call the mid-level driver interrupt handler */ in qla1280_done()
1268 ha->actthreads--; in qla1280_done()
1270 if (sp->wait == NULL) in qla1280_done()
1273 complete(sp->wait); in qla1280_done()
1285 uint16_t comp_status = le16_to_cpu(sts->comp_status); in qla1280_return_status()
1286 uint16_t state_flags = le16_to_cpu(sts->state_flags); in qla1280_return_status()
1287 uint32_t residual_length = le32_to_cpu(sts->residual_length); in qla1280_return_status()
1288 uint16_t scsi_status = le16_to_cpu(sts->scsi_status); in qla1280_return_status()
1353 if ((scsi_bufflen(cp) - residual_length) < in qla1280_return_status()
1354 cp->underflow) { in qla1280_return_status()
1356 "scsi: Underflow detected - retrying " in qla1280_return_status()
1405 ha->flags.online = 0; in qla1280_initialize_adapter()
1406 ha->flags.disable_host_adapter = 0; in qla1280_initialize_adapter()
1407 ha->flags.reset_active = 0; in qla1280_initialize_adapter()
1408 ha->flags.abort_isp_active = 0; in qla1280_initialize_adapter()
1416 reg = ha->iobase; in qla1280_initialize_adapter()
1419 WRT_REG_WORD(&reg->semaphore, 0); in qla1280_initialize_adapter()
1420 WRT_REG_WORD(&reg->host_cmd, HC_CLR_RISC_INT); in qla1280_initialize_adapter()
1421 WRT_REG_WORD(&reg->host_cmd, HC_CLR_HOST_INT); in qla1280_initialize_adapter()
1422 RD_REG_WORD(&reg->host_cmd); in qla1280_initialize_adapter()
1434 spin_lock_irqsave(ha->host->host_lock, flags); in qla1280_initialize_adapter()
1439 ha->host_no); in qla1280_initialize_adapter()
1444 dprintk(1, "scsi(%ld): Configure NVRAM parameters\n", ha->host_no); in qla1280_initialize_adapter()
1447 if (ha->flags.disable_host_adapter) { in qla1280_initialize_adapter()
1457 for (bus = 0; bus < ha->ports; bus++) { in qla1280_initialize_adapter()
1458 if (!ha->bus_settings[bus].disable_scsi_reset && in qla1280_initialize_adapter()
1461 ha->bus_settings[bus].scsi_bus_dead = 1; in qla1280_initialize_adapter()
1464 ha->flags.online = 1; in qla1280_initialize_adapter()
1466 spin_unlock_irqrestore(ha->host->host_lock, flags); in qla1280_initialize_adapter()
1495 spin_unlock_irq(ha->host->host_lock); in qla1280_request_firmware()
1498 index = ql1280_board_tbl[ha->devnum].fw_index; in qla1280_request_firmware()
1504 err = request_firmware(&fw, fwname, &ha->pdev->dev); in qla1280_request_firmware()
1512 if ((fw->size % 2) || (fw->size < 6)) { in qla1280_request_firmware()
1514 fw->size, fwname); in qla1280_request_firmware()
1516 fw = ERR_PTR(-EINVAL); in qla1280_request_firmware()
1523 ha->fwver1 = fw->data[0]; in qla1280_request_firmware()
1524 ha->fwver2 = fw->data[1]; in qla1280_request_firmware()
1525 ha->fwver3 = fw->data[2]; in qla1280_request_firmware()
1528 spin_lock_irq(ha->host->host_lock); in qla1280_request_firmware()
1546 struct device_reg __iomem *reg = ha->iobase; in qla1280_chip_diag()
1550 dprintk(3, "qla1280_chip_diag: testing device at 0x%p \n", &reg->id_l); in qla1280_chip_diag()
1552 dprintk(1, "scsi(%ld): Verifying chip\n", ha->host_no); in qla1280_chip_diag()
1555 WRT_REG_WORD(&reg->ictrl, ISP_RESET); in qla1280_chip_diag()
1565 data = qla1280_debounce_register(&reg->ictrl); in qla1280_chip_diag()
1567 * Yet another QLogic gem ;-( in qla1280_chip_diag()
1569 for (cnt = 1000000; cnt && data & ISP_RESET; cnt--) { in qla1280_chip_diag()
1571 data = RD_REG_WORD(&reg->ictrl); in qla1280_chip_diag()
1580 WRT_REG_WORD(&reg->cfg_1, 0); in qla1280_chip_diag()
1584 WRT_REG_WORD(&reg->host_cmd, HC_RESET_RISC | in qla1280_chip_diag()
1587 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_chip_diag()
1588 data = qla1280_debounce_register(&reg->mailbox0); in qla1280_chip_diag()
1593 for (cnt = 1000000; cnt && data == MBS_BUSY; cnt--) { in qla1280_chip_diag()
1595 data = RD_REG_WORD(&reg->mailbox0); in qla1280_chip_diag()
1604 if (RD_REG_WORD(&reg->mailbox1) != PROD_ID_1 || in qla1280_chip_diag()
1605 (RD_REG_WORD(&reg->mailbox2) != PROD_ID_2 && in qla1280_chip_diag()
1606 RD_REG_WORD(&reg->mailbox2) != PROD_ID_2a) || in qla1280_chip_diag()
1607 RD_REG_WORD(&reg->mailbox3) != PROD_ID_3 || in qla1280_chip_diag()
1608 RD_REG_WORD(&reg->mailbox4) != PROD_ID_4) { in qla1280_chip_diag()
1611 RD_REG_WORD(&reg->mailbox1), in qla1280_chip_diag()
1612 RD_REG_WORD(&reg->mailbox2), in qla1280_chip_diag()
1613 RD_REG_WORD(&reg->mailbox3), in qla1280_chip_diag()
1614 RD_REG_WORD(&reg->mailbox4)); in qla1280_chip_diag()
1667 fw_data = (const __le16 *)&fw->data[0]; in qla1280_load_firmware_pio()
1668 ha->fwstart = __le16_to_cpu(fw_data[2]); in qla1280_load_firmware_pio()
1671 risc_address = ha->fwstart; in qla1280_load_firmware_pio()
1672 fw_data = (const __le16 *)&fw->data[6]; in qla1280_load_firmware_pio()
1673 risc_code_size = (fw->size - 6) / 2; in qla1280_load_firmware_pio()
1683 ha->host_no); in qla1280_load_firmware_pio()
1715 tbuf = dma_alloc_coherent(&ha->pdev->dev, 8000, &p_tbuf, GFP_KERNEL); in qla1280_load_firmware_dma()
1717 return -ENOMEM; in qla1280_load_firmware_dma()
1724 fw_data = (const __le16 *)&fw->data[0]; in qla1280_load_firmware_dma()
1725 ha->fwstart = __le16_to_cpu(fw_data[2]); in qla1280_load_firmware_dma()
1728 risc_address = ha->fwstart; in qla1280_load_firmware_dma()
1729 fw_data = (const __le16 *)&fw->data[6]; in qla1280_load_firmware_dma()
1730 risc_code_size = (fw->size - 6) / 2; in qla1280_load_firmware_dma()
1748 ((__le16 *)ha->request_ring)[i] = fw_data[i]; in qla1280_load_firmware_dma()
1753 mb[3] = ha->request_dma & 0xffff; in qla1280_load_firmware_dma()
1754 mb[2] = (ha->request_dma >> 16) & 0xffff; in qla1280_load_firmware_dma()
1755 mb[7] = upper_32_bits(ha->request_dma) & 0xffff; in qla1280_load_firmware_dma()
1756 mb[6] = upper_32_bits(ha->request_dma) >> 16; in qla1280_load_firmware_dma()
1759 (void *)(long)ha->request_dma, in qla1280_load_firmware_dma()
1764 "segment of f\n", ha->host_no); in qla1280_load_firmware_dma()
1783 sp = (uint8_t *)ha->request_ring; in qla1280_load_firmware_dma()
1797 risc_code_size = risc_code_size - cnt; in qla1280_load_firmware_dma()
1804 dma_free_coherent(&ha->pdev->dev, 8000, tbuf, p_tbuf); in qla1280_load_firmware_dma()
1821 mb[1] = ha->fwstart; in qla1280_start_firmware()
1824 printk(KERN_ERR "scsi(%li): RISC checksum failed.\n", ha->host_no); in qla1280_start_firmware()
1831 mb[1] = ha->fwstart; in qla1280_start_firmware()
1835 ha->host_no); in qla1280_start_firmware()
1866 * ha->request_ring = request ring virtual address
1867 * ha->response_ring = response ring virtual address
1868 * ha->request_dma = request ring physical address
1869 * ha->response_dma = response ring physical address
1883 memset(ha->outstanding_cmds, 0, in qla1280_init_rings()
1887 ha->request_ring_ptr = ha->request_ring; in qla1280_init_rings()
1888 ha->req_ring_index = 0; in qla1280_init_rings()
1889 ha->req_q_cnt = REQUEST_ENTRY_CNT; in qla1280_init_rings()
1893 mb[3] = ha->request_dma & 0xffff; in qla1280_init_rings()
1894 mb[2] = (ha->request_dma >> 16) & 0xffff; in qla1280_init_rings()
1896 mb[7] = upper_32_bits(ha->request_dma) & 0xffff; in qla1280_init_rings()
1897 mb[6] = upper_32_bits(ha->request_dma) >> 16; in qla1280_init_rings()
1902 ha->response_ring_ptr = ha->response_ring; in qla1280_init_rings()
1903 ha->rsp_ring_index = 0; in qla1280_init_rings()
1907 mb[3] = ha->response_dma & 0xffff; in qla1280_init_rings()
1908 mb[2] = (ha->response_dma >> 16) & 0xffff; in qla1280_init_rings()
1910 mb[7] = upper_32_bits(ha->response_dma) & 0xffff; in qla1280_init_rings()
1911 mb[6] = upper_32_bits(ha->response_dma) >> 16; in qla1280_init_rings()
1928 nv->bus[0].config_1.initiator_id); in qla1280_print_settings()
1930 nv->bus[1].config_1.initiator_id); in qla1280_print_settings()
1933 nv->bus[0].bus_reset_delay); in qla1280_print_settings()
1935 nv->bus[1].bus_reset_delay); in qla1280_print_settings()
1937 dprintk(1, "qla1280 : retry count[0]=%d\n", nv->bus[0].retry_count); in qla1280_print_settings()
1938 dprintk(1, "qla1280 : retry delay[0]=%d\n", nv->bus[0].retry_delay); in qla1280_print_settings()
1939 dprintk(1, "qla1280 : retry count[1]=%d\n", nv->bus[1].retry_count); in qla1280_print_settings()
1940 dprintk(1, "qla1280 : retry delay[1]=%d\n", nv->bus[1].retry_delay); in qla1280_print_settings()
1943 nv->bus[0].config_2.async_data_setup_time); in qla1280_print_settings()
1945 nv->bus[1].config_2.async_data_setup_time); in qla1280_print_settings()
1948 nv->bus[0].config_2.req_ack_active_negation); in qla1280_print_settings()
1950 nv->bus[1].config_2.req_ack_active_negation); in qla1280_print_settings()
1953 nv->bus[0].config_2.data_line_active_negation); in qla1280_print_settings()
1955 nv->bus[1].config_2.data_line_active_negation); in qla1280_print_settings()
1958 nv->cntr_flags_1.disable_loading_risc_code); in qla1280_print_settings()
1961 nv->cntr_flags_1.enable_64bit_addressing); in qla1280_print_settings()
1964 nv->bus[0].selection_timeout); in qla1280_print_settings()
1966 nv->bus[1].selection_timeout); in qla1280_print_settings()
1969 nv->bus[0].max_queue_depth); in qla1280_print_settings()
1971 nv->bus[1].max_queue_depth); in qla1280_print_settings()
1977 struct nvram *nv = &ha->nvram; in qla1280_set_target_defaults()
1979 nv->bus[bus].target[target].parameter.renegotiate_on_error = 1; in qla1280_set_target_defaults()
1980 nv->bus[bus].target[target].parameter.auto_request_sense = 1; in qla1280_set_target_defaults()
1981 nv->bus[bus].target[target].parameter.tag_queuing = 1; in qla1280_set_target_defaults()
1982 nv->bus[bus].target[target].parameter.enable_sync = 1; in qla1280_set_target_defaults()
1984 nv->bus[bus].target[target].parameter.enable_wide = 1; in qla1280_set_target_defaults()
1986 nv->bus[bus].target[target].execution_throttle = in qla1280_set_target_defaults()
1987 nv->bus[bus].max_queue_depth - 1; in qla1280_set_target_defaults()
1988 nv->bus[bus].target[target].parameter.parity_checking = 1; in qla1280_set_target_defaults()
1989 nv->bus[bus].target[target].parameter.disconnect_allowed = 1; in qla1280_set_target_defaults()
1992 nv->bus[bus].target[target].flags.flags1x160.device_enable = 1; in qla1280_set_target_defaults()
1993 nv->bus[bus].target[target].flags.flags1x160.sync_offset = 0x0e; in qla1280_set_target_defaults()
1994 nv->bus[bus].target[target].sync_period = 9; in qla1280_set_target_defaults()
1995 nv->bus[bus].target[target].ppr_1x160.flags.enable_ppr = 1; in qla1280_set_target_defaults()
1996 nv->bus[bus].target[target].ppr_1x160.flags.ppr_options = 2; in qla1280_set_target_defaults()
1997 nv->bus[bus].target[target].ppr_1x160.flags.ppr_bus_width = 1; in qla1280_set_target_defaults()
1999 nv->bus[bus].target[target].flags.flags1x80.device_enable = 1; in qla1280_set_target_defaults()
2000 nv->bus[bus].target[target].flags.flags1x80.sync_offset = 12; in qla1280_set_target_defaults()
2001 nv->bus[bus].target[target].sync_period = 10; in qla1280_set_target_defaults()
2008 struct nvram *nv = &ha->nvram; in qla1280_set_defaults()
2014 /* nv->cntr_flags_1.disable_loading_risc_code = 1; */ in qla1280_set_defaults()
2015 nv->firmware_feature.f.enable_fast_posting = 1; in qla1280_set_defaults()
2016 nv->firmware_feature.f.disable_synchronous_backoff = 1; in qla1280_set_defaults()
2017 nv->termination.scsi_bus_0_control = 3; in qla1280_set_defaults()
2018 nv->termination.scsi_bus_1_control = 3; in qla1280_set_defaults()
2019 nv->termination.auto_term_support = 1; in qla1280_set_defaults()
2022 * Set default FIFO magic - What appropriate values would be here in qla1280_set_defaults()
2029 nv->isp_config.burst_enable = 1; in qla1280_set_defaults()
2031 nv->isp_config.fifo_threshold |= 3; in qla1280_set_defaults()
2033 nv->isp_config.fifo_threshold |= 4; in qla1280_set_defaults()
2036 nv->isp_parameter = 0x01; /* fast memory enable */ in qla1280_set_defaults()
2039 nv->bus[bus].config_1.initiator_id = 7; in qla1280_set_defaults()
2040 nv->bus[bus].config_2.req_ack_active_negation = 1; in qla1280_set_defaults()
2041 nv->bus[bus].config_2.data_line_active_negation = 1; in qla1280_set_defaults()
2042 nv->bus[bus].selection_timeout = 250; in qla1280_set_defaults()
2043 nv->bus[bus].max_queue_depth = 32; in qla1280_set_defaults()
2046 nv->bus[bus].bus_reset_delay = 3; in qla1280_set_defaults()
2047 nv->bus[bus].config_2.async_data_setup_time = 6; in qla1280_set_defaults()
2048 nv->bus[bus].retry_delay = 1; in qla1280_set_defaults()
2050 nv->bus[bus].bus_reset_delay = 5; in qla1280_set_defaults()
2051 nv->bus[bus].config_2.async_data_setup_time = 8; in qla1280_set_defaults()
2062 struct nvram *nv = &ha->nvram; in qla1280_config_target()
2080 mb[3] = nv->bus[bus].target[target].flags.flags1x160.sync_offset << 8; in qla1280_config_target()
2082 mb[3] = nv->bus[bus].target[target].flags.flags1x80.sync_offset << 8; in qla1280_config_target()
2083 mb[3] |= nv->bus[bus].target[target].sync_period; in qla1280_config_target()
2088 if (nv->bus[bus].target[target].parameter.tag_queuing) in qla1280_config_target()
2089 ha->bus_settings[bus].qtag_enables |= flag; in qla1280_config_target()
2093 if (nv->bus[bus].target[target].flags.flags1x160.device_enable) in qla1280_config_target()
2094 ha->bus_settings[bus].device_enables |= flag; in qla1280_config_target()
2095 ha->bus_settings[bus].lun_disables |= 0; in qla1280_config_target()
2097 if (nv->bus[bus].target[target].flags.flags1x80.device_enable) in qla1280_config_target()
2098 ha->bus_settings[bus].device_enables |= flag; in qla1280_config_target()
2100 if (nv->bus[bus].target[target].flags.flags1x80.lun_disable) in qla1280_config_target()
2101 ha->bus_settings[bus].lun_disables |= flag; in qla1280_config_target()
2109 mb[2] = nv->bus[bus].max_queue_depth; in qla1280_config_target()
2110 mb[3] = nv->bus[bus].target[target].execution_throttle; in qla1280_config_target()
2120 struct nvram *nv = &ha->nvram; in qla1280_config_bus()
2125 ha->bus_settings[bus].disable_scsi_reset = in qla1280_config_bus()
2126 nv->bus[bus].config_1.scsi_reset_disable; in qla1280_config_bus()
2129 ha->bus_settings[bus].id = nv->bus[bus].config_1.initiator_id; in qla1280_config_bus()
2131 mb[1] = bus ? ha->bus_settings[bus].id | BIT_7 : in qla1280_config_bus()
2132 ha->bus_settings[bus].id; in qla1280_config_bus()
2136 ha->bus_settings[bus].bus_reset_delay = in qla1280_config_bus()
2137 nv->bus[bus].bus_reset_delay; in qla1280_config_bus()
2140 ha->bus_settings[bus].hiwat = nv->bus[bus].max_queue_depth - 1; in qla1280_config_bus()
2152 struct device_reg __iomem *reg = ha->iobase; in qla1280_nvram_config()
2153 struct nvram *nv = &ha->nvram; in qla1280_nvram_config()
2159 if (ha->nvram_valid) { in qla1280_nvram_config()
2163 nv->bus[bus].target[target].parameter. in qla1280_nvram_config()
2173 ha->flags.disable_risc_code_load = in qla1280_nvram_config()
2174 nv->cntr_flags_1.disable_loading_risc_code; in qla1280_nvram_config()
2179 hwrev = RD_REG_WORD(&reg->cfg_0) & ISP_CFG0_HWMSK; in qla1280_nvram_config()
2181 cfg1 = RD_REG_WORD(&reg->cfg_1) & ~(BIT_4 | BIT_5 | BIT_6); in qla1280_nvram_config()
2182 cdma_conf = RD_REG_WORD(&reg->cdma_cfg); in qla1280_nvram_config()
2186 cfg1 |= nv->isp_config.fifo_threshold << 4; in qla1280_nvram_config()
2188 cfg1 |= nv->isp_config.burst_enable << 2; in qla1280_nvram_config()
2189 WRT_REG_WORD(&reg->cfg_1, cfg1); in qla1280_nvram_config()
2191 WRT_REG_WORD(&reg->cdma_cfg, cdma_conf | CDMA_CONF_BENAB); in qla1280_nvram_config()
2192 WRT_REG_WORD(&reg->ddma_cfg, cdma_conf | DDMA_CONF_BENAB); in qla1280_nvram_config()
2197 cfg1 = nv->isp_config.fifo_threshold << 4; in qla1280_nvram_config()
2198 cfg1 |= nv->isp_config.burst_enable << 2; in qla1280_nvram_config()
2200 if (ha->ports > 1) in qla1280_nvram_config()
2202 WRT_REG_WORD(&reg->cfg_1, cfg1); in qla1280_nvram_config()
2205 WRT_REG_WORD(&reg->gpio_enable, in qla1280_nvram_config()
2207 term = nv->termination.scsi_bus_1_control; in qla1280_nvram_config()
2208 term |= nv->termination.scsi_bus_0_control << 2; in qla1280_nvram_config()
2209 term |= nv->termination.auto_term_support << 7; in qla1280_nvram_config()
2210 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nvram_config()
2211 WRT_REG_WORD(&reg->gpio_data, term); in qla1280_nvram_config()
2213 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nvram_config()
2217 mb[1] = nv->isp_parameter; in qla1280_nvram_config()
2221 /* clock rate - for qla1240 and older, only */ in qla1280_nvram_config()
2229 mb[1] = nv->firmware_feature.f.enable_fast_posting; in qla1280_nvram_config()
2230 mb[1] |= nv->firmware_feature.f.report_lvd_bus_transition << 1; in qla1280_nvram_config()
2231 mb[1] |= nv->firmware_feature.f.disable_synchronous_backoff << 5; in qla1280_nvram_config()
2236 mb[1] = nv->bus[0].retry_count; in qla1280_nvram_config()
2237 mb[2] = nv->bus[0].retry_delay; in qla1280_nvram_config()
2238 mb[6] = nv->bus[1].retry_count; in qla1280_nvram_config()
2239 mb[7] = nv->bus[1].retry_delay; in qla1280_nvram_config()
2245 mb[1] = nv->bus[0].config_2.async_data_setup_time; in qla1280_nvram_config()
2246 mb[2] = nv->bus[1].config_2.async_data_setup_time; in qla1280_nvram_config()
2252 if (nv->bus[0].config_2.req_ack_active_negation) in qla1280_nvram_config()
2254 if (nv->bus[0].config_2.data_line_active_negation) in qla1280_nvram_config()
2257 if (nv->bus[1].config_2.req_ack_active_negation) in qla1280_nvram_config()
2259 if (nv->bus[1].config_2.data_line_active_negation) in qla1280_nvram_config()
2279 mb[1] = nv->bus[0].selection_timeout; in qla1280_nvram_config()
2280 mb[2] = nv->bus[1].selection_timeout; in qla1280_nvram_config()
2283 for (bus = 0; bus < ha->ports; bus++) in qla1280_nvram_config()
2330 * Bit 23-16 = address
2331 * Bit 15-0 = write data
2339 struct device_reg __iomem *reg = ha->iobase; in qla1280_nvram_request()
2358 WRT_REG_WORD(&reg->nvram, (NV_SELECT | NV_CLOCK)); in qla1280_nvram_request()
2359 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nvram_request()
2362 reg_data = RD_REG_WORD(&reg->nvram); in qla1280_nvram_request()
2365 WRT_REG_WORD(&reg->nvram, NV_SELECT); in qla1280_nvram_request()
2366 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nvram_request()
2372 WRT_REG_WORD(&reg->nvram, NV_DESELECT); in qla1280_nvram_request()
2373 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nvram_request()
2382 struct device_reg __iomem *reg = ha->iobase; in qla1280_nv_write()
2384 WRT_REG_WORD(&reg->nvram, data | NV_SELECT); in qla1280_nv_write()
2385 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nv_write()
2387 WRT_REG_WORD(&reg->nvram, data | NV_SELECT | NV_CLOCK); in qla1280_nv_write()
2388 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nv_write()
2390 WRT_REG_WORD(&reg->nvram, data | NV_SELECT); in qla1280_nv_write()
2391 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_nv_write()
2413 struct device_reg __iomem *reg = ha->iobase; in qla1280_mailbox_command()
2422 if (ha->mailbox_wait) { in qla1280_mailbox_command()
2425 ha->mailbox_wait = &wait; in qla1280_mailbox_command()
2432 mptr = (uint16_t __iomem *) &reg->mailbox0; in qla1280_mailbox_command()
2447 timer_setup(&ha->mailbox_timer, qla1280_mailbox_timeout, 0); in qla1280_mailbox_command()
2448 mod_timer(&ha->mailbox_timer, jiffies + 20 * HZ); in qla1280_mailbox_command()
2450 spin_unlock_irq(ha->host->host_lock); in qla1280_mailbox_command()
2451 WRT_REG_WORD(&reg->host_cmd, HC_SET_HOST_INT); in qla1280_mailbox_command()
2452 qla1280_debounce_register(&reg->istatus); in qla1280_mailbox_command()
2455 del_timer_sync(&ha->mailbox_timer); in qla1280_mailbox_command()
2457 spin_lock_irq(ha->host->host_lock); in qla1280_mailbox_command()
2459 ha->mailbox_wait = NULL; in qla1280_mailbox_command()
2462 if (ha->mailbox_out[0] != MBS_CMD_CMP) { in qla1280_mailbox_command()
2466 mb[0], ha->mailbox_out[0], RD_REG_WORD(&reg->istatus)); in qla1280_mailbox_command()
2468 RD_REG_WORD(&reg->mailbox0), RD_REG_WORD(&reg->mailbox1), in qla1280_mailbox_command()
2469 RD_REG_WORD(&reg->mailbox2), RD_REG_WORD(&reg->mailbox3)); in qla1280_mailbox_command()
2471 RD_REG_WORD(&reg->mailbox4), RD_REG_WORD(&reg->mailbox5), in qla1280_mailbox_command()
2472 RD_REG_WORD(&reg->mailbox6), RD_REG_WORD(&reg->mailbox7)); in qla1280_mailbox_command()
2478 iptr = (uint16_t *) &ha->mailbox_out[0]; in qla1280_mailbox_command()
2482 if (ha->flags.reset_marker) in qla1280_mailbox_command()
2503 struct device_reg __iomem *reg = ha->iobase; in qla1280_poll()
2510 data = RD_REG_WORD(&reg->istatus); in qla1280_poll()
2514 if (!ha->mailbox_wait) { in qla1280_poll()
2515 if (ha->flags.reset_marker) in qla1280_poll()
2547 ha->host_no, bus); in qla1280_bus_reset()
2549 reset_delay = ha->bus_settings[bus].bus_reset_delay; in qla1280_bus_reset()
2556 if (ha->bus_settings[bus].failed_reset_count > 2) in qla1280_bus_reset()
2557 ha->bus_settings[bus].scsi_bus_dead = 1; in qla1280_bus_reset()
2558 ha->bus_settings[bus].failed_reset_count++; in qla1280_bus_reset()
2560 spin_unlock_irq(ha->host->host_lock); in qla1280_bus_reset()
2562 spin_lock_irq(ha->host->host_lock); in qla1280_bus_reset()
2564 ha->bus_settings[bus].scsi_bus_dead = 0; in qla1280_bus_reset()
2565 ha->bus_settings[bus].failed_reset_count = 0; in qla1280_bus_reset()
2566 ha->bus_settings[bus].reset_marker = 0; in qla1280_bus_reset()
2639 bus = SCSI_BUS_32(sp->cmd); in qla1280_abort_command()
2640 target = SCSI_TCN_32(sp->cmd); in qla1280_abort_command()
2641 lun = SCSI_LUN_32(sp->cmd); in qla1280_abort_command()
2643 sp->flags |= SRB_ABORT_PENDING; in qla1280_abort_command()
2653 sp->flags &= ~SRB_ABORT_PENDING; in qla1280_abort_command()
2671 struct device_reg __iomem *reg = ha->iobase; in qla1280_reset_adapter()
2676 ha->flags.online = 0; in qla1280_reset_adapter()
2677 WRT_REG_WORD(&reg->ictrl, ISP_RESET); in qla1280_reset_adapter()
2678 WRT_REG_WORD(&reg->host_cmd, in qla1280_reset_adapter()
2680 RD_REG_WORD(&reg->id_l); /* Flush PCI write */ in qla1280_reset_adapter()
2705 pkt->entry_type = MARKER_TYPE; in qla1280_marker()
2706 pkt->lun = (uint8_t) lun; in qla1280_marker()
2707 pkt->target = (uint8_t) (bus ? (id | BIT_7) : id); in qla1280_marker()
2708 pkt->modifier = type; in qla1280_marker()
2709 pkt->entry_status = 0; in qla1280_marker()
2735 struct device_reg __iomem *reg = ha->iobase; in qla1280_64bit_start_scsi()
2736 struct scsi_cmnd *cmd = sp->cmd; in qla1280_64bit_start_scsi()
2753 req_cnt += (seg_cnt - 2) / 5; in qla1280_64bit_start_scsi()
2754 if ((seg_cnt - 2) % 5) in qla1280_64bit_start_scsi()
2762 if ((req_cnt + 2) >= ha->req_q_cnt) { in qla1280_64bit_start_scsi()
2764 cnt = RD_REG_WORD(&reg->mailbox4); in qla1280_64bit_start_scsi()
2765 if (ha->req_ring_index < cnt) in qla1280_64bit_start_scsi()
2766 ha->req_q_cnt = cnt - ha->req_ring_index; in qla1280_64bit_start_scsi()
2768 ha->req_q_cnt = in qla1280_64bit_start_scsi()
2769 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt); in qla1280_64bit_start_scsi()
2773 ha->req_q_cnt, seg_cnt); in qla1280_64bit_start_scsi()
2776 if ((req_cnt + 2) >= ha->req_q_cnt) { in qla1280_64bit_start_scsi()
2778 dprintk(2, "qla1280_start_scsi: in-ptr=0x%x req_q_cnt=" in qla1280_64bit_start_scsi()
2779 "0x%xreq_cnt=0x%x", ha->req_ring_index, ha->req_q_cnt, in qla1280_64bit_start_scsi()
2786 ha->outstanding_cmds[cnt] != NULL; cnt++); in qla1280_64bit_start_scsi()
2791 "OUTSTANDING ARRAY, req_q_cnt=0x%x", ha->req_q_cnt); in qla1280_64bit_start_scsi()
2795 ha->outstanding_cmds[cnt] = sp; in qla1280_64bit_start_scsi()
2796 ha->req_q_cnt -= req_cnt; in qla1280_64bit_start_scsi()
2797 CMD_HANDLE(sp->cmd) = (unsigned char *)(unsigned long)(cnt + 1); in qla1280_64bit_start_scsi()
2800 cmd->cmnd[0], (long)CMD_HANDLE(sp->cmd)); in qla1280_64bit_start_scsi()
2803 qla1280_dump_buffer(2, cmd->cmnd, MAX_COMMAND_SIZE); in qla1280_64bit_start_scsi()
2808 pkt = (cmd_a64_entry_t *) ha->request_ring_ptr; in qla1280_64bit_start_scsi()
2810 pkt->entry_type = COMMAND_A64_TYPE; in qla1280_64bit_start_scsi()
2811 pkt->entry_count = (uint8_t) req_cnt; in qla1280_64bit_start_scsi()
2812 pkt->sys_define = (uint8_t) ha->req_ring_index; in qla1280_64bit_start_scsi()
2813 pkt->entry_status = 0; in qla1280_64bit_start_scsi()
2814 pkt->handle = cpu_to_le32(cnt); in qla1280_64bit_start_scsi()
2817 memset(((char *)pkt + 8), 0, (REQUEST_ENTRY_SIZE - 8)); in qla1280_64bit_start_scsi()
2820 pkt->timeout = cpu_to_le16(scsi_cmd_to_rq(cmd)->timeout / HZ); in qla1280_64bit_start_scsi()
2823 pkt->lun = SCSI_LUN_32(cmd); in qla1280_64bit_start_scsi()
2824 pkt->target = SCSI_BUS_32(cmd) ? in qla1280_64bit_start_scsi()
2828 if (cmd->device->simple_tags) in qla1280_64bit_start_scsi()
2829 pkt->control_flags |= cpu_to_le16(BIT_3); in qla1280_64bit_start_scsi()
2832 pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); in qla1280_64bit_start_scsi()
2833 memcpy(pkt->scsi_cdb, CMD_CDBP(cmd), CMD_CDBLEN(cmd)); in qla1280_64bit_start_scsi()
2834 /* dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ in qla1280_64bit_start_scsi()
2838 pkt->control_flags |= cpu_to_le16(dir); in qla1280_64bit_start_scsi()
2841 pkt->dseg_count = cpu_to_le16(seg_cnt); in qla1280_64bit_start_scsi()
2853 dword_ptr = (u32 *)&pkt->dseg_0_address; in qla1280_64bit_start_scsi()
2870 remseg--; in qla1280_64bit_start_scsi()
2873 "command packet data - b %i, t %i, l %i \n", in qla1280_64bit_start_scsi()
2889 ha->req_ring_index++; in qla1280_64bit_start_scsi()
2890 if (ha->req_ring_index == REQUEST_ENTRY_CNT) { in qla1280_64bit_start_scsi()
2891 ha->req_ring_index = 0; in qla1280_64bit_start_scsi()
2892 ha->request_ring_ptr = in qla1280_64bit_start_scsi()
2893 ha->request_ring; in qla1280_64bit_start_scsi()
2895 ha->request_ring_ptr++; in qla1280_64bit_start_scsi()
2897 pkt = (cmd_a64_entry_t *)ha->request_ring_ptr; in qla1280_64bit_start_scsi()
2903 ((struct cont_a64_entry *) pkt)->entry_type = in qla1280_64bit_start_scsi()
2905 ((struct cont_a64_entry *) pkt)->entry_count = 1; in qla1280_64bit_start_scsi()
2906 ((struct cont_a64_entry *) pkt)->sys_define = in qla1280_64bit_start_scsi()
2907 (uint8_t)ha->req_ring_index; in qla1280_64bit_start_scsi()
2910 (u32 *)&((struct cont_a64_entry *) pkt)->dseg_0_address; in qla1280_64bit_start_scsi()
2928 remseg -= cnt; in qla1280_64bit_start_scsi()
2930 "continuation packet data - b %i, t " in qla1280_64bit_start_scsi()
2938 "packet data - b %i, t %i, l %i \n", in qla1280_64bit_start_scsi()
2943 ha->req_ring_index++; in qla1280_64bit_start_scsi()
2944 if (ha->req_ring_index == REQUEST_ENTRY_CNT) { in qla1280_64bit_start_scsi()
2945 ha->req_ring_index = 0; in qla1280_64bit_start_scsi()
2946 ha->request_ring_ptr = ha->request_ring; in qla1280_64bit_start_scsi()
2948 ha->request_ring_ptr++; in qla1280_64bit_start_scsi()
2953 sp->flags |= SRB_SENT; in qla1280_64bit_start_scsi()
2954 ha->actthreads++; in qla1280_64bit_start_scsi()
2955 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index); in qla1280_64bit_start_scsi()
2989 struct device_reg __iomem *reg = ha->iobase; in qla1280_32bit_start_scsi()
2990 struct scsi_cmnd *cmd = sp->cmd; in qla1280_32bit_start_scsi()
3002 cmd->cmnd[0]); in qla1280_32bit_start_scsi()
3013 req_cnt += (seg_cnt - 4) / 7; in qla1280_32bit_start_scsi()
3014 if ((seg_cnt - 4) % 7) in qla1280_32bit_start_scsi()
3024 if ((req_cnt + 2) >= ha->req_q_cnt) { in qla1280_32bit_start_scsi()
3026 cnt = RD_REG_WORD(&reg->mailbox4); in qla1280_32bit_start_scsi()
3027 if (ha->req_ring_index < cnt) in qla1280_32bit_start_scsi()
3028 ha->req_q_cnt = cnt - ha->req_ring_index; in qla1280_32bit_start_scsi()
3030 ha->req_q_cnt = in qla1280_32bit_start_scsi()
3031 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt); in qla1280_32bit_start_scsi()
3035 ha->req_q_cnt, seg_cnt); in qla1280_32bit_start_scsi()
3037 if ((req_cnt + 2) >= ha->req_q_cnt) { in qla1280_32bit_start_scsi()
3039 dprintk(2, "qla1280_32bit_start_scsi: in-ptr=0x%x, " in qla1280_32bit_start_scsi()
3040 "req_q_cnt=0x%x, req_cnt=0x%x", ha->req_ring_index, in qla1280_32bit_start_scsi()
3041 ha->req_q_cnt, req_cnt); in qla1280_32bit_start_scsi()
3047 ha->outstanding_cmds[cnt]; cnt++); in qla1280_32bit_start_scsi()
3052 "ARRAY, req_q_cnt=0x%x\n", ha->req_q_cnt); in qla1280_32bit_start_scsi()
3056 CMD_HANDLE(sp->cmd) = (unsigned char *) (unsigned long)(cnt + 1); in qla1280_32bit_start_scsi()
3057 ha->outstanding_cmds[cnt] = sp; in qla1280_32bit_start_scsi()
3058 ha->req_q_cnt -= req_cnt; in qla1280_32bit_start_scsi()
3063 pkt = (struct cmd_entry *) ha->request_ring_ptr; in qla1280_32bit_start_scsi()
3065 pkt->entry_type = COMMAND_TYPE; in qla1280_32bit_start_scsi()
3066 pkt->entry_count = (uint8_t) req_cnt; in qla1280_32bit_start_scsi()
3067 pkt->sys_define = (uint8_t) ha->req_ring_index; in qla1280_32bit_start_scsi()
3068 pkt->entry_status = 0; in qla1280_32bit_start_scsi()
3069 pkt->handle = cpu_to_le32(cnt); in qla1280_32bit_start_scsi()
3072 memset(((char *)pkt + 8), 0, (REQUEST_ENTRY_SIZE - 8)); in qla1280_32bit_start_scsi()
3075 pkt->timeout = cpu_to_le16(scsi_cmd_to_rq(cmd)->timeout / HZ); in qla1280_32bit_start_scsi()
3078 pkt->lun = SCSI_LUN_32(cmd); in qla1280_32bit_start_scsi()
3079 pkt->target = SCSI_BUS_32(cmd) ? in qla1280_32bit_start_scsi()
3083 if (cmd->device->simple_tags) in qla1280_32bit_start_scsi()
3084 pkt->control_flags |= cpu_to_le16(BIT_3); in qla1280_32bit_start_scsi()
3087 pkt->cdb_len = cpu_to_le16(CMD_CDBLEN(cmd)); in qla1280_32bit_start_scsi()
3088 memcpy(pkt->scsi_cdb, CMD_CDBP(cmd), CMD_CDBLEN(cmd)); in qla1280_32bit_start_scsi()
3090 /*dprintk(1, "Build packet for command[0]=0x%x\n",pkt->scsi_cdb[0]); */ in qla1280_32bit_start_scsi()
3093 pkt->control_flags |= cpu_to_le16(dir); in qla1280_32bit_start_scsi()
3096 pkt->dseg_count = cpu_to_le16(seg_cnt); in qla1280_32bit_start_scsi()
3108 dword_ptr = &pkt->dseg_0_address; in qla1280_32bit_start_scsi()
3123 remseg--; in qla1280_32bit_start_scsi()
3134 ha->req_ring_index++; in qla1280_32bit_start_scsi()
3135 if (ha->req_ring_index == REQUEST_ENTRY_CNT) { in qla1280_32bit_start_scsi()
3136 ha->req_ring_index = 0; in qla1280_32bit_start_scsi()
3137 ha->request_ring_ptr = in qla1280_32bit_start_scsi()
3138 ha->request_ring; in qla1280_32bit_start_scsi()
3140 ha->request_ring_ptr++; in qla1280_32bit_start_scsi()
3142 pkt = (struct cmd_entry *)ha->request_ring_ptr; in qla1280_32bit_start_scsi()
3148 ((struct cont_entry *) pkt)-> in qla1280_32bit_start_scsi()
3150 ((struct cont_entry *) pkt)->entry_count = 1; in qla1280_32bit_start_scsi()
3152 ((struct cont_entry *) pkt)->sys_define = in qla1280_32bit_start_scsi()
3153 (uint8_t) ha->req_ring_index; in qla1280_32bit_start_scsi()
3157 &((struct cont_entry *) pkt)->dseg_0_address; in qla1280_32bit_start_scsi()
3173 remseg -= cnt; in qla1280_32bit_start_scsi()
3175 "continuation packet data - " in qla1280_32bit_start_scsi()
3183 "packet data - \n"); in qla1280_32bit_start_scsi()
3187 qla1280_dump_buffer(5, (char *)ha->request_ring_ptr, in qla1280_32bit_start_scsi()
3191 ha->req_ring_index++; in qla1280_32bit_start_scsi()
3192 if (ha->req_ring_index == REQUEST_ENTRY_CNT) { in qla1280_32bit_start_scsi()
3193 ha->req_ring_index = 0; in qla1280_32bit_start_scsi()
3194 ha->request_ring_ptr = ha->request_ring; in qla1280_32bit_start_scsi()
3196 ha->request_ring_ptr++; in qla1280_32bit_start_scsi()
3201 sp->flags |= SRB_SENT; in qla1280_32bit_start_scsi()
3202 ha->actthreads++; in qla1280_32bit_start_scsi()
3203 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index); in qla1280_32bit_start_scsi()
3229 struct device_reg __iomem *reg = ha->iobase; in qla1280_req_pkt()
3240 for (timer = 15000000; timer; timer--) { in qla1280_req_pkt()
3241 if (ha->req_q_cnt > 0) { in qla1280_req_pkt()
3243 cnt = RD_REG_WORD(&reg->mailbox4); in qla1280_req_pkt()
3244 if (ha->req_ring_index < cnt) in qla1280_req_pkt()
3245 ha->req_q_cnt = cnt - ha->req_ring_index; in qla1280_req_pkt()
3247 ha->req_q_cnt = in qla1280_req_pkt()
3248 REQUEST_ENTRY_CNT - (ha->req_ring_index - cnt); in qla1280_req_pkt()
3252 if (ha->req_q_cnt > 0) { in qla1280_req_pkt()
3253 ha->req_q_cnt--; in qla1280_req_pkt()
3254 pkt = ha->request_ring_ptr; in qla1280_req_pkt()
3264 pkt->sys_define = (uint8_t) ha->req_ring_index; in qla1280_req_pkt()
3267 pkt->entry_count = 1; in qla1280_req_pkt()
3297 struct device_reg __iomem *reg = ha->iobase; in qla1280_isp_cmd()
3302 qla1280_dump_buffer(5, (char *)ha->request_ring_ptr, in qla1280_isp_cmd()
3306 ha->req_ring_index++; in qla1280_isp_cmd()
3307 if (ha->req_ring_index == REQUEST_ENTRY_CNT) { in qla1280_isp_cmd()
3308 ha->req_ring_index = 0; in qla1280_isp_cmd()
3309 ha->request_ring_ptr = ha->request_ring; in qla1280_isp_cmd()
3311 ha->request_ring_ptr++; in qla1280_isp_cmd()
3316 WRT_REG_WORD(&reg->mailbox4, ha->req_ring_index); in qla1280_isp_cmd()
3336 struct device_reg __iomem *reg = ha->iobase; in qla1280_isr()
3346 istatus = RD_REG_WORD(&reg->istatus); in qla1280_isr()
3351 mailbox[5] = RD_REG_WORD(&reg->mailbox5); in qla1280_isr()
3355 mailbox[0] = RD_REG_WORD_dmasync(&reg->semaphore); in qla1280_isr()
3362 *wptr++ = RD_REG_WORD(&reg->mailbox0); in qla1280_isr()
3363 *wptr++ = RD_REG_WORD(&reg->mailbox1); in qla1280_isr()
3364 *wptr = RD_REG_WORD(&reg->mailbox2); in qla1280_isr()
3367 *wptr++ = RD_REG_WORD(&reg->mailbox3); in qla1280_isr()
3368 *wptr++ = RD_REG_WORD(&reg->mailbox4); in qla1280_isr()
3370 *wptr++ = RD_REG_WORD(&reg->mailbox6); in qla1280_isr()
3371 *wptr = RD_REG_WORD(&reg->mailbox7); in qla1280_isr()
3376 WRT_REG_WORD(&reg->semaphore, 0); in qla1280_isr()
3377 WRT_REG_WORD(&reg->host_cmd, HC_CLR_RISC_INT); in qla1280_isr()
3388 if (ha->flags.online) { in qla1280_isr()
3394 sp = ha->outstanding_cmds[index]; in qla1280_isr()
3400 ha->outstanding_cmds[index] = NULL; in qla1280_isr()
3403 CMD_RESULT(sp->cmd) = 0; in qla1280_isr()
3404 CMD_HANDLE(sp->cmd) = COMPLETED_HANDLE; in qla1280_isr()
3407 list_add_tail(&sp->list, done_q); in qla1280_isr()
3419 ha->flags.reset_marker = 1; in qla1280_isr()
3421 ha->bus_settings[index].reset_marker = 1; in qla1280_isr()
3429 "qla1280: ISP System Error - mbx1=%xh, mbx2=" in qla1280_isr()
3444 case MBA_WAKEUP_THRES: /* Request Queue Wake-up */ in qla1280_isr()
3457 ha->flags.reset_marker = 1; in qla1280_isr()
3459 ha->bus_settings[index].reset_marker = 1; in qla1280_isr()
3471 memcpy((uint16_t *) ha->mailbox_out, wptr, in qla1280_isr()
3475 if(ha->mailbox_wait != NULL) in qla1280_isr()
3476 complete(ha->mailbox_wait); in qla1280_isr()
3481 WRT_REG_WORD(&reg->host_cmd, HC_CLR_RISC_INT); in qla1280_isr()
3488 if (!(ha->flags.online && !ha->mailbox_wait)) { in qla1280_isr()
3496 while (ha->rsp_ring_index != mailbox[5]) { in qla1280_isr()
3497 pkt = ha->response_ring_ptr; in qla1280_isr()
3499 dprintk(5, "qla1280_isr: ha->rsp_ring_index = 0x%x, mailbox[5]" in qla1280_isr()
3500 " = 0x%x\n", ha->rsp_ring_index, mailbox[5]); in qla1280_isr()
3504 if (pkt->entry_type == STATUS_TYPE) { in qla1280_isr()
3505 if ((le16_to_cpu(pkt->scsi_status) & 0xff) in qla1280_isr()
3506 || pkt->comp_status || pkt->entry_status) { in qla1280_isr()
3507 dprintk(2, "qla1280_isr: ha->rsp_ring_index = " in qla1280_isr()
3510 ha->rsp_ring_index, mailbox[5], in qla1280_isr()
3511 le16_to_cpu(pkt->comp_status), in qla1280_isr()
3512 le16_to_cpu(pkt->scsi_status)); in qla1280_isr()
3515 dprintk(2, "qla1280_isr: ha->rsp_ring_index = " in qla1280_isr()
3517 ha->rsp_ring_index, mailbox[5]); in qla1280_isr()
3523 if (pkt->entry_type == STATUS_TYPE || pkt->entry_status) { in qla1280_isr()
3525 ha->outstanding_cmds[pkt->handle]->cmd, in qla1280_isr()
3526 pkt->handle); in qla1280_isr()
3527 if (pkt->entry_type == STATUS_TYPE) in qla1280_isr()
3532 ha->rsp_ring_index++; in qla1280_isr()
3533 if (ha->rsp_ring_index == RESPONSE_ENTRY_CNT) { in qla1280_isr()
3534 ha->rsp_ring_index = 0; in qla1280_isr()
3535 ha->response_ring_ptr = ha->response_ring; in qla1280_isr()
3537 ha->response_ring_ptr++; in qla1280_isr()
3538 WRT_REG_WORD(&reg->mailbox5, ha->rsp_ring_index); in qla1280_isr()
3560 if (ha->flags.online && !ha->flags.reset_active && in qla1280_rst_aen()
3561 !ha->flags.abort_isp_active) { in qla1280_rst_aen()
3562 ha->flags.reset_active = 1; in qla1280_rst_aen()
3563 while (ha->flags.reset_marker) { in qla1280_rst_aen()
3565 ha->flags.reset_marker = 0; in qla1280_rst_aen()
3566 for (bus = 0; bus < ha->ports && in qla1280_rst_aen()
3567 !ha->flags.reset_marker; bus++) { in qla1280_rst_aen()
3568 if (ha->bus_settings[bus].reset_marker) { in qla1280_rst_aen()
3569 ha->bus_settings[bus].reset_marker = 0; in qla1280_rst_aen()
3597 uint32_t handle = le32_to_cpu(pkt->handle); in qla1280_status_entry()
3598 uint16_t scsi_status = le16_to_cpu(pkt->scsi_status); in qla1280_status_entry()
3599 uint16_t comp_status = le16_to_cpu(pkt->comp_status); in qla1280_status_entry()
3605 sp = ha->outstanding_cmds[handle]; in qla1280_status_entry()
3615 ha->outstanding_cmds[handle] = NULL; in qla1280_status_entry()
3617 cmd = sp->cmd; in qla1280_status_entry()
3637 le16_to_cpu(pkt->req_sense_length); in qla1280_status_entry()
3642 * scsi_cmnd->sense_buffer is in qla1280_status_entry()
3646 sense_sz = CMD_SNSLEN(cmd) - 1; in qla1280_status_entry()
3648 memcpy(cmd->sense_buffer, in qla1280_status_entry()
3649 &pkt->req_sense_data, sense_sz); in qla1280_status_entry()
3652 memset(cmd->sense_buffer + sense_sz, 0, in qla1280_status_entry()
3653 SCSI_SENSE_BUFFERSIZE - sense_sz); in qla1280_status_entry()
3661 (char *)cmd->sense_buffer, in qla1280_status_entry()
3666 CMD_HANDLE(sp->cmd) = COMPLETED_HANDLE; in qla1280_status_entry()
3669 list_add_tail(&sp->list, done_q); in qla1280_status_entry()
3688 uint32_t handle = le32_to_cpu(pkt->handle); in qla1280_error_entry()
3692 if (pkt->entry_status & BIT_3) in qla1280_error_entry()
3694 else if (pkt->entry_status & BIT_2) in qla1280_error_entry()
3696 else if (pkt->entry_status & BIT_1) in qla1280_error_entry()
3703 sp = ha->outstanding_cmds[handle]; in qla1280_error_entry()
3709 ha->outstanding_cmds[handle] = NULL; in qla1280_error_entry()
3712 if (pkt->entry_status & (BIT_3 + BIT_2)) { in qla1280_error_entry()
3714 /* CMD_RESULT(sp->cmd) = CS_BAD_PAYLOAD; */ in qla1280_error_entry()
3715 CMD_RESULT(sp->cmd) = DID_ERROR << 16; in qla1280_error_entry()
3716 } else if (pkt->entry_status & BIT_1) { /* FULL flag */ in qla1280_error_entry()
3717 CMD_RESULT(sp->cmd) = DID_BUS_BUSY << 16; in qla1280_error_entry()
3720 CMD_RESULT(sp->cmd) = DID_ERROR << 16; in qla1280_error_entry()
3723 CMD_HANDLE(sp->cmd) = COMPLETED_HANDLE; in qla1280_error_entry()
3726 list_add_tail(&sp->list, done_q); in qla1280_error_entry()
3729 else if (pkt->entry_type == COMMAND_A64_TYPE) { in qla1280_error_entry()
3750 struct device_reg __iomem *reg = ha->iobase; in qla1280_abort_isp()
3758 if (ha->flags.abort_isp_active || !ha->flags.online) in qla1280_abort_isp()
3761 ha->flags.abort_isp_active = 1; in qla1280_abort_isp()
3765 WRT_REG_WORD(&reg->host_cmd, HC_PAUSE_RISC); in qla1280_abort_isp()
3766 RD_REG_WORD(&reg->id_l); in qla1280_abort_isp()
3769 ha->host_no); in qla1280_abort_isp()
3773 sp = ha->outstanding_cmds[cnt]; in qla1280_abort_isp()
3775 cmd = sp->cmd; in qla1280_abort_isp()
3778 ha->outstanding_cmds[cnt] = NULL; in qla1280_abort_isp()
3779 list_add_tail(&sp->list, &ha->done_q); in qla1280_abort_isp()
3797 for (bus = 0; bus < ha->ports; bus++) in qla1280_abort_isp()
3800 ha->flags.abort_isp_active = 0; in qla1280_abort_isp()
3804 "qla1280: ISP error recovery failed, board disabled"); in qla1280_abort_isp()
3857 struct device_reg __iomem *reg = ha->iobase; in qla1280_check_for_dead_scsi_bus()
3859 if (ha->bus_settings[bus].scsi_bus_dead) { in qla1280_check_for_dead_scsi_bus()
3860 WRT_REG_WORD(&reg->host_cmd, HC_PAUSE_RISC); in qla1280_check_for_dead_scsi_bus()
3861 config_reg = RD_REG_WORD(&reg->cfg_1); in qla1280_check_for_dead_scsi_bus()
3862 WRT_REG_WORD(&reg->cfg_1, SET_SXP_BANK); in qla1280_check_for_dead_scsi_bus()
3863 scsi_control = RD_REG_WORD(&reg->scsiControlPins); in qla1280_check_for_dead_scsi_bus()
3864 WRT_REG_WORD(&reg->cfg_1, config_reg); in qla1280_check_for_dead_scsi_bus()
3865 WRT_REG_WORD(&reg->host_cmd, HC_RELEASE_RISC); in qla1280_check_for_dead_scsi_bus()
3868 ha->bus_settings[bus].scsi_bus_dead = 1; in qla1280_check_for_dead_scsi_bus()
3871 ha->bus_settings[bus].scsi_bus_dead = 0; in qla1280_check_for_dead_scsi_bus()
3872 ha->bus_settings[bus].failed_reset_count = 0; in qla1280_check_for_dead_scsi_bus()
3885 bus = device->channel; in qla1280_get_target_parameters()
3886 target = device->id; in qla1280_get_target_parameters()
3887 lun = device->lun; in qla1280_get_target_parameters()
3896 printk(KERN_INFO "scsi(%li:%d:%d:%d):", ha->host_no, bus, target, lun); in qla1280_get_target_parameters()
3908 if (device->simple_tags) in qla1280_get_target_parameters()
3909 printk(KERN_CONT ", Tagged queuing: depth %d", device->queue_depth); in qla1280_get_target_parameters()
3923 printk(KERN_DEBUG "---------------------------------------------" in __qla1280_dump_buffer()
3924 "------------------\n"); in __qla1280_dump_buffer()
3953 ha = (struct scsi_qla_host *)host->hostdata; in __qla1280_print_scsi_cmd()
3961 for (i = 0; i < cmd->cmd_len; i++) { in __qla1280_print_scsi_cmd()
3962 printk("0x%02x ", cmd->cmnd[i]); in __qla1280_print_scsi_cmd()
3967 /* if (cmd->use_sg) in __qla1280_print_scsi_cmd()
3969 sg = (struct scatterlist *) cmd->request_buffer; in __qla1280_print_scsi_cmd()
3971 qla1280_dump_buffer(1, (char *)sg, (cmd->use_sg*sizeof(struct scatterlist))); in __qla1280_print_scsi_cmd()
3974 scsi_cmd_to_rq(cmd)->tag, cmd->transfersize); in __qla1280_print_scsi_cmd()
3976 cmd->underflow, cmd->sc_data_direction); in __qla1280_print_scsi_cmd()
3994 if ((sp = ha->outstanding_cmds[i]) == NULL) in ql1280_dump_device()
3996 if ((cp = sp->cmd) == NULL) in ql1280_dump_device()
4100 long ret = -1; in qla1280_get_token()
4107 if (!strncmp(setup_token[i].token, str, (sep - str))) { in qla1280_get_token()
4131 .this_id = -1,
4140 int devnum = id->driver_data; in qla1280_probe_one()
4144 int error = -ENODEV; in qla1280_probe_one()
4147 if (pdev->subsystem_vendor == PCI_VENDOR_ID_AMI) { in qla1280_probe_one()
4154 bdp->name, pdev->bus->number, PCI_SLOT(pdev->devfn)); in qla1280_probe_one()
4164 error = -ENOMEM; in qla1280_probe_one()
4172 ha = (struct scsi_qla_host *)host->hostdata; in qla1280_probe_one()
4175 ha->pdev = pdev; in qla1280_probe_one()
4176 ha->devnum = devnum; /* specifies microcode load address */ in qla1280_probe_one()
4179 if (dma_set_mask_and_coherent(&ha->pdev->dev, DMA_BIT_MASK(64))) { in qla1280_probe_one()
4180 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { in qla1280_probe_one()
4182 "suitable DMA mask - aborting\n", ha->host_no); in qla1280_probe_one()
4183 error = -ENODEV; in qla1280_probe_one()
4188 ha->host_no); in qla1280_probe_one()
4190 if (dma_set_mask(&ha->pdev->dev, DMA_BIT_MASK(32))) { in qla1280_probe_one()
4192 "suitable DMA mask - aborting\n", ha->host_no); in qla1280_probe_one()
4193 error = -ENODEV; in qla1280_probe_one()
4198 ha->request_ring = dma_alloc_coherent(&ha->pdev->dev, in qla1280_probe_one()
4200 &ha->request_dma, GFP_KERNEL); in qla1280_probe_one()
4201 if (!ha->request_ring) { in qla1280_probe_one()
4206 ha->response_ring = dma_alloc_coherent(&ha->pdev->dev, in qla1280_probe_one()
4208 &ha->response_dma, GFP_KERNEL); in qla1280_probe_one()
4209 if (!ha->response_ring) { in qla1280_probe_one()
4214 ha->ports = bdp->numPorts; in qla1280_probe_one()
4216 ha->host = host; in qla1280_probe_one()
4217 ha->host_no = host->host_no; in qla1280_probe_one()
4219 host->irq = pdev->irq; in qla1280_probe_one()
4220 host->max_channel = bdp->numPorts - 1; in qla1280_probe_one()
4221 host->max_lun = MAX_LUNS - 1; in qla1280_probe_one()
4222 host->max_id = MAX_TARGETS; in qla1280_probe_one()
4223 host->max_sectors = 1024; in qla1280_probe_one()
4224 host->unique_id = host->host_no; in qla1280_probe_one()
4226 error = -ENODEV; in qla1280_probe_one()
4229 ha->mmpbase = pci_ioremap_bar(ha->pdev, 1); in qla1280_probe_one()
4230 if (!ha->mmpbase) { in qla1280_probe_one()
4235 host->base = (unsigned long)ha->mmpbase; in qla1280_probe_one()
4236 ha->iobase = (struct device_reg __iomem *)ha->mmpbase; in qla1280_probe_one()
4238 host->io_port = pci_resource_start(ha->pdev, 0); in qla1280_probe_one()
4239 if (!request_region(host->io_port, 0xff, "qla1280")) { in qla1280_probe_one()
4241 "0x%04lx-0x%04lx - already in use\n", in qla1280_probe_one()
4242 host->io_port, host->io_port + 0xff); in qla1280_probe_one()
4246 ha->iobase = (struct device_reg *)host->io_port; in qla1280_probe_one()
4249 INIT_LIST_HEAD(&ha->done_q); in qla1280_probe_one()
4254 if (request_irq(pdev->irq, qla1280_intr_handler, IRQF_SHARED, in qla1280_probe_one()
4257 "in use\n", pdev->irq); in qla1280_probe_one()
4268 host->this_id = ha->bus_settings[0].id; in qla1280_probe_one()
4272 error = scsi_add_host(host, &pdev->dev); in qla1280_probe_one()
4282 free_irq(pdev->irq, ha); in qla1280_probe_one()
4285 iounmap(ha->mmpbase); in qla1280_probe_one()
4287 release_region(host->io_port, 0xff); in qla1280_probe_one()
4290 dma_free_coherent(&ha->pdev->dev, in qla1280_probe_one()
4292 ha->response_ring, ha->response_dma); in qla1280_probe_one()
4294 dma_free_coherent(&ha->pdev->dev, in qla1280_probe_one()
4296 ha->request_ring, ha->request_dma); in qla1280_probe_one()
4310 struct scsi_qla_host *ha = (struct scsi_qla_host *)host->hostdata; in qla1280_remove_one()
4316 free_irq(pdev->irq, ha); in qla1280_remove_one()
4319 iounmap(ha->mmpbase); in qla1280_remove_one()
4321 release_region(host->io_port, 0xff); in qla1280_remove_one()
4324 dma_free_coherent(&ha->pdev->dev, in qla1280_remove_one()
4326 ha->request_ring, ha->request_dma); in qla1280_remove_one()
4327 dma_free_coherent(&ha->pdev->dev, in qla1280_remove_one()
4329 ha->response_ring, ha->response_dma); in qla1280_remove_one()