From b1a93d335f9d5d60b8b5287ed269c61d633c79cd Mon Sep 17 00:00:00 2001 From: rumble Date: Mon, 21 May 2007 19:25:54 +0000 Subject: [PATCH] Fix comments about the cf_flags layout and use macros to test whether tags, sync, and disconnect/reconnect are to be disabled or not. --- sys/dev/ic/wd33c93.c | 14 +++++++------- sys/dev/ic/wd33c93var.h | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/sys/dev/ic/wd33c93.c b/sys/dev/ic/wd33c93.c index bbdc2612d8a9..974e1680bb03 100644 --- a/sys/dev/ic/wd33c93.c +++ b/sys/dev/ic/wd33c93.c @@ -1,4 +1,4 @@ -/* $NetBSD: wd33c93.c,v 1.15 2007/05/21 18:56:32 rumble Exp $ */ +/* $NetBSD: wd33c93.c,v 1.16 2007/05/21 19:25:54 rumble Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wd33c93.c,v 1.15 2007/05/21 18:56:32 rumble Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wd33c93.c,v 1.16 2007/05/21 19:25:54 rumble Exp $"); #include "opt_ddb.h" @@ -273,16 +273,16 @@ wd33c93_init(struct wd33c93_softc *dev) for (i = 0; i < 8; i++) { struct wd33c93_tinfo *ti = &dev->sc_tinfo[i]; /* - * sc_flags = 0xTTRRSS + * cf_flags = 0xTTSSRR * * TT = Bitmask to disable Tagged Queues + * SS = Bitmask to disable Sync negotiation * RR = Bitmask to disable disconnect/reselect - * SS = Bitmask to diable Sync negotiation */ ti->flags = T_NEED_RESET; - if (dev->sc_cfflags & (1<<(i+8))) + if (CFFLAGS_NOSYNC(dev->sc_cfflags, i)) ti->flags |= T_NOSYNC; - if (dev->sc_cfflags & (1<sc_cfflags, i) || wd33c93_nodisc) ti->flags |= T_NODISC; ti->period = dev->sc_minsyncperiod; ti->offset = 0; @@ -630,7 +630,7 @@ wd33c93_scsi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req, void ti = &dev->sc_tinfo[xm->xm_target]; ti->flags &= ~T_WANTSYNC; - if ((dev->sc_cfflags & (1<<(xm->xm_target+16))) == 0 && + if ((CFFLAGS_NOTAGS(dev->sc_cfflags, xm->xm_target) == 0) && (xm->xm_mode & PERIPH_CAP_TQING) && !wd33c93_notags) ti->flags |= T_TAG; else diff --git a/sys/dev/ic/wd33c93var.h b/sys/dev/ic/wd33c93var.h index 61cf7b87c24d..bc94c7cf3c3d 100644 --- a/sys/dev/ic/wd33c93var.h +++ b/sys/dev/ic/wd33c93var.h @@ -1,4 +1,4 @@ -/* $NetBSD: wd33c93var.h,v 1.6 2007/05/08 00:20:15 rumble Exp $ */ +/* $NetBSD: wd33c93var.h,v 1.7 2007/05/21 19:25:55 rumble Exp $ */ /* * Copyright (c) 1990 The Regents of the University of California. @@ -223,6 +223,11 @@ struct wd33c93_softc { #define SBIC_CHIP_LIST {"UNKNOWN", "WD33C93", "WD33C93A", "WD33C93B"} +/* macros for sc_cfflags */ +#define CFFLAGS_NODISC(_cf, _t) ((_cf) & (1 << ( 0 + (_t)))) +#define CFFLAGS_NOSYNC(_cf, _t) ((_cf) & (1 << ( 8 + (_t)))) +#define CFFLAGS_NOTAGS(_cf, _t) ((_cf) & (1 << (16 + (_t)))) + /* * States returned by our state machine */