202 Commits
Author SHA1 Message Date
Marty Connor ec5863a7f5 [release] Update version to 0.9.8 for release 2009-10-14 12:12:40 -04:00
Michael Brown 9f7141a1ce [hermon] Reset device during probe()
Some systems will retry their boot sequence in the event of a boot
failure.  On these systems, the second and subsequent boot attempts
will fail to initialise the Hermon HCA.

Fix by resetting the HCA during probe().  This incurs a one-second
cost, but there seems to be no viable alternative.

Originally-fixed-by: Itay Gazit <itaygazit@gmail.com>
2009-10-14 02:11:16 +01:00
Michael Brown 4175b778c2 [pci] Add generic configuration space backup/restore facility
Some devices can only be reset via a mechanism that also resets the
card's PCI core, thus necessitating a backup and restore of all or
part of the PCI configuration space across a reset.
2009-10-14 02:06:23 +01:00
Michael Brown c9c411286a [job] Report progress of downloader jobs via job_progress() 2009-08-31 19:33:55 +01:00
Michael Brown 0fc13add31 [job] Add missing job_progress() interface method 2009-08-31 19:33:05 +01:00
Joshua Oreman d7dfc9572e [ath5k] Remove spurious debugging check
Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-08-17 19:10:53 -04:00
Michael Brown a7290a970c [802.11] Support multicast hashing
802.11 multicast hashing is the same as standard Ethernet hashing, so
just expose and use eth_mc_hash().

Signed-off-by: Joshua Oreman <oremanj@rwcr.net>
2009-08-12 00:54:29 +01:00
Joshua Oreman 2310c30d1c [802.11] Properly initialize autoassociation process
The recent change to process_add() to detect duplicate process
additions relies on the fact that all processes will be initialized
using process_init_stopped() before being passed to that function.
The autoassociation process was not initialized in this fashion, so
process_add() erroneously detected it as a duplicate.

Fix by using process_init_stopped() to initialize the autoassociation
process instead of setting the step member directly.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-12 00:31:34 +01:00
Michael Brown 444d5550a7 [dhcp] Fall back to using the hardware address to populate the chaddr field
For IPoIB, the chaddr field is too small (16 bytes) to contain the
20-byte IPoIB link-layer address.  RFC4390 mandates that we should
pass an empty chaddr field and rely on the DHCP client identifier
instead.  This has many problems, not least of which is that a client
identifier containing an IPoIB link-layer address is not very useful
from the point of view of creating DHCP reservations, since the QPN
component is assigned at runtime and may vary between boots.

Leave the DHCP client identifier as-is, to avoid breaking existing
setups as far as possible, but expose the real hardware address (the
port GUID) via the DHCP chaddr field, using the broadcast flag to
instruct the DHCP server not to use this chaddr value as a link-layer
address.

This makes it possible (at least with ISC dhcpd) to create DHCP
reservations using host declarations such as:

    host duckling {
        fixed-address 10.252.252.99;
        hardware unknown-32 00:02:c9:02:00:25:a1:b5;
    }
2009-08-12 00:27:08 +01:00
Michael Brown 4eab5bc8ca [netdevice] Allow the hardware and link-layer addresses to differ in size
IPoIB has a 20-byte link-layer address, of which only eight bytes
represent anything relating to a "hardware address".

The PXE and EFI SNP APIs expect the permanent address to be the same
size as the link-layer address, so fill in the "permanent address"
field with the initial link layer address (as generated by
register_netdev() based upon the real hardware address).
2009-08-12 00:23:38 +01:00
Michael Brown 37a0aab4ff [netdevice] Separate out the concept of hardware and link-layer addresses
The hardware address is an intrinsic property of the hardware, while
the link-layer address can be changed at runtime.  This separation is
exposed via APIs such as PXE and EFI, but is currently elided by gPXE.

Expose the hardware and link-layer addresses as separate properties
within a net device.  Drivers should now fill in hw_addr, which will
be used to initialise ll_addr at the time of calling
register_netdev().
2009-08-12 00:19:14 +01:00
Michael Brown b3db99a38d [doc] Expand scope of doxygen-generated documentation 2009-08-11 15:14:36 +01:00
Joshua Oreman d5d68b2e31 [zbin] Change fixup semantics to support ROMs over 128k uncompressed
The option ROM header contains a one-byte field indicating the number
of 512-byte sectors in the ROM image.  Currently it is linked to
contain the number of uncompressed sectors, with an instruction to the
compressor to correct it.  This causes link failure when the
uncompressed size of the ROM image is over 128k.

Fix by replacing the SUBx compressor fixup with an ADDx fixup that
adds the total compressed output length, scaled as requested, to an
addend stored in the field where the final length value will be
placed.  This is similar to the behavior of ELF relocations, and
ensures that an overflow error will not be generated unless the
compressed size is still too large for the field.

This also allows us to do away with the _filesz_pgh and _filesz_sect
calculations exported by the linker script.

Output tested bitwise identical to the old SUBx mechanism on hd, dsk,
lkrn, and rom prefixes, on both 32-bit and 64-bit processors.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-11 12:59:26 +01:00
Michael Brown 487347a0cd [doc] Update doxygen.cfg to match version running on rom.etherboot.org 2009-08-11 07:02:05 -04:00
Michael Brown e5f14e5a32 [infiniband] Add support for the SRP Boot Firmware Table
The SRP Boot Firmware Table serves a similar role to the iSCSI and AoE
Boot Firmware Tables; it provides information required by the loaded
OS in order to establish a connection back to the SRP boot device.
2009-08-10 22:32:47 +01:00
Michael Brown 0ff5c456cb [infiniband] Disambiguate CM connection rejection reasons
There is diagnostic value in being able to disambiguate between the
various reasons why an IB CM has rejected a connection attempt.  In
particular, reason 8 "invalid service ID" can be used to identify an
incorrect SRP service_id root-path component, and reason 28 "consumer
reject" corresponds to a genuine SRP login rejection IU, which can be
passed up to the SRP layer.

For rejection reasons other than "consumer reject", we should not pass
through the private data, since it is most likely generated by the CM
without any protocol-specific knowledge.
2009-08-10 22:31:55 +01:00
Michael Brown 965a0f7a75 [infiniband] Allow SRP reconnection attempts even after reporting failures
With iSCSI, connection attempts are expensive; it may take many
seconds to determine that a connection will fail.  SRP connection
attempts are much less expensive, so we may as well avoid the
"optimisation" of declaring a state of permanent failure after a
certain number of attempts.  This allows a gPXE SRP initiator to
resume operations after an arbitrary amount of SRP target downtime.
2009-08-10 22:30:56 +01:00
Michael Brown a0d337912e [infiniband] Generate more specific errors in response to failure MADs
Generate errors within individual MAD transaction consumers such as
ib_pathrec.c and ib_mcast.c, rather than within ib_mi.c.  This allows
for more meaningful error messages to eventually be displayed to the
user.
2009-08-10 22:30:06 +01:00
Michael Brown 0c30dc6bc5 [infiniband] Add support for SRP over Infiniband
SRP is the SCSI RDMA Protocol.  It allows for a method of SAN booting
whereby the target is responsible for reading and writing data using
Remote DMA directly to the initiator's memory.  The software initiator
merely sends and receives SCSI commands; it never has to touch the
actual data.
2009-08-10 22:27:33 +01:00
Michael Brown 8de49af0d2 [infiniband] Add last_opened_ibdev(), analogous to last_opened_netdev()
The minimal-surprise behaviour, when no explicit SRP initiator device
is specified, will probably be to use the most recently opened
Infiniband device.  This matches our behaviour with using the most
recently opened net device for PXE, iSCSI, AoE, NBI, etc.
2009-08-10 22:25:57 +01:00
Michael Brown 419243e7f1 [infiniband] Add find_ibdev() 2009-08-10 22:25:02 +01:00
Michael Brown 4be11f523c [infiniband] Add a "communication-managed reliable connection" protocol
SRP over Infiniband uses a protocol whereby data is sent via a
combination of the CM private data fields and the RC queue pair
itself.  This seems sufficiently generic that it's worth having
available as a separate protocol.
2009-08-10 22:23:28 +01:00
Michael Brown 1175f0cf29 [hermon] Reduce the RC ACK timeout
The ACK timeout determines how long we take to notice a failed
Reliable Connection.  Reducing it from the arbitrary value of 19 down
to 14 reduces the individual ACK timeout from around 2.1s to 67ms;
this in turn reduces the time to tear down and re-establish a broken
SRP session from around 30s to around 1s.
2009-08-10 22:22:42 +01:00
Michael Brown 0b1222f233 [hermon] Randomise the high-order bits of queue pair numbers
The Infiniband Communication Manager will refuse to establish a
connection if it believes the connection is already established.
There is no immediately obvious way to ask it to tear down the
existing connection and replace it; to issue a DREP we would need to
know the local and remote communication IDs used for the previous
connection setup.

We can work around this by randomising the high-order bits of the
queue pair number; these have no significance to the hardware, but are
sufficient to convince the IB CM that this is a different connection.
2009-08-10 22:19:39 +01:00
Michael Brown cf716a0ce6 [scsi] Make LUN a property of the SCSI backend only
Nothing within the SCSI core actually refers to the LUN, so we can
simplify matters by treating it as purely a property of the backend.
2009-08-10 19:31:45 +01:00
Michael Brown d944794680 [scsi] Generalise iscsi_parse_lun() to scsi_parse_lun() 2009-08-10 19:30:41 +01:00
Michael Brown 976f12c501 [scsi] Generalise iscsi_detached_command() to scsi_detached_command() 2009-08-10 19:29:40 +01:00
Michael Brown 04878ef745 [process] Make it safe to call process_add() multiple times 2009-08-10 19:27:24 +01:00
Michael Brown 46073f1239 [infiniband] Handle duplicate Communication Management REPs
We will terminate our transaction as soon as we receive the first CM
REP, since that provides all the state that we need.  However, the
peer may resend the REP if it didn't see our RTU, and if we don't
respond with another RTU we risk being disconnected.  (This protocol
appears not to handle retries gracefully.)

Fix by adding a management agent that will listen for these duplicate
REPs and send back an RTU.
2009-08-09 01:31:07 +01:00
Joshua Oreman ce68f587e2 [ath5k] Add support for non-802.11n Atheros wireless NICs
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:16:13 +01:00
Joshua Oreman 3f274a6950 [legal] Add MIT licence declaration
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:13:29 +01:00
Joshua Oreman fc9750a68d [802.11] Fix memory leak on unsuccessful probes
When a probe found no results, the list head of beacons would not be
freed, leaking 16 bytes of memory per probe.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:12:53 +01:00
Joshua Oreman 0b3c88e035 [802.11] Fix maximum packet length
Previously the maximum packet length was computed using an erroneous
understanding of the role of the MIC field in TKIP-encrypted packets.
The field is actually considered to be part of the MSDU (encrypted and
fragmented data), not the MPDU (container for each encrypted
fragment). As such its size does not contribute to cryptographic
overhead outside the data field's size limitations. The net result is
that the previous maximum packet length value was 4 bytes too long;
fix it to the correct value of 2352.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:12:04 +01:00
Joshua Oreman 1e810bebe9 [802.11] Set channels early on to avoid tuning to an undefined channel
Some cards (such as ath5k) always need to tune to a particular channel
when they are reset; the reset may happen upon open(), which is before
the channels array would be set up (in prepare_probe()). Avoid tuning
the card to an inconsistent state by copying the hardware
supported-channels array to the 802.11 device's allowable-channels
array even before channels are "properly" set up.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:11:33 +01:00
Joshua Oreman f128a6db21 [802.11] Enhance support for driver PHY differences
The prior net80211 model of physical-layer behavior for drivers was
overly simplistic and limited the drivers that could be written.  To
be more flexible, split the driver-provided list of supported rates by
band, and add a means for specifying a list of supported channels.
Allow drivers to specify a hardware channel value that will be tied to
uses of the channel.

Expose net80211_duration() to drivers, and make the rate it uses in
its computations configurable, so that it can be used in calculating
durations that must be set in hardware for ACK and CTS packets. Add
net80211_cts_duration() for the common case of calculating the
duration for a CTS packet.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:11:26 +01:00
vibi sreenivasan e6e30618c2 [geniso] Emit proper error message for incorrect location of ISOLINUX_BIN
If isolinux.bin is not installed in the expected location the error
message shown is slightly misleading.

Signed-off-by: Vibi Sreenivasan <vibi_sreenivasan@cms.com>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-09 00:05:49 +01:00
Michael Brown 34bfc04e4c [infiniband] Update all other MAD users to use a management interface 2009-08-08 23:56:28 +01:00
Michael Brown 44251ebb9a [infiniband] Update subnet management agent to use a management interface 2009-08-08 23:55:29 +01:00
Michael Brown 0e07516f62 [infiniband] Add the concept of a management interface
A management interface is the component through which both local and
remote management agents are accessed.

This new implementation of a management interface allows for the user
to react to timed-out transactions, and also allows for cancellation
of in-progress transactions.
2009-08-08 23:51:27 +01:00
Michael Brown 18bcdfb1cc [hermon] Allow for multiple calls to ib_modify_qp() 2009-08-08 23:49:59 +01:00
Michael Brown 7a3a159af5 [romprefix] Cope with PnP BIOSes that fail to set %es:%di on entry
Some BIOSes support the BIOS Boot Specification (BBS) but fail to set
%es:%di correctly when calling the option ROM initialisation entry
point.  This causes gPXE to identify the BIOS as non-PnP (and so
non-BBS), leaving the user unable to control the boot order.

Fix by scanning for the $PnP signature ourselves, rather than relying
on the BIOS having passed in %es:%di correctly.

Tested-by: Helmut Adrigan <helmut.adrigan@chello.at>
2009-08-08 15:32:28 +01:00
Michael Brown ad66465b3c [hermon] Add support for multiple ports and detecting non-IB ports
Originally-fixed-by: Itay Gazit <itaygazit@gmail.com>
2009-08-06 01:55:38 +01:00
Michael Brown b0c563824b [infiniband] Change IB_{QPN,QKEY,QPT} names from {SMA,GMA} to {SMI,GSI}
The IBA specification refers to management "interfaces" and "agents".
The interface is the component that connects to the queue pair and
sends and receives MADs; the agent is the component that constructs
the reply to the MAD.

Rename the IB_{QPN,QKEY,QPT} constants as a first step towards making
this separation in gPXE.
2009-08-06 01:24:18 +01:00
Michael Brown 1f7d550246 [build] Mark __intel_new_proc_init with __libgcc rather than cdecl
The function __intel_new_proc_init() (called implicitly when building
using icc) is marked with __attribute__((cdecl)).  This breaks
building on x86_64, where cdecl is meaningless.

Fix by replacing with the existing __libgcc macro, which is already
defined to be "__attribute__((cdecl))" for i386 builds and empty for
x86_64 builds.
2009-08-03 15:56:10 +01:00
Joshua Oreman 70f47e675e [sky2] Add support for Marvell Yukon-II gigabit Ethernet cards
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-03 00:27:16 +01:00
Joshua Oreman 993f8ba9bc [pci] Add definitions for Advanced Error Reporting registers
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-03 00:22:28 +01:00
H. Peter Anvin 5e1aa70301 [legal] Add the MIT and ISC licenses to licence.pl
The MIT and ISC licenses are legally equivalent to the bsd2 license,
but with slightly different verbiage.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-02 23:30:38 +01:00
H. Peter Anvin 193d545903 [pxe] Dual-license pxe_api.h under the MIT license
pxe_api.h is just a description of API functions, it's actively
undesirable to have more implementations than necessary.  Allowing it
under the MIT license lets the Syslinux libraries use it.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-02 23:29:06 +01:00
Joshua Oreman bba00b0c13 [config] Enable PXE commands by default only on pcbios architecture
The commands bring in UNDI and thus real-mode code, so they cannot be
used on EFI.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-02 23:19:40 +01:00
Michael Brown 2b9f7f042c [pxe] Avoid printf format warning on some compilers
Tested-by: Joshua Oreman <oremanj@xenon.get-linux.org>
2009-08-02 22:45:24 +01:00
Michael Brown 5552a1b202 [tcp] Avoid printf format warnings on some compilers
In several places, we currently use size_t to represent a difference
between TCP sequence numbers.  This can cause compiler warnings
relating to printf format specifiers, since the result of
(uint32_t+size_t) may be an unsigned long on some compilers.

Fix by using uint32_t for all variables that represent a difference
between TCP sequence numbers.

Tested-by: Joshua Oreman <oremanj@xenon.get-linux.org>
2009-08-02 22:44:57 +01:00
Michael Brown f42b2932f8 [build] Allow safe concurrent builds of .iso, .liso and .sdsk targets
The geniso, genliso and gensdsk scripts contain hard-coded temporary
directory names, and so could potentially collide with each other when
run as part of a concurrent build (e.g. "make -j 4").

Fix by using mktemp to generate suitable temporary directory names.
2009-08-02 11:17:02 +01:00
Michael Brown b570c2efd8 [build] Make .liso image generation silent unless errors occur 2009-08-02 11:09:08 +01:00
Marty Connor 96f4f96540 [build] Add syslinux floppy image type .sdsk
We add a syslinux floppy disk type using parts of the genliso script.
This floppy image cat be dd'ed to a physical floppy or used in
instances where a virtual floppy with an mountable DOS filesystem is
useful.

We also modify the genliso script to only generate .liso images
rather than creating images depending on how it is called.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-08-02 11:04:13 +01:00
Joshua Oreman 14ae602ef0 [rtl818x] Add driver for Realtek 8180/8185 wireless cards 2009-08-01 19:02:48 +01:00
Joshua Oreman ce64398f87 [802.11] Add support for 802.11 devices with software MAC layer
This is required for all modern 802.11 devices, and allows drivers
to be written for them with minimally more effort than is required
for a wired NIC.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
Modified-by: Michael Brown <mcb30@etherboot.org>
2009-08-01 19:00:32 +01:00
Michael Brown bb2cf3c8d7 [hermon] Add support for RC queue pairs 2009-07-17 23:06:35 +01:00
Michael Brown cd5a21359c [hermon] Allow software GMA to receive packets destined for QP1
The Linux IB Communication Manager will always send MADs to QP1,
rather than back to the originating QP.  On Hermon, QP1 is by default
handled by the embedded firmware.  We can change this, but the cost is
that we have to handle both QP0 and QP1 (i.e. we have to provide SMA
as well as GMA service in software), and we have to use MLX queues
rather than standard UD queues (i.e. we have to construct the UD
datagrams by hand).

There doesn't seem to be any viable way around this situation, ugly
though it is.
2009-07-17 23:06:35 +01:00
Michael Brown de50a19ae3 [hermon] Disable debugging around mapping of firmware tables 2009-07-17 23:06:35 +01:00
Michael Brown dd2788594b [hermon] Remove an unnecessary check for GID-less transmissions 2009-07-17 23:06:35 +01:00
Michael Brown cc2e767b5a [infiniband] Add Communication Manager (CM)
The Communication Manager is responsible for handling the setup and
teardown of RC connections.
2009-07-17 23:06:35 +01:00
Michael Brown c939bc57ff [infiniband] Add infrastructure for RC queue pairs
Queue pairs are now assumed to be created in the INIT state, with a
call to ib_modify_qp() required to bring the queue pair to the RTS
state.

ib_modify_qp() no longer takes a modification list; callers should
modify the relevant queue pair parameters (e.g. qkey) directly and
then call ib_modify_qp() to synchronise the changes to the hardware.

The packet sequence number is now a property of the queue pair, rather
than of the device.

Each queue pair may have an associated address vector.  For RC queue
pairs, this is the address vector that will be programmed in to the
hardware as the remote address.  For UD queue pairs, it will be used
as the default address vector if none is supplied to ib_post_send().
2009-07-17 23:06:35 +01:00
Michael Brown ea6eb7f7ed [infiniband] Pass a generic MAD to ib_set_port_info() 2009-07-17 23:06:35 +01:00
Michael Brown 0095e18d4c [infiniband] Expose supported and enabled link speeds and widths 2009-07-17 23:06:35 +01:00
Michael Brown 773028d34e [infiniband] Allow MAD handlers to indicate response via return value
Now that MAD handlers no longer return a status code, we can allow
them to return a pointer to a MAD structure if and only if they want
to send a response.  This provides a more natural and flexible
approach than using a "response method" field within the handler's
descriptor.
2009-07-17 23:06:35 +01:00
Michael Brown 94876f4bb6 [infiniband] Remove the return status code from MAD handlers
MAD handlers have to set the status fields within the MAD itself
anyway, in order to provide a meaningful response MAD; the additional
gPXE return status code is just noise.

Note that we probably don't need to ever explicitly set the status to
IB_MGMT_STATUS_OK, since it should already have this value from the
request.  (By not explicitly setting the status in this way, we can
safely have ib_sma_set_xxx() call ib_sma_get_xxx() in order to
generate the GetResponse MAD without worrying that ib_sma_get_xxx()
will clear any error status set by ib_sma_set_xxx().)
2009-07-17 23:06:35 +01:00
Michael Brown f1d92fa886 [infiniband] Allow external QPN to differ from real QPN
Most IB hardware seems not to allow allocation of the genuine QPNs 0
and 1, so allow for the externally-visible QPN (as constructed and
parsed by ib_packet, where used) to differ from the real
hardware-allocated QPN.
2009-07-17 23:06:34 +01:00
Michael Brown 92cf240020 [infiniband] Always create an SMA and a GMA 2009-07-17 23:06:34 +01:00
Michael Brown 80c41b90d2 [infiniband] Add notion of a queue pair type 2009-07-17 23:06:34 +01:00
Michael Brown 3f4972db9a [infiniband] Allow completion queue operations to be optional
The send completion handler typically will just free the I/O buffer,
so allow this common case to be handled by the Infiniband core.
2009-07-17 23:06:34 +01:00
Michael Brown 0582a84e66 [infiniband] Improve ib_packet debugging messages 2009-07-17 23:06:34 +01:00
Michael Brown 47c4aaa9e2 [ipoib] Attempt the broadcast group join only if the link is up
Attempting the broadcast group join while the link is down is
harmless, but can generate annoying volumes of debug messages.
2009-07-17 23:06:34 +01:00
Michael Brown 165074c188 [infiniband] Implement SMA as an instance of a GMA
The GMA code was based upon the SMA code.  We can save space by making
the SMA simply an instance of the GMA.
2009-07-17 23:06:34 +01:00
Michael Brown 8a852280eb [infiniband] Pass GMA as a parameter to GMA MAD handlers 2009-07-17 23:06:34 +01:00
Michael Brown cb9ef4dee2 [ipoib] Remove the queue set abstraction
Now that IPoIB has to deal with only one set of queues, the queue set
abstraction becomes merely an inconvenient wrapper.
2009-07-17 23:06:34 +01:00
Michael Brown 63c112ed38 [ipoib] Kill off the now-unused IPoIB metadata queue set
All packets handled by the metadata queue set now go via the GMA.
2009-07-17 23:06:34 +01:00
Michael Brown 0fbf2f6bda [infiniband] Provide a general mechanism for multicast group joins
Generalise out the multicast group membership record code from IPoIB.
2009-07-17 23:06:34 +01:00
Michael Brown 3c77fe73a5 [infiniband] Allow for sending MADs via GMA without retransmission 2009-07-17 23:06:34 +01:00
Michael Brown b4155c4ab5 [infiniband] Make qkey and rate optional parameters to ib_post_send()
The queue key is stored as a property of the queue pair, and so can
optionally be added by the Infiniband core at the time of calling
ib_post_send(), rather than always having to be specified by the
caller.

This allows IPoIB to avoid explicitly keeping track of the data queue
key.
2009-07-17 23:06:33 +01:00
Michael Brown 8aa2591c06 [ipoib] Clarify new role of IPoIB peer cache as for MAC addresses only
Now that path record lookups are handled entirely via
ib_resolve_path(), the only role of the IPoIB peer cache is as a
lookup table for MAC addresses.  Update the code structure and
comments to reflect this.
2009-07-17 23:06:33 +01:00
Michael Brown 06ad481904 [ipoib] Expose the real broadcast MAC
The IPoIB broadcast MAC address varies according to the partition key.
Now that the broadcast MAC address is a property of the network device
rather than of the link layer, we can expose this real MAC address
directly.

The broadcast LID is now identified via a path record lookup; this is
marginally inefficient (since it was present in the MCMemberRecord
GetResponse), but avoids the need to special-case broadcasts when
constructing the address vector in ipoib_transmit().
2009-07-17 23:06:33 +01:00
Michael Brown 4d0029611f [ipoib] Use Infiniband broadcast QPN in IPoIB broadcast MAC address
Remove the special handling of the IPoIB broadcast QPN.
2009-07-17 23:06:33 +01:00
Michael Brown d6b47871de [infiniband] Provide a general mechanism for path record lookups
Generalise out the path record lookup code from IPoIB.
2009-07-17 23:06:33 +01:00
Michael Brown 1d8c85d112 [infiniband] Create a general management agent
Generalise the subnet management agent into a general management agent
capable of sending and responding to MADs, including support for
retransmissions as necessary.
2009-07-17 23:06:33 +01:00
Michael Brown 365b8db5cf [infiniband] Centralise SMA and GMA queue constants 2009-07-17 23:06:33 +01:00
Michael Brown 887d296b88 [infiniband] Poll completion queues automatically
Currently, all Infiniband users must create a process for polling
their completion queues (or rely on a regular hook such as
netdev_poll() in ipoib.c).

