All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: u-boot@lists.denx.de
Subject: [PATCH v4 5/5] qemu: add documentation to qfw.h
Date: Thu, 25 Feb 2021 21:10:16 +0100	[thread overview]
Message-ID: <152ff3b0-6c07-fc63-3c0c-45b60b161fb8@gmx.de> (raw)
In-Reply-To: <20210224032323.15798-6-ashe@kivikakk.ee>

On 2/24/21 4:23 AM, Asherah Connor wrote:
> Also rename a "length" to "size" for consistency with the rest of qfw.
>
> Signed-off-by: Asherah Connor <ashe@kivikakk.ee>
> ---
>
> (no changes since v1)
>
>   drivers/misc/qfw.c |  6 ++--
>   include/qfw.h      | 86 +++++++++++++++++++++++++++++++++++++++++++---
>   2 files changed, 84 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/misc/qfw.c b/drivers/misc/qfw.c
> index b0c82e2098..3e8c1a9cda 100644
> --- a/drivers/misc/qfw.c
> +++ b/drivers/misc/qfw.c
> @@ -283,14 +283,14 @@ static void qfw_read_entry_dma(struct qfw_dev *qdev, u16 entry, u32 size,
>   	ops->read_entry_dma(qdev->dev, &dma);
>   }
>
> -void qfw_read_entry(struct udevice *dev, u16 entry, u32 length, void *address)
> +void qfw_read_entry(struct udevice *dev, u16 entry, u32 size, void *address)
>   {
>   	struct qfw_dev *qdev = dev_get_uclass_priv(dev);
>
>   	if (qdev->dma_present)
> -		qfw_read_entry_dma(qdev, entry, length, address);
> +		qfw_read_entry_dma(qdev, entry, size, address);
>   	else
> -		qfw_read_entry_io(qdev, entry, length, address);
> +		qfw_read_entry_io(qdev, entry, size, address);
>   }
>
>   int qfw_register(struct udevice *dev)
> diff --git a/include/qfw.h b/include/qfw.h
> index 41d4db08d6..d59c71a5dd 100644
> --- a/include/qfw.h
> +++ b/include/qfw.h
> @@ -8,6 +8,11 @@
>
>   #include <linux/list.h>
>
> +/*
> + * List of firmware configuration item selectors. The official source of truth
> + * for these is the QEMU source itself; see
> + * https://github.com/qemu/qemu/blob/master/hw/nvram/fw_cfg.c
> + */
>   enum {
>   	FW_CFG_SIGNATURE	= 0x00,
>   	FW_CFG_ID		= 0x01,
> @@ -66,8 +71,10 @@ enum {
>   #define FW_CFG_DMA_SKIP	(1 << 2)
>   #define FW_CFG_DMA_SELECT	(1 << 3)
>
> +/* Bit set in FW_CFG_ID response to indicate DMA interface availability. */
>   #define FW_CFG_DMA_ENABLED	(1 << 1)
>
> +/* Structs read from FW_CFG_FILE_DIR. */
>   struct fw_cfg_file {
>   	__be32 size;
>   	__be16 select;
> @@ -134,27 +141,56 @@ struct bios_linker_entry {
>   	};
>   } __packed;
>
> +/* DMA transfer control data between UCLASS_QFW and QEMU. */
>   struct qfw_dma {
>   	__be32 control;
>   	__be32 length;
>   	__be64 address;
>   };
>
> +/* uclass per-device configuration information */
>   struct qfw_dev {
> -	struct udevice *dev;
> -	bool dma_present;
> -	struct list_head fw_list;
> +	struct udevice *dev;		/* Transport device */
> +	bool dma_present;		/* DMA interface usable? */
> +	struct list_head fw_list;	/* Cached firmware file list */
>   };
>
> +/* Ops used internally between UCLASS_QFW and its driver implementations. */
>   struct dm_qfw_ops {
> +	/**
> +	 * read_entry_io() - Read a firmware config entry using the regular
> +	 * IO interface for the platform (either PIO or MMIO)
> +	 *
> +	 * Supply FW_CFG_INVALID as the entry to continue a previous read.  In
> +	 * this case, no selector will be issued before reading.
> +	 *
> +	 * @dev: Device to use
> +	 * @entry: Firmware config entry number (e.g. FW_CFG_SIGNATURE)
> +	 * @size: Number of bytes to read
> +	 * @address: Target location for read
> +	 */
>   	void (*read_entry_io)(struct udevice *dev, u16 entry, u32 size,
>   			      void *address);
> +
> +	/**
> +	 * read_entry_dma() - Read a firmware config entry using the DMA
> +	 * interface
> +	 *
> +	 * Supply FW_CFG_INVALID as the entry to continue a previous read.  In
> +	 * this case, no selector will be issued before reading.
> +	 *
> +	 * This method assumes DMA availability has already been confirmed.
> +	 *
> +	 * @dev: Device to use
> +	 * @dma: DMA transfer control struct
> +	 */
>   	void (*read_entry_dma)(struct udevice *dev, struct qfw_dma *dma);
>   };
>
>   #define dm_qfw_get_ops(dev) \
>   		((struct dm_qfw_ops *)(dev)->driver->ops)
>
> +/* Used internally by driver implementations on successful probe. */
>   int qfw_register(struct udevice *dev);
>
>   struct udevice;
> @@ -168,8 +204,37 @@ struct udevice;
>    */
>   int qfw_get_dev(struct udevice **devp);
>
> -void qfw_read_entry(struct udevice *dev, u16 entry, u32 length, void *address);
> +/**
> + * Read a QEMU firmware config entry

This will not generate documentation for qfw_read_entry() with Sphinx.

See
https://www.kernel.org/doc/html/latest/doc-guide/kernel-doc.html#function-documentation

> + *
> + * The appropriate transport and interface will be selected automatically.
> + *
> + * @dev: Device to use
> + * @entry: Firmware config entry number (e.g. FW_CFG_SIGNATURE)
> + * @size: Number of bytes to read
> + * @address: Target location for read
> + */
> +void qfw_read_entry(struct udevice *dev, u16 entry, u32 size, void *address);
> +
> +/**
> + * Reads the QEMU firmware config file list, for later use with qfw_find_file.
> + *
> + * If the list has already been read, returns 0 (success).
> + *
> + * @dev: Device to use
> + *
> + * @return 0 on success, -ENOMEM if unable to allocate.

This is not valid Sphinx syntax.

> + */
>   int qfw_read_firmware_list(struct udevice *dev);
> +
> +/**
> + * Finds a file by name in the QEMU firmware config file list.

Function name missing.

> + *
> + * @dev: Device to use
> + * @name: Name of file to locate (e.g. "etc/table-loader")
> + *
> + * @return pointer to fw_file struct if found, NULL if not present.

Invalid syntax.

> + */
>   struct fw_file *qfw_find_file(struct udevice *dev, const char *name);
>
>   /**
> @@ -179,7 +244,18 @@ struct fw_file *qfw_find_file(struct udevice *dev, const char *name);
>    */
>   int qfw_online_cpus(struct udevice *dev);
>
> -/* helper functions to iterate firmware file list */
> +/**
> + * Helper functions to iterate firmware file list. Suggested use:

Please, describe each function individually in Sphinx style.

Best regards

Heinrich

> + *
> + * struct fw_cfg_file_iter iter;
> + * struct fw_file *file;
> + *
> + * for (file = qfw_file_iter_init(dev, &iter);
> + *      !qfw_file_iter_end(&iter);
> + *      file = qfw_file_iter_next(&iter)) {
> + *         // use `file'
> + * }
> + */
>   struct fw_file *qfw_file_iter_init(struct udevice *dev,
>   				   struct fw_cfg_file_iter *iter);
>   struct fw_file *qfw_file_iter_next(struct fw_cfg_file_iter *iter);
>

  parent reply	other threads:[~2021-02-25 20:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24  3:23 [PATCH v4 0/5] Move qfw to DM, add Arm support Asherah Connor
2021-02-24  3:23 ` [PATCH v4 1/5] arm: x86: qemu: move qfw to DM uclass, " Asherah Connor
2021-02-25 19:31   ` Simon Glass
2021-02-26  2:14   ` Bin Meng
2021-02-26  2:19     ` Bin Meng
2021-02-26  4:54       ` Asherah Connor
2021-02-26  5:07   ` Bin Meng
2021-02-24  3:23 ` [PATCH v4 2/5] arm: x86: qemu: unify qfw driver functions as qfw_ Asherah Connor
2021-02-25 19:31   ` Simon Glass
2021-02-24  3:23 ` [PATCH v4 3/5] qemu: add sandbox driver and tests Asherah Connor
2021-02-25 19:31   ` Simon Glass
2021-02-24  3:23 ` [PATCH v4 4/5] test: qemu: add simple test for cmd_qfw Asherah Connor
2021-02-25 19:31   ` Simon Glass
2021-02-24  3:23 ` [PATCH v4 5/5] qemu: add documentation to qfw.h Asherah Connor
2021-02-25 19:31   ` Simon Glass
2021-02-26  4:49     ` Asherah Connor
2021-02-25 20:10   ` Heinrich Schuchardt [this message]
2021-02-26  4:51     ` Asherah Connor
2021-02-25  7:11 ` [PATCH v4 0/5] Move qfw to DM, add Arm support Asherah Connor

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=152ff3b0-6c07-fc63-3c0c-45b60b161fb8@gmx.de \
    --to=xypron.glpk@gmx.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.