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

197 Commits

Author SHA1 Message Date
Michael Brown cced04ef3b [efi] Provide component name protocol and device path protocol interfaces
Include a minimal component name protocol so that the driver name
shows up as something other than "<UNKNOWN>" in the driver list, and a
device path protocol so that the network interface shows up as a
separate device in the device list, rather than being attached
directly to the PCI device.

Incidentally, the EFI component name protocol reaches new depths for
signal-to-noise ratio in program code.  A typical instance within the
EFI development kit will use an additional 300 lines of code to
provide slightly less functionality than GNU gettext achieves with
three additional characters.
2009-01-12 19:10:53 +00:00
Michael Brown 314779eb36 [efi] Use elf2efi utility in place of efilink
elf2efi converts a suitable ELF executable (containing relocation
information, and with appropriate virtual addresses) into an EFI
executable.  It is less tightly coupled with the gPXE build process
and, in particular, does not require the use of a hand-crafted PE
image header in efiprefix.S.

elf2efi correctly handles .bss sections, which significantly reduces
the size of the gPXE EFI executable.
2009-01-07 22:59:05 +00:00
Michael Brown 29480dd715 [efi] Use EFI-native mechanism for accessing SMBIOS table
EFI provides a copy of the SMBIOS table accessible via the EFI system
table, which we should use instead of manually scanning through the
F000:0000 segment.
2008-12-04 23:19:12 +00:00
Michael Brown 045a22764a [efi] Allow use of EFI configuration tables
EFI passes in copies of SMBIOS and other system configuration tables
via the EFI system table.  Allow configuration tables to be requested
using a mechanism similar to the current method for requesting EFI
protocols.
2008-12-04 23:18:32 +00:00
Michael Brown 0ebbbb95fa [x86_64] Fix assorted 64-bit compilation errors and warnings
Remove various 32-bit assumptions scattered throughout the codebase.
The code is still not necessarily 64-bit clean, but will at least
compile.
2008-11-19 19:33:05 +00:00
Michael Brown 3f85626fa9 [efi] Add efi_strerror()
EFI_STATUS is defined as an INTN, which maps to UINT32 (i.e. unsigned
int) on i386 and UINT64 (i.e. unsigned long) on x86_64.  This would
require a cast each time the error status is printed.

Add efi_strerror() to avoid this ickiness and simultaneously enable
prettier reporting of EFI status codes.
2008-11-19 19:22:49 +00:00
Michael Brown b59e0cc56e [i386] Change [u]int32_t to [unsigned] int, rather than [unsigned] long
This brings us in to line with Linux definitions, and also simplifies
adding x86_64 support since both platforms have 2-byte shorts, 4-byte
ints and 8-byte long longs.
2008-11-19 19:15:44 +00:00
Michael Brown 446b6d5fdd [pxe] Move all PXE files to arch/i386
The initial PXE implementation in Etherboot had the goal of being
architecture-agnostic, but this goal has not been realised.
2008-11-18 22:27:02 +00:00
Michael Brown 9a52ba0cfa [netdevice] Retain and report detailed error breakdowns
netdev_rx_err() and netdev_tx_complete_err() get passed the error
code, but currently use it only in debug messages.

Retain error numbers and frequencey counts for up to
NETDEV_MAX_UNIQUE_ERRORS (4) different errors for each of TX and RX.
This allows the "ifstat" command to report the reasons for TX/RX
errors in most cases, even in non-debug builds.
2008-11-08 05:30:30 +00:00
Michael Brown c99b16c974 [efi] Add basic implementation of EFI SIMPLE_NETWORK_PROTOCOL
This implementation is tested and working, but not currently tied in
to the EFI build.
2008-10-16 05:38:23 +01:00
Michael Brown 3a505dfc35 [netdevice] Change link-layer push() and pull() methods to take raw types
EFI requires us to be able to specify the source address for
individual transmitted packets, and to be able to extract the
destination address on received packets.

Take advantage of this to rationalise the push() and pull() methods so
that push() takes a (dest,source,proto) tuple and pull() returns a
(dest,source,proto) tuple.
2008-10-16 05:13:40 +01:00
Michael Brown 81d92c6d34 [efi] Add EFI image format and basic runtime environment
We have EFI APIs for CPU I/O, PCI I/O, timers, console I/O, user
access and user memory allocation.

