rsc_table: put the fixed-size array behind

The array approach was very limiting: all members had to have
the same size and members, and this didn't work quite well
since some members are very small, where others quite big.

Move to a type-value approach, where each resource entry has
its own dedicated structure.

In addition, create a simple header which contains the number
of entries and their offsets within the table: this helps parsing code
to do fast browsing through the table.

And - add a version field so hosts can verify we have the image
format they expect.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
quick example of CIO filesystem skeleton
rsc_table: add a vdev console resource entry

Add a new resource entry that describes a console vdev.

This creates two dedicated vrings that will be used by the Linux
virtio_console driver.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
VirtQueue: extend vq API

1. Add a vqid parameter to VirtQueue_create to make the index of the vq
   explicit and not depending on the invocation order

2. Add a len param to VirtQueue_addUsedBuf so users can control it

3. Add a *len param to VirtQueue_getAvailBuf so users are notified with
   amount of received data

4. Adapt MessageQCopy to start using the new API

While we're at it, remove the VRING_USED_F_NO_NOTIFY optimization from
VirtQueue.

It isn't implemented correctly, and it causes much grief in debugging
with little, if any, benefit. It can be added later if really needed.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
rpmsgcio: hook up RpmsgCio to the virtio console device

This way sys/bios stdin/stdout will be routed to the Linux virtio
console.

This is just a preliminary implementation, mainly for demonstration
sake. known bugs that have to be fixed: vrings protection against
concurrent access, fix delicate races that might exist in the code, ..

IOW - this is not a product quality. just a prototype.

While at it, add a 'dump' command which Linux can send, which triggers
a dumping of accumulated early logs.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
apps: add some stdout prints

Until we route the Log_printf output to stdout, just temporarily add
some explicit stdout printouts (by means of printf) to make the virtio
console more interesting.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
rsc_table: add reserved members

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
main: delay sys/bios boot

A hacky workaround that still seem to be needed.

Can't use Task_sleep here. Chris says: "The BIOS scheduler isn't running
until you call BIOS_start() (which never returns).  That's why Task_sleep()
isn't working."

Should be reverted as soon as possible once a solid solution is in place.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>
rsc_table: add notifyid fields to the virtio resource entries

Linux needs a way to notify SYS/BIOS if a vring has pending messages, or if the status of a certain vdev changes.

This is done by sending the notifyid of that specific vring/vdev over the mailbox payload.

This patch adds a notifyid member to the relevant resource entries, which will be used to synchronize the notify index of that specific object.

Signed-off-by: Ohad Ben-Cohen <ohad@wizery.com>