[comp.os.minix] ST 1.5.10 with two harddisks works just fine

bartm@praxis.cs.ruu.nl (Bart Muyzer) (07/20/90)

Hi,

I tried to hook up two harddisks to an atari running ST 1.5.0. I recompiled
the kernel with NR_DRIVES (in <minix/config.h>) set to 3, booted the new
system, created the devices, and it all works fine. The two drives are each on
one controller, so the situation is:

	controller 0, lun 0:	first disk,
	controller 0, lun 1:	**no disk connected**
	controller 1, lun 0:	second disk,
	controller 1, lun 1:	**no disk connected**

I jumpered the second disk to 'Target #1 == ACSI-id #1'.

Remember to use major device number 3, and to built the minor device number
like:
	ccccdppp	c = controller number
			d = disk number (0 or 1 -> max. 2 disks/controller!)
			p = partition number (see stwini.c)

I also dived deeply into stwini, learned how to program the DMA and the HDC,
and I couldn't find any errors. So I guess making the new devices and
recompiling the kernel should do...

Good luck,
							>] Bart [<

UPSYF173%DBIUNI11.BITNET@cunyvm.cuny.edu (Wolfgang Thiel) (07/20/90)

     Hi,
        There a_r_e errors in stwini.c/stdma.c ST1.5.10:
The #ifdef SUPRA look fine, but: SUPRA is always defined in config.h,but this
#define means the partitioning, not the interrupt handling. The SUPRA stuff
didnt't work with my harddisk (SCSI, ICD-Hostadaptor, QUANTUM).
   And be careful with the DELAY counters (may-be this is in stdma.c, I
don't recall): the test is: while(--counter > 0)... So, if you change the
counter to unsigned int (which I did to test longer delays!) 0 means a very
long delay, not a short one.    Somewhere in the driver, there is a line
while (--delay  > 0); which is followed two lines later by  while(--delay >0);
without resetting delay to the initial value; so, the 2nd loop finishes
immediately (or very late with unsigned). I think this was in dma_wcmd().
    Why was the extended partitions patch not included into 1.5.10?  There
will be many people with more then 4 partitions right now!
                                    Wolfgang

eesrajm@cc.brunel.ac.uk (Andrew J Michael) (07/26/90)

In article <25146@nigel.udel.EDU>, UPSYF173%DBIUNI11.BITNET@cunyvm.cuny.edu (Wolfgang Thiel) writes:
> 
>      Hi,
>         There a_r_e errors in stwini.c/stdma.c ST1.5.10:
> The #ifdef SUPRA look fine, but: SUPRA is always defined in config.h,but this
> #define means the partitioning, not the interrupt handling. The SUPRA stuff
> didnt't work with my harddisk (SCSI, ICD-Hostadaptor, QUANTUM).
>    And be careful with the DELAY counters (may-be this is in stdma.c, I
(Stuff deleted)
>                                     Wolfgang


Correct.  The official stwini.c will NOT work with later Supra adaptors and
will in fact happily mangle a filesystem on such a disk.  I sent a patch to
Frans, but had no reply, so I'm posting it.  This patch will fix the above
mentioned problems and also adds the patch to access /dev/hd0 correctly. 
Apply it to the unadulterated 1.5.10 stwini.c.

-------------- snip, snip ---------

*** stwini.c.old	Sun May 20 15:58:04 1990
--- stwini.c.new	Sun May 20 15:58:50 1990
***************
*** 3,9 ****
   * This file contains a driver for the Hard Disk Controller (HDC)
   * on the Atari ST.
   * If yor drive is an old Supra drive you perhaps want to compile 
!  * using -DSUPRA. The code added with #ifdef SUPRA/#endif is taken 
   * from usenet and not verified (since I do not have such a drive)
   *
   * The driver supports two operations: read a block and write a block.
--- 3,9 ----
   * This file contains a driver for the Hard Disk Controller (HDC)
   * on the Atari ST.
   * If yor drive is an old Supra drive you perhaps want to compile 
!  * using -DSUPRA=1. The code added with #if SUPRA/#endif is taken 
   * from usenet and not verified (since I do not have such a drive)
   *
   * The driver supports two operations: read a block and write a block.
***************
*** 107,113 ****
    for (drive = 0; drive < NR_DRIVES; drive++) {
  	minor = drive << 3;
  	/* read sector 0 of the drive and copy the partition info */
! 	pi[minor].pi_size = 1;
  	dmagrab(WINCHESTER, hdcint);
  	r = do_xfer(drive, (phys_bytes)&hi, 0L, 1, DISK_READ);
  	dmafree(WINCHESTER);
--- 107,113 ----
    for (drive = 0; drive < NR_DRIVES; drive++) {
  	minor = drive << 3;
  	/* read sector 0 of the drive and copy the partition info */
! 	pi[minor].pi_size = 2;
  	dmagrab(WINCHESTER, hdcint);
  	r = do_xfer(drive, (phys_bytes)&hi, 0L, 1, DISK_READ);
  	dmafree(WINCHESTER);
***************
*** 224,230 ****
   *				do_xfer					     *
   *===========================================================================*/
  
! #ifdef SUPRA
  #define PNK_DELAY	50 	/* tunable */
  #endif
  
--- 224,230 ----
   *				do_xfer					     *
   *===========================================================================*/
  
! #if SUPRA
  #define PNK_DELAY	50 	/* tunable */
  #endif
  
***************
*** 260,282 ****
  	wrbit = WRBIT;
    }
    r = cmdtail(drive, sector, count);	/* command parameters */
! #ifndef SUPRA
    IENABLE();
  #endif
    if (r == OK) {
! #ifdef SUPRA
  	IENABLE();
  #endif
  	dmacomm(wrbit | FDC | SCREG, count, HDC_DELAY);
! 	DMA->dma_mode = wrbit | FDC | HDC | A0;
! 	dmawcmd(0, wrbit);
  	receive(HARDWARE, &mess);	/* Wait for interrupt. */
! #ifdef SUPRA
  	IDISABLE();
  #endif
  	s = dmardat(wrbit | FDC | HDC | A0, HDC_DELAY);
  	if (s & HDC_CC) {
! #ifdef SUPRA
  	  if ((s & HDC_CC) != 2) /* 2: invalid cyl/no drive */
  #endif
  		printf("hd: %s: drive=%d sector=%D status=0x%x\n",
--- 260,282 ----
  	wrbit = WRBIT;
    }
    r = cmdtail(drive, sector, count);	/* command parameters */
! #if (SUPRA == 0)
    IENABLE();
  #endif
    if (r == OK) {
! #if SUPRA
  	IENABLE();
  #endif
  	dmacomm(wrbit | FDC | SCREG, count, HDC_DELAY);
! 	dmawdat(wrbit | FDC | HDC | A0, 0, HDC_DELAY);
! 	DMA->dma_mode = wrbit;
  	receive(HARDWARE, &mess);	/* Wait for interrupt. */
! #if SUPRA
  	IDISABLE();
  #endif
  	s = dmardat(wrbit | FDC | HDC | A0, HDC_DELAY);
  	if (s & HDC_CC) {
! #if SUPRA
  	  if ((s & HDC_CC) != 2) /* 2: invalid cyl/no drive */
  #endif
  		printf("hd: %s: drive=%d sector=%D status=0x%x\n",
***************
*** 286,292 ****
    }
    if (dmardat(FDC, HDC_DELAY))		/* finish HDC command */
  	;
! #ifdef SUPRA
  	for (s = 0; s< PNK_DELAY; s++) {} /* Guarantee interrupt is gone */
  	IENABLE();			  /* re-enable normal interrupts */
  #endif
--- 286,292 ----
    }
    if (dmardat(FDC, HDC_DELAY))		/* finish HDC command */
  	;
! #if SUPRA
  	for (s = 0; s< PNK_DELAY; s++) {} /* Guarantee interrupt is gone */
  	IENABLE();			  /* re-enable normal interrupts */
  #endif

---------------

Andy Michael


-- 
Andy Michael (eesrajm@cc.brunel.ac.uk)      " Software cannot be written to
85 Hawthorne Crescent                        be completely free of errors."
West Drayton
Middlesex                                    - Acorn Computers Ltd.
UB7 9PA