-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add pcie-check service to check PCIe devices at boot #4771
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
736e2e1
PCIe Monitor service
sujinmkang 95bc36b
Add rescan to pcie-mon.service when it fails to get all pcie devices
sujinmkang c938619
space
sujinmkang a6fa285
Clean up
sujinmkang d9ca93b
review comments
sujinmkang 365552b
update the pcie status in state db
sujinmkang 78604b9
update the failed pcie status once at the end
sujinmkang 09472f7
Update the pcie_status in STATE_DB and rename the service
sujinmkang d7f2d50
Add log to exit the service if the configuration file doesn't exist.
sujinmkang f096d2c
fix the build failure
sujinmkang 1604ef8
Redo the pcie rescan for pcie-check failed case.
sujinmkang c406a26
review comments
sujinmkang 61eb853
review comments
sujinmkang a25a5a6
review comments
sujinmkang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [Unit] | ||
| Description=Start the pcie-chk.service in 10 seconds after boot | ||
|
|
||
| [Timer] | ||
| OnBootSec=10sec | ||
| Unit=pcie-chk.service | ||
|
|
||
| [Install] | ||
| WantedBy=timers.target |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| [Unit] | ||
| Description=Check the PCIe device presence and status | ||
| After=rc.local.service | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| ExecStart=/usr/bin/pcie-chk.sh | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #! /bin/bash | ||
| ## Check the platform PCIe device presence and status | ||
|
|
||
| VERBOSE="no" | ||
| RESULTS="PCIe Device Checking All Test" | ||
| PCIE_CHK_CMD=`sudo pcieutil pcie-check |grep "$RESULTS"` | ||
| EXPECTED="PCIe Device Checking All Test ----------->>> PASSED" | ||
| MAX_RESCAN=15 | ||
|
|
||
| function debug() | ||
| { | ||
| /usr/bin/logger "$0 : $1" | ||
| if [[ x"${VERBOSE}" == x"yes" ]]; then | ||
| echo "$(date) $0: $1" | ||
| fi | ||
| } | ||
|
|
||
| function check_and_rescan_pcie_devices() | ||
| { | ||
| for i in $(seq 1 1 $MAX_RESCAN) | ||
| do | ||
| if [ "$PCIE_CHK_CMD" = "$EXPECTED" ]; then | ||
| debug "PCIe check passed" | ||
| exit | ||
| else | ||
| debug "PCIe check failed, try pci bus rescan" | ||
| echo 1 > /sys/bus/pci/rescan | ||
| fi | ||
| sleep 1 | ||
| done | ||
| } | ||
|
|
||
| check_and_rescan_pcie_devices |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.