diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2004-03-19 02:47:37 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2004-03-19 02:47:37 +0000 |
commit | e3715746fd73649fe1a6c8b790f80c9fdb45d310 (patch) | |
tree | db085df8315667948f561367032b4fca3e898213 /sys/dev/ic | |
parent | 5aafb62ee99866067da199675ce0e1c097461bc7 (diff) |
Tweak isr to speed it up, panic in correct spot, prepare for more firmware
handling and error handling.
From Marco Peereboom, with suggestions from LSI.
ok deraadt@.
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/mpt.c | 34 | ||||
-rw-r--r-- | sys/dev/ic/mpt_openbsd.c | 18 | ||||
-rw-r--r-- | sys/dev/ic/mpt_openbsd.h | 3 |
3 files changed, 49 insertions, 6 deletions
diff --git a/sys/dev/ic/mpt.c b/sys/dev/ic/mpt.c index 9a68392cd91..f10a2b91c24 100644 --- a/sys/dev/ic/mpt.c +++ b/sys/dev/ic/mpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt.c,v 1.2 2004/03/17 00:47:06 krw Exp $ */ +/* $OpenBSD: mpt.c,v 1.3 2004/03/19 02:47:36 krw Exp $ */ /* $NetBSD: mpt.c,v 1.4 2003/11/02 11:07:45 wiz Exp $ */ /* @@ -98,9 +98,22 @@ void mpt_check_doorbell(mpt_softc_t *mpt) { u_int32_t db = mpt_rd_db(mpt); - if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { - mpt_prt(mpt, "Device not running"); - mpt_print_db(db); + + /* prepare this function for error path */ + /* if (MPT_STATE(db) != MPT_DB_STATE_RUNNING) { */ + switch (MPT_STATE(db)) { + case MPT_DB_STATE_FAULT: + case MPT_DB_STATE_READY: + /* 1030 needs reset, issue IOC_INIT */ + /* FIXME */ + if (mpt_init(mpt, MPT_DB_INIT_HOST) != 0) + panic("%s: Can't get MPT IOC operational", + mpt->mpt_dev.dv_xname); + break; + + default: + /* nothing done for now */ + break; } } @@ -201,6 +214,10 @@ mpt_hard_reset(mpt_softc_t *mpt) /* Note that if there is no valid firmware to run, the doorbell will remain in the reset state (0x00000000) */ + if (mpt->download_fw) { + /* FIXME do download boot we panic for now */ + panic("FWDownloadBoot not implemented yet."); + } } /* @@ -1131,6 +1148,15 @@ mpt_init(mpt_softc_t *mpt, u_int32_t who) /* save the firmware upload required flag */ mpt->fw_download_boot = facts.Flags & MPI_IOCFACTS_FLAGS_FW_DOWNLOAD_BOOT; + + /* if download boot set download flag */ + if (mpt->fw_download_boot) { + mpt->download_fw = 1; + } + else { + mpt->download_fw = 0; + } + mpt->fw_image_size = facts.FWImageSize; if (mpt_get_portfacts(mpt, &pfp) != MPT_OK) { diff --git a/sys/dev/ic/mpt_openbsd.c b/sys/dev/ic/mpt_openbsd.c index 4bf4fd0e394..8d50bde5b80 100644 --- a/sys/dev/ic/mpt_openbsd.c +++ b/sys/dev/ic/mpt_openbsd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt_openbsd.c,v 1.6 2004/03/17 00:47:06 krw Exp $ */ +/* $OpenBSD: mpt_openbsd.c,v 1.7 2004/03/19 02:47:36 krw Exp $ */ /* $NetBSD: mpt_netbsd.c,v 1.7 2003/07/14 15:47:11 lukem Exp $ */ /* @@ -589,10 +589,26 @@ mpt_intr(void *arg) int nrepl = 0; uint32_t reply; + /* if ((mpt_read(mpt, MPT_OFFSET_INTR_STATUS) & MPT_INTR_REPLY_READY) == 0) return (0); + */ + + /* + * Speed up trick to save one PCI read. + * Reply FIFO replies 0xffffffff whenever + * MPT_OFFSET_INTR_STATUS & MPT_INTR_REPLY_READY == 0 + * + */ reply = mpt_pop_reply_queue(mpt); + + if (reply == 0xffffffff) { + /* check doorbell, this is error path not IO path */ + /* FIXME for now ignore strays and doorbells */ + return (0); + } + while (reply != MPT_REPLY_EMPTY) { nrepl++; if (mpt->verbose > 1) { diff --git a/sys/dev/ic/mpt_openbsd.h b/sys/dev/ic/mpt_openbsd.h index 3238c105577..c1586c7b9a9 100644 --- a/sys/dev/ic/mpt_openbsd.h +++ b/sys/dev/ic/mpt_openbsd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mpt_openbsd.h,v 1.4 2004/03/17 00:47:06 krw Exp $ */ +/* $OpenBSD: mpt_openbsd.h,v 1.5 2004/03/19 02:47:36 krw Exp $ */ /* $NetBSD: mpt_netbsd.h,v 1.2 2003/04/16 23:02:14 thorpej Exp $ */ /* @@ -266,6 +266,7 @@ typedef struct mpt_softc { uint32_t success; /* success after timeout */ uint8_t upload_fw; /* If set, do a fw upload */ + uint8_t download_fw; /* If set, do a fw download */ /* Firmware memory */ bus_dmamap_t fw_dmap; int fw_rseg; |