freebsd-skq/sys
Adrian Chadd b7d7ad0b90 Begin moving support for board MAC addresses over to being explicitly defined.
A lot of these dinky atheros based MIPS boards don't have a nice, well,
anything consistent defining their MAC addresses for things.

The Atheros reference design boards will happily put MAC addresses
into the wifi module calibration data like they should, and individual
ethernet MAC addresses into the calibration area in flash.
That makes my life easy - "hint.arge.X.eeprommac=<addr>" reads from
that flash address to extract a MAC, and everything works fine.

However, aside from some very well behaved vendors (eg the Carambola 2
board), everyone else does something odd.

eg:

* a MAC address in the environment (eg ubiquiti routerstation/RSPRO)
   that you derive arge0/arge1 MAC addresses from.
* a MAC address in flash that you derive arge0/arge1 MAC addresses from.
* The wifi devices having their own MAC addresses in calibration data,
  like normal.
* The wifi devices having a fixed, default or garbage value for a MAC
  address in calibration data, and it has to be derived from the
  system MAC.

So to support this complete nonsense of a situation, there needs to be
a few hacks:

* The "board" MAC address needs to be derived from somewhere and squirreled
  away.  For now it's either redboot or a MAC address stored in calibration
  flash.

* Then, a "map" set of hints to populate kenv with some MAC addresses
  that are derived/local, based on the board address.  Each board has
  a totally different idea of what you do to derive things, so each
  map entry has an "offset" (+ve or -ve) that's added to the board
  MAC address.

* Then if_arge (and later, if_ath) should check kenv for said hint and
  if it's found, use that rather than the EEPROM MAC address - which may
  be totally garbage and not actually work right.

In order to do this, I've undone some of the custom redboot expecting
hacks in if_arge and the stuff that magically adds one to the MAC
address supplied by the board - instead, as I continue to test this
out on more hardware, I'll update the hints file with a map explaining
(a) where the board MAC should come from, and (b) what offsets to use
for each device.

The aim is to have all of the tplink, dlink and other random hardware
we run on have valid MAC addresses at boot, so (a) people don't get
random B:S:Dx:x ethernet MACs, and (b) the wifi MAC is valid
so it works rather than trying to use an invalid address that
actually upsets systems (think: multicast bit set in BSSID.)

Tested:

* TP-Link TL_WDR3600 - subsequent commits will add the hints map
  and the if_ath support.

TODO:

* Since this is -HEAD, and I'm all for debugging, there's a lot of
  printf()s in here.  They'll eventually go under bootverbose.
* I'd like to turn the macaddr routines into something available
  to all drivers - too many places hand-roll random MAC addresses
  and parser stuff.  I'd rather it just be shared code.
  However, that'll require more formal review.
* More boards.
2015-03-28 23:40:29 +00:00
..
amd64 Make it possible for the signal handler to act on #ss. Load the 2015-03-28 09:03:54 +00:00
arm Rather than defining our own magic checks here use INKERNEL() for 2015-03-27 08:47:16 +00:00
arm64/include Add more arm64 machine dependent headers. With this we now have the minimum 2015-03-26 21:10:42 +00:00
boot Add the Raspberry Pi 2 dtb, based on the existing rpi.dts, but with a 2015-03-25 10:26:07 +00:00
bsm
cam Add DA_Q_NO_RC16 quirk for USB mass storage device. 2015-03-25 13:28:13 +00:00
cddl Remove unused upstream DTrace provider implementations that are duplicates 2015-03-16 01:15:08 +00:00
compat cred: add proc_set_cred helper 2015-03-16 00:10:03 +00:00
conf Remove all the handcrafted assembly in hwpmc_armv7.c and use the 2015-03-28 18:57:13 +00:00
contrib Quieten some of the log spam from AR9300 sysctl tree walk and chip setup/reset 2015-03-21 23:12:46 +00:00
crypto Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
ddb
dev Turns out the AR933x looks like the AR7240/AR7241 switch as far as VLAN 2015-03-28 23:20:46 +00:00
fs msdosfs: mark unused compat-mount fields 2015-03-22 09:09:26 +00:00
gdb
geom Remove extra semicolon. 2015-03-27 12:45:20 +00:00
gnu File names with commas in them cause issues for freebsd-update. We 2015-03-12 06:43:58 +00:00
i386 Apply r276208 to non-amd64 NOTES files as well to fix tinderbox builds 2015-03-25 15:51:41 +00:00
isa
kern Make debug.vmem_check a tunable. It is useful to set it early. 2015-03-28 23:30:51 +00:00
kgssapi
libkern Implement asprintf in libkern 2015-03-01 00:22:16 +00:00
mips Begin moving support for board MAC addresses over to being explicitly defined. 2015-03-28 23:40:29 +00:00
modules sym and cxgb build on arm, add them to the build. 2015-03-27 02:35:33 +00:00
net Fix a possible mbuf leak on interface departure. 2015-03-26 23:40:22 +00:00
net80211 Initialise the pps / packet tracking timestamp so 11n aggregation works again. 2015-03-22 17:54:00 +00:00
netgraph Change the callout to supply -1 to indicate we are not changing 2015-03-28 12:50:24 +00:00
netinet VNETalize random IP ID engine. 2015-03-28 16:59:57 +00:00
netinet6 Move ip6_sprintf() declaration from in6_var.h to in6.h. This is a simple 2015-03-24 16:45:50 +00:00
netipsec Remove extra '&'. sin6 is already a pointer. 2015-03-07 18:44:52 +00:00
netnatm
netpfil Static'ize pf_fillup_fragment body to match its declaration. 2015-03-26 13:31:04 +00:00
netsmb
nfs Avoid closing unallocated socket in case socreate fails. 2015-02-28 20:30:29 +00:00
nfsclient Remove the old NFS client and server from head, 2014-12-23 00:47:46 +00:00
nfsserver Use M_SIZE() instead of hand-crafted (and mostly correct) NFSMSIZ() macro 2015-01-07 17:22:56 +00:00
nlm
ofed Fix variable casting: 2015-03-27 19:08:11 +00:00
opencrypto Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
pc98 Factor out duplicated code from dumpsys() on each architecture into generic 2015-01-07 01:01:39 +00:00
powerpc Wrap #ifdef guards around pmap_bootstrap ap. It's only used in SMP, and 2015-03-28 21:39:42 +00:00
rpc rpc: Uninitialized pointer read 2015-02-02 16:07:07 +00:00
security cred: add proc_set_cred helper 2015-03-16 00:10:03 +00:00
sparc64 Apply r276208 to non-amd64 NOTES files as well to fix tinderbox builds 2015-03-25 15:51:41 +00:00
sys Change the callout to supply -1 to indicate we are not changing 2015-03-28 12:50:24 +00:00
teken mdoc: improvements to SEE ALSO. 2014-12-27 07:07:37 +00:00
tools
ufs Fix build (with gcc). 2015-03-27 15:49:21 +00:00
vm - Eliminate pagequeue locking in the dirty code in vm_pageout_scan(). 2015-03-28 02:36:49 +00:00
x86 When mapping an allocated entry, use the entry size, instead of the 2015-03-24 12:48:51 +00:00
xdr
xen Use SYSCTL_OUT_STR() to return strings. 2015-03-14 21:40:24 +00:00
Makefile