aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAdrian Chadd <adrian@FreeBSD.org>2011-03-31 08:07:13 +0000
committerAdrian Chadd <adrian@FreeBSD.org>2011-03-31 08:07:13 +0000
commitdba9c8597747c6c9bf3d2ec68f7eb90552878dc7 (patch)
treed50f60c844cf48dc643a401d409974352145189e /sys
parent53ff3d1e9c136175a07f93123a47320088c505f4 (diff)
downloadsrc-dba9c8597747c6c9bf3d2ec68f7eb90552878dc7.tar.gz
src-dba9c8597747c6c9bf3d2ec68f7eb90552878dc7.zip
Break out the ath PCI logic into a separate device/module.
Introduce the AHB glue for Atheros embedded systems. Right now it's hard-coded for the AR9130 chip whose support isn't yet in this HAL; it'll be added in a subsequent commit. Kernel configuration files now need both 'ath' and 'ath_pci' devices; both modules need to be loaded for the ath device to work.
Notes
Notes: svn path=/head/; revision=220185
Diffstat (limited to 'sys')
-rw-r--r--sys/amd64/conf/GENERIC3
-rw-r--r--sys/arm/conf/AVILA3
-rw-r--r--sys/arm/conf/CAMBRIA3
-rw-r--r--sys/conf/files8
-rw-r--r--sys/dev/ath/if_ath.c3
-rw-r--r--sys/dev/ath/if_ath_ahb.c287
-rw-r--r--sys/dev/ath/if_ath_pci.c7
-rw-r--r--sys/i386/conf/GENERIC3
-rw-r--r--sys/i386/conf/PAE1
-rw-r--r--sys/mips/conf/AR71XX3
-rw-r--r--sys/mips/conf/IDT3
-rw-r--r--sys/mips/conf/OCTEON12
-rw-r--r--sys/mips/conf/SENTRY51
-rw-r--r--sys/modules/Makefile2
-rw-r--r--sys/modules/ath/Makefile2
-rw-r--r--sys/modules/ath_ahb/Makefile41
-rw-r--r--sys/modules/ath_pci/Makefile41
-rw-r--r--sys/pc98/conf/GENERIC3
-rw-r--r--sys/sparc64/conf/GENERIC3
19 files changed, 404 insertions, 15 deletions
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index eca47a8e49c5..c78a479de415 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -257,7 +257,8 @@ device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_amrr # AMRR transmit rate control algorithm
device an # Aironet 4500/4800 802.11 wireless NICs.
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
device ath_hal # pci/cardbus chip support
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
device ath_rate_sample # SampleRate tx rate control for ath
diff --git a/sys/arm/conf/AVILA b/sys/arm/conf/AVILA
index db1c3a0fc1f8..3de3addac596 100644
--- a/sys/arm/conf/AVILA
+++ b/sys/arm/conf/AVILA
@@ -120,7 +120,8 @@ device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_xauth
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
options ATH_DEBUG
options ATH_DIAGAPI
#options ATH_TX99_DIAG
diff --git a/sys/arm/conf/CAMBRIA b/sys/arm/conf/CAMBRIA
index ed16ed83fab1..5dacf26988a5 100644
--- a/sys/arm/conf/CAMBRIA
+++ b/sys/arm/conf/CAMBRIA
@@ -123,7 +123,8 @@ device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_xauth
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
options ATH_DEBUG
options ATH_DIAGAPI
#options ATH_TX99_DIAG
diff --git a/sys/conf/files b/sys/conf/files
index 7b2a5d5414fd..7d3f570f9b27 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -570,6 +570,12 @@ dev/ata/atapi-fd.c optional atapifd
dev/ata/atapi-tape.c optional atapist
dev/ata/atapi-cam.c optional atapicam
#
+dev/ath/if_ath_pci.c optional ath_pci pci \
+ compile-with "${NORMAL_C} -I$S/dev/ath"
+#
+dev/ath/if_ath_ahb.c optional ath_ahb \
+ compile-with "${NORMAL_C} -I$S/dev/ath"
+#
dev/ath/if_ath.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/if_ath_debug.c optional ath \
@@ -582,8 +588,6 @@ dev/ath/if_ath_tx_ht.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/if_ath_sysctl.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
-dev/ath/if_ath_pci.c optional ath pci \
- compile-with "${NORMAL_C} -I$S/dev/ath"
dev/ath/ah_osdep.c optional ath \
compile-with "${NORMAL_C} -I$S/dev/ath"
#
diff --git a/sys/dev/ath/if_ath.c b/sys/dev/ath/if_ath.c
index a87a53c9f3a1..26cdebcb4a2f 100644
--- a/sys/dev/ath/if_ath.c
+++ b/sys/dev/ath/if_ath.c
@@ -58,6 +58,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kthread.h>
#include <sys/taskqueue.h>
#include <sys/priv.h>
+#include <sys/module.h>
#include <machine/bus.h>
@@ -5591,3 +5592,5 @@ ath_tdma_beacon_send(struct ath_softc *sc, struct ieee80211vap *vap)
}
#endif /* IEEE80211_SUPPORT_TDMA */
+MODULE_VERSION(if_ath, 1);
+MODULE_DEPEND(if_ath, wlan, 1, 1, 1); /* 802.11 media layer */
diff --git a/sys/dev/ath/if_ath_ahb.c b/sys/dev/ath/if_ath_ahb.c
new file mode 100644
index 000000000000..1295e9fbd465
--- /dev/null
+++ b/sys/dev/ath/if_ath_ahb.c
@@ -0,0 +1,287 @@
+/*-
+ * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
+ * Copyright (c) 2010-2011 Adrian Chadd, Xenion Pty Ltd
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer,
+ * without modification.
+ * 2. Redistributions in binary form must reproduce at minimum a disclaimer
+ * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+ * redistribution must be conditioned upon including a substantially
+ * similar Disclaimer requirement for further binary redistribution.
+ *
+ * NO WARRANTY
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGES.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+/*
+ * AHB bus front-end for the Atheros Wireless LAN controller driver.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/module.h>
+#include <sys/kernel.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+#include <sys/errno.h>
+
+#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/bus.h>
+#include <sys/rman.h>
+
+#include <sys/socket.h>
+
+#include <net/if.h>
+#include <net/if_media.h>
+#include <net/if_arp.h>
+
+#include <net80211/ieee80211_var.h>
+
+#include <dev/ath/if_athvar.h>
+
+#include <mips/atheros/ar71xxreg.h>
+#include <mips/atheros/ar91xxreg.h>
+#include <mips/atheros/ar71xx_cpudef.h>
+
+/*
+ * bus glue.
+ */
+
+/* number of 16 bit words */
+#define ATH_EEPROM_DATA_SIZE 2048
+
+struct ath_ahb_softc {
+ struct ath_softc sc_sc;
+ struct resource *sc_sr; /* memory resource */
+ struct resource *sc_irq; /* irq resource */
+ struct resource *sc_eeprom; /* eeprom location */
+ void *sc_ih; /* interrupt handler */
+};
+
+#define VENDOR_ATHEROS 0x168c
+#define AR9100_DEVID 0x000b
+
+static int
+ath_ahb_probe(device_t dev)
+{
+ const char* devname;
+
+ /* Atheros / ar9100 */
+ devname = ath_hal_probe(VENDOR_ATHEROS, AR9100_DEVID);
+
+ if (devname != NULL) {
+ device_set_desc(dev, devname);
+ return BUS_PROBE_DEFAULT;
+ }
+ return ENXIO;
+}
+
+static int
+ath_ahb_attach(device_t dev)
+{
+ struct ath_ahb_softc *psc = device_get_softc(dev);
+ struct ath_softc *sc = &psc->sc_sc;
+ int error = ENXIO;
+ int rid;
+ long eepromaddr;
+ uint8_t *p;
+
+ sc->sc_dev = dev;
+
+ rid = 0;
+ psc->sc_sr = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, RF_ACTIVE);
+ if (psc->sc_sr == NULL) {
+ device_printf(dev, "cannot map register space\n");
+ goto bad;
+ }
+
+ if (resource_long_value(device_get_name(dev), device_get_unit(dev),
+ "eepromaddr", &eepromaddr) != 0) {
+ device_printf(dev, "cannot fetch 'eepromaddr' from hints\n");
+ goto bad0;
+ }
+ rid = 0;
+ device_printf(sc->sc_dev, "eeprom @ %p\n", (void *) eepromaddr);
+ psc->sc_eeprom = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, (uintptr_t) eepromaddr,
+ (uintptr_t) eepromaddr + (uintptr_t) ((ATH_EEPROM_DATA_SIZE * 2) - 1), 0, RF_ACTIVE);
+ if (psc->sc_sr == NULL) {
+ device_printf(dev, "cannot map eeprom space\n");
+ goto bad0;
+ }
+
+ /* XXX uintptr_t is a bandaid for ia64; to be fixed */
+ sc->sc_st = (HAL_BUS_TAG)(uintptr_t) rman_get_bustag(psc->sc_sr);
+ sc->sc_sh = (HAL_BUS_HANDLE) rman_get_bushandle(psc->sc_sr);
+ /*
+ * Mark device invalid so any interrupts (shared or otherwise)
+ * that arrive before the HAL is setup are discarded.
+ */
+ sc->sc_invalid = 1;
+
+ /* Copy the EEPROM data out */
+ sc->sc_eepromdata = malloc(ATH_EEPROM_DATA_SIZE * 2, M_TEMP, M_NOWAIT | M_ZERO);
+ device_printf(sc->sc_dev, "eeprom data @ %p\n", (void *) rman_get_bushandle(psc->sc_eeprom));
+ /* XXX why doesn't this work? -adrian */
+#if 0
+ bus_space_read_multi_1(
+ rman_get_bustag(psc->sc_eeprom),
+ rman_get_bushandle(psc->sc_eeprom),
+ 0, (u_int8_t *) sc->sc_eepromdata, ATH_EEPROM_DATA_SIZE * 2);
+#endif
+ p = (void *) rman_get_bushandle(psc->sc_eeprom);
+ memcpy(sc->sc_eepromdata, p, ATH_EEPROM_DATA_SIZE * 2);
+
+ /*
+ * Arrange interrupt line.
+ */
+ rid = 0;
+ psc->sc_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_SHAREABLE|RF_ACTIVE);
+ if (psc->sc_irq == NULL) {
+ device_printf(dev, "could not map interrupt\n");
+ goto bad1;
+ }
+ if (bus_setup_intr(dev, psc->sc_irq,
+ INTR_TYPE_NET | INTR_MPSAFE,
+ NULL, ath_intr, sc, &psc->sc_ih)) {
+ device_printf(dev, "could not establish interrupt\n");
+ goto bad2;
+ }
+
+ /*
+ * Setup DMA descriptor area.
+ */
+ if (bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */
+ 1, 0, /* alignment, bounds */
+ BUS_SPACE_MAXADDR_32BIT, /* lowaddr */
+ BUS_SPACE_MAXADDR, /* highaddr */
+ NULL, NULL, /* filter, filterarg */
+ 0x3ffff, /* maxsize XXX */
+ ATH_MAX_SCATTER, /* nsegments */
+ 0x3ffff, /* maxsegsize XXX */
+ BUS_DMA_ALLOCNOW, /* flags */
+ NULL, /* lockfunc */
+ NULL, /* lockarg */
+ &sc->sc_dmat)) {
+ device_printf(dev, "cannot allocate DMA tag\n");
+ goto bad3;
+ }
+
+ ATH_LOCK_INIT(sc);
+
+ error = ath_attach(AR9100_DEVID, sc);
+ if (error == 0) /* success */
+ return 0;
+
+ ATH_LOCK_DESTROY(sc);
+ bus_dma_tag_destroy(sc->sc_dmat);
+bad3:
+ bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
+bad2:
+ bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
+bad1:
+ bus_release_resource(dev, SYS_RES_MEMORY, 0, psc->sc_eeprom);
+bad0:
+ bus_release_resource(dev, SYS_RES_MEMORY, 0, psc->sc_sr);
+bad:
+ /* XXX?! */
+ if (sc->sc_eepromdata)
+ free(sc->sc_eepromdata, M_TEMP);
+ return (error);
+}
+
+static int
+ath_ahb_detach(device_t dev)
+{
+ struct ath_ahb_softc *psc = device_get_softc(dev);
+ struct ath_softc *sc = &psc->sc_sc;
+
+ /* check if device was removed */
+ sc->sc_invalid = !bus_child_present(dev);
+
+ ath_detach(sc);
+
+ bus_generic_detach(dev);
+ bus_teardown_intr(dev, psc->sc_irq, psc->sc_ih);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, psc->sc_irq);
+
+ bus_dma_tag_destroy(sc->sc_dmat);
+ bus_release_resource(dev, SYS_RES_MEMORY, 0, psc->sc_sr);
+ bus_release_resource(dev, SYS_RES_MEMORY, 0, psc->sc_eeprom);
+ /* XXX?! */
+ if (sc->sc_eepromdata)
+ free(sc->sc_eepromdata, M_TEMP);
+
+ ATH_LOCK_DESTROY(sc);
+
+ return (0);
+}
+
+static int
+ath_ahb_shutdown(device_t dev)
+{
+ struct ath_ahb_softc *psc = device_get_softc(dev);
+
+ ath_shutdown(&psc->sc_sc);
+ return (0);
+}
+
+static int
+ath_ahb_suspend(device_t dev)
+{
+ struct ath_ahb_softc *psc = device_get_softc(dev);
+
+ ath_suspend(&psc->sc_sc);
+
+ return (0);
+}
+
+static int
+ath_ahb_resume(device_t dev)
+{
+ struct ath_ahb_softc *psc = device_get_softc(dev);
+
+ ath_resume(&psc->sc_sc);
+
+ return (0);
+}
+
+static device_method_t ath_ahb_methods[] = {
+ /* Device interface */
+ DEVMETHOD(device_probe, ath_ahb_probe),
+ DEVMETHOD(device_attach, ath_ahb_attach),
+ DEVMETHOD(device_detach, ath_ahb_detach),
+ DEVMETHOD(device_shutdown, ath_ahb_shutdown),
+ DEVMETHOD(device_suspend, ath_ahb_suspend),
+ DEVMETHOD(device_resume, ath_ahb_resume),
+
+ { 0,0 }
+};
+static driver_t ath_ahb_driver = {
+ "ath",
+ ath_ahb_methods,
+ sizeof (struct ath_ahb_softc)
+};
+static devclass_t ath_devclass;
+DRIVER_MODULE(ath, nexus, ath_ahb_driver, ath_devclass, 0, 0);
+MODULE_VERSION(ath, 1);
+MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_DEPEND(ath, if_ath, 1, 1, 1); /* if_ath driver */
diff --git a/sys/dev/ath/if_ath_pci.c b/sys/dev/ath/if_ath_pci.c
index 44d398db1b79..c9b7eecbc1b8 100644
--- a/sys/dev/ath/if_ath_pci.c
+++ b/sys/dev/ath/if_ath_pci.c
@@ -250,6 +250,7 @@ static driver_t ath_pci_driver = {
sizeof (struct ath_pci_softc)
};
static devclass_t ath_devclass;
-DRIVER_MODULE(ath, pci, ath_pci_driver, ath_devclass, 0, 0);
-MODULE_VERSION(ath, 1);
-MODULE_DEPEND(ath, wlan, 1, 1, 1); /* 802.11 media layer */
+DRIVER_MODULE(ath_pci, pci, ath_pci_driver, ath_devclass, 0, 0);
+MODULE_VERSION(ath_pci, 1);
+MODULE_DEPEND(ath_pci, wlan, 1, 1, 1); /* 802.11 media layer */
+MODULE_DEPEND(ath_pci, if_ath, 1, 1, 1); /* if_ath driver */
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 6abc29c757c2..5dad17426e3a 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -269,7 +269,8 @@ device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_amrr # AMRR transmit rate control algorithm
device an # Aironet 4500/4800 802.11 wireless NICs.
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
device ath_hal # pci/cardbus chip support
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
device ath_rate_sample # SampleRate tx rate control for ath
diff --git a/sys/i386/conf/PAE b/sys/i386/conf/PAE
index a8abf7aaf54e..6375930ddc07 100644
--- a/sys/i386/conf/PAE
+++ b/sys/i386/conf/PAE
@@ -74,6 +74,7 @@ nodevice xe
nodevice an
nodevice ath # Atheros pci/cardbus NIC's
+nodevice ath_pci
nodevice ath_hal
nodevice ath_rate_sample # SampleRate tx rate control for ath
nodevice ral
diff --git a/sys/mips/conf/AR71XX b/sys/mips/conf/AR71XX
index ffdf539010d3..5e35ee7589c1 100644
--- a/sys/mips/conf/AR71XX
+++ b/sys/mips/conf/AR71XX
@@ -55,7 +55,8 @@ device wlan_wep # 802.11 WEP support
device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
options ATH_DEBUG
device ath_hal
option AH_SUPPORT_AR5416
diff --git a/sys/mips/conf/IDT b/sys/mips/conf/IDT
index d0e33d1f1575..69d821f9de51 100644
--- a/sys/mips/conf/IDT
+++ b/sys/mips/conf/IDT
@@ -44,7 +44,8 @@ device md
device wlan # 802.11 support
device wlan_wep # 802.11 WEP support
device wlan_tkip # 802.11 TKIP support
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
device ath_hal # pci/cardbus chip support
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
device ath_rate_sample # SampleRate tx rate control for ath
diff --git a/sys/mips/conf/OCTEON1 b/sys/mips/conf/OCTEON1
index 421297d8388a..c67d278d44a6 100644
--- a/sys/mips/conf/OCTEON1
+++ b/sys/mips/conf/OCTEON1
@@ -237,7 +237,7 @@ device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_amrr # AMRR transmit rate control algorithm
device an # Aironet 4500/4800 802.11 wireless NICs.
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
device ath_hal # pci/cardbus chip support
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
device ath_rate_sample # SampleRate tx rate control for ath
diff --git a/sys/mips/conf/SENTRY5 b/sys/mips/conf/SENTRY5
index 048096b258fe..79ed8ca51761 100644
--- a/sys/mips/conf/SENTRY5
+++ b/sys/mips/conf/SENTRY5
@@ -66,6 +66,7 @@ device pci # siba_pcib
# pci devices
# notyet:
#device ath # in pci slot
+#device ath_pci # Atheros pci/cardbus glue
#device ath_hal # pci chip support
#options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 4ed9811fc7a7..4dd2a0ea89ba 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -35,6 +35,8 @@ SUBDIR= ${_3dfx} \
${_asr} \
ata \
ath \
+ ath_ahb \
+ ath_pci \
${_auxio} \
bce \
bfe \
diff --git a/sys/modules/ath/Makefile b/sys/modules/ath/Makefile
index a46c386d0ca1..74c756fee1b6 100644
--- a/sys/modules/ath/Makefile
+++ b/sys/modules/ath/Makefile
@@ -35,7 +35,7 @@ ATH_RATE?= sample # tx rate control algorithm
.PATH: ${.CURDIR}/../../dev/ath/ath_hal
KMOD= if_ath
-SRCS= if_ath.c if_ath_pci.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c
+SRCS= if_ath.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c
SRCS+= if_ath_tx.c if_ath_tx_ht.c
# NB: v3 eeprom support used by both AR5211 and AR5212; just include it
SRCS+= ah_osdep.c ah.c ah_regdomain.c ah_eeprom_v3.c
diff --git a/sys/modules/ath_ahb/Makefile b/sys/modules/ath_ahb/Makefile
new file mode 100644
index 000000000000..698514a89dff
--- /dev/null
+++ b/sys/modules/ath_ahb/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer,
+# without modification.
+# 2. Redistributions in binary form must reproduce at minimum a disclaimer
+# similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+# redistribution must be conditioned upon including a substantially
+# similar Disclaimer requirement for further binary redistribution.
+#
+# NO WARRANTY
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGES.
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../dev/ath
+.PATH: ${.CURDIR}/../../dev/ath/ath_hal
+
+KMOD= if_ath_ahb
+SRCS= if_ath_ahb.c
+SRCS+= device_if.h bus_if.h
+
+CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal
+
+.include <bsd.kmod.mk>
diff --git a/sys/modules/ath_pci/Makefile b/sys/modules/ath_pci/Makefile
new file mode 100644
index 000000000000..4c4a95fc76be
--- /dev/null
+++ b/sys/modules/ath_pci/Makefile
@@ -0,0 +1,41 @@
+#
+# Copyright (c) 2011 Adrian Chadd, Xenion Pty Ltd
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer,
+# without modification.
+# 2. Redistributions in binary form must reproduce at minimum a disclaimer
+# similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
+# redistribution must be conditioned upon including a substantially
+# similar Disclaimer requirement for further binary redistribution.
+#
+# NO WARRANTY
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
+# AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
+# THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
+# OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
+# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+# THE POSSIBILITY OF SUCH DAMAGES.
+#
+# $FreeBSD$
+#
+
+.PATH: ${.CURDIR}/../../dev/ath
+.PATH: ${.CURDIR}/../../dev/ath/ath_hal
+
+KMOD= if_ath_pci
+SRCS= if_ath_pci.c
+SRCS+= device_if.h bus_if.h pci_if.h
+
+CFLAGS+= -I. -I${.CURDIR}/../../dev/ath -I${.CURDIR}/../../dev/ath/ath_hal
+
+.include <bsd.kmod.mk>
diff --git a/sys/pc98/conf/GENERIC b/sys/pc98/conf/GENERIC
index 191165e2894f..915d73f84545 100644
--- a/sys/pc98/conf/GENERIC
+++ b/sys/pc98/conf/GENERIC
@@ -221,7 +221,8 @@ device xe # Xircom pccard Ethernet
#device wlan_tkip # 802.11 TKIP support
#device wlan_amrr # AMRR transmit rate control algorithm
#device an # Aironet 4500/4800 802.11 wireless NICs.
-#device ath # Atheros pci/cardbus NIC's
+#device ath # Atheros NIC's
+#device ath_pci # Atheros pci/cardbus glue
#device ath_hal # pci/cardbus chip support
#options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
#device ath_rate_sample # SampleRate tx rate control for ath
diff --git a/sys/sparc64/conf/GENERIC b/sys/sparc64/conf/GENERIC
index 28bf35ee0d1d..a2bb85c4f4f6 100644
--- a/sys/sparc64/conf/GENERIC
+++ b/sys/sparc64/conf/GENERIC
@@ -203,7 +203,8 @@ device wlan_wep # 802.11 WEP support
device wlan_ccmp # 802.11 CCMP support
device wlan_tkip # 802.11 TKIP support
device wlan_amrr # AMRR transmit rate control algorithm
-device ath # Atheros pci/cardbus NIC's
+device ath # Atheros NIC's
+device ath_pci # Atheros pci/cardbus glue
device ath_hal # Atheros HAL (Hardware Access Layer)
options AH_SUPPORT_AR5416 # enable AR5416 tx/rx descriptors
device ath_rate_sample # SampleRate tx rate control for ath