[comp.os.minix] Do Supra Hard Disks work with MINIX-ST

houpt@svax.cs.cornell.edu (Charles (Chuck) Houpt) (09/26/89)

I am thinking of getting MINIX-ST for my Atari 1040ST and Supra 30MB HD.
The monthly "Minix Information Sheet" says:

> Supra HD on Atari               v1.1, some can, some can't

Does anybody know how to determine if MINIX-ST will run off my Drive?

-Thanks in Advance
 Chuck Houpt (houpt@svax.cs.cornell.edu)

dal@syntel.mn.org (Dale Schumacher) (10/02/89)

[houpt@svax.cs.cornell.edu (Charles (Chuck) Houpt) writes...]
>I am thinking of getting MINIX-ST for my Atari 1040ST and Supra 30MB HD.
>The monthly "Minix Information Sheet" says:
>
>> Supra HD on Atari               v1.1, some can, some can't
>
>Does anybody know how to determine if MINIX-ST will run off my Drive?

Only a few older hard drives, and not just Supra, although that's where
the problem was first discovered, have trouble with MINIX-ST.  If your
drive has a daisy-chain SCSI and/or DMA port on the back then you probably
won't have any trouble.  Even if you do, there is a simple OS patch to
fix 99% of the other broken cases (the only one not yet solvable was the
combination of my old 20Mb full-height drive and my ST, it worked fine
for Willie at Supra).  The (hopefully) upcomming release of a new version
of MINIX-ST should include the patch, since it doesn't effect drives
which already worked.  Maybe Frans, or one of the beta-testers, could
verify that the stwini patch for slow drives is installed.

I just took another look at the patch (actually a new version of the
do_xfer() function) and it's not that large, so I'm reposting it here:

/*****************************************************************************
 * The following is a replacement routine in STWINI.C to allow older Supra   *
 *  hard disk systems (those _without_ a DMA pass thru) to work correctly    *
 *  with MINIX.  The problem is that an extra interrupt gets generated at    *
 *  the end of EVERY hard disk transfer.  I corrected this by disabling the  *
 *  interrups _before_ the status byte is read in.  The delay loop set by    *
 *  PNK_DELAY adds a little extra fudge factor to guaranty that the inter-   *
 *  rupt has happened.  The value of 50 should work with all drives, but I   *
 *  was only able to test it with a MiniScribe 8425S.  The value could be    *
 *  as low as 10 with that drive.  I hope that this will allow all Supra     *
 *  hard disk owners to run MINIX.					     *
 *	Willie Brown - Supra Corporation				     *
 *****************************************************************************/
#define	PNK_DELAY 50
/*===========================================================================*
 *				do_xfer					     *
 *===========================================================================*/
PRIVATE int do_xfer(drive, address, sector, count, rw)
int		drive;
phys_bytes 	address;
long		sector;
int		count;
int		rw;
{
  register	r, s, wrbit;
  /*
   * Carry out the transfer. All parameters have been checked and
   * are set up properly.
   *
   * Every single byte written to the hdc will cause an interrupt.
   * Thus disable interrupts while communicating with hdc. Ready test
   * will be done by busy waiting. Only for real hard disk operations
   * interrupts will be enabled.
   */
  TRACE(printf("hd drive:%d address:0x%X sector:%D count=%d cmd:%s\n",
	 drive, address, sector, count, (rw==DISK_READ)?"READ":"WRITE")
  );
  IDISABLE();
  if (rw == DISK_READ) {
	cmdhead(drive, HD_RD);		/* command code */
	dmaaddr(address);		/* DMA address setup */
	wrbit = 0;
  } else {
	dmaaddr(address);		/* DMA address setup */
	cmdhead(drive, HD_WR);		/* command code */
	wrbit = WRBIT;
  }
  r = cmdtail(drive, sector, count);	/* command parameters */
  if (r == OK) {
	IENABLE();
	dmacomm(wrbit | FDC | SCREG, count, HDC_DELAY);
	dmawdat(wrbit | FDC | HDC | A0, 0, HDC_DELAY);
	DMA->dma_mode = wrbit;		/* needed? */
	receive(HARDWARE, &mess);	/* Wait for interrupt. */
	IDISABLE();			/* Cancel interrupt for status bytes */
	s = dmardat(wrbit | FDC | HDC | A0, HDC_DELAY);
	if (s & HDC_CC) {
		printf("hd: %s: drive=%d sector=%D status=0x%x\n",
			wrbit ? "write" : "read", drive, sector, s&0xFF);
		r = ERROR;
	}
  }
  if (dmardat(FDC, HDC_DELAY))		/* finish HDC command */
	;
  for (s = 0; s < PNK_DELAY; s++) {}	/* Guaranty interrupt is gone! */
  IENABLE();				/* Re-enable normal interrupts */
  return(r);
}


\\   /  Dale Schumacher                         399 Beacon Ave.
 \\ /   (alias: Dalnefre')                      St. Paul, MN  55104-3527
  ><    ...umn-cs!midgard.mn.org!syntel!dal     United States of America
 / \\   "What is wanted is not the will to believe, but the will to find out,
/   \\  which is the exact opposite." -Bertrand Russell