def get_regions(self, node: WrappedNode) -> List[KernelRegionGroup]: ''' Returns a list of KernelRegionGroups that this rule specifies should be mapped into the kernel for this device. ''' ret = [] regions = node.get_regions() for (i, rule) in self.regions.items(): if i >= len(regions): # XXX: skip this rule silently continue reg = regions[i] kernel_name = rule['kernel'] user = rule.get('user', False) macro = rule.get('macro', None) max_size = 1 << self.config.get_page_bits() if 'kernel_size' in rule: max_size = rule['kernel_size'] elif max_size < reg.size: logging.warning( "Only mapping {}/{} bytes from node {}, region {}. Set kernel_size in YAML to silence." .format(max_size, reg.size, node.path, i)) ret.append( KernelRegionGroup(reg, kernel_name, self.config.get_page_bits(), max_size, macro, user)) return ret
def visitor(node: WrappedNode): if node.has_prop('device_type') and node.get_prop( 'device_type').strings[0] == 'memory': regions.update(node.get_regions())