History log of /freebsd-current/sys/dev/ath/ath_hal/ah_internal.h
Revision Date Author Comments
# 95ee2897 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: two-line .h pattern

Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/


# 9966c0f9 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

ath: clean up empty lines in .c and .h files


# 6e778a7e 08-Dec-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

SPDX: license IDs for some ISC-related files.


# f46839b9 24-May-2017 Adrian Chadd <adrian@FreeBSD.org>

[ath] [ath_hal] retire AH_SUPPORT_AR5416 changing anything.

Yes, the memory bloat is large, but it's 2017 and I'll fix it later
by making it runtime configurable / per-chip configurable if I ever need to.


# 41059135 24-May-2017 Adrian Chadd <adrian@FreeBSD.org>

[ath] [ath_hal] (etc, etc) - begin the task of re-modularising the HAL.

In the deep past, when this code compiled as a binary module, ath_hal
built as a module. This allowed custom, smaller HAL modules to be built.
This was especially beneficial for small embedded platforms where you
didn't require /everything/ just to run.

However, sometime around the HAL opening fanfare, the HAL landed here
as one big driver+HAL thing, and a lot of the (dirty) infrastructure
(ie, #ifdef AH_SUPPORT_XXX) to build specific subsets of the HAL went away.
This was retained in sys/conf/files as "ath_hal_XXX" but it wasn't
really floated up to the modules themselves.

I'm now in a position where for the reaaaaaly embedded boards (both the
really old and the last couple generation of QCA MIPS boards) having a
cut down HAL module and driver loaded at runtime is /actually/ beneficial.

This reduces the kernel size down by quite a bit. The MIPS modules look
like this:

adrian@gertrude:~/work/freebsd/head-embedded/src % ls -l ../root/mips_ap/boot/kernel.CARAMBOLA2/ath*ko
-r-xr-xr-x 1 adrian adrian 5076 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_dfs.ko
-r-xr-xr-x 1 adrian adrian 100588 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_hal.ko
-r-xr-xr-x 1 adrian adrian 627324 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_hal_ar9300.ko
-r-xr-xr-x 1 adrian adrian 314588 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_main.ko
-r-xr-xr-x 1 adrian adrian 23472 May 23 23:45 ../root/mips_ap/boot/kernel.CARAMBOLA2/ath_rate.ko

And the x86 versions, like this:

root@gertrude:/home/adrian # ls -l /boot/kernel/ath*ko
-r-xr-xr-x 1 root wheel 36632 May 24 18:32 /boot/kernel/ath_dfs.ko
-r-xr-xr-x 1 root wheel 134440 May 24 18:32 /boot/kernel/ath_hal.ko
-r-xr-xr-x 1 root wheel 82320 May 24 18:32 /boot/kernel/ath_hal_ar5210.ko
-r-xr-xr-x 1 root wheel 104976 May 24 18:32 /boot/kernel/ath_hal_ar5211.ko
-r-xr-xr-x 1 root wheel 236144 May 24 18:32 /boot/kernel/ath_hal_ar5212.ko
-r-xr-xr-x 1 root wheel 336104 May 24 18:32 /boot/kernel/ath_hal_ar5416.ko
-r-xr-xr-x 1 root wheel 598336 May 24 18:32 /boot/kernel/ath_hal_ar9300.ko
-r-xr-xr-x 1 root wheel 406144 May 24 18:32 /boot/kernel/ath_main.ko
-r-xr-xr-x 1 root wheel 55352 May 24 18:32 /boot/kernel/ath_rate.ko

.. so you can see, not building the whole HAL can save quite a bit.
For example, if you don't need AR9300 support, you can actually avoid
wasting half a megabyte of RAM. On embedded routers this is quite a
big deal.

The AR9300 HAL can be later further shrunk because, hilariously,
it indeed supports AH_SUPPORT_<xxx> for optionally adding chipset support.
(I'll chase that down later as it's quite a big savings if you're only
building for a single embedded target.)

So:

* Create a very hackish way to load/unload HAL modules
* Create module metadata for each HAL subtype - ah_osdep_arXXXX.c
* Create module metadata for ath_rate and ath_dfs (bluetooth is
currently just built as part of it)
* .. yes, this means we could actually build multiple rate control
modules and pick one at load time, but I'd rather just glue this
into net80211's rate control code. Oh well, baby steps.
* Main driver is now "ath_main"
* Create an "if_ath" module that does what the ye olde one did -
load PCI glue, main driver, HAL and all child modules.
In this way, if you have "if_ath_load=YES" in /boot/modules.conf
it will load everything the old way and stuff should still work.
* For module autoloading purposes, I actually /did/ fix up
the name of the modules in if_ath_pci and if_ath_ahb.

