mirror of
https://github.com/AsahiLinux/m1n1
synced 2024-11-26 08:20:18 +00:00
m1n1.fw.aop: Move bootargs helpers to new class AOPBase
The new class can possibly be shared between the m1n1 AOP tracer and AOP client. Signed-off-by: Martin Povišer <povik@protonmail.com>
This commit is contained in:
parent
6ad59beb0c
commit
2bacc044e8
2 changed files with 31 additions and 27 deletions
|
@ -36,7 +36,8 @@ class AOPOSLogEndpoint(ASCBaseEndpoint):
|
|||
self.started = True
|
||||
return True
|
||||
|
||||
class AOPClient(StandardASC):
|
||||
|
||||
class AOPClient(StandardASC, AOPBase):
|
||||
ENDPOINTS = {
|
||||
8: AOPOSLogEndpoint,
|
||||
|
||||
|
@ -54,34 +55,10 @@ class AOPClient(StandardASC):
|
|||
def __init__(self, u, adtpath, dart=None):
|
||||
node = u.adt[adtpath]
|
||||
self.base = node.get_reg(0)[0]
|
||||
self.fw_base, self.fw_len = node.get_reg(2)
|
||||
|
||||
if u.adt["arm-io"].compatible[0] == "arm-io,t6000":
|
||||
# argh
|
||||
self.fw_base -= 0x2_0000_0000
|
||||
|
||||
AOPBase.__init__(self, u, node)
|
||||
super().__init__(u, self.base, dart)
|
||||
|
||||
@property
|
||||
def _bootargs_span(self):
|
||||
base = self.fw_base + self.p.read32(self.fw_base + 0x224)
|
||||
length = self.p.read32(self.fw_base + 0x228)
|
||||
|
||||
return (base, length)
|
||||
|
||||
def read_bootargs(self):
|
||||
blob = self.iface.readmem(*self._bootargs_span)
|
||||
return ASCArgumentSection(blob)
|
||||
|
||||
def write_bootargs(self, args):
|
||||
base, _ = self._bootargs_span
|
||||
self.iface.writemem(base, args.to_bytes())
|
||||
|
||||
def update_bootargs(self, keyvals):
|
||||
args = self.read_bootargs()
|
||||
args.update(keyvals)
|
||||
self.write_bootargs(args)
|
||||
|
||||
p.dapf_init_all()
|
||||
|
||||
dart = DART.from_adt(u, "/arm-io/dart-aop")
|
||||
|
|
|
@ -1,4 +1,31 @@
|
|||
# SPDX-License-Identifier: MIT
|
||||
from .bootargs import ASCArgumentSection
|
||||
|
||||
__all__ = ["ASCArgumentSection"]
|
||||
class AOPBase:
|
||||
def __init__(self, u, adtnode):
|
||||
self.fw_base, self.fw_len = adtnode.get_reg(2)
|
||||
if u.adt["arm-io"].compatible[0] == "arm-io,t6000":
|
||||
# argh
|
||||
self.fw_base -= 0x2_0000_0000
|
||||
|
||||
@property
|
||||
def _bootargs_span(self):
|
||||
base = self.fw_base + self.p.read32(self.fw_base + 0x224)
|
||||
length = self.p.read32(self.fw_base + 0x228)
|
||||
|
||||
return (base, length)
|
||||
|
||||
def read_bootargs(self):
|
||||
blob = self.iface.readmem(*self._bootargs_span)
|
||||
return ASCArgumentSection(blob)
|
||||
|
||||
def write_bootargs(self, args):
|
||||
base, _ = self._bootargs_span
|
||||
self.iface.writemem(base, args.to_bytes())
|
||||
|
||||
def update_bootargs(self, keyvals):
|
||||
args = self.read_bootargs()
|
||||
args.update(keyvals)
|
||||
self.write_bootargs(args)
|
||||
|
||||
__all__ = ["ASCArgumentSection", "AOPBase"]
|
||||
|
|
Loading…
Reference in a new issue