Commit Graph

2692 Commits

Author SHA1 Message Date
Robert Watson
347d368c80 On mips64, built 64-bit ELF support.
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2014-02-23 22:11:26 +00:00
Robert Watson
02f21ea80b Give mips64 its own ficl configuration that sizes pointers/etc suitably for
a 64-bit architecture, rather than trying to share the 32-bit MIPS ficl
configuration.

When building ficl on MIPS, don't conflate 32-bit and 64-bit ISAs -- unlike
x86, we don't want a 32-bit loader on a 64-bit CPU.  Use quite conservative
code generation -- e.g., softfloat, no GOT, etc -- suitable for early boot.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2014-02-23 22:10:25 +00:00
Ian Lepore
abe4be7dfd Add a feature for automatically finding and loading a dtb file by name.
The name is taken from the u-boot env vars fdtfile or fdt_file.  If the
name isn't fully-qualified a search is done in module_path locations.

The search order for a usable dtb in fdt_setup_fdtp() is now

 - A dtb loaded with an explicit "load -t dtb" command.
 - A dtb already loaded into memory somehow[*] and pointed to by fdt_to_load.
 - A dtb in the memory pointed to by the u-boot env vars fdtaddr or fdt_addr.
 - A file named by the u-boot env vars fdtfile or fdt_file.
 - A static dtb compiled into the kernel.

* Presumably by some arch-specific command or code.
2014-02-22 22:18:20 +00:00
Ian Lepore
84207cf3b0 Change file_loadraw() from static to public. Change the order of its
arguments from type,filename to filename,type to be consistant with other
public file_whatever() functions, and change it to return a pointer to
the preloaded_file struct describing the file.  Adjust existing callers.
2014-02-22 22:03:26 +00:00
Ian Lepore
d000dd2f86 Change fdt_setup_fdtp() from "guess then fail" to more probe-like behavior.
The old code basically said it was going to use some particular blob
without knowing whether it could successfully do so, then it would invoke
the function to do that and return its status.  If it failed, you were
done, even if other blobs might be available.  Now the code attempts to use
some particular blob and if that succeeds it says so and returns success,
otherwise it moves on to try another potential blob.

One specific problem this solves is when u-boot sets an fdtaddr variable
to point to some memory address, then doesn't actually load a blob at
that address.  Now the header check will fail, and the code will move
on to the fallback dtb compiled into the kernel (if any).
2014-02-22 19:10:58 +00:00
Ian Lepore
324b64f7ac Allow the ubldr boot device to be choosen by a u-boot environment variable.
If a "loaderdev=<device>" env variable is set and the named device
exists, it is used.  If the device doesn't exist, fall back to the
historic "probe" loop that prefers disk devices over network devices.

If the env var is not set, preserve the historic behavior of using the
first working disk device provided by u-boot, or a network device if no
functional disk device is found and a network device exists.

The old probe loop is reworked so that it checks all bootable devices
provided by u-boot rather than taking an early-out on the first device
found.  This results in the cosmetic change of listing all potential boot
devices for the user, but the behavior of which device it chooses is the
same as it has always been.
2014-02-22 17:51:10 +00:00
Peter Grehan
cf087c12c2 ZFS boot support for bhyveload.
Modelled after the i386 zfsloader. However, with no
2nd stage zfsboot to search for a bootable dataset,
attempt a ZFS boot if there is more than one ZFS
dataset found during the disk probe.

sys/boot/userboot/zfs
 - build the ZFS boot library

sys/boot/userboot/userboot/
 conf.c
  - Add the ZFS pool and filesystem tables
 devicename.c
  - correctly format ZFS devices
 main.c
  - increase the size of the libstand malloc pool
  to account for the increased usage from ZFS buffers
  - probe for a ZFS dataset, and if one is
  found, attempt to boot from it.

