[oex]hci_exit: Check before freeing/unmapping memory

While doing cleanup of the allocated memory, make sure addresses being
unmapped/free were really allocated. During error conditions, some
address would not have been.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Handle router advertisement message properly

process_ra_options was going through infinite loop due to improper handling of option_length.
Also introduction of is_ra_received() makes booting time faster since it returns as soon as
router advertisement mesage is received.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fix zero checksum in UDP header

As per RFC 768 (UDP), if the computed checksum  is zero, it is transmitted as all ones
(the equivalent in one's complement arithmetic).

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fix shutdown for virtio devices

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Enable seamless netboot on IPv6 network

To boot from an IPv6 network user has to type "boot net:ipv6" from SLOF prompt. This
is inconvenient in auto-install environment. This patch addresses this issue by falling
back to IPv6 booting in case IPv4 booting fails (No DHCPv4 response).

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Reset obp-tftp arguments before parsing

This avoids junk values assigned to obp-tftp arguments

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
version: update

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
cas: return error when unknown node found

Hypercall for ibm,client-architecture-support could return
nodes that isn't there in the guest DT, in such cases error should
be returned to the guest kernel.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Change representation of string environment variable

Currently strings are stored in the dictionary using "string," which
stores the length as a byte. This brings in the limitation of only 255
byte string. The issue got exposed when using "boot-device" which was
more than 256 bytes, and the string length was equal to (length & 0xFF)

With this patch, we are storing the length in dictionary in a cell and
copying the string after that.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Add support for 64bit LE ABI v1 and v2 support

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

--

v2: With the parameters changed for go-64, kernel loading from commandline broke
v3: (client-exec) calls start-elf64 directly, fix args
Change shutdown method name for virtio-scsi

add-quiesce-xt adds a different method virtio-scsi-shutdown which is not intended to
be added, since the intended method shares the same name with the un-intended one.
This makes call to the wrong method with wrong parameter which makes it unable to reset
virtion-scsi device during quiesce. This patch fixes this by renaming the method name.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Fix virtio device shutdown

The virtio device shutdown method is called during quiesce in order to
reset the device. This implies writing to the I/O region of the device
and this only makes sense if the device is opened, otherwise we hit an
"unassigned write" handler in qemu.

This happens for example while booting a guest from a virtio-blk or
virtio-scsi device, when the guest kernel reaches the end of prom_init().

Reported-by: Greg Kurz <gkurz@linux.vnet.ibm.com>

Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com>
Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Make "boot net:dhcp" boot from IPv4 only

The default network boot method "boot net" tries to boot from both IPv4 and IPv6
networks. The "boot net:ipv6" allows to boot from IPv6 network only. But there
is no option for booting from IPv4 network only. This patch addresses this issue.

Signed-off-by: Avik Sil <aviksil@linux.vnet.ibm.com>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
virtio-9p: disable unused structure

In file included from ./board.code:140:0,
                 from /home/nikunj/work/power/code/slof/SLOF/slof/paflof.c:106:
/home/nikunj/work/power/code/slof/SLOF/slof/paflof.c: In function ‘engine’:
/home/nikunj/work/power/code/slof/SLOF/lib/libvirtio/virtio-9p.h:23:3: warning: typedef ‘virtio_9p_config_t’ locally defined but not used [-Wunused-local-typedefs]
 } virtio_9p_config_t;

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

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
vio-vscsi: Fix CRQ allocation alignment

alloc-mem in SLOF does not always return aligned values it
seems, so we need to align it manually. While messing around I
hit a case where after a close and re-open via the client interface
vscsi would fail to initialize without this fix.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
[ free the  allocated size ]
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Introduce dummy console device

Qemu can create console-less machine, aka no output device. And there
are dependencies in the guest which expects a valid output device. Add
this dummy device that gobbles up all the output send, and keeps the
guest happy.

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

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
ELF loading should fail for virt != phys

Prevent loading of elf files which does not have virtual address same
as physical address.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
ELF: Enter LE binary in LE mode

Trampoline code in the LE binary were helping fix this. This patch now
takes care of switching the mode to LE for LE elf binaries.

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