Commit 1a287acc authored by Neil Horman's avatar Neil Horman

Add object type ennumeration to topo map

Since we use a common object for our topology now, add some ennumeration so we
can tell what type of object wer'e looking at when debugging
parent 587ba2f4
......@@ -76,6 +76,7 @@ static struct topo_obj* add_cache_domain_to_package(struct topo_obj *cache,
if (!package)
return NULL;
package->mask = package_mask;
package->obj_type = OBJ_TYPE_PACKAGE;
packages = g_list_append(packages, package);
package_count++;
}
......@@ -115,6 +116,7 @@ static struct topo_obj* add_cpu_to_cache_domain(struct topo_obj *cpu,
cache = calloc(sizeof(struct topo_obj), 1);
if (!cache)
return NULL;
cache->obj_type = OBJ_TYPE_CACHE;
cache->mask = cache_mask;
cache->number = cache_domain_count;
cache_domains = g_list_append(cache_domains, cache);
......@@ -169,6 +171,8 @@ static void do_one_cpu(char *path)
if (!cpu)
return;
cpu->obj_type = OBJ_TYPE_CPU;
cpu->number = strtoul(&path[27], NULL, 10);
cpu_set(cpu->number, cpu_possible_map);
......
......@@ -40,6 +40,7 @@ GList *numa_nodes = NULL;
struct topo_obj unspecified_node = {
.load = 0,
.number = -1,
.obj_type = OBJ_TYPE_NODE,
.mask = CPU_MASK_ALL,
.interrupts = NULL,
.children = NULL,
......@@ -71,7 +72,7 @@ static void add_one_node(const char *nodename)
free(cpustr);
}
}
new->obj_type = OBJ_TYPE_NODE;
new->number = strtoul(&nodename[4], NULL, 10);
numa_nodes = g_list_append(numa_nodes, new);
}
......
......@@ -26,8 +26,16 @@
#define IRQ_TYPE_MSI 1
#define IRQ_TYPE_MSIX 2
enum obj_type_e {
OBJ_TYPE_CPU,
OBJ_TYPE_CACHE,
OBJ_TYPE_PACKAGE,
OBJ_TYPE_NODE
};
struct topo_obj {
uint64_t load;
enum obj_type_e obj_type;
int number;
cpumask_t mask;
GList *interrupts;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment