Commit Graph

3017 Commits

Author SHA1 Message Date
Andrew Turner
d051c9457e Move the x86 specific files to be built in the amd64 loader.efi. This will
help with importing the arm and arm64 versions of loader.efi.
2015-03-15 19:00:35 +00:00
Dimitry Andric
e0125cfdd1 Merge ^/head r279893 through r279984. 2015-03-14 13:08:00 +00:00
John Baldwin
02cbfd02ba Enable bzipfs support in the EFI loader.
- Add bzipfs to the list of supported filesystems in the EFI loader.
- Increase the heap size allocated for the EFI loader from 2MB to 3MB.

Differential Revision:	https://reviews.freebsd.org/D2053
Reviewed by:	benno, emaste, imp
MFC after:	2 weeks
Sponsored by:	Cisco Systems, Inc.
2015-03-13 09:41:27 +00:00
John Baldwin
ad06e987b1 The System V ABI for amd64 allows functions to use space in a 128 byte
redzone below the stack pointer for scratch space and requires
interrupt and signal frames to avoid overwriting it. However, EFI uses
the Windows ABI which does not support this. As a result, interrupt
handlers in EFI push their interrupt frames directly on top of the
stack pointer. If the compiler used the red zone in a function in the
EFI loader, then a device interrupt that occurred while that function
was running could trash its local variables.  In practice this happens
fairly reliable when using gzipfs as an interrupt during decompression
can trash the local variables in the inflate_table() function
resulting in corrupted output or hangs.

Fix this by disabling the redzone for amd64 EFI binaries. This
requires building not only the loader but any libraries used by the
loader without redzone support.

Thanks to Jilles for pointing me at the redzone once I found the stack
corruption.

Differential Revision:	https://reviews.freebsd.org/D2054
Reviewed by:	imp
MFC after:	2 weeks
Sponsored by:	Cisco Systems, Inc.
2015-03-13 09:38:16 +00:00
John Baldwin
7939325215 Allow the EFI loader to work with large kernels and/or modules
(for example, a large mfsroot).  Note that for EFI the kernel and
modules (as well as other metadata files such as splash screens or
memory disk images) are loaded into a statically-sized staging area.
When the EFI loader exits it copies this staging area down to the
location the kernel expects to run at.
- Add bounds checking to the copy routines to fail attempts to access
  memory outside of the staging area.  Previously loading a combined
  kernel + modules larger than the staging size (32MB) would overflow
  the staging area trashing whatever memory was afterwards.  Under
  Intel's OVMF firmware for qemu this resulted in fatal faults in the
  firmware itself.  Now the attempt will fail with ENOMEM.
- Allow the staging area size to be configured at compile time via
  an EFI_STAGING_SIZE variable in src.conf or on the command line.
  It accepts the size of the staging area in MB.  The default size
  remains 32MB.

MFC after:	2 weeks
Sponsored by:	Cisco Systems, Inc.
2015-03-12 17:07:24 +00:00
John Baldwin
e447efb4f1 Fix 'make depend' by moving the LDSCRIPT dependency into DPADD.
Sponsored by:	Cisco Systems, Inc.
2015-03-12 15:25:22 +00:00
John Baldwin
bc65857d86 Revert r279381. The EFI loader needs to use a separate libstand that
is compiled against the ABI EFI expects (specifically, no stack
redzone) so it cannot share libstand with userboot (which must use
the System V ABI).
2015-03-12 15:20:05 +00:00
Dimitry Andric
a857c4c833 Merge ^/head r279759 through r279892. 2015-03-11 19:04:01 +00:00
Nathan Whitehorn
4b2b0f5043 Provide a shim layer in loader to condense the Open Firmware device tree to
an FDT. This is how Linux and OS X boot and can avoid some issues with
using Open Firmware at runtime. The code is highly experimental and disabled
by default; it can be turned on by setting the loader environment variable
"usefdt" to a non-NULL value.
2015-03-09 02:57:34 +00:00
Nathan Whitehorn
78f38c60bc Fix loader on PowerPC following r279784. It turns out that, due to .PATH
confusion, the _setjmp.S in libstand was never being used and was instead
being shadowed by the libc version. Since the libc version now uses FPRs,
it caused loader to crash.
2015-03-09 02:19:44 +00:00
Dimitry Andric
6404f697a0 Merging ^/head r279596 through r279758. 2015-03-07 23:01:27 +00:00
Edward Tomasz Napierala
411443334b Add error reporting (but not actual handling yet, apart from
reporting them) for EFI calls to boot1.efi.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2015-03-07 19:14:01 +00:00
Dimitry Andric
6ba06d46ee When compiling boot2 with gcc on i386 and pc98, only use the custom flag
-mno-align-long-strings when compiling with base gcc.  This is checked
by comparing the version number against 4.2.1, which is not exactly
right, but good enough.  (There is no other way to check whether we are
using the non-standard gcc in base, as far as I know.)

