diff options
| author | Gerard Roudier <groudier@FreeBSD.org> | 2000-07-05 20:37:53 +0000 |
|---|---|---|
| committer | Gerard Roudier <groudier@FreeBSD.org> | 2000-07-05 20:37:53 +0000 |
| commit | 31102137cafad3d4067695fa304f33686bc00d36 (patch) | |
| tree | 6980c3e1692e17933979a050e26b09fc6a9777be /sys/dev/sym | |
| parent | 9ac958a86509fcaedabcbe0e2548428759c506af (diff) | |
Notes
Diffstat (limited to 'sys/dev/sym')
| -rw-r--r-- | sys/dev/sym/README.sym | 261 | ||||
| -rw-r--r-- | sys/dev/sym/sym_fw1.h | 4 | ||||
| -rw-r--r-- | sys/dev/sym/sym_fw2.h | 4 | ||||
| -rw-r--r-- | sys/dev/sym/sym_hipd.c | 135 |
4 files changed, 122 insertions, 282 deletions
diff --git a/sys/dev/sym/README.sym b/sys/dev/sym/README.sym index 7cf6fa3ea7d2..a4e19edf416a 100644 --- a/sys/dev/sym/README.sym +++ b/sys/dev/sym/README.sym @@ -2,13 +2,12 @@ * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 * PCI-SCSI controllers. * - * Copyright (C) 1999 Gerard Roudier <groudier@club-internet.fr> + * Copyright (C) 1999-2000 Gerard Roudier <groudier@club-internet.fr> * * This driver also supports the following Symbios/LSI PCI-SCSI chips: - * 53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895. + * 53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895, + * 53C810, 53C815, 53C825 and the 53C1510D is 53C8XX mode. * - * but does not support earlier chips as the following ones: - * 53C810, 53C815, 53C825. * * This driver for FreeBSD-CAM is derived from the Linux sym53c8xx driver. * Copyright (C) 1998-1999 Gerard Roudier @@ -54,244 +53,26 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. + * + * $FreeBSD$ */ -Status: - BETA-RELEASE - This driver is currently developped under the following O/S: - FreeBSD 4.0 SNAPSHOT July 5th 1999 - FreeBSD 4.0 current October 1999 - Starting with version 0.9.0, the driver contains conditionnal code - for using pre-4.0 BUS stuff for PCI. I have successfully tested driver - version 0.9.0 under: - FreeBSD 3.2 RELEASE - FreeBSD 3.3 RELEASE - -Latest revision: - sym-0.12.0-19991127 - Files to download: - SYM-0.9.0-19991024.tar.gz - PATCH-SYM-0.10.0-19991111.gz - PATCH-SYM-0.11.0-19991120.gz - PATCH-SYM-0.12.0-19991127.gz - -Supported SCSI features: - - Initiator mode - - Wide 16 SCSI BUS - - FAST10 up to FAST80-DT synchronous data transfers - (depends on controller capabilities) - - 64 luns per target - - 256 tags per lun - - MDP (1) - - BUS DEVICE RESET message - - ABORT, ABORT TAG message - -Supported generic chip features: - - On chip RAM - - PCI optimized transactions. - -Supported features of 896/895A/1010: - - Full SCRIPTS in on-board RAM (8K) - - Phase mismatch handling from SCRIPTS. - -Others: - - SYMBIOS NVRAM layout using 24c16 EEPROM - - TEKRAM NVRAM layout using 24c16 EEPROM (2) - - TEKRAM NVRAM layout using 93c46 EEPROM (2) - - Transfer residuals - - 0(1) for both SCRIPTS and C code, allowing - 100% scalability. - -Notes: -(1) Not yet reported. May not work as expected. - -Files: - README.sym this file - sym_conf.h driver configuration - sym_defs.h driver definitions - sym_hipd.c driver code - sym_sys.patch kernel patch for FreeBSD 4 - sym_sys_3.patch kernel patch for FreeBSD 3 - -These patches apply a change to the ncr.c driver that forces it to -ignore SYM53C8XX chips that support LOAD/STORE. These devices will -be attached by the sym_hipd.c driver. - -Installation: - 1) Untar SYM-0.9.0-19991024.tar.gz - 2) Create the /usr/src/sys/dev/sym directory - 3) Copy README.sym, sym_conf.h, sym_defs.h and sym_hipd.c to - /usr/src/sys/dev/sym/ - 4) Change to /usr/src/sys/ directory - 5) If FreeBSD-4, apply the unified patch sym_sys.patch - (patch -p0 <sym_sys.patch) - Otherwise, - If FreeBSD-3, apply the unified patch sym_sys_3.patch - (patch -p0 <sym_sys_3.patch) - Otherwise, leave here. ;) - 6) Change to /usr/src/sys/dev/sym directory - 7) Update to SYM-0.11.0-19991120 - gzip -d <PATCH-SYM-0.10.0-19991111.gz | patch -p0 - gzip -d <PATCH-SYM-0.11.0-19991120.gz | patch -p0 - gzip -d <PATCH-SYM-0.12.0-19991127.gz | patch -p0 - 8) Add sym0 to your kernel configuration as indicated in patched LINT file. - Configure and make your kernel. - -As seen from the shell history file (driver material assumed from /tmp), -installation should proceed as follow (modulo mistakes from me:)): - -cd /tmp -tar zxvf SYM-0.9.0-19991024.tar.gz -cp SYM-0.9.0-19991024/* /usr/src/sys/dev/sym -cd /usr/src/sys -patch -p0 <dev/sym/sym_sys.patch # use sym_sys_3.patch if FreeBSD-3.X -cd dev/sym -gzip -d </tmp/PATCH-SYM-0.10.0-19991111.gz | patch -p0 -gzip -d </tmp/PATCH-SYM-0.11.0-19991120.gz | patch -p0 -gzip -d </tmp/PATCH-SYM-0.12.0-19991127.gz | patch -p0 - -Configuring Ultra-3 DT data transfer support. ---------------------------------------------- -If you have a board using the SYM53C1010 (only evaluation boards seem to -be available for now), you may want to give Ultra-3 DT transfer a try. -For the reasons that FreeBSD-CAM is not yet ready for Ultra-3 and that -early SYM53C1010 chips need some work-around for DT transfers to work -reliably, you must apply manually the following additionnal patch to your -kernel tree: - ----------------------- Cut Here ------------------------ ---- cam/scsi/scsi_all.c.00 1999/08/29 16:21:44 -+++ cam/scsi/scsi_all.c 1999/11/23 22:11:22 -@@ -2394,6 +2394,7 @@ - u_int period_factor; - u_int period; /* in 10ths of ns */ - } scsi_syncrates[] = { -+ { 0x09, 125 }, - { 0x0a, 250 }, - { 0x0b, 303 }, - { 0x0c, 500 } ---- pci/sym_conf.h.00 Fri Nov 26 22:58:59 1999 -+++ pci/sym_conf.h Fri Nov 26 22:58:38 1999 -@@ -69,6 +69,7 @@ - * corresponding code will get useless. - */ - /* #define SYMCONF_BROKEN_U3EN_SUPPORT */ -+#define SYMCONF_BROKEN_U3EN_SUPPORT - - /* - * Use Normal IO instead of MMIO. ----------------------- Cut Here ------------------------ - -This change consist in allowing sync factor 9 support to be handled -by scsi_all.c and a compilation option to be defined in sym_conf.h. -The driver may only start a PPR negotiation if sync factor is 9. -This change has been only tested on FreeBSD-3.3 for the moment. - -For the PPR negotiation to occur at system startup time, you need to -configure Ultra3 hard disks in the NVRAM for 80 Mega-transfers per second -Wide. -If you prefer to use camcontrol for such a negotiation to be performed after -system startup, then you have to rebuild either the libcam shareable library -with the patched version of scsi_all.c, on to rebuild camcontrol using -the new static version of the libcam library that includes the patched -version of scsi_all.o. - -Warnings: -- This driver uses LOAD/STORE instructions from SCRIPTS and therefore does - not support earliest NCR chips (NCR53C810, NCR53C815, NCR53C825). - -Versionning: -- The version number consists in 3 numbers X.Y.Z, starting with 0.0.0. -- Z will not be used for incremental patches, but may be used for - quick fixes. -- Incremental diff files are of the following pattern: - PATCH-SYM-X.Y.Z-YYYYMMDD - They must be applied from directory: /usr/src/sys/dev/sym/ -- Version 1.0.0 will happen when the driver will be tested enough but this - driver version will probably not officially support the C1010 (Ultra-3) - since the testing of Ultra3 has just started and FreeBSD-CAM is not yet - ready for the support of Ultra-3. Some 1.X.0 version will support - DT data transfer for the C1010. -- Version 2.0.0 is not planned for now, but will add support for host target - mode if it will ever exist. - -Change log: -* SYM-0.0.0-19990915 - Initial release. - -* SYM-0.1.0-19990919 (diff file PATCH-SYM-0.1.0-19990919 - Add NVRAM support for latest Tekram boards using 24c16 EEPROM. - -* SYM-0.2.0-19990922 (diff file PATCH-SYM-0.2.0-19990922 - Add PPR negotiation and Ultra3 DT transfers for the LSI53C1010. - This corresponding code is untested since I haven't yet the - hardware. But the driver is not broken for current chips. - -* SYM-0.3.0-19990925 (diff file PATCH-SYM-0.3.0-19990925 - Source review. - Testing of the QUEUE FULL handling (some fixes applied). - -* SYM-0.4.0-19990925 (diff file PATCH-SYM-0.4.0-19990928) - Fixes, notably the QUEUE FULL handling that requeued everything - without telling the XPT about the error. Note that this did not - break anything, but the queue depth was never reduced. - -* SYM-0.5.0-19991001 (diff file PATCH-SYM-0.5.0-19991001) - Problem of not discovering LUNs != 0 hopefully fixed. - Some other minor fixes. - -* SYM-0.6.0-19991003 (diff file PATCH-SYM-0.6.0-19991003) - Test error recovery pathes and residual calculation. - Improve Symbios NVRAM support by applying the SCAN_LUNS flag. The driver - answers DEV_NOT_THERE to INQUIRYs for LUNs that are not to be scanned. - Switch the driver status for SPI2 support to BETA-RELEASE. - -* SYM-0.7.0-19991006 (diff file PATCH-SYM-0.7.0-19991006) - Add support of the LSI1510D that emulates a 895 (infos sent by Compaq - that seems to be the only supplier of this chip) - Return CAM_REQ_ABORTED on HS_ABORT host status. - Fix a tiny bug that let the driver miss the TAG setting. - -* SYM-0.8.0-19991016 (diff file PATCH-SYM-0.8.0-19991016) - Heavy rewrite/rewamping of the error handling code in order to conform - to FreeBSD-CAM expectation of commands having to be requeued and device - queue to be frozen on any kind of error. Driver status switched back - to EXPERIMENTAL due to these changes. - Warn user about targets that are not flagged for SCAN AT BOOT in the - NVRAM, since the driver will not allow the corresponding devices to be - discovered by XPT. - And numerous minor changes. - -* SYM-0.9.0-19991024 (Tar file SYM-0.9.0-19991024.tar.gz) - Add support for previous PCI BUS stuff, for the driver to be useable - under FreeBSD 3.X RELEASES. The source is #ifdefed for using the old - PCI BUS code under __FreeBSD_version < 400000 and the new one otherwise. - Tested under RELENG_3_2_0_RELEASE, but should also be just fine for 3.3. - Other changes against version 0.8.0 are only minor buglet fixes. - -* SYM-0.10.0-19991111 (diff file PATCH-SYM-0.10.0-19991111) - Add support for Alpha - UNTESTED. Consists in some minor changes picked - mostly from the ncr driver and some others as ahc_pci.c. - Fix the LED support through GPIO0 for pre-896 chips. In fact some code - was wrongly conditionned by something that was never met. - Switch driver status to BETA-RELEASE given that this driver has been rock - solid even if a small number of users seems to actually use it. +README.sym +---------- +This file was bundled with the `sym' driver source files, when +the driver was in development stage and not included yet into +the FreeBSD repository. It described how to install the driver, +gave informations on driver features and summerized important +changes between versions. These informations are now available +using `man sym' for driver usage and features description, and +`cvs log' for driver changes. -* SYM-0.11.0-19991120 (diff file PATCH-SYM-0.11.0-19991120) - Rearrange a bit the initialisation code that deals with IO registers. - Fix a bug in MODIFY_DP/IGN_RESIDUE handling (May-be this code will - never be used). - Fix a tiny problem in Wide nego. The driver didn't start the Sync nego - after a Wide nego if synchronous parameters weren't also changed. - Apply fixes that should allow to successfully link the kernel on Alpha. - LSI53C1010 tested with Asynchronous, FAST5, FAST10, FAST20 and FAST40 - data transfers. +I haven't removed this README file from the repository since +I may have to provide additional documentation to people +interested in understanding the driver sources and/or in helping +driver development and maintainance. -* SYM-0.12.0-19991127 (diff file PATCH-SYM-0.12.0-19991127) - Some testing in Ultra3 FAST-80 DT mode using a SYM53C1010 connected - to an ATLAS 4 Ultra3 disk. Required some tiny fix in the ppr nego code. - Some cosmetic changes in messages displayed under DEBUG. - Fix the chip table (and code) that made the driver wrongly attach - 810 and 825 devices. +As a result, this file is now under reconstruction. :-) -November 27 1999. "Gerard Roudier"<groudier@club-internet.fr> +-- +"Gerard Roudier"<groudier@club-internet.fr> diff --git a/sys/dev/sym/sym_fw1.h b/sys/dev/sym/sym_fw1.h index f671679ef7b6..d7b8644dd436 100644 --- a/sys/dev/sym/sym_fw1.h +++ b/sys/dev/sym/sym_fw1.h @@ -1420,8 +1420,8 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = { * We donnot handle 2 bytes messages from SCRIPTS. * So, let the C code deal with these ones too. */ - SCR_INT ^ IFFALSE (MASK (0x20, 0xf0)), - SIR_MSG_WEIRD, + SCR_JUMP ^ IFFALSE (MASK (0x20, 0xf0)), + PADDR_B (msg_weird_seen), SCR_CLR (SCR_ACK), 0, SCR_MOVE_ABS (1) ^ SCR_MSG_IN, diff --git a/sys/dev/sym/sym_fw2.h b/sys/dev/sym/sym_fw2.h index 5adafb4321bc..494ee17e4547 100644 --- a/sys/dev/sym/sym_fw2.h +++ b/sys/dev/sym/sym_fw2.h @@ -1281,8 +1281,8 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = { * We donnot handle 2 bytes messages from SCRIPTS. * So, let the C code deal with these ones too. */ - SCR_INT ^ IFFALSE (MASK (0x20, 0xf0)), - SIR_MSG_WEIRD, + SCR_JUMP ^ IFFALSE (MASK (0x20, 0xf0)), + PADDR_B (msg_weird_seen), SCR_CLR (SCR_ACK), 0, SCR_MOVE_ABS (1) ^ SCR_MSG_IN, diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index c15509f637ee..d5d7cd8856de 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -57,7 +57,7 @@ /* $FreeBSD$ */ -#define SYM_DRIVER_NAME "sym-1.6.2-20000614" +#define SYM_DRIVER_NAME "sym-1.6.4-20000701" /* #define SYM_DEBUG_GENERIC_SUPPORT */ @@ -189,8 +189,8 @@ typedef u_int32_t u32; #define __le16toh(v) __htole16(v) #define __le32toh(v) __htole32(v) -static __inline__ u16 _htole16(u16 v) { return __htole16(v); } -static __inline__ u32 _htole32(u32 v) { return __htole32(v); } +static __inline u16 _htole16(u16 v) { return __htole16(v); } +static __inline u32 _htole32(u32 v) { return __htole32(v); } #define _le16toh _htole16 #define _le32toh _htole32 @@ -305,7 +305,7 @@ static __inline struct sym_quehead *sym_remque_tail(struct sym_quehead *head) } /* - * This one may be usefull. + * This one may be useful. */ #define FOR_EACH_QUEUED_ELEMENT(head, qp) \ for (qp = (head)->flink; qp != (head); qp = qp->flink) @@ -446,9 +446,9 @@ static void MDELAY(int ms) { while (ms--) UDELAY(1000); } * This allocator has been developped for the Linux sym53c8xx * driver, since this O/S does not provide naturally aligned * allocations. - * It has the vertue to allow the driver to use private pages - * of memory that will be useful if we ever need to deal with - * IO MMU for PCI. + * It has the advantage of allowing the driver to use private + * pages of memory that will be useful if we ever need to deal + * with IO MMUs for PCI. */ #define MEMO_SHIFT 4 /* 16 bytes minimum memory chunk */ @@ -769,7 +769,7 @@ static void ___dma_freep(m_pool_s *mp, m_addr_t m) } #endif -static __inline__ m_pool_s *___get_dma_pool(bus_dma_tag_t dev_dmat) +static __inline m_pool_s *___get_dma_pool(bus_dma_tag_t dev_dmat) { m_pool_s *mp; for (mp = mp0.next; mp && mp->dev_dmat != dev_dmat; mp = mp->next); @@ -1209,7 +1209,7 @@ struct sym_nvram { /* * Device quirks. * Some devices, for example the CHEETAH 2 LVD, disconnects without - * saving the DATA POINTER then reconnect and terminates the IO. + * saving the DATA POINTER then reselects and terminates the IO. * On reselection, the automatic RESTORE DATA POINTER makes the * CURRENT DATA POINTER not point at the end of the IO. * This behaviour just breaks our calculation of the residual. @@ -1543,7 +1543,7 @@ struct sym_ccbh { struct sym_dsb { /* * CCB header. - * Also Assumed at offset 0 of the sym_ccb structure. + * Also assumed at offset 0 of the sym_ccb structure. */ /*0*/ struct sym_ccbh head; @@ -1716,7 +1716,7 @@ struct sym_hcb { rv_ctest5, rv_stest2, rv_ccntl0, rv_ccntl1, rv_scntl4; /* - * Target data used by the CPU. + * Target data. */ struct sym_tcb target[SYM_CONF_MAX_TARGET]; @@ -2026,7 +2026,7 @@ sym_fw1_patch(hcb_p np) #endif /* SYM_CONF_GENERIC_SUPPORT */ /* - * Patch routine for firmware 2. + * Patch routine for firmware #2. */ static void sym_fw2_patch(hcb_p np) @@ -2172,7 +2172,7 @@ sym_fw1_setup(hcb_p np, struct sym_fw *fw) #endif /* SYM_CONF_GENERIC_SUPPORT */ /* - * Setup routine for firmware 2. + * Setup routine for firmware #2. */ static void sym_fw2_setup(hcb_p np, struct sym_fw *fw) @@ -2258,7 +2258,8 @@ static void sym_fw_bind_script (hcb_p np, u32 *start, int len) } if (DEBUG_FLAGS & DEBUG_SCRIPT) - printf ("%x: <%x>\n", cur-start, (unsigned)opcode); + printf ("%d: <%x>\n", (int) (cur-start), + (unsigned)opcode); /* * We don't have to decode ALL commands @@ -2526,8 +2527,6 @@ static void PRINT_ADDR (ccb_p cp) /* * Take into account this ccb in the freeze count. - * The flag that tells user about avoids doing that - * more than once for a ccb. */ static void sym_freeze_cam_ccb(union ccb *ccb) { @@ -2613,7 +2612,6 @@ static u32 div_10M[] = {2*_5M, 3*_5M, 4*_5M, 6*_5M, 8*_5M, 12*_5M, 16*_5M}; * * For PCI 32 bit data transfers each transfer is a DWORD. * It is a QUADWORD (8 bytes) for PCI 64 bit data transfers. - * Only the 896 is able to perform 64 bit data transfers. * * We use log base 2 (burst length) as internal code, with * value 0 meaning "burst disabled". @@ -2923,8 +2921,8 @@ static int sym_prepare_setting(hcb_p np, struct sym_nvram *nvram) /* * Set LED support from SCRIPTS. * Ignore this feature for boards known to use a - * specific GPIO wiring and for the 895A or 896 - * that drive the LED directly. + * specific GPIO wiring and for the 895A, 896 + * and 1010 that drive the LED directly. */ if ((SYM_SETUP_SCSI_LED || nvram->type == SYM_SYMBIOS_NVRAM) && !(np->features & FE_LEDC) && !(np->sv_gpcntl & 0x01)) @@ -3265,6 +3263,10 @@ out: /* * The chip may have completed jobs. Look at the DONE QUEUE. + * + * On architectures that may reorder LOAD/STORE operations, + * a memory barrier may be needed after the reading of the + * so-called `flag' and prior to dealing with the data. */ static int sym_wakeup_done (hcb_p np) { @@ -3284,6 +3286,7 @@ static int sym_wakeup_done (hcb_p np) cp = sym_ccb_from_dsa(np, dsa); if (cp) { + MEMORY_BARRIER(); sym_complete_ok (np, cp); ++n; } @@ -3566,8 +3569,8 @@ sym_getsync(hcb_p np, u_char dt, u_char sfac, u_char *divp, u_char *fakp) kpc <<= 1; /* - * For earliest C10, the extra clocks does not apply - * to CRC cycles, so it may be safe not to use them. + * For earliest C10 revision 0, we cannot use extra + * clocks for the setting of the SCSI clocking. * Note that this limits the lowest sync data transfer * to 5 Mega-transfers per second and may result in * using higher clock divisors. @@ -4002,13 +4005,15 @@ static void sym_intr1 (hcb_p np) /* * interrupt on the fly ? + * + * A `dummy read' is needed to ensure that the + * clear of the INTF flag reaches the device + * before the scanning of the DONE queue. */ istat = INB (nc_istat); if (istat & INTF) { OUTB (nc_istat, (istat & SIGP) | INTF | np->istat_sem); -#if 1 istat = INB (nc_istat); /* DUMMY READ */ -#endif if (DEBUG_FLAGS & DEBUG_TINY) printf ("F "); (void)sym_wakeup_done (np); }; @@ -4050,6 +4055,12 @@ static void sym_intr1 (hcb_p np) (unsigned)INL(nc_dsp), (unsigned)INL(nc_dbc)); /* + * On paper, a memory barrier may be needed here. + * And since we are paranoid ... :) + */ + MEMORY_BARRIER(); + + /* * First, interrupts we want to service cleanly. * * Phase mismatch (MA) is the most frequent interrupt @@ -4347,7 +4358,7 @@ static void sym_int_par (hcb_p np, u_short sist) * must resend the whole thing that failed parity checking * or signal error. So, jumping to dispatcher should be OK. */ - if (phase == 1) { + if (phase == 1 || phase == 5) { /* Phase mismatch handled by SCRIPTS */ if (dsp == SCRIPTB_BA (np, pm_handle)) OUTL_DSP (dsp); @@ -4411,7 +4422,7 @@ static void sym_int_ma (hcb_p np) * raising the MA interrupt for interrupted INPUT phases. * For DATA IN phase, we will check for the SWIDE later. */ - if ((cmd & 7) != 1) { + if ((cmd & 7) != 1 && (cmd & 7) != 5) { u_char ss0, ss2; if (np->features & FE_DFBC) @@ -4528,8 +4539,10 @@ static void sym_int_ma (hcb_p np) /* * check cmd against assumed interrupted script command. + * If dt data phase, the MOVE instruction hasn't bit 4 of + * the phase. */ - if (cmd != (scr_to_cpu(vdsp[0]) >> 24)) { + if (((cmd & 2) ? cmd : (cmd & ~4)) != (scr_to_cpu(vdsp[0]) >> 24)) { PRINT_ADDR(cp); printf ("internal error: cmd=%02x != %02x=(vdsp[0] >> 24)\n", (unsigned)cmd, (unsigned)scr_to_cpu(vdsp[0]) >> 24); @@ -4540,7 +4553,7 @@ static void sym_int_ma (hcb_p np) /* * if old phase not dataphase, leave here. */ - if ((cmd & 5) != (cmd & 7)) { + if (cmd & 2) { PRINT_ADDR(cp); printf ("phase change %x-%x %d@%08x resid=%d.\n", cmd&7, INB(nc_sbcl)&7, (unsigned)olen, @@ -4553,8 +4566,8 @@ static void sym_int_ma (hcb_p np) * * Look at the PM_SAVE SCRIPT if you want to understand * this stuff. The equivalent code is implemented in - * SCRIPTS for the 895A and 896 that are able to handle - * PM from the SCRIPTS processor. + * SCRIPTS for the 895A, 896 and 1010 that are able to + * handle PM from the SCRIPTS processor. */ hflags0 = INB (HF_PRT); hflags = hflags0; @@ -7262,7 +7275,7 @@ static void sym_complete_error (hcb_p np, ccb_p cp) } /* - * Get command, target and lun pointers. + * Get CAM command pointer. */ csio = &cp->cam_ccb->csio; @@ -7823,7 +7836,7 @@ static int sym_setup_cdb(hcb_p np, struct ccb_scsiio *csio, ccb_p cp) /* * Set up data pointers used by SCRIPTS. */ -static void __inline__ +static void __inline sym_setup_data_pointers(hcb_p np, ccb_p cp, int dir) { u32 lastp, goalp; @@ -7937,6 +7950,12 @@ sym_execute_ccb(void *arg, bus_dma_segment_t *psegs, int nsegs, int error) */ sym_enqueue_cam_ccb(np, ccb); + /* + * When `#ifed 1', the code below makes the driver + * panic on the first attempt to write to a SCSI device. + * It is the first test we want to do after a driver + * change that does not seem obviously safe. :) + */ #if 0 switch (cp->cdb_buf[0]) { case 0x0A: case 0x2A: case 0xAA: @@ -8481,6 +8500,49 @@ static void sym_action2(struct cam_sim *sim, union ccb *ccb) } /* + * Asynchronous notification handler. + */ +static void +sym_async(void *cb_arg, u32 code, struct cam_path *path, void *arg) +{ + hcb_p np; + struct cam_sim *sim; + u_int tn; + tcb_p tp; + int s; + + s = splcam(); + + sim = (struct cam_sim *) cb_arg; + np = (hcb_p) cam_sim_softc(sim); + + switch (code) { + case AC_LOST_DEVICE: + tn = xpt_path_target_id(path); + if (tn >= SYM_CONF_MAX_TARGET) + break; + + tp = &np->target[tn]; + + tp->to_reset = 0; + tp->head.sval = 0; + tp->head.wval = np->rv_scntl3; + tp->head.uval = 0; + + tp->tinfo.current.period = tp->tinfo.goal.period = 0; + tp->tinfo.current.offset = tp->tinfo.goal.offset = 0; + tp->tinfo.current.width = tp->tinfo.goal.width = BUS_8_BIT; + tp->tinfo.current.options = tp->tinfo.goal.options = 0; + + break; + default: + break; + } + + splx(s); +} + +/* * Update transfer settings of a target. */ static void sym_update_trans(hcb_p np, tcb_p tp, struct sym_trans *tip, @@ -9198,8 +9260,8 @@ sym_pci_attach2(pcici_t pci_tag, int unit) /* * Prepare the bus address array that contains the bus - * address of each target control bloc. - * For now, assume all logical unit are wrong. :) + * address of each target control block. + * For now, assume all logical units are wrong. :) */ for (i = 0 ; i < SYM_CONF_MAX_TARGET ; i++) { np->targtbl[i] = cpu_to_scr(vtobus(&np->target[i])); @@ -9346,6 +9408,7 @@ int sym_cam_attach(hcb_p np) struct cam_devq *devq = 0; struct cam_sim *sim = 0; struct cam_path *path = 0; + struct ccb_setasync csa; int err, s; s = splcam(); @@ -9412,20 +9475,16 @@ int sym_cam_attach(hcb_p np) #endif #endif -#if 0 /* * Establish our async notification handler. */ - { - struct ccb_setasync csa; xpt_setup_ccb(&csa.ccb_h, np->path, 5); csa.ccb_h.func_code = XPT_SASYNC_CB; csa.event_enable = AC_LOST_DEVICE; csa.callback = sym_async; csa.callback_arg = np->sim; xpt_action((union ccb *)&csa); - } -#endif + /* * Start the chip now, without resetting the BUS, since * it seems that this must stay under control of CAM. |
