Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/dev/ic Pullup rev 1.32 (requested by bouyer in tick...
details: https://anonhg.NetBSD.org/src/rev/a2758f3527ec
branches: netbsd-2-0
changeset: 564925:a2758f3527ec
user: jmc <jmc%NetBSD.org@localhost>
date: Fri Dec 16 20:05:48 2005 +0000
description:
Pullup rev 1.32 (requested by bouyer in ticket #10177)
Don't call alloc_scb() (which can call bus_dmamem_alloc/map) from
ADAPTER_REQ_RUN_XFER context (which can be interrupt context), defer this
to the ADAPTER_REQ_GROW_RESOURCES callback. Fixes a panic in uvm.
diffstat:
sys/dev/ic/aic79xx.c | 54 ++++++++++++++++++++++-----------------------------
1 files changed, 23 insertions(+), 31 deletions(-)
diffs (196 lines):
diff -r ba3fae467cee -r a2758f3527ec sys/dev/ic/aic79xx.c
--- a/sys/dev/ic/aic79xx.c Fri Dec 16 20:05:42 2005 +0000
+++ b/sys/dev/ic/aic79xx.c Fri Dec 16 20:05:48 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: aic79xx.c,v 1.27 2004/02/13 11:36:21 wiz Exp $ */
+/* $NetBSD: aic79xx.c,v 1.27.2.1 2005/12/16 20:05:48 jmc Exp $ */
/*
* Core routines and tables shareable across OS platforms.
@@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.27 2004/02/13 11:36:21 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.27.2.1 2005/12/16 20:05:48 jmc Exp $");
#include <dev/ic/aic79xx_osm.h>
#include <dev/ic/aic79xx_inline.h>
@@ -5654,23 +5654,14 @@
ahd_get_scb(struct ahd_softc *ahd, u_int col_idx)
{
struct scb *scb;
- int tries;
-
- tries = 0;
-look_again:
TAILQ_FOREACH(scb, &ahd->scb_data.free_scbs, links.tqe) {
if (AHD_GET_SCB_COL_IDX(ahd, scb) != col_idx) {
ahd_rem_col_list(ahd, scb);
goto found;
}
}
- if ((scb = LIST_FIRST(&ahd->scb_data.any_dev_free_scb_list)) == NULL) {
-
- if (tries++ != 0)
- return (NULL);
- ahd_alloc_scbs(ahd);
- goto look_again;
- }
+ if ((scb = LIST_FIRST(&ahd->scb_data.any_dev_free_scb_list)) == NULL)
+ return (NULL);
LIST_REMOVE(scb, links.le);
if (col_idx != AHD_NEVER_COL_IDX
&& (scb->col_scb != NULL)
@@ -5739,7 +5730,7 @@
ahd_platform_scb_free(ahd, scb);
}
-void
+int
ahd_alloc_scbs(struct ahd_softc *ahd)
{
struct scb_data *scb_data;
@@ -5759,7 +5750,7 @@
scb_data = &ahd->scb_data;
if (scb_data->numscbs >= AHD_SCB_MAX_ALLOC)
/* Can't allocate any more */
- return;
+ return (0);
KASSERT(scb_data->scbs_left >= 0);
if (scb_data->scbs_left != 0) {
@@ -5770,10 +5761,10 @@
hscb = &((struct hardware_scb *)hscb_map->vaddr)[offset];
hscb_busaddr = hscb_map->physaddr + (offset * sizeof(*hscb));
} else {
- hscb_map = malloc(sizeof(*hscb_map), M_DEVBUF, M_NOWAIT);
+ hscb_map = malloc(sizeof(*hscb_map), M_DEVBUF, M_WAITOK);
if (hscb_map == NULL)
- return;
+ return (0);
memset(hscb_map, 0, sizeof(*hscb_map));
@@ -5784,7 +5775,7 @@
&hscb_map->nseg, ahd_name(ahd),
"hardware SCB structures") < 0) {
free(hscb_map, M_DEVBUF);
- return;
+ return (0);
}
SLIST_INSERT_HEAD(&scb_data->hscb_maps, hscb_map, links);
@@ -5805,10 +5796,10 @@
segs = sg_map->vaddr + offset;
sg_busaddr = sg_map->physaddr + offset;
} else {
- sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_NOWAIT);
+ sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_WAITOK);
if (sg_map == NULL)
- return;
+ return (0);
bzero(sg_map, sizeof(*sg_map));
@@ -5819,7 +5810,7 @@
&sg_map->nseg, ahd_name(ahd),
"SG data structures") < 0) {
free(sg_map, M_DEVBUF);
- return;
+ return (0);
}
SLIST_INSERT_HEAD(&scb_data->sg_maps, sg_map, links);
@@ -5845,10 +5836,10 @@
sense_data = sense_map->vaddr + offset;
sense_busaddr = sense_map->physaddr + offset;
} else {
- sense_map = malloc(sizeof(*sense_map), M_DEVBUF, M_NOWAIT);
+ sense_map = malloc(sizeof(*sense_map), M_DEVBUF, M_WAITOK);
if (sense_map == NULL)
- return;
+ return (0);
bzero(sense_map, sizeof(*sense_map));
@@ -5859,7 +5850,7 @@
&sense_map->nseg, ahd_name(ahd),
"Sense Data structures") < 0) {
free(sense_map, M_DEVBUF);
- return;
+ return (0);
}
SLIST_INSERT_HEAD(&scb_data->sense_maps, sense_map, links);
@@ -5890,12 +5881,12 @@
int error;
#endif
next_scb = (struct scb *)malloc(sizeof(*next_scb),
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_WAITOK);
if (next_scb == NULL)
break;
pdata = (struct scb_platform_data *)malloc(sizeof(*pdata),
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_WAITOK);
if (pdata == NULL) {
free(next_scb, M_DEVBUF);
break;
@@ -5928,7 +5919,7 @@
error = bus_dmamap_create(ahd->parent_dmat,
AHD_MAXTRANSFER_SIZE, AHD_NSEG, MAXBSIZE, 0,
- BUS_DMA_NOWAIT|BUS_DMA_ALLOCNOW|ahd->sc_dmaflags,
+ BUS_DMA_WAITOK|BUS_DMA_ALLOCNOW|ahd->sc_dmaflags,
&next_scb->dmamap);
if (error != 0) {
free(next_scb, M_DEVBUF);
@@ -5949,6 +5940,7 @@
sense_busaddr += AHD_SENSE_BUFSIZE;
scb_data->numscbs++;
}
+ return (i);
}
void
@@ -9732,7 +9724,7 @@
int error, level = 0;
if ((error = bus_dmamem_alloc(tag, size, PAGE_SIZE, 0,
- seg, 1, nseg, BUS_DMA_NOWAIT)) != 0) {
+ seg, 1, nseg, BUS_DMA_WAITOK)) != 0) {
printf("%s: failed to allocate DMA mem for %s, error = %d\n",
myname, what, error);
goto out;
@@ -9740,7 +9732,7 @@
level++;
if ((error = bus_dmamem_map(tag, seg, *nseg, size, vaddr,
- BUS_DMA_NOWAIT|BUS_DMA_COHERENT)) != 0) {
+ BUS_DMA_WAITOK|BUS_DMA_COHERENT)) != 0) {
printf("%s: failed to map DMA mem for %s, error = %d\n",
myname, what, error);
goto out;
@@ -9748,7 +9740,7 @@
level++;
if ((error = bus_dmamap_create(tag, size, 1, size, 0,
- BUS_DMA_NOWAIT | flags, mapp)) != 0) {
+ BUS_DMA_WAITOK | flags, mapp)) != 0) {
printf("%s: failed to create DMA map for %s, error = %d\n",
myname, what, error);
goto out;
@@ -9757,7 +9749,7 @@
if ((error = bus_dmamap_load(tag, *mapp, *vaddr, size, NULL,
- BUS_DMA_NOWAIT)) != 0) {
+ BUS_DMA_WAITOK)) != 0) {
printf("%s: failed to load DMA map for %s, error = %d\n",
myname, what, error);
goto out;
Home |
Main Index |
Thread Index |
Old Index