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:
parent
0eab68c44d
commit
8f3b8d50ed
|
@ -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
|
||||
|
|
243
sys/dev/ic/mfi.c
243
sys/dev/ic/mfi.c
|
@ -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"
|
||||
|
||||
|
@ -110,7 +110,7 @@ __KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.57.10.1 2018/12/07 17:11:37 martin Exp $")
|
|||
|
||||
#ifdef MFI_DEBUG
|
||||
uint32_t mfi_debug = 0
|
||||
/* | MFI_D_CMD */
|
||||
/* | MFI_D_CMD */
|
||||
/* | MFI_D_INTR */
|
||||
/* | MFI_D_MISC */
|
||||
/* | MFI_D_DMA */
|
||||
|
@ -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
|
||||
|
@ -201,10 +203,10 @@ const struct cdevsw mfi_cdevsw = {
|
|||
extern struct cfdriver mfi_cd;
|
||||
|
||||
static uint32_t mfi_xscale_fw_state(struct mfi_softc *sc);
|
||||
static void mfi_xscale_intr_ena(struct mfi_softc *sc);
|
||||
static void mfi_xscale_intr_dis(struct mfi_softc *sc);
|
||||
static int mfi_xscale_intr(struct mfi_softc *sc);
|
||||
static void mfi_xscale_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
|
||||
static void mfi_xscale_intr_ena(struct mfi_softc *sc);
|
||||
static void mfi_xscale_intr_dis(struct mfi_softc *sc);
|
||||
static int mfi_xscale_intr(struct mfi_softc *sc);
|
||||
static void mfi_xscale_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
|
||||
|
||||
static const struct mfi_iop_ops mfi_iop_xscale = {
|
||||
mfi_xscale_fw_state,
|
||||
|
@ -216,10 +218,10 @@ static const struct mfi_iop_ops mfi_iop_xscale = {
|
|||
};
|
||||
|
||||
static uint32_t mfi_ppc_fw_state(struct mfi_softc *sc);
|
||||
static void mfi_ppc_intr_ena(struct mfi_softc *sc);
|
||||
static void mfi_ppc_intr_dis(struct mfi_softc *sc);
|
||||
static int mfi_ppc_intr(struct mfi_softc *sc);
|
||||
static void mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
|
||||
static void mfi_ppc_intr_ena(struct mfi_softc *sc);
|
||||
static void mfi_ppc_intr_dis(struct mfi_softc *sc);
|
||||
static int mfi_ppc_intr(struct mfi_softc *sc);
|
||||
static void mfi_ppc_post(struct mfi_softc *sc, struct mfi_ccb *ccb);
|
||||
|
||||
static const struct mfi_iop_ops mfi_iop_ppc = {
|
||||
mfi_ppc_fw_state,
|
||||
|
@ -285,11 +287,11 @@ static const struct mfi_iop_ops mfi_iop_tbolt = {
|
|||
mfi_tbolt_scsi_ld_io,
|
||||
};
|
||||
|
||||
#define mfi_fw_state(_s) ((_s)->sc_iop->mio_fw_state(_s))
|
||||
#define mfi_intr_enable(_s) ((_s)->sc_iop->mio_intr_ena(_s))
|
||||
#define mfi_intr_disable(_s) ((_s)->sc_iop->mio_intr_dis(_s))
|
||||
#define mfi_my_intr(_s) ((_s)->sc_iop->mio_intr(_s))
|
||||
#define mfi_post(_s, _c) ((_s)->sc_iop->mio_post((_s), (_c)))
|
||||
#define mfi_fw_state(_s) ((_s)->sc_iop->mio_fw_state(_s))
|
||||
#define mfi_intr_enable(_s) ((_s)->sc_iop->mio_intr_ena(_s))
|
||||
#define mfi_intr_disable(_s) ((_s)->sc_iop->mio_intr_dis(_s))
|
||||
#define mfi_my_intr(_s) ((_s)->sc_iop->mio_intr(_s))
|
||||
#define mfi_post(_s, _c) ((_s)->sc_iop->mio_post((_s), (_c)))
|
||||
|
||||
static struct mfi_ccb *
|
||||
mfi_get_ccb(struct mfi_softc *sc)
|
||||
|
@ -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),
|
||||
|
@ -848,7 +849,7 @@ mfi_get_bbu(struct mfi_softc *sc, struct mfi_bbu_status *stat)
|
|||
"status 0x%x\n", stat->battery_type, stat->voltage, stat->current,
|
||||
stat->temperature, stat->fw_status);
|
||||
printf("details: ");
|
||||
switch(stat->battery_type) {
|
||||
switch (stat->battery_type) {
|
||||
case MFI_BBU_TYPE_IBBU:
|
||||
printf("guage %d relative charge %d charger state %d "
|
||||
"charger ctrl %d\n", stat->detail.ibbu.gas_guage_status,
|
||||
|
@ -869,13 +870,14 @@ 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");
|
||||
}
|
||||
#endif
|
||||
switch(stat->battery_type) {
|
||||
switch (stat->battery_type) {
|
||||
case MFI_BBU_TYPE_BBU:
|
||||
return (stat->detail.bbu.is_SOH_good ?
|
||||
return (stat->detail.bbu.is_SOH_good ?
|
||||
MFI_BBU_GOOD : MFI_BBU_BAD);
|
||||
case MFI_BBU_TYPE_NONE:
|
||||
return MFI_BBU_UNKNOWN;
|
||||
|
@ -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;
|
||||
|
@ -1041,7 +1045,7 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
|
|||
sc->sc_iop = &mfi_iop_tbolt;
|
||||
break;
|
||||
default:
|
||||
panic("%s: unknown iop %d", DEVNAME(sc), iop);
|
||||
panic("%s: unknown iop %d", DEVNAME(sc), iop);
|
||||
}
|
||||
|
||||
if (mfi_transition_firmware(sc))
|
||||
|
@ -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);
|
||||
|
@ -1204,7 +1210,7 @@ mfi_attach(struct mfi_softc *sc, enum mfi_iop iop)
|
|||
aprint_normal("unknown type %d", bbu_stat.battery_type);
|
||||
}
|
||||
aprint_normal(", status ");
|
||||
switch(mfi_bbu_status) {
|
||||
switch (mfi_bbu_status) {
|
||||
case MFI_BBU_GOOD:
|
||||
aprint_normal("good\n");
|
||||
sc->sc_bbuok = true;
|
||||
|
@ -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) {
|
||||
|
@ -2061,7 +2069,7 @@ mfi_ioctl_vol(struct mfi_softc *sc, struct bioc_vol *bv)
|
|||
|
||||
strlcpy(bv->bv_dev, sc->sc_ld[i].ld_dev, sizeof(bv->bv_dev));
|
||||
|
||||
switch(sc->sc_ld_list.mll_list[i].mll_state) {
|
||||
switch (sc->sc_ld_list.mll_list[i].mll_state) {
|
||||
case MFI_LD_OFFLINE:
|
||||
bv->bv_status = BIOC_SVOFFLINE;
|
||||
break;
|
||||
|
@ -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 */
|
||||
|
@ -2247,7 +2265,7 @@ mfi_ioctl_alarm(struct mfi_softc *sc, struct bioc_alarm *ba)
|
|||
int rv = 0;
|
||||
int8_t ret;
|
||||
|
||||
switch(ba->ba_opcode) {
|
||||
switch (ba->ba_opcode) {
|
||||
case BIOC_SADISABLE:
|
||||
opc = MR_DCMD_SPEAKER_DISABLE;
|
||||
break;
|
||||
|
@ -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,25 +2319,24 @@ 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++)
|
||||
if (bb->bb_channel == pd->mpl_address[i].mpa_enc_index &&
|
||||
bb->bb_target == pd->mpl_address[i].mpa_enc_slot) {
|
||||
found = 1;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
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,42 +2369,41 @@ 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++)
|
||||
if (bs->bs_channel == pd->mpl_address[i].mpa_enc_index &&
|
||||
bs->bs_target == pd->mpl_address[i].mpa_enc_slot) {
|
||||
found = 1;
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -2603,7 +2619,7 @@ mfi_sensor_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
|
|||
bbu_status = mfi_get_bbu(sc, &bbu_stat);
|
||||
splx(s);
|
||||
KERNEL_UNLOCK_ONE(curlwp);
|
||||
switch(bbu_status) {
|
||||
switch (bbu_status) {
|
||||
case MFI_BBU_GOOD:
|
||||
edata->value_cur = 1;
|
||||
edata->state = ENVSYS_SVALID;
|
||||
|
@ -2870,7 +2886,7 @@ mfi_tbolt_post(struct mfi_softc *sc, struct mfi_ccb *ccb)
|
|||
mfi_tbolt_build_mpt_ccb(ccb);
|
||||
mfi_write(sc, MFI_IQPL,
|
||||
ccb->ccb_tb_request_desc.words & 0xFFFFFFFF);
|
||||
mfi_write(sc, MFI_IQPH,
|
||||
mfi_write(sc, MFI_IQPH,
|
||||
ccb->ccb_tb_request_desc.words >> 32);
|
||||
ccb->ccb_state = MFI_CCB_RUNNING;
|
||||
return;
|
||||
|
@ -2914,7 +2930,7 @@ mfi_tbolt_build_mpt_ccb(struct mfi_ccb *ccb)
|
|||
MFI_REQ_DESCRIPT_FLAGS_TYPE_SHIFT);
|
||||
ccb->ccb_flags |= MFI_CCB_F_TBOLT;
|
||||
bus_dmamap_sync(ccb->ccb_sc->sc_dmat,
|
||||
MFIMEM_MAP(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
ccb->ccb_tb_pio_request -
|
||||
MFIMEM_DVA(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE,
|
||||
|
@ -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 */
|
||||
|
@ -3031,7 +3047,7 @@ mfi_tbolt_init_MFI_queue(struct mfi_softc *sc)
|
|||
|
||||
verbuf = MFIMEM_KVA(sc->sc_tbolt_verbuf);
|
||||
snprintf(verbuf, strlen(MEGASAS_VERSION) + 2, "%s\n",
|
||||
MEGASAS_VERSION);
|
||||
MEGASAS_VERSION);
|
||||
bus_dmamap_sync(sc->sc_dmat, MFIMEM_MAP(sc->sc_tbolt_verbuf), 0,
|
||||
MFIMEM_MAP(sc->sc_tbolt_verbuf)->dm_mapsize, BUS_DMASYNC_PREWRITE);
|
||||
mfi_init->driver_ver_lo = htole32(MFIMEM_DVA(sc->sc_tbolt_verbuf));
|
||||
|
@ -3103,7 +3119,7 @@ mfi_tbolt_intrh(void *arg)
|
|||
sc->sc_last_reply_idx * MEGASAS_THUNDERBOLT_REPLY_SIZE);
|
||||
|
||||
bus_dmamap_sync(sc->sc_dmat,
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE * (sc->sc_max_cmds + 1),
|
||||
MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size,
|
||||
BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
|
||||
|
@ -3121,14 +3137,14 @@ mfi_tbolt_intrh(void *arg)
|
|||
if (ccb->ccb_flags & MFI_CCB_F_TBOLT_IO &&
|
||||
ccb->ccb_tb_io_request->ChainOffset != 0) {
|
||||
bus_dmamap_sync(sc->sc_dmat,
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
ccb->ccb_tb_psg_frame -
|
||||
MFIMEM_DVA(sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_MAX_SZ_CHAIN_FRAME, BUS_DMASYNC_POSTREAD);
|
||||
}
|
||||
if (ccb->ccb_flags & MFI_CCB_F_TBOLT_IO) {
|
||||
bus_dmamap_sync(sc->sc_dmat,
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
ccb->ccb_tb_pio_request -
|
||||
MFIMEM_DVA(sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE,
|
||||
|
@ -3153,7 +3169,7 @@ mfi_tbolt_intrh(void *arg)
|
|||
return 0;
|
||||
|
||||
bus_dmamap_sync(sc->sc_dmat,
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE * (sc->sc_max_cmds + 1),
|
||||
MEGASAS_THUNDERBOLT_REPLY_SIZE * sc->sc_reply_pool_size,
|
||||
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
|
||||
|
@ -3224,7 +3240,7 @@ mfi_tbolt_scsi_ld_io(struct mfi_ccb *ccb, struct scsipi_xfer *xs,
|
|||
|
||||
ccb->ccb_flags |= MFI_CCB_F_TBOLT | MFI_CCB_F_TBOLT_IO;
|
||||
bus_dmamap_sync(ccb->ccb_sc->sc_dmat,
|
||||
MFIMEM_MAP(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
ccb->ccb_tb_pio_request -
|
||||
MFIMEM_DVA(ccb->ccb_sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_THUNDERBOLT_NEW_MSG_SIZE,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -3330,7 +3346,7 @@ mfi_tbolt_create_sgl(struct mfi_ccb *ccb, int flags)
|
|||
sgl_ptr++;
|
||||
}
|
||||
bus_dmamap_sync(sc->sc_dmat,
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
MFIMEM_MAP(sc->sc_tbolt_reqmsgpool),
|
||||
ccb->ccb_tb_psg_frame - MFIMEM_DVA(sc->sc_tbolt_reqmsgpool),
|
||||
MEGASAS_MAX_SZ_CHAIN_FRAME, BUS_DMASYNC_PREREAD);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -3403,7 +3420,7 @@ again:
|
|||
}
|
||||
|
||||
ld_size = sizeof(*ld_sync) * sc->sc_ld_list.mll_no_ld;
|
||||
|
||||
|
||||
ld_sync = malloc(ld_size, M_DEVBUF, M_WAITOK | M_ZERO);
|
||||
if (ld_sync == NULL) {
|
||||
aprint_error_dev(sc->sc_dev, "Failed to allocate sync\n");
|
||||
|
@ -3418,12 +3435,12 @@ again:
|
|||
goto err;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
@ -3499,7 +3516,7 @@ mfifioctl(dev_t dev, u_long cmd, void *data, int flag,
|
|||
int ctx, i, s, error;
|
||||
union mfi_sense_ptr sense_ptr;
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case MFI_CMD:
|
||||
sc = device_lookup_private(&mfi_cd, ioc->mfi_adapter_no);
|
||||
break;
|
||||
|
@ -3511,7 +3528,7 @@ mfifioctl(dev_t dev, u_long cmd, void *data, int flag,
|
|||
if (sc->sc_opened)
|
||||
return (EBUSY);
|
||||
|
||||
switch(cmd) {
|
||||
switch (cmd) {
|
||||
case MFI_CMD:
|
||||
error = kauth_authorize_device_passthru(l->l_cred, dev,
|
||||
KAUTH_REQ_DEVICE_RAWIO_PASSTHRU_ALL, data);
|
||||
|
|
|
@ -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>
|
||||
|
@ -75,7 +75,7 @@
|
|||
#define MFI_IQP 0x40 /* inbound queue port */
|
||||
#define MFI_OQP 0x44 /* outbound queue port */
|
||||
#define MFI_ODC 0xa0 /* outbound doorbell clr */
|
||||
#define MFI_OSP 0xb0 /* outbound scratch pad */
|
||||
#define MFI_OSP 0xb0 /* outbound scratch pad */
|
||||
|
||||
/* ThunderBolt specific Register */
|
||||
#define MFI_RPI 0x6c /* reply_post_host_index */
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -356,27 +357,27 @@ typedef enum {
|
|||
} mfi_evt_locale_t;
|
||||
|
||||
typedef enum {
|
||||
MR_EVT_ARGS_NONE = 0x00,
|
||||
MR_EVT_ARGS_CDB_SENSE,
|
||||
MR_EVT_ARGS_LD,
|
||||
MR_EVT_ARGS_LD_COUNT,
|
||||
MR_EVT_ARGS_LD_LBA,
|
||||
MR_EVT_ARGS_LD_OWNER,
|
||||
MR_EVT_ARGS_LD_LBA_PD_LBA,
|
||||
MR_EVT_ARGS_LD_PROG,
|
||||
MR_EVT_ARGS_LD_STATE,
|
||||
MR_EVT_ARGS_LD_STRIP,
|
||||
MR_EVT_ARGS_PD,
|
||||
MR_EVT_ARGS_PD_ERR,
|
||||
MR_EVT_ARGS_PD_LBA,
|
||||
MR_EVT_ARGS_PD_LBA_LD,
|
||||
MR_EVT_ARGS_PD_PROG,
|
||||
MR_EVT_ARGS_PD_STATE,
|
||||
MR_EVT_ARGS_PCI,
|
||||
MR_EVT_ARGS_RATE,
|
||||
MR_EVT_ARGS_STR,
|
||||
MR_EVT_ARGS_TIME,
|
||||
MR_EVT_ARGS_ECC
|
||||
MR_EVT_ARGS_NONE = 0x00,
|
||||
MR_EVT_ARGS_CDB_SENSE,
|
||||
MR_EVT_ARGS_LD,
|
||||
MR_EVT_ARGS_LD_COUNT,
|
||||
MR_EVT_ARGS_LD_LBA,
|
||||
MR_EVT_ARGS_LD_OWNER,
|
||||
MR_EVT_ARGS_LD_LBA_PD_LBA,
|
||||
MR_EVT_ARGS_LD_PROG,
|
||||
MR_EVT_ARGS_LD_STATE,
|
||||
MR_EVT_ARGS_LD_STRIP,
|
||||
MR_EVT_ARGS_PD,
|
||||
MR_EVT_ARGS_PD_ERR,
|
||||
MR_EVT_ARGS_PD_LBA,
|
||||
MR_EVT_ARGS_PD_LBA_LD,
|
||||
MR_EVT_ARGS_PD_PROG,
|
||||
MR_EVT_ARGS_PD_STATE,
|
||||
MR_EVT_ARGS_PCI,
|
||||
MR_EVT_ARGS_RATE,
|
||||
MR_EVT_ARGS_STR,
|
||||
MR_EVT_ARGS_TIME,
|
||||
MR_EVT_ARGS_ECC
|
||||
} mfi_evt_args;
|
||||
|
||||
/* XXX should be in mfi_evt_args ? */
|
||||
|
@ -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 {
|
||||
|
@ -542,7 +544,7 @@ struct mfi_stp_frame {
|
|||
union {
|
||||
struct mfi_sg32 sg32[2];
|
||||
struct mfi_sg64 sg64[2];
|
||||
} msf_sgl;
|
||||
} msf_sgl;
|
||||
} __packed;
|
||||
|
||||
union mfi_frame {
|
||||
|
@ -560,7 +562,7 @@ union mfi_frame {
|
|||
union mfi_evt_class_locale {
|
||||
struct {
|
||||
uint16_t locale;
|
||||
uint8_t reserved;
|
||||
uint8_t reserved;
|
||||
int8_t class;
|
||||
} __packed mec_members;
|
||||
|
||||
|
@ -613,7 +615,7 @@ struct mfi_evtarg_pd_address {
|
|||
} __packed encl_address;
|
||||
} __packed address;
|
||||
|
||||
uint8_t scsi_dev_type;
|
||||
uint8_t scsi_dev_type;
|
||||
|
||||
union {
|
||||
uint8_t port_bitmap;
|
||||
|
@ -641,7 +643,7 @@ struct mfi_evt_detail {
|
|||
uint8_t sense[64];
|
||||
} __packed cdb_sense;
|
||||
|
||||
struct mfi_evtarg_ld ld;
|
||||
struct mfi_evtarg_ld ld;
|
||||
|
||||
struct {
|
||||
struct mfi_evtarg_ld ld;
|
||||
|
@ -762,25 +764,25 @@ struct mfi_ctrl_props {
|
|||
uint16_t mcp_ecc_bucket_leak_rate;
|
||||
uint8_t mcp_restore_hotspare_on_insertion;
|
||||
uint8_t mcp_expose_encl_devices;
|
||||
uint8_t maintainPdFailHistory;
|
||||
uint8_t disallowHostRequestReordering;
|
||||
uint8_t maintainPdFailHistory;
|
||||
uint8_t disallowHostRequestReordering;
|
||||
/* set TRUE to abort CC on detecting an inconsistency */
|
||||
uint8_t abortCCOnError;
|
||||
uint8_t abortCCOnError;
|
||||
/* load balance mode (MR_LOAD_BALANCE_MODE) */
|
||||
uint8_t loadBalanceMode;
|
||||
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
|
||||
*/
|
||||
uint8_t disableAutoDetectBackplane;
|
||||
uint8_t disableAutoDetectBackplane;
|
||||
/*
|
||||
* % of source LD to be reserved for a VDs snapshot in snapshot
|
||||
* repository, for metadata and user data: 1=5%, 2=10%, 3=15% and so on
|
||||
*/
|
||||
uint8_t snapVDSpace;
|
||||
uint8_t snapVDSpace;
|
||||
|
||||
/*
|
||||
* Add properties that can be controlled by a bit in the following
|
||||
|
@ -789,24 +791,25 @@ struct mfi_ctrl_props {
|
|||
struct {
|
||||
/* set TRUE to disable copyBack (0=copback enabled) */
|
||||
uint32_t copyBackDisabled :1;
|
||||
uint32_t SMARTerEnabled :1;
|
||||
uint32_t prCorrectUnconfiguredAreas :1;
|
||||
uint32_t useFdeOnly :1;
|
||||
uint32_t disableNCQ :1;
|
||||
uint32_t SSDSMARTerEnabled :1;
|
||||
uint32_t SSDPatrolReadEnabled :1;
|
||||
uint32_t enableSpinDownUnconfigured :1;
|
||||
uint32_t autoEnhancedImport :1;
|
||||
uint32_t enableSecretKeyControl :1;
|
||||
uint32_t disableOnlineCtrlReset :1;
|
||||
uint32_t SMARTerEnabled :1;
|
||||
uint32_t prCorrectUnconfiguredAreas :1;
|
||||
uint32_t useFdeOnly :1;
|
||||
uint32_t disableNCQ :1;
|
||||
uint32_t SSDSMARTerEnabled :1;
|
||||
uint32_t SSDPatrolReadEnabled :1;
|
||||
uint32_t enableSpinDownUnconfigured :1;
|
||||
uint32_t autoEnhancedImport :1;
|
||||
uint32_t enableSecretKeyControl :1;
|
||||
uint32_t disableOnlineCtrlReset :1;
|
||||
uint32_t allowBootWithPinnedCache :1;
|
||||
uint32_t disableSpinDownHS :1;
|
||||
uint32_t enableJBOD :1;
|
||||
uint32_t disableSpinDownHS :1;
|
||||
uint32_t enableJBOD :1;
|
||||
uint32_t reserved :18;
|
||||
} 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
|
||||
|
@ -840,7 +843,7 @@ struct mfi_info_host {
|
|||
uint64_t mih_port_addr[8];
|
||||
} __packed;
|
||||
|
||||
/* device interface info */
|
||||
/* device interface info */
|
||||
struct mfi_info_device {
|
||||
uint8_t mid_type;
|
||||
#define MFI_INFO_DEV_SPI 0x01
|
||||
|
@ -854,10 +857,10 @@ struct mfi_info_device {
|
|||
|
||||
/* firmware component info */
|
||||
struct mfi_info_component {
|
||||
char mic_name[8];
|
||||
char mic_version[32];
|
||||
char mic_build_date[16];
|
||||
char mic_build_time[16];
|
||||
char mic_name[8];
|
||||
char mic_version[32];
|
||||
char mic_build_date[16];
|
||||
char mic_build_time[16];
|
||||
} __packed;
|
||||
|
||||
/* controller info from MFI_DCMD_CTRL_GETINFO. */
|
||||
|
@ -914,7 +917,7 @@ struct mfi_ctrl_info {
|
|||
#define MFI_INFO_RAID_6 0x10
|
||||
|
||||
uint32_t mci_adapter_ops;
|
||||
#define MFI_INFO_AOPS_RBLD_RATE 0x0001
|
||||
#define MFI_INFO_AOPS_RBLD_RATE 0x0001
|
||||
#define MFI_INFO_AOPS_CC_RATE 0x0002
|
||||
#define MFI_INFO_AOPS_BGI_RATE 0x0004
|
||||
#define MFI_INFO_AOPS_RECON_RATE 0x0008
|
||||
|
@ -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,103 +1171,6 @@ struct mfi_array {
|
|||
} pd[MFI_MAX_PD_ARRAY];
|
||||
} __packed;
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_CAPACITY_INFO */
|
||||
struct mfi_bbu_capacity_info {
|
||||
uint16_t relative_charge;
|
||||
uint16_t absolute_charge;
|
||||
uint16_t remaining_capacity;
|
||||
uint16_t full_charge_capacity;
|
||||
uint16_t run_time_to_empty;
|
||||
uint16_t average_time_to_empty;
|
||||
uint16_t average_time_to_full;
|
||||
uint16_t cycle_count;
|
||||
uint16_t max_error;
|
||||
uint16_t remaining_capacity_alarm;
|
||||
uint16_t remaining_time_alarm;
|
||||
uint8_t reserved[26];
|
||||
} __packed;
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_DESIGN_INFO */
|
||||
struct mfi_bbu_design_info {
|
||||
uint32_t mfg_date;
|
||||
uint16_t design_capacity;
|
||||
uint16_t design_voltage;
|
||||
uint16_t spec_info;
|
||||
uint16_t serial_number;
|
||||
uint16_t pack_stat_config;
|
||||
uint8_t mfg_name[12];
|
||||
uint8_t device_name[8];
|
||||
uint8_t device_chemistry[8];
|
||||
uint8_t mfg_data[8];
|
||||
uint8_t reserved[17];
|
||||
} __packed;
|
||||
|
||||
struct mfi_ibbu_state {
|
||||
uint16_t gas_guage_status;
|
||||
uint16_t relative_charge;
|
||||
uint16_t charger_system_state;
|
||||
uint16_t charger_system_ctrl;
|
||||
uint16_t charging_current;
|
||||
uint16_t absolute_charge;
|
||||
uint16_t max_error;
|
||||
uint8_t reserved[18];
|
||||
} __packed;
|
||||
|
||||
struct mfi_bbu_state {
|
||||
uint16_t gas_guage_status;
|
||||
uint16_t relative_charge;
|
||||
uint16_t charger_status;
|
||||
uint16_t remaining_capacity;
|
||||
uint16_t full_charge_capacity;
|
||||
uint8_t is_SOH_good;
|
||||
uint8_t reserved[21];
|
||||
} __packed;
|
||||
|
||||
union mfi_bbu_status_detail {
|
||||
struct mfi_ibbu_state ibbu;
|
||||
struct mfi_bbu_state bbu;
|
||||
};
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_STATUS */
|
||||
struct mfi_bbu_status {
|
||||
uint8_t battery_type;
|
||||
#define MFI_BBU_TYPE_NONE 0
|
||||
#define MFI_BBU_TYPE_IBBU 1
|
||||
#define MFI_BBU_TYPE_BBU 2
|
||||
uint8_t reserved;
|
||||
uint16_t voltage;
|
||||
int16_t current;
|
||||
uint16_t temperature;
|
||||
uint32_t fw_status;
|
||||
#define MFI_BBU_STATE_PACK_MISSING (1 << 0)
|
||||
#define MFI_BBU_STATE_VOLTAGE_LOW (1 << 1)
|
||||
#define MFI_BBU_STATE_TEMPERATURE_HIGH (1 << 2)
|
||||
#define MFI_BBU_STATE_CHARGE_ACTIVE (1 << 3)
|
||||
#define MFI_BBU_STATE_DISCHARGE_ACTIVE (1 << 4)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_REQ (1 << 5)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_ACTIVE (1 << 6)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_FAIL (1 << 7)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_TIMEOUT (1 << 8)
|
||||
#define MFI_BBU_STATE_I2C_ERR_DETECT (1 << 9)
|
||||
#define MFI_BBU_STATE_REPLACE_PACK (1 << 10)
|
||||
#define MFI_BBU_STATE_CAPACITY_LOW (1 << 11)
|
||||
#define MFI_BBU_STATE_LEARN_REQUIRED (1 << 12)
|
||||
#define MFI_BBU_STATE_BAD_IBBU ( \
|
||||
MFI_BBU_STATE_PACK_MISSING | \
|
||||
MFI_BBU_STATE_VOLTAGE_LOW | \
|
||||
MFI_BBU_STATE_DISCHARGE_ACTIVE | \
|
||||
MFI_BBU_STATE_LEARN_CYC_REQ | \
|
||||
MFI_BBU_STATE_LEARN_CYC_ACTIVE | \
|
||||
MFI_BBU_STATE_REPLACE_PACK | \
|
||||
MFI_BBU_STATE_CAPACITY_LOW)
|
||||
#define MFI_BBU_STATE_BAD_BBU ( \
|
||||
MFI_BBU_STATE_PACK_MISSING | \
|
||||
MFI_BBU_STATE_REPLACE_PACK | \
|
||||
MFI_BBU_STATE_CAPACITY_LOW)
|
||||
uint8_t pad[20];
|
||||
union mfi_bbu_status_detail detail;
|
||||
} __packed;
|
||||
|
||||
struct mfi_hotspare {
|
||||
struct mfi_pd mhs_pd;
|
||||
uint8_t mhs_type;
|
||||
|
@ -1300,10 +1204,108 @@ struct mfi_conf {
|
|||
struct mfi_hotspare mfc_hs[1];
|
||||
} __packed;
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_CAPACITY_INFO */
|
||||
struct mfi_bbu_capacity_info {
|
||||
uint16_t relative_charge;
|
||||
uint16_t absolute_charge;
|
||||
uint16_t remaining_capacity;
|
||||
uint16_t full_charge_capacity;
|
||||
uint16_t run_time_to_empty;
|
||||
uint16_t average_time_to_empty;
|
||||
uint16_t average_time_to_full;
|
||||
uint16_t cycle_count;
|
||||
uint16_t max_error;
|
||||
uint16_t remaining_capacity_alarm;
|
||||
uint16_t remaining_time_alarm;
|
||||
uint8_t reserved[26];
|
||||
} __packed;
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_DESIGN_INFO */
|
||||
struct mfi_bbu_design_info {
|
||||
uint32_t mfg_date;
|
||||
uint16_t design_capacity;
|
||||
uint16_t design_voltage;
|
||||
uint16_t spec_info;
|
||||
uint16_t serial_number;
|
||||
uint16_t pack_stat_config;
|
||||
uint8_t mfg_name[12];
|
||||
uint8_t device_name[8];
|
||||
uint8_t device_chemistry[8];
|
||||
uint8_t mfg_data[8];
|
||||
uint8_t reserved[17];
|
||||
} __packed;
|
||||
|
||||
struct mfi_ibbu_state {
|
||||
uint16_t gas_guage_status;
|
||||
uint16_t relative_charge;
|
||||
uint16_t charger_system_state;
|
||||
uint16_t charger_system_ctrl;
|
||||
uint16_t charging_current;
|
||||
uint16_t absolute_charge;
|
||||
uint16_t max_error;
|
||||
uint8_t reserved[18];
|
||||
} __packed;
|
||||
|
||||
struct mfi_bbu_state {
|
||||
uint16_t gas_guage_status;
|
||||
uint16_t relative_charge;
|
||||
uint16_t charger_status;
|
||||
uint16_t remaining_capacity;
|
||||
uint16_t full_charge_capacity;
|
||||
uint8_t is_SOH_good;
|
||||
uint8_t reserved[21];
|
||||
} __packed;
|
||||
|
||||
union mfi_bbu_status_detail {
|
||||
struct mfi_ibbu_state ibbu;
|
||||
struct mfi_bbu_state bbu;
|
||||
};
|
||||
|
||||
/* informations from MR_DCMD_BBU_GET_STATUS */
|
||||
struct mfi_bbu_status {
|
||||
uint8_t battery_type;
|
||||
#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; /* 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)
|
||||
#define MFI_BBU_STATE_TEMPERATURE_HIGH (1 << 2)
|
||||
#define MFI_BBU_STATE_CHARGE_ACTIVE (1 << 3)
|
||||
#define MFI_BBU_STATE_DISCHARGE_ACTIVE (1 << 4)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_REQ (1 << 5)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_ACTIVE (1 << 6)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_FAIL (1 << 7)
|
||||
#define MFI_BBU_STATE_LEARN_CYC_TIMEOUT (1 << 8)
|
||||
#define MFI_BBU_STATE_I2C_ERR_DETECT (1 << 9)
|
||||
#define MFI_BBU_STATE_REPLACE_PACK (1 << 10)
|
||||
#define MFI_BBU_STATE_CAPACITY_LOW (1 << 11)
|
||||
#define MFI_BBU_STATE_LEARN_REQUIRED (1 << 12)
|
||||
#define MFI_BBU_STATE_BAD_IBBU ( \
|
||||
MFI_BBU_STATE_PACK_MISSING | \
|
||||
MFI_BBU_STATE_VOLTAGE_LOW | \
|
||||
MFI_BBU_STATE_DISCHARGE_ACTIVE | \
|
||||
MFI_BBU_STATE_LEARN_CYC_REQ | \
|
||||
MFI_BBU_STATE_LEARN_CYC_ACTIVE | \
|
||||
MFI_BBU_STATE_REPLACE_PACK | \
|
||||
MFI_BBU_STATE_CAPACITY_LOW)
|
||||
#define MFI_BBU_STATE_BAD_BBU ( \
|
||||
MFI_BBU_STATE_PACK_MISSING | \
|
||||
MFI_BBU_STATE_REPLACE_PACK | \
|
||||
MFI_BBU_STATE_CAPACITY_LOW)
|
||||
uint8_t pad[20];
|
||||
union mfi_bbu_status_detail detail;
|
||||
} __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 {
|
||||
|
@ -1334,40 +1336,40 @@ typedef struct _mpi2_scsi_io_vendor_unique {
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#define NA_MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */
|
||||
#define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) /* SCSI Task Management */
|
||||
#define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */
|
||||
#define MPI2_FUNCTION_IOC_FACTS (0x03) /* IOC Facts */
|
||||
#define MPI2_FUNCTION_CONFIG (0x04) /* Configuration */
|
||||
#define MPI2_FUNCTION_PORT_FACTS (0x05) /* Port Facts */
|
||||
#define MPI2_FUNCTION_PORT_ENABLE (0x06) /* Port Enable */
|
||||
#define MPI2_FUNCTION_EVENT_NOTIFICATION (0x07) /* Event Notification */
|
||||
#define MPI2_FUNCTION_EVENT_ACK (0x08) /* Event Acknowledge */
|
||||
#define MPI2_FUNCTION_FW_DOWNLOAD (0x09) /* FW Download */
|
||||
#define MPI2_FUNCTION_TARGET_ASSIST (0x0B) /* Target Assist */
|
||||
#define MPI2_FUNCTION_TARGET_STATUS_SEND (0x0C) /* Target Status Send */
|
||||
#define MPI2_FUNCTION_TARGET_MODE_ABORT (0x0D) /* Target Mode Abort */
|
||||
#define MPI2_FUNCTION_FW_UPLOAD (0x12) /* FW Upload */
|
||||
#define MPI2_FUNCTION_RAID_ACTION (0x15) /* RAID Action */
|
||||
#define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) /* SCSI IO RAID Passthrough */
|
||||
#define MPI2_FUNCTION_TOOLBOX (0x17) /* Toolbox */
|
||||
#define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) /* SCSI Enclosure Processor */
|
||||
#define MPI2_FUNCTION_SMP_PASSTHROUGH (0x1A) /* SMP Passthrough */
|
||||
#define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) /* SAS IO Unit Control */
|
||||
#define MPI2_FUNCTION_SATA_PASSTHROUGH (0x1C) /* SATA Passthrough */
|
||||
#define MPI2_FUNCTION_DIAG_BUFFER_POST (0x1D) /* Diagnostic Buffer Post */
|
||||
#define MPI2_FUNCTION_DIAG_RELEASE (0x1E) /* Diagnostic Release */
|
||||
#define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) /* Target Command Buffer Post Base */
|
||||
#define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */
|
||||
#define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */
|
||||
#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */
|
||||
#define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* Power Management Control */
|
||||
#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */
|
||||
#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */
|
||||
#define NA_MPI2_FUNCTION_SCSI_IO_REQUEST (0x00) /* SCSI IO */
|
||||
#define MPI2_FUNCTION_SCSI_TASK_MGMT (0x01) /* SCSI Task Management */
|
||||
#define MPI2_FUNCTION_IOC_INIT (0x02) /* IOC Init */
|
||||
#define MPI2_FUNCTION_IOC_FACTS (0x03) /* IOC Facts */
|
||||
#define MPI2_FUNCTION_CONFIG (0x04) /* Configuration */
|
||||
#define MPI2_FUNCTION_PORT_FACTS (0x05) /* Port Facts */
|
||||
#define MPI2_FUNCTION_PORT_ENABLE (0x06) /* Port Enable */
|
||||
#define MPI2_FUNCTION_EVENT_NOTIFICATION (0x07) /* Event Notification */
|
||||
#define MPI2_FUNCTION_EVENT_ACK (0x08) /* Event Acknowledge */
|
||||
#define MPI2_FUNCTION_FW_DOWNLOAD (0x09) /* FW Download */
|
||||
#define MPI2_FUNCTION_TARGET_ASSIST (0x0B) /* Target Assist */
|
||||
#define MPI2_FUNCTION_TARGET_STATUS_SEND (0x0C) /* Target Status Send */
|
||||
#define MPI2_FUNCTION_TARGET_MODE_ABORT (0x0D) /* Target Mode Abort */
|
||||
#define MPI2_FUNCTION_FW_UPLOAD (0x12) /* FW Upload */
|
||||
#define MPI2_FUNCTION_RAID_ACTION (0x15) /* RAID Action */
|
||||
#define MPI2_FUNCTION_RAID_SCSI_IO_PASSTHROUGH (0x16) /* SCSI IO RAID Passthrough */
|
||||
#define MPI2_FUNCTION_TOOLBOX (0x17) /* Toolbox */
|
||||
#define MPI2_FUNCTION_SCSI_ENCLOSURE_PROCESSOR (0x18) /* SCSI Enclosure Processor */
|
||||
#define MPI2_FUNCTION_SMP_PASSTHROUGH (0x1A) /* SMP Passthrough */
|
||||
#define MPI2_FUNCTION_SAS_IO_UNIT_CONTROL (0x1B) /* SAS IO Unit Control */
|
||||
#define MPI2_FUNCTION_SATA_PASSTHROUGH (0x1C) /* SATA Passthrough */
|
||||
#define MPI2_FUNCTION_DIAG_BUFFER_POST (0x1D) /* Diagnostic Buffer Post */
|
||||
#define MPI2_FUNCTION_DIAG_RELEASE (0x1E) /* Diagnostic Release */
|
||||
#define MPI2_FUNCTION_TARGET_CMD_BUF_BASE_POST (0x24) /* Target Command Buffer Post Base */
|
||||
#define MPI2_FUNCTION_TARGET_CMD_BUF_LIST_POST (0x25) /* Target Command Buffer Post List */
|
||||
#define MPI2_FUNCTION_RAID_ACCELERATOR (0x2C) /* RAID Accelerator */
|
||||
#define MPI2_FUNCTION_HOST_BASED_DISCOVERY_ACTION (0x2F) /* Host Based Discovery Action */
|
||||
#define MPI2_FUNCTION_PWR_MGMT_CONTROL (0x30) /* Power Management Control */
|
||||
#define MPI2_FUNCTION_MIN_PRODUCT_SPECIFIC (0xF0) /* beginning of product-specific range */
|
||||
#define MPI2_FUNCTION_MAX_PRODUCT_SPECIFIC (0xFF) /* end of product-specific range */
|
||||
|
||||
/* Doorbell functions */
|
||||
#define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40)
|
||||
#define MPI2_FUNCTION_HANDSHAKE (0x42)
|
||||
#define MPI2_FUNCTION_IOC_MESSAGE_UNIT_RESET (0x40)
|
||||
#define MPI2_FUNCTION_HANDSHAKE (0x42)
|
||||
|
||||
/*****************************************************************************
|
||||
*
|
||||
|
|
|
@ -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, "" }
|
||||
};
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
@ -197,8 +197,8 @@ struct mfii_task_mgmt {
|
|||
|
||||
/* We currently don't know the full details of the following struct */
|
||||
struct mfii_foreign_scan_cfg {
|
||||
char data[24];
|
||||
} __packed;
|
||||
char data[24];
|
||||
} __packed;
|
||||
|
||||
struct mfii_foreign_scan_info {
|
||||
uint32_t count; /* Number of foreign configs found */
|
||||
|
@ -338,8 +338,8 @@ struct mfii_softc {
|
|||
int sc_target_lds[MFI_MAX_LD];
|
||||
|
||||
/* bio */
|
||||
struct mfi_conf *sc_cfg;
|
||||
struct mfi_ctrl_info sc_info;
|
||||
struct mfi_conf *sc_cfg;
|
||||
struct mfi_ctrl_info sc_info;
|
||||
struct mfi_ld_list sc_ld_list;
|
||||
struct mfi_ld_details *sc_ld_details; /* array to all logical disks */
|
||||
int sc_no_pd; /* used physical disks */
|
||||
|
@ -372,7 +372,7 @@ struct mfii_softc {
|
|||
uint32_t mfii_debug = 0
|
||||
/* | MFII_D_CMD */
|
||||
/* | MFII_D_INTR */
|
||||
| MFII_D_MISC
|
||||
| MFII_D_MISC
|
||||
/* | MFII_D_DMA */
|
||||
/* | MFII_D_IOCTL */
|
||||
/* | MFII_D_RW */
|
||||
|
@ -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);
|
||||
|
@ -1011,7 +1007,7 @@ mfii_childdetached(device_t self, device_t child)
|
|||
sc->sc_child = NULL;
|
||||
}
|
||||
|
||||
static bool
|
||||
static bool
|
||||
mfii_suspend(device_t dev, const pmf_qual_t *q)
|
||||
{
|
||||
/* XXX to be implemented */
|
||||
|
@ -1020,23 +1016,23 @@ mfii_suspend(device_t dev, const pmf_qual_t *q)
|
|||
|
||||
static bool
|
||||
mfii_resume(device_t dev, const pmf_qual_t *q)
|
||||
{
|
||||
{
|
||||
/* XXX to be implemented */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
static bool
|
||||
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;
|
||||
|
@ -1061,7 +1057,7 @@ mfii_shutdown(device_t dev, int how)
|
|||
NULL, 0, MFII_DATA_NONE, true)) {
|
||||
aprint_error_dev(dev, "shutdown: "
|
||||
"firmware shutdown failed\n");
|
||||
rv = false;
|
||||
rv = false;
|
||||
goto fail;
|
||||
}
|
||||
} else {
|
||||
|
@ -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;
|
||||
|
@ -1274,13 +1270,13 @@ mfii_aen(struct work *wk, void *arg)
|
|||
case MR_EVT_PD_INSERTED_EXT:
|
||||
if (med->med_arg_type != MR_EVT_ARGS_PD_ADDRESS)
|
||||
break;
|
||||
|
||||
|
||||
mfii_aen_pd_insert(sc, &med->args.pd_address);
|
||||
break;
|
||||
case MR_EVT_PD_REMOVED_EXT:
|
||||
case MR_EVT_PD_REMOVED_EXT:
|
||||
if (med->med_arg_type != MR_EVT_ARGS_PD_ADDRESS)
|
||||
break;
|
||||
|
||||
|
||||
mfii_aen_pd_remove(sc, &med->args.pd_address);
|
||||
break;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1354,7 +1350,7 @@ mfii_aen_ld_update(struct mfii_softc *sc)
|
|||
for (i = 0; i < MFI_MAX_LD; i++) {
|
||||
old = sc->sc_target_lds[i];
|
||||
nld = newlds[i];
|
||||
|
||||
|
||||
if (old == -1 && nld != -1) {
|
||||
printf("%s: logical drive %d added (target %d)\n",
|
||||
DEVNAME(sc), i, 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;
|
||||
|
@ -1938,9 +1934,9 @@ mfii_initialise_firmware(struct mfii_softc *sc)
|
|||
iiq->reply_descriptor_post_queue_address_hi =
|
||||
htole32(MFII_DMA_DVA(sc->sc_reply_postq) >> 32);
|
||||
|
||||
iiq->system_request_frame_base_address_lo =
|
||||
iiq->system_request_frame_base_address_lo =
|
||||
htole32(MFII_DMA_DVA(sc->sc_requests));
|
||||
iiq->system_request_frame_base_address_hi =
|
||||
iiq->system_request_frame_base_address_hi =
|
||||
htole32(MFII_DMA_DVA(sc->sc_requests) >> 32);
|
||||
|
||||
iiq->timestamp = htole64(time_uptime);
|
||||
|
@ -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);
|
||||
|
@ -2022,7 +2018,7 @@ mfii_postq(struct mfii_softc *sc)
|
|||
|
||||
for (;;) {
|
||||
rdp = &postq[sc->sc_reply_postq_index];
|
||||
DNPRINTF(MFII_D_INTR, "%s: mfii_postq index %d flags 0x%x data 0x%x\n",
|
||||
DNPRINTF(MFII_D_INTR, "%s: mfii_postq index %d flags 0x%x data 0x%x\n",
|
||||
DEVNAME(sc), sc->sc_reply_postq_index, rdp->reply_flags,
|
||||
rdp->data == 0xffffffff);
|
||||
if ((rdp->reply_flags & MPII_REPLY_DESCR_TYPE_MASK) ==
|
||||
|
@ -2060,9 +2056,9 @@ mfii_postq(struct mfii_softc *sc)
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mfii_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
||||
void *arg)
|
||||
void *arg)
|
||||
{
|
||||
struct scsipi_periph *periph;
|
||||
struct scsipi_xfer *xs;
|
||||
|
@ -2072,7 +2068,7 @@ mfii_scsipi_request(struct scsipi_channel *chan, scsipi_adapter_req_t req,
|
|||
int timeout;
|
||||
int target;
|
||||
|
||||
switch(req) {
|
||||
switch (req) {
|
||||
case ADAPTER_REQ_GROW_RESOURCES:
|
||||
/* Not supported. */
|
||||
return;
|
||||
|
@ -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;
|
||||
|
@ -2916,7 +2912,7 @@ mfii_ioctl_vol(struct mfii_softc *sc, struct bioc_vol *bv)
|
|||
strlcpy(bv->bv_dev, sc->sc_ld_details[i].mld_cfg.mlc_prop.mlp_name,
|
||||
sizeof(bv->bv_dev));
|
||||
|
||||
switch(sc->sc_ld_list.mll_list[i].mll_state) {
|
||||
switch (sc->sc_ld_list.mll_list[i].mll_state) {
|
||||
case MFI_LD_OFFLINE:
|
||||
bv->bv_status = BIOC_SVOFFLINE;
|
||||
break;
|
||||
|
@ -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;
|
||||
|
@ -3141,7 +3147,7 @@ mfii_ioctl_alarm(struct mfii_softc *sc, struct bioc_alarm *ba)
|
|||
int8_t ret;
|
||||
mfii_direction_t dir = MFII_DATA_NONE;
|
||||
|
||||
switch(ba->ba_opcode) {
|
||||
switch (ba->ba_opcode) {
|
||||
case BIOC_SADISABLE:
|
||||
opc = MR_DCMD_SPEAKER_DISABLE;
|
||||
break;
|
||||
|
@ -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;
|
||||
|
@ -3720,7 +3727,7 @@ mfii_bbu(struct mfii_softc *sc, envsys_data_t *edata)
|
|||
}
|
||||
|
||||
status = le32toh(bbu.fw_status) & mask;
|
||||
switch(edata->sensor) {
|
||||
switch (edata->sensor) {
|
||||
case 0:
|
||||
edata->value_cur = (status || soh_bad) ? 0 : 1;
|
||||
edata->state =
|
||||
|
@ -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;
|
||||
|
@ -3845,10 +3852,10 @@ mfii_destroy_sensors(struct mfii_softc *sc)
|
|||
sysmon_envsys_unregister(sc->sc_sme);
|
||||
sc->sc_sme = NULL;
|
||||
free(sc->sc_sensors, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
mfii_refresh_sensor(struct sysmon_envsys *sme, envsys_data_t *edata)
|
||||
{
|
||||
struct mfii_softc *sc = sme->sme_cookie;
|
||||
|
|
Loading…
Reference in New Issue