If you want to selectively load things (eg on ye cheape ARM/MIPS platforms
where RAM is at a premium) you should:

* load ath_hal
* load the chip modules in question
* load ath_rate, ath_dfs
* load ath_main
* load if_ath_pci and/or if_ath_ahb depending upon your particular
bus bind type - this is where probe/attach is done.

TODO:

* AR5312 module and associated pieces - yes, we have the SoC side support
now so the wifi support would be good to "round things out";
* Just nuke AH_SUPPORT_AR5416 for now and always bloat the packet
structures; this'll simplify other things.
* Should add a simple refcnt thing to the HAL RF/chip modules so you
can't unload them whilst you're using them.
* Manpage updates, UPDATING if appropriate, etc.


# 85bc19eb 25-Sep-2016 Adrian Chadd <adrian@FreeBSD.org>

[ath_hal] Add FCC6_FCCA regulatory domain (0x0014).

Tested:

* TP-Link N900, AR9380, regdomain 0x0014 (FCC6_FCCA).


# 90d3a30a 08-Sep-2016 Adrian Chadd <adrian@FreeBSD.org>

[ath_hal] fixes for finer grain timestamping, some 11n macros

* change the HT_RC_2_MCS to do MCS0..23
* Use it when looking up the ht20/ht40 array for bits-per-symbol
* add a clk_to_psec (picoseconds) routine, so we can get sub-microsecond
accuracy for the math
* .. and make that + clk_to_usec public, so higher layer code that is
returning clocks (eg the ANI diag routines, some upcoming locationing
experiments) can be converted to microseconds.

Whilst here, add a comment in ar5416 so i or someone else can revisit the
latency values.


# 51558243 08-Jul-2016 Adrian Chadd <adrian@FreeBSD.org>

[ath_hal] retire a "long RX desc" flag, store/use the TX/RX timestamp length.

* the code already stored the length of the RX desc, which I never used.
So, use that and retire the new flag I introduced a while ago.
* Introduce a TX timestamp length field and capability.


# ff066b54 29-Nov-2015 Adrian Chadd <adrian@FreeBSD.org>

fix ht/40 configuration for ar9331 (hornet).

The synth programming here requires the real centre frequency,
which for HT20 channels is the normal channel, but HT40 is
/not/ the primary channel. Everything else was using 'freq',
which is the correct centre frequency, but the hornet config
was using 'ichan' to do the lookup which was also the primary
channel.

So, modify the HAL call that does the mapping to take a frequency
in MHz and return the channel number.

Tested:

* Carambola 2, AR9331, tested both HT/20 and HT/40 operation.


# b0602bec 29-Mar-2015 Adrian Chadd <adrian@FreeBSD.org>

Move the HAL channel survey support out to be in the top-level HAL,
rathe than private in each HAL module.

Whilst here, modify ath_hal_private to always have the per-channel
noisefloor stats, rather than conditionally. This just makes
life easier in general (no strange ABI differences between different
HAL compile options.)

Add a couple of methods (clear/reset, add) rather than using
hand-rolled versions of things.


# 99f46e36 27-Jan-2015 Adrian Chadd <adrian@FreeBSD.org>

Add a new HAL capability - required to compile the updated AR9300
HAL i have lying about.


# 9389d5a9 29-Sep-2014 Adrian Chadd <adrian@FreeBSD.org>

Add initial support for the AR9485 CUS198 / CUS230 variants.

These variants have a few differences from the default AR9485 NIC,
namely:

* a non-default antenna switch config;
* slightly different RX gain table setup;
* an external XLNA hooked up to a GPIO pin;
* (and not yet done) RSSI threshold differences when
doing slow diversity.

To make this possible:

* Add the PCI device list from Linux ath9k, complete with vendor and
sub-vendor IDs for various things to be enabled;
* .. and until FreeBSD learns about a PCI device list like this,
write a search function inspired by the USB device enumeration code;
* add HAL_OPS_CONFIG to the HAL attach methods; the HAL can use this
to initialise its local driver parameters upon attach;
* copy these parameters over in the AR9300 HAL;
* don't default to override the antenna switch - only do it for
the chips that require it;
* I brought over ar9300_attenuation_apply() from ath9k which is cleaner
and easier to read for this particular NIC.

This is a work in progress. I'm worried that there's some post-AR9380
NIC out there which doesn't work without the antenna override set as
I currently haven't implemented bluetooth coexistence for the AR9380
and later HAL. But I'd rather have this code in the tree and fix it
up before 11.0-RELEASE happens versus having a set of newer NICs
in laptops be effectively RX deaf.

Tested:

* AR9380 (STA)
* AR9485 CUS198 (STA)

Obtained from: Qualcomm Atheros, Linux ath9k


# fad86101 09-Aug-2014 Adrian Chadd <adrian@FreeBSD.org>

