public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Michal Simek <monstr@monstr.eu>
To: christian.taedcke-oss@weidmueller.com, u-boot@lists.denx.de
Cc: Christian Taedcke <christian.taedcke@weidmueller.com>,
	Michal Simek <michal.simek@amd.com>,
	Simon Glass <sjg@chromium.org>
Subject: Re: [PATCH v3] event: Add fpga load event
Date: Mon, 17 Jul 2023 12:36:42 +0200	[thread overview]
Message-ID: <48d31c19-48ca-d913-bbf1-e62cde4166af@monstr.eu> (raw)
In-Reply-To: <20230712113909.140508-1-christian.taedcke-oss@weidmueller.com>



On 7/12/23 13:39, christian.taedcke-oss@weidmueller.com wrote:
> From: Christian Taedcke <christian.taedcke@weidmueller.com>
> 
> This enables implementing custom logic after a bitstream was loaded
> into the fpga.
> 
> Signed-off-by: Christian Taedcke <christian.taedcke@weidmueller.com>
> ---
> 
> Changes in v3:
> - replace #if with if
> - remove previously added printf
> - return notification error from fpga_load()
> - fix static_assert checking event name list
> 
> Changes in v2:
> - replace __weak function with a new event
> 
>   common/event.c      |  3 +++
>   drivers/fpga/fpga.c | 20 ++++++++++++++++++++
>   include/event.h     | 16 ++++++++++++++++
>   3 files changed, 39 insertions(+)
> 
> diff --git a/common/event.c b/common/event.c
> index 164c95f8f5..20720c5283 100644
> --- a/common/event.c
> +++ b/common/event.c
> @@ -36,6 +36,9 @@ const char *const type_name[] = {
>   	/* init hooks */
>   	"misc_init_f",
>   
> +	/* Fpga load hook */
> +	"fpga_load",
> +
>   	/* fdt hooks */
>   	"ft_fixup",
>   
> diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c
> index 7f6b6bc73a..81e6d8ffc0 100644
> --- a/drivers/fpga/fpga.c
> +++ b/drivers/fpga/fpga.c
> @@ -244,6 +244,21 @@ int fpga_loads(int devnum, const void *buf, size_t size,
>   }
>   #endif
>   
> +static int fpga_load_event_notify(const void *buf, size_t bsize, int result)
> +{
> +	if (CONFIG_IS_ENABLED(EVENT)) {
> +		struct event_fpga_load load = {
> +			.buf = buf,
> +			.bsize = bsize,
> +			.result = result
> +		};
> +
> +		return event_notify(EVT_FPGA_LOAD, &load, sizeof(load));
> +	}
> +
> +	return 0;
> +}
> +
>   /*
>    * Generic multiplexing code
>    */
> @@ -251,6 +266,7 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype,
>   	      int flags)
>   {
>   	int ret_val = FPGA_FAIL;           /* assume failure */
> +	int ret_notify;
>   	const fpga_desc *desc = fpga_validate(devnum, buf, bsize,
>   					      (char *)__func__);
>   
> @@ -284,6 +300,10 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype,
>   		}
>   	}
>   
> +	ret_notify = fpga_load_event_notify(buf, bsize, ret_val);
> +	if (ret_notify)
> +		return ret_notify;
> +
>   	return ret_val;
>   }
>   
> diff --git a/include/event.h b/include/event.h
> index fe41080fa6..77124c2e73 100644
> --- a/include/event.h
> +++ b/include/event.h
> @@ -31,6 +31,9 @@ enum event_t {
>   	/* Init hooks */
>   	EVT_MISC_INIT_F,
>   
> +	/* Fpga load hook */
> +	EVT_FPGA_LOAD,
> +
>   	/* Device tree fixups before booting */
>   	EVT_FT_FIXUP,
>   
> @@ -59,6 +62,19 @@ union event_data {
>   		struct udevice *dev;
>   	} dm;
>   
> +	/**
> +	 * struct event_fpga_load - fpga load event
> +	 *
> +	 * @buf: The buffer that was loaded into the fpga
> +	 * @bsize: The size of the buffer that was loaded into the fpga
> +	 * @result: Result of the load operation
> +	 */
> +	struct event_fpga_load {
> +		const void *buf;
> +		size_t bsize;
> +		int result;
> +	} fpga_load;
> +
>   	/**
>   	 * struct event_ft_fixup - FDT fixup before booting
>   	 *

There is the error generated for kmcent2_defconfig.

Please fix.

For more information please take a look at

https://source.denx.de/u-boot/custodians/u-boot-microblaze/-/jobs/657127

+In file included from board/keymile/kmcent2/kmcent2.c:9:
+include/event.h:74:17: error: unknown type name 'size_t'
+   74 |                 size_t bsize;
+      |                 ^~~~~~
+make[2]: *** [scripts/Makefile.build:257: board/keymile/kmcent2/kmcent2.o] Error 1

Thanks,
Michal

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs
TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs

  parent reply	other threads:[~2023-07-17 10:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 11:39 [PATCH v3] event: Add fpga load event christian.taedcke-oss
2023-07-12 14:00 ` Simon Glass
2023-07-17 10:36 ` Michal Simek [this message]
2023-07-18 11:22   ` Taedcke, Christian
2023-07-19  8:37     ` Michal Simek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48d31c19-48ca-d913-bbf1-e62cde4166af@monstr.eu \
    --to=monstr@monstr.eu \
    --cc=christian.taedcke-oss@weidmueller.com \
    --cc=christian.taedcke@weidmueller.com \
    --cc=michal.simek@amd.com \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox