Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sgimips/hpc Fixes to HPC abstraction layer from Ste...



details:   https://anonhg.NetBSD.org/src/rev/78c4314b00f9
branches:  trunk
changeset: 556871:78c4314b00f9
user:      sekiya <sekiya%NetBSD.org@localhost>
date:      Mon Dec 29 06:33:57 2003 +0000

description:
Fixes to HPC abstraction layer from Steve Rumble:

        - hpc1_hdd_{ctl,bufptr} and hpc3_hdd_{ctl,bufptr} are
          established in hpcreg.h. All references to these fields
          are updated with the exception of if_sq: (haltwo,
          hpcdma). This makes reading the code and spotting bugs
          easier.
        - hpcdma.c was applying EOCHAIN to the wrong descriptor
          word for the hpc1 case.
        - I added scsi_max_xfer to the abstraction layer, and it
          allows some crusty #defines in wdsc.c to be removed.
          hpc1 now doesn't waste descriptors as it once did.
        - hpcreg.h was updated to reflect the lack of XMITDONE
          bit in hpc1. HPC1_REV15 added for a test in hpc.c
        - hpc.c now verifies HPC1 revisions (1.0 vs 1.5) and
          prints the output a little prettier ;)
        - power interrupts shouldn't establish on non-IP22
          platforms.

diffstat:

 sys/arch/sgimips/hpc/haltwo.c |   14 +-
 sys/arch/sgimips/hpc/hpc.c    |  275 ++++++++++++++++++++++-------------------
 sys/arch/sgimips/hpc/hpcdma.c |   25 +-
 sys/arch/sgimips/hpc/hpcreg.h |   16 ++-
 sys/arch/sgimips/hpc/hpcvar.h |    3 +-
 sys/arch/sgimips/hpc/wdsc.c   |   14 +-
 6 files changed, 185 insertions(+), 162 deletions(-)

diffs (truncated from 551 to 300 lines):

diff -r f8a9d53f3476 -r 78c4314b00f9 sys/arch/sgimips/hpc/haltwo.c
--- a/sys/arch/sgimips/hpc/haltwo.c     Mon Dec 29 06:30:42 2003 +0000
+++ b/sys/arch/sgimips/hpc/haltwo.c     Mon Dec 29 06:33:57 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: haltwo.c,v 1.2 2003/10/04 09:19:23 tsutsui Exp $ */
+/* $NetBSD: haltwo.c,v 1.3 2003/12/29 06:33:57 sekiya Exp $ */
 
 /*
  * Copyright (c) 2003 Ilpo Ruotsalainen
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.2 2003/10/04 09:19:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: haltwo.c,v 1.3 2003/12/29 06:33:57 sekiya Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -226,14 +226,14 @@
        /* Build descriptor chain for looping DMA, triggering interrupt every
         * blksize bytes */
        for (i = 0; i < dmabuf->dma_map->dm_nsegs; i++) {
-               descp->hdd_bufptr = segp->ds_addr;
-               descp->hdd_ctl = segp->ds_len;
+               descp->hpc3_hdd_bufptr = segp->ds_addr;
+               descp->hpc3_hdd_ctl = segp->ds_len;
 
                KASSERT(next_intr >= segp->ds_len);
 
                if (next_intr == segp->ds_len) {
                        /* Generate intr after this DMA buffer */
-                       descp->hdd_ctl |= HDD_CTL_INTR;
+                       descp->hpc3_hdd_ctl |= HDD_CTL_INTR;
                        next_intr = blksize;
                } else
                        next_intr -= segp->ds_len;
@@ -245,8 +245,8 @@
                        descp->hdd_descptr = codec->dma_seg.ds_addr;
 
                DPRINTF(("haltwo_setup_dma: hdd_bufptr = %x hdd_ctl = %x"
-                   " hdd_descptr = %x\n", descp->hdd_bufptr, descp->hdd_ctl,
-                   descp->hdd_descptr));
+                   " hdd_descptr = %x\n", descp->hpc3_hdd_bufptr,
+                   descp->hpc3_hdd_ctl, descp->hdd_descptr));
 
                segp++;
                descp++;
