summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f025de2)
raw | patch | inline | side by side (parent: f025de2)
author | Wendy Liang <jliang@xilinx.com> | |
Mon, 23 May 2016 23:37:31 +0000 (16:37 -0700) | ||
committer | Wendy Liang <jliang@xilinx.com> | |
Thu, 13 Oct 2016 05:01:43 +0000 (22:01 -0700) |
use metal_list instead of llist in hil_proc.
Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Wendy Liang <jliang@xilinx.com>
lib/common/hil.c | patch | blob | history | |
lib/include/openamp/hil.h | patch | blob | history |
diff --git a/lib/common/hil.c b/lib/common/hil.c
index 234ac576d2d14ee8eaf988d5d31453828e74be15..eb53e96e56a6a6ebb13080b9217117f43802620c 100644 (file)
--- a/lib/common/hil.c
+++ b/lib/common/hil.c
**************************************************************************/
#include "openamp/hil.h"
+#include "metal/utilities.h"
/*--------------------------- Globals ---------------------------------- */
-struct hil_proc_list procs;
+static METAL_DECLARE_LIST (procs);
#if defined (OPENAMP_BENCHMARK_ENABLE)
*/
struct hil_proc *hil_create_proc(int cpu_id)
{
- struct hil_proc *proc = NULL;
- struct llist *node = NULL;
- struct llist *proc_hd = procs.proc_list;
+ struct hil_proc *proc;
+ struct metal_list *node;
int status;
/* If proc already exists then return it */
- while (proc_hd != NULL) {
- proc = (struct hil_proc *)proc_hd->data;
+ metal_list_for_each(&procs, node) {
+ proc = metal_container_of(node, struct hil_proc, node);
if (proc->cpu_id == (unsigned int)cpu_id) {
return proc;
}
- proc_hd = proc_hd->next;
}
/* Allocate memory for proc instance */
(unsigned int)proc->sh_buff.start_addr,
proc->sh_buff.size, (SHARED_MEM | UNCACHED));
- /* Put the new proc in the procs list */
- node = env_allocate_memory(sizeof(struct llist));
-
- if (!node) {
- env_free_memory(proc);
- return NULL;
- }
-
- node->data = proc;
- add_to_list(&procs.proc_list, node);
+ metal_list_add_tail(&procs, &proc->node);
return proc;
}
*/
void hil_delete_proc(struct hil_proc *proc)
{
- struct llist *proc_hd = NULL;
-
- if (!proc)
- return;
-
- proc_hd = procs.proc_list;
-
- while (proc_hd != NULL) {
- if (proc_hd->data == proc) {
- remove_from_list(&procs.proc_list, proc_hd);
- env_free_memory(proc_hd);
+ struct metal_list *node;
+ metal_list_for_each(&procs, node) {
+ if (proc ==
+ metal_container_of(node, struct hil_proc, node)) {
+ metal_list_del(&proc->node);
env_free_memory(proc);
- break;
+ return;
}
- proc_hd = proc_hd->next;
}
-
}
/**
*/
struct hil_proc *hil_get_proc(int cpu_id)
{
- struct llist *proc_hd = procs.proc_list;
-
- if (!proc_hd)
- return NULL;
+ struct metal_list *node;
+ struct hil_proc *proc;
- while (proc_hd != NULL) {
- struct hil_proc *proc = (struct hil_proc *)proc_hd->data;
+ metal_list_for_each(&procs, node) {
+ proc = metal_container_of(node, struct hil_proc, node);
if (proc->cpu_id == (unsigned int)cpu_id) {
return proc;
}
- proc_hd = proc_hd->next;
}
return NULL;
index 4ed1783183560dc5d0e98c46e8f3e32084f0428f..c4fdf2c5b0202423950f5821e8dbde2a14f19c99 100644 (file)
#include "openamp/virtio.h"
#include "openamp/firmware.h"
+#include "metal/list.h"
/* Configurable parameters */
#define HIL_MAX_CORES 2
unsigned long cpu_bitmask;
/* Spin lock - This field is for future use. */
volatile unsigned int *slock;
-};
-
-/**
- * struct hil_proc_list
- *
- * This structure serves as lists for cores present in the system.
- * It provides entry point to access remote core parameters.
- *
- */
-struct hil_proc_list {
- struct llist *proc_list;
+ /* List node */
+ struct metal_list node;
};
/**