Patchwork use public interface to detect CAS reboots (take 2)

login
register
mail settings
Submitter Michael Wolf
Date Jan. 15, 2008, 8:33 p.m.
Message ID <478D18AF.8040009@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/22965/
State Accepted
Commit 0c0a18b7a1a6b44963da4469d21428e76f9c2b30
Headers show

Comments

Michael Wolf - Jan. 15, 2008, 8:33 p.m.
This is the second pass of this patch.  The fw variable name is changed
to use ibm,client-architecture-support-reboot field which is already present
in the firmware.  Please disregard the previous patch.

The firmware field used to detect CAS reboots (ibm,fw-nbr-reboots) is 
really a private field that could change without warning.  A new field 
ibm,#reconfig-reboots will be added as a public interface intended to 
be used for this detection.  The patch will first check for 
ibm,client-architecture-support-reboot if that is not found it will see 
if ibm,fw-nbr-reboots is present and will use that instead.


-------
Doug Maxey - Jan. 15, 2008, 8:40 p.m.
On Tue, 15 Jan 2008 14:33:51 CST, Mike Wolf wrote:
> This is the second pass of this patch.  The fw variable name is changed
> to use ibm,client-architecture-support-reboot field which is already present
> in the firmware.  Please disregard the previous patch.
> 
> The firmware field used to detect CAS reboots (ibm,fw-nbr-reboots) is 
> really a private field that could change without warning.  A new field 
> ibm,#reconfig-reboots will be added as a public interface intended to 
> be used for this detection.  The patch will first check for 
> ibm,client-architecture-support-reboot if that is not found it will see 
> if ibm,fw-nbr-reboots is present and will use that instead.
> 
> 
> -------
> 
> 
> diff --git a/second/yaboot.c b/second/yaboot.c
> index 5fc1213..3d93275 100644
> --- a/second/yaboot.c
> +++ b/second/yaboot.c
> @@ -1702,7 +1702,8 @@ yaboot_main(void)
>       DEBUG_F("/chosen/bootargs = %s\n", bootargs);
>       prom_get_chosen("bootpath", bootdevice, BOOTDEVSZ);
>       DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
> -     prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);
> +     if (prom_get_options("ibm,client-architecture-support-reboot",fw_nbr_reboots, FW_NBR_REBOOTSZ) == -1 )
> +        prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);

What if the property does not exist?

>       fw_reboot_cnt = simple_strtol(fw_nbr_reboots,&endp,10);
>       if (fw_reboot_cnt > 0L)
>            prom_get_options("boot-last-label", bootlastlabel, BOOTLASTSZ);
> 
> 
> _______________________________________________
> Yaboot-devel mailing list
> Yaboot-devel@ozlabs.org
> https://ozlabs.org/mailman/listinfo/yaboot-devel
>

Patch

diff --git a/second/yaboot.c b/second/yaboot.c
index 5fc1213..3d93275 100644
--- a/second/yaboot.c
+++ b/second/yaboot.c
@@ -1702,7 +1702,8 @@  yaboot_main(void)
      DEBUG_F("/chosen/bootargs = %s\n", bootargs);
      prom_get_chosen("bootpath", bootdevice, BOOTDEVSZ);
      DEBUG_F("/chosen/bootpath = %s\n", bootdevice);
-     prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);
+     if (prom_get_options("ibm,client-architecture-support-reboot",fw_nbr_reboots, FW_NBR_REBOOTSZ) == -1 )
+        prom_get_options("ibm,fw-nbr-reboots",fw_nbr_reboots, FW_NBR_REBOOTSZ);
      fw_reboot_cnt = simple_strtol(fw_nbr_reboots,&endp,10);
      if (fw_reboot_cnt > 0L)
           prom_get_options("boot-last-label", bootlastlabel, BOOTLASTSZ);