Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Fix LP64 issues.



details:   https://anonhg.NetBSD.org/src/rev/5a1e7ec3a179
branches:  trunk
changeset: 540314:5a1e7ec3a179
user:      ad <ad%NetBSD.org@localhost>
date:      Mon Dec 09 15:24:28 2002 +0000

description:
Fix LP64 issues.

diffstat:

 sys/dev/ic/dpt.c    |  35 ++++++++++++++++++-----------------
 sys/dev/ic/dptreg.h |  12 +++++++++++-
 2 files changed, 29 insertions(+), 18 deletions(-)

diffs (149 lines):

diff -r 8b791c2e9b6d -r 5a1e7ec3a179 sys/dev/ic/dpt.c
--- a/sys/dev/ic/dpt.c  Mon Dec 09 14:57:47 2002 +0000
+++ b/sys/dev/ic/dpt.c  Mon Dec 09 15:24:28 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dpt.c,v 1.33 2002/12/07 19:48:32 ad Exp $      */
+/*     $NetBSD: dpt.c,v 1.34 2002/12/09 15:24:28 ad Exp $      */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.33 2002/12/07 19:48:32 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dpt.c,v 1.34 2002/12/09 15:24:28 ad Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -194,7 +194,7 @@
 static void    dpt_ctlrinfo(struct dpt_softc *, struct dpt_eata_ctlrinfo *);
 static void    dpt_hba_inquire(struct dpt_softc *, struct eata_inquiry_data **);
 static void    dpt_minphys(struct buf *);
-static int     dpt_passthrough(struct dpt_softc *, struct eata_cp *,
+static int     dpt_passthrough(struct dpt_softc *, struct eata_ucp *,
                                struct proc *);
 static void    dpt_scsipi_request(struct scsipi_channel *,
                                   scsipi_adapter_req_t, void *);
@@ -1152,7 +1152,7 @@
                if (sc->sc_uactive++)
                        tsleep(&sc->sc_uactive, PRIBIO, "dptslp", 0);
 
-               rv = dpt_passthrough(sc, (struct eata_cp *)data, p);
+               rv = dpt_passthrough(sc, (struct eata_ucp *)data, p);
 
                sc->sc_uactive--;
                wakeup_one(&sc->sc_uactive);
@@ -1258,7 +1258,7 @@
 }
 
 int
