Merge "Debian: Add missing patches in pf-bb-config"
This commit is contained in:
commit
d784f9f9cd
@ -0,0 +1,50 @@
|
|||||||
|
From a12967eba299f63f3abe5a906765d5beb16db81c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andre Kantek <andrefernandozanella.kantek@windriver.com>
|
||||||
|
Date: Wed, 23 Nov 2022 08:27:52 -0300
|
||||||
|
Subject: [PATCH] Reject device configuration if not enabled
|
||||||
|
|
||||||
|
Check if device is enabled in the return logic of get_device_id()
|
||||||
|
|
||||||
|
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
|
||||||
|
---
|
||||||
|
config_app.c | 10 +++++++++-
|
||||||
|
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/config_app.c b/config_app.c
|
||||||
|
index 6acd8f1..4f72764 100644
|
||||||
|
--- a/config_app.c
|
||||||
|
+++ b/config_app.c
|
||||||
|
@@ -85,6 +85,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];
|
||||||
|
@@ -112,6 +113,12 @@ get_device_id(hw_device *device, const char *location)
|
||||||
|
if (snprintf_ret < 0)
|
||||||
|
LOG(ERR, "Failed to format PCI path");
|
||||||
|
|
||||||
|
+ /* 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 &&
|
||||||
|
@@ -127,7 +134,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.17.1
|
||||||
|
|
@ -0,0 +1,37 @@
|
|||||||
|
From b1b29494ab8b9395c36c1b5664af324c7f67245c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Andre Kantek <andrefernandozanella.kantek@windriver.com>
|
||||||
|
Date: Wed, 23 Nov 2022 08:36:08 -0300
|
||||||
|
Subject: [PATCH] Fix: check return of configure_device()
|
||||||
|
|
||||||
|
Takes the result of configure_device() as the return code of the
|
||||||
|
application, allowing any script running pf-bb-config to stop on
|
||||||
|
bad device configuration.
|
||||||
|
|
||||||
|
Signed-off-by: Andre Kantek <andrefernandozanella.kantek@windriver.com>
|
||||||
|
---
|
||||||
|
config_app.c | 4 ++++
|
||||||
|
1 file changed, 4 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/config_app.c b/config_app.c
|
||||||
|
index 4f72764..066fb55 100644
|
||||||
|
--- a/config_app.c
|
||||||
|
+++ b/config_app.c
|
||||||
|
@@ -431,11 +431,15 @@ main(int argc, char *argv[])
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ ret = 0;
|
||||||
|
if (device.config_all) {
|
||||||
|
for (i = 0; i < num_devices; i++) {
|
||||||
|
strncpy(device.pci_address, found_devices[i],
|
||||||
|
sizeof(device.pci_address) - NULL_PAD);
|
||||||
|
ret = configure_device(&device);
|
||||||
|
+ if (ret != 0) {
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
select_device(&device, found_devices, num_devices);
|
||||||
|
--
|
||||||
|
2.17.1
|
||||||
|
|
2
base/pf-bb-config/debian/patches/series
Normal file
2
base/pf-bb-config/debian/patches/series
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
0001-Reject-device-configuration-if-not-enabled.patch
|
||||||
|
0002-Fix-check-return-of-configure_device.patch
|
Loading…
x
Reference in New Issue
Block a user