Added ibm,req#msi and ibm,req#msi-x to device nodes

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Update .gitignore files

This updates a number of .gitignore files to ignore generated targets of
various sorts.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Workaround for SLES11 installer bug

This is a hack to work around some stupid behaviour in the SLES11
installer.  It expects a node named simply "disk" under the VIO SCSI
device node, rather than individual disk@XXX devices.  pHyp doesn't
enumerate the disks, and so provides such a node with the disk only probed
when the device is actually opened.  SLOF does enumerate the disks and so
provides the nodes with specific unit addresses instead, breaking the
installer.

The installer doesn't actually use anything in the "disk" node however, it
just expects it to be there, so this hack provides a dummy node to make
the installer happy.

Signed-off-by: Ben Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
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
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>
Grammar fix (sent -> send)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Spelling fixes in forth code

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
SLOF: vio-vscsi: fixed bug with reported luns

The vscsi-report-luns scans up to 8 devices and returns
a number of found devices and an array of pointers, one per device.
Each pointer points to a null-terminated list of LUNs reported by
a device in a response to REPORT_LUNS SCSI command.

The vscsi-find-disks function uses the result returned vscsi-report-luns
to walk through the lists and probe all the devices. However the loop
through a null terminated list was interrupted on the first iteration.
The patch fixes this bug.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
vio-vscsi: added a proper lun parser

SCSI specification allows LUN to be specified in different formats,
the first 2 bits in 8 bytes LUN define the exact format. At the moment
QEMU uses only 2 formats: 00b for LUN<255 and 01b for bigger LUNs, both
are 2 bytes long and big endian.

However the existing SLOF code treats LUN as a 8 bytes big endian value
what is incorrect. The patch fixes this by adding a function which
parses LUN and returns an error if the format is not supported.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
vio-vscsi: vscsi-report-luns can return 0

In case when vscsi-report-luns returns 0, the loop would go on
for 64K times before realising. Fixing this bug.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
vio-vscsi: Get CRQ on open and release on close

Instead of getting it at init time and releasing on quiesce, which is
fragile as quiesce is an Apple extension that not everybody supports.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fix handling of wildcard nodes in open-dev

There was a hack there involving having no #address-cells property
in the parent and "manual" parsing of the resulting address numbers
but this really didn't work properly.

I added (the hack is still there until I'm sure nothing relies on it)
a proper handling of wildcard nodes, changing match-unit to match them
properly, and recovering the unit address in find-component.

There are still issues, among other instance>package still loses the
unit address, as does disk-label (for different reasons).

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fix instance>path to contain unit address for wildcard nodes

instance>path (and instance>qpath) which are used among others by
the client interface "instance-to-path" are broken when dealing
with wildcard nodes (node with no unit address which obtain one
when opened).

This fixes this by properly using the instance address when building
instance path.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Increase size of catpad

Just paranoid...

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Fix disk-label package to use proper instance path

This fixes booting from a path that has an explicitly specified
unit address on a wildcard node

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
vio-vscsi: Switch to using a wildcard "disk" node and make scsi-disk generic

This switches vio-vscsi to using a wildcard "disk" node instead of
creating nodes for all children, which is more in line with what
other OFW implementations do and fixes issues with some clients
(such as the SLES11SP2 installer) in a better way than the previous
hack of creating a non-functional disk device.

Additionally, the vio-vscsi-device.fs now becomes a generic scsi-disk.fs
which should generally be usable underneath any scsi-style transport
that provides a handful of methods.

Still to do to be come really generic:

Simplify interface to the parent by implementing an "execute-command"
akin to what is described in the OF SCSI binding and move the actual
construction of most SCSI commands into scsi-disk.fs itself.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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>
disk-label: Increase the max size of the PReP boot partition

Some folks put a whole zImage in there, and we can easily cope
with more than 8M nowadays.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
disk-label: Allocate 4096 bytes for 4k block devices

To make 4k scsi devices to work, allocated memory needs to be increased
accordingly

Tested in the following scenario:

modprobe scsi_debug dev_size_mb=100 sector_size=4096

parted /dev/sdc u b p
Model: Linux scsi_debug (scsi)
Disk /dev/sdc: 209715200B
Sector size (logical/physical): 4096B/4096B
Partition Table: msdos

Number Start End Size Type File system Flags
1 262144B 2097151B 1835008B primary boot,
prep, type=41
2 2097152B 200015871B 197918720B primary type=83

qemu-system-ppc64 -enable-kvm -M pseries -m 1024 -nographic -drive
file=/dev/sdc,if=none,format=raw,id=drive-scsi0 -device
scsi-block,drive=drive-scsi0,id=scsi0 -vga none

Signed-off-by: Dinar Valeev <dvaleev@suse.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
virtio: Add a virtio-set-qaddr helper

A simple function that can be used from forth code for setting
virtqueue address. virito-scsi has multiple virtqueues(atleast 3) and
need to use set queue address for all the 3 queues.

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>