Commit Graph

98 Commits

Author SHA1 Message Date
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
Nikunj A. Dadhania 0ad10f26c9 SLOF: Support PAPR NVRAM RTAS calls
BenH still need to ACK this though.

From: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>

* Determines size of the flash using device tree.
* Provides nvram access functions for RTAS_NVRAM
* Allocates temporary buffer of nvram in SLOF code and use that in C.
  (sbrk not available)
* NVRAM_LENGTH is used at various places, make sure it is well guarded
  and also use dynamically determined size once an RTAS-NVRAM is
  found.
* Use NVRAM_LENGTH as a variable in case of RTAS_NVRAM, not very
  elegant though

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>

--

Changelog from v1:
* #define cleanups suggested by Thomas/Benh
* Fix makefile which missed passing $FLAG for building llfw
* renamed vio-nvram.fs as rtas-nvram.fs
2012-10-17 16:30:58 +11:00
Benjamin Herrenschmidt 7279655af2 vscsi updates to match IBM OFW variant
This update our vscsi to encode unit-addresses the same way as IBM
proprietary OFW does, and adds support for the vscsi-report-lun
method.

This fixes booting with grub2 on fedora. It also means that we now
support devices with LUNs.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-07-19 16:44:17 +10:00
Alexey Kardashevskiy 05a383ee8b Fixes error preventing from scanning PHBs with devices type1 (bridges):
E3401: Aborting boot,  no current instance
 no current instance

The fix is taken from pci-device.fs.
2012-06-29 15:50:24 +10:00
Benjamin Herrenschmidt cd5f73de2b Fixes to ANSI escape sequence handling
We have a couple of issues making grub2 essentially unusable when
using a framebuffer console:

 - When we encounter a ";" in a CSI sequence, we still stop the
parsing, so all the positioning sequences are broken

 - We made a pretty poor choice of when to use invert video,
basically switching to invert whenever a "m" sequence had any
non-zero value. Instead we remember the foreground and background
colors set by the client and use invert when the foreground value
is lower (or equal) to the background value.

There is still a -lot- of improvements to do here (including proper
support for colors) but at least this makes grub2 from fedora 17
usable.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-05-14 16:01:33 +10:00
Benjamin Herrenschmidt 989d27121e Fix inverse display
Trying to display in "inverse" mode causes us to display black on black

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-05-14 15:56:29 +10:00
Thomas Huth eedaba3a2e Fixed some bugs in the bootinfo.txt parsing code
The bootinfo.txt parsing code assumed that the filename to the boot loader
always contained a backslash. However, this is maybe not the case if the
boot loader has been put into the root directory of the filesystem. For example
SLES 8 used "boot &device;:1,yaboot.chrp" in its boot-script. Now we look for
the &device; string instead which should always work.
SLOF also failed if there were parameters after the path to the boot loader.
Now we take care of the parameters, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-04-30 10:38:56 +02:00
Thomas Huth 042cb119ec Fixed ISO9660 filesystem directory parsing with a lot of entries
According to the ISO9660/Ecma-119 standard, directory entries must not cross
the boundary of a sector. That means that there might be some padding after
the last directory entry that still fitted into a sector. SLOF did not take
this into account yet so it failed to find files in directories which used
more than one sector for its directory entries. Now we are taking the padding
into account so the "file not found" problems should be gone.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-04-30 10:27:55 +02:00
Thomas Huth 157c561405 Cleaned up envvar.fs and fixed the behaviour of env-bytes config variables
Some parts of envvar.fs were quite hard to read due to bad indentation, and
the handling of env-byte variables was quite shaky. Fixed and cleaned up the
code now so that it should be more maintainable now.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-03-16 11:43:01 +01:00
Thomas Huth cf13fc9bee Added the possibility to debug the "getprop" client interface calls
To analyze the behavior and requirements of boot loaders and OS clients, it's
crucial to know which properties they try to read from our device tree. Thus
we need the possibility to debug the "getprop" client interface call.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-27 10:44:25 +01:00
Thomas Huth 33f6dd25bb Removed unused PCI Forth functions.
assign-bar-mapping and assigned-addresses-property are not needed anymore.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-23 18:44:44 +01:00
Benjamin Herrenschmidt 7add7a0a9f Move _FASTRMOVE implementation into headers & support new hcall
This moves _FASTREMOVE to the cache.h header, 970 uses the
existing code, p7 now uses the new memop hcall.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-02-22 10:33:18 +11:00
Benjamin Herrenschmidt 0dfcbc1336 Add a proper compiler barrier between prim's
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-02-22 10:31:07 +11:00
Thomas Huth 2eed580261 Fixed disk-label partition parsing to also work with single partition arguments
The parse-partition function was not able to deal with arguments that only
contained a partition number (without comma), e.g. "boot disk:1" failed.
Also limited the size that we load from a PReP partition in case the hard disk
is smaller than max-prep-partition-blocks.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-14 09:01:46 +01:00
Thomas Huth 0bede83ced Fixed debugger for functions with (doito)
Functions that use the TO keyword with an instance variable need some special
treatment, just like we did it with the TO for normal variables already (see
the usage of <doto> in debugger.fs).

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-14 09:01:46 +01:00
Thomas Huth 34717b356a Fixed $call-method to clean up the return stack in case of errors.
There was a bug that occured when yaboot tried to load its configuration file
via network. The net-snk tries to probe the device tree node for write and read
methods (see ci_device.c), which triggers $call-method in the end. But when
$call-method failed, it did not restore my-self and the return stack, which
caused some bad crashes.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-14 09:01:46 +01:00
Thomas Huth b46da96a00 Added a possibility to debug the client interface calls
Set "debug-client-interface?" to TRUE to enable the debug messages.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-02-14 09:01:46 +01:00
Thomas Huth adde61dfeb FCODE: Support for old-fashioned "local values" tokens
One of the old FCODE tokenizers uses the opcodes in the range of 0x407 to 0x41f
for supporting Forth local values. To get these FCODE programs working, we have
to support these opcodes, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-01-13 10:40:22 +01:00
Benjamin Herrenschmidt 509185b812 usb-ohci: Avoid instance specific allocations
The USB stack did instance specific allocations for the
various buffers, but would then assign them to package
specific lists, and would generally get badly confused
as soon as multiple instances of the driver got opened.

