Commit Graph

434 Commits

Author SHA1 Message Date
Andreas Färber
c3b33b6610 Introduce forth_init() for trampoline initialization
Use init_trampoline() for trampoline variable initialization.

Add calls to a new forth_init() function for each architecture
to invoke it. Idea courtesy of Blue.

This fixes ppc64 compilation by avoiding a casted self-reference.

v2:
* Share init_trampoline() with kernel/bootstrap.c, suggested by Mark.
* Adopt QEMU coding style for new functions.

Cc: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@954 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-13 13:04:34 +00:00
Andreas Färber
54c0ea8a54 ppc: Fix indentation
Tab-indent to match surrounding code.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@948 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-07 18:08:41 +00:00
Andreas Färber
652ebc448f ppc: Fix /memory reg property
Physical address and size were both using two cells instead of one,
and their order was wrong. This would happen to work for RAM < 4 GB,
since the clear high address bits would happen to match the zero-based
memory location. It would indicate a second bank of size zero though.

Switch the value order and use encode-phys in preparation for ppc64.

This tidies the output of the Haiku boot loader.

v2:
* Document TODOs for ppc64, requested by Alex.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@947 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-07 16:51:47 +00:00
Andreas Färber
cddf823b54 ppc: Avoid vector overlap on ppc64
Due to the 64-bit immediate load sequence, the ISI and DSI vectors
are two instructions too long for the respective segment exceptions.

Move the code to the start of the relocated vector region and do a
relative branch there.

v2:
* load() -> LOAD_REG_IMMEDIATE()

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Alexander Graf <agraf@suse.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@945 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-02 22:16:32 +00:00
Andreas Färber
814bcd10cd ppc: Introduce LOAD_REG_IMMEDIATE() macro for ppc64
When loading the fw_cfg address with just lis, addi sequence,
we get the high address bits as 0xffffffff on ppc64.

Use the full double word immediate load sequence on ppc64.

v2:
* Rename from load() to LOAD_REG_IMMEDIATE() to match Linux.
  Suggested by Alex.
* Move to ppc/asmdefs.h for future use elsewhere.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Alexander Graf <agraf@suse.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@944 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-02 22:13:24 +00:00
Andreas Färber
cb897515cc ppc64: Don't disable SF bit
Don't clear the MSR for the pure ppc64 version since it would disable
Sixty Four bit mode as well.

The MMU is supposed to be disabled by default.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Alexander Graf <agraf@suse.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@943 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-02 22:09:31 +00:00
Andreas Färber
f85cd4220b ppc: Use vector-local version of exception_return
On ppc64 the high 32 address bits are clear, so ba's sign extension
cannot be used to branch to the ROM version of exception_return.
Use a relative branch to the relocated version instead.

This fixes relocation linker errors for ppc64.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: Alexander Graf <agraf@suse.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@942 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-02 22:07:27 +00:00
Andreas Färber
513b9da74b ppc: Label illegal vectors
Improve GDB backtrace by making the vector source less ambiguous.
A 0x700 program exception was shown as originating from vector__0x400.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@941 f158a5a8-5612-0410-a976-696ce0be7e32
2010-11-01 17:31:11 +00:00
Andreas Färber
ce371d6307 ofmem: CIF release preparations
Add an ofmem_release() function and stub out the implementation.

Hook it up for ppc and sparc64.

Cc: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@938 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-31 15:12:01 +00:00
Andreas Färber
b0158732da ppc: Add RTAS rtas-version property
The CHRP 1.0 spec defines it as 1, which matches the IBM JS20.
Macs appear to have it as 0x41 though.

v2:
* Authentically set it to 0x41 for Apple machines.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@937 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-31 10:30:22 +00:00
Andreas Färber
8d8e29fce6 ppc: Don't set up RTAS for OldWorld Macs
According to historical device trees, pre-iMac Macs do not seem to
have the /rtas node.

Make /rtas conditional to NewWorld Macs for now, while allowing to
extend this to future CHRP machines.

This means that the ppc-softmmu would by default not have it,
except when using -M mac99. ppc64-softmmu would get it by default.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@936 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-31 10:21:50 +00:00
Andreas Färber
b544062187 ppc: Typo fix
It's Old World vs. New World Macs.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@935 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-31 09:59:12 +00:00
Andreas Färber
d1c94b88f4 ppc: Add support for -cpu 970
The 970fx is supported, which happens to be the default CPU for -M mac99.
The IBM JS20 had a dual 970 though, and -cpu 970 leads to a busy loop:

>> Unknown cpu (pvr 390000), freezing!

Add a definition for the 970.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@934 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-30 22:49:20 +00:00
Andreas Färber
545998848f ppc: Don't hardcode "ppc" arch for openbios-qemu.elf
Use $(ARCH) to allow using a different linker script for ppc64.

v2:
* Add ppc64/qemu/ldscript, derived from ppc/qemu/ldscript.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@929 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-30 15:33:11 +00:00
Mark Cave-Ayland
e47c3e71ed Alter SPARC32 memory routines so that they also update the relevant /memory and /virtual-memory properties.
The existing routines hard-coded the initial values into the device tree at startup, and then didn't update them which could 
allow the romvec memory lists and the device tree memory properties to become out of sync.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@925 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-30 13:18:31 +00:00
Mark Cave-Ayland
36d943f6d3 Change SPARC32 memory allocator to allocate memory starting from just below the OpenBIOS image downwards.
The existing code appeared to be allocating memory from the wrong property (map rather than avail) and so rather than allocating 
memory starting from just below the OpenBIOS image downwards, it was simply reducing the reported size of the OpenBIOS image.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@923 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-28 20:53:58 +00:00
Andreas Färber
380cd335cc Don't assume that pointer and cell size are identical, part 1
On ppc64, cell size is 32 bits but pointers are 64-bit.
Thus, direct casts result in warnings, treated as errors.

Use [u]intptr_t cast or cell2pointer and pointer2cell macros as necessary.

v2:
* Drop changes related to physical addresses since physical addresses may be
  wider than pointers (e.g., 36 bits on sparc32, as pointed out by Blue).
* Drop changes to cell2pointer() and pointer2cell() for now.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@922 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-25 20:48:45 +00:00
Mark Cave-Ayland
e31f031549 Reduce SPARC32 stack space since otherwise compiling with -O0 results in a 'rom: requested regions overlap (rom
/home/build/rel-qemu-git/share/qemu/openbios-sparc32. free=0x0000000070101000, addr=0x0000000070000000)
rom loading failed' error when starting qemu.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@920 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-24 21:34:21 +00:00
Mark Cave-Ayland
d0b1458780 Commit more readable version of obp_fortheval_v2 as posted to the mailing list, plus increase the default client image stack
size on SPARC32 to help Solaris 8 boot.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@919 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-24 20:20:14 +00:00
Mark Cave-Ayland
d92b811c6e Use wrappers around all romvec functions on SPARC32 to flush register window and preserve global registers.
This appears to resolve issues with OpenBIOS crashing when calling OBP functions through the romvec interface due to 
stack/register issues. Note that this patch also implements pv_printf() and pv_putstr() which appears to fix issues with 
displaying error messages during Solaris 8 boot.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@918 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-24 19:55:27 +00:00
Mark Cave-Ayland
3dbab02fc2 Fix the placing of Forth arguments on the stack when calling obp_fortheval_v2() via romvec on SPARC32.
The extra stack arguments are actually placed within %o1-%o5 but unfortunately there doesn't seem to be a way of passing the 
number of parameters using the romvec API. Hence we go through the argument list and start pushing arguments onto the Forth 
stack from the first non-zero argument before executing the Forth string.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@915 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-18 19:32:16 +00:00
Andreas Färber
dd6027703d ppc: Move noreturn attribute
Otherwise GCC 4.2.4 complains that panic() marked noreturn does return.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@914 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-17 12:15:44 +00:00
Andreas Färber
cffdefa19e ppc: Use config file to enable RTAS
RTAS had to be enabled via EXTRACFLAGS=-DUSE_RTAS.
Use the config file instead.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@909 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:22 +00:00
Andreas Färber
31289f3544 ppc: Fix client stack setup
The client stack was set up 96 * 64 KiB below the hash table.
Should be 96 KiB instead.

v2:
* Initial.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@908 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:18 +00:00
Andreas Färber
0c3891e2c9 ppc: Fix stack setup
The exception stack was always set up 64 KiB below the ROM,
ignoring hash table alignment.
Align the stack pointer appropriately.

v2:
* Drop buggy distinction based on PVR value since the previous patch
  unifies alignment. Suggested by Segher Boessenkool.

Cc: Alexander Graf <agraf@suse.de>
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@907 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:15 +00:00
Andreas Färber
7a86728b19 ppc: Move hash table
To avoid complications with ppc64, always use the ppc64 alignment.

v2:
* Initial. Suggested by Segher Boessenkool.

