diff --git a/config/cml/container_ruleset.template b/config/cml/container_ruleset.template index 0a03f4d..86559ed 100644 --- a/config/cml/container_ruleset.template +++ b/config/cml/container_ruleset.template @@ -216,6 +216,8 @@ menu cont%(cn)d_physmem_list # # Device menu and options per container # +# FIXME: All this is to be moved to a per-platform description file. +# symbols cont%(cn)d_device_uart1 'Container %(cn)d UART1 Menu' cont%(cn)d_device_uart2 'Container %(cn)d UART2 Menu' @@ -232,89 +234,6 @@ default CONT%(cn)d_CAP_UART2_DEVICE_USE from n default CONT%(cn)d_CAP_UART3_DEVICE_USE from n default CONT%(cn)d_CAP_TIMER1_DEVICE_USE from n -# Note: We are suppressing the menu not symbol here, as in future -# we will add new parameters to menu, so suprpressing each symbol -# will be cumbersome -when CONT0_CAP_UART1_DEVICE_USE == y suppress - cont1_device_uart1 - cont2_device_uart1 - cont3_device_uart1 - -when CONT1_CAP_UART1_DEVICE_USE == y suppress - cont0_device_uart1 - cont2_device_uart1 - cont3_device_uart1 - -when CONT2_CAP_UART1_DEVICE_USE == y suppress - cont0_device_uart1 - cont1_device_uart1 - cont3_device_uart1 - -when CONT3_CAP_UART1_DEVICE_USE == y suppress - cont0_device_uart1 - cont1_device_uart1 - cont2_device_uart1 - -when CONT0_CAP_UART2_DEVICE_USE == y suppress - cont1_device_uart2 - cont2_device_uart2 - cont3_device_uart2 - -when CONT1_CAP_UART2_DEVICE_USE == y suppress - cont0_device_uart2 - cont2_device_uart2 - cont3_device_uart2 - -when CONT2_CAP_UART2_DEVICE_USE == y suppress - cont0_device_uart2 - cont1_device_uart2 - cont2_device_uart2 - -when CONT3_CAP_UART2_DEVICE_USE == y suppress - cont0_device_uart2 - cont1_device_uart2 - cont2_device_uart2 - -when CONT0_CAP_UART3_DEVICE_USE == y suppress - cont1_device_uart3 - cont2_device_uart3 - cont3_device_uart3 - -when CONT1_CAP_UART3_DEVICE_USE == y suppress - cont0_device_uart3 - cont2_device_uart3 - cont3_device_uart3 - -when CONT2_CAP_UART3_DEVICE_USE == y suppress - cont0_device_uart3 - cont1_device_uart3 - cont3_device_uart3 - -when CONT3_CAP_UART3_DEVICE_USE == y suppress - cont0_device_uart3 - cont1_device_uart3 - cont2_device_uart3 - -when CONT0_CAP_TIMER1_DEVICE_USE == y suppress - cont1_device_timer1 - cont2_device_timer1 - cont3_device_timer1 - -when CONT1_CAP_TIMER1_DEVICE_USE == y suppress - cont0_device_timer1 - cont2_device_timer1 - cont3_device_timer1 - -when CONT2_CAP_TIMER1_DEVICE_USE == y suppress - cont0_device_timer1 - cont1_device_timer1 - cont3_device_timer1 - -when CONT3_CAP_TIMER1_DEVICE_USE == y suppress - cont0_device_timer1 - cont1_device_timer1 - cont2_device_timer1 - menu cont%(cn)d_device_uart1 CONT%(cn)d_CAP_UART1_DEVICE_USE diff --git a/scripts/cml/generate_container_cml.py b/scripts/cml/generate_container_cml.py index e5bb269..bbf18a4 100755 --- a/scripts/cml/generate_container_cml.py +++ b/scripts/cml/generate_container_cml.py @@ -7,6 +7,7 @@ # import os, sys, shelve, glob from os.path import join +from string import Template PROJRELROOT = '../../' @@ -34,6 +35,43 @@ def add_container_constraint(cid): cml_string = containers_constraint % (cid, cid) return cml_string +device_suppress_rule = \ +''' +when CONT${CONTID}_CAP_${DEVNAME}_DEVICE_USE == y suppress +''' + +device_suppress_sym = \ +'''\tcont${CONTID}_device_${DEVNAME_LOWER} +''' + +devices = ['UART1', 'UART2', 'UART3', 'TIMER1'] + +# +# When a symbol is used by a single container, sometimes it is +# necessary to hide it in other containers. This cannot be +# achieved statically but rather needs to be autogenerated +# depending on the number of containers used. +# +def generate_container_suppress_rules(ncont): + finalstr = '' + # For each device on the platform + for devname in devices: + # Generate rule for each container + for cont in range(ncont): + # Create string templates + rule_templ = Template(device_suppress_rule) + sym_templ = Template(device_suppress_sym) + + rulestr = rule_templ.substitute(CONTID = cont, DEVNAME = devname) + symstr = '' + # Fill for each container + for other_cont in range(ncont): + if other_cont == cont: + continue + symstr += sym_templ.substitute(CONTID = other_cont, DEVNAME_LOWER = devname.lower()) + finalstr += rulestr + symstr + "\n" + return finalstr + def generate_container_cml(arch, ncont): print "Autogenerating new rule file" fbody = "" @@ -49,6 +87,9 @@ def generate_container_cml(arch, ncont): for cont in range(ncont): fbody += '\tcont%d_menu\n' % cont + # Generate inter-container suppression rules for as many rules as containers + fbody += generate_container_suppress_rules(ncont) + # Write each container's rules for cont in range(ncont): with open(CML2_CONT_DEFFILE, "rU") as contdefs: diff --git a/scripts/kernel/generate_kernel_cinfo.py b/scripts/kernel/generate_kernel_cinfo.py index 9faecfb..4e07b98 100755 --- a/scripts/kernel/generate_kernel_cinfo.py +++ b/scripts/kernel/generate_kernel_cinfo.py @@ -108,7 +108,7 @@ pager_ifdefs_todotext = \ * TODO: * This had to be defined this way because in CML2 there * is no straightforward way to derive symbols from expressions, even - * it is stated in the manual that it can be done. + * if it is stated in the manual that it can be done. * As a workaround, a ternary expression of (? : ) was tried but this * complains that type deduction could not be done. */''' diff --git a/src/generic/capability.c b/src/generic/capability.c index 58542f3..360131b 100644 --- a/src/generic/capability.c +++ b/src/generic/capability.c @@ -15,7 +15,7 @@ #include #include #include -//#include +#include #include INC_GLUE(message.h) #include INC_GLUE(ipc.h)