usr.sbin/bhyveload/bhyveload.c
 - allow multiple invocations of the '-d' option
 to specify multiple disks e.g. a raidz set.
 Up to 32 disks are supported.

Tested with various combinations of GPT, MBR, single
and multiple disks, RAID-Z, mirrors.

Reviewed by:	neel
Discussed with:	avg
Tested by:	Michael Dexter and others
MFC after:	3 weeks
2014-02-22 07:18:06 +00:00
Ian Lepore
7c674742cb Look for both fdtaddr and fdt_addr env var names. Grepping the u-boot
source shows that board vendors seem to be about evenly split on this.

This commit is a trivial change to note that while the previous change
was supposed to be whitespace only, this functional change also crept in.
The added lines were:

  /* Board vendors use both fdtaddr and fdt_addr names.  Grrrr. */

  if (s == NULL)
	s = ub_env_get("fdt_addr");
2014-02-22 03:36:45 +00:00
Ian Lepore
f5658746ab Fix the strange 2-space indentation that appears only in this one function. 2014-02-22 03:29:53 +00:00
Ian Lepore
86a5575402 Add basic cpu frequency control and temperature monitoring to imx6_anatop.
The temperature monitor device is enabled to sample the die temperature at
16hz.  The temperature is published via sysctl.  A callout routine at 10hz
monitors the temperature and throttles back the cpu if the temperature
goes over a user-settable throttle point (by default 10C less than the
critical high-point temperature for the chip).  The hardware is supposed
to be able to deliver an interrupt when the temperature exceeds a settable
limit, but the interrupt never arrives so for now a callout does the job.

At attach time we read the maximum cpu frequency the chip is allowed to run
at and the cpu is set to run at that speed.  It's reported at attach time.
A sysctl variable reports the current speed when queried.

New sysctl values:

  dev.imx6_anatop.0.cpu_mhz: 984
  dev.imx6_anatop.0.temperature: 37.9C
  dev.imx6_anatop.0.throttle_temperature: 95.0C

Steven Lawrance did the initial heavy lifting on this, but I changed
enough stuff that I'm the one to blame if anything breaks.

Submitted by:	Steven Lawrance <stl@koffein.net>
2014-02-21 06:00:06 +00:00
Luiz Otavio O Souza
69728ec82d Fix the boot on FDT-enabled systems after r261819.
While here, don't overwrite the error message on interactive use and add
the missing '\n' at end of error message for the non interactive use.

Tested by:	ian, myself
Approved by:	adrian (mentor, implicit)
2014-02-20 13:09:08 +00:00
Robert Watson
b1bdbe9d09 Temporarily unhook BERI boot loader from the build until 32-bit MIPS
properly excludes building our 64-bit only boot-loader adaptation.
2014-02-19 23:09:25 +00:00
Robert Watson
0c7090e31a Do build boot-loader FDT code on MIPS.
MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2014-02-19 17:44:59 +00:00
Robert Watson
2067168264 Replace Apache-style license on two Makefiles with stock 2-clause BSD;
license, although the former is pretty safe, it wasn't intended to be
used in the version of MIPS boot2/loader upstreamed to FreeBSD.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRL
2014-02-18 23:22:54 +00:00
Robert Watson
4527ee3e06 Commit a first cut at ports of boot2 and loader to 64-bit MIPS, with a
particular interest in (and support for) SRI International and the
University of Cambridge's BERI FPGA soft-core processor.  This includes
micro device drivers for the Altera JTAG UART console, memory-mapped
flash, and the Altera SD Card IP core in both boot2 and loader.  boot2
can be written to the on-board Intel StrataFlash on the DE4 board, and
loader can be placed in StrataFlash or the SD Card.

Plenty of XXX comments, but works quite well locally in practice and I
am using it daily.  Although I had originally ported the ARM version
of boot2, the current version is x86-derived as that proved more
feature-complete.  As we don't currently use partitions on our flash
disks, support for that has been commented out relative to x86, but
would be easy to add back.  FDT support has not yet been hooked up,
although some skeleton parts have been put in place for that.

