Skip to contentSkip to conversation

misc: fs-loader: Use fw_storage_interface instead of storage_interface

PATCH In review MD Danish Anwar 3 participants 5 messages Feb 9, 2024 – Feb 28, 2024 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH v5 1/1 misc: fs-loader: Use fw_storage_interface instead of storage_interface

The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface.

The env storage_interface will act as fallback so that the existing implementations do not break.

Also update the FS Loader documentation accordingly.

---
Cc: Sean Anderson <[email protected]>
Changes from v4 to v5:
*) Modified commit message to make the motive cleared for this commit. *) Added RB tag of Ravi.
*) Rebased on the latest u-boot/master [commit
a4650bf65e4b7d3ef04c90ba8031374428e4a682]

v4: https://lore.kernel.org/all/[email protected]/

 doc/develop/driver-model/fs_firmware_loader.rst | 5 ++++-
 drivers/misc/fs_loader.c                        | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
doc/develop/driver-model/fs_firmware_loader.rst +4 -1
index 149b8b436e..410cc1442d 100644
@@ -98,8 +98,11 @@ through the U-Boot environment variable during run time.
 
 For examples:
 
+fw_storage_interface:
+  Firmware storage interface, it can be "mmc", "usb", "sata" or "ubi".
 storage_interface:
-  Storage interface, it can be "mmc", "usb", "sata" or "ubi".
+  Storage interface, it can be "mmc", "usb", "sata" or "ubi". This acts
+  as a fallback if fw_storage_interface is not set.
 fw_dev_part:
   Block device number and its partition, it can be "0:1".
 fw_ubi_mtdpart:
drivers/misc/fs_loader.c +4 -1
index 1ffc199ba1..3798dab5b6 100644
@@ -153,7 +153,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
 	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
 	int ret;
 
-	storage_interface = env_get("storage_interface");
+	storage_interface = env_get("fw_storage_interface");
+	if (!storage_interface)
+		storage_interface = env_get("storage_interface");
+
 	dev_part = env_get("fw_dev_part");
 	ubi_mtdpart = env_get("fw_ubi_mtdpart");
 	ubi_volume = env_get("fw_ubi_volume");
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · MD Danish Anwar

The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface.

Quoted 7 lines

The env storage_interface will act as fallback so that the existing implementations do not break.

Also update the FS Loader documentation accordingly.

---

Hi Tom / Sean, can you please pick this patch if there is no pending comments to address.

Quoted 46 lines

Cc: Sean Anderson <[email protected]>
Changes from v4 to v5:
*) Modified commit message to make the motive cleared for this commit. *) Added RB tag of Ravi.
*) Rebased on the latest u-boot/master [commit
a4650bf65e4b7d3ef04c90ba8031374428e4a682]

v4: https://lore.kernel.org/all/[email protected]/

 doc/develop/driver-model/fs_firmware_loader.rst | 5 ++++-
 drivers/misc/fs_loader.c                        | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)
doc/develop/driver-model/fs_firmware_loader.rst +4 -1
index 149b8b436e..410cc1442d 100644
@@ -98,8 +98,11 @@ through the U-Boot environment variable during run time.
 
 For examples:
 
+fw_storage_interface:
+  Firmware storage interface, it can be "mmc", "usb", "sata" or "ubi".
 storage_interface:
-  Storage interface, it can be "mmc", "usb", "sata" or "ubi".
+  Storage interface, it can be "mmc", "usb", "sata" or "ubi". This acts
+  as a fallback if fw_storage_interface is not set.
 fw_dev_part:
   Block device number and its partition, it can be "0:1".
 fw_ubi_mtdpart:
drivers/misc/fs_loader.c +4 -1
index 1ffc199ba1..3798dab5b6 100644
@@ -153,7 +153,10 @@ static int fw_get_filesystem_firmware(struct udevice *dev)
 	char *storage_interface, *dev_part, *ubi_mtdpart, *ubi_volume;
 	int ret;
 
-	storage_interface = env_get("storage_interface");
+	storage_interface = env_get("fw_storage_interface");
+	if (!storage_interface)
+		storage_interface = env_get("storage_interface");
+
 	dev_part = env_get("fw_dev_part");
 	ubi_mtdpart = env_get("fw_ubi_mtdpart");
 	ubi_volume = env_get("fw_ubi_volume");
Signature · 2 lines
Thanks and Regards,
Danish
#2 lore raw

Hi Danish,

Quoted 11 lines · MD Danish Anwar
Quoted 10 lines · MD Danish Anwar

The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface.

The env storage_interface will act as fallback so that the existing implementations do not break.

Quoted 8 lines
Quoted 4 lines

Also update the FS Loader documentation accordingly.

---

Hi Tom / Sean, can you please pick this patch if there is no pending comments to address.

Sorry, I forgot to respond to this earlier.

To be honest, I'm not really convinced. We have plenty of environmental variables which are inconsistent (e.g. ethaddr, eth2addr, eth3addr) and it doesn't cause any issues. While fixing code has no cost, the environment is an ABI which we can't break. So we'd have to support both of these variables forever. I'm not really a fan of doing that without good reason, and I think aesthetics of the variable name isn't really compelling.

--Sean

#3 lore raw
Quoted 23 lines · Sean Anderson

Hi Danish,

Quoted 11 lines · MD Danish Anwar
Quoted 10 lines · MD Danish Anwar

The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface.

The env storage_interface will act as fallback so that the existing implementations do not break.

Quoted 8 lines
Quoted 4 lines

Also update the FS Loader documentation accordingly.

---

Hi Tom / Sean, can you please pick this patch if there is no pending comments to address.

Quoted 9 lines

Sorry, I forgot to respond to this earlier.

To be honest, I'm not really convinced. We have plenty of environmental variables which are inconsistent (e.g. ethaddr, eth2addr, eth3addr) and it doesn't cause any issues. While fixing code has no cost, the environment is an ABI which we can't break. So we'd have to support both of these variables forever. I'm not really a fan of doing that without good reason, and I think aesthetics of the variable name isn't really compelling.

Roger, should I keep the env variable name as it is and don't rename it? Sean's concern seems valid, can you please comment here.

Quoted 1 line

--Sean

Signature · 2 lines
Thanks and Regards,
Danish
#4 lore raw
Quoted 35 lines · MD Danish Anwar
Quoted 23 lines · Sean Anderson

Hi Danish,

Quoted 11 lines · MD Danish Anwar
Quoted 10 lines · MD Danish Anwar

The fs-loader driver reads env storage_interface and uses it to load firmware file into memory using the medium set by env. Update the driver to use env fw_storage_interface as this variable is only used to load firmwares. This is to keep all variables used by fs-loader driver with 'fw_' prefix. All other variables have 'fw_' prefix except for storage_interface.

The env storage_interface will act as fallback so that the existing implementations do not break.

Quoted 8 lines
Quoted 4 lines

Also update the FS Loader documentation accordingly.

---

Hi Tom / Sean, can you please pick this patch if there is no pending comments to address.

Quoted 9 lines

Sorry, I forgot to respond to this earlier.

To be honest, I'm not really convinced. We have plenty of environmental variables which are inconsistent (e.g. ethaddr, eth2addr, eth3addr) and it doesn't cause any issues. While fixing code has no cost, the environment is an ABI which we can't break. So we'd have to support both of these variables forever. I'm not really a fan of doing that without good reason, and I think aesthetics of the variable name isn't really compelling.

Quoted 2 lines

Roger, should I keep the env variable name as it is and don't rename it? Sean's concern seems valid, can you please comment here.

Sure.

Signature · 2 lines
cheers,
-roger