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

4388 Commits

Author SHA1 Message Date
Michael Brown e63f6c9241 [efi] Fix building with newer binutils
Newer versions of bfd.h require definitions for the PACKAGE and
PACKAGE_VERSION macros used by autotools.  Work around this by
manually defining these macros before including bfd.h.

Originally-fixed-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Tested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-14 00:20:04 +00:00
Michael Brown c7c3d839fc [efi] Add our own EFI_LOAD_FILE_PROTOCOL implementation
When iPXE is used as a UEFI driver, the UEFI PXE base code currently
provides the TCP/IP stack, network protocols, and user interface.
This represents a substantial downgrade from the standard BIOS iPXE
user experience.

Fix by installing our own EFI_LOAD_FILE_PROTOCOL implementation which
initiates the standard iPXE boot procedure.  This upgrades the UEFI
iPXE user experience to match the standard BIOS iPXE user experience.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13 23:01:53 +00:00
Michael Brown fc87adb46c [efi] Expose downloaded images via EFI_SIMPLE_FILE_SYSTEM_PROTOCOL
Expose iPXE's images as a UEFI file system, allowing the booted image
to access all images downloaded by iPXE.

This functionality is complementary to the custom iPXE download
protocol.  The iPXE download protocol allows a booted image to utilise
iPXE to download arbitrary URIs, but requires the booted image to
specifically support the custom iPXE download protocol.  The new
functionality limits the booted image to accessing only files that
were already downloaded by iPXE (e.g. as part of a script), but can
work with any generic UEFI image (e.g. the UEFI shell).  Both
protocols are provided simultaneously, and are attached to the SNP
device handle.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13 22:42:16 +00:00
Michael Brown db014f3c23 [efi] Add last_opened_snpdev()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13 22:42:15 +00:00
Michael Brown 033f4c92ca [autoboot] Split main control flow out of main() into a new function ipxe()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13 22:24:13 +00:00
Michael Brown 1025835d80 [efi] Update to latest EDK2 headers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-13 22:23:42 +00:00
Michael Brown cb37d92ff6 [romprefix] Display only one "Ctrl-B" prompt per PCI device during POST
If a multifunction PCI device exposes an iPXE ROM via each function,
then each function will display a "Press Ctrl-B to configure iPXE"
prompt, and delay for two seconds.  Since a single instance of iPXE
can drive all functions on the multifunction device, this simply adds
unnecessary delay to the boot process.

Fix by inhibiting the "Press Ctrl-B" prompt for all except the first
function on a PCI device.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-11 01:48:00 +00:00
Michael Brown 2629b7e2cd [pcbios] Inhibit all calls to INT 15,e820 and INT 15,e801 during POST
Many BIOSes do not construct the full system memory map until after
calling the option ROM initialisation entry points.  For several
years, we have added sanity checks and workarounds to accommodate
charming quirks such as BIOSes which report the entire 32-bit address
space (including all memory-mapped PCI BARs) as being usable RAM.

The IBM x3650 takes quirky behaviour to a new extreme.  Calling either
INT 15,e820 or INT 15,e801 during POST doesn't just get you invalid
data.  We could cope with invalid data.  Instead, these nominally
read-only API calls manage to trash some internal BIOS state, with the
result that the system memory map is _never_ constructed.  This tends
to confuse subsequent bootloaders and operating systems.

[ GRUB 0.97 fails in a particularly amusing way.  Someone thought it
would be a good idea for memcpy() to check that the destination memory
region is a valid part of the system memory map; if not, then memcpy()
will sulk, fail, and return NULL.  This breaks pretty much every use
of memcpy() including, for example, those inserted implicitly by gcc
to copy non-const initialisers.  Debugging is _fun_ when a simple call
to printf() manages to create an infinite recursion, exhaust the
available stack space, and shut down the CPU. ]

Fix by completely inhibiting calls to INT 15,e820 and INT 15,e801
during POST.

We do now allow relocation during POST up to the maximum address
returned by INT 15,88 (which seems so far to always be safe).  This
allows us to continue to have a reasonable size of external heap, even
if the PMM allocation is close to the 1MB mark.

The downside of allowing relocation during POST is that we may
overwrite PMM-allocated memory in use by other option ROMs.  However,
the downside of inhibiting relocation, when combined with also
inhibiting calls to INT 15,e820 and INT 15,e801, would be that we
might have no external heap available: this would make booting an OS
impossible and could prevent some devices from even completing
initialisation.

On balance, the lesser evil is probably to allow relocation during
POST (up to the limit provided by INT 15,88).  Entering iPXE during
POST is a rare operation; on the even rarer systems where doing so
happens to overwrite a PMM-allocated region, then there exists a
fairly simple workaround: if the user enters iPXE during POST and
wishes to exit iPXE, then the user must reboot.  This is an acceptable
cost, given the rarity of the situation and the simplicity of the
workaround.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-11 01:20:01 +00:00
Michael Brown 0d4a760ffc [prefix] Use %cs as implicit parameter to uninstall()
romprefix.S currently calls uninstall() with an invalid value in %ax.
Consequently, base memory is not freed after a ROM boot attempt (or
after entering iPXE during POST).

