Source-Changes-HG archive

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

[src/bouyer-socketcan]: src/sys/arch/i386/stand/efiboot/bootia32 1673439



details:   https://anonhg.NetBSD.org/src/rev/7aad4a3397d7
branches:  bouyer-socketcan
changeset: 820845:7aad4a3397d7
user:      nonaka <nonaka%NetBSD.org@localhost>
date:      Tue Feb 21 10:53:38 2017 +0000

description:
1673439

diffstat:

 sys/arch/i386/stand/efiboot/bootia32/Makefile      |  17 +++++
 sys/arch/i386/stand/efiboot/bootia32/efibootia32.c |  73 ++++++++++++++++++++++
 2 files changed, 90 insertions(+), 0 deletions(-)

diffs (98 lines):

diff -r 340be7afeadd -r 7aad4a3397d7 sys/arch/i386/stand/efiboot/bootia32/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/stand/efiboot/bootia32/Makefile     Tue Feb 21 10:53:38 2017 +0000
@@ -0,0 +1,17 @@
+#      $NetBSD: Makefile,v 1.2.6.2 2017/02/21 10:53:38 nonaka Exp $
+
+PROG=          bootia32.efi
+OBJFMT=                pei-i386
+
+EXTRA_SOURCES= efibootia32.c startprog32.S
+
+CPUFLAGS=      -march=i686 -mtune=i686
+GNUEFIARCH=    ia32
+LIBKERN_ARCH=  i386
+LIBGNUEFI_ARCH=        i386
+KLINK_MACHINE= i386
+
+CFLAGS+=       -m32
+AFLAGS+=       -m32
+
+.include "${.CURDIR}/../Makefile.efiboot"
diff -r 340be7afeadd -r 7aad4a3397d7 sys/arch/i386/stand/efiboot/bootia32/efibootia32.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/i386/stand/efiboot/bootia32/efibootia32.c        Tue Feb 21 10:53:38 2017 +0000
@@ -0,0 +1,73 @@
+/*     $NetBSD: efibootia32.c,v 1.2.6.2 2017/02/21 10:53:38 nonaka Exp $       */
+
+/*-
+ * Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "efiboot.h"
+
+#include <sys/bootblock.h>
+
+struct x86_boot_params boot_params;
+
+void startprog32_start(physaddr_t, uint32_t, uint32_t *, physaddr_t,
+    physaddr_t, physaddr_t, u_long, void *);
+extern void (*startprog32)(physaddr_t, uint32_t, uint32_t *, physaddr_t,
+    physaddr_t, physaddr_t, u_long, void *);
+extern u_int startprog32_size;
+
+void
+efi_md_init(void)
+{
+       EFI_STATUS status;
+       EFI_PHYSICAL_ADDRESS addr = EFI_ALLOCATE_MAX_ADDRESS;
+       u_int sz = EFI_SIZE_TO_PAGES(startprog32_size);
+
+       status = uefi_call_wrapper(BS->AllocatePages, 4, AllocateMaxAddress,
+           EfiLoaderData, sz, &addr);
+       if (EFI_ERROR(status))
+               Panic(L"%a: AllocatePages() failed: %d page(s): %r",
+                   __func__, sz, status);
+       startprog32 = (void *)(u_long)addr;
+       CopyMem(startprog32, startprog32_start, startprog32_size);
+}
+
+/* ARGSUSED */
+void
+startprog(physaddr_t entry, uint32_t argc, uint32_t *argv, physaddr_t sp)
+{
+
+       (*startprog32)(entry, argc, argv,
+           (physaddr_t)startprog32 + startprog32_size,
+           efi_kernel_start, efi_kernel_start + efi_loadaddr,
+           efi_kernel_size, startprog32);
+}
+
+/* ARGSUSED */
+void
+multiboot(physaddr_t entry, physaddr_t header, physaddr_t sp)
+{
+       Panic(L"%a: not implemented", __func__);
+}



Home | Main Index | Thread Index | Old Index