cagney@chook.ua.oz (Andrew Cagney - aka Noid) (04/24/89)
OK I and others from Micro Byte have got minix running on a PC230 using the hard disk driver bios_wini.c with the patch below applied. The patch is to the initialization so that bios_wini.c gets the correct number of "heads" etc on the hard disk device. The code is much simpler than that of all the other xx_init_param routines. It gets the disk parameters by using a bios call. (looking up the disk tables directly was the cause of the problem on a pc230) Notes: - This was tested using a 1.3b hybrid minix. - The tty driver works but how well we can not say until we finaly get proper 1.3 minix with out any software bugs. More on this later. - A PC230 uses a SCSI interface for its disk drives. Micro Byte are currently writing a SCSI driver for MINIX! When finished it will be posted. - a PC230 is an Australian IBM-PC Look a like made here by Micro Byte INC. It is not a direct clone. Andrew Cagney. --------------------- cut here -------------------------------------- *** bios_wini.new Tue Apr 25 00:46:44 1989 --- bios_wini.c Tue Jan 17 14:43:31 1989 *************** *** 20,28 **** * * winchester_task: main entry when system is brought up * - * Changes: - * - April 25th 89, Andrew Cagney: Add routine bios_init_params - * to initialise parameter tables using bios tables. */ #include "../h/const.h" --- 20,25 ---- *************** *** 116,129 **** /* Initialize each drive at the moment it is first used. */ if (initialized[drive] == FALSE) { if (putback++ == 0) replace(); ! #ifdef PC_230 ! bios_init_params(drive); ! #else ! if (pc_at /*|| ps (removed to get round a bug TN*/) at_init_params(drive); else xt_init_params(drive); - #endif initialized[drive] = TRUE; } --- 109,118 ---- /* Initialize each drive at the moment it is first used. */ if (initialized[drive] == FALSE) { if (putback++ == 0) replace(); ! if (pc_at || ps) at_init_params(drive); else xt_init_params(drive); initialized[drive] = TRUE; } *************** *** 197,265 **** c3 = ((unsigned) wn->wn_sector) + 1; Cx = c1 | c2 | c3; Dx = (wn->wn_head<<8) | wn->wn_drive; - bios13(); - r = (Ax >> 8) & 0xFF; return(r == 0 ? BLOCK_SIZE : EIO); } - /*============================================================================* - * bios_init_params * - *===========================================================================*/ - PRIVATE bios_init_params(drive) - int drive; - { - /* This routine is called at startup to initialize the partition table, - * the number of drives and the controller - */ - unsigned int i; - int nr_heads, nr_sec, nr_cyl; - extern phys_bytes umap(); - /* Get the number of drives from the bios */ - phys_copy(0x475L, umap(proc_addr(WINCHESTER), D, buf, 1), 1L); - nr_drives = (int) *buf > MAX_DRIVES ? MAX_DRIVES : (int) *buf; - - Ax = 0x0800; /* Get Current Drive Parameters */ - Dx = DRIVE+drive; /* select the drive ???? */ - - bios13(); - - if (((Ax >> 8) & 0xff) != 0) { - printf("Unable to get drive parameters for drive %d\n",drive); - delay(); - return; - } - nr_heads = ((Dx >> 8) & 0xff)+1; /* DH = hr sides or heads */ - nr_sec = Cx &0x3f; /* Cl = nr sectors */ - nr_cyl = ((Cx >> 8) & 0xff) + ((Cx & 0xc0) << 2) + 1; /* cH = Nr cylinders */ - - /* Set the parameters in the drive structure */ - for (i = drive*DEV_PER_DRIVE; i < ((drive+1)*DEV_PER_DRIVE); i++) { - wini[i].wn_heads = nr_heads; - wini[i].wn_maxsec = nr_sec; - wini[i].wn_drive = DRIVE + drive; - wini[i].wn_low = 0L; - wini[i].wn_size = (long)((long)nr_cyl * - (long)nr_heads * (long)nr_sec); - } - - /* Read the partition table for this drive and save it. */ - w_extra.DEVICE = drive * DEV_PER_DRIVE; - w_extra.POSITION = 0L; - w_extra.COUNT = BLOCK_SIZE; - w_extra.ADDRESS = (char *) buf; - w_extra.PROC_NR = WINCHESTER; - w_extra.m_type = DISK_READ; - if (w_do_rdwt(&w_extra) != BLOCK_SIZE) { - printf("Can't read partition table of winchester %d\n", drive); - delay(); - return; - } - copy_prt(drive * DEV_PER_DRIVE); - } - /*===========================================================================* * at_init_params * *===========================================================================*/ --- 185,196 ----