[Skiboot] [RFC PATCH 6/7] VAS: Define OPAL_VAS_READ_FIR interface
Alistair Popple
alistair at popple.id.au
Tue Nov 15 15:03:50 AEDT 2016
On Fri, 11 Nov 2016 08:56:54 AM Sukadev Bhattiprolu wrote:
> Implement the OPAL_VAS_READ_FIR interface to read a Fault Isolation
> Register (FIR) in VAS. Linux kernel can use this interface to dump these
> registers in case of a fault from VAS.
>
> Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> ---
> core/vas.c | 38 ++++++++++++++++++++++++++++++++++++++
> include/opal-api.h | 3 ++-
> 2 files changed, 40 insertions(+), 1 deletions(-)
>
> diff --git a/core/vas.c b/core/vas.c
> index a4c5948..e7079bb 100644
> --- a/core/vas.c
> +++ b/core/vas.c
> @@ -18,6 +18,13 @@
> #include <xscom.h>
> #include <vas.h>
>
> +#undef VAS_VERBOSE_DEBUG
> +#ifdef VAS_VERBOSE_DEBUG
> +#define vas_vdbg(__x,__fmt,...) prlog(PR_DEBUG,"VAS: " __fmt, ##__VA_ARGS)
> +#else
> +#define vas_vdbg(__x,__fmt,...) do { } while (0)
> +#endif
> +
> /*
> * TODO: Set to 64K after initial development.
> */
> @@ -80,6 +87,37 @@ __attrconst uint64_t vas_get_wcbs_bar(int chipid)
> return wcbs;
> }
>
> +/*
> + * Read the Fault Isolation Register (FIR) identified by @idx for chip
> + * @chip_id.
> + */
> +static int opal_vas_read_fir(uint32_t chip_id, int idx, uint64_t *val)
> +{
> + struct proc_chip *chip;
> + uint64_t reg;
> +
> + chip = get_chip(chip_id);
> + if (!chip)
> + return OPAL_PARAMETER;
> +
> + /* FIRs 1,2,4,5 are write-only, just return 0 in them. */
> + switch (idx) {
> + default: /* fall through to 0 */
Why fall through and not return OPAL_PARAMETER instead? Falling through makes
it difficult to add other register indexes in future and have the caller detect
this.
> + case 0: reg = VAS_FIR0; break;
> + case 3: reg = VAS_FIR3; break;
> + case 6: reg = VAS_FIR6; break;
> + case 7: reg = VAS_FIR7; break;
> +
> + case 1:
> + case 2:
> + case 4:
> + case 5: *val = 0ULL; return OPAL_SUCCESS;
> + }
> +
> + return vas_scom_read(chip, reg, val);
> +}
> +opal_call(OPAL_VAS_READ_FIR, opal_vas_read_fir, 3);
> +
> static int init_north_ctl(struct proc_chip *chip)
> {
> uint64_t val = 0ULL;
> diff --git a/include/opal-api.h b/include/opal-api.h
> index 05ff51d..9705ebd 100644
> --- a/include/opal-api.h
> +++ b/include/opal-api.h
> @@ -181,7 +181,8 @@
> #define OPAL_INT_SET_MFRR 125
> #define OPAL_PCI_TCE_KILL 126
> #define OPAL_NMMU_SET_PTCR 127
> -#define OPAL_LAST 127
> +#define OPAL_VAS_READ_FIR 128
> +#define OPAL_LAST 128
>
> /* Device tree flags */
>
>
More information about the Skiboot
mailing list