Newsgroups: comp.os.minix
Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!simtel!daffy!uwvax!uchinews!vixen.cso.uiuc.edu!howland.reston.ans.net!usc!crash!cwr
From: cwr@crash.cts.com (Will Rose)
Subject: Re: Unsolvable 1.7.0b HD problem. (LONG)
Organization: CTS Network Services (CTSNET), San Diego, CA
Date: Mon, 3 Jul 1995 18:39:48 GMT
Message-ID: <DB5L6D.3HE@crash.cts.com>
X-Newsreader: TIN [version 1.2 PL2]
References: <3t7uvn$ogl@dingo.cc.uq.oz.au>
Sender: news@crash.cts.com (news subsystem)
Nntp-Posting-Host: crash.cts.com
Lines: 191

Peter Petroff (e3307976@student.uq.edu.au) wrote:
: Minix 1.7.0 appears to be completely incapable of seeing the hard drive.

: PC:       Toshiba T3200 portable, 80286-12, IBM PC/AT compatible BIOS ROM
: Disk:     1 x 3.5" 720kB DSDD
:           1 x 3.5"  40MB HD (controller type UNKNOWN)
:                (type 4, 8h., 611 cyl., 17 sec/track)
: RAM:      4MB (640kB + 384kB EMS + 3MB expansion card)
: Software: Minix 1.7.0 beta ( / Minix 1.5)
:           MS-DOS v5.00
:  
: What happens:
:           ROOT and USR diskettes successfully load Minix into ramdrive,
: mounting /usr as /dev/fd0; then login as root and run part(8) following
: usage(8) instructions - but as soon as I try to modify any parameters (or
: even move cursor to another partition entry), I get an error from part.
: Under the AT driver (set in Boot Monitor) I get
:                at-hd0: probe failed
:                /dev/hd0: No such device or address
:           Under XT or BIOS no probe, but
:                /dev/hd0: No such device
:           Under ESDI it hangs and I know this machine isn't a PS/2; is it?
:  

I know nozzing, nozzing about Toshiba's but I took a look at the patch
for the 5100 (which I've included below) and you probably have (oh joy!)
a non-standard AT controller...

The best way around this is to boot using the bios_wini driver, which
surely has to work, but this is not present in the ROOT disk, only in
TINYROOT.

Try booting off TINYROOT, and to make assurance doubly sure hit ESC
at the bootmon prompt and enter hd=bios before entering boot.  That
should bring up a real mode system that will recognise your HD.
If that works, then bring up a full real-mode system, and start
recompiling the kernel and messing with the patches below to get
an AT driver that will recognise your HD.

[...]
:           I would have installed Minix 1.5 (I have reference manual and
: ORIGINAL installation disks) but disk #5 is corrupted and can't be read and
: I couldn't get a replacement (therefore I was very glad when 1.7.0b came out
: as tryware).
:  

You're better off with 1.7, honestly.  The 5100 message follows -
note that it's against 1.3, so your mileage will definitely vary.

