Pull up following revision(s) via patch (requested by msaitoh in ticket #1454):

sys/dev/ic/mfi.c: revisions 1.63, 1.66-77
	sys/dev/ic/mfireg.h: revisions 1.11-1.20 via patch
	sys/dev/pci/mfi_pci.c: revision 1.21
	sys/dev/pci/mfii.c: revisions 1.6-1.7, 1.10-1.15
	share/man/man4/mfi.4: revision 1.13

Improve mfi(4) and mfii(4):
- Set 'ld_sync' to NULL as part of 'again', to prevent use-after-free.
- Add some code for the SKINNY variant to make Dell PERC H310 work.
- Print the percentage correctly when the background initialization is
  running.
- Clear mailbox to not to pass garbage data.
- Use union mbox instead of unit8_t xxx[] to avoid unaligned access.
- Set stripe size for BIOCVOL to show the size correctly in bioctl.
- Add support for iBBU-09 to show BBU voltage, current and temperature
  correctly.
- Fix typos in comments.
- Sprinkle static.
- Improve debug printf()s.
- KNF. Remove extra semicolon. Whitespace fixes.
This commit is contained in:
bouyer 2022-05-17 10:33:46 +00:00
parent 0eab68c44d
commit 8f3b8d50ed
5 changed files with 518 additions and 486 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: mfi.4,v 1.11.24.1 2019/09/02 16:39:20 martin Exp $
.\" $NetBSD: mfi.4,v 1.11.24.2 2022/05/17 10:33:46 bouyer Exp $
.\" $OpenBSD: mfi.4,v 1.7 2006/09/01 09:58:09 jmc Exp $
.\"
.\" Written by Marco Peereboom <marco@peereboom.us>
@ -24,7 +24,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd March 22, 2012
.Dd May 5, 2022
.Dt MFI 4
.Os
.Sh NAME
@ -43,7 +43,10 @@ including:
Dell PERC 5/e,
PERC 5/i,
PERC 6/e,
PERC 6/i
PERC 6/i,
PERC H310,
PERC H700,
PERC H800
.It
Intel RAID Controller SRCSAS18E,
SRCSAS144E
@ -56,9 +59,11 @@ MegaRAID SAS 8344ELP,
MegaRAID SAS 8408E,
MegaRAID SAS 8480E,
MegaRAID SAS 8708ELP,
MegaRAID SAS 8888ELP,
MegaRAID SAS 8880EM2,
MegaRAID SAS 9260-8i
MegaRAID SAS 8888ELP,
MegaRAID SAS 9260-8i,
MegaRAID SAS 9261-8i,
MegaRAID SAS 9265-8i
.It
IBM ServeRAID M1015,
ServeRAID M5014

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfi.c,v 1.57.10.1 2018/12/07 17:11:37 martin Exp $ */
/* $NetBSD: mfi.c,v 1.57.10.2 2022/05/17 10:33:46 bouyer Exp $ */
/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
/*
@ -73,7 +73,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.57.10.1 2018/12/07 17:11:37 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.57.10.2 2022/05/17 10:33:46 bouyer Exp $");
#include "bio.h"
@ -154,9 +154,11 @@ static int mfi_scsi_ld_io(struct mfi_ccb *, struct scsipi_xfer *,
static void mfi_scsi_ld_done(struct mfi_ccb *);
static void mfi_scsi_xs_done(struct mfi_ccb *, int, int);
static int mfi_mgmt_internal(struct mfi_softc *, uint32_t,
uint32_t, uint32_t, void *, uint8_t *, bool);
uint32_t, uint32_t, void *, const union mfi_mbox *,
bool);
static int mfi_mgmt(struct mfi_ccb *,struct scsipi_xfer *,
uint32_t, uint32_t, uint32_t, void *, uint8_t *);
uint32_t, uint32_t, uint32_t, void *,
const union mfi_mbox *);
static void mfi_mgmt_done(struct mfi_ccb *);
#if NBIO > 0
@ -439,11 +441,11 @@ mfi_init_ccb(struct mfi_softc *sc)
}
DNPRINTF(MFI_D_CCB,
"ccb(%d): %p frame: %#lx (%#lx) sense: %#lx (%#lx) map: %#lx\n",
"ccb(%d): %p frame: %p (%#lx) sense: %p (%#lx) map: %p\n",
ccb->ccb_frame->mfr_header.mfh_context, ccb,
(u_long)ccb->ccb_frame, (u_long)ccb->ccb_pframe,
(u_long)ccb->ccb_sense, (u_long)ccb->ccb_psense,
(u_long)ccb->ccb_dmamap);
ccb->ccb_frame, (u_long)ccb->ccb_pframe,
ccb->ccb_sense, (u_long)ccb->ccb_psense,
ccb->ccb_dmamap);
/* add ccb to queue */
mfi_put_ccb(ccb);
@ -472,14 +474,14 @@ mfi_read(struct mfi_softc *sc, bus_size_t r)
BUS_SPACE_BARRIER_READ);
rv = bus_space_read_4(sc->sc_iot, sc->sc_ioh, r);
DNPRINTF(MFI_D_RW, "%s: mr 0x%lx 0x08%x ", DEVNAME(sc), (u_long)r, rv);
DNPRINTF(MFI_D_RW, "%s: mr %#zx 0x08%x ", DEVNAME(sc), r, rv);
return rv;
}
static void
mfi_write(struct mfi_softc *sc, bus_size_t r, uint32_t v)
{
DNPRINTF(MFI_D_RW, "%s: mw 0x%lx 0x%08x", DEVNAME(sc), (u_long)r, v);
DNPRINTF(MFI_D_RW, "%s: mw %#zx 0x%08x", DEVNAME(sc), r, v);
bus_space_write_4(sc->sc_iot, sc->sc_ioh, r, v);
bus_space_barrier(sc->sc_iot, sc->sc_ioh, r, 4,
@ -492,8 +494,8 @@ mfi_allocmem(struct mfi_softc *sc, size_t size)
struct mfi_mem *mm;
int nsegs;
DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %ld\n", DEVNAME(sc),
(long)size);
DNPRINTF(MFI_D_MEM, "%s: mfi_allocmem: %zu\n", DEVNAME(sc),
size);
mm = malloc(sizeof(struct mfi_mem), M_DEVBUF, M_NOWAIT|M_ZERO);
if (mm == NULL)
@ -585,7 +587,7 @@ mfi_transition_firmware(struct mfi_softc *sc)
case MFI_STATE_OPERATIONAL:
if (sc->sc_ioptype == MFI_IOP_SKINNY ||
sc->sc_ioptype == MFI_IOP_TBOLT)
mfi_write(sc, MFI_SKINNY_IDB, MFI_INIT_READY);
mfi_write(sc, MFI_SKINNY_IDB, MFI_RESET_FLAGS);
else
mfi_write(sc, MFI_IDB, MFI_INIT_READY);
max_wait = 10;
@ -687,7 +689,6 @@ mfi_get_info(struct mfi_softc *sc)
return 1;
#ifdef MFI_DEBUG
for (i = 0; i < sc->sc_info.mci_image_component_count; i++) {
printf("%s: active FW %s Version %s date %s time %s\n",
DEVNAME(sc),
@ -869,6 +870,7 @@ mfi_get_bbu(struct mfi_softc *sc, struct mfi_bbu_status *stat)
stat->detail.bbu.remaining_capacity ,
stat->detail.bbu.full_charge_capacity ,
stat->detail.bbu.is_SOH_good);
break;
default:
printf("\n");
}
@ -971,20 +973,22 @@ static bool
mfi_shutdown(device_t dev, int how)
{
struct mfi_softc *sc = device_private(dev);
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
int s = splbio();
DNPRINTF(MFI_D_MISC, "%s: mfi_shutdown\n", DEVNAME(sc));
if (sc->sc_running) {
mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
if (mfi_mgmt_internal(sc, MR_DCMD_CTRL_CACHE_FLUSH,
MFI_DATA_NONE, 0, NULL, mbox, true)) {
MFI_DATA_NONE, 0, NULL, &mbox, true)) {
aprint_error_dev(dev, "shutdown: cache flush failed\n");
goto fail;
}
mbox[0] = 0;
mbox.b[0] = 0;
if (mfi_mgmt_internal(sc, MR_DCMD_CTRL_SHUTDOWN,
MFI_DATA_NONE, 0, NULL, mbox, true)) {
MFI_DATA_NONE, 0, NULL, &mbox, true)) {
aprint_error_dev(dev, "shutdown: "
"firmware shutdown failed\n");
goto fail;
@ -1062,13 +1066,15 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
sc->sc_max_sgl = max_sgl;
sc->sc_sgl_size = sizeof(struct mfi_sg32);
}
if (sc->sc_ioptype == MFI_IOP_SKINNY)
sc->sc_sgl_size = sizeof(struct mfi_sg_ieee);
DNPRINTF(MFI_D_MISC, "%s: max commands: %u, max sgl: %u\n",
DEVNAME(sc), sc->sc_max_cmds, sc->sc_max_sgl);
if (sc->sc_ioptype == MFI_IOP_TBOLT) {
uint32_t tb_mem_size;
/* for Alignment */
tb_mem_size = MEGASAS_THUNDERBOLT_MSG_ALLIGNMENT;
tb_mem_size = MEGASAS_THUNDERBOLT_MSG_ALIGNMENT;
tb_mem_size +=
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE * (sc->sc_max_cmds + 1);
@ -1371,8 +1377,7 @@ mfi_intr(void *arg)
pcq = MFIMEM_KVA(sc->sc_pcq);
DNPRINTF(MFI_D_INTR, "%s: mfi_intr %#lx %#lx\n", DEVNAME(sc),
(u_long)sc, (u_long)pcq);
DNPRINTF(MFI_D_INTR, "%s: mfi_intr %p %p\n", DEVNAME(sc), sc, pcq);
bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_pcq), 0,
sizeof(uint32_t) * sc->sc_max_cmds + sizeof(struct mfi_prod_cons),
@ -1476,8 +1481,8 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb, int status, int scsi_status)
struct scsipi_xfer *xs = ccb->ccb_xs;
struct mfi_softc *sc = ccb->ccb_sc;
DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done %#lx %#lx\n",
DEVNAME(sc), (u_long)ccb, (u_long)ccb->ccb_frame);
DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done %p %p\n",
DEVNAME(sc), ccb, ccb->ccb_frame);
if (xs->data != NULL) {
DNPRINTF(MFI_D_INTR, "%s: mfi_scsi_xs_done sync\n",
@ -1500,9 +1505,9 @@ mfi_scsi_xs_done(struct mfi_ccb *ccb, int status, int scsi_status)
ccb->ccb_psense - MFIMEM_DVA(sc->sc_sense),
MFI_SENSE_SIZE, BUS_DMASYNC_POSTREAD);
DNPRINTF(MFI_D_INTR,
"%s: mfi_scsi_xs_done sense %#x %lx %lx\n",
"%s: mfi_scsi_xs_done sense %#x %p %p\n",
DEVNAME(sc), scsi_status,
(u_long)&xs->sense, (u_long)ccb->ccb_sense);
&xs->sense, ccb->ccb_sense);
memset(&xs->sense, 0, sizeof(xs->sense));
memcpy(&xs->sense, ccb->ccb_sense,
sizeof(struct scsi_sense_data));
@ -1579,10 +1584,10 @@ mfi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
struct scsipi_rw_10 *rwb;
struct scsipi_rw_12 *rw12;
struct scsipi_rw_16 *rw16;
union mfi_mbox mbox;
uint64_t blockno;
uint32_t blockcnt;
uint8_t target;
uint8_t mbox[MFI_MBOX_SIZE];
int s;
switch (req) {
@ -1684,9 +1689,10 @@ mfi_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
case SCSI_SYNCHRONIZE_CACHE_10:
case SCSI_SYNCHRONIZE_CACHE_16:
mbox[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = MR_FLUSH_CTRL_CACHE | MR_FLUSH_DISK_CACHE;
if (mfi_mgmt(ccb, xs,
MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, mbox)) {
MR_DCMD_CTRL_CACHE_FLUSH, MFI_DATA_NONE, 0, NULL, &mbox)) {
goto stuffup;
}
break;
@ -1758,8 +1764,8 @@ mfi_create_sgl(struct mfi_ccb *ccb, int flags)
union mfi_sgl *sgl;
int error, i;
DNPRINTF(MFI_D_DMA, "%s: mfi_create_sgl %#lx\n", DEVNAME(sc),
(u_long)ccb->ccb_data);
DNPRINTF(MFI_D_DMA, "%s: mfi_create_sgl %p\n", DEVNAME(sc),
ccb->ccb_data);
if (!ccb->ccb_data)
return 1;
@ -1782,7 +1788,8 @@ mfi_create_sgl(struct mfi_ccb *ccb, int flags)
sgl = ccb->ccb_sgl;
sgd = ccb->ccb_dmamap->dm_segs;
for (i = 0; i < ccb->ccb_dmamap->dm_nsegs; i++) {
if (sc->sc_ioptype == MFI_IOP_TBOLT &&
if (((sc->sc_ioptype == MFI_IOP_SKINNY) ||
(sc->sc_ioptype == MFI_IOP_TBOLT)) &&
(hdr->mfh_cmd == MFI_CMD_PD_SCSI_IO ||
hdr->mfh_cmd == MFI_CMD_LD_READ ||
hdr->mfh_cmd == MFI_CMD_LD_WRITE)) {
@ -1837,7 +1844,7 @@ mfi_create_sgl(struct mfi_ccb *ccb, int flags)
static int
mfi_mgmt_internal(struct mfi_softc *sc, uint32_t opc, uint32_t dir,
uint32_t len, void *buf, uint8_t *mbox, bool poll)
uint32_t len, void *buf, const union mfi_mbox *mbox, bool poll)
{
struct mfi_ccb *ccb;
int rv = 1;
@ -1871,8 +1878,8 @@ done:
}
static int
mfi_mgmt(struct mfi_ccb *ccb, struct scsipi_xfer *xs,
uint32_t opc, uint32_t dir, uint32_t len, void *buf, uint8_t *mbox)
mfi_mgmt(struct mfi_ccb *ccb, struct scsipi_xfer *xs, uint32_t opc,
uint32_t dir, uint32_t len, void *buf, const union mfi_mbox *mbox)
{
struct mfi_dcmd_frame *dcmd;
@ -2035,7 +2042,7 @@ static int
mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
{
int i, per, rv = EINVAL;
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol %#x\n",
DEVNAME(sc), bv->bv_volid);
@ -2045,12 +2052,13 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
goto done;
i = bv->bv_volid;
mbox[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = sc->sc_ld_list.mll_list[i].mll_ld.mld_target;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_vol target %#x\n",
DEVNAME(sc), mbox[0]);
DEVNAME(sc), mbox.b[0]);
if (mfi_mgmt_internal(sc, MR_DCMD_LD_GET_INFO, MFI_DATA_IN,
sizeof(sc->sc_ld_details), &sc->sc_ld_details, mbox, false))
sizeof(sc->sc_ld_details), &sc->sc_ld_details, &mbox, false))
goto done;
if (bv->bv_volid >= sc->sc_ld_list.mll_no_ld) {
@ -2085,7 +2093,6 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
/* additional status can modify MFI status */
switch (sc->sc_ld_details.mld_progress.mlp_in_prog) {
case MFI_LD_PROG_CC:
case MFI_LD_PROG_BGI:
bv->bv_status = BIOC_SVSCRUB;
per = (int)sc->sc_ld_details.mld_progress.mlp_cc.mp_progress;
bv->bv_percent = (per * 100) / 0xffff;
@ -2093,6 +2100,14 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
sc->sc_ld_details.mld_progress.mlp_cc.mp_elapsed_seconds;
break;
case MFI_LD_PROG_BGI:
bv->bv_status = BIOC_SVSCRUB;
per = (int)sc->sc_ld_details.mld_progress.mlp_bgi.mp_progress;
bv->bv_percent = (per * 100) / 0xffff;
bv->bv_seconds =
sc->sc_ld_details.mld_progress.mlp_bgi.mp_elapsed_seconds;
break;
case MFI_LD_PROG_FGI:
case MFI_LD_PROG_RECONSTRUCT:
/* nothing yet */
@ -2101,7 +2116,7 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
/*
* The RAID levels are determined per the SNIA DDF spec, this is only
* a subset that is valid for the MFI contrller.
* a subset that is valid for the MFI controller.
*/
bv->bv_level = sc->sc_ld_details.mld_cfg.mlc_parm.mpa_pri_raid;
if (sc->sc_ld_details.mld_cfg.mlc_parm.mpa_sec_raid ==
@ -2112,6 +2127,9 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
sc->sc_ld_details.mld_cfg.mlc_parm.mpa_span_depth;
bv->bv_size = sc->sc_ld_details.mld_size * 512; /* bytes per block */
bv->bv_stripe_size =
(512 << sc->sc_ld_details.mld_cfg.mlc_parm.mpa_stripe_size)
/ 1024; /* in KB */
rv = 0;
done:
@ -2132,7 +2150,7 @@ mfi_ioctl_disk(struct mfi_softc *sc, struct bioc_disk *bd)
int i, rv = EINVAL;
int arr, vol, disk;
uint32_t size;
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_disk %#x\n",
DEVNAME(sc), bd->bd_diskid);
@ -2209,14 +2227,14 @@ mfi_ioctl_disk(struct mfi_softc *sc, struct bioc_disk *bd)
default:
bd->bd_status = BIOC_SDINVALID;
break;
}
/* get the remaining fields */
*((uint16_t *)&mbox) = ar[arr].pd[disk].mar_pd.mfp_id;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = ar[arr].pd[disk].mar_pd.mfp_id;
memset(pd, 0, sizeof(*pd));
if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_INFO, MFI_DATA_IN,
sizeof *pd, pd, mbox, false))
sizeof *pd, pd, &mbox, false))
goto freeme;
bd->bd_size = pd->mpd_size * 512; /* bytes per block */
@ -2290,7 +2308,7 @@ static int
mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *bb)
{
int i, found, rv = EINVAL;
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
uint32_t cmd;
struct mfi_pd_list *pd;
@ -2301,10 +2319,10 @@ mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *bb)
if (bb->bb_channel == 0)
return EINVAL;
pd = malloc(MFI_PD_LIST_SIZE, M_DEVBUF, M_WAITOK);
pd = malloc(sizeof(*pd), M_DEVBUF, M_WAITOK);
if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN,
MFI_PD_LIST_SIZE, pd, NULL, false))
sizeof(*pd), pd, NULL, false))
goto done;
for (i = 0, found = 0; i < pd->mpl_no_pd; i++)
@ -2317,9 +2335,8 @@ mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *bb)
if (!found)
goto done;
memset(mbox, 0, sizeof mbox);
*((uint16_t *)&mbox) = pd->mpl_address[i].mpa_pd_id;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pd->mpl_address[i].mpa_pd_id;
switch (bb->bb_status) {
case BIOC_SBUNBLINK:
@ -2338,7 +2355,7 @@ mfi_ioctl_blink(struct mfi_softc *sc, struct bioc_blink *bb)
}
if (mfi_mgmt_internal(sc, cmd, MFI_DATA_NONE, 0, NULL, mbox, false))
if (mfi_mgmt_internal(sc, cmd, MFI_DATA_NONE, 0, NULL, &mbox, false))
goto done;
rv = 0;
@ -2352,15 +2369,15 @@ mfi_ioctl_setstate(struct mfi_softc *sc, struct bioc_setstate *bs)
{
struct mfi_pd_list *pd;
int i, found, rv = EINVAL;
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_ioctl_setstate %x\n", DEVNAME(sc),
bs->bs_status);
pd = malloc(MFI_PD_LIST_SIZE, M_DEVBUF, M_WAITOK);
pd = malloc(sizeof(*pd), M_DEVBUF, M_WAITOK);
if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_LIST, MFI_DATA_IN,
MFI_PD_LIST_SIZE, pd, NULL, false))
sizeof(*pd), pd, NULL, false))
goto done;
for (i = 0, found = 0; i < pd->mpl_no_pd; i++)
@ -2373,21 +2390,20 @@ mfi_ioctl_setstate(struct mfi_softc *sc, struct bioc_setstate *bs)
if (!found)
goto done;
memset(mbox, 0, sizeof mbox);
*((uint16_t *)&mbox) = pd->mpl_address[i].mpa_pd_id;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = pd->mpl_address[i].mpa_pd_id;
switch (bs->bs_status) {
case BIOC_SSONLINE:
mbox[2] = MFI_PD_ONLINE;
mbox.b[4] = MFI_PD_ONLINE;
break;
case BIOC_SSOFFLINE:
mbox[2] = MFI_PD_OFFLINE;
mbox.b[4] = MFI_PD_OFFLINE;
break;
case BIOC_SSHOTSPARE:
mbox[2] = MFI_PD_HOTSPARE;
mbox.b[4] = MFI_PD_HOTSPARE;
break;
/*
case BIOC_SSREBUILD:
@ -2401,7 +2417,7 @@ mfi_ioctl_setstate(struct mfi_softc *sc, struct bioc_setstate *bs)
if (mfi_mgmt_internal(sc, MR_DCMD_PD_SET_STATE, MFI_DATA_NONE,
0, NULL, mbox, false))
0, NULL, &mbox, false))
goto done;
rv = 0;
@ -2422,7 +2438,7 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs)
char vend[8+16+4+1];
int i, rv = EINVAL;
uint32_t size;
uint8_t mbox[MFI_MBOX_SIZE];
union mfi_mbox mbox;
DNPRINTF(MFI_D_IOCTL, "%s: mfi_vol_hs %d\n", DEVNAME(sc), volid);
@ -2466,10 +2482,10 @@ mfi_bio_hs(struct mfi_softc *sc, int volid, int type, void *bio_hs)
cfg->mfc_no_hs, hs, cfg, hs[i].mhs_pd.mfp_id);
/* get pd fields */
memset(mbox, 0, sizeof mbox);
*((uint16_t *)&mbox) = hs[i].mhs_pd.mfp_id;
memset(&mbox, 0, sizeof(mbox));
mbox.s[0] = hs[i].mhs_pd.mfp_id;
if (mfi_mgmt_internal(sc, MR_DCMD_PD_GET_INFO, MFI_DATA_IN,
sizeof *pd, pd, mbox, false)) {
sizeof *pd, pd, &mbox, false)) {
DNPRINTF(MFI_D_IOCTL, "%s: mfi_vol_hs illegal PD\n",
DEVNAME(sc));
goto freeme;
@ -2931,7 +2947,7 @@ mfi_tbolt_init_desc_pool(struct mfi_softc *sc)
uint32_t offset = 0;
uint8_t *addr = MFIMEM_KVA(sc->sc_tbolt_reqmsgpool);
/* Request Decriptors alignment restrictions */
/* Request Descriptors alignment restrictions */
KASSERT(((uintptr_t)addr & 0xFF) == 0);
/* Skip request message pool */
@ -3283,8 +3299,8 @@ mfi_tbolt_create_sgl(struct mfi_ccb *ccb, int flags)
/* One element to store the chain info */
sge_idx = MEGASAS_THUNDERBOLT_MAX_SGE_IN_MAINMSG - 1;
DNPRINTF(MFI_D_DMA,
"mfi sge_idx %d sge_count %d io_req paddr 0x%" PRIx64 "\n",
sge_idx, sge_count, ccb->ccb_tb_pio_request);
"mfi sge_idx %d sge_count %d io_req paddr %jx\n",
sge_idx, sge_count, (uintmax_t)ccb->ccb_tb_pio_request);
} else {
sge_idx = sge_count;
}
@ -3373,7 +3389,7 @@ mfi_tbolt_create_sgl(struct mfi_ccb *ccb, int flags)
* interrupt thread.
*
* The driver could get the RAID state via the MFI_DCMD_LD_MAP_GET_INFO
* That requires a bunch of structure and it is simplier to just do
* That requires a bunch of structure and it is simpler to just do
* the MFI_DCMD_LD_GET_LIST versus walking the RAID map.
*/
@ -3383,13 +3399,14 @@ mfi_tbolt_sync_map_info(struct work *w, void *v)
struct mfi_softc *sc = v;
int i;
struct mfi_ccb *ccb = NULL;
uint8_t mbox[MFI_MBOX_SIZE];
struct mfi_ld *ld_sync = NULL;
union mfi_mbox mbox;
struct mfi_ld *ld_sync;
size_t ld_size;
int s;
DNPRINTF(MFI_D_SYNC, "%s: mfi_tbolt_sync_map_info\n", DEVNAME(sc));
again:
ld_sync = NULL;
s = splbio();
if (sc->sc_ldsync_ccb != NULL) {
splx(s);
@ -3419,11 +3436,11 @@ again:
}
sc->sc_ldsync_ccb = ccb;
memset(mbox, 0, MFI_MBOX_SIZE);
mbox[0] = sc->sc_ld_list.mll_no_ld;
mbox[1] = MFI_DCMD_MBOX_PEND_FLAG;
memset(&mbox, 0, sizeof(mbox));
mbox.b[0] = sc->sc_ld_list.mll_no_ld;
mbox.b[1] = MFI_DCMD_MBOX_PEND_FLAG;
if (mfi_mgmt(ccb, NULL, MR_DCMD_LD_MAP_GET_INFO, MFI_DATA_OUT,
ld_size, ld_sync, mbox)) {
ld_size, ld_sync, &mbox)) {
aprint_error_dev(sc->sc_dev, "Failed to create sync command\n");
goto err;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfireg.h,v 1.8.30.1 2018/12/07 17:11:37 martin Exp $ */
/* $NetBSD: mfireg.h,v 1.8.30.2 2022/05/17 10:33:46 bouyer Exp $ */
/* $OpenBSD: mfireg.h,v 1.24 2006/06/19 19:05:45 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
@ -125,11 +125,12 @@
#define MFI_STATE_TB_FAULT 0x40000000
/* command reset register */
#define MFI_INIT_ABORT 0x00000000
#define MFI_INIT_ABORT 0x00000001
#define MFI_INIT_READY 0x00000002
#define MFI_INIT_MFIMODE 0x00000004
#define MFI_INIT_CLEAR_HANDSHAKE 0x00000008
#define MFI_RESET_FLAGS MFI_INIT_READY|MFI_INIT_MFIMODE
#define MFI_RESET_FLAGS MFI_INIT_READY | MFI_INIT_MFIMODE | \
MFI_INIT_ABORT
#define MFI_INIT_HOTPLUG 0x00000010
/* ADP reset flags */
@ -159,7 +160,7 @@
*/
#define MR_COMMAND_SIZE (MFI_FRAME_SIZE*20) /* 1280 bytes */
#define MEGASAS_THUNDERBOLT_MSG_ALLIGNMENT 256
#define MEGASAS_THUNDERBOLT_MSG_ALIGNMENT 256
/*
* We are defining only 128 byte message to reduce memory move over head
* and also it will reduce the SRB extension size by 128byte compared with
@ -173,7 +174,7 @@
#define MEGASAS_MAX_SZ_CHAIN_FRAME 1024
/*
* Calculating how many SGEs allowed in a allocated main message
* Calculating how many SGEs allowed in an allocated main message
* (size of the Message - Raid SCSI IO message size(except SGE))
* / size of SGE
* (0x100 - (0x90 - 0x10)) / 0x10 = 8
@ -184,7 +185,7 @@
) / sizeof(mpi2_sge_io_union))
/*
* (Command frame size allocaed in SRB ext - Raid SCSI IO message size)
* (Command frame size allocated in SRB ext - Raid SCSI IO message size)
* / size of SGL ;
* (1280 - 256) / 16 = 64
*/
@ -413,6 +414,7 @@ typedef enum {
#define MFI_MAX_LD 64
#define MFI_MAX_SPAN 8
#define MFI_MAX_ARRAY_DEDICATED 16
#define MFI_MAX_PD 256
/* sense buffer */
struct mfi_sense {
@ -770,7 +772,7 @@ struct mfi_ctrl_props {
uint8_t loadBalanceMode;
/*
* 0 - use auto detect logic of backplanes like SGPIO, i2c SEP using
* h/w mechansim like GPIO pins
* h/w mechanism like GPIO pins
* 1 - disable auto detect SGPIO,
* 2 - disable i2c SEP auto detect
* 3 - disable both auto detect
@ -806,7 +808,8 @@ struct mfi_ctrl_props {
} OnOffProperties;
/*
* % of source LD to be reserved for auto snapshot in snapshot
* repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so on.
* repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so
* on.
*/
uint8_t autoSnapVDSpace;
/*
@ -828,7 +831,7 @@ struct mfi_info_pci {
uint8_t mip_reserved[24];
} __packed;
/* host interface infor */
/* host interface info */
struct mfi_info_host {
uint8_t mih_type;
#define MFI_INFO_HOST_PCIX 0x01
@ -982,11 +985,11 @@ struct mfi_ld_list {
uint8_t mll_res2;
uint8_t mll_res3;
uint8_t mll_res4;
u_quad_t mll_size;
uint64_t mll_size;
} mll_list[MFI_MAX_LD];
} __packed;
/* logicl disk details from MR_DCMD_LD_GET_INFO */
/* logical disk details from MR_DCMD_LD_GET_INFO */
struct mfi_ld_prop {
struct mfi_ld mlp_ld;
char mlp_name[16];
@ -1029,8 +1032,8 @@ struct mfi_ld_parm {
} __packed;
struct mfi_ld_span {
u_quad_t mls_start_block;
u_quad_t mls_no_blocks;
uint64_t mls_start_block;
uint64_t mls_no_blocks;
uint16_t mls_index;
uint8_t mls_res[6];
} __packed;
@ -1056,7 +1059,7 @@ struct mfi_ld_progress {
struct mfi_ld_details {
struct mfi_ld_cfg mld_cfg;
u_quad_t mld_size;
uint64_t mld_size;
struct mfi_ld_progress mld_progress;
uint16_t mld_clust_own_id;
uint8_t mld_res1;
@ -1073,16 +1076,14 @@ struct mfi_pd_address {
uint8_t mpa_enc_slot;
uint8_t mpa_scsi_type;
uint8_t mpa_port;
u_quad_t mpa_sas_address[2];
uint64_t mpa_sas_address[2];
} __packed;
#define MFI_MAX_PD 256
struct mfi_pd_list {
uint32_t mpl_size;
uint32_t mpl_no_pd;
struct mfi_pd_address mpl_address[MFI_MAX_PD];
} __packed;
#define MFI_PD_LIST_SIZE (sizeof(struct mfi_pd_list))
struct mfi_pd {
uint16_t mfp_id;
@ -1105,7 +1106,7 @@ struct mfi_pd_details {
uint8_t mpd_inq_data[96];
uint8_t mpd_inq_page83[64];
uint8_t mpd_no_support;
uint8_t mpd_scsy_type;
uint8_t mpd_scsi_type;
uint8_t mpd_port;
uint8_t mpd_speed;
uint32_t mpd_mediaerr_cnt;
@ -1131,11 +1132,11 @@ struct mfi_pd_details {
uint8_t mpp_cnt;
uint8_t mpp_severed;
uint8_t mpp_res[6];
u_quad_t mpp_sas_addr[4];
uint64_t mpp_sas_addr[4];
} __packed mpd_path;
u_quad_t mpd_size;
u_quad_t mpd_no_coerce_size;
u_quad_t mpd_coerce_size;
uint64_t mpd_size;
uint64_t mpd_no_coerce_size;
uint64_t mpd_coerce_size;
uint16_t mpd_enc_id;
uint8_t mpd_enc_idx;
uint8_t mpd_enc_slot;
@ -1145,9 +1146,9 @@ struct mfi_pd_details {
uint8_t mpd_res[218]; /* size is 512 */
} __packed;
/* array configuration from MD_DCMD_CONF_GET */
/* array configuration from MR_DCMD_CONF_GET */
struct mfi_array {
u_quad_t mar_smallest_pd;
uint64_t mar_smallest_pd;
uint8_t mar_no_disk;
uint8_t mar_res1;
uint16_t mar_array_ref;
@ -1170,6 +1171,39 @@ struct mfi_array {
} pd[MFI_MAX_PD_ARRAY];
} __packed;
struct mfi_hotspare {
struct mfi_pd mhs_pd;
uint8_t mhs_type;
#define MFI_PD_HS_DEDICATED 0x01
#define MFI_PD_HS_REVERTIBLE 0x02
#define MFI_PD_HS_ENC_AFFINITY 0x04
uint8_t mhs_res[2];
uint8_t mhs_array_max;
uint16_t mhs_array_ref[MFI_MAX_ARRAY_DEDICATED];
} __packed;
struct mfi_conf {
uint32_t mfc_size;
uint16_t mfc_no_array;
uint16_t mfc_array_size;
uint16_t mfc_no_ld;
uint16_t mfc_ld_size;
uint16_t mfc_no_hs;
uint16_t mfc_hs_size;
uint8_t mfc_res[16];
/*
* XXX this is a ridiculous hack and does not reflect reality
* Structures are actually indexed and therefore need pointer
* math to reach. We need the size of this structure first so
* call it with the size of this structure and then use the returned
* values to allocate memory and do the transfer of the whole structure
* then calculate pointers to each of these structures.
*/
struct mfi_array mfc_array[1];
struct mfi_ld_cfg mfc_ld[1];
struct mfi_hotspare mfc_hs[1];
} __packed;
/* informations from MR_DCMD_BBU_GET_CAPACITY_INFO */
struct mfi_bbu_capacity_info {
uint16_t relative_charge;
@ -1233,10 +1267,11 @@ struct mfi_bbu_status {
#define MFI_BBU_TYPE_NONE 0
#define MFI_BBU_TYPE_IBBU 1
#define MFI_BBU_TYPE_BBU 2
#define MFI_BBU_TYPE_IBBU09 5
uint8_t reserved;
uint16_t voltage;
int16_t current;
uint16_t temperature;
uint16_t voltage; /* mV */
int16_t current; /* mA */
uint16_t temperature; /* degC */
uint32_t fw_status;
#define MFI_BBU_STATE_PACK_MISSING (1 << 0)
#define MFI_BBU_STATE_VOLTAGE_LOW (1 << 1)
@ -1267,43 +1302,10 @@ struct mfi_bbu_status {
union mfi_bbu_status_detail detail;
} __packed;
struct mfi_hotspare {
struct mfi_pd mhs_pd;
uint8_t mhs_type;
#define MFI_PD_HS_DEDICATED 0x01
#define MFI_PD_HS_REVERTIBLE 0x02
#define MFI_PD_HS_ENC_AFFINITY 0x04
uint8_t mhs_res[2];
uint8_t mhs_array_max;
uint16_t mhs_array_ref[MFI_MAX_ARRAY_DEDICATED];
} __packed;
struct mfi_conf {
uint32_t mfc_size;
uint16_t mfc_no_array;
uint16_t mfc_array_size;
uint16_t mfc_no_ld;
uint16_t mfc_ld_size;
uint16_t mfc_no_hs;
uint16_t mfc_hs_size;
uint8_t mfc_res[16];
/*
* XXX this is a ridiculous hack and does not reflect reality
* Structures are actually indexed and therefore need pointer
* math to reach. We need the size of this structure first so
* call it with the size of this structure and then use the returned
* values to allocate memory and do the transfer of the whole structure
* then calculate pointers to each of these structures.
*/
struct mfi_array mfc_array[1];
struct mfi_ld_cfg mfc_ld[1];
struct mfi_hotspare mfc_hs[1];
} __packed;
/* ThunderBolt support */
/*
* Raid Context structure which describes MegaRAID specific IO Paramenters
* Raid Context structure which describes MegaRAID specific IO Parameters
* This resides at offset 0x60 where the SGL normally starts in MPT IO Frames
*/
typedef struct _mpi2_scsi_io_vendor_unique {

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfi_pci.c,v 1.19 2016/07/14 04:00:46 msaitoh Exp $ */
/* $NetBSD: mfi_pci.c,v 1.19.10.1 2022/05/17 10:33:46 bouyer Exp $ */
/* $OpenBSD: mfi_pci.c,v 1.11 2006/08/06 04:40:08 brad Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.19 2016/07/14 04:00:46 msaitoh Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfi_pci.c,v 1.19.10.1 2022/05/17 10:33:46 bouyer Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -99,6 +99,7 @@ static const struct mfi_pci_subtype mfi_gen2_subtypes[] = {
static const struct mfi_pci_subtype mfi_skinny_subtypes[] = {
{ PCI_VENDOR_IBM, 0x03b1, "IBM ServeRAID M1015 SAS/SATA" },
{ PCI_VENDOR_DELL, 0x1f78, "Dell PERC H310" },
{ 0x0, 0, "" }
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin Exp $ */
/* $NetBSD: mfii.c,v 1.3.2.5 2022/05/17 10:33:46 bouyer Exp $ */
/* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
/*
@ -18,7 +18,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.5 2022/05/17 10:33:46 bouyer Exp $");
#include "bio.h"
@ -384,11 +384,11 @@ uint32_t mfii_debug = 0
#define DNPRINTF(n,x...)
#endif
int mfii_match(device_t, cfdata_t, void *);
void mfii_attach(device_t, device_t, void *);
int mfii_detach(device_t, int);
int mfii_rescan(device_t, const char *, const int *);
void mfii_childdetached(device_t, device_t);
static int mfii_match(device_t, cfdata_t, void *);
static void mfii_attach(device_t, device_t, void *);
static int mfii_detach(device_t, int);
static int mfii_rescan(device_t, const char *, const int *);
static void mfii_childdetached(device_t, device_t);
static bool mfii_suspend(device_t, const pmf_qual_t *);
static bool mfii_resume(device_t, const pmf_qual_t *);
static bool mfii_shutdown(device_t, int);
@ -398,94 +398,91 @@ CFATTACH_DECL3_NEW(mfii, sizeof(struct mfii_softc),
mfii_match, mfii_attach, mfii_detach, NULL, mfii_rescan,
mfii_childdetached, DVF_DETACH_SHUTDOWN);
void mfii_scsipi_request(struct scsipi_channel *,
static void mfii_scsipi_request(struct scsipi_channel *,
scsipi_adapter_req_t, void *);
void mfii_scsi_cmd_done(struct mfii_softc *, struct mfii_ccb *);
static void mfii_scsi_cmd_done(struct mfii_softc *, struct mfii_ccb *);
#define DEVNAME(_sc) (device_xname((_sc)->sc_dev))
static u_int32_t mfii_read(struct mfii_softc *, bus_size_t);
static void mfii_write(struct mfii_softc *, bus_size_t, u_int32_t);
struct mfii_dmamem * mfii_dmamem_alloc(struct mfii_softc *, size_t);
void mfii_dmamem_free(struct mfii_softc *,
static struct mfii_dmamem * mfii_dmamem_alloc(struct mfii_softc *, size_t);
static void mfii_dmamem_free(struct mfii_softc *,
struct mfii_dmamem *);
struct mfii_ccb * mfii_get_ccb(struct mfii_softc *);
void mfii_put_ccb(struct mfii_softc *, struct mfii_ccb *);
int mfii_init_ccb(struct mfii_softc *);
void mfii_scrub_ccb(struct mfii_ccb *);
static struct mfii_ccb * mfii_get_ccb(struct mfii_softc *);
static void mfii_put_ccb(struct mfii_softc *, struct mfii_ccb *);
static int mfii_init_ccb(struct mfii_softc *);
static void mfii_scrub_ccb(struct mfii_ccb *);
int mfii_transition_firmware(struct mfii_softc *);
int mfii_initialise_firmware(struct mfii_softc *);
int mfii_get_info(struct mfii_softc *);
static int mfii_transition_firmware(struct mfii_softc *);
static int mfii_initialise_firmware(struct mfii_softc *);
static int mfii_get_info(struct mfii_softc *);
void mfii_start(struct mfii_softc *, struct mfii_ccb *);
void mfii_done(struct mfii_softc *, struct mfii_ccb *);
int mfii_poll(struct mfii_softc *, struct mfii_ccb *);
void mfii_poll_done(struct mfii_softc *, struct mfii_ccb *);
int mfii_exec(struct mfii_softc *, struct mfii_ccb *);
void mfii_exec_done(struct mfii_softc *, struct mfii_ccb *);
int mfii_my_intr(struct mfii_softc *);
int mfii_intr(void *);
void mfii_postq(struct mfii_softc *);
static void mfii_start(struct mfii_softc *, struct mfii_ccb *);
static void mfii_done(struct mfii_softc *, struct mfii_ccb *);
static int mfii_poll(struct mfii_softc *, struct mfii_ccb *);
static void mfii_poll_done(struct mfii_softc *, struct mfii_ccb *);
static int mfii_exec(struct mfii_softc *, struct mfii_ccb *);
static void mfii_exec_done(struct mfii_softc *, struct mfii_ccb *);
static int mfii_my_intr(struct mfii_softc *);
static int mfii_intr(void *);
static void mfii_postq(struct mfii_softc *);
int mfii_load_ccb(struct mfii_softc *, struct mfii_ccb *,
static int mfii_load_ccb(struct mfii_softc *, struct mfii_ccb *,
void *, int);
int mfii_load_mfa(struct mfii_softc *, struct mfii_ccb *,
static int mfii_load_mfa(struct mfii_softc *, struct mfii_ccb *,
void *, int);
int mfii_mfa_poll(struct mfii_softc *, struct mfii_ccb *);
static int mfii_mfa_poll(struct mfii_softc *, struct mfii_ccb *);
int mfii_mgmt(struct mfii_softc *, uint32_t,
static int mfii_mgmt(struct mfii_softc *, uint32_t,
const union mfi_mbox *, void *, size_t,
mfii_direction_t, bool);
int mfii_do_mgmt(struct mfii_softc *, struct mfii_ccb *,
static int mfii_do_mgmt(struct mfii_softc *, struct mfii_ccb *,
uint32_t, const union mfi_mbox *, void *, size_t,
mfii_direction_t, bool);
void mfii_empty_done(struct mfii_softc *, struct mfii_ccb *);
static void mfii_empty_done(struct mfii_softc *, struct mfii_ccb *);
int mfii_scsi_cmd_io(struct mfii_softc *,
static int mfii_scsi_cmd_io(struct mfii_softc *,
struct mfii_ccb *, struct scsipi_xfer *);
int mfii_scsi_cmd_cdb(struct mfii_softc *,
static int mfii_scsi_cmd_cdb(struct mfii_softc *,
struct mfii_ccb *, struct scsipi_xfer *);
void mfii_scsi_cmd_tmo(void *);
static void mfii_scsi_cmd_tmo(void *);
int mfii_dev_handles_update(struct mfii_softc *sc);
void mfii_dev_handles_dtor(void *, void *);
void mfii_abort_task(struct work *, void *);
void mfii_abort(struct mfii_softc *, struct mfii_ccb *,
static void mfii_abort_task(struct work *, void *);
static void mfii_abort(struct mfii_softc *, struct mfii_ccb *,
uint16_t, uint16_t, uint8_t, uint32_t);
void mfii_scsi_cmd_abort_done(struct mfii_softc *,
static void mfii_scsi_cmd_abort_done(struct mfii_softc *,
struct mfii_ccb *);
int mfii_aen_register(struct mfii_softc *);
void mfii_aen_start(struct mfii_softc *, struct mfii_ccb *,
static int mfii_aen_register(struct mfii_softc *);
static void mfii_aen_start(struct mfii_softc *, struct mfii_ccb *,
struct mfii_dmamem *, uint32_t);
void mfii_aen_done(struct mfii_softc *, struct mfii_ccb *);
void mfii_aen(struct work *, void *);
void mfii_aen_unregister(struct mfii_softc *);
static void mfii_aen_done(struct mfii_softc *, struct mfii_ccb *);
static void mfii_aen(struct work *, void *);
static void mfii_aen_unregister(struct mfii_softc *);
void mfii_aen_pd_insert(struct mfii_softc *,
static void mfii_aen_pd_insert(struct mfii_softc *,
const struct mfi_evtarg_pd_address *);
void mfii_aen_pd_remove(struct mfii_softc *,
static void mfii_aen_pd_remove(struct mfii_softc *,
const struct mfi_evtarg_pd_address *);
void mfii_aen_pd_state_change(struct mfii_softc *,
static void mfii_aen_pd_state_change(struct mfii_softc *,
const struct mfi_evtarg_pd_state *);
void mfii_aen_ld_update(struct mfii_softc *);
static void mfii_aen_ld_update(struct mfii_softc *);
#if NBIO > 0
int mfii_ioctl(device_t, u_long, void *);
int mfii_ioctl_inq(struct mfii_softc *, struct bioc_inq *);
int mfii_ioctl_vol(struct mfii_softc *, struct bioc_vol *);
int mfii_ioctl_disk(struct mfii_softc *, struct bioc_disk *);
int mfii_ioctl_alarm(struct mfii_softc *, struct bioc_alarm *);
int mfii_ioctl_blink(struct mfii_softc *sc, struct bioc_blink *);
int mfii_ioctl_setstate(struct mfii_softc *,
static int mfii_ioctl(device_t, u_long, void *);
static int mfii_ioctl_inq(struct mfii_softc *, struct bioc_inq *);
static int mfii_ioctl_vol(struct mfii_softc *, struct bioc_vol *);
static int mfii_ioctl_disk(struct mfii_softc *, struct bioc_disk *);
static int mfii_ioctl_alarm(struct mfii_softc *, struct bioc_alarm *);
static int mfii_ioctl_blink(struct mfii_softc *sc, struct bioc_blink *);
static int mfii_ioctl_setstate(struct mfii_softc *,
struct bioc_setstate *);
int mfii_bio_hs(struct mfii_softc *, int, int, void *);
int mfii_bio_getitall(struct mfii_softc *);
static int mfii_bio_hs(struct mfii_softc *, int, int, void *);
static int mfii_bio_getitall(struct mfii_softc *);
#endif /* NBIO > 0 */
#if 0
@ -506,13 +503,13 @@ static const char *mfi_bbu_indicators[] = {
};
#endif
void mfii_init_ld_sensor(struct mfii_softc *, envsys_data_t *, int);
void mfii_refresh_ld_sensor(struct mfii_softc *, envsys_data_t *);
static void mfii_init_ld_sensor(struct mfii_softc *, envsys_data_t *, int);
static void mfii_refresh_ld_sensor(struct mfii_softc *, envsys_data_t *);
static void mfii_attach_sensor(struct mfii_softc *, envsys_data_t *);
int mfii_create_sensors(struct mfii_softc *);
static int mfii_create_sensors(struct mfii_softc *);
static int mfii_destroy_sensors(struct mfii_softc *);
void mfii_refresh_sensor(struct sysmon_envsys *, envsys_data_t *);
void mfii_bbu(struct mfii_softc *, envsys_data_t *);
static void mfii_refresh_sensor(struct sysmon_envsys *, envsys_data_t *);
static void mfii_bbu(struct mfii_softc *, envsys_data_t *);
/*
* mfii boards support asynchronous (and non-polled) completion of
@ -525,8 +522,7 @@ void mfii_bbu(struct mfii_softc *, envsys_data_t *);
* hold the dcmd, we reuse the sense memory buffer for it.
*/
void mfii_dcmd_start(struct mfii_softc *,
struct mfii_ccb *);
static void mfii_dcmd_start(struct mfii_softc *, struct mfii_ccb *);
static inline void
mfii_dcmd_scrub(struct mfii_ccb *ccb)
@ -550,7 +546,7 @@ mfii_dcmd_sync(struct mfii_softc *sc, struct mfii_ccb *ccb, int flags)
#define mfii_fw_state(_sc) mfii_read((_sc), MFI_OSP)
const struct mfii_iop mfii_iop_thunderbolt = {
static const struct mfii_iop mfii_iop_thunderbolt = {
MFII_BAR,
MFII_IOP_NUM_SGE_LOC_ORIG,
0,
@ -563,7 +559,7 @@ const struct mfii_iop mfii_iop_thunderbolt = {
/*
* a lot of these values depend on us not implementing fastpath yet.
*/
const struct mfii_iop mfii_iop_25 = {
static const struct mfii_iop mfii_iop_25 = {
MFII_BAR,
MFII_IOP_NUM_SGE_LOC_ORIG,
MFII_RAID_CTX_RL_FLAGS_CPU0, /* | MFII_RAID_CTX_RL_FLAGS_SEQNO_EN */
@ -573,7 +569,7 @@ const struct mfii_iop mfii_iop_25 = {
MFII_SGE_END_OF_LIST
};
const struct mfii_iop mfii_iop_35 = {
static const struct mfii_iop mfii_iop_35 = {
MFII_BAR_35,
MFII_IOP_NUM_SGE_LOC_35,
MFII_RAID_CTX_ROUTING_FLAGS_CPU0, /* | MFII_RAID_CTX_ROUTING_FLAGS_SQN */
@ -589,7 +585,7 @@ struct mfii_device {
const struct mfii_iop *mpd_iop;
};
const struct mfii_device mfii_devices[] = {
static const struct mfii_device mfii_devices[] = {
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_2208,
&mfii_iop_thunderbolt },
{ PCI_VENDOR_SYMBIOS, PCI_PRODUCT_SYMBIOS_MEGARAID_3008,
@ -610,9 +606,9 @@ const struct mfii_device mfii_devices[] = {
&mfii_iop_35 }
};
const struct mfii_iop *mfii_find_iop(struct pci_attach_args *);
static const struct mfii_iop *mfii_find_iop(struct pci_attach_args *);
const struct mfii_iop *
static const struct mfii_iop *
mfii_find_iop(struct pci_attach_args *pa)
{
const struct mfii_device *mpd;
@ -629,13 +625,13 @@ mfii_find_iop(struct pci_attach_args *pa)
return (NULL);
}
int
static int
mfii_match(device_t parent, cfdata_t match, void *aux)
{
return ((mfii_find_iop(aux) != NULL) ? 2 : 0);
}
void
static void
mfii_attach(device_t parent, device_t self, void *aux)
{
struct mfii_softc *sc = device_private(self);
@ -912,7 +908,7 @@ mfii_dev_handle(struct mfii_softc *sc, uint16_t target)
return (handle);
}
int
static int
mfii_dev_handles_update(struct mfii_softc *sc)
{
struct mfii_ld_map *lm;
@ -947,7 +943,7 @@ free_lm:
return (rv);
}
void
static void
mfii_dev_handles_dtor(void *null, void *v)
{
uint16_t *dev_handles = v;
@ -956,7 +952,7 @@ mfii_dev_handles_dtor(void *null, void *v)
}
#endif /* 0 */
int
static int
mfii_detach(device_t self, int flags)
{
struct mfii_softc *sc = device_private(self);
@ -987,7 +983,7 @@ mfii_detach(device_t self, int flags)
return (0);
}
int
static int
mfii_rescan(device_t self, const char *ifattr, const int *locators)
{
struct mfii_softc *sc = device_private(self);
@ -999,7 +995,7 @@ mfii_rescan(device_t self, const char *ifattr, const int *locators)
return 0;
}
void
static void
mfii_childdetached(device_t self, device_t child)
{
struct mfii_softc *sc = device_private(self);
@ -1031,12 +1027,12 @@ mfii_shutdown(device_t dev, int how)
struct mfii_softc *sc = device_private(dev);
struct mfii_ccb *ccb;
union mfi_mbox mbox;
bool rv = true;;
bool rv = true;
memset(&mbox, 0, sizeof(mbox));
mutex_enter(&sc->sc_lock);
DNPRINTF(MFI_D_MISC, "%s: mfii_shutdown\n", DEVNAME(sc));
DNPRINTF(MFII_D_MISC, "%s: mfii_shutdown\n", DEVNAME(sc));
ccb = mfii_get_ccb(sc);
if (ccb == NULL)
return false;
@ -1089,7 +1085,7 @@ mfii_write(struct mfii_softc *sc, bus_size_t r, u_int32_t v)
BUS_SPACE_BARRIER_WRITE);
}
struct mfii_dmamem *
static struct mfii_dmamem *
mfii_dmamem_alloc(struct mfii_softc *sc, size_t size)
{
struct mfii_dmamem *m;
@ -1132,7 +1128,7 @@ mdmfree:
return (NULL);
}
void
static void
mfii_dmamem_free(struct mfii_softc *sc, struct mfii_dmamem *m)
{
bus_dmamap_unload(sc->sc_dmat, m->mdm_map);
@ -1142,7 +1138,7 @@ mfii_dmamem_free(struct mfii_softc *sc, struct mfii_dmamem *m)
free(m, M_DEVBUF);
}
void
static void
mfii_dcmd_start(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
struct mpii_msg_scsi_io *io = ccb->ccb_request;
@ -1163,7 +1159,7 @@ mfii_dcmd_start(struct mfii_softc *sc, struct mfii_ccb *ccb)
mfii_start(sc, ccb);
}
int
static int
mfii_aen_register(struct mfii_softc *sc)
{
struct mfi_evt_log_info mel;
@ -1201,7 +1197,7 @@ mfii_aen_register(struct mfii_softc *sc)
return (0);
}
void
static void
mfii_aen_start(struct mfii_softc *sc, struct mfii_ccb *ccb,
struct mfii_dmamem *mdm, uint32_t seq)
{
@ -1239,7 +1235,7 @@ mfii_aen_start(struct mfii_softc *sc, struct mfii_ccb *ccb,
mfii_dcmd_start(sc, ccb);
}
void
static void
mfii_aen_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
KASSERT(sc->sc_aen_ccb == ccb);
@ -1253,7 +1249,7 @@ mfii_aen_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
workqueue_enqueue(sc->sc_aen_wq, &sc->sc_aen_work, NULL);
}
void
static void
mfii_aen(struct work *wk, void *arg)
{
struct mfii_softc *sc = arg;
@ -1303,7 +1299,7 @@ mfii_aen(struct work *wk, void *arg)
mfii_aen_start(sc, ccb, mdm, le32toh(med->med_seq_num) + 1);
}
void
static void
mfii_aen_pd_insert(struct mfii_softc *sc,
const struct mfi_evtarg_pd_address *pd)
{
@ -1311,7 +1307,7 @@ mfii_aen_pd_insert(struct mfii_softc *sc,
le16toh(pd->device_id), le16toh(pd->encl_id));
}
void
static void
mfii_aen_pd_remove(struct mfii_softc *sc,
const struct mfi_evtarg_pd_address *pd)
{
@ -1319,14 +1315,14 @@ mfii_aen_pd_remove(struct mfii_softc *sc,
le16toh(pd->device_id), le16toh(pd->encl_id));
}
void
static void
mfii_aen_pd_state_change(struct mfii_softc *sc,
const struct mfi_evtarg_pd_state *state)
{
return;
}
void
static void
mfii_aen_ld_update(struct mfii_softc *sc)
{
int i, target, old, nld;
@ -1376,13 +1372,13 @@ mfii_aen_ld_update(struct mfii_softc *sc)
memcpy(sc->sc_target_lds, newlds, sizeof(sc->sc_target_lds));
}
void
static void
mfii_aen_unregister(struct mfii_softc *sc)
{
/* XXX */
}
int
static int
mfii_transition_firmware(struct mfii_softc *sc)
{
int32_t fw_state, cur_state;
@ -1436,7 +1432,7 @@ mfii_transition_firmware(struct mfii_softc *sc)
return (0);
}
int
static int
mfii_get_info(struct mfii_softc *sc)
{
int i, rv;
@ -1591,7 +1587,7 @@ mfii_get_info(struct mfii_softc *sc)
return (0);
}
int
static int
mfii_mfa_poll(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
struct mfi_frame_header *hdr = ccb->ccb_request;
@ -1647,7 +1643,7 @@ mfii_mfa_poll(struct mfii_softc *sc, struct mfii_ccb *ccb)
return (rv);
}
int
static int
mfii_poll(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
void (*done)(struct mfii_softc *, struct mfii_ccb *);
@ -1673,7 +1669,7 @@ mfii_poll(struct mfii_softc *sc, struct mfii_ccb *ccb)
return (0);
}
void
static void
mfii_poll_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
int *rv = ccb->ccb_cookie;
@ -1681,7 +1677,7 @@ mfii_poll_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
*rv = 0;
}
int
static int
mfii_exec(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
#ifdef DIAGNOSTIC
@ -1702,7 +1698,7 @@ mfii_exec(struct mfii_softc *sc, struct mfii_ccb *ccb)
return (0);
}
void
static void
mfii_exec_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
mutex_enter(&ccb->ccb_mtx);
@ -1711,7 +1707,7 @@ mfii_exec_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
mutex_exit(&ccb->ccb_mtx);
}
int
static int
mfii_mgmt(struct mfii_softc *sc, uint32_t opc, const union mfi_mbox *mbox,
void *buf, size_t len, mfii_direction_t dir, bool poll)
{
@ -1733,7 +1729,7 @@ mfii_mgmt(struct mfii_softc *sc, uint32_t opc, const union mfi_mbox *mbox,
return (rv);
}
int
static int
mfii_do_mgmt(struct mfii_softc *sc, struct mfii_ccb *ccb, uint32_t opc,
const union mfi_mbox *mbox, void *buf, size_t len, mfii_direction_t dir,
bool poll)
@ -1804,13 +1800,13 @@ done:
return (rv);
}
void
static void
mfii_empty_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
return;
}
int
static int
mfii_load_mfa(struct mfii_softc *sc, struct mfii_ccb *ccb,
void *sglp, int nosleep)
{
@ -1843,7 +1839,7 @@ mfii_load_mfa(struct mfii_softc *sc, struct mfii_ccb *ccb,
return (0);
}
void
static void
mfii_start(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
u_long *r = (u_long *)&ccb->ccb_req;
@ -1867,7 +1863,7 @@ mfii_start(struct mfii_softc *sc, struct mfii_ccb *ccb)
#endif
}
void
static void
mfii_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
bus_dmamap_sync(sc->sc_dmat, MFII_DMA_MAP(sc->sc_requests),
@ -1900,7 +1896,7 @@ mfii_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
ccb->ccb_done(sc, ccb);
}
int
static int
mfii_initialise_firmware(struct mfii_softc *sc)
{
struct mpii_msg_iocinit_request *iiq;
@ -1976,7 +1972,7 @@ mfii_initialise_firmware(struct mfii_softc *sc)
return (rv);
}
int
static int
mfii_my_intr(struct mfii_softc *sc)
{
u_int32_t status;
@ -1992,7 +1988,7 @@ mfii_my_intr(struct mfii_softc *sc)
return (ISSET(status, MFII_OSTS_INTR_VALID) ? 1 : 0);
}
int
static int
mfii_intr(void *arg)
{
struct mfii_softc *sc = arg;
@ -2005,7 +2001,7 @@ mfii_intr(void *arg)
return (1);
}
void
static void
mfii_postq(struct mfii_softc *sc)
{
struct mfii_ccb_list ccbs = SIMPLEQ_HEAD_INITIALIZER(ccbs);
@ -2060,7 +2056,7 @@ mfii_postq(struct mfii_softc *sc)
}
}
void
static void
mfii_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
void *arg)
{
@ -2168,7 +2164,7 @@ stuffup:
mfii_put_ccb(sc, ccb);
}
void
static void
mfii_scsi_cmd_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
struct scsipi_xfer *xs = ccb->ccb_cookie;
@ -2202,7 +2198,7 @@ mfii_scsi_cmd_done(struct mfii_softc *sc, struct mfii_ccb *ccb)
mfii_put_ccb(sc, ccb);
}
int
static int
mfii_scsi_cmd_io(struct mfii_softc *sc, struct mfii_ccb *ccb,
struct scsipi_xfer *xs)
{
@ -2262,7 +2258,7 @@ mfii_scsi_cmd_io(struct mfii_softc *sc, struct mfii_ccb *ccb,
return (0);
}
int
static int
mfii_scsi_cmd_cdb(struct mfii_softc *sc, struct mfii_ccb *ccb,
struct scsipi_xfer *xs)
{
@ -2431,7 +2427,7 @@ mfii_pd_scsi_cmd_cdb(struct mfii_softc *sc, struct mfii_ccb *ccb,
}
#endif
int
static int
mfii_load_ccb(struct mfii_softc *sc, struct mfii_ccb *ccb, void *sglp,
int nosleep)
{
@ -2499,7 +2495,7 @@ mfii_load_ccb(struct mfii_softc *sc, struct mfii_ccb *ccb, void *sglp,
return (0);
}
void
static void
mfii_scsi_cmd_tmo(void *p)
{
struct mfii_ccb *ccb = p;
@ -2516,7 +2512,7 @@ mfii_scsi_cmd_tmo(void *p)
mutex_exit(&sc->sc_abort_mtx);
}
void
static void
mfii_abort_task(struct work *wk, void *scp)
{
struct mfii_softc *sc = scp;
@ -2556,7 +2552,7 @@ mfii_abort_task(struct work *wk, void *scp)
}
}
void
static void
mfii_abort(struct mfii_softc *sc, struct mfii_ccb *accb, uint16_t dev_handle,
uint16_t smid, uint8_t type, uint32_t flags)
{
@ -2575,7 +2571,7 @@ mfii_abort(struct mfii_softc *sc, struct mfii_ccb *accb, uint16_t dev_handle,
accb->ccb_req.smid = le16toh(accb->ccb_smid);
}
void
static void
mfii_scsi_cmd_abort_done(struct mfii_softc *sc, struct mfii_ccb *accb)
{
struct mfii_ccb *ccb = accb->ccb_cookie;
@ -2591,7 +2587,7 @@ mfii_scsi_cmd_abort_done(struct mfii_softc *sc, struct mfii_ccb *accb)
mfii_put_ccb(sc, ccb);
}
struct mfii_ccb *
static struct mfii_ccb *
mfii_get_ccb(struct mfii_softc *sc)
{
struct mfii_ccb *ccb;
@ -2608,7 +2604,7 @@ mfii_get_ccb(struct mfii_softc *sc)
return (ccb);
}
void
static void
mfii_scrub_ccb(struct mfii_ccb *ccb)
{
ccb->ccb_cookie = NULL;
@ -2624,7 +2620,7 @@ mfii_scrub_ccb(struct mfii_ccb *ccb)
memset(ccb->ccb_mfi, 0, MFI_FRAME_SIZE);
}
void
static void
mfii_put_ccb(struct mfii_softc *sc, struct mfii_ccb *ccb)
{
mutex_enter(&sc->sc_ccb_mtx);
@ -2632,7 +2628,7 @@ mfii_put_ccb(struct mfii_softc *sc, struct mfii_ccb *ccb)
mutex_exit(&sc->sc_ccb_mtx);
}
int
static int
mfii_init_ccb(struct mfii_softc *sc)
{
struct mfii_ccb *ccb;
@ -2719,7 +2715,7 @@ destroy:
}
#if NBIO > 0
int
static int
mfii_ioctl(device_t dev, u_long cmd, void *addr)
{
struct mfii_softc *sc = device_private(dev);
@ -2777,7 +2773,7 @@ mfii_ioctl(device_t dev, u_long cmd, void *addr)
return (error);
}
int
static int
mfii_bio_getitall(struct mfii_softc *sc)
{
int i, d, rv = EINVAL;
@ -2858,7 +2854,7 @@ done:
return (rv);
}
int
static int
mfii_ioctl_inq(struct mfii_softc *sc, struct bioc_inq *bi)
{
int rv = EINVAL;
@ -2891,7 +2887,7 @@ done:
return (rv);
}
int
static int
mfii_ioctl_vol(struct mfii_softc *sc, struct bioc_vol *bv)
{
int i, per, rv = EINVAL;
@ -2940,7 +2936,6 @@ mfii_ioctl_vol(struct mfii_softc *sc, struct bioc_vol *bv)
/* additional status can modify MFI status */
switch (sc->sc_ld_details[i].mld_progress.mlp_in_prog) {
case MFI_LD_PROG_CC:
case MFI_LD_PROG_BGI:
bv->bv_status = BIOC_SVSCRUB;
per = (int)sc->sc_ld_details[i].mld_progress.mlp_cc.mp_progress;
bv->bv_percent = (per * 100) / 0xffff;
@ -2948,6 +2943,14 @@ mfii_ioctl_vol(struct mfii_softc *sc, struct bioc_vol *bv)
sc->sc_ld_details[i].mld_progress.mlp_cc.mp_elapsed_seconds;
break;
case MFI_LD_PROG_BGI:
bv->bv_status = BIOC_SVSCRUB;
per = (int)sc->sc_ld_details[i].mld_progress.mlp_bgi.mp_progress;
bv->bv_percent = (per * 100) / 0xffff;
bv->bv_seconds =
sc->sc_ld_details[i].mld_progress.mlp_bgi.mp_elapsed_seconds;
break;
case MFI_LD_PROG_FGI:
case MFI_LD_PROG_RECONSTRUCT:
/* nothing yet */
@ -2973,13 +2976,16 @@ mfii_ioctl_vol(struct mfii_softc *sc, struct bioc_vol *bv)
sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_span_depth;
bv->bv_size = sc->sc_ld_details[i].mld_size * 512; /* bytes per block */
bv->bv_stripe_size =
(512 << sc->sc_ld_details[i].mld_cfg.mlc_parm.mpa_stripe_size)
/ 1024; /* in KB */
rv = 0;
done:
return (rv);
}
int
static int
mfii_ioctl_disk(struct mfii_softc *sc, struct bioc_disk *bd)
{
struct mfi_conf *cfg;
@ -3133,7 +3139,7 @@ freeme:
return (rv);
}
int
static int
mfii_ioctl_alarm(struct mfii_softc *sc, struct bioc_alarm *ba)
{
uint32_t opc;
@ -3180,7 +3186,7 @@ mfii_ioctl_alarm(struct mfii_softc *sc, struct bioc_alarm *ba)
return (rv);
}
int
static int
mfii_ioctl_blink(struct mfii_softc *sc, struct bioc_blink *bb)
{
int i, found, rv = EINVAL;
@ -3347,7 +3353,7 @@ done:
return (rv);
}
int
static int
mfii_ioctl_setstate(struct mfii_softc *sc, struct bioc_setstate *bs)
{
struct mfi_pd_details *pd;
@ -3579,7 +3585,7 @@ mfii_ioctl_patrol(struct mfii_softc *sc, struct bioc_patrol *bp)
}
#endif
int
static int
mfii_bio_hs(struct mfii_softc *sc, int volid, int type, void *bio_hs)
{
struct mfi_conf *cfg;
@ -3683,7 +3689,7 @@ freeme:
#define MFI_BBU_SENSORS 4
void
static void
mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
{
struct mfi_bbu_status bbu;
@ -3704,6 +3710,7 @@ mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
switch (bbu.battery_type) {
case MFI_BBU_TYPE_IBBU:
case MFI_BBU_TYPE_IBBU09:
mask = MFI_BBU_STATE_BAD_IBBU;
soh_bad = 0;
break;
@ -3741,7 +3748,7 @@ mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
}
}
void
static void
mfii_refresh_ld_sensor(struct mfii_softc *sc, envsys_data_t *edata)
{
struct bioc_vol bv;
@ -3757,7 +3764,7 @@ mfii_refresh_ld_sensor(struct mfii_softc *sc, envsys_data_t *edata)
bio_vol_to_envsys(edata, &bv);
}
void
static void
mfii_init_ld_sensor(struct mfii_softc *sc, envsys_data_t *sensor, int i)
{
sensor->units = ENVSYS_DRIVE;
@ -3776,7 +3783,7 @@ mfii_attach_sensor(struct mfii_softc *sc, envsys_data_t *s)
"failed to attach sensor %s\n", s->desc);
}
int
static int
mfii_create_sensors(struct mfii_softc *sc)
{
int i, rv;
@ -3848,7 +3855,7 @@ mfii_destroy_sensors(struct mfii_softc *sc)
return 0;
}
void
static void
mfii_refresh_sensor(struct sysmon_envsys *sme, envsys_data_t *edata)
{
struct mfii_softc *sc = sme->sme_cookie;