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

722 Commits

Author SHA1 Message Date
Michael Brown 01b755704a Auto-assign drive number only if set to 0xff; almost all applications
require that we use drive 0x80, so it should probably be the default.
2007-08-23 20:50:24 +01:00
Michael Brown eff8b06eff Separate out arch-independent parts of stdint.h 2007-08-17 19:51:08 +01:00
Michael Brown 950057eeed Add PXE FILE API. 2007-08-04 01:23:37 +01:00
Michael Brown 688bac1656 Place multiboot command lines in base memory; Xen won't pick them up
otherwise.  :(
2007-08-02 23:09:03 +01:00
Michael Brown d4947c05b2 Allow images to hold references to the originating URI.
Some shuffling around of the image management code; this needs tidying up.
2007-08-02 20:18:32 +01:00
Michael Brown 9fd6a0418f Allowed zero-cost enforced ordering of features in startup banner
list.

Added FEATURE() macros to most relevant (non-driver) files.
2007-08-02 14:51:03 +01:00
Holger Lubitz 0ebf6cdef4 remove old minorversion!=4 check (added -march a second time) 2007-08-02 01:54:42 +01:00
Holger Lubitz 06eb725cd4 remove x86_64 comments from arch specific Config
options are in main makefile now
2007-08-02 01:48:28 +01:00
Michael Brown 726e366e8f Add code for constructing single-file cpio archives on the fly 2007-08-01 23:10:30 +01:00
Michael Brown 24f32a1945 Initrd concatenation now working 2007-08-01 15:29:15 +01:00
Michael Brown c5d9114064 Allow loading of multiple initramfs images. 2007-07-31 18:09:18 +01:00
Michael Brown 5e26df0325 Centralise construction of the DHCP request and response packets. 2007-07-31 03:02:21 +01:00
Michael Brown 4ce8d61a5c Import various libgcc functions from syslinux.
Experimentation reveals that gcc ignores -mrtd for the implicit
arithmetic functions (e.g. __udivdi3), but not for the implicit
memcpy() and memset() functions.  Mark the implicit arithmetic
functions with __attribute__((cdecl)) to compensate for this.

(Note: we cannot mark with with __cdecl, because we define __cdecl to
incorporate regparm(0) as well.)
2007-07-30 02:43:43 +01:00
Michael Brown f62d6486d8 GCC's optimiser seems to screw up if this is left static... 2007-07-30 02:42:32 +01:00
Michael Brown 304d1e9fa5 Don't rely on retry.c's periodically calling currticks() in order to
allow the UNDI NIC interrupt to happen.
2007-07-29 15:27:47 +01:00
Michael Brown a6a1052096 Applied a modified version of holger's regparm patches. 2007-07-29 00:17:25 +01:00
Holger Lubitz 0ae6c53bd9 Revert "make __udivmoddi4 static" - gcc links to it implicitly
This reverts commit 9e7b165017.
2007-07-28 23:20:00 +02:00
Holger Lubitz 9a4790667a make multiboot_load static 2007-07-27 22:01:23 +02:00
Holger Lubitz dc38303ff9 make nbi_load static 2007-07-27 22:00:51 +02:00
Holger Lubitz 5ec4e2ad50 make eltorito_load static 2007-07-27 21:58:31 +02:00
Holger Lubitz 9e7b165017 make __udivmoddi4 static 2007-07-27 21:39:58 +02:00
Michael Brown 09118cd5bf Don't overwrite %dl with a (potentially) modified drive number if we
already handled the INT13 call.
2007-07-25 02:03:29 +01:00
Michael Brown d5e39286f7 We probably shouldn't leave interrupts disabled when starting an OS. 2007-07-25 02:02:24 +01:00
Michael Brown 9aa61ad5a2 Add per-file error identifiers 2007-07-24 17:11:31 +01:00
Michael Brown 75912b3b77 Remove some obsolete sections of librm.h and libkir.h.
Add some of the missing parts to libkir.h.
2007-07-24 12:46:07 +01:00
Michael Brown 07e11f8af9 Minor debug improvement 2007-07-19 17:01:21 +01:00
Michael Brown 2cfe0dee1f Don't trash the %ecx value returned by relocate(). This was causing
us to round down the size for the relocation copy to the nearest 64kB
(+0x10 bytes); this just happened to work on most machines because the
last 64kB of the image is all-zeroes anyway (it's the .bss).
2007-07-19 16:07:31 +01:00
Michael Brown a8111e8ab7 Remove INT 13,4b handler; it represents an incomplete feature (CD-ROM
emulation support) for an unknown purpose, and breaks grub.
2007-07-19 11:16:05 +01:00
Michael Brown 0d9d2ccbae Completed definition of struct int13_cdrom_specification, and moved to
int13.h.
2007-07-19 11:15:01 +01:00
Michael Brown 013d381e3c Real-mode code might set the direction flag, which would cause carnage. 2007-07-17 13:46:37 +01:00
Michael Brown c94cdf2b7d Move .zinfo to libprefix.S; it doesn't belong with the decompression code. 2007-07-17 12:52:54 +01:00
Michael Brown dc52db4920 Removed dead code identified by symcheck 2007-07-17 01:43:19 +01:00
Michael Brown 38dbe14bbe Kill off redundant references to the .zprefixes. 2007-07-16 17:26:07 +01:00
Michael Brown 84551d485e Update all prefixes currently referring to _load_size to include a
compressor fixup section.
2007-07-16 17:17:26 +01:00
Michael Brown 0929142a15 Rename _rom_size to _load_size_sect, since hdprefix.S also uses it. 2007-07-16 17:03:19 +01:00
Michael Brown 048bbeeebc Compressed ROM images now work. 2007-07-16 16:58:38 +01:00
Michael Brown 6d2e4e719c Move uninitialised .data16 variables to .bss16; saves around 2000
bytes of useless zeroes in the final image.
2007-07-16 13:22:12 +01:00
Michael Brown 389204713f Kill off some long-redundant CFLAGS 2007-07-16 13:15:12 +01:00
Michael Brown 833d6cc8ec Add __bss16() macro, and allow use of .bss16 section by removing
link-time check for section overlaps.  (In order to avoid wasting
space in the executable image, .bss16 will overlap with the following
section, which is .text).
2007-07-16 13:10:49 +01:00
Michael Brown ab859a5355 Use a single _payload_offset linker-defined variable to locate the
start of the non-prefix blocks in the loaded image, and rely on the
image ordering.  This should make introducing compression much easier.
2007-07-15 02:52:02 +01:00
Michael Brown 0b5059c40b Skip the length field prepended by util/nrv2b.c 2007-07-15 02:01:17 +01:00
Michael Brown b37e267d1b Modified calling convention: we now update %esi and %edi just like a
"rep movsb".
2007-07-15 01:51:32 +01:00
Michael Brown 3feac9465e "not" doesn't affect flags, "xor $-1" does. 2007-07-15 01:25:13 +01:00
Michael Brown 26473105cd On advice of hpa: be more patient with the KBC and SCPA methods; retry
in a long loop before giving up on them.  Record method which worked
and default to that method on next attempt.
2007-07-14 20:56:12 +01:00
Michael Brown adf192f566 Shrink cpu.c and render it useful for our purposes. 2007-07-14 19:12:13 +01:00
Michael Brown e330db3c74 Dead code removal.
Kill off use of etherboot.h outside drivers/net.
2007-07-14 15:42:26 +01:00
Michael Brown 95c07736cb Be more aggressive in attempts to enable A20, now that we have the
optimisation of only trying to do so when necessary.
2007-07-14 14:21:18 +01:00
Michael Brown 8624fdc445 Kill off the enforced RX quota; it only seems to hurt on real hardware. 2007-07-14 00:30:11 +01:00
Michael Brown 57b5e227ff Use fast in-situ test for gate A20 being set, to cut down on the
number of (potentially very slow) gateA20_set operations.

Die with a fatal error if we are unable to set gate A20; if this fails
then we are bound to experience memory corruption at a later stage,
and I'd prefer to pick it up early.
2007-07-13 13:32:49 +01:00
Michael Brown 2ac7694c3e Improve error reporting for strange length combinations reported by
the UNDI stack.

Ignore obviously invalid length combinations (as returned by
e.g. VMWare's PXE stack).

Limit to one packet per poll to avoid memory exhaustion.
2007-07-10 20:59:21 +01:00
Michael Brown efd322091d Set up %ds *before* testing a value in our data segment (d'oh!).
Always send EOI; do not chain to BIOS's default interrupt handler.
They are just too unpredictable; at least VMware's seems to kill the
machine if you go anywhere near it.

Disable interrupts after return from PXENV_UNDI_ISR, just in case some
dumb PXE stack enables them.
2007-07-10 17:08:32 +01:00
Michael Brown f6f9a3098d Report RX errors via netdev_rx_err() 2007-07-10 17:01:18 +01:00
Michael Brown fb16f90699 Dump first 64 bytes of chained ISR when debugging is enabled. 2007-07-10 16:57:55 +01:00
Michael Brown edc4648c39 Protect ISR against failure to unhook. 2007-07-10 04:34:53 +01:00
Michael Brown 4e14b020a5 Master IRQ should be EOIed first, I think. 2007-07-10 04:33:59 +01:00
Michael Brown 19871cbb96 We probably ought not to call INT13 with interrupts disabled. 2007-07-10 04:32:30 +01:00
Michael Brown 027fed72c1 Working code to call the PXE stack from within the ISR. 2007-07-10 04:21:24 +01:00
Michael Brown cd7e296cbe Always increase number of BIOS drives when registering 2007-07-09 20:42:04 +01:00
Michael Brown b90d321dfb Change %dl fixup rules for INT13:
INT 13,08 : read number of drives from 40:75
INT 13,15 : do nothing
all others : restore original value of %dl
2007-07-09 20:37:39 +01:00
Michael Brown c7d9fdb5b9 Proof of concept; works, but has several hard-coded hacks. 2007-07-09 20:28:40 +01:00
Michael Brown 8bce52d348 Set CF by default, clear on success (rather than clearing and setting
on failure).
2007-07-09 19:02:41 +01:00
Holger Lubitz 4ff85d9f15 Add -mpreferred-stack-boundary=2 to i386 CFLAGS as it's almost always a win. 2007-07-09 03:32: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
Holger Lubitz c7549bcebe convert to zalloc 2007-07-06 20:19:06 +02:00
Holger Lubitz bb61774ee4 convert to zalloc 2007-07-06 20:19:06 +02:00
Michael Brown 311637503d Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe 2007-07-06 13:31:58 +01:00
Michael Brown f660e8ef58 Add strlen_user() (will be needed for PXE API extensions) 2007-07-06 13:07:10 +01:00
Marty Connor 74a1c77820 Merge branch 'master' of /pub/scm/gpxe 2007-07-06 08:04:55 -04:00
Marty Connor 28d8d828b3 Rename .lilo extension to .lkrn and updated dependencies 2007-07-06 08:04:06 -04:00
Michael Brown 763a3eab8a Add .pdsk target (padded .dsk, suitable for qemu). 2007-07-05 23:37:17 +01:00
Michael Brown fbda4837b0 Allocate heap at first usage, rather than assuming we can fit it in
below _text.  This should help with the gPXE-on-gPXE-via-PXE case.
2007-07-05 22:30:34 +01:00
Michael Brown 07ea125213 Use partition type 0xeb ("EtherBoot"), to avoid any attempts to mount
the Etherboot partition.
2007-07-05 14:20:55 +01:00
Michael Brown 6e082c9b81 Add .usb target 2007-07-05 14:15:43 +01:00
Michael Brown a0f078d7f5 Working with multi-sector reads 2007-07-05 13:30:49 +01:00
Michael Brown 66208dd65d hdprefix that works for LBA only 2007-07-05 12:58:16 +01:00
Michael Brown 839960276d Miscellaneous efficiency improvements, and extend read_sectors to
handle multiple sectors.
2007-07-05 12:36:39 +01:00
Michael Brown 3c2d50e5de Added active partition locator, and simple MBR built using it. 2007-07-05 00:21:01 +01:00
Michael Brown 738ebaf4a5 Revert "Added master boot record capable of locating active partition"
This reverts commit 844d088c51.
2007-07-05 00:20:04 +01:00
Michael Brown 844d088c51 Added master boot record capable of locating active partition
(including logical partitions).
2007-07-05 00:05:26 +01:00
Michael Brown 5e3f2247e0 Kill off lots of warnings in via-velocity.c by correcting these definitions. 2007-07-04 23:36:16 +01:00
Michael Brown ac69b85adb UNDI loader entry point implemented; seems to work. 2007-07-04 03:23:02 +01:00
Michael Brown 1ecb9acb87 Fix typo 2007-07-04 02:25:07 +01:00
Michael Brown dca470cb21 Add (untested) UNDI loader C-level implementation. 2007-07-03 23:41:35 +01:00
Michael Brown 7db6b4b79c Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe 2007-07-03 23:10:16 +01:00
Michael Brown 89349d7fad Separated out initialisation functions from startup/shutdown functions. 2007-07-03 23:09:56 +01:00
Marty Connor 79238335b0 remove obsolete file: src/arch/i386/prefix/int19exit.c 2007-07-03 16:24:06 -04:00
Michael Brown cbd4542dc0 Merge branch 'master' of rom.etherboot.org:/pub/scm/gpxe 2007-07-03 21:09:26 +01:00
Marty Connor 9b3c4e4d79 Warnings purge: src/arch/i386, src/core/disk.c, ramdisk, autoboot 2007-07-03 16:02:15 -04:00
Michael Brown fae10a7ca1 We don't actually use the reset functions anywhere, and nothing really
provides them.
2007-07-03 20:34:51 +01:00
Michael Brown 2dc8ed1eb8 Work around Etherboot 5.4 bug when multiple packets are received. 2007-07-03 15:53:29 +01:00
Michael Brown 0958726ebb It's not just Etherboot that fails to generate TX completions. 2007-07-03 14:43:57 +01:00
Michael Brown adb3dd03e5 Document TX completion bug. 2007-07-03 13:17:58 +01:00
Michael Brown 071356d976 Ensure that pxe_netdev is set before starting up PXE NBP. 2007-07-03 00:02:26 +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 d5451d210c Add ability to resolve relative symbols as well as locate absolute ones. 2007-06-30 22:59:15 +01:00
Michael Brown 8f6a4e8140 Add gdbsym.c object to help with running gdb-to-qemu 2007-06-30 22:43:31 +01:00
Michael Brown e1646b4080 Place the actual version string in .data16, rather than just the
pointer to it.
2007-06-30 21:36:54 +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 d71b116f54 Fix stack on return from PXE NBP so that we can return properly. 2007-06-28 23:37:49 +01:00
Michael Brown 045fb24557 Use internal real-mode stack from non-returnable prefixes 2007-06-28 21:56:14 +01:00
Michael Brown 00473f0952 Revert "Move stack to below 0x7c00; leaving it at the default location"
This reverts commit 03ca71c38d.
2007-06-28 21:50:36 +01:00
Michael Brown 03ca71c38d Move stack to below 0x7c00; leaving it at the default location
(0x7ef4) tends to really screw up anything that loads at 0x7c00...
2007-06-28 21:15:47 +01:00
Michael Brown f77815f2b1 Kill off hotplug.h and just make net devices normal reference-counted
structures.

DHCP still broken and #if 0'd out.
2007-06-27 14:48:31 +01:00
Michael Brown 1ae549b892 Add our own trivial version of stdarg.h. This makes our build
entirely self-hosted (which avoids problems when building the same
tree on multiple systems - e.g. when you have /home NFS-mounted).

Also saves around 50 bytes in total - not sure why.
2007-06-09 18:11:07 +01:00
Michael Brown 3e2c6b6736 pkbuff->iobuf changeover
Achieved via Perl using:

perl -pi -e 's/pk_buff/io_buffer/g; s/Packet buffer/I\/O buffer/ig; ' \
	-e 's/pkbuff\.h/iobuf.h/g; s/pkb_/iob_/g; s/_pkb/_iob/g; ' \
	-e 's/pkb/iobuf/g; s/PKB/IOB/g;'
2007-05-19 18:39:40 +00:00
Michael Brown 0d9b3e2dd2 Add 32-bit support.
Generate DHCP data block for images.
2007-03-22 16:18:46 +00:00
Michael Brown ff7d0af585 Provide a buffer in base memory for code to fill with generated DHCP data. 2007-03-22 16:18:07 +00:00
Michael Brown 160e66dbb9 Typo 2007-03-20 18:55:00 +00:00
Michael Brown 5578d3b2de Support 32-bit (linear) NBI images. We don't yet provide a bootp data
block, so first32.c dies immediately.
2007-03-14 00:39:12 +00:00
Michael Brown 37127ea90c Added .nbi as a format. 2007-03-11 00:57:26 +00:00
Michael Brown 628f6eddcc Make _load_size accurately reflect the number of bytes in the actual
image file.
2007-03-11 00:54:35 +00:00
Michael Brown 520d9c36af Updated ISAPnP, EISA, MCA and ISA buses to current device model.
ISA 3c509 is currently non-functional, although the EISA (3c509-eisa) and
MCA (3c529) variants should build OK.

None of this code is yet tested.
2007-03-10 18:08:33 +00:00
Michael Brown 22ed1fbaf1 Add ability to read serial number from SMBIOS 2007-02-01 20:52:12 +00:00
Michael Brown f06059ab97 More assertions 2007-02-01 02:18:22 +00:00
Michael Brown c650c8c84a Also print out stack pointer (with optional stack dump) 2007-02-01 02:17:59 +00:00
Michael Brown 406b20a64d Assert that division result is correct 2007-01-31 23:58:52 +00:00
Michael Brown c789e8640b Added __umoddi3 2007-01-31 22:26:14 +00:00
Michael Brown 7d9267561b Don't call PXENV_STOP_UNDI in the kpxeprefix. This slighy breaks the
clean separation between loading and starting, but does mean that more
PXE stacks survive the process.
2007-01-29 15:21:10 +00:00
Michael Brown 2cf1e33df1 Split bootsector execution code out into bootsector.c.
Added basic El Torito ISO image boot capability
2007-01-29 04:21:38 +00:00
Michael Brown b3b6b25aeb Handle (64-bit) / (32-bit) = (64-bit), i.e. one step beyond that
provided by the divl instruction.
2007-01-28 19:34:17 +00:00
Michael Brown f59281d8f6 Yet more synonyms that people tend to use. 2007-01-26 01:30:16 +00:00
Michael Brown 6a765fdc15 Use base "0" in strtoul for consistency with "mem=" 2007-01-24 22:54:08 +00:00
Michael Brown 99cb46943f "vga=" is specified in decimal, not hex. 2007-01-22 23:56:24 +00:00
Michael Brown ebb00e032c Misread the definition of the type_of_loader field; it should include a
version.
2007-01-19 15:40:01 +00:00
Michael Brown 73b09ecba6 Use stdio.h instead of vsprintf.h 2007-01-19 01:13:12 +00:00
Michael Brown 5d57cd47a2 Declaring the CPU architecture in the middle of an assembly file is
somewhat redundant, and also causes gas to complain when we include
the profiling code (which uses an i586 instruction).
2007-01-18 18:53:32 +00:00
Michael Brown bd95927386 Accelerate memcpy() by around 32% on large, dword-aligned copies. 2007-01-18 15:18:02 +00:00
Michael Brown 544fa25928 Rename e{malloc,realloc,free} to u{malloc,realloc,free}, to more obviously
reflect the fact that they allocate and deallocate user memory (i.e.
things reached through a userptr_t).
2007-01-16 08:36:42 +00:00
Michael Brown a5f6408d8e We can now load an initrd as well as a kernel 2007-01-14 16:09:01 +00:00
Michael Brown b9f99858ab Make the getmemsize() prototype available in memsizes.h, for code that
doesn't want to go to the hassle of processing a full memory map.
2007-01-14 15:32:25 +00:00
Michael Brown 10c9b03cdb Actually, the initrd image should be architecture-independent. 2007-01-14 15:07:11 +00:00
Michael Brown f92e04dea4 Add dummy "initrd" image format, just so that images can be marked as
initrds.
2007-01-14 15:03:39 +00:00
Michael Brown 8a490146bf Copy command line at execution time rather than load time.
Parse command line for "vga=" and "mem=" parameters
2007-01-14 14:29:30 +00:00
Michael Brown 3ccd7335f0 Split bzimage_load into separate functions 2007-01-14 13:36:33 +00:00
Michael Brown 97a3037f76 Can start a Linux kernel directly (albeit with no initrd support) 2007-01-14 12:34:35 +00:00
Michael Brown 3cbf0db0a3 Remove some references to no-longer-existent source files.
Add a path for isolinux.bin that is correct on my system; hopefully it
will work on others too.
2007-01-14 11:52:22 +00:00
Michael Brown b04b0ddc31 .lilo and derived targets (e.g. .iso) now load properly. 2007-01-14 11:50:44 +00:00
Michael Brown 77d280968a Obsoleted by arch/i386/image/multiboot.c 2007-01-14 11:45:28 +00:00
Michael Brown 784e10635a Can almost start a kernel now. It dies with "No setup signature found" 2007-01-14 06:36:20 +00:00
Michael Brown b07161f397 Placeholder bzImage support 2007-01-14 04:27:25 +00:00
Michael Brown 797edf28b7 Replace image->entry with image->priv. 2007-01-14 04:04:28 +00:00
Michael Brown 3bdbfe1f00 Mostly updated. Won't work yet. 2007-01-14 03:49:07 +00:00
Michael Brown 644f3674e6 Obsolete for some time 2007-01-14 02:24:41 +00:00
Michael Brown 7bc03d37a2 Select a PXE network device before starting PXE NBP.
Move pxe_boot() code to pxe_image.c
2007-01-14 02:20:10 +00:00
Michael Brown 55e6d7b70c Use debug autocolourisation.
Shut down before jumping to the multiboot image.
2007-01-14 00:57:43 +00:00
Michael Brown dca369ddc3 Call hide_etherboot() from startup(), rather than requiring the prefix to
do it.
2007-01-14 00:53:56 +00:00
Michael Brown ece4ff929e Use _text, rather than assuming _text==0. 2007-01-14 00:03:07 +00:00
Michael Brown f547f148d3 Use {get,set}_fbms() so that allocated base memory is correctly hidden. 2007-01-14 00:01:16 +00:00
Michael Brown 0b0e34e667 Provide {get,set}_fbms() in basemem.h.
set_fbms() will also update the E820 hidden region.
2007-01-13 23:57:31 +00:00
Michael Brown aaed3d50a8 Some operating systems get a nasty shock if a region of the E820 map seems
to start on a non-page boundary.  Make life safer by rounding out our
edited regions.
2007-01-13 23:38:33 +00:00
Michael Brown d0f4e9a54b Add some trace messages for important events 2007-01-13 17:54:41 +00:00
Michael Brown f11900a9c6 I prefer IMAGE_XXX to XXX_IMAGE.
Add IMAGE_PXE to use the new image format framework.  "kernel pxelinux.0"
now works.
2007-01-13 17:28:51 +00:00
Michael Brown bd863e4112 Add header for pxe_boot() 2007-01-13 17:23:44 +00:00
Michael Brown 4b77061881 Pick up the return status code from the correct place now that we
don't overwrite the parameter block until *after* the debug code.
2007-01-13 16:55:57 +00:00
Michael Brown 5817c9f114 When an UNDI API call fails, print everything there is to know about it. 2007-01-13 16:53:55 +00:00
Michael Brown 6a3c76c8e0 Always send EOI. We can't feasibly share interrupts (since we have no
clue what the "previous" interrupt handler will do, which could range
from "just an iret" to "disable the interrupt"), and that means that
we have to take responsibility for ACKing all interrupts.  Joy.
2007-01-13 14:45:26 +00:00
Michael Brown 86171c53f4 Damn Broadcom and their damned incorrect assumptions about x86 memory
allocation.
2007-01-13 01:48:12 +00:00
Michael Brown bcd6ca3291 Place multiboot tables in base memory; at least some OSes won't see it
if we don't.
2007-01-12 16:25:05 +00:00
Michael Brown 0f29e0e46e Ensure multiboot modules are in ascending order of memory start
address, to work around OS bugs.
2007-01-12 12:03:19 +00:00
Michael Brown 53e948bba8 Fix the memory map. 2007-01-12 11:38:04 +00:00
Michael Brown 6fdc6c81a6 Force probing of multiboot before ELF. 2007-01-12 08:10:35 +00:00
Michael Brown 9debfed07a Place command-line inline, to save on memory allocation hassles. 2007-01-12 05:26:19 +00:00
Michael Brown 77b7640af4 Fix the only bug (which was to use DBGC() in place of DBG()!) and add 4kB
alignment.
2007-01-12 03:28:03 +00:00
Michael Brown 45ec9c907e First version of an external memory allocator (not tested) 2007-01-12 03:15:29 +00:00
Michael Brown 1d313234b3 Rename copy_user() to memcpy_user(). Add memmove_user() and
userptr_add().
2007-01-12 03:14:15 +00:00
Michael Brown 859da6bd32 Allow external code to update hidden memory regions. 2007-01-12 03:13:04 +00:00
Michael Brown 687c1e3227 Nothing (not even hidemem.c) uses this file! 2007-01-12 02:45:46 +00:00
Michael Brown 39a8ed827c Long since obsoleted by arch/i386/scripts/i386.lds 2007-01-12 02:43:10 +00:00
Michael Brown 2e088d9afc Obsoleted by arch/i386/interface/pxe/pxe_call.c 2007-01-12 02:42:14 +00:00
Michael Brown f81bf3bc52 We *do* have a __data16_array after all! 2007-01-12 02:37:47 +00:00
Michael Brown e4c6418ac0 We may be required to page-align modules, so let's make sure we catch
it if we don't.
2007-01-12 00:09:16 +00:00
Michael Brown f59ad50504 Provide registration mechanism for loaded images, so that we can e.g.
refer to them by name from the command line, or build them into a
multiboot module list.

Use setting image->type to disambiguate between "not my image" and "bad
image"; this avoids relying on specific values of the error code.
2007-01-11 23:43:29 +00:00
Michael Brown f31d91bce5 Populate multiboot information structure before calling OS. 2007-01-11 21:21:02 +00:00
Michael Brown ddbc60b5ae Whoever put together the grub multiboot.h header is insane. 2007-01-11 21:20:27 +00:00
Michael Brown 200d92c76d Avoid namespace clashes 2007-01-11 19:42:26 +00:00
Michael Brown bcc98c78b8 Added fields present in the documentation but not in the header file. 2007-01-11 19:41:13 +00:00
Michael Brown dc51af59a4 Capable of starting a multiboot kernel (albeit without the multiboot
information table yet).
2007-01-11 18:41:15 +00:00
Michael Brown 9196e9069c Add PHYS_CODE, for use as in __asm__ ( PHYS_CODE ( ... ) ), comparable
to the REAL_CODE interface.
2007-01-11 18:40:46 +00:00
Michael Brown d488a172eb Capable of loading a multiboot image into memory 2007-01-11 17:44:42 +00:00
Michael Brown 143e3b84a4 Downloaded from current grub CVS. 2007-01-11 16:22:03 +00:00
Michael Brown 4fc9333159 Move include/image.h to include/gpxe/image.h 2007-01-11 16:04:36 +00:00
Michael Brown 7ad1c2eaa8 Removed the Etherboot-specific ELF-image code and replaced it with a
generic ELF loader, to be used by the multiboot code.
2007-01-11 14:44:03 +00:00
Michael Brown 3634e705b7 Remove osloader.c and replace with a prep_segment() that uses userptr_t
and get_memmap() in image/segment.c
2007-01-11 14:32:26 +00:00
Michael Brown ceca6b185c Added user_to_phys() and memset_user(). 2007-01-11 14:27:27 +00:00
Michael Brown c980cdd0aa Move memmap.h out of arch/i386; it no longer contains anything
architecture-dependent and is needed by the ELF code.
2007-01-11 14:08:44 +00:00
Michael Brown c6a4055fae Add phys_to_user() and copy_user(). 2007-01-11 14:01:20 +00:00
Michael Brown e2dcd05b67 Update buffer-handling code to enable expandable buffers. 2007-01-11 03:50:47 +00:00
Michael Brown fdc97499bf Add device description fields to struct device. 2007-01-10 15:27:48 +00:00
Michael Brown 489a4004d7 Give UNDI device a more meaningful name. 2007-01-10 05:52:04 +00:00
Michael Brown dad5274522 Add "name" field to struct device to allow human-readable hardware device
names.

Add "dev" pointer in struct net_device to tie network interfaces back to a
hardware device.

Force natural alignment of data types in __table() macros.  This seems to
prevent gcc from taking the unilateral decision to occasionally increase
their alignment (which screws up the table packing).
2007-01-10 04:22:09 +00:00
Michael Brown c65fae2475 Add RX quotas to the net device poll() method. This avoids the problem
of alloc_pkb() exhaustion when e.g. an iSCSI-booted DOS session is left
idle for a long time at the C:\ prompt and builds up a huge packet
backlog.
2007-01-09 21:47:01 +00:00
Michael Brown 18e5353bed Rename pkb_available() to pkb_tailroom() for consistency with Linux's
skb_tailroom().  Add pkb_headroom().
2007-01-09 20:56:31 +00:00
Michael Brown b7fcfe8ece Added net device TX queue; this will be needed to support the PXE UNDI API
(which will need us to wait for TX completions).

Added debug autocolourisation to netdevice.c
2007-01-09 20:18:31 +00:00
Michael Brown 3c2cc59d25 Added ability to break ISR processing over several calls to poll().
This will allow us to implement RX quotas.
2007-01-09 17:04:10 +00:00
Michael Brown aa7bda7b47 Send EOI after enabling interrupt, in case the device had asserted IRQ
to the PIC while it was disabled.
2007-01-09 14:53:19 +00:00
Michael Brown a2ffe8c123 Allow boot sector to completely destroy real-mode stack, but still
manage to return control.
2007-01-09 14:13:59 +00:00
Michael Brown a9369bb503 Leave protected-mode return address on PM stack when issuing a
real_call(), rather than moving it to the RM stack and back again.
This allows the real-mode function to completely destroy the stack
contents, provided that it manages to return to real_call().
2007-01-09 14:13:06 +00:00
Michael Brown 2738bdf74b Obsoleted by drivers/net/undionly.c 2007-01-09 03:22:11 +00:00
Michael Brown d606edb41d Added UNDI root bus driver (which saves including all the PCI bus code,
UNDI ROM code etc. when you just want a "undi.kpxe"-type image).

This driver cannot be used in conjunction with any other driver (it will
crash), or in any other format than .kpxe (it just won't find any network
devices).
2007-01-09 03:20:22 +00:00
Michael Brown 159930862f Added missing call to undinet_remove() 2007-01-09 03:08:01 +00:00
Michael Brown 6b09dd8244 undipci_probe() has to calculate busdevfn anyway, so we may as well pass
it directly to undi_load_pci().
2007-01-09 02:58:07 +00:00
Michael Brown ed44e3730d Avoid erasing non-existent signatures in undi_unload() 2007-01-09 02:53:24 +00:00
Michael Brown a2be828a33 Avoid leaving preloaded_undi with invalid PXENV+/!PXE structure
addresses if the signature checks fail.
2007-01-09 02:52:28 +00:00
Michael Brown 697bcc9d24 Since we now always unload the base code stack (even if we keep UNDI),
we can never return to the PXE stack and must always use INT 18.
2007-01-09 02:46:58 +00:00
Michael Brown f2f492a536 If preloaded device matches, use that rather than going via the UNDI
loader.
2007-01-09 02:32:06 +00:00
Michael Brown 2436dac281 Populate preloaded_undi device when applicable. 2007-01-09 02:29:54 +00:00
Michael Brown 937289cdc8 Provide storage for an undi_device structure representing the preloaded
UNDI stack.
2007-01-09 02:29:18 +00:00
Michael Brown 47222d5ed8 Call PXENV_UNDI_GET_NIC_TYPE to identify NIC physical device.
Record all information required for populating a struct undi_device.

Make debugging output more human-readable.
2007-01-09 01:42:28 +00:00
Michael Brown cea2221737 Use fixed-width fields in struct undi_device, so that pxeprefix.S will be
able to populate the structure.
2007-01-09 01:41:26 +00:00
Michael Brown fbdebac5f4 Copy pxelinux's shutdown sequence: use UNLOAD_STACK without STOP_BASE,
and call UNDI_SHUTDOWN first to make sure the NIC is in a safe state.
2007-01-08 05:06:26 +00:00
Michael Brown 8f8af10b22 New strategy: always stop both base code and UNDI. Always free base code
memory (unless we get an error while stopping the base code).  Leave UNDI
resident (though stopped) for .kpxe.

Still need to add code to record the device identification parameters
prior to stopping UNDI.
2007-01-08 03:48:26 +00:00
Michael Brown 075d79f6d4 Checking in obsolete but working memory-scanning code just for the record 2007-01-08 03:45:00 +00:00
Michael Brown 67e824b539 Neaten up debug messages 2007-01-08 03:42:19 +00:00
Michael Brown f08093b0d9 Remove spurious debug message 2007-01-08 03:37:32 +00:00
Michael Brown f0edd11c7d Now split out into undirom.c and undiload.c 2007-01-08 03:35:51 +00:00
Michael Brown 07e5d4e3dc Added any-PCI-device UNDI driver 2007-01-08 03:34:47 +00:00
Michael Brown 66f7bcc785 Tidied up debug messages 2007-01-08 03:34:06 +00:00
Michael Brown a6ba48e51e Added debugging statements 2007-01-08 03:04:54 +00:00
Michael Brown 239965ff3b Added missing includes 2007-01-08 03:03:42 +00:00
Michael Brown 6115356859 Added missing declarations 2007-01-08 02:51:27 +00:00
Michael Brown aff96c13d2 Added missing include 2007-01-08 02:51:04 +00:00
Michael Brown afc01a1a7f Split UNDI load/unload out into undiload.c. 2007-01-08 02:48:17 +00:00
Michael Brown 359c888aec Remove obsolete includes 2007-01-08 02:39:56 +00:00
Michael Brown 6fc75f659b Separated out UNDI ROM location code into undirom.c, and use struct
undi_rom rather than struct pxe_driver.  (This is part of the naming
consistency fixes).
2007-01-08 02:38:10 +00:00
Michael Brown 675fe200e5 Use "struct undi_device" instead of "struct pxe_device", and use the
function prefix "undinet_" and the variable name "undinic" in undinet.c,
so that we can reserve the variable name "undi" for a struct undi_device.

The idea is that we preserve the Etherboot 5.4 convention that the "UNDI"
code refers to our using an underlying UNDI stack, while the "PXE" code
refers to our providing a PXE API.
2007-01-08 02:24:53 +00:00
Michael Brown 36c1e1aa57 Renamed undi.c to undinet.c. (undi.c will become the UNDI PCI driver) 2007-01-08 02:02:07 +00:00
Michael Brown 234d81728a Obsolete 2007-01-08 02:00:55 +00:00
Michael Brown d3558fdd3a Remove accidentally checked-in code 2007-01-07 19:05:28 +00:00
Michael Brown 85a41b25fe Move START_UNDI, UNDI_STARTUP, UNDI_INITIALIZE and
UNDI_GET_INFORMATION calls into drivers/net/undi.c.  undi_probe() now
gets given a pxe_device representing a PXE stack that has been loaded
into memory but not initialised in any way.
2007-01-07 19:02:17 +00:00
Michael Brown 23cb837951 Remember to enable/disable the interrupt at the PIC.
Handle failures in undi_open() properly.
2007-01-07 13:31:39 +00:00
Michael Brown 9ab5c0dde7 Remove redundant debug message 2007-01-05 16:15:50 +00:00
Michael Brown fa9055197d UNDI loader routine now works 2007-01-05 16:11:05 +00:00
Michael Brown 477a70697a Added PnP BIOS scanning code, separated out from the UNDI driver 2007-01-05 16:10:03 +00:00
Marty Connor 7dee2556f4 Fixed typo 2007-01-05 16:09:47 +00:00
Michael Brown 9780fef360 Partial implementation of UNDI loader caller. 2007-01-05 03:24:39 +00:00
Michael Brown 0638945c7e Add PXE driver-scanning code, capable of locating all PXE ROMs in a system
and matching them up to (e.g. PCI) devices.
2007-01-05 01:52:06 +00:00
Michael Brown ef50ea0b2b Renamed undi_net.c to undi.c. 2007-01-04 19:43:35 +00:00
Michael Brown 6cf488dcf7 Obsolete; net driver functionality is now in undi_net.c and bus driver
functionality is now in pxebus.c.  (Not all bus functionality is ported
across yet.)
2007-01-04 19:42:05 +00:00
Michael Brown 7e07dfb2f4 Added PXE bus driver (with support only for using PXE structures found
lying about in memory, not for loading from ROM), and UNDI net driver.
2007-01-04 19:38:34 +00:00
Michael Brown e28db95de6 Obsolete 2007-01-04 19:37:31 +00:00
Michael Brown 70acce06e4 This file is no longer used 2007-01-04 19:36:31 +00:00
Michael Brown b12cd68726 Ripped out everything except the ability to send EOI to the PIC. 2007-01-04 19:36:18 +00:00
Michael Brown de2fc50f4c Add as a separate file so that we can do "make bin/xxxx.kpxe" rather than
having to edit PXELOADER_KEEP_ALL as a config option.
2007-01-04 19:35:10 +00:00
Michael Brown 290c5ee779 Don't automatically call gateA20_set() when returning from a real-mode
call.
2007-01-04 04:32:18 +00:00
Michael Brown f58f193633 Engage brain: since when was zero >= 0x80 ? 2006-12-21 05:15:26 +00:00
Michael Brown 9c3b4e5b0b Some BIOSes return 0xe0 for extended characters. Just assume that
anything over 0x80 is an extended character.
2006-12-21 00:07:48 +00:00
Michael Brown dbb7b30cca Return ANSI sequences for special keys 2006-12-20 23:42:28 +00:00
Michael Brown 43d976edd0 Prevent NULL from ever pointing to some real code or data. (This was
causing the serial console to ignore input, because it happened to end up
linked with serial_ischar() at address 0, which core/console.c decided was
invalid).
2006-12-20 20:28:20 +00:00
Michael Brown 0aa1223264 Optimise bios_putchar for speed(!) by avoiding two separate real-mode
calls.  This does make a visible difference when clearing the screen with
werase() inside bochs or qemu.
2006-12-19 01:15:05 +00:00
Michael Brown 8b3a4c9862 Add basic ANSI escape sequence support to BIOS console 2006-12-18 01:19:38 +00:00
Michael Brown 8a45f619a9 Fix building on gas versions that don't auto-insert addr32 prefixes 2006-12-12 19:07:18 +00:00
Michael Brown 8bff0f0619 Avoid draining the keyboard buffer during gateA20_set(). It shouldn't
technically be necessary, because the "enable A20" command requires
only that the keyboard controller is ready to accept input (i.e. that
its input buffer is empty), and shouldn't also require that the
keyboard is ready to send output (i.e. that its output buffer is also
empty).  See http://www.smsc.com/main/tools/io-bios/42i.pdf section
3.1 ("Command Invocation") for a justification.

gateA20_set() is called on every real-mode transition (in case some
idiot piece of external code such as Intel's PXE stack decided it
would be fun to re-disable A20), so draining the keyboard buffer means
that we end up losing keypresses on some systems.  In particular, this
makes typing at the command line almost impossible, and causes
Etherboot to ignore Ctrl-Alt-Del.

We should really implement a gateA20_test() function to verify that
gate A20 has been correctly enabled, and think about adding other
commonly-used methods such as Fast Gate A20.
2006-12-05 09:45:39 +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
Marty Connor c4964c3e3a fix args to _disable routine 2006-09-19 15:01:16 +00:00
Marty Connor 56a3ff7202 get rid of compile warnings (except intentionally generated ones) 2006-09-14 20:54:05 +00:00
Marty Connor c30623b739 fix DBG macro unknown variable 2006-09-14 20:34:53 +00:00
Michael Brown 0566ab2a2f Added geometry-guessing code based on the partition table 2006-09-08 22:22:03 +00:00
Michael Brown 78dd963c1f Check to see if we've reached the end of the map before attempting to
skip past an empty region, otherwise we end up generating an infinitely
long e820 map.  (Yes, there *are* real systems that provide e820 maps
with a zero-length region at the end...)
2006-08-31 13:25:45 +00:00
Michael Brown 5a54225aef Added support for INT 13,15; NTLDR calls it (though it may not
actually do anything with the result, since it carried on using us
even when we returned failure).
2006-08-27 01:22:01 +00:00
Michael Brown 40724431e8 Added support for INT 13,15; NTLDR calls it (though it may not
actually do anything with the result, since it carried on using us
even when we returned failure).
2006-08-26 23:42:02 +00:00
Michael Brown 19883779ba Use TEXT16_CODE() rather than manually specifying ".code16" etc, since
our manual ".code32" will break a KEEP_IT_REAL build.
2006-08-24 18:43:28 +00:00
Michael Brown 6abfaa153b Towards making KEEP_IT_REAL work again.
Fix bug that caused over-allocation of .text16 and .data16 memory areas
by a factor of 16.
2006-08-24 13:18:05 +00:00
Michael Brown 4afc494b83 Both the !PXE and PXENV+ structures must be paragraph-aligned 2006-08-09 18:22:25 +00:00
Michael Brown fd07f56f0d Note to self: learn to count. 2006-08-09 00:56:07 +00:00
Michael Brown 843bcc291d Added missing __from_text16()s when passing pointers to PXE NBP. 2006-08-09 00:39:21 +00:00
Michael Brown 751ae718bd pxe_int_1a is needed by pxe_call.c 2006-08-09 00:16:57 +00:00
Michael Brown 18c112d205 Added (not yet tested) PXE API entry point and support functions. 2006-08-08 20:43:33 +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 2138db36ca Add "addr32" required explicitly by older gas. 2006-06-12 01:07:43 +00:00
Michael Brown df4b503a8c Added null trap code for debugging. (Must be included by adding
--nulltrap to the make target at the moment.)
2006-06-11 01:48:29 +00:00
Michael Brown 476d02051f Windows Server 2003 sulks if we feed it an empty region in base memory
as a result of our memory map editing, so strip out any empty regions.
2006-06-09 12:20:03 +00:00
Michael Brown 6fd1bd0510 Added missing check-in 2006-06-09 10:19:17 +00:00
Michael Brown 17eea9f933 Fix bug with >256 cylinders.
Allow our functions to return a non-zero, non-error status (since the
INT 13 Extensions Check has to return the API version in the register
that is otherwise always used for the error code).

Report a non-zero API version from the INT 13 Extensions Check; GRUB
now uses extended reads.
2006-06-08 19:28:08 +00:00
Michael Brown fdf62528ca It's astonishing how long really fundamental bugs can survive without
being noticed...
2006-06-08 15:06:09 +00:00
Michael Brown 191a906338 Fix some remarkably obvious mistakes in pcidirect.h 2006-06-08 14:57:04 +00:00
Michael Brown 763b7e2ef9 We now have just romprefix, rather than having isaprefix and pciprefix 2006-06-06 15:41:21 +00:00
Michael Brown ef37f78cbe Cut out almost all the optional code paths, drastically simplifying the
flow of control through this code.

We now always add PCI and PnP headers even for ISA ROMs; there's no harm
in doing so.

UNDI loader is still missing.
2006-06-06 15:33:39 +00:00
Michael Brown e7eca7b7cb Code segment may not be writable; create the temporary pointer to the GDT
on the stack.
2006-06-06 15:30:28 +00:00
Michael Brown 46253ba618 Calculate _rom_size for the ROM prefix 2006-06-06 15:29:39 +00:00
Michael Brown 35b04b1514 Tidy up comment 2006-05-28 14:40:04 +00:00
Michael Brown 041a04335e Fixed assembly on old versions of gas 2006-05-28 14:21:29 +00:00
Michael Brown 9f86754f90 Updated to work with libprefix. 2006-05-25 22:04:47 +00:00
Michael Brown 29340d7728 Documented the fact that the prefix can prot_call(main) without
worrying about its stack being destroyed during the Etherboot run.
2006-05-25 22:04:17 +00:00
Michael Brown d82f71efd0 Also hide base memory region from E820 map. 2006-05-25 00:10:58 +00:00
Michael Brown 89da833c5d init_librm() and prot_call() are now real-mode far calls.
install() now calls relocate(), moves the protected-mode code to the new
location, and calls hide_etherboot().
2006-05-25 00:06:45 +00:00
Michael Brown 4d81b48504 Has been obsolete for a while. 2006-05-25 00:04:37 +00:00
Michael Brown 1966945a5d Update relocate() to work with get_memmap().
Change semantics; relocate() now just finds a suitable location; it
doesn't actually perform the relocation itself.  Code in libprefix does
the copy in flat real mode.
2006-05-25 00:04:13 +00:00
Michael Brown f939ff7cb5 Fix printf format warning error 2006-05-25 00:02:27 +00:00
Michael Brown 3bd3c13c7b Why should pushal/popal put the registers on the stack in a logical
order?
2006-05-25 00:01:46 +00:00
Michael Brown dd75965057 Typo. 2006-05-25 00:00:53 +00:00
Michael Brown e4f8d6eed7 Add a "count" field to struct memory_map. 2006-05-25 00:00:30 +00:00
Michael Brown 986f6ffff1 Define a struct memory_map with a fixed number of entries, rather than
requiring each caller to decide how many entries it wants to permit.
2006-05-24 14:41:27 +00:00
Michael Brown edcf89e2b0 Remove the automatic segment register save and restore; most users of
REAL_CODE() don't need it.
2006-05-24 14:11:36 +00:00
Michael Brown 02cf755f3f Removed REAL_EXEC(); there is no longer any code using it. 2006-05-24 14:10:15 +00:00
Michael Brown 103aff3ae2 Added potentially required "\n\t" on the end of asm_code_str 2006-05-24 14:06:28 +00:00
Michael Brown 190276a8b6 NBI is due for removal 2006-05-24 13:53:35 +00:00
Michael Brown 52125e158c Will be replaced with a block-device implementation. 2006-05-24 13:52:46 +00:00
Michael Brown 8110f9b082 Updated to REAL_CODE() 2006-05-24 13:50:40 +00:00