Move instead to a model whereby the Infiniband core maintains a single
process calling ib_poll_eq(), and polling the event queue triggers
polls of the applicable completion queues.  (At present, the
Infiniband core simply polls all of the device's completion queues.)
Polling a completion queue will now implicitly refill all attached
receive work queues; this is analogous to the way that netdev_poll()
implicitly refills the RX ring.

Infiniband users no longer need to create a process just to poll their
completion queues and refill their receive rings.
2009-07-17 23:06:33 +01:00
Michael Brown 1f5c0239b4 [infiniband] Centralise assumption of 2048-byte payloads
IPoIB and the SMA have separate constants for the packet size to be
used to I/O buffer allocations.  Merge these into the single
IB_MAX_PAYLOAD_SIZE constant.

(Various other points in the Infiniband stack have hard-coded
assumptions of a 2048-byte payload; we don't currently support
variable MTUs.)
2009-07-17 23:06:33 +01:00
Michael Brown 7ba33f7826 [infiniband] Provide ib_get_hca_info() as a commonly-available function 2009-07-17 23:06:33 +01:00
Michael Brown b25a4b6c8a [infiniband] Split queue set functionality out of ipoib.c to ib_qset.c 2009-07-17 23:06:33 +01:00
Michael Brown 8868956268 [infiniband] Move non-driver-specific code to net/infiniband 2009-07-17 23:04:07 +01:00
Michael Brown d09290161e [netdevice] Make ll_broadcast per-netdevice rather than per-ll_protocol
IPoIB has a link-layer broadcast address that varies according to the
partition key.  We currently go through several contortions to pretend
that the link-layer address is a fixed constant; by making the
broadcast address a property of the network device rather than the
link-layer protocol it will be possible to simplify IPoIB's broadcast
handling.
2009-07-17 23:02:48 +01:00
Michael Brown 54ec3673cc [ata] Make ATA command issuing partially asynchronous
Move the icky call to step() from aoe.c to ata.c; this takes it at
least one step further away from where it really doesn't belong.

Unfortunately, AoE has the ugly aoe_discover() mechanism which means
that we still have a step() loop in aoe.c for now; this needs to be
replaced at some future point.
2009-07-17 23:01:20 +01:00
Michael Brown acfd7cc609 [scsi] Improve SCSI debugging 2009-07-17 23:00:46 +01:00
Michael Brown 1d8d8ef2c8 [scsi] Make SCSI command issuing partially asynchronous
Move the icky call to step() from iscsi.c to scsi.c; this takes it at
least one step further away from where it really doesn't belong.
2009-07-17 23:00:09 +01:00
Michael Brown 51172783e2 [debug] Use a delimiter to break up DBG_HD() output
Reading sixteen columns of hex digits can be difficult; include a "-"
character to split the output into two groups of eight columns.
2009-07-17 22:58:44 +01:00
Michael Brown b7e93a6a55 [xfer] Always nullify interface while sending close() message
Objects typically call xfer_close() as part of their response to a
close() message.  If the initiating object has already nullified the
xfer interface then this isn't a problem, but it can lead to
unexpected behaviour when the initiating object is aiming to reuse the
connection and so does not nullify the interface.

Fix by always temporarily nullifying the interface during xfer_close()
(as was already being done by xfer_vreopen() in order to work around
this specific problem).

Reported-by: infernix <infernix@infernix.net>
Tested-by: infernix <infernix@infernix.net>
2009-07-06 16:16:59 +01:00
Michael Brown 546cc62394 [pxe] Add startpxe and stoppxe commands
These commands can be used to activate or deactivate the PXE API (on a
specifiable network interface).

This is currently of limited use, since most image formats will call
shutdown() before booting the image, meaning that the underlying net
device gets shut down during remove_devices() anyway.
2009-06-28 20:50:23 +01:00
Michael Brown 76c915d5bd [ifmgmt] Move ifmgmt_cmd.h to include/hci 2009-06-28 20:28:38 +01:00
Michael Brown 6e564323e0 [ifmgmt] Optimise prototype for ifcommon_exec()
ifcommon_exec() was long-ago marked as __attribute__((regparm(2))) in
order to minimise the size of functions that call into it.  Since
then, gPXE has added -mregparm=3 as a general compilation option, and
this "optimisation" is now counter-productive.

Change (and simplify) the prototype to minimise code size given the
current compilation conditions.
2009-06-28 20:24:54 +01:00
Michael Brown ee1d315ac0 [pxe] Check for unhookable interrupts in PXENV_STOP_UNDI
PXENV_STOP_UNDI should return PXENV_STATUS_KEEP_UNDI if the UNDI
cannot be safely unloaded (e.g. due to interrupt vectors that could
not be unhooked).
2009-06-28 20:12:16 +01:00
Michael Brown 07b5be3341 [pxe] Create pxe_[de]activate() wrapper functions
Merge the pxe_set_netdev()+pxe_[un]hook_int1a() pattern into a single
pxe_[de]activate() call.
2009-06-28 20:11:32 +01:00
Michael Brown c2965b0fe7 [pxe] Make pxe_init_structures() an initialisation function
pxe_init_structures() fills in the fields of the !PXE and PXENV+
structures that aren't known until gPXE starts up.  Once gPXE is
started, these values will never change.

Make pxe_init_structures() an initialisation function so that PXE
users don't have to worry about calling it.
2009-06-28 19:40:16 +01:00
Michael Brown c26a38b313 [pxe] Update UNDI transmit count before transmitting packet
It is possible that the UNDI ISR may be triggered before netdev_tx()
returns control to pxenv_undi_transmit().  This means that
pxenv_undi_isr() may see a zero undi_tx_count, and so not check for TX
completions.  This is not a significant problem, since it will check
for TX completions on the next call to pxenv_undi_isr() anyway; it
just means that the NBP will see a spurious IRQ that was apparently
caused by nothing.

Fix by updating the undi_tx_count before calling netdev_tx(), so that
pxenv_undi_isr() can decrement it and report the TX completion.
2009-06-27 16:36:21 +01:00
Michael Brown f186ada2d3 [pxe] Implement PXENV_UNDI_{GET,SET}_MCAST_ADDRESS
Symantec Ghost requires working multicast support.  gPXE configures
all (sufficiently supported) network adapters into "receive all
multicasts" mode, which means that PXENV_UNDI_SET_MCAST_ADDRESS is
actually a no-op, but the current implementation returns
PXENV_STATUS_UNSUPPORTED instead.

Fix by making PXENV_UNDI_SET_MCAST_ADDRESS return success.  For good
measure, also implement PXENV_UNDI_GET_MCAST_ADDRESS, since the
relevant functionality is now exposed by the net device core.

Note that this will silently fail if the gPXE driver for the NIC being
used fails to configure the NIC in "receive all multicasts" mode.
2009-06-27 15:46:06 +01:00
Michael Brown 9580f9d5cd [pxe] Improve pxe_undi debug messages
The PXE debugging messages have remained pretty much unaltered since
Etherboot 5.4, and are now difficult to read in comparison to most of
the rest of gPXE.

Bring the pxe_undi debug messages up to normal gPXE standards.
2009-06-27 14:43:10 +01:00
Joshua Oreman 15ce2fb851 [hci] Expose ifcommon_exec() in a local header so wireless commands can use it
This keeps code size down, since the wireless interface management
commands have the same command-line interface and overall structure as
the wired commands.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-24 13:23:41 +01:00
Joshua Oreman 6254998327 [dhcp] Await link-up before starting DHCP
Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-24 13:18:31 +01:00
Joshua Oreman 4125216a2f [ifmgmt] Move link-up status messages from autoboot() to iflinkwait()
With the addition of link status codes, we can now display a detailed
error indication if iflinkwait() fails.

Putting the error output in iflinkwait avoids code duplication, and
gains symmetry with the other interface management routines; ifopen()
already prints an error directly if it cannot open its interface.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-24 13:15:27 +01:00
Michael Brown a310d00d37 [netdevice] Add mechanism for reporting detailed link status codes
Expand the NETDEV_LINK_UP bit into a link_rc status code field,
allowing specific reasons for link failure to be reported via
"ifstat".

Originally-authored-by: Joshua Oreman <oremanj@rwcr.net>
2009-06-24 13:04:36 +01:00
Daniel Verkamp cb9700ef6f [comboot] Implement INT 22h AX=000Bh (Get Serial Console Configuration)
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-23 23:09:01 +01:00
Michael Brown 4fe1e08a60 [pxe] Fix interoperability with the Symantec (undipd) DOS UNDI driver
The Symantec UNDI DOS driver fails when run on top of gPXE because we
return our interface type as "gPXE" rather than one of the predefined
NDIS interface type strings.

Fix by returning the standard "DIX+802.3" string; this isn't
necessarily always accurate, but it's highly unlikely that anything
trying to use the UNDI API would understand our IPoIB link-layer
pseudo-header anyway.
2009-06-23 22:56:21 +01:00
Michael Brown 0b922595fe [pxe] Fix interoperability with the Intel DOS UNDI driver
The Intel DOS UNDI driver fails when run on top of gPXE because we do
not fill in the ServiceFlags field in PXENV_UNDI_GET_IFACE_INFO.

Fix by filling in the ServiceFlags field with reasonable values
indicating our approximate feature capabilities.
2009-06-23 22:42:55 +01:00
Michael Brown 4f881ae352 [pxe] Fix interoperability with the 3Com DOS UNDI driver
The 3Com DOS UNDI driver fails when run on top of gPXE for two
reasons: firstly because PXENV_UNDI_SET_PACKET_FILTER is unsupported,
and secondly because gPXE enters the NBP without enabling interrupts
on the NIC, and the 3Com driver never calls PXENV_UNDI_OPEN.

Fix by always returning success from PXENV_UNDI_SET_PACKET_FILTER
(which is no worse than the current situation, since we already ignore
the receive packet filter in PXENV_UNDI_OPEN), and by forcibly
enabling interrupts on the NIC within PXENV_UNDI_TRANSMIT.  The latter
is something of a hack, but avoids the need to implement a complete
base-code ISR that we would otherwise need if we were to enter the NBP
with interrupts enabled.
2009-06-23 21:54:50 +01:00
Michael Brown ded4d3a703 [rtl8139] Split debug messages into DBGLVL_LOG and DBGLVL_EXTRA 2009-06-23 20:41:44 +01:00
Michael Brown 198ae0a131 [undi] Include PXENV_GET_IFACE_INFO's ServiceFlags in debug output 2009-06-23 19:26:07 +01:00
Michael Brown 5e1ef98469 [e1000] Ensure descriptor is fully written before sending packet
Reported-by: Mark McLoughlin <markmc@redhat.com>
2009-06-23 18:36:01 +01:00
Michael Brown 58f60df66c [tcp] Avoid rewinding sequence numbers on receiving old duplicate ACKs
Commit 558c1a4 ("[tcp] Improve robustness in the presence of duplicated
received packets") introduced a regression in that an old duplicate
ACK received while in the ESTABLISHED state would pass through normal
ACK processing, including updating tcp->snd_seq.

Fix by ensuring that ACK processing ignores all duplicate ACKs.
2009-06-23 16:10:34 +01:00
Michael Brown 99e64f5806 [tcp] Attempt to catch all possible error cases with debug messages
All TCP errors or unusual events should now generate a debugging
message at DBGLVL_LOG, with enough information (SEQ and ACK numbers)
to be able to identify the corresponding packet (or missing packet) in
a network trace from the remote end.
2009-06-23 14:28:00 +01:00
Michael Brown f4605970f4 [tcp] Include current sequence numbers in "timer expired" messages 2009-06-23 14:03:09 +01:00
Michael Brown a2f753ba64 [tcp] Move high-frequency debug messages to DBGLVL_EXTRA
This makes it possible to leave TCP debugging enabled in order to see
interesting TCP events, without flooding the console with at least one
message per packet.
2009-06-23 13:35:45 +01:00
Joshua Oreman f8448735b0 [image] Modify imgfree command to accept an argument
This resolves potential difficulties occurring when more than one script
is used. Total cost: 88 bytes uncompressed.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-23 10:53:33 +01:00
Joshua Oreman 254bdc2a8e [netdevice] Adjust maximum link-layer header length for 802.11
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-23 10:49:50 +01:00
Joshua Oreman eb3ca2a36f [netdevice] Add netdev argument to link-layer push and pull handlers
In order to construct outgoing link-layer frames or parse incoming
ones properly, some protocols (such as 802.11) need more state than is
available in the existing variables passed to the link-layer protocol
handlers. To remedy this, add struct net_device *netdev as the first
argument to each of these functions, so that more information can be
fetched from the link layer-private part of the network device.

Updated all three call sites (netdevice.c, efi_snp.c, pxe_undi.c) and
both implementations (ethernet.c, ipoib.c) of ll_protocol to use the
new argument.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-23 10:41:57 +01:00
Joshua Oreman 743ebc2f4b [nvs] Add init function for Atmel 93C66 EEPROM
The 93C66 is identical to the 93C56 in programming interface and
addressing, but twice as large in data storage (4096 bits). It's
used in some RTL8185 wireless cards.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-23 10:33:10 +01:00
Michael Brown 558c1a45fe [tcp] Improve robustness in the presence of duplicated received packets
gPXE responds to duplicated ACKs with an immediate retransmission,
which can lead to a sorceror's apprentice syndrome.  It also responds
to out-of-range (or old duplicate) ACKs with a RST, which can cause
valid connections to be dropped.

Fix the sorceror's apprentice syndrome by leaving the retransmission
timer running (and so inhibiting the immediate retransmission) when we
receive a potential duplicate ACK.  This seems to match the behaviour
of Linux observed via wireshark traces.

Fix the RST issue by sending RST only on out-of-range ACKs that occur
before the connection is fully established, as per RFC 793.

These problems were exposed during development of the 802.11 wireless
link layer; the 802.11 protocol has a failure mode that can easily
cause duplicated packets.  The fixes were tested in a controlled way
by faking large numbers of duplicated packets in the rtl8139 driver.

Originally-fixed-by: Joshua Oreman <oremanj@rwcr.net>
2009-06-23 09:40:26 +01:00
Shao Miller 68973f1c49 [settings] Fix setting_cmp() to handle nameless settings
setting_cmp() compares by option tag and then by name.  Empty names
will always match, which gives us a false positive.

Fix by explicitly checking for empty names.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-06-13 12:04:08 +01:00
Michael Brown edfbd4e4fa [netdevice] Fix incorrect value for MAX_LL_HEADER_LEN
MAX_LL_HEADER_LEN is erroneously set to 6 rather than 14, resulting
in possible data corruption whenever we send an ARP packet.

Fix value and add a comment explaining why MAX_LL_ADDR_LEN is greater
than MAX_LL_HEADER_LEN.

Reported-by: Joshua Oreman <oremanj@rwcr.net>
2009-06-05 01:07:27 +01:00
Michael Brown 4c5f00f879 [script] Allow for DOS-style line endings in scripts
Windows text editors such as Notepad tend to use CRLF line endings,
which breaks gPXE's signature detection for script images.  Since
scripts are usually very small, they end up falling back to being
detected as valid PXE executable images (since there are no signature
checks for PXE executables).  Executing text files as x86 machine code
tends not to work well.

Fix by allowing for any isspace() character to terminate the "#!gpxe"
signature, and by ensuring that CR characters get stripped during
command line parsing.

Suggested-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca>
2009-06-03 10:13:29 +01:00
Michael Brown 5e51aaccaa [misc] Remove long-obsolete header files dating from Etherboot 5.4 2009-06-03 10:09:28 +01:00
Michael Brown a5cd8d1772 [misc] Fix source files erroneously marked as executable 2009-06-02 11:26:09 +01:00
Michael Brown 92a9978b44 [spi] Add address-length autodetection to the SPI bit-bashing code
Several SPI chips will respond to an SPI read command with a dummy
zero bit immediately prior to the first real data bit.  This can be
used to autodetect the address length, provided that the command
length and data length are already known, and that the MISO data line
is tied high.

Tested-by: Thomas Miletich <thomas.miletich@gmail.com>
Debugged-by: Thomas Miletich <thomas.miletich@gmail.com>
2009-05-28 19:32:03 +01:00
Michael Brown 8afafb6532 [build] Add -fno-dwarf2-cfi-asm to CFLAGS if supported by the gcc in use
gcc 4.4 defaults to using .cfi assembler directives for debugging
information, which causes unneeded .eh_frame sections to be generated.
These sections are already stripped out by our linker script, so don't
affect the final build, but do distort the output of "size" when run
on individual .o files; the .eh_frame size is included within the size
reported for .text.  This makes it difficult to accurately judge the
effects of source code changes upon object code size.

Fix by adding -fno-dwarf2-cfi-asm to CFLAGS if we detect that this
option is supported by the gcc that we are compiling with.

Tested-by: Daniel Verkamp <daniel@drv.nu>
2009-05-27 02:30:46 +01:00
Daniel Verkamp e47869995f [comboot] Implement stub calls for auxiliary data vector handling
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-05-26 11:43:02 +01:00
Daniel Verkamp 1f80b2dcd5 [ethernet] Add MII link status functions from Linux
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-05-26 11:37:46 +01:00
Daniel Verkamp b8469eddaa [ethernet] Update mii.h and use it in drivers that had a private copy
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-05-26 11:30:31 +01:00
Daniel Verkamp 005fce0258 [ethernet] Move struct mii_if_info to mii.h
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-05-26 11:27:55 +01:00
Michael Brown 3c06277bbb [settings] Allow for arbitrarily-named settings
This provides a mechanism for using arbitrarily-named variables within
gPXE, using the existing syntax for settings.
2009-05-26 11:05:58 +01:00
Michael Brown 822b3b53f4 [multiboot] Include argv[0] as part of "command line"
Grub will include the module name as part of the command line, and
some multiboot kernels expect this to be done.
2009-05-26 06:58:53 +01:00
Michael Brown c345336435 [dhcp] Choose ProxyDHCP port based on presence of PXE options
If the ProxyDHCPOFFER already includes PXE options (i.e. option 60 is
set to "PXEClient" and option 43 is present) then assume that the
ProxyDHCPREQUEST can be sent to port 67, rather than port 4011.  This
is a reasonable assumption, since in that case the ProxyDHCP server
has already demonstrated by responding to the DHCPDISCOVER that it is
listening on port 67.  (If the ProxyDHCP server were not listening on
port 67, then the standard DHCP server would have been configured to
respond with option 60 set to "PXEClient" but no option 43 present.)

The PXE specification is ambiguous on this point; the specified
behaviour covers only the cases in which option 43 is *not* present in
the ProxyDHCPOFFER.  In these cases, we will continue to send the
ProxyDHCPREQUEST to port 4011.

This change is required in order to allow us to interoperate with
dnsmasq, which listens only on port 67.  (dnsmasq relies on
unspecified behaviour of the Intel PXE stack, which it seems will
retain the ProxyDHCPOFFER as an options source and never issue a
ProxyDHCPREQUEST, thereby enabling dnsmasq to omit listening on port
4011.)
2009-05-22 05:42:57 +01:00
Thomas Miletich f51d61371f [serial] Define constants for serial port I/O addresses
Tested with COM1 and COM2.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-05-21 10:04:12 +01:00
Michael Brown 1958974d0a [tftp] Process OACKs even if malformed
IBM Tivoli PXE Server 5.1.0.3 is reported to send trailing garbage
bytes at the end of the OACK packet, which causes gPXE to reject the
packet and abort the TFTP transfer.

Work around the problem by processing as much as possible of the OACK,
and treating name/value parsing errors as non-fatal.

Reported-by: Shao Miller <Shao.Miller@yrdsb.edu.on.ca>
2009-05-20 10:04:50 +01:00
Michael Brown c5a88ed553 [settings] Fix erroneous bit-masking in fetch_uintz_setting() 2009-05-20 08:55:48 +01:00
Michael Brown 3961c1ca02 [dhcp] Send broadcast PXE boot server discovery requests to port 67
We currently send all boot server discovery requests to port 4011.
Section 2.2.1 of the PXE spec states that boot server discovery
packets should be "sent broadcast (port 67), multicast (port 4011), or
unicast (port 4011)".  Adjust our behaviour so that any boot server
discovery packets that are sent to the broadcast address are directed
to port 67 rather than port 4011.

This is required for operation with dnsmasq as a PXE server, since
dnsmasq listens only on port 67, and relies upon this (specified)
behaviour.

This change may break some setups using the (itself very broken) Linux
PXE server from kano.org.uk.  This server will, in its default
configuration, listen only on port 4011.  It never constructs a boot
server list (PXE_BOOT_SERVERS, option 43.8), and uses the wrong
definitions for the discovery control bits (PXE_DISCOVERY_CONTROL,
option 43.6).  The upshot is that it will always instruct the client
to perform multicast and broadcast discovery only.  In setups lacking
a valid multicast route on the server side, this used to work because
gPXE would eventually give up on the (non-responsive) multicast
address and send a broadcast request to port 4011, which the Linux PXE
server would respond to.  Now that gPXE correctly sends this broadcast
request to port 67 instead, it is never seen by the Linux PXE server,
and the boot fails.  The fix is to either (a) set up a multicast route
correctly on the server side before starting the PXE server, or (b)
edit /etc/pxe.conf to contain the server's unicast address in the
"multicast_address" field (a hack that happens to work).

Suggested-by: Simon Kelley <simon@thekelleys.org.uk>
2009-05-20 08:47:39 +01:00
Michael Brown 9119b0c8af [dhcp] Perform ProxyDHCP only if we do not already have PXE options
This prevents gPXE from wasting time attempting to contact a ProxyDHCP
server on port 4011 if the DHCP response already contains the relevant
PXE options.  This behaviour is hinted at (though not explicitly
specified) in the PXE spec, and seems to match what the Intel client
does.

Suggested-by: Simon Kelley <simon@thekelleys.org.uk>
2009-05-20 07:56:29 +01:00
Michael Brown f4bf4e69f7 [legal] Add FILE_LICENCE declaration to romprefix.S 2009-05-18 09:33:36 +01:00
Michael Brown c44a193d0d [legal] Add a selection of FILE_LICENCE declarations
Add FILE_LICENCE declarations to almost all files that make up the
various standard builds of gPXE.
2009-05-18 08:33:25 +01:00
Michael Brown 41307f2874 [legal] Add licence.pl and %.licence make target
It is now possible to run e.g.

  make bin/rtl8139.dsk.licence

in order to see a licensing assessment for any given gPXE build.  The
assessment will either produce a single overall licence for the build
(based on combining all the licences used within the source files for
that build), or will exit with an error stating why a licence
assessment is not possible (for example, if there are files involved
that do not yet contain an explicit FILE_LICENCE() declaration).
2009-05-18 08:29:24 +01:00
Michael Brown a525fb7782 [legal] Add mechanism for explicit per-file licence declarations
For partly historical reasons, various files in the gPXE source tree
are licensed under different, though compatible, terms.  Most of the
code is licensed under GPLv2 with the "or later" clause, but there are
exceptions such as:

  The string.h file, which derives from Linux and is licensed as
  Public Domain.

  The EFI header files, which are taken from the EDK2 source tree and
  are licensed under BSD.

  The 3c90x driver, which has a custom GPL-like licence text.

Introduce a FILE_LICENCE() macro to make licensing more explicit.
This macro should be applied exactly once to each source (.c, .S or
.h) file.  It will cause a corresponding zero-sized common symbol to
be added to any .o files generated from that source file (and hence to
any final gPXE binaries generated from that source file).  Determining
the applicable licences to generated files can then be done using e.g.

  $ objdump -t bin/process.o | grep __licence
  00000000       O *COM*  00000001 .hidden __licence_gpl2_or_later

indicating that bin/process.o is covered entirely by the GPLv2
with the "or later" clause, or

  $ objdump -t bin/rtl8139.dsk.tmp | grep __licence
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_only
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_gpl2_or_later
  00033e8c g     O .bss.textdata  00000000 .hidden __licence_public_domain

indicating that bin/rtl8139.dsk includes both code licensed under
GPLv2 (both with and without the "or later" clause) and code licensed
as Public Domain.

Determining the result of licence combinations is currently left as an
exercise for the reader.
2009-05-18 08:26:08 +01:00
Michael Brown a13fc96cb3 [legacy] Remove long-obsolete old dhcp.h file 2009-05-18 08:24:45 +01:00
Michael Brown 4188d51753 [pxeprefix] Work around bug in Etherboot 5.4 when loading undionly.kpxe
Etherboot 5.4 erroneously treats PXENV_UNLOAD_STACK as the "final
shutdown" call, and unhooks INT15.  When using gPXE's undionly.kpxe,
this results in gPXE overwriting the portion of Etherboot located in
high memory, because it is no longer hidden from the system memory map
at the time that gPXE loads.

Work around this by explicitly testing for Etherboot as the underlying
PXE stack (as is already done in undinet.c) and skipping the call to
PXENV_UNLOAD_STACK if necessary.
2009-04-30 04:48:28 +01:00
Michael Brown 7c47ebd65c [build] Add {PROVIDE,REQUIRE}_SYMBOL macros and tidy up compiler.h 2009-04-27 14:04:35 +01:00
Michael Brown 6e764282dd [i386] Remove long-obsolete realmode.c file 2009-04-26 06:41:54 +01:00
Michael Brown bb06fc17cc [i386] Remove long-obsolete callbacks_arch.h file 2009-04-26 06:38:36 +01:00
Stefan Hajnoczi 9b964dec36 [build] Fix signed/unsigned division in util/zbin.c
Commit b149a99 ([build] Round up SUBx deltas) introduced a
signed/unsigned issue that affects gPXE images built on 32-bit hosts.
The zbin fixup utility performed an unsigned division, which led to
.usb images with an incorrect number of sectors to load.

The issue snuck by on 64-bit hosts since uint32_t is promoted to long.
On 32-bit hosts it is promoted to unsigned long.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-04-26 05:48:15 +01:00
Michael Brown 4b8e021161 [elf] Work around entry point bug in NetBSD kernels
NetBSD kernels are multiboot ELF kernels with an entry point
incorrectly specified as a virtual address rather than a physical
address.

Work around this by looking for the segment that could plausibly
contain the entry point address (interpreted as either a physical or
virtual address), and using that to determine the eventual physical
entry point.

In the event of any ambiguity, precedence is given to interpretation
of the entry point as a physical address.
2009-04-24 03:42:34 +01:00
Michael Brown e960fac8d0 [multiboot] Work around raw-flag bug in Solaris kernels
Solaris kernels are multiboot images with the "raw" flag set,
indicating that the loader should use the raw address fields within
the multiboot header rather than looking for an ELF header.  However,
the Solaris kernel contains garbage data in the raw address fields,
and requires us to use the ELF header instead.

Work around this by always using the ELF header if present.  This
renders the "raw" flag somewhat redundant.
2009-04-24 03:19:47 +01:00
Michael Brown ad027e41e5 [doc] Remove obsolete README.pixify 2009-04-18 17:10:00 +01:00
Michael Brown a1eb4ffdf7 [build] Automatically sort the list of constituent object sizes 2009-04-18 16:20:03 +01:00
Michael Brown ead44dba89 [build] Provide mechanism for listing constituent object sizes
You can now type e.g.

  make bin/rtl8139.rom.sizes

in order to see the (uncompressed) sizes of all of the object files
linked in to bin/rtl8139.rom.  This should make it easier to identify
relevant code bloat.
2009-04-18 15:56:29 +01:00
Michael Brown 3d6b8a67f2 [build] Remove obsolete linker script files 2009-04-17 14:09:14 +01:00
Michael Brown f721067d35 [build] Kill off the multiple-object-per-source-file mechanism
Now that there are no remaining multiple-object source files, kill off
the mechanism in order to simplify the Makefile.
2009-04-17 13:43:35 +01:00
Michael Brown a63ef9207d [build] Kill off the last multiple-object source file
The build mechanism currently allows for multiple objects per source
file.  The only remaining user of this is unnrv2b.S.  Replace this
usage with a separate unnrv2b16.S wrapper file, as is currently used
for e.g. pxeprefix.S and kpxeprefix.S.
2009-04-17 13:38:18 +01:00
Michael Brown f79608b376 [build] Provide mechanism for listing per-target source files
You can now type e.g.

  make bin/rtl8139.rom.deps

to see a list of the source files included in the build of
bin/rtl8139.rom.  This is intended to assist with copyright vetting.

Other new debugging targets include

  make bin/rtl8139.rom.objs

to see a list of object files linked in to bin/rtl8139.rom, and

  make bin/rtl8139.rom.nodeps

to see a list of the source files that are *not* required for the
build of bin/rtl8139.rom.
2009-04-17 12:38:44 +01:00
Michael Brown b4a87daeb9 [build] Simplify use of Getopt::Long in padimg.pl
Sometimes it's just so much fun doing things the complicated way that
you forget to check the man page for the existence of a simpler
syntax.
2009-04-16 06:13:09 +01:00
Michael Brown 7aee624881 [build] Reinstate the .pdsk padded-floppy image format
Some utilities that expect a floppy disk image (e.g. iLO?) may test
for a file of the correct size.  Reinstate the .pdsk image format in
order to provide this if needed.
2009-04-16 06:01:07 +01:00
Michael Brown 7741546a40 [build] Pad .rom, .dsk, and .hd images to 512-byte boundaries
QEMU will silently round down a disk or ROM image file to the nearest
512 bytes.  Fix by always padding .rom, .dsk and .hd images to the
nearest 512-byte boundary.

Originally-fixed-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-04-16 03:15:08 +01:00
Michael Brown b363d19a16 [dhcp] Accept filename via DHCP option 67 as well as BOOTP filename field
Allow options with dedicated BOOTP fields to fall back to using the
equivalent DHCP option if the relevant field is empty.
2009-04-15 21:08:02 +01:00
Timothy Stack cc4363acca [smbios] Add asset tag setting
Add SMBIOS asset tag as a named setting.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-04-15 17:23:18 +01:00
Stefan Hajnoczi 38a1d0fe3f [gdb] Allow resynchronisation with gdb
This replaces the gdbstub's polite NAK behavior with retransmission of
the current outstanding reply packet.  It solves situations where gdb
and gPXE's gdbstub get out of sync due to the lack of flow control in
the gdb protocol spec.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-04-15 17:18:14 +01:00
Stefan Hajnoczi b149a99302 [build] Round up SUBx deltas
The zbin compressor fixup utility rounds down file sizes before
calculating their difference.  This produces incorrect values and may
cause truncated gPXE images to be loaded at boot.

The following example explains the problem:
ilen    = 48 bytes     (uncompressed input file)
olen    = 17 bytes     (compressed output file)
divisor = 16 bytes     (paragraph granularity)
fixmeup = 3 paragraphs (value to fix up)

olen / divisor - ilen / divisor
= 1 - 3
= -2 paragraphs  (old delta calculation)

( align ( olen, divisor ) - align ( ilen, divisor ) ) / divisor
= 2 - 3
= -1 paragraphs  (new delta calculation)

If we perform the SUBx operation with old delta:
fixmeup + -2 = 1 paragraph gets loaded by the prefix

With the new delta:
fixmeup + -1 = 2 paragraphs get loaded by the prefix

The old delta calculation removes the last paragraph; the prefix will
load a truncated copy of gPXE into memory.  We need to load 2
paragraphs since olen is 17 bytes.  Loading only 1 paragraph (16
bytes) would truncate the last byte.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-04-15 16:14:47 +01:00
H. Peter Anvin f44205b9ea [pcbios] Don't use "lret $2" to return from an interrupt
Using "lret $2" to return from an interrupt causes interrupts to be
disabled in the calling program, since the INT instruction will have
disabled interrupts.  Instead, patch CF on the stack and use iret to
return.

Interestingly, the original PC BIOS had this bug in at least one
place.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-04-15 15:45:27 +01:00
Michael Brown dc387547a3 [build] Don't assume the existence of "seq"
The "seq" command is GNU-specific; a BSD userland will not have it.
Use POSIX-conforming "awk" instead.

Reported-by: Joshua Oreman <oremanj@rwcr.net>
Suggested-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-03-31 11:06:35 +01:00
Michael Brown 3dd7ce1c26 [efi] Allow building with non-system libbfd
On Mac OS X, it is necessary to build binutils manually; the system
does not provide bfd.h or the libbfd or libiberty libraries.

Originally-fixed-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 09:36:08 +01:00
Michael Brown 7266aceb39 [efi] Fix compilation on Mac OS X.
The Mac compiler treats "#pragma pack()" as gcc's "#pragma pack(pop)",
and so dies if the pragma pack stack is empty.  Adding a "#pragma
pack(1)" immediately beforehand is enough to keep the Mac compiler
happy.

The combination of "#pragma pack(1)", "#pragma pack()" won't actually
achieve anything on a Mac, but it will at least build.  (With gcc, the
"#pragma pack()" overrides any previous pragmas, so is still useful.)

Suggested-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 07:39:20 +01:00
Joshua Oreman 820b11dc0a [build] Use __SIZE_TYPE__ macro in definition of size_t
This is required in order to build on Mac OS X.

Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-31 07:21:07 +01:00
Joshua Oreman 210bc9e9ba [3c90x] Add missing size_t format specifier
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-31 07:10:40 +01:00
Michael Brown bbd274a1d6 [efi] Use POSIX version of basename() in elf2efi.c
This is required in order to build on Mac OS X.

Suggested-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 07:07:44 +01:00
Michael Brown e3b9e3d04b [build] Add --divide to ASFLAGS if supported by the assembler
Some builds of the GNU assembler will treat a '/' character as a
comment delimiter.  Adding "--divide" will cause it to be treated as a
division operator, as we expect.  The "--divide" option is not
available in all gas versions, so apply it only conditionally.

Suggested-by: Joshua Oreman <oremanj@rwcr.net>
2009-03-31 07:02:17 +01:00
Michael Brown b0c818d7b5 [int13] Improve debugging messages 2009-03-31 06:26:51 +01:00
Michael Brown f7d2168c8e [segment] Add "Requested memory not available" error message
prep_segment() can sometimes fail because an image requests memory
that is already in use by gPXE.  This will happen if
e.g. undionly.kpxe is used to boot memtest86; the memtest86 image is
an old-format kernel that needs to be loaded at 9000:0000, but this
area of memory may well already be in use by the underlying PXE stack.

Add a human-friendly error message, so that the cause is more
immediately visible.
2009-03-31 04:38:48 +01:00
Michael Brown edea441ad5 [resolv] Simplify xfer_redirect() logic
Now that we have xfer_vreopen() as the default .vredirect handler,
sending redirection events can become simpler.
2009-03-30 15:23:57 +01:00
Michael Brown 272e6ddc30 [http] Support HTTP redirection 2009-03-30 13:28:33 +01:00
Michael Brown 323cdf8c4c [xfer] Implement xfer_vreopen() to properly handle redirections
When handling a redirection event, we need to close the existing
connection before opening the new connection.
2009-03-30 13:24:56 +01:00
Michael Brown abc13af070 [bzimage] Support old (pre-2.00 bootloader) Linux kernel formats
This allows gPXE to load memtest86, which is packaged as an old kernel.

Split all code that directly touches the kernel headers out into
bzimage_parse_header() and bzimage_update_header(), to reduce code
size and offset the cost of supporting older kernels.

Total cost of this feature: 11 bytes (uncompressed).
2009-03-30 11:42:19 +01:00
Michael Brown a436dc4014 [build] Avoid always rebuilding bin/embedded.o
bin/embedded.o has a build dependency on bin/.embedded.list, which
gets generated automatically by the Makefile.  However, if the
EMBEDDED_IMAGE list is empty, bin/.embedded.list will never be
created, and so bin/embedded.o will be rebuilt every time due to a
missing dependency.

Fix by forcing bin/.embedded.list to be created even if the list is
empty.
2009-03-27 04:47:20 +00:00
Daniel Verkamp a323a85d9b [digest] md5sum and sha1sum commands
Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-27 04:29:54 +00:00
Michael Brown f3335b83d4 [netdevice] Add debug message for unknown network-layer protocols
Suggested-by: Bill Lortz <Bill.Lortz@premier.org>
2009-03-26 16:14:24 +00:00
Michael Brown 5538a38b9c [pcnet32] Fix received packet corruption
The pcnet32 driver mismanages its RX buffers, with the result that
packets get corrupted if more than one packet arrives between calls to
poll().

Originally-fixed-by: Bill Lortz <Bill.Lortz@premier.org>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Tested-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-03-26 15:44:59 +00:00
Thomas Miletich 03ff8cd3e2 [forcedeth] Add support for newer forcedeth NICs
Also adds the MAC_ADDR_CORRECT flag, to indicate whether or not the
MAC address needs to be fixed up by the driver.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-26 10:26:55 +00:00
Thomas Miletich 3da6f1c7bd [pci] Add driver_data field to struct pci_device_id
Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-26 10:22:15 +00:00
Shao Miller 87b494bbab [time] Add the sleep command
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Thomas Miletich <thomas.miletich@gmail.com>
Modified-by: Michael Brown <mcb30@etherboot.org>
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-26 10:06:04 +00:00
Michael Brown 5bd32315d0 [settings] Fix broken assertion in fetch_string_setting_copy()
Reported-by: Stefan Hajnoczi <stefanha@gmail.com>
2009-03-26 09:50:52 +00:00
Michael Brown 1c67623e37 [build] Enable building with the Intel C compiler (icc) 2009-03-26 07:27:19 +00:00
Marty Connor 16aa435567 [3c90x] Remove src/drivers/3c90x.txt
Most of the 3c90x.txt file is obsolete.  The content from the file has
been placed here:

   http://etherboot.org/wiki/appnotes/3c90x_issues
2009-03-13 12:05:12 -04:00
Thomas Miletich 90c01ef1e4 [3c90x] 3c90x driver rewrite using gPXE API
This is a major rewrite of the legacy etherboot 3c90x driver using the
gPXE API for much improved performance over the legacy driver it
replaces.

This driver has been tested on 3c905, 3c905B, and 3c905C cards.

Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Reviewed-by: Marty Connor <mdc@etherboot.org>
Tested-by: Marty Connor <mdc@etherboot.org>
Tested-by: Daniel Verkamp <daniel@drv.nu>

Signed-off-by: Marty Connor <mdc@etherboot.org>
2009-03-13 11:54:39 -04:00
Michael Brown 3c68ff99ea [tables] Incorporate table data type information into table definition
Eliminate the potential for mismatches between table names and the
table entry data type by incorporating the data type into the
definition of the table, rather than specifying it explicitly in each
table accessor method.
2009-03-13 02:10:21 +00:00
Michael Brown 1266d7902b [tables] Redefine methods for accessing linker tables
Intel's C compiler (icc) chokes on the zero-length arrays that we
currently use as part of the mechanism for accessing linker table
entries.  Abstract away the zero-length arrays, to make a port to icc
easier.

Introduce macros such as for_each_table_entry() to simplify the common
case of iterating over all entries in a linker table.

Represent table names as #defined string constants rather than
unquoted literals; this avoids visual confusion between table names
and C variable or type names, and also allows us to force a
compilation error in the event of incorrect table names.
2009-03-13 02:06:30 +00:00
Michael Brown 3ed468e0c5 [tcp] Avoid setting PSH flag when SYN flag is set
Some firewall devices seem to regard SYN,PSH as an invalid flag
combination and reject the packet.  Fix by setting PSH only if SYN is
not set.

Reported-by: DSE Incorporated <dseinc@gmail.com>
2009-03-10 08:15:47 +00:00
Daniel Verkamp 4397a2a4ca [time] Add the time command
Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-06 15:02:41 +00:00
H. Peter Anvin f3d09b5c79 [pxeprefix] Merge common code between !PXE and PXENV+
The parsing of the !PXE and PXENV+ structures share a fair bit of
code; merge the common code to save a few bytes.

Signed-off-by: Michael Brown <mcb30@etherboot.org>
2009-03-06 14:51:50 +00:00
Michael Brown ec24672db7 [settings] Allow for autovivification of settings blocks
Allow for settings blocks to be created on demand.  This allows for
constructions such as

  set defaults/filename http://bootserver/bootfile
  set defaults/priority 0xff
  dhcp net0
  chain ${filename}

which will boot from the DHCP-provided filename, or from
"http://bootserver/bootfile" if the DHCP server does not provide a
filename.

(Note that "priority" gets interpreted as a signed integer, so setting
"defaults/priority" to 0xff will cause the "defaults" settings block
to have an effective priority of -1.)
2009-03-06 14:40:44 +00:00
Michael Brown f95c919741 [release] Update version to 0.9.7+ post release 2009-03-02 02:29:20 +00:00
622 changed files with 44006 additions and 5942 deletions
+2 -2
View File
@@ -47,13 +47,13 @@ To get qemu running is fairly simple:
8. Build gPXE floppy disk images and pad to 1.44MB
pushd ../../src
make bin/rtl8139.pdsk
make bin/rtl8139.dsk
popd
9. Start qemu
./qemu/i386-softmmu/qemu -L qemu/pc-bios \
-net nic,model=rtl8139 -net tap,ifname=tap0 \
-boot a -fda ../../src/bin/rtl8139.pdsk
-boot a -fda ../../src/bin/rtl8139.dsk
You should see qemu start up, load up gPXE and attempt to boot from
the network.
+15 -3
View File
@@ -22,7 +22,7 @@ ECHO := echo
PRINTF := printf
PERL := /usr/bin/perl
CC := $(CROSS_COMPILE)gcc
CPP := $(CROSS_COMPILE)gcc -E -Wp,-Wall
CPP := $(CC) -E
AS := $(CROSS_COMPILE)as
LD := $(CROSS_COMPILE)ld
SIZE := $(CROSS_COMPILE)size
@@ -35,12 +35,17 @@ PARSEROM := $(PERL) ./util/parserom.pl
MAKEROM := $(PERL) ./util/makerom.pl
SYMCHECK := $(PERL) ./util/symcheck.pl
SORTOBJDUMP := $(PERL) ./util/sortobjdump.pl
PADIMG := $(PERL) ./util/padimg.pl
LICENCE := $(PERL) ./util/licence.pl
NRV2B := ./util/nrv2b
ZBIN := ./util/zbin
ELF2EFI32 := ./util/elf2efi32
ELF2EFI64 := ./util/elf2efi64
EFIROM := ./util/efirom
ICCFIX := ./util/iccfix
DOXYGEN := doxygen
BINUTILS_DIR := /usr
BFD_DIR := $(BINUTILS_DIR)
###############################################################################
#
@@ -50,12 +55,14 @@ SRCDIRS :=
SRCDIRS += libgcc
SRCDIRS += core
SRCDIRS += proto
SRCDIRS += net net/tcp net/udp
SRCDIRS += net net/tcp net/udp net/infiniband net/80211
SRCDIRS += image
SRCDIRS += drivers/bus
SRCDIRS += drivers/net
SRCDIRS += drivers/net/e1000
SRCDIRS += drivers/net/phantom
SRCDIRS += drivers/net/rtl818x
SRCDIRS += drivers/net/ath5k
SRCDIRS += drivers/block
SRCDIRS += drivers/nvs
SRCDIRS += drivers/bitbash
@@ -73,6 +80,11 @@ SRCDIRS += usr
NON_AUTO_SRCS :=
NON_AUTO_SRCS += drivers/net/prism2.c
# INCDIRS lists the include path
#
INCDIRS :=
INCDIRS += include .
###############################################################################
#
# Default build target: build the most common targets and print out a
@@ -117,7 +129,7 @@ install :
#
VERSION_MAJOR = 0
VERSION_MINOR = 9
VERSION_PATCH = 7
VERSION_PATCH = 8
EXTRAVERSION =
MM_VERSION = $(VERSION_MAJOR).$(VERSION_MINOR)
VERSION = $(MM_VERSION).$(VERSION_PATCH)$(EXTRAVERSION)
+180 -37
View File
@@ -52,6 +52,14 @@ VERYCLEANUP += .echocheck
echo :
@$(ECHO) "Using \"$(ECHO_E)\" for \"echo -e\""
###############################################################################
#
# Generate a usable "seq" substitute
#
define seq
$(shell awk 'BEGIN { for ( i = $(1) ; i <= $(2) ; i++ ) print i }')
endef
###############################################################################
#
# Determine host OS
@@ -60,6 +68,22 @@ HOST_OS := $(shell uname -s)
hostos :
@$(ECHO) $(HOST_OS)
###############################################################################
#
# Determine compiler
CCDEFS := $(shell $(CC) -E -x c -c /dev/null -dM | cut -d" " -f2)
ccdefs:
@$(ECHO) $(CCDEFS)
ifeq ($(filter __ICC,$(CCDEFS)),__ICC)
CCTYPE := icc
else
CCTYPE := gcc
endif
cctype:
@$(ECHO) $(CCTYPE)
###############################################################################
#
# Check for tools that can cause failed builds
@@ -103,10 +127,30 @@ oldgas :
# default, even when -ffreestanding is specified. We therefore need
# to disable -fstack-protector if the compiler supports it.
#
ifeq ($(CCTYPE),gcc)
SP_TEST = $(CC) -fno-stack-protector -x c -c /dev/null \
-o /dev/null >/dev/null 2>&1
SP_FLAGS := $(shell $(SP_TEST) && $(ECHO) '-fno-stack-protector')
CFLAGS += $(SP_FLAGS)
endif
# gcc 4.4 generates .eh_frame sections by default, which distort the
# output of "size". Inhibit this.
#
ifeq ($(CCTYPE),gcc)
CFI_TEST = $(CC) -fno-dwarf2-cfi-asm -x c -c /dev/null \
-o /dev/null >/dev/null 2>&1
CFI_FLAGS := $(shell $(CFI_TEST) && $(ECHO) '-fno-dwarf2-cfi-asm')
CFLAGS += $(CFI_FLAGS)
endif
# Some versions of gas choke on division operators, treating them as
# comment markers. Specifying --divide will work around this problem,
# but isn't available on older gas versions.
#
DIVIDE_TEST = $(AS) --divide /dev/null -o /dev/null 2>/dev/null
DIVIDE_FLAGS := $(shell $(DIVIDE_TEST) && $(ECHO) '--divide')
ASFLAGS += $(DIVIDE_FLAGS)
###############################################################################
#
@@ -248,6 +292,11 @@ MAKEDEPS += arch/$(ARCH)/Makefile
include arch/$(ARCH)/Makefile
endif
# Include architecture-specific include path
ifdef ARCH
INCDIRS += arch/$(ARCH)/include
endif
###############################################################################
#
# Source file handling
@@ -276,12 +325,45 @@ autosrcs :
ifdef BIN
# INCDIRS lists the include path
incdirs :
@$(ECHO) $(INCDIRS)
# Common flags
#
CFLAGS += -I include -I arch/$(ARCH)/include -I .
CFLAGS += -Os -ffreestanding
CFLAGS += -Wall -W -Wformat-nonliteral
CFLAGS += $(foreach INC,$(INCDIRS),-I$(INC))
CFLAGS += -Os
CFLAGS += -g
ifeq ($(CCTYPE),gcc)
CFLAGS += -ffreestanding
CFLAGS += -Wall -W -Wformat-nonliteral
endif
ifeq ($(CCTYPE),icc)
CFLAGS += -fno-builtin
CFLAGS += -no-ip
CFLAGS += -no-gcc
CFLAGS += -diag-disable 111 # Unreachable code
CFLAGS += -diag-disable 128 # Unreachable loop
CFLAGS += -diag-disable 170 # Array boundary checks
CFLAGS += -diag-disable 177 # Unused functions
CFLAGS += -diag-disable 181 # printf() format checks
CFLAGS += -diag-disable 188 # enum strictness
CFLAGS += -diag-disable 193 # Undefined preprocessor identifiers
CFLAGS += -diag-disable 280 # switch ( constant )
CFLAGS += -diag-disable 310 # K&R parameter lists
CFLAGS += -diag-disable 424 # Extra semicolon
CFLAGS += -diag-disable 589 # Declarations mid-code
CFLAGS += -diag-disable 593 # Unused variables
CFLAGS += -diag-disable 810 # Casting ints to smaller ints
CFLAGS += -diag-disable 981 # Sequence point violations
CFLAGS += -diag-disable 1292 # Ignored attributes
CFLAGS += -diag-disable 1338 # void pointer arithmetic
CFLAGS += -diag-disable 1361 # Variable-length arrays
CFLAGS += -diag-disable 1418 # Missing prototypes
CFLAGS += -diag-disable 1419 # Missing prototypes
CFLAGS += -diag-disable 1599 # Hidden variables
CFLAGS += -Wall -Wmissing-declarations
endif
CFLAGS += $(EXTRA_CFLAGS)
ASFLAGS += $(EXTRA_ASFLAGS)
LDFLAGS += $(EXTRA_LDFLAGS)
@@ -314,11 +396,21 @@ OBJ_CFLAGS = $(CFLAGS_$(OBJECT)) -DOBJECT=$(subst -,_,$(OBJECT))
$(BIN)/%.flags :
@$(ECHO) $(OBJ_CFLAGS)
# ICC requires postprocessing objects to fix up table alignments
#
ifeq ($(CCTYPE),icc)
POST_O = && $(ICCFIX) $@
POST_O_DEPS := $(ICCFIX)
else
POST_O :=
POST_O_DEPS :=
endif
# Rules for specific object types.
#
COMPILE_c = $(CC) $(CFLAGS) $(CFLAGS_c) $(OBJ_CFLAGS)
RULE_c = $(Q)$(COMPILE_c) -c $< -o $@
RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@
RULE_c = $(Q)$(COMPILE_c) -c $< -o $@ $(POST_O)
RULE_c_to_dbg%.o = $(Q)$(COMPILE_c) -Ddebug_$(OBJECT)=$* -c $< -o $@ $(POST_O)
RULE_c_to_c = $(Q)$(COMPILE_c) -E -c $< > $@
RULE_c_to_s = $(Q)$(COMPILE_c) -S -g0 -c $< -o $@
@@ -346,39 +438,25 @@ define src_template
@$(MKDIR) -p $(dir $(2))
@$(RM) $(2)
@$(TOUCH) $(2)
$(foreach OBJ,$(if $(OBJS_$(4)),$(OBJS_$(4)),$(4)), \
$(call obj_template,$(1),$(2),$(3),$(OBJ)))
@$(PARSEROM) $(1) >> $(2)
endef
# obj_template : generate Makefile rules for a given resultant object
# of a particular source file. (We can have multiple objects per
# source file via the OBJS_xxx list.)
#
# $(1) is the full path to the source file (e.g. "drivers/net/rtl8139.c")
# $(2) is the full path to the .d file (e.g. "bin/deps/drivers/net/rtl8139.d")
# $(3) is the source type (e.g. "c")
# $(4) is the object name (e.g. "rtl8139")
#
define obj_template
@$(CPP) $(CFLAGS) $(CFLAGS_$(3)) $(CFLAGS_$(4)) -DOBJECT=$(4) \
-Wno-error -MM $(1) -MT "$(4)_DEPS" -MG -MP | \
sed 's/_DEPS\s*:/_DEPS =/' >> $(2)
@$(ECHO_E) '\n$$(BIN)/$(4).o : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
-Wno-error -MM $(1) -MG -MP | \
sed 's/\.o\s*:/_DEPS =/' >> $(2)
@$(ECHO_E) '\n$$(BIN)/$(4).o :' \
'$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(4)_DEPS)' \
'\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
'\n\t$$(RULE_$(3))\n' \
'\nBOBJS += $$(BIN)/$(4).o\n' \
$(foreach TGT,$(DEBUG_TARGETS), \
$(if $(RULE_$(3)_to_$(TGT)), \
'\n$$(BIN)/$(4).$(TGT) : $(1) $$(MAKEDEPS) $$($(4)_DEPS)' \
'\n$$(BIN)/$(4).$(TGT) :' \
'$(1) $$(MAKEDEPS) $$(POST_O_DEPS) $$($(4)_DEPS)' \
'\n\t$$(QM)$(ECHO) " [BUILD] $$@"' \
'\n\t$$(RULE_$(3)_to_$(TGT))\n' \
'\n$(TGT)_OBJS += $$(BIN)/$(4).$(TGT)\n' ) ) \
'\n$(2) : $$($(4)_DEPS)\n' \
'\nTAGS : $$($(4)_DEPS)\n' \
>> $(2)
@$(PARSEROM) $(1) >> $(2)
endef
@@ -415,7 +493,7 @@ roms :
#
EMBEDDED_LIST := $(BIN)/.embedded.list
ifeq ($(wildcard $(EMBEDDED_LIST)),)
EMBEDDED_LIST_IMAGE :=
EMBEDDED_LIST_IMAGE := <invalid>
else
EMBEDDED_LIST_IMAGE := $(shell cat $(EMBEDDED_LIST))
endif
@@ -428,7 +506,7 @@ $(EMBEDDED_LIST) :
VERYCLEANUP += $(EMBEDDED_LIST)
EMBEDDED_FILES := $(subst $(COMMA), ,$(EMBEDDED_IMAGE))
EMBED_ALL := $(foreach i,$(shell seq 1 $(words $(EMBEDDED_FILES))),\
EMBED_ALL := $(foreach i,$(call seq,1,$(words $(EMBEDDED_FILES))),\
EMBED ( $(i), \"$(word $(i), $(EMBEDDED_FILES))\",\
\"$(notdir $(word $(i),$(EMBEDDED_FILES)))\" ))
@@ -550,7 +628,7 @@ $(BIN)/%.info :
#
BLIB_LIST := $(BIN)/.blib.list
ifeq ($(wildcard $(BLIB_LIST)),)
BLIB_LIST_OBJS :=
BLIB_LIST_OBJS := <invalid>
else
BLIB_LIST_OBJS := $(shell cat $(BLIB_LIST))
endif
@@ -589,6 +667,55 @@ $(BIN)/%.tmp : $(BLIB) $(MAKEDEPS) $(LDSCRIPT)
$(BIN)/%.map : $(BIN)/%.tmp
@less $(BIN)/$*.tmp.map
# Get objects list for the specified target
#
define objs_list
$(sort $(foreach OBJ_SYMBOL,\
$(filter obj_%,$(shell $(NM) $(1) | cut -d" " -f3)),\
$(patsubst obj_%,%,$(OBJ_SYMBOL))))
endef
$(BIN)/%.objs : $(BIN)/%.tmp
$(Q)$(ECHO) $(call objs_list,$<)
$(BIN)/%.sizes : $(BIN)/%.tmp
$(Q)$(SIZE) -t $(foreach OBJ,$(call objs_list,$<),$(BIN)/$(OBJ).o) | \
sort -g
# Get dependency list for the specified target
#
define deps_list
$(sort $(foreach OBJ,$(call objs_list,$(1)),$($(OBJ)_DEPS)))
endef
$(BIN)/%.deps : $(BIN)/%.tmp
$(Q)$(ECHO) $(call deps_list,$<)
# Get unneeded source files for the specified target
#
define nodeps_list
$(sort $(filter-out $(call deps_list,$(1)),\
$(foreach BOBJ,$(BOBJS),\
$($(basename $(notdir $(BOBJ)))_DEPS))))
endef
$(BIN)/%.nodeps : $(BIN)/%.tmp
$(Q)$(ECHO) $(call nodeps_list,$<)
# Get licensing verdict for the specified target
#
define unlicensed_deps_list
$(shell grep -L FILE_LICENCE $(call deps_list,$(1)))
endef
define licence_list
$(patsubst __licence_%,%,\
$(filter __licence_%,$(shell $(NM) $(1) | cut -d" " -f3)))
endef
$(BIN)/%.licence : $(BIN)/%.tmp
$(QM)$(ECHO) " [LICENCE] $@"
$(Q)$(if $(strip $(call unlicensed_deps_list,$<)),\
echo -n "Unable to determine licence because the following " ;\
echo "files are missing a licence declaration:" ;\
echo $(call unlicensed_deps_list,$<);\
exit 1,\
$(LICENCE) $(call licence_list,$<))
# Extract compression information from intermediate object file
#
$(BIN)/%.zinfo : $(BIN)/%.tmp
@@ -649,6 +776,7 @@ define media_template
@$(ECHO_E) '$$(BIN)/%.$(1) : $$(BIN)/%.$(1).zbin' \
'\n\t$$(QM)$(ECHO) " [FINISH] $$@"' \
'\n\t$$(Q)$$(CP) $$< $$@' \
'\n\t$$(Q)$$(PAD_$(1))' \
'\n\t$$(Q)$$(FINALISE_$(1))' \
> $(2)
@@ -726,16 +854,18 @@ CLEANUP += $(ZBIN)
#
# The EFI image converter
#
ELF2EFI_CFLAGS := -I$(BINUTILS_DIR)/include -I$(BFD_DIR)/include \
-idirafter include -L$(BINUTILS_DIR)/lib -L$(BFD_DIR)/lib \
-lbfd -liberty -lz
$(ELF2EFI32) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -DMDE_CPU_IA32 -idirafter include -O2 \
-o $@ $< -lbfd -liberty
$(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_IA32 -O2 -o $@ $<
CLEANUP += $(ELF2EFI32)
$(ELF2EFI64) : util/elf2efi.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -DMDE_CPU_X64 -idirafter include -O2 \
-o $@ $< -lbfd -liberty
$(Q)$(HOST_CC) $(ELF2EFI_CFLAGS) -DMDE_CPU_X64 -O2 -o $@ $<
CLEANUP += $(ELF2EFI64)
$(EFIROM) : util/efirom.c $(MAKEDEPS)
@@ -743,6 +873,15 @@ $(EFIROM) : util/efirom.c $(MAKEDEPS)
$(Q)$(HOST_CC) -idirafter include -O2 -o $@ $<
CLEANUP += $(EFIROM)
###############################################################################
#
# The ICC fixup utility
#
$(ICCFIX) : util/iccfix.c $(MAKEDEPS)
$(QM)$(ECHO) " [HOSTCC] $@"
$(Q)$(HOST_CC) -idirafter include -O2 -o $@ $<
CLEANUP += $(ICCFIX)
###############################################################################
#
# Auto-incrementing build serial number. Append "bs" to your list of
@@ -823,20 +962,24 @@ endif # defined(BIN)
ifdef BIN
$(BIN)/doxygen.cfg : doxygen.cfg $(MAKEDEPS)
$(PERL) -pe 's{\@SRCDIRS\@}{$(SRCDIRS)}; ' \
$(Q)$(PERL) -pe 's{\@SRCDIRS\@}{$(SRCDIRS)}; ' \
-e 's{\@INCDIRS\@}{$(filter-out .,$(INCDIRS))}; ' \
-e 's{\@BIN\@}{$(BIN)}; ' \
-e 's{\@ARCH\@}{$(ARCH)}; ' \
$< > $@
$(BIN)/doc : $(BIN)/doxygen.cfg
$(DOXYGEN) $<
$(Q)$(DOXYGEN) $<
.PHONY : $(BIN)/doc
VERYCLEANUP += $(BIN)/doc
doc : $(BIN)/doc
doc-clean :
$(Q)$(RM) -r $(BIN)/doc
VERYCLEANUP += $(BIN)/doc
docview :
@[ -f $(BIN)/doc/html/index.html ] || $(MAKE) $(BIN)/doc
@if [ -n "$$BROWSER" ] ; then \
-90
View File
@@ -1,90 +0,0 @@
This file documents the driver changes needed to support use as part
of a PXE stack.
PROPER WAY
==========
1. The probe() routine.
There are three additional fields that need to be filled in the nic
structure: ioaddr, irqno and irq.
ioaddr is the base I/O address and seems to be for information only;
no use will be made of this value other than displaying it on the
screen.
irqno must be the IRQ number for the NIC. For PCI NICs this can
simply be copied from pci->irq.
irq is a function pointer, like poll and transmit. It must point to
the driver's irq() function.
2. The poll() routine.
This must take an additional parameter: "int retrieve". Calling
poll() with retrieve!=0 should function exactly as before. Calling
poll() with retrieve==0 indicates that poll() should check for the
presence of a packet to read, but must *not* read the packet. The
packet will be read by a subsequent call to poll() with retrieve!=0.
The easiest way to implement this is to insert the line
if ( ! retrieve ) return 1;
between the "is there a packet ready" and the "fetch packet" parts of
the existing poll() routine.
Care must be taken that a call to poll() with retrieve==0 does not
clear the NIC's "packet ready" status indicator, otherwise the
subsequent call to poll() with retrieve!=0 will fail because it will
think that there is no packet to read.
poll() should also acknowledge and clear the NIC's "packet received"
interrupt. It does not need to worry about enabling/disabling
interrupts; this is taken care of by calls to the driver's irq()
routine.
Etherboot will forcibly regenerate an interrupt if a packet remains
pending after all interrupts have been acknowledged. You can
therefore get away with having poll() just acknolwedge and clear all
NIC interrupts, without particularly worrying about exactly when this
should be done.
3. The irq() routine.
This is a new routine, with prototype
void DRIVER_irq ( struct nic *nic, irq_action_t action );
"action" takes one of three possible values: ENABLE, DISABLE or FORCE.
ENABLE and DISABLE mean to enable/disable the NIC's "packet received"
interrupt. FORCE means that the NIC should be forced to generate a
fake "packet received" interrupt.
If you are unable to implement FORCE, your NIC will not work when
being driven via the UNDI interface under heavy network traffic
conditions. Since Etherboot's UNDI driver (make bin/undi.zpxe) is the
only program known to use this interface, it probably doesn't really
matter.
QUICK AND DIRTY WAY
===================
It is possible to use the system timer interrupt (IRQ 0) rather than a
genuine NIC interrupt. Since there is a constant stream of timer
interrupts, the net upshot is a whole load of spurious "NIC"
interrupts that have no effect other than to cause unnecessary PXE API
calls. It's inefficient but it works.
To achieve this, simply set nic->irqno=0 in probe() and point nic->irq
to a dummy routine that does nothing. Add the line
if ( ! retrieve ) return 1;
at the beginning of poll(), to prevent the packet being read (and
discarded) when poll() is called with retrieve==0;
UNCONVERTED DRIVERS
===================
Drivers that have not yet been converted should continue to function
when not used as part of a PXE stack, although there will be a
harmless compile-time warning about assignment from an incompatible
pointer type in the probe() function, since the prototype for the
poll() function is missing the "int retrieve" parameter.
+17 -15
View File
@@ -4,22 +4,33 @@ CFLAGS += -march=i386
# Code size reduction.
#
CFLAGS += -fstrength-reduce -fomit-frame-pointer
CFLAGS += -fomit-frame-pointer
# Code size reduction.
#
ifeq ($(CCTYPE),gcc)
CFLAGS += -fstrength-reduce
endif
# Code size reduction. gcc3 needs a different syntax to gcc2 if you
# want to avoid spurious warnings.
#
ifeq ($(CCTYPE),gcc)
GCC_VERSION := $(subst ., ,$(shell $(CC) -dumpversion))
GCC_MAJOR := $(firstword $(GCC_VERSION))
ifeq ($(GCC_MAJOR),2)
CFLAGS += -malign-jumps=1 -malign-loops=1 -malign-functions=1
else
CFLAGS += -falign-jumps=1 -falign-loops=1 -falign-functions=1
endif
endif # gcc2
endif # gcc
# Code size reduction. This is almost always a win. The kernel uses it, too.
# Code size reduction. This is almost always a win. The kernel uses
# it, too.
#
ifeq ($(CCTYPE),gcc)
CFLAGS += -mpreferred-stack-boundary=2
endif
# Code size reduction. Use regparm for all functions - C functions
# called from assembly (or vice versa) need __asmcall now
@@ -27,7 +38,9 @@ CFLAGS += -mpreferred-stack-boundary=2
CFLAGS += -mregparm=3
# Code size reduction. Use -mrtd (same __asmcall requirements as above)
ifeq ($(CCTYPE),gcc)
CFLAGS += -mrtd
endif
# Code size reduction. This is the logical complement to -mregparm=3.
# It doesn't currently buy us anything, but if anything ever tries to
@@ -68,6 +81,7 @@ SRCDIRS += arch/i386/drivers/net
SRCDIRS += arch/i386/interface/pcbios
SRCDIRS += arch/i386/interface/pxe
SRCDIRS += arch/i386/interface/syslinux
SRCDIRS += arch/i386/hci/commands
# The various xxx_loader.c files are #included into core/loader.c and
# should not be compiled directly.
@@ -76,11 +90,6 @@ NON_AUTO_SRCS += arch/i386/core/aout_loader.c
NON_AUTO_SRCS += arch/i386/core/freebsd_loader.c
NON_AUTO_SRCS += arch/i386/core/wince_loader.c
# unnrv2b.S is used to generate a 16-bit as well as a 32-bit object.
#
OBJS_unnrv2b = unnrv2b unnrv2b16
CFLAGS_unnrv2b16 = -DCODE16
# Include common x86 Makefile
#
MAKEDEPS += arch/x86/Makefile
@@ -101,13 +110,6 @@ NON_AUTO_MEDIA += fd0
$(Q)dd if=$< bs=512 conv=sync of=/dev/fd0
$(Q)sync
# rule to create padded disk images
NON_AUTO_MEDIA += pdsk
%pdsk : %dsk
$(QM)$(ECHO) " [DSKPAD] $@"
$(Q)cp $< $@
$(Q)$(PERL) ./util/dskpad.pl $@
# Add NON_AUTO_MEDIA to the media list, so that they show up in the
# output of "make"
#
+18
View File
@@ -27,6 +27,12 @@ MEDIA += raw
MEDIA += com
MEDIA += exe
# Padding rules
#
PAD_rom = $(PADIMG) --blksize=512 --byte=0xff $@
PAD_dsk = $(PADIMG) --blksize=512 $@
PAD_hd = $(PADIMG) --blksize=512 $@
# rule to make a non-emulation ISO boot image
NON_AUTO_MEDIA += iso
%iso: %lkrn util/geniso
@@ -39,6 +45,12 @@ NON_AUTO_MEDIA += liso
$(QM)$(ECHO) " [GENLISO] $@"
$(Q)bash util/genliso $@ $<
# rule to make a syslinux floppy image (mountable, bootable)
NON_AUTO_MEDIA += sdsk
%sdsk: %lkrn util/gensdsk
$(QM)$(ECHO) " [GENSDSK] $@"
$(Q)bash util/gensdsk $@ $<
# Special target for building Master Boot Record binary
$(BIN)/mbr.bin : $(BIN)/mbr.o
$(QM)$(ECHO) " [OBJCOPY] $@"
@@ -53,3 +65,9 @@ NON_AUTO_MEDIA += usb
%usb: $(BIN)/usbdisk.bin %hd
$(QM)$(ECHO) " [FINISH] $@"
$(Q)cat $^ > $@
# Padded floppy image (e.g. for iLO)
NON_AUTO_MEDIA += pdsk
%pdsk : %dsk
$(Q)cp $< $@
$(Q)$(PADIMG) --blksize=1474560 $@
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
-100
View File
@@ -1,100 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
ENTRY(_prefix_start)
SECTIONS {
/* Prefix */
.prefix : {
_verbatim_start = . ;
_prefix_start = . ;
*(.prefix)
. = ALIGN(16);
_prefix_end = . ;
} = 0x9090
_prefix_size = _prefix_end - _prefix_start;
.text.nocompress : {
*(.prefix.udata)
} = 0x9090
decompress_to = . ;
.prefix.zdata : {
_compressed = . ;
*(.prefix.zdata)
_compressed_end = . ;
}
_compressed_size = _compressed_end - _compressed;
. = ALIGN(16);
_verbatim_end = . ;
/* Size of the core of etherboot in memory */
_base_size = _end - _text;
/* _prefix_size is the length of the non-core etherboot prefix */
_prefix_size = _prefix_end - _prefix_start;
/* _verbatim_size is the actual amount that has to be copied to base memory */
_verbatim_size = _verbatim_end - _verbatim_start;
/* _image_size is the amount of base memory needed to run */
_image_size = _base_size + _prefix_size;
/* Standard sizes rounded up to paragraphs */
_prefix_size_pgh = (_prefix_size + 15) / 16;
_verbatim_size_pgh = (_verbatim_size + 15) / 16;
_image_size_pgh = (_image_size + 15) / 16 ;
/* Standard sizes in sectors */
_prefix_size_sct = (_prefix_size + 511) / 512;
_verbatim_size_sct = (_verbatim_size + 511) / 512;
_image_size_sct = (_image_size + 511) / 512;
/* Symbol offsets and sizes for the exe prefix */
_exe_hdr_size = 32;
_exe_size = _verbatim_size; /* Should this be - 32 to exclude the header? */
_exe_size_tail = (_exe_size) % 512;
_exe_size_pages = ((_exe_size) + 511) / 512;
_exe_bss_size = ((_image_size - _verbatim_size) + 15) / 16;
_exe_ss_offset = (_stack_offset + _prefix_size - _exe_hdr_size + 15) / 16 ;
/* This is where we copy the compressed image before decompression.
* Prepare to decompress in place. The end mark is about 8.25 bytes long,
* and the worst case symbol is about 16.5 bytes long. Therefore
* We need to reserve at least 25 bytes of slack here.
* Currently I reserve 2048 bytes of just slack to be safe :)
* 2048 bytes easily falls within the BSS (the defualt stack is 4096 bytes)
* so we really are decompressing in place.
*
* Hmm. I missed a trick. In the very worst case (no compression)
* the encoded data is 9/8 the size as it started out so to be completely
* safe I need to be 1/8 of the uncompressed code size past the end.
* This will still fit compfortably into our bss in any conceivable scenario.
*/
_compressed_copy = _edata + _prefix_size - _compressed_size +
/* The amount to overflow _edata */
MAX( ((_edata - _text + 7) / 8) , 2016 ) + 32;
_assert = ASSERT( ( _compressed_copy - _prefix_size ) < _ebss , "Cannot decompress in place" ) ;
decompress = DEFINED(decompress) ? decompress : 0;
/DISCARD/ : {
*(.comment)
*(.note)
}
/* Symbols used by the prefixes whose addresses are inconvinient
* to compute, at runtime in the code.
*/
image_basemem_size = DEFINED(image_basemem_size)? image_basemem_size : 65536;
image_basemem = DEFINED(image_basemem)? image_basemem : 65536;
_prefix_real_to_prot = _real_to_prot + _prefix_size ;
_prefix_prot_to_real = _prot_to_real + _prefix_size ;
_prefix_image_basemem_size = image_basemem_size + _prefix_size ;
_prefix_image_basemem = image_basemem + _prefix_size ;
_prefix_rm_in_call = _rm_in_call + _prefix_size ;
_prefix_in_call = _in_call + _prefix_size ;
_prefix_rom = rom + _prefix_size ;
_prefix_rm_etherboot_location = rm_etherboot_location + _prefix_size ;
_prefix_stack_end = _stack_end + _prefix_size ;
}
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/io.h>
#include <pic8259.h>
-8
View File
@@ -1,8 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
SECTIONS {
.prefix.udata : {
*(*)
}
}
-8
View File
@@ -1,8 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
SECTIONS {
.prefix.zdata : {
*(*)
}
}
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/** @file
*
* RDTSC timer
-23
View File
@@ -1,23 +0,0 @@
/* Real-mode interface: C portions.
*
* Initial version by Michael Brown <mbrown@fensystems.co.uk>, January 2004.
*/
#include "realmode.h"
/*
* Copy data to/from base memory.
*
*/
#ifdef KEEP_IT_REAL
void memcpy_to_real ( segoff_t dest, void *src, size_t n ) {
}
void memcpy_from_real ( void *dest, segoff_t src, size_t n ) {
}
#endif /* KEEP_IT_REAL */
+2
View File
@@ -9,6 +9,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
/*
* The linker passes in the symbol _max_align, which is the alignment
* that we must preserve, in bytes.
+2
View File
@@ -1,5 +1,7 @@
/* setjmp and longjmp. Use of these functions is deprecated. */
FILE_LICENCE ( GPL2_OR_LATER )
.text
.arch i386
.code32
+2
View File
@@ -1,3 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER )
.arch i386
/****************************************************************************
+2
View File
@@ -1,3 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER )
.arch i386
/****************************************************************************
-8
View File
@@ -1,8 +0,0 @@
/* When linking with an uncompressed image, these symbols are not
* defined so we provide them here.
*/
__decompressor_uncompressed = 0 ;
__decompressor__start = 0 ;
INCLUDE arch/i386/core/start16z.lds
-65
View File
@@ -1,65 +0,0 @@
OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386")
OUTPUT_ARCH(i386)
/* Linker-generated symbols are prefixed with a double underscore.
* Decompressor symbols are prefixed with __decompressor_. All other
* symbols are the same as in the original object file, i.e. the
* runtime addresses.
*/
ENTRY(_start16)
SECTIONS {
.text : {
*(.text)
}
.payload : {
__payload_start = .;
*(.data)
__payload_end = .;
}
/* _payload_size is the size of the binary image appended to
* start16, in bytes.
*/
__payload_size = __payload_end - __payload_start ;
/* _size is the size of the runtime image
* (start32 + the C code), in bytes.
*/
__size = _end - _start ;
/* _decompressor_size is the size of the decompressor, in
* bytes. For a non-compressed image, start16.lds sets
* _decompressor_uncompressed = _decompressor__start = 0.
*/
__decompressor_size = __decompressor_uncompressed - __decompressor__start ;
/* image__size is the total size of the image, after
* decompression and including the decompressor if applicable.
* It is therefore the amount of memory that start16's payload
* needs in order to execute, in bytes.
*/
__image_size = __size + __decompressor_size ;
/* Amount to add to runtime symbols to obtain the offset of
* that symbol within the image.
*/
__offset_adjust = __decompressor_size - _start ;
/* Calculations for the stack
*/
__stack_size = _estack - _stack ;
__offset_stack = _stack + __offset_adjust ;
/* Some symbols will be larger than 16 bits but guaranteed to
* be multiples of 16. We calculate them in paragraphs and
* export these symbols which can be used in 16-bit code
* without risk of overflow.
*/
__image_size_pgh = ( __image_size / 16 );
__start_pgh = ( _start / 16 );
__decompressor_size_pgh = ( __decompressor_size / 16 );
__offset_stack_pgh = ( __offset_stack / 16 );
}
+2
View File
@@ -11,6 +11,8 @@
* your option) any later version.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stddef.h>
#include <gpxe/timer2.h>
#include <gpxe/io.h>
+2
View File
@@ -4,6 +4,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER )
#include "librm.h"
.arch i386
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/io.h>
#include <gpxe/x86_io.h>
+3 -1
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
@@ -135,7 +137,7 @@ static void undipci_remove ( struct pci_device *pci ) {
}
static struct pci_device_id undipci_nics[] = {
PCI_ROM ( 0xffff, 0xffff, "undipci", "UNDI (PCI)" ),
PCI_ROM ( 0xffff, 0xffff, "undipci", "UNDI (PCI)", 0 ),
};
struct pci_driver undipci_driver __pci_driver = {
+2
View File
@@ -1,3 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER )
#define PXENV_UNDI_ISR 0x0014
#define PXENV_UNDI_ISR_IN_START 1
#define PXENV_UNDI_ISR_OUT_OURS 0
+4 -3
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@@ -90,11 +92,10 @@ int undi_load ( struct undi_device *undi, struct undi_rom *undirom ) {
undi_loader_entry = undirom->loader_entry;
__asm__ __volatile__ ( REAL_CODE ( "pushw %%ds\n\t"
"pushw %%ax\n\t"
"lcall *%c2\n\t"
"lcall *undi_loader_entry\n\t"
"addw $4, %%sp\n\t" )
: "=a" ( exit )
: "a" ( __from_data16 ( &undi_loader ) ),
"p" ( __from_data16 ( &undi_loader_entry ) )
: "a" ( __from_data16 ( &undi_loader ) )
: "ebx", "ecx", "edx", "esi", "edi", "ebp" );
/* UNDI API calls may rudely change the status of A20 and not
+9 -7
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <string.h>
#include <pxe.h>
#include <realmode.h>
@@ -173,12 +175,11 @@ static int undinet_call ( struct undi_nic *undinic, unsigned int function,
__asm__ __volatile__ ( REAL_CODE ( "pushw %%es\n\t"
"pushw %%di\n\t"
"pushw %%bx\n\t"
"lcall *%c3\n\t"
"lcall *undinet_entry_point\n\t"
"addw $6, %%sp\n\t" )
: "=a" ( exit ), "=b" ( discard_b ),
"=D" ( discard_D )
: "p" ( __from_data16 ( &undinet_entry_point )),
"b" ( function ),
: "b" ( function ),
"D" ( __from_data16 ( &undinet_params ) )
: "ecx", "edx", "esi", "ebp" );
@@ -688,7 +689,7 @@ int undinet_probe ( struct undi_device *undi ) {
if ( ( rc = undinet_call ( undinic, PXENV_UNDI_GET_INFORMATION,
&undi_info, sizeof ( undi_info ) ) ) != 0 )
goto err_undi_get_information;
memcpy ( netdev->ll_addr, undi_info.PermNodeAddress, ETH_ALEN );
memcpy ( netdev->hw_addr, undi_info.PermNodeAddress, ETH_ALEN );
undinic->irq = undi_info.IntNumber;
if ( undinic->irq > IRQ_MAX ) {
DBGC ( undinic, "UNDINIC %p invalid IRQ %d\n",
@@ -696,7 +697,7 @@ int undinet_probe ( struct undi_device *undi ) {
goto err_bad_irq;
}
DBGC ( undinic, "UNDINIC %p is %s on IRQ %d\n",
undinic, eth_ntoa ( netdev->ll_addr ), undinic->irq );
undinic, eth_ntoa ( netdev->hw_addr ), undinic->irq );
/* Get interface information */
memset ( &undi_iface, 0, sizeof ( undi_iface ) );
@@ -704,8 +705,9 @@ int undinet_probe ( struct undi_device *undi ) {
&undi_iface,
sizeof ( undi_iface ) ) ) != 0 )
goto err_undi_get_iface_info;
DBGC ( undinic, "UNDINIC %p has type %s and link speed %d\n",
undinic, undi_iface.IfaceType, undi_iface.LinkSpeed );
DBGC ( undinic, "UNDINIC %p has type %s, speed %d, flags %08x\n",
undinic, undi_iface.IfaceType, undi_iface.LinkSpeed,
undi_iface.ServiceFlags );
if ( strncmp ( ( ( char * ) undi_iface.IfaceType ), "Etherboot",
sizeof ( undi_iface.IfaceType ) ) == 0 ) {
DBGC ( undinic, "UNDINIC %p Etherboot 5.4 workaround enabled\n",
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
#include <undipreload.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <realmode.h>
#include <bios.h>
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <assert.h>
#include <realmode.h>
#include <console.h>
+21 -10
View File
@@ -15,7 +15,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER )
.text
.arch i386
.code16
@@ -489,6 +491,18 @@ get_mangled_e820:
ret
.size get_mangled_e820, . - get_mangled_e820
/****************************************************************************
* Set/clear CF on the stack as appropriate, assumes stack is as it should
* be immediately before IRET
****************************************************************************
*/
patch_cf:
pushw %bp
movw %sp, %bp
setc 8(%bp) /* Set/reset CF; clears PF, AF, ZF, SF */
popw %bp
ret
/****************************************************************************
* INT 15,e820 handler
****************************************************************************
@@ -500,7 +514,8 @@ int15_e820:
popw %ds
call get_mangled_e820
popw %ds
lret $2
call patch_cf
iret
.size int15_e820, . - int15_e820
/****************************************************************************
@@ -512,7 +527,7 @@ int15_e801:
/* Call previous handler */
pushfw
lcall *%cs:int15_vector
pushfw
call patch_cf
/* Edit result */
pushw %ds
pushw %cs:rm_ds
@@ -524,9 +539,7 @@ int15_e801:
xchgw %ax, %cx
xchgw %bx, %dx
popw %ds
/* Restore flags returned by previous handler and return */
popfw
lret $2
iret
.size int15_e801, . - int15_e801
/****************************************************************************
@@ -538,16 +551,14 @@ int15_88:
/* Call previous handler */
pushfw
lcall *%cs:int15_vector
pushfw
call patch_cf
/* Edit result */
pushw %ds
pushw %cs:rm_ds
popw %ds
call patch_1m
popw %ds
/* Restore flags returned by previous handler and return */
popfw
lret $2
iret
.size int15_88, . - int15_88
/****************************************************************************
+5 -2
View File
@@ -15,6 +15,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
#include <biosint.h>
@@ -63,6 +65,8 @@ void fake_e820 ( void ) {
"cmpl $0x534d4150, %%edx\n\t"
"jne 99f\n\t"
"pushaw\n\t"
"movw %%sp, %%bp\n\t"
"andb $~0x01, 22(%%bp)\n\t" /* Clear return CF */
"leaw e820map(%%bx), %%si\n\t"
"cs rep movsb\n\t"
"popaw\n\t"
@@ -73,8 +77,7 @@ void fake_e820 ( void ) {
"xorl %%ebx,%%ebx\n\t"
"\n1:\n\t"
"popfw\n\t"
"clc\n\t"
"lret $2\n\t"
"iret\n\t"
"\n99:\n\t"
"popfw\n\t"
"ljmp *%%cs:real_int15_vector\n\t" )
+2
View File
@@ -1,3 +1,5 @@
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdio.h>
#include <realmode.h>
#include <bios.h>
+2
View File
@@ -15,6 +15,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <assert.h>
#include <realmode.h>
#include <biosint.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <errno.h>
#include <realmode.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <string.h>
#include <errno.h>
+33
View File
@@ -0,0 +1,33 @@
#include <gpxe/netdevice.h>
#include <gpxe/command.h>
#include <hci/ifmgmt_cmd.h>
#include <pxe_call.h>
FILE_LICENCE ( GPL2_OR_LATER );
static int startpxe_payload ( struct net_device *netdev ) {
if ( netdev->state & NETDEV_OPEN )
pxe_activate ( netdev );
return 0;
}
static int startpxe_exec ( int argc, char **argv ) {
return ifcommon_exec ( argc, argv, startpxe_payload,
"Activate PXE on" );
}
static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
pxe_deactivate();
return 0;
}
struct command pxe_commands[] __command = {
{
.name = "startpxe",
.exec = startpxe_exec,
},
{
.name = "stoppxe",
.exec = stoppxe_exec,
},
};
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
+235 -250
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
@@ -42,9 +44,11 @@ FEATURE ( FEATURE_IMAGE, "bzImage", DHCP_EB_FEATURE_BZIMAGE, 1 );
struct image_type bzimage_image_type __image_type ( PROBE_NORMAL );
/**
* bzImage load context
* bzImage context
*/
struct bzimage_load_context {
struct bzimage_context {
/** Boot protocol version */
unsigned int version;
/** Real-mode kernel portion load segment address */
unsigned int rm_kernel_seg;
/** Real-mode kernel portion load address */
@@ -55,28 +59,14 @@ struct bzimage_load_context {
size_t rm_heap;
/** Command line (offset from rm_kernel) */
size_t rm_cmdline;
/** Command line maximum length */
size_t cmdline_size;
/** Real-mode kernel portion total memory size */
size_t rm_memsz;
/** Non-real-mode kernel portion load address */
userptr_t pm_kernel;
/** Non-real-mode kernel portion file and memory size */
size_t pm_sz;
};
/**
* bzImage execution context
*/
struct bzimage_exec_context {
/** Real-mode kernel portion load segment address */
unsigned int rm_kernel_seg;
/** Real-mode kernel portion load address */
userptr_t rm_kernel;
/** Real-mode heap top (offset from rm_kernel) */
size_t rm_heap;
/** Command line (offset from rm_kernel) */
size_t rm_cmdline;
/** Command line maximum length */
size_t cmdline_size;
/** Video mode */
unsigned int vid_mode;
/** Memory limit */
@@ -85,18 +75,178 @@ struct bzimage_exec_context {
physaddr_t ramdisk_image;
/** Initrd size */
physaddr_t ramdisk_size;
/** Command line magic block */
struct bzimage_cmdline cmdline_magic;
/** bzImage header */
struct bzimage_header bzhdr;
};
/**
* Parse bzImage header
*
* @v image bzImage file
* @v bzimg bzImage context
* @v src bzImage to parse
* @ret rc Return status code
*/
static int bzimage_parse_header ( struct image *image,
struct bzimage_context *bzimg,
userptr_t src ) {
unsigned int syssize;
int is_bzimage;
/* Sanity check */
if ( image->len < ( BZI_HDR_OFFSET + sizeof ( bzimg->bzhdr ) ) ) {
DBGC ( image, "bzImage %p too short for kernel header\n",
image );
return -ENOEXEC;
}
/* Read in header structures */
memset ( bzimg, 0, sizeof ( *bzimg ) );
copy_from_user ( &bzimg->cmdline_magic, src, BZI_CMDLINE_OFFSET,
sizeof ( bzimg->cmdline_magic ) );
copy_from_user ( &bzimg->bzhdr, src, BZI_HDR_OFFSET,
sizeof ( bzimg->bzhdr ) );
/* Calculate size of real-mode portion */
bzimg->rm_filesz =
( ( bzimg->bzhdr.setup_sects ? bzimg->bzhdr.setup_sects : 4 ) + 1 ) << 9;
if ( bzimg->rm_filesz > image->len ) {
DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
image, bzimg->rm_filesz );
return -ENOEXEC;
}
bzimg->rm_memsz = BZI_ASSUMED_RM_SIZE;
/* Calculate size of protected-mode portion */
bzimg->pm_sz = ( image->len - bzimg->rm_filesz );
syssize = ( ( bzimg->pm_sz + 15 ) / 16 );
/* Check for signatures and determine version */
if ( bzimg->bzhdr.boot_flag != BZI_BOOT_FLAG ) {
DBGC ( image, "bzImage %p missing 55AA signature\n", image );
return -ENOEXEC;
}
if ( bzimg->bzhdr.header == BZI_SIGNATURE ) {
/* 2.00+ */
bzimg->version = bzimg->bzhdr.version;
} else {
/* Pre-2.00. Check that the syssize field is correct,
* as a guard against accepting arbitrary binary data,
* since the 55AA check is pretty lax. Note that the
* syssize field is unreliable for protocols between
* 2.00 and 2.03 inclusive, so we should not always
* check this field.
*/
bzimg->version = 0x0100;
if ( bzimg->bzhdr.syssize != syssize ) {
DBGC ( image, "bzImage %p bad syssize %x (expected "
"%x)\n", image, bzimg->bzhdr.syssize, syssize );
return -ENOEXEC;
}
}
/* Determine image type */
is_bzimage = ( ( bzimg->version >= 0x0200 ) ?
( bzimg->bzhdr.loadflags & BZI_LOAD_HIGH ) : 0 );
/* Calculate load address of real-mode portion */
bzimg->rm_kernel_seg = ( is_bzimage ? 0x1000 : 0x9000 );
bzimg->rm_kernel = real_to_user ( bzimg->rm_kernel_seg, 0 );
/* Allow space for the stack and heap */
bzimg->rm_memsz += BZI_STACK_SIZE;
bzimg->rm_heap = bzimg->rm_memsz;
/* Allow space for the command line */
bzimg->rm_cmdline = bzimg->rm_memsz;
bzimg->rm_memsz += BZI_CMDLINE_SIZE;
/* Calculate load address of protected-mode portion */
bzimg->pm_kernel = phys_to_user ( is_bzimage ? BZI_LOAD_HIGH_ADDR
: BZI_LOAD_LOW_ADDR );
/* Extract video mode */
bzimg->vid_mode = bzimg->bzhdr.vid_mode;
/* Extract memory limit */
bzimg->mem_limit = ( ( bzimg->version >= 0x0203 ) ?
bzimg->bzhdr.initrd_addr_max : BZI_INITRD_MAX );
/* Extract command line size */
bzimg->cmdline_size = ( ( bzimg->version >= 0x0206 ) ?
bzimg->bzhdr.cmdline_size : BZI_CMDLINE_SIZE );
DBGC ( image, "bzImage %p version %04x RM %#lx+%#zx PM %#lx+%#zx "
"cmdlen %zd\n", image, bzimg->version,
user_to_phys ( bzimg->rm_kernel, 0 ), bzimg->rm_filesz,
user_to_phys ( bzimg->pm_kernel, 0 ), bzimg->pm_sz,
bzimg->cmdline_size );
return 0;
}
/**
* Update bzImage header in loaded kernel
*
* @v image bzImage file
* @v bzimg bzImage context
* @v dst bzImage to update
*/
static void bzimage_update_header ( struct image *image,
struct bzimage_context *bzimg,
userptr_t dst ) {
/* Set loader type */
if ( bzimg->version >= 0x0200 )
bzimg->bzhdr.type_of_loader = BZI_LOADER_TYPE_GPXE;
/* Set heap end pointer */
if ( bzimg->version >= 0x0201 ) {
bzimg->bzhdr.heap_end_ptr = ( bzimg->rm_heap - 0x200 );
bzimg->bzhdr.loadflags |= BZI_CAN_USE_HEAP;
}
/* Set command line */
if ( bzimg->version >= 0x0202 ) {
bzimg->bzhdr.cmd_line_ptr = user_to_phys ( bzimg->rm_kernel,
bzimg->rm_cmdline );
} else {
bzimg->cmdline_magic.magic = BZI_CMDLINE_MAGIC;
bzimg->cmdline_magic.offset = bzimg->rm_cmdline;
bzimg->bzhdr.setup_move_size = bzimg->rm_memsz;
}
/* Set video mode */
bzimg->bzhdr.vid_mode = bzimg->vid_mode;
/* Set initrd address */
if ( bzimg->version >= 0x0200 ) {
bzimg->bzhdr.ramdisk_image = bzimg->ramdisk_image;
bzimg->bzhdr.ramdisk_size = bzimg->ramdisk_size;
}
/* Write out header structures */
copy_to_user ( dst, BZI_CMDLINE_OFFSET, &bzimg->cmdline_magic,
sizeof ( bzimg->cmdline_magic ) );
copy_to_user ( dst, BZI_HDR_OFFSET, &bzimg->bzhdr,
sizeof ( bzimg->bzhdr ) );
DBGC ( image, "bzImage %p vidmode %d\n", image, bzimg->vid_mode );
}
/**
* Parse kernel command line for bootloader parameters
*
* @v image bzImage file
* @v exec_ctx Execution context
* @v bzimg bzImage context
* @v cmdline Kernel command line
* @ret rc Return status code
*/
static int bzimage_parse_cmdline ( struct image *image,
struct bzimage_exec_context *exec_ctx,
struct bzimage_context *bzimg,
const char *cmdline ) {
char *vga;
char *mem;
@@ -105,13 +255,13 @@ static int bzimage_parse_cmdline ( struct image *image,
if ( ( vga = strstr ( cmdline, "vga=" ) ) ) {
vga += 4;
if ( strcmp ( vga, "normal" ) == 0 ) {
exec_ctx->vid_mode = BZI_VID_MODE_NORMAL;
bzimg->vid_mode = BZI_VID_MODE_NORMAL;
} else if ( strcmp ( vga, "ext" ) == 0 ) {
exec_ctx->vid_mode = BZI_VID_MODE_EXT;
bzimg->vid_mode = BZI_VID_MODE_EXT;
} else if ( strcmp ( vga, "ask" ) == 0 ) {
exec_ctx->vid_mode = BZI_VID_MODE_ASK;
bzimg->vid_mode = BZI_VID_MODE_ASK;
} else {
exec_ctx->vid_mode = strtoul ( vga, &vga, 0 );
bzimg->vid_mode = strtoul ( vga, &vga, 0 );
if ( *vga && ( *vga != ' ' ) ) {
DBGC ( image, "bzImage %p strange \"vga=\""
"terminator '%c'\n", image, *vga );
@@ -122,17 +272,17 @@ static int bzimage_parse_cmdline ( struct image *image,
/* Look for "mem=" */
if ( ( mem = strstr ( cmdline, "mem=" ) ) ) {
mem += 4;
exec_ctx->mem_limit = strtoul ( mem, &mem, 0 );
bzimg->mem_limit = strtoul ( mem, &mem, 0 );
switch ( *mem ) {
case 'G':
case 'g':
exec_ctx->mem_limit <<= 10;
bzimg->mem_limit <<= 10;
case 'M':
case 'm':
exec_ctx->mem_limit <<= 10;
bzimg->mem_limit <<= 10;
case 'K':
case 'k':
exec_ctx->mem_limit <<= 10;
bzimg->mem_limit <<= 10;
break;
case '\0':
case ' ':
@@ -142,7 +292,7 @@ static int bzimage_parse_cmdline ( struct image *image,
"terminator '%c'\n", image, *mem );
break;
}
exec_ctx->mem_limit -= 1;
bzimg->mem_limit -= 1;
}
return 0;
@@ -152,20 +302,20 @@ static int bzimage_parse_cmdline ( struct image *image,
* Set command line
*
* @v image bzImage image
* @v exec_ctx Execution context
* @v bzimg bzImage context
* @v cmdline Kernel command line
* @ret rc Return status code
*/
static int bzimage_set_cmdline ( struct image *image,
struct bzimage_exec_context *exec_ctx,
struct bzimage_context *bzimg,
const char *cmdline ) {
size_t cmdline_len;
/* Copy command line down to real-mode portion */
cmdline_len = ( strlen ( cmdline ) + 1 );
if ( cmdline_len > exec_ctx->cmdline_size )
cmdline_len = exec_ctx->cmdline_size;
copy_to_user ( exec_ctx->rm_kernel, exec_ctx->rm_cmdline,
if ( cmdline_len > bzimg->cmdline_size )
cmdline_len = bzimg->cmdline_size;
copy_to_user ( bzimg->rm_kernel, bzimg->rm_cmdline,
cmdline, cmdline_len );
DBGC ( image, "bzImage %p command line \"%s\"\n", image, cmdline );
@@ -217,14 +367,16 @@ static size_t bzimage_load_initrd ( struct image *image,
}
/* Copy in initrd image body */
if ( address )
memcpy_user ( address, offset, initrd->data, 0, initrd->len );
offset += initrd->len;
if ( address ) {
DBGC ( image, "bzImage %p has initrd %p at [%lx,%lx)\n",
image, initrd, address, ( address + offset ) );
memcpy_user ( address, offset, initrd->data, 0,
initrd->len );
image, initrd, user_to_phys ( address, 0 ),
user_to_phys ( address, offset ) );
}
offset += initrd->len;
/* Round up to 4-byte boundary */
offset = ( ( offset + 0x03 ) & ~0x03 );
return offset;
}
@@ -233,20 +385,19 @@ static size_t bzimage_load_initrd ( struct image *image,
* Load initrds, if any
*
* @v image bzImage image
* @v exec_ctx Execution context
* @v bzimg bzImage context
* @ret rc Return status code
*/
static int bzimage_load_initrds ( struct image *image,
struct bzimage_exec_context *exec_ctx ) {
struct bzimage_context *bzimg ) {
struct image *initrd;
size_t total_len = 0;
physaddr_t address;
int rc;
/* Add up length of all initrd images */
for_each_image ( initrd ) {
for_each_image ( initrd )
total_len += bzimage_load_initrd ( image, initrd, UNULL );
}
/* Give up if no initrd images found */
if ( ! total_len )
@@ -268,7 +419,7 @@ static int bzimage_load_initrds ( struct image *image,
return -ENOBUFS;
}
/* Check that we are within the kernel's range */
if ( ( address + total_len - 1 ) > exec_ctx->mem_limit )
if ( ( address + total_len - 1 ) > bzimg->mem_limit )
continue;
/* Prepare and verify segment */
if ( ( rc = prep_segment ( phys_to_user ( address ), 0,
@@ -279,8 +430,8 @@ static int bzimage_load_initrds ( struct image *image,
}
/* Record initrd location */
exec_ctx->ramdisk_image = address;
exec_ctx->ramdisk_size = total_len;
bzimg->ramdisk_image = address;
bzimg->ramdisk_size = total_len;
/* Construct initrd */
DBGC ( image, "bzImage %p constructing initrd at [%lx,%lx)\n",
@@ -300,60 +451,37 @@ static int bzimage_load_initrds ( struct image *image,
* @ret rc Return status code
*/
static int bzimage_exec ( struct image *image ) {
struct bzimage_exec_context exec_ctx;
struct bzimage_header bzhdr;
struct bzimage_context bzimg;
const char *cmdline = ( image->cmdline ? image->cmdline : "" );
int rc;
/* Initialise context */
memset ( &exec_ctx, 0, sizeof ( exec_ctx ) );
/* Retrieve kernel header */
exec_ctx.rm_kernel_seg = image->priv.ul;
exec_ctx.rm_kernel = real_to_user ( exec_ctx.rm_kernel_seg, 0 );
copy_from_user ( &bzhdr, exec_ctx.rm_kernel, BZI_HDR_OFFSET,
sizeof ( bzhdr ) );
exec_ctx.rm_cmdline = exec_ctx.rm_heap =
( bzhdr.heap_end_ptr + 0x200 );
exec_ctx.vid_mode = bzhdr.vid_mode;
if ( bzhdr.version >= 0x0203 ) {
exec_ctx.mem_limit = bzhdr.initrd_addr_max;
} else {
exec_ctx.mem_limit = BZI_INITRD_MAX;
}
if ( bzhdr.version >= 0x0206 ) {
exec_ctx.cmdline_size = bzhdr.cmdline_size;
} else {
exec_ctx.cmdline_size = BZI_CMDLINE_SIZE;
}
DBG ( "cmdline_size = %zd\n", exec_ctx.cmdline_size );
/* Read and parse header from loaded kernel */
if ( ( rc = bzimage_parse_header ( image, &bzimg,
image->priv.user ) ) != 0 )
return rc;
assert ( bzimg.rm_kernel == image->priv.user );
/* Parse command line for bootloader parameters */
if ( ( rc = bzimage_parse_cmdline ( image, &exec_ctx, cmdline ) ) != 0)
if ( ( rc = bzimage_parse_cmdline ( image, &bzimg, cmdline ) ) != 0)
return rc;
/* Store command line */
if ( ( rc = bzimage_set_cmdline ( image, &exec_ctx, cmdline ) ) != 0 )
if ( ( rc = bzimage_set_cmdline ( image, &bzimg, cmdline ) ) != 0 )
return rc;
/* Load any initrds */
if ( ( rc = bzimage_load_initrds ( image, &exec_ctx ) ) != 0 )
if ( ( rc = bzimage_load_initrds ( image, &bzimg ) ) != 0 )
return rc;
/* Update and store kernel header */
bzhdr.vid_mode = exec_ctx.vid_mode;
bzhdr.ramdisk_image = exec_ctx.ramdisk_image;
bzhdr.ramdisk_size = exec_ctx.ramdisk_size;
copy_to_user ( exec_ctx.rm_kernel, BZI_HDR_OFFSET, &bzhdr,
sizeof ( bzhdr ) );
/* Update kernel header */
bzimage_update_header ( image, &bzimg, bzimg.rm_kernel );
/* Prepare for exiting */
shutdown ( SHUTDOWN_BOOT );
DBGC ( image, "bzImage %p jumping to RM kernel at %04x:0000 "
"(stack %04x:%04zx)\n", image,
( exec_ctx.rm_kernel_seg + 0x20 ),
exec_ctx.rm_kernel_seg, exec_ctx.rm_heap );
"(stack %04x:%04zx)\n", image, ( bzimg.rm_kernel_seg + 0x20 ),
bzimg.rm_kernel_seg, bzimg.rm_heap );
/* Jump to the kernel */
__asm__ __volatile__ ( REAL_CODE ( "movw %w0, %%ds\n\t"
@@ -365,9 +493,9 @@ static int bzimage_exec ( struct image *image ) {
"pushw %w2\n\t"
"pushw $0\n\t"
"lret\n\t" )
: : "r" ( exec_ctx.rm_kernel_seg ),
"r" ( exec_ctx.rm_heap ),
"r" ( exec_ctx.rm_kernel_seg + 0x20 ) );
: : "r" ( bzimg.rm_kernel_seg ),
"r" ( bzimg.rm_heap ),
"r" ( bzimg.rm_kernel_seg + 0x20 ) );
/* There is no way for the image to return, since we provide
* no return address.
@@ -377,157 +505,6 @@ static int bzimage_exec ( struct image *image ) {
return -ECANCELED; /* -EIMPOSSIBLE */
}
/**
* Load and parse bzImage header
*
* @v image bzImage file
* @v load_ctx Load context
* @v bzhdr Buffer for bzImage header
* @ret rc Return status code
*/
static int bzimage_load_header ( struct image *image,
struct bzimage_load_context *load_ctx,
struct bzimage_header *bzhdr ) {
/* Sanity check */
if ( image->len < ( BZI_HDR_OFFSET + sizeof ( *bzhdr ) ) ) {
DBGC ( image, "bzImage %p too short for kernel header\n",
image );
return -ENOEXEC;
}
/* Read and verify header */
copy_from_user ( bzhdr, image->data, BZI_HDR_OFFSET,
sizeof ( *bzhdr ) );
if ( bzhdr->header != BZI_SIGNATURE ) {
DBGC ( image, "bzImage %p bad signature %08x\n",
image, bzhdr->header );
return -ENOEXEC;
}
/* We don't support ancient kernels */
if ( bzhdr->version < 0x0200 ) {
DBGC ( image, "bzImage %p version %04x not supported\n",
image, bzhdr->version );
return -ENOTSUP;
}
/* Calculate load address and size of real-mode portion */
load_ctx->rm_kernel_seg = ( ( bzhdr->loadflags & BZI_LOAD_HIGH ) ?
0x1000 : /* 1000:0000 (bzImage) */
0x9000 ); /* 9000:0000 (zImage) */
load_ctx->rm_kernel = real_to_user ( load_ctx->rm_kernel_seg, 0 );
load_ctx->rm_filesz =
( ( bzhdr->setup_sects ? bzhdr->setup_sects : 4 ) + 1 ) << 9;
load_ctx->rm_memsz = BZI_ASSUMED_RM_SIZE;
if ( load_ctx->rm_filesz > image->len ) {
DBGC ( image, "bzImage %p too short for %zd byte of setup\n",
image, load_ctx->rm_filesz );
return -ENOEXEC;
}
/* Calculate load address and size of non-real-mode portion */
load_ctx->pm_kernel = ( ( bzhdr->loadflags & BZI_LOAD_HIGH ) ?
phys_to_user ( BZI_LOAD_HIGH_ADDR ) :
phys_to_user ( BZI_LOAD_LOW_ADDR ) );
load_ctx->pm_sz = ( image->len - load_ctx->rm_filesz );
DBGC ( image, "bzImage %p version %04x RM %#zx bytes PM %#zx bytes\n",
image, bzhdr->version, load_ctx->rm_filesz, load_ctx->pm_sz );
return 0;
}
/**
* Load real-mode portion of bzImage
*
* @v image bzImage file
* @v load_ctx Load context
* @ret rc Return status code
*/
static int bzimage_load_real ( struct image *image,
struct bzimage_load_context *load_ctx ) {
int rc;
/* Allow space for the stack and heap */
load_ctx->rm_memsz += BZI_STACK_SIZE;
load_ctx->rm_heap = load_ctx->rm_memsz;
/* Allow space for the command line */
load_ctx->rm_cmdline = load_ctx->rm_memsz;
load_ctx->rm_memsz += BZI_CMDLINE_SIZE;
/* Prepare, verify, and load the real-mode segment */
if ( ( rc = prep_segment ( load_ctx->rm_kernel, load_ctx->rm_filesz,
load_ctx->rm_memsz ) ) != 0 ) {
DBGC ( image, "bzImage %p could not prepare RM segment: %s\n",
image, strerror ( rc ) );
return rc;
}
memcpy_user ( load_ctx->rm_kernel, 0, image->data, 0,
load_ctx->rm_filesz );
return 0;
}
/**
* Load non-real-mode portion of bzImage
*
* @v image bzImage file
* @v load_ctx Load context
* @ret rc Return status code
*/
static int bzimage_load_non_real ( struct image *image,
struct bzimage_load_context *load_ctx ) {
int rc;
/* Prepare, verify and load the non-real-mode segment */
if ( ( rc = prep_segment ( load_ctx->pm_kernel, load_ctx->pm_sz,
load_ctx->pm_sz ) ) != 0 ) {
DBGC ( image, "bzImage %p could not prepare PM segment: %s\n",
image, strerror ( rc ) );
return rc;
}
memcpy_user ( load_ctx->pm_kernel, 0, image->data, load_ctx->rm_filesz,
load_ctx->pm_sz );
return 0;
}
/**
* Update and store bzImage header
*
* @v image bzImage file
* @v load_ctx Load context
* @v bzhdr Original bzImage header
* @ret rc Return status code
*/
static int bzimage_write_header ( struct image *image __unused,
struct bzimage_load_context *load_ctx,
struct bzimage_header *bzhdr ) {
struct bzimage_cmdline cmdline;
/* Update the header and copy it into the loaded kernel */
bzhdr->type_of_loader = BZI_LOADER_TYPE_GPXE;
if ( bzhdr->version >= 0x0201 ) {
bzhdr->heap_end_ptr = ( load_ctx->rm_heap - 0x200 );
bzhdr->loadflags |= BZI_CAN_USE_HEAP;
}
if ( bzhdr->version >= 0x0202 ) {
bzhdr->cmd_line_ptr = user_to_phys ( load_ctx->rm_kernel,
load_ctx->rm_cmdline );
} else {
cmdline.magic = BZI_CMDLINE_MAGIC;
cmdline.offset = load_ctx->rm_cmdline;
copy_to_user ( load_ctx->rm_kernel, BZI_CMDLINE_OFFSET,
&cmdline, sizeof ( cmdline ) );
bzhdr->setup_move_size = load_ctx->rm_memsz;
}
copy_to_user ( load_ctx->rm_kernel, BZI_HDR_OFFSET,
bzhdr, sizeof ( *bzhdr ) );
return 0;
}
/**
* Load bzImage image into memory
*
@@ -535,35 +512,43 @@ static int bzimage_write_header ( struct image *image __unused,
* @ret rc Return status code
*/
int bzimage_load ( struct image *image ) {
struct bzimage_load_context load_ctx;
struct bzimage_header bzhdr;
struct bzimage_context bzimg;
int rc;
/* Initialise context */
memset ( &load_ctx, 0, sizeof ( load_ctx ) );
/* Load and verify header */
if ( ( rc = bzimage_load_header ( image, &load_ctx, &bzhdr ) ) != 0 )
/* Read and parse header from image */
if ( ( rc = bzimage_parse_header ( image, &bzimg,
image->data ) ) != 0 )
return rc;
/* This is a bzImage image, valid or otherwise */
if ( ! image->type )
image->type = &bzimage_image_type;
/* Load real-mode portion */
if ( ( rc = bzimage_load_real ( image, &load_ctx ) ) != 0 )
/* Prepare segments */
if ( ( rc = prep_segment ( bzimg.rm_kernel, bzimg.rm_filesz,
bzimg.rm_memsz ) ) != 0 ) {
DBGC ( image, "bzImage %p could not prepare RM segment: %s\n",
image, strerror ( rc ) );
return rc;
}
if ( ( rc = prep_segment ( bzimg.pm_kernel, bzimg.pm_sz,
bzimg.pm_sz ) ) != 0 ) {
DBGC ( image, "bzImage %p could not prepare PM segment: %s\n",
image, strerror ( rc ) );
return rc;
}
/* Load non-real-mode portion */
if ( ( rc = bzimage_load_non_real ( image, &load_ctx ) ) != 0 )
return rc;
/* Load segments */
memcpy_user ( bzimg.rm_kernel, 0, image->data,
0, bzimg.rm_filesz );
memcpy_user ( bzimg.pm_kernel, 0, image->data,
bzimg.rm_filesz, bzimg.pm_sz );
/* Update and write out header */
if ( ( rc = bzimage_write_header ( image, &load_ctx, &bzhdr ) ) != 0 )
return rc;
bzimage_update_header ( image, &bzimg, bzimg.rm_kernel );
/* Record real-mode segment in image private data field */
image->priv.ul = load_ctx.rm_kernel_seg;
image->priv.user = bzimg.rm_kernel;
return 0;
}
+2
View File
@@ -23,6 +23,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+2
View File
@@ -23,6 +23,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <errno.h>
#include <elf.h>
#include <gpxe/image.h>
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
+23 -13
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
@@ -139,10 +141,11 @@ static void multiboot_build_memmap ( struct image *image,
/**
* Add command line in base memory
*
* @v imgname Image name
* @v cmdline Command line
* @ret physaddr Physical address of command line
*/
physaddr_t multiboot_add_cmdline ( const char *cmdline ) {
physaddr_t multiboot_add_cmdline ( const char *imgname, const char *cmdline ) {
char *mb_cmdline;
if ( ! cmdline )
@@ -153,7 +156,7 @@ physaddr_t multiboot_add_cmdline ( const char *cmdline ) {
mb_cmdline_offset +=
( snprintf ( mb_cmdline,
( sizeof ( mb_cmdlines ) - mb_cmdline_offset ),
"%s", cmdline ) + 1 );
"%s %s", imgname, cmdline ) + 1 );
/* Truncate to terminating NUL in buffer if necessary */
if ( mb_cmdline_offset > sizeof ( mb_cmdlines ) )
@@ -208,8 +211,8 @@ multiboot_build_module_list ( struct image *image,
( ( count - insert ) * sizeof ( *module ) ) );
module->mod_start = start;
module->mod_end = end;
module->string =
multiboot_add_cmdline ( module_image->cmdline );
module->string = multiboot_add_cmdline ( module_image->name,
module_image->cmdline );
module->reserved = 0;
/* We promise to page-align modules */
@@ -267,7 +270,7 @@ static int multiboot_exec ( struct image *image ) {
multiboot_build_memmap ( image, &mbinfo, mbmemmap,
( sizeof(mbmemmap) / sizeof(mbmemmap[0]) ) );
mb_cmdline_offset = 0;
mbinfo.cmdline = multiboot_add_cmdline ( image->cmdline );
mbinfo.cmdline = multiboot_add_cmdline ( image->name, image->cmdline );
mbinfo.mods_count = multiboot_build_module_list ( image, mbmodules,
( sizeof(mbmodules) / sizeof(mbmodules[0]) ) );
mbinfo.mods_addr = virt_to_phys ( mbmodules );
@@ -360,6 +363,13 @@ static int multiboot_load_raw ( struct image *image,
userptr_t buffer;
int rc;
/* Sanity check */
if ( ! ( hdr->mb.flags & MB_FLAG_RAW ) ) {
DBGC ( image, "MULTIBOOT %p is not flagged as a raw image\n",
image );
return -EINVAL;
}
/* Verify and prepare segment */
offset = ( hdr->offset - hdr->mb.header_addr + hdr->mb.load_addr );
filesz = ( hdr->mb.load_end_addr ?
@@ -432,14 +442,14 @@ static int multiboot_load ( struct image *image ) {
return -ENOTSUP;
}
/* Load the actual image */
if ( hdr.mb.flags & MB_FLAG_RAW ) {
if ( ( rc = multiboot_load_raw ( image, &hdr ) ) != 0 )
return rc;
} else {
if ( ( rc = multiboot_load_elf ( image ) ) != 0 )
return rc;
}
/* There is technically a bit MB_FLAG_RAW to indicate whether
* this is an ELF or a raw image. In practice, grub will use
* the ELF header if present, and Solaris relies on this
* behaviour.
*/
if ( ( ( rc = multiboot_load_elf ( image ) ) != 0 ) &&
( ( rc = multiboot_load_raw ( image, &hdr ) ) != 0 ) )
return rc;
return 0;
}
+8 -10
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @file
*
@@ -42,28 +44,24 @@ struct image_type pxe_image_type __image_type ( PROBE_PXE );
* @ret rc Return status code
*/
static int pxe_exec ( struct image *image ) {
struct net_device *netdev;
int rc;
/* Ensure that PXE stack is ready to use */
pxe_init_structures();
pxe_hook_int1a();
/* Arbitrarily pick the most recently opened network device */
pxe_set_netdev ( last_opened_netdev() );
/* Many things will break if pxe_netdev is NULL */
if ( ! pxe_netdev ) {
if ( ( netdev = last_opened_netdev() ) == NULL ) {
DBGC ( image, "IMAGE %p could not locate PXE net device\n",
image );
return -ENODEV;
}
/* Activate PXE */
pxe_activate ( netdev );
/* Start PXE NBP */
rc = pxe_start_nbp();
/* Deactivate PXE */
pxe_set_netdev ( NULL );
pxe_unhook_int1a();
pxe_deactivate();
return rc;
}
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <realmode.h>
#include <bios.h>
+2
View File
@@ -1,6 +1,8 @@
#ifndef BASEMEM_PACKET_H
#define BASEMEM_PACKET_H
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
/** Maximum length of base memory packet buffer */
+2
View File
@@ -1,6 +1,8 @@
#ifndef BIOS_H
#define BIOS_H
FILE_LICENCE ( GPL2_OR_LATER );
#define BDA_SEG 0x0040
#define BDA_FBMS 0x0013
#define BDA_NUM_DRIVES 0x0075
+2
View File
@@ -6,6 +6,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
struct segoff;
+2
View File
@@ -1,6 +1,8 @@
#ifndef ETHERBOOT_BITS_BYTESWAP_H
#define ETHERBOOT_BITS_BYTESWAP_H
FILE_LICENCE ( GPL2_OR_LATER );
static inline __attribute__ ((always_inline, const)) uint16_t
__bswap_variable_16(uint16_t x)
{
+2
View File
@@ -1,6 +1,8 @@
#ifndef _BITS_COMPILER_H
#define _BITS_COMPILER_H
FILE_LICENCE ( GPL2_OR_LATER );
#ifndef ASSEMBLY
/** Declare a function with standard calling conventions */
+2
View File
@@ -1,6 +1,8 @@
#ifndef ETHERBOOT_BITS_ENDIAN_H
#define ETHERBOOT_BITS_ENDIAN_H
FILE_LICENCE ( GPL2_OR_LATER );
#define __BYTE_ORDER __LITTLE_ENDIAN
#endif /* ETHERBOOT_BITS_ENDIAN_H */
+2
View File
@@ -1,6 +1,8 @@
#ifndef _BITS_ERRFILE_H
#define _BITS_ERRFILE_H
FILE_LICENCE ( GPL2_OR_LATER );
/**
* @addtogroup errfile Error file identifiers
* @{
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/x86_io.h>
#endif /* _BITS_IO_H */
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/bios_nap.h>
#include <gpxe/efi/efix86_nap.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/bios_smbios.h>
#endif /* _BITS_SMBIOS_H */
+4 -2
View File
@@ -1,8 +1,10 @@
#ifndef _BITS_STDINT_H
#define _BITS_STDINT_H
typedef unsigned int size_t;
typedef signed int ssize_t;
FILE_LICENCE ( GPL2_OR_LATER );
typedef __SIZE_TYPE__ size_t;
typedef signed long ssize_t;
typedef signed long off_t;
typedef unsigned char uint8_t;
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/bios_timer.h>
#include <gpxe/rdtsc_timer.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <librm.h>
#endif /* _BITS_UACCESS_H */
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <gpxe/memtop_umalloc.h>
#endif /* _BITS_UMALLOC_H */
+2
View File
@@ -6,6 +6,8 @@
* x86 bootsector image format
*/
FILE_LICENCE ( GPL2_OR_LATER );
extern int call_bootsector ( unsigned int segment, unsigned int offset,
unsigned int drive );
+5
View File
@@ -1,6 +1,8 @@
#ifndef _BZIMAGE_H
#define _BZIMAGE_H
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
/**
@@ -75,6 +77,9 @@ struct bzimage_header {
/** Offset of bzImage header within kernel image */
#define BZI_HDR_OFFSET 0x1f1
/** bzImage boot flag value */
#define BZI_BOOT_FLAG 0xaa55
/** bzImage magic signature value */
#define BZI_SIGNATURE 0x53726448
-243
View File
@@ -1,243 +0,0 @@
/* Callout/callback interface for Etherboot
*
* This file provides the mechanisms for making calls from Etherboot
* to external programs and vice-versa.
*
* Initial version by Michael Brown <mbrown@fensystems.co.uk>, January 2004.
*
* $Id$
*/
#ifndef CALLBACKS_ARCH_H
#define CALLBACKS_ARCH_H
/* Skip the definitions that won't make sense to the assembler */
#ifndef ASSEMBLY
/* Struct to hold general-purpose register values. PUSHAL and POPAL
* can work directly with this structure; do not change the order of
* registers.
*/
typedef struct {
union {
uint16_t di;
uint32_t edi;
};
union {
uint16_t si;
uint32_t esi;
};
union {
uint16_t bp;
uint32_t ebp;
};
union {
uint16_t sp;
uint32_t esp;
};
union {
struct {
uint8_t bl;
uint8_t bh;
} PACKED;
uint16_t bx;
uint32_t ebx;
};
union {
struct {
uint8_t dl;
uint8_t dh;
} PACKED;
uint16_t dx;
uint32_t edx;
};
union {
struct {
uint8_t cl;
uint8_t ch;
} PACKED;
uint16_t cx;
uint32_t ecx;
};
union {
struct {
uint8_t al;
uint8_t ah;
} PACKED;
uint16_t ax;
uint32_t eax;
};
} regs_t;
/* Struct to hold segment register values. Don't change the order;
* many bits of assembly code rely on it.
*/
typedef struct {
uint16_t cs;
uint16_t ss;
uint16_t ds;
uint16_t es;
uint16_t fs;
uint16_t gs;
} PACKED seg_regs_t;
/* Struct for a GDT descriptor */
typedef struct {
uint16_t limit;
uint32_t address;
uint16_t padding;
} PACKED gdt_descriptor_t;
/* Struct for a GDT entry. Use GDT_SEGMENT() to fill it in.
*/
typedef struct {
uint16_t limit_0_15;
uint16_t base_0_15;
uint8_t base_16_23;
uint8_t accessed__type__sflag__dpl__present;
uint8_t limit_16_19__avl__size__granularity;
uint8_t base_24_31;
} PACKED gdt_segment_t;
#define GDT_SEGMENT(base,limit,type,sflag,dpl,avl,size,granularity) \
( (gdt_segment_t) { \
( (limit) & 0xffff ), \
( (base) & 0xffff ), \
( ( (base) >> 16 ) & 0xff ), \
( ( 1 << 0 ) | ( (type) << 1 ) | \
( (sflag) << 4 ) | ( (dpl) << 5 ) | ( 1 << 7 ) ), \
( ( (limit) >> 16 ) | \
( (avl) << 4 ) | ( (size) << 5 ) | ( (granularity) << 7 ) ),\
( (base) >> 24 ) \
} )
#define GDT_SEGMENT_BASE(gdt_segment) \
( (gdt_segment)->base_0_15 | \
(gdt_segment)->base_16_23 << 16 | \
(gdt_segment)->base_24_31 << 24 )
#define GDT_SEGMENT_LIMIT(gdt_segment) \
( (gdt_segment)->limit_0_15 | \
( ( (gdt_segment)->limit_16_19__avl__size__granularity \
& 0xf ) << 16 ) )
#define GDT_SEGMENT_GRANULARITY(gdt_segment) \
( ( (gdt_segment)->limit_16_19__avl__size__granularity \
& 0x80 ) >> 7 )
#define GDT_SEGMENT_TYPE(gdt_segment) \
( ( (gdt_segment)->accessed__type__sflag__dpl__present & 0x0e ) >> 1 )
#define GDT_SEGMENT_SIZE(gdt_segment) \
( ( (gdt_segment)->limit_16_19__avl__size__granularity \
& 0x60 ) >> 5 )
#define GDT_TYPE_DATA (0x0)
#define GDT_TYPE_STACK (0x2)
#define GDT_TYPE_WRITEABLE (0x1)
#define GDT_TYPE_CODE (0x6)
#define GDT_TYPE_EXEC_ONLY_CODE (0x4)
#define GDT_TYPE_CONFORMING (0x1)
#define GDT_SFLAG_SYSTEM (0)
#define GDT_SFLAG_NORMAL (1)
#define GDT_AVL_NORMAL (0)
#define GDT_SIZE_16BIT (0x0)
#define GDT_SIZE_32BIT (0x2)
#define GDT_SIZE_64BIT (0x1)
#define GDT_SIZE_UNKNOWN (0x3)
#define GDT_GRANULARITY_SMALL (0)
#define GDT_GRANULARITY_LARGE (1)
#define GDT_SEGMENT_NORMAL(base,limit,type,size,granularity) \
GDT_SEGMENT ( base, limit, type, \
GDT_SFLAG_NORMAL, 0, GDT_AVL_NORMAL, \
size, granularity )
/* Protected mode code segment */
#define GDT_SEGMENT_PMCS(base) GDT_SEGMENT_NORMAL ( \
base, 0xfffff, GDT_TYPE_CODE | GDT_TYPE_CONFORMING, \
GDT_SIZE_32BIT, GDT_GRANULARITY_LARGE )
#define GDT_SEGMENT_PMCS_PHYS GDT_SEGMENT_PMCS(0)
/* Protected mode data segment */
#define GDT_SEGMENT_PMDS(base) GDT_SEGMENT_NORMAL ( \
base, 0xfffff, GDT_TYPE_DATA | GDT_TYPE_WRITEABLE, \
GDT_SIZE_32BIT, GDT_GRANULARITY_LARGE )
#define GDT_SEGMENT_PMDS_PHYS GDT_SEGMENT_PMDS(0)
/* Real mode code segment */
/* Not sure if there's any reason to use GDT_TYPE_EXEC_ONLY_CODE
* instead of just GDT_TYPE_CODE, but that's what our old GDT did and
* it worked, so I'm not changing it.
*/
#define GDT_SEGMENT_RMCS(base) GDT_SEGMENT_NORMAL ( \
base, 0xffff, GDT_TYPE_EXEC_ONLY_CODE | GDT_TYPE_CONFORMING, \
GDT_SIZE_16BIT, GDT_GRANULARITY_SMALL )
/* Real mode data segment */
#define GDT_SEGMENT_RMDS(base) GDT_SEGMENT_NORMAL ( \
base, 0xffff, GDT_TYPE_DATA | GDT_TYPE_WRITEABLE, \
GDT_SIZE_16BIT, GDT_GRANULARITY_SMALL )
/* Long mode code segment */
#define GDT_SEGMENT_LMCS(base) GDT_SEGMENT_NORMAL ( \
base, 0xfffff, GDT_TYPE_CODE | GDT_TYPE_CONFORMING, \
GDT_SIZE_64BIT, GDT_GRANULARITY_LARGE )
#define GDT_SEGMENT_LMCS_PHYS GDT_SEGMENT_LMCS(0)
/* Long mode data segment */
/* AFIACT, GDT_SIZE_64BIT applies only to code segments */
#define GDT_SEGMENT_LMDS(base) GDT_SEGMENT_NORMAL ( \
base, 0xfffff, GDT_TYPE_DATA | GDT_TYPE_WRITEABLE, \
GDT_SIZE_32BIT, GDT_GRANULARITY_LARGE )
#define GDT_SEGMENT_LMDS_PHYS GDT_SEGMENT_LMDS(0)
/* Template for creating GDT structures (including segment register
* lists), suitable for passing as parameters to external_call().
*/
#define GDT_STRUCT_t(num_segments) \
struct { \
gdt_descriptor_t descriptor; \
gdt_segment_t segments[num_segments]; \
} PACKED
/* And utility function for filling it in */
#define GDT_ADJUST(structure) { \
(structure)->descriptor.address = \
virt_to_phys(&((structure)->descriptor.limit)); \
(structure)->descriptor.limit = \
sizeof((structure)->segments) + 8 - 1; \
(structure)->descriptor.padding = 0; \
}
/* Data passed in to in_call() by assembly wrapper.
*/
typedef struct {
regs_t regs;
seg_regs_t seg_regs;
gdt_descriptor_t gdt_desc;
uint32_t flags;
struct {
uint32_t offset;
uint32_t segment;
} ret_addr;
} PACKED i386_pm_in_call_data_t;
typedef struct {
seg_regs_t seg_regs;
union {
uint16_t pad;
uint16_t prefix_sp;
};
uint16_t flags;
struct {
uint16_t offset;
uint16_t segment;
} ret_addr;
uint32_t orig_opcode;
} PACKED i386_rm_in_call_data_t;
typedef struct {
i386_pm_in_call_data_t *pm;
i386_rm_in_call_data_t *rm;
} i386_in_call_data_t;
#define in_call_data_t i386_in_call_data_t
/* Function prototypes
*/
extern int install_rm_callback_interface ( void *address, size_t available );
#endif /* ASSEMBLY */
#define RM_IN_CALL (0)
#define RM_IN_CALL_FAR (2)
#endif /* CALLBACKS_ARCH_H */
+2
View File
@@ -7,6 +7,8 @@
* SYSLINUX COMBOOT
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <setjmp.h>
#include <gpxe/in.h>
+2
View File
@@ -1,6 +1,8 @@
#ifndef _FAKEE820_H
#define _FAKEE820_H
FILE_LICENCE ( GPL2_OR_LATER );
extern void fake_e820 ( void );
extern void unfake_e820 ( void );
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <gpxe/acpi.h>
#include <gpxe/if_ether.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef NAP_PCBIOS
#define NAP_PREFIX_pcbios
#else
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef SMBIOS_PCBIOS
#define SMBIOS_PREFIX_pcbios
#else
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef TIMER_PCBIOS
#define TIMER_PREFIX_pcbios
#else
+2
View File
@@ -28,6 +28,8 @@
*
*/
FILE_LICENCE ( BSD2 );
/** @file
*
* iSCSI boot firmware table
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef UMALLOC_MEMTOP
#define UMALLOC_PREFIX_memtop
#else
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef TIMER_RDTSC
#define TIMER_PREFIX_rdtsc
#else
+125
View File
@@ -0,0 +1,125 @@
#ifndef _GPXE_SBFT_H
#define _GPXE_SBFT_H
/*
* Copyright (C) 2009 Fen Systems Ltd <mbrown@fensystems.co.uk>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
FILE_LICENCE ( BSD2 );
/** @file
*
* SRP boot firmware table
*
* The working draft specification for the SRP boot firmware table can
* be found at
*
* http://etherboot.org/wiki/srp/sbft
*
*/
#include <stdint.h>
#include <gpxe/acpi.h>
#include <gpxe/scsi.h>
#include <gpxe/srp.h>
#include <gpxe/ib_srp.h>
/** SRP Boot Firmware Table signature */
#define SBFT_SIG "sBFT"
/** An offset from the start of the sBFT */
typedef uint16_t sbft_off_t;
/**
* SRP Boot Firmware Table
*/
struct sbft_table {
/** ACPI header */
struct acpi_description_header acpi;
/** Offset to SCSI subtable */
sbft_off_t scsi_offset;
/** Offset to SRP subtable */
sbft_off_t srp_offset;
/** Offset to IB subtable, if present */
sbft_off_t ib_offset;
/** Reserved */
uint8_t reserved[6];
} __attribute__ (( packed ));
/**
* sBFT SCSI subtable
*/
struct sbft_scsi_subtable {
/** LUN */
struct scsi_lun lun;
} __attribute__ (( packed ));
/**
* sBFT SRP subtable
*/
struct sbft_srp_subtable {
/** Initiator and target ports */
struct srp_port_ids port_ids;
} __attribute__ (( packed ));
/**
* sBFT IB subtable
*/
struct sbft_ib_subtable {
/** Source GID */
struct ib_gid sgid;
/** Destination GID */
struct ib_gid dgid;
/** Service ID */
struct ib_gid_half service_id;
/** Partition key */
uint16_t pkey;
/** Reserved */
uint8_t reserved[6];
} __attribute__ (( packed ));
/**
* An sBFT created by gPXE
*/
struct gpxe_sbft {
/** The table header */
struct sbft_table table;
/** The SCSI subtable */
struct sbft_scsi_subtable scsi;
/** The SRP subtable */
struct sbft_srp_subtable srp;
/** The IB subtable */
struct sbft_ib_subtable ib;
} __attribute__ (( packed, aligned ( 16 ) ));
struct srp_device;
extern int sbft_fill_data ( struct srp_device *srp );
#endif /* _GPXE_SBFT_H */
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
extern void timer2_udelay ( unsigned long usecs );
#endif /* _GPXE_TIMER2_H */
+2
View File
@@ -15,6 +15,8 @@
* into a machine with such an old CPU anyway.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifdef IOAPI_X86
#define IOAPI_PREFIX_x86
#else
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <gpxe/list.h>
#include <realmode.h>
Executable → Regular
+2
View File
@@ -1,6 +1,8 @@
#ifndef LIBRM_H
#define LIBRM_H
FILE_LICENCE ( GPL2_OR_LATER );
/* Segment selectors as used in our protected-mode GDTs.
*
* Don't change these unless you really know what you're doing.
+2
View File
@@ -1,6 +1,8 @@
#ifndef LIMITS_H
#define LIMITS_H 1
FILE_LICENCE ( GPL2_OR_LATER );
/* Number of bits in a `char' */
#define CHAR_BIT 8
+2
View File
@@ -1,6 +1,8 @@
#ifndef _MEMSIZES_H
#define _MEMSIZES_H
FILE_LICENCE ( GPL2_OR_LATER );
#include <basemem.h>
/**
+2
View File
@@ -8,6 +8,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
/** The magic number for the Multiboot header */
+2
View File
@@ -4,6 +4,8 @@
* Initially written by Michael Brown (mcb30).
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifndef PIC8259_H
#define PIC8259_H
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
/* BIOS segment address */
#define BIOS_SEG 0xf000
+2
View File
@@ -1,6 +1,8 @@
#ifndef PXE_H
#define PXE_H
FILE_LICENCE ( GPL2_OR_LATER );
#include "pxe_types.h"
#include "pxe_api.h"
#include <gpxe/device.h>
+46
View File
@@ -15,6 +15,31 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* As an alternative, at your option, you may use this file under the
* following terms, known as the "MIT license":
*
* Copyright (c) 2005-2009 Michael Brown <mbrown@fensystems.co.uk>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/** @file
@@ -23,6 +48,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include "pxe_types.h"
/** @addtogroup pxe Preboot eXecution Environment (PXE) API
@@ -1415,6 +1442,25 @@ extern PXENV_EXIT_t pxenv_undi_get_nic_type (
/** PXE API function code for pxenv_undi_get_iface_info() */
#define PXENV_UNDI_GET_IFACE_INFO 0x0013
/** Broadcast supported */
#define SUPPORTED_BROADCAST 0x0001
/** Multicast supported */
#define SUPPORTED_MULTICAST 0x0002
/** Functional/group addressing supported */
#define SUPPORTED_GROUP 0x0004
/** Promiscuous mode supported */
#define SUPPORTED_PROMISCUOUS 0x0008
/** Software settable station address */
#define SUPPORTED_SET_STATION_ADDRESS 0x0010
/** InitiateDiagnostics supported */
#define SUPPORTED_DIAGNOSTICS 0x0040
/** Reset MAC supported */
#define SUPPORTED_RESET 0x0400
/** Open / Close Adapter supported */
#define SUPPORTED_OPEN_CLOSE 0x0800
/** Interrupt Request supported */
#define SUPPORTED_IRQ 0x1000
/** Parameter block for pxenv_undi_get_iface_info() */
struct s_PXENV_UNDI_GET_IFACE_INFO {
PXENV_STATUS_t Status; /**< PXE status code */
+6 -3
View File
@@ -6,9 +6,13 @@
* PXE API entry point
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <pxe_api.h>
#include <realmode.h>
struct net_device;
/** PXE load address segment */
#define PXE_LOAD_SEGMENT 0
@@ -26,9 +30,8 @@ extern struct s_PXE __text16 ( ppxe );
extern struct s_PXENV __text16 ( pxenv );
#define pxenv __use_text16 ( pxenv )
extern void pxe_hook_int1a ( void );
extern int pxe_unhook_int1a ( void );
extern void pxe_init_structures ( void );
extern void pxe_activate ( struct net_device *netdev );
extern int pxe_deactivate ( void );
extern int pxe_start_nbp ( void );
extern __asmcall void pxe_api_call ( struct i386_all_regs *ix86 );
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <errno.h> /* PXE status codes */
+2
View File
@@ -10,6 +10,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
/*
* Declaration of variables in .data16
*
+2
View File
@@ -10,6 +10,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
/**
+2
View File
@@ -1,6 +1,8 @@
#ifndef ETHERBOOT_SETJMP_H
#define ETHERBOOT_SETJMP_H
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <realmode.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#ifndef ASSEMBLY
#include <gpxe/device.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
struct undi_device;
struct undi_rom;
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
struct undi_device;
extern int undinet_probe ( struct undi_device *undi );
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
#include <undi.h>
+2
View File
@@ -7,6 +7,8 @@
*
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <pxe_types.h>
/** An UNDI PCI device ID */
+2
View File
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <realmode.h>
#include <gpxe/aoe.h>
#include <gpxe/netdevice.h>
+2
View File
@@ -10,6 +10,8 @@
#include <gpxe/abft.h>
#include <int13.h>
FILE_LICENCE ( GPL2_OR_LATER );
static int aoeboot ( const char *root_path ) {
struct ata_device ata;
struct int13_drive drive;
@@ -1,6 +1,8 @@
#include <gpxe/nap.h>
#include <realmode.h>
FILE_LICENCE ( GPL2_OR_LATER );
/**
* Save power by halting the CPU until the next interrupt
*
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
#include <stdint.h>
#include <string.h>
#include <errno.h>
@@ -16,6 +16,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
FILE_LICENCE ( GPL2_OR_LATER );
/** @file
*
* BIOS timer

Some files were not shown because too many files have changed in this diff Show More