git: 37c8ee8847fa - main - ath(4): Remove MIPS AHB frontend and join PCI one w/ main support again

From: Marius Strobl <marius_at_FreeBSD.org>
Date: Tue, 08 Aug 2023 20:32:33 UTC
The branch main has been updated by marius:

URL: https://cgit.FreeBSD.org/src/commit/?id=37c8ee8847faa53432809cae2ecc11b80c4eab2f

commit 37c8ee8847faa53432809cae2ecc11b80c4eab2f
Author:     Marius Strobl <marius@FreeBSD.org>
AuthorDate: 2023-08-07 16:39:24 +0000
Commit:     Marius Strobl <marius@FreeBSD.org>
CommitDate: 2023-08-08 20:30:13 +0000

    ath(4): Remove MIPS AHB frontend and join PCI one w/ main support again
    
    Following the removal of general MIPS support, there's no longer a need
    to have the AHB bus-frontend in place, which according to Linux sources
    also isn't used with any non-MIPS SoCs. For simplicity, PCI bus support
    is only made conditional on the main one again, i. e. device ath_pci is
    removed, and built into the main module, i. e. if_ath_pci.ko obsoleted,
    respectively.
    Effectively, this reverts the following commits and associated changes:
    dba9c8597747c6c9bf3d2ec68f7eb90552878dc7
    e849bb3ecbb1963344a22ae77fc96f89fbebf40c
    
    Approved by:    adrian
    Relnotes:       yes
    Differential Revision:  https://reviews.freebsd.org/D41354
---
 ObsoleteFiles.inc             |   4 +
 UPDATING                      |   7 +
 share/man/man4/Makefile       |   2 -
 share/man/man4/ath.4          |  17 +-
 share/man/man4/ath_ahb.4      |  60 -------
 share/man/man4/ath_pci.4      |  57 -------
 sys/amd64/conf/GENERIC        |   5 +-
 sys/arm/conf/ARMADA38X        |   3 +-
 sys/conf/files                |   8 +-
 sys/dev/ath/if_ath_ahb.c      | 353 ------------------------------------------
 sys/i386/conf/GENERIC         |   5 +-
 sys/modules/Makefile          |   1 -
 sys/modules/ath_ahb/Makefile  |  43 -----
 sys/modules/ath_main/Makefile |   1 +
 sys/modules/ath_pci/Makefile  |  43 -----
 sys/powerpc/conf/GENERIC64    |   5 +-
 sys/powerpc/conf/GENERIC64LE  |   5 +-
 17 files changed, 24 insertions(+), 595 deletions(-)

diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc
index d77ced3c817d..8ca4c98d6a6d 100644
--- a/ObsoleteFiles.inc
+++ b/ObsoleteFiles.inc
@@ -52,6 +52,10 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20230807: Removal of the ath(4) AHB bus-frontend or MIPS
+OLD_FILES+=usr/share/man/man4/ath_ahb.4
+OLD_FILES+=usr/share/man/man4/ath_pci.4
+
 # 20230803: Removal of support for cloning pseudo interfaces from iflib(9)
 OLD_FILES+=usr/include/net/iflib_private.h
 
diff --git a/UPDATING b/UPDATING
index 5889c0ac9903..fbe932db2aa9 100644
--- a/UPDATING
+++ b/UPDATING
@@ -27,6 +27,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 14.x IS SLOW:
 	world, or to merely disable the most expensive debugging functionality
 	at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".)
 
+20230807:
+	Following the general removal of MIPS support, the ath(4) AHB bus-
+	frontend has been removed, too, and building of the PCI support is
+	integrated with the ath(4) main module again. As a result, there's
+	no longer a need for if_ath_pci_load="YES" in /boot/loader.conf or
+	"device ath_pci" in the kernel configuration.
+
 20230803:
 	MAXCPU has been increased to 1024 in the amd64 GENERIC kernel config.
 	Out-of-tree kernel modules will need to be rebuilt.
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index 047f3b1aeba7..91df1f3b94c0 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -55,9 +55,7 @@ MAN=	aac.4 \
 	at45d.4 \
 	ata.4 \
 	ath.4 \
-	ath_ahb.4 \
 	ath_hal.4 \
-	ath_pci.4 \
 	atkbd.4 \
 	atkbdc.4 \
 	atp.4 \
