Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/vax Code to spin up other CPUs on a VAX 8200 system.



details:   https://anonhg.NetBSD.org/src/rev/e6e1325bf15b
branches:  trunk
changeset: 487640:e6e1325bf15b
user:      ragge <ragge%NetBSD.org@localhost>
date:      Sat Jun 10 14:59:38 2000 +0000

description:
Code to spin up other CPUs on a VAX 8200 system.
Haven't solved the printf() problem yet, though.

diffstat:

 sys/arch/vax/conf/files.vax |    3 +-
 sys/arch/vax/include/cpu.h  |   72 +++++++++-----
 sys/arch/vax/vax/ka820.c    |  207 ++++++++++++++++++++++++++++++++++++-------
 sys/arch/vax/vax/multicpu.c |  142 ++++++++++++++++++++++++++++++
 sys/arch/vax/vax/pmap.c     |    7 +-
 sys/arch/vax/vax/subr.s     |    3 +-
 6 files changed, 370 insertions(+), 64 deletions(-)

diffs (truncated from 639 to 300 lines):

diff -r 2e80a986fb24 -r e6e1325bf15b sys/arch/vax/conf/files.vax
--- a/sys/arch/vax/conf/files.vax       Sat Jun 10 14:12:03 2000 +0000
+++ b/sys/arch/vax/conf/files.vax       Sat Jun 10 14:59:38 2000 +0000
@@ -1,4 +1,4 @@
-#       $NetBSD: files.vax,v 1.68 2000/05/08 19:09:49 ragge Exp $
+#       $NetBSD: files.vax,v 1.69 2000/06/10 14:59:39 ragge Exp $
 #
 # new style config file for vax architecture
 #
@@ -350,6 +350,7 @@
 file   arch/vax/vax/db_machdep.c       ddb
 file   arch/vax/vax/db_disasm.c        ddb
 file   arch/vax/uba/uba_dma.c          uba
+file   arch/vax/vax/multicpu.c         multiprocessor
 
 include "compat/ibcs2/files.ibcs2"
 file   arch/vax/vax/ibcs2_machdep.c    compat_ibcs2
diff -r 2e80a986fb24 -r e6e1325bf15b sys/arch/vax/include/cpu.h
--- a/sys/arch/vax/include/cpu.h        Sat Jun 10 14:12:03 2000 +0000
+++ b/sys/arch/vax/include/cpu.h        Sat Jun 10 14:59:38 2000 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: cpu.h,v 1.50 2000/06/02 21:47:02 matt Exp $      */
+/*      $NetBSD: cpu.h,v 1.51 2000/06/10 14:59:39 ragge Exp $      */
 
 /*
  * Copyright (c) 1994 Ludd, University of Lule}, Sweden
@@ -58,21 +58,27 @@
  * All cpu-dependent info is kept in this struct. Pointer to the
  * struct for the current cpu is set up in locore.c.
  */
+struct cpu_info;
+
 struct cpu_dep {
-       void    (*cpu_steal_pages) __P((void)); /* pmap init before mm is on */
-       int     (*cpu_mchk) __P((caddr_t));   /* Machine check handling */
-       void    (*cpu_memerr) __P((void)); /* Memory subsystem errors */
+       void    (*cpu_steal_pages)(void); /* pmap init before mm is on */
+       int     (*cpu_mchk)(caddr_t);   /* Machine check handling */
+       void    (*cpu_memerr)(void); /* Memory subsystem errors */
            /* Autoconfiguration */
-       void    (*cpu_conf) __P((void));
-       int     (*cpu_clkread) __P((time_t));   /* Read cpu clock time */
-       void    (*cpu_clkwrite) __P((void));    /* Write system time to cpu */
+       void    (*cpu_conf)(void);
+       int     (*cpu_clkread)(time_t); /* Read cpu clock time */
+       void    (*cpu_clkwrite)(void);  /* Write system time to cpu */
        short   cpu_vups;       /* speed of cpu */
        short   cpu_scbsz;      /* (estimated) size of system control block */
-       void    (*cpu_halt) __P((void)); /* Cpu dependent halt call */
-       void    (*cpu_reboot) __P((int)); /* Cpu dependent reboot call */
-       void    (*cpu_clrf) __P((void)); /* Clear cold/warm start flags */
-       void    (*cpu_subconf) __P((struct device *));/*config cpu dep. devs */
+       void    (*cpu_halt)(void); /* Cpu dependent halt call */
+       void    (*cpu_reboot)(int); /* Cpu dependent reboot call */
+       void    (*cpu_clrf)(void); /* Clear cold/warm start flags */
+       void    (*cpu_subconf)(struct device *);/*config cpu dep. devs */
        int     cpu_flags;
+#if defined(MULTIPROCESSOR)
+       /* Kick off slave cpu */
+       void    (*cpu_startslave)(struct device *, struct cpu_info *);
+#endif
 };
   
 #define        CPU_RAISEIPL    1       /* Must raise IPL until intr is handled */ 
