Commit Graph

2887 Commits

Author SHA1 Message Date
Doug Ambrisko
db0b8e10a7 Make UEFI booting of 4Kn disks work:
-	convert boot1.efi to corrrectly calculate the lba for what the
	media reports and convert the size based on what FreeBSD uses.
	The existing code would use the 512 byte lba and convert the
	size using 4K byte size.
      -	make fsck_msdosfs read the boot block as 4K so the read doesn't
	fail on a 4Kn drive since FreeBSD will error out parition reads
	of a block.  Make the bpbBytesPerSec check a multiple of 512 since
	it can be 512 or 4K depending on the disk.  This allows fsck to
	pass checking the EFI partition on a 4Kn disk.

To create the EFI file system I used:
	newfs_msdos -F 32 -S 4096 -c 1 -m 0xf8 <partition>
This works for booting 512 and 4Kn disks.

Caveat is that loader.efi cannot read the 4Kn EFI partition.  This isn't
critical right now since boot1.efi will read loader.efi from the ufs
partition.  It looks like loader.efi can be fixed via making some of the
512 bytes reads more flexible.  loader.efi doesn't have trouble reading
the ufs partition.  This is probably a simple fix.

I now have FreeBSD installed on a system with 4Kn drives and tested the
same code works on 512.

MFC after:	1 week
2014-10-30 15:52:01 +00:00
Ruslan Bukin
2d3f1b38a9 Provide a character device allowing us to access BERI memory regions.
Sponsored by:	DARPA, AFRL
2014-10-22 11:30:03 +00:00
Ruslan Bukin
8b62915e24 Add driver for Micrel KSZ9021 Gigabit Ethernet Transceiver (PHY).
Sponsored by:	DARPA, AFRL
2014-10-21 09:14:16 +00:00
Marcel Moolenaar
0067051fe7 Fully support constructors for the purpose of code coverage analysis.
This involves:
1.  Have the loader pass the start and size of the .ctors section to the
    kernel in 2 new metadata elements.
2.  Have the linker backends look for and record the start and size of
    the .ctors section in dynamically loaded modules.
3.  Have the linker backends call the constructors as part of the final
    work of initializing preloaded or dynamically loaded modules.

Note that LLVM appends the priority of the constructors to the name of
the .ctors section. Not so when compiling with GCC. The code currently
works for GCC and not for LLVM.

Submitted by:	Dmitry Mikulin <dmitrym@juniper.net>
Obtained from:	Juniper Networks, Inc.
2014-10-20 17:04:03 +00:00
Ian Lepore
db8aa5fd6d The U-Boot README says fdt_addr_r is the right env var for fdt data
loaded into ram, but vendors also use fdtaddr and fdt_addr.  Check the
recommended variable first and fall back to the others.
2014-10-20 01:52:17 +00:00
Ruslan Bukin
b0da449e60 Add driver for BERI soft processor 'ring buffer' device.
Ring device provides a way for communicate to BERI
peripherals such as BERI debug unit and console.

Sponsored by:	DARPA, AFRL
2014-10-19 16:26:49 +00:00
Rui Paulo
5aed7446fe AM335X FDT: use the oma3-wdt string for compatibility with Linux.
Submitted by:	andrew
MFC after:	1 week
2014-10-18 16:34:52 +00:00
Rui Paulo
b406729896 AM335x FDT: add an entry for the watchdog.
MFC after:	1 week
2014-10-18 07:40:38 +00:00
Jens Schweikhardt
632d4e706a Correct grammos.
MFC after:	3 weeks
2014-10-15 17:55:10 +00:00
Ruslan Bukin
d4d630aebe o Add machine-dependent SMP part
o Enable SMP

Sponsored by:	DARPA, AFRL
2014-10-10 14:35:51 +00:00
Baptiste Daroussin
66c8095956 Rename elf*-powerpc into elf*-powerpc-freebsd in binutils
The powerpc support was the only supported architecture not prepending the elf format name
with "-freebsd" in base this change makes it consistent with other architectures.
On newer version of binutils the powerpc format is also prepended with "-freebsd".

Also modify the kernel ldscripts in that regards.

As a result it is now possible cross build the kernel on powerpc using newer binutils

Differential Revision:	https://reviews.freebsd.org/D926
Differential Revision:	https://reviews.freebsd.org/D928
2014-10-10 06:24:09 +00:00
Marcel Moolenaar
511037bd43 Properly NUL-terminate the on-stack buffer for reading /boot.config
or /boot/config. In qemu, on a warm boot, the stack is not all zeroes
and we parse beyond the file's contents.

Obtained from:	Juniper Networks, Inc.
2014-10-09 01:54:32 +00:00
Andrey V. Elsukov
5c6af4bbf5 Fix comment.
MFC after:	1 week
2014-10-08 12:33:31 +00:00
Ruslan Bukin
41709d23c4 Add driver for Synopsys DesignWare Mobile Storage Host Controller.
Sponsored by:	DARPA, AFRL
2014-10-07 17:39:30 +00:00
Andrey V. Elsukov
4118113fc1 Rework bootparttest to use more code from sys/boot.
Use disk_open() call to emulate loader behavior.
2014-10-05 06:04:47 +00:00
Andrey V. Elsukov
34f50f4c34 Add a bit more debug messages. 2014-10-05 06:00:22 +00:00
Andrey V. Elsukov
f24c6fe478 Add GUID of FreeBSD slice to GPT scheme.
MFC after:	1 week
2014-10-03 21:46:07 +00:00
Andrew Turner
6d4766c1b8 Remove MK_ARM_EABI, the armeb issues have been fixed. The code to support
the oabi is still in the tree, but it is expected this will be removed
as developers work on surrounding code.

With this commit the ARM EABI is the only supported supported ABI by
FreeBSD on ARMa 32-bit processors.

X-MFC after:	never
Relnotes:	yes
Differential Revision: https://reviews.freebsd.org/D876
2014-10-01 08:26:51 +00:00
Yoshihiro Takahashi
4ac1175e89 MFi386: r261567
Switch from lib/libstand to sys/boot/libstand32.
2014-09-28 13:34:43 +00:00
Yoshihiro Takahashi
2c4969da8d MFi386: r268974
Supress clang warning for FreeBSD printf %b and %D formats.
2014-09-28 13:13:18 +00:00
Yoshihiro Takahashi
f40e4b0c6d MFi386: r261520
Drop the 3rd clause from all 3 clause BSD licenses.
2014-09-28 12:25:27 +00:00
Yoshihiro Takahashi
985b2f8cd1 Reduce diffs against i386. 2014-09-28 12:13:51 +00:00
Yoshihiro Takahashi
a580f768cf Remove extra '\'. 2014-09-28 12:12:54 +00:00
Alexander Kabaev
23667f089d Remove obsolete compatibility glue and improve firewire code readability.
Commit my version of style(9) pass over the firewire code. Now that
other people have started changing the code carrying this is as a
local patch is not longer a viable option.

MFC after:	1 month
2014-09-27 16:50:21 +00:00
Ruslan Bukin
5d43fd685b Add driver for Synopsys DesignWare 3504-0 Universal 10/100/1000
Ethernet MAC.

Sponsored by:	DARPA, AFRL
2014-09-25 18:03:14 +00:00
Ed Maste
7797431f9a Remove duplicated header content
I fail at patch(1).

MFC after:	3 days
2014-09-25 13:31:08 +00:00
Ed Maste
3bcd280e3b Switch to text mode in UEFI boot
The loader previously failed to display on MacBooks and other systems
where the UEFI firmware remained in graphics mode.

Submitted by:	Rafael Espíndola
2014-09-18 13:59:36 +00:00
Ed Maste
7f4b01c1fa Wrap long lines introduced in r268227 2014-09-18 13:00:03 +00:00
Andriy Gapon
ce2907df79 add gptzfsboot.8, zfsboot.8 and zfsloader.8 manual pages
Many thanks to Warren Block for his reviews, corrections and additions.

Reviewed by:	Warren Block <wblock@FreeBSD.org>
MFC after:	1 week
2014-09-15 06:21:28 +00:00
Doug Ambrisko
cb8a626055 Add support for serial and null console to UEFI boot loader. 2014-09-12 17:32:28 +00:00
Ruslan Bukin
6ca0b78179 Add Reset Manager driver. This driver provides generic way to reset
and provides sysctl tunables for enable/disable FPGA<->HPS bridges.

Sponsored by:	DARPA, AFRL
2014-09-11 18:12:28 +00:00
Warner Losh
dd56e3b6bc Add support for calling pcibios routines from the
bootloader. Implement the following routines:
	pcibios-device-count	count the number of instances of a devid
	pcibios-read-config	read pci config space
	pcibios-write-config	write pci config space
	pcibios-find-devclass	find the nth device with a given devclass
	pcibios-find-device	find the nth device with a given devid
	pcibios-locator		convert bus device function ti pcibios locator
These commands are thin wrappers over their PCI BIOS 2.1 counterparts. More
informaiton, such as it is, can be found in the standard.

Export a nunmber of pcibios.X variables into the environment to report
what the PCI IDENTIFY command returned.

Also implmenet a new command line primitive (pci-device-count), but don't
include it by default just yet, since it depends on the recently added
words and any errors here can render a system unbootable.

This is intended to allow the boot loader to do special things based
on the hardware it finds. This could be have special settings that are
optimized for the specific cards, or even loading special drivers. It
goes without saying that writing to pci config space should not be
done without a just cause and a sound mind.

