Subject: Re: A little more info
To: Allen Briggs <briggs@puma.bevd.blacksburg.va.us>
From: Ted Lemon <mellon@vix.com>
List: port-pmax
Date: 05/01/1995 10:33:39
Sigh.   Mea culpa.   Mea maxima culpa.

I don't know why I didn't catch this last night when I was grovelling
through the CVS trees, but this morning I did.   I checked in a change
a little while ago to be compatible with some changes elsewhere in the
tree, which accidentally brought with it some other changes that
shouldn't have been made yet.   The change was to machdep.c.   I've
included a patch below which fixes it, and in addition, the change
should be in the next sup.

The definitive answer on the rcons stuff is that it's still not quite
ready for primetime.   I'm seriously rewiring all of the console code
to make it more modular and understandable, but I don't quite have
input working yet.   Output works great, though!

I will let you know when I check these changes in.   I'll need some
volunteers to test stuff, particularly 2100/3100 monochrome console
stuff and cfb stuff, since I don't have access to a cfb.   Should be
sometime this week or on the weekend.

Sorry again for checking in that bogus code...   :'(

			       _MelloN_

Date: Mon, 1 May 1995 13:27:03 -0400
From: Ted Lemon <mellon@NetBSD.ORG>
Message-Id: <199505011727.NAA08859@pain.lcs.mit.edu>
To: mellon@vix.com

Index: machdep.c
===================================================================
RCS file: /a/cvsroot/src/sys/arch/pmax/pmax/machdep.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -c -r1.25 -r1.26
*** machdep.c	1995/04/22 20:28:10	1.25
--- machdep.c	1995/05/01 17:22:20	1.26
***************
*** 1,4 ****
! /*	$NetBSD: machdep.c,v 1.25 1995/04/22 20:28:10 christos Exp $	*/
  
  /*
   * Copyright (c) 1988 University of Utah.
--- 1,4 ----
! /*	$NetBSD: machdep.c,v 1.26 1995/05/01 17:22:20 mellon Exp $	*/
  
  /*
   * Copyright (c) 1988 University of Utah.
***************
*** 98,104 ****
  #include <cfb.h>
  #include <mfb.h>
  #include <xcfb.h>
- #include <sfb.h>
  #include <dc.h>
  #include <dtop.h>
  #include <scc.h>
--- 98,103 ----
***************
*** 117,123 ****
  extern void sccPutc();
  #endif
  extern int KBDGetc();
! /* extern void fbPutc(); */
  extern struct consdev cn_tab;
  
  /* Will scan from max to min, inclusive */
--- 116,122 ----
  extern void sccPutc();
  #endif
  extern int KBDGetc();
! extern void fbPutc();
  extern struct consdev cn_tab;
  
  /* Will scan from max to min, inclusive */
***************
*** 651,656 ****
--- 645,832 ----
  	 * Initialize the virtual memory system.
  	 */
  	pmap_bootstrap((vm_offset_t)v);
