From 9503323265986354b65af4954a4b1ca2cc8c9d4e Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Mon, 13 Aug 2012 06:19:16 +0000 Subject: get rid of the last foo_lo and foo_hi bits i could find in the hardware structures and use htole64 instead of htole32(addr >> 32); htole32(addr); gets rid of "handy" stack variables to get the dva to 64bits. sprinkle some more byte swaps for things that should have it. tested on a perc5 (xscale) --- sys/dev/ic/mfi.c | 20 ++++++-------------- sys/dev/ic/mfireg.h | 14 +++++--------- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c index 4ce063eedc6..42347aada00 100644 --- a/sys/dev/ic/mfi.c +++ b/sys/dev/ic/mfi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mfi.c,v 1.125 2012/08/13 05:20:30 dlg Exp $ */ +/* $OpenBSD: mfi.c,v 1.126 2012/08/13 06:19:15 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom * @@ -887,7 +887,6 @@ mfi_scsi_io(struct mfi_ccb *ccb, struct scsi_xfer *xs, uint64_t blockno, { struct scsi_link *link = xs->sc_link; struct mfi_io_frame *io; - uint64_t handy; DNPRINTF(MFI_D_CMD, "%s: mfi_scsi_io: %d\n", DEVNAME((struct mfi_softc *)link->adapter_softc), link->target); @@ -907,13 +906,9 @@ mfi_scsi_io(struct mfi_ccb *ccb, struct scsi_xfer *xs, uint64_t blockno, io->mif_header.mfh_timeout = 0; io->mif_header.mfh_flags = 0; io->mif_header.mfh_sense_len = MFI_SENSE_SIZE; - io->mif_header.mfh_data_len= blockcnt; - io->mif_lba_hi = (uint32_t)(blockno >> 32); - io->mif_lba_lo = (uint32_t)(blockno & 0xffffffffull); - - handy = ccb->ccb_psense; - io->mif_sense_addr_hi = htole32((u_int32_t)(handy >> 32)); - io->mif_sense_addr_lo = htole32(handy); + io->mif_header.mfh_data_len = htole32(blockcnt); + io->mif_lba = htole64(blockno); + io->mif_sense_addr = htole64(ccb->ccb_psense); ccb->ccb_done = mfi_scsi_xs_done; ccb->ccb_cookie = xs; @@ -988,7 +983,6 @@ mfi_scsi_ld(struct mfi_ccb *ccb, struct scsi_xfer *xs) { struct scsi_link *link = xs->sc_link; struct mfi_pass_frame *pf; - uint64_t handy; DNPRINTF(MFI_D_CMD, "%s: mfi_scsi_ld: %d\n", DEVNAME((struct mfi_softc *)link->adapter_softc), link->target); @@ -999,12 +993,10 @@ mfi_scsi_ld(struct mfi_ccb *ccb, struct scsi_xfer *xs) pf->mpf_header.mfh_lun_id = 0; pf->mpf_header.mfh_cdb_len = xs->cmdlen; pf->mpf_header.mfh_timeout = 0; - pf->mpf_header.mfh_data_len= xs->datalen; /* XXX */ + pf->mpf_header.mfh_data_len = htole32(xs->datalen); /* XXX */ pf->mpf_header.mfh_sense_len = MFI_SENSE_SIZE; - handy = ccb->ccb_psense; - pf->mpf_sense_addr_hi = htole32((u_int32_t)(handy >> 32)); - pf->mpf_sense_addr_lo = htole32(handy); + pf->mpf_sense_addr = htole64(ccb->ccb_psense); memset(pf->mpf_cdb, 0, 16); memcpy(pf->mpf_cdb, xs->cmd, xs->cmdlen); diff --git a/sys/dev/ic/mfireg.h b/sys/dev/ic/mfireg.h index b6a763c15b6..b32d4f6523b 100644 --- a/sys/dev/ic/mfireg.h +++ b/sys/dev/ic/mfireg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mfireg.h,v 1.31 2012/08/13 03:04:51 dlg Exp $ */ +/* $OpenBSD: mfireg.h,v 1.32 2012/08/13 06:19:15 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom * @@ -316,18 +316,15 @@ struct mfi_init_qinfo { #define MFI_IO_FRAME_SIZE 40 struct mfi_io_frame { struct mfi_frame_header mif_header; - uint32_t mif_sense_addr_lo; - uint32_t mif_sense_addr_hi; - uint32_t mif_lba_lo; - uint32_t mif_lba_hi; + uint64_t mif_sense_addr; + uint64_t mif_lba; union mfi_sgl mif_sgl; } __packed; #define MFI_PASS_FRAME_SIZE 48 struct mfi_pass_frame { struct mfi_frame_header mpf_header; - uint32_t mpf_sense_addr_lo; - uint32_t mpf_sense_addr_hi; + uint64_t mpf_sense_addr; uint8_t mpf_cdb[16]; union mfi_sgl mpf_sgl; } __packed; @@ -344,8 +341,7 @@ struct mfi_abort_frame { struct mfi_frame_header maf_header; uint32_t maf_abort_context; uint32_t maf_pad; - uint32_t maf_abort_mfi_addr_lo; - uint32_t maf_abort_mfi_addr_hi; + uint64_t maf_abort_mfi_addr; uint32_t maf_reserved[6]; } __packed; -- cgit v1.2.3