Reported by:	rodrigc
MFC after:	3 days
2015-03-04 20:33:15 +00:00
Dimitry Andric
ca65be80fd Merge ^/head r279313 through r279595. 2015-03-04 19:47:33 +00:00
Ruslan Bukin
c7f898e9d3 o Add more room for EFI boot blocks
o Specify the filename as argument

Differential Revision:	https://reviews.freebsd.org/D1999
Reviewed by:	emaste@
2015-03-02 18:08:39 +00:00
David E. O'Brien
eda6932911 sys/boot/userboot/libstand/libstand.a should also include strtoul.c;
as lib/libstand/ and sys/boot/libstand32/ already does.
2015-02-27 22:23:35 +00:00
David E. O'Brien
48f73a80ba Use sys/boot/userboot/libstand/ and not /usr/lib/libstand.a. 2015-02-27 22:22:05 +00:00
David E. O'Brien
f76aa51521 Remove duplicated -I. 2015-02-27 22:20:07 +00:00
Jayachandran C.
020a664210 Move PCI bus below simplebus for Broadcom XLP
This will enable us to do common allocation code for memory and
interrupts for SoC devices as well as PCI devices.
2015-02-27 02:21:52 +00:00
Dimitry Andric
0d56a8cba1 Merge ^/head r279163 through r279308. 2015-02-26 07:26:56 +00:00
Jayachandran C.
5441635eb0 Remove run-time allocation of XLP IRQs
Follow the same static IRQ to Interrupt Table Entry mapping as the other
OS supported on XLP.
2015-02-26 02:22:47 +00:00
Jayachandran C.
70abc1ff8e Add netlogic,xlp-pic as interrupt controller for XLP
Add an empty driver for netlogic,xlp-pic to ensure that the device tree
is correct and has an interrupt controller.
2015-02-26 02:05:45 +00:00
Alexander Motin
772747e2ee Fix potential NULL dereference.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	2 weeks
2015-02-25 09:57:05 +00:00
Michael Gmelin
29f2e5b5bc Improve memory detection in biosmem.c
- Add a quirk to allow ignoring e820 extended memory detection.
- Improve memory detection through e801.
- Add bootloader command "biosmem".

See differential revision for more details.

Reviewed by:	jhb, adrian
Approved by:	adrian
Differential Revision:  https://reviews.freebsd.org/D1741
2015-02-23 22:58:51 +00:00
Dimitry Andric
9b2a0d91b8 Merge ^/head r279023 through r279162. 2015-02-22 16:04:37 +00:00
Warner Losh
cda676ac0d Allow EFI and ACPI to be included together. When ACPI is included
first, EFI will use its definitions for {,U}INT{8,16,32,64} and
BOOLEAN. When EFI is included first, define ACPI_USE_SYSTEM_INTTYPES
to tell ACPI that these are already defined.

Differential Revision: https://reviews.freebsd.org/D1905
2015-02-20 01:40:55 +00:00
Dimitry Andric
714e3c812d Merge ^/head r278756 through r278915. 2015-02-17 19:53:41 +00:00
Luiz Otavio O Souza
206b8a8d5b Set the #address-cells and #size-cells properties on I2C controllers of
Raspberry-pi.

This fixes the issues of dtc(1) while compiling I2C addresses set in "reg"
property.

MFC after:	2 weeks
2015-02-17 19:38:16 +00:00
Dimitry Andric
569e61a4fc Merge ^/head r278499 through r278755. 2015-02-14 13:12:03 +00:00
John Baldwin
56af34a743 MFi386:
When building some of the boot loaders with clang, and DEBUG_FLAGS or
CFLAGS having '-g' in it, clang outputs several assembly directives that
are too new for our version of binutils.

Therefore, assemble the resulting .s files with clang instead.  A more
general solution can be implemented when a GNU as-compatible driver for
clang's integrated assembler appears.