diff --git a/share/man/man4/ath.4 b/share/man/man4/ath.4
index 564238fd396e..59814e9973ff 100644
--- a/share/man/man4/ath.4
+++ b/share/man/man4/ath.4
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"/
-.Dd June 16, 2020
+.Dd August 7, 2023
 .Dt ATH 4
 .Os
 .Sh NAME
@@ -40,7 +40,6 @@ place the following lines in your
 kernel configuration file:
 .Bd -ragged -offset indent
 .Cd "device ath"
-.Cd "device ath_pci"
 .Cd "device ath_hal"
 .Cd "device ath_rate_sample"
 .Cd "device wlan"
@@ -51,7 +50,6 @@ module at boot time, place the following line in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 if_ath_load="YES"
-if_ath_pci_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
@@ -65,19 +63,6 @@ Supported features include 802.11 and 802.3 frames, power management, BSS,
 IBSS, MBSS, WDS/DWDS TDMA, and host-based access point operation modes.
 All host/device interaction is via DMA.
 .Pp
-Please note that from FreeBSD-9.0, the
-.Nm
-driver does not include the PCI/PCIe bus glue.
-The same driver supports multiple underlying bus types, including PCI/PCIe,
-but also embedded (AHB) and USB in the future.
-.Pp
-To enable use for PCI/PCIe systems, see the
-.Xr ath_pci 4
-driver.
-For embedded systems which use the AHB to connect the wireless MAC, see the
-.Xr ath_ahb 4
-driver.
-.Pp
 The
 .Nm
 driver encapsulates all IP and ARP traffic as 802.11 frames, however
diff --git a/share/man/man4/ath_ahb.4 b/share/man/man4/ath_ahb.4
deleted file mode 100644
index 52aceb760657..000000000000
--- a/share/man/man4/ath_ahb.4
+++ /dev/null
@@ -1,60 +0,0 @@
-.\"-
-.\" 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$
-.\"/
-.Dd May 30, 2011
-.Dt ATH_AHB 4
-.Os
-.Sh NAME
-.Nm ath_ahb
-.Nd "Atheros AHB device glue"
-.Sh SYNOPSIS
-.Cd "device ath_ahb"
-.Sh DESCRIPTION
-This module provides the AHB bus glue needed for the devices supported
-by the
-.Xr ath 4
-and
-.Xr ath_hal 4
-drivers.
-.Pp
-This is only relevant for embedded System-on-Chip (SoC) devices such as
-the Atheros AR913x series, which include an Atheros wireless MAC on-die.
-.Sh SEE ALSO
-.Xr ath 4 ,
-.Xr ath_hal 4
-.Sh HISTORY
-The
-.Nm
-module first appeared in
-.Fx 9.0 .
-.Sh BUGS
-See
-.Xr ath 4
-for known bugs.
diff --git a/share/man/man4/ath_pci.4 b/share/man/man4/ath_pci.4
deleted file mode 100644
index 0cc36d7268f3..000000000000
--- a/share/man/man4/ath_pci.4
+++ /dev/null
@@ -1,57 +0,0 @@
-.\"-
-.\" 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$
-.\"/
-.Dd May 30, 2011
-.Dt ATH_PCI 4
-.Os
-.Sh NAME
-.Nm ath_pci
-.Nd "Atheros PCI device glue"
-.Sh SYNOPSIS
-.Cd "device ath_pci"
-.Sh DESCRIPTION
-This module provides the PCI/PCIe bus glue needed for the devices supported
-by the
-.Xr ath 4
-and
-.Xr ath_hal 4
-drivers.
-.Sh SEE ALSO
-.Xr ath 4 ,
-.Xr ath_hal 4
-.Sh HISTORY
-The
-.Nm
-module first appeared in
-.Fx 9.0 .
-.Sh BUGS
-See
-.Xr ath 4
-for known bugs.
diff --git a/sys/amd64/conf/GENERIC b/sys/amd64/conf/GENERIC
index feec1d5dd3c8..822567ebe4bd 100644
--- a/sys/amd64/conf/GENERIC
+++ b/sys/amd64/conf/GENERIC
@@ -303,9 +303,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 NICs
-device		ath_pci			# Atheros pci/cardbus glue
-device		ath_hal			# pci/cardbus chip support
+device		ath			# Atheros CardBus/PCI NICs
+device		ath_hal			# Atheros CardBus/PCI chip support
 options 	AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation
 options 	ATH_ENABLE_11N		# Enable 802.11n support for AR5416 and later
 device		ath_rate_sample		# SampleRate tx rate control for ath
