Subject: console stuff
To: None <glass@sun-lamp.cs.berkeley.edu>
From: Gordon W. Ross <gwr@jericho.mc.com>
List: port-sun3
Date: 02/22/1994 12:18:43
> Date: Sun, 20 Feb 1994 01:10:23 -0800
> From: Adam Glass <glass@sun-lamp.cs.berkeley.edu>
>
> making very good progress...probably looking at a shell prompt now but
> the prom console driver i wrote just isn't cutting it. basically its
> losing output, not taking input etc. I've revised it considerably [...]
I am getting close to having the sparc zs driver work, but it drags in
the kbd/ms/event drivers as well so it is taking some time...
For the interim, I have the PROM console driver working reliably for
both input and output. The changes for this are below.
Gordon W. Ross Mercury Computer Systems
gwr@mc.com 199 Riverneck Road
508-256-1300 Chelmsford, MA 01824-2820
Make console input work with the PROM driver.
This lets you break into a hung kernel and do "g4".
Note that the PROM getchar needs NMI enabled.
*** arch/sun3/dev/prom.c.orig Fri Dec 17 01:56:52 1993
--- arch/sun3/dev/prom.c Tue Feb 22 00:18:58 1994
***************
*** 235,246 ****
mon_printf("prom console initialized\n");
}
- promcngetc(dev)
- dev_t dev;
- {
- mon_printf("not sure how to do promcngetc() yet\n");
- }
-
/*
* Console kernel output character routine.
*/
--- 235,240 ----
***************
*** 251,254 ****
--- 245,268 ----
if (minor(dev) != 0)
mon_printf("non unit 0 prom console???\n");
mon_putchar(c);
+ }
+
+ /*
+ * Well, here's a hack for you...
+ */
+
+ int
+ promcngetc(dev)
+ dev_t dev;
+ {
+ int c, s;
+
+ s = splhigh();
+ do {
+ c = (romVectorPtr->mayGet)();
+ } while (c < 0);
+ if (c == '\r')
+ c = '\n';
+ splx(s);
+ return (c);
}
diffs in arch/sun3/sun3/
*** arch/sun3/sun3/autoconf.c.orig Fri Feb 4 05:12:16 1994
--- arch/sun3/sun3/autoconf.c Tue Feb 22 01:33:14 1994
***************
*** 29,34 ****
--- 29,35 ----
* SUCH DAMAGE.
*
* $Header: /b/source/CVS/src/sys/arch/sun3/sun3/autoconf.c,v 1.5 1994/02/04 08:20:19 glass Exp $
+ * Let the PROM handle NMI for now. -gwr
*/
/*
* Setup the system to run on the current machine.
***************
*** 89,94 ****
--- 90,96 ----
void configure()
{
int root_found;
+ extern unsigned int orig_nmi_vector;
isr_init();
***************
*** 95,101 ****
--- 97,108 ----
root_found = config_rootfound("mainbus", NULL);
if (!root_found)
panic("configure: autoconfig failed, no device tree root found");
+ #if 1
+ /* XXX - Let the PROM handle this for now. -gwr */
+ isr_add_custom(7, orig_nmi_vector);
+ #else
isr_add(7, nmi_intr, 0);
+ #endif
isr_cleanup();
}
*** arch/sun3/sun3/clock.c.orig Fri Feb 4 05:12:17 1994
--- arch/sun3/sun3/clock.c Tue Feb 22 01:34:31 1994
***************
*** 29,34 ****
--- 29,35 ----
* SUCH DAMAGE.
*
* $Header: /b/source/CVS/src/sys/arch/sun3/sun3/clock.c,v 1.12 1994/02/04 08:20:52 glass Exp $
+ * Let the PROM handle NMI for now. -gwr
*/
/*
* machine-dependent clock routines; intersil7170
***************
*** 217,223 ****
--- 218,227 ----
}
intersil_softc = clock;
intersil_disable();
+ #if 0
+ /* XXX - Leave the NMI enabled for now. -gwr */
set_clk_mode(0, IREG_CLOCK_ENAB_7, 0);
+ #endif
isr_add_custom(clock->clock_level, level5intr_clock);
set_clk_mode(IREG_CLOCK_ENAB_5, 0, 0);
printf("\n");
*** arch/sun3/sun3/sun3_startup.c.orig Fri Feb 4 05:12:23 1994
--- arch/sun3/sun3/sun3_startup.c Tue Feb 22 01:39:31 1994
***************
*** 29,34 ****
--- 29,35 ----
* SUCH DAMAGE.
*
* $Header: /b/source/CVS/src/sys/arch/sun3/sun3/sun3_startup.c,v 1.15 1994/02/04 08:21:07 glass Exp $
+ * Let the PROM handle NMI for now. -gwr
*/
#include "systm.h"
***************
*** 107,119 ****
void sun3_stop()
{
unsigned int *new_vect;
! mon_printf("sun3_stop: kernel ended deliberately\n");
! /* set_clk_mode(0, IREG_CLOCK_ENAB_5);*/
mon_printf("sun3_stop: clock(0,0)\n");
setvbr(old_vector_table);
new_vect = getvbr();
mon_printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
! /* set_clk_mode(IREG_CLOCK_ENAB_7,0);*/
mon_printf("interrupt_reg_value: %x\n", *interrupt_reg);
mon_printf("sun3_stop: clock(7,1)\n");
mon_exit_to_mon();
--- 108,121 ----
void sun3_stop()
{
unsigned int *new_vect;
! mon_printf("sun3_stop: kernel ended deliberately: (getchar)");
! cngetc();
! /* set_clk_mode(0, (IREG_CLOCK_ENAB_5|IREG_CLOCK_ENAB_7), 0);*/
mon_printf("sun3_stop: clock(0,0)\n");
setvbr(old_vector_table);
new_vect = getvbr();
mon_printf("post: nmi vec %x\n", new_vect[VEC_LEVEL_7_INT]);
! /* set_clk_mode(IREG_CLOCK_ENAB_7,0,1);*/
mon_printf("interrupt_reg_value: %x\n", *interrupt_reg);
mon_printf("sun3_stop: clock(7,1)\n");
mon_exit_to_mon();
------------------------------------------------------------------------------