File tree Expand file tree Collapse file tree 3 files changed +34
-17
lines changed
Expand file tree Collapse file tree 3 files changed +34
-17
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,6 @@ function stopplatform2() {
136136 if [[ x" $WARM_BOOT " != x" true" ]]; then
137137 if [ x$sonic_asic_platform == x' mellanox' ]; then
138138 /etc/init.d/sxdkernel stop
139- /usr/bin/mst stop
140139 elif [ x" $sonic_asic_platform " == x" nvidia-bluefield" ]; then
141140 /usr/bin/bfnet.sh stop
142141 fi
Original file line number Diff line number Diff line change 1919
2020SUCCESS_CODE=0
2121RC=-1
22+ RETURN_PCI_ID=false
2223
23- if [[ -f " /usr/bin/asic_detect/asic_type" ]]; then
24- cat /usr/bin/asic_detect/asic_type
24+ # Parse command line arguments
25+ while getopts " p" opt; do
26+ case $opt in
27+ p)
28+ RETURN_PCI_ID=true
29+ ;;
30+ * )
31+ ;;
32+ esac
33+ done
34+
35+ if [[ -f " /usr/bin/asic_detect/asic_type" ]] && [[ -f " /usr/bin/asic_detect/asic_pci_id" ]]; then
36+ if [[ " $RETURN_PCI_ID " == true ]]; then
37+ cat /usr/bin/asic_detect/asic_pci_id
38+ else
39+ cat /usr/bin/asic_detect/asic_type
40+ fi
2541 exit $SUCCESS_CODE
2642fi
2743
@@ -37,6 +53,7 @@ declare -A DEVICE_DICT=(
3753TYPE_UNKNOWN=" unknown"
3854VENDOR_ID=" 15b3"
3955DEVICE_TYPE=$TYPE_UNKNOWN
56+ DEVICE_PCI_ID=" "
4057
4158# bf3 should be the last device in the list
4259DEVICE_ORDER=(" cb84" " cf6c" " cf70" " cf80" " cf82" " a2dc" )
@@ -46,12 +63,21 @@ if [[ -n "$lspci_output" ]]; then
4663 for key in " ${DEVICE_ORDER[@]} " ; do
4764 if echo " $lspci_output " | grep " $VENDOR_ID :$key " & > /dev/null; then
4865 DEVICE_TYPE=" ${DEVICE_DICT[$key]} "
66+ DEVICE_PCI_ID=$( echo " $lspci_output " | grep " $VENDOR_ID :$key " | awk ' {print $1}' )
4967 RC=$SUCCESS_CODE
5068 break
5169 fi
5270 done
5371 if [[ -n " $DEVICE_TYPE " ]]; then
54- echo " $DEVICE_TYPE " | tee >( [[ " $DEVICE_TYPE " != " $TYPE_UNKNOWN " ]] && cat > /usr/bin/asic_detect/asic_type )
72+ if [[ " $RETURN_PCI_ID " == true ]]; then
73+ echo " $DEVICE_PCI_ID "
74+ else
75+ echo " $DEVICE_TYPE "
76+ fi
77+ if [[ " $DEVICE_TYPE " != " $TYPE_UNKNOWN " ]] && [[ -n " $DEVICE_PCI_ID " ]]; then
78+ echo " $DEVICE_TYPE " > /usr/bin/asic_detect/asic_type
79+ echo " $DEVICE_PCI_ID " > /usr/bin/asic_detect/asic_pci_id
80+ fi
5581 fi
5682 exit $RC
5783fi
Original file line number Diff line number Diff line change @@ -90,9 +90,9 @@ function PrintHelp() {
9090 echo "Examples:"
9191 echo " ./${SCRIPT_NAME} --verbose"
9292 echo " ./${SCRIPT_NAME} --upgrade"
93- echo " ./${SCRIPT_NAME} --no-mst"
9493{% if sonic_asic_platform == "nvidia-bluefield" %}
9594 echo " ./${SCRIPT_NAME} --reset"
95+ echo " ./${SCRIPT_NAME} --no-mst"
9696{% endif %}
9797 echo " ./${SCRIPT_NAME} --help"
9898 echo
@@ -239,10 +239,6 @@ function WaitForDevice() {
239239 if [[ "${NO_MST}" != "${YES_PARAM}" ]]; then
240240 LogInfo "Restarting MST device"
241241 /usr/bin/mst restart --with_i2cdev
242- ERROR_CODE="$?"
243- if [[ "${ERROR_CODE}" != "${EXIT_SUCCESS}" ]]; then
244- ExitFailure "MST device restart failed with error: ${ERROR_CODE}"
245- fi
246242 fi
247243
248244 while : ; do
@@ -266,15 +262,11 @@ function WaitForDevice() {
266262}
267263
268264function GetSPCMstDevice() {
269- local _DEVICE_TYPE=$(GetMstDeviceType)
270- local _MST_DEVICE=$(${QUERY_XML} | xmlstarlet sel -t -m "//Device[contains(@type,'${_DEVICE_TYPE}')]" -v @pciName | head -n 1)
271-
272- if [[ ! -c "${_MST_DEVICE}" ]]; then
273- echo "${UNKN_MST}"
274- else
275- echo "${_MST_DEVICE}"
265+ local -r _ASIC_PCI_ID="$(/usr/bin/asic_detect/asic_detect.sh -p)"
266+ if [[ "${_ASIC_PCI_ID}" = "${UNKN_PCI_ID}" ]]; then
267+ ExitFailure "failed to detect ASIC PCI ID"
276268 fi
277-
269+ echo "${_ASIC_PCI_ID}"
278270 exit "${EXIT_SUCCESS}"
279271}
280272
You can’t perform that action at this time.
0 commit comments