lib: update libmetal to release v2020.01.0

Origin:
	https://github.com/OpenAMP/libmetal

commit:
	e3dfc2fe85e5ceb8b193c4cf559b17bbd53e8866

Status:
	merge libmetal new version after removing useless dirs.

Release Description:
	https://github.com/OpenAMP/libmetal/releases/tag/v2020.01.0

Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
This commit is contained in:
Arnaud Pouliquen 2020-03-19 18:01:49 +01:00 committed by Kumar Gala
parent 45e630d615
commit 11a4d140f5
12 changed files with 67 additions and 23 deletions

2
README
View File

@ -27,7 +27,7 @@ URL:
https://github.com/OpenAMP/libmetal
commit:
a4f763094cb26cd8f7abdff251f57a6a802c039d
e3dfc2fe85e5ceb8b193c4cf559b17bbd53e8866
Maintained-by:
External

View File

@ -9,6 +9,8 @@ names to be CC'd when submitting a patch.
## Project Administration
Wendy Liang <wendy.liang@xilinx.com>
Ed Mooring <ed.mooring@linaro.org>
Arnaud Pouliquen <arnaud.pouliquen@st.com>
### All patches CC here
open-amp@googlegroups.com
@ -16,6 +18,8 @@ open-amp@googlegroups.com
## Machines
### Xilinx Platform - Zynq-7000
Wendy Liang <wendy.liang@xilinx.com>
Ed Mooring <ed.mooring@linaro.org>
### Xilinx Platform - Zynq UltraScale+ MPSoC
Wendy Liang <wendy.liang@xilinx.com>
Ed Mooring <ed.mooring@linaro.org>

View File

@ -18,8 +18,6 @@
!defined(__cplusplus)
# include <stdint.h>
# include <stdatomic.h>
#elif defined(__cplusplus)
# include <atomic>
#elif defined(__GNUC__)
# include <metal/compiler/gcc/atomic.h>
#else

View File

@ -43,11 +43,10 @@ int metal_bus_find(const char *name, struct metal_bus **result)
metal_list_for_each(&_metal.common.bus_list, node) {
bus = metal_container_of(node, struct metal_bus, node);
if (strcmp(bus->name, name) != 0)
continue;
if (result)
if (strcmp(bus->name, name) == 0 && result) {
*result = bus;
return 0;
return 0;
}
}
return -ENOENT;
}
@ -106,10 +105,10 @@ int metal_generic_dev_open(struct metal_bus *bus, const char *dev_name,
metal_list_for_each(&_metal.common.generic_device_list, node) {
dev = metal_container_of(node, struct metal_device, node);
if (strcmp(dev->name, dev_name) != 0)
continue;
*device = dev;
return metal_generic_dev_sys_open(dev);
if (strcmp(dev->name, dev_name) == 0) {
*device = dev;
return metal_generic_dev_sys_open(dev);
}
}
return -ENODEV;
@ -122,9 +121,9 @@ int metal_generic_dev_dma_map(struct metal_bus *bus,
int nents_in,
struct metal_sg *sg_out)
{
int i;
(void)bus;
(void)device;
int i;
if (sg_out != sg_in)
memcpy(sg_out, sg_in, nents_in*(sizeof(struct metal_sg)));
@ -144,10 +143,10 @@ void metal_generic_dev_dma_unmap(struct metal_bus *bus,
struct metal_sg *sg,
int nents)
{
int i;
(void)bus;
(void)device;
(void)dir;
int i;
for (i = 0; i < nents; i++) {
metal_cache_invalidate(sg[i].virt, sg[i].len);

View File

@ -14,12 +14,10 @@
#define metal_cpu_yield()
#ifdef TEAKLITE4
/*
* The dummy implementation is enough here since
* tl42x don't support the out of order and multi core
* ceva dsp don't support the out of order and multi core
*/
#define __sync_synchronize()
#endif
#endif /* __METAL_CEVA_CPU__H__ */

View File

@ -0,0 +1,4 @@
collect (PROJECT_LIB_HEADERS atomic.h)
collect (PROJECT_LIB_HEADERS cpu.h)
# vim: expandtab:ts=2:sw=2:smartindent

View File

@ -0,0 +1,16 @@
/*
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file gcc/atomic.h
* @brief GCC specific atomic primitives for libmetal.
*/
#ifndef __METAL_X86_ATOMIC__H__
#define __METAL_X86_ATOMIC__H__
#endif /* __METAL_X86_ATOMIC__H__ */

View File

@ -0,0 +1,17 @@
/*
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
/*
* @file cpu.h
* @brief CPU specific primatives
*/
#ifndef __METAL_X86_CPU__H__
#define __METAL_X86_CPU__H__
#define metal_cpu_yield() asm volatile("rep; nop")
#endif /* __METAL_X86_CPU__H__ */

View File

@ -38,10 +38,10 @@ int metal_shmem_open_generic(const char *name, size_t size,
shmem = metal_container_of(node, struct metal_generic_shmem, node);
if (strcmp(shmem->name, name) != 0)
continue;
if (size > metal_io_region_size(&shmem->io))
continue;
*result = &shmem->io;
return 0;
if (size <= metal_io_region_size(&shmem->io)) {
*result = &shmem->io;
return 0;
}
}
return -ENOENT;

View File

@ -656,8 +656,13 @@ int metal_linux_get_device_property(struct metal_device *device,
fd = open(path, flags, mode);
if (fd < 0)
return -errno;
status = read(fd, output, len);
if (read(fd, output, len) < 0) {
status = -errno;
close(fd);
return status;
}
status = close(fd);
return status < 0 ? -errno : 0;
}

View File

@ -28,12 +28,14 @@ void metal_irq_restore_enable(unsigned int flags)
static void metal_cntr_irq_set_enable(struct metal_irq_controller *cntr,
int irq, unsigned int enable)
{
#ifndef CONFIG_ARCH_NOINTC
if (irq >= 0 && irq < cntr->irq_num) {
if (enable == METAL_IRQ_ENABLE)
up_enable_irq(irq);
else
up_disable_irq(irq);
}
#endif
}
static int metal_cntr_irq_handler(int irq, void *context, void *data)
@ -78,7 +80,8 @@ static int metal_cntr_irq_attach(struct metal_irq_controller *cntr,
int metal_cntr_irq_init(void)
{
static METAL_IRQ_CONTROLLER_DECLARE(metal_cntr_irq,
0, NR_IRQS,
0,
NR_IRQS ? NR_IRQS : 1,
NULL,
metal_cntr_irq_set_enable,
metal_cntr_irq_attach,

View File

@ -29,7 +29,7 @@ typedef struct k_sem metal_mutex_t;
* METAL_MUTEX_INIT - used for initializing an mutex elmenet in a static struct
* or global
*/
#define METAL_MUTEX_INIT(m) Z_SEM_INITIALIZER(m, 1, 1)
#define METAL_MUTEX_INIT(m) _K_SEM_INITIALIZER(m, 1, 1)
/*
* METAL_MUTEX_DEFINE - used for defining and initializing a global or
* static singleton mutex