diff options
author | Peng Fan <peng.fan@nxp.com> | 2020-08-06 12:42:50 +0300 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2020-08-14 22:18:30 +0300 |
commit | 384d5cfe5d7e391a5584492bb2ce5794cbd691a9 (patch) | |
tree | 8d363041a6682d7321ca0bafdbe1e706cad7c658 /board | |
parent | 673fd82c507cf2a674ca6ec6d84d8d2854a6d78c (diff) | |
download | u-boot-384d5cfe5d7e391a5584492bb2ce5794cbd691a9.tar.xz |
serial: serial_xen: Add Xen PV serial driver
Add support for Xen para-virtualized serial driver. This
driver fully supports serial console for the virtual machine.
Please note that as the driver is initialized late, so no banner
nor memory size is visible.
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Signed-off-by: Anastasiia Lukianenko <anastasiia_lukianenko@epam.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/xen/xenguest_arm64/xenguest_arm64.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/board/xen/xenguest_arm64/xenguest_arm64.c b/board/xen/xenguest_arm64/xenguest_arm64.c index 1d1e229085..e3903bb987 100644 --- a/board/xen/xenguest_arm64/xenguest_arm64.c +++ b/board/xen/xenguest_arm64/xenguest_arm64.c @@ -17,9 +17,12 @@ #include <asm/armv8/mmu.h> #include <asm/xen.h> #include <asm/xen/hypercall.h> +#include <asm/xen/system.h> #include <linux/compiler.h> +#include <xen/hvm.h> + DECLARE_GLOBAL_DATA_PTR; int board_init(void) @@ -56,9 +59,28 @@ static int get_next_memory_node(const void *blob, int mem) static int setup_mem_map(void) { - int i, ret, mem, reg = 0; + int i = 0, ret, mem, reg = 0; struct fdt_resource res; const void *blob = gd->fdt_blob; + u64 gfn; + + /* + * Add "magic" region which is used by Xen to provide some essentials + * for the guest: we need console. + */ + ret = hvm_get_parameter_maintain_dcache(HVM_PARAM_CONSOLE_PFN, &gfn); + if (ret < 0) { + printf("%s: Can't get HVM_PARAM_CONSOLE_PFN, ret %d\n", + __func__, ret); + return -EINVAL; + } + + xen_mem_map[i].virt = PFN_PHYS(gfn); + xen_mem_map[i].phys = PFN_PHYS(gfn); + xen_mem_map[i].size = PAGE_SIZE; + xen_mem_map[i].attrs = (PTE_BLOCK_MEMTYPE(MT_NORMAL) | + PTE_BLOCK_INNER_SHARE); + i++; mem = get_next_memory_node(blob, -1); if (mem < 0) { @@ -66,7 +88,7 @@ static int setup_mem_map(void) return -EINVAL; } - for (i = 0; i < MAX_MEM_MAP_REGIONS; i++) { + for (; i < MAX_MEM_MAP_REGIONS; i++) { ret = fdt_get_resource(blob, mem, "reg", reg++, &res); if (ret == -FDT_ERR_NOTFOUND) { reg = 0; @@ -145,8 +167,3 @@ int print_cpuinfo(void) return 0; } -__weak struct serial_device *default_serial_console(void) -{ - return NULL; -} - |