integ/base/pf-bb-config/files/Reject-device-configuration-if-not-enabled.patch
Babak Sarashki 8a33372bee 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
2021-02-11 23:18:51 +00:00

49 lines
1.4 KiB
Diff

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