Commit Graph

3237 Commits

Author SHA1 Message Date
John Baldwin
9beae9a046 Fix remaining direct tests of the carry flag in the v86 %eflags via a
magic number to use V86_CY() instead.  These should have been fixed as
part of the cleanup in r226746 but were missed.

The md5 sums of the object files were unchanged, so there should be no
functional change.

PR:		205424
Submitted by:	Alexander Kuleshov <kuleshovmail@gmail.com>
MFC after:	1 week
2015-12-24 06:22:41 +00:00
Ed Maste
7ebeabcf9b Revert accidental whitespace changes included with r292623 2015-12-22 20:40:34 +00:00
Ed Maste
6ee0db8b76 Support a.out format in nlist only on i386
i386 is the only current FreeBSD architecture that ever used a.out
format.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4687
2015-12-22 20:36:14 +00:00
Ian Lepore
21fddb1173 Set env vars from values on the efi loader command line.
Examine each cmdline arg and if it contains an '=' convert it to ascii and
pass it to putenv(). This allows var=value settings to come in on the
command line.

This will allow overriding dhcp server-provided data in loader(8), as
discussed in PR 202098

PR:		202098
Differential Revision:	https://reviews.freebsd.org/D4561
2015-12-22 03:07:38 +00:00
Ed Maste
d3525a9e36 boot1.efi: show EFI error number, not full status value
EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-12-21 22:42:03 +00:00
Ed Maste
2dfc9e2cd4 loader.efi: strip trailing whitespace
Sponsored by:	The FreeBSD Foundation
2015-12-21 19:56:11 +00:00
Ian Lepore
ebe8a6e100 Add strlcat() and strlcpy() to libstand32. This should have been part of
r292234, but I forgot there was a libstand32.

Submitted by:	martymac
Pointy hat:	ian
2015-12-21 02:02:43 +00:00
Ed Maste
09e4ee9af3 loader.efi: refresh size in GetMemoryMap retry loop
If ExitBootServices fails due to a changed efi_mapkey then GetMemoryMap
must be called again. In this case it is also possible for the memory
map to grow, so repeat the initial GetMemoryMap call to fetch the new
size.

Also roll bi_add_efi_data_and_exit into bi_load_efi_data as there's no
need for it to be a separate function.

PR:		202455
Reported by:	Berislav Purgar <bpurgar@gmail.com>
Tested by:	Berislav Purgar <bpurgar@gmail.com>
Reviewed by:	kib
MFC after:	1 week
MFC with:	r292338
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4621
2015-12-20 16:07:09 +00:00
Enji Cooper
ee898967d0 Add missing smbios.h #include to mute a -Wimplicit-function-declaration warning
after r279222

Reported by: Jenkins
Sponsored by: EMC / Isilon Storage Division
2015-12-20 02:46:51 +00:00
Warner Losh
7a80f343f3 Pass the UEFI system table into the kernel from the boot loader via
the FW_HANDLE metadata item. The kernel can get the rest of what it
needs from this.
2015-12-19 19:01:42 +00:00
Ed Maste
2351669e6d loader.efi: show EFI error number, not full status value
EFI return values set the high bit to indicate an error. The log
messages changed here are printed only in the case of an error,
so including the error bit is redundant. Also switch to decimal to
match the error definitions (in sys/boot/efi/include/efierr.h).

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2015-12-18 17:39:54 +00:00
Baptiste Daroussin
35fad84fec Use human readable representation of ip for the pxeboot.ip kenv
While here use colon as a separator for pxeboot.hwaddr kenv

Sponsored by:	Gandi.net
2015-12-16 17:45:03 +00:00
Baptiste Daroussin
4d6ab32f99 pxeboot: make the tftp loader use the option root-path directive
pxeboot in tftp loader mode (when built with LOADER_TFTP_SUPPORT) now
prefix all the path to open with the path obtained via the option 'root-path'
directive.

This allows to be able to use the traditional content /boot out of box. Meaning
it now works pretty much like all other loaders. It simplifies hosting hosting
multiple version of FreeBSD on a tftp server.

As a consequence, pxeboot does not look anymore for a pxeboot.4th (which was
never provided)

