From: Heinrich Schuchardt <xypron.glpk@gmx.de>
To: Simon Glass <sjg@chromium.org>
Cc: Andrew Scull <ascull@google.com>, Marek Vasut <marex@denx.de>,
Rob Herring <rob.herring@calxeda.com>,
Sean Anderson <seanga2@gmail.com>, Stefan Roese <sr@denx.de>,
U-Boot Mailing List <u-boot@lists.denx.de>
Subject: Re: [PATCH 03/15] scsi: Move cmd_phase enum to the header
Date: Mon, 29 Aug 2022 16:50:51 +0200 [thread overview]
Message-ID: <dc50cf3c-f8b0-76fb-f469-2ce855c973d3@gmx.de> (raw)
In-Reply-To: <20220827151513.736395-4-sjg@chromium.org>
On 8/27/22 17:15, Simon Glass wrote:
> This can be used by common files, so move it to the SCSI header and rename
> it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
> drivers/usb/emul/sandbox_flash.c | 24 +++++++++---------------
> include/scsi.h | 6 ++++++
> 2 files changed, 15 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/usb/emul/sandbox_flash.c b/drivers/usb/emul/sandbox_flash.c
> index 7de752100c8..806aed2ef2e 100644
> --- a/drivers/usb/emul/sandbox_flash.c
> +++ b/drivers/usb/emul/sandbox_flash.c
> @@ -23,12 +23,6 @@ enum {
> SANDBOX_FLASH_BLOCK_LEN = 512,
> };
>
> -enum cmd_phase {
> - PHASE_START,
> - PHASE_DATA,
> - PHASE_STATUS,
> -};
> -
> enum {
> STRINGID_MANUFACTURER = 1,
> STRINGID_PRODUCT,
> @@ -56,7 +50,7 @@ struct sandbox_flash_priv {
> int alloc_len;
> int transfer_len;
> int read_len;
> - enum cmd_phase phase;
> + enum scsi_cmd_phase phase;
> u32 tag;
> int fd;
> loff_t file_size;
> @@ -290,7 +284,7 @@ static int handle_ufi_command(struct sandbox_flash_plat *plat,
> return -EPROTONOSUPPORT;
> }
>
> - priv->phase = priv->transfer_len ? PHASE_DATA : PHASE_STATUS;
> + priv->phase = priv->transfer_len ? SCSIPH_DATA : SCSIPH_STATUS;
> return 0;
> }
>
> @@ -307,7 +301,7 @@ static int sandbox_flash_bulk(struct udevice *dev, struct usb_device *udev,
> switch (ep) {
> case SANDBOX_FLASH_EP_OUT:
> switch (priv->phase) {
> - case PHASE_START:
> + case SCSIPH_START:
> priv->alloc_len = 0;
> priv->read_len = 0;
> if (priv->error || len != UMASS_BBB_CBW_SIZE ||
> @@ -322,7 +316,7 @@ static int sandbox_flash_bulk(struct udevice *dev, struct usb_device *udev,
> priv->tag = cbw->dCBWTag;
> return handle_ufi_command(plat, priv, cbw->CBWCDB,
> cbw->bCDBLength);
> - case PHASE_DATA:
> + case SCSIPH_DATA:
> debug("data out\n");
> break;
> default:
> @@ -330,7 +324,7 @@ static int sandbox_flash_bulk(struct udevice *dev, struct usb_device *udev,
> }
> case SANDBOX_FLASH_EP_IN:
> switch (priv->phase) {
> - case PHASE_DATA:
> + case SCSIPH_DATA:
> debug("data in, len=%x, alloc_len=%x, priv->read_len=%x\n",
> len, priv->alloc_len, priv->read_len);
> if (priv->read_len) {
> @@ -344,22 +338,22 @@ static int sandbox_flash_bulk(struct udevice *dev, struct usb_device *udev,
> return -EIO;
> priv->read_len -= len / SANDBOX_FLASH_BLOCK_LEN;
> if (!priv->read_len)
> - priv->phase = PHASE_STATUS;
> + priv->phase = SCSIPH_STATUS;
> } else {
> if (priv->alloc_len && len > priv->alloc_len)
> len = priv->alloc_len;
> if (len > sizeof(priv->buff))
> len = sizeof(priv->buff);
> memcpy(buff, priv->buff, len);
> - priv->phase = PHASE_STATUS;
> + priv->phase = SCSIPH_STATUS;
> }
> return len;
> - case PHASE_STATUS:
> + case SCSIPH_STATUS:
> debug("status in, len=%x\n", len);
> if (len > sizeof(priv->status))
> len = sizeof(priv->status);
> memcpy(buff, &priv->status, len);
> - priv->phase = PHASE_START;
> + priv->phase = SCSIPH_START;
> return len;
> default:
> break;
> diff --git a/include/scsi.h b/include/scsi.h
> index e5d75b0cdca..5d63963bed0 100644
> --- a/include/scsi.h
> +++ b/include/scsi.h
> @@ -167,6 +167,12 @@ struct scsi_cmd {
> #define SCSI_WRITE_LONG 0x3F /* Write Long (O) */
> #define SCSI_WRITE_SAME 0x41 /* Write Same (O) */
>
> +enum scsi_cmd_phase {
Please, add Sphinx style description.
Best regards
Heinrich
> + SCSIPH_START,
> + SCSIPH_DATA,
> + SCSIPH_STATUS,
> +};
> +
> /**
> * struct scsi_plat - stores information about SCSI controller
> *
next prev parent reply other threads:[~2022-08-29 14:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-27 15:14 [PATCH 00/15] scsi: Convert sandbox SCSI to driver model Simon Glass
2022-08-27 15:14 ` [PATCH 01/15] scsi: Tidy up comments for struct scsi_cmd Simon Glass
2022-08-29 14:49 ` Heinrich Schuchardt
2022-08-27 15:15 ` [PATCH 02/15] sandbox: usb: Rename transfer_len in protocol struct Simon Glass
2022-08-27 15:15 ` [PATCH 03/15] scsi: Move cmd_phase enum to the header Simon Glass
2022-08-29 14:50 ` Heinrich Schuchardt [this message]
2022-08-27 15:15 ` [PATCH 04/15] scsi: Move core emulation state into a new struct Simon Glass
2022-08-27 15:15 ` [PATCH 05/15] sandbox: Move buffer to scsi_emul_info Simon Glass
2022-08-27 15:15 ` [PATCH 06/15] scsi: Move vendor/product info into the shared struct Simon Glass
2022-08-27 15:15 ` [PATCH 07/15] sandbox: scsi: Move block size into " Simon Glass
2022-08-27 15:15 ` [PATCH 08/15] sandbox: scsi: Move file " Simon Glass
2022-08-27 15:15 ` [PATCH 09/15] sandbox: scsi: Move reply setup out of helper Simon Glass
2022-08-27 15:15 ` [PATCH 10/15] sandbox: scsi: Remove setup calls from handle_read() Simon Glass
2022-08-27 15:15 ` [PATCH 11/15] sandbox: scsi: Move structs to header file Simon Glass
2022-08-29 14:51 ` Heinrich Schuchardt
2022-08-27 15:15 ` [PATCH 12/15] sandbox: Enable SCSI for all builds Simon Glass
2022-08-27 15:15 ` [PATCH 13/15] sandbox: scsi: Move request-handling code to scsi_emul Simon Glass
2022-08-27 15:15 ` [PATCH 14/15] sandbox: Convert to use driver model for SCSI Simon Glass
2022-08-27 15:15 ` [PATCH 15/15] sandbox: Add a test " Simon Glass
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=dc50cf3c-f8b0-76fb-f469-2ce855c973d3@gmx.de \
--to=xypron.glpk@gmx.de \
--cc=ascull@google.com \
--cc=marex@denx.de \
--cc=rob.herring@calxeda.com \
--cc=seanga2@gmail.com \
--cc=sjg@chromium.org \
--cc=sr@denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).