Commit Graph

80 Commits

Author SHA1 Message Date
Mark Cave-Ayland
f9bdcf050c Rework the OpenBIOS internals so that boot, load and init-program now all use the unified libopenbios loader code with improved
IEEE-1275 spec compliance.

This patch implements the following:

1) Fix bootpath/bootargs handling so that default values are read from NVRAM, and allow multiple space-separated values to be 
specified.
2) With correct bootargs handling in place, move the ELF loader over to the new libopenbios unified loaders.
3) Remove all the loader code from all architecture directories sine we don't need it anymore.
4) Simplify the boot word so it invokes platform-specific code where required, then calls load and go as per the specification.

Tested on all my available images for SPARC32, SPARC64 and PPC, and compile-tested on x86.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@828 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-01 15:13:48 +00:00
Mark Cave-Ayland
f1e745579c Switch dir over to use the new static filesystem dir methods.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@817 f158a5a8-5612-0410-a976-696ce0be7e32
2010-07-11 18:57:19 +00:00
Mark Cave-Ayland
004dc4cf85 Fix up NVRAM settings for boot-device and boot-args.
This patch originally started as a fix for PPC, in that the NVRAM initialiser wasn't been run on startup (this is why printenv 
on PPC always showed much much less than on SPARC). However, it also showed up some inconsistent logic for boot device 
selection, which must also happen *before* boot is called in order for load to work correctly. With this patch applied, bootpath 
and bootargs are set from boot-device and boot-args respectively on startup for SPARC32, SPARC64 and PPC.

Note: there is a small chance SPARC32 may break on some images - please let me know if it does.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@805 f158a5a8-5612-0410-a976-696ce0be7e32
2010-06-28 11:58:28 +00:00
Mark Cave-Ayland
50e344721c Fix up parse word so that it can correctly handle empty arguments and (encode-bootpath) word so that it can handle optional
arguments. With these fixes in place we can now switch the boot word to use (encode-bootpath) which means that the bootpath and 
bootarg properties are now set exactly the same when executing boot and/or load.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@803 f158a5a8-5612-0410-a976-696ce0be7e32
2010-06-28 05:16:15 +00:00
Blue Swirl
cab993ac04 Fix Sparc32 boot breakage: define load-base
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@802 f158a5a8-5612-0410-a976-696ce0be7e32
2010-06-27 20:08:21 +00:00
Mark Cave-Ayland
3d7832bba9 Implement a basic C loader function in load.c that tries to load each supported executable file format. Now that the ihandle
hierarchy is correct, we can simply pass an ihandle into the loader and it will work correctly regardless of whether it is being 
invoked on an entire disk, partition or individual file.

In order to test the new code, start by switching the Fcode loader over to the new infrastructure for testing on SPARC64. Note 
this patch also contains a correction to load-base on SPARC which was being set to a value other than 0x4000 which is the 
documented default.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@798 f158a5a8-5612-0410-a976-696ce0be7e32
2010-06-25 20:42:00 +00:00
Mark Cave-Ayland
0c2f6e929d Demote the 'byte-load: stack overflow' message so that it only appears when fcode-debug? is set to true. This is because the
stack is automatically corrected anyway, and is triggered by a bug in older versions of the OpenSolaris boot blocks. See the 
following for more information:

http://src.opensolaris.org/source/history/onnv/onnv-gate/usr/src/psm/stand/bootblks/common/boot.fth (rev 9941:eb1c075cb0e4)
http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6803195

Anyone developing new Fcode under OpenBIOS is extremely likely to want fcode-debug? enabled during development, so this 
seems like a reasonable compromise.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@765 f158a5a8-5612-0410-a976-696ce0be7e32
2010-05-01 12:13:16 +00:00
Mark Cave-Ayland
7e28db1a6e Move the temporary compilation buffer into dictionary space. This prevent spurious dictionary overflow messages appearing due to
setup-tmp-comp switching dictionaries to memory outside of the initial dictionary space.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@761 f158a5a8-5612-0410-a976-696ce0be7e32
2010-04-30 20:54:03 +00:00
Mark Cave-Ayland
aa6519e1f2 Fix incorrect stack (dropping one too many items) when a phandle of 0 is passed into getprop CIF.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@735 f158a5a8-5612-0410-a976-696ce0be7e32
2010-04-05 19:19:37 +00:00
Mark Cave-Ayland
3111a2293b Fix two errors related to argument passing in the client interface:
i) client-call-iface did not set a return value of 0 on success; hence the top stack argument was dropped as part of the status 
check causing an off-by-one error.