Note: that pxeboot in tftp loader mode is not built by default.

Reviewed by:	rpokala
Relnotes:	yes
Sponsored by:	Gandi.net
Differential Revision:	https://reviews.freebsd.org/D4590
2015-12-16 17:13:09 +00:00
Ed Maste
54f97d1eef UEFI: combine GetMemoryMap and ExitBootServices and retry on error
The EFI memory map may change before or during the first
ExitBootServices call. In that case ExitBootServices returns an error,
and GetMemoryMap and ExitBootServices must be retried.

Glue together calls to GetMemoryMap(), ExitBootServices() and storage of
(now up-to-date) MODINFOMD_EFI_MAP metadata within a single function.

That new function - bi_add_efi_data_and_exit() - uses space previously
allocated in bi_load_efi_data() to store the memory map (it will fail if
that space is too short). It handles re-calling GetMemoryMap() once to
update the map key if necessary. Finally, if ExitBootServices() is
successful, it stores the memory map and its header as MODINFOMD_EFI_MAP
metadata.

ExitBootServices() calls are now done earlier, from within arch-
independent bi_load() code.

PR:		202455
Submitted by:	Ganael LAPLANCHE
Reviewed by:	kib
MFC after:	2 weeks
Relnotes:	Yes
Differential Revision:	https://reviews.freebsd.org/D4296
2015-12-16 16:19:18 +00:00
Ian Lepore
36f17e5176 Enhance the "ubenv import" command to allow importing a u-boot env var
directly into a loader (and thus kernel) env var, using the syntax

  ubenv import ldvarname=ubvarname

Without the varname= prefix it uses the historical behavior of importing
to the name uboot.ubvarname.
2015-12-14 22:00:46 +00:00
Andrey V. Elsukov
af90a87209 Make detection of GPT a bit more reliable.
When we are detecting a partition table and didn't find PMBR, try to
read backup GPT header from the last sector and if it is correct,
assume that we have GPT.

Reviewed by:	rpokala
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D4282
2015-12-10 10:35:07 +00:00
Bryan Drewery
b2fe867a0f DIRDEPS_BUILD: Update dependencies.
Sponsored by:	EMC / Isilon Storage Division
2015-12-07 23:53:01 +00:00
Enji Cooper
f23ba0f0e9 Remove stray unescaped % in Booting from ... informational message
PR: 204944
MFC after: 1 week
X-MFC with: r291164
Reported by: David Binderman <dcb314@hotmail.com>
Sponsored by: EMC / Isilon Storage Division
2015-12-05 23:59:30 +00:00
Ganbold Tsagaankhuu
f4459b9645 Add glue driver for Amlogic Meson Gigabit Ethernet Controller
and enable it for Odroid C1 board.
Together with r291676 change, dwc(4) can receive packets now.
2015-12-03 09:37:20 +00:00
Nathan Whitehorn
87008d7b77 Clean up PowerPC bootloader compiler flags to fix the build with GCC 5.2
and binutils 2.25.
2015-12-03 00:08:50 +00:00
Nathan Whitehorn
b931a53849 Allow loader to load 64-bit ELFv2 PowerPC kernels. 2015-12-01 17:01:27 +00:00
Bryan Drewery
b1f92fa229 META MODE: Update dependencies with 'the-lot' and add missing directories.
This is not properly respecting WITHOUT or ARCH dependencies in target/.
Doing so requires a massive effort to rework targets/ to do so.  A
better approach will be to either include the SUBDIR Makefiles directly
and map to DIRDEPS or just dynamically lookup the SUBDIR.  These lose
the benefit of having a userland/lib, userland/libexec, etc, though and
results in a massive package.  The current implementation of targets/ is
very unmaintainable.

Currently rescue/rescue and sys/modules are still not connected.

