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

5057 Commits

Author SHA1 Message Date
Michael Brown 334eed0cb5 [build] Remove unused __keepme macro
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 16:08:39 +00:00
Michael Brown 30d356b455 [build] Remove unused IMPORT_SYMBOL() and EXPORT_SYMBOL() macros
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 15:51:33 +00:00
Michael Brown b2f38da888 [malloc] Rewrite unrelicensable portions of malloc.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 15:24:15 +00:00
Michael Brown 5f3d165232 [malloc] Move valgrind headers out of arch/x86
The valgrind headers are not x86-specific; they detect the CPU
architecture and contain inline assembly for multiple architectures.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 14:25:51 +00:00
Michael Brown ad2e82a65b [settings] Use generic jump scrolling abstraction
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 03:51:08 +00:00
Michael Brown 58752cc10d [menu] Abstract out the generic concept of a jump scroller
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 02:47:37 +00:00
Michael Brown 70124dd3be [settings] Rewrite unrelicensable portions of settings.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 00:42:25 +00:00
Michael Brown 0af3d14a23 [settings] Use list_first_entry() when unregistering child settings
Unregistering a child settings block can have almost arbitrary
effects, due to the call to apply_settings().  Avoid potentially
dereferencing a stale pointer by using list_first_entry() rather than
list_for_each_entry_safe() to iterate over the list of child settings.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 00:29:42 +00:00
Michael Brown e399fc0d21 [pci] Rewrite unrelicensable portions of pci.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-03 00:08:41 +00:00
Michael Brown 06c8a27b74 [pci] Remove outdated and mostly-unused pci_ids.h file
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 21:37:45 +00:00
Michael Brown c1ac466838 [iscsi] Rewrite unrelicensable portions of iscsi.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 20:40:31 +00:00
Michael Brown 2d707ac964 [list] Relicense list.h
The code in list.h was originally taken from the Linux kernel many
years ago, but has been rewritten to the point that no original code
remains, and may therefore be relicensed.

