Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Make all powerpc ports use a common Makefile.powerp...



details:   https://anonhg.NetBSD.org/src/rev/0cd945df3e2a
branches:  trunk
changeset: 514215:0cd945df3e2a
user:      matt <matt%NetBSD.org@localhost>
date:      Sun Aug 26 02:47:33 2001 +0000

description:
Make all powerpc ports use a common Makefile.powerpc (except walnut)
Enforce -Wmissing-prototypes -Wstrict-prototypes for all ppc ports.
Split out macppc cpu support and make common to mpc6xx ports.  Make
other mpc6xx ports use it.  Add evcnts for mpc6xx traps.

diffstat:

 sys/arch/bebox/bebox/clock.c               |   16 +-
 sys/arch/bebox/bebox/cpu.c                 |   28 ++
 sys/arch/bebox/bebox/extintr.c             |   21 +-
 sys/arch/bebox/bebox/machdep.c             |   83 +-----
 sys/arch/bebox/bebox/mainbus.c             |   64 ++++-
 sys/arch/bebox/conf/GENERIC                |    5 +-
 sys/arch/bebox/conf/INSTALL                |    3 +-
 sys/arch/bebox/conf/Makefile.bebox         |  207 -----------------
 sys/arch/bebox/conf/files.bebox            |    7 +-
 sys/arch/bebox/conf/std.bebox              |    4 +-
 sys/arch/bebox/include/autoconf.h          |   22 +
 sys/arch/bebox/include/bus.h               |    8 +-
 sys/arch/bebox/include/cpu.h               |   51 +----
 sys/arch/bebox/include/intr.h              |   13 +-
 sys/arch/bebox/pci/pfb.c                   |   12 +-
 sys/arch/macppc/conf/Makefile.macppc       |  215 ------------------
 sys/arch/macppc/conf/files.macppc          |    4 +-
 sys/arch/macppc/include/cpu.h              |  105 +--------
 sys/arch/macppc/macppc/cpu.c               |  290 +------------------------
 sys/arch/macppc/macppc/machdep.c           |    5 +-
 sys/arch/ofppc/conf/GENERIC                |    7 +-
 sys/arch/ofppc/conf/Makefile.ofppc         |  214 ------------------
 sys/arch/ofppc/conf/files.ofppc            |    6 +-
 sys/arch/ofppc/include/autoconf.h          |   23 +
 sys/arch/ofppc/include/cpu.h               |   94 +-------
 sys/arch/ofppc/include/intr.h              |   82 +++++++
 sys/arch/ofppc/include/ptrace.h            |    3 +-
 sys/arch/ofppc/ofppc/autoconf.c            |    4 +-
 sys/arch/ofppc/ofppc/clock.c               |   55 +--
 sys/arch/ofppc/ofppc/cpu.c                 |   80 ++++++
 sys/arch/ofppc/ofppc/disksubr.c            |   48 +--
 sys/arch/ofppc/ofppc/machdep.c             |   84 +-----
 sys/arch/ofppc/ofppc/mainbus.c             |    3 +-
 sys/arch/ofppc/ofppc/soft_spl.c            |   19 +-
 sys/arch/powerpc/conf/Makefile.powerpc     |  216 ++++++++++++++++++
 sys/arch/powerpc/conf/files.powerpc        |    4 +-
 sys/arch/powerpc/include/cpu.h             |  141 +++++++++++-
 sys/arch/powerpc/include/spr.h             |   64 +++++
 sys/arch/powerpc/mpc6xx/cpu_subr.c         |  339 +++++++++++++++++++++++++++++
 sys/arch/powerpc/powerpc/ofw_machdep.c     |   25 +-
 sys/arch/powerpc/powerpc/powerpc_machdep.c |   15 +-
 sys/arch/powerpc/powerpc/trap.c            |   87 +++++-
 sys/arch/prep/conf/Makefile.prep           |  206 -----------------
 sys/arch/prep/include/bus.h                |    6 +-
 sys/arch/prep/include/cpu.h                |   51 +----
 sys/arch/prep/include/intr.h               |    6 +-
 sys/arch/prep/include/isa_machdep.h        |    3 +-
 sys/arch/prep/include/pci_machdep.h        |   11 +-
 sys/arch/prep/isa/isa_machdep.c            |    4 +-
 sys/arch/prep/prep/cpu.c                   |   19 +-
 sys/arch/prep/prep/ibm_machdep.c           |    3 +-
 sys/arch/prep/prep/machdep.c               |   72 +-----
 sys/arch/prep/prep/platform.c              |    3 +-
 sys/arch/sandpoint/conf/GENERIC            |    5 +-
 sys/arch/sandpoint/conf/Makefile.sandpoint |  218 ------------------
 sys/arch/sandpoint/conf/files.sandpoint    |    6 +-
 sys/arch/sandpoint/conf/std.sandpoint      |    5 +-
 sys/arch/sandpoint/include/cpu.h           |   47 +---
 sys/arch/sandpoint/sandpoint/autoconf.c    |   67 +-----
 sys/arch/sandpoint/sandpoint/machdep.c     |    5 +-
 sys/arch/sandpoint/sandpoint/mainbus.c     |   42 +++-
 sys/arch/walnut/include/cpu.h              |   45 +---
 62 files changed, 1424 insertions(+), 2176 deletions(-)

