Skip to content

Commit 186d851

Browse files
authored
Pcieutil to load the platform api first instead of using common api (#1672)
What I did Pcieutil to load the platform api first instead of using common api Some platform device with different BIOS version needs more than one pcie configuration to check the pcie devices properly. Please refer to the platform api support : sonic-net/sonic-platform-common#195 How I did it Load the platform pcie api first prior to use the common api
1 parent 7a82c06 commit 186d851

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pcieutil/main.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,18 @@ def load_platform_pcieutil():
4949
global platform_path
5050

5151
# Load platform module from source
52+
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
5253
try:
53-
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
54-
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
55-
platform_pcieutil = PcieUtil(platform_path)
54+
from sonic_platform.pcie import Pcie
55+
platform_pcieutil = Pcie(platform_path)
5656
except ImportError as e:
57-
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
58-
raise e
57+
log.log_warning("Failed to load platform Pcie module. Error : {}, fallback to load Pcie common utility.".format(str(e)), True)
58+
try:
59+
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
60+
platform_pcieutil = PcieUtil(platform_path)
61+
except ImportError as e:
62+
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
63+
raise e
5964

6065

6166
# ==================== CLI commands and groups ====================

0 commit comments

Comments
 (0)