Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Oct 2019 02:46:37 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r353980 - in stable/12/stand: efi/loader fdt
Message-ID:  <201910240246.x9O2kbMB093653@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Oct 24 02:46:36 2019
New Revision: 353980
URL: https://svnweb.freebsd.org/changeset/base/353980

Log:
  MFC r346701: loader: fdt: Add fdt_is_setup function
  
  When efi_autoload is called it will call fdt_setup_fdtp which setup the
  dtb and overlays. If a user already loaded at dtb or overlays or just
  printed the efi provided dtb, this will re-setup everything and also
  re-applying the overlays.
  Test that everything is setup before doing it again.

Modified:
  stable/12/stand/efi/loader/autoload.c
  stable/12/stand/fdt/fdt_loader_cmd.c
  stable/12/stand/fdt/fdt_platform.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/stand/efi/loader/autoload.c
==============================================================================
--- stable/12/stand/efi/loader/autoload.c	Thu Oct 24 02:43:38 2019	(r353979)
+++ stable/12/stand/efi/loader/autoload.c	Thu Oct 24 02:46:36 2019	(r353980)
@@ -50,7 +50,8 @@ efi_autoload(void)
 	 * imply that we're on a platform where FDT is a requirement.  If we
 	 * fix this, then the error handling here should be fixed accordingly.
 	 */
-	fdt_setup_fdtp();
+	if (fdt_is_setup() == 0)
+		fdt_setup_fdtp();
 #endif
 	return (0);
 }

Modified: stable/12/stand/fdt/fdt_loader_cmd.c
==============================================================================
--- stable/12/stand/fdt/fdt_loader_cmd.c	Thu Oct 24 02:43:38 2019	(r353979)
+++ stable/12/stand/fdt/fdt_loader_cmd.c	Thu Oct 24 02:46:36 2019	(r353980)
@@ -510,6 +510,16 @@ fdt_apply_overlays()
 }
 
 int
+fdt_is_setup(void)
+{
+
+	if (fdtp != NULL)
+		return (1);
+
+	return (0);
+}
+
+int
 fdt_setup_fdtp()
 {
 	struct preloaded_file *bfp;

Modified: stable/12/stand/fdt/fdt_platform.h
==============================================================================
--- stable/12/stand/fdt/fdt_platform.h	Thu Oct 24 02:43:38 2019	(r353979)
+++ stable/12/stand/fdt/fdt_platform.h	Thu Oct 24 02:46:36 2019	(r353980)
@@ -48,6 +48,7 @@ int fdt_load_dtb_addr(struct fdt_header *);
 int fdt_load_dtb_file(const char *);
 void fdt_load_dtb_overlays(const char *);
 int fdt_setup_fdtp(void);
+int fdt_is_setup(void);
 
 /* The platform library needs to implement these functions */
 int fdt_platform_load_dtb(void);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910240246.x9O2kbMB093653>