Cc: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@906 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:12 +00:00
Andreas Färber
076573e064 ppc: Move malloc zone
ofmem was fixed at 0x05400000, followed by the malloc zone. The latter was
bounded by the stack (now client stack), relative to the top of RAM.
An increase of RAM would therefore only enlarge the malloc zone.

Move the malloc zone below the client stack, with a fixed size of 2 MiB.
The size is derived from the memory map depicted in ofmem.c;
having a fixed size leaves room for memory claim'ed by clients
and by OpenBIOS.

v2:
* Through the preceding patch the malloc zone goes below the client stack
  rather than below the stack. Adjust and prettify the illustration.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@905 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:08 +00:00
Andreas Färber
c469e237e6 ppc: Claim memory used by OpenBIOS
OpenBIOS kept getting overwritten in RAM by clients such as Haiku.

Make sure memory used by OpenBIOS cannot accidentally be claimed
by someone else.
This also sets up the "available" property as expected.

Note that we avoid ofmem_claim() as it would map the pages using a
default mode, followed by a remap with the desired mode.

v2:
* Reordered.
* Added spacing.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@904 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:04 +00:00
Andreas Färber
4e3639f8ac ppc: Fix heap top
Don't let the client stack and the heap overlap.

v2:
* Initial.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@903 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:36:00 +00:00
Andreas Färber
ca9e9b0230 ppc: Fix RAM top (2/2)
The hash base is not get_rom_base() - HASH_SIZE. It gets rounded down,
depending on the PVR, so read its true value from SDR1.

v2:
* Split up.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@902 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:35:56 +00:00
Andreas Färber
6f834ad03b ppc: Fix RAM top (1/2)
According to the illustration in start.S,
the stack size is supposed to be 64 KiB.

v2:
* Split up.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@901 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:35:53 +00:00
Andreas Färber
74203e0c7a ppc: Remove bogus return
ofmem_free() has no return value and neither does free().

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@900 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:35:51 +00:00
Andreas Färber
d0ade34117 ppc: Use symbolic OpenBIOS origin address
This will simplify moving OpenBIOS around in memory.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@899 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 17:35:49 +00:00
Mark Cave-Ayland
5b7a80e9e8 When booting from disk, an explicit :a slice is required in order for the Fcode bootloader to execute correctly.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@898 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 15:09:18 +00:00
Mark Cave-Ayland
0fcbe4e047 Replace hardcoded value with the correct constant from spitfire.h.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@897 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-16 14:13:15 +00:00
Andreas Färber
05ec5dd149 ppc: Suppress /hypervisor outside KVM
My New World PowerMac G3 does not have a /hypervisor node.