The uninstall() function is physically present in .text16, and so can
use %cs to determine the .text16 segment address.  The .data16 segment
address is not required, since uninstall() is called only by code
paths which set up .data16 to immediately follow .text16.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-08 17:42:24 +00:00
Michael Brown c7694acb51 [nbiprefix] Set up real-mode stack before jumping to .text16
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-08 17:41:51 +00:00
Michael Brown b33082a52b [pcbios] Add extra debugging messages when unhiding iPXE from memory
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-08 17:40:46 +00:00
Brandon Penglase 3a8dbd9cdf [build] Add vmware build target
Add "make vmware" build target, to build all of the ROMs used with
VMware.

Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-06 19:52:51 +00:00
Michael Brown 02b914e812 [tftp] Allow TFTP block size to be controlled via the PXE TFTP API
The PXE TFTP API allows the caller to request a particular TFTP block
size.  Since mid-2008, iPXE has appended a "?blksize=xxx" parameter to
the TFTP URI constructed internally; nothing has ever parsed this
parameter.  Nobody seems to have cared that this parameter has been
ignored for almost five years.

Fix by using xfer_window(), which provides a fairly natural way to
convey the block size information from the PXE TFTP API to the TFTP
protocol layer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-06 17:35:30 +00:00
Michael Brown c08025137b [menu] Prevent separators with shortcut keys from being selected
Nothing currently prevents a menu separator from being assigned a
shortcut key, and then from being selected using that shortcut key.
This produces an inconsistency in the user interface, since separators
cannot be selected by other means of menu navigation (arrow keys, page
up/down, etc).

It would be trivial to prevent separators from being assigned shortcut
keys, but this would eliminate one potentially useful use case: having
a large menu and using shortcut keys to jump to a section within the
menu.

Fix by treating a shortcut key on a separator as equivalent to "select
the separator, then press the down arrow key".  This has the effect of
moving to the first non-separator menu item following the specified
separator, which is probably the most intuitive behaviour.  (The
existing logic for moving the selection already handles the various
nasty corner cases such as a menu ending with one or more separators.)

Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-06 15:11:49 +00:00
Michael Brown b8cbdbbb53 [menu] Prevent character code zero from acting as a shortcut key
Unrecognised keys may be returned by getkey() as character code zero,
which currently matches against the first menu item with no shortcut
key defined.

Prevent this unintended behaviour by explicitly checking that the menu
item has a defined shortcut key.

Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-06 14:41:46 +00:00
Daniel P. Berrange eb5a2ba596 [zbin] Fix size used for memset in alloc_output_file
The output->buf field is a pointer, not an array, so sizeof() is not
applicable.  We must use the allocated string length instead.

Identified by gcc:

  util/zbin.c: In function ‘alloc_output_file’:
  util/zbin.c:146:37: warning: argument to ‘sizeof’ in ‘memset’ call
    is the same expression as the destination; did you mean to
    dereference it? [-Wsizeof-pointer-memaccess]
  memset ( output->buf, 0xff, sizeof ( output->buf ) );

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-05 15:23:01 +00:00
Michael Brown 9373ca8ea2 [undi] Work around specific devices with known broken interrupt behaviour
Some PXE stacks are known to claim that IRQs are supported, but then
never generate interrupts.  No satisfactory solution has been found to
this problem; the workaround is to add the PCI vendor and device IDs
to a list of devices which will be treated as simply not supporting
interrupts.

This is something of a hack, since it will generate false positives
for identical devices with a working PXE stack (e.g. those that have
been reflashed with iPXE), but it's an improvement on the current
situation.

Reported-by: Richard Moore <rich@richud.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-05 14:22:53 +00:00
Kevin Tran e27803e40f [tg3] Fix various tg3 issues
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-04 21:56:24 +00:00
Michael Brown 77f64b11f7 [netdevice] Separate VLAN support from presence of VLAN-supporting drivers
Some NICs (e.g. Hermon) provide hardware support for stripping the
VLAN tag, but do not provide any way for this support to be disabled.
Drivers for this hardware must therefore call vlan_find() to identify
a suitable receiving network device.

Provide a weak version of vlan_find() which will always return NULL if
VLAN support has not been enabled (either directly, or by enabling
a feature such as FCoE which requires VLAN support).  This allows the
VLAN code to be omitted from builds where the user has not requested
support for VLANs.

Inspired-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-01 16:36:34 +00:00
Stefan Hajnoczi 7d64abbc5d [iscsi] Include 802.1Q VLAN identifier in iBFT
The iBFT NIC section has a VLAN field which must be filled in so that
iSCSI booting works over VLANs.

Unfortunately it is unclear from the IBM specification linked in
ibft.c whether the VLAN field is just the 802.1Q VLAN Identifier or
the full 802.1Q TCI.  For now just fill in the VID, the Priority Code
Point and Drop Eligible Indicator could be set in the future if it
turns out they should be present too.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-01 16:22:23 +00:00
Stefan Hajnoczi 7426177d63 [netdevice] Add vlan_tag() to get the VLAN tag of a network device
The iBFT has a VLAN field that should be filled in.  Add the
vlan_tag() function to extract the VLAN tag of a network device.

Since VLAN support is optional, define a weak function that returns 0
when iPXE is built without VLAN support.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-01 16:11:40 +00:00
Michael Brown 09c5109b85 [efi] Ensure EFI binaries comply with Authenticode requirements
Authenticode requires that the size of the raw file must equal the
size of the OptionalHeader.SizeOfHeaders plus the sum of all sections'
SizeOfRawData.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-02-25 17:22:01 +00:00
Jens Rottmann 3c29c8ecc1 [intel] Add Intel I210 Gigabit Ethernet PCI ID
Signed-off-by: Jens Rottmann <JRottmann@LiPPERTembedded.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-02-20 12:04:10 +00:00
Michael Brown b757df7756 [build] Include self-tests within "make everything"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-01-31 10:12:58 +00:00
Michael Brown 0acc52519d [tls] Concatenate received non-data records before processing
Allow non-data records to be split across multiple received I/O
buffers, to accommodate large certificate chains.

Reported-by: Nicola Volpini <Nicola.Volpini@kambi.com>
Tested-by: Nicola Volpini <Nicola.Volpini@kambi.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-01-31 09:59:36 +00:00
Stefan Weil 3fcb8cf8dc [src] Fix spelling in comments, debug messages and local variable names
Fixes in comments and debug messages:

  existance -> existence
  unecessary -> unnecessary
  occured -> occurred
  decriptor -> descriptor
  neccessary -> necessary
  addres, adress -> address
  initilize -> initialize
  sucessfully -> successfully
  paramter -> parameter
  acess -> access
  upto -> up to
  likelyhood ->likelihood
  thru -> through
  substracting -> subtracting
  lenght -> length
  isnt -> isn't
  interupt -> interrupt
  publically -> publicly (this one was not wrong, but unusual)
  recieve -> receive
  accessable -> accessible
  seperately -> separately
  pacet -> packet
  controled -> controlled
  dectect -> detect
  indicies -> indices
  extremly -> extremely
  boundry -> boundary
  usefull -> useful
  unuseable -> unusable
  auxilliary -> auxiliary
  embeded -> embedded
  enviroment -> environment
  sturcture -> structure
  complier -> compiler
  constructes -> constructs
  supress -> suppress
  intruduced -> introduced
  compatability -> compatibility
  verfication -> verification
  ths -> the
  reponse -> response

Fixes in local variable names:

  retreive -> retrieve

Most of these fixes were made using codespell.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-01-03 15:18:48 +00:00
Michael Brown 717279a294 [efi] Include product short name in EFI SNP device names
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-21 03:43:43 +00:00
Michael Brown 1a79f6f37a [efi] Delegate to child device's EFI_COMPONENT_NAME2_PROTOCOL, if present
EFI's device naming model requires drivers to provide names for child
devices.  Allow the driver's GetControllerName() method to delegate to
an instance of EFI_COMPONENT_NAME2_PROTOCOL installed on the child
device itself (if present); this allows the SNP device to expose its
own device name via the PCI driver's GetControllerName() method.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-21 03:26:45 +00:00
Michael Brown d6b0b76a05 [bzimage] Allow initrds to be rearranged in place
At present, loading a bzImage via iPXE requires enough RAM to hold two
copies of each initrd file.  Remove this constraint by rearranging the
initrds in place.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 23:10:45 +00:00
Michael Brown 4ca98693b9 [initrd] Add ability to reshuffle initrds into image list order
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 21:56:20 +00:00
Michael Brown 603455bb06 [libc] Relicense x86 string.h
No code from the original source remains within this file; relicense
under GPL2+ with a new copyright notice.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown 53f3deee06 [libc] Fix and externalise memswap()
Make memswap() behave correctly if called with a length of zero.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown de20c526e6 [libc] Reduce overall code size by externalising strlen()
Typical saving is 5-20 bytes in each file using strlen().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown 06766875ad [libc] Reduce overall code size by externalising strncmp()
Typical saving is 20-30 bytes in each file using strncmp().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown f8ece72fc9 [libc] Remove unnecessary "cld" instruction from memset()
Saving is one byte per call to memset().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown 61c6af3f0b [libc] Convert memcpy() from a macro to an inline function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown fc30b13b25 [libc] Reduce overall code size by externalising memmove()
Typical saving is 15-20 bytes in each file using memmove().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown 7cbac68593 [libc] Remove obsolete implementation of memcpy()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown 520323e360 [test] Add self-tests for string functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-12 16:58:49 +00:00
Michael Brown fd141fb669 [umalloc] Split largest_memblock() function out from init_eheap()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-06 17:44:40 +00:00
Michael Brown 1494d41d0a [uaccess] Add userptr_sub() to find the difference between two user pointers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-05 16:15:14 +00:00
Michael Brown 54a861a7bd [list] Reduce overall code size by externalising many list functions
Typical saving is 10-20 bytes in each file using list functions.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 16:21:06 +00:00
Thomas Miletich f68b4069b1 [build] Make version.o depend on the git index
The version number string is currently updated only if version.o
happens to be rebuilt due to changes in its dependencies.  Add a
dependency upon the git index, so that the version number is updated
after any checkout.

Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 15:00:09 +00:00
Michael Brown 4867085c0c [build] Include version number within only a single object file
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 14:46:39 +00:00
Michael Brown 0932bc5156 [build] Inhibit .eh_frame on newer gcc versions
Using -fno-dwarf2-cfi-asm is not sufficient to prevent the .eh_frame
section from being generated on newer versions of gcc.  Add
-fno-exceptions -fno-unwind-tables -fno-asynchronous-unwind-tables;
this is sufficient to inhibit the .eh_frame section on gcc 4.7.1.

