Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!bru-cc!eesrajm From: eesrajm@cc.brunel.ac.uk (Andrew J Michael) Newsgroups: comp.os.minix Subject: Re: ST 1.5.10 with two harddisks works just fine Summary: Here's a patch .. Message-ID: <1741@Terra.cc.brunel.ac.uk> Date: 25 Jul 90 18:26:15 GMT References: <25146@nigel.udel.EDU> Organization: Brunel University, Uxbridge, UK Lines: 151 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