The named-token function evaluated the fcode-debug? variable the wrong way
round, and the "new-token" path did not work yet since it was not skipping
the fcode-string of the new function in that branch.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The SEE debugger word expects functions to end with a semicolon. However, b(;)
was using EXIT to mark the end of a function, so SEE failed with such Forth
words. Now b(;) is using the <semicolon> execution token so that FCODE functions
can be analyzed with SEE, too.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The Forth debug function "SEE" sometimes displayed wrong literal
values. This happened because the formatting of literal values was
prepared with the (u.) in (see-colon-body), but the formatted string
was then clobbered during (see-my-type) by another call to (u.).
To avoid this problem, (see-my-type) now copies the string to a
temporary pocket before calling (u.) again.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
INSTANCE VALUEs, VARIABLEs and DEFERs did not work at all for FCODE.
The opcode for INSTANCE was just doing the wrong thing, and the opcodes for
VALUE, VARIABLE and DEFER simply ignored whether they were used in context
of an INSTANCE or not. Now the opcodes are working right.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Fixed bad indentation and white space damages in the FCODE evaluator source
code. Also removed the redundant definitions of <value>, <variable>, etc. which
are defined in base.fs already.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
According to the IEEE 1275 PCI bus binding, the config space address for the
config-xx access functions should also always contain the bus-device-function
numbers (i.e. "my-space"). The SLOF code behaved different so far by adding
my-space during the config-xx words instead. This of course caused problems
when running FCODE that expects the IEEE 1275 behaviour.
The config-xx functions have now been changed to automatically detect the
required behaviour: If the caller supplied a bus-device-function number, we
do not add "my-space" in these functions anymore.
However, our pci-bridge code for the AMD 8111 abused the old behaviour by
accessing multiple devices+functions without specifying the full unit address.
So for this device, special config-xx functions have been added to work-around
this problem.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
When running more than one FCODE program, the second one was not executed
since fcode-end was not reset.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
There were several bugs in the pci-find-rom function that is used to detect
the FCODE in PCI Expansion ROMs. Due to these bugs, it was only able to find
the first image in the ROM. Now the function should also work fine if the
FCODE image is not the first image in the ROM.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Here are some useful debug functions that can be used for debugging problems
with memory allocation.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The bcm57xx driver is a normal part of the SLOF firmware, so it does not make
sense that it resides in the other-licence directory. Moved it to a new
directory called "drivers" now.
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>
QEMU only provides a 256 MiB DMA window. So when running with more than 256 MiB
RAM, we can not use a 1:1 mapping between physical and virtual DMA addresses
anymore -- the addresses have to be translated instead from physical to virtual
and vice versa.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
When running on QEMU, DMA can only happen with dedicated buffers that have to
be allocated and mapped in.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Size of the keyboard report descriptors is only 0x3f instead of 0x40...
...and qemu is picky about this right size.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The emulated OHCI controller on board-qemu behaves slightly different to the
controller that was used on JS2x. We've got to translate the PCI base address
to get the correct virtual base address of the HC. QEMU also does not like
mis-aligned accesses to registers, and after powering off the USB ports, we
must make sure to issue a reset to be able to detect devices again.
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>
To be able to use some of the PCI helper functions for board-qemu, too, they
have to be separated from the original PCI-scan code.
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>
Implemented the CI functions in cache.h (which are required by net-snk)
and fixed a bug in hv_logical_ci_store in libhvcall.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The INSTANCE keyword can not be used while a node is opened (since it changes
the node>instance field that is also used for allocating the necessary amount
of memory for an instance). Since I experienced some bad and hard-to-debug
crashes when accidentially running into this problem, I now added a proper
error handling to the INSTANCE keyword.
Also improved my-space, my-address and my-unit a little bit so that these
node specific words now can also be used without an active instance.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
The debugger used an ugly hack to determine the execution tokens for
2CONSTANT, INSTANCE VALUE and INSTANCE VARIABLE. This hack used an faked
device node, which was quite error prone, e.g. when extending the node
structure in node.fs. Now the XTs are determined in a much more elegant way
at the places where the corresponding Forth words are defined.
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>
The function for determining the PHB Unit ID had a bug - when translating the
address, it used the PCI child node for starting the translation. However,
since the PHB Unit ID is bound to the PCI bus root node, we've got to use that
node as starting point instead.
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>
The /vdevice/l-lan device tree node from qemu uses a 8-byte wide
local-mac-address property instead of a normal 6-byte wide one.
According to a comments in the qemu code, this is necessary for backward
compatibility with old Linux kernels, so the problem is not going to be fixed
on the qemu side and we've got to take care about this in SLOF instead.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Due to some bad built rules, client has always been linked during each built.
This has been fixed now so that it only gets rebuild when something has changed.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
"test" was removing the wrong stack items, so the first stack item beyond
its parameters got corrupted.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
printf does not work during rtas_init of snk yet, so the code has to use the
snk_kernel_interface instead.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Since the biosemu code is optional, the config file now determines its
availability automatically.
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>
The byte-swapping functions were scattered all over the source tree, now they
are merged into a new common header file called byteswap.h.
Signed-off-by: <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>