This does not affect the overall binary size, but does fix the numbers
reported by "size" for individual object files.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 13:41:50 +00:00
Michael Brown f008698c68 [build] Use -maccumulate-outgoing-args if required by gcc
Current versions of gcc require -maccumulate-outgoing-args if any
sysv_abi functions call ms_abi functions.  This requirement is likely
to be lifted in future gcc versions, so test explicitly to see if the
current version of gcc requires -maccumulate-outgoing-args.

This problem is currently masked since the implied
-fasynchronous-unwind-tables (which is the default in current gcc
versions) implies -maccumulate-outgoing-args.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-11-02 13:41:44 +00:00
Michael Brown 6586e03fba [forcedeth] Increase TX ring size to prevent dropped packets
Commit 947976d ("[netdevice] Do not force a poll on net_tx()")
requires network devices to have TX rings that are sufficiently large
to allow a transmitted response to all packets received during a
single poll.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-29 10:14:00 +00:00
Michael Brown 0c5e3df6d9 [intel] Poll RX queue if hardware reports RX overflow
The Intel NIC emulation in some versions of VMware seems to suffer
from a flaw whereby the Interrupt Cause Register (ICR) fails to assert
the usual "packet received" bit (ICR.RXT0) if a receive overflow
(ICR.RXO) has also occurred.

Work around this flaw by polling for completed descriptors whenever
either ICR.RXT0 or ICR.RXO is asserted.

Reported-by: Miroslav Halas <miroslav.halas@bankofamerica.com>
Debugged-by: Miroslav Halas <miroslav.halas@bankofamerica.com>
Tested-by: Miroslav Halas <miroslav.halas@bankofamerica.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-28 18:53:23 +00:00
Michael Brown c4ee23e7c6 [hermon] Use PCI VPD for non-volatile option storage
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-25 08:24:00 -07:00
Michael Brown 2c011d77ae [readline] Allow readline_history() to return a meaningful status
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 23:24:43 -07:00
Michael Brown 88e19fcda9 [netdevice] Clear network device setting before unregistering
Avoid memory leaks by clearing any (non-child) settings immediately
before unregistering the network device settings block.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 22:44:00 -07:00
Michael Brown 34863a51c2 [settings] Prefill existing setting value in "read" command
When prompting the user to enter a setting value via the "read"
command, prefill the input buffer with the setting's current value.

Requested-by: Ján Ondrej (SAL) <ondrejj@salstar.ks>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 20:47:39 -07:00
Michael Brown 4dedccfa1f [readline] Allow a prefilled input string to be provided
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 20:42:42 -07:00
Michael Brown c86790df5c [settings] Add fetchf_named_setting_copy()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 20:42:42 -07:00
Michael Brown 947976da0c [netdevice] Do not force a poll on net_tx()
Including a netdev_poll() within net_tx() can cause the net_step()
loop to end up processing hundreds or thousands of packets within a
single step, since each received packet being processed may trigger a
response which, in turn causes a poll for further received packets.

