Commit Graph

45 Commits

Author SHA1 Message Date
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
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
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
Mark Cave-Ayland
0d2c29f1ef Commit better SPARC32 fix for obp_devclose().
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@852 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-11 20:59:18 +00:00
Mark Cave-Ayland
287779605b Revert commit r850 - on reflection, keeping a separate v2 function for obp_devclose() seems a little excessive.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@851 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-11 20:57:53 +00:00
Mark Cave-Ayland
348083a52d Fix up obp_devclose on SPARC32 - Forth's close-dev doesn't actually return a result code, so we fix it as 1 (to indicate success) for the v0
callback as suggested by Google, and simply return nothing for the v2 callback as indicated by the romvec structure. This allows us to remove the 
extra POP() which was causing a stack underflow error which was affecting Solaris 8 installation kernel boot.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@850 f158a5a8-5612-0410-a976-696ce0be7e32
2010-08-11 16:41:36 +00:00
Mark Cave-Ayland
1dbe55b8e4 Move the basic OpenBIOS configuration header files from include/openbios to include/.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@695 f158a5a8-5612-0410-a976-696ce0be7e32
2010-03-14 17:19:58 +00:00
Mark Cave-Ayland
f84dd73af4 Fix the sys_info.h header file so it doesn't reference functions both inside and outside of libopenbios, and move the firmware
configuration header file to include/arch/common. Following through the code showed that elfnote.c and linuxbios.c were being 
used by sys_info and so these are also renamed to elf_info.c and linuxbios_info.c for clarity.

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


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@693 f158a5a8-5612-0410-a976-696ce0be7e32
2010-03-14 16:09:44 +00:00
Mark Cave-Ayland
da4cc1d0bd Move the driver header files into include/drivers to synchronise with the code directory structure.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@692 f158a5a8-5612-0410-a976-696ce0be7e32
2010-03-14 15:19:41 +00:00
Mark Cave-Ayland
4a2c065e4f Move the libopenbios header files into include/libopenbios to synchronise with the code directory structure.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@siriusit.co.uk>


git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@691 f158a5a8-5612-0410-a976-696ce0be7e32
2010-03-14 15:05:53 +00:00
Blue Swirl
12fda803f3 Fix build errors with debugging enabled
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@512 f158a5a8-5612-0410-a976-696ce0be7e32
2009-07-20 06:52:23 +00:00
Blue Swirl
91148c0702 Clean up Sparc32 memory management
Concentrate memory and MMU management (lib.c malloc, romvec opb_, iommu,
OF /memory) to lib.c.



git-svn-id: svn://coreboot.org/openbios/openbios-devel@344 f158a5a8-5612-0410-a976-696ce0be7e32
2009-01-03 13:45:02 +00:00
Blue Swirl
c5d270009e Warning fixes for Sparc32, Sparc64, PPC
Fix warnings that would be caused by gcc flag -Wwrite-strings and
-Wmissing-prototypes. Also fix most PPC specific warnings.


