device_tree: allow offsets for cell properties

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
device_tree: return Error* from prop getters

Rather than exit(1) on fail return an Error*. Clients can then handle errors as
they wish.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
device_tree: allow property getters to inherit

If the inherit flag is set, and the specified property is not found, then search
the parents for it as well.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
device_tree: get_prop(): memdup returned properties

getprop currently return a pointer into the device tree itself. These pointers
will be corrupted if the device tree is written to in anyway. To make getprop()
safe, duplicate the property so that the value doesnt change over the lifetime
of the returned pointer.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
qemu-coroutine: Add simple work queue support

Add a function co_queue_enter_next() which will immediately transfer
control to the coroutine at the head of a co queue. This can be used for
implementing simple work queues where the manager of a co-queue only
needs to enter queued routines one at a time.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
device_tree: Extended interface for fdt_generic

Extended the wrapper interface (around libfdt) for device tree. Node Property
getters have been added (qemu_devtree_getprop*) as well as helpers to search/
navigate the nodes of a FDT blob.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>

---CHANGLOG--
Changed since v0:
added qemu_devtree_get_prop to return all properties of a specified node
---END---
fdt_generic: First revision

First revision of fdt generic infrastructure. These modules allow
for fdt generic machine models, which create machines to match a device
tree specification.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
pflash_cfi01: Added fdt generic platform support

Added fdt generic platform support. Note that this does not add the fdt init
handler to the table of registered models as this needs to be handled in a
platform dependent way (due to target endianness issues). Fdt generic machine
models are required to register this device should it be supported.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
microblaze_generic_fdt: first revision

First revision of fdt generic platform for xilinx microblaze platforms.
Adds machine model "microblaze-fdt" which can be used along with the --hw-dtb
option to lauch dts driven machine models for microblaze platforms.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
serial: added fdt generic platform support

fdt generic platform support for 16550 uarts.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
fdt_generic: always init children nodes.

Just call simple_bus_fdt_init, on every node in the system recursively. Every
device gets a chance to init then.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
fdt_generic_util: set the root node opaque

This happen for all nodes except the root node. No reason for the exception
and will be needed for the canonical path logic in upcomming patches.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: set proper canonical paths

If the parent node is an object, set the parent child relationship. This
will create proper canonical paths for fdt machines.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: try qdev init with no vendor

If qdev init fails on the name, have a go with the vendor string trimmed off.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: Improve MMIO mapping.

Not all valid qdev device (E.G. M25P80) will have a reg property so dont error
on no reg property found. Check that there is a reg length property before MMIO
mapping though.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: Wait for qdev init for intc

The interrupt connection logic uses qdev_get_gpio_in to get gpios. This only
works after qdev_init() is called for the interrupt controller, which it may
not have been at this stage. Gaurd against an un-inited by checking the qdev
state and yielding if before the init stage.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: yield once after setting parent.

This means child nodes get a chance to set parents before the parents get qdev
inited.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: Wait for children to init

Dont qdev_init before the children nodes have. Required for nodes that walk
the child nodes in some way to init themselves (e.g. SPI).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_devices: inlcude flash.h

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
fdt_generic_util: Allow instantiation of objects

Dont limit fdt generic instantion to just TYPE_DEVICE, allow instantation
of any QOM object from compatability. string. Use RTTI to do conditionally
do TYPE_DEVICE and TYPE_SYS_BUS_DEVICE bits and pieces.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>