Subject: patches to /src/sys/arch/pmax/stand/rz.c
To: None <port-pmax@NetBSD.ORG>
From: Jonathan Stone <jonathan@DSG.Stanford.EDU>
List: port-pmax
Date: 02/12/1995 09:51:30
The following works for me on a 5000/200 and a 3100 (but not a 5k/240).
It appears to not be using REX on the 5k/200, which seems strange,
since the machines have updated proms.  (The bootblock in -current
doesn't work on such machines.)

If someone could try building a bootblock on a machine that uses REX,
that Ted Lemon's bootblock *does* work on, (e.g., a 3MIN or an n XINE)
that would be great.

I've just put binaries of these bootblocks (with some other tweaks I
found necessary) on Gregorio.Stanford.EDU:/pub/NetBSD/pmax/mdec/.  So
if there's someone out there with two bootable disks, all they need to
do is save their old /usr/mdec/*, snarf the bootrz/rzboot files from
Gregorio, do a disklabel -B rz?c, and then try booting...

(the stdargs change below is not actually necessary, but I didn't want to
 have  _any_ chance of the old hack breaking  anthing...)


*** ../stand/rz.c	Wed Jan 18 04:02:14 1995
--- rz.c	Sun Feb 12 09:41:13 1995
***************
*** 38,43 ****
--- 38,45 ----
   *	@(#)rz.c	8.1 (Berkeley) 6/10/93
   */
  
+ #include <stdarg.h>
+ 
  #include <stand.h>
  #include <sys/param.h>
  #include <sys/disklabel.h>
***************
*** 81,93 ****
  	}
  
  	offset += pp->p_offset * DEV_BSIZE;
! #if 0
! 	if (prom_lseek(sc->sc_fd, offset, 0) < 0)
! 		return (EIO);
! 	s = prom_read(sc->sc_fd, addr, reqcnt);
! #else
! 	s = bootread (offset / 512, addr, reqcnt);
! #endif
  	if (s < 0)
  		return (EIO);
  
--- 83,96 ----
  	}
  
  	offset += pp->p_offset * DEV_BSIZE;
! 
! 	if (callv == &callvec) {
! 		/* No REX on this machine */
! 		if (prom_lseek(sc->sc_fd, offset, 0) < 0)
! 			return (EIO);
! 		s = prom_read(sc->sc_fd, addr, reqcnt);
! 	} else
! 		s = bootread (offset / 512, addr, reqcnt);
  	if (s < 0)
  		return (EIO);
  
***************
*** 96,105 ****
  }
  
  int
! rzopen(f, ctlr, unit, part)
! 	struct open_file *f;
! 	int ctlr, unit, part;
  {
  	register struct rz_softc *sc;
  	register struct disklabel *lp;
  	register int i;
--- 99,108 ----
  }
  
  int
! rzopen(struct open_file *f, ...)
  {
+ 	register int ctlr, unit, part;
+ 
  	register struct rz_softc *sc;
  	register struct disklabel *lp;
  	register int i;
***************
*** 107,113 ****
--- 110,122 ----
  	char buf[DEV_BSIZE];
  	int cnt;
  	static char device[] = "rz(0,0,0)";
+ 	va_list ap;
  
+ 	va_start(ap, f);
+ 
+ 	ctlr = va_arg(ap, int);
+ 	unit = va_arg(ap, int);
+ 	part = va_arg(ap, int);
  	if (unit >= 8 || part >= 8)
  		return (ENXIO);
  	device[5] = '0' + unit;
***************
*** 117,127 ****
  	   the DS3100 PROMs.   As a consequence, it may be possible to
  	   boot from some other drive with these bootblocks on the 3100,
  	   but will not be possible on any TurboChannel machine. */
! #if 0
! 	if ((i = prom_open(device, 0)) < 0) {
! #else
! 	if ((i = bootinit (device)) < 0) {
! #endif
  		return (ENXIO);
  	}
  
--- 126,138 ----
  	   the DS3100 PROMs.   As a consequence, it may be possible to
  	   boot from some other drive with these bootblocks on the 3100,
  	   but will not be possible on any TurboChannel machine. */
! 
! 	if (callv == &callvec)
! 		i = prom_open(device, 0);
! 	else
! 		i = bootinit (device);
! 	if (i < 0) {
! 		printf("boot init failed\n");
  		return (ENXIO);
  	}