Output banner and initial display output in VNC window

Initial display output does not show up in the VGA/VNC window.
Create replay buffer to store the initial output and when vga/vnc
console starts, dump the buffer there.

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
usb-xhci: memory freeing and using returns as bool uniformly

* Fix freeing of memory in error path
* Boolean and int were used interchangebly at various points,
  consolidate it to use boolean

Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
fix print_version() to return where it came from

The print_version() is jumping through hoops to get back to where
it was called from, though it actually does get called with "bl"
already, so it knows.

Just return to where we came from after print_version(), making it
a function we can call from other places in the code.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
Work around missing sc 1 traps on pHyp

When running a pseries guest in PR KVM on top of pHyp, sc 1 instructions
are handled directly by pHyp, so we don't get to see them.

That means we need to get inventive. Invent a new instruction that behaves
like sc 1, but really is a reserved instruction that traps. This instruction
can be used by KVM to emulate sc 1 behavior.

This patch adds the SLOF support for it. With this, SLOF detects whether
it's running on such a broken setup and if so patches itself to execute
the fake sc 1 instruction instead of the real one.

Furthermore, we also hook into "quiesce" which Linux calls when it boots.
This gives us the chance to also patch Linux when it boots up, so it uses
the fake sc 1 too.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
[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>