summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2006-12-12 02:13:33 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2006-12-12 02:13:33 +0000
commite89c45a8be43f1ee0187f9b6d8ab0d4aa31cf818 (patch)
tree9ed6e0a390e086f69df9dd1a2fb6bb4bb69e3578
parent36fdd91a757640f79b72e7cfce049b075ff3d924 (diff)
introduce the command control blocks, and the concept that they are managed
per port rather than as a big list for the whole controller. the softc has an array of pointers to a struct that manages all the shizz relevant to a particular port. when we map the controllers ports, we'll allocate these as needed. if the port isnt implemented, we leave its pointer in the softc null and use that to decide if a drive might be there or not, rather than lookup up the PI register all the time. a comparison has to null has to be cheaper than doing bit operations, surely.
-rw-r--r--sys/dev/pci/ahci.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index 16ee5acd54f..752a41ffa0c 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.22 2006/12/12 02:06:09 dlg Exp $ */
+/* $OpenBSD: ahci.c,v 1.23 2006/12/12 02:13:32 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -23,6 +23,7 @@
#include <sys/malloc.h>
#include <sys/device.h>
#include <sys/proc.h>
+#include <sys/queue.h>
#include <machine/bus.h>
@@ -170,6 +171,21 @@ struct ahci_dmamem {
#define AHCI_DMA_DVA(_adm) ((_adm)->adm_map->dm_segs[0].ds_addr)
#define AHCI_DMA_KVA(_adm) ((void *)(_adm)->adm_kva)
+struct ahci_softc;
+
+struct ahci_ccb {
+ bus_dmamap_t ccb_dmamap;
+
+ TAILQ_ENTRY(ahci_ccb) ccb_entry;
+};
+
+struct ahci_port {
+ struct ahci_ccb *ap_ccbs;
+ TAILQ_HEAD(, ahci_ccb) ap_ccb_free;
+
+ struct ahci_dmamem *ap_dmamem;
+};
+
struct ahci_softc {
struct device sc_dev;
@@ -181,6 +197,7 @@ struct ahci_softc {
bus_dma_tag_t sc_dmat;
u_int sc_ncmds;
+ struct ahci_port *sc_ports[AHCI_MAX_PORTS];
};
#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)