-dpt_passthrough(struct dpt_softc *sc, struct eata_cp *ucp, struct proc *proc)
+dpt_passthrough(struct dpt_softc *sc, struct eata_ucp *ucp, struct proc *proc)
 {
        struct dpt_ccb *ccb;
        struct eata_sp sp;
@@ -1266,7 +1266,7 @@
        struct eata_sg *sg;
        bus_dmamap_t xfer;
        bus_dma_segment_t *ds;
-       int datain, s, rv, i;
+       int datain, s, rv, i, uslen;
 
        /*
         * Get a CCB and fill.
@@ -1277,7 +1277,8 @@
        ccb->ccb_savesp = &sp;
 
        cp = &ccb->ccb_eata_cp;
-       memcpy(cp, ucp, sizeof(*cp));
+       memcpy(cp, ucp->ucp_cp, sizeof(ucp->ucp_cp));
+       uslen = cp->cp_senselen;
        cp->cp_ccbid = ccb->ccb_id;
        cp->cp_senselen = sizeof(ccb->ccb_sense);
        cp->cp_senseaddr = htobe32(sc->sc_dmamap->dm_segs[0].ds_addr +
@@ -1287,17 +1288,17 @@
        /*
         * Map data transfers.
         */
-       if (ucp->cp_dataaddr && ucp->cp_datalen) {
+       if (ucp->ucp_dataaddr && ucp->ucp_datalen) {
                xfer = ccb->ccb_dmamap_xfer;
-               datain = ((ucp->cp_ctl0 & CP_C0_DATA_IN) != 0);
+               datain = ((cp->cp_ctl0 & CP_C0_DATA_IN) != 0);
 
-               if (ucp->cp_datalen > DPT_MAX_XFER) {
+               if (ucp->ucp_datalen > DPT_MAX_XFER) {
                        DPRINTF(("%s: xfer too big\n", sc->sc_dv.dv_xname));
                        dpt_ccb_free(sc, ccb);
                        return (EFBIG);
                }
                rv = bus_dmamap_load(sc->sc_dmat, xfer,
-                   (caddr_t)ucp->cp_dataaddr, ucp->cp_datalen, proc,
+                   ucp->ucp_dataaddr, ucp->ucp_datalen, proc,
                    BUS_DMA_WAITOK | BUS_DMA_STREAMING |
                    (datain ? BUS_DMA_READ : BUS_DMA_WRITE));
                if (rv != 0) {
@@ -1314,7 +1315,7 @@
                ds = xfer->dm_segs;
                for (i = 0; i < xfer->dm_nsegs; i++, sg++, ds++) {
                        sg->sg_addr = htobe32(ds->ds_addr);
-                       sg->sg_len =  htobe32(ds->ds_len);
+                       sg->sg_len = htobe32(ds->ds_len);
                }
                cp->cp_dataaddr = htobe32(CCB_OFF(sc, ccb) + 
                    sc->sc_dmamap->dm_segs[0].ds_addr +
@@ -1353,15 +1354,15 @@
                bus_dmamap_unload(sc->sc_dmat, xfer);
        }
 
-       if (ucp->cp_stataddr != NULL) {
-               rv = copyout(&sp, (caddr_t)ucp->cp_stataddr, sizeof(sp));
+       if (ucp->ucp_stataddr != NULL) {
+               rv = copyout(&sp, ucp->ucp_stataddr, sizeof(sp));
                if (rv != 0)
                        DPRINTF(("%s: sp copyout() failed\n",
                            sc->sc_dv.dv_xname));
        }
-       if (rv == 0 && ucp->cp_senseaddr != NULL) {
-               i = min(ucp->cp_senselen, sizeof(ccb->ccb_sense));
-               rv = copyout(&ccb->ccb_sense, (caddr_t)ucp->cp_senseaddr, i);
+       if (rv == 0 && ucp->ucp_senseaddr != NULL) {
+               i = min(uslen, sizeof(ccb->ccb_sense));
+               rv = copyout(&ccb->ccb_sense, ucp->ucp_senseaddr, i);
                if (rv != 0)
                        DPRINTF(("%s: sense copyout() failed\n",
                            sc->sc_dv.dv_xname));
diff -r 8b791c2e9b6d -r 5a1e7ec3a179 sys/dev/ic/dptreg.h
--- a/sys/dev/ic/dptreg.h       Mon Dec 09 14:57:47 2002 +0000
+++ b/sys/dev/ic/dptreg.h       Mon Dec 09 15:24:28 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dptreg.h,v 1.10 2001/04/25 17:53:32 bouyer Exp $       */
+/*     $NetBSD: dptreg.h,v 1.11 2002/12/09 15:24:29 ad Exp $   */
 
 /*
  * Copyright (c) 1999, 2000, 2001 Andrew Doran <ad%netbsd.org@localhost>
@@ -98,6 +98,7 @@
        u_int8_t        cp_cdb_more0[3];        /* SCSI CDB */
        u_int8_t        cp_cdb_len;             /* SCSI CDB */
        u_int8_t        cp_cdb_more1[7];        /* SCSI CDB */
+
        u_int32_t       cp_datalen;             /* Bytes of data/SG list */
        u_int32_t       cp_ccbid;               /* ID of software CCB */
        u_int32_t       cp_dataaddr;            /* Addr of data/SG list */
@@ -105,6 +106,15 @@
        u_int32_t       cp_senseaddr;           /* Addr of req. sense */
 } __attribute__ ((__packed__));
 
+struct eata_ucp {
+       u_int8_t        ucp_cp[sizeof(struct eata_cp) - 5*4];   /* XXX */;
+       u_long          ucp_datalen;
+       u_long          ucp_ccbid;
+       caddr_t         ucp_dataaddr;
+       caddr_t         ucp_stataddr;
+       caddr_t         ucp_senseaddr;
+} __attribute__ ((__packed__));
+
 #define CP_C0_SCSI_RESET       0x01    /* Cause a bus reset */
 #define CP_C0_HBA_INIT         0x02    /* Reinitialize HBA */
 #define CP_C0_AUTO_SENSE       0x04    /* Auto request sense on error */



Home | Main Index | Thread Index | Old Index