Michael Brown [Fri, 28 Oct 2011 21:32:33 +0000 (22:32 +0100)]
[netdevice] Allow driver to preinitialise the link-layer address
Drivers are currently expected to initialise only the hardware
address, with the link-layer protocol code taking care of converting
this into a valid link-layer address. Some drivers (e.g. undinet) can
legitimately determine both the hardware and link-layer addresses,
which may differ.
Allow for this situation by checking to see if the link-layer address
is empty before initialising it from the hardware address.
Michael Brown [Tue, 25 Oct 2011 14:48:20 +0000 (15:48 +0100)]
[liba20] Preserve all non-segment registers when calling INT 15,2401
Some BIOSes are reported to corrupt %ebx when using INT 15,2401 (see
http://opensolaris.org/jive/thread.jspa?messageID=377026). Guard
against this by preserving all (non-segment) registers.
Michael Brown [Tue, 25 Oct 2011 14:12:30 +0000 (15:12 +0100)]
[librm] Avoid (harmless) collisions with linker symbols
The symbol_text16 is defined globally by the linker. Use rm_text16
instead of _text16 for the local variable within librm.S to avoid
confusion when reading linker maps.
Michael Brown [Tue, 25 Oct 2011 00:41:41 +0000 (01:41 +0100)]
[image] Eliminate the register_and_xxx_image() functions
All users of imgdownload() require registration of the image, so make
registration an integral part of imgdownload() itself and simplify the
"action" parameter to be one of image_select(), image_exec() et al.
Michael Brown [Fri, 17 Sep 2010 21:43:45 +0000 (22:43 +0100)]
[arbel] Add (not-yet-functional) support for RC queue pairs
Arbel seems to crash the system as soon as the first send WQE
completes on an RC queue pair. (NOPs complete successfully, so this
is a problem specific to the work queue rather than the completion
queue.) The cause of this problem has remained unknown for over a
year.
Check in the non-functioning code to avoid bit-rot, and in the hope
that someone will find the fix.
Michael Brown [Wed, 12 Oct 2011 22:50:14 +0000 (23:50 +0100)]
[test] Add a basic infrastructure for running self-tests
This self-test mechanism is inspired by Perl's Test::Simple and
similar modules. The aim is to encourage the use of self-tests by
making it as easy as possible to create self-test code
Michael Brown [Mon, 19 Sep 2011 16:30:39 +0000 (17:30 +0100)]
[dhcp] Use a random DHCP transaction identifier (xid)
iPXE currently uses the last four bytes of the MAC address as the DHCP
transaction identifier. Reduce the probability of collisions by
generating a random transaction identifier.
Originally-implemented-by: Amos Kong <akong@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Mon, 19 Sep 2011 14:48:57 +0000 (15:48 +0100)]
[tcp] Allow sufficient headroom for TCP headers
TCP currently neglects to allow sufficient space for its own headers
when allocating I/O buffers. This problem is masked by the fact that
the maximum link-layer header size (802.11) is substantially larger
than the common Ethernet link-layer header.
Fix by allowing sufficient space for any TCP headers, as well as the
network-layer and link-layer headers.
Reported-by: Scott K Logan <logans@cottsay.net> Debugged-by: Scott K Logan <logans@cottsay.net> Tested-by: Scott K Logan <logans@cottsay.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Mon, 8 Aug 2011 15:35:30 +0000 (16:35 +0100)]
[script] Accept labels on lines terminated with CRLF
CRLF line terminators are allowed in scripts; the carriage return is
simply interpreted as trailing whitespace and so is ignored. This
fails on lines containing script labels, since the label-finding code
checks for a line containing only the ":" marker and the label itself
(without any trailing whitespace).
Fix by allowing a label to be terminated by either a NUL or a
whitespace character.
Reported-by: Bovey Christian <Christian.Bovey@chuv.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Fri, 15 Jul 2011 17:58:44 +0000 (18:58 +0100)]
[ipv4] Discard unwanted unicast packets
Explicitly discard any unicast packets for addresses that we do not
control, to avoid unexpected behaviour when operating in promiscuous
mode (which is now the default, thanks to FCoE).
Michael Brown [Fri, 15 Jul 2011 17:48:46 +0000 (18:48 +0100)]
[netdevice] Allow link layer to report broadcast/multicast packets via pull()
Allow the link layer to directly report whether or not a packet is
multicast or broadcast at the time of calling pull(), rather than
relying on heuristics to determine this at a later stage.
According to section 14.23 of RFC2616, an HTTP Host header without
port implies the default port is used. Thus, when fetching from
anywhere but port 80 for HTTP or 443 for HTTPS, the port ought to be
explicitly given in that header. Otherwise, some servers might fail
to associate the request with the correct virtual host or generate
incorrect self-referencing URLs.
Thomas Miletich [Sun, 10 Jul 2011 15:47:09 +0000 (17:47 +0200)]
[igb] Remove __BIG_ENDIAN conditional
Reported-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Wed, 29 Jun 2011 13:49:18 +0000 (14:49 +0100)]
[iscsi] Avoid duplicate calls to iscsi_tx_done()
The iSCSI TX process can now be woken up by the TCP socket via
xfer_window_changed(), so it is no longer valid to assume that
iscsi_tx_step() can be called in state ISCSI_TX_IDLE only immediately
after completing a transmission.
Fix by calling iscsi_tx_done() only upon a transition into state
ISCSI_TX_IDLE.
Michael Brown [Wed, 29 Jun 2011 10:42:07 +0000 (11:42 +0100)]
[build] Avoid using -ffunction-sections on some older versions of gcc
Some older versions of gcc issue a warning if -ffunction-sections is
used in combination with -g (gcc bug #18553). Inhibit
-ffunction-sections when building with such a version of gcc.
Reported-by: zhengwei <zw111_2001@126.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Mon, 27 Jun 2011 17:27:28 +0000 (18:27 +0100)]
[http] Support read-only HTTP block devices
Provide support for HTTP range requests, and expose this functionality
via the iPXE block device API. This allows SAN booting from a root
path such as:
Michael Brown [Fri, 24 Jun 2011 15:51:31 +0000 (16:51 +0100)]
[hw] Eliminate polling while waiting for window to open
Polling for the data-transfer window to become open is wasteful. We
can eliminate the polling loop by using hw_step() as the handler for
an xfer_window_changed() event.
If the window is already open at the time of instantiation, then
xfer_window_changed() may never be called. We can cover this case by
using hw_step() as the step() method of a one-shot process. Since the
signature for an xfer_window_changed() method is identical to the
signature for a process step() method, the same function can be used
for both.
Michael Brown [Fri, 24 Jun 2011 13:18:48 +0000 (14:18 +0100)]
[process] Add support for one-shot processes
Some processes execute only once, and exist solely in order to defer
execution until after the relevant instantiator method has returned.
Such processes do not need to be automatically rescheduled when
executing.
Michael Brown [Fri, 24 Jun 2011 13:14:41 +0000 (14:14 +0100)]
[process] Pass containing object pointer to process step() methods
Give the step() method a pointer to the containing object, rather than
a pointer to the process. This is consistent with the operation of
interface methods, and allows a single function to serve as both an
interface method and a process step() method.
Michael Brown [Wed, 22 Jun 2011 15:40:13 +0000 (16:40 +0100)]
[xfer] Send xfer_window_changed() after xfer_vredirect()
Modify the default action for xfer_vredirect() to automatically send
xfer_window_changed() messages to both the new child and the parent
interfaces. This will allow the elimination of processes that simply
poll on xfer_window() to determine when a redirection has completed
successfully.
Michael Brown [Fri, 24 Jun 2011 11:51:45 +0000 (12:51 +0100)]
[ftp] Remove redundant ftp_data_deliver() method
ftp_data_deliver() does nothing except pass through the received data
to the xfer interface, and so can be eliminated by using a
pass-through interface.
Michael Brown [Tue, 28 Jun 2011 09:21:30 +0000 (10:21 +0100)]
[ipv4] Record ARP resolution errors
At the time of attempting ARP resolution, we already know the
transmitting network device. We can therefore record ARP errors using
netdev_tx_err() so that they show up in the output of "ifstat".
Inspired-by: Dominik Russenberger <dominik.russenberger@terreactive.ch> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Tue, 17 May 2011 21:48:52 +0000 (22:48 +0100)]
[romprefix] Force PnP header to a 16-byte boundary for IBM BIOSes
IBM BIOSes ignore the PnP header offset stored at address 0x1a and
instead scan for the $PnP signature on a 16-byte boundary. (This
alignment is not mandated by the PnP specification.)
Force PnP header to a 16-byte boundary to work around these BIOSes.
Michael Brown [Tue, 17 May 2011 14:35:23 +0000 (15:35 +0100)]
[romprefix] Do not fall back to hooking INT19 by default
Several BIOSes (including most IBM BIOSes and many virtual machine
BIOSes) do not provide detectable PnP support, but will use the BEV
entry point for a PnP option ROM. On these semi-PnP BIOSes, iPXE will
respond to the absence of detectable PnP support by hooking INT19,
which disrupts the boot order.
BIOSes that genuinely require hooking INT19 seem to be very rare
nowadays. It may therefore be preferable to assume that the absence
of detectable PnP support indicates a semi-PnP BIOS rather than a
non-PnP BIOS.
Change the default behaviour so that INT19 will never be hooked unless
the compile-time option NONPNP_HOOK_INT19 is enabled. Leave the
redundant PnP detection routine in-place to allow for debugging via
the ROM banner line.
Michael Brown [Tue, 17 May 2011 14:27:47 +0000 (15:27 +0100)]
[romprefix] Remove special treatment for IBM BIOSes
Revert commit 38cd351 ("[romprefix] Attempt to gracefully handle
semi-PnP IBM BIOSes"), since the test for the "IBM " signature in %edi
is not sufficient to identify an IBM BIOS.
Michael Brown [Thu, 5 May 2011 17:02:44 +0000 (18:02 +0100)]
[ipv4] Include network device metadata in packet traces
(Ab)use the "ident" field in transmitted IPv4 packets to convey
metadata about the network device. In particular:
bits 0-3 represent the low bits of the "RX" good packet counter
bits 4-7 represent the low bits of the "RXE" bad packet counter
bits 8-15 represent the transmitted packet sequence number
This allows some relevant information about the internal state of the
network device to be read out from a packet trace from a non-debug
build of iPXE. In particular, it allows a packet trace containing
packets transmitted by iPXE to indicate whether or not any packets
have been received by iPXE.
Michael Brown [Thu, 5 May 2011 14:32:34 +0000 (15:32 +0100)]
[http] Support chunked transfer encoding
Booting from an HTTP SAN will require HTTP range requests, which are
defined only in HTTP/1.1 and above. HTTP/1.1 mandates support for
"Transfer-Encoding: chunked", so we must support it.
Michael Brown [Wed, 4 May 2011 11:04:14 +0000 (12:04 +0100)]
[bofm] Report {slot,port} to {bus:dev.fn,mport} mapping on newer BOFM builds
Newer BOFM builds provide support for mapping multiple physical ports
to a single PCI bus:dev.fn via PCI VPD descriptions. These builds
will also leave the {slot,port} field intact, and will populate the
mport field with a meaningful value.
Older BOFM builds will zero out the {slot,port} field. A zero value
in this field may indicate either a genuine zero value (i.e. slot 0
first port) or an older build.
Michael Brown [Wed, 4 May 2011 09:04:43 +0000 (10:04 +0100)]
[romprefix] Attempt to gracefully handle semi-PnP IBM BIOSes
Some IBM BIOSes provide partial support for PnP: they will use the BEV
entry point but will not advertise PnP support. This causes iPXE to
hook INT 19, which disrupts the boot process.
Attempt to improve this situation by detecting an IBM BIOS and
treating it as a PnP BIOS despite the absence of a PnP signature.
This has interesting side-effects such as producing sizes for .bss
segments that are negative, causing the majority of addressable memory
to be zeroed out.
Fix by using the form
ABSOLUTE ( x ) - ABSOLUTE ( y )
rather than
ABSOLUTE ( x - y )
Reported-by: H. Peter Anvin <hpa@zytor.com> Suggested-by: H. Peter Anvin <hpa@zytor.com> Tested-by: H. Peter Anvin <hpa@zytor.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Michael Brown [Fri, 22 Apr 2011 22:31:25 +0000 (23:31 +0100)]
[undi] Assume that interrupts are not supported if IRQ=0
Some PXE stacks (notably old Etherboot/gPXE stacks) will claim to use
the timer interrupt, rather than reporting that interrupts are not
supported. Since using the timer interrupt is equivalent to polling
anyway, we may as well genuinely poll these stacks.
Michael Brown [Sat, 9 Apr 2011 22:34:34 +0000 (23:34 +0100)]
[build] Run parserom.pl only on potential driver files
PCI_ROM() and ISA_ROM() macros occur only within driver files.
Running parserom.pl on non-driver files is therefore redundant.
Skip running parserom.pl on any files outside a "drivers" directory.
This reduces the time taken to generate build rules and dependencies
after a "make veryclean" by around 12%.
Michael Brown [Fri, 8 Apr 2011 02:19:06 +0000 (03:19 +0100)]
[cmdline] Simplify "isset" command
There is no plausible scenario I can think of in which "isset" would
be used with more than one argument. Simplify the code by specifying
that exactly one argument is required.
Michael Brown [Thu, 7 Apr 2011 12:53:28 +0000 (13:53 +0100)]
[hermon] Work around missing mport support in current BOFM implementations
Current BOFM versions are unable to create entries with mport>1, which
means that only the port 1 MAC address can be explicitly specified.
Work around this by using the provided MAC address as a base address
for all subsequent ports. For example, if BOFM assigns the address
00:1A:64:76:00:09 for port 1
then we will assign the addresses
00:1A:64:76:00:09 for port 1
00:1A:64:76:00:0a for port 2
Future BOFM versions that may correctly support mport will work with
this scheme without modification provided that the BOFM entries are
created in increasing order of mport. Since BOFM tools tend to
generate entries in increasing order (of slot, port, etc), this is not
an unreasonable compromise.