Subject: Re: port-hp300/460: scsi slaves treated as unit's
To: None <netbsd-bugs@netbsd.org>
From: Jason Thorpe <thorpej@cs.orst.edu>
List: netbsd-bugs
Date: 09/05/1994 16:17:07
On Mon, 5 Sep 1994 13:20:20 -0700 
 "Jason R. Thorpe" <thorpej@mail.cs.orst.edu> wrote:

 > 	Actual code is unknown to me at the moment...But after enough
 > 	coffee, I'm sure I can come up with something...

Well, after a pot of "Breakfast at 11", here's my fix...I've tested it on 
my 433, anyway, and it does OK...

-----------------------------------------------------------------------------
Jason R. Thorpe                thorpej@cs.orst.edu                   754-1554
Systems Administrator             CSWest Room 12                     737-5567
Oregon State University

-----cut here-----
*** autoconf.c~	Mon Sep  5 12:29:23 1994
--- autoconf.c	Mon Sep  5 16:13:15 1994
***************
*** 972,977 ****
--- 972,978 ----
  	int  majdev, mindev, unit, part, controller, adaptor;
  	dev_t temp, orootdev;
  	struct swdevt *swp;
+ 	int kludge_unit = 0;
  
  	if (boothowto & RB_DFLTROOT ||
  	    (bootdev & B_MAGICMASK) != (u_long)B_DEVMAGIC)
***************
*** 1021,1034 ****
  	 * unit 0 and a tape as unit 1.  This would have to be
  	 * rethought if you ever wanted to boot from other than unit 0.
  	 */
! 	if (unit != 0)
! 		printf("WARNING: using device at unit 0 of controller\n");
  
- 	mindev = hd->hp_unit;
  	/*
! 	 * Form a new rootdev
  	 */
! 	mindev = (mindev << PARTITIONSHIFT) + part;
  	orootdev = rootdev;
  	rootdev = makedev(majdev, mindev);
  	/*
--- 1022,1062 ----
  	 * unit 0 and a tape as unit 1.  This would have to be
  	 * rethought if you ever wanted to boot from other than unit 0.
  	 */
! 	if (unit != 0) {
! 		/*
! 		 * XXX: this is a hack
! 		 * Since the unit number of a scsi disk is always the
! 		 * same as the slave number, we need to set mindev to
! 		 * what was spec'd in swapnetbsd.c.  So, check to see 
! 		 * if the driver name is "sd" - if it is, then set the
! 		 * mindev appropriately.  If not, continue on your
! 		 * merry way.
! 		 */
! 		if (strcmp(hd->hp_driver->d_name, "sd")) {
! 			printf("WARNING: using device at unit 0 of controller\n");
! 		} else {	/* yup...we're `sd' */
! #ifdef	DEBUG
! 			printf("WARNING: kludging scsi unit number\n");
! 			printf("  hd->hp_unit: %d\n", hd->hp_unit);
! 			printf("  hd->hp_driver->d_name: %s\n",
! 			       hd->hp_driver->d_name);
! #endif
! 			kludge_unit = 1;
! 			mindev = minor(rootdev);
! #ifdef	DEBUG
! 			printf("unit kludged to %d\n", mindev >> PARTITIONSHIFT);
! #endif
! 		}
! 	}
  
  	/*
! 	 * Form a new rootdev...if necessary
  	 */
! 	if (!kludge_unit) {
! 		mindev = hd->hp_unit;
! 		mindev = (mindev << PARTITIONSHIFT) + part;
! 	}
! 
  	orootdev = rootdev;
  	rootdev = makedev(majdev, mindev);
  	/*

------------------------------------------------------------------------------