linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Gavin Shan <gwshan@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: qiudayu@linux.vnet.ibm.com, Gavin Shan <gwshan@linux.vnet.ibm.com>
Subject: Re: [1/4] powerpc/powernv: Sync header with firmware
Date: Thu, 25 Sep 2014 14:27:47 +1000 (EST)	[thread overview]
Message-ID: <20140925042747.8E2AE14016A@ozlabs.org> (raw)
In-Reply-To: <1409039779-392-2-git-send-email-gwshan@linux.vnet.ibm.com>

On Tue, 2014-26-08 at 07:56:16 UTC, Gavin Shan wrote:
> From: Mike Qiu <qiudayu@linux.vnet.ibm.com>
> 
> The patch synchronizes firmware header file (opal.h) for PCI error
> injection.
> 
> diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h
> index 4593a93..9113653 100644
> --- a/arch/powerpc/include/asm/opal.h
> +++ b/arch/powerpc/include/asm/opal.h
> @@ -200,6 +201,33 @@ enum OpalPciErrorSeverity {
>  	OPAL_EEH_SEV_INF	= 5
>  };
>  
> +enum OpalErrinjctType {
> +	OpalErrinjctTypeIoaBusError	= 0,
> +	OpalErrinjctTypeIoaBusError64	= 1,
> +
> +	/* IoaBusError & IoaBusError64 */
> +	OpalEjtIoaLoadMemAddr		= 0,
> +	OpalEjtIoaLoadMemData		= 1,
> +	OpalEjtIoaLoadIoAddr		= 2,
> +	OpalEjtIoaLoadIoData		= 3,
> +	OpalEjtIoaLoadConfigAddr	= 4,
> +	OpalEjtIoaLoadConfigData	= 5,
> +	OpalEjtIoaStoreMemAddr		= 6,
> +	OpalEjtIoaStoreMemData		= 7,
> +	OpalEjtIoaStoreIoAddr		= 8,
> +	OpalEjtIoaStoreIoData		= 9,
> +	OpalEjtIoaStoreConfigAddr	= 10,
> +	OpalEjtIoaStoreConfigData	= 11,
> +	OpalEjtIoaDmaReadMemAddr	= 12,
> +	OpalEjtIoaDmaReadMemData	= 13,
> +	OpalEjtIoaDmaReadMemMaster	= 14,
> +	OpalEjtIoaDmaReadMemTarget	= 15,
> +	OpalEjtIoaDmaWriteMemAddr	= 16,
> +	OpalEjtIoaDmaWriteMemData	= 17,
> +	OpalEjtIoaDmaWriteMemMaster	= 18,
> +	OpalEjtIoaDmaWriteMemTarget	= 19,
> +};

I realise these come from the skiboot source, but they're just too ugly.

Please use kernel style naming, like most of the rest of the file, eg:

	OPAL_ERR_INJECT_IOA_BUS_ERR

Also this enum seems to contain two separate types, the first two values are
the "type", and the rest are "functions".

The only usage I see is:

	/* Sanity check on error type */
	if (type < OpalErrinjctTypeIoaBusError   ||
	    type > OpalErrinjctTypeIoaBusError64 ||
	    function < OpalEjtIoaLoadMemAddr     ||
	    function > OpalEjtIoaDmaWriteMemTarget) {
		pr_warn("%s: Invalid error type %d-%d\n",
			__func__, type, function);
		return -ERANGE;
	}

So we could also just do:

# define OPAL_ERR_INJECT_TYPE_MIN	0
# define OPAL_ERR_INJECT_TYPE_MAX	1

# define OPAL_ERR_INJECT_FUNC_MIN	0
# define OPAL_ERR_INJECT_FUNC_MAX	19

	if (type < OPAL_ERR_INJECT_TYPE_MIN ||
	    type > OPAL_ERR_INJECT_TYPE_MAX ||
	    function < OPAL_ERR_INJECT_FUNC_MIN ||
	    function > OPAL_ERR_INJECT_FUNC_MIN)
	{
		pr_warn("%s: Invalid error type %d-%d\n", __func__, type, function);
		return -ERANGE;
	}


cheers

  reply	other threads:[~2014-09-25  4:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-26  7:56 [PATCH 0/4] powerpc/eeh: More precisely error injection Gavin Shan
2014-08-26  7:56 ` [PATCH 1/4] powerpc/powernv: Sync header with firmware Gavin Shan
2014-09-25  4:27   ` Michael Ellerman [this message]
2014-09-25  4:56     ` [1/4] " Gavin Shan
2014-09-26  6:48     ` Gavin Shan
2014-10-03  5:30     ` Stewart Smith
2014-10-03  6:40       ` Gavin Shan
2014-08-26  7:56 ` [PATCH 2/4] powerpc/eeh: Introduce eeh_ops::err_inject Gavin Shan
2014-09-24  2:23   ` [2/4] " Michael Ellerman
2014-08-26  7:56 ` [PATCH 3/4] powerpc/powernv: Add error injection debugfs entry Gavin Shan
2014-08-26  7:56 ` [PATCH 4/4] powerpc/powernv: Clear PAPR error injection registers Gavin Shan

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=20140925042747.8E2AE14016A@ozlabs.org \
    --to=mpe@ellerman.id.au \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=qiudayu@linux.vnet.ibm.com \
    /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).