bt.c:
Simplify some inline functions. btreg.h: Correct a comment.
This commit is contained in:
parent
00fa2b1fa7
commit
047a1fb181
@ -29,7 +29,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bt.c,v 1.16 1999/04/18 15:50:32 peter Exp $
|
||||
* $Id: bt.c,v 1.17 1999/04/18 19:03:50 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -964,18 +964,22 @@ btallocccbs(struct bt_softc *bt)
|
||||
int newcount;
|
||||
int i;
|
||||
|
||||
if (bt->num_ccbs >= bt->max_ccbs)
|
||||
/* Can't allocate any more */
|
||||
return;
|
||||
|
||||
next_ccb = &bt->bt_ccb_array[bt->num_ccbs];
|
||||
|
||||
sg_map = malloc(sizeof(*sg_map), M_DEVBUF, M_NOWAIT);
|
||||
|
||||
if (sg_map == NULL)
|
||||
return;
|
||||
goto error_exit;
|
||||
|
||||
/* Allocate S/G space for the next batch of CCBS */
|
||||
if (bus_dmamem_alloc(bt->sg_dmat, (void **)&sg_map->sg_vaddr,
|
||||
BUS_DMA_NOWAIT, &sg_map->sg_dmamap) != 0) {
|
||||
free(sg_map, M_DEVBUF);
|
||||
return;
|
||||
goto error_exit;
|
||||
}
|
||||
|
||||
SLIST_INSERT_HEAD(&bt->sg_maps, sg_map, links);
|
||||
@ -1009,6 +1013,12 @@ btallocccbs(struct bt_softc *bt)
|
||||
bt->recovery_bccb = SLIST_FIRST(&bt->free_bt_ccbs);
|
||||
SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links);
|
||||
}
|
||||
|
||||
if (SLIST_FIRST(&bt->free_bt_ccbs) != NULL)
|
||||
return;
|
||||
|
||||
error_exit:
|
||||
device_printf(bt->dev, "Can't malloc BCCBs\n");
|
||||
}
|
||||
|
||||
static __inline void
|
||||
@ -1040,12 +1050,10 @@ btgetccb(struct bt_softc *bt)
|
||||
if ((bccb = SLIST_FIRST(&bt->free_bt_ccbs)) != NULL) {
|
||||
SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links);
|
||||
bt->active_ccbs++;
|
||||
} else if (bt->num_ccbs < bt->max_ccbs) {
|
||||
} else {
|
||||
btallocccbs(bt);
|
||||
bccb = SLIST_FIRST(&bt->free_bt_ccbs);
|
||||
if (bccb == NULL)
|
||||
device_printf(bt->dev, "Can't malloc BCCB\n");
|
||||
else {
|
||||
if (bccb != NULL) {
|
||||
SLIST_REMOVE_HEAD(&bt->free_bt_ccbs, links);
|
||||
bt->active_ccbs++;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: btreg.h,v 1.5 1999/04/07 23:01:43 gibbs Exp $
|
||||
* $Id: btreg.h,v 1.6 1999/04/18 15:50:33 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _BTREG_H_
|
||||
@ -629,8 +629,8 @@ struct bt_softc {
|
||||
bus_dmamap_t mailbox_dmamap;
|
||||
bus_dma_tag_t ccb_dmat; /* dmat for our ccb array */
|
||||
bus_dmamap_t ccb_dmamap;
|
||||
bus_dma_tag_t sg_dmat; /* dmat for our sg maps */
|
||||
bus_dma_tag_t sense_dmat; /* dmat for our sg maps */
|
||||
bus_dma_tag_t sg_dmat; /* dmat for our sg segments */
|
||||
bus_dma_tag_t sense_dmat; /* dmat for our sense buffers */
|
||||
bus_dmamap_t sense_dmamap;
|
||||
SLIST_HEAD(, sg_map_node) sg_maps;
|
||||
bus_addr_t mailbox_physbase;
|
||||
|
Loading…
Reference in New Issue
Block a user