Sponsored by:	EMC / Isilon Storage Division
2015-12-01 05:23:19 +00:00
Zbigniew Bodek
6a5289b068 Add support for exynos5_ehci in loader
Create new driver which initializes Arndale PHY and calls ehci_init

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4192
2015-11-27 18:22:04 +00:00
Zbigniew Bodek
fcf39bdcc4 Increase malloc area in loader/usb
Previous value was not enough on Arndale platform.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4145
2015-11-27 18:20:21 +00:00
Zbigniew Bodek
5bb01ba335 Run callouts during infinite waiting inside cv_wait
During cv_wait we may be waiting for an event triggered by callout.
Run callbacks here to avoid code blocking.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4144
2015-11-27 18:19:11 +00:00
Zbigniew Bodek
bbcfaa4eb8 Implement simple ops for umass_disk
The initial IOCTL implementation supports reading disk physical
geometry.
Two additional functions were added. They allow reading/writing raw
data to the disk (default partition).

Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4143
2015-11-27 18:17:53 +00:00
Zbigniew Bodek
09a37b41c5 Do not zero memory in umass_detach
The detach function is called very often, for example from
get_capacity function. We don't want to loose any pointers
here, so disable detaching for umass driver.

Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4141
2015-11-27 18:16:10 +00:00
Zbigniew Bodek
2646d9c030 Implement missing bus_space_subregion in kshim
Add missing function, used by exynos5_ehci driver.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4141
2015-11-27 18:14:45 +00:00
Zbigniew Bodek
7f34c97a79 Use properly aligned buffer in usb_alloc
The PA adress must be gathered from an aligned VA,
not the RAW pointer to the memory space.

Reviewed by:   hselasky
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4140
2015-11-27 18:13:28 +00:00
Bryan Drewery
b791fbe630 META MODE: Don't create .meta files when symlinking sources into the obj directory.
Tracking these leads to situations where meta mode will consider the
file to be out of date if /bin/sh or /bin/ln are newer than the source
file.  There's no reason for meta mode to do this as make is already
handling the rebuild dependency fine.

Sponsored by:	EMC / Isilon Storage Division
2015-11-25 19:44:43 +00:00
Ian Lepore
731192872f Print more detailed info about the disk and partition chosen for booting.
No behavioral changes, just cosmetics.

A partition number of zero is not a wildcard, it's the 'a' partition in
a BSD slice, so don't print it as "<auto>".  (Only slices are 1-based,
unit and partition numbers are 0-based and -1 is their wildcard marker.)

Also, after doing all the probing and choosing, print the final result as
"Booting from <disk spec>" where disk spec has all the wildcards resolved
and looks like familiar BSD slice-and-partition notation (disk0s3a, etc).
2015-11-22 20:38:50 +00:00
Ed Maste
380392f2f9 Disconnect unused kgzldr from sys/boot/i386
Sponsored by:	The FreeBSD Foundation
2015-11-20 21:56:20 +00:00
Bryan Drewery
d9b8630978 Remove disconnected boot0ext.
This was [re-]added in r127458 (apparently with disconnected history as well)
and never connected to the build.

It is no longer relevant for modern systems from the past 20 years.

Discussed with:	jhb
Sponsored by:	EMC / Isilon Storage Division
2015-11-20 18:10:02 +00:00
Nathan Whitehorn
0df013a065 The Linux kexec boot loader doesn't need a font built in to it. This got
copied-and-pasted from the PS3 loader.
2015-11-19 01:57:23 +00:00
Steven Hartland
ca94d06e45 Document loader(8) dumpdev option
Add an entry for dumpdev environment variable to loader(8).

MFC after:	1 week
Sponsored by:	Multiplay
2015-11-18 09:42:36 +00:00
Warner Losh
fe04a9e147 Add support for the Zybo and similar boards to ZEDBOARD kernel.
Zybo needs its own DTB and has a different PHY, so add it to
the base kernel. Details on building bootable SD images at
http://www.thomasskibo.com/zedbsd/

Submitted By: Thomas Skibo
2015-11-13 15:36:40 +00:00
Oleksandr Tymoshenko
686ec1cbb0 Raspberry Pi firmware passes cache line size as a DTB parameter
- Add cache-line-size paramter to vchiq node
- Add cache_line_size DTB parameter referencing to
    .../vchiq/cache-line-size property
2015-11-03 04:50:58 +00:00
Enji Cooper
a71c657475 Make vers.c creation atomic by using a temporary file, then moving
the temporary file to vers.c at the end of the script

The previous logic wrote out to vers.c multiple times, so the file
could be incorrectly interpreted as being completely written out
after one of the echo calls with recursive make, when in reality it
was only partially written.

Also, in the event the build was interrupted when creating vers.c
(small race window), it would have a leftover file that needed to
be cleaned up before resuming the build.

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division
2015-10-24 21:59:58 +00:00
Colin Percival
889592b876 Change gptldr from relocating 0xfff1 bytes of boot2 to relocating 0x20000
bytes of boot2.  Since we're in 16-bit mode, we can't copy all 128kB at
once; instead we loop four times and copy 32 kB each time.

This change was made necessary by an upcoming increase in the size of the
boot2 binary; should it increase further, the COPY_BLKS value can be
adjusted without anyone needing to remember 8086 assembly language again.

Requested by:	allanjude
Tested by:	allanjude
MFC after:	1 week
2015-10-08 15:38:34 +00:00
John Baldwin
3e10dd1049 Use EFI page size constants instead of hardcoding 4096.
Reviewed by:	emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3692
2015-09-29 15:49:53 +00:00
Luiz Otavio O Souza
2dde378283 Set the #address-cells and #size-cells for the I2C controllers in RPi2.
This allows the use of I2C addresses in 'reg' property.
2015-09-27 18:21:22 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00
Luiz Otavio O Souza
61ebeff43c Enable if_dwc for Allwinner A20 based boards.
This enables the gigabit ethernet on cubieboard2 and banana pi.

A special thanks to Netgate who gently provided me with a banana pi almost
a year ago.
2015-09-21 03:17:41 +00:00
John Baldwin
b2e38974e2 The EFI boot loader allocates a single chunk of contiguous memory to
hold the kernel, modules, and any other loaded data.  This memory block
is relocated to the kernel's expected location during the transfer of
control from the loader to the kernel.

The GENERIC kernel on amd64 has recently grown such that a kernel + zfs.ko
no longer fits in the default staging size.  Bump the default size from
32MB to 48MB to provide more breathing room.

PR:		201679
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D3666
2015-09-17 20:36:46 +00:00
John Baldwin
5dc89bd2a0 Various small cleanups to EFI loader Makefiles.
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D3641
2015-09-17 18:32:51 +00:00
Hans Petter Selasky
6e17d3a7fc Add missing file to build. 2015-09-14 07:11:53 +00:00
Marcel Moolenaar
40ea8e710e As expected, things aren't as simple as hoped. Consequently, we have
no option but to use the smbios information to fill in the blanks.
It's a good thing UGA is a protocol of the past and GOP has all the
info we need.

Anyway, the logic has been tweaked a little to get the easier bits
of information up front. This includes the resolution and the frame
buffer address. Then we look at the smbios information and define
expected values as well as the missing bits (frame buffer offset and
stride). If the values obtained match the expect values, we fill in
the blanks and return. Otherwise we use the existing detection logic
to figure it out.

Rename the environment variables from uga_framebuffer abd uga_stride
to hw.efifb.address and hw.efifb.stride. The latter names are more
in line with other variable names.

We currently have hardcoded settings for:
1.  Mid-2007 iMac (iMac7,1)
2.  Late-2007 MacBook (MacBook3,1)
2015-09-07 17:56:49 +00:00
Marcel Moolenaar
1f8577e633 Auto-detect the UGA frame buffer and stride on a MacBook. We're
striking a delicate balance between exhaustive searching and
banking on assumptions. The environment variables can be used
as a fall-back anyway. With this change, all known and tested
Macs with only UGA should have a working console out of the
box... for now...
2015-09-05 18:24:51 +00:00
Marcel Moolenaar
39993974aa My MacBook has UGA only, but we fail to detect any changes
in the frame buffer when we flip pixels. Allow the detection
to be bypassed by setting the uga_framebuffer and uga_stride
variables. The kernel console works fine even when we can't
detect pixel changes in the frame buffer, which indicates
that the problem could be with reading from the frame buffer
and not writing to it.
2015-09-05 03:27:23 +00:00