Message ID | 1408423682-14297-1-git-send-email-mikey@neuling.org (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Michael Ellerman |
Headers | show |
On Tue, 2014-08-19 at 14:47 +1000, Michael Neuling wrote: > Currently there is no way to generically check if an OPAL call exists or not > from the host kernel. > > This adds an OPAL call opal_check_token() which tells you if the given token is > present in OPAL or not. > > Signed-off-by: Michael Neuling <mikey@neuling.org> > --- > arch/powerpc/include/asm/opal.h | 7 +++++++ > arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + > 2 files changed, 8 insertions(+) > > diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h > index 86055e5..4593a93 100644 > --- a/arch/powerpc/include/asm/opal.h > +++ b/arch/powerpc/include/asm/opal.h > @@ -135,6 +135,7 @@ struct opal_sg_list { > #define OPAL_FLASH_MANAGE 77 > #define OPAL_FLASH_UPDATE 78 > #define OPAL_RESYNC_TIMEBASE 79 > +#define OPAL_CHECK_TOKEN 80 > #define OPAL_DUMP_INIT 81 > #define OPAL_DUMP_INFO 82 > #define OPAL_DUMP_READ 83 > @@ -417,6 +418,11 @@ struct opal_msg { > __be64 params[8]; > }; > > +enum OpalCheckTokenStatus { > + OPAL_TOKEN_ABSENT = 0, > + OPAL_TOKEN_PRESENT = 1 > +}; I don't see this used anywhere? And NoCamelCase ! Yes I know there's lots in that file, but I didn't merge that :) cheers
On Mon, 2014-09-15 at 13:10 +1000, Michael Ellerman wrote: > On Tue, 2014-08-19 at 14:47 +1000, Michael Neuling wrote: > > Currently there is no way to generically check if an OPAL call exists or not > > from the host kernel. > > > > This adds an OPAL call opal_check_token() which tells you if the given token is > > present in OPAL or not. > > > > Signed-off-by: Michael Neuling <mikey@neuling.org> > > --- > > arch/powerpc/include/asm/opal.h | 7 +++++++ > > arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + > > 2 files changed, 8 insertions(+) > > > > diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h > > index 86055e5..4593a93 100644 > > --- a/arch/powerpc/include/asm/opal.h > > +++ b/arch/powerpc/include/asm/opal.h > > @@ -135,6 +135,7 @@ struct opal_sg_list { > > #define OPAL_FLASH_MANAGE 77 > > #define OPAL_FLASH_UPDATE 78 > > #define OPAL_RESYNC_TIMEBASE 79 > > +#define OPAL_CHECK_TOKEN 80 > > #define OPAL_DUMP_INIT 81 > > #define OPAL_DUMP_INFO 82 > > #define OPAL_DUMP_READ 83 > > @@ -417,6 +418,11 @@ struct opal_msg { > > __be64 params[8]; > > }; > > > > +enum OpalCheckTokenStatus { > > + OPAL_TOKEN_ABSENT = 0, > > + OPAL_TOKEN_PRESENT = 1 > > +}; > > I don't see this used anywhere? > > And NoCamelCase ! We can probably just delete the enum since we are just doing this in code anyway: if (!opal_check_token(OPAL_RTC_READ)) goto out; OK? Or would you prefer the usage to read: if (opal_check_token(OPAL_RTC_READ) == OPAL_TOKEN_ABSENT) goto out; > Yes I know there's lots in that file, but I didn't merge that :) Fickle bloody maintainers. I thought I never say this but... I want our crazy Frenchman back! :-P Mikey
On Mon, 2014-09-15 at 13:10 +1000, Michael Ellerman wrote: > > +enum OpalCheckTokenStatus { > > + OPAL_TOKEN_ABSENT = 0, > > + OPAL_TOKEN_PRESENT = 1 > > +}; > > I don't see this used anywhere? > > And NoCamelCase ! > > Yes I know there's lots in that file, but I didn't merge that :) The original OPAL APIs were like that and I chose to not "fix" them because I've been aiming at reconciling the Linux and the FW versions of the file, which I haven't had a chance to do yet (Cyril & Sam have some WIP in that area afaik). We could de-camelify them both but I'd rather do the reunification first. Cheers, Ben.
Michael Neuling <mikey@neuling.org> writes: > Currently there is no way to generically check if an OPAL call exists or not > from the host kernel. > > This adds an OPAL call opal_check_token() which tells you if the given token is > present in OPAL or not. > > Signed-off-by: Michael Neuling <mikey@neuling.org> (checked the firmware code) Reviewed-by: Stewart Smith <stewart@linux.vnet.ibm.com> (although should we be checking if the call returns OPAL_PARAMETER? The opal call will return that if booting on firmware without OPAL_CHECK_TOKEN.. which granted, is pretty old firmware that I don't *think* we had leave the lab... or at least not to too many places)
diff --git a/arch/powerpc/include/asm/opal.h b/arch/powerpc/include/asm/opal.h index 86055e5..4593a93 100644 --- a/arch/powerpc/include/asm/opal.h +++ b/arch/powerpc/include/asm/opal.h @@ -135,6 +135,7 @@ struct opal_sg_list { #define OPAL_FLASH_MANAGE 77 #define OPAL_FLASH_UPDATE 78 #define OPAL_RESYNC_TIMEBASE 79 +#define OPAL_CHECK_TOKEN 80 #define OPAL_DUMP_INIT 81 #define OPAL_DUMP_INFO 82 #define OPAL_DUMP_READ 83 @@ -417,6 +418,11 @@ struct opal_msg { __be64 params[8]; }; +enum OpalCheckTokenStatus { + OPAL_TOKEN_ABSENT = 0, + OPAL_TOKEN_PRESENT = 1 +}; + struct opal_machine_check_event { enum OpalMCE_Version version:8; /* 0x00 */ uint8_t in_use; /* 0x01 */ @@ -887,6 +893,7 @@ int64_t opal_pci_next_error(uint64_t phb_id, __be64 *first_frozen_pe, __be16 *pci_error_type, __be16 *severity); int64_t opal_pci_poll(uint64_t phb_id); int64_t opal_return_cpu(void); +int64_t opal_check_token(uint64_t token); int64_t opal_reinit_cpus(uint64_t flags); int64_t opal_xscom_read(uint32_t gcid, uint64_t pcb_addr, __be64 *val); diff --git a/arch/powerpc/platforms/powernv/opal-wrappers.S b/arch/powerpc/platforms/powernv/opal-wrappers.S index 2e6ce1b..5718855 100644 --- a/arch/powerpc/platforms/powernv/opal-wrappers.S +++ b/arch/powerpc/platforms/powernv/opal-wrappers.S @@ -232,6 +232,7 @@ OPAL_CALL(opal_validate_flash, OPAL_FLASH_VALIDATE); OPAL_CALL(opal_manage_flash, OPAL_FLASH_MANAGE); OPAL_CALL(opal_update_flash, OPAL_FLASH_UPDATE); OPAL_CALL(opal_resync_timebase, OPAL_RESYNC_TIMEBASE); +OPAL_CALL(opal_check_token, OPAL_CHECK_TOKEN); OPAL_CALL(opal_dump_init, OPAL_DUMP_INIT); OPAL_CALL(opal_dump_info, OPAL_DUMP_INFO); OPAL_CALL(opal_dump_info2, OPAL_DUMP_INFO2);
Currently there is no way to generically check if an OPAL call exists or not from the host kernel. This adds an OPAL call opal_check_token() which tells you if the given token is present in OPAL or not. Signed-off-by: Michael Neuling <mikey@neuling.org> --- arch/powerpc/include/asm/opal.h | 7 +++++++ arch/powerpc/platforms/powernv/opal-wrappers.S | 1 + 2 files changed, 8 insertions(+)