diffs (truncated from 4995 to 300 lines):

diff -r 423d71a977da -r 0cd945df3e2a sys/arch/bebox/bebox/clock.c
--- a/sys/arch/bebox/bebox/clock.c      Sun Aug 26 00:43:53 2001 +0000
+++ b/sys/arch/bebox/bebox/clock.c      Sun Aug 26 02:47:33 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock.c,v 1.8 2001/06/19 08:34:49 simonb Exp $ */
+/*     $NetBSD: clock.c,v 1.9 2001/08/26 02:47:35 matt Exp $   */
 /*      $OpenBSD: clock.c,v 1.3 1997/10/13 13:42:53 pefo Exp $  */
 
 /*
@@ -33,8 +33,10 @@
  */
 
 #include <sys/param.h>
+#include <sys/systm.h>
 #include <sys/kernel.h>
 
+#include <machine/autoconf.h>
 #include <machine/bootinfo.h>
 #include <machine/pio.h>
 
@@ -47,8 +49,7 @@
 static volatile u_long lasttb;
 
 void
-decr_intr(frame)
-       struct clockframe *frame;
+decr_intr(struct clockframe *frame)
 {
        int msr;
        int pri;
@@ -107,17 +108,15 @@
 }
 
 void
-cpu_initclocks()
+cpu_initclocks(void)
 {
-       int msr, scratch;
-
        ticks_per_intr = ticks_per_sec / hz;
        asm volatile ("mftb %0" : "=r"(lasttb));
        asm volatile ("mtdec %0" :: "r"(ticks_per_intr));
 }
 
 static inline u_quad_t
