summaryrefslogtreecommitdiff
path: root/sys/dev/ic/ami.c
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-05-21 18:28:25 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-05-21 18:28:25 +0000
commit48dfa53c5c094f8a22985983b506e73f75556de2 (patch)
tree8c4c5c173ef85afd9a443fce31040f039aa9e113 /sys/dev/ic/ami.c
parentc4382cdff568b2bef44f3f98e57719b5e0ca04b4 (diff)
the maximum possible number of ccbs that a megaraid can use (126 of them)
is preallocated in the softc, even if the driver is only ever going to use one of them when running. this allocates them separately during attach as a first step toward having the driver only allocate as many ccbs as the firmware can support. ok krw@
Diffstat (limited to 'sys/dev/ic/ami.c')
-rw-r--r--sys/dev/ic/ami.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index 347a76c334a..a3bdda90670 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.158 2006/05/21 03:33:53 dlg Exp $ */
+/* $OpenBSD: ami.c,v 1.159 2006/05/21 18:28:24 dlg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -315,11 +315,18 @@ ami_attach(struct ami_softc *sc)
sc->sc_mbox_pa = htole32(AMIMEM_DVA(sc->sc_mbox_am));
AMI_DPRINTF(AMI_D_CMD, ("mbox_pa=%llx ", sc->sc_mbox_pa));
+ sc->sc_ccbs = malloc(sizeof(struct ami_ccb) * AMI_MAXCMDS,
+ M_DEVBUF, M_NOWAIT);
+ if (sc->sc_ccbs == NULL) {
+ printf(": unable to allocate ccbs\n");
+ goto free_mbox;
+ }
+
sc->sc_ccbmem_am = ami_allocmem(sc,
sizeof(struct ami_ccbmem) * AMI_MAXCMDS);
if (sc->sc_ccbmem_am == NULL) {
printf(": unable to allocate ccb dmamem\n");
- goto free_mbox;
+ goto free_ccbs;
}
ccbmem = AMIMEM_KVA(sc->sc_ccbmem_am);
@@ -566,6 +573,8 @@ destroy:
bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmamap);
ami_freemem(sc, sc->sc_ccbmem_am);
+free_ccbs:
+ free(sc->sc_ccbs, M_DEVBUF);
free_mbox:
ami_freemem(sc, sc->sc_mbox_am);
free_idata: