Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Mar 1995 00:29:00 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        PVinci@ix.netcom.com, hackers@FreeBSD.org
Subject:   Re: wdcommand() revisited ..
Message-ID:  <199503241429.AAA21278@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>wdcommand ends as follows:
>	outb(wdc + wd_command, command);
>	return (0);
>}

>ATA states that we first have to check the status register to ensure 
>command is ok.

>	outb(wdc + wd_command, command);

>	if ((inb(wdc +wd_status) & WDCS_ERR) != 0)
>	return (-1)	/* or whatever error correction */

>	return (0);
>}

Callers of wdcommand() are required to check the status.

Many callers (too many) check it immediately by calling wdwait().  The
WDCS_ERR bit in the status register isn't valid until the WDCS_BUSY bit
is clear, and it is necessary to wait for up to 31 seconds for it to
become clear.

Others wait for an interrupt before checking.  They call wdwait() too.
This is a bit wasteful because the WDCS_BUSY bit is probably already
clear and the 450nsec delay before reading the status register is
probably guaranteed by the slowness of getting to the interrupt handler.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199503241429.AAA21278>