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

TOMOYO Linux Cross Reference
Linux/scripts/gdb/linux/clk.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/clk.py (Version linux-6.12-rc7) and /scripts/gdb/linux/clk.py (Version linux-6.7.12)


  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 import utils, lists, constants           8 from linux import utils, lists, constants
  9                                                     9 
 10 clk_core_type = utils.CachedType("struct clk_c     10 clk_core_type = utils.CachedType("struct clk_core")
 11                                                    11 
 12                                                    12 
 13 def clk_core_for_each_child(hlist_head):           13 def clk_core_for_each_child(hlist_head):
 14     return lists.hlist_for_each_entry(hlist_he     14     return lists.hlist_for_each_entry(hlist_head,
 15             clk_core_type.get_type().pointer()     15             clk_core_type.get_type().pointer(), "child_node")
 16                                                    16 
 17                                                    17 
 18 class LxClkSummary(gdb.Command):                   18 class LxClkSummary(gdb.Command):
 19     """Print clk tree summary                      19     """Print clk tree summary
 20                                                    20 
 21 Output is a subset of /sys/kernel/debug/clk/cl     21 Output is a subset of /sys/kernel/debug/clk/clk_summary
 22                                                    22 
 23 No calls are made during printing, instead a (     23 No calls are made during printing, instead a (c) if printed after values which
 24 are cached and potentially out of date"""          24 are cached and potentially out of date"""
 25                                                    25 
 26     def __init__(self):                            26     def __init__(self):
 27         super(LxClkSummary, self).__init__("lx     27         super(LxClkSummary, self).__init__("lx-clk-summary", gdb.COMMAND_DATA)
 28                                                    28 
 29     def show_subtree(self, clk, level):            29     def show_subtree(self, clk, level):
 30         gdb.write("%*s%-*s %7d %8d %8d %11lu%s     30         gdb.write("%*s%-*s %7d %8d %8d %11lu%s\n" % (
 31                 level * 3 + 1, "",                 31                 level * 3 + 1, "",
 32                 30 - level * 3,                    32                 30 - level * 3,
 33                 clk['name'].string(),              33                 clk['name'].string(),
 34                 clk['enable_count'],               34                 clk['enable_count'],
 35                 clk['prepare_count'],              35                 clk['prepare_count'],
 36                 clk['protect_count'],              36                 clk['protect_count'],
 37                 clk['rate'],                       37                 clk['rate'],
 38                 '(c)' if clk['flags'] & consta     38                 '(c)' if clk['flags'] & constants.LX_CLK_GET_RATE_NOCACHE else '   '))
 39                                                    39 
 40         for child in clk_core_for_each_child(c     40         for child in clk_core_for_each_child(clk['children']):
 41             self.show_subtree(child, level + 1     41             self.show_subtree(child, level + 1)
 42                                                    42 
 43     def invoke(self, arg, from_tty):               43     def invoke(self, arg, from_tty):
 44         if utils.gdb_eval_or_none("clk_root_li     44         if utils.gdb_eval_or_none("clk_root_list") is None:
 45             raise gdb.GdbError("No clocks regi     45             raise gdb.GdbError("No clocks registered")
 46         gdb.write("                                46         gdb.write("                                 enable  prepare  protect               \n")
 47         gdb.write("   clock                        47         gdb.write("   clock                          count    count    count        rate   \n")
 48         gdb.write("---------------------------     48         gdb.write("------------------------------------------------------------------------\n")
 49         for clk in clk_core_for_each_child(gdb     49         for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_root_list")):
 50             self.show_subtree(clk, 0)              50             self.show_subtree(clk, 0)
 51         for clk in clk_core_for_each_child(gdb     51         for clk in clk_core_for_each_child(gdb.parse_and_eval("clk_orphan_list")):
 52             self.show_subtree(clk, 0)              52             self.show_subtree(clk, 0)
 53                                                    53 
 54                                                    54 
 55 LxClkSummary()                                     55 LxClkSummary()
 56                                                    56 
 57                                                    57 
 58 class LxClkCoreLookup(gdb.Function):               58 class LxClkCoreLookup(gdb.Function):
 59     """Find struct clk_core by name"""             59     """Find struct clk_core by name"""
 60                                                    60 
 61     def __init__(self):                            61     def __init__(self):
 62         super(LxClkCoreLookup, self).__init__(     62         super(LxClkCoreLookup, self).__init__("lx_clk_core_lookup")
 63                                                    63 
 64     def lookup_hlist(self, hlist_head, name):      64     def lookup_hlist(self, hlist_head, name):
 65         for child in clk_core_for_each_child(h     65         for child in clk_core_for_each_child(hlist_head):
 66             if child['name'].string() == name:     66             if child['name'].string() == name:
 67                 return child                       67                 return child
 68             result = self.lookup_hlist(child['     68             result = self.lookup_hlist(child['children'], name)
 69             if result:                             69             if result:
 70                 return result                      70                 return result
 71                                                    71 
 72     def invoke(self, name):                        72     def invoke(self, name):
 73         name = name.string()                       73         name = name.string()
 74         return (self.lookup_hlist(gdb.parse_an     74         return (self.lookup_hlist(gdb.parse_and_eval("clk_root_list"), name) or
 75                 self.lookup_hlist(gdb.parse_an     75                 self.lookup_hlist(gdb.parse_and_eval("clk_orphan_list"), name))
 76                                                    76 
 77                                                    77 
 78 LxClkCoreLookup()                                  78 LxClkCoreLookup()
                                                      

~ [ 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