From 48dfa53c5c094f8a22985983b506e73f75556de2 Mon Sep 17 00:00:00 2001 From: David Gwynne Date: Sun, 21 May 2006 18:28:25 +0000 Subject: 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@ --- sys/dev/ic/ami.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'sys/dev/ic/ami.c') 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: -- cgit v1.2.3