summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2012-08-13 03:04:52 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2012-08-13 03:04:52 +0000
commitcd9de79efe0c8cb0580311673a2544b2b52bdf20 (patch)
tree1ae03ca1c5daf220554eabd549febd09fce131e0 /sys/dev
parentf8ac143abf00ac209718344852ac1ef541a36006 (diff)
replace uint32_ts for hi and lo addresses in the mfi_init_ hardware
descriptors with single uint64_ts. theyre not some weird middle endian thing. this makes the code more readable. add some missing htole32s to the code while here. tested on a perc5 (xscale).
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/ic/mfi.c48
-rw-r--r--sys/dev/ic/mfireg.h17
2 files changed, 22 insertions, 43 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index 15e95b35a45..f0ab43580ab 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.123 2012/08/11 00:57:01 dlg Exp $ */
+/* $OpenBSD: mfi.c,v 1.124 2012/08/13 03:04:51 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -428,54 +428,38 @@ mfi_initialize_firmware(struct mfi_softc *sc)
struct mfi_ccb *ccb;
struct mfi_init_frame *init;
struct mfi_init_qinfo *qinfo;
- uint64_t handy;
+ int rv;
DNPRINTF(MFI_D_MISC, "%s: mfi_initialize_firmware\n", DEVNAME(sc));
- if ((ccb = mfi_get_ccb(sc)) == NULL)
+ ccb = scsi_io_get(&sc->sc_iopool, 0);
+ if (ccb == NULL)
return (1);
init = &ccb->ccb_frame->mfr_init;
qinfo = (struct mfi_init_qinfo *)((uint8_t *)init + MFI_FRAME_SIZE);
- memset(qinfo, 0, sizeof *qinfo);
- qinfo->miq_rq_entries = sc->sc_max_cmds + 1;
+ memset(qinfo, 0, sizeof(*qinfo));
+ qinfo->miq_rq_entries = htole32(sc->sc_max_cmds + 1);
- handy = MFIMEM_DVA(sc->sc_pcq) +
- offsetof(struct mfi_prod_cons, mpc_reply_q);
- qinfo->miq_rq_addr_hi = htole32(handy >> 32);
- qinfo->miq_rq_addr_lo = htole32(handy);
+ qinfo->miq_rq_addr = htole64(MFIMEM_DVA(sc->sc_pcq) +
+ offsetof(struct mfi_prod_cons, mpc_reply_q));
- handy = MFIMEM_DVA(sc->sc_pcq) +
- offsetof(struct mfi_prod_cons, mpc_producer);
- qinfo->miq_pi_addr_hi = htole32(handy >> 32);
- qinfo->miq_pi_addr_lo = htole32(handy);
+ qinfo->miq_pi_addr = htole64(MFIMEM_DVA(sc->sc_pcq) +
+ offsetof(struct mfi_prod_cons, mpc_producer));
- handy = MFIMEM_DVA(sc->sc_pcq) +
- offsetof(struct mfi_prod_cons, mpc_consumer);
- qinfo->miq_ci_addr_hi = htole32(handy >> 32);
- qinfo->miq_ci_addr_lo = htole32(handy);
+ qinfo->miq_ci_addr = htole64(MFIMEM_DVA(sc->sc_pcq) +
+ offsetof(struct mfi_prod_cons, mpc_consumer));
init->mif_header.mfh_cmd = MFI_CMD_INIT;
- init->mif_header.mfh_data_len = sizeof *qinfo;
- init->mif_qinfo_new_addr_lo = htole32(ccb->ccb_pframe + MFI_FRAME_SIZE);
-
- DNPRINTF(MFI_D_MISC, "%s: entries: %08x%08x rq: %08x%08x pi: %#x "
- "ci: %08x%08x\n",
- DEVNAME(sc),
- qinfo->miq_rq_entries,
- qinfo->miq_rq_addr_hi, qinfo->miq_rq_addr_lo,
- qinfo->miq_pi_addr_hi, qinfo->miq_pi_addr_lo,
- qinfo->miq_ci_addr_hi, qinfo->miq_ci_addr_lo);
+ init->mif_header.mfh_data_len = htole32(sizeof(*qinfo));
+ init->mif_qinfo_new_addr = htole64(ccb->ccb_pframe + MFI_FRAME_SIZE);
- if (mfi_poll(ccb)) {
- printf("%s: mfi_initialize_firmware failed\n", DEVNAME(sc));
- return (1);
- }
+ rv = mfi_poll(ccb);
mfi_put_ccb(sc, ccb);
- return (0);
+ return (rv);
}
int
diff --git a/sys/dev/ic/mfireg.h b/sys/dev/ic/mfireg.h
index 7a6a817ce35..b6a763c15b6 100644
--- a/sys/dev/ic/mfireg.h
+++ b/sys/dev/ic/mfireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfireg.h,v 1.30 2012/01/12 06:12:30 dlg Exp $ */
+/* $OpenBSD: mfireg.h,v 1.31 2012/08/13 03:04:51 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -299,10 +299,8 @@ union mfi_sgl_frame {
struct mfi_init_frame {
struct mfi_frame_header mif_header;
- uint32_t mif_qinfo_new_addr_lo;
- uint32_t mif_qinfo_new_addr_hi;
- uint32_t mif_qinfo_old_addr_lo;
- uint32_t mif_qinfo_old_addr_hi;
+ uint64_t mif_qinfo_new_addr;
+ uint64_t mif_qinfo_old_addr;
uint32_t mif_reserved[6];
} __packed;
@@ -310,12 +308,9 @@ struct mfi_init_frame {
struct mfi_init_qinfo {
uint32_t miq_flags;
uint32_t miq_rq_entries;
- uint32_t miq_rq_addr_lo;
- uint32_t miq_rq_addr_hi;
- uint32_t miq_pi_addr_lo;
- uint32_t miq_pi_addr_hi;
- uint32_t miq_ci_addr_lo;
- uint32_t miq_ci_addr_hi;
+ uint64_t miq_rq_addr;
+ uint64_t miq_pi_addr;
+ uint64_t miq_ci_addr;
} __packed;
#define MFI_IO_FRAME_SIZE 40