Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/vax Allow printf's from slave CPUs by stealing the ...
details: https://anonhg.NetBSD.org/src/rev/d689e29d983f
branches: trunk
changeset: 487676:d689e29d983f
user: ragge <ragge%NetBSD.org@localhost>
date: Sun Jun 11 07:50:11 2000 +0000
description:
Allow printf's from slave CPUs by stealing the v_putc function.
Easier than expected because the printout lock is hold in the higher levels.
diffstat:
sys/arch/vax/include/cpu.h | 6 ++--
sys/arch/vax/vax/ka820.c | 52 +++++++++++++++++++++++++++++++++++++++-----
sys/arch/vax/vax/multicpu.c | 11 +++++++-
sys/arch/vax/vax/pmap.c | 6 +++-
4 files changed, 62 insertions(+), 13 deletions(-)
diffs (204 lines):
diff -r 595bfea549fb -r d689e29d983f sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h Sun Jun 11 07:40:45 2000 +0000
+++ b/sys/arch/vax/include/cpu.h Sun Jun 11 07:50:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.h,v 1.51 2000/06/10 14:59:39 ragge Exp $ */
+/* $NetBSD: cpu.h,v 1.52 2000/06/11 07:50:13 ragge Exp $ */
/*
* Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -106,7 +106,7 @@
* Private members.
*/
int ci_want_resched; /* Should change process */
- int ci_cpunumber; /* Index in cpu_cd.cd_devs[] array */
+ struct device *ci_dev; /* device struct for this cpu */
long ci_exit; /* Page to use while exiting */
#if defined(MULTIPROCESSOR)
struct pcb *ci_pcb; /* Idle PCB for this CPU */
@@ -119,7 +119,7 @@
#define curcpu() ((struct cpu_info *)mfpr(PR_SSP))
#define curproc (curcpu()->ci_curproc)
-#define cpu_number() (curcpu()->ci_cpunumber)
+#define cpu_number() (curcpu()->ci_dev->dv_unit)
#define need_resched() {curcpu()->ci_want_resched++; mtpr(AST_OK,PR_ASTLVL); }
#if defined(MULTIPROCESSOR)
#define CPU_IS_PRIMARY(ci) (ci->ci_flags & CI_MASTERCPU)
diff -r 595bfea549fb -r d689e29d983f sys/arch/vax/vax/ka820.c
--- a/sys/arch/vax/vax/ka820.c Sun Jun 11 07:40:45 2000 +0000
+++ b/sys/arch/vax/vax/ka820.c Sun Jun 11 07:50:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ka820.c,v 1.23 2000/06/10 14:59:38 ragge Exp $ */
+/* $NetBSD: ka820.c,v 1.24 2000/06/11 07:50:12 ragge Exp $ */
/*
* Copyright (c) 1988 Regents of the University of California.
* All rights reserved.
@@ -49,6 +49,7 @@
#include <sys/kernel.h>
#include <sys/device.h>
#include <sys/systm.h>
+#include <sys/conf.h>
#include <vm/vm.h>
#include <vm/vm_kern.h>
@@ -62,6 +63,7 @@
#include <machine/bus.h>
#include <dev/clock_subr.h>
+#include <dev/cons.h>
#include <dev/bi/bireg.h>
#include <dev/bi/bivar.h>
@@ -90,6 +92,9 @@
static void ka820_sendstr(int, char *);
static void ka820_sergeant(int);
static int rxchar(void);
+static void ka820_putc(int);
+static void ka820_cnintr(void);
+cons_decl(gen);
#endif
struct cpu_dep ka820_calls = {
@@ -162,11 +167,12 @@
if (ba->ba_nodenr != mastercpu) {
#if defined(MULTIPROCESSOR)
sc->sc_ci = cpu_slavesetup(self);
+ v_putc = ka820_putc; /* Need special console handling */
#endif
return;
}
- curcpu()->ci_cpunumber = sc->sc_dev.dv_unit;
+ curcpu()->ci_dev = self;
/* reset the console and enable the RX50 */
ka820port_ptr = (void *)vax_map_physmem(KA820_PORTADDR, 1);
csr = ka820port_ptr->csr;
@@ -427,6 +433,12 @@
return;
#if defined(MULTIPROCESSOR)
+ if ((c & 0xff) == 0) {
+ if (curcpu()->ci_flags & CI_MASTERCPU)
+ ka820_cnintr();
+ return;
+ }
+
if (expect == ((c >> 8) & 0xf))
rxbuf[got++] = c & 0xff;
@@ -527,11 +539,9 @@
for (i = 0; i < 10000; i++)
if ((volatile)ci->ci_flags & CI_RUNNING)
break;
- printf("%s: (ID %d) ", dev->dv_xname, sc->sc_binid);
if (i == 10000)
- printf("failed starting??!!??\n");
- else
- printf("now running\n");
+ printf("%s: (ID %d) failed starting??!!??\n",
+ dev->dv_xname, sc->sc_binid);
}
void
@@ -590,4 +600,34 @@
}
/* What to do now??? */
}
+
+/*
+ * Write to master console.
+ * Need no locking here; done in the print functions.
+ */
+static volatile int ch = 0;
+
+void
+ka820_putc(int c)
+{
+ if (curcpu()->ci_flags & CI_MASTERCPU) {
+ gencnputc(0, c);
+ return;
+ }
+ ch = c;
+ mtpr(mastercpu << 8, PR_RXCD); /* Send IPI to mastercpu */
+ while (ch != 0)
+ ; /* Wait for master to handle */
+}
+
+/*
+ * Got character IPI.
+ */
+void
+ka820_cnintr()
+{
+ if (ch != 0)
+ gencnputc(0, ch);
+ ch = 0; /* Release slavecpu */
+}
#endif
diff -r 595bfea549fb -r d689e29d983f sys/arch/vax/vax/multicpu.c
--- a/sys/arch/vax/vax/multicpu.c Sun Jun 11 07:40:45 2000 +0000
+++ b/sys/arch/vax/vax/multicpu.c Sun Jun 11 07:50:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: multicpu.c,v 1.1 2000/06/10 14:59:38 ragge Exp $ */
+/* $NetBSD: multicpu.c,v 1.2 2000/06/11 07:50:12 ragge Exp $ */
/*
* Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -41,12 +41,15 @@
#include <sys/malloc.h>
#include <sys/proc.h>
#include <sys/user.h>
+#include <sys/device.h>
#include <vm/vm.h>
#include <vm/vm_page.h>
#include <machine/cpu.h>
+#include "ioconf.h"
+
static void slaverun(void);
struct cpuq {
@@ -115,6 +118,7 @@
/* Populate the PCB and the cpu_info struct */
ci = (struct cpu_info *)(scratch + VAX_NBPG);
memset(ci, 0, sizeof(struct cpu_info));
+ ci->ci_dev = dev;
ci->ci_exit = scratch;
(u_long)ci->ci_pcb = (u_long)pcb & ~KERNBASE;
ci->ci_istack = istackbase + NBPG;
@@ -136,7 +140,10 @@
void
slaverun()
{
- (volatile)curcpu()->ci_flags |= CI_RUNNING;
+ struct cpu_info *ci = curcpu();
+
+ (volatile)ci->ci_flags |= CI_RUNNING;
+ printf("%s: running\n", ci->ci_dev->dv_xname);
for (;;)
;
}
diff -r 595bfea549fb -r d689e29d983f sys/arch/vax/vax/pmap.c
--- a/sys/arch/vax/vax/pmap.c Sun Jun 11 07:40:45 2000 +0000
+++ b/sys/arch/vax/vax/pmap.c Sun Jun 11 07:50:11 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.c,v 1.81 2000/06/10 14:59:38 ragge Exp $ */
+/* $NetBSD: pmap.c,v 1.82 2000/06/11 07:50:11 ragge Exp $ */
/*
* Copyright (c) 1994, 1998, 1999 Ludd, University of Lule}, Sweden.
* All rights reserved.
@@ -283,8 +283,10 @@
/* cpu_info struct */
pcb->SSP = scratch + VAX_NBPG;
mtpr(pcb->SSP, PR_SSP);
- bzero((caddr_t)pcb->SSP, sizeof(struct cpu_info));
+ bzero((caddr_t)pcb->SSP,
+ sizeof(struct cpu_info) + sizeof(struct device));
curcpu()->ci_exit = scratch;
+ curcpu()->ci_dev = (void *)(pcb->SSP + sizeof(struct cpu_info));
#if defined(MULTIPROCESSOR)
curcpu()->ci_flags = CI_MASTERCPU|CI_RUNNING;
#endif
Home |
Main Index |
Thread Index |
Old Index