diff options
author | Simon Glass | 2021-02-03 06:00:53 -0700 |
---|---|---|
committer | Simon Glass | 2021-03-22 19:23:27 +1300 |
commit | c8b19b0694014ac4423558f4e65937791fd6d574 (patch) | |
tree | 34e94be3da0159bf5501bd771e1e781f7a267a66 /tools/dtoc/src_scan.py | |
parent | 36b2220cbd62c7829b8e845777318f323a963e47 (diff) |
dtoc: Collect priv/plat struct info from drivers
In order to output variables to hold the priv/plat information used by
each device, dtoc needs to know the struct for each. With this, it can
declare this at build time:
u8 xxx_priv [sizeof(struct <name>)];
Collect the various struct names from the drivers.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/src_scan.py')
-rw-r--r-- | tools/dtoc/src_scan.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/tools/dtoc/src_scan.py b/tools/dtoc/src_scan.py index 761164a9c9a..ff3ab409e4b 100644 --- a/tools/dtoc/src_scan.py +++ b/tools/dtoc/src_scan.py @@ -61,6 +61,11 @@ class Driver: value: Driver data, e,g, 'ROCKCHIP_SYSCON_GRF', or None fname: Filename where the driver was found priv (str): struct name of the priv_auto member, e.g. 'serial_priv' + plat (str): struct name of the plat_auto member, e.g. 'serial_plat' + child_priv (str): struct name of the per_child_auto member, + e.g. 'pci_child_priv' + child_plat (str): struct name of the per_child_plat_auto member, + e.g. 'pci_child_plat' """ def __init__(self, name, fname): self.name = name @@ -68,12 +73,16 @@ class Driver: self.uclass_id = None self.compat = None self.priv = '' + self.plat = '' + self.child_priv = '' + self.child_plat = '' def __eq__(self, other): return (self.name == other.name and self.uclass_id == other.uclass_id and self.compat == other.compat and - self.priv == other.priv) + self.priv == other.priv and + self.plat == other.plat) def __repr__(self): return ("Driver(name='%s', uclass_id='%s', compat=%s, priv=%s)" % @@ -230,8 +239,11 @@ class Scanner: re_of_match = re.compile( r'\.of_match\s*=\s*(of_match_ptr\()?([a-z0-9_]+)(\))?,') - # Matches the struct name for priv + # Matches the struct name for priv, plat re_priv = self._get_re_for_member('priv_auto') + re_plat = self._get_re_for_member('plat_auto') + re_child_priv = self._get_re_for_member('per_child_auto') + re_child_plat = self._get_re_for_member('per_child_plat_auto') prefix = '' for line in buff.splitlines(): @@ -250,8 +262,17 @@ class Scanner: m_id = re_id.search(line) m_of_match = re_of_match.search(line) m_priv = re_priv.match(line) + m_plat = re_plat.match(line) + m_cplat = re_child_plat.match(line) + m_cpriv = re_child_priv.match(line) if m_priv: driver.priv = m_priv.group(1) + elif m_plat: + driver.plat = m_plat.group(1) + elif m_cplat: + driver.child_plat = m_cplat.group(1) + elif m_cpriv: + driver.child_priv = m_cpriv.group(1) elif m_id: driver.uclass_id = m_id.group(1) elif m_of_match: |