Bump the HAL_REGRANGE fields from 16 bit to 32 bit.

The AR9380 and later chips have a 128KiB register window, so the register
read diag api needs changing.

The tools are about to be updated as well. No, they're not backwards
compatible.


# dd7b232e 27-Apr-2014 Adrian Chadd <adrian@FreeBSD.org>

* Add a new capability which returns whether the hardware supports
the MYBEACON RX filter (only receive beacons which match the BSSID)
or all beacons on the current channel.

* Add the relevant RX filter entry for MYBEACON.

Tested:

* AR5416, STA
* AR9285, STA

TODO:

* once the code is in -HEAD, just make sure that the code which uses it
correctly sets BEACON for pre-AR5416 chips.

Obtained from: QCA, Linux ath9k


# 03f26656 25-Jun-2013 Adrian Chadd <adrian@FreeBSD.org>

Add a HAL local routine to map the 2GHz channel frequency to an IEEE
channel.

There's some HAL code in the AR9300 HAL that requires a back-mapping
and using the net80211 code isn't appropriate here.


# d98a3d69 04-Jun-2013 Adrian Chadd <adrian@FreeBSD.org>

Add a new capability flag to announce that the chip implements LNA mixing
for the RX path.

This is different to the div comb HAL flag, that says it actually
can use this for RX diversity (the "slow" diversity path implemented
but disabled in the AR9285 HAL code.)

Tested:

* AR9285, STA operation


# 7598a108 05-Apr-2013 Adrian Chadd <adrian@FreeBSD.org>

Add a new TX power field - it's inteded to be used where low TX power
is configured for higher rates (lower than max) but higher TX power
is configured for the lower rates, above the configured cap, to improve
long distance behaviour.


# 9cbc6f15 29-Dec-2012 Adrian Chadd <adrian@FreeBSD.org>

Add spectral scan capability.


# 7877ac64 06-Nov-2012 Adrian Chadd <adrian@FreeBSD.org>

Add new HAL configuration features for the updated AR9300 HAL.


# 3631c3f2 31-Oct-2012 Adrian Chadd <adrian@FreeBSD.org>

Add in the last random assortment of missing bits for the AR9380 HAL.

Obtained from: Qualcomm Atheros


# 8122c316 17-Sep-2012 Adrian Chadd <adrian@FreeBSD.org>

Add a couple of accessor inline functions for state that exists in net80211.

Obtained from: Qualcomm Atheros


# d94f2d7f 17-Sep-2012 Adrian Chadd <adrian@FreeBSD.org>

Rename AH_MIMO_MAX_CHAINS to AH_MAX_CHAINS, for compatibility with
internal atheros HAL code.


# 46e26496 28-Aug-2012 Adrian Chadd <adrian@FreeBSD.org>

Add a new capability bit - whether the hardware supports AR9285 style
combined diversity.


# 0146ef1a 28-Aug-2012 Adrian Chadd <adrian@FreeBSD.org>

Add a (temporarily located) definition.


# 9b134472 23-Aug-2012 Adrian Chadd <adrian@FreeBSD.org>

Add rfkill HAL accessor methods.


# 830c1c46 23-Aug-2012 Adrian Chadd <adrian@FreeBSD.org>

Wrap this a little so it's slightly easier on the eyes.


# c84b4ebb 23-Aug-2012 Adrian Chadd <adrian@FreeBSD.org>

Add some new flags:

* mfp support;
* 4.9ghz support in the HAL;
* device type - specifically, the bus type and whether it's a HB63
NIC (which requires some subtle chainmask handling differences
in the AR5416 HAL.)

Obtained from: Qualcomm Atheros


# ee3e4df9 28-Jul-2012 Adrian Chadd <adrian@FreeBSD.org>

Flesh out the multi-rate retry capability.

The existing method for testing for MRR is to call the "SetupXTXDesc"
HAL method and see if it returns AH_TRUE or AH_FALSE. This capability
explicitly lists what number of multi-rate attempts are possible.

"1" means "one rate attempt supported".


# df914682 30-Jun-2012 Adrian Chadd <adrian@FreeBSD.org>

Migrate the MAC/BB hang structures out from ar5416_misc.h into the HAL.

The ar9300 HAL also uses these types, so it makes no sense to duplicate
them.


# 7eee712c 30-Jun-2012 Adrian Chadd <adrian@FreeBSD.org>

Bring over capabilities for the AR9300 and later HAL.


# 3acbfe72 16-Jun-2012 Adrian Chadd <adrian@FreeBSD.org>

AR9287 tidyups:

* Add an OS_A_REG_WRITE() routine - analog writes require a 100usec delay
on AR9280 and later, so create a method to do it.

* Use it for the AR9287 analog writes.

* Re-indent and style(9) the code.