ii) instead of setting pb->nret to be the number of arguments returned, the (random) value being passed in was being used to 
control the number of arguments being returned.


Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@732 f158a5a8-5612-0410-a976-696ce0be7e32
2010-04-03 08:25:47 +00:00
Mark Cave-Ayland
bedc10adae Now that we have a C version of go available, rework client.fs so that it will automatically detect if a platform has execution
capability based upon the existence of the lower level (go) word. Also add standard ELF image support to (go) for SPARC32, 
SPARC64 and x86.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@728 f158a5a8-5612-0410-a976-696ce0be7e32
2010-04-02 14:03:38 +00:00
Mark Cave-Ayland
1b273803c2 The new loader APIs in libopenbios already have routines to detect the type of executable at a given address and react
accordingly. Hence since the loaders are currently written in C, it makes more sense to drop down into C and re-use the same 
code rather than have a second implementation in Forth.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@726 f158a5a8-5612-0410-a976-696ce0be7e32
2010-04-02 13:01:10 +00:00
Mark Cave-Ayland
8a6d445d38 Introduce the concept of the OF saved-program-state structure and modify all of the loaders (except PPC) to make use of it.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@708 f158a5a8-5612-0410-a976-696ce0be7e32
2010-03-26 21:17:32 +00:00
Igor V. Kovalenko
91857d3a8c pathres: consistently encode unit address on 64bit target
This change fixes node unit address matching on arch
where cell is not 4 byte integer (tested with sparc64.)

Since we encode "reg" property chunks with encode-int
we need to use the same encoding while preparing unit
phys addr for comparison at path resolution time.

- (exact-match): calculate phys addr length using 4 byte
  member encoding with /l* not cells

- find-child: encode phys addr components similar to
  encode-int with 4 byte stores

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@674 f158a5a8-5612-0410-a976-696ce0be7e32
2010-02-03 17:54:14 +00:00
Blue Swirl
0b0411515c Make auto-boot default again
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@661 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-03 08:58:56 +00:00
Blue Swirl
fdf932f477 Fix non-Sparc64 architecture breakage by r657
Build broke with:
  GEN   openbios.dict
 undefined word.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@660 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-03 08:58:55 +00:00
Mark Cave-Ayland
83425bf953 Add Fcode as a suitable executable payload for init-program.
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@659 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-03 03:44:01 +00:00
Mark Cave-Ayland
301d419d4c Add Stefan's hack for load-base to allow it to be referenced as a value from within Fcode bootloaders such as Milax.
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@657 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-02 12:43:59 +00:00
Mark Cave-Ayland
8c7efc5939 Add load-base NVRAM variable for SPARC64.
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@656 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-01 18:21:18 +00:00
Mark Cave-Ayland
46f2ccaf6d Change the new-device word so that subsequent words within a new device are added to the public wordlist and not
the private wordlist by default. This is required for executing Milax Fcode which defines package words which need to be externally 
visible.

As a consequence, it is now possible to remove lots of "external" words used building the device tree since this is now the 
default.


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@655 f158a5a8-5612-0410-a976-696ce0be7e32
2010-01-01 18:17:15 +00:00
Mark Cave-Ayland
3ef33eb736 Correct Forth data stack when the alarm word is used (the implementation is currently missing, but we'll worry about that a bit
later). This allows us to proceed further with SPARC64 boot.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@642 f158a5a8-5612-0410-a976-696ce0be7e32
2009-12-09 18:44:01 +00:00
Mark Cave-Ayland
7253d7b0af Revert r638, apply previous patch to extend control flow stack items to 2 data stack items, and fix the Fcode evaluator to use
this new information to correctly resolve destination (b<mark) references. See the email archives for further discussion on why 
this is required.