This may well be a useful starting point for ports to other 32-bit and
64-bit MIPS-ISA systems.

This merge is synchronised to CheriBSD github commit
e41d74fd71, but with some additions of
$FreeBSD.

MFC after:	3 weeks
Sponsored by:	DARPA, AFRAL
2014-02-18 23:18:32 +00:00
Ruslan Bukin
586a16c431 Add driver for Synchronous Audio Interface (SAI).
SAI supports full-duplex serial interfaces with frame
synchronization such as I2S, AC97, TDM, and codec/DSP
interfaces.
2014-02-16 16:49:54 +00:00
Christian Brueffer
7f47cbd3ce Retire the nve(4) driver; nfe(4) has been the default driver for NVIDIA
nForce MCP adapters for a long time.

Yays:	jhb, remko, yongari
Nays:	none on the current and stable lists
2014-02-16 12:22:43 +00:00
Ian Lepore
844a97cdc2 Add a driver to provide access to imx6 on-chip one-time-programmble data.
Submitted by:	Steven Lawrance <stl@koffein.net>
2014-02-15 17:19:55 +00:00
Luiz Otavio O Souza
62564a0858 Make the gpioled(4) work out of the box on BBB.
Add gpioled(4) to BEAGLEBONE kernel and add the description of the four
on-board leds of beaglebone-black to its DTS file.

Approved by:	adrian (mentor, implicit)
2014-02-13 18:51:37 +00:00
Ian Lepore
1332dc8827 Validate the header of a new dtb before using it. Remove the comment
that says that should be done.
2014-02-13 04:13:50 +00:00
Ian Lepore
50618a328f Enable both sdcard slots, but not the sdio-based wifi that we don't yet
have a driver for.
2014-02-13 04:10:27 +00:00
Ian Lepore
e4366cae40 Add standard non-removable and cd-gpios properties to the usdhc devices.
That generates references to gpio devices, so uncomment them even though
there isn't a gpio driver to do anything with them yet.
2014-02-13 03:41:00 +00:00
Ruslan Bukin
f3a72e40b5 Add drivers for:
- Enhanced Direct Memory Access Controller (eDMA)
- Direct Memory Access Multiplexer (DMAMUX)
2014-02-08 19:47:59 +00:00
Ed Maste
90990e3bc1 Build a 32-bit libstand under sys/boot/ for ppc64
This change is equivalent to r261567 for i386/amd64.

Sponsored by:	The FreeBSD Foundation
2014-02-07 22:49:42 +00:00
Ed Maste
b0b98e9752 Don't force efi to a 32-bit build on amd64
Sponsored by:	The FreeBSD Foundation
2014-02-07 16:28:40 +00:00
Ed Maste
5a989e68f6 Build a 32-bit libstand under sys/boot/
A 32-bit libstand is needed on 64-bit platforms for use by various
bootloaders.  Previously only the 32-bit version was built, installed as
/usr/lib/libstand.a.

A new 64-bit libstand consumer will arrive in the near future, so move
the bootloader-specific 32-bit version to sys/boot/libstand32/.

Explicitly link against this version in the 32-bit loaders.

Sponsored by:	The FreeBSD Foundation
2014-02-06 21:54:21 +00:00
Warren Block
665c90aa49 Describe the use of a freebsd-boot GPT partition, brought up by Scot
Hetzel <swhetzel@gmail.com> on the -doc mailing list.

Also modify the Author section to be clear that I wrote the man page,
not gptboot.

MFC after:	3 days
2014-02-05 18:26:30 +00:00
John Baldwin
e432d5f6a7 Drop the 3rd clause from all 3 clause BSD licenses where I am the sole
holder to convert them to 2 clause BSD licenses.

