Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/newsmips * Apply updates from Shimizu-san received ...



details:   https://anonhg.NetBSD.org/src/rev/34ed459ce13a
branches:  trunk
changeset: 479840:34ed459ce13a
user:      tsubai <tsubai%NetBSD.org@localhost>
date:      Thu Dec 23 06:52:30 1999 +0000

description:
* Apply updates from Shimizu-san received after the initial commit.
* G/C unused.
* Many cosmetic changes.
* etc...

diffstat:

 sys/arch/newsmips/apbus/apbus.c           |   41 +---
 sys/arch/newsmips/apbus/apbus_subr.c      |   36 +-
 sys/arch/newsmips/apbus/apbusvar.h        |    8 +-
 sys/arch/newsmips/apbus/clock_ap.c        |   11 +-
 sys/arch/newsmips/apbus/if_sn_ap.c        |   33 +---
 sys/arch/newsmips/apbus/zs_ap.c           |   68 ++++---
 sys/arch/newsmips/include/adrsmap.h       |  157 ++++-------------
 sys/arch/newsmips/include/apbus.h         |  150 ++++-----------
 sys/arch/newsmips/include/apcall.h        |   81 +--------
 sys/arch/newsmips/newsmips/news5000.c     |  274 ++++++++++-------------------
 sys/arch/newsmips/stand/boot/boot.c       |    4 +-
 sys/arch/newsmips/stand/boot/netif_news.c |    4 +-
 12 files changed, 258 insertions(+), 609 deletions(-)

diffs (truncated from 1266 to 300 lines):

diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/apbus.c
--- a/sys/arch/newsmips/apbus/apbus.c   Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/apbus.c   Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbus.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $ */
+/*     $NetBSD: apbus.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -62,8 +62,9 @@
 
 #define        NLEVEL  2
 #define        NBIT    16
+#define        LEVELxBIT(l,b)  (((l)*NBIT)+(b))
 
-static struct ap_intrhand apintr[NLEVEL][NBIT];
+static struct ap_intrhand apintr[NLEVEL*NBIT];
 
 static int
 apbusmatch(parent, cfdata, aux)
@@ -87,20 +88,13 @@
         void *aux;
 {
        struct apbus_attach_args child;
-       struct apbus_device *apdev;
+       struct apbus_dev *apdev;
        struct apbus_ctl *apctl;
 
-       *(volatile u_int*)(NEWS5000_APBUS_INTSTAT) = 0xffffffff;
-       *(volatile u_int*)(NEWS5000_APBUS_INTMASK) = NEWS5000_INTAPBUS_ALL;
-
-       *(volatile u_int*)(NEWS5000_APBUS_CONFIG) = 0x04;
-       *(volatile u_int *)(NEWS5000_APBUS_DUMCOH) =
-                                      NEWS5000_APBUS_DEVICE_DMAC3 |
-                                      NEWS5000_APBUS_DEVICE_SONIC |
-                                      NEWS5000_APBUS_DEVICE_ALLSLOT;
-
-       *(volatile u_int*)NEWS5000_INTMASK0 = NEWS5000_INT0_ALL;
-       *(volatile u_int*)NEWS5000_INTMASK1 = NEWS5000_INT1_ALL;
+       *(volatile u_int *)(NEWS5000_APBUS_INTST) = 0xffffffff;
+       *(volatile u_int *)(NEWS5000_APBUS_INTMSK) = 0xffffffff;
+       *(volatile u_int *)(NEWS5000_APBUS_CTRL) = 0x00000004;
+       *(volatile u_int *)(NEWS5000_APBUS_DMA) = 0xffffffff;
 
        printf("\n");
 
@@ -130,13 +124,6 @@
                                child.apa_slotno = apctl->apbc_sl;
                                child.apa_hwbase = apctl->apbc_hwbase;
 
-#if 0
-printf("config_found: name = %s\n", child.apa_name);
-printf("            : unit = %d\n", child.apa_ctlnum);
-printf("            : slot = %d\n", child.apa_slotno);
-printf("            : unit = 0x%08lx\n", child.apa_hwbase);
-#endif
-
                                config_found(self, &child, apbusprint);
 
                                apctl = apctl->apbc_link;
@@ -181,17 +168,11 @@
 void
 apbus_wbflush()
 {
-       volatile int *wbflush = (int *)NEWS5000_WB;
+       volatile int *wbflush = (int *)NEWS5000_WBFLUSH;
 
        (void)*wbflush;
 }
 
-void
-apbus_intr_init()
-{
-       bzero(&apintr[0][0],sizeof(apintr));
-}
-
 /*
  * called by hardware interrupt routine
  */
