Commit Graph

38 Commits

Author SHA1 Message Date
Marcel Moolenaar
155dbcacfb Change the startup code to fix a memory leak and to allow us to
accept load options (=command line options).

The call graph changes from *entry*->efi_main->efi_init, where
efi_main is the EFI equivalent of main to *entry*->efi_main->main,
where main is what you'd expect. efi_main now is what efi_init was.
The prototype of main follows that of C. The first argument is argc
and the second is argv. There is no third argument.
Allocation of heap pages is now handled by the EFI library and it
now deallocates the pages when main() returns or when exit() is
called. This allows us to safely return to the boot manager (or
EFI shell) without leaks. EFI applications are responsible to free
all memory themselves.

Handling of the load options is a bit tricky. There are either no
load options, load options in ASCII or load options in Unicode.
The EFI library will translate the ASCII options to Unicode options
as to simplify user code. Since the load options are passed as a
single string (if present) and main() accepts argc and argv, the
startup code also has to split the string into words and build the
argv vector. Here the trickiness starts. When the loader is started
from the EFI shell, argv[0] will automaticly load the program name.
In all other cases (ie through the boot manager), this is not the
case. Unfortunately, there's no trivial way to check. Hence, a
set of conditions is checked to determine if we need to fill in
argv[0] ourselves or not. This checking is not perfect. There are
known cases where it fails to do the right thing. The logic works
for most expected cases, though. This includes the case where no
options are given.

Approved by: re (blanket)
2002-12-10 06:22:25 +00:00
Marcel Moolenaar
4ee2f7cb16 o Make all GUID variables global to maximize reuse.
o  Recognize the HCDP configuration table.
o  Dump the GUID of tables we don't recognize.

Approved by: re (carte blanche)
2002-12-10 04:55:25 +00:00
Marcel Moolenaar
ea16741fc0 The boot manager sets the watchdog timer to 5 minutes before invoking
a boot option. When the timer expires the machine is rebooted.
Disable the watchdog timer for 2 reasons:
o  We're an interactive program. We cannot guarantee that we've
   booted the kernel in the time available to us. There have been
   situations where netbooting the right kernel took 2 tries and
   more time than given. Not to speak of the normal behaviour to
   have the loader sitting at the prompt while the user is off
   doing other things (such as figuring out what to type next ;-)
o  We may not boot a kernel at all. We may exit as the result of
   the user typing quit (assuming it took less than 5 minutes to
   type it :-). It is documented that loaders should have disabled
   the watchdog timer if they return to the boot manager. Not doing
   so would cause a reboot while in the boot manager. This appears
   to be harmless, besides of course the actual reboot.

Approved by: re (weisse karte)
2002-12-08 20:04:00 +00:00
Marcel Moolenaar
aef78848af Remove a left-over virtual mapping of uncached I/O port space.
Previous kernels unwantingly depended on this mapping, but as
of version 1.123 of src/sys/ia64/ia64/machdep.c this dependency
has been removed. Consequently, one has to update the kernel
before updating the loader. The documented/recommended upgrade
will suffice in this case.

Due to a visible (from the kernels point of view) change in
behaviour, bump the loader version number from 0.3 to 1.0.

Approved by: re (carte blanc)
2002-11-28 03:25:51 +00:00
Marcel Moolenaar
689f36d7f9 MFp4:
o  Show the contents of the AP wakeup descriptor when dumping SAL
   information.
o  Increase S/N ratio when listing the itr and dtr. Only show valid
   mappings and give the total number of TRs.

Approved by: re (blanket)
2002-11-24 19:45:05 +00:00
Peter Wemm
296c758b66 Disable loader ufs support. It causes the loader to crash on the Itanium2
box that I have.  We have no EFI disk drivers yet anyway (maybe that is the
problem).
2002-07-20 03:46:43 +00:00
Peter Wemm
df0e0b8823 Fix printf format errors 2002-07-20 03:44:01 +00:00
David E. O'Brien
d1bdfb40fd -ffreestanding is the word.
(also resort some CFLAGS such that the more "important" value are first so
they are easier to see)
2002-05-10 09:26:35 +00:00
Peter Wemm
c21ab46789 We must not let install(1) strip loader.efi when installing it, or the
resulting binary will be damaged and no longer work.
2002-04-07 04:27:50 +00:00
Peter Wemm
1e7e1ea54d Set BINDIR 2002-04-07 04:26:42 +00:00
Peter Wemm
f3693129ce Add loader bootforth infrastructure and install it. 2002-04-07 04:25:45 +00:00
Peter Wemm
e91ab65ef6 Try and tidy up some very loose ends with paths to various libraries etc. 2002-04-06 04:29:36 +00:00
Peter Wemm
5459842c5e Do not assume that ${OBJCOPY} variable exists. It was hidden by the
fact that the 'ia64-make' wrapper explicitly set it.
2002-04-06 04:11:46 +00:00
Peter Wemm
a6d81d83a2 Fix self hosted loader building. When you use a self configured gcc, it
detects and uses the gas section merge support.  As a result, a whole bunch
of new sections arrive, including .rodata.str1.8, which was not included
in our custom ldscript.ia64.  The result was a loader binary that EFI
rejected.

