Skip to contentSkip to conversation

Generic firmware loader

PATCH Superseded tien.fong.chee at intel.com 6 participants 10 messages Dec 12, 2017 – Dec 14, 2017

v3 of 10 Superseded Latest is v10 →

lore
Share & tools
lore
#0 lore raw

v3 cover Generic firmware loader

From: Tien Fong Chee <[email protected]>

This patchset contains generic firmware loader which is very close to Linux firmware loader but for U-Boot framework. Generic firmware loader can be used load whatever into target location, and then consumer driver would use it to program whatever, ie. the FPGA. This version mainly resolved comments from Lothar Waßmann in [v2].

This series is working on top of u-boot.git -
http://git.denx.de/u-boot.git .

[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271979.html

v2 -> v3 changes:
-----------------
- Fixed the bugs in generic firmware loader driver.

Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271905.html

Tien Fong Chee (2):
spl: Remove static declaration on spl_mmc_find_device function
common: Generic firmware loader for file system

 common/Makefile      |   1 +
 common/fs_loader.c   | 305 +++++++++++++++++++++++++++++++++++++++++++++++++++
 common/spl/spl_mmc.c |   2 +-
 include/fs_loader.h  |  33 ++++++
 include/spl.h        |   2 +
 5 files changed, 342 insertions(+), 1 deletion(-)
 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h
Signature · 1 line
2.2.0
#1 lore raw

PATCH v3 1/2 spl: Remove static declaration on spl_mmc_find_device function

From: Tien Fong Chee <[email protected]>

This patch removes the static declation on spl_mmc_find_device_function so this function is accessible by the caller from other file. This patch is required for later patch.

---
 common/spl/spl_mmc.c | 2 +-
 include/spl.h        | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)
common/spl/spl_mmc.c +1 -1
index b57e0b0..183d05a 100644
@@ -114,7 +114,7 @@ static int spl_mmc_get_device_index(u32 boot_device)
 	return -ENODEV;
 }
 
-static int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
+int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device)
 {
 #if CONFIG_IS_ENABLED(DM_MMC)
 	struct udevice *dev;
include/spl.h +2 -0
index 308ce7b..912983a 100644
@@ -10,6 +10,7 @@
 /* Platform-specific defines */
 #include <linux/compiler.h>
 #include <asm/spl.h>
+#include <mmc.h>
 
 /* Value in r0 indicates we booted from U-Boot */
 #define UBOOT_NOT_LOADED_FROM_SPL	0x13578642
@@ -72,6 +73,7 @@ void preloader_console_init(void);
 u32 spl_boot_device(void);
 u32 spl_boot_mode(const u32 boot_device);
 void spl_set_bd(void);
+int spl_mmc_find_device(struct mmc **mmcp, u32 boot_device);
 
 /**
  * spl_set_header_raw_uboot() - Set up a standard SPL image structure
Signature · 1 line
2.2.0
#2 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

In reply to tien.fong.chee at intel.com

From: Tien Fong Chee <[email protected]>

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device.

---
 common/Makefile     |   1 +
 common/fs_loader.c  | 305 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/fs_loader.h |  33 ++++++
 3 files changed, 339 insertions(+)
 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h
common/Makefile +1 -0
index cec506f..2934221 100644
@@ -130,3 +130,4 @@ obj-$(CONFIG_CMD_DFU) += dfu.o
 obj-y += command.o
 obj-y += s_record.o
 obj-y += xyzModem.o
+obj-y += fs_loader.o
common/fs_loader.c new file +305 -0

305 lines not on this page · raw message

include/fs_loader.h new file +33 -0
new file mode 100644
index 0000000..35a6b5b
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+#ifndef _FS_LOADER_H_
+#define _FS_LOADER_H_
+
+#include <linux/types.h>
+
+struct firmware_priv {
+	const char *name;	/* Filename */
+	u32 offset;		/* Offset of reading a file */
+};
+
+struct firmware {
+	size_t size;		/* Size of a file */
+	const u8 *data;		/* Buffer for file */
+	void *priv;		/* Firmware loader private fields */
+};
+
+struct device_location {
+	char *name;	/* Such as mmc, usb,and sata. */
+	char *devpart;  /* Use the load command dev:part conventions */
+	char *mtdpart;	/* MTD partition for ubi part */
+	char *ubivol;	/* UBI volume-name for ubifsmount */
+};
+
+int request_firmware_into_buf(struct firmware **firmware_p,
+			      const char *name,
+			      struct device_location *location,
+			      void *buf, size_t size, u32 offset);
+#endif
Signature · 1 line
2.2.0
#3 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

