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

5795 Commits

Author SHA1 Message Date
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 c73af29fe2 [int13con] Avoid overwriting random portions of SAN boot disks
The INT13 console type (CONSOLE_INT13) autodetects at initialisation
time a magic partition to be used for logging iPXE console output.  If
the INT13 drive number mapping is subsequently changed (e.g. because
iPXE was used to perform a SAN boot), then the console logging output
will be written to the incorrect disk.

Fix by recording the INT13 vector at initialisation time, and using
this original vector to emulate INT13 calls for all subsequent
accesses.  This should be robust against drive remapping performed
either by ourselves or by another bootloader (e.g. a chainloaded
undionly.kpxe which then performs a SAN boot).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-27 10:50:59 +03:00
Michael Brown ebceb8ad8a [int13] Improve geometry guessing for unaligned partitions
Some partition tables have partitions that are not aligned to a
cylinder boundary, which confuses the current geometry guessing logic.

Enhance the existing logic to ensure that we never reduce our guesses
for the number of heads or sectors per track, and add extra logic to
calculate the exact number of sectors per track if we find a partition
that starts within cylinder zero.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-26 21:03:50 +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 6bc4a8ac91 [scsi] Avoid duplicate call to scsicmd_close() on TEST UNIT READY failure
When the TEST UNIT READY command receives an error response, the
shutdown of the command's block data interface will result in
scsidev_ready() closing the SCSI device.  This will subsequently
result in a duplicate call to scsicmd_close(), leading to an assertion
failure when list_del() is called for the second time.

Fix by removing the command from the list of outstanding commands
before shutting down the command's interfaces.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-26 11:29:18 +03:00
Michael Brown c13bf52509 [vxge] Fix use of stale I/O buffer on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 21:10:25 +02:00
Michael Brown b340971852 [iobuf] Increase minimum I/O buffer size to 128 bytes
The eIPoIB translation layer needs to translate outbound ARP packets
from Ethernet to IPoIB.  A 64-byte buffer (starting with the Ethernet
header) does not provide enough tailroom to expand to hold the two
20-byte IPoIB MAC addresses.  The result is that an UNDI API user will
be unable to send ARP packets.

We could potentially shuffle the packet contents to reuse the space
occupied by the stripped Ethernet link-layer header, but this would
add complexity.  Instead, fix by increasing the minimum allocation
size to 128 bytes.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 18:29:46 +02:00
Mike McCormack a317e9a310 [sky2] Use 32-bit read to read Y2_VAUX_AVAIL
B0_CTST is a 24bit register according to the vendor driver (sk98lin).
A 16bit read on B0_CTST will always return 0 for Y2_VAUX_AVAIL
(1<<16), so use a 32bit read when testing Y2_VAUX_AVAIL.

[This patch is copied directly from the Linux kernel tree.]

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 17:54:03 +02:00
Michael Brown 19d3e966d9 [pcnet32] Eliminate redundant register read
The value of ( ( x & 0x0c00 ) | 0x0c00 ) is always 0x0c00 regardless
of the value of x, and so the read_csr() is redundant.  (There are no
read side effects for this register, according to the datasheet.)

This line of code originated in Linux kernel 2.3.19pre1 as

  a->write_csr(ioaddr, 80, a->read_csr(ioaddr, 80) | 0x0c00);

and was modified in kernel 2.3.41pre4 to read

  a->write_csr(ioaddr, 80, (a->read_csr(ioaddr, 80) & 0x0C00) | 0x0c00);

In the absence of commit messages, the intention of the code is
unclear.  However, the logic resulting in a fixed value of 0x0c00 has
remained unaltered for over 17 years, and can probably be assumed to
have the correct overall result.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 17:43:13 +02:00
Raed Salem 1ff1eebcf7 [golan] Bug fixes and improved paging allocation method
Updates:
- revert Support for clear interrupt via BAR

Signed-off-by: Raed Salem <raeds@mellanox.com>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 16:03:40 +02:00
Michael Brown ce240c8c2d [rtl818x] Fix resource leak on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 11:40:36 +02:00
Michael Brown c24f772349 [travis] Integrate with Coverity Scan
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-23 10:51:25 +02:00
Michael Brown 9ecad204fc [travis] Build and run the unit test suite
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 22:22:25 +02:00
Michael Brown aa1f7b0f7f [travis] Add minimal .travis.yml file
Allow for automated builds via Travis CI (https://travis-ci.org).

Note that the bin-i386-linux build platform is deliberately omitted
since the required linux-libc-dev:i386 package is not on the allowed
packages list for the Travis 14.04 ("trusty") container environment.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 22:09:26 +02: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 65a3518013 [coverity] Add Coverity user model
Add a trivial model file to prevent Coverity from making various
incorrect assumptions about functions where the iPXE behaviour
diverges from POSIX or Linux norms.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 16:46:03 +02:00
Michael Brown f032556b15 [mucurses] Ensure SLK labels are always terminated
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 16:35:29 +02:00
Michael Brown 3870a7bde2 [sis190] Avoid NULL pointer dereference
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 16:12:56 +02:00
Michael Brown 99e1207a4d [w89c840] Avoid potential array overrun
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:59:27 +02:00
Michael Brown ad725fa7d9 [tlan] Guard against failure to identify chip
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:28:58 +02:00
Michael Brown dea5b74475 [hermon] Assert that mapping length is non-zero
An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:20:14 +02:00
Michael Brown 0ced99e97c [arbel] Assert that mapping length is non-zero
An (impossible) mapping length of zero produces a negative bit shift,
which is technically undefined.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:18:54 +02:00
Michael Brown 7495813792 [video_subr] Use memmove() for overlapping memory copy
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:13:06 +02:00
Michael Brown 75bb948008 [tcp] Use correct length for memset()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 15:11:05 +02:00
Michael Brown 01496a5028 [xen] Use standard calling pattern for asprintf()
Our asprintf() implementation guarantees that strp will be NULL on
allocation failure, but this is not standard behaviour.  Detect errors
by checking for a negative return value instead of a NULL pointer.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 14:41:01 +02:00
Michael Brown 21d8624da8 [usb] Use correct length for memcpy()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 14:14:57 +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 45f2265bfc [ath] Add missing break statements
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 11:52:09 +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 c26c1fd07c [infiniband] Return status code from ib_create_mi()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 11:18:23 +02:00
Michael Brown 39ef530088 [infiniband] Return status code from ib_create_cq() and ib_create_qp()
Any underlying errors arising during ib_create_cq() or ib_create_qp()
are lost since the functions simply return NULL on error.  This makes
debugging harder, since a debug-enabled build is required to discover
the root cause of the error.

Fix by returning a status code from these functions, thereby allowing
any underlying errors to be propagated.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 11:18:02 +02:00
Michael Brown e88e2a2965 [build] Avoid confusing sparse in single-argument DBG() macros
For visual consistency with surrounding lines, the definitions of
DBG_MORE(), DBG_PAUSE(), etc include an unnecessary ##__VA_ARGS__
argument which is always elided.  This confuses sparse, which
complains about DBG_MORE_IF() being called with more than one
argument.

Work around this problem by adding an unused variable argument list to
the single-argument macros DBG_MORE_IF() and DBG_PAUSE_IF().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-22 08:25:04 +02:00
Michael Brown 6124c0ebfa [xhci] Avoid accessing beyond end of endpoint context array
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 16:22:42 +02:00
Michael Brown 501fa53b25 [mucurses] Attempt to fix use of uninitialised buffer with strcat()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 15:30:05 +02:00
Michael Brown f17cf0ecd0 [http] Add missing check for memory allocation failure
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 15:20:59 +02:00
Michael Brown 1ec2a60614 [eoib] Avoid passing a NULL I/O buffer to netdev_tx_complete_err()
Report errors in eoib_duplicate() via netdev_tx_err() rather than
netdev_tx_complete_err(), since netdev_tx_complete_err() accepts only
valid I/O buffers that are currently in the network device's transmit
queue.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 15:07:10 +02:00
Michael Brown 64de7dc7fd [slam] Avoid NULL pointer dereference in slam_pull_value()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:57:36 +02:00
Michael Brown 60561d0f3d [slam] Fix resource leak on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:53:13 +02:00
Michael Brown 8963193cda [hyperv] Fix resource leaks on error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:51:03 +02:00
Michael Brown 2ae759219b [mucurses] Attempt to fix resource leaks
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:46:19 +02:00
Michael Brown 583d258b89 [mucurses] Attempt to fix keypress processing logic
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:42:02 +02:00
Michael Brown d29e2d551c [mucurses] Attempt to fix test for empty string
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:37:53 +02:00
Michael Brown 7b113bc744 [usb] Use correct length for memcpy()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:21:54 +02:00
Michael Brown d25e7daf47 [librm] Fail gracefully if asked to ioremap() a zero length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:17:18 +02:00
Michael Brown 36cffe054d [crypto] Free correct pointer on the error path
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:07:40 +02:00
Michael Brown 9b581158b5 [802.11] Remove redundant NULL pointer check after dereference
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 14:01:08 +02:00
Michael Brown eb6acabc8f [sis900] Remove extraneous memset() with incorrect length
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 13:55:04 +02:00
Michael Brown ae915aa5cc [qib7322] Use correct length for memset()
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2017-03-21 13:51:56 +02:00