MFC after:	1 week
2014-02-05 18:13:27 +00:00
John Baldwin
96c3037416 Similar to r130943 for cdboot.S, update the license on this file to a
stock 2-clause BSD license.

MFC after:	1 week
2014-02-05 17:22:54 +00:00
Luiz Otavio O Souza
1b3fd4ca03 Add the missing ')' at end of sentence. Reword it to use a more common
idiom.

Reviewed by:	imp (on freebsd-embedded@)
Approved by:	adrian (mentor, implicit)
2014-02-05 17:08:55 +00:00
John Baldwin
00f3efe1bd Add support for FreeBSD/i386 guests under bhyve.
- Similar to the hack for bootinfo32.c in userboot, define
  _MACHINE_ELF_WANT_32BIT in the load_elf32 file handlers in userboot.
  This allows userboot to load 32-bit kernels and modules.
- Copy the SMAP generation code out of bootinfo64.c and into its own
  file so it can be shared with bootinfo32.c to pass an SMAP to the i386
  kernel.
- Use uint32_t instead of u_long when aligning module metadata in
  bootinfo32.c in userboot, as otherwise the metadata used 64-bit
  alignment which corrupted the layout.
- Populate the basemem and extmem members of the bootinfo struct passed
  to 32-bit kernels.
- Fix the 32-bit stack in userboot to start at the top of the stack
  instead of the bottom so that there is room to grow before the
  kernel switches to its own stack.
- Push a fake return address onto the 32-bit stack in addition to the
  arguments normally passed to exec() in the loader.  This return
  address is needed to convince recover_bootinfo() in the 32-bit
  locore code that it is being invoked from a "new" boot block.
- Add a routine to libvmmapi to setup a 32-bit flat mode register state
  including a GDT and TSS that is able to start the i386 kernel and
  update bhyveload to use it when booting an i386 kernel.
- Use the guest register state to determine the CPU's current instruction
  mode (32-bit vs 64-bit) and paging mode (flat, 32-bit, PAE, or long
  mode) in the instruction emulation code.  Update the gla2gpa() routine
  used when fetching instructions to handle flat mode, 32-bit paging, and
  PAE paging in addition to long mode paging.  Don't look for a REX
  prefix when the CPU is in 32-bit mode, and use the detected mode to
  enable the existing 32-bit mode code when decoding the mod r/m byte.

Reviewed by:	grehan, neel
MFC after:	1 month
2014-02-05 04:39:03 +00:00
Ruslan Bukin
b318fc466d Add support for Colibri VF50 Evaluation Board.
Colibri VF50 is a SODIMM200 Vybrid Family core module
and development board produced by Toradex AG.

Sponsored by:	Machdep, Inc.
2014-02-02 19:35:10 +00:00
Ruslan Bukin
bf636ac469 o Expand device tree information
o Export iomuxc (pins) configuration to DTS
o Allow devices to assign clocks in DTS
2014-02-02 17:48:06 +00:00
Alexander Motin
75da4d0634 Make comconsole options set before its activation to be remembered.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2014-01-20 23:27:05 +00:00
Ganbold Tsagaankhuu
8a0a7e75c1 Update dts files of Cubieboard1,2 to use 1GB memory.
Whilst there, fix cpu config register address for Cubieboard2.

Approved by: stas (mentor)
2014-01-08 09:33:16 +00:00
Dimitry Andric
4abd7edcbd Split the last gcc-specific flags off into CFLAGS.gcc. This also
removes the need to use -Qunused-arguments for clang throughout the
tree.

MFC after:	3 days
2014-01-05 21:03:49 +00:00
Ian Lepore
8f4fa88900 Enable the cesa security/crypto device by providing the required property
in the dts source, and adding the right devices to the kernel config. Also
generally bring the kernel config into line with what we have for other
Marvell/Kirkwood systems (add lots of useful devices and options).

One particularly notable addition amongst the kernel config changes is
USB_HOST_ALIGN=32, which may help eliminate data corruption on USB drives.

