Source-Changes-HG archive

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

[src/netbsd-8]: src Pull up following revision(s) [adapted, via patch]



details:   https://anonhg.NetBSD.org/src/rev/164e6650bb0f
branches:  netbsd-8
changeset: 852547:164e6650bb0f
user:      martin <martin%NetBSD.org@localhost>
date:      Wed Sep 18 17:30:05 2019 +0000

description:
Pull up following revision(s) [adapted, via patch]
(requested by manu in ticket #1382):

        sys/arch/i386/include/multiboot2.h: revision 1.1
        sys/arch/i386/stand/lib/exec.c: revision 1.74
        sys/arch/i386/stand/efiboot/efiboot.c: revision 1.11
        sys/arch/i386/stand/efiboot/bootia32/multiboot32.S: revision 1.1
        sys/arch/i386/stand/lib/biosdisk.c: revision 1.52
        sys/arch/i386/stand/efiboot/bootx64/efibootx64.c: revision 1.5
        distrib/sets/lists/comp/md.amd64: revision 1.273
        sys/arch/i386/stand/efiboot/eficons.c: revision 1.7
        sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.5
        distrib/sets/lists/comp/md.i386: revision 1.191
        sys/arch/i386/stand/lib/libi386.h: revision 1.45
        sys/arch/i386/stand/lib/bootinfo_memmap.c: revision 1.6
        sys/arch/i386/stand/lib/pread.c: revision 1.8
        sys/arch/i386/stand/efiboot/efiboot.h: revision 1.10
        sys/arch/i386/stand/efiboot/bootia32/Makefile: revision 1.3
        sys/arch/i386/stand/lib/Makefile: revision 1.47
        sys/arch/i386/stand/efiboot/bootx64/Makefile: revision 1.2
        sys/arch/i386/stand/lib/multiboot.S: revision 1.3
        sys/arch/i386/stand/efiboot/bootx64/multiboot64.S: revision 1.1
        sys/arch/i386/stand/efiboot/efimemory.c: revision 1.9
        sys/arch/i386/stand/efiboot/boot.c: revision 1.16
        sys/arch/i386/include/Makefile: revision 1.50
        sys/arch/i386/stand/efiboot/Makefile.efiboot: revision 1.16
        share/man/man8/man8.x86/boot.8: revision 1.20
        sys/arch/i386/stand/boot/Makefile.boot: revision 1.73
        sys/arch/i386/stand/pxeboot/Makefile: revision 1.26
        sys/arch/i386/stand/lib/exec_multiboot1.c: revision 1.1
        sys/arch/i386/stand/netboot/Makefile.netboot: revision 1.11
        sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.1
        sys/arch/i386/stand/lib/biosdisk.h: revision 1.12
        sys/arch/i386/stand/lib/exec_multiboot2.c: revision 1.2
        sys/arch/i386/stand/dosboot/Makefile: revision 1.32
        sys/external/bsd/gnu-efi/dist/inc/efiapi.h (apply patch)

Add multiboot 2 support to x86 bootloaders

multiboot 2 is required to boot Xen on an EFI system.

This also require a kernel patch for properly discovering
the ACPI RSDP, which is available after 20190912, in
src/sys/arch/x86/acpi/acpi_machdep.c 1.26-1.28

There are a few missing bit in this multiboot 2 implementation
(which are unused by Xen):
- Header tags Address, Freambuffer, and Relocatable are ignored
- Tags APM and Network are not provided
- Tags ACPI old and ACP new are only provided for ACPI boot
- Tag boot device does not provides the subpart (BSD disklabel partition)

Notes:
- multiboot2 is disabled in dosboot, otherwise the binary
  gets too big and build fails.
- in src/sys/arch/i386/stand/efiboot, consinit() is renamed
  as efi_consinit() to avoid prototype conflicts in src/sys/sys/systm.h

Remove debug define.

It remained there unseen because it was misspelled!

Remove obsoeolete BUGS note that UEFI bootloader does not support multiboot

Add new multiboot2.h header.

diffstat:

 distrib/sets/lists/comp/md.amd64                   |     5 +-
 distrib/sets/lists/comp/md.i386                    |     3 +-
 share/man/man8/man8.x86/boot.8                     |     7 +-
 sys/arch/i386/include/Makefile                     |     4 +-
 sys/arch/i386/include/multiboot2.h                 |   417 +++++
 sys/arch/i386/stand/boot/Makefile.boot             |     5 +-
 sys/arch/i386/stand/dosboot/Makefile               |     5 +-
 sys/arch/i386/stand/efiboot/Makefile.efiboot       |     3 +-
 sys/arch/i386/stand/efiboot/boot.c                 |     4 +-
 sys/arch/i386/stand/efiboot/bootia32/Makefile      |     6 +-
 sys/arch/i386/stand/efiboot/bootia32/efibootia32.c |    23 +-
 sys/arch/i386/stand/efiboot/bootia32/multiboot32.S |    27 +
 sys/arch/i386/stand/efiboot/bootx64/Makefile       |     4 +-
 sys/arch/i386/stand/efiboot/bootx64/efibootx64.c   |    26 +-
 sys/arch/i386/stand/efiboot/bootx64/multiboot64.S  |    29 +
 sys/arch/i386/stand/efiboot/efiboot.c              |    16 +-
 sys/arch/i386/stand/efiboot/efiboot.h              |     7 +-
 sys/arch/i386/stand/efiboot/eficons.c              |     6 +-
 sys/arch/i386/stand/efiboot/efimemory.c            |    36 +-
 sys/arch/i386/stand/lib/Makefile                   |     3 +-
 sys/arch/i386/stand/lib/biosdisk.c                 |    16 +-
 sys/arch/i386/stand/lib/biosdisk.h                 |     5 +-
 sys/arch/i386/stand/lib/bootinfo_memmap.c          |    14 +-
 sys/arch/i386/stand/lib/exec.c                     |   102 +-
 sys/arch/i386/stand/lib/exec_multiboot1.c          |   159 +
 sys/arch/i386/stand/lib/exec_multiboot2.c          |  1642 ++++++++++++++++++++
 sys/arch/i386/stand/lib/libi386.h                  |    26 +-
 sys/arch/i386/stand/lib/multiboot.S                |    10 +-
 sys/arch/i386/stand/lib/pread.c                    |     7 +-
 sys/arch/i386/stand/netboot/Makefile.netboot       |     3 +-
 sys/arch/i386/stand/pxeboot/Makefile               |     5 +-
 sys/external/bsd/gnu-efi/dist/inc/efiapi.h         |     5 +-
 32 files changed, 2490 insertions(+), 140 deletions(-)

diffs (truncated from 3234 to 300 lines):

diff -r c6cf514536eb -r 164e6650bb0f distrib/sets/lists/comp/md.amd64
--- a/distrib/sets/lists/comp/md.amd64  Wed Sep 18 17:22:32 2019 +0000
+++ b/distrib/sets/lists/comp/md.amd64  Wed Sep 18 17:30:05 2019 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: md.amd64,v 1.243.4.1 2017/11/23 11:02:16 martin Exp $
-
+# $NetBSD: md.amd64,v 1.243.4.2 2019/09/18 17:30:05 martin Exp $
+# $NetBSD: md.amd64,v 1.243.4.2 2019/09/18 17:30:05 martin Exp $
 ./usr/include/amd64                            comp-c-include
 ./usr/include/amd64/ansi.h                     comp-c-include
 ./usr/include/amd64/aout_machdep.h             comp-c-include
@@ -446,6 +446,7 @@
 ./usr/include/i386/mcontext.h                  comp-c-include
 ./usr/include/i386/mtrr.h                      comp-c-include
 ./usr/include/i386/multiboot.h                 comp-c-include
+./usr/include/i386/multiboot2.h                        comp-c-include
 ./usr/include/i386/mutex.h                     comp-c-include
 ./usr/include/i386/npx.h                       comp-obsolete           obsolete
 ./usr/include/i386/param.h                     comp-c-include
diff -r c6cf514536eb -r 164e6650bb0f distrib/sets/lists/comp/md.i386
--- a/distrib/sets/lists/comp/md.i386   Wed Sep 18 17:22:32 2019 +0000
+++ b/distrib/sets/lists/comp/md.i386   Wed Sep 18 17:30:05 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: md.i386,v 1.167.4.1 2017/11/23 11:02:16 martin Exp $
+# $NetBSD: md.i386,v 1.167.4.2 2019/09/18 17:30:05 martin Exp $
 ./usr/include/clang-3.4/__wmmintrin_aes.h      comp-obsolete           obsolete
 ./usr/include/clang-3.4/__wmmintrin_pclmul.h   comp-obsolete           obsolete
 ./usr/include/clang-3.4/ammintrin.h            comp-obsolete           obsolete
@@ -377,6 +377,7 @@
 ./usr/include/i386/mouse.h                     comp-obsolete           obsolete
 ./usr/include/i386/mtrr.h                      comp-c-include
 ./usr/include/i386/multiboot.h                 comp-c-include
+./usr/include/i386/multiboot2.h                        comp-c-include
 ./usr/include/i386/mutex.h                     comp-c-include
 ./usr/include/i386/npx.h                       comp-obsolete           obsolete
 ./usr/include/i386/param.h                     comp-c-include
diff -r c6cf514536eb -r 164e6650bb0f share/man/man8/man8.x86/boot.8
--- a/share/man/man8/man8.x86/boot.8    Wed Sep 18 17:22:32 2019 +0000
+++ b/share/man/man8/man8.x86/boot.8    Wed Sep 18 17:30:05 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: boot.8,v 1.11.4.3 2019/09/18 17:22:32 martin Exp $
+.\"    $NetBSD: boot.8,v 1.11.4.4 2019/09/18 17:30:05 martin Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -825,11 +825,6 @@
 .Nx
 disklabel (if it is a hard disk).
 .Pp
-.Ic multiboot
-is not supported by
-.Tn UEFI
-bootstrap code.
-.Pp
 .Tn UEFI
 implementation are supposed to support either
 .Xr mbr 8
diff -r c6cf514536eb -r 164e6650bb0f sys/arch/i386/include/Makefile
--- a/sys/arch/i386/include/Makefile    Wed Sep 18 17:22:32 2019 +0000
+++ b/sys/arch/i386/include/Makefile    Wed Sep 18 17:30:05 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.44 2016/02/27 00:09:45 tls Exp $
+#      $NetBSD: Makefile,v 1.44.10.1 2019/09/18 17:30:05 martin Exp $
 
 INCSDIR= /usr/include/i386
 
@@ -15,7 +15,7 @@
        joystick.h \
        kcore.h \
        limits.h lock.h \
-       math.h mcontext.h mutex.h mtrr.h multiboot.h \
+       math.h mcontext.h mutex.h mtrr.h multiboot.h multiboot2.h \
        param.h pcb.h pio.h pmap.h pmc.h proc.h profile.h psl.h \
        pte.h ptrace.h \
        reg.h rwlock.h \
diff -r c6cf514536eb -r 164e6650bb0f sys/arch/i386/include/multiboot2.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/include/multiboot2.h        Wed Sep 18 17:30:05 2019 +0000
@@ -0,0 +1,417 @@
+/*  multiboot2.h - Multiboot 2 header file.  */
+/*  Copyright (C) 1999,2003,2007,2008,2009,2010  Free Software Foundation, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a copy
+ *  of this software and associated documentation files (the "Software"), to
+ *  deal in the Software without restriction, including without limitation the
+ *  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ *  sell copies of the Software, and to permit persons to whom the Software is
+ *  furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice shall be included in
+ *  all copies or substantial portions of the Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL ANY
+ *  DEVELOPER OR DISTRIBUTOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ *  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
+ *  IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef MULTIBOOT_HEADER
+#define MULTIBOOT_HEADER 1
+
+/* How many bytes from the start of the file we search for the header.  */
+#define MULTIBOOT_SEARCH                       32768
+#define MULTIBOOT_HEADER_ALIGN                 8
+
+/* The magic field should contain this.  */
+#define MULTIBOOT2_HEADER_MAGIC                        0xe85250d6
+
+/* This should be in %eax.  */
+#define MULTIBOOT2_BOOTLOADER_MAGIC            0x36d76289
+
+/* Alignment of multiboot modules.  */
+#define MULTIBOOT_MOD_ALIGN                    0x00001000
+
+/* Alignment of the multiboot info structure.  */
+#define MULTIBOOT_INFO_ALIGN                   0x00000008
+
+/* Flags set in the 'flags' member of the multiboot header.  */
+
+#define MULTIBOOT_TAG_ALIGN                  8
+#define MULTIBOOT_TAG_TYPE_END               0
+#define MULTIBOOT_TAG_TYPE_CMDLINE           1
+#define MULTIBOOT_TAG_TYPE_BOOT_LOADER_NAME  2
+#define MULTIBOOT_TAG_TYPE_MODULE            3
+#define MULTIBOOT_TAG_TYPE_BASIC_MEMINFO     4
+#define MULTIBOOT_TAG_TYPE_BOOTDEV           5
+#define MULTIBOOT_TAG_TYPE_MMAP              6
+#define MULTIBOOT_TAG_TYPE_VBE               7
+#define MULTIBOOT_TAG_TYPE_FRAMEBUFFER       8
+#define MULTIBOOT_TAG_TYPE_ELF_SECTIONS      9
+#define MULTIBOOT_TAG_TYPE_APM               10
+#define MULTIBOOT_TAG_TYPE_EFI32             11
+#define MULTIBOOT_TAG_TYPE_EFI64             12
+#define MULTIBOOT_TAG_TYPE_SMBIOS            13
+#define MULTIBOOT_TAG_TYPE_ACPI_OLD          14
+#define MULTIBOOT_TAG_TYPE_ACPI_NEW          15
+#define MULTIBOOT_TAG_TYPE_NETWORK           16
+#define MULTIBOOT_TAG_TYPE_EFI_MMAP          17
+#define MULTIBOOT_TAG_TYPE_EFI_BS            18
+#define MULTIBOOT_TAG_TYPE_EFI32_IH          19
+#define MULTIBOOT_TAG_TYPE_EFI64_IH          20
+#define MULTIBOOT_TAG_TYPE_LOAD_BASE_ADDR    21
+
+#define MULTIBOOT_HEADER_TAG_END  0
+#define MULTIBOOT_HEADER_TAG_INFORMATION_REQUEST  1
+#define MULTIBOOT_HEADER_TAG_ADDRESS  2
+#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS  3
+#define MULTIBOOT_HEADER_TAG_CONSOLE_FLAGS  4
+#define MULTIBOOT_HEADER_TAG_FRAMEBUFFER  5
+#define MULTIBOOT_HEADER_TAG_MODULE_ALIGN  6
+#define MULTIBOOT_HEADER_TAG_EFI_BS  7
+#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI32  8
+#define MULTIBOOT_HEADER_TAG_ENTRY_ADDRESS_EFI64  9
+#define MULTIBOOT_HEADER_TAG_RELOCATABLE  10
+
+#define MULTIBOOT_ARCHITECTURE_I386  0
+#define MULTIBOOT_ARCHITECTURE_MIPS32  4
+#define MULTIBOOT_HEADER_TAG_OPTIONAL 1
+
+#define MULTIBOOT_LOAD_PREFERENCE_NONE 0
+#define MULTIBOOT_LOAD_PREFERENCE_LOW 1
+#define MULTIBOOT_LOAD_PREFERENCE_HIGH 2
+
+#define MULTIBOOT_CONSOLE_FLAGS_CONSOLE_REQUIRED 1
+#define MULTIBOOT_CONSOLE_FLAGS_EGA_TEXT_SUPPORTED 2
+
+#ifndef ASM_FILE
+
+typedef unsigned char          multiboot_uint8_t;
+typedef unsigned short         multiboot_uint16_t;
+typedef unsigned int           multiboot_uint32_t;
+typedef unsigned long long     multiboot_uint64_t;
+
+struct multiboot_header
+{
+  /* Must be MULTIBOOT_MAGIC - see above.  */
+  multiboot_uint32_t magic;
+
+  /* ISA */
+  multiboot_uint32_t architecture;
+
+  /* Total header length.  */
+  multiboot_uint32_t header_length;
+
+  /* The above fields plus this one must equal 0 mod 2^32. */
+  multiboot_uint32_t checksum;
+};
+
+struct multiboot_header_tag
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+};
+
+struct multiboot_header_tag_information_request
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t requests[0];
+};
+
+struct multiboot_header_tag_address
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t header_addr;
+  multiboot_uint32_t load_addr;
+  multiboot_uint32_t load_end_addr;
+  multiboot_uint32_t bss_end_addr;
+};
+
+struct multiboot_header_tag_entry_address
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t entry_addr;
+};
+
+struct multiboot_header_tag_console_flags
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t console_flags;
+};
+
+struct multiboot_header_tag_framebuffer
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t width;
+  multiboot_uint32_t height;
+  multiboot_uint32_t depth;
+};
+
+struct multiboot_header_tag_module_align
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+};
+
+struct multiboot_header_tag_relocatable
+{
+  multiboot_uint16_t type;
+  multiboot_uint16_t flags;
+  multiboot_uint32_t size;
+  multiboot_uint32_t min_addr;
+  multiboot_uint32_t max_addr;
+  multiboot_uint32_t align;
+  multiboot_uint32_t preference;
+};
+
+struct multiboot_color
+{
+  multiboot_uint8_t red;
+  multiboot_uint8_t green;
+  multiboot_uint8_t blue;
+};
+
+struct multiboot_mmap_entry
+{
+  multiboot_uint64_t addr;
+  multiboot_uint64_t len;
+#define MULTIBOOT_MEMORY_AVAILABLE             1
+#define MULTIBOOT_MEMORY_RESERVED              2
+#define MULTIBOOT_MEMORY_ACPI_RECLAIMABLE       3
+#define MULTIBOOT_MEMORY_NVS                    4
+#define MULTIBOOT_MEMORY_BADRAM                 5
+  multiboot_uint32_t type;
+  multiboot_uint32_t zero;
+};
+typedef struct multiboot_mmap_entry multiboot_memory_map_t;
+
+struct multiboot_tag
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+};
+
+struct multiboot_tag_string
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+  char string[0];
+};
+
+struct multiboot_tag_module
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+  multiboot_uint32_t mod_start;
+  multiboot_uint32_t mod_end;



Home | Main Index | Thread Index | Old Index