Hopefully this should finally resolve the Fcode backward branch problem; at least all previous incorrect resolutions now appear 
correct and the Fcode evaluator no longer crashes or gets stuck in a loop while attempting to boot Milax.



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@641 f158a5a8-5612-0410-a976-696ce0be7e32
2009-12-09 01:09:48 +00:00
Mark Cave-Ayland
dbc5a9c3ba Fix backwards Fcode branches (bbranch and b?branch).
According to the specification, the destination for a backwards Fcode branch must be resolved from the bottom rather than the 
top of the cstack. The existing version of the code was simply doing a swap, and so nesting any branches within a backward branch 
would fail since the wrong destination would be resolved from the stack.

This patch adds a new cstack-startdepth variable to keep track of the cstack base location within an execution context 
(setup-tmp-comp and execute-tmp-comp) and alters the backward branches to make use of it.

With this patch in place, Milax under Qemu doesn't crash anymore but sits in an infinite loop reading sectors from the CDROM.


Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@638 f158a5a8-5612-0410-a976-696ce0be7e32
2009-12-03 15:47:39 +00:00
Mark Cave-Ayland
ba52470cce In the IEEE 1275-1994 specification the parameters for Client Interface calls
are not in forth stack order but in reversed (heh!) order. Our implementation
confused this.

This second patch is fairly straightforward; probably the only unexpected part is
the need to rename the existing /openprom/client-services "claim" and
"release" words to "cif-claim" and "cif-release" respectively. This is
because we need to use the "claim" and "release" words in
forth/system/ciface.fs to reverse the argument order before calling the real
underlying words.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@637 f158a5a8-5612-0410-a976-696ce0be7e32
2009-12-02 10:44:35 +00:00
Laurent Vivier
5e57ac49a0 dir command cleanup
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@635 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-26 01:47:36 +00:00
Laurent Vivier
576f234a27 Implement command "dir <path>".
This is the generic command, it needs support from the filesystem 
packages.

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@630 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-22 09:58:01 +00:00
Laurent Vivier
02d95dc3cd Revert commit r624 (breaks ppc and sparc64 boot)
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@625 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-22 09:04:27 +00:00
Stefan Reinauer
5bd8b39a36 In the IEEE 1275-1994 specification the parameters for Client Interface calls
are not in forth stack order but in reversed (heh!) order. Our implementation
confused this. 

This might / will need some more work, but get this in so more people can test
easily.

From Mark Cave-Ayland and me.



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@624 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 19:09:04 +00:00
Stefan Reinauer
c10134fb2d - drop commented out functions, they're in others.fs already
- fix another stack diagram typo


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@621 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 18:54:38 +00:00
Stefan Reinauer
51fb2e19c3 improve x@ and x! functions, at least x@ reads back what x! wrote, now.
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@620 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 16:37:41 +00:00
Stefan Reinauer
6708a79d0f actually print value of a (lit)
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@619 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 15:58:55 +00:00
Stefan Reinauer
b1cb73b506 fix ms
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@618 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 15:42:28 +00:00
Stefan Reinauer
7c14e1eac7 - hook up new 64bit words into fcode table.
- dummy implementations for peek, poke, ms and get-msecs


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@617 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 15:40:53 +00:00
Stefan Reinauer
d5714f89ac Add 64bit extensions from 12756d5
Signed-off-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@616 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-20 15:38:29 +00:00
Stefan Reinauer
7dbe5e6507 This patch replaces the string definitions in nvram.fs by the
simpler version s" that does not contain a complex parser for
" "(0a) type of strings.

Also use handle-text in " instead of the hand crafted version. This fixes 
strings in "see".

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@613 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-17 16:54:24 +00:00
Blue Swirl
d6aac5ffe2 Reworked version of Forth Source debugger (Mark Cave-Ayland)
This patch implements the following Forth words:

   debug <xt> - Mark word for debugging
   debug-off  - Unmark all words for debugging
   resume     - Return from subordinate Forth interpreter

