add validator to restrict the flexibility of LConfig
[lunaix-os.git] / lunaix-os / hal / LConfig
index 35385c9450920be346376d813c2e68c19100d490..b2e00fa77c7b659a6147b79aa9dddde55b98658e 100644 (file)
@@ -1,9 +1,31 @@
-include("char")
-include("bus")
-include("ahci")
+from . import char, bus, ahci
 
-@Collection
+@"Devices & Peripherials"
 def hal():
     """ Lunaix hardware asbtraction layer """
 
-    pass
\ No newline at end of file
+    @"Devicetree for hardware discovery"
+    def use_devicetree() -> bool:
+        """
+            Decide whether to use Devicetree for platform
+            resource topology sensing.
+
+            On some architecture, Lunaix will fallback to use
+            devicetree when ran out of options. For others, such
+            as those designed with embedded support in mind, 
+            devicetree might be mandatory and perhaps the only
+            way.
+        """
+        require(not arch_x86)
+
+        return False
+
+    @"Maximum size of device tree blob (in KiB)"
+    @readonly
+    def dtb_maxsize() -> int:
+        """
+            Maximum size for a firmware provided device tree blob
+        """
+        require(use_devicetree)
+
+        return 256
\ No newline at end of file