# ae2a0aa4 24-May-2012 Adrian Chadd <adrian@FreeBSD.org>

oops - ath_hal_disablepcie is actually destined for another purpose,
not to disable the PCIe PHY in prepration for reset.

Extend the enablepci method to have a "poweroff" flag, which if equal
to true means the hardware is about to go to sleep.


# f5d9d545 07-Jan-2012 Adrian Chadd <adrian@FreeBSD.org>

.. the AR5416 HAL code touches the MIMO parts in HAL_CHANNEL,
so this is also needed.

Pointed out by: bz


# ddbe3036 09-Nov-2011 Adrian Chadd <adrian@FreeBSD.org>

Introduce a work-around for issues with the AR5416 based MAC on SMP devices.

The AR5416 MAC (which shows up in the AR5008, AR9001, AR9002 devices) has
issues with PCI transactions on SMP machines. This work-around enforces
that register access is serialised through a (global for now) spinlock.

This should stop the hangs people have seen with the AR5416 PCI devices
on SMP hosts.

Obtained by: Linux, Atheros


# 46614948 17-Oct-2011 Adrian Chadd <adrian@FreeBSD.org>

Implement the first part of the BB read workaround.

The AR5008/AR9001 series NICs have a bug where BB register reads
will occasionally be corrupted. This could cause issues with things
such as ANI, which adjust operational parameters based on the
BB radio register reads. This was introduced in the AR5008 chip
and fixed with the first released AR9002 series NIC (AR9280v2.)

A followup commit will implement the acutal WAR when reading
BB registers. I'm still not sure how I'll implement it - whether
it should be done in the osdep layer, or whether it should just
live in the AR5416 HAL. Either way, they can use this capability
bit to determine whether to implement the WAR or not.

Thankyou to various sources inside Atheros who have helped me track
down what this particular issue is.

Obtained from: Atheros


# 31a47d8c 17-Oct-2011 Adrian Chadd <adrian@FreeBSD.org>

Add in OS_REG_BIT_SET, a macro which does what it says it does.

This will be used in an upcoming commit to the ar5212 HAL.


# 0e56140a 29-Sep-2011 Adrian Chadd <adrian@FreeBSD.org>

Fix a corner case in the HAL debugging changes, where ah was NULL.

Although I tried to fix this earlier by introducing HALDEBUG_G(), it
turns out there seem to be other cases where the pointer value is still
NULL.

* Fix DO_HALDEBUG() and the HALDEBUG macro to check whether ah is NULL
before deferencing it
* Remove HALDEBUG_G() as it's no longer needed

This is hopefully a merge candidate for 9.0-RELEASE as enabling
debugging at startup could result in a kernel panic.


# fc4de9b7 07-Sep-2011 Adrian Chadd <adrian@FreeBSD.org>

Update the TSF and next-TBTT methods to work for the AR5416 and later NICs.
This is another commit in a series of TDMA support fixes for the 11n NICs.

* Move ath_hal_getnexttbtt() into the HAL; write methods for it.
This returns a timer value in TSF, rather than TU.

* Move ath_hal_getcca() and ath_hal_setcca() into the HAL too, where they
likely now belong.

* Create a new HAL capability: HAL_CAP_LONG_RXDESC_TSF.
The pre-11n NICs write 15 bit TSF snapshots into the RX descriptor;
the AR5416 and later write 32 bit TSF snapshots into the RX descriptor.
* Use the new capability to choose between 15 and 31 bit TSF adjustment
functions in ath_extend_tsf().

* Write ar5416GetTsf64() and ar5416SetTsf64() methods.
ar5416GetTsf64() tries to compensate for TSF changes at the 32 bit boundary.

According to yin, this fixes the TDMA beaconing on 11n chipsets and TDMA
stations can now associate/talk, but there are still issues with traffic
stability which need to be investigated.

The ath_hal_extendtsf() function is also used in RX packet timestamping;
this may improve adhoc mode on the 11n chipsets. It also will affect the
timestamps seen in radiotap frames.

Submitted by: Kang Yin Su <cantona@cantona.net>
Approved by: re (kib)


# 8db87e40 08-Aug-2011 Adrian Chadd <adrian@FreeBSD.org>

Introduce some more DFS related hooks, inspired both by local work
and the Atheros reference code.

The radar detection code needs to know what the current DFS domain is.
Since net80211 doesn't currently know this information, it's extracted
from the HAL regulatory domain information.

The specifics:

* add a new ath_dfs API hook, ath_dfs_init_radar_filters(), which
updates the radar filters whenever the regulatory domain changes.
* add HAL_DFS_DOMAIN which describes the currently configured DFS domain .
* add a new HAL internal variable which tracks the currently configured
HAL DFS domain.
* add a new HAL capability, HAL_CAP_DFS_DMN, which returns the currently
configured HAL DFS domain setting.
* update the HAL DFS domain setting whenever the channel setting is
updated.

