Return to BSD News archive
Xref: sserve comp.os.386bsd.questions:2733 comp.os.386bsd.development:811 Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.development Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!sdd.hp.com!caen!batcomputer!ghost.dsi.unimi.it!ipgaix!peppe From: peppe@ipgaix.unipg.it (G. Vitillaro) Subject: Particular Kernel needed Message-ID: <1993May29.101916.126649@ipgaix.unipg.it> Summary: I need a particular kernel for my (crazy) HW emulated WD/SCSI controller Keywords: Kernel, WD, Controller, disks Organization: Universita' di Perugia Date: Sat, 29 May 1993 10:19:16 GMT Lines: 136 Please forgot my previous post if you see it. Here it is the right one (I hope). =================================================== I need a particular kernel for my (crazy) HD controller, as I sad in my previous post. I analyzed the source and (maybe and hopefully) I found what should changed for my WD controller. The key point is I have to hardcode my HD parameters for my disk as it seems to not answer to the READP command correctly, to get the HD geometry. From the other side I verified, using the fixit diskette, that the disks are working correctly, if only the kernel may found the correct geometry. So, I checked the source and found the source to change. The file is </usr/src/sys.386bsd/i386/isa/wd.c> (obviously) and the routine is <wdgetctlr(int u, struct disk *du)>. Should be enough to modify your wd.c substituting this routine to the original wdgetctlr. You will note that I defined CRAZY_WD_CONTROLLER, for my case, so you may understand the changes. (Remember to save a copy of your wd.c and restore after the kernel rebuild). I supposed that <unit> is <0=DRIVE0> and <1=DRIVE1>. If not please change it, where I hardcoded my disk parameters. I did this change in the orginal <srcdist> source. Anybody may handle for me to recompile a kernel with the changes I need to boot it the first time from HD? (If you will find an error please advice me). Here are the changed routine, for my case: ==== /usr/src/sys.386bsd/i386/isa/wd.c:wdgetctlr ====== line 886,940 ==== * issue READP to drive to ask it what it is. */ #define CRAZY_WD_CONTROLLER static int wdgetctlr(int u, struct disk *du) { int stat, x, i, wdc; char tb[DEV_BSIZE]; struct wdparams *wp; x = splbio(); /* not called from intr level ... */ #ifndef CRAZY_WD_CONTROLLER wdc = du->dk_port; outb(wdc+wd_sdh, WDSD_IBM | (u << 4)); stat = wdcommand(du, WDCC_READP); if (stat < 0) return(stat); if (stat & WDCS_ERR) { splx(x); return(inb(wdc+wd_error)); } /* obtain parameters */ wp = &du->dk_params; insw(wdc+wd_data, tb, sizeof(tb)/sizeof(short)); bcopy(tb, wp, sizeof(struct wdparams)); /* shuffle string byte order */ for (i=0; i < sizeof(wp->wdp_model) ;i+=2) { u_short *p; p = (u_short *) (wp->wdp_model + i); *p = ntohs(*p); } /*printf("gc %x cyl %d trk %d sec %d type %d sz %d model %s\n", wp->wdp_config, wp->wdp_fixedcyl+wp->wdp_removcyl, wp->wdp_heads, wp->wdp_sectors, wp->wdp_cntype, wp->wdp_cnsbsz, wp->wdp_model);*/ /* update disklabel given drive information */ du->dk_dd.d_ncylinders = wp->wdp_fixedcyl + wp->wdp_removcyl /*+- 1*/; du->dk_dd.d_ntracks = wp->wdp_heads; du->dk_dd.d_nsectors = wp->wdp_sectors; #else /* hardcode disks parameters */ /* my guess is <0=DRIVE0> and <1=DRIVE1> */ /* if not please change it */ switch ( unit ) { case 0: /* drive 0 : 314Mb */ du->dk_dd.d_ncylinders = 730; du->dk_dd.d_ntracks = 16; du->dk_dd.d_nsectors = 55; bcopy("DRIVE0", du->dk_dd.d_packname, 7); break; case 1: /* drive 1 : 957Mb */ du->dk_dd.d_ncylinders = 1945; du->dk_dd.d_ntracks = 16; du->dk_dd.d_nsectors = 63; bcopy("DRIVE1", du->dk_dd.d_packname, 7); break; } #endif du->dk_dd.d_secpercyl = du->dk_dd.d_ntracks * du->dk_dd.d_nsectors; du->dk_dd.d_partitions[1].p_size = du->dk_dd.d_secpercyl * wp->wdp_sectors; du->dk_dd.d_partitions[1].p_offset = 0; /* dubious ... */ bcopy("ESDI/IDE", du->dk_dd.d_typename, 9); #ifndef CRAZY_WD_CONTROLLER bcopy(wp->wdp_model+20, du->dk_dd.d_packname, 14-1); #endif /* better ... */ du->dk_dd.d_type = DTYPE_ESDI; du->dk_dd.d_subtype |= DSTYPE_GEOMETRY; #ifndef CRAZY_WD_CONTROLLER /* XXX sometimes possibly needed */ (void) inb(wdc+wd_status); #endif return (0); } === end of source =============================================== -- Giuseppe Vitillaro - IBM SEMEA | E-Mail : peppe@ipgaix.unipg.it University of Perugia Italy | 06100 Perugia Phone:+39.75.585-2200 --------------------------------------------------------------------------- All comments/opinions are mine and don't represent those of IBM