>
>From: nfs@notecnirp.Princeton.EDU (Norbert Schlenker)
>Newsgroups: comp.os.minix
>Subject: Minix 1.3 on a Toshiba 5100
>Date: 3 May 89 04:07:47 GMT
>Reply-To: nfs@notecnirp.UUCP (Norbert Schlenker)
>Organization: Dept. of Computer Science, Princeton University
>
>Here is a context diff that will turn the standard 1.3 at_wini.c
>into a working driver for a Toshiba 5100's hard disk.  The Toshiba
>controller appears to generate two interrupts almost simultaneously
>when asked for two disk sectors, and Minix doesn't handle it very
>well.  The diff changes the single request for a two sector read into
>two consecutive single sector reads, which appears to fix the problem
>nicely.
>
>*** at_wini.c   Tue May  2 23:22:07 1989
>--- my_wini.c   Tue May  2 23:25:26 1989
>***************
>*** 197,226 ****
>    usr_buf = umap(proc_addr(wn->wn_procnr), D, wn->wn_address, BLOCK_SIZE);
>    if (usr_buf == (phys_bytes)0)
>        return(ERR);
>!   command[0] = wn->wn_ctlbyte;
>!   command[1] = wn->wn_precomp;
>!   command[2] = BLOCK_SIZE/SECTOR_SIZE;
>!   command[3] = wn->wn_sector;
>!   command[4] = wn->wn_cylinder & 0xFF;
>!   command[5] = ((wn->wn_cylinder & 0x0300) >> 8);
>!   command[6] = (wn->wn_drive << 4) | wn->wn_head | 0xA0;
>!   command[7] = (wn->wn_opcode == DISK_READ ? WIN_READ : WIN_WRITE);
>! 
>!   if (com_out() != OK)
>!       return(ERR);
>  
>    /* Block, waiting for disk interrupt. */
>    if (wn->wn_opcode == DISK_READ) {
>        for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
>!               receive(HARDWARE, &w_mess);
>! /*            old_state = lock(); */
>!               dma_read((unsigned)(usr_buf >> 4), (unsigned)(usr_buf & 0x0F));
>! /*            restore(old_state); */
>!               usr_buf += 0x200;
>                if (win_results() != OK) {
>                        w_need_reset = TRUE;
>                        return(ERR);
>                }
>        }
>        r = OK;
>    } else {
>--- 197,239 ----
>    usr_buf = umap(proc_addr(wn->wn_procnr), D, wn->wn_address, BLOCK_SIZE);
>    if (usr_buf == (phys_bytes)0)
>        return(ERR);
>! 
>!   /* Set up controller registers (mostly an inline com_out). */
>! 
>!   if (drive_busy()) {
>!       w_need_reset = TRUE;
>!       return(ERR);
>!   }
>!   port_out(WIN_REG9, wn->wn_ctlbyte);
>!   port_out(WIN_REG2, wn->wn_precomp);
>!   port_out(WIN_REG3, 1);
>!   port_out(WIN_REG4, wn->wn_sector);
>!   port_out(WIN_REG5, wn->wn_cylinder & 0xFF);
>!   port_out(WIN_REG6, (wn->wn_cylinder & 0x0300) >> 8);
>!   port_out(WIN_REG7, (wn->wn_drive << 4) | wn->wn_head | 0xA0);
>  
>    /* Block, waiting for disk interrupt. */
>    if (wn->wn_opcode == DISK_READ) {
>        for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
>!               port_out(WIN_REG8, WIN_READ);
>!               receive(HARDWARE, &w_mess);
>!               dma_read((unsigned)(usr_buf >> 4), (unsigned)(usr_buf & 0x0F));
>                if (win_results() != OK) {
>                        w_need_reset = TRUE;
>                        return(ERR);
>                }
>+               if (++wn->wn_sector > wn->wn_maxsec) {
>+                       wn->wn_sector = 1;
>+                       if (++wn->wn_head >= wn->wn_heads) {
>+                               wn->wn_head = 0;
>+                               ++wn->wn_cylinder;
>+                               port_out(WIN_REG5, wn->wn_cylinder & 0xFF);
>+                               port_out(WIN_REG6, (wn->wn_cylinder & 0x0300) >> 8);
>+                       }
>+                       port_out(WIN_REG7, (wn->wn_drive << 4) | wn->wn_head | 0xA0);
>+               }
>+               port_out(WIN_REG4, wn->wn_sector);
>+               usr_buf += 0x200;
>        }
>        r = OK;
>    } else {
>***************
>*** 231,245 ****
>                return(ERR);
>        }
>        for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
>! /*            old_state = lock(); */
>!               dma_write((unsigned)(usr_buf >> 4), (unsigned)(usr_buf&0x0F));
>! /*            restore(old_state); */
>!               usr_buf += 0x200;
>                receive(HARDWARE, &w_mess);
>                if (win_results() != OK) {
>                        w_need_reset = TRUE;
>                        return(ERR);
>                }
>        }
>        r = OK;
>    }
>--- 244,268 ----
>                return(ERR);
>        }
>        for (i=0; i<BLOCK_SIZE/SECTOR_SIZE; i++) {
>!               port_out(WIN_REG8, WIN_WRITE);
>!               dma_write((unsigned)(usr_buf >> 4), (unsigned)(usr_buf&0x0F));
>                receive(HARDWARE, &w_mess);
>                if (win_results() != OK) {
>                        w_need_reset = TRUE;
>                        return(ERR);
>                }
>+               if (++wn->wn_sector > wn->wn_maxsec) {
>+                       wn->wn_sector = 1;
>+                       if (++wn->wn_head >= wn->wn_heads) {
>+                               wn->wn_head = 0;
>+                               ++wn->wn_cylinder;
>+                               port_out(WIN_REG5, wn->wn_cylinder & 0xFF);
>+                               port_out(WIN_REG6, (wn->wn_cylinder & 0x0300) >> 8);
>+                       }
>+                       port_out(WIN_REG7, (wn->wn_drive << 4) | wn->wn_head | 0xA0);
>+               }
>+               port_out(WIN_REG4, wn->wn_sector);
>+               usr_buf += 0x200;
>        }
>        r = OK;
>    }
>

Good luck - Will
cwr@crash.cts.com

