diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2006-12-12 02:22:57 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2006-12-12 02:22:57 +0000 |
commit | 7441aca1955f96f0d713781c48c81a9f107961e2 (patch) | |
tree | 80bb07df84a34574a7dcdc257812384a5e8d98cd /sys/dev/pci/ahci.c | |
parent | 3c6472bf20be2716a4a755244da69aabed7be192 (diff) |
add functions to get and put ccbs out of each ports command free list.
Diffstat (limited to 'sys/dev/pci/ahci.c')
-rw-r--r-- | sys/dev/pci/ahci.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c index 8f33c2e1f4a..f796a189689 100644 --- a/sys/dev/pci/ahci.c +++ b/sys/dev/pci/ahci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ahci.c,v 1.24 2006/12/12 02:19:37 dlg Exp $ */ +/* $OpenBSD: ahci.c,v 1.25 2006/12/12 02:22:56 dlg Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -224,6 +224,9 @@ int ahci_map_intr(struct ahci_softc *, void ahci_unmap_intr(struct ahci_softc *, struct pci_attach_args *); +struct ahci_ccb *ahci_get_ccb(struct ahci_port *); +void ahci_put_ccb(struct ahci_port *, struct ahci_ccb *); + struct ahci_dmamem *ahci_dmamem_alloc(struct ahci_softc *, size_t); void ahci_dmamem_free(struct ahci_softc *, struct ahci_dmamem *); @@ -401,6 +404,25 @@ ahci_intr(void *arg) return (0); } +struct ahci_ccb * +ahci_get_ccb(struct ahci_port *ap) +{ + struct ahci_ccb *ccb; + + ccb = TAILQ_FIRST(&ap->ap_ccb_free); + if (ccb != NULL) + TAILQ_REMOVE(&ap->ap_ccb_free, ccb, ccb_entry); + + return (ccb); +} + +void +ahci_put_ccb(struct ahci_port *ap, struct ahci_ccb *ccb) +{ + /* scrub bits */ + TAILQ_INSERT_TAIL(&ap->ap_ccb_free, ccb, ccb_entry); +} + struct ahci_dmamem * ahci_dmamem_alloc(struct ahci_softc *sc, size_t size) { |