summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-07-02 00:52:26 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-07-02 00:52:26 +0000
commit58512cf1cc5d5fa31c2dcde5820fbe6d00954e68 (patch)
tree32c8d0573ea3636a1dce27bfbd854bbbf42c5753
parent77cdcbc78199aa9d62818cfa490ca768b6e390b6 (diff)
move ahci_softc and the prototype for ahci_attach into a header so other
code will be able to see it.
-rw-r--r--sys/dev/pci/ahci.c38
-rw-r--r--sys/dev/pci/ahcivar.h49
2 files changed, 54 insertions, 33 deletions
diff --git a/sys/dev/pci/ahci.c b/sys/dev/pci/ahci.c
index e9c8161390f..bcaa9bef1be 100644
--- a/sys/dev/pci/ahci.c
+++ b/sys/dev/pci/ahci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ahci.c,v 1.123 2007/07/02 00:46:22 dlg Exp $ */
+/* $OpenBSD: ahci.c,v 1.124 2007/07/02 00:52:25 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -33,6 +33,8 @@
#include <dev/ata/atascsi.h>
+#include <dev/pci/ahcivar.h>
+
/* change to AHCI_DEBUG for dmesg spam */
#define NO_AHCI_DEBUG
@@ -48,6 +50,8 @@ int ahcidebug = AHCI_D_VERBOSE;
#define DPRINTF(m, f...)
#endif
+#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
+
#define AHCI_PCI_BAR 0x24
#define AHCI_PCI_INTERFACE 0x01
@@ -311,9 +315,6 @@ 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_port;
-
struct ahci_ccb {
/* ATA xfer associated with this CCB. Must be 1st struct member. */
struct ata_xfer ccb_xa;
@@ -374,32 +375,6 @@ struct ahci_port {
#endif
};
-struct ahci_softc {
- struct device sc_dev;
-
- void *sc_ih;
-
- bus_space_tag_t sc_iot;
- bus_space_handle_t sc_ioh;
- bus_size_t sc_ios;
- bus_dma_tag_t sc_dmat;
-
- int sc_flags;
-#define AHCI_F_NO_NCQ (1<<0)
-
- u_int sc_ncmds;
- struct ahci_port *sc_ports[AHCI_MAX_PORTS];
-
- struct atascsi *sc_atascsi;
-
-#ifdef AHCI_COALESCE
- u_int32_t sc_ccc_mask;
- u_int32_t sc_ccc_ports;
- u_int32_t sc_ccc_ports_cur;
-#endif
-};
-#define DEVNAME(_s) ((_s)->sc_dev.dv_xname)
-
struct ahci_device {
pci_vendor_id_t ad_vendor;
pci_product_id_t ad_product;
@@ -444,9 +419,6 @@ struct cfdriver ahci_cd = {
NULL, "ahci", DV_DULL
};
-int ahci_attach(struct ahci_softc *,
- struct pci_attach_args *, pci_intr_handle_t);
-
int ahci_map_regs(struct ahci_softc *,
struct pci_attach_args *);
void ahci_unmap_regs(struct ahci_softc *,
diff --git a/sys/dev/pci/ahcivar.h b/sys/dev/pci/ahcivar.h
new file mode 100644
index 00000000000..cde545d9d25
--- /dev/null
+++ b/sys/dev/pci/ahcivar.h
@@ -0,0 +1,49 @@
+/* $OpenBSD: ahcivar.h,v 1.1 2007/07/02 00:52:25 dlg Exp $ */
+
+/*
+ * Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+struct ahci_port;
+
+struct ahci_softc {
+ struct device sc_dev;
+
+ void *sc_ih;
+
+ bus_space_tag_t sc_iot;
+ bus_space_handle_t sc_ioh;
+ bus_size_t sc_ios;
+ bus_dma_tag_t sc_dmat;
+
+ int sc_flags;
+#define AHCI_F_NO_NCQ (1<<0)
+
+ u_int sc_ncmds;
+
+#define AHCI_MAX_PORTS 32
+ struct ahci_port *sc_ports[AHCI_MAX_PORTS];
+
+ struct atascsi *sc_atascsi;
+
+#ifdef AHCI_COALESCE
+ u_int32_t sc_ccc_mask;
+ u_int32_t sc_ccc_ports;
+ u_int32_t sc_ccc_ports_cur;
+#endif
+};
+
+int ahci_attach(struct ahci_softc *, struct pci_attach_args *,
+ pci_intr_handle_t);