diff -r f8a9d53f3476 -r 78c4314b00f9 sys/arch/sgimips/hpc/hpc.c
--- a/sys/arch/sgimips/hpc/hpc.c        Mon Dec 29 06:30:42 2003 +0000
+++ b/sys/arch/sgimips/hpc/hpc.c        Mon Dec 29 06:33:57 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: hpc.c,v 1.22 2003/12/16 11:59:04 sekiya Exp $  */
+/*     $NetBSD: hpc.c,v 1.23 2003/12/29 06:33:57 sekiya Exp $  */
 
 /*
  * Copyright (c) 2000 Soren S. Jorvang
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.22 2003/12/16 11:59:04 sekiya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpc.c,v 1.23 2003/12/29 06:33:57 sekiya Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -128,134 +128,136 @@
 };
 
 static struct hpc_values hpc1_values = {
-       15,
-       HPC1_SCSI0_REGS,
-       HPC1_SCSI0_REGS_SIZE,
-       HPC1_SCSI0_CBP,
-       HPC1_SCSI0_NDBP,
-       HPC1_SCSI0_BC,
-       HPC1_SCSI0_CTL,
-       HPC1_SCSI0_GIO,
-       HPC1_SCSI0_DEV,
-       HPC1_SCSI0_DMACFG,
-       HPC1_SCSI0_PIOCFG,
-       HPC1_SCSI1_REGS,
-       HPC1_SCSI1_REGS_SIZE,
-       HPC1_SCSI1_CBP,
-       HPC1_SCSI1_NDBP,
-       HPC1_SCSI1_BC,
-       HPC1_SCSI1_CTL,
-       HPC1_SCSI1_GIO,
-       HPC1_SCSI1_DEV,
-       HPC1_SCSI1_DMACFG,
-       HPC1_SCSI1_PIOCFG,
-       HPC1_DMACTL_DIR,
-       HPC1_DMACTL_FLUSH,
-       HPC1_DMACTL_ACTIVE,
-       HPC1_DMACTL_RESET,
-       HPC1_ENET_REGS,
-       HPC1_ENET_REGS_SIZE,
-       HPC1_ENET_INTDELAY,
-       HPC1_ENET_INTDELAYVAL,
-       HPC1_ENETR_CBP,
-       HPC1_ENETR_NDBP,
-       HPC1_ENETR_BC,
-       HPC1_ENETR_CTL,
-       HPC1_ENETR_CTL_ACTIVE,
-       HPC1_ENETR_RESET,
-       0,
-       HPC1_ENETR_PIOCFG,
-       HPC1_ENETX_CBP,
-       HPC1_ENETX_NDBP,
-       HPC1_ENETX_BC,
-       HPC1_ENETX_CTL,
-       HPC1_ENETX_CTL_ACTIVE,
-       HPC1_ENETX_DEV,
-       HPC1_ENETR_FIFO,
-       HPC1_ENETR_FIFO_SIZE,
-       HPC1_ENETX_FIFO,
-       HPC1_ENETX_FIFO_SIZE,
-       HPC1_SCSI0_DEVREGS_SIZE,
-       HPC1_SCSI0_DEVREGS_SIZE,
-       HPC1_ENET_DEVREGS,
-       HPC1_ENET_DEVREGS_SIZE,
-       HPC1_PBUS_FIFO,
-       HPC1_PBUS_FIFO_SIZE,
-       HPC1_PBUS_BBRAM,
+       .revision =             1,
+       .scsi0_regs =           HPC1_SCSI0_REGS,
+       .scsi0_regs_size =      HPC1_SCSI0_REGS_SIZE,
+       .scsi0_cbp =            HPC1_SCSI0_CBP,
+       .scsi0_ndbp =           HPC1_SCSI0_NDBP,
+       .scsi0_bc =             HPC1_SCSI0_BC,
+       .scsi0_ctl =            HPC1_SCSI0_CTL,
+       .scsi0_gio =            HPC1_SCSI0_GIO,
+       .scsi0_dev =            HPC1_SCSI0_DEV,
+       .scsi0_dmacfg =         HPC1_SCSI0_DMACFG,
+       .scsi0_piocfg =         HPC1_SCSI0_PIOCFG,
+       .scsi1_regs =           HPC1_SCSI1_REGS,
+       .scsi1_regs_size =      HPC1_SCSI1_REGS_SIZE,
+       .scsi1_cbp =            HPC1_SCSI1_CBP,
+       .scsi1_ndbp =           HPC1_SCSI1_NDBP,
+       .scsi1_bc =             HPC1_SCSI1_BC,
+       .scsi1_ctl =            HPC1_SCSI1_CTL,
+       .scsi1_gio =            HPC1_SCSI1_GIO,
+       .scsi1_dev =            HPC1_SCSI1_DEV,
+       .scsi1_dmacfg =         HPC1_SCSI1_DMACFG,
+       .scsi1_piocfg =         HPC1_SCSI1_PIOCFG,
+       .dmactl_dir =           HPC1_DMACTL_DIR,
+       .dmactl_flush =         HPC1_DMACTL_FLUSH,
+       .dmactl_active =        HPC1_DMACTL_ACTIVE,
+       .dmactl_reset =         HPC1_DMACTL_RESET,
+       .enet_regs =            HPC1_ENET_REGS,
+       .enet_regs_size =       HPC1_ENET_REGS_SIZE,
+       .enet_intdelay =        HPC1_ENET_INTDELAY,
+       .enet_intdelayval =     HPC1_ENET_INTDELAYVAL,
+       .enetr_cbp =            HPC1_ENETR_CBP,
+       .enetr_ndbp =           HPC1_ENETR_NDBP,
+       .enetr_bc =             HPC1_ENETR_BC,
+       .enetr_ctl =            HPC1_ENETR_CTL,
+       .enetr_ctl_active =     HPC1_ENETR_CTL_ACTIVE,
+       .enetr_reset =          HPC1_ENETR_RESET,
+       .enetr_dmacfg =         0,
+       .enetr_piocfg =         HPC1_ENETR_PIOCFG,
+       .enetx_cbp =            HPC1_ENETX_CBP,
+       .enetx_ndbp =           HPC1_ENETX_NDBP,
+       .enetx_bc =             HPC1_ENETX_BC,
+       .enetx_ctl =            HPC1_ENETX_CTL,
+       .enetx_ctl_active =     HPC1_ENETX_CTL_ACTIVE,
+       .enetx_dev =            HPC1_ENETX_DEV,
+       .enetr_fifo =           HPC1_ENETR_FIFO,
+       .enetr_fifo_size =      HPC1_ENETR_FIFO_SIZE,
+       .enetx_fifo =           HPC1_ENETX_FIFO,
+       .enetx_fifo_size =      HPC1_ENETX_FIFO_SIZE,
+       .scsi0_devregs_size =   HPC1_SCSI0_DEVREGS_SIZE,
+       .scsi1_devregs_size =   HPC1_SCSI0_DEVREGS_SIZE,
+       .enet_devregs =         HPC1_ENET_DEVREGS,
+       .enet_devregs_size =    HPC1_ENET_DEVREGS_SIZE,
+       .pbus_fifo =            HPC1_PBUS_FIFO,
+       .pbus_fifo_size =       HPC1_PBUS_FIFO_SIZE,
+       .pbus_bbram =           HPC1_PBUS_BBRAM,
 #define MAX_SCSI_XFER   (512*1024)
-       (MAX_SCSI_XFER / 4096),
-       4096,
-       100,
-       (HPC1_DMACTL_ACTIVE | HPC1_DMACTL_DIR),
-       HPC1_DMACTL_ACTIVE,
-       HPC1_DMACTL_FLUSH,
-       HPC1_DMACTL_ACTIVE,
-       HPC1_DMACTL_RESET
+       .scsi_max_xfer =        MAX_SCSI_XFER,
+       .scsi_dma_segs =        (MAX_SCSI_XFER / 4096),
+       .scsi_dma_segs_size =   4096,
+       .clk_freq =             100,
+       .dma_datain_cmd =       (HPC1_DMACTL_ACTIVE | HPC1_DMACTL_DIR),
+       .dma_dataout_cmd =      HPC1_DMACTL_ACTIVE,
+       .scsi_dmactl_flush =    HPC1_DMACTL_FLUSH,
+       .scsi_dmactl_active =   HPC1_DMACTL_ACTIVE,
+       .scsi_dmactl_reset =    HPC1_DMACTL_RESET
 };
 
 static struct hpc_values hpc3_values = {
-       3,
-       HPC_SCSI0_REGS,
-       HPC_SCSI0_REGS_SIZE,
-       HPC_SCSI0_CBP,
-       HPC_SCSI0_NDBP,
-       HPC_SCSI0_BC,
-       HPC_SCSI0_CTL,
-       HPC_SCSI0_GIO,
-       HPC_SCSI0_DEV,
-       HPC_SCSI0_DMACFG,
-       HPC_SCSI0_PIOCFG,
-       HPC_SCSI1_REGS,
-       HPC_SCSI1_REGS_SIZE,
-       HPC_SCSI1_CBP,
-       HPC_SCSI1_NDBP,
-       HPC_SCSI1_BC,
-       HPC_SCSI1_CTL,
-       HPC_SCSI1_GIO,
-       HPC_SCSI1_DEV,
-       HPC_SCSI1_DMACFG,
-       HPC_SCSI1_PIOCFG,
-       HPC_DMACTL_DIR,
-       HPC_DMACTL_FLUSH,
-       HPC_DMACTL_ACTIVE,
-       HPC_DMACTL_RESET,
-       HPC_ENET_REGS,
-       HPC_ENET_REGS_SIZE,
-       0,
-       0,
-       HPC_ENETR_CBP,
-       HPC_ENETR_NDBP,
-       HPC_ENETR_BC,
-       HPC_ENETR_CTL,
-       ENETR_CTL_ACTIVE,
-       HPC_ENETR_RESET,
-       HPC_ENETR_DMACFG,
-       HPC_ENETR_PIOCFG,
-       HPC_ENETX_CBP,
-       HPC_ENETX_NDBP,
-       HPC_ENETX_BC,
-       HPC_ENETX_CTL,
-       ENETX_CTL_ACTIVE,
-       HPC_ENETX_DEV,
-       HPC_ENETR_FIFO,
-       HPC_ENETR_FIFO_SIZE,
-       HPC_ENETX_FIFO,
-       HPC_ENETX_FIFO_SIZE,
-       HPC_SCSI0_DEVREGS_SIZE,
-       HPC_SCSI1_DEVREGS_SIZE,
-       HPC_ENET_DEVREGS,
-       HPC_ENET_DEVREGS_SIZE,
-       HPC_PBUS_FIFO,
-       HPC_PBUS_FIFO_SIZE,
-       HPC_PBUS_BBRAM,
-       (MAX_SCSI_XFER / 8192),
-       8192,
-       100,
-       HPC_DMACTL_ACTIVE,
-       (HPC_DMACTL_ACTIVE | HPC_DMACTL_DIR),
-       HPC_DMACTL_FLUSH,
-       HPC_DMACTL_ACTIVE,
-       HPC_DMACTL_RESET
+       .revision               3,
+       .scsi0_regs =           HPC_SCSI0_REGS,
+       .scsi0_regs_size =      HPC_SCSI0_REGS_SIZE,
+       .scsi0_cbp =            HPC_SCSI0_CBP,
+       .scsi0_ndbp =           HPC_SCSI0_NDBP,
+       .scsi0_bc =             HPC_SCSI0_BC,
+       .scsi0_ctl =            HPC_SCSI0_CTL,
+       .scsi0_gio =            HPC_SCSI0_GIO,
+       .scsi0_dev =            HPC_SCSI0_DEV,
+       .scsi0_dmacfg =         HPC_SCSI0_DMACFG,
+       .scsi0_piocfg =         HPC_SCSI0_PIOCFG,
+       .scsi1_regs =           HPC_SCSI1_REGS,
+       .scsi1_regs_size =      HPC_SCSI1_REGS_SIZE,
+       .scsi1_cbp =            HPC_SCSI1_CBP,
+       .scsi1_ndbp =           HPC_SCSI1_NDBP,
+       .scsi1_bc =             HPC_SCSI1_BC,
+       .scsi1_ctl =            HPC_SCSI1_CTL,
+       .scsi1_gio =            HPC_SCSI1_GIO,
+       .scsi1_dev =            HPC_SCSI1_DEV,
+       .scsi1_dmacfg =         HPC_SCSI1_DMACFG,
+       .scsi1_piocfg =         HPC_SCSI1_PIOCFG,
+       .dmactl_dir =           HPC_DMACTL_DIR,
+       .dmactl_flush =         HPC_DMACTL_FLUSH,
+       .dmactl_active =        HPC_DMACTL_ACTIVE,
+       .dmactl_reset =         HPC_DMACTL_RESET,
+       .enet_regs =            HPC_ENET_REGS,
+       .enet_regs_size =       HPC_ENET_REGS_SIZE,
+       .enet_intdelay =        0,
+       .enet_intdelayval =     0,
+       .enetr_cbp =            HPC_ENETR_CBP,
+       .enetr_ndbp =           HPC_ENETR_NDBP,
+       .enetr_bc =             HPC_ENETR_BC,
+       .enetr_ctl =            HPC_ENETR_CTL,
+       .enetr_ctl_active =     ENETR_CTL_ACTIVE,
+       .enetr_reset =          HPC_ENETR_RESET,
+       .enetr_dmacfg =         HPC_ENETR_DMACFG,
+       .enetr_piocfg =         HPC_ENETR_PIOCFG,
+       .enetx_cbp =            HPC_ENETX_CBP,
+       .enetx_ndbp =           HPC_ENETX_NDBP,
+       .enetx_bc =             HPC_ENETX_BC,



Home | Main Index | Thread Index | Old Index