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/5f0de7e0b403
branches:  trunk
changeset: 941470:5f0de7e0b403
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 9476060f6ece -r 5f0de7e0b403 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