Skip to content

Commit

Permalink
Pcieutil to load the platform api first instead of using common api (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
sujinmkang authored Jun 28, 2021
1 parent 7a82c06 commit 186d851
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pcieutil/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,18 @@ def load_platform_pcieutil():
global platform_path

# Load platform module from source
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
try:
platform_path, _ = device_info.get_paths_to_platform_and_hwsku_dirs()
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_path)
from sonic_platform.pcie import Pcie
platform_pcieutil = Pcie(platform_path)
except ImportError as e:
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e
log.log_warning("Failed to load platform Pcie module. Error : {}, fallback to load Pcie common utility.".format(str(e)), True)
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
platform_pcieutil = PcieUtil(platform_path)
except ImportError as e:
log.log_error("Failed to load default PcieUtil module. Error : {}".format(str(e)), True)
raise e


# ==================== CLI commands and groups ====================
Expand Down

0 comments on commit 186d851

Please sign in to comment.