PR:		kern/181975 arm/162159
2014-01-05 20:44:10 +00:00
Ian Lepore
9fa0eb8b8f Update the dockstar DTS to reflect just NAND flash (no SPI NOR flash, and
the LED specification was just misplaced).  The rather odd memory mappings
that were in place used an undocumented attribute value (0x0f) that caused
problems with the system.

Submitted by:	Markus Pfeiffer <markus.pfeiffer@morphism.de>
2014-01-03 18:36:19 +00:00
Xin LI
f4c8ba8370 MFV r259170:
4370 avoid transmitting holes during zfs send

4371 DMU code clean up

illumos/illumos-gate@43466aae47

NOTE: Make sure the boot code is updated if a zpool upgrade is
done on boot zpool.

MFC after:	2 weeks
2014-01-01 00:45:28 +00:00
Dimitry Andric
d5c1aaf2fb For sys/boot/i386 and sys/boot/pc98, separate flags to be passed
directly to the linker (LD_FLAGS) from flags passed indirectly, via the
compiler driver (LDFLAGS).

This is because several Makefiles under sys/boot/i386 and sys/boot/pc98
use ${LD} directly to link, and the normal LDFLAGS value should not be
used in these cases.

MFC after:	3 days
2013-12-30 19:05:50 +00:00
Dimitry Andric
d19f075047 Fix pc98 build, by also forcing COMPILER_TYPE in sys/boot/pc98/boot2's
Makefile.

Pointy hat to:	dim
MFC after:	3 days
X-MFC-With:	r259730
2013-12-26 22:31:47 +00:00
Dimitry Andric
0673132dcb For libstand and sys/boot, split off gcc-only flags into CFLAGS.gcc.
MFC after:	3 days
X-MFC-With:	r259730
2013-12-26 11:32:39 +00:00
Marcel Moolenaar
ad098e2975 Bump the loader version to 3.2 after various dosfs fixes (in particular). 2013-12-19 05:28:43 +00:00
Bjoern A. Zeeb
8b8807f515 Add an FDT DTS and MDROOT kernel configuration for BERI on NetFPGA.
At this point we only support one CPU, the PIC, and a UART console.

Reviewed by:	brooks
Sponsored by:	DARPA, AFRL
MFC after:	5 days
2013-12-12 18:08:31 +00:00
Ganbold Tsagaankhuu
fba7d5d18a Add gpio config for usb1 in dts.
That way it gives power to other usb hub via gpio at boot time.

Reviewed by: stas@
2013-12-09 07:15:46 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
shifts into the sign bit.  Instead use (1U << 31) which gets the
expected result.

This fix is not ideal as it assumes a 32 bit int, but does fix the issue
for most cases.

A similar change was made in OpenBSD.

Discussed with:	-arch, rdivacky
Reviewed by:	cperciva
2013-11-30 22:17:27 +00:00
Ed Maste
ed4c8729a2 Purely cosmetic change: order DT_REL* and DT_RELA* consistently.
From projects/uefi, r246107

Sponsored by:	The FreeBSD Foundation
2013-11-28 19:41:03 +00:00
Luiz Otavio O Souza
c1bc07dada Fix the led 'gpios' definition to match the description on
sys/boot/fdt/dts/bindings-gpio.txt.  Make the led pin an output, add the
missing flag field.  No functional change (gpioled(4) isn’t supported on
FDT systems yet).

Approved by:	adrian (mentor)
2013-11-27 12:12:37 +00:00
Ganbold Tsagaankhuu
a8e50123f0 Add clock frequency for rk3188 watchdog.
Whilst here, replace "clocks" to "clock-frequency".

Approved by: ray@
2013-11-25 11:02:11 +00:00
Andrew Turner
299f9dc1a6 Recent versions of U-Boot require us to also backup and restore r9 for API
calls to work.
2013-11-24 20:33:38 +00:00