While here, collect the loader shell commands linker set and include it
in the data area rather than having its own section.

/boot/loader.efi was the last holdout for having a 100% self built ia64
system.
2002-04-06 03:39:22 +00:00
Peter Wemm
65a0653eb7 Use a relative path to libstand.. /usr/src/lib/libstand may not exist
or may have the wrong header files.
2002-04-04 06:04:38 +00:00
Marcel Moolenaar
16ed9fd6bb Only install the help file if we can find it. Use ${BASE}.help
in both the condition and for the install. We expect to find
the help file in ${.OBJDIR}.
2002-03-31 20:48:13 +00:00
Marcel Moolenaar
c459265de7 Pass the physical address of the bootinfo block to the kernel in
register r8. We continue to write the bootinfo block at the same
hardwired address, because the kernel still expects it there.
It is expected that future kernels use register r8 to get to the
bootinfo block and don't depend on the hardwired address anymore.

Bump the loader version once again due to the interface change.
2002-03-30 23:00:05 +00:00
Marcel Moolenaar
a918e110c4 Add a quick and dirty way to determine where we're loaded from. We
only care if it's network or not at this time. If we're loaded from
the network, we set currdev (=loaddev) so that the kernel is loaded
from the network as well. In all other cases we initialize to disk.
This makes netbooting more convenient and can easily be enhanced to
do more elaborate checking.
2002-03-30 07:32:08 +00:00
Marcel Moolenaar
4e357dbc58 The EFI loader has been improved a lot since it was first added.
Most significantly (from an interfacing point of view) is the
support for the FPSWA pointer passing. Even though that was added
4 months ago, it's probably not a bad idea to bump the version
number to reflect this.
2002-03-30 04:54:54 +00:00
Marcel Moolenaar
95c0f344ee o Add -L${DESTDIR}${LIBDIR} on the link line for -lstand.
o  Add -j .dynstr to objcopy. This makes .efi binaries work
   when built with a 3.x based toolchain.
2002-03-28 06:58:46 +00:00
Peter Wemm
436122c232 Boot from efifs first. 2002-03-19 10:50:41 +00:00
Marcel Moolenaar
8daca20f62 s/alpha/${MACHINE_ARCH}/g 2001-10-08 01:41:45 +00:00
Doug Rabson
5f802bfc9f Calculate the valid flag for ITRs and DTRs correctly. Also fix a couple
of minor problems and remove some debugging code.
2001-09-25 19:44:19 +00:00
Doug Rabson
9164a3125a Add commands to dump the itrs and dtrs. 2001-09-24 19:39:34 +00:00
Doug Rabson
0f34719cf5 Add commands to dump the configuration tables and the SAL System Table. 2001-09-23 10:28:01 +00:00
Doug Rabson
e565888bc5 Add EFI network support. 2001-09-22 19:12:30 +00:00
Doug Rabson
28d7d2f0a0 Plug in ELF backend. 2001-09-14 08:28:17 +00:00
Doug Rabson
9d2535d919 Add missing entry to memory type name table and adjust field widths. 2001-09-08 12:32:12 +00:00
Doug Rabson
3146b2d65c Add a command 'memmap' to print out the EFI memory map. 2001-09-08 12:21:37 +00:00
Doug Rabson
96bf6ac71e Hook up the native EFI filesystem reader. 2001-09-07 08:52:53 +00:00
Doug Rabson
fc2b065c41 Set currdev and loaddev variables. 2001-09-07 08:52:26 +00:00
Doug Rabson
8e8dc221a6 Enable bootforth. 2001-09-04 14:48:59 +00:00
Doug Rabson
772d958c9f Make sure we copy over the linker set sections to the EFI executable. 2001-09-04 08:59:38 +00:00
Doug Rabson
ecab3d453e Make this build again after breakage from previous commits. 2001-07-10 16:18:20 +00:00
David E. O'Brien
5ed2687ff2 style(9) and remove a left over Alpha comment 2001-06-16 06:17:35 +00:00
David E. O'Brien
3caacd361d style cleanup 2001-06-16 06:17:16 +00:00
Peter Wemm
44fa54f5f6 Nuke old gensetdefs based linker sets with extreme prejudice 2001-06-14 01:23:57 +00:00
Doug Rabson
fd3e14e915 First approximation of an ia64 EFI loader. Not functional. 2001-06-09 16:49:51 +00:00