Commit Graph

53 Commits

Author SHA1 Message Date
Thomas Huth c4d03cf1a9 Fix typos in the board-js2x folder
Found with the "codespell" utility. I kept "busses" which codespell
also complains about since it seems to be an old but still valid
plural of the word "bus".

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2023-03-28 18:48:58 +11:00
Alexey Kardashevskiy 0705a5cc1d js2x: Fix compile and cleanup
This moves shared symbols out from the header file and leaves only
the minimum in bmc.h.

This fixes a "while (...); {" bug spotted by the modern gcc.

This fixes cleanup as otherwise the board-js2x/Makefile's "clean" tries
cleaning "rtas" which tries cleaning all libs (not just the ones it uses)
and that in turn triggers generation of lib/libtpm/Makefile.dep which
fails due to missing ./board-js2x/include/version.h.

This fixes create_reloc_table.sh to build with newer toolchains which
otherwise fail with:

ld: cannot use executable file 'reloc_table.o' as input to a link

This adds js2x compile to the travis script to know when it breaks
again.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2021-10-01 14:19:58 +10:00
Alexey Kardashevskiy 608e416bb1 board-qemu: Fix slof-build-id length
The existing code hardcodes the length of /openprom/model to 10 characters
even though it is less than that - len("aik")==3. All 10 chars go to
the device tree blob and DTC complains on such a property as there are
characters after terminating null:

aik@fstn1-p1:~$ dtc -f -I dtb -O dts -o dbg.dts dbg.dtb
Warning (model_is_string): "model" property in /openprom is not a string

This uses the real length and limits it by 10 to avoid breaking something.

Since the same code parses the build id field, this moves from-cstring
to a common place for both js2x and qemu boards.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-11-06 13:28:49 +11:00
Thomas Huth 1199592fb4 Define 'open' and 'close' words of the /aliases nodes right from the start
It's much easier to do this when we create the node instead of
looking up the device node again later in each of the boards.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-07-20 15:36:25 +10:00
Thomas Huth 11ff4ba277 pci: Remove unused next-pci-[mem|mmio|io] functions
The next-pci-mem and next-pci-mmio Forth words are completely unused,
and pci-next-io is only used in one location (which can easily be
replaced), so let's get simply rid of these legacy functions.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-06-06 15:47:31 +10:00
Thomas Huth 06e1e07e5f Rework the printing of the banner during boot
If the initial boot attempt fails, for example because the file that we
downloaded via TFTP is not executable, or because the user exited grub
instead of booting a kernel, SLOF prints out the banner text twice.
This is quite ugly. Fix it by avoiding to print the banner during the
first boot attempt, i.e. by adding the ".banner" command to the "boot"
command only after we've done the first attempt via "start-it".

Buglink: https://bugzilla.redhat.com/show_bug.cgi?id=1443904
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2017-04-26 15:42:19 +10:00
Alexey Kardashevskiy 2f1e6a73f2 logo: Update the logo
This removes old ugly logo to save precious boot cycles and make it
easier to do automation scripts. This removes logo for both QEMU and JS2x
boards. As .banner does not call .slof-logo anymore, this also removes
redefinitions of .banner.

