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 <zbsarashki@gmail.com>
Change-Id: Idaebcac5d0021d5c11c7ab27e13176139ba66c3b
This commit is contained in:
Babak Sarashki 2021-02-04 23:21:48 +00:00 committed by babak sarashki
parent 7b5b3aeabf
commit 8a33372bee
8 changed files with 158 additions and 0 deletions

View File

@ -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

View File

@ -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 <info@windriver.com>
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}/*

View File

@ -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

View File

@ -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 <info@windriver.com>
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}/*

View File

@ -0,0 +1,48 @@
From 8ac364315c153e546fbae9dd63c562b9a1e42d82 Mon Sep 17 00:00:00 2001
From: Babak Sarashki <Babak.SarAshki@windriver.com>
Date: Sun, 24 Jan 2021 13:46:20 -0500
Subject: [PATCH] Reject device configuration if not enabled
Signed-off-by: Babak Sarashki <Babak.SarAshki@windriver.com>
---
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

View File

@ -201,3 +201,6 @@ kvm-timer-advance
# botocore is an unspecified requirement of boto3 # botocore is an unspecified requirement of boto3
python2-botocore python2-botocore
python-boto3 python-boto3
# Pf bbdev configuration tool for ACC100 (Mt. Bryce)
pf-bb-config

View File

@ -83,3 +83,5 @@ python/python-mechanize
python/python-html5lib python/python-html5lib
python/python-webencodings python/python-webencodings
python/python-daemon python/python-daemon
base/inih
base/pf-bb-config

View File

@ -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# !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## 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## 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##