Source-Changes-HG archive

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

[src/trunk]: src/sys/stand/efiboot Suppress printing size info when calling l...



details:   https://anonhg.NetBSD.org/src/rev/9ab6c47ec20c
branches:  trunk
changeset: 433456:9ab6c47ec20c
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Sep 15 17:06:32 2018 +0000

description:
Suppress printing size info when calling loadfile with COUNT_KERNEL

diffstat:

 sys/stand/efiboot/Makefile.efiboot |   3 ++-
 sys/stand/efiboot/efiboot.c        |  19 ++++++++++++++++++-
 sys/stand/efiboot/efiboot.h        |   5 ++++-
 sys/stand/efiboot/exec.c           |   9 ++++++---
 4 files changed, 30 insertions(+), 6 deletions(-)

diffs (120 lines):

diff -r c7d79463061a -r 9ab6c47ec20c sys/stand/efiboot/Makefile.efiboot
--- a/sys/stand/efiboot/Makefile.efiboot        Sat Sep 15 17:05:56 2018 +0000
+++ b/sys/stand/efiboot/Makefile.efiboot        Sat Sep 15 17:06:32 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.efiboot,v 1.4 2018/09/09 17:55:22 jmcneill Exp $
+# $NetBSD: Makefile.efiboot,v 1.5 2018/09/15 17:06:32 jmcneill Exp $
 
 S=             ${.CURDIR}/../../..
 
@@ -61,6 +61,7 @@
 COPTS+= ${${ACTIVE_CC} == "gcc":? -Wno-error=unused-but-set-variable :}
 CPPFLAGS+= -nostdinc -D_STANDALONE
 CPPFLAGS+= -DEFIBOOT
+CPPFLAGS+= -DPROGRESS_FN=efi_progress
 
 CPPFLAGS+= -Wall -Wmissing-prototypes
 CPPFLAGS+= -Wno-pointer-sign
diff -r c7d79463061a -r 9ab6c47ec20c sys/stand/efiboot/efiboot.c
--- a/sys/stand/efiboot/efiboot.c       Sat Sep 15 17:05:56 2018 +0000
+++ b/sys/stand/efiboot/efiboot.c       Sat Sep 15 17:06:32 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: efiboot.c,v 1.7 2018/09/15 16:41:57 jmcneill Exp $ */
+/* $NetBSD: efiboot.c,v 1.8 2018/09/15 17:06:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -31,10 +31,14 @@
 #include "efiblock.h"
 #include "efifdt.h"
 
+#include <sys/reboot.h>
+
 EFI_HANDLE IH;
 EFI_DEVICE_PATH *efi_bootdp;
 EFI_LOADED_IMAGE *efi_li;
 
+int howto = 0;
+
 static EFI_PHYSICAL_ADDRESS heap_start;
 static UINTN heap_size = 1 * 1024 * 1024;
 static EFI_EVENT delay_ev = 0;
@@ -133,3 +137,16 @@
        uefi_call_wrapper(BS->SetTimer, 3, delay_ev, TimerRelative, us * 10);
        uefi_call_wrapper(BS->WaitForEvent, 3, 1, &delay_ev, &val);
 }
+
+void
+efi_progress(const char *fmt, ...)
+{
+       va_list ap;
+
+       if ((howto & AB_SILENT) != 0)
+               return;
+
+       va_start(ap, fmt);
+       vprintf(fmt, ap);
+       va_end(ap);
+}
diff -r c7d79463061a -r 9ab6c47ec20c sys/stand/efiboot/efiboot.h
--- a/sys/stand/efiboot/efiboot.h       Sat Sep 15 17:05:56 2018 +0000
+++ b/sys/stand/efiboot/efiboot.h       Sat Sep 15 17:06:32 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: efiboot.h,v 1.6 2018/09/09 18:00:20 jmcneill Exp $     */
+/*     $NetBSD: efiboot.h,v 1.7 2018/09/15 17:06:32 jmcneill Exp $     */
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -32,6 +32,8 @@
 #include <lib/libsa/stand.h>
 #include <lib/libkern/libkern.h>
 
+#include <loadfile.h>
+
 #include "efiboot_machdep.h"
 
 struct boot_command {
@@ -56,6 +58,7 @@
 char *get_initrd_path(void);
 int set_dtb_path(char *);
 char *get_dtb_path(void);
+extern int howto;
 
 /* console.c */
 int ischar(void);
diff -r c7d79463061a -r 9ab6c47ec20c sys/stand/efiboot/exec.c
--- a/sys/stand/efiboot/exec.c  Sat Sep 15 17:05:56 2018 +0000
+++ b/sys/stand/efiboot/exec.c  Sat Sep 15 17:06:32 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.5 2018/09/09 13:37:54 jmcneill Exp $ */
+/* $NetBSD: exec.c,v 1.6 2018/09/15 17:06:32 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "efiboot.h"
 #include "efifdt.h"
 
-#include <loadfile.h>
+#include <sys/reboot.h>
 
 u_long load_offset = 0;
 
@@ -109,13 +109,16 @@
        EFI_PHYSICAL_ADDRESS addr;
        u_long marks[MARK_MAX], alloc_size;
        EFI_STATUS status;
-       int fd;
+       int fd, ohowto;
 
        load_file(get_initrd_path(), &initrd_addr, &initrd_size);
        load_file(get_dtb_path(), &dtb_addr, &dtb_size);
 
        memset(marks, 0, sizeof(marks));
+       ohowto = howto;
+       howto |= AB_SILENT;
        fd = loadfile(fname, marks, COUNT_KERNEL | LOAD_NOTE);
+       howto = ohowto;
        if (fd < 0) {
                printf("boot: %s: %s\n", fname, strerror(errno));
                return EIO;



Home | Main Index | Thread Index | Old Index