Add PCI device enumeration and configuration utilities
This commit introduces a new PCI library and associated tools for inspecting and modifying PCI configuration space via Linux sysfs. The following changes were made: - Implemented `pci.c` and `pci.h` for PCI device management, including enumeration, attribute reading, and configuration space access. - Added `setpci` command-line utility for reading and writing PCI configuration registers, with support for filtering devices by vendor, device, and slot. - Created manual pages for `setpci` to document its usage and options. - Developed test scripts for both `lspci` and `setpci` to ensure functionality and correctness of the new features. These additions enhance the ability to interact with PCI devices, providing a robust framework for device management and configuration.
This commit is contained in:
+14
-3
@@ -104,6 +104,14 @@ xargs_src = files(
|
||||
|
||||
xargs_inc = include_directories('src/xargs')
|
||||
|
||||
pci_src = files(
|
||||
'src/pci/pci.c',
|
||||
'src/pci/lspci.c',
|
||||
'src/pci/setpci.c',
|
||||
)
|
||||
|
||||
pci_inc = include_directories('src/pci')
|
||||
|
||||
gzip_defines = [
|
||||
'-DNO_BZIP2_SUPPORT',
|
||||
'-DNO_ZSTD_SUPPORT',
|
||||
@@ -128,8 +136,9 @@ vx = executable('vx',
|
||||
find_src,
|
||||
getdate_gen,
|
||||
xargs_src,
|
||||
pci_src,
|
||||
compat_src,
|
||||
include_directories : [compat_inc, gzip_inc, grep_inc, find_inc, xargs_inc],
|
||||
include_directories : [compat_inc, gzip_inc, grep_inc, find_inc, xargs_inc, pci_inc],
|
||||
c_args : compat_args + gzip_defines,
|
||||
dependencies : [libm, libz, liblzma, libacl],
|
||||
install : true,
|
||||
@@ -137,7 +146,7 @@ vx = executable('vx',
|
||||
|
||||
# Create symlinks for all applets pointing to the vx binary
|
||||
bindir = get_option('bindir')
|
||||
foreach name : ['patch', 'diff', 'cmp', 'diff3', 'sdiff', 'which', 'gzip', 'gunzip', 'zcat', 'uncompress', 'grep', 'egrep', 'fgrep', 'rgrep', 'find', 'xargs']
|
||||
foreach name : ['patch', 'diff', 'cmp', 'diff3', 'sdiff', 'which', 'gzip', 'gunzip', 'zcat', 'uncompress', 'grep', 'egrep', 'fgrep', 'rgrep', 'find', 'xargs', 'lspci', 'setpci']
|
||||
meson.add_install_script('sh', '-c',
|
||||
'ln -sf vx "$MESON_INSTALL_DESTDIR_PREFIX/' + bindir + '/' + name + '"',
|
||||
)
|
||||
@@ -161,6 +170,8 @@ install_man(
|
||||
'src/grep/grep.1',
|
||||
'src/find/find.1',
|
||||
'src/xargs/xargs.1',
|
||||
'src/pci/lspci.8',
|
||||
'src/pci/setpci.8',
|
||||
)
|
||||
|
||||
# --- Gzip shell script utilities ---
|
||||
@@ -182,7 +193,7 @@ endforeach
|
||||
test_env = environment()
|
||||
test_env.set('VX', vx.full_path())
|
||||
|
||||
foreach t : ['test_patch', 'test_diff', 'test_cmp', 'test_diff3', 'test_sdiff', 'test_which', 'test_gzip', 'test_grep', 'test_find', 'test_xargs']
|
||||
foreach t : ['test_patch', 'test_diff', 'test_cmp', 'test_diff3', 'test_sdiff', 'test_which', 'test_gzip', 'test_grep', 'test_find', 'test_xargs', 'test_lspci', 'test_setpci']
|
||||
test(t, find_program('tests/' + t + '.sh'),
|
||||
env : test_env,
|
||||
depends : vx,
|
||||
|
||||
Reference in New Issue
Block a user