Since this isn't currently used by any radar code, these should all
be no-ops for existing users.

Obtained from: Atheros
Submitted by: KBC Networks, sibridge
Approved by: re (kib, blanket)


# 8fc0556a 24-Jun-2011 Adrian Chadd <adrian@FreeBSD.org>

Small fix to bring the non-debug definitions of HALDEBUG/HALDEBUG_G in line
with the debug definitions.


# dc6ebb1b 22-Jun-2011 Adrian Chadd <adrian@FreeBSD.org>

add missing #define for the non-debug case.


# f6f1dfb6 23-Jun-2011 Adrian Chadd <adrian@FreeBSD.org>

Re-introduce a global ath_hal_debug again for now, whilst I figure out what
to do about the few cases where the HAL state isn't available (regdomain)
or isn't yet setup (probe/attach.)

The global ath_hal_debug now affects all instances of the HAL.

This also restores the ability for probe/attach debugging to work; as
the sysctl tree may not be attached at that point. Users can just set
the global "hw.ath.hal.debug" to a suitable value to enable probe/attach
related debugging.


# 37931a35 22-Jun-2011 Adrian Chadd <adrian@FreeBSD.org>

Break out most of the HAL related tweaks into a per-HAL instance,
rather than global variables.

This specifically allows for debugging to be enabled per-NIC, rather
than globally.

Since the ath driver doesn't know about AH_DEBUG, and to keep the ABI
consistent regardless of whether AH_DEBUG is enabled or not, enable the
debug parameter always but only conditionally compile in the debug
methods if needed.

The ALQ support is currently still global pending some brainstorming.

Submitted by: ssgriffonuser@gmail.com
Reviewed by: adrian, bschmidt


# 2cb5233b 01-Jun-2011 Adrian Chadd <adrian@FreeBSD.org>

Add some missing DFS chipset functionality to the FreeBSD HAL.

Please note - this doesn't in any way constitute a full DFS
implementation, it merely adds the relevant capability bits and
radar detection threshold register access.

The particulars:

* Add new capability bits outlining what the DFS capabilities
are of the various chipsets.
* Add HAL methods to set and get the radar related register values.
* Add AR5212 and AR5416+ DFS radar related register value
routines.
* Add a missing HAL phy error code that's related to radar event
processing.
* Add HAL_PHYERR_PARAM, a data type that encapsulates the radar
register values.

The AR5212 routines are just for completeness. The AR5416 routines
are a super-set of those; I may later on do a drive-by pass to
tidy up duplicate code.

Obtained from: Linux, Atheros


# 727edca4 25-May-2011 Adrian Chadd <adrian@FreeBSD.org>

The current ANI capability information uses a different set of
values for the commands, compared to the internal command values
(HAL_ANI_CMD.)

My eventual aim is to make the HAL_ANI_CMD internal enum match
the public API and then remove all this messiness.

This now allows HAL_CAP_INTMIT users to use a public HAL_CAP_INTMIT_
enum rather than magic constants.

The only magic constants currently used by if_ath are "enable" and
"present". Some local tools of mine allow for direct, manual fiddling
of the ANI variables and I'll convert these to use the public enum API
before I commit them.


# 241d9a34 25-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Tidy up the ANI API in preparation for looking to expose some more
of the ANI statistics and committing some tools which use these.

* Change HAL_ANI_* commands _back_ to be numerical, rather than a
bitmap;
* modify access to the ANI control bitmap to convert a command to
a bitmap;
* Fix the ANI noise immunity fiddling for CCK errors - it wasn't
checking whether noise immunity was disabled or not.


# 92ffeb63 14-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Fix the eeprom set API method to return HAL_STATUS.

The code assumed it could return HAL_OK, HAL_EINVAL and other
HAL_STATUS types; so it shouldn't be declared as returning HAL_BOOL.

This commit was brought to you by the Clang compiler.

Submitted by: Matthew Fleming <mdf356@gmail.com>


# 46dde1e6 11-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Add a new flag - HAL_DEBUG_UNMASKABLE - which always logs a debug message
(when debug is enabled) no matter what.


# c9cd7631 08-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Fix the 5ghz fast clock logic.

The macro which I incorrectly copied into ah_internal.h assumed
that it'd be called with an AR_SREV_MERLIN_20() check to ensure
it was only enabled for Merlin (AR9280) silicon revision 2.0 or
later.

Trouble is, the 5GHz fast clock EEPROM flag is only valid for
EEPROM revision 16 or greater; it's assumed to be enabled
by default for Merlin rev >= 2.0. This meant it'd be incorrectly
set for AR5416 and AR9160 in 5GHz mode.

This would have affected non-default clock timings such as SIFS,
ACK and slot time. The incorrect slot time was very likely wrong
for 5ghz mode.


# 26e8415d 07-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Do a HAL capabilities sync pass based on the Atheros HAL.

* Shuffle some of the capability numbers around to match the
Atheros HAL capability IDs, just for consistency.

* Add some new capabilities to FreeBSD from the Atheros
HAL which will be be shortly used when new chipsets are added
(HAL SGI-20 support is for Kiwi/AR9287 support); for
TX aggregation (MBSSID aggregate support, WDS aggregation
support); CST/GTT support for carrier sense/TX timeout.


# f93ef551 07-May-2011 Adrian Chadd <adrian@FreeBSD.org>

Read in the extended regulatory domain flags so future code can use them.

These describe FCC/Japan channel and DFS behaviour.

The AR9285 and later chips don't set these bits in the eeprom, the correct
behaviour is to just assume all five bits are enabled.


# 132163b1 12-Apr-2011 Adrian Chadd <adrian@FreeBSD.org>

Add OS_REG_RMW, which mirrors ath9k's REG_RMW.

This macro does a read-modify-write pass with register bits to set and clear.


# 7ab2ab91 08-Apr-2011 Adrian Chadd <adrian@FreeBSD.org>

Fix the completely wrong types I used in the previous commit.


# f1ff1148 08-Apr-2011 Adrian Chadd <adrian@FreeBSD.org>

Export the per-chain ctl/ext noise floor values, raw and uncut, to the
upper-level HAL.

Right now the per-chain noise floor values aren't used anywhere in
the upper-level HAL, so the driver currently has no real reference
to compare the per-chain RSSI values to.

This is needed before per-chain RSSI values (for ctl and ext radios)
are can be thrown upstairs to the net80211 code.


# 9e9ae8e2 04-Apr-2011 Adrian Chadd <adrian@FreeBSD.org>

Commit missing bits from the last commit:

* add the hal capability flag
* make sure its disabled for the ar9280/ar9285.


# f90a170c 03-Apr-2011 Adrian Chadd <adrian@FreeBSD.org>

I missed committing this last time - it's needed for the 5ghz fast clock calculation.


# d2211b6a 26-Mar-2011 Adrian Chadd <adrian@FreeBSD.org>

This was missing from the previous HAL commit - it fixes a typo and
introduces the PS-POLL hardware support.


# ef58d1e0 23-Mar-2011 Adrian Chadd <adrian@FreeBSD.org>

Make the ar2133ForceBias() call controllable at runtime.

At least one AR5416 user has reported measurable throughput drops
with this option. For now, disable it and make it a run-time
twiddle. It won't take affect until the next radio programming
trip though (eg channel scan, channel change.)


# 6ff1b2bd 12-Mar-2011 Adrian Chadd <adrian@FreeBSD.org>

Move out some of the shared eeprom board value calculation routines into ah.c
rather than duplicating them for the v14 (ar5416+) and v4k (ar9285) codebases.

Further chipsets (eg the AR9287) have yet another EEPROM format which will use
these routines to calculate things.


# f247e820 05-Mar-2011 Adrian Chadd <adrian@FreeBSD.org>

Change HALDEBUG() to be a macro that conditionally calls the debug output routine.

The earlier way of doing debugging would evaluate the function parameters
before calling the HALDEBUG. In the case of detailed register debugging
would mean a -lot- of unneeded register IO and other stuff was going on.

This method evaluates the ath_hal_debug variable before the function
parameters are evaluated, drastically reducing the amount of overhead
enabling HAL debugging during compilation.


# 744996fc 16-Feb-2011 Adrian Chadd <adrian@FreeBSD.org>

Add a new parameter to selectively enable/disable the ANI operations.

This was inspired by ath9k, which disables ANI anti-noise immunity
parameter tweaking (but leaves the rest of the ANI operations alone.)


# e0e5b8b4 07-Feb-2011 Adrian Chadd <adrian@FreeBSD.org>

There's apparently a bug with Merlin (AR9280) and later chipsets where
putting descriptors (not buffers) across a 4k page boundary can cause issues.
I've not seen it in production myself but it apparently can cause problems.

So, in preparation for addressing this workaround, (re)-expose the particular
HAL capability bit which marks whether the chipset has support for cross-4k-
boundary transactions or not.

A subsequent commit will modify the descriptor allocation to avoid allocating
descriptor entries that straddle a 4k page boundary.


# d9a80efd 07-Feb-2011 Adrian Chadd <adrian@FreeBSD.org>

Add a new RMW macro for analog register writes which implements the needed
wait period between operations.


# 94d748d2 31-Jan-2011 Adrian Chadd <adrian@FreeBSD.org>

