Merge remote-tracking branch 'origin/master' into isa/arm64
[lunaix-os.git] / lunaix-os / includes / hal / devtreem.h
diff --git a/lunaix-os/includes/hal/devtreem.h b/lunaix-os/includes/hal/devtreem.h
new file mode 100644 (file)
index 0000000..c8d10c2
--- /dev/null
@@ -0,0 +1,48 @@
+#ifndef __LUNAIX_DEVTREE_TOP_H
+#define __LUNAIX_DEVTREE_TOP_H
+
+struct device_def;
+struct device;
+
+#ifdef CONFIG_USE_DEVICETREE
+
+#include "devtree.h"
+#include <lunaix/ds/hashtable.h>
+#include <lunaix/ds/list.h>
+#include <klibc/hash.h>
+
+typedef struct dt_node* devtree_link_t;
+
+#define dt_node_morpher     morphable_attrs(dt_node, mobj)
+
+struct dtm_driver_info
+{
+    struct list_node node;
+    const char* pattern;
+};
+
+struct dtm_driver_record
+{
+    struct hlist_node node;
+    struct list_head infos;
+    struct device_def* def;
+};
+
+void
+dtm_register_entry(struct device_def* def, const char* pattern);
+
+#else
+
+#include <lunaix/types.h>
+
+typedef void* devtree_link_t;
+
+static inline void
+dtm_register_entry(struct device_def* def, const char* pattern)
+{
+    return;
+}
+
+#endif
+
+#endif /* __LUNAIX_DEVTREE_TOP_H */