Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot If the framebuffer node already exists, we...



details:   https://anonhg.NetBSD.org/src/rev/9d7430cf387c
branches:  trunk
changeset: 1015388:9d7430cf387c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Thu Oct 22 09:14:40 2020 +0000

description:
If the framebuffer node already exists, we don't need to create one

diffstat:

 sys/stand/efiboot/efifdt.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 2f4ab41b353a -r 9d7430cf387c sys/stand/efiboot/efifdt.c
--- a/sys/stand/efiboot/efifdt.c        Thu Oct 22 08:26:00 2020 +0000
+++ b/sys/stand/efiboot/efifdt.c        Thu Oct 22 09:14:40 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.c,v 1.25 2020/10/10 19:17:39 jmcneill Exp $ */
+/* $NetBSD: efifdt.c,v 1.26 2020/10/22 09:14:40 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -338,12 +338,18 @@
                        continue;
                }
 
+               snprintf(buf, sizeof(buf), "framebuffer@%" PRIx64, mode->FrameBufferBase);
+               fb = fdt_path_offset(fdt_data, buf);
+               if (fb >= 0) {
+                       /* Framebuffer node already exists, no need to create one */
+                       return;
+               }
+
                chosen = efi_fdt_chosen();
                fdt_setprop_u32(fdt_data, chosen, "#address-cells", 2);
                fdt_setprop_u32(fdt_data, chosen, "#size-cells", 2);
                fdt_setprop_empty(fdt_data, chosen, "ranges");
 
-               snprintf(buf, sizeof(buf), "framebuffer@%" PRIx64, mode->FrameBufferBase);
                fb = fdt_add_subnode(fdt_data, chosen, buf);
                if (fb < 0)
                        panic("FDT: Failed to create framebuffer node");



Home | Main Index | Thread Index | Old Index