Move all Forth code to kvm_of_init() to make it match the comment:
Don't expose /hypervisor when not in KVM.

Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Alexander Graf <agraf@suse.de>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@895 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-13 14:01:51 +00:00
Andreas Färber
1061a98f8d ppc: Fix typos in comment
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@892 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-09 10:16:26 +00:00
Mark Cave-Ayland
a5eb733975 Fix the MMU TLB miss handlers so that they no longer crash when building SPARC64 with -O0.
This patch allocates an extra 192 bytes of stack space required by unoptimised gcc builds for saving arguments to the stack. As 
suggested by Igor previously (see http://lists.openbios.org/pipermail/openbios/2009-July/003762.html and SVN r508).

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@887 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-05 08:52:49 +00:00
Mark Cave-Ayland
44af623113 Implement va>tte-data defer word for the MMU TLB miss handlers.
As used by OpenSolaris. This enables OpenSolaris boot to proceed further by allowing the kernel to correctly manage its own TLB 
misses.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@886 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-03 20:28:27 +00:00
Blue Swirl
b00e6c7085 sparc32: fix warnings from GCC 4.6.0
Compiling Sparc32 with GCC 4.6.0 20100925 produced a few warnings:
../arch/sparc32/context.c: In function 'start_main':
../arch/sparc32/context.c:49:9: error: variable 'retval' set but not used [-Werror=unused-but-set-variable]
../arch/sparc32/romvec.c: In function 'obp_devwrite':
../arch/sparc32/romvec.c:326:9: error: variable 'ret' set but not used [-Werror=unused-but-set-variable]
../drivers/iommu.c: In function 'iommu_init':
../drivers/iommu.c:102:24: error: variable 'vers' set but not used [-Werror=unused-but-set-variable]
../drivers/iommu.c:102:18: error: variable 'impl' set but not used [-Werror=unused-but-set-variable]

Fix the warnings by avoiding write-only variables.

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

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@883 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-03 19:18:23 +00:00
Blue Swirl
4355018924 Fix warnings from GCC 4.6.0
Compiling Sparc64 with GCC 4.6.0 20100925 produced a few warnings:
../arch/sparc64/context.c: In function 'start_main':
../arch/sparc64/context.c:49:9: error: variable 'retval' set but not used [-Werror=unused-but-set-variable]
../packages/disk-label.c: In function 'dlabel_load':
../packages/disk-label.c:183:8: error: variable 'buf' set but not used [-Werror=unused-but-set-variable]
../drivers/floppy.c: In function 'collect_interrupt':
../drivers/floppy.c:378:13: error: variable 'status' set but not used [-Werror=unused-but-set-variable]

Fix the warnings by avoiding write-only variables.

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

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@882 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-03 16:37:47 +00:00
Mark Cave-Ayland
630c56c162 Implement pgmap@ for SPARC64 since it is required for OpenSolaris.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@877 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-03 09:37:13 +00:00
Mark Cave-Ayland
31fd96f480 Solaris 9 kernel needs more memory during startup.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@875 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-02 13:28:49 +00:00
Mark Cave-Ayland
6d590534bb Allow context-switching within the MMU TLB miss handlers on SPARC64, and use this to implement MMU miss handlers in C rather
than assembler.

In order to allow OpenSolaris to boot under OpenBIOS, it is necessary to be able to invoke Forth words from within the MMU 
I/D-TLB miss handlers, since Solaris 10 kernels hook into the virtual to physical address translation process via va>tte-data at 
boot time. Hence this patch implements two macros: SAVE_CPU_STATE and RESTORE_CPU_STATE which enable a context switch to occur 
from within these trap handlers.

Things are more complicated from within the MMU miss handlers because we can't use flushw to flush the processor registers to 
stack. This is because the memory pointed to by the stack pointer may not be in the TLB either, and so we'd end up in a 
recursive MMU trap. Hence we solve this by creating a static stack within OpenBIOS which is guaranteed to be locked in the TLB 
and storing all of our state there.

Once the ability to switch context has been implemented, it is possible to invoke C functions as per normal from within the MMU 
miss handlers. Hence as a proof of concept I've migrated the MMU miss handling code from ASM to C with a view of making the 
relevant changes to invoke the relevant Forth functions at a later date.

I'd also like to say thank you to Blue Swirl who took the time to answer all my questions and generally point out the 
shortcomings in my first attempts at SPARC assembler.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@874 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-02 12:10:45 +00:00
Mark Cave-Ayland
e9c1365d32 Increase IMAGE_STACK_SIZE to 16K from 8K.
The existing 8K stack used when switching context to run the executable payload was not enough. Increasing the stack to 16K 
solves the issue, preventing the payload from clobbering memory within OpenBIOS as it runs.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@873 f158a5a8-5612-0410-a976-696ce0be7e32
2010-10-01 22:29:16 +00:00
Blue Swirl
b60891b683 Avoid a lot of malloc/free traffic
Each console write caused temporary buffer allocation.

Avoid allocations by changing console_draw_str() to use Forth
string parameters, which are usually readily available.

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

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@872 f158a5a8-5612-0410-a976-696ce0be7e32
2010-09-29 20:30:51 +00:00
Blue Swirl
e00c8ab982 Enable GCC warning flag -Wnested-externs, fix warnings
Move nested extern declarations into header files, or use the
already existing declarations.

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

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@861 f158a5a8-5612-0410-a976-696ce0be7e32
2010-09-06 20:56:54 +00:00
Mark Cave-Ayland
28fed458ff Alter the MMU properties as suggested by the UltraSPARC-II device tree prtconf output in the Debian sparc-utils package and
Solaris 9 boot; i.e. remove the /CPU/mmu device, relocate its methods to /virtual-memory, and alter the /chosen mmu property so 
that it now points to /virtual-memory. This helps both Solaris 9 and OpenSolaris boot further along the way.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@859 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-25 16:58:55 +00:00
Mark Cave-Ayland
bb488d3045 Fix bug in SPARC64 CIF claim function - previously we were just allocating virtual memory rather than allocating both virtual
and physical memory and setting up an MMU mapping.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@856 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-22 21:23:19 +00:00
Blue Swirl
eec9e0d61b Drop some unused variables
Found with this Coccinelle script:
@@
type T;
identifier i;
expression E;
@@

(
extern T i;
|
- T i;
  <+... when != i
- i = E;
  ...+>
)

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

git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@855 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-22 09:29:28 +00:00