Sponsored by:	Netflix
2014-09-10 21:07:00 +00:00
Ian Lepore
6966304042 Add a 'ubenv import' command to import environment variables from the
u-boot env into the loader(8) env (which also gets them into the kernel
env).  You can import selected variables or the whole environment.  Each
u-boot var=value becomes uboot.var=value in the loader env.  You can also
use 'ubenv show' to display uboot vars without importing them.
2014-09-08 19:19:10 +00:00
Ruslan Bukin
34a0189341 Add FPGA Manager driver. This driver allows to program FPGA core
from FreeBSD userspace running on ARM core.

Sponsored by:	DARPA, AFRL
2014-09-06 08:48:57 +00:00
Ian Lepore
9cbece6f0d Stop setting the iomux device status to disabled, now that we have a driver. 2014-09-04 19:52:17 +00:00
Ruslan Bukin
9493c332a3 Add initial support for Altera SOCFPGA (heterogeneous ARM/FPGA) SoC family.
Include board configuration for Terasic SoCKit (Altera Cyclone V).

Sponsored by:	DARPA, AFRL
2014-09-04 12:44:40 +00:00
Ian Lepore
7a969f2e05 When built with FDT support, add /boot/dtb to the list of search directories. 2014-09-03 21:25:36 +00:00
Warner Losh
696a6f55d1 The proper compatibility string for the AHCI device is
allwinner,sun4i-ahci, so use that instead of the older string which
had become FreeBSD specific.
2014-09-02 16:38:00 +00:00
Andrey V. Elsukov
94be23b653 Since the size of GPT entry may differ from the sizeof(struct gpt_ent),
use the size from GPT header to iterate entries.

Suggested by:	marcel@
MFC after:	1 week
2014-08-25 07:15:14 +00:00
Andrey V. Elsukov
69ce0dbce3 The size of the GPT table can not be less than one sector.
Reported by:	rodrigc@
MFC after:	1 week
2014-08-24 09:20:30 +00:00
Bryan Drewery
5608fd23c2 Revert r267233 for now. PIE support needs to be reworked.
1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
   build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
   where it never would work anyhow, such as csu or loader. This suggests
   there may be better ways of adding support to the tree. Many of these
   cases can be fixed such that -fPIE will work but there is really no
   reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
   really building libraries but have been using bsd.prog.mk because the code
   is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
   been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by:	kib
2014-08-19 15:04:32 +00:00
Warner Losh
d8f5c1e164 New DTS files to suppport the SAM9260EK eval board. Derived, in part,
from the SAM9G20EK dts files (so that file is GPL'd).
2014-08-19 03:51:05 +00:00
Sean Bruno
45a3069948 Quiesce warning about discarding a const qualifier in assignement.
Phabric:	https://phabric.freebsd.org/D445
Reviewed by:	neel
2014-08-08 21:47:47 +00:00
Marcel Moolenaar
7d67e5f85e Optionally include the install command as found on Juniper products
like EX and SRX. The install command uses pkgfs to extract a kernel,
zero or more modules and a root file system from the specified package
and boots the kernel. The name of the kernel, the list of modules and
the name of the root file system can be specified by putting a
file called "metatags in the package.

The package to use is given by an URL. The schemes supported are
tftp and file. For the file scheme, the disk is currently hardcoded
but that should really look for the package on all devices and
partititions.

Obtained from:	Juniper Networks, Inc.
2014-08-06 00:36:04 +00:00
Marcel Moolenaar
ca0a6da1a2 Rename command_unload() to unload() and re-implement command_unload()
in terms of unload() This allows unloading all files by the loader
itself.

Obtained from:	Juniper Networks, Inc.
2014-08-06 00:06:25 +00:00
Marcel Moolenaar
fae00455b5 In command_lsmod() prevent overrunning lbuf due to long path
names. Call pager_output() separately for the module name.

Obtained from:	Juniper Networks, Inc.
2014-08-05 23:55:23 +00:00
Marcel Moolenaar
0b790c084c In file_loadraw() print the name of the file as well as its size
so that we know what file is being loaded and how big the file
is once complete. This has ELF modules and disk images emit the
same output.
2014-08-05 23:41:40 +00:00
Hans Petter Selasky
f9478f91fb Add new USB phone descriptor template for USB device side mode.
MFC after:	3 days
2014-08-05 07:03:16 +00:00
Brooks Davis
92dbec66f2 Merge from CheriBSD:
Make the sysinit tool a build tool rather than building in with
/usr/bin/cc and running it from OBJDIR.  (It will be moved to usr.bin
once a manpage is written and a few style cleanups are done.)

Split the makefile bits for Hans' kernel shim layer into their own
includable kshim.mk.

Move USB support into a .mk file so loaders can include it.
2014-08-04 23:00:13 +00:00
Ruslan Bukin
d440ef2d73 Rename files: keep codename only to make it shorter. 2014-08-01 15:10:55 +00:00