[DRIVERS] Adding linux headers (placeholder) for compilation.

Adding placeholders for irq.h, of_address.h of_irq.h and of_platform.h
Since many linux drivers includes these files so this will help
in reducing compilation errors.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[CORE] vmm_devtree: Adding vmm_devtree_is_compatible() and fixing misc things.

This patch does multiple things:

In core/vmm_devtree.c and core/include/vmm_devtree.h

a. Add Linux-like vmm_devtree_is_compatible() function.
b. Forcing vmm_devtree_match_node arguments() functions
   second argument to const type .

In drivers/include/linux/of.h -

Adding Linux-like follwoing routines/macros:
a. of_device_is_compatible()
b. of_get_property()
c. irq_of_parse_and_map()
d. for_each_available_child_of_node()
e. of_node_get()
f. of_node_put()

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS]: Adding misc Linux-like portability functions.

 In drivers/include/linux/device.h
 - Add platform_set_drvdata() and platform_get_drvdata() macros.
 - Originally these macros were defined inside drivers/net/ethernet/smsc/smc91x.c
   during porting but these should be defined in "include/linux/device.h"

 In drivers/include/linux/errno.h
 - Defining misc errno's like ERESTARTSYS to please the compilation
   of various drivers.

 In drivers/include/linux/interrupt.h
 - Defining cpu_relax(), tasklet_schedule(x), tasklet_hi_schedule(x) tasklet_kill(x)
 - Curretnyl these macros are nothing but empty placeholders.
 - Originally these macros were defined inside drivers/net/ethernet/smsc/smc91x.c
   during porting but these should be defined in "include/linux/device.h"

 In drivers/include/linux/kernel.h
 - Defining sprintf to vmm_sprintf

 In drivers/include/linux/notifier.h
 - Defineing notifier_block to vmm_notifier_block

 In drivers/include/linux/phy.h
 - Adding placeholder functions of phy_ethtool_sset() and phy_ethtool_gset()

 In drivers/net/ethernet/smsc/smc91x.c
 - Removing macros platform_set_drvdata(), platform_get_drvdata(),
   cpu_relax(), tasklet_schedule(x), tasklet_hi_schedule(x)
   and tasklet_kill(x)

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] netdevice: Cleaing up and adding missing linux-like functionality.

In drivers/include/linux/netdevice.h
- Add NETDEV_OPEN status in enum netdev_status,
  this is to track if open has been called (something similar to ifup in Linux)
  on a perticular device.
  We set this falg in netdev_set_link() function after success of "ndo_open()".
  We clear this flag after "ndo_stop()" is getting called.
  This flag is used in returing status in "netif_running"
- Add netif_running() function.
- Add free_netdev() function.
- Adding floowing debug macros for debug print enablement/disablement decission.
    a. Default enable : netif_msg_ifup(), netif_msg_ifdown(),
       netif_msg_timer(), netif_msg_rx_err().
    b. Default disable: netif_msg_intr(), netif_msg_tx_done(),
       netif_msg_rx_status()

In drivers/net/netdevice.c
- Set/Clear NETDEV_OPEN status in netdev_set_link() function.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS]: net: smc91x: Enabling free_netdev() function in code.

Uncommenting free_netdev() function in code since we have it now in
include/linux/netdevice,h

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] include: Adding placeholder for linux/regulator/consumer.h

Adding placeholder file for include/linux/regulator/consumer.h

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] net: phy: Adding phy/of_mdio.c

Porting Linux's "of_mdio.c" file and corrospnding functionality.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] net: phy: Adding SUN4i ethernet MDIO driver.

Porting Linux's mdio-sun4i.c driver for allwinner SUN4i ethernet's MDIO.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] net: ethernet: Allwinner SUN4i emac driver.

This driver has been ported from Linux 3.12.3 "drivers/net/ethernet/allwinner/"

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] More Linux-like API's for network driver porting.

File drivers/include/linux/etherdevice.h
-Added eth_validate_addr() function.

File drivers/include/linux/gpio.h
-Placeholder file.

File drivers/include/linux/kernel.h
-Placeholder macro for might_sleep()

File drivers/include/linux/mii.h
-Uncommenting include of uapi/linux/mii.h

