Subject: Re: MRG, ADB, serial console vs. PRAM time
To: None <port-mac68k@NetBSD.ORG>
From: Scott Reynolds <scottr@edsi.org>
List: port-mac68k
Date: 06/18/1996 08:44:21
With the current state of affairs, if you boot with a serial console, you
can't read or set the RTC because the ROM vectors are never initialized.
I propose that instead of dumping the ROM vectors entirely, we abort
adb_init() before it does anything useful if a serial console is in use.

Please test these changes, and in particular note if you can read the PRAM
time correctly when booting with a serial console.  This is
particularly critical for those of you who have no choice but to use a
serial console, as Allen and I aren't sure whether this will break in
that case.  I'd like to get this into the release branch, if possible.

Contact me if you want a GENERIC kernel to test this out.

--scott

Index: mac68k/machdep.c
===================================================================
RCS file: /a/cvsroot/src/sys/arch/mac68k/mac68k/machdep.c,v
retrieving revision 1.109
diff -c -r1.109 machdep.c
*** machdep.c	1996/06/11 03:11:06	1.109
--- machdep.c	1996/06/18 13:19:12
***************
*** 2167,2174 ****
  	 * used later when we re-map the vectors from MacOS Address
  	 * Space to NetBSD Address Space.
  	 */
! 	if ((mac68k_machine.serial_console & 0x03) == 0)
! 		mrg_MacOSROMVectors = cpui->rom_vectors;
  
  	/*
  	 * Set up any machine specific stuff that we have to before
--- 2167,2173 ----
  	 * used later when we re-map the vectors from MacOS Address
  	 * Space to NetBSD Address Space.
  	 */
! 	mrg_MacOSROMVectors = cpui->rom_vectors;
  
  	/*
  	 * Set up any machine specific stuff that we have to before
Index: dev/adbsys.c
===================================================================
RCS file: /a/cvsroot/src/sys/arch/mac68k/dev/adbsys.c,v
retrieving revision 1.20
diff -c -r1.20 adbsys.c
*** adbsys.c	1996/05/08 13:36:41	1.20
--- adbsys.c	1996/06/18 13:19:14
***************
*** 32,43 ****
--- 32,47 ----
  
  #include <sys/param.h>
  #include <sys/systm.h>
+ 
  #include <machine/adbsys.h>
+ #include <machine/cpu.h>
  #include <machine/viareg.h>
  
  #include "adbvar.h"
  #include "../mac68k/macrom.h"
  
+ extern	struct mac68k_machine_S mac68k_machine;
+ 
  /* from adb.c */
  void    adb_processevent(adb_event_t * event);
  
***************
*** 175,180 ****
--- 179,189 ----
  	int adbindex, adbaddr;
  	int error;
  	char buffer[9];
+ 
+ 	if ((mac68k_machine.serial_console & 0x03)) {
+ 		printf("adb: using serial console\n");
+ 		return;
+ 	}
  
  	if (!mrg_romready()) {
  		printf("adb: no ROM ADB driver in this kernel for this machine\n");