Hi,

Quoted 16 lines · On Tue, 12 Dec 2017 19:56:17 +0800 tien.fong.chee at intel.com wrote:

From: Tien Fong Chee <[email protected]>

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device.

---
 common/Makefile     |   1 +
 common/fs_loader.c  | 305 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/fs_loader.h |  33 ++++++
 3 files changed, 339 insertions(+)
 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h

[...]

Quoted 11 lines
include/fs_loader.h new file +4 -0
new file mode 100644
index 0000000..35a6b5b
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0

include/fs_loader.h line 14

Quoted 10 lines
include/fs_loader.h new file +10 -0
+ */
+#ifndef _FS_LOADER_H_
+#define _FS_LOADER_H_
+
+#include <linux/types.h>
+
+struct firmware_priv {
+	const char *name;	/* Filename */
+	u32 offset;		/* Offset of reading a file */
+};

This is private to the firmware loader and should be declared locally in the source file. That's the whole point of being 'private'. You could have different firmware loaders with different requirements for their private data, thus there is no use in defining this globally.

include/fs_loader.h line 21

Quoted 7 lines
include/fs_loader.h new file +7 -0
+
+struct firmware {
+	size_t size;		/* Size of a file */
+	const u8 *data;		/* Buffer for file */
+	void *priv;		/* Firmware loader private fields */
+};
+

Lothar Waßmann

#4 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

Quoted 41 lines · Lothar Waßmann

Hi,

Quoted 18 lines · On Tue, 12 Dec 2017 19:56:17 +0800 tien.fong.chee at intel.com wrote:

From: Tien Fong Chee <[email protected]>

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device.

---
 common/Makefile     |   1 +
 common/fs_loader.c  | 305
++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/fs_loader.h |  33 ++++++

 3 files changed, 339 insertions(+)

 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h

[...]

Quoted 19 lines
include/fs_loader.h new file +12 -0
new file mode 100644
index 0000000..35a6b5b
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2017 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier:    GPL-2.0
+ */
+#ifndef _FS_LOADER_H_
+#define _FS_LOADER_H_
+
+#include <linux/types.h>
+
+struct firmware_priv {
+	const char *name;	/* Filename */
Quoted 9 lines

include/fs_loader.h line 14

Quoted 3 lines
include/fs_loader.h new file +2 -0
+	u32 offset;		/* Offset of reading a file */
+};

This is private to the firmware loader and should be declared locally in the source file. That's the whole point of being 'private'. You could have different firmware loaders with different requirements for their private data, thus there is no use in defining this globally.

Okay, i will move this declaration to source file. Any comments to the source file?

Quoted 11 lines

include/fs_loader.h

Quoted 9 lines
include/fs_loader.h new file +5 -0
+
+struct firmware {
+	size_t size;		/* Size of a file */
+	const u8 *data;		/* Buffer for file */
+	void *priv;		/* Firmware loader private

fields */

include/fs_loader.h new file +2 -0
+};
+

Lothar Waßmann

#5 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

In reply to tien.fong.chee at intel.com

Dear Tien,

Quoted 12 lines

-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of tien.fong.chee at intel.com
Sent: Tuesday, December 12, 2017 5:26 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tien Fong Chee <[email protected]>; Ching Liang See <[email protected]>; Tien Fong <[email protected]>; Westergteen Dalon <[email protected]>
Subject: [U-Boot] [PATCH v3 2/2] common: Generic firmware loader for file system

Quoted 8 lines

From: Tien Fong Chee <[email protected]>

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device.

A README about how to use this feature in u-boot will be very helpful.

--pk

#6 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

Hi Tien,

Quoted 16 lines

Dear Tien,

Quoted 14 lines

-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of tien.fong.chee at intel.com
Sent: Tuesday, December 12, 2017 5:26 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tien Fong Chee <[email protected]>; Ching Liang See <[email protected]>; Tien Fong <[email protected]>; Westergteen Dalon <[email protected]>
Subject: [U-Boot] [PATCH v3 2/2] common: Generic firmware loader for file system

From: Tien Fong Chee <[email protected]>

Quoted 8 lines
Quoted 6 lines

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever, ie. the FPGA device.

A README about how to use this feature in u-boot will be very helpful.

+1

Quoted 6 lines

--pk
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de -------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20171213/32601941/attachment.sig>

#7 lore raw

PATCH v3 2/2 common: Generic firmware loader for file system

Quoted 26 lines · Lukasz Majewski

Hi Tien,

Quoted 24 lines

Dear Tien,

Quoted 21 lines

-----Original Message-----
From: U-Boot [mailto:u-boot-bounces at lists.denx.de] On Behalf Of tien.fong.chee at intel.com
Sent: Tuesday, December 12, 2017 5:26 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tien Fong Chee <[email protected]>; Ching Liang See <[email protected]>; Tien Fong <[email protected]>; Westergteen Dalon <[email protected]>
Subject: [U-Boot] [PATCH v3 2/2] common: Generic firmware loader for file system

From: Tien Fong Chee <[email protected]>

This is file system generic loader which can be used to load the file image from the storage into target such as memory. The consumer driver would then use this loader to program whatever,
ie. the FPGA device.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

A README about how to use this feature in u-boot will be very helpful.

+1

Okay, i will send out the initial draft documents separately for discussion.

Quoted 18 lines
Quoted 7 lines

--pk
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de

#8 lore raw

v3 cover Generic firmware loader

In reply to tien.fong.chee at intel.com
Quoted 25 lines · tien.fong.chee at intel.com

From: Tien Fong Chee <[email protected]>

This patchset contains generic firmware loader which is very close to Linux firmware loader but for U-Boot framework. Generic firmware loader can be used load whatever into target location, and then consumer driver would use it to program whatever, ie. the FPGA. This version mainly resolved comments from Lothar Waßmann in [v2].

This series is working on top of u-boot.git -
http://git.denx.de/u-boot.git .

[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271979.html

v2 -> v3 changes:
-----------------
- Fixed the bugs in generic firmware loader driver.

Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271905.html

Tien Fong Chee (2):
spl: Remove static declaration on spl_mmc_find_device function
common: Generic firmware loader for file system

Quoted 9 lines
 common/Makefile      |   1 +
 common/fs_loader.c   | 305 +++++++++++++++++++++++++++++++++++++++++++++++++++
 common/spl/spl_mmc.c |   2 +-
 include/fs_loader.h  |  33 ++++++
 include/spl.h        |   2 +
 5 files changed, 342 insertions(+), 1 deletion(-)
 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h

I thought we discussed resending patchsets multiple times a day already, didn't we ?

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

v3 cover Generic firmware loader

Quoted 43 lines · Marek Vasut
Quoted 38 lines · tien.fong.chee at intel.com

From: Tien Fong Chee <[email protected]>

This patchset contains generic firmware loader which is very close to Linux
firmware loader but for U-Boot framework. Generic firmware loader can be used
load whatever into target location, and then consumer driver would use it to
program whatever, ie. the FPGA. This version mainly resolved comments from
Lothar Waßmann in [v2].

This series is working on top of u-boot.git -
 http://git.denx.de/u-boot.git .

[v2]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271979.h tml

v2 -> v3 changes:
-----------------
- Fixed the bugs in generic firmware loader driver.

Patchset history
----------------
[v1]: https://www.mail-archive.com/u-boot at lists.denx.de/msg271905.h tml

Tien Fong Chee (2):
  spl: Remove static declaration on spl_mmc_find_device function
  common: Generic firmware loader for file system

 common/Makefile      |   1 +
 common/fs_loader.c   | 305
+++++++++++++++++++++++++++++++++++++++++++++++++++
 common/spl/spl_mmc.c |   2 +-
 include/fs_loader.h  |  33 ++++++
 include/spl.h        |   2 +

Quoted 4 lines
 5 files changed, 342 insertions(+), 1 deletion(-)

 create mode 100644 common/fs_loader.c
 create mode 100644 include/fs_loader.h

Quoted 4 lines

I thought we discussed resending patchsets multiple times a day already,
didn't we ?

Sorry, i will kepp it slow down.