The functions and data structures remain largely API-compatible, to
facilitate the conversion of Linux network drivers to iPXE.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 19:47:32 +00:00
Michael Brown 350768d4b4 [elf] Rewrite ELF header
Rewrite the ELF header to include only the relevant portions from the
ELF specification.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 19:42:48 +00:00
Michael Brown 01d16d821f [libc] Rewrite byte-swapping code
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:37 +00:00
Michael Brown 8ab4b00442 [libc] Rewrite setjmp() and longjmp()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:37 +00:00
Michael Brown d1f0e89e4e [libc] Rewrite unrelicensable portions of ctype.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:37 +00:00
Michael Brown 5d1f351278 [libc] Rewrite unrelicensable portions of stddef.h
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:37 +00:00
Michael Brown 2f020a8df3 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
These files cannot be automatically relicensed by util/relicense.pl
since they either contain unusual but trivial contributions (such as
the addition of __nonnull function attributes), or contain lines
dating back to the initial git revision (and so require manual
knowledge of the code's origin).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 16:35:29 +00:00
Michael Brown 626ccf76ea [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicence files with kind permission from the following contributors:

  Alex Williamson <alex.williamson@redhat.com>
  Eduardo Habkost <ehabkost@redhat.com>
  Greg Jednaszewski <jednaszewski@gmail.com>
  H. Peter Anvin <hpa@zytor.com>
  Marin Hannache <git@mareo.fr>
  Robin Smidsrød <robin@smidsrod.no>
  Shao Miller <sha0.miller@gmail.com>
  Thomas Horsten <thomas@horsten.com>

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:50:42 +00:00
Michael Brown e24be567f4 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicense files authored by Dan Lynch while working as an employee of
Fen Systems Ltd., with permission from Fen Systems Ltd.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:17:31 +00:00
Michael Brown b6ee89ffb5 [legal] Relicense files under GPL2_OR_LATER_OR_UBDL
Relicense files for which I am the sole author (as identified by
util/relicense.pl).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:17:31 +00:00
Michael Brown d454d98d35 [legal] Add UBDL relicensing tool
The UBDL relicensing tool (util/relicense.pl) is designed to identify
files which may be relicensed under a dual GPL+UBDL licence.  It uses
git-blame to identify the author of each line (using the -M and -C
options to track lines moved or copied between files), and relicenses
files for which all authors have given permission.

The relicensing tool will ignore certain types of lines identified by
git-blame:

 - empty lines
 - comments
 - standalone opening or closing braces
 - "#include ..."
 - "return 0;"
 - "return rc;"
 - "PCI_ROM(...)"
 - "FILE_LICENCE(...)"

These lines either contain no meaningful content (e.g. empty lines),
contain only non-copyrightable facts (e.g. PCI ROM IDs) or are
sufficiently common within the codebase that git-blame is likely to
misattribute their origin (e.g. "return 0").

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 14:17:24 +00:00
Michael Brown 2782ccec41 [legal] Add support for the Unmodified Binary Distribution Licence
Add the text for the Unmodified Binary Distribution Licence.  This
Licence allows for the distribution of unmodified binaries built from
publicly available source code, without imposing the obligations of
the GNU General Public License upon anyone who chooses to distribute
only the unmodified binaries built from that source code.  See the
licence text for the precise terms and conditions.

Add the licence GPL2_OR_LATER_OR_UBDL to the set of licences which can
be declared using FILE_LICENCE(), and add the corresponding support to
licence.pl.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 12:07:14 +00:00
Michael Brown 7aa689e3ba [mucurses] Add missing FILE_LICENCE declarations
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-03-02 12:07:14 +00:00
Michael Brown 5e95a79241 [legal] Include full licence text for all GPL2_OR_LATER files
Add the standard warranty disclaimer and Free Software Foundation
address paragraphs to the licence text where these are not currently
present.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 17:59:53 +00:00
Michael Brown f57743f259 [legal] Update GPLv2 licence text
Update the GPLv2 licence text to the current version (with the current
address of the Free Software Foundation, and without the Y2k
compatibility issue).

Rename the GPLv2 licence text to COPYING.GPLv2 (to hopefully make it
clearer that the licence does not apply to all files within the source
tree) and rename COPYRIGHTS to COPYING.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 17:59:53 +00:00
Michael Brown 4c3b9c79a5 [zbin] Remove now-unused unnrv2b.S decompressor
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 17:59:53 +00:00
Robin Smidsrød 40c699a181 [vbox] Enable some more features now that we have LZMA compression
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 15:00:36 +00:00
Michael Brown ea3be0f4a6 [zbin] Fix check for existence of most recent output byte
The code in lzma_literal() checks to see if we are at the start of the
compressed input data in order to determine whether or not a most
recent output byte exists.  This check is incorrect, since
initialisation of the decompressor will always consume the first five
bytes of the compressed input data.

Fix by instead checking whether or not we are at the start of the
output data stream.  This is, in any case, a more logical check.

This issue was masked during development and testing since virtual
machines tend to zero the initial contents of RAM; the spuriously-read
"most recent output byte" is therefore likely to already be a zero
when running in a virtual machine.

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 13:01:55 +00:00
Michael Brown c11306e6ca [zbin] Allow decompressor to generate debug output via BIOS console
The 0xe9 debug port exists only on virtual machines.  Provide an
option to print debug output on the BIOS console, to allow for
debugging on real hardware.

Note that this option can be used only if the decompressor is called
in flat real mode; the easiest way to achieve this is to build with
DEBUG=libprefix.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 12:59:08 +00:00
Michael Brown 93178adb98 [prefix] Call decompressor in flat real mode when DEBUG=libprefix is enabled
Allow the decompressor the option of generating debugging output via
the BIOS console by calling it in flat real mode (rather than 16-bit
protected mode) when libprefix.S is built with debugging enabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 12:56:07 +00:00
Michael Brown 9cdf68a219 [zbin] Perform extra normalisation after completing decompression
LZMA performs an extra normalisation after decompression is complete,
which does not affect the output but may consume an extra byte from
the input (and so may affect which byte is identified as being the
start of the next block).

Reported-by: Robin Smidsrød <robin@smidsrod.no>
Tested-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-26 09:54:05 +00:00
Alex Williamson 47aebc24d3 [dhcp] Extract timing parameters out to config/dhcp.h
iPXE uses DHCP timeouts loosely based on values recommended by the
specification, but often abbreviated to reduce timeouts for reliable
and/or simple network topologies.  Extract the DHCP timing parameters
to config/dhcp.h and document them.  The resulting default iPXE
behavior is exactly the same, but downstreams are now afforded the
opportunity to implement spec-compliant behavior via config file
overrides.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-25 16:58:43 +00:00
Michael Brown 5350b65a3c [zbin] Use LZMA compression
LZMA provides significantly better compression (by ~15%) than the
current NRV2B algorithm.

We use a raw LZMA stream (aka LZMA1) to avoid the need for code to
parse the LZMA2 block headers.  We use parameters {lc=2,lp=0,pb=0} to
reduce the stack space required by the decompressor to acceptable
levels (around 8kB).  Using lc=3 or pb=2 would give marginally better
compression, but at the cost of substantially increasing the required
stack space.

The build process now requires the liblzma headers to be present on
the build system, since we do not include a copy of an LZMA compressor
within the iPXE source tree.  The decompressor is written from scratch
(based on XZ Embedded) and is entirely self-contained within the
iPXE source.

The branch-call-jump (BCJ) filter used to improve the compressibility
is specific to iPXE.  We choose not to use liblzma's built-in BCJ
filter since the algorithm is complex and undocumented.  Our BCJ
filter achieves approximately the same results (on typical iPXE
binaries) with a substantially simpler algorithm.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-25 14:06:13 +00:00
Michael Brown 3e04f0791e [prefix] Use .bss16 as temporary stack space for calls to install_block
Some decompression algorithms (e.g. LZMA) require large amounts of
temporary stack space, which may not be made available by all
prefixes.  Use .bss16 as a temporary stack for the duration of the
calls to install_block (switching back to the external stack before we
start making calls into code which might access variables in .bss16),
and allow the decompressor to define a global symbol to force a
minimum value on the size of .bss16.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-24 16:33:14 +00:00
Michael Brown b6889eaa1e [hyperv] Check for required features
Other hypervisors (e.g. KVM) may provide an unusable subset of the
Hyper-V features, and our attempts to use these non-existent features
cause the guest to reboot.

Fix by explicitly checking for the Hyper-V features that we use.

Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-20 11:00:52 +00:00
Michael Brown a32b1e9e35 [libc] Rewrite strtoul()
The implementation of strtoul() has a partially unknown provenance.
Rewrite this code to avoid potential licensing uncertainty.

Since we now use -ffunction-sections, there is no need to place
strtoull() in a separate file from strtoul().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-19 16:00:01 +00:00
Michael Brown bb1abb2b21 [ipv4] Rewrite inet_aton()
The implementation of inet_aton() has an unknown provenance.  Rewrite
this code to avoid potential licensing uncertainty.

Also move the code from core/misc.c to its logical home in net/ipv4.c,
and add a few extra test cases.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-19 14:02:07 +00:00
Michael Brown 095c007aa3 [legal] Add missing copyright header to net/ipv4.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 14:16:59 +00:00
Michael Brown b05e7e50fa [test] Add IPv4 self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 14:11:32 +00:00
Michael Brown 645458e5a0 [xhci] Abort commands on timeout
When a command times out, abort it (via the Command Abort bit in the
Command Ring Control Register) so that subsequent commands may execute
as expected.

This improves robustness when a device fails to respond to the Set
Address command, since the subsequent Disable Slot command will now
succeed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 11:10:55 +00:00
Michael Brown 88448de720 [xhci] Leak memory if controller fails to disable slot
If the Disable Slot command fails then the hardware may continue to
write to the slot context.  Leak the memory used by the slot context
to avoid future memory corruption.

This situation has been observed in practice when a Set Address
command fails, causing the command ring to become temporarily
unresponsive.

Note that there is no need to similarly leak memory on the failure
path in xhci_device_open(), since in the event of a failure the
hardware is never informed of the slot context address.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-18 09:32:50 +00:00
Michael Brown 08189df4e0 [timer] Rewrite the 8254 Programmable Interval Timer support
The 8254 timer code (used to implement udelay()) has an unknown
provenance.  Rewrite this code to avoid potential licensing
uncertainty.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 16:24:02 +00:00
Michael Brown 320e786d3d [ncm] Use generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:54 +00:00
Michael Brown 5b9b5ced4e [ecm] Use generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:54 +00:00
Michael Brown a92fb8d9a5 [usb] Add generic USB network device framework
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 01:21:53 +00:00
Michael Brown 21d3d5c47c [libc] Reduce size of memset()
As with memcpy(), we can reduce the code size (by an average of 0.2%)
by giving the compiler more visibility into what memset() is doing,
and by avoiding the "rep" prefix on short fixed-length sequences of
string operations.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 00:42:28 +00:00
Michael Brown 7867e48cee [test] Add constant-length memset() self-tests
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-17 00:41:40 +00:00
Michael Brown cd8273b308 [test] Add self-tests for more string functions
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-16 23:16:20 +00:00
Michael Brown 8ee39f7432 [libc] Rewrite string functions
Some of the C library string functions have an unknown provenance.
Reimplement all such functions to avoid potential licensing
uncertainty.

Remove the inline-assembler versions of strlen(), memswap(), and
strncmp(); these save a minimal amount of space (around 40 bytes in
total) and are not performance-critical.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2015-02-16 23:16:20 +00:00