While we are here, this updates a year in the copyright notice for
the QEMU board. This also removes some spaces from the standard banner.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2017-04-26 14:29:25 +10:00
Thomas Huth b3fde41bc7 Do not include the FCode evaluator by default anymore
Commit 2fed565281 ("Always include evaluator, move
framebuffer token init to fbuffer.fs") made sure that the FCode
evaluator is always included, during each boot cycle. The basic
idea was that we would soon be starting to support PCI cards with
FCode drivers on them. However, this has never happened, and so
this change was in vain. The bad thing is now that the inclusion
of the FCode evaluator also takes a lot of precious boot time,
e.g. when running in QEMU TCG mode, it is more than a second.
So to be able to boot faster again, disable the FCode evaluator
by default again and put it into the ROM-fs instead (so it still
can be loaded manually with "include evaluator.fs" if necessary).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-09-14 16:55:36 +10:00
Thomas Huth 3c1fe653f5 net: Move files from clients/net-snk/app/netlib/ to lib/libnet/
When we want to link the network stack to other parts of the
firmware later (paflof), we've got to turn it into a proper
library first.

Note: Make sure to run "make distclean" after this patch, so that
the dependencies for the moved files get rebuilt properly.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-06-27 12:31:06 +10:00
Thomas Huth 18b9556122 base: Move cnt-bits and bcd-to-bin to board-js2x folder
These functions are only used by some ancient js2x code,
so move them to that folder accordingly.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-05-02 14:06:10 +10:00
Thomas Huth fe7b047c0c Fix dma-alloc and dma-map-in functions on board-js2x
Since slof/fs/dma-function.fs has been introduced for board-qemu,
these function definitions shadow the original js2x functions from
slof/fs/pci-config-bridge.fs, because dma-functions.fs is included
after pci-config-bridge.fs in slof/fs/pci-bridge.fs.
To restore the original behavior, move the js2x functions into
a board-specific dma-function.fs file instead and include that
one into the ROM-fs instead of the version for board-qemu.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2016-01-14 14:52:32 +11:00
Alexey Kardashevskiy 12cbf22606 qemu/js2x/client: Support binutils >= 2.25.1
The recent binutils version introduces explicit definition of
a TOC symbol which points to the .toc section and enforces .toc
alignment to 256 rather than 8 bytes before.

For now the TOC symbol points to same location as it was before -
start of .toc + 0x8000; however as this might change, we should not
rely on that in the source code.

This changes __toc_start (for qemu and js2x boards), _got (for net-snk,
takeover, rtas) in linker scripts to use explicitely defined TOC if
defined and fall back to the older scheme if not.

This changes r2 (the register pointing to TOC) setup code not to add
0x8000 as linker scripts do that now.

Here is a bit more information about the change:
https://sourceware.org/ml/binutils/2015-10/msg00124.html
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commit;h=a27e685fa0a6480bdb07e3be359558524cec89b7

Tested on
1. gcc version 4.8.3 20140911 (Red Hat 4.8.3-7) (GCC)
   GNU ld version 2.23.2
2. gcc version 5.2.1 20151001 (GCC)
   GNU ld (GNU Binutils) 2.25.51.20150930

Reported-by: William Grant <wgrant@ubuntu.com>
Tested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-11-03 12:00:22 +11:00
Thomas Huth 1c9af10b8a board-js2x: Add missing file dma-function.fs
The PCI scan code needs the functions from the file
dma-function.fs - and this had been forgotten to be
included in the rom filesystem of board js2x. So add
it here, too, to avoid that the boot process aborts
due to the missing functions.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-09-30 15:10:58 +10:00
Thomas Huth be3d1ca710 fbuffer: Improve invert-region helper
The introduction of invert-region already speeded up the cursor
drawing very much. But there is still space for improvement:
So far invert-region is accessing the memory only byte by byte,
but with some additional logic that checks the alignment of the
address and the length of the area, we can also make this function
to access the memory with half-word, word or long-word accesses.
With this additional logic, invert-region-x is also no longer
necessary and thus can be removed.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-08-03 12:57:24 +10:00
Alexey Kardashevskiy 99c534ecc7 fbuffer: introduce the invert-region-x helper
This patch simply moves the slow RX based logic from fb8-invert-screen
to board-js2x helpers and implement a fast hv-logical-memop based helper
for board-qemu. And we can drop hcall-invert-screen !

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[aik: removed one empty line]
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-05-29 14:57:52 +10:00
Greg Kurz 4c7a70f061 fbuffer: introduce the invert-region helper
The inner loop in fb8-toggle-cursor can be implemented with hv-logical-memop
in board-qemu and get an incredible performance boost.

Let's introduce a per-board helper:
- board-js2x: slow RB based, taken from current fb8-toggle-cursor
- board-qemu: faster hv-logical-memop based

With standard graphical settings on board-qemu, we go from 512 hcall
invocations per character down to 16.

Suggested-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-05-29 14:57:30 +10:00
Thomas Huth 088baa0de4 Fix rectangle drawing functions to work also with higher bit depths
draw-rectangle, fill-rectangle and read-rectangle were only working
with 8-bit color depth displays so far. This is fixed now for 16-bit,
24-bit and 32-bit color depths, too, by taking the "screen-depth"
into account.
And while we're at it, consolidate all the same copies of these
functions into one common file (graphics.fs) so that we do not
have to do these modifications multiple times in different files.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2015-03-12 18:25:35 +11:00
Thomas Huth 18b1f60976 Use device-type Forth word to set up the corresponding property
It's easier to use "device-type" instead of creating the
corresponding properties manually.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2015-03-12 18:25:35 +11:00
Benjamin Herrenschmidt b7489d4673 js2x: Fix build
Add a dummy version.c to please the Makefile

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2014-10-29 16:16:31 +05:30
Thomas Huth e1b7b85031 Remove unused SLOF code
This patch removes some code that is obsolete and completely unused
nowadays.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2014-04-25 15:40:12 +05:30
Avik Sil b30e4a4f8a Allow more than one client to open net devices simultaneously
When multiple clients are active simultaneously, they might open network
devices that is already opened by other clients. This results in failure
to transfer packets since obp-tftp package is not instantiated on each open.
This patch resolves it by instantiating obp-tftp on each open.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:21 +05:30
Avik Sil 7e0d538712 Remove bcm57xx network driver as module
The driver has been moved to libbcm

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:15 +05:30
Avik Sil d474f35199 Remove e1000 network driver as module
The driver has been moved to libe1k

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:01:11 +05:30
Avik Sil 5f84bfe465 Add bcm57xx network driver in libbcm
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-10-04 12:00:28 +05:30
Nikunj A Dadhania a481b1d18a js2x: more fixes
* Build fixes to include scsi files
* Move usb-setup-hcidev out of board-qemu
* Fix pci-bridge-probe to assign temporary ranges

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-08-21 10:49:32 +05:30
Nikunj A Dadhania ad2060c3d7 js2x: use new usb stack
Fix the js2x build to compile and link the usb stack.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-08-06 11:50:19 +05:30
Benjamin Herrenschmidt 099d99e73d Make load-base a real environment variable
It can be stored in nvram. It defaults to a platform specified default
currently set to 256MB on js2x and 16K on qemu.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2013-05-13 14:08:07 +10:00
Stefan Weil f564e52f44 Spelling fixes in forth code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-01-04 10:14:26 +05:30
Stefan Weil d070068574 Spelling fixes in comments and debug messages
Most of these errors were found by codespell:

controler -> controller
appropiate -> appropriate
devide -> divide
comming -> coming
seperate -> separate
reponsible -> responsible
initialization -> initialization
successfull -> successful
whithin -> within
recieve -> receive
wich -> which
occurence -> occurrence
beggining -> beginning
accessable -> accessible
proccess -> process
succesfuly -> successfully
immediatly -> immediately
prefered -> preferred
avaliable -> available
threshhold -> threshold
statistsics -> statistics
endianess -> endianness
positon -> position
writen -> written
occurence -> occurrence
upto -> up to
overwriten -> overwritten
availabe -> available
enviroment -> environment
intruction -> instruction
thru -> through
substract -> subtract
occured -> occurred
begining -> beginning
lenght -> length
atributes -> attributes
preceeding -> preceding
defintion -> definition
decriptor -> descriptor

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
2013-01-04 10:12:48 +05:30
Thomas Huth 22f6383925 New oco for JS20
The old file did not work with new compilers anymore.
2012-02-02 08:55:19 +01:00
Thomas Huth 8536acbc9f Enabled -Wmissing-prototypes and -Wstrict-prototypes CFLAGS and cleaned up
These two compiler flags for additional warnings help to improve the quality
of the source code: Removed some unused code and fixed some obvious bugs.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-28 18:38:39 +01:00
Thomas Huth 2fed565281 FCODE: Always include evaluator, move framebuffer token init to fbuffer.fs
Since the FCODE evaluator can be used for more than one PCI card now, the
interpreter is now always included during boot. The framebuffer tokens are now
only initialized when the code from fbuffer.fs is being used.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 5817583665 JS2x: Added oco files to be able to built board-js2x
These additional files are necessary to built board-js2x, see the following
URL for details:   http://www.ibm.com/developerworks/power/pa-slof-js20/
2011-12-20 17:56:48 +01:00
Thomas Huth c6f186273f JS2x: Fixed config space access functions.
According to the PCI bus binding to Open Firmware, the uppermost byte can
contain some description bits when doing "config-l@" and the like. For
accessing the config space via MMIO, we've got to mask them away.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
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 e43f0673c4 JS2x: Check whether biosemu has been executed successfully
The code did not check whether biosemu has been executed successfully - and
this of course caused problems when SLOF has been compiled without biosemu
enabled.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-17 12:10:37 +01:00
Thomas Huth 69cbb38fb5 JS2x: Fixed bug in Citrine code
While setting up the setsupbuff, the code wrote accidentially to memory
at address 3 instead of setsupbuff+3.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-17 12:10:37 +01:00
Thomas Huth de5b143a1e Fixed the PCI map-in function.
The map-in function must retriev the BAR address from the config space address
that is provided in the phys.hi parameter. We can not rely on the value in
phys.lo as we did before. This patch is needed to get the FCODE from QLOGIC
working, and it also revealed some bugs in the current version of our ATI rn50
driver (which uses map-in, too, to get the register base address).

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-17 12:10:36 +01:00
Thomas Huth c140913ece Fixed config-xx PCI bus node functions
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>
2011-11-17 12:09:57 +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 beaa972b82 Moved bcm57xx driver to a new directory called "drivers".
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>
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
Benjamin Herrenschmidt 35fc16fee3 Move MMIO accessors to board-js2x and implement h-calls based ones for qemu
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2011-10-12 13:20:00 +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 4e4101fed2 JS2x: Detect the availability of biosemu automatically.
Since the biosemu code is optional, the config file now determines its
availability automatically.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-10-12 09:00:04 +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 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 0453b00574 Fixed compiler warning
Silenced a compiler warning that was easy to fix.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-03-22 15:22:09 +01:00