svn commit: r271135 - in stable/10: lib/libstand sys/boot sys/boot/amd64 sys/boot/amd64/efi sys/boot/efi sys/boot/efi/include sys/boot/efi/include/amd64 sys/boot/efi/libefi sys/boot/ficl sys/boot/f...
Ed Maste
emaste at FreeBSD.org
Thu Sep 4 21:01:16 UTC 2014
Author: emaste
Date: Thu Sep 4 21:01:10 2014
New Revision: 271135
URL: http://svnweb.freebsd.org/changeset/base/271135
Log:
MFC UEFI loader
This MFC consists of the following SVN revisions:
258741 261568 261603 261668 263115 263117 263968 264078 264087 264088
264092 264095 264115 264132 264208 264261 264262 264263 264319 265028
265057 268974
Detailed commit messages:
r258741: Note that libstand is 32-bit on amd64 and powerpc64
r261568: Build libstand as a 64-bit library on amd64
The 32-bit bootloaders now link against libstand.a in
sys/boot/libstand32, so there is no need to force /usr/lib/libstand.a
to be 32-bit.
r261603: Don't force efi to a 32-bit build on amd64
r261668: Build libstand as a 64-bit library on ppc64
The 32-bit bootloaders now link against libstand.a in
sys/boot/libstand32, so there is no need to force /usr/lib/libstand.a
to be 32-bit.
This is equivalent to r261568 for amd64.
r263115: Add amd64 EFI headers
r263117: Connect 64-bit boot ficl to the build
It is not yet used, but this will ensure it doesn't get broken.
r263968: Use EFI types for EFI values (silences warnings).
EFI UINTN is actually a 64-bit type on 64-bit processors.
r264078: Put each source file on a separate line
This will simplify rebasing the amd64 UEFI patch set.
r264087: Build boot/ficl as 64-bit library on amd64
The 32-bit bootloaders on amd64 now use the 32-bit version in ficl32,
as is done with libstand32. The native 64-bit ficl will be used by the
upcoming UEFI loader.
r264088: Merge efilib changes from projects/uefi
r247216: Add the ability for a device to have an "alias" handle.
r247379: Fix network device registration.
r247380: Adjust our load device when we boot from CD under UEFI.
The process for booting from a CD under UEFI involves adding a FAT
filesystem containing your loader code as an El Torito boot image.
When UEFI detects this, it provides a block IO instance that points
at the FAT filesystem as a child of the device that represents the CD
itself. The problem being that the CD device is flagged as a "raw
device" while the boot image is flagged as a "logical partition".
The existing EFI partition code only looks for logical partitions and
so the CD filesystem was rendered invisible.
To fix this, check the type of each block IO device. If it's found to
be a CD, and thus an El Torito boot image, look up its parent device
and add that instead so that the loader will then load the kernel from
the CD filesystem. This is done by using the handle for the boot
filesystem as an alias.
Something similar to this will be required for booting from other media
as well as the loader will live in the EFI system partition, not on the
partition containing the kernel.
r247381: Remove a scatalogical debug printf that crept in.
r264092: Add -fPIC for amd64
r264095: Support UEFI booting on amd64 via loader.efi
This is largely the work from the projects/uefi branch, with some
additional refinements. This is derived from (and replaces) the
original i386 efi implementation; i386 support will be restored later.
Specific revisions of note from projects/uefi:
r247380:
Adjust our load device when we boot from CD under UEFI.
The process for booting from a CD under UEFI involves adding a FAT
filesystem containing your loader code as an El Torito boot image.
When UEFI detects this, it provides a block IO instance that points at
the FAT filesystem as a child of the device that represents the CD
itself. The problem being that the CD device is flagged as a "raw
device" while the boot image is flagged as a "logical partition". The
existing EFI partition code only looks for logical partitions and so
the CD filesystem was rendered invisible.
To fix this, check the type of each block IO device. If it's found to
be a CD, and thus an El Torito boot image, look up its parent device
and add that instead so that the loader will then load the kernel from
the CD filesystem. This is done by using the handle for the boot
filesystem as an alias.
Something similar to this will be required for booting from other
media as well as the loader will live in the EFI system partition, not
on the partition containing the kernel.
r246231:
Add necessary code to hand off from loader to an amd64 kernel.
r246335:
Grab the EFI memory map and store it as module metadata on the kernel.
This is the same approach used to provide the BIOS SMAP to the kernel.
r246336:
Pass the ACPI table metadata via hints so the kernel ACPI code can
find them.
r246608:
Rework copy routines to ensure we always use memory allocated via EFI.
The previous code assumed it could copy wherever it liked. This is not
the case. The approach taken by this code is pretty ham-fisted in that
it simply allocates a large (32MB) buffer area and stages into that,
then copies the whole area into place when it's time to execute. A more
elegant solution could be used but this works for now.
r247214:
Fix a number of problems preventing proper handover to the kernel.
There were two issues at play here. Firstly, there was nothing
preventing UEFI from placing the loader code above 1GB in RAM. This
meant that when we switched in the page tables the kernel expects to
be running on, we are suddenly unmapped and things no longer work. We
solve this by making our trampoline code not dependent on being at any
given position and simply copying it to a "safe" location before
calling it.
Secondly, UEFI could allocate our stack wherever it wants. As it
happened on my PC, that was right where I was copying the kernel to.
This did not cause happiness. The solution to this was to also switch
to a temporary stack in a safe location before performing the final
copy of the loaded kernel.
r246231:
Add necessary code to hand off from loader to an amd64 kernel.
r246335:
Grab the EFI memory map and store it as module metadata on the kernel.
This is the same approach used to provide the BIOS SMAP to the kernel.
r246336:
Pass the ACPI table metadata via hints so the kernel ACPI code can
find them.
r246608:
Rework copy routines to ensure we always use memory allocated via EFI.
The previous code assumed it could copy wherever it liked. This is not
the case. The approach taken by this code is pretty ham-fisted in that
it simply allocates a large (32MB) buffer area and stages into that,
then copies the whole area into place when it's time to execute. A more
elegant solution could be used but this works for now.
r247214:
Fix a number of problems preventing proper handover to the kernel.
There were two issues at play here. Firstly, there was nothing
preventing UEFI from placing the loader code above 1GB in RAM. This
meant that when we switched in the page tables the kernel expects to
be running on, we are suddenly unmapped and things no longer work. We
solve this by making our trampoline code not dependent on being at any
given position and simply copying it to a "safe" location before
calling it.
Secondly, UEFI could allocate our stack wherever it wants. As it
happened on my PC, that was right where I was copying the kernel to.
This did not cause happiness. The solution to this was to also switch
to a temporary stack in a safe location before performing the final
copy of the loaded kernel.
r247216:
Use the UEFI Graphics Output Protocol to get the parameters of the
framebuffer.
r264115: Fix printf format mismatches
r264132: Connect sys/boot/amd64 to the build
r264208: Do not build the amd64 UEFI loader with GCC
The UEFI loader causes buildworld to fail when building with (in-tree)
GCC, due to a typedef redefinition. As it happens the in-tree GCC
cannot successfully build the UEFI loader anyhow, as it does not support
__attribute__((ms_abi)). Thus, just avoid trying to build it with GCC,
rather than disconnecting it from the build until the underlying issue
is fixed.
r264261: Correct a variable's type for 64-bit Ficl
FICL_INT is long.
r264262: Fix printf args for 64-bit archs
r264263: Add explicit casts to quiet warnings in libefi
r264319: Fix EFI loader object tree creation on 9.x build hosts
Previously ${COMPILER_TYPE} was checked in sys/boot/amd64, and the efi
subdirectory was skipped altogether for gcc (since GCC does not support
a required attribute). However, during the early buildworld stages
${COMPILER_TYPE} is the existing system compiler (i.e., gcc on 9.x build
hosts), not the compiler that will eventually be used. This caused
"make obj" to skip the efi subdirectory. In later build stages
${COMPILER_TYPE} is "clang", and then the efi loader would attempt to
build in the source directory.
r265028 (dteske): Disable the beastie menu for EFI console ...
which doesn't support ANSI codes (so things like `at-xy', `clear', and
other commands don't work making it impossible to generate a living
menu).
r265057 (nwhitehorn): Turn off various fancy instruction sets...
as well as deduplicate some options. This makes the EFI loader build
work with CPUTYPE=native in make.conf on my Core i5.
r268974 (sbruno): Supress clang warning for FreeBSD printf %b and %D formats
Relnotes: Yes
Sponsored by: The FreeBSD Foundation
Added:
stable/10/sys/boot/amd64/
- copied from r264095, head/sys/boot/amd64/
stable/10/sys/boot/efi/include/amd64/
- copied from r263115, head/sys/boot/efi/include/amd64/
stable/10/sys/boot/efi/include/efigop.h
- copied unchanged from r264095, head/sys/boot/efi/include/efigop.h
stable/10/sys/boot/ficl32/
- copied from r264087, head/sys/boot/ficl32/
Deleted:
stable/10/sys/boot/ficl64/
stable/10/sys/boot/i386/efi/Makefile
stable/10/sys/boot/i386/efi/autoload.c
stable/10/sys/boot/i386/efi/conf.c
stable/10/sys/boot/i386/efi/devicename.c
stable/10/sys/boot/i386/efi/ldscript.amd64
stable/10/sys/boot/i386/efi/main.c
stable/10/sys/boot/i386/efi/version
Modified:
stable/10/lib/libstand/Makefile
stable/10/sys/boot/Makefile
stable/10/sys/boot/Makefile.amd64
stable/10/sys/boot/amd64/Makefile.inc
stable/10/sys/boot/amd64/efi/Makefile
stable/10/sys/boot/amd64/efi/copy.c
stable/10/sys/boot/amd64/efi/elf64_freebsd.c
stable/10/sys/boot/amd64/efi/main.c
stable/10/sys/boot/efi/Makefile.inc
stable/10/sys/boot/efi/include/efi.h
stable/10/sys/boot/efi/include/efilib.h
stable/10/sys/boot/efi/libefi/Makefile
stable/10/sys/boot/efi/libefi/efinet.c
stable/10/sys/boot/efi/libefi/efipart.c
stable/10/sys/boot/efi/libefi/handles.c
stable/10/sys/boot/ficl/Makefile
stable/10/sys/boot/ficl/tools.c
stable/10/sys/boot/ficl/words.c
stable/10/sys/boot/forth/beastie.4th
stable/10/sys/boot/forth/beastie.4th.8
stable/10/sys/boot/forth/loader.conf.5
stable/10/sys/boot/i386/libi386/Makefile
stable/10/sys/boot/i386/loader/Makefile
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/lib/libstand/Makefile
==============================================================================
--- stable/10/lib/libstand/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/lib/libstand/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -21,18 +21,20 @@ CFLAGS+= -ffreestanding -Wformat
CFLAGS+= -I${.CURDIR}
.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-CFLAGS.gcc+= -mpreferred-stack-boundary=2
CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
.endif
+.if ${MACHINE_CPUARCH} == "i386"
+CFLAGS.gcc+= -mpreferred-stack-boundary=2
+.endif
+.if ${MACHINE_CPUARCH} == "amd64"
+CFLAGS+= -fPIC
+.endif
.if ${MACHINE} == "pc98"
CFLAGS+= -Os
.endif
.if ${MACHINE_CPUARCH} == "powerpc"
CFLAGS+= -msoft-float -D_STANDALONE -DNETIF_DEBUG
.endif
-.if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "powerpc64"
-CFLAGS+= -m32 -I.
-.endif
.if ${MACHINE_CPUARCH} == "arm"
CFLAGS+= -msoft-float -D_STANDALONE
.endif
@@ -103,9 +105,7 @@ SRCS+= syncicache.c
SRCS+= uuid_equal.c uuid_is_nil.c
# _setjmp/_longjmp
-.if ${MACHINE_CPUARCH} == "amd64"
-.PATH: ${.CURDIR}/i386
-.elif ${MACHINE_ARCH} == "powerpc64"
+.if ${MACHINE_ARCH} == "powerpc64"
.PATH: ${.CURDIR}/powerpc
.else
.PATH: ${.CURDIR}/${MACHINE_CPUARCH}
@@ -179,12 +179,3 @@ SRCS+= nandfs.c
.include <bsd.lib.mk>
-.if ${MACHINE_CPUARCH} == "amd64"
-beforedepend ${OBJS}: machine
-cleandepend: cleanmachine
-cleanmachine:
- rm -f machine
-
-machine:
- ln -s ${.CURDIR}/../../sys/i386/include machine
-.endif
Modified: stable/10/sys/boot/Makefile
==============================================================================
--- stable/10/sys/boot/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -9,9 +9,12 @@ SUBDIR+= ficl
.endif
# Pick the machine-dependent subdir based on the target architecture.
-ADIR= ${MACHINE:S/amd64/i386/:S/powerpc64/powerpc/}
+ADIR= ${MACHINE:S/powerpc64/powerpc/}
.if exists(${.CURDIR}/${ADIR}/.)
SUBDIR+= ${ADIR}
.endif
+.if ${MACHINE} == "amd64"
+SUBDIR+= i386
+.endif
.include <bsd.subdir.mk>
Modified: stable/10/sys/boot/Makefile.amd64
==============================================================================
--- stable/10/sys/boot/Makefile.amd64 Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/Makefile.amd64 Thu Sep 4 21:01:10 2014 (r271135)
@@ -4,3 +4,7 @@ SUBDIR+= efi
SUBDIR+= libstand32
SUBDIR+= zfs
SUBDIR+= userboot
+
+.if ${MK_FORTH} != "no"
+SUBDIR+= ficl32
+.endif
Modified: stable/10/sys/boot/amd64/Makefile.inc
==============================================================================
--- head/sys/boot/amd64/Makefile.inc Fri Apr 4 00:16:46 2014 (r264095)
+++ stable/10/sys/boot/amd64/Makefile.inc Thu Sep 4 21:01:10 2014 (r271135)
@@ -4,8 +4,9 @@
BINDIR?= /boot
+# See conf/kern.mk for the correct set of these
CFLAGS+= -ffreestanding
-CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
+CFLAGS+= -mno-mmx -mno-sse -mno-aes -mno-avx -msoft-float
LDFLAGS+= -nostdlib
.include "../Makefile.inc"
Modified: stable/10/sys/boot/amd64/efi/Makefile
==============================================================================
--- head/sys/boot/amd64/efi/Makefile Fri Apr 4 00:16:46 2014 (r264095)
+++ stable/10/sys/boot/amd64/efi/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -3,6 +3,10 @@
NO_MAN=
.include <bsd.own.mk>
+
+# In-tree GCC does not support __attribute__((ms_abi)).
+.if ${COMPILER_TYPE} != "gcc"
+
MK_SSP= no
PROG= loader.sym
@@ -85,6 +89,8 @@ CFLAGS+= -I${.CURDIR}/../../common
DPADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND}
LDADD= ${LIBFICL} ${LIBEFI} ${LIBSTAND}
+.endif # ${COMPILER_TYPE} != "gcc"
+
.include <bsd.prog.mk>
beforedepend ${OBJS}: machine x86
Modified: stable/10/sys/boot/amd64/efi/copy.c
==============================================================================
--- head/sys/boot/amd64/efi/copy.c Fri Apr 4 00:16:46 2014 (r264095)
+++ stable/10/sys/boot/amd64/efi/copy.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -51,8 +51,8 @@ x86_efi_copy_init(void)
status = BS->AllocatePages(AllocateAnyPages, EfiLoaderData,
STAGE_PAGES, &staging);
if (EFI_ERROR(status)) {
- printf("failed to allocate staging area: %d\n",
- status & EFI_ERROR_MASK);
+ printf("failed to allocate staging area: %lu\n",
+ (unsigned long)(status & EFI_ERROR_MASK));
return (status);
}
Modified: stable/10/sys/boot/amd64/efi/elf64_freebsd.c
==============================================================================
--- head/sys/boot/amd64/efi/elf64_freebsd.c Fri Apr 4 00:16:46 2014 (r264095)
+++ stable/10/sys/boot/amd64/efi/elf64_freebsd.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -101,7 +101,7 @@ elf64_exec(struct preloaded_file *fp)
rsdp = efi_get_table(&acpi_guid);
}
if (rsdp != NULL) {
- sprintf(buf, "0x%016llx", rsdp);
+ sprintf(buf, "0x%016llx", (unsigned long long)rsdp);
setenv("hint.acpi.0.rsdp", buf, 1);
revision = rsdp->Revision;
if (revision == 0)
@@ -115,7 +115,8 @@ elf64_exec(struct preloaded_file *fp)
setenv("hint.acpi.0.rsdt", buf, 1);
if (revision >= 2) {
/* XXX extended checksum? */
- sprintf(buf, "0x%016llx", rsdp->XsdtPhysicalAddress);
+ sprintf(buf, "0x%016llx",
+ (unsigned long long)rsdp->XsdtPhysicalAddress);
setenv("hint.acpi.0.xsdt", buf, 1);
sprintf(buf, "%d", rsdp->Length);
setenv("hint.acpi.0.xsdt_length", buf, 1);
Modified: stable/10/sys/boot/amd64/efi/main.c
==============================================================================
--- head/sys/boot/amd64/efi/main.c Fri Apr 4 00:16:46 2014 (r264095)
+++ stable/10/sys/boot/amd64/efi/main.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -304,7 +304,7 @@ command_mode(int argc, char *argv[])
printf("couldn't set mode %d\n", mode);
return (CMD_ERROR);
}
- sprintf(rowenv, "%d", rows);
+ sprintf(rowenv, "%u", (unsigned)rows);
setenv("LINES", rowenv, 1);
return (CMD_OK);
@@ -314,7 +314,8 @@ command_mode(int argc, char *argv[])
status = conout->QueryMode(conout, i, &cols, &rows);
if (EFI_ERROR(status))
break;
- printf("Mode %d: %d columns, %d rows\n", i, cols, rows);
+ printf("Mode %d: %u columns, %u rows\n", i, (unsigned)cols,
+ (unsigned)rows);
}
if (i != 0)
Modified: stable/10/sys/boot/efi/Makefile.inc
==============================================================================
--- stable/10/sys/boot/efi/Makefile.inc Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/Makefile.inc Thu Sep 4 21:01:10 2014 (r271135)
@@ -2,17 +2,10 @@
BINDIR?= /boot
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "i386"
CFLAGS+= -march=i386
.endif
-.if ${MACHINE_CPUARCH} == "amd64"
-CFLAGS+= -m32
-ACFLAGS+= -m32
-LDFLAGS+= -m elf_i386_fbsd
-AFLAGS+= --32
-.endif
-
# Options used when building app-specific efi components
CFLAGS+= -ffreestanding -fshort-wchar -Wformat
LDFLAGS+= -nostdlib
Modified: stable/10/sys/boot/efi/include/efi.h
==============================================================================
--- stable/10/sys/boot/efi/include/efi.h Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/include/efi.h Thu Sep 4 21:01:10 2014 (r271135)
@@ -52,6 +52,7 @@ Revision History
#include "efiapi.h"
#include "efifs.h"
#include "efierr.h"
+#include "efigop.h"
#define EFI_STRINGIZE(a) #a
#define EFI_PROTOCOL_DEFINITION(a) EFI_STRINGIZE(Protocol/a/a.h)
Copied: stable/10/sys/boot/efi/include/efigop.h (from r264095, head/sys/boot/efi/include/efigop.h)
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ stable/10/sys/boot/efi/include/efigop.h Thu Sep 4 21:01:10 2014 (r271135, copy of r264095, head/sys/boot/efi/include/efigop.h)
@@ -0,0 +1,122 @@
+/* $FreeBSD$ */
+/*++
+
+Copyright (c) 1999 - 2002 Intel Corporation. All rights reserved
+This software and associated documentation (if any) is furnished
+under a license and may only be used or copied in accordance
+with the terms of the license. Except as permitted by such
+license, no part of this software or documentation may be
+reproduced, stored in a retrieval system, or transmitted in any
+form or by any means without the express written consent of
+Intel Corporation.
+
+Module Name:
+
+ efigop.h
+
+Abstract:
+ Info about framebuffers
+
+
+
+
+Revision History
+
+--*/
+
+#ifndef _EFIGOP_H
+#define _EFIGOP_H
+
+#define EFI_GRAPHICS_OUTPUT_PROTOCOL_GUID \
+ { 0x9042a9de, 0x23dc, 0x4a38, 0x96, 0xfb, 0x7a, 0xde, 0xd0, 0x80, \
+ 0x51, 0x6a }
+
+INTERFACE_DECL(_EFI_GRAPHICS_OUTPUT);
+
+typedef struct {
+ UINT32 RedMask;
+ UINT32 GreenMask;
+ UINT32 BlueMask;
+ UINT32 ReservedMask;
+} EFI_PIXEL_BITMASK;
+
+typedef enum {
+ PixelRedGreenBlueReserved8BitPerColor,
+ PixelBlueGreenRedReserved8BitPerColor,
+ PixelBitMask,
+ PixelBltOnly,
+ PixelFormatMax,
+} EFI_GRAPHICS_PIXEL_FORMAT;
+
+typedef struct {
+ UINT32 Version;
+ UINT32 HorizontalResolution;
+ UINT32 VerticalResolution;
+ EFI_GRAPHICS_PIXEL_FORMAT PixelFormat;
+ EFI_PIXEL_BITMASK PixelInformation;
+ UINT32 PixelsPerScanLine;
+} EFI_GRAPHICS_OUTPUT_MODE_INFORMATION;
+
+typedef struct {
+ UINT32 MaxMode;
+ UINT32 Mode;
+ EFI_GRAPHICS_OUTPUT_MODE_INFORMATION *Info;
+ UINTN SizeOfInfo;
+ EFI_PHYSICAL_ADDRESS FrameBufferBase;
+ UINTN FrameBufferSize;
+} EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE) (
+ IN struct _EFI_GRAPHICS_OUTPUT *This,
+ IN UINT32 ModeNumber,
+ OUT UINTN *SizeOfInfo,
+ OUT EFI_GRAPHICS_OUTPUT_MODE_INFORMATION **Info
+ );
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE) (
+ IN struct _EFI_GRAPHICS_OUTPUT *This,
+ IN UINT32 ModeNumber
+ );
+
+typedef struct {
+ UINT8 Blue;
+ UINT8 Green;
+ UINT8 Red;
+ UINT8 Reserved;
+} EFI_GRAPHICS_OUTPUT_BLT_PIXEL;
+
+typedef enum {
+ EfiBltVideoFill,
+ EfiBltVideoToBltBuffer,
+ EfiBltBufferToVideo,
+ EfiBltVideoToVideo,
+ EfiGraphcisOutputBltOperationMax,
+} EFI_GRAPHICS_OUTPUT_BLT_OPERATION;
+
+typedef
+EFI_STATUS
+(EFIAPI *EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT) (
+ IN struct _EFI_GRAPHICS_OUTPUT *This,
+ IN OUT EFI_GRAPHICS_OUTPUT_BLT_PIXEL *BltBuffer,
+ IN EFI_GRAPHICS_OUTPUT_BLT_OPERATION BltOperation,
+ IN UINTN SourceX,
+ IN UINTN SourceY,
+ IN UINTN DestinationX,
+ IN UINTN DestinationY,
+ IN UINTN Width,
+ IN UINTN Height,
+ IN UINTN Delta
+ );
+
+typedef struct _EFI_GRAPHICS_OUTPUT {
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_QUERY_MODE QueryMode;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_SET_MODE SetMode;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_BLT Blt;
+ EFI_GRAPHICS_OUTPUT_PROTOCOL_MODE *Mode;
+} EFI_GRAPHICS_OUTPUT;
+
+#endif /* _EFIGOP_H */
Modified: stable/10/sys/boot/efi/include/efilib.h
==============================================================================
--- stable/10/sys/boot/efi/include/efilib.h Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/include/efilib.h Thu Sep 4 21:01:10 2014 (r271135)
@@ -41,7 +41,7 @@ extern struct netif_driver efinetif;
void *efi_get_table(EFI_GUID *tbl);
void efi_main(EFI_HANDLE image_handle, EFI_SYSTEM_TABLE *system_table);
-int efi_register_handles(struct devsw *, EFI_HANDLE *, int);
+int efi_register_handles(struct devsw *, EFI_HANDLE *, EFI_HANDLE *, int);
EFI_HANDLE efi_find_handle(struct devsw *, int);
int efi_handle_lookup(EFI_HANDLE, struct devsw **, int *);
Modified: stable/10/sys/boot/efi/libefi/Makefile
==============================================================================
--- stable/10/sys/boot/efi/libefi/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/libefi/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -6,11 +6,18 @@ INTERNALLIB=
SRCS= delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
libefi.c time.c
+.if ${MACHINE_ARCH} == "amd64"
+CFLAGS+= -fPIC
+.endif
CFLAGS+= -I${.CURDIR}/../include
-CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH:S/amd64/i386/}
+CFLAGS+= -I${.CURDIR}/../include/${MACHINE_CPUARCH}
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
# Pick up the bootstrap header for some interface items
CFLAGS+= -I${.CURDIR}/../../common
+
+# Suppress warning from clang for FreeBSD %b and %D formats
+CFLAGS+= -fformat-extensions
+
.include <bsd.lib.mk>
Modified: stable/10/sys/boot/efi/libefi/efinet.c
==============================================================================
--- stable/10/sys/boot/efi/libefi/efinet.c Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/libefi/efinet.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -274,7 +274,7 @@ efinet_dev_init()
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
nifs = sz / sizeof(EFI_HANDLE);
- err = efi_register_handles(&efinet_dev, handles, nifs);
+ err = efi_register_handles(&efinet_dev, handles, NULL, nifs);
free(handles);
if (err != 0)
return (err);
Modified: stable/10/sys/boot/efi/libefi/efipart.c
==============================================================================
--- stable/10/sys/boot/efi/libefi/efipart.c Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/libefi/efipart.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <efiprot.h>
static EFI_GUID blkio_guid = BLOCK_IO_PROTOCOL;
+static EFI_GUID devpath_guid = DEVICE_PATH_PROTOCOL;
static int efipart_init(void);
static int efipart_strategy(void *, int, daddr_t, size_t, char *, size_t *);
@@ -62,9 +63,11 @@ static int
efipart_init(void)
{
EFI_BLOCK_IO *blkio;
- EFI_HANDLE *hin, *hout;
+ EFI_DEVICE_PATH *devpath, *node;
+ EFI_HANDLE *hin, *hout, *aliases, handle;
EFI_STATUS status;
UINTN sz;
+ CHAR16 *path;
u_int n, nin, nout;
int err;
@@ -72,7 +75,7 @@ efipart_init(void)
hin = NULL;
status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz, 0);
if (status == EFI_BUFFER_TOO_SMALL) {
- hin = (EFI_HANDLE *)malloc(sz * 2);
+ hin = (EFI_HANDLE *)malloc(sz * 3);
status = BS->LocateHandle(ByProtocol, &blkio_guid, 0, &sz,
hin);
if (EFI_ERROR(status))
@@ -84,19 +87,50 @@ efipart_init(void)
/* Filter handles to only include FreeBSD partitions. */
nin = sz / sizeof(EFI_HANDLE);
hout = hin + nin;
+ aliases = hout + nin;
nout = 0;
+ bzero(aliases, nin * sizeof(EFI_HANDLE));
+
for (n = 0; n < nin; n++) {
- status = BS->HandleProtocol(hin[n], &blkio_guid, &blkio);
+ status = BS->HandleProtocol(hin[n], &devpath_guid,
+ (void **)&devpath);
+ if (EFI_ERROR(status)) {
+ continue;
+ }
+ node = devpath;
+ while (!IsDevicePathEnd(NextDevicePathNode(node)))
+ node = NextDevicePathNode(node);
+ status = BS->HandleProtocol(hin[n], &blkio_guid,
+ (void**)&blkio);
if (EFI_ERROR(status))
continue;
if (!blkio->Media->LogicalPartition)
continue;
- hout[nout] = hin[n];
+
+ /*
+ * If we come across a logical partition of subtype CDROM
+ * it doesn't refer to the CD filesystem itself, but rather
+ * to any usable El Torito boot image on it. In this case
+ * we try to find the parent device and add that instead as
+ * that will be the CD filesystem.
+ */
+ if (DevicePathType(node) == MEDIA_DEVICE_PATH &&
+ DevicePathSubType(node) == MEDIA_CDROM_DP) {
+ node->Type = END_DEVICE_PATH_TYPE;
+ node->SubType = END_ENTIRE_DEVICE_PATH_SUBTYPE;
+ status = BS->LocateDevicePath(&blkio_guid, &devpath,
+ &handle);
+ if (EFI_ERROR(status))
+ continue;
+ hout[nout] = handle;
+ aliases[nout] = hin[n];
+ } else
+ hout[nout] = hin[n];
nout++;
}
- err = efi_register_handles(&efipart_dev, hout, nout);
+ err = efi_register_handles(&efipart_dev, hout, aliases, nout);
free(hin);
return (err);
}
@@ -115,7 +149,7 @@ efipart_print(int verbose)
sprintf(line, " %s%d:", efipart_dev.dv_name, unit);
pager_output(line);
- status = BS->HandleProtocol(h, &blkio_guid, &blkio);
+ status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio);
if (!EFI_ERROR(status)) {
sprintf(line, " %llu blocks",
(unsigned long long)(blkio->Media->LastBlock + 1));
@@ -144,7 +178,7 @@ efipart_open(struct open_file *f, ...)
if (h == NULL)
return (EINVAL);
- status = BS->HandleProtocol(h, &blkio_guid, &blkio);
+ status = BS->HandleProtocol(h, &blkio_guid, (void **)&blkio);
if (EFI_ERROR(status))
return (efi_status_to_errno(status));
Modified: stable/10/sys/boot/efi/libefi/handles.c
==============================================================================
--- stable/10/sys/boot/efi/libefi/handles.c Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/efi/libefi/handles.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
struct entry {
EFI_HANDLE handle;
+ EFI_HANDLE alias;
struct devsw *dev;
int unit;
};
@@ -40,7 +41,8 @@ struct entry *entry;
int nentries;
int
-efi_register_handles(struct devsw *sw, EFI_HANDLE *handles, int count)
+efi_register_handles(struct devsw *sw, EFI_HANDLE *handles,
+ EFI_HANDLE *aliases, int count)
{
size_t sz;
int idx, unit;
@@ -51,6 +53,10 @@ efi_register_handles(struct devsw *sw, E
entry = (entry == NULL) ? malloc(sz) : realloc(entry, sz);
for (unit = 0; idx < nentries; idx++, unit++) {
entry[idx].handle = handles[unit];
+ if (aliases != NULL)
+ entry[idx].alias = aliases[unit];
+ else
+ entry[idx].alias = NULL;
entry[idx].dev = sw;
entry[idx].unit = unit;
}
@@ -78,7 +84,7 @@ efi_handle_lookup(EFI_HANDLE h, struct d
int idx;
for (idx = 0; idx < nentries; idx++) {
- if (entry[idx].handle != h)
+ if (entry[idx].handle != h && entry[idx].alias != h)
continue;
if (dev != NULL)
*dev = entry[idx].dev;
Modified: stable/10/sys/boot/ficl/Makefile
==============================================================================
--- stable/10/sys/boot/ficl/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/ficl/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -3,7 +3,7 @@
FICLDIR?= ${.CURDIR}
-.if !defined(FICL64)
+.if defined(FICL32)
.PATH: ${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/}
.else
.PATH: ${FICLDIR}/${MACHINE_CPUARCH}
@@ -14,11 +14,12 @@ BASE_SRCS= dict.c ficl.c fileaccess.c fl
SRCS= ${BASE_SRCS} sysdep.c softcore.c
CLEANFILES= softcore.c testmain testmain.o
CFLAGS+= -ffreestanding
-.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
-.if !defined(FICL64)
+.if ${MACHINE_CPUARCH} == "i386" || \
+ (${MACHINE_CPUARCH} == "amd64" && defined(FICL32))
CFLAGS+= -march=i386
CFLAGS.gcc+= -mpreferred-stack-boundary=2
.endif
+.if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
CFLAGS+= -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 -msoft-float
.endif
.if ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
@@ -48,22 +49,32 @@ SOFTWORDS= softcore.fr jhlocal.fr marker
# Optional OO extension softwords
#SOFTWORDS+= oo.fr classes.fr
-.if ${MACHINE_CPUARCH} == "amd64" && !defined(FICL64)
+.if ${MACHINE_CPUARCH} == "amd64"
+.if defined(FICL32)
CFLAGS+= -m32 -I.
+.else
+CFLAGS+= -fPIC
+.endif
.endif
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc -I.
.endif
-CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${MACHINE_CPUARCH:S/amd64/i386/} \
+.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
+FICL_CPUARCH= i386
+.else
+FICL_CPUARCH= ${MACHINE_CPUARCH}
+.endif
+
+CFLAGS+= -I${FICLDIR} -I${FICLDIR}/${FICL_CPUARCH} \
-I${FICLDIR}/../common
softcore.c: ${SOFTWORDS} softcore.awk
(cd ${FICLDIR}/softwords; cat ${SOFTWORDS} \
| awk -f softcore.awk -v datestamp="`LC_ALL=C date`") > ${.TARGET}
-.if ${MACHINE_CPUARCH} == "amd64"
+.if ${MACHINE_CPUARCH} == "amd64" && defined(FICL32)
.if !exists(machine)
${SRCS:M*.c:R:S/$/.o/g}: machine
Modified: stable/10/sys/boot/ficl/tools.c
==============================================================================
--- stable/10/sys/boot/ficl/tools.c Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/ficl/tools.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -201,7 +201,7 @@ static void seeColon(FICL_VM *pVM, CELL
*cp++ = '>';
else
*cp++ = ' ';
- cp += sprintf(cp, "%3d ", pc-param0);
+ cp += sprintf(cp, "%3d ", (int)(pc-param0));
if (isAFiclWord(pd, pFW))
{
@@ -239,40 +239,40 @@ static void seeColon(FICL_VM *pVM, CELL
case IF:
c = *++pc;
if (c.i > 0)
- sprintf(cp, "if / while (branch %d)", pc+c.i-param0);
+ sprintf(cp, "if / while (branch %d)", (int)(pc+c.i-param0));
else
- sprintf(cp, "until (branch %d)", pc+c.i-param0);
+ sprintf(cp, "until (branch %d)", (int)(pc+c.i-param0));
break;
case BRANCH:
c = *++pc;
if (c.i == 0)
- sprintf(cp, "repeat (branch %d)", pc+c.i-param0);
+ sprintf(cp, "repeat (branch %d)", (int)(pc+c.i-param0));
else if (c.i == 1)
- sprintf(cp, "else (branch %d)", pc+c.i-param0);
+ sprintf(cp, "else (branch %d)", (int)(pc+c.i-param0));
else
- sprintf(cp, "endof (branch %d)", pc+c.i-param0);
+ sprintf(cp, "endof (branch %d)", (int)(pc+c.i-param0));
break;
case OF:
c = *++pc;
- sprintf(cp, "of (branch %d)", pc+c.i-param0);
+ sprintf(cp, "of (branch %d)", (int)(pc+c.i-param0));
break;
case QDO:
c = *++pc;
- sprintf(cp, "?do (leave %d)", (CELL *)c.p-param0);
+ sprintf(cp, "?do (leave %d)", (int)((CELL *)c.p-param0));
break;
case DO:
c = *++pc;
- sprintf(cp, "do (leave %d)", (CELL *)c.p-param0);
+ sprintf(cp, "do (leave %d)", (int)((CELL *)c.p-param0));
break;
case LOOP:
c = *++pc;
- sprintf(cp, "loop (branch %d)", pc+c.i-param0);
+ sprintf(cp, "loop (branch %d)", (int)(pc+c.i-param0));
break;
case PLOOP:
c = *++pc;
- sprintf(cp, "+loop (branch %d)", pc+c.i-param0);
+ sprintf(cp, "+loop (branch %d)", (int)(pc+c.i-param0));
break;
default:
sprintf(cp, "%.*s", pFW->nName, pFW->name);
Modified: stable/10/sys/boot/ficl/words.c
==============================================================================
--- stable/10/sys/boot/ficl/words.c Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/ficl/words.c Thu Sep 4 21:01:10 2014 (r271135)
@@ -2567,7 +2567,7 @@ static void setObjectFlag(FICL_VM *pVM)
static void isObject(FICL_VM *pVM)
{
- int flag;
+ FICL_INT flag;
FICL_WORD *pFW = (FICL_WORD *)stackPopPtr(pVM->pStack);
flag = ((pFW != NULL) && (pFW->flags & FW_ISOBJECT)) ? FICL_TRUE : FICL_FALSE;
Modified: stable/10/sys/boot/forth/beastie.4th
==============================================================================
--- stable/10/sys/boot/forth/beastie.4th Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/forth/beastie.4th Thu Sep 4 21:01:10 2014 (r271135)
@@ -242,6 +242,11 @@ variable logoY
;
: beastie-start ( -- ) \ starts the menu
+ s" console" getenv dup -1 <> if
+ s" efi" 2swap contains? if
+ s" set beastie_disable=YES" evaluate
+ then
+ else drop then
s" beastie_disable" getenv
dup -1 <> if
s" YES" compare-insensitive 0= if
Modified: stable/10/sys/boot/forth/beastie.4th.8
==============================================================================
--- stable/10/sys/boot/forth/beastie.4th.8 Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/forth/beastie.4th.8 Thu Sep 4 21:01:10 2014 (r271135)
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 16, 2011
+.Dd April 27, 2014
.Dt BEASTIE.4TH 8
.Os
.Sh NAME
@@ -119,6 +119,8 @@ Sets the desired row position of the log
If set to
.Dq YES ,
the beastie boot menu will be skipped.
+The beastie boot menu is always skipped if booting UEFI or running non-x86
+hardware.
.It Va loader_delay
If set to a number higher than zero, introduces a delay before starting the
beastie boot menu. During the delay the user can press either Ctrl-C to skip
Modified: stable/10/sys/boot/forth/loader.conf.5
==============================================================================
--- stable/10/sys/boot/forth/loader.conf.5 Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/forth/loader.conf.5 Thu Sep 4 21:01:10 2014 (r271135)
@@ -23,7 +23,7 @@
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
-.Dd October 18, 2013
+.Dd April 27, 2014
.Dt LOADER.CONF 5
.Os
.Sh NAME
@@ -236,6 +236,8 @@ be displayed.
If set to
.Dq YES ,
the beastie boot menu will be skipped.
+The beastie boot menu is always skipped if booting UEFI or running non-x86
+hardware.
.It Va loader_logo Pq Dq Li orbbw
Selects a desired logo in the beastie boot menu.
Possible values are:
Modified: stable/10/sys/boot/i386/libi386/Makefile
==============================================================================
--- stable/10/sys/boot/i386/libi386/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/i386/libi386/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -52,6 +52,9 @@ CFLAGS+= -I${.CURDIR}/../../common -I${.
# the location of libstand
CFLAGS+= -I${.CURDIR}/../../../../lib/libstand/
+# Suppress warning from clang for FreeBSD %b and %D formats
+CFLAGS+= -fformat-extensions
+
.if ${MACHINE_CPUARCH} == "amd64"
CLEANFILES+= machine
machine:
Modified: stable/10/sys/boot/i386/loader/Makefile
==============================================================================
--- stable/10/sys/boot/i386/loader/Makefile Thu Sep 4 20:49:11 2014 (r271134)
+++ stable/10/sys/boot/i386/loader/Makefile Thu Sep 4 21:01:10 2014 (r271135)
@@ -41,8 +41,12 @@ HAVE_ISABUS= yes
# Enable BootForth
BOOT_FORTH= yes
CFLAGS+= -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
+.if ${MACHINE_CPUARCH} == "amd64"
+LIBFICL= ${.OBJDIR}/../../ficl32/libficl.a
+.else
LIBFICL= ${.OBJDIR}/../../ficl/libficl.a
.endif
+.endif
.if defined(LOADER_BZIP2_SUPPORT)
CFLAGS+= -DLOADER_BZIP2_SUPPORT
More information about the svn-src-all
mailing list