+ }
+ 
+ /*
+  * Console initialization: called early on from main,
+  * before vm init or startup.  Do enough configuration
+  * to choose and initialize a console.
+  */
+ consinit()
+ {
+ 	register int kbd, crt;
+ 	register char *oscon;
+ 
+ 	/*
+ 	 * First get the "osconsole" environment variable.
+ 	 */
+ 	oscon = (*callv->_getenv)("osconsole");
+ 	crt = kbd = -1;
+ 	if (oscon && *oscon >= '0' && *oscon <= '9') {
+ 		kbd = *oscon - '0';
+ 		cn_tab.cn_screen = 0;
+ 		while (*++oscon) {
+ 			if (*oscon == ',')
+ 				cn_tab.cn_screen = 1;
+ 			else if (cn_tab.cn_screen &&
+ 			    *oscon >= '0' && *oscon <= '9') {
+ 				crt = kbd;
+ 				kbd = *oscon - '0';
+ 				break;
+ 			}
+ 		}
+ 	}
+ 	if (pmax_boardtype == DS_PMAX && kbd == 1)
+ 		cn_tab.cn_screen = 1;
+ 	/*
+ 	 * The boot program uses PMAX ROM entrypoints so the ROM sets
+ 	 * osconsole to '1' like the PMAX.
+ 	 */
+ 	if (pmax_boardtype == DS_3MAX && crt == -1 && kbd == 1) {
+ 		cn_tab.cn_screen = 1;
+ 		crt = 0;
+ 		kbd = 7;
+ 	}
+ 
+ 	/*
+ 	 * First try the keyboard/crt cases then fall through to the
+ 	 * remote serial lines.
+ 	 */
+ 	if (cn_tab.cn_screen) {
+ 	    switch (pmax_boardtype) {
+ 	    case DS_PMAX:
+ #if NDC > 0 && NPM > 0
+ 		if (pminit()) {
+ 			cn_tab.cn_dev = makedev(DCDEV, DCKBD_PORT);
+ 			cn_tab.cn_getc = KBDGetc;
+ 			cn_tab.cn_kbdgetc = dcGetc;
+ 			cn_tab.cn_putc = fbPutc;
+ 			cn_tab.cn_disabled = 0;
+ 			return;
+ 		}
+ #endif /* NDC and NPM */
+ 		goto remcons;
+ 
+ 	    case DS_MAXINE:
+ #if NDTOP > 0
+ 		if (kbd == 3) {
+ 			cn_tab.cn_dev = makedev(DTOPDEV, 0);
+ 			cn_tab.cn_getc = dtopKBDGetc;
+ 			cn_tab.cn_putc = fbPutc;
+ 		} else
+ #endif /* NDTOP */
+ 			goto remcons;
+ #if NXCFB > 0
+ 		if (crt == 3 && xcfbinit()) {
+ 			cn_tab.cn_disabled = 0;
+ 			return;
+ 		}
+ #endif /* XCFB */
+ 		break;
+ 
+ 	    case DS_3MAX:
+ #if NDC > 0
+ 		if (kbd == 7) {
+ 			cn_tab.cn_dev = makedev(DCDEV, DCKBD_PORT);
+ 			cn_tab.cn_getc = KBDGetc;
+ 			cn_tab.cn_kbdgetc = dcGetc;
+ 			cn_tab.cn_putc = fbPutc;
+ 		} else
+ #endif /* NDC */
+ 			goto remcons;
+ 		break;
+ 
+ 	    case DS_3MIN:
+ 	    case DS_3MAXPLUS:
+ #if NSCC > 0
+ 		if (kbd == 3) {
+ 			cn_tab.cn_dev = makedev(SCCDEV, SCCKBD_PORT);
+ 			cn_tab.cn_getc = KBDGetc;
+ 			cn_tab.cn_kbdgetc = sccGetc;
+ 			cn_tab.cn_putc = fbPutc;
+ 		} else
+ #endif /* NSCC */
+ 			goto remcons;
+ 		break;
+ 
+ 	    default:
+ 		goto remcons;
+ 	    };
+ 
+ 	    /*
+ 	     * Check for a suitable turbochannel frame buffer.
+ 	     */
+ 	    if (tc_slot_info[crt].driver_name) {
+ #if NMFB > 0
+ 		if (strcmp(tc_slot_info[crt].driver_name, "mfb") == 0 &&
+ 		    mfbinit(tc_slot_info[crt].k1seg_address)) {
+ 			cn_tab.cn_disabled = 0;
+ 			return;
+ 		}
+ #endif /* NMFB */
+ #if NSFB > 0
+ 		if (strcmp(tc_slot_info[crt].driver_name, "sfb") == 0 &&
+ 		    sfbinit(tc_slot_info[crt].k1seg_address)) {
+ 			cn_tab.cn_disabled = 0;
+ 			return;
+ 		}
+ #endif /* NSFB */
+ #if NCFB > 0
+ 		if (strcmp(tc_slot_info[crt].driver_name, "cfb") == 0 &&
+ 		    cfbinit(tc_slot_info[crt].k1seg_address)) {
+ 			cn_tab.cn_disabled = 0;
+ 			return;
+ 		}
+ #endif /* NCFB */
+ 		printf("crt: %s not supported as console device\n",
+ 			tc_slot_info[crt].driver_name);
+ 	    } else
+ 		printf("No crt console device in slot %d\n", crt);
+ 	}
+ remcons:
+ 	/*
+ 	 * Configure a serial port as a remote console.
+ 	 */
+ 	cn_tab.cn_screen = 0;
+ 	switch (pmax_boardtype) {
+ 	case DS_PMAX:
+ #if NDC > 0
+ 		if (kbd == 4)
+ 			cn_tab.cn_dev = makedev(DCDEV, DCCOMM_PORT);
+ 		else
+ 			cn_tab.cn_dev = makedev(DCDEV, DCPRINTER_PORT);
+ 		cn_tab.cn_getc = dcGetc;
+ 		cn_tab.cn_putc = dcPutc;
+ #endif /* NDC */
+ 		break;
+ 
+ 	case DS_3MAX:
+ #if NDC > 0
+ 		cn_tab.cn_dev = makedev(DCDEV, DCPRINTER_PORT);
+ 		cn_tab.cn_getc = dcGetc;
+ 		cn_tab.cn_putc = dcPutc;
+ #endif /* NDC */
+ 		break;
+ 
+ 	case DS_3MIN:
+ 	case DS_3MAXPLUS:
+ #if NSCC > 0
+ 		cn_tab.cn_dev = makedev(SCCDEV, SCCCOMM3_PORT);
+ 		cn_tab.cn_getc = sccGetc;
+ 		cn_tab.cn_putc = sccPutc;
+ #endif /* NSCC */
+ 		break;
+ 
+ 	case DS_MAXINE:
+ #if NSCC > 0
+ 		cn_tab.cn_dev = makedev(SCCDEV, SCCCOMM2_PORT);
+ 		cn_tab.cn_getc = sccGetc;
+ 		cn_tab.cn_putc = sccPutc;
+ #endif /* NSCC */
+ 		break;
+ 	};
+ 	if (cn_tab.cn_dev == NODEV)
+ 		printf("Can't configure console!\n");
  }
  
  /*