Commit Graph

160 Commits

Author SHA1 Message Date
Blue Swirl
37cc208996 Move serial console functions to obio.c
git-svn-id: svn://coreboot.org/openbios/openbios-devel@317 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-23 12:07:07 +00:00
Blue Swirl
58d21fb1c2 Change part_length to a define
git-svn-id: svn://coreboot.org/openbios/openbios-devel@312 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-23 10:15:14 +00:00
Blue Swirl
e7b906fd86 Fix gcc and Sparse warnings generated by r301
git-svn-id: svn://coreboot.org/openbios/openbios-devel@302 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-21 09:15:57 +00:00
Laurent Vivier
e11b806d1c qemu better support
This patches copies all needed ppc files to qemu and modifies them.

The generated OpenBIOS image must be loaded at adresse 0xfff00000 by  Qemu.

It is able to load Yaboot from disk and Yaboot is able to load Linux, but Linux hangs somewhere... of course it needs more work (but this cleans up my patch queue).

Thank you to Blue Swirl and Aurelien Jarno for their help.

Signed-off-by: Laurent Vivier <Laurent@lvivier.info>


git-svn-id: svn://coreboot.org/openbios/openbios-devel@301 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-21 08:30:42 +00:00
Blue Swirl
d7208a6daf Fix Sparse warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@296 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-20 18:36:23 +00:00
Blue Swirl
7e21fc929d Fix almost all remaining warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@294 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-20 17:15:47 +00:00
Blue Swirl
edafcf6e86 IDE fixes for PPC (Laurent Vivier)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@292 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-20 14:48:40 +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
41659eb217 Remove spurious svn:executable property
git-svn-id: svn://coreboot.org/openbios/openbios-devel@286 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-14 09:09:48 +00:00
Blue Swirl
a757800a01 Remove unnecessary trailing newlines
git-svn-id: svn://coreboot.org/openbios/openbios-devel@285 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-13 09:26:41 +00:00
Blue Swirl
58ca864765 Delete extra whitespace at the end of line, which annoys quilt
git-svn-id: svn://coreboot.org/openbios/openbios-devel@284 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-11 20:30:53 +00:00
Blue Swirl
e338f06ba1 Initialize VGA from PCI configuration (Laurent Vivier)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@281 f158a5a8-5612-0410-a976-696ce0be7e32
2008-12-05 18:31:27 +00:00
Blue Swirl
d4eec07d55 Fix some more warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@275 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-30 13:42:11 +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
f446864114 Use pci_arch_t also on Sparc64 (but disable PCI probing for now, hangs)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@270 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-29 13:18:32 +00:00
Blue Swirl
80df7beb9f Eliminate M4 macros
git-svn-id: svn://coreboot.org/openbios/openbios-devel@266 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-28 19:40:28 +00:00
Blue Swirl
b210e52224 Rearrange nvram init
git-svn-id: svn://coreboot.org/openbios/openbios-devel@262 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-25 18:30:22 +00:00
Blue Swirl
df5359c81a Fix Sparc32 and Sparc64 build by reverting some of the previous patches
git-svn-id: svn://coreboot.org/openbios/openbios-devel@261 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-24 19:29:24 +00:00
Laurent Vivier
d6cd6543aa Create device tree according found PCI devices.
Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/openbios/openbios-devel@257 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-24 12:29:36 +00:00
Laurent Vivier
bee6afbc60 Access to nvram must left shifted by 4.
Initialize device tree (used by PCI patch, to follow).

Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
Acked-by: Stefan Reinauer <stepan@coresystems.de>




git-svn-id: svn://coreboot.org/openbios/openbios-devel@255 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-24 12:21:36 +00:00
Laurent Vivier
c619e7c4a1 Define the ISA io base according machine type.
Signed-off-by: Laurent Vivier <Laurent@lvivier.info> 
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/openbios/openbios-devel@254 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-24 12:19:05 +00:00
Laurent Vivier
f4f7644d8c This patch moves all definitions of REGISTER_NAMED_NODE and
REGISTER_NODE_METHODS to openbios/bindings.h.

