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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
- 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>
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>
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>
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>