git-svn-id: svn://coreboot.org/openbios/openbios-devel@288 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-14 12:54:23 +00:00
Blue Swirl
1b49d198f1 Fix NetBSD booting
git-svn-id: svn://coreboot.org/openbios/openbios-devel@278 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-01 18:04:16 +00:00
Blue Swirl
bf0c6b1c38 Fix most warnings from Sparse
git-svn-id: svn://coreboot.org/openbios/openbios-devel@274 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-30 11:54:01 +00:00
Blue Swirl
c52d26b976 Reduce warnings by 29%
git-svn-id: svn://coreboot.org/openbios/openbios-devel@273 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-29 19:31:28 +00:00
Blue Swirl
e5bc7e8990 Fix system include file use
git-svn-id: svn://coreboot.org/openbios/openbios-devel@250 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-17 19:42:11 +00:00
Blue Swirl
f6ddfeb0e7 Fix OpenBSD >4.2 crash when printing out bootpath
git-svn-id: svn://coreboot.org/openbios/openbios-devel@244 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-02 19:25:05 +00:00
Blue Swirl
5205e45840 Fix some Sparc32 compile warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@189 f158a5a8-5612-0410-a976-696ce0be7e32
2008-07-07 18:35:51 +00:00
Blue Swirl
a7bceec408 Fix NetBSD reset problem
git-svn-id: svn://coreboot.org/openbios/openbios-devel@187 f158a5a8-5612-0410-a976-696ce0be7e32
2008-07-05 16:57:17 +00:00
Blue Swirl
b1f340d044 Fix NetBSD property problems
git-svn-id: svn://coreboot.org/openbios/openbios-devel@169 f158a5a8-5612-0410-a976-696ce0be7e32
2007-08-11 07:45:33 +00:00
Blue Swirl
6623b66346 Maximally align allocations
git-svn-id: svn://coreboot.org/openbios/openbios-devel@167 f158a5a8-5612-0410-a976-696ce0be7e32
2007-07-29 20:20:46 +00:00
Blue Swirl
bca00a2c33 Fix mapping of a single byte area, fix reset and poweroff
git-svn-id: svn://coreboot.org/openbios/openbios-devel@166 f158a5a8-5612-0410-a976-696ce0be7e32
2007-07-20 11:23:30 +00:00
Blue Swirl
8980119c27 Update totavail when memory is allocated by dumb memory allocator
git-svn-id: svn://coreboot.org/openbios/openbios-devel@154 f158a5a8-5612-0410-a976-696ce0be7e32
2007-06-27 20:11:08 +00:00
Blue Swirl
3d080ec99b Fix obp_dumb_memalloc
git-svn-id: svn://coreboot.org/openbios/openbios-devel@151 f158a5a8-5612-0410-a976-696ce0be7e32
2007-06-10 15:56:42 +00:00
Blue Swirl
f4151ed546 Try to fix system reset for SMP and SS-10 cases
git-svn-id: svn://coreboot.org/openbios/openbios-devel@150 f158a5a8-5612-0410-a976-696ce0be7e32
2007-05-27 19:49:35 +00:00
Blue Swirl
21fb003090 Use full 36-bit physical address space on SS10
git-svn-id: svn://coreboot.org/openbios/openbios-devel@149 f158a5a8-5612-0410-a976-696ce0be7e32
2007-05-19 12:55:01 +00:00
Blue Swirl
0e4a65dbb9 Fix broken compilation when debugging enabled
git-svn-id: svn://coreboot.org/openbios/openbios-devel@129 f158a5a8-5612-0410-a976-696ce0be7e32
2007-04-24 20:00:02 +00:00
Stefan Reinauer
247c616971 Fix for interpose problem.
git-svn-id: svn://coreboot.org/openbios/openbios-devel@127 f158a5a8-5612-0410-a976-696ce0be7e32
2007-04-24 19:19:58 +00:00
Stefan Reinauer
aac2f06b44 Patch for SunOS compatibility from pjcreath+openbios@gmail.com:
I've been trying to get old versions of SunOS to load under qemu.  In
doing so, I've encountered a number of bugs in OBP.  I'm not always
certain of the best fix, but I can at least provide a quick hack that
will get people farther along.


1) Error message: "kmem_alloc failed, nbytes 680"

Bug: obp_dumb_memalloc is a bit too dumb.  It needs to pick an address
if passed a null address.  (According to the comment in the allocator
in OpenSolaris prom_alloc.c (see
<http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/psm/promif/ieee1275/sun4/prom_alloc.c>),
"If virthint is zero, a suitable virt is chosen.")

Quick fix: If passed a null address, start doling out addresses at
10MB and increment by size.

Shortcomings: The quick fix ignores the issue of free() and doesn't
remove memory from the virtual-memory/available node.

After the quick fix, the boot gets farther, leading us to:


2) Error message: "Unhandled Exception 0x00000080"

Bug: Trap 0 (entry 0x80 in the table, i.e. syscall_trap_4x) is
undefined.  This is because the SunOS bootloader installs the trap by
writing code in the trap table, but the trap table is in the .text
section of OpenBIOS.  Thus the trap 0 handler simply jumps to "bug".

Quick fix: Move the trap table  to the .data section.  Insert a "b
entry; nop; nop; nop;" before "bug:".

Shortcomings: Requires the extra "b entry" code.  Allows the only VM
copy of the trap table to be permanently changed.  OpenBIOS should
copy the read-only trap table to read-write memory (and update %tbr)
upon reset/entry.


