[LIBS] libfdt: Fix libfdt_parse_fileinfo() API

Currently, libfdt_parse_fileinfo() API assume that FDT strings will
immediately follow FDT data. This works is most of the case but if
bootloader (such as u-boot) modify FDT before passing then it will
fail.

The correct way of determining location of FDT strings and FDT data
in FDT blob is to use offset_xxx fields of FDT header.

Signed-off-by: Anup Patel <anup@brainfault.org>
[DRIVERS] serial: Few improvements to 8250-uart

This patch does two improvements to 8250-uart drivers:
1. The function uart_8250_clear_errors() is only required
when UART_POLLING is disabled.
2. Do not break poping data from Rx FIFO when Rx buffer
is full. If Rx buffer is full then drop data instead of
breaking loop.

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] arm64: update arch_delay_loop_cycles()

The correct way for estimating machine cycle count from delay
loop count on Foundation v8 Model and Real HW seems to be:
Number of machine cycles = Loop count  * 2

This patch update arch_delay_loop_cycles() as per above.

In future, we will have CPU vendor specific ways of computing
machine cycles from delay loop count.

Signed-off-by: Anup Patel <anup@brainfault.org>
[CORE] Don't use vmm_panic() for failures in init_bootcpu()

When we are in init_bootcpu() there is no VCPU running and
the stack is boot-time stack provided by architecture specific
code.

The vmm_panic() tries to do stacktrace when called from anywhere.
This stacktrace fails from init_bootcpu() on arm64 hardware.

This patch replaces use of vmm_panic() in init_bootcpu() with
vmm_printf() followed by vmm_hang().

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] arm64: Fix defterm early mapping in initial MMU LPAE setup

The initial MMU LPAE setup uses "&defterm_early_base" to determine
virtual address of defterm early mapping.

On ARM64, "&x" gives us absolute address of variable "x" based on
current execution address and not compile time address of "x".

This means that on arm64 "&defterm_early_base" will give absolute
virtual address based on current load address because the function
_setup_initial_ttbl() is called with MMU disabled from load address.

Due to all this, defterm early base in initial MMU LPAE setup is
mapped to wrong location.

This patch fixes use of "&defterm_early_base" in _setup_initial_ttbl().

Signed-off-by: Anup Patel <anup@brainfault.org>
[ARM] Enable 8250-uart driver in generic-v8-defconfig

The 8250-uart is quite common serial device found on lot of
ARM SOCs hence enable it for generic-v8-defconfig.

Signed-off-by: Anup Patel <anup@brainfault.org>
Merge remote-tracking branch 'upstream/master' into A20
[DRIVERS] Add umode_t and dma_addr_t to linux/types.h

Provide linux compatible umode_t and dma_addr_t types.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add pm_message_t to linux/pm.h

Provide linux compatible pm_message_t for driver porting.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[ARCH] Add atomic_add_unless() to arch_atomic.h

This patch adds derived atomic operation atomic_add_unless()
to arch_atomic.h for all archs.

This new atomic operation will be used for implementing linux
compatible kref APIs.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add more linux compatible atomic operations to asm/atomic.h

This patch adds number of linux-like atomic operations such as:
1. atomic_inc_and_test()
2. atomic_dec_and_test()
3. atomic_sub_and_test()
4. atomic_add_negative()

All the above atomic operations are directly expressed in terms of
Xvisor atomic operations.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add linux-like __xxx() byteorder to asm/byteorder.h

We already have most of the linux compatible byteorder APIs
in asm/byteorder.h but quite a few drivers use __xxx() varients
of these byteorder APIs hence this patch.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Define module to vmm_module to make drivers happy

Lot of linux driver keep track of module pointer hence #define
module to vmm_module to make them happy.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add place holder linux/moduleparam.h

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add place holder linux/kmod.h

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[DRIVERS] Add linux compatible kref APIs

Quite a few driver frameworks use kref APIs for reference
counting hence this patch adds linux compatible kref for
porting drivers.

Signed-off-by: Ankit Jindal <thatsjindal@gmail.com>
[EMULATORS] PCI Bus emulation layer

This patch set adds a simple PCI bus emulation layer.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[EMULATORS] PCI Shared memory device emulator

This patch set adds a PCI shared memory device emulator.
Its kind of framework now but more code will be added to it.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[x86] i440fx PMC controller emulation.

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>
[EMULATORS] pci: Reshuffle the ipriorities

Signed-off-by: Himanshu Chauhan <hschauhan@nulltrace.org>