This typically occurs when using a USB keyboard and booting
from a USB disk.

This makes everything node variables instead, with tracking
of how many instances are open, with one allocation pass
on the first open and one free pass on the last close.

The result is a lot more reliable, I can boot with USB keyboard
and a USB disk fine without hanging qemu.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-01-12 12:31:17 +11:00
Thomas Huth 3a88b69f2f Fixed problem in framebuffer code when erasing or inserting characters.
When erasing characters or when inserting characters in the middle of a line,
the framebuffer code did not correctly calculate the line width, since it was
not taking the bit depth into account yet.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2012-01-11 12:25:05 +01:00
Benjamin Herrenschmidt c1394c3d2a Support new-style PCI for qemu board
We now support populating the device-nodes ourselves when using
a newer qemu which doesn't do it anymore.

Note: I have removed the support for working with the existing
device nodes, so qemu needs to be updated in sync with slof

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
2012-01-11 12:48:40 +11:00
Thomas Huth 895e94fe32 Add support for instance specific "my-unit" settings
According to IEEE 1275, the "my-unit" command shall return the unit address
of the current _instance_, i.e. this unit address can be set differently for
each instance, it is not bound to the physical unit address like "my-space"
and "my-address". This behaviour is expected by the Citrine FCODE for example,
which does not set a physical unit address for the "sd" (disk) nodes, but
needs the unit address to be specified when opening the device tree node
instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-29 16:48:09 +01:00
Thomas Huth 23c9ac8981 Source code beautification
Some functions in node.fs were formatted in a very bad way, using wrong
indentation or mixing spaces and tabs for indentation. Cleaned this up now,
without doing any functional changes.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-28 18:33:21 +01:00
Thomas Huth ef727e4b6f Improved "tick", postpone and $FIND commands
When the ' (tick) or postpone commands hit an unknown function, they simply
printed out "undefined word" without telling which word was not defined. These
problems were quite cumbersome to debug since it was quite hard to find the
right spot in the source code where such problems happened. Now the tick and
postpone command store the name of the undefined word, too, so that the code
which catches the ABORT also prints this information.
I also fixed the $FIND command to be standard compliant right from the start
(so that it leaves the string parameters on the stack in case the word has
not been found).

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-28 15:05:23 +01:00
Thomas Huth 46b5160777 Fixed yet another bug in open-node
When the "open" method of the target node failed, the open-node function did
not correctly restore the previous value of "my-self" (it was using my-parent
of the new node to restore the previous value, but that did not work when the
new node could not be opened). Now the old value of "my-self" is saved on the
return stack instead and then always correctly restored.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-22 16:59:04 +01:00
Thomas Huth caf3ad3e8d Improved framebuffer code to support more than only 8-bit resolutions
With these changes, it should be possible to use screen depth of 16 bit and
32 bit as well.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 19:30:10 +01:00
Thomas Huth deb63aa40e Fixes for using the USB keyboard driver on QEMU
For some reasons, interrupt transfers do not work right on QEMU, so we use
control transfers there instead. Also digest one key scancode at a time only
to avoid the problem with phantom keypresses.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 05a38d52f8 Source code beautification
Cleaned up indentation and superfluous white spaces in usb-keyboard.fs

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +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 82d381b5cf Two minor improvements for the device tree node code
The "open-node" command always tried to execute the "open" method of the node
that should be opened and used CATCH to determine whether the method is
available or not (and assumed success if it is not available). That works fine
as long as the "open" method does not ABORT due to any reason - in that case
the "open" should be considered as failure instead. So the code is now using
"find-method" instead to determine whether the "open" method is available or
not.
Second fix is about "my-unit". According to IEEE1275, this value should be
initialized to the firt component of the "reg" property in case it has not
been specified by other means.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 8dc3a137ec Fixed get-inherited-property
The get-inherited-property function messed up the stack in case the property
could not be found. Now it deals with this situation correctly.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 848199fff6 Fixed "map-in" to also allow access to the Option ROM BAR.
Some FCODE programs try to access their ROM BAR, so map-in has got to support
this BAR, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 631dd47cc8 Fixed the BEHAVIOR function to also work with INSTANCE DEFERs
The BEHAVIOR function only worked with normal DEFER variables so far. It was
not aware of INSTANCE DEFERs yet. This problem has been fixed now.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth 4530bc4d6b Removed unused code
In 1275.fs there were some functions that were apparently not used anymore.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth c94eb8530f FCODE: Support for fcode programs with 8-bit offsets
IEEE1275 allows offset values to be either encoded with 8-bit values or
16-bit values. So far our FCODE engine only supported 16-bit offsets.
Now 8-bit offsets are working, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth f1fbd787c7 Fixed "dev" command to only parse one word
The "dev" command parsed the whole remaining input line. That way it was not
possible to do something like "dev / ls" at the prompt. Now it parses only
the next available word in the input so that the rest of the input line can
be interpreted by the Forth engine instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth e79c624cdd Print phandle when listing the device tree
Printing the phandle of each node is quite handy when searching for a specific
phandle value.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
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
Thomas Huth af85b73292 Support for "INSTANCE BUFFER:" in Forth and FCODE.
IEEE 1275 stipulates that the "BUFFER:" keyword and its FCODE equivalent
"b(buffer:)" can both be used with the INSTANCE keyword to create an
instance-specific buffer. SLOF lacked this support, but now it's possible
to create such instance-specific buffers with SLOF, too.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-12-20 17:56:48 +01:00
Thomas Huth ec10f8af35 FCODE: Added token 0x12b (interpose)
The "Recommended Practice: Interposition" document declares that token 0x12b
is used for "interpose".

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-28 12:00:54 +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 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 0be6560d65 OHCI: Reworked USB scan code a little bit
Refactored the ohci-scan function a little bit and use the new "extend-device"
function to extend the ohci node properly.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth a5a2d44591 Improved instance handling
Fixed various bugs and added some improvements in the device tree node instance
handling code:
- The ">instance" word now checks whether access is beyond the allocated memory
- Check max-instance-size when creating new instance variables/values
- The arg point and the args-len were stored the wrong way round in the
  instance header structure
