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

4416 Commits

Author SHA1 Message Date
Michael Brown 15d2f947f5 [settings] Eliminate settings "tag magic"
Create an explicit concept of "settings scope" and eliminate the magic
values used for numerical setting tags.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 19:52:12 +01:00
Michael Brown b4ec6a6a68 [realtek] Defer packets when no transmit descriptors are available
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 14:07:51 +01:00
Michael Brown 2095ed413e [netdevice] Add netdev_tx_defer() to allow drivers to defer transmissions
Devices with small transmit descriptor rings may temporarily run out
of space.  Provide netdev_tx_defer() to allow drivers to defer packets
for retransmission as soon as a descriptor becomes available.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 14:05:42 +01:00
Michael Brown ab1e3ce0d7 [dhcp] Remove obsolete bootp.h header
Reported-by: Christian Helmuth <christian.helmuth@genode-labs.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 10:17:48 +01:00
Michael Brown 9b1ec3132f [realtek] Ensure EEPROM writes reach chip before starting udelay()
On some systems, it appears to be possible for writes to the EEPROM
registers to be delayed for long enough that the EEPROM's setup and
hold times are violated, resulting in invalid data being read from the
EEPROM.

Fix by inserting a PCI read cycle immediately after writes to
RTL_9346CR, to ensure that the write has completed before starting the
udelay() used to time the SPI bus transitions.

