diff --git a/libs/utils/env.py b/libs/utils/env.py index 1e8a2c90fc55cb71bfa1cc65bbfffd5e91f12bc0..34828465557acfe240ea0cccd0d7ef267bb58147 100644 --- a/libs/utils/env.py +++ b/libs/utils/env.py @@ -337,6 +337,8 @@ class TestEnv(ShareState): ######################################################################## # Setup board default if not specified by configuration + platform = None + self.__modules = [] if 'board' not in self.conf: self.conf['board'] = 'UNKNOWN' @@ -355,20 +357,18 @@ class TestEnv(ShareState): platform = Platform(model='MT8173') self.__modules = ['bl', 'cpufreq'] - # Initialize N5X device - elif self.conf['board'].upper() == 'N5X': - platform = Platform(model='bullhead', - core_names = ['A53', 'A53', 'A53', 'A53', - 'A57', 'A57'], - core_clusters = [ 0, 0, 0, 0, 1, 1], - big_core = 'A57', - ) - self.__modules = ['bl', 'cpufreq'] - - # Initialize default UNKNOWN board - else: - platform = None - self.__modules = [] + elif self.conf['board'] != 'UNKNOWN': + # Initilize from platform descriptor (if available) + board = self._load_board(self.conf['board']) + if board: + core_names=board['cores'] + platform = Platform( + model=self.conf['board'], + core_names=core_names, + core_clusters = self._get_clusters(core_names), + big_core=board.get('big_core', None) + ) + self.__modules=board.get('modules', []) ######################################################################## # Modules configuration @@ -592,6 +592,31 @@ class TestEnv(ShareState): return None return board.json['nrg_model'] + def _load_board(self, board): + board_path = os.path.join(basepath, + 'libs/utils/platforms', board.lower() + '.json') + logging.debug('%14s - Trying to load board descriptor from %s', + 'Platform', board_path) + if not os.path.exists(board_path): + return None + logging.info('%14s - Loading board:', 'Platform') + logging.info('%14s - %s', 'Platform', board_path) + board = JsonConf(board_path) + board.load() + if 'board' not in board.json: + return None + return board.json['board'] + + def _get_clusters(self, core_names): + idx = 0 + clusters = [] + ids_map = { core_names[0] : 0 } + for name in core_names: + idx = ids_map.get(name, idx+1) + ids_map[name] = idx + clusters.append(idx) + return clusters + def _init_platform(self): if 'bl' in self.target.modules: self._init_platform_bl() diff --git a/libs/utils/platforms/nexus5x.json b/libs/utils/platforms/nexus5x.json new file mode 100644 index 0000000000000000000000000000000000000000..d483e913f4de793630b349d582c5e12b1a6755db --- /dev/null +++ b/libs/utils/platforms/nexus5x.json @@ -0,0 +1,9 @@ +{ + "board" : { + "cores" : [ + "A53", "A53", "A53", "A53", "A57", "A57" + ], + "big_core" : "A57", + "modules" : ["bl", "cpufreq"] + } +}