*BSD News Article 8994


Return to BSD News archive

Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!uwm.edu!cs.utexas.edu!sun-barr!ames!saimiri.primate.wisc.edu!usenet.coe.montana.edu!news.u.washington.edu!ogicse!mimbres.cs.unm.edu!unmvax!uservx.plk.af.mil!hrd769.brooks.af.mil!hrd769.brooks.af.mil!not-for-mail
From: news@hrd769.brooks.af.mil (InterNet News)
Newsgroups: comp.unix.bsd
Subject: Re: 386BSD wd.c timeout problem during autoconfig
Message-ID: <1gnpa7INN2u1@hrd769.brooks.af.mil>
Date: 16 Dec 92 05:33:59 GMT
Article-I.D.: hrd769.1gnpa7INN2u1
References: <1992Dec16.002542.6959@moxie.hou.tx.us>
Sender: burgess@hrd769.brooks.af.mil (Dave Burgess)
Organization: Armstrong Lab MIS, Brooks AFB TX
Lines: 44
NNTP-Posting-Host: hrd769.brooks.af.mil

In article <1992Dec16.002542.6959@moxie.hou.tx.us> hackney@moxie.hou.tx.us (Greg Hackney) writes:
}
}We found a timeout problem in the wd.c code that occurs when the
}system trys to autoconfigure the disk drives at boot time.
}
}In wdcommand() there is a declaration:  int timeout = 1000000;
}
}This is a loop counter that runs while the disk controller
}registers are being probed. For a Conner 510MB IDE drive on a Compaq
}SystemPro 486/33, that value is not large enough for the controller
}to respond in time. (It's only short by a count of about 3,000 on
}this system).
}
}As a result, booting the dist.fs floppy indicates you have no hard
}disk drives.
}
}The fix was to increase the value of timeout. We used 1,500,000.
}--
}Greg Hackney   hackney@compaq.com
}Mike Busby     mcb@compaq.com
}
}
  I apologize for not looking at the code closely before I jump into this,
but shouldn't we be using a time value instead of a processor speed
dependent for loop?  Something like usleep(3) comes to mind, but I could be
mistaken.

  As an example:

  while(((stat = inb(wdc + wd_status)) & WDCS_BUSY) && timeout-- > 0)
    usleep(n);

  Where n is some reasonable number of milliseconds to pause and
    timeout is the number of pauses before there is an actual error.

  If we sleep for 1 millisecond, and the timeout value is 1 second,
then timeout would be 1000.  This way, the code doesn't break on fast
'486 machines (assuming that usleep works).

  What kind of problems would this cause?

TSgt Dave Burgess
NCOIC AL/MIS
Brooks AFB, TX