Lines Matching full:self

22     def __init__(self, elf, sym):  argument
23 self.elf = elf
24 self.sym = sym
25 self.data = self.elf.symbol_data(sym)
27 def __lt__(self, other): argument
28 return self.sym.entry.st_value < other.sym.entry.st_value
30 def _data_native_read(self, offset): argument
31 (format, size) = self.elf.native_struct_format
32 return struct.unpack(format, self.data[offset:offset + size])[0]
43 def __init__(self, elf, sym): argument
45 self.flags = self._data_native_read(self.elf.ld_consts['_PM_DEVICE_STRUCT_FLAGS_OFFSET'])
48 def is_power_domain(self): argument
49 return self.flags & (1 << self.elf.ld_consts["_PM_DEVICE_FLAG_PD"])
59 def __init__(self, elf, sym): argument
61 format = "<" if self.elf.little_endian else ">"
62 format += "{:d}h".format(len(self.data) // 2)
63 self._ordinals = struct.unpack(format, self.data)
64 self._ordinals_split = []
68 for idx, val in enumerate(self._ordinals, 1):
69 if val == self.DEVICE_HANDLE_SEP:
70 self._ordinals_split.append(self._ordinals[prev:idx-1])
72 self._ordinals_split.append(self._ordinals[prev:])
75 def self_ordinal(self): argument
76 return self._ordinals[0]
79 def ordinals(self): argument
80 return self._ordinals_split
91 def __init__(self, elf, sym): argument
93 self.edt_node = None
94 self.handle = None
95 self.ordinals = None
96 self.pm = None
99 self.devs_depends_on = set()
100 self.devs_depends_on_injected = set()
101 self.devs_supports = set()
106 self.obj_ordinals = None
107 if '_DEVICE_STRUCT_HANDLES_OFFSET' in self.elf.ld_consts:
108 ordinal_offset = self.elf.ld_consts['_DEVICE_STRUCT_HANDLES_OFFSET']
109 self.obj_ordinals = self._data_native_read(ordinal_offset)
111 self.obj_pm = None
112 if '_DEVICE_STRUCT_PM_OFFSET' in self.elf.ld_consts:
113 pm_offset = self.elf.ld_consts['_DEVICE_STRUCT_PM_OFFSET']
114 self.obj_pm = self._data_native_read(pm_offset)
117 def ordinal(self): argument
118 return self.ordinals.self_ordinal
124 def __init__(self, kernel, edt, device_start_symbol): argument
125 self.elf = ELFFile(open(kernel, "rb"))
126 self.relocatable = self.elf['e_type'] == 'ET_REL'
127 self.edt = edt
128 self.devices = []
129self.ld_consts = self._symbols_find_value(set([device_start_symbol, *Device.required_ld_consts, *D…
130 self._device_parse_and_link()
133 def little_endian(self): argument
137 return self.elf.little_endian
140 def native_struct_format(self): argument
144 format = "<" if self.little_endian else ">"
145 if self.elf.elfclass == 32:
153 def symbol_data(self, sym): argument
161 section = self.elf.get_section(sym.entry['st_shndx'])
164 offset = addr - (0 if self.relocatable else section['sh_addr'])
170 def _symbols_find_value(self, names): argument
172 for section in self.elf.iter_sections():
179 def _object_find_named(self, prefix, cb): argument
180 for section in self.elf.iter_sections():
188 def _link_devices(self, devices): argument
192 root = self.edt.dep_ord2node[0]
195 n = self.edt.dep_ord2node[ord]
218 def _link_injected(self, devices): argument
226 def _device_parse_and_link(self): argument
230 pm_structs[sym.entry.st_value] = DevicePM(self, sym)
231 self._object_find_named('__pm_device_', _on_pm)
236 ordinal_arrays[sym.entry.st_value] = DeviceOrdinals(self, sym)
237 self._object_find_named('__devicedeps_', _on_ordinal)
241 self.devices.append(Device(self, sym))
242 self._object_find_named('__device_', _on_device)
245 self.devices = sorted(self.devices)
248 for idx, dev in enumerate(self.devices):
252 for dev in self.devices:
258 dev.edt_node = self.edt.dep_ord2node[dev.ordinal]
261 devices_by_ord = {d.ordinal: d for d in self.devices if d.edt_node}
264 self._link_devices(devices_by_ord)
267 self._link_injected(devices_by_ord)
269 def device_dependency_graph(self, title, comment): argument
276 for dev in self.devices:
280 n = self.edt.dep_ord2node[dev.ordinal]
285 for dev in self.devices: