summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/ic/mfi.c31
-rw-r--r--sys/dev/ic/mfireg.h3
-rw-r--r--sys/dev/ic/mfivar.h8
3 files changed, 37 insertions, 5 deletions
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index 6b32f901eb6..8fa08bb4005 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.13 2006/04/16 18:14:23 marco Exp $ */
+/* $OpenBSD: mfi.c,v 1.14 2006/04/16 23:35:43 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -256,7 +256,7 @@ mfiminphys(struct buf *bp)
int
mfi_attach(struct mfi_softc *sc)
{
- uint32_t status;
+ uint32_t status, frames;
if (mfi_transition_firmware(sc))
return (1);
@@ -273,13 +273,38 @@ mfi_attach(struct mfi_softc *sc)
if (sc->sc_pcq == NULL) {
printf("%s: unable to allocate reply queue memory\n",
DEVNAME(sc));
- return (1);
+ goto nopcq;
+ }
+
+ /* frame memory */
+ /* we are not doing 64 bit IO so only calculate # of 32 bit frames */
+ frames = (sizeof(struct mfi_sg32) * sc->sc_max_sgl +
+ MFI_FRAME_SIZE - 1) / MFI_FRAME_SIZE + 1;
+ sc->sc_frames = mfi_allocmem(sc, frames * MFI_FRAME_SIZE);
+ if (sc->sc_frames == NULL) {
+ printf("%s: unable to allocate frame memory\n",
+ DEVNAME(sc));
+ goto noframe;
+ }
+
+ /* sense memory */
+ sc->sc_sense = mfi_allocmem(sc, sc->sc_max_cmds * MFI_SENSE_SIZE);
+ if (sc->sc_sense == NULL) {
+ printf("%s: unable to allocate sense memory\n",
+ DEVNAME(sc));
+ goto nosense;
}
/* enable interrupts */
mfi_write(sc, MFI_OMSK, MFI_ENABLE_INTR);
return (0);
+nosense:
+ mfi_freemem(sc, sc->sc_frames);
+noframe:
+ mfi_freemem(sc, sc->sc_pcq);
+nopcq:
+ return (1);
}
int
diff --git a/sys/dev/ic/mfireg.h b/sys/dev/ic/mfireg.h
index 17676bd141a..017f7398eef 100644
--- a/sys/dev/ic/mfireg.h
+++ b/sys/dev/ic/mfireg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfireg.h,v 1.5 2006/04/16 16:41:29 marco Exp $ */
+/* $OpenBSD: mfireg.h,v 1.6 2006/04/16 23:35:43 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -17,6 +17,7 @@
#define MFI_FRAME_SIZE 64
+#define MFI_SENSE_SIZE 128
#define MFI_OSTS_INTR_VALID 0x00000002 /* valid interrupt */
#define MFI_INVALID_CTX 0xffffffff
#define MFI_ENABLE_INTR 0x01
diff --git a/sys/dev/ic/mfivar.h b/sys/dev/ic/mfivar.h
index 04ae366d40b..523246809d4 100644
--- a/sys/dev/ic/mfivar.h
+++ b/sys/dev/ic/mfivar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfivar.h,v 1.8 2006/04/16 17:10:08 marco Exp $ */
+/* $OpenBSD: mfivar.h,v 1.9 2006/04/16 23:35:43 marco Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -100,6 +100,12 @@ struct mfi_softc {
/* producer/consumer pointers and reply queue */
struct mfi_mem *sc_pcq;
+ /* frame memory */
+ struct mfi_mem *sc_frames;
+
+ /* sense memory */
+ struct mfi_mem *sc_sense;
+
mfi_queue_head sc_ccb_freeq;
};