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

916 Commits

Author SHA1 Message Date
Michael Brown 53f273af90 [resolv] Use pass-through interfaces for name resolution multiplexer
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-06 11:43:22 +01:00
Michael Brown 4674df25ef [monojob] Display job status message, if present
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown a258b0897b [downloader] Allow underlying downloads to provide detailed job progress
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown 7e6b367b7e [monojob] Check for job progress only once per timer tick
Checking for job progress is essentially a user interface activity,
and can safely be performed only once per timer tick (as is already
done with checking for keypresses).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-05 23:23:22 +01:00
Michael Brown 42eedb04c1 [malloc] Avoid false positive warnings from valgrind
Calling discard_cache() is likely to result in a call to
free_memblock(), which will call valgrind_make_blocks_noaccess()
before returning.  This causes valgrind to report an invalid read on
the next iteration through the loop in alloc_memblock().

Fix by explicitly calling valgrind_make_blocks_defined() after
discard_cache() returns.  Also call valgrind_make_blocks_noaccess()
before calling discard_cache(), to guard against free list corruption
while executing cache discarders.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-09-04 14:09:17 +01:00
Michael Brown 51a79731f6 [acpi] Fix spurious uninitialised-variable warning on some gcc versions
Reported-by: Christian Nilsson <nikize@gmail.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-07-28 20:19:31 +01:00
Laurent Gourvénec 041d362423 [acpi] Compute and check checksum for ACPI tables
Modified-by: Michael Brown <mcb30@ipxe.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-07-28 17:05:33 +01:00
Michael Brown 1fdf4dddbd [syslog] Handle backspace characters
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-06-13 11:54:41 +01:00
Michael Brown 356f6c1b64 [acpi] Expose ACPI tables via settings mechanism
Allow values to be read from ACPI tables using the syntax

  ${acpi/<signature>.<index>.0.<offset>.<length>}

where <signature> is the ACPI table signature as a 32-bit hexadecimal
number (e.g. 0x41504093 for the 'APIC' signature on the MADT), <index>
is the index into the array of tables matching this signature,
<offset> is the byte offset within the table, and <length> is the
field length in bytes.

Numeric values are returned in reverse byte order, since ACPI numeric
values are usually little-endian.

For example:

  ${acpi/0x41504943.0.0.0.0}           - entire MADT table in raw hex
  ${acpi/0x41504943.0.0.0x0a.6:string} - MADT table OEM ID
  ${acpi/0x41504943.0.0.0x24.4:uint32} - local APIC address

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-05-23 18:48:06 +01:00
Michael Brown 933e6dadc0 [acpi] Make acpi_find_rsdt() a per-platform method
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-05-23 18:34:39 +01:00
Michael Brown ee9897fe64 [settings] Extend numerical setting tags to 64 bits
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-05-22 13:54:13 +01:00
Michael Brown 648657b776 [block] Provide abstraction to allow system to be quiesced
When performing a SAN boot via INT 13, there is no way for the
operating system to indicate that it has finished using the INT 13 SAN
device.  We therefore have no opportunity to clean up state before the
loaded operating system's native drivers take over.  This can cause
problems when booting Windows, which tends not to be forgiving of
unexpected system state.

Windows will typically write a flag to the SAN device as the last
action before transferring control to the native drivers.  We can use
this as a heuristic to bring the system to a quiescent state (without
performing a full shutdown); this provides us an opportunity to
temporarily clean up state that could otherwise prevent a successful
Windows boot.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-04-26 20:15:39 +01:00
Michael Brown dd976cb50d [block] Provide sandev_read() and sandev_write() as global symbols
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-04-26 20:15:39 +01:00
Michael Brown 84d406ccf4 [block] Allow use of a non-default EFI SAN boot filename
Some older operating systems (e.g. RHEL6) use a non-default filename
on the root disk and rely on setting an EFI variable to point to the
bootloader.  This does not work when performing a SAN boot on a
machine where the EFI variable is not present.