@@ -100,14 +106,26 @@
         * Private members.
         */
        int ci_want_resched;            /* Should change process */
-       int ci_cpunumber;               /* Some numeric identifier */
+       int ci_cpunumber;               /* Index in cpu_cd.cd_devs[] array */
        long ci_exit;                   /* Page to use while exiting */
+#if defined(MULTIPROCESSOR)
+       struct pcb *ci_pcb;             /* Idle PCB for this CPU */
+       vaddr_t ci_istack;              /* Interrupt stack location */
+       int ci_flags;                   /* See below */
+#endif
 };
+#define        CI_MASTERCPU    1               /* Set if master CPU */
+#define        CI_RUNNING      2               /* Set when a slave CPU is running */
 
 #define        curcpu() ((struct cpu_info *)mfpr(PR_SSP))
 #define        curproc (curcpu()->ci_curproc)
 #define        cpu_number() (curcpu()->ci_cpunumber)
 #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)
+
+extern char tramp;
+#endif
 
 extern int mastercpu;
 
@@ -134,23 +152,25 @@
 struct device;
 
 /* Some low-level prototypes */
-int    badaddr __P((caddr_t, int));
-void   cpu_swapin __P((struct proc *));
-int    hp_getdev __P((int, int, struct device **));
-int    ra_getdev __P((int, int, int, struct device **));
-void   dumpconf __P((void));
-void   dumpsys __P((void));
-void   swapconf __P((void));
-void   disk_printtype __P((int, int));
-void   disk_reallymapin __P((struct buf *, struct pte *, int, int));
-vaddr_t        vax_map_physmem __P((paddr_t, int));
-void   vax_unmap_physmem __P((vaddr_t, int));
-void   ioaccess __P((vaddr_t, paddr_t, int));
-void   iounaccess __P((vaddr_t, int));
+#if defined(MULTIPROCESSOR)
+struct cpu_info *cpu_slavesetup(struct device *);
+void   cpu_boot_secondary_processors(void);
+#endif
+int    badaddr(caddr_t, int);
+void   cpu_swapin(struct proc *);
+void   dumpconf(void);
+void   dumpsys(void);
+void   swapconf(void);
+void   disk_printtype(int, int);
+void   disk_reallymapin(struct buf *, struct pte *, int, int);
+vaddr_t        vax_map_physmem(paddr_t, int);
+void   vax_unmap_physmem(vaddr_t, int);
+void   ioaccess(vaddr_t, paddr_t, int);
+void   iounaccess(vaddr_t, int);
 void   findcpu(void);
 void   child_return(void *);
 #ifdef DDB
-int    kdbrint __P((int));
+int    kdbrint(int);
 #endif
 #endif /* _KERNEL */
 #ifdef _STANDALONE
diff -r 2e80a986fb24 -r e6e1325bf15b sys/arch/vax/vax/ka820.c
--- a/sys/arch/vax/vax/ka820.c  Sat Jun 10 14:12:03 2000 +0000
+++ b/sys/arch/vax/vax/ka820.c  Sat Jun 10 14:59:38 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ka820.c,v 1.22 2000/06/04 02:19:27 matt Exp $  */
+/*     $NetBSD: ka820.c,v 1.23 2000/06/10 14:59:38 ragge Exp $ */
 /*
  * Copyright (c) 1988 Regents of the University of California.
  * All rights reserved.
@@ -42,6 +42,8 @@
  * a KA8200.  Sigh.)
  */
 
+#include "opt_multiprocessor.h"
+
 #include <sys/param.h>
 #include <sys/time.h>
 #include <sys/kernel.h>
@@ -73,15 +75,22 @@
 struct rx50device *rx50device_ptr;
 static volatile struct ka820clock *ka820_clkpage;
 
-static int ka820_match __P((struct device *, struct cfdata *, void *));
-static void ka820_attach __P((struct device *, struct device *, void*));
-static void ka820_memerr __P((void));
-static void ka820_conf __P((void));
-static int ka820_mchk __P((caddr_t));
+static int ka820_match(struct device *, struct cfdata *, void *);
+static void ka820_attach(struct device *, struct device *, void*);
+static void ka820_memerr(void);
+static void ka820_conf(void);
+static int ka820_mchk(caddr_t);
 static int ka820_clkread(time_t base);
 static void ka820_clkwrite(void);
