Commit Graph

30 Commits

Author SHA1 Message Date
Thomas Huth e977f3e512 Encode FDT properties as string when they contain a valid ASCII string.
There are a lot of properties in the FDT that contain a string, but commands
like ".properties" only displayed them as byte array since all properties
were encoded with "encode-bytes". Now the code tries to detect valid ASCII
strings and encodes such properties with "encode-string" instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Michael Ellerman 4516a322be Use linux,stdout-path to find the console
Currently the hvterm code just picks an arbitrary vty to use as the
console. It would be preferable under QEMU if we could use
linux,stdout-path.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
2011-12-20 17:56:48 +01:00
Michael Ellerman f7504aec1b hvterm: Update hvterm routines to take the termno as an argument
Currently the hvterm routines always use termno=0. This works because
QEMU has code that recognies termno=0 and chooses a "default" vty.

It would be more correct if the hvterm routines took the termno as an
argument. That way if we open a vty other than the default the output
will correctly go to that vty.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
2011-12-20 17:56:48 +01:00
Thomas Huth 33bb95bab2 Silenced some compiler warnings that occur when compiling with prototype checks
The compiler flags -Wmissing-prototypes and -Wstrict-prototypes generally help
to write code with proper prototypes. This way one can avoid some ugly bugs
because it helps to identify functions that do not have prototypes in headers.
It also helps to improve performance since local functions then have to be
declared "static", so the compiler can do better optimizations.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:34 +01:00
Thomas Huth 525e3b393b Fixed crash during "quiesce" when USB OHCI controller is enabled
The OHCI code unmaps the allocated DMA buffers during "quiesce". For this
the dma-map-out and dma-free functions were using the $call-parent function
that requires a valid current instance ("my-self"). However, there is no
current instance available during "quiesce" so $call-parent aborted the boot
process.
To fix the problem, the dma-* functions now use $call-static again so that
they also work without a current instance.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-25 12:35:35 +01:00
Thomas Huth 54539073a9 Improved version printing
When building SLOF from a git repository, use the SHA-id as version information
instead of the less useful "private build" string.
Also make sure that version information is updated during each build, so that
we also print more accurate "build date" information now.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 17:28:28 +01:00
Thomas Huth c20f4bc8ac Support for virtio-net PCI devices
Added a driver for the "virtio-net" virtualized network devices from KVM/qemu.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 11:56:03 +01:00
Thomas Huth 008fe5610d Support for virtio-block PCI devices
The virtio devices are preferred way of providing virtualized devices on
KVM/qemu. Here's now the basic support for virtio block devices.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 11:32:35 +01:00
Thomas Huth 7c33e22351 Fix stack problem during setup-alias functions
The code for setting some of the device alias had a bug. When it was called
multiple times, for example because two or more hard disk images had been
configured, it left an item on the Forth stack, causing a crash or other
ugly side effects later.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 2d3eabca48 Provide PCI memory mapping and dma memory handling in PHB node on board-qemu
According to the PCI Bus Binding to IEEE 1275, the dma-alloc, dma-free,
dma-map-in, dma-map-out and dma-sync functions have to be provided by the
PCI bus node, not by the PCI device node, so I moved these functions to the
PHB node now. Since the "ibm,dma-window" property is still located in the
device node instead, I had to add a little hack to the $call-parent method
to remember the calling child, so that the parent node (the PHB node) can
access that property of the calling child.
Also added map-in and map-out functions now according the the PCI Bus Binding.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 72f942f1ac Added e1000 network driver
This driver can be used for downloading files via e1000 compatible NICs.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 16:24:55 +02:00
Thomas Huth 580d42015f Scan USB bus during boot.
For board-qemu, USB scan had to be triggered manually so far. Now it is run
automatically during each boot when an OHCI controller is available.
To determine the base address of the OHCI controller, we need translate-address.
However, this function does not work during the PCI scan on real hardware yet,
since the "assigned-addresses" properties might not be set up yet. Therefor the
translate-address is now done in the file usb-ohci.fs, which is now included
during the USB scan instead of the PCI scan.
For the real JS2x hardware there were also some words missing, like dma-alloc.
These are now provided, too, so the USB code now works on both again, emulated
and real hardware.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 16:24:55 +02:00
Thomas Huth 82954d4c10 Patch "interrupt-map" properties to contain the phandles from SLOF
The flattened device tree from QEMU contains some "phandle" and "linux,phandle"
properties which are referenced from the "interrupt-map" properties in the
pci root nodes. This is bad, since SLOF has a different concept of phandles.
Now the code patches the "interrupt-map" properties to contain the values
from SLOF and removes the "phandle" and "linux,phandle" properties from the
device tree.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 16:24:55 +02:00
Thomas Huth 4f0a051873 Added PCI DMA functions
DMA transfers can only happen within a dedicated DMA window, so we need
special functions for allocating buffers and for mapping these buffers in and
out again.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 16:24:55 +02:00
Thomas Huth c691959389 Set up PCI nodes on board-qemu
Populate the PCI device tree nodes with additional properties and words, and
provide enough of the SLOF PCI framework to be able to use the nodes with our
device specific drivers.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 16:21:48 +02:00
Thomas Huth eecba74b38 Fixed unit address handling for PCI nodes
Added proper encode-unit and decode-unit functions for the PCI root node and
fixed the unit address handling for PCI nodes in the fdt to OF1275 device tree
conversion function.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 13:20:00 +02:00
Benjamin Herrenschmidt c9d1203de0 Add RTAS config space accessors and skeletton PHB
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2011-10-12 13:20:00 +02:00
Thomas Huth d823eb86d6 Removed obsolete types.h header files
Our "portable" types are defined in stdint.h, so there is no need for the
types.h header files anymore.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 12:50:05 +02:00
Thomas Huth f227b33012 Cleaned up Makefiles
Replaced "make" by "$(MAKE)" to be able to built in parallel, fixed
the indentation of some rules and removed some unused targets.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 12:50:05 +02:00
Thomas Huth 4f6e2c9efe Fix compiler warnings
GCC 4.6 complains about unused-but-set variables - which can safely be removed
in our cases.
Also fixed a strict-aliasing problem in rtas_flash.c of board-js2x.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 12:50:05 +02:00
Thomas Huth 399e16b3f7 Make net-snk and modules relocatable, too.
Cleaned up the toc-relative assembly of net-snk, fixed the Makefiles, save the
modules as ELF files instead of raw binaries, adjust the net-snk base address
and the load-base variable... a lot of changes were required to make the net-snk
and the snk modules relocatable, too. But now it should be possible to relocate
all files so that the firmware also runs with less than 256 MiB RAM.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 08:58:04 +02:00
Thomas Huth 98cdbf03c1 Got rid of the ELF loader functions written in Forth, using libelf instead.
It's cumbersome to maintain code twice, in Forth and in C, and now that libelf
has a new important feature (relocation), I removed most of the old Forth
functions for ELF loading and use the libelf everywhere instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 08:44:23 +02:00
Thomas Huth ad3238534f Pass IMA to Paflof and fix the memory regions which have to be CLAIMed
Provide a IMA (initially mapped area) value to Paflof so that the Forth code
can properly claim the memory regions which are used by Paflof.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 08:44:11 +02:00
Thomas Huth 7a3606eeb9 Reworked libelf to support relocation
Split elf.c into elf32.c and elf64.c for better readability. Added relocation
code to libelf for 64-bit ELF images, modified the Paflof Makefile to link
the executable with relocation information and load Paflof now to the upper
end of the memory.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 08:43:50 +02:00
Thomas Huth b94bde008b Fix vSCSI device addressing method
According to the "SCSI Architecture Model", there are multiple ways to specify
the 64-bit LUNs in the SRP_CMD structure. SLOF was using the "Peripheral device
addressing method" (00b) which did not match the rest of the source code that
is trying to scan for target IDs, not bus/channel numbers. Now the method has
been switched to "Logical unit addressing method" (10b) which matches the rest
of the code and which is also used by the Linux kernel in the same way.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-09-16 15:53:13 +02:00
Thomas Huth 3a3f3280e6 Workaround for the VSCSI problems with latest qemu version
The VSCSI behaviour of upstream qemu has changed a little bit, so that the
read-capacity command from SLOF failed. We now issue a test-unit-ready for
normal disks, too, and explicitly check whether read-capacity returned valid
values to work-around the problem.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-08-19 15:06:09 +02:00
Thomas Huth 1d41e8a29b Fixed some problems with libnvram
- On board-qemu, the logging partitions were too big (bigger than the total
  NVRAM size).
- Fixed a compiler warning about type-punned pointers in nvram.c
- When DISABLE_NVRAM is set, the fake buffer should not be accessed with
  cache-inhibited functions
- Makefile did not generate proper dependencies

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-08-19 14:57:32 +02:00
Thomas Huth f36326c115 Cleaned up vio-vscsi.fs a little bit
Got rid of the target-id/target-lun hack. Instead we're now creating a
temporary node instance for scanning, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-08-19 14:34:09 +02:00
Thomas Huth 5a9155e834 Fixed problem with potentially unitialized variable.
GCC complained about an uninitialized variable in the veth_receive() receive
function. And indeed, the buf variable might have been used uninitialized here
when the packet could not be handled and the code jumped to the recycle part
immediately.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-06-06 15:30:22 +02:00
Benjamin Herrenschmidt 39426bad55 Initial qemu/KVM board support
Added a new board for SLOF running on KVM/qemu.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-03-22 15:22:00 +01:00