Lines Matching refs: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 _data_native_read(self, offset): argument
28 (format, size) = self.elf.native_struct_format
29 return struct.unpack(format, self.data[offset:offset + size])[0]
40 def __init__(self, elf, sym): argument
42 self.flags = self._data_native_read(self.elf.ld_consts['_PM_DEVICE_STRUCT_FLAGS_OFFSET'])
45 def is_power_domain(self): argument
46 return self.flags & (1 << self.elf.ld_consts["_PM_DEVICE_FLAG_PD"])
56 def __init__(self, elf, sym): argument
58 format = "<" if self.elf.little_endian else ">"
59 format += "{:d}h".format(len(self.data) // 2)
60 self._ordinals = struct.unpack(format, self.data)
61 self._ordinals_split = []
65 for idx, val in enumerate(self._ordinals, 1):
66 if val == self.DEVICE_HANDLE_SEP:
67 self._ordinals_split.append(self._ordinals[prev:idx-1])
69 self._ordinals_split.append(self._ordinals[prev:])
72 def self_ordinal(self): argument
73 return self._ordinals[0]
76 def ordinals(self): argument
77 return self._ordinals_split
88 def __init__(self, elf, sym): argument
90 self.edt_node = None
91 self.handle = None
92 self.ordinals = None
93 self.pm = None
96 self.devs_depends_on = set()
97 self.devs_depends_on_injected = set()
98 self.devs_supports = set()
103 self.obj_ordinals = None
104 if '_DEVICE_STRUCT_HANDLES_OFFSET' in self.elf.ld_consts:
105 ordinal_offset = self.elf.ld_consts['_DEVICE_STRUCT_HANDLES_OFFSET']
106 self.obj_ordinals = self._data_native_read(ordinal_offset)
108 self.obj_pm = None
109 if '_DEVICE_STRUCT_PM_OFFSET' in self.elf.ld_consts:
110 pm_offset = self.elf.ld_consts['_DEVICE_STRUCT_PM_OFFSET']
111 self.obj_pm = self._data_native_read(pm_offset)
114 def ordinal(self): argument
115 return self.ordinals.self_ordinal
121 def __init__(self, kernel, edt, device_start_symbol): argument
122 self.elf = ELFFile(open(kernel, "rb"))
123 self.relocatable = self.elf['e_type'] == 'ET_REL'
124 self.edt = edt
125 self.devices = []
126 …self.ld_consts = self._symbols_find_value(set([device_start_symbol, *Device.required_ld_consts, *D…
127 self._device_parse_and_link()
130 def little_endian(self): argument
134 return self.elf.little_endian
137 def native_struct_format(self): argument
141 format = "<" if self.little_endian else ">"
142 if self.elf.elfclass == 32:
150 def symbol_data(self, sym): argument
158 section = self.elf.get_section(sym.entry['st_shndx'])
161 offset = addr - (0 if self.relocatable else section['sh_addr'])
167 def _symbols_find_value(self, names): argument
169 for section in self.elf.iter_sections():
176 def _object_find_named(self, prefix, cb): argument
177 for section in self.elf.iter_sections():
185 def _link_devices(self, devices): argument
189 root = self.edt.dep_ord2node[0]
192 n = self.edt.dep_ord2node[ord]
215 def _link_injected(self, devices): argument
223 def _device_parse_and_link(self): argument
227 pm_structs[sym.entry.st_value] = DevicePM(self, sym)
228 self._object_find_named('__pm_device_', _on_pm)
233 ordinal_arrays[sym.entry.st_value] = DeviceOrdinals(self, sym)
234 self._object_find_named('__devicedeps_', _on_ordinal)
238 self.devices.append(Device(self, sym))
239 self._object_find_named('__device_', _on_device)
242 self.devices = sorted(self.devices, key = lambda k: k.sym.entry.st_value)
245 for idx, dev in enumerate(self.devices):
249 for dev in self.devices:
255 dev.edt_node = self.edt.dep_ord2node[dev.ordinal]
258 devices_by_ord = {d.ordinal: d for d in self.devices if d.edt_node}
261 self._link_devices(devices_by_ord)
264 self._link_injected(devices_by_ord)
266 def device_dependency_graph(self, title, comment): argument
273 for dev in self.devices:
277 n = self.edt.dep_ord2node[dev.ordinal]
282 for dev in self.devices: