[settings] Make "netX" settings block function as a symbolic link

Add a facility for settings blocks to act as symbolic links to other
settings blocks, and reimplement the "netX" virtual settings block
using this facility.

The primary advantage of this approach is that unscoped settings such
as ${mac} and ${filename} will now reflect the settings obtained from
the most recently opened network device: in most cases, this will mean
the settings obtained from the most recent DHCP attempt.  This should
improve conformance to the principle of least astonishment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[cmdline] Accept "netX" in iPXE commands

Allow any iPXE command expecting a network device name to accept
"netX" as a synonym for "most recently opened network device".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[settings] Add "version" builtin setting

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[lotest] Include sequence number within loopback test packets

Include a sequence number as the first four bytes of the loopback test
packet payload.  When a content mismatch occurs, this gives some
information about the source of the mismatched packet.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[rhine] Rewrite VIA Rhine driver

Replace the old via-rhine driver with a new version using the iPXE
API.

Includes fixes by Thomas Miletich for:

  - MMIO access
  - Link detection
  - RX completion in RX overflow case
  - Reset and EEPROM reloading
  - CRC stripping
  - Missing cpu_to_le32() calls
  - Missing memory barriers

Signed-off-by: Adrian Jamróz <adrian.jamroz@gmail.com>
Modified-by: Thomas Miletich <thomas.miletich@gmail.com>
Tested-by: Thomas Miletich <thomas.miletich@gmail.com>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Modified-by: Michael Brown <mcb30@ipxe.org>
Tested-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[intel] Incorporate ring producer and consumer counters in diagnostics

Signed-off-by: Michael Brown <mcb30@ipxe.org>
[linux] Add missing #include <stddef.h>

Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[legal] Add FILE_LICENCE for valgrind headers

Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[legal] Add FILE_LICENCE for core/errno.c

Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[legal] Add FILE_LICENCE for ath9k driver headers

Signed-off-by: Marin Hannache <git@mareo.fr>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[base16] Ensure base16_encode() always terminates its result string

base16_encode() will fail to generate a terminating NUL if the length
of the raw data is zero, since the loop calling sprintf() will never
execute.

Fix by explicitly terminating the result with a NUL.

Reported-by: Marin Hannache <git@mareo.fr>
Debugged-by: Marin Hannache <git@mareo.fr>
Tested-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
[realtek] Report RX error detail in debug messages

Signed-off-by: Michael Brown <mcb30@ipxe.org>