Add a new capability which reports the number of spatial streams a device supports.

The higher levels (net80211, if_ath, ath_rate) need this to make correct
choices about what MCS capabilities to advertise and what MCS rates are
able to be TXed.

In summary:

* AR5416 - 2/3 antennas, 2x2 streams
* AR9160 - 2/3 antennas, 2x2 streams
* AR9220 - 2 antennas, 2x2 sstraems
* AR9280 - 2 antennas, 2x2 streams
* AR9285 - 2 antennas but with antenna diversity, 1x1 stream


# 88117a53 20-Jan-2011 Adrian Chadd <adrian@FreeBSD.org>

Include the initial support for external EEPROMs.

The AR9100 at least doesn't have an external serial EEPROM
attached to the MAC; it instead stores the calibration data
in the normal system flash.

I believe earlier parts can do something similar but I haven't
experienced it first-hand.

This commit introduces an eepromdata pointer into the API but
doesn't at all commit to using it. A future commit will
include the glue needed to allow the AR9100 support code
to use this data pointer as the EEPROM.


# 7fbdd9a0 20-Jan-2011 Adrian Chadd <adrian@FreeBSD.org>

Add another HAL function which waits for a register for a configurable amount.

This will be used by some future code.


# 0dbe9289 19-Jan-2011 Adrian Chadd <adrian@FreeBSD.org>

Break out the diagnostic codes from ah_internal.h and place them in ah_diagcodes.h.

Since we now have the source code, there's no reason to hide the diag codes
from other areas.

They live in the HAL as they form part of the HAL API and should still be treate
as "potentially flexible; don't publish as a public API." But since they're
already used as a public API (see follow-up commit), we may as well use
them in place of magic constants.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# d4aef82b 03-Mar-2010 Rui Paulo <rpaulo@FreeBSD.org>

Introduce ath_hal_setInterrupts(), a macro for ah_setInterrupts().

Pointed out by: sam


# 256796db 01-Mar-2010 Rui Paulo <rpaulo@FreeBSD.org>

Couple of suggestions from Sam regarding latest commit:
o rename the new variables to comply with the naming scheme
o move the new variables to an AR5212 specific struct
o use ahp when available
o revert to previous ts_flags check


# 9425e26b 01-Mar-2010 Rui Paulo <rpaulo@FreeBSD.org>

Properly setup the TX FIFO threshold for AR5416 based chipsets,
including the AR9285. This seems to fix some users's problems.

Submitted by: Jorge Boncompte [DTI2] <jorge at dti2.net>


# 3c3e9d33 27-Jun-2009 Sam Leffler <sam@FreeBSD.org>

Add HAL_RX_FILTER_BSSID support (to disable bssid match):
o add HAL_CAP_BSSIDMATCH to identify parts that have the support for
disabling bssid match
o honor capability for set/get rx filter
o use HAL_CAP_BSSIDMATCH in driver to decide whether to use the bssid
match disable or fall back to promisc mode

Reviewed by: rpaulo
Approved by: re (rwatson)


# 683f3134 19-May-2009 Sam Leffler <sam@FreeBSD.org>

add HAL_CAP_INTRMASK to return the set of interrupts supported by the device


# dd015656 09-Apr-2009 Sam Leffler <sam@FreeBSD.org>

check the method pointer before invoking ah_eepromDetach as it can
be null if attach work fails before hooking up the eeprom support

Obtained from: madwifi


# 44834ea4 23-Feb-2009 Sam Leffler <sam@FreeBSD.org>

Add PCIE power control api:
o add ah_configPCIE and ah_disablePCIE for drivers to configure PCIE
power save operation (modeled after ath9k, may need changes)
o add private state flag to indicate if device is PCIE (replaces private
hack in 5212 code)
o add serdes programming ini bits for 5416 and later parts and setup
for each part (5416 and 9160 logic hand-crafted from existing routines);
5212 remains open-coded but is now hooked in via ah_configPCIE
o add PCIE workaround gunk
o add ar5416AttachPCIE for iodomatic code used by 5416 and later parts


# 869ff02e 23-Feb-2009 Sam Leffler <sam@FreeBSD.org>

5416 and later parts mux the gpio outputs; extend the api to include
a signal type that's used to select the appropriate mux


# 0f5578c1 23-Feb-2009 Sam Leffler <sam@FreeBSD.org>

remove private copies of gpio methods that were needed when the hal
was an independent entity


# 17e45e19 18-Feb-2009 Sam Leffler <sam@FreeBSD.org>

Cleanup ath_hal_computetxtime's handling of 1/2 and 1/4-width channels:
o mark phy type to indicate 1/2 or 1/4-rate operation
o use phy type instead of channel attributes to identify 1/2 and 1/4-rate
operation
o general cleanup of code including move phy constants to ah_internal.h

