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>
vio-vscsi: Rework vio-vscsi support

This reworks the vio-vscsi driver to funnel all SCSI commands through
a more/less generic SCSI command interface. Adds the ability to retry
based on the sense code and busy status and handles various conditions
better.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
vscsi: Sanitize interface between scsi-disk.fs and vio-vscsi.fs

We now exclusively use the proper SCSI command interface to vio-vscsi.fs
and move all of the higher level command building from vio-vscsi.fs
to scsi-disk.fs with the exception of the ones used during probe.

[ Even those could be moved out by in large part by opening/closing
  the device and letting it print its own inquiry data but that's less
  urgent. In fact we could have a generic "Probe SCSI bus" helper
]

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
iso9660: Don't constantly reallocate the read buffer

If it's big enough, re-use it !

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
SLOF: virtio-scsi - add pci device file

Create pci device file to take care of a virtio-scsi by qemu.

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

* initialize/shutdown virtio-scsi device
* routine for sending scsi commands to virtio-scsi device

[ Modified to pass the whole virtio req/resp from forth
  to allow better handling of status and sense buffer
  -- BenH
]

Signed-off-by: Nikunj A. Dadhania <nikunj@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
scsi: Move scsi-disk.fs to a generic place

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
scsi: Move bits of vio-vscsi.fs to a common helpers file

Currently meant to be included by host drivers to add standard
methods to them.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
SLOF: virtio-scsi block driver code

Forth implementation for virtio-scsi as a block driver. Uses
scsi-support.fs for the scsi command protocol

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

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fix off by one error in scsi-disk get-capacity

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>