File drivers/include/linux/module.h
-Define placeholder for module_param().

File drivers/include/linux/netdevice.h
-Update struct net_device_ops with inclusion of linux-like function pointers:
 a. ndo_validate_addr
 b. ndo_tx_timeout
 c. ndo_do_ioctl
 d. ndo_change_mtu
- Update struct net_device with Linux-like variables:
 a. trans_start
 b. watchdog_timeo
- Add Linux-like eth_change_mtu() function.

File drivers/include/linux/phy.h
-Define placeholder for phy_mii_ioctl() function.

File  drivers/include/uapi/linux/if.h
-New placeholder for Linux file include/uapi/linux/if.h.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[DRIVERS] net: ethernet: Enabling misc commented code in SUN4I EMAC driver.

This patch uncomments various #if 0 code in sun4i emac drivers,
I had commented this code because of lack of Linux-like header
or framework support during initial driver porting but now it is
available in our driver portability layer.

Signed-off-by: Pranav Sawargaonkar <pranav.sawargaonkar@gmail.com>
[CORE] net: Lockless bottom-half queue for network switch

We have per-cpu bottom-half queue and worker thread which processes
xfer request from bottom-half queue. Currently, this bottom-half queue
is linked-list based and protected using spinlock. If we have multiple
threads doing Tx/Rx of packets running on same host cpu then we might
spend considerable time in locking/unlocking and signalling.

This patch makes per-cpu bottom-half queue ring based and completely
lockless based on concept of "Lockless message passing". For details
on "Lockless message passing" refer:
http://www.informit.com/articles/article.aspx?p=1626980&seqNum=3
http://www.linuxjournal.com/content/lock-free-multi-producer-multi-consumer-queue-ring-buffer

The new approach for bottom-half queue stabilizes and improves performance
of inter-guest packet Tx/Rx.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] net: Add hub or repeater policy based netswitch

The most simplest policy for a netswitch is hub or repeater policy.

According to hub or repeater policy, a packet coming to netswitch from
a "src" port is simply broadcasted to all other ports in netswitch.

This simple/braindead netswitch policy can be very useful in scenarios
where we have many network ports in host HW and we want to pair each
guest network port with a single host HW network port.

Signed-off-by: Anup Patel <anup@brainfault.org>
[EMULATORS] virtio_net: Minor bug fix in virtio_net_tx_lazy()

The virtio_net_tx_lazy() can Tx max "budget" number of packets from
guest but it might happen that there are more packets on virtio_net
Tx queue. To handle this situation at the end of virtio_net_tx_lazy()
we add one more lazy xfer request if more packets are available in
virtio_net Tx queue.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARCH] Make CONFIG_SMP option CPU specific

This patch make CONFIG_SMP option CPU specific instead of having
it common for all archs in arch/openconf.cfg.

The patch also makes CONFIG_SMP and CONFIG_CPU_COUNT visible on
"make menuconfig" as architecture specific option.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] vmm_devtree: Minor improvement to vmm_devtree_addnode() API

The vmm_devtree_addnode() API takes two argument: parent node and
new node name. The parent node argument can be NULL when calling
vmm_devtree_addnode() API.

This patch improves vmm_devtree_addnode() for the case when parent
node is NULL. When there is no root node and parent node is NULL,
the vmm_devtree_addnode() API will return new node with parent
as NULL. When root node is available and parent node is NULL, the
vmm_devtree_addnode() API will return new node with parent node
as root node.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Ensure that /guests and /templates nodes are present

The nodes /guests and /templates are very important for guest creation
hence this patch ensures that when these nodes not present we explicitly
create it in system_init_work().

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] clk: Minor fixes in clk-sunxi driver

This patch fixes incorrect condition checks in sun4i_osc_clk_setup()
and sunxi_factors_clk_setup() functions.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] serial: Add compatile string for synopse uart in 8250 driver

The Synopses Designware APB UART is compliant to 8250 UART hence add
compatible string for this in 8250 driver.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] Fix no_printk() in linux/printk.h

The no_printk() is not supposed to print anything hence fix
this macro in linux/printk.h

Signed-off-by: Anup Patel <anup@brainfault.org>