3) #2 above actually exposes another bug.  The write to the read-only
trap table does not cause an access violation -- instead, it silently
fails.  The "std" instruction at 0x403e6c in the bootloader has no
effect.

Bug: Uncertain.  It could be a systemic bug in qemu, but it appears
that the VM's MMU believes that the page is writable.  That means that
the VM's MMU is not having the access protection flags set for pages
mapped to ROM.  It thinks everything is rwx.

Fix?: The VM's MMU should have the access protection flags properly
set for each ROM section.  This should probably be done within
OpenBIOS.  E.g., .text should be r-x, .data should probably be rwx,
etc.

This is the one fix I'm really not sure how to implement.  Any
suggestions?  This may be a problem that only affects this bootloader,
so fixing #2 above may be all that's strictly necessary.  But I'm not
positive that this bug doesn't have other ill effects I haven't found
yet.

At any rate, fixing #2 gets us still further, to:


4) Error messages:
"obp_devopen(sd(0,0,0):d) = 0xffd8e270
obp_inst2pkg(fd 0xffd8e270) = 0xffd57f44
obp_getprop(0xffd57f44, device_type) (not found)"

Bug: The OpenBIOS "interpose" implementation is not transparent to
non-interposition-aware code (in violation of the interposition spec).
 The inst2pkg call in this sequence returns the phandle for
/packages/misc-files, instead of the proper phandle.

Quick fix: Comment out the "interpose disk-label" lines in ob_sd_open.

Shortcomings: It disables disk-label.  The correct fix is to fix the
underlying problem with interposition, but I'm not sure exactly what
it is.  Could someone help?


Fixing #4 gets us quite a bit further, until:


5) Error message:
"Unhandled Exception 0x00000009
PC = 0xf0138b20 NPC = 0xf0138b24
Stopping execution"

Bug: The instruction is trying to read from 0xfd020000+4, which is an
invalid address.  This address isn't mapped by OBP by default on Sun
hardware, so the bootloader must be trying to (a) map this address and
failing silently or (b) skipping the mapping for some reason.  The
instruction is hard-coded to look at this absolute address.

Fix: Unknown.  This may be another instance of writes silently
failing, hence my interest in #3 above.  It could also be a
side-effect of the quick fix for #4.

6) Error message:
"BAD TRAP: cpu=0 type=9 rp=fd008f0c addr=feff8008 mmu_fsr=3a6 rw=2
MMU sfsr=3a6: Invalid Address on supv data store at level 3
regs at fd008f0c:
psr=4400fc7 pc=f00053f4 npc=f00053f8
..."

Bug: Real sun4m hardware registers 4 CPU-specific interrupts followed
by a system-wide interrupt, regardless of the number of CPUs
installed.  The same is true of counters.  SunOS looks at the 5th
interrupt for the system-wide interrupt.  OBP, since there's only one
CPU, just sets up one CPU-specific interrupt followed by the
system-wide interrupt, so there is no 5th interrupt.  See the comment
on "NCPU" at
<http://stuff.mit.edu/afs/athena/astaff/project/opssrc/sys.sunos/sun4m/devaddr.h>.

Fix: in obp_interrupt_init() and obp_counter_init() register 4
CPU-specific interrupts before allocating the system-wide interrupt.
The kernel will then map the 5th interrupt to the system-wide
interrupt.

7) Error message:
"BAD TRAP: cpu=0 type=9 rp=fd008d8c addr=7ff000 mmu_fsr=126 rw=1
MMU sfsr=126: Invalid Address on supv data fetch at level 1
regs at fd008d8c:
psr=4000cc4 pc=f01339a4 npc=f01339a8
..."

Bug: The command-line arguments passed to the kernel are fixed at
address 0x7FF000 (CMDLINE_ADDR, passed from qemu via nv_info.cmdline),
which is no longer mapped by the time the kernel looks at the boot
arguments.  A regular Sun boot ROM will copy this into mapped memory.

Fix: Copy the string in nv_info.cmdline to a OpenBIOS global (since
OpenBIOS continues to be mapped) in ob_nvram_init().


8) Error message:
"BAD TRAP: cpu=0 type=9 rp=fd008dec addr=1019000 mmu_fsr=126 rw=1
MMU sfsr=126: Invalid Address on supv data fetch at level 1
regs at fd008dec:
psr=4400cc5 pc=f0131680 npc=f0131684
..."