diff --git a/sys/arm/conf/ARMADA38X b/sys/arm/conf/ARMADA38X
index 17ba80095531..ec216d67cbb7 100644
--- a/sys/arm/conf/ARMADA38X
+++ b/sys/arm/conf/ARMADA38X
@@ -88,8 +88,7 @@ device		mv_spi
 
 # Wireless NIC cards
 device		wlan		# 802.11 support
-device		ath		# Atheros NIC's
-device		ath_pci		# Atheros pci/cardbus glue
+device		ath		# Atheros CardBus/PCI NICs
 device		ath_hal
 device		ath_rate_sample
 options 	ATH_ENABLE_11N
diff --git a/sys/conf/files b/sys/conf/files
index 3d405b3d86b5..5d75f819a5f5 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -892,12 +892,6 @@ dev/ata/chipsets/ata-siliconimage.c	optional ata pci | atasiliconimage | ataati
 dev/ata/chipsets/ata-sis.c	optional ata pci | atasis
 dev/ata/chipsets/ata-via.c	optional ata pci | atavia
 #
-dev/ath/if_ath_pci.c		optional ath_pci pci \
-	compile-with "${ATH_C}"
-#
-dev/ath/if_ath_ahb.c		optional ath_ahb \
-	compile-with "${ATH_C}"
-#
 dev/ath/if_ath.c		optional ath \
 	compile-with "${ATH_C}"
 dev/ath/if_ath_alq.c		optional ath \
@@ -920,6 +914,8 @@ dev/ath/if_ath_led.c		optional ath \
 	compile-with "${ATH_C}"
 dev/ath/if_ath_lna_div.c	optional ath \
 	compile-with "${ATH_C}"
+dev/ath/if_ath_pci.c		optional ath pci \
+	compile-with "${ATH_C}"
 dev/ath/if_ath_tx.c		optional ath \
 	compile-with "${ATH_C}"
 dev/ath/if_ath_tx_edma.c	optional ath \