Reported-by: Gelip <mrgelip@gmail.com>
Tested-by: Gelip <mrgelip@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-05-01 09:21:56 +01:00
Michael Brown c6375a85be [romprefix] Report failure cause when unable to open payload
Report the cause of the failure when we are unable to open the .mrom
payload.  There are two possible failure cases:

 - Unable to find a suitable memory BAR to borrow (e.g. if the NIC
   doesn't have a memory BAR that is at least as large as the
   expansion ROM BAR, or if the memory BAR has been assigned a 64-bit
   address which won't fit into the 32-bit expansion ROM BAR).  This
   will be reported as "BABABABA".

 - Unable to find correct ROM image within the BAR.  This will be
   reported as the address (within the borrowed BAR) at which we first
   fail to find a valid 55AA signature.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-30 14:56:19 +01:00
Michael Brown 592755eccf [realtek] Allow reaction time between writing RTL_CAPR and reading RTL_CR
Some older RTL8139 chips seem to not immediately update the
RTL_CR.BUFE bit in response to a write to RTL_CAPR.  This results in
iPXE seeing a spurious zero-length received packet, and thereafter
being out of sync with the hardware's RX ring offset.

Fix by inserting an extra PCI read cycle after writing to RTL_CAPR, to
give the chip time to react before we next read RTL_CR.

Reported-by: Gelip <mrgelip@gmail.com>
Tested-by: Gelip <mrgelip@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-30 13:42:12 +01:00
Michael Brown e411b37eb1 [pxe] Convert external PXE API errors into iPXE platform-generated errors
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-29 19:58:25 +01:00
Michael Brown de1fafd2f8 [errdb] Strip platform error code for non-platform-generated errors
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-29 15:36:32 +01:00
Michael Brown d90fc3156c [realtek] Use ID word to detect EEPROM presence
Some onboard RTL8169 NICs seem to leave the EEPROM pins disconnected.
The existing is_valid_ether_addr() test will not necessarily catch
this, since it expects a missing EEPROM to show up as a MAC address of
00:00:00:00:00:00 or ff:ff:ff:ff:ff:ff.  When the EEPROM pins are
floating the MAC address may read as e.g. 00:00:00:00:0f:00, which
will not be detected as invalid.

Check the ID word in the first two bytes of the EEPROM (which should
have the value 0x8129 for all RTL8139 and RTL8169 chips), and use this
to determine whether or not an EEPROM is present.

Reported-by: Carl Karsten <carl@nextdayvideo.com>
Tested-by: Carl Karsten <carl@nextdayvideo.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 18:59:09 +01:00
Michael Brown 1aca99f3cf [build] Default to short wchar_t in stddef.h
sparse does not understand -fshort-wchar.  Default to using uint16_t
as a wchar_t if not explicitly specified by the compiler, to avoid
large numbers of spurious warnings from sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 17:43:37 +01:00
Michael Brown 4678864ce6 [build] Fix dubious uses of bitwise operators
Detected by sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 17:31:23 +01:00
Michael Brown b9663b8049 [build] Fix uses of literal 0 as a NULL pointer
Detected using sparse.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 17:13:44 +01:00
Michael Brown e5cbfefdf3 [build] Use -Wno-decl when running sparse
Linker table entries must be non-static in order to avoid being
completely optimised away by some versions of gcc.  Use -Wno-decl to
prevent sparse from warning about these, since the alternative would
be to litter the code with otherwise unnecessary "extern"
declarations.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-28 16:43:32 +01:00
Michael Brown 2e54c4b52e [realtek] Print bad MAC address in debug message when inferring no EEPROM
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-27 21:24:10 +01:00
Michael Brown d91ccde9e5 [process] Mark process descriptor as static in PERMANENT_PROCESS
There is no need for the process descriptor to be a global variable.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 15:15:43 +01:00
Michael Brown eaa0f47dc2 [build] Avoid sparse undeclared symbol warning for PROVIDE_SYMBOL()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 15:14:59 +01:00
Michael Brown 39ab88ac09 [build] Allow sparse to be invoked via "make C=1"
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 14:56:48 +01:00
Michael Brown f85af68ac5 [build] Define __WINT_TYPE__ if necessary
sparse does not define __WCHAR_TYPE__ or __WINT_TYPE__.  We already
define __WCHAR_TYPE__ if the compiler does not do so; do the same for
__WINT_TYPE__.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 14:52:01 +01:00
Michael Brown 5b9ce33c5c [build] Allow sparse to find compiler.h
sparse seems to have problems finding compiler.h when specified as
"-include compiler.h"; one possible explanation is that it ignores the
include path.  Fix by using "-include include/compiler.h".

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-25 13:45:41 +01:00
Michael Brown 445ac9fbdc [netdevice] Use link-layer address as part of RNG seed
iPXE currently seeds the random number generator using the system
timer tick count.  When large numbers of machines are booted
simultaneously, multiple machines may end up choosing the same DHCP
transaction ID (XID) value; this can cause problems.

Fix by using the least significant (and hence most variable) bits of
each network device's link-layer address to perturb the random number
generator.  This introduces some per-machine unique data into the
random number generator's seed, and so reduces the chances of DHCP XID
collisions.

This does not affect the ANS X9.82-compatible random bit generator
used by TLS and other cryptography code, which uses an entirely
separate source of entropy.

Originally-implemented-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 14:34:03 +01:00
Michael Brown 9cb60c8a21 [efi] Add sample platform-generated error disambiguations
Add disambiguated errors for LoadImage() and StartImage(), primarily
to demonstrate how to use __einfo_uniqify() and __einfo_platformify()
in the context of EFI platform errors.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 13:34:19 +01:00
Michael Brown 54409583e2 [efi] Perform meaningful error code conversions
Exploit the redefinition of iPXE error codes to include a "platform
error code" to allow for meaningful conversion of EFI_STATUS values to
iPXE errors and vice versa.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 13:34:19 +01:00
Michael Brown 7348035231 [libc] Redefine low 8 bits of error code as "platform error code"
The low 8 bits of an iPXE error code are currently defined as the
closest equivalent PXE error code.  Generalise this scheme to
platforms other than PC-BIOS by extending this definition to "closest
equivalent platform error code".  This allows for the possibility of
returning meaningful errors via EFI APIs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 13:34:13 +01:00
Michael Brown e42bc3aa37 [libc] Use __einfo() tuple as first argument to EUNIQ()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 00:45:13 +01:00
Michael Brown 0f7b3fa6f9 [efi] Remove obsolete EFI I/O implementation using EFI_CPU_IO_PROTOCOL
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-19 00:45:13 +01:00
Michael Brown cdca99f068 [intel] Add intelx driver for Intel 10 Gigabit Ethernet NICs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-18 23:56:06 +01:00
Michael Brown 1dd4e51063 [intel] Expose functionality to be shared with intelx driver
The Intel 10 Gigabit NICs have a datapath that is almost
register-compatible with the Intel 1 Gigabit NICs.  Expose common
functionality to avoid duplication of code in the new "intelx" driver.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-18 23:56:05 +01:00
Michael Brown c2ba57e517 [intel] Remove hardcoded offsets for descriptor ring registers
The Intel 10 Gigabit NICs use the same simplified (aka "legacy")
descriptor format and the same layout for descriptor register blocks
as the Intel 1 Gigabit NICs.  The offsets of the descriptor register
blocks are not the same.

Simplify reuse of the existing code by removing all hardcoded offsets
for registers within descriptor register blocks, and ensuring that all
offsets are calculated using the descriptor register block base
address provided via intel_init_ring().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-18 23:56:05 +01:00
Michael Brown 9909e7b10a [bios] Fix screen clearing on buggy BIOSes
The implementation of INT 10,06 on some BIOSes (observed with both
Hyper-V and a Dell OptiPlex 7010) seems to treat %dx=0xffff as a
special value meaning "do absolutely nothing".  Fix by using
%dx=0xfefe, which should still be sufficient to cover any realistic
screen size.

Reported-by: John Clark <skyman@iastate.edu>
Tested-by: John Clark <skyman@iastate.edu>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-17 19:36:03 +01:00
Michael Brown 0e2ba15a58 [settings] Expose build architecture and platform via settings
Expose the build architecture (e.g. "i386" or "x86_64") via
${buildarch} and the firmware platform (e.g. "pcbios" or "efi") via
${platform}.  These settings directly expose the ARCH and PLATFORM
variables from the Makefile.

Note that the build architecture reflects the architecture for which
iPXE was compiled, not the architecture on which iPXE is currently
running.  The "cpuid" command can be used to detect a 64-bit system at
runtime.

Requested-by: James A. Peltier <jpeltier@sfu.ca>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-04-06 11:33:34 +01:00
Michael Brown 6979b7a2d3 [efi] Fetch device path for loaded image during initialisation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-27 21:23:21 +00:00
Michael Brown 8a49782eeb [prism2] Use standard type names
Avoid using UINT16 and similar typedefs, which are non-standard in the
iPXE codebase and generate conflicts when trying to include any of the
EFI headers.

Also fix trailing whitespace in the affected files, to prevent
complaints from git.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-27 15:16:52 +00:00
Michael Brown dab7910beb [igbvf] Remove conflicting macro definitions
Remove macros which aren't used anywhere in the driver, and which
conflict with macros of the same name used in the EFI headers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-25 22:24:26 +00:00
Michael Brown b2c9730da7 [cs89x0] Remove conflicting macro definitions
Remove macros which aren't used anywhere in the driver, and which
conflict with macros of the same name used in the EFI headers.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-25 22:23:04 +00:00
Michael Brown 9f75ee9ddb [efi] Enable "cpuid" command by default for EFI
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-22 13:58:54 +00:00
Michael Brown e68a6ca225 [cmdline] Add ability to perform a warm reboot
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-22 13:54:44 +00:00
Michael Brown 71cd508838 [efi] Add "reboot" command for EFI
Abstract out the ability to reboot the system to a separate reboot()
function (with platform-specific implementations), add an EFI
implementation, and make the existing "reboot" command available under
EFI.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-22 13:44:02 +00:00
Bo Yang 11ad0bafbf [build] Avoid strict-aliasing warning for gcc 4.3
Signed-off-by: Bo Yang <boyang@suse.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-21 13:54:44 +00:00
Michael Brown 1920aa4376 [efi] Provide efi_guid_ntoa() for printing EFI GUIDs
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 15:25:16 +00:00
Michael Brown d938e50136 [uuid] Abstract UUID mangling code out to a separate uuid_mangle() function
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 15:06:40 +00:00
Michael Brown a9b63ecda5 [dhcp] Use PXE byte ordering for UUID in DHCP option 97
The PXE spec does not specify a byte ordering for UUIDs, but RFC4578
suggests that it follows the EFI spec, in which the first three fields
are little-endian.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 00:54:42 +00:00
Michael Brown 9e896d0eea [smbios] Mangle UUIDs for SMBIOS version 2.6 and newer
iPXE treats UUIDs as being in network byte order (big-endian).  The
SMBIOS specification version 2.6 states that UUIDs are stored with
little-endian values in the first three fields; earlier versions did
not specify an endianness.  This results in some inconsistency between
the BIOS, vendor PXE, iPXE, and operating system interpretations of
the SMBIOS UUID.

dmidecode assumes that the byte order is little-endian if and only if
the SMBIOS version is 2.6 or higher.  Choose to match this behaviour.

Reported-by: Matthew Helton <mwhelton@gmail.com>
Reported-by: Alexandru Bordei <alexandru.bordei@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 00:19:42 +00:00
Michael Brown 4f742bcd95 [smbios] Provide SMBIOS version number via smbios_version()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-20 00:12:30 +00:00
Michael Brown 2ec0c1ea48 [int13] Split out ISO9660 and El Torito definitions to separate header files
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-19 23:21:15 +00:00
Michael Brown 6b9b44319f [efi] Add EFI-specific debugging macros
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-19 23:21:15 +00:00
Michael Brown e05dcf0e01 [efi] Fix minor typos in efi_image.c
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-19 23:21:15 +00:00
Michael Brown 747e9eb6f3 [lkrnprefix] Allow relocation when no initrd is present
Commit 2629b7e ("[pcbios] Inhibit all calls to INT 15,e820 and INT
15,e801 during POST") introduced a regression into .lkrn images when
used with no corresponding initrd.

Specifically, the semantics of the "maximum address for relocation"
value passed to install_prealloc() in %ebp changed so that zero became
a special value meaning "inhibit use of INT 15,e820 and INT 15,e801".
The %ebp value meaing "no upper limit on relocation" was changed from
zero to 0xffffffff, and all prefixes providing fixed values for %ebp
were updated to match the new semantics.

The .lkrn prefix provides the initrd base address as the maximum
address for relocation.  When no initrd is present, this address will
be zero, and so will unintentionally trigger the "inhibit INT 15,e820
and INT 15,e801" behaviour.

Fix by explicitly setting %ebp to 0xffffffff if no initrd is present
before calling install_prealloc().

Reported-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Tested-by: Ján ONDREJ (SAL) <ondrejj@salstar.sk>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2013-03-15 15:34:50 +00:00
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