Network devices must now ensure that the TX ring is at least as large
as the RX ring, in order to avoid running out of TX descriptors.  This
should not cause any problems; unlike the RX ring, there is no
substantial memory cost incurred by increasing the TX ring size.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 14:04:41 -07:00
Michael Brown dace457baf [intel] Report receive overruns via network device errors
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-24 11:21:34 -07:00
Michael Brown 7cf6c6bfed [efi] Add EFI_COMPONENT_NAME2_PROTOCOL instance for each SNP device
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-23 14:07:50 -07:00
Michael Brown 1d38168064 [autoboot] Avoid excess backspacing after displaying Ctrl-B prompt
Remove the newline from the "Press Ctrl-B..." prompt string, so that
prompt() does not attempt to backspace beyond the start of the line.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-23 14:07:50 -07:00
Michael Brown 0e7819d298 [efi] Add missing RC_TO_EFIRC() conversion
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-22 08:42:53 -07:00
Michael Brown a27413c82a [util] Fix uninitialised-variable warning in einfo.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-22 08:26:43 -07:00
Michael Brown 34a81da0c8 [test] Remove self-test for empty formatted setting value
Commit 5ad445f ("[settings] Treat an empty formatted value as meaning
"delete setting"") (re)defined the semantics of storing an empty
formatted setting as meaning "delete setting".

Remove the existing self-test using an empty formatted hex setting
value, since it no longer conforms to the defined semantics.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-20 14:44:34 -07:00
Michael Brown 885384faf3 [arp] Increase robustness of ARP discarder
Take ownership from the ARP cache at the start of arp_destroy(), to
ensure that no code path can lead to arp_destroy() being re-entered.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-19 23:03:38 +01:00
Michael Brown a4d1250810 [efi] Expose net device non-volatile settings via HII
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-16 15:10:52 +01:00
Michael Brown 41ea18a455 [efi] Split SNP HII functionality into a separate file
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-16 15:10:52 +01:00
Michael Brown 0fd29e15b5 [nvo] Expose nvo_applies()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-15 18:32:16 +01:00
Michael Brown 08a6ae86a2 [nvo] Expose non-volatile options block name
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-15 18:32:16 +01:00
Michael Brown 5ad445fd0b [settings] Treat an empty formatted value as meaning "delete setting"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-15 18:32:16 +01:00
Michael Brown 1c2b6d29ea [settings] Expose find_child_settings()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-15 18:32:16 +01:00
Michael Brown 51b65d5f9c [libc] Add wcslen() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-15 18:32:16 +01:00
Shao Miller a712dae709 [serial] Don't enable serial console without serial support
serial_console_init() would enable serial console support without
knowing if the serial driver succeeded or not.  As a result, the
serial console would interfere with a normal keyboard on a system
lacking serial support.

Reported-by: Jan ONDREJ (SAL) <ondrejj(at)salstar.sk>
Signed-off-by: Shao Miller <sha0.miller@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-05 15:18:57 +01:00
Michael Brown fcdfe81764 [int13] Do not zero %edx when jumping to a boot sector
Commit 73eb3f1 ("[int13] Zero all possible registers when jumping to a
boot sector") introduced a regression preventing the SAN-booting of
boot sectors which rely upon %dl containing the correct drive number
(such as most CD-ROM boot sectors).

Fix by not zeroing %edx.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-05 15:04:27 +01:00
Michael Brown bab0a4c1ce [efi] Mark SNP formset compliant with IBM's Unified Configuration Manager
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-10-05 13:24:07 +01:00
Michael Brown d23db28488 [tls] Fix potential memory leak
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-28 10:54:07 +01:00
Michael Brown 1e199c8260 [tls] Fix uninitialised variable
Reported-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-28 10:52:17 +01:00
Michael Brown 72db14640c [tls] Split received records over multiple I/O buffers
TLS servers are not obliged to implement the RFC3546 maximum fragment
length extension, and many common servers (including OpenSSL, as used
in Apache's mod_ssl) do not do so.  iPXE may therefore have to cope
with TLS records of up to 16kB.  Allocations for 16kB have a
non-negligible chance of failing, causing the TLS connection to abort.

Fix by maintaining the received record as a linked list of I/O
buffers, rather than a single contiguous buffer.  To reduce memory
pressure, we also decrypt in situ, and deliver the decrypted data via
xfer_deliver_iob() rather than xfer_deliver_raw().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-27 01:56:01 +01:00
Michael Brown 09d45ffd79 [crypto] Allow in-place CBC decryption
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-27 01:54:55 +01:00
Michael Brown c1adf7dabe [test] Add speed tests for cipher algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-26 15:27:33 +01:00
Michael Brown 681a219caa [test] Add speed tests for digest algorithms
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-26 14:54:02 +01:00
Michael Brown 09cc63fc8b [efi] Provide guaranteed space in transmitted packets
eIPoIB requires space to expand a transmitted ARP packet.  This
guarantee is met by ensuring that a transmitted packet consists of at
least MAX_LL_HEADER_LEN bytes from the start of the I/O buffer up to
the end of the link-layer header, and at least IOB_ZLEN bytes
thereafter.

Adjust the I/O buffer allocation for SNP transmitted packets to ensure
that this guarantee is met.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-14 17:49:53 +01:00
Michael Brown 73eb3f17db [int13] Zero all possible registers when jumping to a boot sector
At least one boot sector (the DUET boot sector used for bootstrapping
EFI from a non-EFI system) fails to initialise the high words of
registers before using them in calculations, leading to undefined
behaviour.

Work around such broken boot sectors by explicitly zeroing the
contents of all registers apart from %cs:%ip and %ss:%sp.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-14 15:42:54 +01:00
Michael Brown 8509dbf86a [int13] Use correct size when estimating floppy disk geometry
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-14 15:04:53 +01:00
Michael Brown 117fc61738 [console] Add support for the bochs/qemu debug port console
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 15:58:02 +01:00
Patrick Plenefisch 8e4faa0948 [cmdline] Add standalone "nslookup" command
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 15:31:14 +01:00
Michael Brown c4500fb7ca [smbios] Default to "hex" type for non-string SMBIOS settings
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 15:29:36 +01:00
Michael Brown 25ec56e0ec [settings] Use a generic setting's own type as its default type
When fetching a named setting using a name that does not explicitly
specify a type, default to using the type stored when the setting was
created, rather than always defaulting to "string".  This allows the
behaviour of user-defined settings to match the behaviour of
predefined settings (which have a sensible default type).

For example:

  set server:ipv4 192.168.0.1
  echo ${server}

will now print "192.168.0.1", rather than trying to print out the raw
IPv4 address bytes as a string.

The downside of this change is that existing tricks for printing
special characters within scripts may require (backwards-compatible)
modification.  For example, the "clear screen" sequence:

  set esc:hex 1b
  set cls ${esc}[2J
  echo ${cls}

will now have to become

  set esc:hex 1b
  set cls ${esc:string}[2J  # Must now explicitly specify ":string"
  echo ${cls}

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-10 14:25:04 +01:00
Michael Brown e6427b7ee1 [sdi] Add support for SDI images
Add support (disabled by default) for booting .sdi images as used by
Windows XP Embedded.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-09-05 14:11:01 +01:00
Michael Brown 03f0c23f8b [ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headers
Almost all clients of the raw-packet interfaces (UNDI and SNP) can
handle only Ethernet link layers.  Expose an Ethernet-compatible link
layer to local clients, while remaining compatible with IPoIB on the
wire.  This requires manipulation of ARP (but not DHCP) packets within
the IPoIB driver.

This is ugly, but it's the only viable way to allow IPoIB devices to
be driven via the raw-packet interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:59 +01:00
Michael Brown f54a61e434 [infiniband] Include destination address vector in ib_complete_recv()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:58 +01:00
Michael Brown cbe41cb31b [infiniband] Use explicit "source" and "dest" address vector parameter names
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:58 +01:00
Michael Brown f747fac3e1 [infiniband] Allow queue pairs to have a custom allocator for receive iobufs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:57 +01:00
Michael Brown 96be171be5 [iobuf] Allow allocation of I/O buffers with a specified alignment offset
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:52 +01:00
Michael Brown e2becce186 [malloc] Allow allocation of memory with a specified alignment offset
Allow for allocation of memory blocks having a specified offset from a
specified physical alignment, such as being 12 bytes before a 2kB
boundary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 21:22:45 +01:00
Michael Brown de802310bc [retry] Expose retry_poll() to explicitly poll all running timers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 20:21:15 +01:00
Michael Brown 1cbb1581f1 [ethernet] Expose eth_broadcast as a global constant
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-31 20:21:10 +01:00
Anton D. Kachalov 5e73677a01 [build] Add missing #include <config/local/sideband.h>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-27 00:28:49 +01:00
Anton D. Kachalov 34a637f46f [build] Display commands for dependency generation when building with V=1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-27 00:24:23 +01:00
Michael Brown 79300e2ddf [tls] Disambiguate most error causes
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-25 04:08:04 +01:00
Michael Brown 70618161ad [realtek] Force EEPROM CS low before disabling EEPROM access mode
Some RTL8169 cards seem to drive the EEPROM CS line high (i.e. active)
when 9346CR.EEM is set to "normal operating mode", with the result
that the CS line is never deasserted.  The symptom of this is that the
first read from the EEPROM will work, while all subsequent reads will
return garbage data.

Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Debugged-by: Thomas Miletich <thomas.miletich@gmail.com>
Tested-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-24 17:26:11 +01:00
Michael Brown d1949f2737 [bitbash] Add optional open() and close() methods for bit-bashing interfaces
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-24 17:26:10 +01:00
Michael Brown 5676abead2 [realtek] Forcibly enable advertisement of 1000Mbps speeds
Some RTL8169 cards (observed with an RTL8169SC) power up advertising
only 100Mbps, despite being capable of 1000Mbps.  Forcibly enable
advertisement of 1000Mbps on any RTL8169-like card.

This change relies on the assumption that the CTRL1000 register will
not exist on 100Mbps-only RTL8169 cards such as the RTL8101.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 22:44:20 +01:00
Michael Brown 6e50e7950f [mii] Add separate mii_restart() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 21:25:51 +01:00
Michael Brown 0dacd54174 [realtek] Enable DAC only when built as a 64-bit binary
Some RTL8169 cards (observed with an RTL8169SC) crash and burn if DAC
is enabled, even if only 32-bit addresses are used.  Observed
behaviour includes system lockups and repeated transmission of garbage
data onto the wire.

This seems to be a known problem.  The Linux r8169 driver disables DAC
by default and provides a "use_dac" module parameter.

There appears to be no known test for determining whether or not DAC
will work.  As a workaround, enable DAC only if we are built as as
64-bit binary.  This at least eliminates the problem in the common
case of a 32-bit build, which will never use 64-bit addresses anyway.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 15:15:43 +01:00
Michael Brown 0e61beb26f [realtek] Use read-modify-write to check for C+ Command register
Some bits in the C+ Command register are always one.  Testing for the
presence of the register must allow for this.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 15:15:42 +01:00
Michael Brown 77afdc5643 [realtek] Use explicit value for TCR.MXDMA
Some RTL8169 cards (observed with an RTL8169SC) power up with
TCR.MXDMA set to 16 bytes.  While this does not prevent proper
operation, it almost certainly degrades performance.

Fix by explicitly setting TCR.MXDMA to "unlimited".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 15:15:42 +01:00
Michael Brown 5d05220ee0 [realtek] Use explicit values for RCR.RXFTH and RCR.MXDMA
Some RTL8169 cards (observed with an RTL8169SC) power up with invalid
values in RCR.RXFTH and RCR.MXDMA, causing receive DMA to fail.  Fix
by setting explicit values for both fields.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 15:15:35 +01:00
Michael Brown b0ba892333 [realtek] Always set high dword of ring address registers
Some RTL8169 cards (observed with an RTL8169SC) power up with garbage
values in the ring address registers, and do not clear the registers
on reset.

Fix by always setting the high dword of the ring address registers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-23 13:35:54 +01:00
Kevin Tran a05871d89a [tg3] Fix driver for BCM5719, BCM5720, BCM5764M, BCM57762
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-20 18:50:35 +01:00
Michael Brown 8f7cd88af5 [http] Fix HTTP SAN booting
Commit 501527d ("[http] Treat any unexpected connection close as an
error") introduced a regression causing HTTP SAN booting to fail.  At
the end of the response to the HEAD request, the call to http_done()
would erroneously believe that the server had disconnected in the
middle of the HTTP headers.

Fix by treating the header block from a HEAD request as a trailer
block.  This fixes the problem and also simplifies the logic in
http_rx_header().

Reported-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-17 18:00:40 +01:00
Marin Hannache 1170a36e6b [ftp] Add support for the FTP SIZE command
The FTP SIZE command allows us to get the size of a particular file,
as a consequence, we can now show proper transfer progression while
fetching a file using the FTP protocol.

Signed-off-by: Marin Hannache <git@mareo.fr>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 17:04:41 +01:00
Michael Brown 501527daab [http] Treat any unexpected connection close as an error
iPXE currently checks that the server has not closed the connection
mid-stream (i.e. in the middle of a chunked transfer, or before the
specified Content-Length has been received), but does not check that
the server got as far as starting to send data.  Consequently, if the
server closes the connection before any data is transferred (e.g. if
the server gives up waiting while iPXE performs the validation steps
for TLS), then iPXE will treat this as a successful transfer of a
zero-length file.

Fix by checking the RX connection state, and forcing an error if the
server has closed the connection at an unexpected point.

Originally-fixed-by: Marin Hannache <mareo@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 16:29:22 +01:00
Michael Brown c7eea31ed8 [util] Fix up checksum in UNDI ROM header, if present
The UNDI ROM header does contain a checksum byte.  Apparently no-one
cares about this, since iPXE has left it as zero for years without
anyone noticing.

Since Option::ROM now understands the UNDI ROM header, we may as well
fix up the checksum byte for the sake of completeness.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 13:22:12 +01:00
Michael Brown 69fa494280 [util] Display UNDI ROM header in disrom.pl
Requested-by: Daniel Wyatt <daniel.wyatt@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 13:19:16 +01:00
Daniel Wyatt 37ac7a666f [util] Allow for CALL NEAR in the option ROM initialisation entry point
Option::ROM currently understands only JMP NEAR and JMP SHORT
instructions in the initialisation entry point.  At least one Broadcom
option ROM has been observed to use a CALL NEAR instruction.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-15 12:51:47 +01:00
Michael Brown d0bd383463 [comboot] Accept only ".cbt" as an extension for COMBOOT images
COMBOOT images are detected by looking for a ".com" or ".cbt" filename
extension.  There are widely-used files with a ".com" extension, such
as "wdsnbp.com", which are PXE images rather than COMBOOT images.

Avoid false detection of PXE images as COMBOOT images by accepting
only a ".cbt" extension as indicating a COMBOOT image.

Interestingly, this bug has been present for a long time but was
frequently concealed because the filename was truncated to fit the
fixed-length "name" field in struct image.  (PXE binaries ending in
".com" tend to be related to Windows deployment products and so often
use pathnames including backslashes, which iPXE doesn't recognise as a
path separator and so treats as part of a very long filename.)

Commit 1c127a6 ("[image] Simplify image management commands and
internal API") made the image name a variable-length field, and so
exposed this flaw in the COMBOOT image detection algorithm.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-13 22:14:57 +01:00
Michael Brown d97c6a321e [bzimage] Allow file mode to be specified for standalone initrd files
Allow the file mode to be specified using a "mode=" command line
parameter.  For example:

  initrd http://web/boot/bootlocal.sh /opt/bootlocal.sh mode=755

Requested-by: Bryce Zimmerman <bryce.zimmerman@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-08-03 02:29:34 +01:00
Michael Brown 1f88e9c8ea [romprefix] Round up PMM allocation sizes to nearest 4kB
Some AMI BIOSes apparently break in exciting ways when asked for PMM
allocations for sizes that are not multiples of 4kB.

Fix by rounding up the image source area to the nearest 4kB.  (The
temporary decompression area is already rounded up to the nearest
128kB, to facilitate sharing between multiple iPXE ROMs.)

Reported-by: Itay Gazit <itayg@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-25 14:37:43 +01:00
Thomas Miletich ced1493c02 [tg3] Fix excessive DMA alignment.
Change the DMA alignment from 4096 bytes to 16 bytes, to conserve
available DMA memory.  The hardware doesn't have any specific
alignment requirements.

Signed-off-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-24 15:50:11 +01:00
Michael Brown 183a70e8b7 [console] Sleep while waiting for user input
Reduce CPU usage while waiting for user input.  This is particularly
important for virtual machines, where CPU is a shared resource.

Reported-by: Alessandro Salvatori <alessandro@embrane.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-24 09:56:36 +01:00
Joshua Oreman fb7c022c2c [tcpip] Fix building under Cygwin
Cygwin's assembler treats '/' as a comment character.

Reported-by: Steve Goodrich <steve.goodrich@se-eng.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 23:20:56 +01:00
Thomas Miletich c70586f6e9 [build] Fix building under OpenBSD
Similarly to FreeBSD, OpenBSD requires the object format to be
specified as elf_i386_obsd rather than elf_i386.

Reported-by: Jiri B <jirib@devio.us>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 23:04:17 +01:00
Thomas Miletich acd74089f5 [vmware] Fix compilation under OpenBSD
Reported-by: Jiri B <jirib@devio.us>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 22:53:13 +01:00
Michael Brown 8cac5c0c92 [util] Update mergerom.pl to handle iPXE ROM header
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 18:05:01 +01:00
Michael Brown 5de45cd3da [romprefix] Report a pessimistic runtime size estimate
PCI3.0 allows us to report a "runtime size" which can be smaller than
the actual ROM size.  On systems that support PMM our runtime size
will be small (~2.5kB), which helps to conserve the limited option ROM
space.  However, there is no guarantee that the PMM allocation will
succeed, and so we need to report the worst-case runtime size in the
PCI header.

Move the "shrunk ROM size" field from the PCI header to a new "iPXE
ROM header", allowing it to be accessed by ROM-manipulation utilities
such as disrom.pl.

Reported-by: Anton D. Kachalov <mouse@yandex-team.ru>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 17:57:40 +01:00
Alexey 8f17955c03 [epic100] Fix wrong field used as rx packet length
Datasheet pp. 41-42 defines 'rx packet length' as upper word of
'status' dword field of the receive descriptor table.

  http://www.smsc.com/media/Downloads_Archive/discontinued/83c171.pdf

Tested on SMC EtherPower II.

Signed-off-by: Alexey Smazhenko <darkover@corbina.com.ua>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-23 13:22:43 +01:00
Michael Brown c3b4860ce3 [legal] Update FSF mailing address in GPL licence texts
Suggested-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:55:45 +01:00
Michael Brown 1ac62b914e [qib7322] Fix compiler warning on gcc 4.7
Originally-fixed-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 19:18:50 +01:00
Michael Brown a87c0c4f0f [isa] Avoid spurious compiler warning on gcc 4.7
gcc 4.7 produces a spurious warning about an array subscript being out
of bounds.  Use a pointer dereference instead of an array lookup to
inhibit this spurious warning.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 18:32:58 +01:00
Michael Brown 348ec33aee [build] Include git commit within version string when available
Originally-implemented-by: Christian Hesse <list@eworm.de>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 18:08:52 +01:00
Michael Brown b3b939c6ff [image] Automatically free autobooted images
Simplify the process of booting by ensuring that old images are not
left registered after an unsuccessful autoboot attempt.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 12:46:42 +01:00
Michael Brown 5d3c368efb [image] Add "--replace" option
Expose image tail-recursion to iPXE scripts via the "--replace"
option.  This functions similarly to exec() under Unix: the
currently-executing script is replaced with the new image (as opposed
to running the new image as a subroutine).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 12:45:15 +01:00
Michael Brown d3c660b671 [image] Add "--autofree" option
Allow images to be automatically freed after execution completes
(successfully or otherwise).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-20 12:44:40 +01:00
Michael Brown 23b70323c7 [libc] Add missing wchar.h header
Commit 58ed3b1 ("[libc] Add support for "%lc" and "%ls" format
specifiers") was missing a file.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:19:51 +01:00
Michael Brown d32aac88ef [skel] Add missing iounmap()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:13:52 +01:00
Michael Brown 76b4323b4d [myson] Add missing iounmap()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:12:41 +01:00
Michael Brown 93f1d69a77 [natsemi] Add missing iounmap()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:12:13 +01:00
Michael Brown e982a7e3c4 [realtek] Add missing iounmap()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:11:40 +01:00
Michael Brown ac8107854f [intel] Add missing iounmap()
Reported-by: Thomas Miletich <thomas.miletich@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 17:10:28 +01:00
Michael Brown 58ed3b1cee [libc] Add support for "%lc" and "%ls" format specifiers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 16:33:33 +01:00
Michael Brown 7ad6caf29f [efi] Add EFI_LOAD_FILE_PROTOCOL header
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 13:15:25 +01:00
Michael Brown bc41c6ef02 [efi] Update to current EDK2 headers
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 13:15:24 +01:00
Michael Brown 34576e5ff4 [efi] Standardise #include guard in ipxe_download.h
The script include/ipxe/efi/import.pl relies on a particular format
for the #include guard in order to detect EFI headers that are not
imported.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-19 13:15:24 +01:00
Michael Brown 9200049c80 [pxeprefix] Ignore errors from PXENV_FILE_CMDLINE
PXENV_FILE_CMDLINE is an iPXE extension, and will not be supported by
most PXE stacks.  Do not report any errors to the user, since in
almost all cases the error will mean simply "not loaded by iPXE".

Reported-by: Patrick Domack <patrickdk@patrickdk.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-18 18:19:25 +01:00
Michael Brown 2d7c966e77 [efi] Default to using raw x86 I/O
The EFI_CPU_IO_PROTOCOL is not available on all EFI platforms.  In
particular, it is not available under OVMF, as used for qemu.

Since the EFI_CPU_IO_PROTOCOL is an abomination of unnecessary
complexity, banish it and use raw I/O instead.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-17 21:30:18 +01:00
Michael Brown 4dc3f8141f [ioapi] Generalise i386 raw I/O API to x86
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-17 21:22:02 +01:00
Michael Brown 73ba154124 [b44] Eliminate call to get_memmap()
get_memmap() is not available under all runtime environments.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-17 21:22:02 +01:00
Michael Brown 88016deccf [pxe] Reopen network device if NBP exits
Attempt to restore the network device to the state it was in prior to
calling the NBP.  This simplifies the task of taking follow-up action
in an iPXE script.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-12 16:06:05 +01:00
Michael Brown c5c257788f [settings] Expose exit status of failed command via ${errno}
Allow scripts to report errors in more detail by exposing the most
recent error via the ${errno} setting.  For example:

    chain ${filename} || goto failed
    ...
    :failed
    imgfree http://192.168.0.1/ipxe_error.php?error=${errno}

Note that ${errno} is valid only immediately after executing a failed
command.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-12 15:46:24 +01:00
Michael Brown 5b4958388d [cmdline] Store exit status of failed command in errno
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-12 15:42:29 +01:00
Michael Brown e84e19d4ed [pxeprefix] Fetch command line (if any) via PXENV_FILE_CMDLINE
Use PXENV_FILE_CMDLINE to retrieve the command line (if any) provided
by the invoking PXE stack.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-11 21:26:53 +01:00
Michael Brown a814eff38e [pxe] Add PXENV_FILE_CMDLINE API call
Allow a PXE NBP to obtain its command line (if any) via the new PXE
API call PXENV_FILE_CMDLINE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2012-07-11 18:16:13 +01:00