mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
Organize companion code and materials by book part: part-01/ Foundations part-02/ Kernel & driver fundamentals part-03/ Character & block devices part-04/ Networking & storage part-05/ Buses & advanced topics part-06/ Debugging & performance part-07/ Real-world drivers appendices/ Supplementary material README.md Overview and build instructions
23 lines
537 B
Bash
Executable file
23 lines
537 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# pci_dump_config.sh -- dump the first 64 bytes of PCI configuration
|
|
# space for the named device in a readable 4-byte-per-row format.
|
|
#
|
|
# Usage: ./pci_dump_config.sh <selector>
|
|
#
|
|
# Example: ./pci_dump_config.sh myfirst0
|
|
# ./pci_dump_config.sh pci0:0:4:0
|
|
|
|
set -eu
|
|
|
|
SEL="${1:-myfirst0}"
|
|
|
|
printf 'PCI configuration space for %s:\n' "$SEL"
|
|
printf 'offset value\n'
|
|
|
|
off=0
|
|
while [ "$off" -lt 64 ]; do
|
|
printf '0x%02x %s\n' "$off" \
|
|
"$(pciconf -r "$SEL" "${off}:4" | tr -d ' \n')"
|
|
off=$((off + 4))
|
|
done
|