Re: svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread Warner Losh
Yea, that was a misfire It's been a long week and I didn't check before
I tried to commit and hit ^C too late when I realized my mistake.

Warner

On Fri, Jul 27, 2018 at 5:54 PM, Rodney W. Grimes <
free...@pdx.rh.cn85.dnsmgr.net> wrote:

> [ Charset UTF-8 unsupported, converting... ]
> > Author: imp
> > Date: Fri Jul 27 22:00:00 2018
> > New Revision: 336789
> > URL: https://svnweb.freebsd.org/changeset/base/336789
> >
> > Log:
> >   stand debug
>
> Thats a bit brief for a commit message...
>
> > Modified:
> >   head/stand/efi/loader/main.c
> >
> > Modified: head/stand/efi/loader/main.c
> > 
> ==
> > --- head/stand/efi/loader/main.c  Fri Jul 27 21:50:10 2018
> (r336788)
> > +++ head/stand/efi/loader/main.c  Fri Jul 27 22:00:00 2018
> (r336789)
> > @@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >   char *kernel = NULL;
> >   FILEPATH_DEVICE_PATH  *fp;
> >   struct stat st;
> > + CHAR16 *text;
> >
> >   /*
> >* FreeBSD encodes it's boot loading path into the boot loader
> > @@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >   if ((char *)edp > ep)
> >   return NOT_SPECIFIC;
> >   while (dp < edp) {
> > + text = efi_devpath_name(dp);
> > + if (text != NULL) {
> > + printf("   BootInfo Path: %S\n", text);
> > + efi_free_devpath_name(text);
> > + }
> >   last_dp = dp;
> >   dp = (EFI_DEVICE_PATH *)((char *)dp +
> efi_devpath_length(dp));
> >   }
> > @@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >* path in it. Those show up as various VenHw() nodes
> >* which are basically opaque to us. Don't count those
> >* as something specifc.
> > +  * path in it...
> >*/
> > - if (last_dp == first_dp)
> > + if (last_dp == first_dp) {
> > + printf("Ignoring BootXXX: Only one DP found\n");
> >   return NOT_SPECIFIC;
> > - if (efi_devpath_to_media_path(last_dp) == NULL)
> > + }
> > + if (efi_devpath_to_media_path(path) == NULL) {
> > + printf("Ignoring Boot: No Media Path\n");
> >   return NOT_SPECIFIC;
> > + }
> >
> >   /*
> >* OK. At this point we either have a good path or a bad one.
> >* Let's check.
> >*/
> >   pp = efiblk_get_pdinfo_by_device_path(last_dp);
> > - if (pp == NULL)
> > + if (pp == NULL) {
> > + printf("Ignoring Boot: Device Path not found\n");
> >   return BAD_CHOICE;
> > + }
> >   set_currdev_pdinfo(pp);
> > - if (!sanity_check_currdev())
> > + if (!sanity_check_currdev()){
> > + printf("Ignoring BootXXX: sanity check failed\n");
> >   return BAD_CHOICE;
> > + }
> >
> >   /*
> >* OK. We've found a device that matches, next we need to check
> the last
> > @@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >*/
> >   dp = efi_devpath_last_node(last_dp);
> >   if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
> > - DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
> > + DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
> > + printf("Using Boot for root partition\n");
> >   return (BOOT_INFO_OK);  /* use currdir, default
> kernel */
> > + }
> >   fp = (FILEPATH_DEVICE_PATH *)dp;
> >   ucs2_to_utf8(fp->PathName, );
> > - if (kernel == NULL)
> > + if (kernel == NULL) {
> > + printf("Not using BootXXX: can't decode kernel\n");
> >   return (BAD_CHOICE);
> > + }
> >   if (*kernel == '\\' || isupper(*kernel))
> >   fix_dosisms(kernel);
> >   if (stat(kernel, ) != 0) {
> >   free(kernel);
> > + printf("Not using BootXXX: can't find %s\n", kernel);
> >   return (BAD_CHOICE);
> >   }
> >   setenv("kernel", kernel, 1);
> >   free(kernel);
> > + text = efi_devpath_name(last_dp);
> > + if (text) {
> > + printf("Using BootXXX %S + %s\n", text, kernel);
> > + efi_free_devpath_name(text);
> > + }
> >
> >   return (BOOT_INFO_OK);
> >  }
> > @@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool
> do_bootmgr, b
> >   if (sanity_check_currdev())
> >   return (0);
> >   if (dp->pd_parent != NULL) {
> > + pdinfo_t *espdp = dp;
> >   dp = dp->pd_parent;
> >   STAILQ_FOREACH(pp, >pd_part, pd_link) {
> > + /* Already tried the ESP */
> > + if (espdp == pp)
> > + continue;
> >   /*
> >

Re: svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread Rodney W. Grimes
[ Charset UTF-8 unsupported, converting... ]
> Author: imp
> Date: Fri Jul 27 22:00:00 2018
> New Revision: 336789
> URL: https://svnweb.freebsd.org/changeset/base/336789
> 
> Log:
>   stand debug

Thats a bit brief for a commit message...

> Modified:
>   head/stand/efi/loader/main.c
> 
> Modified: head/stand/efi/loader/main.c
> ==
> --- head/stand/efi/loader/main.c  Fri Jul 27 21:50:10 2018
> (r336788)
> +++ head/stand/efi/loader/main.c  Fri Jul 27 22:00:00 2018
> (r336789)
> @@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   char *kernel = NULL;
>   FILEPATH_DEVICE_PATH  *fp;
>   struct stat st;
> + CHAR16 *text;
>  
>   /*
>* FreeBSD encodes it's boot loading path into the boot loader
> @@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   if ((char *)edp > ep)
>   return NOT_SPECIFIC;
>   while (dp < edp) {
> + text = efi_devpath_name(dp);
> + if (text != NULL) {
> + printf("   BootInfo Path: %S\n", text);
> + efi_free_devpath_name(text);
> + }
>   last_dp = dp;
>   dp = (EFI_DEVICE_PATH *)((char *)dp + efi_devpath_length(dp));
>   }
> @@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>* path in it. Those show up as various VenHw() nodes
>* which are basically opaque to us. Don't count those
>* as something specifc.
> +  * path in it...
>*/
> - if (last_dp == first_dp)
> + if (last_dp == first_dp) {
> + printf("Ignoring BootXXX: Only one DP found\n");
>   return NOT_SPECIFIC;
> - if (efi_devpath_to_media_path(last_dp) == NULL)
> + }
> + if (efi_devpath_to_media_path(path) == NULL) {
> + printf("Ignoring Boot: No Media Path\n");
>   return NOT_SPECIFIC;
> + }
>  
>   /*
>* OK. At this point we either have a good path or a bad one.
>* Let's check.
>*/
>   pp = efiblk_get_pdinfo_by_device_path(last_dp);
> - if (pp == NULL)
> + if (pp == NULL) {
> + printf("Ignoring Boot: Device Path not found\n");
>   return BAD_CHOICE;
> + }
>   set_currdev_pdinfo(pp);
> - if (!sanity_check_currdev())
> + if (!sanity_check_currdev()){
> + printf("Ignoring BootXXX: sanity check failed\n");
>   return BAD_CHOICE;
> + }
>  
>   /*
>* OK. We've found a device that matches, next we need to check the last
> @@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>*/
>   dp = efi_devpath_last_node(last_dp);
>   if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
> - DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
> + DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
> + printf("Using Boot for root partition\n");
>   return (BOOT_INFO_OK);  /* use currdir, default kernel 
> */
> + }
>   fp = (FILEPATH_DEVICE_PATH *)dp;
>   ucs2_to_utf8(fp->PathName, );
> - if (kernel == NULL)
> + if (kernel == NULL) {
> + printf("Not using BootXXX: can't decode kernel\n");
>   return (BAD_CHOICE);
> + }
>   if (*kernel == '\\' || isupper(*kernel))
>   fix_dosisms(kernel);
>   if (stat(kernel, ) != 0) {
>   free(kernel);
> + printf("Not using BootXXX: can't find %s\n", kernel);
>   return (BAD_CHOICE);
>   }
>   setenv("kernel", kernel, 1);
>   free(kernel);
> + text = efi_devpath_name(last_dp);
> + if (text) {
> + printf("Using BootXXX %S + %s\n", text, kernel);
> + efi_free_devpath_name(text);
> + }
>  
>   return (BOOT_INFO_OK);
>  }
> @@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
>   if (sanity_check_currdev())
>   return (0);
>   if (dp->pd_parent != NULL) {
> + pdinfo_t *espdp = dp;
>   dp = dp->pd_parent;
>   STAILQ_FOREACH(pp, >pd_part, pd_link) {
> + /* Already tried the ESP */
> + if (espdp == pp)
> + continue;
>   /*
>* Roll up the ZFS special case
>* for those partitions that have
>* zpools on them.
>*/
> + text = efi_devpath_name(pp->pd_devpath);
> + if (text != NULL) {
> + printf("Trying: %S\n", text);
> + efi_free_devpath_name(text);
> +  

Re: svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread Warner Losh
On Fri, Jul 27, 2018 at 4:22 PM, O. Hartmann  wrote:

> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA512
>
> Am Fri, 27 Jul 2018 22:00:00 + (UTC)
> Warner Losh  schrieb:
>
> > Author: imp
> > Date: Fri Jul 27 22:00:00 2018
> > New Revision: 336789
> > URL: https://svnweb.freebsd.org/changeset/base/336789
> >
> > Log:
> >   stand debug
> >
> > Modified:
> >   head/stand/efi/loader/main.c
> >
> > Modified: head/stand/efi/loader/main.c
> > 
> ==
> > --- head/stand/efi/loader/main.c  Fri Jul 27 21:50:10 2018
> (r336788)
> > +++ head/stand/efi/loader/main.c  Fri Jul 27 22:00:00 2018
> (r336789)
> > @@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >   char *kernel = NULL;
> >   FILEPATH_DEVICE_PATH  *fp;
> >   struct stat st;
> > + CHAR16 *text;
> >
> >   /*
> >* FreeBSD encodes it's boot loading path into the boot loader
> > @@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >   if ((char *)edp > ep)
> >   return NOT_SPECIFIC;
> >   while (dp < edp) {
> > + text = efi_devpath_name(dp);
> > + if (text != NULL) {
> > + printf("   BootInfo Path: %S\n", text);
> > + efi_free_devpath_name(text);
> > + }
> >   last_dp = dp;
> >   dp = (EFI_DEVICE_PATH *)((char *)dp +
> efi_devpath_length(dp));
> >   }
> > @@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >* path in it. Those show up as various VenHw() nodes
> >* which are basically opaque to us. Don't count those
> >* as something specifc.
> > +  * path in it...
> >*/
> > - if (last_dp == first_dp)
> > + if (last_dp == first_dp) {
> > + printf("Ignoring BootXXX: Only one DP found\n");
> >   return NOT_SPECIFIC;
> > - if (efi_devpath_to_media_path(last_dp) == NULL)
> > + }
> > + if (efi_devpath_to_media_path(path) == NULL) {
> > + printf("Ignoring Boot: No Media Path\n");
> >   return NOT_SPECIFIC;
> > + }
> >
> >   /*
> >* OK. At this point we either have a good path or a bad one.
> >* Let's check.
> >*/
> >   pp = efiblk_get_pdinfo_by_device_path(last_dp);
> > - if (pp == NULL)
> > + if (pp == NULL) {
> > + printf("Ignoring Boot: Device Path not found\n");
> >   return BAD_CHOICE;
> > + }
> >   set_currdev_pdinfo(pp);
> > - if (!sanity_check_currdev())
> > + if (!sanity_check_currdev()){
> > + printf("Ignoring BootXXX: sanity check failed\n");
> >   return BAD_CHOICE;
> > + }
> >
> >   /*
> >* OK. We've found a device that matches, next we need to check
> the last
> > @@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused,
> char *
> >*/
> >   dp = efi_devpath_last_node(last_dp);
> >   if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
> > - DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
> > + DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
> > + printf("Using Boot for root partition\n");
> >   return (BOOT_INFO_OK);  /* use currdir, default
> kernel */
> > + }
> >   fp = (FILEPATH_DEVICE_PATH *)dp;
> >   ucs2_to_utf8(fp->PathName, );
> > - if (kernel == NULL)
> > + if (kernel == NULL) {
> > + printf("Not using BootXXX: can't decode kernel\n");
> >   return (BAD_CHOICE);
> > + }
> >   if (*kernel == '\\' || isupper(*kernel))
> >   fix_dosisms(kernel);
> >   if (stat(kernel, ) != 0) {
> >   free(kernel);
> > + printf("Not using BootXXX: can't find %s\n", kernel);
> >   return (BAD_CHOICE);
> >   }
> >   setenv("kernel", kernel, 1);
> >   free(kernel);
> > + text = efi_devpath_name(last_dp);
> > + if (text) {
> > + printf("Using BootXXX %S + %s\n", text, kernel);
> > + efi_free_devpath_name(text);
> > + }
> >
> >   return (BOOT_INFO_OK);
> >  }
> > @@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool
> do_bootmgr, b
> >   if (sanity_check_currdev())
> >   return (0);
> >   if (dp->pd_parent != NULL) {
> > + pdinfo_t *espdp = dp;
> >   dp = dp->pd_parent;
> >   STAILQ_FOREACH(pp, >pd_part, pd_link) {
> > + /* Already tried the ESP */
> > + if (espdp == pp)
> > + continue;
> >   /*
> >* Roll up the ZFS special case
> >* for those partitions that have
> >* zpools 

Re: svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Fri, 27 Jul 2018 22:00:00 + (UTC)
Warner Losh  schrieb:

> Author: imp
> Date: Fri Jul 27 22:00:00 2018
> New Revision: 336789
> URL: https://svnweb.freebsd.org/changeset/base/336789
> 
> Log:
>   stand debug
> 
> Modified:
>   head/stand/efi/loader/main.c
> 
> Modified: head/stand/efi/loader/main.c
> ==
> --- head/stand/efi/loader/main.c  Fri Jul 27 21:50:10 2018
> (r336788)
> +++ head/stand/efi/loader/main.c  Fri Jul 27 22:00:00 2018
> (r336789)
> @@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   char *kernel = NULL;
>   FILEPATH_DEVICE_PATH  *fp;
>   struct stat st;
> + CHAR16 *text;
>  
>   /*
>* FreeBSD encodes it's boot loading path into the boot loader
> @@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   if ((char *)edp > ep)
>   return NOT_SPECIFIC;
>   while (dp < edp) {
> + text = efi_devpath_name(dp);
> + if (text != NULL) {
> + printf("   BootInfo Path: %S\n", text);
> + efi_free_devpath_name(text);
> + }
>   last_dp = dp;
>   dp = (EFI_DEVICE_PATH *)((char *)dp + efi_devpath_length(dp));
>   }
> @@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>* path in it. Those show up as various VenHw() nodes
>* which are basically opaque to us. Don't count those
>* as something specifc.
> +  * path in it...
>*/
> - if (last_dp == first_dp)
> + if (last_dp == first_dp) {
> + printf("Ignoring BootXXX: Only one DP found\n");
>   return NOT_SPECIFIC;
> - if (efi_devpath_to_media_path(last_dp) == NULL)
> + }
> + if (efi_devpath_to_media_path(path) == NULL) {
> + printf("Ignoring Boot: No Media Path\n");
>   return NOT_SPECIFIC;
> + }
>  
>   /*
>* OK. At this point we either have a good path or a bad one.
>* Let's check.
>*/
>   pp = efiblk_get_pdinfo_by_device_path(last_dp);
> - if (pp == NULL)
> + if (pp == NULL) {
> + printf("Ignoring Boot: Device Path not found\n");
>   return BAD_CHOICE;
> + }
>   set_currdev_pdinfo(pp);
> - if (!sanity_check_currdev())
> + if (!sanity_check_currdev()){
> + printf("Ignoring BootXXX: sanity check failed\n");
>   return BAD_CHOICE;
> + }
>  
>   /*
>* OK. We've found a device that matches, next we need to check the last
> @@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>*/
>   dp = efi_devpath_last_node(last_dp);
>   if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
> - DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
> + DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
> + printf("Using Boot for root partition\n");
>   return (BOOT_INFO_OK);  /* use currdir, default kernel 
> */
> + }
>   fp = (FILEPATH_DEVICE_PATH *)dp;
>   ucs2_to_utf8(fp->PathName, );
> - if (kernel == NULL)
> + if (kernel == NULL) {
> + printf("Not using BootXXX: can't decode kernel\n");
>   return (BAD_CHOICE);
> + }
>   if (*kernel == '\\' || isupper(*kernel))
>   fix_dosisms(kernel);
>   if (stat(kernel, ) != 0) {
>   free(kernel);
> + printf("Not using BootXXX: can't find %s\n", kernel);
>   return (BAD_CHOICE);
>   }
>   setenv("kernel", kernel, 1);
>   free(kernel);
> + text = efi_devpath_name(last_dp);
> + if (text) {
> + printf("Using BootXXX %S + %s\n", text, kernel);
> + efi_free_devpath_name(text);
> + }
>  
>   return (BOOT_INFO_OK);
>  }
> @@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
>   if (sanity_check_currdev())
>   return (0);
>   if (dp->pd_parent != NULL) {
> + pdinfo_t *espdp = dp;
>   dp = dp->pd_parent;
>   STAILQ_FOREACH(pp, >pd_part, pd_link) {
> + /* Already tried the ESP */
> + if (espdp == pp)
> + continue;
>   /*
>* Roll up the ZFS special case
>* for those partitions that have
>* zpools on them.
>*/
> + text = efi_devpath_name(pp->pd_devpath);
> + if (text != NULL) {
> + printf("Trying: %S\n", text);
> + 

Re: svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread O. Hartmann
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

Am Fri, 27 Jul 2018 22:00:00 + (UTC)
Warner Losh  schrieb:

> Author: imp
> Date: Fri Jul 27 22:00:00 2018
> New Revision: 336789
> URL: https://svnweb.freebsd.org/changeset/base/336789
> 
> Log:
>   stand debug
> 
> Modified:
>   head/stand/efi/loader/main.c
> 
> Modified: head/stand/efi/loader/main.c
> ==
> --- head/stand/efi/loader/main.c  Fri Jul 27 21:50:10 2018
> (r336788)
> +++ head/stand/efi/loader/main.c  Fri Jul 27 22:00:00 2018
> (r336789)
> @@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   char *kernel = NULL;
>   FILEPATH_DEVICE_PATH  *fp;
>   struct stat st;
> + CHAR16 *text;
>  
>   /*
>* FreeBSD encodes it's boot loading path into the boot loader
> @@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>   if ((char *)edp > ep)
>   return NOT_SPECIFIC;
>   while (dp < edp) {
> + text = efi_devpath_name(dp);
> + if (text != NULL) {
> + printf("   BootInfo Path: %S\n", text);
> + efi_free_devpath_name(text);
> + }
>   last_dp = dp;
>   dp = (EFI_DEVICE_PATH *)((char *)dp + efi_devpath_length(dp));
>   }
> @@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>* path in it. Those show up as various VenHw() nodes
>* which are basically opaque to us. Don't count those
>* as something specifc.
> +  * path in it...
>*/
> - if (last_dp == first_dp)
> + if (last_dp == first_dp) {
> + printf("Ignoring BootXXX: Only one DP found\n");
>   return NOT_SPECIFIC;
> - if (efi_devpath_to_media_path(last_dp) == NULL)
> + }
> + if (efi_devpath_to_media_path(path) == NULL) {
> + printf("Ignoring Boot: No Media Path\n");
>   return NOT_SPECIFIC;
> + }
>  
>   /*
>* OK. At this point we either have a good path or a bad one.
>* Let's check.
>*/
>   pp = efiblk_get_pdinfo_by_device_path(last_dp);
> - if (pp == NULL)
> + if (pp == NULL) {
> + printf("Ignoring Boot: Device Path not found\n");
>   return BAD_CHOICE;
> + }
>   set_currdev_pdinfo(pp);
> - if (!sanity_check_currdev())
> + if (!sanity_check_currdev()){
> + printf("Ignoring BootXXX: sanity check failed\n");
>   return BAD_CHOICE;
> + }
>  
>   /*
>* OK. We've found a device that matches, next we need to check the last
> @@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
>*/
>   dp = efi_devpath_last_node(last_dp);
>   if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
> - DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
> + DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
> + printf("Using Boot for root partition\n");
>   return (BOOT_INFO_OK);  /* use currdir, default kernel 
> */
> + }
>   fp = (FILEPATH_DEVICE_PATH *)dp;
>   ucs2_to_utf8(fp->PathName, );
> - if (kernel == NULL)
> + if (kernel == NULL) {
> + printf("Not using BootXXX: can't decode kernel\n");
>   return (BAD_CHOICE);
> + }
>   if (*kernel == '\\' || isupper(*kernel))
>   fix_dosisms(kernel);
>   if (stat(kernel, ) != 0) {
>   free(kernel);
> + printf("Not using BootXXX: can't find %s\n", kernel);
>   return (BAD_CHOICE);
>   }
>   setenv("kernel", kernel, 1);
>   free(kernel);
> + text = efi_devpath_name(last_dp);
> + if (text) {
> + printf("Using BootXXX %S + %s\n", text, kernel);
> + efi_free_devpath_name(text);
> + }
>  
>   return (BOOT_INFO_OK);
>  }
> @@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
>   if (sanity_check_currdev())
>   return (0);
>   if (dp->pd_parent != NULL) {
> + pdinfo_t *espdp = dp;
>   dp = dp->pd_parent;
>   STAILQ_FOREACH(pp, >pd_part, pd_link) {
> + /* Already tried the ESP */
> + if (espdp == pp)
> + continue;
>   /*
>* Roll up the ZFS special case
>* for those partitions that have
>* zpools on them.
>*/
> + text = efi_devpath_name(pp->pd_devpath);
> + if (text != NULL) {
> + printf("Trying: %S\n", text);
> + 

svn commit: r336789 - head/stand/efi/loader

2018-07-27 Thread Warner Losh
Author: imp
Date: Fri Jul 27 22:00:00 2018
New Revision: 336789
URL: https://svnweb.freebsd.org/changeset/base/336789

Log:
  stand debug

Modified:
  head/stand/efi/loader/main.c

Modified: head/stand/efi/loader/main.c
==
--- head/stand/efi/loader/main.cFri Jul 27 21:50:10 2018
(r336788)
+++ head/stand/efi/loader/main.cFri Jul 27 22:00:00 2018
(r336789)
@@ -312,6 +312,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
char *kernel = NULL;
FILEPATH_DEVICE_PATH  *fp;
struct stat st;
+   CHAR16 *text;
 
/*
 * FreeBSD encodes it's boot loading path into the boot loader
@@ -349,6 +350,11 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
if ((char *)edp > ep)
return NOT_SPECIFIC;
while (dp < edp) {
+   text = efi_devpath_name(dp);
+   if (text != NULL) {
+   printf("   BootInfo Path: %S\n", text);
+   efi_free_devpath_name(text);
+   }
last_dp = dp;
dp = (EFI_DEVICE_PATH *)((char *)dp + efi_devpath_length(dp));
}
@@ -359,22 +365,31 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
 * path in it. Those show up as various VenHw() nodes
 * which are basically opaque to us. Don't count those
 * as something specifc.
+* path in it...
 */
-   if (last_dp == first_dp)
+   if (last_dp == first_dp) {
+   printf("Ignoring BootXXX: Only one DP found\n");
return NOT_SPECIFIC;
-   if (efi_devpath_to_media_path(last_dp) == NULL)
+   }
+   if (efi_devpath_to_media_path(path) == NULL) {
+   printf("Ignoring Boot: No Media Path\n");
return NOT_SPECIFIC;
+   }
 
/*
 * OK. At this point we either have a good path or a bad one.
 * Let's check.
 */
pp = efiblk_get_pdinfo_by_device_path(last_dp);
-   if (pp == NULL)
+   if (pp == NULL) {
+   printf("Ignoring Boot: Device Path not found\n");
return BAD_CHOICE;
+   }
set_currdev_pdinfo(pp);
-   if (!sanity_check_currdev())
+   if (!sanity_check_currdev()){
+   printf("Ignoring BootXXX: sanity check failed\n");
return BAD_CHOICE;
+   }
 
/*
 * OK. We've found a device that matches, next we need to check the last
@@ -386,20 +401,30 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char *
 */
dp = efi_devpath_last_node(last_dp);
if (DevicePathType(dp) !=  MEDIA_DEVICE_PATH ||
-   DevicePathSubType(dp) != MEDIA_FILEPATH_DP)
+   DevicePathSubType(dp) != MEDIA_FILEPATH_DP) {
+   printf("Using Boot for root partition\n");
return (BOOT_INFO_OK);  /* use currdir, default kernel 
*/
+   }
fp = (FILEPATH_DEVICE_PATH *)dp;
ucs2_to_utf8(fp->PathName, );
-   if (kernel == NULL)
+   if (kernel == NULL) {
+   printf("Not using BootXXX: can't decode kernel\n");
return (BAD_CHOICE);
+   }
if (*kernel == '\\' || isupper(*kernel))
fix_dosisms(kernel);
if (stat(kernel, ) != 0) {
free(kernel);
+   printf("Not using BootXXX: can't find %s\n", kernel);
return (BAD_CHOICE);
}
setenv("kernel", kernel, 1);
free(kernel);
+   text = efi_devpath_name(last_dp);
+   if (text) {
+   printf("Using BootXXX %S + %s\n", text, kernel);
+   efi_free_devpath_name(text);
+   }
 
return (BOOT_INFO_OK);
 }
@@ -499,13 +524,22 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b
if (sanity_check_currdev())
return (0);
if (dp->pd_parent != NULL) {
+   pdinfo_t *espdp = dp;
dp = dp->pd_parent;
STAILQ_FOREACH(pp, >pd_part, pd_link) {
+   /* Already tried the ESP */
+   if (espdp == pp)
+   continue;
/*
 * Roll up the ZFS special case
 * for those partitions that have
 * zpools on them.
 */
+   text = efi_devpath_name(pp->pd_devpath);
+   if (text != NULL) {
+   printf("Trying: %S\n", text);
+   efi_free_devpath_name(text);
+   }
if (try_as_currdev(dp, pp))
return (0);