Tested by:	gjb
2015-02-11 15:49:14 +00:00
George V. Neville-Neil
5dbbe22ac8 Summary: Update CPU identification call to recent version. 2015-02-11 12:08:40 +00:00
Dimitry Andric
b40d827331 Merging ^/head r278298 through r278350. 2015-02-07 12:57:40 +00:00
Devin Teske
d33946470c Revert SVN r277693.
Discussed on:	src-committers
Approved by:	core (emaste)
2015-02-06 23:19:17 +00:00
Rui Paulo
a1d03f4480 Add a FAT label to the EFI boot1 partition.
MFC after:	1 week
2015-02-06 01:42:17 +00:00
Dimitry Andric
bd9cc051b3 Merging ^/head r278224 through r278297. 2015-02-05 22:34:29 +00:00
Rui Paulo
e708492700 EFI: print more information about EFI Tables.
This adds the GUIDs for DXE, HOB, Memory Type Information and Debug
Image Info.
2015-02-05 07:19:30 +00:00
Dimitry Andric
73ee00cef5 Merge ^/head r278005 through r278109. 2015-02-02 20:18:47 +00:00
Ian Lepore
59f8cb6368 Do not skip setting the memory 'reg' property if the fdt data already
contains one.  Published dts source often includes a minimal default
memory definition and expects it to be overridden by the bootloader after
determining the actual physical memory in the system.
2015-02-01 18:21:16 +00:00
Nathan Whitehorn
cb46e6c2af Allow this to work with disks greater than 4 GB and with names not beginning
with "s".
2015-02-01 02:02:50 +00:00
Dimitry Andric
acdf53f9a3 Merge ^/head r277975 through r277998. 2015-01-31 20:49:30 +00:00
Nathan Whitehorn
878eae988b Relocate kernel to high address space (a static + 64 MB for now) to avoid
conflicts with the Linux host kernel. This lets you kexec an unmodified
GENERIC64.
2015-01-31 19:42:08 +00:00
Nathan Whitehorn
79215b4a3d Add FDT reservations for memory areas used by OPAL or RTAS runtime firmware.
This allows a kexec'ed kernel to boot multiuser under PHYP.
2015-01-31 19:18:09 +00:00
Nathan Whitehorn
b717bfa3ce Add code to support loading relocatable kernels at offsets that are not
zero.
2015-01-31 18:42:51 +00:00
Dimitry Andric
6a0fc39710 Merge ^/head r277956 through r277974. 2015-01-31 14:31:12 +00:00
Nathan Whitehorn
5bfb054e01 Add support for booting relocatable kernels on PowerPC. 2015-01-31 07:22:29 +00:00
Michael Gmelin
be0acc1ced Fix order of functions in smbios.c (corrects r277949), since this corrects
a build error I committed this directly, sorry.
2015-01-31 00:06:05 +00:00
Dimitry Andric
174411efe9 Merge ^/head r277945 through r277955. 2015-01-30 23:57:39 +00:00
Michael Gmelin
26066a530f New function smbios_match to detect BIOS versions during boot
Motivation is to introduce BIOS specific quirks early in the boot
process. smbios_match can be called before malloc is avaible, that's
why parts of smbios_detect have been moved into a separate function
smbios_probe that will be called by smbios_detect as well as
smbios_match.

Reviewed by:	jhb
Approved by:	jhb
Differential Revision: 	https://reviews.freebsd.org/D1679
2015-01-30 19:47:25 +00:00
Dimitry Andric
f72f83dcae Merge ^/head r277902 through r277944. 2015-01-30 18:34:56 +00:00
Doug Ambrisko
b6a6b77b12 Fix UEFI PXE boot on a NIC that isn't the first NIC.
In UEFI it appears all available NICS are present to pass network traffic.
This gives the capability to load the loader.efi from disk then set
currdev="net3:" and then all I/O will over over the 2nd NIC.  On this
machine is appears the first handle is the first NIC in IPv4 mode and
then the 2nd handle is the first NIC in IPv6 mode.  The 3rd handle is
the 2nd NIC in IPv4 mode.  The fix is to index into the handle based
on the unit cached from boot device passed into the loader.

Some testing info from a test boot via kenv:
	currdev="net3:"
	loaddev="net3:"
	boot.netif.name="igb1"
2015-01-30 18:25:53 +00:00