diff --git a/sys/dev/ath/if_ath_ahb.c b/sys/dev/ath/if_ath_ahb.c
deleted file mode 100644
index fe002ae7ffd7..000000000000
--- a/sys/dev/ath/if_ath_ahb.c
+++ /dev/null
@@ -1,353 +0,0 @@
-/*-
- * SPDX-License-Identifier: BSD-2-Clause
- *
- * 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 "opt_ath.h"
-
-#include <sys/param.h>
-#include <sys/systm.h> 
-#include <sys/malloc.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 <net/ethernet.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>
-
-/* For EEPROM firmware */
-#ifdef	ATH_EEPROM_FIRMWARE
-#include <sys/linker.h>
-#include <sys/firmware.h>
-#endif	/* ATH_EEPROM_FIRMWARE */
-
-/*
- * 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 */
-	void			*sc_ih;		/* interrupt handler */
-};
-
-#define	VENDOR_ATHEROS	0x168c
-#define	AR9130_DEVID	0x000b
-
-static int
-ath_ahb_probe(device_t dev)
-{
-	int vendor_id, device_id;
-	const char* devname;
-
-	/*
-	 * Check if a device/vendor ID is provided in hints.
-	 */
-	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
-	    "vendor_id", &vendor_id) != 0) {
-		vendor_id = VENDOR_ATHEROS;
-	}
-
-	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
-	    "device_id", &device_id) != 0) {
-		device_id = AR9130_DEVID;
-	}
-
-	device_printf(dev, "Vendor=0x%04x, Device=0x%04x\n",
-	    vendor_id & 0xffff,
-	    device_id & 0xffff);
-
-	/* Attempt to probe */
-	devname = ath_hal_probe(vendor_id, device_id);
-
-	if (devname != NULL) {
-		device_set_desc(dev, devname);
-		return BUS_PROBE_DEFAULT;
-	}
-	return ENXIO;
-}
-
-static void
-ath_ahb_intr(void *arg)
-{
-	/* XXX TODO: check if its ours! */
-	ar71xx_device_flush_ddr(AR71XX_CPU_DDR_FLUSH_WMAC);
-	ath_intr(arg);
-}
-
-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;
-	int device_id, vendor_id;
-#ifdef	ATH_EEPROM_FIRMWARE
-	const struct firmware *fw = NULL;
-	const char *buf;
-#endif
-
-	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;
-	}
-
-	sc->sc_st = (HAL_BUS_TAG) 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;
-
-#ifdef	ATH_EEPROM_FIRMWARE
-	/*
-	 * If there's an EEPROM firmware image, load that in.
-	 */
-	if (resource_string_value(device_get_name(dev), device_get_unit(dev),
-	    "eeprom_firmware", &buf) == 0) {
-		device_printf(dev, "%s: looking up firmware @ '%s'\n",
-		    __func__, buf);
-
-		fw = firmware_get(buf);
-		if (fw == NULL) {
-			device_printf(dev, "%s: couldn't find firmware\n",
-			    __func__);
-			goto bad1;
-		}
-
-		device_printf(dev, "%s: EEPROM firmware @ %p\n",
-		    __func__, fw->data);
-		sc->sc_eepromdata =
-		    malloc(fw->datasize, M_TEMP, M_WAITOK | M_ZERO);
-		if (! sc->sc_eepromdata) {
-			device_printf(dev, "%s: can't malloc eepromdata\n",
-			    __func__);
-			goto bad1;
-		}
-		memcpy(sc->sc_eepromdata, fw->data, fw->datasize);
-		firmware_put(fw, 0);
-	}
-#endif	/* ATH_EEPROM_FIRMWARE */
-
-	/*
-	 * 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_ahb_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;
-	}
-
-	/*
-	 * Check if a device/vendor ID is provided in hints.
-	 */
-	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
-	    "vendor_id", &vendor_id) != 0) {
-		vendor_id = VENDOR_ATHEROS;
-	}
-
-	if (resource_int_value(device_get_name(dev), device_get_unit(dev),
-	    "device_id", &device_id) != 0) {
-		device_id = AR9130_DEVID;
-	}
-
-	ATH_LOCK_INIT(sc);
-	ATH_PCU_LOCK_INIT(sc);
-	ATH_RX_LOCK_INIT(sc);
-	ATH_TX_LOCK_INIT(sc);
-	ATH_TXSTATUS_LOCK_INIT(sc);
-
-	error = ath_attach(device_id, sc);
-	if (error == 0)					/* success */
-		return 0;
-
-	ATH_TXSTATUS_LOCK_DESTROY(sc);
-	ATH_RX_LOCK_DESTROY(sc);
-	ATH_TX_LOCK_DESTROY(sc);
-	ATH_PCU_LOCK_DESTROY(sc);
-	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_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);
-	/* XXX?! */
-	if (sc->sc_eepromdata)
-		free(sc->sc_eepromdata, M_TEMP);
-
-	ATH_TXSTATUS_LOCK_DESTROY(sc);
-	ATH_RX_LOCK_DESTROY(sc);
-	ATH_TX_LOCK_DESTROY(sc);
-	ATH_PCU_LOCK_DESTROY(sc);
-	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)
-};
-
-DRIVER_MODULE(if_ath_ahb, nexus, ath_ahb_driver, 0, 0);
-DRIVER_MODULE(if_ath_ahb, apb, ath_ahb_driver, 0, 0);
-MODULE_VERSION(if_ath_ahb, 1);
-MODULE_DEPEND(if_ath_ahb, wlan, 1, 1, 1);		/* 802.11 media layer */
-MODULE_DEPEND(if_ath_ahb, ath_main, 1, 1, 1);		/* if_ath driver */
-MODULE_DEPEND(if_ath_ahb, ath_hal, 1, 1, 1);		/* ath HAL */
diff --git a/sys/i386/conf/GENERIC b/sys/i386/conf/GENERIC
index 105bc238cb7d..d2bc5b195963 100644
--- a/sys/i386/conf/GENERIC
+++ b/sys/i386/conf/GENERIC
@@ -259,9 +259,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 NICs
-device		ath_pci			# Atheros pci/cardbus glue
-device		ath_hal			# pci/cardbus chip support
+device		ath			# Atheros CardBus/PCI NICs
+device		ath_hal			# Atheros CardBus/PCI chip support
 options 	AH_AR5416_INTERRUPT_MITIGATION # AR5416 interrupt mitigation
 options 	ATH_ENABLE_11N		# Enable 802.11n support for AR5416 and later
 device		ath_rate_sample		# SampleRate tx rate control for ath
diff --git a/sys/modules/Makefile b/sys/modules/Makefile
index 0ef69528b45e..8b5e48a2d53f 100644
--- a/sys/modules/Makefile
+++ b/sys/modules/Makefile
@@ -54,7 +54,6 @@ SUBDIR=	\
 	ath_hal_ar9300 \
 	ath_main \
 	ath_rate \
