Apply the following change from 06/28/2003 04:45:25 by gibbs to the

FreeBSD ahd driver:

aic79xx.h:
	Add softc flag to indicate that we have seen at
	least one selection since the last bus reset or
	SE/LVD bus change.

aic79xx.c:
	Fix a few style nits.

	In ahd_update_pending_scbs(), only touch card registers
	once we have found an SCB that needs to be updated.
	This removes lots of clutter from PCI traces taken of
	error recovery performed by the driver.

	Short circuit the first selection iocell workaround handler
	if we've run once since the last bus reset or iocell change.
	This also removes clutter from PCI traces.

	Note if completions are pending in the qoutfifo when we dump
	card state.
This commit is contained in:
thorpej 2003-08-29 04:50:00 +00:00
parent 56ebfcc6d5
commit 478ae1fc6e
2 changed files with 19 additions and 14 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic79xx.c,v 1.19 2003/08/29 04:38:07 thorpej Exp $ */
/* $NetBSD: aic79xx.c,v 1.20 2003/08/29 04:50:00 thorpej Exp $ */
/*
* Core routines and tables shareable across OS platforms.
@ -39,9 +39,9 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* Id: //depot/aic7xxx/aic7xxx/aic79xx.c#200 $
* Id: //depot/aic7xxx/aic7xxx/aic79xx.c#201 $
*
* $FreeBSD: src/sys/dev/aic7xxx/aic79xx.c,v 1.22 2003/06/28 04:42:11 gibbs Exp $
* $FreeBSD: src/sys/dev/aic7xxx/aic79xx.c,v 1.23 2003/06/28 04:45:25 gibbs Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.19 2003/08/29 04:38:07 thorpej Exp $");
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.20 2003/08/29 04:50:00 thorpej Exp $");
#include <dev/ic/aic79xx_osm.h>
#include <dev/ic/aic79xx_inline.h>
@ -2356,7 +2356,7 @@ ahd_dump_sglist(struct scb *scb)
len = ahd_le32toh(sg_list[i].len);
printf("sg[%d] - Addr 0x%x%x : Length %d%s\n",
i,
(len >> 24) & SG_HIGH_ADDR_BITS,
(len & AHD_SG_HIGH_ADDR_MASK) >> 24,
ahd_le32toh(sg_list[i].addr),
len & AHD_SG_LEN_MASK,
len & AHD_DMA_LAST_SEG ? " Last" : "");
@ -2950,7 +2950,7 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
{
struct scb *pending_scb;
int pending_scb_count;
int i;
u_int scb_tag;
int paused;
u_int saved_scbptr;
ahd_mode_state saved_modes;
@ -3008,17 +3008,14 @@ ahd_update_pending_scbs(struct ahd_softc *ahd)
ahd_outb(ahd, SCSISEQ0, ahd_inb(ahd, SCSISEQ0) & ~ENSELO);
saved_scbptr = ahd_get_scbptr(ahd);
/* Ensure that the hscbs down on the card match the new information */
for (i = 0; i < ahd->scb_data.maxhscbs; i++) {
for (scb_tag = 0; scb_tag < ahd->scb_data.maxhscbs; scb_tag++) {
struct hardware_scb *pending_hscb;
u_int control;
u_int scb_tag;
ahd_set_scbptr(ahd, i);
scb_tag = i;
pending_scb = ahd_lookup_scb(ahd, scb_tag);
if (pending_scb == NULL)
continue;
ahd_set_scbptr(ahd, scb_tag);
pending_hscb = pending_scb->hscb;
control = ahd_inb_scbram(ahd, SCB_CONTROL);
control &= ~MK_MESSAGE;
@ -5245,6 +5242,7 @@ ahd_setup_iocell_workaround(struct ahd_softc *ahd)
printf("%s: Setting up iocell workaround\n", ahd_name(ahd));
#endif
ahd_restore_modes(ahd, saved_modes);
ahd->flags &= ~AHD_HAD_FIRST_SEL;
}
static void
@ -5253,6 +5251,8 @@ ahd_iocell_first_selection(struct ahd_softc *ahd)
ahd_mode_state saved_modes;
u_int sblkctl;
if ((ahd->flags & AHD_HAD_FIRST_SEL) != 0)
return;
saved_modes = ahd_save_modes(ahd);
ahd_set_modes(ahd, AHD_MODE_SCSI, AHD_MODE_SCSI);
sblkctl = ahd_inb(ahd, SBLKCTL);
@ -5272,6 +5272,7 @@ ahd_iocell_first_selection(struct ahd_softc *ahd)
ahd_outb(ahd, SIMODE0, ahd_inb(ahd, SIMODE0) & ~(ENSELDO|ENSELDI));
ahd_outb(ahd, CLRINT, CLRSCSIINT);
ahd_restore_modes(ahd, saved_modes);
ahd->flags |= AHD_HAD_FIRST_SEL;
}
/*************************** SCB Management ***********************************/
@ -8341,6 +8342,9 @@ ahd_dump_card_state(struct ahd_softc *ahd)
ahd->saved_dst_mode));
if (paused)
printf("Card was paused\n");
if (ahd_check_cmdcmpltqueues(ahd))
printf("Completions are pending\n");
/*
* Mode independent registers.
*/

View File

@ -37,9 +37,9 @@
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGES.
*
* Id: //depot/aic7xxx/aic7xxx/aic79xx.h#93 $
* Id: //depot/aic7xxx/aic7xxx/aic79xx.h#94 $
*
* $FreeBSD: src/sys/dev/aic7xxx/aic79xx.h,v 1.14 2003/06/28 04:39:49 gibbs Exp $
* $FreeBSD: src/sys/dev/aic7xxx/aic79xx.h,v 1.15 2003/06/28 04:45:25 gibbs Exp $
*/
/*
* Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003
@ -376,7 +376,8 @@ typedef enum {
AHD_HP_BOARD = 0x100000,
AHD_RESET_POLL_ACTIVE = 0x200000,
AHD_UPDATE_PEND_CMDS = 0x400000,
AHD_RUNNING_QOUTFIFO = 0x800000
AHD_RUNNING_QOUTFIFO = 0x800000,
AHD_HAD_FIRST_SEL = 0x1000000
} ahd_flag;
/************************* Hardware SCB Definition ***************************/