9
0
Fork 0
Commit Graph

38 Commits

Author SHA1 Message Date
Sascha Hauer 221d6f5d79 arch: refresh defconfigs
The defconfig files are long untouched and a
make xy_defconfig; make savedefconfig usually generates quite
a different looking file. Refresh them to make it easier to generate
patches against the configs using
make xy_defconfig; make menuconfig; make savedefconfig

This has been done with the following script.

for a in arch/*; do
	arch=$(basename $a)
	for c in $a/configs/*; do
		config=$(basename $c)

	export ARCH=$arch
	make $config && make savedefconfig && mv defconfig $c
	done
done

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-12 08:58:31 +02:00
Sascha Hauer 790980bf18 Make generic default environment type a use choice
So far it was hardcoded for each board if defenv-1 or defenv-2 is used.
Make this a user choice so that a particular board no longer enforces
a defenv type.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-10-10 08:30:36 +02:00
Sascha Hauer 4d85cb974a include: Move bulk of boot.h to bootm.h
The majority of the stuff currently in include/boot.h is about bootm
code implemented common/bootm.c. To be more consistent move it to a
new file include/bootm.h.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-07-26 08:31:31 +02:00
Sascha Hauer 7839011f61 bootm: Move bootm options to common/Kconfig
bootm has a C API, so the bootm options have to depend on the
option providing the bootm code (CONFIG_BOOTM), not on the
option providing the command (CONFIG_CMD_BOOTM). Fixing the
dependencies makes it possible to fully use bootm from C without
enabling the bootm command support.
This also removes the CMD_ prefix from the options which means
we have to update the defconfigs aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-10 14:51:58 +02:00
Sascha Hauer 041155f11c include: Move ns16550 serial platform_data to include/platform_data
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-15 08:44:42 +02:00
Michael Olbrich 2096b4f8a0 efi: let the generic relocate code handle all relocations
Part of the barebox code and variables are put in separate sections
(.barebox* and .initcall*). When this code is compiled as position
independent code then the compiler creates corresponding .rela.barebox* and
.rela.initcall* sections with the relocation table entries.
These sections don't match the .rela.data* wildcard in the linker script.
As a result, they are not added to the .rela section during linking but are
added individually after it instead. And when the EFI binary is created
from the ELF binary, these sections are not copied.
This has two side effects:

1. The corresponding relocations are not handled by the generic relocation
code. 'fixup_tables()' was added to do these relocations manually.

2. In the DYNAMIC section, the RELASZ entry contains the total size of
relocations in bytes. This includes the .rela.barebox* and .rela.initcall*
sections. This value is not modified when the EFI binary is created. So the
value is too large.
The generic relocation code in _relocate() used this value when iterating
over all relocation entries. With the wrong RELASZ value it iterates beyond
the end of the .rela section into uninitialized memory. After power-on this
memory is zero and the relocation code interprets this as 'nothing to do',
so there is no visible effect. After a soft reset, random data in that area
may produce a seemingly valid relocation entry, a random address is
modified and barebox crashes.

This patch adds the .rela.barebox* and .rela.initcall* sections to the
normal .rela section. The RELASZ now contains the correct size and the
generic relocation code works correctly. 'fixup_tables()' must be removed
at the same time to avoid relocating these entries twice.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-04-07 07:29:29 +02:00
Lucas Stach 93b5fca095 efi: fix memory leak in error path
Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-03-04 07:54:58 +01:00
Sascha Hauer 3f0835e074 bootm: Push dryrun to handlers
We can make the dryrun option more useful by calling into the handlers.
With this we can detect more cases that can go wrong during boot.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-26 22:45:36 +01:00
Sascha Hauer 83b0a5ae05 restart: replace reset_cpu with registered restart handlers
This replaces the reset_cpu() function which every SoC or board must
provide with registered handlers. This makes it possible to have multiple
reset functions for boards which have multiple ways to reset the machine.
Also boards which have no way at all to reset the machine no longer
have to provide a dummy reset_cpu() function.

The problem this solves is that some machines have external PMICs or
similar to reset the system which have to be preferred over the
internal SoC reset, because the PMIC can reset not only the SoC but also
the external devices.

To pick the right way to reset a machine each handler has a priority. The
default priority is 100 and all currently existing restart handlers are
registered with this priority. of_get_restart_priority() allows to retrieve
the priority from the device tree which makes it possible for boards to
give certain restart handlers a higher priority in order to use this one
instead of the default one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:03 +02:00
Sascha Hauer ebd6f26412 Merge branch 'for-next/exitcall' 2015-08-06 12:33:06 +02:00
Michael Olbrich 89aef0fb85 efi: enable blspec in the defconfig
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:56 +02:00
Michael Olbrich c95b1c2bf2 efi: use an EFI variable to save the environment
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:20 +02:00
Michael Olbrich 89c142f4ef efi: use xstrdup_* when appropriate
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:19 +02:00
Michael Olbrich b04ec8bfb9 efi: use xasprintf() when appropriate
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:18 +02:00
Michael Olbrich 21a83053ab efi: write volatile EFI variables used by systemd
LoaderTimeInitUSec and LoaderTimeExecUSec are used e.g. in systemd-analyze
to calculate the time spent in the firmare and barebox.

LoaderDevicePartUUID is used to mount the EFI partition to /boot.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:18 +02:00
Michael Olbrich ceb217682c efi: add helper functions to write EFI variables
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:18 +02:00
Michael Olbrich 55da0cf13e efi: add support for initrd loading
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 20:31:44 +02:00
Michael Olbrich 356aaef5a3 efi: improve malloc pool allocation
Use allocate_pages() instead of allocate_pool(). With allocate_pages() we
can specify the address. This way, any address passed to the kernel will
never exceed the lower 32 bit.
If possible, try to allocate a larger pool.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:14 +02:00
Herve Codina a2136e6cbd exitcall: Add exitcall infrastructure
exitcall infrastructure is based on initcall infrastructure.
It allows to have and use exit call hooks on barebox shutdown.

Signed-off-by: Herve Codina <Herve.CODINA@celad.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-13 08:28:19 +02:00
Sascha Hauer 79e3eda09a efi: use generic posix_types.h
Use generic asm-generic/posix_types.h instead of repeating the
typedefs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 09:53:58 +02:00
Sascha Hauer e4daf80881 introduce bitsperlong.h for remaining architectures
This introduces the bitsperlong.h file for the remaining architectures.
It's purpose is to define BITS_PER_LONG which in the next step can be used
by a generic posix_types.h file.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 09:53:56 +02:00
Sascha Hauer 9e7d9a5f2a dma: Use generic place for dma_addr_t typedef
Instead of letting all architectures define their own dma_addr_t use
a common place in include/linux/types.h and use a Kconfig symbol that
architectures can select to define the width of dma_addr_t. The same
is done in the Kernel.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-22 08:00:48 +02:00
Sascha Hauer e0899dfa3b driver: Call remove function only when available
The bus implementations currently call the drivers remove
hook unconditionally, but this hook is seldomly populated. Only call
it when it's actually populated.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-17 07:24:50 +01:00
Masahiro Yamada 78582e53dc kbuild: add KBUILD_DEFCONFIG
This allows "make ARCH=... defconfig".

Fox example, you can type "make defconfig" instead of
"make sandbox_defconfig".

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-14 07:14:35 +01:00
Sascha Hauer ff6383c8e4 Merge branch 'for-next/misc' 2015-01-09 17:38:26 +01:00
Sascha Hauer 2af31fbc23 Merge branch 'for-next/kbuild' 2015-01-09 17:38:26 +01:00
Masahiro Yamada d8753571b2 sizes.h: move include/sizes.h to include/linux/sizes.h
This file originates in Linux.  Linux has it under include/linux/
directory since commit dccd2304cc90.
Let's move it to the same place as well in barebox.

This commit was generated by the following commands:

  find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:'
  git mv include/sizes.h include/linux/

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 14:00:26 +01:00
Masahiro Yamada d6d28acee0 kbuild: move asm-offsets.h rule to ./Kbuild
Currently, MIPS is the only architecture that needs
include/generated/asm-offsets.h, but we have got ./Kbuild file now.

It is a good reason to move asm-offsets.h rule from arch/mips/Makefile
to ./Kbuild and add dummy asm-offsets.c for the other architectures.
asm-offsets.h would be useful for all the architectures.

This commit does not implement include/generated/bounds.h,
but if necessary, it is easy to implement it.

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-08 13:55:38 +01:00
Lucas Stach 23746e7e02 efi: move exit to EFI into own command
Adds a command to drop back into the calling EFI process.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Lucas Stach e4f3215be2 efi: add proper reset hook
This allows to actually reset the system from barebox
instead of dropping back into the EFI firmware.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:09 +01:00
Alexander Shiyan 9a4cb25a39 treewide: Reuse init_clock() return value for clocksource drivers
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-10 08:42:19 +01:00
Michael Olbrich b07e7f3bb8 EFI: report correct block device size
last_block is a zero-based block number, so the total number of blocks is
last_block + 1

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-23 07:31:03 +02:00
Michael Olbrich b376b8d365 efi: use objcopy with CROSS_COMPILE prefix
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-19 09:56:03 +02:00
Michael Olbrich ee3254569d EFI: add missing include
Otherwise building produces these warnings:
[...]
arch/efi/efi/efi-image.c:48:2: warning: implicit declaration of function 'read_file' [-Wimplicit-function-declaration]
arch/efi/efi/efi-image.c:48:6: warning: assignment makes pointer from integer without a cast [enabled by default]
[...]

And bootm fails for x86_64. The implicit declaration has an int as return
value, so half of the returned address is lost.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-03 15:53:22 +02:00
Michael Olbrich 53c443ce72 EFI: fix error handling in efi_get_boot()
efi_get_global_var() returns an error code, not NULL when it fails.

Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-01 14:24:50 +02:00
Sascha Hauer 38c3b2455e Merge branch 'for-next/misc'
Conflicts:
	lib/Makefile
2014-08-07 13:13:31 +02:00
Jean-Christophe PLAGNIOL-VILLARD 9183a8c683 EFI: introduce efi_strguid to convert GUID to human readable names
use in devinfo Protocols

Tested today on qemu with all the GUID translated

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-16 10:46:19 +02:00
Sascha Hauer 1dff7e414d Add initial EFI architecture support
This adds support for running barebox in an EFI environment
on X86 PC hardware.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-16 10:46:18 +02:00