@@ -202,7 +183,7 @@
 {
        int i;
        int nintr = 0;
-       struct ap_intrhand *aip = &apintr[level][0];
+       struct ap_intrhand *aip = &apintr[LEVELxBIT(level,0)];
 
        for(i = 0; i < NBIT; i++) {
                if (aip->ai_mask & stat) {
@@ -241,7 +222,7 @@
        if (nbit == -1)
                panic("apbus_intr_establish");
 
-       aip = &apintr[level][nbit];
+       aip = &apintr[LEVELxBIT(level,nbit)];
        aip->ai_mask = 1 << nbit;
        aip->ai_priority = priority;
        aip->ai_func = func;
diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/apbus_subr.c
--- a/sys/arch/newsmips/apbus/apbus_subr.c      Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/apbus_subr.c      Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbus_subr.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $    */
+/*     $NetBSD: apbus_subr.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $    */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -33,31 +33,31 @@
 
 void *
 apbus_device_to_hwaddr(apbus_dev)
-       struct apbus_device *apbus_dev;
+       struct apbus_dev *apbus_dev;
 {
        struct apbus_ctl *ctl;
 
-       if (!apbus_dev)
-               return (void *)0;
+       if (apbus_dev == NULL)
+               return NULL;
 
        ctl = apbus_dev->apbd_ctl;
-       if (!ctl)
-               return (void *)0;
+       if (ctl == NULL)
+               return NULL;
 
        return (void *)ctl->apbc_hwbase;
 }
 
-struct apbus_device *
+struct apbus_dev *
 apbus_lookupdev(devname)
        char *devname;
 {
-       struct apbus_device *dp;
+       struct apbus_dev *dp;
 
        dp = _sip->apbsi_dev;
-       if (!devname || *devname == '\0')
+       if (devname == NULL || *devname == '\0')
                return dp;
 
-       /* search apbus_device named 'devname' */
+       /* search apbus_dev named 'devname' */
        while (dp) {
                if (strcmp(devname,dp->apbd_name) == 0)
                        return dp;
@@ -65,7 +65,7 @@
                dp = dp->apbd_link;
        }
 
-       return (struct apbus_device *)0;
+       return NULL;
 }
 
 void
@@ -77,7 +77,7 @@
        if (!apctl)
                return;
 
-       printf("        apbus_ctl dump (0x%08x)\n", (unsigned int)apctl);
+       printf("        apbus_ctl dump (%p)\n", apctl);
 
        p = (void *)apctl;
 
@@ -93,21 +93,21 @@
 
 void
 apdevice_dump(apdev)
-       struct apbus_device *apdev;
+       struct apbus_dev *apdev;
 {
        struct apbus_ctl *apctl;
 
-       if (!apdev)
+       if (apdev == NULL)
                return;
 
        /* only no pseudo device */
        apctl = apdev->apbd_ctl;
-       if (!(int)apctl || !(int)apctl->apbc_hwbase)
+       if (apctl == NULL || apctl->apbc_hwbase == 0)
                return;
 
-       printf("apbus_device dump (%p)\n", apdev);
-       printf("name:           %s\n", (char *)apdev->apbd_name);
-       printf("vendor:         %s\n", (char *)apdev->apbd_vendor);
+       printf("apbus_dev dump (%p)\n", apdev);
+       printf("name:           %s\n", apdev->apbd_name);
+       printf("vendor:         %s\n", apdev->apbd_vendor);
        printf("atr:            %08x\n", apdev->apbd_atr);
        printf("rev:            %d\n", apdev->apbd_rev);
        printf("driver:         0x%08x\n", (unsigned int)apdev->apbd_driver);
diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/apbusvar.h
--- a/sys/arch/newsmips/apbus/apbusvar.h        Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/apbusvar.h        Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: apbusvar.h,v 1.1 1999/12/22 05:55:24 tsubai Exp $      */
+/*     $NetBSD: apbusvar.h,v 1.2 1999/12/23 06:52:30 tsubai Exp $      */
 
 /*-
  * Copyright (C) 1999 SHIMIZU Ryo.  All rights reserved.
@@ -39,9 +39,9 @@
        u_long  apa_hwbase;     /* hardware I/O address */
 };
 
-void *apbus_device_to_hwaddr __P((struct apbus_device *));
-struct apbus_device *apbus_lookupdev __P((char *));
-void apdevice_dump __P((struct apbus_device *));
+void *apbus_device_to_hwaddr __P((struct apbus_dev *));
+struct apbus_dev *apbus_lookupdev __P((char *));
+void apdevice_dump __P((struct apbus_dev *));
 void apbus_intr_init __P((void));
 int apbus_intr_call __P((int, int));
 void *apbus_intr_establish __P((int, int, int, void (*)(void *), void *,
diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/clock_ap.c
--- a/sys/arch/newsmips/apbus/clock_ap.c        Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/clock_ap.c        Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: clock_ap.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $      */
+/*     $NetBSD: clock_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $      */
 
 /*-
  * Copyright (C) 1999 Tsubai Masanari.  All rights reserved.
@@ -93,14 +93,7 @@
 clockinit(dev)
        struct device *dev;
 {
-#if 1
-       /* use timer0 */
-       *(volatile u_int *)NEWS5000_INTMASK2 = NEWS5000_INT2_TIMER0;
-#else
-       /* use timer1 */
-       *(volatile u_int *)NEWS5000_TIMER1_PERIOD = 5000 / CLOCK_RATE - 1;
-       *(volatile u_int *)NEWS5000_INTMASK2 = NEWS5000_INT2_TIMER1;
-#endif
+       *(volatile u_int *)NEWS5000_INTEN2 = NEWS5000_INT2_TIMER0;
 }
 
 void
diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/if_sn_ap.c
--- a/sys/arch/newsmips/apbus/if_sn_ap.c        Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/if_sn_ap.c        Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_sn_ap.c,v 1.1 1999/12/22 05:55:24 tsubai Exp $      */
+/*     $NetBSD: if_sn_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $      */
 
 /*
  * Copyright (C) 1997 Allen Briggs
@@ -139,34 +139,7 @@
        return 0;
 }
 
-#define APSONIC_REG    0x00
-#define APSONIC_NREGS  0x10
-
-#define APSONIC_ENDIAN         0x80000000 /* Endian Display bit        */
-#define APSONIC_RDERR          0x00020000 /* DMA Error occur in RDMAC  */
-#define APSONIC_TDERR          0x00010000 /* DMA Error occur in TDMAC  */
-#define APSONIC_RDMACEN                0x00004000 /* RDMAC done Interrupt enable */
-#define APSONIC_TDMACEN                0x00002000 /* TDMAC done Interrupt enable */
-#define APSONIC_DERREN         0x00001000 /* DMA Error Interrupt enable */
-#define APSONIC_CH3_INTEN      0x00000800 /* Channel 3 Interrupt enable */
-#define APSONIC_CH2_INTEN      0x00000400 /* Channel 2 Interrupt enable */
-#define APSONIC_CH1_INTEN      0x00000200 /* Channel 1 Interrupt enable */
-#define APSONIC_CH0_INTEN      0x00000100 /* Channel 0 Interrupt enable */
-#define APSONIC_RDMAC          0x00000040 /* RDMAC done Interrupt      */
-#define APSONIC_TDMAC          0x00000020 /* TDMAC done Interrupt      */
-#define APSONIC_DERR           0x00000010 /* DMA Error Interrupt       */
-#define APSONIC_CH3_INT                0x00000008 /* Channel 3 Interrupt       */
-#define APSONIC_CH2_INT                0x00000004 /* Channel 2 Interrupt       */
-#define APSONIC_CH1_INT                0x00000002 /* Channel 1 Interrupt       */
-#define APSONIC_CH0_INT                0x00000001 /* Channel 0 Interrupt       */
-
-#define APSONIC_INT_MASK (APSONIC_CH0_INTEN | \
-                         APSONIC_CH1_INTEN | \
-                         APSONIC_CH2_INTEN | \
-                         APSONIC_CH3_INTEN | \
-                         APSONIC_RDMACEN | \
-                         APSONIC_TDMACEN | \
-                         APSONIC_DERREN)
+#define APSONIC_INT_MASK       0x00007f00      /* XXX */
 
 void
 sn_md_init(sc)
@@ -174,7 +147,7 @@
 {
        u_int *reg = (u_int *)(sc->sc_hwbase - 0x00100000);
 
-       reg[APSONIC_REG] = APSONIC_INT_MASK;
+       *reg = APSONIC_INT_MASK;
        wbflush();
        apbus_wbflush();
        delay(10000);
diff -r 5986a2e7d751 -r 34ed459ce13a sys/arch/newsmips/apbus/zs_ap.c
--- a/sys/arch/newsmips/apbus/zs_ap.c   Thu Dec 23 06:26:08 1999 +0000
+++ b/sys/arch/newsmips/apbus/zs_ap.c   Thu Dec 23 06:52:30 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: zs_ap.c,v 1.1 1999/12/22 05:55:25 tsubai Exp $ */
+/*     $NetBSD: zs_ap.c,v 1.2 1999/12/23 06:52:30 tsubai Exp $ */



Home | Main Index | Thread Index | Old Index