~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/gdb/linux/genpd.py

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/gdb/linux/genpd.py (Version linux-6.12-rc7) and /scripts/gdb/linux/genpd.py (Version linux-5.9.16)


  1 # SPDX-License-Identifier: GPL-2.0                  1 # SPDX-License-Identifier: GPL-2.0
  2 #                                                   2 #
  3 # Copyright (c) NXP 2019                            3 # Copyright (c) NXP 2019
  4                                                     4 
  5 import gdb                                          5 import gdb
  6 import sys                                          6 import sys
  7                                                     7 
  8 from linux.utils import CachedType, gdb_eval_o !!   8 from linux.utils import CachedType
  9 from linux.lists import list_for_each_entry         9 from linux.lists import list_for_each_entry
 10                                                    10 
 11 generic_pm_domain_type = CachedType('struct ge     11 generic_pm_domain_type = CachedType('struct generic_pm_domain')
 12 pm_domain_data_type = CachedType('struct pm_do     12 pm_domain_data_type = CachedType('struct pm_domain_data')
 13 device_link_type = CachedType('struct device_l     13 device_link_type = CachedType('struct device_link')
 14                                                    14 
 15                                                    15 
 16 def kobject_get_path(kobj):                        16 def kobject_get_path(kobj):
 17     path = kobj['name'].string()                   17     path = kobj['name'].string()
 18     parent = kobj['parent']                        18     parent = kobj['parent']
 19     if parent:                                     19     if parent:
 20         path = kobject_get_path(parent) + '/'      20         path = kobject_get_path(parent) + '/' + path
 21     return path                                    21     return path
 22                                                    22 
 23                                                    23 
 24 def rtpm_status_str(dev):                          24 def rtpm_status_str(dev):
 25     if dev['power']['runtime_error']:              25     if dev['power']['runtime_error']:
 26         return 'error'                             26         return 'error'
 27     if dev['power']['disable_depth']:              27     if dev['power']['disable_depth']:
 28         return 'unsupported'                       28         return 'unsupported'
 29     _RPM_STATUS_LOOKUP = [                         29     _RPM_STATUS_LOOKUP = [
 30         "active",                                  30         "active",
 31         "resuming",                                31         "resuming",
 32         "suspended",                               32         "suspended",
 33         "suspending"                               33         "suspending"
 34     ]                                              34     ]
 35     return _RPM_STATUS_LOOKUP[dev['power']['ru     35     return _RPM_STATUS_LOOKUP[dev['power']['runtime_status']]
 36                                                    36 
 37                                                    37 
 38 class LxGenPDSummary(gdb.Command):                 38 class LxGenPDSummary(gdb.Command):
 39     '''Print genpd summary                         39     '''Print genpd summary
 40                                                    40 
 41 Output is similar to /sys/kernel/debug/pm_genp     41 Output is similar to /sys/kernel/debug/pm_genpd/pm_genpd_summary'''
 42                                                    42 
 43     def __init__(self):                            43     def __init__(self):
 44         super(LxGenPDSummary, self).__init__('     44         super(LxGenPDSummary, self).__init__('lx-genpd-summary', gdb.COMMAND_DATA)
 45                                                    45 
 46     def summary_one(self, genpd):                  46     def summary_one(self, genpd):
 47         if genpd['status'] == 0:                   47         if genpd['status'] == 0:
 48             status_string = 'on'                   48             status_string = 'on'
 49         else:                                      49         else:
 50             status_string = 'off-{}'.format(ge     50             status_string = 'off-{}'.format(genpd['state_idx'])
 51                                                    51 
 52         child_names = []                           52         child_names = []
 53         for link in list_for_each_entry(           53         for link in list_for_each_entry(
 54                 genpd['parent_links'],             54                 genpd['parent_links'],
 55                 device_link_type.get_type().po     55                 device_link_type.get_type().pointer(),
 56                 'parent_node'):                    56                 'parent_node'):
 57             child_names.append(link['child']['     57             child_names.append(link['child']['name'])
 58                                                    58 
 59         gdb.write('%-30s  %-15s %s\n' % (          59         gdb.write('%-30s  %-15s %s\n' % (
 60                 genpd['name'].string(),            60                 genpd['name'].string(),
 61                 status_string,                     61                 status_string,
 62                 ', '.join(child_names)))           62                 ', '.join(child_names)))
 63                                                    63 
 64         # Print devices in domain                  64         # Print devices in domain
 65         for pm_data in list_for_each_entry(gen     65         for pm_data in list_for_each_entry(genpd['dev_list'],
 66                         pm_domain_data_type.ge     66                         pm_domain_data_type.get_type().pointer(),
 67                         'list_node'):              67                         'list_node'):
 68             dev = pm_data['dev']                   68             dev = pm_data['dev']
 69             kobj_path = kobject_get_path(dev['     69             kobj_path = kobject_get_path(dev['kobj'])
 70             gdb.write('    %-50s  %s\n' % (kob     70             gdb.write('    %-50s  %s\n' % (kobj_path, rtpm_status_str(dev)))
 71                                                    71 
 72     def invoke(self, arg, from_tty):               72     def invoke(self, arg, from_tty):
 73         if gdb_eval_or_none("&gpd_list") is No << 
 74             raise gdb.GdbError("No power domai << 
 75         gdb.write('domain                          73         gdb.write('domain                          status          children\n');
 76         gdb.write('    /device                     74         gdb.write('    /device                                             runtime status\n');
 77         gdb.write('---------------------------     75         gdb.write('----------------------------------------------------------------------\n');
 78         for genpd in list_for_each_entry(          76         for genpd in list_for_each_entry(
 79                 gdb.parse_and_eval('&gpd_list'     77                 gdb.parse_and_eval('&gpd_list'),
 80                 generic_pm_domain_type.get_typ     78                 generic_pm_domain_type.get_type().pointer(),
 81                 'gpd_list_node'):                  79                 'gpd_list_node'):
 82             self.summary_one(genpd)                80             self.summary_one(genpd)
 83                                                    81 
 84                                                    82 
 85 LxGenPDSummary()                                   83 LxGenPDSummary()
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php