Eventually this code should go away and we should use the net0211 equivalents.


# 1a15e29a 18-Feb-2009 Sam Leffler <sam@FreeBSD.org>

add HAL_DIAG_SETREGS to write registers via the diag api


# 4a701925 11-Feb-2009 Sam Leffler <sam@FreeBSD.org>

fix both instances of name

Pointy hat: sam


# d34b671c 11-Feb-2009 Sam Leffler <sam@FreeBSD.org>

fix typo in AH_CHIP definition

Submitted by: Pavel Roskin <proski@gnu.org>


# 59efa8b5 28-Jan-2009 Sam Leffler <sam@FreeBSD.org>

Overhaul regulatory support:
o remove HAL_CHANNEL; convert the hal to use net80211 channels; this
mostly involves mechanical changes to variable names and channel
attribute macros
o gut HAL_CHANNEL_PRIVATE as most of the contents are now redundant
with the net80211 channel available
o change api for ath_hal_init_channels: no more reglass id's, no more outdoor
indication (was a noop), anM contents
o add ath_hal_getchannels to have the hal construct a channel list without
altering runtime state; this is used to retrieve the calibration list for
the device in ath_getradiocaps
o add ath_hal_set_channels to take a channel list and regulatory data from
above and construct internal state to match (maps frequencies for 900MHz
cards, setup for CTL lookups, etc)
o compact the private channel table: we keep one private channel
per frequency instead of one per HAL_CHANNEL; this gives a big
space savings and potentially improves ani and calibration by
sharing state (to be seen; didn't see anything in testing); a new config
option AH_MAXCHAN controls the table size (default to 96 which
was chosen to be ~3x the largest expected size)
o shrink ani state and change to mirror private channel table (one entry per
frequency indexed by ic_devdata)
o move ani state flags to private channel state
o remove country codes; use net80211 definitions instead
o remove GSM regulatory support; it's no longer needed now that we
pass in channel lists from above
o consolidate ADHOC_NO_11A attribute with DISALLOW_ADHOC_11A
o simplify initial channel list construction based on the EEPROM contents;
we preserve country code support for now but may want to just fallback
to a WWR sku and dispatch the discovered country code up to user space
so the channel list can be constructed using the master regdomain tables
o defer to net80211 for max antenna gain
o eliminate sorting of internal channel table; now that we use ic_devdata
as an index, table lookups are O(1)
o remove internal copy of the country code; the public one is sufficient
o remove AH_SUPPORT_11D conditional compilation; we always support 11d
o remove ath_hal_ispublicsafetysku; not needed any more
o remove ath_hal_isgsmsku; no more GSM stuff
o move Conformance Test Limit (CTL) state from private channel to a lookup
using per-band pointers cached in the private state block
o remove regulatory class id support; was unused and belongs in net80211
o fix channel list construction to set IEEE80211_CHAN_NOADHOC,
IEEE80211_CHAN_NOHOSTAP, and IEEE80211_CHAN_4MSXMIT
o remove private channel flags CHANNEL_DFS and CHANNEL_4MS_LIMIT; these are
now set in the constructed net80211 channel
o store CHANNEL_NFCREQUIRED (Noise Floor Required) channel attribute in one
of the driver-private flag bits of the net80211 channel
o move 900MHz frequency mapping into the hal; the mapped frequency is stored
in the private channel and used throughout the hal (no more mapping in the
driver and/or net80211)
o remove ath_hal_mhz2ieee; it's no longer needed as net80211 does the
calculation and available in the net80211 channel
o change noise floor calibration logic to work with compacted private channel
table setup; this may require revisiting as we no longer can distinguish
channel attributes (e.g. 11b vs 11g vs turbo) but since the data is used
only to calculate status data we can live with it for now
o change ah_getChipPowerLimits internal method to operate on a single channel
instead of all channels in the private channel table
o add ath_hal_gethwchannel to map a net80211 channel to a h/w frequency
(always the same except for 900MHz channels)
o add HAL_EEBADREG and HAL_EEBADCC status codes to better identify regulatory
problems
o remove CTRY_DEBUG and CTRY_DEFAULT enum's; these come from net80211 now
o change ath_hal_getwirelessmodes to really return wireless modes supported
by the hardware (was previously applying regulatory constraints)
o return channel interference status with IEEE80211_CHANSTATE_CWINT (should
change to a callback so hal api's can take const pointers)
o remove some #define's no longer needed with the inclusion of
<net80211/_ieee80211.h>

Sponsored by: Carlson Wireless


# 7978748b 12-Dec-2008 Sam Leffler <sam@FreeBSD.org>

o remove dead code
o fix AH_RF macro expansion to be as intended (worked before unintentionally)

Obtained from: netbsd