Fix by allowing a non-default filename to be specified via the
"sanboot --filename" option or the "san-filename" setting.  For
example:

  sanboot --filename \efi\redhat\grub.efi \
          iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6

or

  option ipxe.san-filename code 188 = string;
  option ipxe.san-filename "\\efi\\redhat\\grub.efi";
  option root-path "iscsi:192.168.0.1::::iqn.2010-04.org.ipxe.demo:rhel6";

Originally-implemented-by: Vishvananda Ishaya Abrams <vish.ishaya@oracle.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-04-12 15:58:05 +01:00
Michael Brown 7cfdd769aa [block] Describe all SAN devices via ACPI tables
Describe all SAN devices via ACPI tables such as the iBFT.  For tables
that can describe only a single device (i.e. the aBFT and sBFT), one
table is installed per device.  For multi-device tables (i.e. the
iBFT), all devices are described in a single table.

An underlying SAN device connection may be closed at the time that we
need to construct an ACPI table.  We therefore introduce the concept
of an "ACPI descriptor" which enables the SAN boot code to maintain an
opaque pointer to the underlying object, and an "ACPI model" which can
build tables from a list of such descriptors.  This separates the
lifecycles of ACPI descriptions from the lifecycles of the block
device interfaces, and allows for construction of the ACPI tables even
if the block device interface has been closed.

For a multipath SAN device, iPXE will wait until sufficient
information is available to describe all devices but will not wait for
all paths to connect successfully.  For example: with a multipath
iSCSI boot iPXE will wait until at least one path has become available
and name resolution has completed on all other paths.  We do this
since the iBFT has to include IP addresses rather than DNS names.  We
will commence booting without waiting for the inactive paths to either
become available or close; this avoids unnecessary boot delays.

Note that the Linux kernel will refuse to accept an iBFT with more
than two NIC or target structures.  We therefore describe only the
NICs that are actually required in order to reach the described
targets.  Any iBFT with at most two targets is therefore guaranteed to
describe at most two NICs.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-28 19:12:48 +03:00
Michael Brown 414b4fc9c5 [block] Ignore redundant xfer_window_changed() messages
For some block device protocols, the active path may continue to
receive xfer_window_changed() notifications during normal use.  These
currently result in the active path being erroneously closed.

Fix by ignoring any xfer_window_changed() messages if this path is
already the active path.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-28 19:02:38 +03:00
Michael Brown 539088a27b [block] Gracefully close SAN device if registration fails
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 16:57:40 +03:00
Michael Brown ee35b03583 [block] Retry reopening indefinitely for multipath devices
For multipath SAN devices, verify that the device is capable of being
opened (i.e. that all URIs are parseable and that at least one path is
alive) and thereafter retry indefinitely to reopen the device as
needed.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 15:41:22 +03:00
Michael Brown 164378fee6 [block] Add a small delay between attempts to reopen SAN targets
When all SAN targets are completely unreachable, there will be a
natural delay between reopening attempts due to the network connection
timeout on the unreachable targets.

However, some SAN targets may accept connections instantly and report
a temporary unavailability by e.g. failing the TEST UNIT READY
command.  If all targets are behaving this way then there will be no
natural delay, and we will attempt to saturate the network with
connection attempts.

Fix by introducing a small delay between attempts.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 15:41:22 +03:00
Michael Brown 6b385c9da3 [block] Allow SAN retry count to be reconfigured
Allow the SAN retry count to be configured via the ${san-retry}
setting, defaulting to the current value of 10 retries if not
specified.

Note that setting a retry count of zero is inadvisable, since iSCSI
targets in particular will often report spurious errors such as "power
on occurred" for the first few commands.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 15:41:22 +03:00
Michael Brown 6bd0060f26 [time] Add sleep_fixed() function to sleep without checking for Ctrl-C
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 15:41:22 +03:00
Michael Brown bb5a54b79a [block] Add basic multipath support
Add basic support for multipath block devices.  The "sanboot" and
"sanhook" commands now accept a list of SAN URIs.  We open all URIs
concurrently.  The first connection to become available for issuing
block device commands is marked as the active path and used for all
subsequent commands; all other connections are then closed.  Whenever
the active path fails, we reopen all URIs and repeat the process.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-26 16:06:02 +03:00
Michael Brown c212597336 [block] Add dummy SAN device
Add a dummy SAN device which allows the "sanhook" command to be tested
even when no SAN booting capability is present on the platform.  This
allows substantial portions of the SAN boot code to be run in Linux
under Valgrind.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-26 16:03:29 +03:00
Michael Brown c90b4d82b7 [malloc] Track maximum heap usage
Track the current and maximum heap usage, and display the maximum
during shutdown when DEBUG=malloc is enabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 20:01:25 +02:00
Michael Brown 966a960a83 [pixbuf] Avoid potential division by zero
Avoid potential division by zero when performing the check against
multiplication overflow.  (Note that if the width is zero then there
can be no overflow anyway, so it is then safe to bypass the check.)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 14:11:19 +02:00
Michael Brown e846bd22c3 [block] Quell spurious Coverity size mismatch warning
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 11:45:28 +02:00
Michael Brown 91372d6dab [xfer] Ensure va_end() is called on failure path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 13:38:39 +02:00
Michael Brown de2c6fa240 [dhcp] Allow vendor class to be changed in DHCP requests
Allow the DHCPv4 vendor class to be specified via the "vendor-class"
setting.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-20 13:58:59 +02:00
Michael Brown 9423a85f71 [block] Use intfs_shutdown() when shutting down multiple interfaces
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-09 12:16:56 +00:00
Michael Brown d9886f1961 [block] Retry any SAN device operation
The SCSI layer currently implements a retry loop in order to retry
commands that fail due to spurious "error" conditions such as "power
on occurred".  Move this retry loop to the generic SAN device layer:
this allow for retries due to other transient error conditions such as
an iSCSI target having dropped the connection due to inactivity.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-07 16:11:22 +00:00
Michael Brown e7ee2eda4b [block] Centralise "san-drive" setting
The concept of the SAN drive number is meaningful only in a BIOS
environment, where it represents the INT13 drive number (0x80 for the
first hard disk).  We retain this concept in a UEFI environment to
allow for a simple way for iPXE commands to refer to SAN drives.

Centralise the concept of the default drive number, since it is shared
between all supported environments.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-07 13:40:35 +00:00
Michael Brown 4adc7b0290 [block] Centralise SAN device abstraction
Create a central SAN device abstraction to be shared between BIOS and
UEFI.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-07 13:40:35 +00:00
Michael Brown 23b788e5cd [interface] Provide the ability to shut down multiple interfaces
Shutting down (and optionally restarting) multiple interfaces is
fraught with problems if there are loops in the interface connectivity
(e.g. the HTTP content-decoded and transfer-decoded interfaces, which
will generally loop back to each other).  Various workarounds
currently exist across the codebase, generally involving preceding
calls to intf_nullify() to avoid problems due to known loops.

Provide intfs_shutdown() and intfs_restart() to allow all of an
object's interfaces to be shut down (or restarted) in a single call,
without having to worry about potential external loops.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-02-02 15:49:21 +00:00
Michael Brown a8f80a75d2 [time] Report attempts to use timers before initialisation
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-02-01 15:30:41 +00:00
Michael Brown 41f786cc0a [settings] Add "unixtime" builtin setting to expose the current time
Expose the current wall-clock time (in seconds since the Epoch), since
this is often useful in captured boot logs and can also be useful when
checking unexpected X.509 certificate validation failures.

Use a :uint32 setting to avoid Y2K38 rollover, thereby ensuring that
this will eventually be somebody else's problem.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-26 12:26:54 +00:00
Michael Brown 302f1eeb80 [time] Allow timer to be selected at runtime
Allow the active timer (providing udelay() and currticks()) to be
selected at runtime based on probing during the INIT_EARLY stage of
initialisation.

TICKS_PER_SEC is now a fixed compile-time constant for all builds, and
is independent of the underlying clock tick rate.  We choose the value
1024 to allow multiplications and divisions on seconds to be converted
to bit shifts.

TICKS_PER_MS is defined as 1, allowing multiplications and divisions
on milliseconds to be omitted entirely.  The 2% inaccuracy in this
definition is negligible when using the standard BIOS timer (running
at around 18.2Hz).

TIMER_RDTSC now checks for a constant TSC before claiming to be a
usable timer.  (This timer can be tested in KVM via the command-line
option "-cpu host,+invtsc".)

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-26 08:17:37 +00:00
Michael Brown f450c75dad [interface] Unplug interface before calling intf_close() in intf_shutdown()
The call to intf_close() may result in the original interface being
reopened.  For example: when reading the capacity of a 2TB+ disk via
iSCSI, the SCSI layer will respond to the intf_close() from the READ
CAPACITY (10) command by immediately issuing a READ CAPACITY (16)
command.  The iSCSI layer happens to reuse the same interface for the
new command (since it allows only a single concurrent command).

Currently, intf_shutdown() unplugs the interface after the call to
intf_close() returns.  In the above scenario, this results in
unplugging the just-reopened interface.

Fix by transferring the interface destination (and its reference) to a
temporary interface, and so effectively performing the unplug before
making the call to intf_close().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-25 11:29:29 +00:00
Michael Brown 5ff13830ec [interface] Remove misleading comment
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-25 10:17:48 +00:00
Michael Brown 8ef4e7c572 [interface] Avoid unnecessary reference counting in intf_unplug()
The null interface does not have a reference counter, so the call to
intf_get() is always redundant.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-25 10:16:36 +00:00
David Decotigny 04c7befa73 [build] Return const char * from uuid_ntoa()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-01-22 13:45:00 +00:00
Michael Brown daa8ed9274 [interface] Provide intf_reinit() to reinitialise nullified interfaces
Provide an abstraction intf_reinit() to restore the descriptor of a
previously nullified interface.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-11-16 22:22:13 +00:00
Michael Brown 2afd66eb55 [pixbuf] Enable PNG format by default
Enable IMAGE_PNG (but not IMAGE_PNM) by default, and drag in the
relevant objects only when image_pixbuf() is present in the binary.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29 16:04:09 +01:00
Michael Brown 942b798c8d [crypto] Enable both DER and PEM formats by default
Enable both IMAGE_DER and IMAGE_PEM by default, and drag in the
relevant objects only when image_asn1() is present in the binary.

This allows "imgverify" to transparently use either DER or PEM
signature files.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29 15:40:39 +01:00
Michael Brown ef50608029 [image] Add image_asn1() to extract ASN.1 objects from image
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-29 00:41:36 +01:00
Michael Brown f5cf4f706e [settings] Allow settings blocks to specify a sibling ordering
Allow settings blocks to provide an explicit default ordering between
siblings, with lower precedence than the existing ${priority} setting.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-19 17:07:53 +01:00
Michael Brown 0ac874242b [settings] Correctly mortalise autovivified child settings blocks
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-19 00:13:00 +01:00
Michael Brown 129206f476 [ipv6] Rename ipv6_scope to dhcpv6_scope
The settings scope ipv6_scope refers specifically to IPv6 settings
that have a corresponding DHCPv6 option.  Rename to dhcpv6_scope to
more accurately reflect this purpose.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-16 12:42:08 +01:00
Michael Brown e19c0a8fd2 [acpi] Add support for ACPI power off
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-11 14:05:18 +01:00
Michael Brown 89c6db838f [downloader] Treat redirection failures as fatal
Debugged-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-04 16:20:01 +01:00
Michael Brown 5e2a7481ad [xfer] Send intf_close() if redirection fails
A redirection failure is fatal, but provides no opportunity for the
caller of xfer_[v]redirect() to report the failure since the interface
will already have been disconnected.  Fix by sending intf_close() from
within the default xfer_vredirect() handler.

Debugged-by: Robin Smidsrød <robin@smidsrod.no>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2016-07-04 16:14:46 +01:00