diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-12-04 03:56:18 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2005-12-04 03:56:18 +0000 |
commit | 093f453182f5ee4b27f12fc5b707aa270e2f0d2e (patch) | |
tree | 8a34ba606c2bd6e5110748166c151c5b5e0d556b /sys/dev/ic | |
parent | f2253c12ba50b796b6b6dd37cd687be4e29e9f5a (diff) |
Allocate all scbs during initialization to avoid using
bus_dmamem_alloc() in interrupt context.
Use same logic as ahd.
"Looks good to me" pedro@
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/aic7xxx.c | 13 | ||||
-rw-r--r-- | sys/dev/ic/aic7xxx_inline.h | 14 |
2 files changed, 15 insertions, 12 deletions
diff --git a/sys/dev/ic/aic7xxx.c b/sys/dev/ic/aic7xxx.c index 36ddcd8b34b..e2dbc949fe4 100644 --- a/sys/dev/ic/aic7xxx.c +++ b/sys/dev/ic/aic7xxx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx.c,v 1.69 2005/12/01 02:21:13 krw Exp $ */ +/* $OpenBSD: aic7xxx.c,v 1.70 2005/12/04 03:56:17 krw Exp $ */ /* $NetBSD: aic7xxx.c,v 1.108 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -40,7 +40,7 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. * - * $Id: aic7xxx.c,v 1.69 2005/12/01 02:21:13 krw Exp $ + * $Id: aic7xxx.c,v 1.70 2005/12/04 03:56:17 krw Exp $ */ /* * Ported from FreeBSD by Pascal Renauld, Network Storage Solutions, Inc. - April 2003 @@ -4263,6 +4263,7 @@ static int ahc_init_scbdata(struct ahc_softc *ahc) { struct scb_data *scb_data; + int i; scb_data = ahc->scb_data; SLIST_INIT(&scb_data->free_scbs); @@ -4316,9 +4317,13 @@ ahc_init_scbdata(struct ahc_softc *ahc) /* Perform initial CCB allocation */ memset(scb_data->hscbs, 0, AHC_SCB_MAX_ALLOC * sizeof(struct hardware_scb)); - ahc_alloc_scbs(ahc); + do { + i = scb_data->numscbs; + ahc_alloc_scbs(ahc); + } while ((i != scb_data->numscbs) && + (scb_data->numscbs < AHC_SCB_MAX_ALLOC)); - if (scb_data->numscbs == 0) { + if (scb_data->numscbs != AHC_SCB_MAX_ALLOC) { printf("%s: ahc_init_scbdata - " "Unable to allocate initial scbs\n", ahc_name(ahc)); diff --git a/sys/dev/ic/aic7xxx_inline.h b/sys/dev/ic/aic7xxx_inline.h index 5ddc5c6b157..34ae4709177 100644 --- a/sys/dev/ic/aic7xxx_inline.h +++ b/sys/dev/ic/aic7xxx_inline.h @@ -1,4 +1,4 @@ -/* $OpenBSD: aic7xxx_inline.h,v 1.11 2005/07/18 02:43:26 fgsch Exp $ */ +/* $OpenBSD: aic7xxx_inline.h,v 1.12 2005/12/04 03:56:17 krw Exp $ */ /* $NetBSD: aic7xxx_inline.h,v 1.4 2003/11/02 11:07:44 wiz Exp $ */ /* @@ -378,13 +378,11 @@ ahc_get_scb(struct ahc_softc *ahc) { struct scb *scb; - if ((scb = SLIST_FIRST(&ahc->scb_data->free_scbs)) == NULL) { - ahc_alloc_scbs(ahc); - scb = SLIST_FIRST(&ahc->scb_data->free_scbs); - if (scb == NULL) - return (NULL); - } - SLIST_REMOVE_HEAD(&ahc->scb_data->free_scbs, links.sle); + scb = SLIST_FIRST(&ahc->scb_data->free_scbs); + + if (scb != NULL) + SLIST_REMOVE_HEAD(&ahc->scb_data->free_scbs, links.sle); + return (scb); } |