-mftb()
+mftb(void)
 {
        u_long scratch;
        u_quad_t tb;
@@ -131,8 +130,7 @@
  * Fill in *tvp with current time with microsecond resolution.
  */
 void
-microtime(tvp)
-       struct timeval *tvp;
+microtime(struct timeval *tvp)
 {
        u_long tb;
        u_long ticks;
diff -r 423d71a977da -r 0cd945df3e2a sys/arch/bebox/bebox/cpu.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/bebox/bebox/cpu.c        Sun Aug 26 02:47:33 2001 +0000
@@ -0,0 +1,28 @@
+static int cpumatch(struct device *, struct cfdata *, void *);
+static void cpuattach(struct device *, struct device *, void *);
+
+struct cfattach cpu_ca = {
+       sizeof(struct device), cpumatch, cpuattach
+};
+
+extern struct cfdriver cpu_cd;
+
+int
+cpumatch(struct device *parent, struct cfdata *cf, void *aux)
+{
+       struct mainbus_attach_args *mba = aux;
+
+       if (strcmp(mba->mba_name, cpu_cd.cd_name) != 0)
+               return 0;
+
+       if (cpu_info_store.ci_dev != NULL)
+               return 0;
+
+       return 1;
+}
+
+void
+cpuattach(struct device *parent, struct device *self, void *aux)
+{
+       (void) cpu_attach_common(self, 0);
+}
diff -r 423d71a977da -r 0cd945df3e2a sys/arch/bebox/bebox/extintr.c
--- a/sys/arch/bebox/bebox/extintr.c    Sun Aug 26 00:43:53 2001 +0000
+++ b/sys/arch/bebox/bebox/extintr.c    Sun Aug 26 02:47:33 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: extintr.c,v 1.15 2001/01/15 20:19:53 thorpej Exp $     */
+/*     $NetBSD: extintr.c,v 1.16 2001/08/26 02:47:35 matt Exp $        */
 /*      $OpenBSD: isabus.c,v 1.1 1997/10/11 11:53:00 pefo Exp $ */
 
 /*-
@@ -46,9 +46,18 @@
 
 #include <uvm/uvm_extern.h>
 
+#include <machine/autoconf.h>
 #include <machine/intr.h>
 #include <machine/psl.h>
 
+#include <machine/bus.h>
+#include <dev/isa/isavar.h>
+
+#include "com.h"
+#if NCOM > 0
+extern void comsoft(void);
+#endif
+
 unsigned int imen = 0xffffffff;
 volatile int cpl, ipending, astpending, tickspending;
 int imask[NIPL];
@@ -56,10 +65,9 @@
 struct intrhand *intrhand[ICU_LEN];
 
 void bebox_intr_mask __P((int));
-void intr_calculatemasks();
 
-int fakeintr(arg)
-       void *arg;
+static int
+fakeintr(void *arg)
 {
        return 0;
 }
@@ -134,7 +142,7 @@
                                break;
                        }
        } else {
-               printf("ext_intr: unknown interrupt 0x%x\n", int_state);
+               printf("ext_intr: unknown interrupt 0x%lx\n", int_state);
                goto out;
        }
 
@@ -179,7 +187,7 @@
        int mask = 0;
 
        for (i = 0; i < BEBOX_INTR_SIZE; i++)
-               if (!(imen & (1 << i + BEBOX_ISA_INTR)))
+               if (!(imen & (1 << (i + BEBOX_ISA_INTR))))
                        mask |= bebox_intr_map[i];
 
        *(unsigned int *)(bebox_mb_reg + CPU0_INT_MASK) = BEBOX_INTR_MASK;
@@ -443,7 +451,6 @@
        }
        if ((ipending & ~pcpl) & SINT_SERIAL) {
                ipending &= ~SINT_SERIAL;
-#include "com.h"
 #if NCOM > 0
                comsoft();
 #endif
diff -r 423d71a977da -r 0cd945df3e2a sys/arch/bebox/bebox/machdep.c
--- a/sys/arch/bebox/bebox/machdep.c    Sun Aug 26 00:43:53 2001 +0000
+++ b/sys/arch/bebox/bebox/machdep.c    Sun Aug 26 02:47:33 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: machdep.c,v 1.65 2001/08/24 04:34:26 chs Exp $ */
+/*     $NetBSD: machdep.c,v 1.66 2001/08/26 02:47:35 matt Exp $        */
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -53,12 +53,18 @@
 #include <sys/systm.h>
 #include <sys/user.h>
 
+#ifdef DDB
+#include <machine/db_machdep.h>
+#include <ddb/db_extern.h>
+#endif
+
 #include <uvm/uvm_extern.h>
 
 #include <net/netisr.h>
 
 #include <powerpc/mpc6xx/bat.h>
 #include <machine/bootinfo.h>
+#include <machine/autoconf.h>
 #define _POWERPC_BUS_DMA_PRIVATE
 #include <machine/bus.h>
 #include <machine/intr.h>
@@ -109,9 +115,6 @@
 char machine[] = MACHINE;              /* machine */
 char machine_arch[] = MACHINE_ARCH;    /* machine architecture */
 
-/* Our exported CPU info; we have only one right now. */  
-struct cpu_info cpu_info_store;
-
 struct pcb *curpcb;
 struct pmap *curpm;
 struct proc *fpuproc;
@@ -141,24 +144,24 @@
        u_int startkernel, endkernel, args;
        void *btinfo;
 {
-       extern trapcode, trapsize;
-       extern alitrap, alisize;
-       extern dsitrap, dsisize;
-       extern isitrap, isisize;
-       extern decrint, decrsize;
-       extern tlbimiss, tlbimsize;
-       extern tlbdlmiss, tlbdlmsize;
-       extern tlbdsmiss, tlbdsmsize;
+       extern int trapcode, trapsize;
+       extern int alitrap, alisize;
+       extern int dsitrap, dsisize;
+       extern int isitrap, isisize;
+       extern int decrint, decrsize;
+       extern int tlbimiss, tlbimsize;
+       extern int tlbdlmiss, tlbdlmsize;
+       extern int tlbdsmiss, tlbdsmsize;
 #ifdef DDB
-       extern ddblow, ddbsize;
+       extern int ddblow, ddbsize;
        extern void *startsym, *endsym;
 #endif
 #ifdef IPKDB
-       extern ipkdblow, ipkdbsize;
+       extern int ipkdblow, ipkdbsize;
 #endif
        extern void consinit __P((void));
        extern void ext_intr __P((void));
-       int exc, scratch, i;
+       int exc, scratch;
 
        /*
         * copy bootinfo
@@ -372,58 +375,12 @@
  * This should probably be in autoconf!                                XXX
  */
 int cpu;
-char cpu_model[80];
-char cpu_name[] = "PowerPC";   /* cpu architecture */
-
-void
-identifycpu()
-{
-       int phandle, pvr;
-       char name[32];
-
-       /*
-        * Find cpu type
-        */
-       asm ("mfpvr %0" : "=r"(pvr));
-       cpu = pvr >> 16;
-       switch (cpu) {
-       case 1:
-               sprintf(cpu_model, "601");
-               break;
-       case 3:
-               sprintf(cpu_model, "603");
-               break;
-       case 4:
-               sprintf(cpu_model, "604");
-               break;
-       case 5:
-               sprintf(cpu_model, "602");
-               break;
-       case 6:
-               sprintf(cpu_model, "603e");
-               break;
-       case 7:
-               sprintf(cpu_model, "603ev");
-               break;
-       case 9:
-               sprintf(cpu_model, "604ev");
-               break;
-       case 20:
-               sprintf(cpu_model, "620");
-               break;
-       default:
-               sprintf(cpu_model, "Version %x", cpu);
-               break;
-       }
-       sprintf(cpu_model + strlen(cpu_model), " (Revision %x)", pvr & 0xffff);
-       printf("CPU: %s %s\n", cpu_name, cpu_model);
-}
 
 void
 install_extint(handler)
        void (*handler) __P((void));
 {
-       extern extint, extsize;
+       extern int extint, extsize;
        extern u_long extint_call;
        u_long offset = (u_long)handler - (u_long)&extint_call;
        int omsr, msr;
@@ -478,7 +435,7 @@
        initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
 
        printf("%s", version);
-       identifycpu();
+       cpu_identify(NULL, 0);
 



Home | Main Index | Thread Index | Old Index