-static void rxcdintr __P((void *));
+static void rxcdintr(void *);
 static void vaxbierr(void *);
+#if defined(MULTIPROCESSOR)
+static void ka820_startslave(struct device *, struct cpu_info *);
+static void ka820_txrx(int, char *, int);
+static void ka820_sendstr(int, char *);
+static void ka820_sergeant(int);
+static int rxchar(void);
+#endif
 
 struct cpu_dep ka820_calls = {
        0,
@@ -92,10 +101,24 @@
        ka820_clkwrite,
        3,      /* ~VUPS */
        5,      /* SCB pages */
+       0,
+       0,
+       0,
+       0,
+       0,
+#if defined(MULTIPROCESSOR)
+       ka820_startslave,
+#endif
+};
+
+struct ka820_softc {
+       struct device sc_dev;
+       struct cpu_info *sc_ci;
+       int sc_binid;           /* CPU node ID */
 };
 
 struct cfattach cpu_bi_ca = {
-       sizeof(struct device), ka820_match, ka820_attach
+       sizeof(struct cpu_info), ka820_match, ka820_attach
 };
 
 #ifdef notyet
@@ -106,19 +129,13 @@
 #endif
 
 static int
-ka820_match(parent, cf, aux)
-       struct device *parent;
-       struct cfdata *cf;
-       void    *aux;
+ka820_match(struct device *parent, struct cfdata *cf, void *aux)
 {
        struct bi_attach_args *ba = aux;
 
        if (bus_space_read_2(ba->ba_iot, ba->ba_ioh, BIREG_DTYPE) != BIDT_KA820)
                return 0;
 
-       if (ba->ba_nodenr != mastercpu)
-               return 0;
-
        if (cf->cf_loc[BICF_NODE] != BICF_NODE_DEFAULT &&
            cf->cf_loc[BICF_NODE] != ba->ba_nodenr)
                return 0;
@@ -127,10 +144,9 @@
 }
 
 static void
-ka820_attach(parent, self, aux)
-       struct  device *parent, *self;
-       void    *aux;
+ka820_attach(struct device *parent, struct device *self, void *aux)
 {
+       struct ka820_softc *sc = (void *)self;
        struct bi_attach_args *ba = aux;
        register int csr;
        u_short rev;
@@ -141,7 +157,16 @@
        printf(": ka82%c (%s) cpu rev %d, u patch rev %d, sec patch %d\n",
            cpu_model[6], mastercpu == ba->ba_nodenr ? "master" : "slave",
            ((rev >> 11) & 15), ((rev >> 1) &1023), rev & 1);
+       sc->sc_binid = ba->ba_nodenr;
 
+       if (ba->ba_nodenr != mastercpu) {
+#if defined(MULTIPROCESSOR)
+               sc->sc_ci = cpu_slavesetup(self);
+#endif
+               return;
+       }
+
+       curcpu()->ci_cpunumber = sc->sc_dev.dv_unit;
        /* reset the console and enable the RX50 */
        ka820port_ptr = (void *)vax_map_physmem(KA820_PORTADDR, 1);
        csr = ka820port_ptr->csr;
@@ -231,8 +256,8 @@
 #define MS2_INTLVADDR  0x00000100      /* error was in bank 1 (ro) */
 #define MS2_SYN                0x0000007f      /* error syndrome (ro, rw diag) */
 
-static int ms820_match __P((struct device *, struct cfdata *, void *));
-static void ms820_attach __P((struct device *, struct device *, void*));
+static int ms820_match(struct device *, struct cfdata *, void *);
+static void ms820_attach(struct device *, struct device *, void*);
 
 struct mem_bi_softc {
        struct device sc_dev;
@@ -245,10 +270,7 @@
 };
 
 static int
-ms820_match(parent, cf, aux)
-       struct  device  *parent;
-       struct cfdata *cf;
-       void    *aux;
+ms820_match(struct device *parent, struct cfdata *cf, void *aux)
 {
        struct bi_attach_args *ba = aux;
 
@@ -263,9 +285,7 @@
 }
 
 static void
-ms820_attach(parent, self, aux)
-       struct  device  *parent, *self;
-       void    *aux;
+ms820_attach(struct device *parent, struct device *self, void *aux)
 {
        struct mem_bi_softc *sc = (void *)self;
        struct bi_attach_args *ba = aux;
@@ -361,8 +381,7 @@
 };
 
 static int
-ka820_mchk(cmcf)
-       caddr_t cmcf;
+ka820_mchk(caddr_t cmcf)
 {
        register struct mc8200frame *mcf = (struct mc8200frame *)cmcf;
        register int i, type = mcf->mc82_summary;



Home | Main Index | Thread Index | Old Index