Subject: patches to pc532/stand
To: 532bsd Mailing List <port-pc532@sun-lamp.cs.berkeley.edu>
From: Matthias Pfaller <leo@marco.de>
List: port-pc532
Date: 08/22/1994 10:06:09
Hi,

I made a few patches to boot. The following problems are fixed:

* You can now boot from sdX:/netbsd (where X is > 1)

* You can now boot a kernel with a zero size symbol table.
  (this is usefull for boot floppies. You can get a working system
   including the kernel on a 1.44 mb disk)

* Most important: We finally got a running wheel like the sun :-)

* I think scsi_low.c should not reset the scsi bus (one of my disks
  gives me problems if scsi_low resets the bus).

	Matthias

*** ../stand/boot.c	Mon May 30 19:58:00 1994
--- boot.c	Mon Jun 13 23:32:30 1994
***************
*** 92,97 ****
--- 92,99 ----
  		    printf(": %s\n", name);
  
  		io = open(name, 0);
+ 		reset_twiddle();
+ 
  		if (io >= 0) {
  			copyunix(howto, opendev, io);
  			close(io);
***************
*** 124,130 ****
  		printf("Bad format\n");
  		return;
  	}
! 
  	load = addr = x.a_entry & 0x00ffff00;	/* XXX make less magical? */
  	printf("Booting %s%d%c:%s @ 0x%x\n",
  	    devsw[dev].dv_name, unit + (8*ctlr), 'a'+part, name, addr);
--- 126,132 ----
  		printf("Bad format\n");
  		return;
  	}
! 	reset_twiddle();
  	load = addr = x.a_entry & 0x00ffff00;	/* XXX make less magical? */
  	printf("Booting %s%d%c:%s @ 0x%x\n",
  	    devsw[dev].dv_name, unit + (8*ctlr), 'a'+part, name, addr);
***************
*** 157,168 ****
--- 159,172 ----
  		while ((int)addr & CLOFSET)
  			*addr++ = 0;
  	/* Data */
+ 	reset_twiddle();
  	printf("+%d", x.a_data);
  	if (read(io, addr, x.a_data) != x.a_data)
  		goto shread;
  	addr += x.a_data;
  
  	/* Bss */
+ 	reset_twiddle();
  	printf("+%d", x.a_bss);
  	bzero( addr, x.a_bss );
  	addr += x.a_bss;
***************
*** 171,186 ****
  	ssym = addr;
  	bcopy(&x.a_syms, addr, sizeof(x.a_syms));
  	addr += sizeof(x.a_syms);
  	printf(" [%d+", x.a_syms);
! 	if (read(io, addr, x.a_syms) != x.a_syms)
  		goto shread;
  	addr += x.a_syms;
  
  	/* read size of string table */
! 	if (read(io, &i, sizeof(int)) != sizeof(int))
  		goto shread;
  
  	/* read strings */
  	printf("%d]", i);
  	bcopy(&i, addr, sizeof(int));
  	if (i) {
--- 175,193 ----
  	ssym = addr;
  	bcopy(&x.a_syms, addr, sizeof(x.a_syms));
  	addr += sizeof(x.a_syms);
+ 	reset_twiddle();
  	printf(" [%d+", x.a_syms);
! 	if (x.a_syms && read(io, addr, x.a_syms) != x.a_syms)
  		goto shread;
  	addr += x.a_syms;
  
  	/* read size of string table */
! 	i = 0;
! 	if (x.a_syms && read(io, &i, sizeof(int)) != sizeof(int))
  		goto shread;
  
  	/* read strings */
+ 	reset_twiddle();
  	printf("%d]", i);
  	bcopy(&i, addr, sizeof(int));
  	if (i) {
***************
*** 197,202 ****
--- 204,210 ----
  #undef round_to_size
  
  	/* and note the end address of all this	*/
+ 	reset_twiddle();
  	printf(" total=0x%x", addr);
  
  #ifdef pc532
***************
*** 274,276 ****
--- 282,307 ----
  	} else
  		printf("\n");
  }
+ 
+ static int tw_on;
+ static int tw_pos;
+ static char tw_chars[] = "|/-\\";
+ 
+ reset_twiddle()
+ {
+ 	if (tw_on)
+ 		putchar('\b');
+ 	tw_on = 0;
+ 	tw_pos = 0;
+ }
+ 
+ twiddle()
+ {
+ 	if (tw_on)
+ 		putchar('\b');
+ 	else
+ 		tw_on = 1;
+ 	putchar(tw_chars[tw_pos++]);
+ 	tw_pos %= (sizeof(tw_chars) - 1);
+ }
+ 
*** ../stand/devopen.c	Mon May 30 19:58:00 1994
--- devopen.c	Tue Jun 14 23:57:06 1994
***************
*** 96,102 ****
  
  	/* tokenize device ident */
  	args[0] = ++s;
! 	for (args[0] = s, i = 1; *s && *s != ')'; s++) {
  	    if (*s == ',')
  		args[i++] = ++s;
  	}
--- 96,104 ----
  
  	/* tokenize device ident */
  	args[0] = ++s;
! 	for (i = 1; *s && *s != ')'; s++) {
! 	    if (i > 3)
! 	        goto baddev;
  	    if (*s == ',')
  		args[i++] = ++s;
  	}
***************
*** 135,141 ****
  	    goto baddev;
  
  	/* isolate unit */
! 	if ((*unit = atoi(s)) > sizeof(char))
  	    goto bad;
  	for (; isdigit(*s); s++);
  	
--- 137,143 ----
  	    goto baddev;
  
  	/* isolate unit */
! 	if ((*unit = atoi(s)) > ((1 << (sizeof(char) * 8)) - 1))
  	    goto bad;
  	for (; isdigit(*s); s++);
  	
*** ../stand/scsi_low.c	Mon May 30 19:58:00 1994
--- scsi_low.c	Sun Jun 12 23:52:42 1994
***************
*** 82,88 ****
  
  PRIVATE struct scsi_args	*sc_ptrs;
  PRIVATE char			sc_cur_phase,
! 				sc_reset_done,
  				sc_have_msg,
  				sc_accept_int,
  				sc_dma_dir;
--- 82,88 ----
  
  PRIVATE struct scsi_args	*sc_ptrs;
  PRIVATE char			sc_cur_phase,
! 				sc_reset_done = 1,
  				sc_have_msg,
  				sc_accept_int,
  				sc_dma_dir;
*** ../stand/sd.c	Mon May 30 19:58:00 1994
--- sd.c	Mon Jun 13 23:27:21 1994
***************
*** 170,175 ****
--- 170,176 ----
  		return(0);
  
  	ss->sc_retry = 0;
+ 	twiddle();
  
  #ifdef SD_DEBUG
  	if (debug)


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