Signed-off-by: Laurent Vivier <Laurent@lvivier.info>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://coreboot.org/openbios/openbios-devel@252 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-24 12:15:08 +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
0734bf85e6 Avoid including system <asm/page.h>, based on patch by Aurelien Jarno
git-svn-id: svn://coreboot.org/openbios/openbios-devel@248 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-09 19:15:08 +00:00
Blue Swirl
7e8e34ae70 Fix compilation on OpenBSD: avoid accidental system include file use
git-svn-id: svn://coreboot.org/openbios/openbios-devel@246 f158a5a8-5612-0410-a976-696ce0be7e32
2008-11-08 09:10:52 +00:00
Blue Swirl
aee05c163e Use the firmware device introduced in Qemu SVN r5256
git-svn-id: svn://coreboot.org/openbios/openbios-devel@237 f158a5a8-5612-0410-a976-696ce0be7e32
2008-09-18 18:41:26 +00:00
Blue Swirl
7bb362b0c9 Fix compilation on OpenBSD: avoid accidental system include file use
git-svn-id: svn://coreboot.org/openbios/openbios-devel@228 f158a5a8-5612-0410-a976-696ce0be7e32
2008-08-10 18:09:55 +00:00
Blue Swirl
33b784951f Add prototypes for [v]snprintf
git-svn-id: svn://coreboot.org/openbios/openbios-devel@191 f158a5a8-5612-0410-a976-696ce0be7e32
2008-07-07 18:37:24 +00:00
Blue Swirl
3409ec8b13 Fix some Sparc64 compile warnings
git-svn-id: svn://coreboot.org/openbios/openbios-devel@190 f158a5a8-5612-0410-a976-696ce0be7e32
2008-07-07 18:36:16 +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
36f50c20dc Revert broken r161, fix identification string printing (Igor Kovalenko)
git-svn-id: svn://coreboot.org/openbios/openbios-devel@186 f158a5a8-5612-0410-a976-696ce0be7e32
2008-04-24 15:26:13 +00:00
Blue Swirl
b56d6fd8a5 Move AUX1 and AUX2 to correct locations, rename APC
git-svn-id: svn://coreboot.org/openbios/openbios-devel@185 f158a5a8-5612-0410-a976-696ce0be7e32
2008-02-01 19:58:56 +00:00
Blue Swirl
a4340199fb Update OHW interface to version 3.
Use common ABI description file with Qemu for both Sparc32 and Sparc64.
Remove private definitions and magic constants.


git-svn-id: svn://coreboot.org/openbios/openbios-devel@176 f158a5a8-5612-0410-a976-696ce0be7e32
2007-11-14 19:25:43 +00:00
Blue Swirl
65dca7dd37 Add SPARCserver 600MP emulation
git-svn-id: svn://coreboot.org/openbios/openbios-devel@175 f158a5a8-5612-0410-a976-696ce0be7e32
2007-11-11 18:02:11 +00:00
Blue Swirl
d77b4ab701 Fix Sparc64 insw and outsw
git-svn-id: svn://coreboot.org/openbios/openbios-devel@161 f158a5a8-5612-0410-a976-696ce0be7e32
2007-07-09 16:25:32 +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
Stefan Reinauer
d06b24d10f SS10 support by blueswirl
git-svn-id: svn://coreboot.org/openbios/openbios-devel@120 f158a5a8-5612-0410-a976-696ce0be7e32
2007-04-09 12:35:41 +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
1a34b8a360 64bit fixes from blueswirl
git-svn-id: svn://coreboot.org/openbios/openbios-devel@83 f158a5a8-5612-0410-a976-696ce0be7e32
2006-09-14 15:06:38 +00:00
Stefan Reinauer
7c2a631397 VGA for Sparc64
Added 8x16 font, low-level VGA register programming and mode switching
functions from LinuxBIOS.

Fixed incorrect VGA_BASE.



git-svn-id: svn://coreboot.org/openbios/openbios-devel@69 f158a5a8-5612-0410-a976-696ce0be7e32
2006-07-18 21:48:00 +00:00
Stefan Reinauer
e492087dbe 64-bit fixes
General 64-bit fixes and a hack for x86 to Sparc64 crosscompiling problem,
where x86 misses 128-bit types.



git-svn-id: svn://coreboot.org/openbios/openbios-devel@68 f158a5a8-5612-0410-a976-696ce0be7e32
2006-07-18 21:42:16 +00:00
Stefan Reinauer
ca836bfae7 sparc64: fix CFLAGS and add missing pci include
git-svn-id: svn://coreboot.org/openbios/openbios-devel@63 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-11 10:59:48 +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
ad26a9b752 initial sparc64 version
git-svn-id: svn://coreboot.org/openbios/openbios-devel@58 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-10 01:37:53 +00:00
Stefan Reinauer
f1ab57e8a0 non-sparc64 part of -25
git-svn-id: svn://coreboot.org/openbios/openbios-devel@57 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-10 01:31:30 +00:00
Stefan Reinauer
05518242c1 drop OS includes. The endianess is already defined in config.xml
git-svn-id: svn://coreboot.org/openbios/openbios-devel@55 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-09 15:55:34 +00:00
Stefan Reinauer
f936ed58b3 -20
git-svn-id: svn://coreboot.org/openbios/openbios-devel@40 f158a5a8-5612-0410-a976-696ce0be7e32
2006-06-05 12:35:11 +00:00
Stefan Reinauer
2eaec36c50 drop io from bootstrap and exception stuff from non-bootstrap compiles.
git-svn-id: svn://coreboot.org/openbios/openbios-devel@28 f158a5a8-5612-0410-a976-696ce0be7e32
2006-05-22 22:36:01 +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