The source debugger also implements the following commands when it has
been activated:

   Up - Unmark current word for debugging, mark parent and continue
   Down - Mark next word for debugging
   Trace - Continue execution until end of word displaying
           debug information
   Rstack - Display contents of the Rstack
   Forth - Launch subordinate Forth interpreter

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@611 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-15 21:03:51 +00:00
Laurent Vivier
515a3c6eb3 Implement Client Interface method "test-method" defined in
"PowerPC Microprocessor CHRP binding", Chapter 10.5.2.

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@609 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-12 01:11:04 +00:00
Laurent Vivier
d6365bca24 Fully decode PCI unit name attribute.
Signed-off-by: Laurent Vivier <Laurent@vivier.eu>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@603 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-10 21:39:42 +00:00
Laurent Vivier
92e6599c92 Correctly encode strings of bootpath and bootargs properties.
Signed-off-by: Laurent Vivier <Laurent@vivier.eu>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@602 f158a5a8-5612-0410-a976-696ce0be7e32
2009-11-10 21:34:21 +00:00
Laurent Vivier
428b4b807f Manage state-valid.
"go" can be done only if init-program has set state-valid to true.

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@587 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-21 22:44:21 +00:00
Laurent Vivier
719271835f Add bootinfo-loader.
Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@584 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-20 20:15:46 +00:00
Laurent Vivier
1f31d2f057 When "load" is used, correctly set bootpath and bootargs.
Signed-off-by: Laurent Vivier <Laurent@Vivier.eu>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@583 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-20 19:32:30 +00:00
Laurent Vivier
ebf7e3f6da According to IEEE Std 1275-1994, "CORE REQUIREMENTS AND PRACTICES",
Annexe H.8, "User interface name changes", "select-dev" and
"unselect-dev" have been obsoleted and replaced by "open-dev" and 
"device-end".
But some scripts (like BootX) are using the obsoleted name, so we need 
to
define them.

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@582 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-20 04:20:48 +00:00
Laurent Vivier
9164a49dc8 Implements XCOFF loader (to be able to boot Apple BootX bootloader)
Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@581 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-19 21:44:05 +00:00
Laurent Vivier
1a93a83480 Allows to boot openSUSE from install CD-ROM
Implements "init-program" using loader packages
Write a first loader package: elf-loader

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@578 f158a5a8-5612-0410-a976-696ce0be7e32
2009-09-18 22:59:30 +00:00
Laurent Vivier
95a04cec0e Implement load method
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@575 f158a5a8-5612-0410-a976-696ce0be7e32
2009-08-30 23:39:55 +00:00
Laurent Vivier
a58190e204 Define load-base to follow memory mapping defined in the BootX source
comments.

This as been reported by Steven Noonan.



git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@573 f158a5a8-5612-0410-a976-696ce0be7e32
2009-08-29 21:09:21 +00:00
Laurent Vivier
3e457210bd Implement "$=" to compare two strings (needed by BootX)
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@572 f158a5a8-5612-0410-a976-696ce0be7e32
2009-08-29 20:42:22 +00:00
Laurent Vivier
2db781a446 Replace yaboot_startup() by newworld_boot() which implements generic
CHRP boot method.
It finds the CHRP bootscript using the file attribute 'tbxi' and 
the blessed directory.

This method allows to boot easily Fedora (the bitness detection is done
by the script and yaboot is called with the according yaboot.conf) but
openSUSE is broken (you have to use "boot cd:,\suseboot\yaboot")
Debian works well (as usual...).
The openSUSE needs the missing forth words: "load" and "go".
The MacOS bootloader (BootX) is also loaded automatically but forth 
script is too complex to be executed correctly.

Signed-off-by: Laurent Vivier <Laurent@vivier.eu>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@571 f158a5a8-5612-0410-a976-696ce0be7e32
2009-08-29 15:43:00 +00:00
Blue Swirl
dfb87d8446 Minor tweaks to dump word output (Mark Cave-Ayland)
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@511 f158a5a8-5612-0410-a976-696ce0be7e32
2009-07-12 20:16:39 +00:00