Skip to content

Commit

Permalink
Add to check pcie configuration revision to get the right configurati…
Browse files Browse the repository at this point in the history
…on. (#195)

Platform vendor can add their own logic to determine the pcie
conifiguration revision.
  • Loading branch information
sujinmkang committed Jun 14, 2021
1 parent 4e3a0a0 commit f57fee4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sonic_platform_base/sonic_pcie/pcie_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,12 @@ class PcieUtil(PcieBase):
# got the config file path
def __init__(self, path):
self.config_path = path
self._conf_rev = None

# load the config file
def load_config_file(self):
config_file = self.config_path + "/" + "pcie.yaml"
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
try:
with open(config_file) as conf_file:
self.confInfo = yaml.load(conf_file)
Expand Down Expand Up @@ -137,6 +139,8 @@ def get_pcie_aer_stats(self, domain=0, bus=0, device=0, func=0):
# generate the config file with current pci device
def dump_conf_yaml(self):
curInfo = self.get_pcie_device()
with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file:
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
with open(config_file, "w") as conf_file:
yaml.dump(curInfo, conf_file, default_flow_style=False)
return

0 comments on commit f57fee4

Please sign in to comment.