Index: README.dc395x =================================================================== RCS file: /home/cvsroot/dc395/README.dc395x,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- README.dc395x 2000/09/29 20:21:40 1.10 +++ README.dc395x 2000/11/24 00:53:41 1.11 @@ -2,7 +2,7 @@ ========================================== Preliminary. 2000-02-14 Kurt Garloff -$Id: README.dc395x,v 1.10 2000/09/29 20:21:40 garloff Exp $ +$Id: README.dc395x,v 1.11 2000/11/24 00:53:41 garloff Exp $ This driver is similar to the DC390/AM53c974 driver (tmscsim), so you might want to have a look into the README.tmscsim. @@ -11,11 +11,6 @@ These features are now almost completely implemented for the dc395x_trm driver, too. -The kernel/module params have now also been added. The meaning is exactly -the same than the ones from the tmscsim driver, except, that the SpdIdx is -now interpreted as 20Mhz, 13.3MHz, 10MHz, 8MHz, 6.7MHz, 5.8Mhz, 5Mhz, 4Mhz -and that the bit5 (0x20) was added to the DevMode meaning Wide negotiation. -The name for the driver is dc395x_trm. Status ------ @@ -148,6 +143,54 @@ If you can provide me with exact observations and logs of failures, I would be very pleased! + + +Parameters +---------- +The driver uses the settings from the EEPROM set in the SCSI BIOS +setup. +If there is no EEPROM, the driver uses default values. +Both can be overriden by command line parameters (module or kernel +parameters). [This is new; formerly the EEprom could not be overriden.] + +The syntax is as follows: + dc395x_trm = AdapterID, SpeedIdx, DevMode, AdaptMode, Tags, DelayReset + +AdapterID : Host Adapter SCSI ID +SpeedIdx : 0,1,...7 = 20,13.3,10,8,6.7,5.8,5,4 MHz [ 7] +DevMode : Bitmap for Dev Cfg [63] +AdaptMode : Bitmap for Adapter Cfg [47] +Tags : The number of tags is 1<= 1. + +If you set AdapterID, the adapter will use conservative ("safe") default +settings instead. + +If you specify -2 for a value, it will be ignored. You don't need to specify +all six parameters. + +Note, that you can also influence the behaviour of the host adapter at +runtime by echoing values to /proc/scsi/dc395x_trm/?. Have a loo at +README.tmscsim for explanation and examples. The syntex is the same, except +for the added "Wide" setting. Installation Index: dc395x_trm.c =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.c,v retrieving revision 1.64 retrieving revision 1.66 diff -u -r1.64 -r1.66 --- dc395x_trm.c 2000/11/22 22:40:57 1.64 +++ dc395x_trm.c 2000/11/24 14:16:53 1.66 @@ -12,7 +12,7 @@ //* Kurt Garloff //* (C) 1999-2000 Kurt Garloff //* License: GNU GPL -//* $Id: dc395x_trm.c,v 1.64 2000/11/22 22:40:57 garloff Exp $ +//* $Id: dc395x_trm.c,v 1.66 2000/11/24 14:16:53 garloff Exp $ //*********************************************************************** //* Tekram PCI SCSI adapter (DC395/U/UW/F or DC315/U) revision history //* @@ -83,6 +83,8 @@ //* 1.29 00/10/12 KG Allow in kernel compilation w/ 2.4 //* 1.30 00/11/22 KG Use DCB field for reported INQ flags //* 2.4: Use get_options(). Add pci_dev_tbl[]. +//* 1.31 00/11/24 KG Fix another NULL ptr. Allow overriding of +//* BIOS settings by cmd ln params. //*********************************************************************** /* ************************************************************************* @@ -482,7 +484,7 @@ /* 0x38: */ /* BYTE Reserved2[3]; for dword alignment */ }; -typedef struct _DCB DC395x_DCB, *PDCB; +typedef struct _DCB DC395X_TRM_DCB, *PDCB; /* ;----------------------------------------------------------------------- ; Adapter Control Block @@ -1399,19 +1401,14 @@ */ //static BYTE dc395x_clock_period[] = {12,19,25,31,37,44,50,62}; /* real period:48ns,76ns,100ns,124ns,148ns,176ns,200ns,248ns */ -static BYTE dc395x_clock_period[] = {12,18,25,31,37,43,50,62}; +static BYTE dc395x_clock_period[] = { 12, 18, 25, 31, 37, 43, 50, 62}; +static WORD dc395x_clock_speed[] = {200,133,100, 80, 67, 58, 50, 40}; /* real period:48ns,72ns,100ns,124ns,148ns,172ns,200ns,248ns */ -/* Startup values, to be overriden on the commandline */ -int dc395x_trm[] = {7, 1 /* 13.3MHz */, - NTC_DO_PARITY_CHK | NTC_DO_DISCONNECT | NTC_DO_SYNC_NEGO - | NTC_DO_WIDE_NEGO | NTC_DO_TAG_QUEUEING | NTC_DO_SEND_START, - NAC_GT2DRIVES | NAC_GREATER_1G | NAC_POWERON_SCSI_RESET - /* | NAC_ACTIVE_NEG */ -# ifdef CONFIG_SCSI_MULTI_LUN - | NAC_SCANLUN -# endif - , 3 /* 16 Tags per LUN */, 1 /* s delay after Reset */ }; +/* Override defaults on cmdline: + * dc395x_trm = AdaptID, MaxSpeed (Index), DevMode (Bitmapped), AdaptMode (Bitmapped), Tags (log2-1), DelayReset + */ +int dc395x_trm[] = {-2, -2, -2, -2, -2, -2}; # if defined(MODULE) && LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,30) MODULE_PARM(dc395x_trm, "1-6i"); @@ -1426,11 +1423,13 @@ /* Delaying after a reset */ static char __initdata DC395x_interpd [] = {1,3,5,10,16,30,60,120}; +/* Convert EEprom value to seconds */ static void __init DC395x_interpret_delay (PNVRAMTYPE pEEpromBuf) { //printk ("DC395x: Debug: Delay: %i\n", pEEpromBuf->NvramDelayTime); pEEpromBuf->NvramDelayTime = DC395x_interpd[pEEpromBuf->NvramDelayTime]; }; +/* seconds to EEProm value */ static int __init DC395x_uninterpret_delay (int delay) { BYTE idx = 0; @@ -1439,57 +1438,61 @@ }; -static void __init DC395x_EEpromDefaults (PNVRAMTYPE pEEpromBuf) +/* Handle "-1" case */ +static void __init DC395x_check_for_safe_settings (void) { - BYTE id; - - /* Adapter Settings */ - pEEpromBuf->NvramScsiId = (BYTE)dc395x_trm[0]; /* Adapter ID */ - pEEpromBuf->NvramChannelCfg = (BYTE)dc395x_trm[3]; - pEEpromBuf->NvramDelayTime = DC395x_uninterpret_delay (dc395x_trm[5]); /* Reset delay */ - pEEpromBuf->NvramMaxTag = (BYTE)dc395x_trm[4]; /* Tagged Cmds */ - - /* Device Settings */ - for (id = 0; id < DC395x_MAX_SCSI_ID; id++) - { - pEEpromBuf->NvramTarget[id].NvmTarCfg0 = (BYTE)dc395x_trm[2]; /* Cfg0 */ - pEEpromBuf->NvramTarget[id].NvmTarPeriod= (BYTE)dc395x_trm[1]; /* Speed */ - }; + if (dc395x_trm[0] == -1 || dc395x_trm[0] > 15) /* modules-2.0.0 passes -1 as string */ + { + dc395x_trm[0] = 7; dc395x_trm[1] = 4; + dc395x_trm[2] = 0x09; dc395x_trm[3] = 0x0f; + dc395x_trm[4] = 2; dc395x_trm[5] = 10; + printk (KERN_INFO "DC395x: Using safe settings.\n"); + } } -static void __init DC395x_checkparams (void) +/* Defaults, to be overriden by (a) BIOS and (b) Cmnd line (kernel/module) args */ +int __initdata dc395x_def[] = {7, 1 /* 13.3MHz */, + NTC_DO_PARITY_CHK | NTC_DO_DISCONNECT | NTC_DO_SYNC_NEGO + | NTC_DO_WIDE_NEGO | NTC_DO_TAG_QUEUEING | NTC_DO_SEND_START, + NAC_GT2DRIVES | NAC_GREATER_1G | NAC_POWERON_SCSI_RESET + /* | NAC_ACTIVE_NEG */ +#ifdef CONFIG_SCSI_MULTI_LUN + | NAC_SCANLUN +#endif + , 3 /* 16 Tags per LUN */, 1 /* s delay after Reset */ +}; +/* Copy defaults over set values where missing */ +static void __init DC395x_fill_with_defaults (void) { + int i; PARSEDEBUG(printk(KERN_INFO "DC395x: setup %08x %08x %08x %08x %08x %08x\n", dc395x_trm[0],\ dc395x_trm[1], dc395x_trm[2], dc395x_trm[3], dc395x_trm[4], dc395x_trm[5]);) - if (dc395x_trm[0] < 0 || dc395x_trm[0] > 15) /* modules-2.0.0 passes -1 as string */ + for (i = 0; i < 6; i++) { - dc395x_trm[0] = 7; dc395x_trm[1] = 4; - dc395x_trm[2] = 9; dc395x_trm[3] = 15; - dc395x_trm[4] = 2; dc395x_trm[5] = 10; - printk (KERN_INFO "DC395x: Using safe settings.\n"); + if (dc395x_trm[i] < 0 || dc395x_trm[i] > 255) + dc395x_trm[i] = dc395x_def[i]; } - else - { - /* if (dc395x_trm[0] < 0 || dc395x_trm[0] > 7) dc395x_trm[0] = 7; */ - if (dc395x_trm[1] < 0 || dc395x_trm[1] > 7) dc395x_trm[1] = 4; - if (dc395x_trm[4] < 0 || dc395x_trm[4] > 5) dc395x_trm[4] = 4; - if (dc395x_trm[5] > 180) dc395x_trm[5] = 180; - }; + /* Sanity checks */ + if (dc395x_trm[0] < 0 || dc395x_trm[0] > 15) dc395x_trm[0] = 7; + if (dc395x_trm[1] < 0 || dc395x_trm[1] > 7) dc395x_trm[1] = 4; + if (dc395x_trm[4] < 0 || dc395x_trm[4] > 5) dc395x_trm[4] = 4; + if (dc395x_trm[5] > 180) dc395x_trm[5] = 180; }; -/* Override defaults on cmdline: - * tmscsim: AdaptID, MaxSpeed (Index), DevMode (Bitmapped), AdaptMode (Bitmapped) - */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) + + +/* Read the parameters from the command line */ +#if !defined(MODULE) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) void __init DC395x_trm_setup (char *str) { int i, im; int ints[8]; (void)get_options (str, ARRAY_SIZE(ints), ints); -#else +# else void __init DC395x_trm_setup (char *str, int *ints) { int i, im; -#endif +# endif im = ints[0]; if (im > 6) { @@ -1501,10 +1504,38 @@ /* DC395x_checkparams (); */ }; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) && !defined(MODULE) +# if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,13) __setup("dc395x_trm=", DC395x_trm_setup); -#endif +# endif + +#endif /* !MODULE */ +/* Overrride BIOS values with the set ones */ +static void __init DC395x_EEprom_Override (PNVRAMTYPE pEEpromBuf) +{ + BYTE id; + + /* Adapter Settings */ + if (dc395x_trm[0] != -2) + pEEpromBuf->NvramScsiId = (BYTE)dc395x_trm[0]; /* Adapter ID */ + if (dc395x_trm[3] != -2) + pEEpromBuf->NvramChannelCfg = (BYTE)dc395x_trm[3]; + if (dc395x_trm[5] != -2) + pEEpromBuf->NvramDelayTime = DC395x_uninterpret_delay (dc395x_trm[5]); /* Reset delay */ + if (dc395x_trm[4] != -2) + pEEpromBuf->NvramMaxTag = (BYTE)dc395x_trm[4]; /* Tagged Cmds */ + + /* Device Settings */ + for (id = 0; id < DC395x_MAX_SCSI_ID; id++) + { + if (dc395x_trm[2] != -2) + pEEpromBuf->NvramTarget[id].NvmTarCfg0 = (BYTE)dc395x_trm[2]; /* Cfg0 */ + if (dc395x_trm[1] != -2) + pEEpromBuf->NvramTarget[id].NvmTarPeriod= (BYTE)dc395x_trm[1]; /* Speed */ + }; +} + + /* Queueing philosphy: * There are a couple of lists: * - Query: Contains the Scsi Commands not yet turned into SRBs (per ACB) @@ -1793,7 +1824,9 @@ void DC395x_waiting_timed_out (unsigned long ptr) { unsigned int flags; - DEBUG0(printk ("DC395x: Debug: Waiting queue woken up by timer.\n");) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Debug: Waiting queue woken up by timer.\n"); +#endif DC395x_LOCK_IO; DC395x_Waiting_process ((PACB)ptr); DC395x_UNLOCK_IO; @@ -2144,7 +2177,8 @@ pDCB->SyncMode &= EN_TAG_QUEUEING | SYNC_NEGO_DONE | WIDE_NEGO_DONE/*| EN_ATN_STOP*/; if (pDCB->DevMode & NTC_DO_TAG_QUEUEING) { - if (pDCB->SyncMode & EN_TAG_QUEUEING) pDCB->MaxCommand = pACB->TagMaxNum; + if (pDCB->SyncMode & EN_TAG_QUEUEING) + pDCB->MaxCommand = pACB->TagMaxNum; } else { pDCB->SyncMode &= ~EN_TAG_QUEUEING; pDCB->MaxCommand = 1; @@ -2771,8 +2805,10 @@ #if 1 if (s_stat & 0x20/* s_stat2 & 0x02000 */) { - DEBUG0(printk ("DC395x: Debug: StartSCSI: pid %li(%02i-%i): BUSY %02x %04x\n", - pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN, s_stat, s_stat2);) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Debug: StartSCSI: pid %li(%02i-%i): BUSY %02x %04x\n", + pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN, s_stat, s_stat2); +#endif /* Try anyway? */ /* We could, BUT: Sometimes the TRM_S1040 misses to produce a Selection * Timeout, a Disconnect or a Reselction IRQ, so we would be screwed! @@ -2798,8 +2834,10 @@ } if( DC395x_read16(TRM_S1040_SCSI_STATUS ) & SCSIINTERRUPT ) { - DEBUG0(printk ("DC395x: Debug: StartSCSI failed (busy) for pid %li(%02i-%i)\n", - pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN);) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Debug: StartSCSI failed (busy) for pid %li(%02i-%i)\n", + pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN); +#endif TRACEPRINTF ("°*"); return 1; } @@ -2807,7 +2845,9 @@ * to queue them again after a reset */ if (time_before (jiffies, pACB->pScsiHost->last_reset - HZ/2)) { - DEBUG0(printk ("DC395x: We were just reset and don't accept commands yet!\n");) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: We were just reset and don't accept commands yet!\n"); +#endif return 1; } @@ -2899,7 +2939,9 @@ ** Send CDB ..command block ......... */ #ifdef DC395x_DEBUG_KG - printk (KERN_INFO "DC395x: Start_SCSI (pid %li): Tag %i\n", pSRB->pcmd->pid, pSRB->TagNumber); + printk (KERN_INFO "DC395x: StartSCSI (pid %li) %02x (%i-%i): Tag %i\n", + pSRB->pcmd->pid, pSRB->pcmd->cmnd[0], pSRB->pcmd->target, + pSRB->pcmd->lun, pSRB->TagNumber); #endif if( pSRB->SRBFlag & AUTO_REQSENSE ) { @@ -4663,8 +4705,10 @@ { /* Normal selection timeout */ TRACEPRINTF("SlTO *"); - DEBUG0(printk ("DC395x: Disc: SelTO (pid=%li) for dev %02i-%i\n", pSRB->pcmd->pid, - pDCB->TargetID, pDCB->TargetLUN);) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Disc: SelTO (pid=%li) for dev %02i-%i\n", pSRB->pcmd->pid, + pDCB->TargetID, pDCB->TargetLUN); +#endif if (pSRB->RetryCnt++ > DC395x_MAX_RETRIES || pACB->scan_devices) { pSRB->TargetStatus = SCSI_STAT_SEL_TIMEOUT; @@ -4672,6 +4716,9 @@ } DC395x_freetag (pDCB, pSRB); DC395x_Going_to_Waiting (pDCB, pSRB); +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Retry pid %li ...\n", pSRB->pcmd->pid); +#endif DC395x_waiting_timer (pACB, HZ/20); } } @@ -4749,9 +4796,11 @@ /* Why the if ? */ if( !( pACB->scan_devices ) ) { - DEBUG0(printk ("DC395x: Arb lost but Resel win pid %li (%02i-%i) Rsel %04x Stat %04x\n", - pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN, - RselTarLunId, DC395x_read16 (TRM_S1040_SCSI_STATUS));) +#ifdef DC395x_DEBUG_KG + printk ("DC395x: Arb lost but Resel win pid %li (%02i-%i) Rsel %04x Stat %04x\n", + pSRB->pcmd->pid, pDCB->TargetID, pDCB->TargetLUN, + RselTarLunId, DC395x_read16 (TRM_S1040_SCSI_STATUS)); +#endif TRACEPRINTF ("ArbLResel!*"); //TRACEOUT (" %s\n", pSRB->debugtrace); arblostflag = 1; @@ -4916,7 +4965,8 @@ || (pDCB->DevType == TYPE_MOD)) &&*/ !DC395x_tagq_blacklist (((char*)ptr)+8) ) { - if (pDCB->MaxCommand ==1) pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum; + if (pDCB->MaxCommand ==1) + pDCB->MaxCommand = pDCB->pDCBACB->TagMaxNum; pDCB->SyncMode |= EN_TAG_QUEUEING; //pDCB->TagMask = 0; } @@ -4976,22 +5026,32 @@ #ifdef DC395x_DEBUG_KG switch (pcmd->sense_buffer[2] & 0x0f) { - case NOT_READY: printk (KERN_INFO "\nDC395x: ReqSense: NOT_READY (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n", + case NOT_READY: printk ("\nDC395x: ReqSense: NOT_READY (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i) ", pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN, status, pACB->scan_devices); break; - case UNIT_ATTENTION: printk (KERN_INFO "\nDC395x: ReqSense: UNIT_ATTENTION (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n", + case UNIT_ATTENTION: printk ("\nDC395x: ReqSense: UNIT_ATTENTION (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i) ", pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN, status, pACB->scan_devices); break; - case ILLEGAL_REQUEST: printk (KERN_INFO "\nDC395x: ReqSense: ILLEGAL_REQUEST (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n", + case ILLEGAL_REQUEST: printk ("\nDC395x: ReqSense: ILLEGAL_REQUEST (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i) ", pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN, status, pACB->scan_devices); break; - case MEDIUM_ERROR: printk (KERN_INFO "\nDC395x: ReqSense: MEDIUM_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n", + case MEDIUM_ERROR: printk ("\nDC395x: ReqSense: MEDIUM_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i) ", pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN, status, pACB->scan_devices); break; - case HARDWARE_ERROR: printk (KERN_INFO "\nDC395x: ReqSense: HARDWARE_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i)\n", + case HARDWARE_ERROR: printk ("\nDC395x: ReqSense: HARDWARE_ERROR (Cmnd = 0x%02x, Dev = %i-%i, Stat = %i, Scan = %i) ", pcmd->cmnd[0], pDCB->TargetID, pDCB->TargetLUN, status, pACB->scan_devices); break; } + if (pcmd->sense_buffer[7] >= 6) + printk ("\nDC395x: Sense=%02x, ASC=%02x, ASCQ=%02x (%08x %08x) ", + pcmd->sense_buffer[2], pcmd->sense_buffer[12], + pcmd->sense_buffer[13], + *((unsigned int*)(pcmd->sense_buffer+3)), + *((unsigned int*)(pcmd->sense_buffer+8))); + else + printk ("\nDC395x: Sense=%02x, No ASC/ASCQ (%08x) ", + pcmd->sense_buffer[2], + *((unsigned int*)(pcmd->sense_buffer+3))); #endif if (status == (CHECK_CONDITION << 1)) { @@ -5006,10 +5066,10 @@ pSRB->SegmentX[0].length = pSRB->SgSenseTemp.length; if( (pSRB->SRBTotalXferLength) && (pSRB->SRBTotalXferLength >= pcmd->underflow) ) - pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION); + pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,pSRB->EndMessage,CHECK_CONDITION); //SET_RES_DID(pcmd->result,DID_OK) else - pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,0,CHECK_CONDITION); + pcmd->result = MK_RES_LNX(DRIVER_SENSE,DID_OK,pSRB->EndMessage,CHECK_CONDITION); goto ckc_e; } @@ -5022,13 +5082,16 @@ */ if( status_byte(status) == CHECK_CONDITION ) { +#ifdef DC395x_DEBUG_KG + printk ("RqSense!\n"); +#endif DC395x_RequestSense( pACB, pDCB, pSRB ); return; } else if( status_byte(status) == QUEUE_FULL ) { tempcnt = (BYTE) pDCB->GoingSRBCnt; - printk ("DC395x: QUEUE_FULL for dev %02i-%i with %i cmnds\n", + printk ("\nDC395x: QUEUE_FULL for dev %02i-%i with %i cmnds\n", pDCB->TargetID, pDCB->TargetLUN, tempcnt); if (tempcnt > 1) tempcnt--; pDCB->MaxCommand = tempcnt; @@ -5051,7 +5114,7 @@ { pSRB->AdaptStatus = 0; pSRB->TargetStatus = status; - pcmd->result = MK_RES(0,0,pSRB->EndMessage,/*status*/0); + pcmd->result = MK_RES(0,0,pSRB->EndMessage,status); } else { @@ -5092,16 +5155,8 @@ pcmd->request_bufflen >= 8 && ptr && (ptr->Vers & 0x07) >= 2) - { - if (ptr->Flags & SCSI_INQ_SYNC) - pcmd->device->sync = 1; - if (ptr->Flags & SCSI_INQ_WBUS16) - pcmd->device->wide = 1; - /* Handled by mid-layer - if (((unsigned char*)(pcmd->buffer))[7] & 0x02) - pcmd->device->tagged_supported = 1; - */ - } + pDCB->Inquiry7 = ptr->Flags; +/* Check Error Conditions */ ckc_e: if( pACB->scan_devices ) { @@ -5109,7 +5164,7 @@ pcmd->cmnd[0] == INQUIRY) { #ifdef DC395x_DEBUG0 - printk (KERN_INFO "\nDC395x: %s: result: %08x", + printk ("\nDC395x: %s: result: %08x", (pcmd->cmnd[0] == INQUIRY? "INQUIRY": "TEST_UNIT_READY"), pcmd->result); if (pcmd->result & (DRIVER_SENSE << 24)) printk (" (sense: %02x %02x %02x %02x)\n", @@ -5151,16 +5206,16 @@ { DEBUG0(int i;) #ifdef DC395x_DEBUG0 - printk ("DC395x: Inquiry result:"); + printk ("\nDC395x: Inquiry result:"); for (i = 0; i < 8; i++) printk (" %02x", ((PBYTE)ptr)[i]); ((PBYTE)ptr)[96] = 0; - printk ("\nDC395x: %s\n", (char*)ptr + 8); + printk ("\nDC395x: %s\n", (char*)ptr + 8); #endif if ( (ptr->Vers & 0x07) >= 2 || (ptr->RDF & 0x0F) == 2 ) pDCB->Inquiry7 = ptr->Flags; if ((ptr->DevType & SCSI_DEVTYPE) == TYPE_NODEV) { - printk ("DC395x: Device %02i-%i: TYPE_NODEV?\n", + printk ("\nDC395x: Device %02i-%i: TYPE_NODEV?\n", pDCB->TargetID, pDCB->TargetLUN); /* device not present: remove */ /*if (!DCB_removed) @@ -5188,25 +5243,25 @@ pcmd->SCp.buffers_residual = 0; #if 0 if (pSRB->SRBTotalXferLength && !DCB_removed) - printk ("DC395x: pid %li: %02x (%02i-%i): Missed %i bytes\n", + printk ("\nDC395x: pid %li: %02x (%02i-%i): Missed %i bytes\n", pcmd->pid, pcmd->cmnd[0], pcmd->target, pcmd->lun, pSRB->SRBTotalXferLength); #endif if (!DCB_removed) DC395x_Going_remove (pDCB, pSRB, 0); /* Add to free list */ if (pSRB == pACB->pTmpSRB) - printk ("DC395x: ERROR! Completed Cmnd with TmpSRB!\n"); + printk ("\nDC395x: ERROR! Completed Cmnd with TmpSRB!\n"); else DC395x_Free_insert (pACB, pSRB); - DEBUG0(printk (KERN_DEBUG "DC395x: SRBdone: done pid %li\n", pcmd->pid);) + DEBUG0(printk (KERN_DEBUG "\nDC395x: SRBdone: done pid %li\n", pcmd->pid);) #ifdef DC395x_DEBUG_KG - printk ("0x%08x", pcmd->result); + printk (" 0x%08x\n", pcmd->result); #endif TRACEPRINTF("%08x(%li)*", pcmd->result, jiffies); //DC395x_UNLOCK_ACB_NI; pcmd->scsi_done (pcmd); //DC395x_LOCK_ACB_NI; - TRACEOUTALL (KERN_INFO "%s\n", pSRB->debugtrace); + TRACEOUTALL (KERN_INFO " %s\n", pSRB->debugtrace); DC395x_Query_to_Waiting (pACB); DC395x_Waiting_process (pACB); @@ -5517,7 +5572,7 @@ #ifdef DC395x_DEBUG0 printk(KERN_INFO "DC395x_initDCB..............\n "); #endif - pDCB = kmalloc (sizeof(DC395x_DCB), GFP_ATOMIC); + pDCB = kmalloc (sizeof(DC395X_TRM_DCB), GFP_ATOMIC); //pDCB = DC395x_findDCB (pACB, target, lun); *ppDCB = pDCB; pDCB2 = 0; if (!pDCB) return; @@ -5677,7 +5732,8 @@ //pACB->pScsiHost->this_lun = 0; pACB->DCBCnt = 0; pACB->DeviceCnt = 0; pACB->IRQLevel = Irq; - pACB->TagMaxNum = pEEpromBuf->NvramMaxTag << 2; + pACB->TagMaxNum = 1 << pEEpromBuf->NvramMaxTag; + if (pACB->TagMaxNum > 30) pACB->TagMaxNum = 30; pACB->ACBFlag = 0; /* RESET_DETECT, RESET_DONE, RESET_DEV */ pACB->scan_devices = 1; pACB->MsgLen = 0; @@ -5787,13 +5843,15 @@ if (pEEpromBuf->NvramChannelCfg & NAC_POWERON_SCSI_RESET) pACB->Config |= HCC_SCSI_RESET; if (pACB->Config & HCC_SCSI_RESET) + { DC395x_write8 (TRM_S1040_SCSI_CONTROL, DO_RSTSCSI); - //spin_unlock_irq (&io_request_lock); - udelay (500); - pACB->pScsiHost->last_reset = jiffies + HZ/2 + - HZ * dc395x_trm_eepromBuf[pACB->AdapterIndex].NvramDelayTime; - //spin_lock_irq (&io_request_lock); - + //while (!( DC395x_read8(TRM_S1040_SCSI_INTSTATUS) & INT_SCSIRESET )); + //spin_unlock_irq (&io_request_lock); + udelay (500); + pACB->pScsiHost->last_reset = jiffies + HZ/2 + + HZ * dc395x_trm_eepromBuf[pACB->AdapterIndex].NvramDelayTime; + //spin_lock_irq (&io_request_lock); + } DC395x_basic_config (pACB); return(0); } @@ -6085,8 +6143,9 @@ *dpEeprom = 0x00; /* Now load defaults (maybe set by boot/module params) */ - DC395x_checkparams (); - DC395x_EEpromDefaults (pEEpromBuf); + DC395x_check_for_safe_settings (); + DC395x_fill_with_defaults (); + DC395x_EEprom_Override (pEEpromBuf); pEEpromBuf->NvramCheckSum = 0x00; for (wAddr = 0, wCheckSum = 0, wpEeprom = (WORD *) pEEpromBuf; wAddr < 63; wAddr++, wpEeprom++) @@ -6097,7 +6156,11 @@ pEEpromBuf->NvramDelayTime = dc395x_trm[5]; } else + { + DC395x_check_for_safe_settings (); DC395x_interpret_delay (pEEpromBuf); + DC395x_EEprom_Override (pEEpromBuf); + } return; } @@ -6165,8 +6228,17 @@ printk(KERN_INFO "DC395x_init : pSH scsi_register ERROR\n"); return( 0 ); } - printk (KERN_INFO "DC395x: Used settings: AdaptID=%i\n", - dc395x_trm_eepromBuf[index].NvramScsiId); + printk (KERN_INFO "DC395x: Used settings: AdapterID=%02i, Speed=%i(%02i.%01iMHz), DevMode=0x%02x\n", + dc395x_trm_eepromBuf[index].NvramScsiId, + dc395x_trm_eepromBuf[index].NvramTarget[0].NvmTarPeriod, + dc395x_clock_speed[dc395x_trm_eepromBuf[index].NvramTarget[0].NvmTarPeriod]/10, + dc395x_clock_speed[dc395x_trm_eepromBuf[index].NvramTarget[0].NvmTarPeriod]%10, + dc395x_trm_eepromBuf[index].NvramTarget[0].NvmTarCfg0); + printk (KERN_INFO "DC395x: AdaptMode=0x%02x, Tags=%i(%02i), DelayReset=%is\n", + dc395x_trm_eepromBuf[index].NvramChannelCfg, + dc395x_trm_eepromBuf[index].NvramMaxTag, + 1 << dc395x_trm_eepromBuf[index].NvramMaxTag, + dc395x_trm_eepromBuf[index].NvramDelayTime); pACB = (PACB) psh->hostdata; //DC395x_ACB_INITLOCK(pACB); Index: dc395x_trm.h =================================================================== RCS file: /home/cvsroot/dc395/dc395x_trm.h,v retrieving revision 1.29 retrieving revision 1.30 diff -u -r1.29 -r1.30 --- dc395x_trm.h 2000/11/22 22:40:58 1.29 +++ dc395x_trm.h 2000/11/24 00:53:41 1.30 @@ -8,7 +8,7 @@ ** ********************************************************************** */ -/* $Id: dc395x_trm.h,v 1.29 2000/11/22 22:40:58 garloff Exp $ */ +/* $Id: dc395x_trm.h,v 1.30 2000/11/24 00:53:41 garloff Exp $ */ /* ***************************************************** ** Tekram TRM_S1040 for DC395x driver, header file @@ -20,7 +20,7 @@ #include #define DC395x_BANNER "Tekram DC395U/UW/F DC315/U" -#define DC395x_VERSION "1.30, 2000-11-22" +#define DC395x_VERSION "1.31, 2000-11-24" /* Kernel version autodetection */ #include