Source-Changes-HG archive

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

[src/netbsd-9]: src Pull up following revision(s) (requested by manu in ticke...



details:   https://anonhg.NetBSD.org/src/rev/da24329d6da4
branches:  netbsd-9
changeset: 962974:da24329d6da4
user:      martin <martin%NetBSD.org@localhost>
date:      Tue Sep 17 19:31:59 2019 +0000

description:
Pull up following revision(s) (requested by manu in ticket #203):

        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
        sys/arch/i386/stand/efiboot/eficons.c: revision 1.7
        sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.5
        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

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

diffstat:

 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 +-
 29 files changed, 2481 insertions(+), 136 deletions(-)

diffs (truncated from 3179 to 300 lines):

diff -r 615daed3d4b6 -r da24329d6da4 share/man/man8/man8.x86/boot.8
--- a/share/man/man8/man8.x86/boot.8    Tue Sep 17 19:25:18 2019 +0000
+++ b/share/man/man8/man8.x86/boot.8    Tue Sep 17 19:31:59 2019 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: boot.8,v 1.15.2.1 2019/09/13 07:00:14 martin Exp $
+.\"    $NetBSD: boot.8,v 1.15.2.2 2019/09/17 19:32:00 martin Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -821,11 +821,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 615daed3d4b6 -r da24329d6da4 sys/arch/i386/include/Makefile
--- a/sys/arch/i386/include/Makefile    Tue Sep 17 19:25:18 2019 +0000
+++ b/sys/arch/i386/include/Makefile    Tue Sep 17 19:31:59 2019 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.49 2018/07/12 10:46:44 maxv Exp $
+#      $NetBSD: Makefile,v 1.49.4.1 2019/09/17 19:31:59 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 proc.h profile.h psl.h \
        pte.h ptrace.h \
        reg.h rwlock.h \
diff -r 615daed3d4b6 -r da24329d6da4 sys/arch/i386/include/multiboot2.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/include/multiboot2.h        Tue Sep 17 19:31:59 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;
+  char cmdline[0];
+};
+
+struct multiboot_tag_basic_meminfo
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+  multiboot_uint32_t mem_lower;
+  multiboot_uint32_t mem_upper;
+};
+
+struct multiboot_tag_bootdev
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+  multiboot_uint32_t biosdev;
+  multiboot_uint32_t slice;
+  multiboot_uint32_t part;
+};
+
+struct multiboot_tag_mmap
+{
+  multiboot_uint32_t type;
+  multiboot_uint32_t size;
+  multiboot_uint32_t entry_size;
+  multiboot_uint32_t entry_version;
+  struct multiboot_mmap_entry entries[0];  
+};
+
+struct multiboot_vbe_info_block
+{
+  multiboot_uint8_t external_specification[512];
+};
+
+struct multiboot_vbe_mode_info_block
+{



Home | Main Index | Thread Index | Old Index