Skip to content

Commit b0dad8c

Browse files
sujinmkangqiluo-msft
authored andcommitted
Add to check pcie configuration revision to get the right configuration. (#195)
Platform vendor can add their own logic to determine the pcie conifiguration revision.
1 parent f66ffc3 commit b0dad8c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

sonic_platform_base/sonic_pcie/pcie_common.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,12 @@ class PcieUtil(PcieBase):
1919
# got the config file path
2020
def __init__(self, path):
2121
self.config_path = path
22+
self._conf_rev = None
2223

2324
# load the config file
2425
def load_config_file(self):
25-
config_file = self.config_path + "/" + "pcie.yaml"
26+
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
27+
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
2628
try:
2729
with open(config_file) as conf_file:
2830
self.confInfo = yaml.load(conf_file)
@@ -137,6 +139,8 @@ def get_pcie_aer_stats(self, domain=0, bus=0, device=0, func=0):
137139
# generate the config file with current pci device
138140
def dump_conf_yaml(self):
139141
curInfo = self.get_pcie_device()
140-
with open(self.config_path + "/" + "pcie.yaml", "w") as conf_file:
142+
conf_rev = "_{}".format(self._conf_rev) if self._conf_rev else ""
143+
config_file = "{}/pcie{}.yaml".format(self.config_path, conf_rev)
144+
with open(config_file, "w") as conf_file:
141145
yaml.dump(curInfo, conf_file, default_flow_style=False)
142146
return

0 commit comments

Comments
 (0)