EFI executables are created using the vanilla GNU toolchain, with the
EXE header handcrafted in assembly and relocations generated by a
custom efilink utility.
2008-10-13 10:24:14 +01:00
Michael Brown a2f9bf70d7 [pxe] Display PXE_LOADER debug message after call to initialise()
At least one Dell system calls the UNDI loader entry point with the
BIOS console disabled.  The serial console is active only after a call
to initialise(), so move the debug message in undi_loader() so that it
can be displayed via the serial console.
2008-09-23 04:15:56 +01:00
Michael Brown 0ffc3f6285 [pxe] Add extra debug messages to the PXE UDP API calls 2008-08-21 16:52:08 +01:00
Michael Brown 2090aade04 [pxe] Fix broadcast transmissions via PXENV_UDP_WRITE
pxenv_udp_write() needs to specify a net device, otherwise ipv4 is
unable to route broadcast transmissions.
2008-08-21 16:50:51 +01:00
Michael Brown 30fb3b3810 [undi] Fill in ProtType correctly in PXENV_UNDI_ISR
Determine the network-layer packet type and fill it in for UNDI
clients.  This is required by some NBPs such as emBoot's winBoot/i.

This change requires refactoring the link-layer portions of the
gPXE netdevice API, so that it becomes possible to strip the
link-layer header without passing the packet up the network stack.
2008-08-20 03:21:37 +01:00
Michael Brown f6f6f626f7 [undi] Work around broken UNDI polling behaviour in winBoot/i
Some dumb NBPs (e.g. emBoot's winBoot/i) never call PXENV_UNDI_ISR
with FuncFlag=PXENV_UNDI_ISR_START; they just sit in a tight polling
loop merrily violating the PXE spec with repeated calls to
PXENV_UNDI_ISR_IN_PROCESS.  Force a extra calls to netdev_poll() to
cope with these out-of-spec clients.
2008-08-20 02:02:51 +01:00
Michael Brown 03c80c12b8 [iSCSI] Support Windows Server 2008 direct iSCSI installation
Add yet another ugly hack to iscsiboot.c, this time to allow the user to
inhibit the shutdown/removal of the iSCSI INT13 device (and the network
devices, since they are required for the iSCSI device to function).

On the plus side, the fact that shutdown() now takes flags to
differentiate between shutdown-for-exit and shutdown-for-boot means that
another ugly hack (to allow returning via the PXE stack on BIOSes that
have broken INT 18 calls) will be easier.

I feel dirty.
2008-07-17 17:45:17 +01:00
Michael Brown 4fbbf651d7 [i386] Change semantics of __from_data16 and __from_text16
__from_data16 and __from_text16 now take a pointer to a
.data16/.text16 variable, and return the real-mode offset within the
appropriate segment.  This matches the use case for every occurrence
of these macros, and prevents potential future bugs such as that fixed
in commit d51d80f.  (The bug arose essentially because "&pointer" is
still syntactically valid.)
2008-06-30 18:52:13 -07:00
Michael Brown d51d80f785 [pxe] Fix a typo in PXENV_GET_CACHED_INFO that broke Altiris
__from_data16 takes the value pointed to, rather than the pointer
itself.  This was silently causing gPXE to return a dud buffer pointer
when the caller did not supply a buffer for PXENV_GET_CACHED_INFO.
2008-06-30 18:35:51 -07:00
Michael Brown 2596a9aa9c [misc] Fix building on OpenBSD
OpenBSD throws compiler warnings that we can't reproduce on Linux, for
some reason.

Original patch from Dewey Hylton <dewey@hyltown.com>.
2008-06-27 22:35:26 +01:00
H. Peter Anvin d62e89d776 [PXEXT] Add FILE_API_CHECK API function
Add FILE_API_CHECK to the PXEXT API so the NBP can query the
availability and status of the API.
2008-03-26 15:10:56 -07:00
Michael Brown 92d15eff30 [Settings] Remove assumption that all settings have DHCP tag values
Allow for settings to be described by something other than a DHCP option
tag if desirable.  Currently used only for the MAC address setting.

Separate out fake DHCP packet creation code from dhcp.c to fakedhcp.c.

Remove notion of settings from dhcppkt.c.

Rationalise dhcp.c to use settings API only for final registration of the
DHCP options, rather than using {store,fetch}_setting throughout.
2008-03-25 20:46:16 +00:00
Michael Brown ee4206a8a7 [DHCP] Fix up fake-packet creation as used by PXENV_GET_CACHED_INFO
Add dedicated functions create_dhcpdiscover(), create_dhcpack() and
create_proxydhcpack() for use by external code such as the PXE preboot
code.

Register ProxyDHCP options under the global scope "proxydhcp".

Unregister previously-acquired DHCP and ProxyDHCP settings when DHCP
succeeds.
2008-03-23 21:58:05 +00:00
Michael Brown 8afb36c3bc [Settings] Migrate DHCP and NVO code to the new settings API (untested) 2008-03-21 22:15:31 +00:00
Michael Brown 1dd3f88964 [PXE] Work around a buffer-size bug in WinPE
WinPE's pxeboot.n12 takes the BufferLimit returned by gPXE (indicating
the size of gPXE's internal DHCP packet buffers) and erroneously passes
it in as BufferSize (indicating the size of pxeboot.n12's DHCP packet
buffer).  If these don't match, then pxeboot.n12 ends up instructing gPXE
to overwrite parts of its data segment.

Change gPXE's internal DHCP packet buffers to be exactly
sizeof(BOOTPLAYER_t) bytes to work around this problem.
2008-03-10 11:46:55 +00:00
Michael Brown b62f2325ba [PXEXT] Add PXENV_FILE_EXEC call to PXE extensions API.
This allows pxelinux to execute arbitrary gPXE commands.  This is
remarkably unsafe (not least because some of the commands will assume
full ownership of memory and do nasty things like edit the e820 map
underneath the calling pxelinux), but it does allow access to the
"sanboot" command.
2008-03-04 18:16:30 +00:00
Michael Brown 5e4e267177 Start restructuring pxe_tftp.c to cope with multicast (MTFTP) receives. 2008-02-02 15:59:32 +00:00
Michael Brown c9c8cdeb8b Add pxe_set_cached_filename() so that pxe_tftp.c can also update the
stored DHCP packets.
2008-01-22 18:51:12 +00:00
Michael Brown 84f99f781e Use XFER_INIT() macro. 2008-01-22 18:50:24 +00:00
Michael Brown f6a8158eed Make seek information part of the xfer metadata, rather than an entirely
separate xfer method.

Add missing .alloc_iob entries to several xfer_interface_operations
structures.
2008-01-08 16:46:55 +00:00
Michael Brown 1949641d10 Fix compiler warnings that appear only on OpenBSD. 2007-12-06 14:16:46 -06:00
Michael Brown 6b0e147e0d Don't complain when callers provide too-short buffers for
PXENV_GET_CACHED_INFO.  NTLDR does this.
2007-12-07 01:06:37 +00:00
Michael Brown 838ecba131 Provide individually cached constructed copies of DHCP packets via
PXENV_GET_CACHED_INFO.  If we dont do this, Altiris' NBP screws up; it
relies on being able to grab pointers to each of the three packets and
then read them at will later.
2007-11-22 04:43:11 +00:00
Michael Brown 3a2473f123 Do not fill in the BufferLimit field in struct
s_PXENV_GET_CACHED_INFO, because this field doesn't exist in earlier
versions of the PXE spec, and some callers don't allocate space for it.
2007-11-22 00:31:21 +00:00
Michael Brown 950057eeed Add PXE FILE API. 2007-08-04 01:23:37 +01:00
Michael Brown 07f84566d5 Make read_user() non-blocking, and add select() call. 2007-08-04 01:22:52 +01:00
Michael Brown 5e26df0325 Centralise construction of the DHCP request and response packets. 2007-07-31 03:02:21 +01:00
Michael Brown 9aa61ad5a2 Add per-file error identifiers 2007-07-24 17:11:31 +01:00
Michael Brown b34d4d0449 Separate the "is data ready" function of xfer_seek() into an
xfer_window() function, which can return a scalar rather than a
boolean.
2007-07-08 14:11:07 +01:00
Michael Brown ca4c6f9eee Kill off unused request() method in data-xfer interface. 2007-07-08 02:10:54 +01:00
Michael Brown 4c418d2100 Use net_device_operations structure and netdev_nullify() to allow for
safe dropping of the netdev ref by the driver while other refs still
exist.

Add netdev_irq() method.  Net device open()/close() methods should no
longer enable or disable IRQs.

Remove rx_quota; it wasn't used anywhere and added too much complexity
to implementing correct interrupt-masking behaviour in pxe_undi.c.
2007-07-07 16:43:39 +01:00
Michael Brown 539ff45fd0 Allow recording of TX and RX errors to aid in end-user debugging. 2007-07-05 17:18:27 +01:00
Michael Brown 0324d5ff70 !PXE and PXENV+ structures are in code segment, not data segment. 2007-07-04 03:20:18 +01:00
Michael Brown dca470cb21 Add (untested) UNDI loader C-level implementation. 2007-07-03 23:41:35 +01:00
Michael Brown 89349d7fad Separated out initialisation functions from startup/shutdown functions. 2007-07-03 23:09:56 +01:00
Michael Brown 5ce5e6d846 Move pxe_netdev and set_pxe_netdev to pxe_undi.c and remove
now-obsolete pxe.c.
2007-07-03 20:21:16 +01:00
Michael Brown 0924cf678e Implemented (untested) PXENV_START_UNDI. 2007-07-03 18:17:14 +01:00
Michael Brown 30a442aef8 Report our interface type as "gPXE" to avoid working around Etherboot
5.4 bugs when driving ourselves via UNDI.
2007-07-03 15:57:32 +01:00
Michael Brown 1ce0b4bbfb Kill off PXENV_UNDI_FORCE_INTERRUPT support; we have no reason to
suspect that we need it, and implementing it would require needlessly
complicating the net device API.
2007-07-03 15:36:29 +01:00
Michael Brown 5f92f0bd82 Reserve space for link-layer header in pxenv_undi_transmit() when not
handed a P_UNKNOWN packet.
2007-07-03 04:05:30 +01:00
Michael Brown 258afef751 Add missing call to free_iob() in pxenv_undi_isr().
Correct typo in pxenv_set_station_address().
2007-07-03 00:57:53 +01:00
Michael Brown 4968caab82 Add trivial net device statistics (TX and RX packet count), reported
via UNDI API and also by ifstat command; may be useful for debugging.
2007-07-03 00:15:53 +01:00
Michael Brown cbd956535e Place netdev_open()/netdev_close() calls in appropriate places. 2007-07-03 00:02:06 +01:00
Michael Brown 8f37a6a424 Add mechanism for providing TX completion events. 2007-07-02 23:49:00 +01:00
Michael Brown 332614a382 Add untested support for UNDI transmit and receive. 2007-07-02 20:05:58 +01:00
Michael Brown e42eba4af4 Use a common base-memory packet buffer for DHCP construction (as used
by PXE and NBI) and UNDI packets (as used by undinet and UNDI).
2007-07-02 18:33:41 +01:00
Michael Brown 5f17089b14 pxe_netdev now holds a reference to the network device.
Use generic fields in struct device_description rather than assuming
that the struct device * is contained within a pci_device or
isapnp_device; this assumption is broken when using the undionly
driver.

Add PXENV_UNDI_SET_STATION_ADDRESS.
2007-07-02 17:43:32 +01:00
Michael Brown e3bbfd7a75 Call shutdown() from pxenv_undi_shutdown(). Probably not totally
correct, but it's enough to get RIS working.
2007-07-02 03:12:35 +01:00
Michael Brown 4472e22b5e Implement the two UNDI API calls used by RIS. 2007-06-30 15:56:00 +01:00
Michael Brown d05d8edd42 Implement the "overwrite TFTP filename" Microsoft RIS bug workaround. 2007-06-30 15:13:18 +01:00
Michael Brown 8130443f9f Separate out pxe_start_nbp() from pxe_image.c into pxe_call.c
Implement PXENV_RESTART_TFTP.
2007-06-30 14:56:35 +01:00
Michael Brown 9125070f51 I really, really screwed up the semantics of BufferSize and BufferLimit. 2007-06-29 20:16:30 +01:00
Michael Brown 40d6d3dcf4 Windows RIS now gets as far as downloading NTLDR. 2007-06-29 01:42:59 +01:00
Michael Brown e381714c07 Partial migration of UDP to data-xfer interface. (Will not link at
present; DHCP is broken).
2007-06-20 01:13:35 +01:00
Michael Brown 01b4bde8a0 Updated TFTP and PXE UDP API code to use not-yet-implemented data-xfer
UDP API.
2007-06-11 18:11:29 +01:00
Michael Brown 23008b9326 Updated to use POSIX-style file I/O layer. 2007-05-18 14:33:20 +00:00
Michael Brown 5ff23aa406 Include stdlib.h rather than malloc.h 2007-01-18 20:06:03 +00:00
Michael Brown a5a330339b Split DBG() statement containing two inet_ntoa() statements; they
return a static buffer.
2007-01-14 19:58:41 +00:00
Michael Brown ce7289a766 Dump buffer and packet information in PXENV_UDP_READ as well 2007-01-14 18:22:37 +00:00
Michael Brown 6dcb182aee Fill in BufferSize in PXENV_GET_CACHED_INFO 2007-01-14 02:21:02 +00:00
Michael Brown 3b2f6e4585 Currently unusable; do not attempt to compile 2007-01-04 19:37:21 +00:00
Michael Brown d4894f0127 We *should* use the persistent reference API for our netdev reference,
but there's so much else missing that it's not worth doing right now.
2007-01-04 03:44:36 +00:00
Michael Brown 84a2b886e1 Split error-message table portions of errno.h out to gpxe/errortab.h 2006-12-20 03:40:48 +00:00
Michael Brown 88e38fa148 We don't actually have a stdio.h header file. Our printf() functions are
defined in vsprintf.h.  (This may change, since vsprintf.h is a
non-standard name, but for now it's the one to use.)

There should be no need to include vsprintf.h just for DBG() statements,
since include/compiler.h forces it in for a debug build anyway.
2006-09-27 10:58:14 +00:00
Marty Connor 6ac78f6aff added stdio.h to includes for DBG compilation 2006-09-27 05:57:06 +00:00
Michael Brown f018da8215 Implement enough of PXENV_GET_CACHED_INFO to support pxelinux. 2006-08-09 02:59:19 +00:00
Michael Brown 75d26d884a Added pxe_netdev; a slight hack for now, but will need to be done
properly for the PXE UNDI API anyway.
2006-08-09 02:58:27 +00:00
Michael Brown 691557281f Add a couple of small but vital parts to PXENV_UDP_WRITE. 2006-08-09 01:57:02 +00:00
Michael Brown 71754ada2a Allow linking by converting functions to stubs 2006-08-09 00:25:29 +00:00
Michael Brown 17ecfd1d67 Allow linking by converting all functions to stubs 2006-08-09 00:22:28 +00:00
Michael Brown ffe0e24249 Make the UDP senddata() methods return a status code.
udp_connect() now follows the standard BSD sockets semantics and simply
sets the default address for outgoing packets; it doesn't filter incoming
packets.
2006-08-03 23:10:14 +00:00
Michael Brown a0a872f7f1 Updated PXE UDP implementation to use the new Etherboot UDP API.
Updated PXE API dispatcher to use copy_{to,from}_user, and moved to
arch/i386 since the implementation is quite architecture-dependent.
(The individual PXE API calls can be largely
architecture-independent.)
2006-08-02 23:08:10 +00:00
Michael Brown c3e41e6fd1 Added soon-to-be-requisite missing include. 2006-06-05 15:41:22 +00:00
Michael Brown 832e86246b gcc is rather over-aggressive about optimising out static data structures
even when __atribute__ (( unused )) is correctly set...
2006-04-24 18:31:37 +00:00
Michael Brown b89ccac02d Updated to remove obsolete constants 2006-04-19 02:11:56 +00:00
Michael Brown 708bbc43bc Merge from Etherboot 5.4 2006-03-16 17:40:55 +00:00
Michael Brown 53a4436d94 TFTP upgraded to use a core function library (in tftpcore.c) which will be
shared between TFTP, TFTM and MTFTP protocols.
2005-06-01 13:13:05 +00:00
Michael Brown 59582db29d Documented remainder of PXE TFTP API calls. 2005-05-27 16:47:45 +00:00
Michael Brown 2ffc960e67 Added diatribe about the mismatch between the PXE spec and the TFTP
protocol, and how we will work around it.
2005-05-27 11:44:46 +00:00
Michael Brown 97675c7129 Refer to implementation note on IP routing. 2005-05-27 11:37:09 +00:00
Michael Brown aeb984a1a9 Thoughts on how to coerce the PXE TFTP API into something resembling
the TFTP protocol.
2005-05-26 18:52:12 +00:00
Michael Brown 572483cc59 Separate out the documentation of the PXE API from the documentation of
the Etherboot implementation (i.e. don't do what Intel did).
2005-05-24 17:00:55 +00:00
Michael Brown 0e494614b5 Some versions of doxygen seem to object to "@ret None" or similar. 2005-05-24 00:11:25 +00:00
Michael Brown 809933d9f7 Split PXE code into preboot, udp, tftp, undi and loader units.
PXE code now compiles without errors (though it won't actually work).
2005-05-23 23:32:56 +00:00
Michael Brown 8fcb6448bd Moved pxe_errors.c to pxe/interface/ 2005-05-23 22:47:21 +00:00
Michael Brown d8f187dc6a Documented the UDP API calls. 2005-05-20 17:50:37 +00:00