-	ath_pci \
 	${_autofs} \
 	axgbe \
 	backlight \
diff --git a/sys/modules/ath_ahb/Makefile b/sys/modules/ath_ahb/Makefile
deleted file mode 100644
index 02278eadea2b..000000000000
--- a/sys/modules/ath_ahb/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# 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:	${SRCTOP}/sys/dev/ath
-.PATH:	${SRCTOP}/sys/dev/ath/ath_hal
-
-KMOD=	if_ath_ahb
-SRCS=	if_ath_ahb.c
-SRCS+=	device_if.h bus_if.h opt_wlan.h opt_ath.h opt_ah.h
-
-CFLAGS+=  -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
-
-.include <bsd.kmod.mk>
-
-CWARNFLAGS+=	${NO_WUNUSED_BUT_SET_VARIABLE}
diff --git a/sys/modules/ath_main/Makefile b/sys/modules/ath_main/Makefile
index 4cf55d42fc92..6a08874115ac 100644
--- a/sys/modules/ath_main/Makefile
+++ b/sys/modules/ath_main/Makefile
@@ -39,6 +39,7 @@ SRCS=	if_ath.c if_ath_alq.c if_ath_debug.c if_ath_keycache.c if_ath_sysctl.c
 SRCS+=	if_ath_tx.c if_ath_tx_ht.c if_ath_led.c if_ath_rx.c if_ath_tdma.c
 SRCS+=	if_ath_beacon.c if_ath_rx_edma.c if_ath_tx_edma.c if_ath_spectral.c
 SRCS+=	if_ath_btcoex.c if_ath_btcoex_mci.c if_ath_lna_div.c if_ath_ioctl.c if_ath_descdma.c
+SRCS+=	if_ath_pci.c
 
 SRCS+=	device_if.h bus_if.h pci_if.h opt_inet.h opt_ath.h opt_ah.h opt_wlan.h
 
diff --git a/sys/modules/ath_pci/Makefile b/sys/modules/ath_pci/Makefile
deleted file mode 100644
index a5a2d87925ca..000000000000
--- a/sys/modules/ath_pci/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#
-# 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:	${SRCTOP}/sys/dev/ath
-.PATH:	${SRCTOP}/sys/dev/ath/ath_hal
-
-KMOD=	if_ath_pci
-SRCS=	if_ath_pci.c
-SRCS+=	device_if.h bus_if.h pci_if.h opt_wlan.h opt_ath.h opt_ah.h
-
-CFLAGS+=  -I. -I${SRCTOP}/sys/dev/ath -I${SRCTOP}/sys/dev/ath/ath_hal
-
-.include <bsd.kmod.mk>
-
-CWARNFLAGS+=	${NO_WUNUSED_BUT_SET_VARIABLE}
diff --git a/sys/powerpc/conf/GENERIC64 b/sys/powerpc/conf/GENERIC64
index c4277983b66a..dc7edadd78d0 100644
--- a/sys/powerpc/conf/GENERIC64
+++ b/sys/powerpc/conf/GENERIC64
@@ -241,9 +241,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 NICs
-device		ath_pci		# Atheros pci/cardbus glue
-device		ath_hal		# pci/cardbus chip support
+device		ath		# Atheros CardBus/PCI NICs
+device		ath_hal		# Atheros CardBus/PCI chip support
 options 	AH_AR5416_INTERRUPT_MITIGATION	# AR5416 interrupt mitigation
 options 	ATH_ENABLE_11N	# Enable 802.11n support for AR5416 and later
 device		ath_rate_sample	# SampleRate tx rate control for ath
diff --git a/sys/powerpc/conf/GENERIC64LE b/sys/powerpc/conf/GENERIC64LE
index 99d1975442f7..b6e402ab77a1 100644
--- a/sys/powerpc/conf/GENERIC64LE
+++ b/sys/powerpc/conf/GENERIC64LE
@@ -237,9 +237,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 NICs
-device		ath_pci		# Atheros pci/cardbus glue
-device		ath_hal		# pci/cardbus chip support
+device		ath		# Atheros CardBus/PCI NICs
+device		ath_hal		# Atheros CardBus/PCI chip support
 options 	AH_AR5416_INTERRUPT_MITIGATION	# AR5416 interrupt mitigation
 options 	ATH_ENABLE_11N	# Enable 802.11n support for AR5416 and later
 device		ath_rate_sample	# SampleRate tx rate control for ath