Bug: The dumb memory allocator from bug #1 was allocating a range that
the SunOS 4 kernel doesn't like.

Fix: Mimic the Sun boot ROM allocator:  the top of the heap should be
a 0xFFEDA000 and allocations should return descending addresses.  So,
for example, if asking for 0x1000 bytes, the first returned pointer
should be 0xFFED9000.

9) Error message:
"BAD TRAP: cpu=0 type=9 rp=fd008d2c addr=b1b91000 mmu_fsr=126 rw=1
MMU sfsr=126: Invalid Address on supv data fetch at level 1
regs at fd008d2c:
psr=4900cc3 pc=f0142c04 npc=f0142c08
..."

Bug: The precise underlying cause isn't clear.  The bug appears due to
a variation between OBP's behavior and stock Sun behavior.

Fix: Add the "cache-physical?" property to the CPU node in
ob_nvram_init() and bump the "mmu-nctx" property up to 4096 (from
256).





git-svn-id: svn://coreboot.org/openbios/openbios-devel@114 f158a5a8-5612-0410-a976-696ce0be7e32
2007-03-09 00:59:05 +00:00
Stefan Reinauer
0726cb7dd7 blueswirl's latest console-nographic.diff.bz2
git-svn-id: svn://coreboot.org/openbios/openbios-devel@71 f158a5a8-5612-0410-a976-696ce0be7e32
2006-07-23 14:29:29 +00:00
Stefan Reinauer
6aa2681386 get sparc64 almost building (fails due to my binutils at the moment)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@60 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-10 02:04:54 +00:00
Stefan Reinauer
b8a7ec8a6b fix prototype
git-svn-id: svn://coreboot.org/openbios/openbios-devel@54 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-07 10:18:24 +00:00
Stefan Reinauer
d369c47203 get solaris boot to show error messages again :-))
This also gets us further with netbsd


git-svn-id: svn://coreboot.org/openbios/openbios-devel@50 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-07 07:44:40 +00:00
Stefan Reinauer
ebc74de556 openbios.patch-22.bz2 from blueswirl
git-svn-id: svn://coreboot.org/openbios/openbios-devel@49 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-06 22:23:04 +00:00
Stefan Reinauer
9f386f64bd add reset-all and reset for sparc32
git-svn-id: svn://coreboot.org/openbios/openbios-devel@48 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-05 20:34:53 +00:00
Stefan Reinauer
0f8870dd45 we're on the way: solaris fails a lot later now:
git-svn-id: svn://coreboot.org/openbios/openbios-devel@46 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-05 19:49:53 +00:00
Stefan Reinauer
f7784c1d5d blueswirl's sparc32 patches - boots linux.
git-svn-id: svn://coreboot.org/openbios/openbios-devel@35 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-28 18:48:47 +00:00
Stefan Reinauer
85a73f1f84 make sparc32 boot linux. This should be stripped down again
git-svn-id: svn://coreboot.org/openbios/openbios-devel@33 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-26 10:37:37 +00:00
Stefan Reinauer
9283d9ebc8 openbios.patch-15-svn25.bz2 part II merge
git-svn-id: svn://coreboot.org/openbios/openbios-devel@27 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-22 22:16:20 +00:00
Stefan Reinauer
ad82fa58a6 blueswirl -14 sparc32 related
git-svn-id: svn://coreboot.org/openbios/openbios-devel@24 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-22 10:33:31 +00:00
Stefan Reinauer
e67c4c8142 this makes linux on sparc32 boot :-)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@23 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-18 21:57:08 +00:00
Stefan Reinauer
3b61f3011b new sparc merge
git-svn-id: svn://coreboot.org/openbios/openbios-devel@19 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-16 17:36:09 +00:00
Stefan Reinauer
1d33aa0ec0 sparc32 merge
git-svn-id: svn://coreboot.org/openbios/openbios-devel@18 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-15 08:17:51 +00:00
Blue Swirl
db8e7fe92a merge more sparc32 code from: Blue Swirl <blueswir1@hotmail.com>
git-svn-id: svn://coreboot.org/openbios/openbios-devel@16 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-10 23:00:34 +00:00