david/ipxe
david
/
ipxe
Archived
1
0
Fork 0
Commit Graph

1358 Commits

Author SHA1 Message Date
Michael Brown 962cada830 [init] Remove concept of "shutdown exit flags"
Remove the concept of shutdown exit flags, and replace it with a
counter used to keep track of exposed interfaces that require devices
to remain active.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-27 20:40:26 +00:00
Michael Brown 35a50399a5 [xfer] Expose xfer_uri_opener()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-27 18:46:07 +00:00
Michael Brown 66caec3f00 [netdevice] Allow devices to indicate that interrupts are not supported
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-25 14:16:11 +00:00
Michael Brown 7bf37147b3 [pci] Auto-resize VPD fields used for non-volatile storage
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-19 13:52:56 +00:00
Michael Brown e67c79b856 [pci] Add ability to resize a VPD field
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-19 13:52:55 +00:00
Michael Brown 267ef31791 [pci] Allow pci_vpd_init() return status to be ignored
Most xxx_init() functions are void functions with no failure cases.
Allow pci_vpd_init() to be used in the same way.  (Subsequent calls to
pci_vpd_read() etc. will fail if pci_vpd_init() fails.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-19 13:52:55 +00:00
Michael Brown 17d28f4877 [nvo] Allow resizing of non-volatile stored option blocks
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-19 13:52:48 +00:00
Michael Brown 1651d4f6d7 [nvo] Remove the non-volatile options fragment list
Since its implementation several years ago, no driver has used a
fragment list containing more than a single fragment.  Simplify the
NVO core and the drivers that use it by removing the whole concept of
the fragment list, and using a simple (address,length) pair instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-11 21:24:40 +00:00
Michael Brown 17b6a3c506 [dhcp] Allow use of custom reallocation functions for DHCP option blocks
Allow functions other than realloc() to be used to reallocate DHCP
option block data, and specify the reallocation function at the time
of calling dhcpopt_init().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-11 21:24:40 +00:00
Michael Brown 310d46c1ed [dhcp] Rename length fields for DHCP options
Rename "len" to "used_len" and "max_len" to "alloc_len".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-10 03:39:26 +00:00
Michael Brown 6cee8904d1 [dhcp] Remove redundant length fields in struct dhcp_packet
The max_len field is never used, and the len field is used only by
dhcp_tx().  Remove these two fields, and perform the necessary trivial
calculation in dhcp_tx() instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2011-01-10 03:39:26 +00:00
Alex Williamson c080de1a60 [igbvf] Add igbvf driver
Driver for Intel 82576 based virtual functions, based on Intel source
code available at:

    http://sourceforge.net/projects/e1000  (igbvf-1.0.7)

Based on initial port from Eric Keller <ekeller@princeton.edu>.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-16 03:58:42 +00:00
Michael Brown 708c5060b9 [dhcp] Use Ethernet-compatible chaddr, if possible
For IPoIB, we currently use the hardware address (i.e. the eight-byte
GUID) as the DHCP chaddr.  This works, but some PXE servers (notably
Altiris RDP) refuse to respond if the chaddr field is anything other
than six bytes in length.

We already have the notion of an Ethernet-compatible link-layer
address, which is used in the iBFT (the design of which similarly
fails to account for non-Ethernet link layers).  Use this as the first
preferred alternative to the actual link-layer address when
constructing the DHCP chaddr field.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-15 18:46:19 +00:00
Michael Brown cb838cc419 [settings] Add fetch_ipv4_array_setting()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 15:34:12 +00:00
Michael Brown 66531a5918 [debug] Add DBG_MD5() and related macros
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 13:13:31 +00:00
Michael Brown ea0fcb9460 [fnrec] Enhance function recording
Enhance the information collected by the function recorder to include
the call site and entry/exit counts.  This allows fnrec.pl to produce
a call tree such as:

    step (from core/getkey.c:46 = 0x17e90) {
      ref_increment (from core/process.c:93 = 0x73ec) { }
      net_step (from core/process.c:96 = 0x73f1) {
        net_poll (from net/netdevice.c:741 = 0xbce6) {
          netdev_poll (from net/netdevice.c:700 = 0xbc58) { }
          netdev_rx_dequeue (from net/netdevice.c:709 = 0xbc65) { }
        }
      }
      ref_decrement (from core/process.c:96 = 0x73f9) { }
    }

Note that inlined functions are reported, confusingly, as extra calls
to the *containing* function.  Minimise this confusion by adding the
attribute "no_instrument_function" to all functions declared as
inline.  (Static functions that have been inlined autonomously by gcc
will still be problematic, but these are far fewer in number.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-09 13:11:27 +00:00
Shao Miller 79a3799c41 [legal] Add FILE_LICENCE macro to some GPL-v2 files
Changes were made to files where the licence text within the files
themselves confirms that the files are GPL version 2.

Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-03 23:23:35 +00:00
Michael Brown f14a5045d7 [hermon] Work around hardware stripping of VLAN tags
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 18:51:29 +00:00
Michael Brown 5273c2748c [vlan] Expose vlan_find() to network card drivers
Some network cards automatically strip the VLAN header, providing the
VLAN tag via a side channel such as a completion queue entry.  These
cards need to be able to report receive completions directly against
the relevant VLAN device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 18:46:50 +00:00
Michael Brown 67b45186a5 [settings] Apply settings block name in register_settings()
Pass the settings block name as a parameter to register_settings(),
rather than defining it with settings_init() (and then possibly
changing it by directly manipulating settings->name).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-12-01 16:35:00 +00:00
Michael Brown 7bebe9579e [cmdline] Match user expectations for &&, ||, goto, and exit
The && and || operators should be left-associative, since that is how
they are treated in most other languages (including C and Unix
shell).  For example, in the command:

  dhcp net0 && goto dhcp_ok || echo No DHCP on net0

if the "dhcp net0" fails then the "echo" should be executed.

After an "exit" or a successful "goto", further commands on the same
line should never be executed.  For example:

  goto somewhere && echo This should never be printed
  exit 0 && echo This should never be printed
  exit 1 && echo This should never be printed

An "exit" should cause the current shell or script to terminate and
return the specified exit status to its caller.  For example:

  chain test.ipxe && echo Success || echo Failure
    [in test.ipxe]
    #!ipxe
    exit 0

should echo "Success".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-29 14:19:59 +00:00
Michael Brown 1fcea25c42 [shell] Add "shell" command
The "shell" command allows a script to enter an interactive shell,
which is potentially useful for troubleshooting.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-28 21:09:33 +00:00
Arkadiusz Miskiewicz 719f2d793c [build] Really use __builtin_offsetof() when available
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-28 18:28:15 +00:00
Michael Brown 795793b3a4 [build] Use __builtin_offsetof() when available
Some newer versions of gcc (observed with a patched gcc 4.5.1) seem to
treat our offsetof() implementation as not being a compile-time
constant.  Fix by using __builtin_offsetof() when available.  (As with
the original offsetof() macro, this code is copied from the Linux
kernel's stddef.h.)

Reported-by: Arkadiusz Miskiewicz <arekm@maven.pl>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-28 17:28:52 +00:00
Michael Brown c5c0a27b68 [vlan] Treat VLAN 0 as valid
VLAN headers are allowed to contain a VLAN tag of zero, indicating
that the header specifies only a priority and that the packet does not
belong to any VLAN.  The easiest way to handle this is to treat VLAN 0
as being a normal VLAN.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 16:04:57 +00:00
Michael Brown 1415ec9c9a [fc] Allow Fibre Channel ports to be explicitly named
Use the network interface name as the Fibre Channel port name.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-27 14:37:53 +00:00
Michael Brown 1790f56fb2 [fcoe] Add support for FIP VLAN discovery
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:41 +00:00
Michael Brown b4706c88c9 [vlan] Provide vlan_can_be_trunk()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-26 01:09:40 +00:00
Michael Brown ce7b0efa87 [pci] Add a mechanism for using a PCI VPD field as an NVS device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-25 00:00:38 +00:00
Michael Brown 69db6e7d8f [pci] Add support for reading and writing PCI Vital Product Data (VPD)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-24 23:58:27 +00:00
Michael Brown ef0376483c [pci] Standardise debug message format
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-24 16:59:46 +00:00
Michael Brown 84aa702ff8 [script] Allow "exit" to exit a script
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 20:29:01 +00:00
Michael Brown 1e2a8aa9c1 [gdb] Use generic option-parsing library
Total saving: 42 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:47 +00:00
Michael Brown 59980a6176 [fc] Use generic option-parsing library
Total saving: 111 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-22 00:34:40 +00:00
Michael Brown 398a6e9a50 [ifmgmt] Use generic option-parsing library
Total cost: 66 bytes

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-21 23:37:49 +00:00
Michael Brown 9e9c9adf10 [settings] Use generic option-parsing library
Total cost: 75 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-21 20:38:39 +00:00
Michael Brown 17b337d4a8 [autoboot] Use generic option-parsing library
Total saving: 32 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-21 20:38:39 +00:00
Michael Brown 216fd0a5cf [parseopt] Add generic option-parsing library
Command implementations tend to include a substantial amount of common
boilerplate code revolving around the parsing of command-line options
and arguments.  This increases the size cost of each command.

Introduce an option-parsing library that abstracts out the common
operations involved in command implementations.  This enables the size
of each individual command to be reduced, and also enhances
consistency between commands.

Total size of the library is 704 bytes, to be amortised across all
command implementations.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-21 20:38:26 +00:00
Michael Brown 4448285142 [autoboot] Add "netboot" command
Originally-implemented-by: michael-dev@fami-braun.de
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-20 17:20:03 +00:00
Michael Brown 6fd09b541f [vlan] Add support for IEEE 802.1Q VLANs
Originally-implemented-by: michael-dev@fami-braun.de
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-20 16:52:04 +00:00
Michael Brown 4576c2da58 [netdevice] Allow per-device receive queue processing to be frozen
Several use cases (e.g. the UNDI API and the EFI SNP API) require
access to the raw network device receive queue, and so currently use
manual calls to netdev_poll() on a specific network device in order to
prevent received packets from being processed by the network stack.

As an alternative, provide a flag that allows receive queue processing
to be frozen on a per-device basis.  When receive queue processing is
frozen, packets will be enqueued as normal, but will not be
automatically dequeued and passed up the network stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-20 15:46:00 +00:00
Michael Brown 7e33adcb90 [tcp] Remove obsolete constants
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown d012f87018 [tcp] Use MAX_LL_NET_HEADER_LEN instead of defining our own MAX_HDR_LEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 878a1f4e2f [udp] Remove obsolete constants
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 5de4fba4f9 [udp] Use MAX_LL_NET_HEADER_LEN instead of defining our own UDP_MAX_HLEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 0d7839678b [netdevice] Add MAX_NET_HEADER_LEN and MAX_LL_NET_HEADER_LEN
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-19 16:08:05 +00:00
Michael Brown 1782fc7011 [lotest] Move lotest.h to correct directory
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-18 23:30:50 +00:00
Michael Brown 8e718df5e1 [fc] Add support for Fibre Channel name server lookups
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00
Michael Brown 90930be8fe [fc] Support Fibre Channel ECHO
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:36 +00:00
Michael Brown 6e41f2cf18 [refcnt] Check reference validity on each use of ref_get() and ref_put()
Check that the reference count is valid (i.e. non-negative) on each
call to ref_get() and ref_put(), using an assert() at the point of
use.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:35:35 +00:00
Michael Brown ea631f6fb8 [list] Add list_first_entry()
There are several points in the iPXE codebase where
list_for_each_entry() is (ab)used to extract only the first entry from
a list.  Add a macro list_first_entry() to make this code easier to
read.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 03:15:28 +00:00
Michael Brown 295ba15bd6 [list] Extend list-manipulation assertions to all list-handling functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-11-08 02:22:53 +00:00
Dave Hansen 053d28688c [autoboot] Introduce "skip-san-boot" option
For some install-to-SAN scenarios, the OS needs to be able to reboot
to reread the partition table.  On this second boot attempt, the SAN
disk will not be empty and so iPXE will attempt to boot from it,
rather than falling back to the OS' installation media.

Work around this problem by introducing the "skip-san-boot" option,
similar in spirit to "keep-san".

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-21 23:49:03 +01:00
Michael Brown 57bab0ae4a [scsi] Wait for a successful TEST UNIT READY command
Some SCSI targets (observed with an EMC CLARiiON Fibre Channel target)
will not respond to commands correctly until a TEST UNIT READY has
been issued.  In particular, a READ CAPACITY (10) command will return
with a success status, but no capacity data.

Fix by issuing a TEST UNIT READY command automatically, and delaying
further SCSI commands until the TEST UNIT READY has succeeded.

Reported-by: Hadar Hen Zion <hadarh@mellanox.co.il>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-19 19:10:02 +01:00
Michael Brown 19c59bb131 [iscsi] Ensure ISID is consistent within an iSCSI session
Commit 5f4ab0d ("[iscsi] Randomise a portion of the ISID to force new
session instantiation") introduced a regression by randomising the
ISID on each call to iscsi_start_login(), which may be called more
than once per connection, rather than on each call to
iscsi_open_connection(), which is guaranteed to be called only once
per connection.  This is incorrect behaviour that causes our
connection to be rejected by some iSCSI targets (observed with a
COMSTAR target under OpenSolaris).

Fix by generating the ISID in iscsi_open_connection(), and storing the
randomised ISID as part of the session state.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-18 14:40:27 +01:00
Michael Brown 60b690141e [fc] Use port WWN rather than node WWN as the primary Fibre Channel name
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-15 01:54:48 +01:00
Michael Brown c0e3a774b2 [linux] Fix building on RHEL5 and similar platforms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-11 02:24:39 +01:00
Michael Brown 0f4fd09180 [fcoe] Add support for the FCoE Initialization Protocol (FIP)
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-07 19:20:36 +01:00
Michael Brown 1775a6f25e [fc] Include port IDs in metadata for received Fibre Channel frames
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-07 19:16:34 +01:00
Michael Brown 88dd921e24 [netdevice] Pass both link-layer addresses in net_tx() and net_rx()
FCoE requires the use of fabric-provided MAC addresses, which breaks
the assumption that the net device's MAC address is implicitly the
source address for net_tx() and the (unicast) destination address for
net_rx().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-10-07 19:15:04 +01:00
Michael Brown 29ad8a922b [infiniband] Include the SRP login rejection reason in the error number
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-22 20:05:39 +01:00
Michael Brown 2a92697bda [libc] Ensure that error numbers from EUNIQ() have the correct type
Error numbers are signed ints.  EUNIQ() should not allow implicit type
promotion based on the supplied error diambiguator, because this
causes problems with statements such as

  rc = ( condition ? -EUNIQ ( EBASE, disambiguator ) : -EBASE );

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-22 20:04:11 +01:00
Michael Brown 3c35ae2f3b [int13] Add infrastructure to support EDD version 4.0
Support the extensions mandated by EDD 4.0, including:

 o  the ability to specify a flat physical address in a disk address
    packet,

 o  the ability to specify a sector count greater than 127 in a disk
    address packet,

 o  support for all functions within the Fixed Disk Access and EDD
    Support subsets,

 o  the ability to describe a device using EDD Device Path Information.

This implementation is based on draft revision 3 of the EDD 4.0
specification, with reference to the EDD 3.0 specification.  It is
possible that this implementation may need to change in order to
conform to the final published EDD 4.0 specification.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-22 17:09:56 +01:00
Michael Brown 26a50c3a11 [infiniband] Add the notion of an Ethernet queue pair type
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-21 02:12:06 +01:00
Michael Brown 654da534ad [fc] Allow FLOGI response to be sent to newly-assigned peer port ID
The response to a received FLOGI should probably be sent to the peer
port ID assigned as a result of the WWPN comparison.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-21 02:06:06 +01:00
Michael Brown 1c7f47895c [lotest] Add loopback testing commands
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-21 02:03:42 +01:00
Michael Brown 42cf4a720c [infiniband] Add node GUID as distinct from the first port GUID
iPXE currently uses the first port's port GUID as the node GUID,
rather than using the (possibly distinct) real node GUID.  This can
confuse opensm during the handover to a loaded OS: it thinks the port
already belongs to a different node and so discards our port
information with a warning message about duplicate ports.  Everything
is picked up correctly on the second subnet sweep, after opensm has
established that the "old" node no longer exists, but this can delay
link-up unnecessarily by several seconds.

Fix by using the real node GUID.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-16 03:30:45 +01:00
Michael Brown 09555826e9 [infiniband] Always call ib_link_state_changed() in ib_smc_update()
ib_smc_update() potentially updates the Infiniband port state, and so
should almost always be followed by a call to ib_link_state_changed().
The one exception is the call made to ib_smc_update() before the
device is registered.

Fix by removing explicit calls to ib_link_state_changed() from drivers
using ib_smc_update(), including a call to ib_link_state_changed()
within ib_smc_update(), and creating a separate ib_smc_init() for use
prior to device registration.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-16 03:30:45 +01:00
Michael Brown 5e697b64a5 [scsi] Include sense key within error number reported to user
The sense key gives a first idea of what the problem might be, and so
is potentially useful in diagnosing problems in a non-debug build.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 22:23:48 +01:00
Michael Brown 52e54a8c69 [infiniband] Match GID/GUID terminology as used in the IBA
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 19:25:05 +01:00
Michael Brown dace106f82 [fcoe] Add support for Fibre Channel over Ethernet
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 03:20:54 +01:00
Michael Brown d2a2618d76 [fcp] Add support for the Fibre Channel Protocol
The Fibre Channel Protocol provides a mechanism for transporting SCSI
commands via a Fibre Channel fabric.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 03:20:26 +01:00
Michael Brown bf2657075d [fc] Add Fibre Channel management commands
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 03:17:30 +01:00
Michael Brown 508ff4d614 [fc] Add support for Fibre Channel devices
Add support for Fibre Channel ports, peers, and upper-layer protocols,
and for Fibre Channel extended link services.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-15 03:16:24 +01:00
Michael Brown 220495f8bf [block] Replace gPXE block-device API with an iPXE asynchronous interface
The block device interface used in gPXE predates the invention of even
the old gPXE data-transfer interface, let alone the current iPXE
generic asynchronous interface mechanism.  Bring this old code up to
date, with the following benefits:

 o  Block device commands can be cancelled by the requestor.  The INT 13
    layer uses this to provide a global timeout on all INT 13 calls,
    with the result that an unexpected passive failure mode (such as
    an iSCSI target ACKing the request but never sending a response)
    will lead to a timeout that gets reported back to the INT 13 user,
    rather than simply freezing the system.

 o  INT 13,00 (reset drive) is now able to reset the underlying block
    device.  INT 13 users, such as DOS, that use INT 13,00 as a method
    for error recovery now have a chance of recovering.

 o  All block device commands are tagged, with a numerical tag that
    will show up in debugging output and in packet captures; this will
    allow easier interpretation of bug reports that include both
    sources of information.

 o  The extremely ugly hacks used to generate the boot firmware tables
    have been eradicated and replaced with a generic acpi_describe()
    method (exploiting the ability of iPXE interfaces to pass through
    methods to an underlying interface).  The ACPI tables are now
    built in a shared data block within .bss16, rather than each
    requiring dedicated space in .data16.

 o  The architecture-independent concept of a SAN device has been
    exposed to the iPXE core through the sanboot API, which provides
    calls to hook, unhook, boot, and describe SAN devices.  This
    allows for much more flexible usage patterns (such as hooking an
    empty SAN device and then running an OS installer via TFTP).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-14 20:37:15 +01:00
Michael Brown ef8452a642 [infiniband] Respond to CM disconnection requests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-12 22:32:02 +01:00
Michael Brown 79dd00bb3a [build] Remove unnecessary constraint on DBG_ENABLE()/DBG_DISABLE()
DBG_ENABLE() and DBG_DISABLE() are currently constrained to enabling
and disabling only debug levels that are compiled in for the current
object.  For example, a DBG_ENABLE(DBGLVL_EXTRA) in foo.c will not be
able to affect output from other objects at DBGLVL_EXTRA unless foo.c
is itself compiled with DBGLVL_EXTRA enabled.

Partially fix by removing this unnecessary constraint.  (Note that it
is still necessary for at least one debug level to be compiled in for
the object invoking DBG_ENABLE()/DBG_DISABLE().)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-12 22:24:06 +01:00
Michael Brown 0f65efc185 [retry] Add TIMER_INIT() for initialising static timers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-06 22:18:13 +01:00
Michael Brown c8199aacaa [xfer] Add xfer_window_changed()
xfer_window_changed() can be used to notify peers that an interface is
now ready to accept data.  This can potentially be used to eliminate
the need for wasteful processes that simply poll xfer_window() until
the window becomes non-zero.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-05 03:12:17 +01:00
Michael Brown 35b19d8848 [infiniband] Add the concept of an Infiniband upper-layer driver
Replace the explicit calls from the Infiniband core to the IPoIB layer
with the general concept of an Infiniband upper-layer driver
(analogous to a PCI driver) which can create arbitrary devices on top
of Infiniband devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-05 03:06:16 +01:00
Michael Brown ca4df90a63 [netdevice] Add the concept of a network upper-layer driver
Add the concept of a network upper-layer driver, which can create
arbitrary devices on top of network devices.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-05 03:03:38 +01:00
Michael Brown c04b6ccd75 [tables] Add for_each_table_entry_continue() and _continue_reverse()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-05 02:49:06 +01:00
Michael Brown 28934eef81 [retry] Hold reference while timer is running and during expiry callback
Guarantee that a retry timer cannot go out of scope while the timer is
running, and provide a guarantee to the expiry callback that the timer
will remain in scope during the entire callback (similar to the
guarantee provided to interface methods).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03 21:28:43 +01:00
Michael Brown 25447294d5 [process] Add process_running()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03 21:26:21 +01:00
Michael Brown da123eada4 [tables] Add table_index()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03 21:25:06 +01:00
Michael Brown 0329673833 [xfer] Add xfer_deliver_raw_meta()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03 21:23:16 +01:00
Michael Brown 364b92521a [xfer] Generalise metadata "whence" field to "flags" field
iPXE has never supported SEEK_END; the usage of "whence" offers only
the options of SEEK_SET and SEEK_CUR and so is effectively a boolean
flag.  Further flags will be required to support additional metadata
required by the Fibre Channel network model, so repurpose the "whence"
field as a generic "flags" field.

xfer_seek() has always been used with SEEK_SET, so remove the "whence"
field altogether from its argument list.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-09-03 21:21:14 +01:00
Piotr Jaroszyński b9eaf24df2 [build] Fix misaligned table entries when using gcc 4.5
Declarations without the accompanying __table_entry cause misalignment
of the table entries when using gcc 4.5.  Fix by adding the
appropriate __table_entry macro or (where possible) by removing
unnecessary forward declarations.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-20 10:13:04 +01:00
Joshua Oreman 49d6f57005 [compiler] Prevent empty weak function stubs from being removed
Even with the noinline specifier added by commit 1a260f8, gcc may skip
calls to non-inlinable functions that it knows have no side
effects. This caused the get_cached_dhcpack() call in start_dhcp(),
the weak stub of which has no code in its body, to be removed,
preventing cached DHCP from working.

Fix by adding a __keepme macro to compiler.h expanding to asm(""), as
recommended by gcc's info page, and using it in the weak stub for
get_cached_dhcpack().

Reported-by: Aaron Brooks <aaron@brooks1.net>
Tested-by: Aaron Brooks <aaron@brooks1.net>
Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 13:37:52 +01:00
Piotr Jaroszyński d60cbe43b7 [linux] Add the tap driver
Add the tap driver that can be used like:
$ ./ipxe.linux --net tap,if=tap0,mac=00:0c:29:c5:39:a1
The if setting is mandatory.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 13:12:53 +01:00
Piotr Jaroszyński ddef2e1bc1 [linux] Add command line arguments
Support qemu-like arguments for network setup:
--net driver_name[,setting=value]*

and global settings:
--settings setting=value[,setting=value]*

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:45:41 +01:00
Piotr Jaroszyński 91fb434bda [linux] Add device and driver model
Add the base to build linux drivers and the linux UI code on.  UI
fills device requests, which are later walked over by the linux
root_driver and delegated to specific linux drivers.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:42:42 +01:00
Piotr Jaroszyński aacd1d62fb [linux] Add empty smbios
There exists an smbios userspace library so implementing this is
probably possible, but doesn't seem really important to have in
userspace.  Hence provide a dummy implementation returning an error.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:38:34 +01:00
Piotr Jaroszyński 9ab6761b9c [linux] Add nap
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:38:08 +01:00
Piotr Jaroszyński 6ec1c509e4 [linux] Add umalloc
Add umalloc API.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:37:48 +01:00
Piotr Jaroszyński a320085750 [linux] Add uaccess
Add user access API for linux.

On linux userspace virtual == user == phys addresses.  Physical
addresses also being the same is wrong, but there is no general way of
converting userspace addresses to physical as what appears to be
contiguous in userspace is physically fragmented.  Currently only the
DMA memory is special-cased, but its conversion to bus addresses is
done in phys_to_bus.  This is known to break virtio as it is passing
phys addresses to the virtual device.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:35:28 +01:00
Piotr Jaroszyński 01a4c244db [linux] Add timer
Add linux timer API.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:32:53 +01:00
Piotr Jaroszyński 0e5fc47a25 [linux] Add linux api headers
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:29:37 +01:00
Piotr Jaroszyński 1822b1deb9 [libc] Add strtoull()
Don't implement strtoul() on top of strtoull() as strtoull() is much
bigger and only used on linux currently. Instead refactor most of the
logic out of strtoul() into static inlines and reuse that. Also put it
in a separate object so it won't get linked in.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-19 12:22:07 +01:00
Piotr Jaroszyński 6e4573bcd0 [libc] Add isxdigit()
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-17 14:44:27 +01:00
Piotr Jaroszyński 380d7c8d45 [settings] Export find_setting()
Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-17 14:39:10 +01:00
Piotr Jaroszyński 5bbad9c8f0 [ioapi] Move get_memmap() to the I/O API group
pcbios specific get_memmap() is used by the b44 driver making
all-drivers builds fail on other platforms.  Move it to the I/O API
group and provide a dummy implementation on EFI.

Signed-off-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-08-16 16:54:03 +01:00
Michael Brown 1d3b6619e5 [tcp] Allow out-of-order receive queue to be discarded
Allow packets in the receive queue to be discarded in order to free up
memory.  This avoids a potential deadlock condition in which the
missing packet can never be received because the receive queue is
occupying all of the memory available for further RX buffers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-21 12:01:50 +01:00
Michael Brown 9dc51afa2c [malloc] Add cache discard mechanism
Add a facility allowing cached data to be discarded in order to
satisfy memory allocations that would otherwise fail.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-21 11:58:50 +01:00
Michael Brown 68613047f0 [tcp] Handle out-of-order received packets
Maintain a queue of received packets, so that lost packets need not
result in retransmission of the entire TCP window.

Increase the TCP window to 8kB, in order that we can potentially
transmit enough duplicate ACKs to trigger Fast Retransmission at the
sender.

Using a 10MB HTTP download in qemu-kvm with an artificial drop rate of
1 in 64 packets, this reduces the download time from around 26s to
around 4s.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-21 00:00:38 +01:00
Stefan Hajnoczi e4419ff97c [virtio] Replace virtio-net with native iPXE driver
This patch adds a native iPXE virtio-net driver and removes the legacy
Etherboot virtio-net driver.  The main reasons for doing this are:

1. Multiple virtio-net NICs are now supported by iPXE.  The legacy
   driver kept global state and caused issues in virtual machines with
   more than one virtio-net device.

2. Faster downloads.  The native iPXE driver downloads 100 MB over
   HTTP in 12s, the legacy Etherboot driver in 37s.  This simple
   benchmark uses KVM with tap networking and the Python
   SimpleHTTPServer both running on the same host.

Changes to core virtio code reduce vring descriptors to 256 (QEMU uses
128 for virtio-blk and 256 for virtio-net) and change the opaque token
from u16 to void*.  Lowering the descriptor count reduces memory
consumption.  The void* opaque token change makes driver code simpler.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-17 17:07:14 +01:00
Stefan Hajnoczi 8ee6d216e4 [build] Mark weak functions noinline
Weak functions whose visibility is hidden may be inlined due to a bug
in GCC.  Explicitly mark weak functions noinline to work around the
problem.

This makes the PXE_MENU config option work again, the PXE boot menu
was never being called because the compiler inlined a weak stub
function.

The GCC bug was identified and fixed by Richard Sandiford
<rdsandiford@googlemail.com> but in the meantime iPXE needs to
implement a workaround.

Reported-by: Steve Jones <steve@squaregoldfish.co.uk>
Reported-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Suggested-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 12:55:59 +01:00
Michael Brown 3338a03982 [hci] Continue processing while prompting for shell banner
Continue calling step() while displaying the shell banner.  This
potentially allows TCP connections to close gracefully after a failed
boot attempt.

Inspired-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 12:43:10 +01:00
Michael Brown 7aa1d70e52 [debug] Expose pause() and more() debugging functions
Include the pause() and more() debugging functions within the general
iPXE debugging framework, by introducing DBGxxx_PAUSE() and
DBGxxx_MORE() macros.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 12:28:18 +01:00
Michael Brown e08cf49f1d [build] Remove some obsolete header files
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 11:38:02 +01:00
Michael Brown c5d760c987 [console] Remove never-used putline() method
putline() was introduced back in 2007 for a feature that was never
committed.  No console driver implements it and no code calls it, so
remove it from struct console_driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-14 11:27:42 +01:00
Alessandro Salvatori 3cefc5a3e0 [refcnt] Fix embedded image building
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-07-05 11:01:23 +01:00
Glenn Brown 9908587ca2 [pci] Define Vendor Specific capability ID
Add a PCI_CAP_ID_VNDR definition for the PCI standard "Vendor
Specific" capability ID.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-24 23:31:35 +01:00
Joshua Oreman 719ba316df [refcnt] Add ref_no_free handler
Since more reference-counted structures than embedded images might
want to mark themselves unfreeable, expose a dummy ref_no_free().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-23 00:34:48 +01:00
Michael Brown 65bc070b05 [interface] Allow for non-pass-through interface methods
xfer_vredirect() should not be allowed to propagate to a pass-through
interface.  For example, when an HTTPS connection is opened, the
redirect message should cause the TLS layer to reopen the TCP socket,
rather than causing the HTTP layer to disconnect from the TLS layer.

Fix by allowing for non-pass-through interface methods, and setting
xfer_vredirect() to be one such method.

This is slightly ugly, in that it complicates the notion of an
interface method call by adding a "pass-through" / "non-pass-through"
piece of metadata.  However, the only current user of xfer_vredirect()
is iscsi.c, which uses it only because we don't yet have an
ioctl()-style call for retrieving the underlying socket address.
The new interface infrastructure allows for such a call to be created,
at which time this sole user of xfer_vredirect() can be removed,
xfer_vredirect() can cease to be an interface method and become simply
a wrapper around xfer_vreopen(), and the concept of a non-pass-through
interface method can be reverted.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 19:12:40 +01:00
Michael Brown 4327d5d39f [interface] Convert all data-xfer interfaces to generic interfaces
Remove data-xfer as an interface type, and replace data-xfer
interfaces with generic interfaces supporting the data-xfer methods.

Filter interfaces (as used by the TLS layer) are handled using the
generic pass-through interface capability.  A side-effect of this is
that deliver_raw() no longer exists as a data-xfer method.  (In
practice this doesn't lose any efficiency, since there are no
instances within the current codebase where xfer_deliver_raw() is used
to pass data to an interface supporting the deliver_raw() method.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 15:50:31 +01:00
Michael Brown 7b4fbd93a5 [interface] Convert all name-resolution interfaces to generic interfaces
Remove name-resolution as an interface type, and replace
name-resolution interfaces with generic interfaces supporting the
resolv_done() method.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 15:45:57 +01:00
Michael Brown a03dd97e6b [interface] Convert all job-control interfaces to generic interfaces
Remove job-control as an interface type, and replace job-control
interfaces with generic interfaces supporting the close() method.
(Both done() and kill() are absorbed into the function of close();
kill() is merely close(-ECANCELED).)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 14:40:09 +01:00
Michael Brown e71b83b22b [interface] Expand object interface to allow for polymorphic interfaces
We have several types of object interface at present (data-xfer, job
control, name resolution), and there is some duplication of
functionality between them.  For example, job_done(), job_kill() and
xfer_close() are almost isomorphic to each other.

This updated version of the object interface mechanism allows for each
interface to export an arbitrary list of supported operations.
Advantages include:

  Operations methods now receive a pointer to the object, rather than
  a pointer to the interface.  This allows an object to, for example,
  implement a single close() method that can handle close() operations
  from any of its exposed interfaces.

  The close() operation is implemented as a generic operation (rather
  than having specific variants for data-xfer, job control, etc.).
  This will allow functions such as monojob_wait() to be used to wait
  for e.g.  a name resolution to complete.

  The amount of boilerplate code required in objects is reduced, not
  least because it is no longer necessary to include per-interface
  methods that simply use container_of() to derive a pointer to the
  object and then tail-call to a common per-object method.

  The cost of adding new operations is reduced; adding a new data-xfer
  operation such as stat() no longer incurs the penalty of adding a
  .stat member to the operations table of all existing data-xfer
  interfaces.

The data-xfer, job control and name resolution interfaces have not yet
been updated to use the new interface mechanism, but the code will
still compile and run.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 14:34:58 +01:00
Michael Brown c760ac3022 [retry] Add timer_init() wrapper function
Standardise on using timer_init() to initialise an embedded retry
timer, to match the coding style used by other embedded objects.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 14:30:20 +01:00
Michael Brown 4bfd5b52c1 [refcnt] Add ref_init() wrapper function
Standardise on using ref_init() to initialise an embedded reference
count, to match the coding style used by other embedded objects.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-22 14:26:40 +01:00
Michael Brown 75333f464e [ethernet] Move Ethernet MAC address checking routines to ethernet.h
Originally-fixed-by: Faur Andrei <da3drus@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-07 15:21:04 +01:00
Guo-Fu Tseng f27e077f09 [jme] Add JMicron Ethernet driver
A new driver for JMicron Ethernet controller.

Reviewed-by: Joshua Oreman <oremanj@rwcr.net>
Reviewed-by: Michael Brown <mbrown@fensystems.co.uk>
Reviewed-by: Marty Connor <mdc@etherboot.org>
Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-02 15:44:07 +01:00
Geoff Lywood 62149deb11 [efi] Add the "snpnet" driver
Add a new network driver that consumes the EFI Simple Network
Protocol.  Also add a bus driver that can find the Simple Network
Protocol that iPXE was loaded from; the resulting behavior is similar
to the "undionly" driver for BIOS systems.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-06-02 15:15:29 +01:00
Michael Brown 6c0e8c14be [libc] Enable automated extraction of error usage reports
Add preprocessor magic to the error definitions to enable every error
usage to be tracked.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-31 03:11:57 +01:00
Michael Brown bf2b1c8e47 [efi] Tidy up output of EFI header import script
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:47 +01:00
Michael Brown 03b1020acc [legal] Add FILE_LICENCE declarations to EFI header files
Autodetect the BSD licence statement in EFI header files, and add a
suitable FILE_LICENCE macro to the version imported into the iPXE
tree.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:47 +01:00
Michael Brown ae5ce45afe [efi] Synchronise EFI header files
Now that the PACKED macro conflict is resolved, we can use an
unmodified import of the EFI header files (using
include/ipxe/efi/import.pl).

Synchronised to EDK2 SVN revision 10556.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:47 +01:00
Michael Brown 307b39c08c [build] Remove PACKED macro
Most of iPXE uses __attribute__((packed)) anyway, and PACKED conflicts
with an identically-named macro in the upstream EFI header files.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:47 +01:00
Geoff Lywood eef46c23d6 [efi] Update UEFI header files with latest version from TianoCore
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-29 23:49:39 +01:00
Michael Brown bc83e4b5d3 [base16] Add generic base16 encoding and decoding routines
Base16 encoding is currently implemented in both iSCSI and SRP.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-28 15:41:37 +01:00
Michael Brown 97ea628484 [base64] Add ability to decode base64 strings
Inspired-by: Piotr Jaroszyński <p.jaroszynski@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-28 12:47:10 +01:00
Michael Brown dfcce165a5 [base64] Allow base64_encode() to handle arbitrary data
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-28 12:44:23 +01:00
Joshua Oreman 2aad3fab23 [build] Use weak definitions instead of weak declarations
This removes the need for inline safety wrappers, marginally reducing
the size penalty of weak functions, and works around an apparent
binutils bug that causes undefined weak symbols to not actually be
NULL when compiling with -fPIE (as EFI builds do).

A bug in versions of binutils prior to 2.16 (released in 2005) will
cause same-file weak definitions to not work with those
toolchains. Update the README to reflect our new dependency on
binutils >= 2.16.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 10:19:14 +01:00
Geoff Lywood 83efb3d750 [bitmap] Fix bitmaps on 64-bit
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-27 01:18:17 +01:00
Michael Brown 4fb3dae14e [qib7322] Add support for QLogic 7322 HCA
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-25 02:13:11 +01:00
Michael Brown 84996b7b09 [lacp] Add simple LACP implementation
Some switch configurations will refuse to enable our port unless we
can speak LACP to inform the switch that we are alive.  Add a very
simple passive LACP implementation that is sufficient to convince at
least Linux's bonding driver (when tested using qemu attached to a tap
device enslaved to a bond device configured as "mode=802.3ad").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-05-10 16:34:17 +01:00
Michael Brown 8406115834 [build] Rename gPXE to iPXE
Access to the gpxe.org and etherboot.org domains and associated
resources has been revoked by the registrant of the domain.  Work
around this problem by renaming project from gPXE to iPXE, and
updating URLs to match.

Also update README, LOG and COPYRIGHTS to remove obsolete information.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2010-04-19 23:43:39 +01:00
Michael Brown 4a7648bd3d [netdevice] Record whether or not interrupts are currently enabled
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2010-03-23 00:55:47 +00:00
Michael Brown 88e436376c [netdevice] Add netdev_is_open() wrapper function
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2010-03-23 00:46:35 +00:00
Marty Connor 5e829de055 [igb] Add igb driver
This commit adds an igb (Intel GigaBit) driver based on Intel source
code available at:

    http://sourceforge.net/projects/e1000/

which is upstream source for the Linux kernel e1000 drivers, and
should support some PCIe e1000 variants.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-17 03:44:27 -04:00
Marty Connor be5392c93a [e1000e] Add e1000e driver
This commit adds an e1000e driver based on Intel source code
available at:

    http://sourceforge.net/projects/e1000/

which is upstream source for the Linux kernel e1000 drivers, and
should support many PCIe e1000 variants.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-17 03:18:46 -04:00
Marty Connor 930a2ffac8 [e1000] Update e1000 driver
This commit replaces the current gPXE e1000 driver with one ported
from Intel source code available at

    http://sourceforge.net/projects/e1000/

which is upstream source for the Linux kernel e1000 drivers, and
should support most if not all PCI e1000 variants.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-03-17 03:02:32 -04:00
Masroor Vettuparambil f5f8ee00fc [vxge] Add support for X3100 series 10GbE Server/Storage Adapter
Signed-off-by: Sivakumar Subramani <sivakumar.subramani@neterion.com>
Signed-off-by: Masroor Vettuparambil <masroor.vettuparambil@neterion.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-02-24 13:08:49 -05:00
Stefan Hajnoczi 26f882bf64 [proto] Remove unsupported NMB protocol
The NMB protocol code came from legacy Etherboot and was never updated
to work as a gPXE protocol.  There has been no demand for this protocol,
so this patch removes it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-31 19:24:12 -05:00
Stefan Hajnoczi 00a780e38f [proto] Remove unsupported IGMP protocol
The IGMP code came from legacy Etherboot and was never updated to work
as a gPXE protocol.  There has been no demand for this protocol, so this
patch removes it.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-31 19:22:43 -05:00
Stefan Hajnoczi 1548189ffa [proto] Remove unsupported NFS protocol
The NFS protocol code came from legacy Etherboot and was never updated
to work as a gPXE protocol.  There has been no demand for this protocol,
so this patch removes it.

I have an unfinished NFSv3 over TCP implementation for gPXE that can be
used as the base for new work, should we want to resurrect this
protocol.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-31 19:21:00 -05:00
Joshua Oreman 3d9dd93a14 [uri] Decode/encode URIs when parsing/unparsing
Currently, handling of URI escapes is ad-hoc; escaped strings are
stored as-is in the URI structure, and it is up to the individual
protocol to unescape as necessary. This is error-prone and expensive
in terms of code size. Modify this behavior by unescaping in
parse_uri() and escaping in unparse_uri() those fields that typically
handle URI escapes (hostname, user, password, path, query, fragment),
and allowing unparse_uri() to accept a subset of fields to print so
it can be easily used to generate e.g. the escaped HTTP path?query
request.

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 18:14:28 -05:00
Joshua Oreman fa4aec8f03 [config] Make PXE stack a compile-time option
For extremely tight space requirements and specific applications, it is
sometimes desirable to create gPXE images that cannot provide the PXE API
functionality to client programs. Add a configuration header option,
PXE_STACK, that can be removed to remove this stack. Also add PXE_MENU
to control the PXE boot menu, which most uses of gPXE do not need.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 17:23:37 -05:00
Joshua Oreman b1ba80f8fb [dhcp] Add generic facility for using cached network settings
When a DHCP session is started (using autoboot or a command-line `dhcp
net0'), check whether the new setting use-cached (DHCP option 175.178)
is TRUE; if so, skip DHCP and rely on currently registered
settings. This lets one combine a static IP with autoboot.

Before checking the use-cached setting, call a weak
get_cached_dhcpack() hook that can be implemented by particular builds
of gPXE supporting some fashion of retrieving a cached DHCPACK packet.
If one is available, it is registered as an options source, and then
either that packet's option 175.178 or the user's prior manual
use-cached setting can allow skipping duplicate DHCP.

Using cached packets is not the default because DHCP servers are often
configured to give gPXE different options than they give a vendor PXE
client; in order to break the infinite loop of PXE chaining, one would
need to load a gPXE with an embedded image that does something more
than autoboot.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 17:15:51 -05:00
Joshua Oreman 2d58a62330 [linker] Add safe weak symbol macros
Weak symbols are a useful tool in eliminating unnecessary dependencies
between object files, but they are somewhat dangerous because one must
remember to test the weak symbol against NULL before using it. To
rectify that, add macros for declaring weak functions that will return
a default value inline if the file defining them is not available at
link time.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-20 17:05:25 -05:00
Marty Connor 5264e965ad [skge] Add driver for skge NICs
This code is based on the linux skge driver. It supports Marvell Yukon
and SysKonnect Gigabit chipsets.

The code is based on code Michael Decker <mrd999@gmail.com> wrote for
Google Summer of Code 2008.

Support for dual-port cards is untested. The code, however, was left
in. In my opinion it's easier to fix the code if we need to, instead
of having to add support for it from scratch.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-14 12:05:35 -05:00
Glenn Brown 57faa48f3b [myri10ge] Native driver for Myricom 10Gb Ethernet NICs
This driver supports all current Myricom 10 gigabit Ethernet NICs.
It was written from scratch for gPXE by Glenn Brown <glenn@myri.com>,
referenencing Myricom's Linux and EFI drivers, with permission.

Signed-off-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-14 10:32:40 -05:00
Glenn Brown cdd3797053 [pci] Add PCI_COMMAND_INTX_DISABLE
Taken from Linux /usr/include/linux/pci.h .

Signed-off-by: Glenn Brown <glenn@myri.com>
Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-14 10:23:12 -05:00
Joshua Oreman 5240fee38f [wpa] Add CCMP backend (new AES-based cryptosystem)
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 10:11:42 -05:00
Joshua Oreman 8106cb130b [wpa] Add TKIP backend (legacy RC4-based cryptosystem)
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 10:09:44 -05:00
Joshua Oreman 0758111345 [wpa] Add pre-shared key frontend (WPA "Personal" with just a passphrase)
Modified-by: Marty Connor <mdc@etherboot.org>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 10:07:59 -05:00
Joshua Oreman 8ec18a5b50 [wpa] Add general support for WPA-protected 802.11 networks
Modified-by: Marty Connor <mdc@etherboot.org>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:53:03 -05:00
Joshua Oreman 432cc6d1d8 [eapol] Add basic support for 802.1X EAP over LANs
EAPOL is a container protocol that can wrap either EAP packets or
802.11 EAPOL-Key frames. For cleanliness' sake, add a stub that strips
the framing and sends packets off to the appropriate handler if it
is compiled in.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:18:12 -05:00
Joshua Oreman 01b4f52089 [802.11] Add support for WEP-protected networks
WEP is a highly flawed cryptosystem, barely better than no encryption at all,
but many people still use it. It does have the advantage of being very simple
and small in code size.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:14:08 -05:00
Joshua Oreman 1327a787eb [iwmgmt] Add wireless management commands and text for common errors
Add commands `iwstat' (to list 802.11-specific status information for
802.11 devices) and `iwlist' (to scan for available networks and print
a list along with security information).

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:11:21 -05:00
Joshua Oreman dd8a3e2e70 [802.11] Add core support for detecting and using encrypted networks
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:08:37 -05:00
Joshua Oreman 8d08da3a99 [crypto] Add a placeholder for a proper random number generator
Currently it just calls random().

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:07:33 -05:00
Joshua Oreman 6c6db8647b [crypto] Add AES key-wrap mode (RFC 3394)
The unwrapping half is used by WPA2 code; the wrapping half is currently
unused.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:06:15 -05:00
Joshua Oreman 2dfe4c414a [crypto] Make AES context size and algorithm structure externally available
This is required to support modes of AES beyond cipher-block chaining.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:04:25 -05:00
Joshua Oreman ff4d61de96 [crypto] Add parentheses around len argument in blocksize assert
This fixes an issue where passing a length as a compound expression
(e.g. using `hdrlen + datalen') would trigger compiler warnings and
potentially precedence-related errors.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:02:59 -05:00
Joshua Oreman 59b7d00c06 [digest] Add HMAC-SHA1 based pseudorandom function and PBKDF2
Both of these routines are used by 802.11 WPA, but they are generic
and could be needed by other protocols as well.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:01:34 -05:00
Joshua Oreman 05d3be1048 [cipher] Add the ARC4 stream cipher
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 09:00:20 -05:00
Joshua Oreman 7eaad90976 [digest] Add generic CRC32 function
Signed-off-by: Marty Connor <mdc@etherboot.org>
2010-01-05 08:54:28 -05:00
Shao Miller 177389fb73 [settings] Add Bus ID setting
Users can find the bus type and PCI IDs for a network interface with:

netX/busid

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-12-14 17:54:53 +00:00
Joshua Oreman 9a0bd0711f [linker] Add mechanism for subsystem-dependent configuration options
It is often the case that some module of gPXE is only relevant if the
subsystem it depends on is already being included. For instance,
commands to manage wireless interfaces are quite useless if no
compiled-in driver has pulled in the wireless networking stack. There
may be a user-modifiable configuration options for these dependent
modules, but even if enabled, they should not be included when they
would be useless.

Solve this by allowing the creation of config_subsystem.c, for
configuration directives like those in the global config.c that should
only be considered when subsystem.c is included in the final gPXE
build.

For consistency, move core/config.c to the config/ directory, where
the other config_subsystem.c files will eventually reside.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-11-20 20:30:58 -05:00
Joshua Oreman 572e61754a [linker] Expand and correct symbol requirement macros
REQUIRE_SYMBOL() formerly used a formulation of symbol requirement
that would allow a link to succeed despite lacking a required symbol,
because it did not introduce any relocations. Fix by renaming it to
REQUEST_SYMBOL() (since the soft-requirement behavior can be useful)
and add a REQUIRE_SYMBOL() that truly requires.

Add EXPORT_SYMBOL() and IMPORT_SYMBOL() for REQUEST_SYMBOL()-like
behavior that allows one to make use of the symbol, by combining a
weak external on the symbol itself with a REQUEST_SYMBOL() of a second
symbol.

Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-11-20 20:27:25 -05:00
Michael Brown c2c77377a6 [ipoib] Mask out non-QPN bits in the IPoIB destination MAC when sending
The first byte of the IPoIB MAC address is used for flags indicating
support for "connected mode".  Strip out the non-QPN bits of the first
dword when constructing the address vector for transmitted IPoIB
packets, so as not to end up passing an invalid QPN in the BTH.
2009-11-16 22:15:29 +00:00
Michael Brown 50242e4202 [ipoib] Always set the "full membership" bit in the IPv4 broadcast GID
The SM always creates the IPoIB multicast groups with full membership
partition keys.
2009-11-16 22:14:58 +00:00
Michael Brown 58b6794c11 [infiniband] Rename IB_PKEY_NONE to IB_PKEY_DEFAULT
There is no such thing as a non-existent partition.
2009-11-16 22:14:36 +00:00
Michael Brown bbc530c0dd [infiniband] Report IB link status as IPoIB netdevice status 2009-11-16 22:14:12 +00:00
Michael Brown be670840c7 [sanboot] Extend the "keep-san" option to non-iSCSI SAN protocols
This disgustingly ugly hack just keeps getting worse.
2009-11-04 01:21:43 +00:00
Thomas Miletich 8912e24fdc [sis190] Hide the ISA bridge's PCI IDs from parserom.pl
Signed-off-by: Michael Brown <mcb30@etherboot.org>
Modified-by: Michael Brown <mcb30@etherboot.org>
2009-10-24 18:57:02 +01:00
Michael Brown 1b1e63d54d [netdevice] Add the concept of an "Ethernet-compatible" MAC address
The iBFT is Ethernet-centric in providing only six bytes for a MAC
address.  This is most probably an indirect consequence of a similar
design flaw in the Windows NDIS stack.  (The WinOF IPoIB stack
performs all sorts of contortions in order to pretend to the NDIS
layer that it is dealing with six-byte MAC addresses.)

There is no sensible way in which to extend the iBFT without breaking
compatibility with programs that expect to parse it.  Add the notion
of an "Ethernet-compatible" MAC address to our link layer abstraction,
so that link layers can provide their own workarounds for this
limitation.
2009-10-23 22:14:05 +01:00
Thomas Miletich 251926f631 [sis190] Add sis190/191 ethernet driver
Tested-by: Paul Hackett <paulfxhackett@gmail.com>
Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-10-16 14:56:34 -04:00
Joshua Oreman db3e054fe5 [atl1e] Add Attansic L1E gigabit Ethernet driver
Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-10-16 12:41:16 -04:00
Michael Brown 4175b778c2 [pci] Add generic configuration space backup/restore facility
Some devices can only be reset via a mechanism that also resets the
card's PCI core, thus necessitating a backup and restore of all or
part of the PCI configuration space across a reset.
2009-10-14 02:06:23 +01:00
Michael Brown 0fc13add31 [job] Add missing job_progress() interface method 2009-08-31 19:33:05 +01:00
Michael Brown a7290a970c [802.11] Support multicast hashing
802.11 multicast hashing is the same as standard Ethernet hashing, so
just expose and use eth_mc_hash().

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
2009-08-12 00:54:29 +01:00
Michael Brown 444d5550a7 [dhcp] Fall back to using the hardware address to populate the chaddr field
For IPoIB, the chaddr field is too small (16 bytes) to contain the
20-byte IPoIB link-layer address.  RFC4390 mandates that we should
pass an empty chaddr field and rely on the DHCP client identifier
instead.  This has many problems, not least of which is that a client
identifier containing an IPoIB link-layer address is not very useful
from the point of view of creating DHCP reservations, since the QPN
component is assigned at runtime and may vary between boots.

Leave the DHCP client identifier as-is, to avoid breaking existing
setups as far as possible, but expose the real hardware address (the
port GUID) via the DHCP chaddr field, using the broadcast flag to
instruct the DHCP server not to use this chaddr value as a link-layer
address.

This makes it possible (at least with ISC dhcpd) to create DHCP
reservations using host declarations such as:

    host duckling {
        fixed-address 10.252.252.99;
        hardware unknown-32 00:02:c9:02:00:25:a1:b5;
    }
2009-08-12 00:27:08 +01:00
Michael Brown 4eab5bc8ca [netdevice] Allow the hardware and link-layer addresses to differ in size
IPoIB has a 20-byte link-layer address, of which only eight bytes
represent anything relating to a "hardware address".

The PXE and EFI SNP APIs expect the permanent address to be the same
size as the link-layer address, so fill in the "permanent address"
field with the initial link layer address (as generated by
register_netdev() based upon the real hardware address).
2009-08-12 00:23:38 +01:00
Michael Brown 37a0aab4ff [netdevice] Separate out the concept of hardware and link-layer addresses
The hardware address is an intrinsic property of the hardware, while
the link-layer address can be changed at runtime.  This separation is
exposed via APIs such as PXE and EFI, but is currently elided by gPXE.

Expose the hardware and link-layer addresses as separate properties
within a net device.  Drivers should now fill in hw_addr, which will
be used to initialise ll_addr at the time of calling
register_netdev().
2009-08-12 00:19:14 +01:00
Michael Brown 0ff5c456cb [infiniband] Disambiguate CM connection rejection reasons
There is diagnostic value in being able to disambiguate between the
various reasons why an IB CM has rejected a connection attempt.  In
particular, reason 8 "invalid service ID" can be used to identify an
incorrect SRP service_id root-path component, and reason 28 "consumer
reject" corresponds to a genuine SRP login rejection IU, which can be
passed up to the SRP layer.

For rejection reasons other than "consumer reject", we should not pass
through the private data, since it is most likely generated by the CM
without any protocol-specific knowledge.
2009-08-10 22:31:55 +01:00
Michael Brown 965a0f7a75 [infiniband] Allow SRP reconnection attempts even after reporting failures
With iSCSI, connection attempts are expensive; it may take many
seconds to determine that a connection will fail.  SRP connection
attempts are much less expensive, so we may as well avoid the
"optimisation" of declaring a state of permanent failure after a
certain number of attempts.  This allows a gPXE SRP initiator to
resume operations after an arbitrary amount of SRP target downtime.
2009-08-10 22:30:56 +01:00
Michael Brown 0c30dc6bc5 [infiniband] Add support for SRP over Infiniband
SRP is the SCSI RDMA Protocol.  It allows for a method of SAN booting
whereby the target is responsible for reading and writing data using
Remote DMA directly to the initiator's memory.  The software initiator
merely sends and receives SCSI commands; it never has to touch the
actual data.
2009-08-10 22:27:33 +01:00
Michael Brown 8de49af0d2 [infiniband] Add last_opened_ibdev(), analogous to last_opened_netdev()
The minimal-surprise behaviour, when no explicit SRP initiator device
is specified, will probably be to use the most recently opened
Infiniband device.  This matches our behaviour with using the most
recently opened net device for PXE, iSCSI, AoE, NBI, etc.
2009-08-10 22:25:57 +01:00
Michael Brown 419243e7f1 [infiniband] Add find_ibdev() 2009-08-10 22:25:02 +01:00
Michael Brown 4be11f523c [infiniband] Add a "communication-managed reliable connection" protocol
SRP over Infiniband uses a protocol whereby data is sent via a
combination of the CM private data fields and the RC queue pair
itself.  This seems sufficiently generic that it's worth having
available as a separate protocol.
2009-08-10 22:23:28 +01:00
Michael Brown cf716a0ce6 [scsi] Make LUN a property of the SCSI backend only
Nothing within the SCSI core actually refers to the LUN, so we can
simplify matters by treating it as purely a property of the backend.
2009-08-10 19:31:45 +01:00
Michael Brown d944794680 [scsi] Generalise iscsi_parse_lun() to scsi_parse_lun() 2009-08-10 19:30:41 +01:00
Michael Brown 976f12c501 [scsi] Generalise iscsi_detached_command() to scsi_detached_command() 2009-08-10 19:29:40 +01:00
Michael Brown 04878ef745 [process] Make it safe to call process_add() multiple times 2009-08-10 19:27:24 +01:00
Michael Brown 46073f1239 [infiniband] Handle duplicate Communication Management REPs
We will terminate our transaction as soon as we receive the first CM
REP, since that provides all the state that we need.  However, the
peer may resend the REP if it didn't see our RTU, and if we don't
respond with another RTU we risk being disconnected.  (This protocol
appears not to handle retries gracefully.)

Fix by adding a management agent that will listen for these duplicate
REPs and send back an RTU.
2009-08-09 01:31:07 +01:00
Joshua Oreman ce68f587e2 [ath5k] Add support for non-802.11n Atheros wireless NICs
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:16:13 +01:00
Joshua Oreman 3f274a6950 [legal] Add MIT licence declaration
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:13:29 +01:00