[Pdbg] [PATCH 16/18] libpdbg: Add sbefifo based implementation of ocmb getscom/putscom

Amitay Isaacs amitay at ozlabs.org
Mon Sep 28 17:09:12 AEST 2020


On Mon, 2020-09-28 at 06:09 +0000, Joel Stanley wrote:
> On Thu, 24 Sep 2020 at 04:44, Amitay Isaacs <amitay at ozlabs.org>
> wrote:
> > Signed-off-by: Amitay Isaacs <amitay at ozlabs.org>
> > ---
> >  Makefile.am    |  1 +
> >  libpdbg/ocmb.c | 85
> > ++++++++++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 86 insertions(+)
> >  create mode 100644 libpdbg/ocmb.c
> > 
> > diff --git a/Makefile.am b/Makefile.am
> > index d902863..a970ab9 100644
> > --- a/Makefile.am
> > +++ b/Makefile.am
> > @@ -178,6 +178,7 @@ libpdbg_la_SOURCES = \
> >         libpdbg/kernel.c \
> >         libpdbg/libpdbg.c \
> >         libpdbg/libpdbg.h \
> > +       libpdbg/ocmb.c \
> >         libpdbg/operations.h \
> >         libpdbg/p8chip.c \
> >         libpdbg/p9chip.c \
> > diff --git a/libpdbg/ocmb.c b/libpdbg/ocmb.c
> > new file mode 100644
> > index 0000000..ef929f9
> > --- /dev/null
> > +++ b/libpdbg/ocmb.c
> > @@ -0,0 +1,85 @@
> > +/* Copyright 2020 IBM Corp.
> > + *
> > + * Licensed under the Apache License, Version 2.0 (the "License");
> > + * you may not use this file except in compliance with the
> > License.
> > + * You may obtain a copy of the License at
> > + *
> > + *     http://www.apache.org/licenses/LICENSE-2.0
> > + *
> > + * Unless required by applicable law or agreed to in writing,
> > software
> > + * distributed under the License is distributed on an "AS IS"
> > BASIS,
> > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> > + * implied.
> > + * See the License for the specific language governing permissions
> > and
> > + * limitations under the License.
> > + */
> > +#include <stdio.h>
> > +
> > +#include <libsbefifo/libsbefifo.h>
> > +
> > +#include "hwunit.h"
> > +
> > +static struct sbefifo *ocmb_to_sbefifo(struct ocmb *ocmb)
> > +{
> > +       struct pdbg_target *pib = pdbg_target_require_parent("pib",
> > &ocmb->target);
> > +       struct pdbg_target *target;
> > +       struct sbefifo *sbefifo = NULL;
> > +
> > +       pdbg_for_each_class_target("sbefifo", target) {
> > +               if (pdbg_target_index(target) ==
> > pdbg_target_index(pib)) {
> > +                       sbefifo = target_to_sbefifo(target);
> > +                       break;
> > +               }
> > +       }
> > +
> > +       assert(sbefifo);
> 
> So there will always be a sbefifo, unless the device tree is broken?
> Is there any point printing a message?

There must always be sbefifo in the backend device tree.  This is not
user controlled (users can only override system device tree), so it's
programming error and that's why the assert.

Amitay.
-- 

The best God is one that gives nothing and demands nothing. That is 
the only God you can count on.  - Conan



More information about the Pdbg mailing list