aboutsummaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)AuthorFilesLines
2014-12-18[rndis] Add generic RNDIS device abstractionMichael Brown4-6/+1204
RNDIS provides an abstraction of a network device on top of a generic packet transmission mechanism. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18[iobuf] Add iob_split() to split an I/O buffer into portionsMichael Brown2-0/+31
RNDIS devices may provide multiple packets encapsulated into a single message. Provide an API to allow the RNDIS driver to split an I/O buffer into smaller portions. The current implementation will always copy the underlying data, rather than splitting the buffer in situ. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-18[device] Provide a driver-private data field for root devicesMichael Brown1-0/+23
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15[malloc] Report caller address as soon as memory corruption is detectedMichael Brown1-1/+21
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15[malloc] Check integrity of free listMichael Brown1-1/+59
Check the integrity of the free memory block list before and after any modifications to the list. We check that certain invariants are preserved: - the list is a well-formed doubly linked list - all blocks are at least MIN_MEMBLOCK_SIZE - no block extends beyond the end of our address space - blocks remain sorted in ascending order of address - no blocks are adjacent (i.e. any adjacent blocks have been merged) Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15[malloc] Sanity check parameters to alloc_memblock() and free_memblock()Michael Brown1-0/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-15[malloc] Tidy up debug outputMichael Brown1-19/+23
Colourise debug output and move per-allocation messages to DBGLVL_EXTRA. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12[list] Add sanity checks after list-adding functionsMichael Brown1-0/+4
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12[libc] Add ASSERTED macro to test if any assertion has triggeredMichael Brown1-0/+2
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12[netdevice] Fix erroneous use of free(iobuf) instead of free_iob(iobuf)Michael Brown1-1/+1
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-12-12[vmxnet3] Add profiling code to exclude time spent in the hypervisorMichael Brown1-1/+33
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-11-24[crypto] Fix parsing of OCSP responder ID key hashMichael Brown2-3/+419
We currently compare the entirety of the KeyHash object (including the ASN.1 tag and length byte) against the raw SHA-1 hash of the certificate's public key. This causes OCSP validation to fail for any responses which identify the responder by key hash rather than by name, and hence prevents the use of X.509 certificates where any certificate in the chain has an OCSP responder which chooses to identify itself via its key hash. Fix by adding the missing asn1_enter() required to enter the ASN.1 octet string containing the key hash. Also add a corresponding test case including an OCSP response where the responder is identified by key hash, to ensure that this functionality cannot be broken in future. Debugged-by: Brian Rak <brak@gameservers.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-31[intel] Use autoloaded MAC address instead of EEPROM MAC addressMichael Brown1-4/+4
The i350 (and possibly other Intel NICs) have a non-trivial correspondence between the PCI function number and the external physical port number. For example, the i350 has a "LAN Function Sel" bit within the EEPROM which can invert the mapping so that function 0 becomes port 3, function 1 becomes port 2, etc. Unfortunately the MAC addresses within the EEPROM are indexed by physical port number rather than PCI function number. The end result is that when anything other than the default mapping is used, iPXE will use the wrong address as the base MAC address. Fix by using the autoloaded MAC address if it is valid, and falling back to reading the MAC address directly from the EEPROM only if no autoloaded address is available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-23[ping] Allow "ping" command output to be inhibitedMichael Brown4-9/+17
Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-23[ping] Allow termination after a specified number of packetsMichael Brown5-7/+51
Add the "-c <count>" option to the "ping" command, allowing for automatic termination after a specified number of packets. When a number of packets is specified: - if a serious error (i.e. length mismatch or content mismatch) occurs, then the ping will be immediately terminated with the relevant status code; - if at least one response is received successfully, and all errors are non-serious (i.e. timeouts or out-of-sequence responses), then the ping will be terminated after the final response (or timeout) with a success status; - if no responses are received successfully, then the ping will be terminated after the final timeout with ETIMEDOUT. If no number of packets is specified, then the ping will continue until manually interrupted. Originally-implemented-by: Cedric Levasseur <cyr-ius@ipocus.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-23[ping] Report timed-out pings via the callback functionMichael Brown2-3/+14
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-17[efi] Include NII driver within "snp" and "snponly" build targetsMichael Brown4-106/+195
End users almost certainly don't care whether the underlying interface is SNP or NII/UNDI. Try to minimise surprise and unnecessary documentation by including the NII driver whenever the SNP driver is requested. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-17[efi] Check for presence of UNDI in NII protocolMichael Brown1-0/+6
iPXE itself exposes a dummy NII protocol with no UNDI. Avoid potentially dereferencing a NULL pointer by checking for a non-zero UNDI address. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16[efi] Add NII / UNDI driverMichael Brown5-0/+1977
Some UEFI network drivers provide a software UNDI interface which is exposed via the Network Interface Identifier Protocol (NII), rather than providing a Simple Network Protocol (SNP). The UEFI platform firmware will usually include the SnpDxe driver, which attaches to NII and provides an SNP interface. The SNP interface is usually provided on the same handle as the underlying NII device. This causes problems for our EFI driver model: when efi_driver_connect() detaches existing drivers from the handle it will cause the SNP interface to be uninstalled, and so our SNP driver will not be able to attach to the handle. The platform firmware will eventually reattach the SnpDxe driver and may attach us to the SNP handle, but we have no way to prevent other drivers from attaching first. Fix by providing a driver which can attach directly to the NII protocol, using the software UNDI interface to drive the network device. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16[efi] Update to current EDK2 headersMichael Brown5-15/+60
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16[efi] Generalise snpnet_dev_info() to efi_device_info()Michael Brown3-60/+69
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-16[efi] Free transmit ring entry before calling netdev_tx_complete()Michael Brown1-1/+3
The snpnet driver uses netdev_tx_defer() and so must ensure that space in the (single-entry) transmit descriptor ring is freed up before calling netdev_tx_complete(). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-10-03[intel] Add 8086:1557 card (Intel 82599 10G ethernet mezz)Anton D. Kachalov1-0/+1
Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-25[efi] Add definitions of GUIDs observed when chainloading from Intel driverMichael Brown12-2/+4246
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-25[efi] Centralise definitions of more protocol GUIDsMichael Brown5-18/+23
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-24[build] Use -malign-double to build 32-bit UEFI binariesMichael Brown1-0/+4
The EDK2 codebase uses -malign-double for 32-bit builds, which causes 64-bit integers to be naturally aligned. This affects the layout of some structures (including EFI_BLOCK_IO_MEDIA). This mirrors wimboot commit 7b8f39d ("[build] Fix building of 32-bit UEFI version"). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-22[dhcp] Remove obsolete dhcp_chaddr() functionMichael Brown1-75/+5
As of commit 03f0c23 ("[ipoib] Expose Ethernet-compatible eIPoIB link-layer addresses and headers"), all link layers have used addresses which fit within the DHCP chaddr field. The dhcp_chaddr() function was therefore made obsolete by this commit, but was accidentally left present (though unused) in the source code. Remove the dhcp_chaddr() function and the only remaining use of it, unnecessarily introduced in commit 08bcc0f ("[dhcp] Check for matching chaddr in received DHCP packets"). Reported-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-22[dhcp] Check for matching chaddr in received DHCP packetsMichael Brown1-0/+37
On large networks a DHCP XID collision is possible. Fix by explicitly checking the chaddr in received DHCP packets. Originally-fixed-by: Wissam Shoukair <wissams@mellanox.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-19[efi] Provide dummy device path in efi_image_probe()Michael Brown1-1/+6
Some UEFI platforms will fail the call to LoadImage() with EFI_INVALID_PARAMETER if we do not provide a device path (even though we are providing a non-NULL SourceBuffer). Fix by providing an empty device path for the call to LoadImage() in efi_image_probe(). The call to LoadImage() in efi_image_exec() already constructs and provides a device path (based on the most recently opened SNP device), and so does not require this fix. Reported-by: NICOLAS CATTIE <nicolas.cattie@mpsa.com> Tested-by: NICOLAS CATTIE <nicolas.cattie@mpsa.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-16[intel] Add I217-LM PCI IDJan Kiszka1-1/+2
Add the ID for the LM variant and differentiate it from the I217-V. Signed-off-by: Jan Kiszka <jan.kiszka@web.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-10[efi] Add efifatbin utilityMichael Brown4-0/+267
Add utility for constructing EFI fat binaries (dual 32/64-bit binaries, usable only on Apple EFI systems). This utility is not part of the standard build process. To use it: make util/efifatbin bin-i386-efi/ipxe.efi bin-x86_64-efi/ipxe.efi and then ./util/efifatbin bin-*-efi/ipxe.efi fat-ipxe.efi Requested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net> Tested-by: Brandon Penglase <bpenglase-ipxe@spaceservices.net> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04[build] Clean up all binary directories on "make [very]clean"Michael Brown1-1/+8
Allow a straightforward "make clean" or "make veryclean" to apply to all binary directories (using the shell pattern "bin{,-*}"). Individual binary directories can be cleaned using e.g. make bin clean make bin-x86_64-efi clean Reported-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04[efi] Allow for non-PCI snpnet devicesMichael Brown1-7/+8
We currently require information about the underlying PCI device to populate the snpnet device's name and description. If the underlying device is not a PCI device, this will fail and prevent the device from being registered. Fix by falling back to populating the device description with information based on the EFI handle, if no PCI device information is available. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04[efi] Make EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL optionalMichael Brown1-1/+7
Some UEFI systems (observed with a Hyper-V virtual machine) do not provide EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL. Make this an optional protocol (and fail any attempts to access PCI configuration space via the root bridge if the protocol is missing). Reported-by: Colin Blacker <Colin.Blacker@computerplanet.co.uk> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04[efi] Avoid returning uninitialised data from PCI configuration space readsMichael Brown1-0/+3
Under UEFI, reads from PCI configuration space may fail. If this happens, we should return all-ones (which will mimic the behaviour of an absent PCI device). Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-09-04[efi] Use the SNP protocol instance to match the SNP chainloading deviceMichael Brown1-8/+89
Some systems will install a child of the SNP device and use this as our loaded image's device handle, duplicating the installation of the underlying SNP protocol onto the child device handle. On such systems, we want to end up driving the parent device (and disconnecting any other drivers, such as MNP, which may be attached to the parent device). Fix by recording the SNP protocol instance at initialisation time, and using this to match against device handles (rather than simply comparing the handles themselves). Reported-by: Jarrod Johnson <jarrod.b.johnson@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-29[efi] Wrap any images loaded by our wrapped imageMichael Brown4-24/+70
Propagate our modified EFI system table to any images loaded by the image that we wrap, thereby allowing us to observe boot services calls made by all subsequent EFI images. Also show details of intercepted ExitBootServices() calls. When wrapping is used, exiting boot services will almost certainly fail, but this at least allows us to see when it happens. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-27[efi] Make our virtual file system case insensitiveMichael Brown1-4/+24
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-27[efi] Show details of intercepted LoadImage() callsMichael Brown1-0/+30
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[mromprefix] Allow for .mrom images larger than 128kBMichael Brown1-9/+1
The .mrom payload has a code type of 0xff and so the initialisation length field (single byte at offset 0x02) does not need to be present. Use only the PCI header's image length field, which allows the .mrom payload to be up to 32MB in size. Inspired-by: Swift Geek <swiftgeek@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[mromprefix] Use PCI length field to obtain length of individual imagesMichael Brown1-7/+17
mromprefix.S currently uses the initialisation length field (single byte at offset 0x02) to determine the length of a ROM image within a multi-image ROM BAR. For PCI ROM images with a code type other than 0, the initialisation length field may not be present. Fix by using the PCI header's image length field instead. Inspired-by: Swift Geek <swiftgeek@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[util] Use PCI length field to obtain length of individual imagesMichael Brown1-3/+2
Option::ROM currently uses the initialisation length field (single byte at offset 0x02) to determine the length of a ROM image within a multi-image ROM file. For PCI ROM images with a code type other than 0, the initialisation length field may not be present. Fix by using the PCI header's image length field instead. Note that this does not prevent us from correctly handling ISA ROMs, since ISA ROMs do not support multiple images within a single ROM BAR anyway. Inspired-by: Swift Geek <swiftgeek@gmail.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[prefix] Report both %esi and %ecx when opening payload failsMichael Brown2-1/+6
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[prefix] Halt system without burning CPU if we cannot access the payloadMichael Brown1-1/+4
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-26[build] Avoid deleting config header files if build is interruptedMichael Brown1-2/+15
With extremely unlucky timing, it is possible to interrupt a build and cause make to delete config/named.h (and possibly any local configuration headers). Mark config/named.h and all local configuration headers as .PRECIOUS to prevent make from ever deleting them. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-22[build] Avoid using embedded script in VirtualBox named configurationRobin Smidsrød3-12/+8
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-22[build] Allow ISA ROMs to be builtMichael Brown8-30/+146
The build process has for a long time assumed that every ROM is a PCI ROM, and will always include the PCI header and PCI-related functionality (such as checking the PCI BIOS version, including the PCI bus:dev.fn address within the ROM product name string, etc.). While real ISA cards are no longer in use, some virtualisation environments (notably VirtualBox) have support only for ISA ROMs. This can cause problems: in particular, VirtualBox will call our initialisation entry point with random garbage in %ax, which we then treat as the PCI bus:dev.fn address of the autoboot device: this generally prevents the default boot sequence from using any network devices. Create .isarom and .pcirom prefixes which can be used to explicitly specify the type of ROM to be created. (Note that the .mrom prefix always implies a PCI ROM, since the .mrom mechanism relies on reconfiguring PCI BARs.) Make .rom a magic prefix which will automatically select the appropriate PCI or ISA ROM prefix for ROMs defined via a PCI_ROM() or ISA_ROM() macro. To maintain backwards compatibility, we default to building a PCI ROM for anything which is not directly derived from a PCI_ROM() or ISA_ROM() macro (e.g. bin/intel.rom). Add a selection of targets to "make everything" to ensure that the (relatively obscure) ISA ROM build process is included within the per-commit QA checks. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-22[build] Remove obsolete references to .zrom build targetsMichael Brown1-8/+5
Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-22[romprefix] Do not preserve unused register %diMichael Brown1-8/+1
Since some PnP BIOSes fail to set %es:di to point to the PnP signature on entry, we identify a PnP BIOS by scanning through the top 64kB of base memory looking for the PnP structure. We therefore don't actually use the values of %es:di provided to the initialisation entry point, and so there is no need to preserve them. Signed-off-by: Michael Brown <mcb30@ipxe.org>
2014-08-22[efi] Dump details of any calls to our dummy block and disk I/O protocolsMichael Brown1-15/+33
Signed-off-by: Michael Brown <mcb30@ipxe.org>