summaryrefslogtreecommitdiff
path: root/sys/dev/ic
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2012-08-26 11:33:45 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2012-08-26 11:33:45 +0000
commit5f5286de0a0de74ab7e362a34220341aa04be063 (patch)
treef9e78e8300185e417a7e310151187d8a3ed79900 /sys/dev/ic
parent6f7696c116b8de9d1c0673b7529bf7a792ddd56e (diff)
htole64 works as good as htole32 twice for dma virtual addresses.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r--sys/dev/ic/mpi.c27
-rw-r--r--sys/dev/ic/mpireg.h5
2 files changed, 9 insertions, 23 deletions
diff --git a/sys/dev/ic/mpi.c b/sys/dev/ic/mpi.c
index f4503159076..bed852d9400 100644
--- a/sys/dev/ic/mpi.c
+++ b/sys/dev/ic/mpi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpi.c,v 1.175 2012/01/16 10:55:46 dlg Exp $ */
+/* $OpenBSD: mpi.c,v 1.176 2012/08/26 11:33:44 dlg Exp $ */
/*
* Copyright (c) 2005, 2006, 2009 David Gwynne <dlg@openbsd.org>
@@ -801,8 +801,7 @@ mpi_inq(struct mpi_softc *sc, u_int16_t target, int physdisk)
addr = ccb->ccb_cmd_dva +
((u_int8_t *)&bundle->inqbuf - (u_int8_t *)bundle);
- sge->sg_hi_addr = htole32((u_int32_t)(addr >> 32));
- sge->sg_lo_addr = htole32((u_int32_t)addr);
+ sge->sg_addr = htole64(addr);
if (mpi_poll(sc, ccb, 5000) != 0)
return (1);
@@ -1562,10 +1561,7 @@ mpi_load_xs(struct mpi_ccb *ccb)
ce_dva = ccb->ccb_cmd_dva +
((u_int8_t *)nsge - (u_int8_t *)mcb);
- addr = (u_int32_t)(ce_dva >> 32);
- ce->sg_hi_addr = htole32(addr);
- addr = (u_int32_t)ce_dva;
- ce->sg_lo_addr = htole32(addr);
+ ce->sg_addr = htole64(ce_dva);
DNPRINTF(MPI_D_DMA, "%s: ce: 0x%08x 0x%08x 0x%08x\n",
DEVNAME(sc), ce->sg_hdr, ce->sg_hi_addr,
@@ -1581,10 +1577,7 @@ mpi_load_xs(struct mpi_ccb *ccb)
sge = nsge;
sge->sg_hdr = htole32(flags | dmap->dm_segs[i].ds_len);
- addr = (u_int32_t)((u_int64_t)dmap->dm_segs[i].ds_addr >> 32);
- sge->sg_hi_addr = htole32(addr);
- addr = (u_int32_t)dmap->dm_segs[i].ds_addr;
- sge->sg_lo_addr = htole32(addr);
+ sge->sg_addr = htole64(dmap->dm_segs[i].ds_addr);
DNPRINTF(MPI_D_DMA, "%s: %d: 0x%08x 0x%08x 0x%08x\n",
DEVNAME(sc), i, sge->sg_hdr, sge->sg_hi_addr,
@@ -2638,7 +2631,6 @@ mpi_fwupload(struct mpi_softc *sc)
struct mpi_sge sge;
} __packed *bundle;
struct mpi_msg_fwupload_reply *upp;
- u_int64_t addr;
int rv = 0;
if (sc->sc_fw_len == 0)
@@ -2674,9 +2666,7 @@ mpi_fwupload(struct mpi_softc *sc)
bundle->sge.sg_hdr = htole32(MPI_SGE_FL_TYPE_SIMPLE |
MPI_SGE_FL_SIZE_64 | MPI_SGE_FL_LAST | MPI_SGE_FL_EOB |
MPI_SGE_FL_EOL | (u_int32_t)sc->sc_fw_len);
- addr = MPI_DMA_DVA(sc->sc_fw);
- bundle->sge.sg_hi_addr = htole32((u_int32_t)(addr >> 32));
- bundle->sge.sg_lo_addr = htole32((u_int32_t)addr);
+ bundle->sge.sg_addr = htole64(MPI_DMA_DVA(sc->sc_fw));
if (mpi_poll(sc, ccb, 50000) != 0) {
DNPRINTF(MPI_D_MISC, "%s: mpi_cfg_header poll\n", DEVNAME(sc));
@@ -2855,7 +2845,6 @@ mpi_req_cfg_page(struct mpi_softc *sc, u_int32_t address, int flags,
struct mpi_msg_config_reply *cp;
struct mpi_cfg_hdr *hdr = p;
struct mpi_ecfg_hdr *ehdr = p;
- u_int64_t dva;
char *kva;
int page_length;
int rv = 0;
@@ -2901,10 +2890,8 @@ mpi_req_cfg_page(struct mpi_softc *sc, u_int32_t address, int flags,
(read ? MPI_SGE_FL_DIR_IN : MPI_SGE_FL_DIR_OUT));
/* bounce the page via the request space to avoid more bus_dma games */
- dva = ccb->ccb_cmd_dva + sizeof(struct mpi_msg_config_request);
-
- cq->page_buffer.sg_hi_addr = htole32((u_int32_t)(dva >> 32));
- cq->page_buffer.sg_lo_addr = htole32((u_int32_t)dva);
+ cq->page_buffer.sg_addr = htole64(ccb->ccb_cmd_dva +
+ sizeof(struct mpi_msg_config_request));
kva = ccb->ccb_cmd;
kva += sizeof(struct mpi_msg_config_request);
diff --git a/sys/dev/ic/mpireg.h b/sys/dev/ic/mpireg.h
index c6d05c8013b..011bb6bc500 100644
--- a/sys/dev/ic/mpireg.h
+++ b/sys/dev/ic/mpireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mpireg.h,v 1.41 2011/04/27 04:03:11 dlg Exp $ */
+/* $OpenBSD: mpireg.h,v 1.42 2012/08/26 11:33:44 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -126,8 +126,7 @@
struct mpi_sge {
u_int32_t sg_hdr;
- u_int32_t sg_lo_addr;
- u_int32_t sg_hi_addr;
+ u_int64_t sg_addr;
} __packed;
struct mpi_fw_tce {