- Free instance args buffer when closing an instance to avoid memory leaking
- finish-device destroyed the instance-template buffer, causing instance values
  not to be initialized correctly anymore
- Added new command "extend-device" to be able to modify the instance template
  of already existing nodes
- Added new command "unselect-dev" to undo the changes from select-dev

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 05a2623c8c Fixed memory leak during network loading
Fixed two memory leaks:
- The PCI class file for network nodes did not properly close the obp-tftp
  package
- The obp-tftp package used "select-dev" for setting a property in /chosen
  which created some instances that were not closed anymore

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 3124929fbf FCODE: Allow return stack commands to be used in "interpretation" mode.
According to IEEE 1275, the return stack commands may also be used in
"interpretation" FCODE mode (i.e. without a surrounding colon definition).
This did not work in SLOF yet since the commands were executed in one function
(called "exec"), but the main loop was done in another function (called
"evaluate-fcode"), so SLOF needed the return stack inbetween. When an FCODE
program put an additional item on the return stack, the FCODE interpreter
crashed. This has been fixed now by merging the exec function into the
evaluate-fcode function with the main loop.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 1b9c3f4ca5 FCODE: Fixed b?branch instruction
According to IEEE 1275, the b?branch instruction should jump "if all bits
of x are zero". However, our implementation also jumped already if x was not
equal to TRUE (i.e. 0xffffffff). It's fixed now by simply removing the odd
"?branch" function.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-24 10:21:56 +01:00
Thomas Huth 559018d1cb FCODE: Support FCODE programs that access MMIO memory without the r-functions
Since some FCODE programs use the normal memory access functions (like c@)
for accessing MMIO memory, we got to use a little hack to support them:
When address is bigger than MIN-RAM-SIZE, assume the FCODE is trying to
access MMIO memory and use the register based access functions (like rb@)
instead.

Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
2011-11-17 12:10:37 +01:00
Thomas Huth 7ea496223c Fixed bug in disk-label support package
The "offset" function only worked for partitions starting within the first
4 GiB of the disk.
Also increased the amount of data to be read from a PReP partition since some
clients are certainly bigger than 2 MiB nowadays.
2011-11-17 12:10:37 +01:00
Thomas Huth 9e757c8c38 Improved ext2-files support package
- Added support for double and tripple indirect blocks.
- For modern revision of ext2, the inode size is configurable
  and thus has to be read out of the superblock
- The group descriptor table can be bigger than one block
- Free allocated memory when closing the package
2011-11-17 12:10:37 +01:00