Return to BSD News archive
Newsgroups: comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!uunet!news.univie.ac.at!news.tu-graz.ac.at!fstgds01!chmr
From: chmr@fstgds01.tu-graz.ac.at (Christoph Robitschko)
Subject: Re: second disk on 0.1
Message-ID: <1992Jul20.164920.9319@news.tu-graz.ac.at>
Keywords: wd1
Sender: news@news.tu-graz.ac.at (USENET News System)
Nntp-Posting-Host: fstgds01
Organization: Technical University of Graz, Austria
References: <1992Jul19.035222.639@chinet.chi.il.us>
Date: Mon, 20 Jul 92 16:49:20 GMT
Lines: 254
In article <1992Jul19.035222.639@chinet.chi.il.us> randy@chinet.chi.il.us (Randy Suess) writes:
>
>What is the magic incantation to get a second disk availble under
>0.1? I have 2 IDE drives, first being a 110 meg and the second being
>a 40 meg. Doing a "disklabel -r -w wd1 st351" (with st351 added to
>/etc/disktab) just hangs the system.
>Thanks for any info..
>
>--
> I am created Shiva the Destroyer; Death, the shatterer of worlds!
> Who is this dog meat who stands before me now?
> That's the biz, sweetheart.
>Randy Suess randy@chinet.chi.il.us
I have hacked /sys/i386/isa/wd.c to support two (or any number) hard disks.
It now prints the device description for each configured disk on boot time
and even doesn't break if it cannot find a configured disk.
Your configuration file should contain something like this:
controller wd0 at isa? ...
disk wd0 at wd0 disk0
disk wd1 at wd0 disk1
Enjoy ! (But at your own risk !)
Christoph
diff -p wd.c.ori wd.c
--- CUT HERE ---
*** wd.c.ori Wed Jul 15 02:55:21 1992
--- wd.c Sun Jul 19 14:48:53 1992
***************
*** 60,65 ****
--- 60,68 ----
#include "syslog.h"
#include "vm/vm.h"
+ #define _NWD (NWD - 1) /* One is for the controller */
+
+
#define RETRIES 5 /* number of retries before giving up */
#define MAXTRANSFER 32 /* max size of transfer in page clusters */
*************** struct disk {
*** 113,123 ****
struct dkbad dk_bad; /* bad sector table */
};
! struct disk *wddrives[NWD]; /* table of units */
struct buf wdtab;
! struct buf wdutab[NWD]; /* head of queue per drive */
! struct buf rwdbuf[NWD]; /* buffers for raw IO */
! long wdxfer[NWD]; /* count of transfers */
#ifdef WDDEBUG
int wddebug;
#endif
--- 116,126 ----
struct dkbad dk_bad; /* bad sector table */
};
! struct disk *wddrives[_NWD]; /* table of units */
struct buf wdtab;
! struct buf wdutab[_NWD]; /* head of queue per drive */
! struct buf rwdbuf[_NWD]; /* buffers for raw IO */
! long wdxfer[_NWD]; /* count of transfers */
#ifdef WDDEBUG
int wddebug;
#endif
*************** wdprobe(struct isa_device *dvp)
*** 143,149 ****
struct disk *du;
int wdc;
! if (unit > NWD)
return(0);
if ((du = wddrives[unit]) == 0) {
--- 146,152 ----
struct disk *du;
int wdc;
! if (unit > _NWD)
return(0);
if ((du = wddrives[unit]) == 0) {
*************** nodevice:
*** 186,218 ****
int
wdattach(struct isa_device *dvp)
{
! int unit = dvp->id_unit;
! struct disk *du = wddrives[unit];
! if(wdgetctlr(unit, du) == 0) {
! int i, blank;
! char c;
!
! printf(" <");
! for (i = blank = 0 ; i < sizeof(du->dk_params.wdp_model); i++) {
! char c = du->dk_params.wdp_model[i];
!
! if (blank && c == ' ') continue;
! if (blank && c != ' ') {
! printf(" %c", c);
! blank = 0;
! continue;
! }
! if (c == ' ')
! blank = 1;
! else
! printf("%c", c);
! }
! printf(">");
}
- /* check for index pulses from each drive. if present, report and
- allocate a bios drive position to it, which will be used by read disklabel */
- du->dk_unit = unit;
return(1);
}
--- 189,234 ----
int
wdattach(struct isa_device *dvp)
{
! int unit;
! /* int unit = dvp->id_unit; */
! for (unit=0; unit< _NWD; unit++) {
! struct disk *du;
! if ((du = wddrives[unit]) == 0) {
! du = wddrives[unit] = (struct disk *)
! malloc (sizeof(struct disk), M_TEMP, M_NOWAIT);
! du->dk_unit = unit;
! du->dk_port = dvp->id_iobase;
! }
!
!
! /* print out description of drive, suppressing multiple blanks */
! if(wdgetctlr(unit, du) == 0) {
! int i, blank;
! char c;
! printf(" %d:<", unit);
! for (i = blank = 0 ; i < sizeof(du->dk_params.wdp_model); i++) {
! char c = du->dk_params.wdp_model[i];
!
! if (blank && c == ' ') continue;
! if (blank && c != ' ') {
! printf(" %c", c);
! blank = 0;
! continue;
! }
! if (c == ' ')
! blank = 1;
! else
! printf("%c", c);
! }
! printf(">");
! du->dk_unit = unit;
! }
! else {
! free(du, M_TEMP);
! wddrives[unit] = 0;
! }
}
return(1);
}
*************** wdstrategy(register struct buf *bp)
*** 233,239 ****
int s;
/* valid unit, controller, and request? */
! if (unit >= NWD || bp->b_blkno < 0 || (du = wddrives[unit]) == 0) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
goto done;
--- 249,255 ----
int s;
/* valid unit, controller, and request? */
! if (unit >= _NWD || bp->b_blkno < 0 || (du = wddrives[unit]) == 0) {
bp->b_error = EINVAL;
bp->b_flags |= B_ERROR;
goto done;
*************** wdopen(dev_t dev, int flags, int fmt, st
*** 642,655 ****
char *msg;
unit = wdunit(dev);
! if (unit >= NWD) return (ENXIO) ;
du = wddrives[unit];
- if (du == 0 && (unit&1) && wddrives[unit&~1]) { /*XXX*/
- du = wddrives[unit] = (struct disk *) /*XXX*/
- malloc (sizeof(struct disk), M_TEMP, M_NOWAIT); /*XXX*/
- du->dk_port = wddrives[unit&~1]->dk_port; /*XXX*/
- } /*XXX*/
if (du == 0) return (ENXIO) ;
if ((du->dk_flags & DKFL_BSDLABEL) == 0) {
--- 658,666 ----
char *msg;
unit = wdunit(dev);
! if (unit >= _NWD) return (ENXIO) ;
du = wddrives[unit];
if (du == 0) return (ENXIO) ;
if ((du->dk_flags & DKFL_BSDLABEL) == 0) {
*************** wdsize(dev_t dev)
*** 1089,1095 ****
int unit = wdunit(dev), part = wdpart(dev), val;
struct disk *du;
! if (unit >= NWD)
return(-1);
du = wddrives[unit];
--- 1100,1106 ----
int unit = wdunit(dev), part = wdpart(dev), val;
struct disk *du;
! if (unit >= _NWD)
return(-1);
du = wddrives[unit];
*************** wddump(dev_t dev) /* dump core after a
*** 1129,1135 ****
unit = wdunit(dev); /* eventually support floppies? */
part = wdpart(dev); /* file system */
/* check for acceptable drive number */
! if (unit >= NWD) return(ENXIO);
du = wddrives[unit];
if (du == 0) return(ENXIO);
--- 1140,1146 ----
unit = wdunit(dev); /* eventually support floppies? */
part = wdpart(dev); /* file system */
/* check for acceptable drive number */
! if (unit >= _NWD) return(ENXIO);
du = wddrives[unit];
if (du == 0) return(ENXIO);
--- CUT HERE ---
--
------------------------------------------------------------------------
Christoph M. Robitschko | "the only man who got his work done by Friday
chmr@edvz.tu-graz.ac.at | was Robinson Crusoe."