[comp.os.minix] Zenith 150 Winchester disk fix

n0ano@wldrdg.UUCP (04/13/87)

Having recently installed MINIX on my Zenith 150 I discovered that
I had a read-only hard disk.  When writing, every few blocks would
confuse the driver which would try to reset the disk (a very lengthy
process) and would frequently not write out the block.  After debugging
the Zenith BIOS I came up with the following fix which seems to correct
the problem.  Using this fix I have copied all of the MINIX source
to my hard disk and I've recompiled the kernel about a half-dozen
times, all with no errors.  The fix is a new version of routine
`com_out' for the file `kernel/wini.c'.  Just replace `com_out' with
this one, recompile the kernel and the hard disk should work.

Don Dugger
Wildridge Consulting
...nbires!onecom!wldrdg!n0ano

PRIVATE com_out(mode)
int mode;
{
/* Output the command block to the winchester controller and return status */

	register int i = 0;
	int r;

	port_out(WIN_DMA, mode);
	port_out(WIN_SELECT, mode);
	for (i=0; i<300; i++) {
		port_in(WIN_STATUS, &r);
		if (r & 8)
			break;
	}
	if (i == 300) {
		w_need_reset = TRUE;
		return(ERR);
	}
	lock();
	for (i=0; i<6; i++) {
		for (;;) {
			port_in(WIN_STATUS, &r);
			if (r & 1)
				break;
			if ((r & 8) == 0) {
				w_need_reset = TRUE;
				unlock();
				return(ERR);
			}
		}
		if ((r & 0xe) != 0xc) {
			w_need_reset = TRUE;
			unlock();
			return(ERR);
		}
		port_out(WIN_DATA, command[i]);
	}
	unlock();
	return(OK);
}

paradis@encore.UUCP (Jim Paradis) (04/16/87)

In article <131@wldrdg.UUCP> n0ano@wldrdg.UUCP (Don Dugger) writes:
>...I discovered that I had a read-only hard disk.  

So did I.  Same symptoms as you described.  Only difference is
I'm running a Taiwan XT-clone with a mail-order hard disk
(Western Digital controller, though).

>...I came up with the following fix which seems to correct
>the problem.  

Sure does!  (Thanks) * 1E6!  You just saved me many days of
agonized device driver hackery...

(I must mention, though, that MINIX is the first system I've
used where it's actually semi-tolerable to do development on
floppies... not comfortable, mind you, but I didn't tear my
hair out either!  Still, I'm glad I got my hard disk back).

Anyhow... so as to not waste net.bandwidth with a mere thank-you
note, I thought I'd warn the net about a bug I discovered: DO NOT
use the `mv' utility to move a directory to a different place in
the directory tree!!!  I tried that, cd'ed into the directory,
did a `pwd', and got "Can't open ..".  It turns out that when
`mv' moves a directory it doesn't check to see if the `..' entry
needs to be updated.  This-all happened this morning before going
to work, so I didn't have time to look into it.  I'll check it out
and post a fix as soon as I come up with one...

   +----------------+  Jim Paradis                  linus--+
+--+-------------+  |  Encore Computer Corp.       necntc--|
|  | E N C O R E |  |  257 Cedar Hill St.           ihnp4--+-encore!paradis
|  +-------------+--+  Marlboro MA 01752           decvax--|
+----------------+     (617) 460-0500             talcott--+
You don't honestly think ENCORE is responsible for this??!!