From 3c2f1530c9ee8ccd2c27cb757655a9c851b926ae Mon Sep 17 00:00:00 2001
From: Babak Sarashki <zbsarashki@gmail.com>
Date: Thu, 4 Feb 2021 23:52:37 +0000
Subject: [PATCH] platform puppet: Config ACC100 bbdev with QMGR val

The ACC100 PF and VF configuration takes the same puppet
config code path as the N3000 except that the ACC100 does
not require a reset, but requires bbdev config.

This patch adds platform::devices::acc100::fec class to
exec pf-bb-config to configure QMGR on the Intel ACC100
(Mt. Bryce) with number of 5G UL/DL qgroups and configures
the device with the number of VF's.

Story: 2008440
Task: 41530

Depends-On: https://review.opendev.org/c/starlingx/integ/+/775252

Signed-off-by: Babak Sarashki <zbsarashki@gmail.com>
Change-Id: I7d42852009fedba5136d9d726092f273ef41c7fd
---
 .../src/modules/platform/manifests/devices.pp   | 17 ++++++++++++++++-
 .../templates/processing.accelerator-config.erb |  1 +
 2 files changed, 17 insertions(+), 1 deletion(-)
 create mode 100644 puppet-manifests/src/modules/platform/templates/processing.accelerator-config.erb

diff --git a/puppet-manifests/src/modules/platform/manifests/devices.pp b/puppet-manifests/src/modules/platform/manifests/devices.pp
index 9868eb333..b766b156c 100644
--- a/puppet-manifests/src/modules/platform/manifests/devices.pp
+++ b/puppet-manifests/src/modules/platform/manifests/devices.pp
@@ -76,6 +76,11 @@ define platform::devices::sriov_bind (
       Class['platform::devices::fpga::n3000::reset']
       -> Exec["sriov-bind-device: ${title}"]
     }
+    if ($device_id != undef) and ($device_id == '0d5c') {
+      include platform::devices::acc100::fec
+      Exec["sriov-enable-device: ${title}"]
+      -> Class['platform::devices::acc100::fec']
+    }
     ensure_resource(kmod::load, $driver)
     exec { "sriov-bind-device: ${title}":
       command   => template('platform/sriov.bind-device.erb'),
@@ -153,9 +158,19 @@ class platform::devices::fpga::fec {
   require ::platform::devices::fpga::fec::config
 }
 
+class platform::devices::acc100::fec (
+  $enabled = false
+)
+{
+  if $enabled {
+      exec { 'Mt.Bryce: Configuring baseband device':
+        command   => template('platform/processing.accelerator-config.erb'),
+        logoutput => true,
+      }
+  }
+}
 
 class platform::devices {
   include ::platform::devices::qat
   include ::platform::devices::fpga::fec
 }
-
diff --git a/puppet-manifests/src/modules/platform/templates/processing.accelerator-config.erb b/puppet-manifests/src/modules/platform/templates/processing.accelerator-config.erb
new file mode 100644
index 000000000..fd907d444
--- /dev/null
+++ b/puppet-manifests/src/modules/platform/templates/processing.accelerator-config.erb
@@ -0,0 +1 @@
+/usr/bin/pf_bb_config ACC100 -c /usr/share/pf-bb-config/acc100/acc100_config_vf_5g.cfg