summaryrefslogtreecommitdiff
path: root/sys/dev/pci/ahci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/pci/ahci.c')
-rw-r--r--sys/dev/pci/ahci.c24
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)
{