Move epprom settings checks to the right place, so that sync/wide nego is

started based on the eeprom values and adapter capabilities.
Avoid the driver to negotiate wide transfers with a wide drive connected
to a non-wide capable controller.
Problem reported and fix tested by Dan LaBell on netbsd-help.
This commit is contained in:
bouyer 2005-04-16 13:46:20 +00:00
parent 1d12c53188
commit 186671a540
1 changed files with 7 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: trm.c,v 1.18 2005/02/27 00:27:34 perry Exp $ */
/* $NetBSD: trm.c,v 1.19 2005/04/16 13:46:20 bouyer Exp $ */
/*
* Device Driver for Tekram DC395U/UW/F, DC315/U
* PCI SCSI Bus Master Host Adapter
@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.18 2005/02/27 00:27:34 perry Exp $");
__KERNEL_RCSID(0, "$NetBSD: trm.c,v 1.19 2005/04/16 13:46:20 bouyer Exp $");
/* #define TRM_DEBUG */
#ifdef TRM_DEBUG
@ -586,11 +586,6 @@ trm_init(struct trm_softc *sc)
ti->config0 = tconf->config0;
ti->period = trm_clock_period[tconf->period & 0x07];
ti->flag = 0;
if ((ti->config0 & NTC_DO_WIDE_NEGO) != 0 &&
(sc->sc_config & HCC_WIDE_CARD) != 0)
ti->flag |= WIDE_NEGO_ENABLE;
if ((ti->config0 & NTC_DO_SYNC_NEGO) != 0)
ti->flag |= SYNC_NEGO_ENABLE;
if ((ti->config0 & NTC_DO_DISCONNECT) != 0) {
#ifdef notyet
if ((ti->config0 & NTC_DO_TAG_QUEUING) != 0)
@ -799,12 +794,15 @@ trm_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
#endif
ti->flag &= ~USE_TAG_QUEUING;
if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0) {
if ((xm->xm_mode & PERIPH_CAP_WIDE16) != 0 &&
(sc->sc_config & HCC_WIDE_CARD) != 0 &&
(ti->config0 & NTC_DO_WIDE_NEGO) != 0) {
ti->flag |= WIDE_NEGO_ENABLE;
ti->flag &= ~WIDE_NEGO_DONE;
}
if ((xm->xm_mode & PERIPH_CAP_SYNC) != 0) {
if ((xm->xm_mode & PERIPH_CAP_SYNC) != 0 &&
(ti->config0 & NTC_DO_SYNC_NEGO) != 0) {
ti->flag |= SYNC_NEGO_ENABLE;
ti->flag &= ~SYNC_NEGO_DONE;
ti->period = trm_clock_period[0];