diff --git a/config/caps.py b/config/caps.py index 75e8cff..ca80b36 100644 --- a/config/caps.py +++ b/config/caps.py @@ -139,6 +139,18 @@ cap_strings = { 'ipc' : \ \t\t\t\t.size = ${size}, \t\t\t}, ''' +, 'uart' : \ +''' +\t\t\t[${idx}] = { +\t\t\t\t/* For device selection. */ +\t\t\t\t.target = ${cid}, +\t\t\t\t.devid = ${devid}, +\t\t\t\t.type = CAP_DEVTYPE_UART | CAP_TYPE_MAP_PHYSMEM | CAP_RTYPE_CONTAINER, +\t\t\t\t.access = CAP_MAP_READ | CAP_MAP_WRITE | CAP_MAP_EXEC | +\t\t\t\t\tCAP_MAP_CACHED | CAP_MAP_UNCACHED | CAP_MAP_UNMAP | CAP_MAP_UTCB, +\t\t\t\t.start = 0, .end = 0, .size = 0, +\t\t\t}, +''' } @@ -187,7 +199,17 @@ def prepare_typed_capability(cont, param, val): # USE makes us assign the initial cap string with blank fields if 'USE' in params: - cont.caps[captype] = cap_strings[captype] + + # Special case for device + if 'DEVICE' in params: + # Extract device name and number + devnum = captype[-1:] + devname = captype[: -1] + + cont.caps[captype] = cap_strings[devname] + + else: + cont.caps[captype] = cap_strings[captype] # Prepare string template from capability type templ = Template(cont.caps[captype]) @@ -196,6 +218,10 @@ def prepare_typed_capability(cont, param, val): if captype[-len('pool'):] == 'pool': cont.caps[captype] = templ.safe_substitute(cid = cont.id) + # If device, amend current container id and devnum as default + if 'DEVICE' in params: + cont.caps[captype] = templ.safe_substitute(cid = cont.id, devid = devnum) + # Fill in the blank size field elif 'SIZE' in params: # Get reference to capability string template diff --git a/config/cml/container_ruleset.template b/config/cml/container_ruleset.template index 4c177da..b10a997 100644 --- a/config/cml/container_ruleset.template +++ b/config/cml/container_ruleset.template @@ -144,6 +144,7 @@ symbols cont%(cn)d_menu 'Container %(cn)d Parameters' cont%(cn)d_physmem_list 'Container %(cn)d Physical Memory Regions (Capabilities)' cont%(cn)d_virtmem_list 'Container %(cn)d Virtual Memory Regions (Capabilities)' +cont%(cn)d_device_list 'Container %(cn)d Devices (Capabilities)' container%(cn)d_type 'Container %(cn)d Type' container%(cn)d_options 'Container %(cn)d Options' @@ -208,6 +209,99 @@ menu cont%(cn)d_physmem_list CONT%(cn)d_PHYS3_START@ CONT%(cn)d_PHYS3_END@ +# +# Device menu and options per container +# +symbols +cont%(cn)d_device_uart1 'Container %(cn)d UART1 Menu' +cont%(cn)d_device_uart2 'Container %(cn)d UART2 Menu' +cont%(cn)d_device_uart3 'Container %(cn)d UART3 Menu' + +CONT%(cn)d_CAP_UART1_DEVICE_USE 'Container %(cn)d UART1 Enable' +CONT%(cn)d_CAP_UART2_DEVICE_USE 'Container %(cn)d UART2 Enable' +CONT%(cn)d_CAP_UART3_DEVICE_USE 'Container %(cn)d UART3 Enable' + +default CONT%(cn)d_CAP_UART1_DEVICE_USE from n +default CONT%(cn)d_CAP_UART2_DEVICE_USE from n +default CONT%(cn)d_CAP_UART3_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 + +menu cont%(cn)d_device_uart1 + CONT%(cn)d_CAP_UART1_DEVICE_USE + +menu cont%(cn)d_device_uart2 + CONT%(cn)d_CAP_UART2_DEVICE_USE + +menu cont%(cn)d_device_uart3 + CONT%(cn)d_CAP_UART3_DEVICE_USE + +menu cont%(cn)d_device_list + cont%(cn)d_device_uart1 + cont%(cn)d_device_uart2 + cont%(cn)d_device_uart3 + # # Settings for Custom Capabilities # @@ -639,6 +733,7 @@ menu container%(cn)d_options cont%(cn)d_physmem_list cont%(cn)d_virtmem_list cont%(cn)d_capability_list + cont%(cn)d_device_list choices container%(cn)d_type CONT%(cn)d_TYPE_BAREMETAL diff --git a/config/configuration.py b/config/configuration.py index 10d6894..735e281 100644 --- a/config/configuration.py +++ b/config/configuration.py @@ -12,7 +12,6 @@ class Container: self.name = None self.type = None self.id = id - self.src_path = None self.baremetal_id = 0 self.pager_lma = 0 self.pager_vma = 0