[Pdbg] [PATCH 08/18] libsbefifo: Add implementation of suspend_io chipop
Amitay Isaacs
amitay at ozlabs.org
Mon Sep 28 16:05:46 AEST 2020
On Mon, 2020-09-28 at 05:53 +0000, Joel Stanley wrote:
> On Thu, 24 Sep 2020 at 04:43, Amitay Isaacs <amitay at ozlabs.org>
> wrote:
> > Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
>
> Is there a document or source file you can refer to for the
> definition of these?
There is SBE interface specification document for P10 which has not yet
released. You can get access to current draft.
>
>
> > ---
> > libsbefifo/cmd_control.c | 51
> > ++++++++++++++++++++++++++++++++++++
> > libsbefifo/libsbefifo.h | 1 +
> > libsbefifo/sbefifo_private.h | 1 +
> > 3 files changed, 53 insertions(+)
> >
> > diff --git a/libsbefifo/cmd_control.c b/libsbefifo/cmd_control.c
> > index 9293ef9..4826b5d 100644
> > --- a/libsbefifo/cmd_control.c
> > +++ b/libsbefifo/cmd_control.c
> > @@ -76,3 +76,54 @@ int sbefifo_istep_execute(struct sbefifo_context
> > *sctx, uint8_t major, uint8_t m
> >
> > return rc;
> > }
> > +
> > +static int sbefifo_suspend_io_push(uint8_t **buf, uint32_t
> > *buflen)
> > +{
> > + uint32_t *msg;
> > + uint32_t nwords, cmd;
> > +
> > + nwords = 2;
> > + *buflen = nwords * sizeof(uint32_t);
> > + msg = malloc(*buflen);
> > + if (!msg)
> > + return ENOMEM;
> > +
> > + cmd = SBEFIFO_CMD_CLASS_CONTROL | SBEFIFO_CMD_SUSPEND_IO;
> > +
> > + msg[0] = htobe32(nwords);
> > + msg[1] = htobe32(cmd);
> > +
> > + *buf = (uint8_t *)msg;
> > + return 0;
> > +}
> > +
> > +static int sbefifo_suspend_io_pull(uint8_t *buf, uint32_t buflen)
> > +{
> > + if (buflen != 0)
> > + return EPROTO;
> > +
> > + return 0;
> > +}
> > +
> > +int sbefifo_suspend_io(struct sbefifo_context *sctx)
> > +{
> > + uint8_t *msg, *out;
> > + uint32_t msg_len, out_len;
> > + int rc;
> > +
> > + rc = sbefifo_suspend_io_push(&msg, &msg_len);
> > + if (rc)
> > + return rc;
> > +
> > + out_len = 0;
> > + rc = sbefifo_operation(sctx, msg, msg_len, &out, &out_len);
> > + free(msg);
> > + if (rc)
> > + return rc;
> > +
> > + rc = sbefifo_suspend_io_pull(out, out_len);
> > + if (out)
> > + free(out);
> > +
> > + return rc;
> > +}
> > diff --git a/libsbefifo/libsbefifo.h b/libsbefifo/libsbefifo.h
> > index 3af54b4..1c26ea3 100644
> > --- a/libsbefifo/libsbefifo.h
> > +++ b/libsbefifo/libsbefifo.h
> > @@ -73,6 +73,7 @@ uint32_t sbefifo_ffdc_get(struct sbefifo_context
> > *sctx, const uint8_t **ffdc, ui
> > void sbefifo_ffdc_dump(struct sbefifo_context *sctx);
> >
> > int sbefifo_istep_execute(struct sbefifo_context *sctx, uint8_t
> > major, uint8_t minor);
> > +int sbefifo_suspend_io(struct sbefifo_context *sctx);
> >
> > #define SBEFIFO_SCOM_OPERAND_NONE 0
> > #define SBEFIFO_SCOM_OPERAND_OR 1
> > diff --git a/libsbefifo/sbefifo_private.h
> > b/libsbefifo/sbefifo_private.h
> > index 6262c3e..5c9b10a 100644
> > --- a/libsbefifo/sbefifo_private.h
> > +++ b/libsbefifo/sbefifo_private.h
> > @@ -22,6 +22,7 @@
> >
> > #define SBEFIFO_CMD_CLASS_CONTROL 0xA100
> > #define SBEFIFO_CMD_EXECUTE_ISTEP 0x01
> > +#define SBEFIFO_CMD_SUSPEND_IO 0x02
> >
> > #define SBEFIFO_CMD_CLASS_SCOM 0xA200
> > #define SBEFIFO_CMD_GET_SCOM 0x01
> > --
> > 2.26.2
> >
> > --
> > Pdbg mailing list
> > Pdbg at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/pdbg
Amitay.
--
When you were born, you cried and world rejoiced. Live your life in such a
manner that when you die the world cries and you rejoice. - Old Indian
Saying
More information about the Pdbg
mailing list