]> git.saurik.com Git - apple/xnu.git/blobdiff - pexpert/gen/pe_gen.c
xnu-4903.231.4.tar.gz
[apple/xnu.git] / pexpert / gen / pe_gen.c
index 5bab0cc1401fdf2d028bc3c6d88219f9a818e569..5515f47b2ab1143526f1199c737865ec19bcb739 100644 (file)
 #include <pexpert/device_tree.h>
 #include <kern/debug.h>
 
+#if CONFIG_EMBEDDED
+#include <libkern/section_keywords.h>
+#endif
+
 static int DEBUGFlag;
+
+#if CONFIG_EMBEDDED
+SECURITY_READ_ONLY_LATE(static uint32_t) gPEKernelConfigurationBitmask;
+#else
 static uint32_t gPEKernelConfigurationBitmask;
+#endif
 
 int32_t gPESerialBaud = -1;
 
+int debug_cpu_performance_degradation_factor = 1;
+
 void pe_init_debug(void)
 {
        boolean_t boot_arg_value;
@@ -77,6 +88,21 @@ void pe_init_debug(void)
 #endif
        gPEKernelConfigurationBitmask |= (boot_arg_value ? kPEICanHasDiagnosticAPI : 0);
 
+
+       int factor = 1;
+       boolean_t have_bootarg = PE_parse_boot_argn("cpu-factor", &factor, sizeof (factor));
+       if (have_bootarg) {
+               debug_cpu_performance_degradation_factor = factor;
+       } else {
+               DTEntry         root;
+               if (DTLookupEntry(NULL, "/", &root) == kSuccess) {
+                       void *prop = NULL;
+                       uint32_t size = 0;
+                       if (DTGetProperty(root, "target-is-fpga", &prop, &size) == kSuccess) {
+                               debug_cpu_performance_degradation_factor = 10;
+                       }
+               }
+       }
 }
 
 void PE_enter_debugger(const char *cause)