From 8a33372bee65b517850245b55f771e3cd6bba0ff Mon Sep 17 00:00:00 2001 From: Babak Sarashki Date: Thu, 4 Feb 2021 23:21:48 +0000 Subject: [PATCH] Add: PF Baseband Device config application for ACC100 This introduces PF BBDEV (baseband device) Configuration Application "pf_bb_config" and inih. PF BBDEV program accesses the configuration space and sets the various parameters through memory-mapped IO read/writes. This is needed for Intel ACC100 (Mt Bryce) configuration and QMGR related settings. PF BBDEV requires inih for parsing .INI configuration file. This commit adds the inih for static linkage with PF BBDEV. Story: 2008440 Task: 41472 Signed-off-by: Babak Sarashki Change-Id: Idaebcac5d0021d5c11c7ab27e13176139ba66c3b --- base/inih/centos/build_srpm.data | 6 +++ base/inih/centos/inih.spec | 45 +++++++++++++++++ base/pf-bb-config/centos/build_srpm.data | 8 ++++ base/pf-bb-config/centos/pf-bb-config.spec | 44 +++++++++++++++++ ...-device-configuration-if-not-enabled.patch | 48 +++++++++++++++++++ centos_iso_image.inc | 3 ++ centos_pkg_dirs | 2 + centos_tarball-dl.lst | 2 + 8 files changed, 158 insertions(+) create mode 100644 base/inih/centos/build_srpm.data create mode 100644 base/inih/centos/inih.spec create mode 100644 base/pf-bb-config/centos/build_srpm.data create mode 100644 base/pf-bb-config/centos/pf-bb-config.spec create mode 100644 base/pf-bb-config/files/Reject-device-configuration-if-not-enabled.patch diff --git a/base/inih/centos/build_srpm.data b/base/inih/centos/build_srpm.data new file mode 100644 index 000000000..a5b1f6a0e --- /dev/null +++ b/base/inih/centos/build_srpm.data @@ -0,0 +1,6 @@ +TAR_NAME=inih +GIT_SHA=b1dbff4b0bd1e1f40d237e21011f6dee0ec2fa69 +VERSION=44 + +COPY_LIST="$STX_BASE/downloads/$TAR_NAME-$GIT_SHA.tar.gz" +TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/base/inih/centos/inih.spec b/base/inih/centos/inih.spec new file mode 100644 index 000000000..7bc540a76 --- /dev/null +++ b/base/inih/centos/inih.spec @@ -0,0 +1,45 @@ +%global git_sha b1dbff4b0bd1e1f40d237e21011f6dee0ec2fa69 + +Summary: inih +Name: inih +Version: 44 +Release: 0%{?_tis_dist}.%{tis_patch_ver} +License: New BSD +Group: base +Packager: Wind River +URL: https://github.com/benhoyt/inih/releases/tag/r44 +Source0: %{name}-%{git_sha}.tar.gz + +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: ncurses-static +BuildRequires: perl-version + +%define debug_package %{nil} +%description +Simple .INI file parser written in C + +%prep +%setup + +%build +pushd extra > /dev/null +make -f Makefile.static +popd > /dev/null + +%install +install -d -m 755 %{buildroot}%{_libdir} +install -d -m 755 %{buildroot}%{_includedir} +install -d -m 755 %{buildroot}%{_datadir}/inih/ +install -p -D -m 755 extra/libinih.a %{buildroot}%{_libdir}/libinih.a +install -p -D -m 644 ini.h %{buildroot}%{_includedir}/ini.h +install -p -D -m 644 LICENSE.txt %{buildroot}%{_datadir}/inih/LICENSE.txt + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_libdir}/* +%{_includedir}/* +%{_datadir}/* diff --git a/base/pf-bb-config/centos/build_srpm.data b/base/pf-bb-config/centos/build_srpm.data new file mode 100644 index 000000000..0c8ee4668 --- /dev/null +++ b/base/pf-bb-config/centos/build_srpm.data @@ -0,0 +1,8 @@ +TAR_NAME=pf-bb-config +GIT_SHA=791b4f38d15377d4fbb3c9799a652acbc405b088 + +COPY_LIST=" \ + $STX_BASE/downloads/$TAR_NAME-$GIT_SHA.tar.gz \ + $PKG_BASE/files/* \ +" +TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/base/pf-bb-config/centos/pf-bb-config.spec b/base/pf-bb-config/centos/pf-bb-config.spec new file mode 100644 index 000000000..7b0193039 --- /dev/null +++ b/base/pf-bb-config/centos/pf-bb-config.spec @@ -0,0 +1,44 @@ +%global git_sha 791b4f38d15377d4fbb3c9799a652acbc405b088 + +Summary: PF BBDEV (baseband device) Configuration Application. +Name: pf-bb-config +Version: 20.11 +Release: 0%{?_tis_dist}.%{tis_patch_ver} +License: Apache-2.0 +Group: base +Packager: Wind River +URL: https://github.com/intel/pf-bb-config/releases/tag/v20.11 +Source0: %{name}-%{git_sha}.tar.gz +Patch0: Reject-device-configuration-if-not-enabled.patch + +BuildRequires: gcc +BuildRequires: inih + +%define debug_package %{nil} +%description +The PF BBDEV (baseband device) Configuration Application "pf_bb_config" provides a means to +configure the baseband device at the host-level. The program accesses the configuration +space and sets the various parameters through memory-mapped IO read/writes. + +%prep +%setup +%patch0 -p1 + +%build +make + +%install + +install -d -m 755 %{buildroot}%{_bindir} +install -d -m 755 %{buildroot}%{_datadir}/pf-bb-config/acc100 +install -p -D -m 700 pf_bb_config %{buildroot}%{_bindir}/pf_bb_config +install -p -D -m 700 acc100/acc100_config_vf_5g.cfg %{buildroot}%{_datadir}/pf-bb-config/acc100/acc100_config_vf_5g.cfg +install -p -D -m 644 README.md %{buildroot}%{_datadir}/pf-bb-config/README.md + +%clean +rm -rf $RPM_BUILD_ROOT + +%files +%defattr(-,root,root,-) +%{_bindir}/* +%{_datadir}/* diff --git a/base/pf-bb-config/files/Reject-device-configuration-if-not-enabled.patch b/base/pf-bb-config/files/Reject-device-configuration-if-not-enabled.patch new file mode 100644 index 000000000..a9a1813ea --- /dev/null +++ b/base/pf-bb-config/files/Reject-device-configuration-if-not-enabled.patch @@ -0,0 +1,48 @@ +From 8ac364315c153e546fbae9dd63c562b9a1e42d82 Mon Sep 17 00:00:00 2001 +From: Babak Sarashki +Date: Sun, 24 Jan 2021 13:46:20 -0500 +Subject: [PATCH] Reject device configuration if not enabled + +Signed-off-by: Babak Sarashki +--- + config_app.c | 10 +++++++++- + 1 file changed, 9 insertions(+), 1 deletion(-) + +diff --git a/config_app.c b/config_app.c +index fdad259..f1aa52b 100644 +--- a/config_app.c ++++ b/config_app.c +@@ -114,6 +114,7 @@ static bool + get_device_id(hw_device *device, const char *location) + { + unsigned long vendor_id = -1, device_id = -1; ++ unsigned int device_enabled = 0; + struct dirent *dirent; + DIR *dir; + char pci_path[PATH_MAX]; +@@ -139,6 +140,12 @@ get_device_id(hw_device *device, const char *location) + snprintf(file_path, sizeof(file_path), "%s/%s", + pci_path, dirent->d_name); + ++ /* Is device enabled? */ ++ if (strncmp(dirent->d_name, "enable", ++ strlen(dirent->d_name)) == 0 && ++ dirent->d_type == DT_REG) ++ device_enabled = get_file_val(file_path); ++ + /* Get Device ID */ + if (strncmp(dirent->d_name, DEVICE_FILE, + strlen(dirent->d_name)) == 0 && +@@ -154,7 +161,8 @@ get_device_id(hw_device *device, const char *location) + + closedir(dir); + /* Check if device is found */ +- return (vendor_id == device->vendor_id && ++ return (device_enabled && ++ vendor_id == device->vendor_id && + device_id == device->device_id); + } + +-- +2.29.2 + diff --git a/centos_iso_image.inc b/centos_iso_image.inc index a066ef274..a635cbb79 100644 --- a/centos_iso_image.inc +++ b/centos_iso_image.inc @@ -201,3 +201,6 @@ kvm-timer-advance # botocore is an unspecified requirement of boto3 python2-botocore python-boto3 + +# Pf bbdev configuration tool for ACC100 (Mt. Bryce) +pf-bb-config diff --git a/centos_pkg_dirs b/centos_pkg_dirs index 8a58fb5d8..3c1e83657 100644 --- a/centos_pkg_dirs +++ b/centos_pkg_dirs @@ -83,3 +83,5 @@ python/python-mechanize python/python-html5lib python/python-webencodings python/python-daemon +base/inih +base/pf-bb-config diff --git a/centos_tarball-dl.lst b/centos_tarball-dl.lst index a177e9769..6c0fda732 100644 --- a/centos_tarball-dl.lst +++ b/centos_tarball-dl.lst @@ -69,3 +69,5 @@ trident-installer-20.04.0.tar.gz#trident-installer-20.04.0#https://github.com/Ne !tss2-930.tar.gz#tss2-930#https://git.code.sf.net/p/ibmtpm20tss/tss#git#v930# xxHash-1f40c6511fa8dd9d2e337ca8c9bc18b3e87663c9.tar.gz#xxHash#https://api.github.com/repos/ceph/xxHash/tarball/1f40c6511fa8dd9d2e337ca8c9bc18b3e87663c9#https## zstd-f4340f46b2387bc8de7d5320c0b83bb1499933ad.tar.gz#zstd#https://api.github.com/repos/facebook/zstd/tarball/f4340f46b2387bc8de7d5320c0b83bb1499933ad#https## +inih-b1dbff4b0bd1e1f40d237e21011f6dee0ec2fa69.tar.gz#inih-44#https://github.com/benhoyt/inih/tarball/b1dbff4b0bd1e1f40d237e21011f6dee0ec2fa69#https## +pf-bb-config-791b4f38d15377d4fbb3c9799a652acbc405b088.tar.gz#pf-bb-config-20.11#https://github.com/intel/pf-bb-config/tarball/791b4f38d15377d4fbb3c9799a652acbc405b088#https##