9
0
Fork 0
Commit Graph

1971 Commits

Author SHA1 Message Date
Sascha Hauer 1b59b573e4 Merge branch 'for-next/rtc' 2016-01-11 13:11:08 +01:00
Sascha Hauer 70ef1cef5c Merge branch 'for-next/pstore' 2016-01-11 13:11:07 +01:00
Sascha Hauer ab96ba298b partition: Create links with partition names
When a partition has a name create a link to the original partition
rather than registering a second cdev.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Sascha Hauer 3cff8948ff state: implement signed int support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Trent Piepho 5e3069f3f9 partitions/efi: Add partuuid to partition description
In commit bc31d85c6e the partition UUID
was added to the partition struct and thence to the cdev(s) for the
partition.  But just for DOS partitions.  Do this for GPT aka EFI
partitions too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Sascha Hauer 6eb5d78419 hwclock command: use format like the Linux tool does
Print three-letter abbreviations of the days and months.

With a fixup by Andrey Smirnov:
| common/date.c: Fix off-by-one error
|
| As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
| 'tm_wday' is zero indexed with zero representing Sunday, this is also
| corroborated by the code in rtc_time_to_tm() which used 4 to represent
| Thursday.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:45:12 +01:00
Zahari Doychev 295a5f8e4b environment: allow saving of symbolic link changes
Currently it is not possible to change symbolic links in the default
environment. For example if the default environment contains the
link "current_boot -> mmc" then the following does not work:

$ rm current_boot
$ ln net current_boot
$ saveenv

After reset the link is still pointing to "mmc" and this error appears:

"symlink: /env/boot/current_boot -> net : error -17"

The patch fixes the above problem and moves the "ENV_FLAG_NO_OVERWRITE"
to enable handling of symbolic links in this case too.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-17 10:48:18 +01:00
Markus Pargmann 160d2ed0ba fs: Add pstore filesystem
pstore is a persistent storage filesystem used for RAMOOPS. It is used
to store console logs, panics, ftrace and other information in case of a
crash/panic/oops/reboot.

pstore is implemented for barebox as a read-only filesystem at the
moment. It may be extended later on. The idea is to provide a way to
extract essential data from the last running kernel.

Most of the code is copied from the kernel. However this is only a
lightweight implementation without real write support yet.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Sascha Hauer 2ae9bbba07 Merge branch 'for-next/state' 2015-12-08 08:29:02 +01:00
Sascha Hauer 9fdf56c8d4 Merge branch 'for-next/omap' 2015-12-08 08:28:41 +01:00
Sascha Hauer 24f1c994cc Merge branch 'for-next/misc' 2015-12-08 08:28:07 +01:00
Sascha Hauer 5e79364a66 Merge branch 'for-next/console' 2015-12-08 08:27:20 +01:00
Sascha Hauer fe68ba4526 Merge branch 'for-next/arm' 2015-12-08 08:27:08 +01:00
Trent Piepho a2b3a25417 ARM: Remove do_execute and thumb2_execute
In commit 104a6a7ccf support was added
for Thumb2.  It added do_execute() as a way to provide arch dependent
calling veneers for use in "go" and thumb2_execute() as the thumb2 to
arm veneer.

But thumb2_execute() isn't necessary as gcc generates a proper calling
sequence from a standard function pointer call.  Thumb2 barebox is
compiled with the AAPCS ABI which requires this.

It also had a bug and didn't pass the arguments properly, but code
execute via "go" rarely uses arguments so this wasn't very noticeable.

Since thumb2 was always the only user of do_execute(), go ahead and
delete that too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-07 10:44:45 +01:00
Sascha Hauer c85ef6a776 Revert "memtest: move error handling to end of function"
While this simplifies the code as is I got the request to continue on
errors in memtest, which can be better implemented when the messages are
printed inline and not at the end of the function.

This reverts commit 4ff9e28abc.
2015-12-04 08:01:59 +01:00
Antony Pavlov cf0dd1196b environment: support env on at24 eeprom
unprotect(), erase() and protect() return EOPNOTSUPP errno code
for at24 I2C eeproms, so envfs_save() doesn't store data
to these eeproms without this patch.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-01 09:59:05 +01:00
Marc Kleine-Budde 34cda8c231 state: backend_raw: add hmac support
This patch adds hmac support to the raw backend.

With this patch, modifications of the header or data of a state partition can
be detected, as the hmac woudln't match anymore. The hmac relies on a shared
secret, which is requested from the keystore, with keystore_get_secret() using
the name of the state partition as the "name" of the secret.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:43 +01:00
Marc Kleine-Budde bf3cb63799 state: prepare raw backend for hmac support
This patch cleans up the raw backend, so that adding hmac support in the next
patch is easier.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Enrico Jorns 446f3d07dd state: disable load command
Explicitly loading environment is not required as it will be loaded if
available during device probing

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Peter Mamonov bc87f4399c common: filetype: do not redetect MBR-type devices as a FAT-type
Deleted pieces of code detect MBR-containig device as a FAT-type device,
if it's first partition contains a FAT filesystem. This behaviour enabled one
to mount the FAT FS which is either directly on the device (disk0) or on
the first partition (disk0.0) using the same command:
    mount /dev/disk0 /fat
However, the desired behaviour can be reached with a:
    mount /dev/disk0 /fat || mount /dev/disk0.0 /fat || echo "Mounting failed"

Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 08:24:56 +01:00
Jan Remmet 2936579c60 state: make type check error verbose
Wrong type let state probe fail with ENOENT.

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 07:52:38 +01:00
Jan Remmet 39c858ede8 bootm: get file type before bootm_open_os_uimage
Using a  multi uimage stored in nand didn't work. Only one open for the
bb file is allowed. The file type detection after bootm_open_os_uimage
will fail. bootm_open_initrd_uimage and bootm_open_oftree_uimage already
check if they can reuse data->os.

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-20 08:35:18 +01:00
Jan Remmet 5ec644e7d8 bootm: cleanup bootm_open_oftree
Separate oftree file and uimage oftree handling.
Make fie_type checks in bootm_boot

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-20 08:35:18 +01:00
Sascha Hauer 749f337e60 console: Set baudrate during registration
This makes sure that the cdev->baudrate field is always consistent with
the hardware state.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 12:03:47 +01:00
Sascha Hauer 1d9295b344 Merge branch 'for-next/misc' 2015-11-06 16:10:42 +01:00
Sascha Hauer 3cdd30342b Merge branch 'for-next/memtest' 2015-11-06 16:10:37 +01:00
Sascha Hauer 664ca39628 hush: Add missing initialize_context() in some places
Before a context can be used it must be initialized. This was forgotten
in several places. Add the missing calls to initialize_context().
This fixes crashes when sourcing empty files

Reported-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@kiwigrid.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-05 07:56:51 +01:00
Sascha Hauer 8f2549abb7 memtest: By default only test biggest region
Often enough the biggest free region spans most free RAM, so
it doesn't add much value to test the remaining free regions. This
patch changes the default behaviour to only test the biggest free
region and adds the -t option to test all regions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:43 +01:00
Sascha Hauer 4ff9e28abc memtest: move error handling to end of function
Move error handling out of the test code to make the actual test
better visible.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:42 +01:00
Sascha Hauer 8f130c738e memtest: move ctrlc check / progress showing into separate function
To make the actual test a bit better visible in the code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:04 +01:00
Sascha Hauer b9f9eef722 memtest: Make comments single line when appropriate
Make the comments single line when they fit into a single line
to make the code a bit shorter.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:47 +01:00
Sascha Hauer 680a6a9616 memtest: Make output more compact
Especially when called multiple times the output of the memory test
is quite verbose. Make it more compact by only describing once what
is being done and only use one progress bare instead of three.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:47 +01:00
Sascha Hauer e96b1713ea memtest: split tests in separate functions
The memtest does a bus integrity check and a moving inversions test.
Split the tests into two separate functions so that the can be called
separately.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:47 +01:00
Sascha Hauer b792124a7d rework remap_range
remap_range is for remapping regions with different cache attributes.
It is implemented for ARM and PowerPC only, the other architectures only
provide stubs.
Currently the new cache attributes are passed in an architecture specific
way and the attributes have to be retrieved by calls to
mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags().
Make this simpler by providing architecture independent flags which can
be directly passed to remap_range()
Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function.
The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture
has as default. the arch_can_remap() function returns true if the
architecture can change the cache attributes, false otherwise. This
allows the memtest code to better find out what it has to do.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:44 +01:00
Sergey Koshechkin e5b9918329 login: make some locally used functions static
This patch continues cleanup password code from

  commit 40596b856f
  Author: Sascha Hauer <s.hauer@pengutronix.de>
  Date:   Thu Aug 27 15:58:50 2015 +0200

      login: cleanup password code

Signed-off-by: Sergey Koshechkin <tritel59@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-02 07:59:13 +01:00
Sascha Hauer 6b127d4f18 memtest: move request/release regions to common/
Normally code providing a feature should be implemented in common/ which
is then called from the command code. Follow this rule and move some more
of the memtest code to common/.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-27 08:22:45 +01:00
Sascha Hauer e4216c80ac common/Makefile: Add missing dependency
imd-barebox.o needs include/generated/compile.h. Add the dependency.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-16 19:25:03 +02:00
Sascha Hauer 77073ab24d filetype: Use cdev_open
a cdev has to be opened before usage. Use cdev_open instead of
cdev_by_name.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 08:56:23 +02:00
Andrey Smirnov 04d8c2541d common/parser.c: Do not treat zero return code as error
Run_command() would return zero to indicated success so treating it as
error case would completely break command repetition logic, so change
comparinson operator from "less or equal" to "less then"

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 08:56:21 +02:00
Andrey Smirnov 822ad01d5d common/parser.c: Do not conflate error reporting disciplines
Run_command() uses 0 to indicate success and negative values to
indicate errors, whereas execute_command() uses 0 for success and
positive integers to represent error codes. Conflating the two breaks
the code that calls run_command and then checks for error code sign to
detect problems, so avoid that by doing a very simple transformation
on the result of execute_command

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 08:56:21 +02:00
Andrey Smirnov 69f3f7b353 common/command.c: Replace magic number with appropriate constant
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 08:56:21 +02:00
Sascha Hauer 54bf386650 Merge branch 'for-next/usb' 2015-10-07 08:23:51 +02:00
Sascha Hauer dd4da6d328 Merge branch 'for-next/omap' 2015-10-07 08:23:45 +02:00
Sascha Hauer c8fa7eed66 Merge branch 'for-next/misc' 2015-10-07 08:23:45 +02:00
Vicente Bergas e89f1a1f18 detect_fs: use device instead of file
detect_fs would usually mount a device on a directory,
so, use a device-specific type detection.

Signed-off-by: Vicente Bergas <vicencb@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-02 09:10:16 +02:00
Peter Mamonov 8165f3131c common: clock: introduce mdelay_non_interruptible()
Signed-off-by: Peter Mamonov <pmamonov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-02 07:50:51 +02:00
Sascha Hauer e94d1eb5d3 state: check return value of of_property_count_strings
When a enum32 state variable node does not have a "names" property bail
out instead of continuing with an error value used as number of strings.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-29 09:07:48 +02:00
Sascha Hauer 2a34749fca state: write names in enum32 variables to oftree again
Commit 179b75a (state: fixup: only export default value during
fixup if set) accidently removed writing the enum32 value names
to the device tree. Add it back again

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
2015-09-29 09:07:40 +02:00
Sascha Hauer b62aea5611 of_fix_tree: do not fail when fixup fails
When a device tree fixup fails it is worth printing a warning, but
we should not fail booting.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-24 08:00:39 +02:00
Sascha Hauer 4a79ca7d62 of_fix_tree: warn instead of fail when a fixup fails
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 17:14:46 +02:00
Sascha Hauer 7e44c8495a introduce strerrorp
putting an error pointer into strerror can be a bit confusing since
strerror takes a positive error code but PTR_ERR returns a negative
number, so we have to do strerror(-PTR_ERR(errp)). Some places got
this wrong already, so introduce a strerrorp function which directly
takes an error pointer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-23 17:12:44 +02:00
Lucas Stach 342891feed passwd: avoid NULL ptr usage
Fixes
common/password.c: In function 'check_passwd':
common/password.c:292:4: warning: reading through null pointer (argument 3)
    pr_err("No such digest: %s\n", PASSWD_SUM);

if no algo is enabled in which case PASSWD_SUM is defined to NULL.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-14 07:59:11 +02:00
Sascha Hauer bf62a6e2d8 of_fix_tree: Print error message
When a of_fixup handler fails add a meaningful error message so
that the user gets a clue what might have gone wrong.

Suggested-by: Enrico Joerns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-08 15:48:44 +02:00
Masahiro Yamada 2548c100bb console: use int rather than uint in printf() and friends
These functions and vsprintf() return int type.
No reason to use uint type.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-07 07:24:32 +02:00
Sascha Hauer 67e0a30e77 Merge branch 'for-next/restart' 2015-09-01 09:43:55 +02:00
Sascha Hauer ce36b4a05e reset-source: Add some debugging aids
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:35:51 +02:00
Sascha Hauer 460cc82191 login: explain PASSWORD_DEFAULT option
This option looks like it takes the default password, but instead
it takes a filename of a file which contains the password encoded
with the selected password digest.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer 2b5bdb47cf crypto: fix selecting of digests
SHA1 is meant as a boolean option which is true when sha1 support is available.
This works because the providers (DIGEST_SHA1_GENERIC and DIGEST_SHA1_ARM) have
a 'select SHA1'. However, consumers like the sha1sum command do a 'select SHA1'
to enable SHA1 support. This of course does not work; selecting SHA1 will not
select any of the SHA1 providers.

This is broken for all digest consumers. We have to explicitly select a digest
provider, that is DIGEST_*_GENERIC to enable the corresponding digest.

This means now we will always have the generic digest in the binary, even
when an optimized one is enabled. There is no sane way in Kconfig to
"select provider for feature xy", so let's live with the overhead in the binary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer 3e361f3764 login: check return value of digest_alloc
digest_alloc can fail, check the return value.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer 40596b856f login: cleanup password code
- make some locally used functions static
- remove read_passwd which is unused
- some refactoring to make code pathes clearer

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer 90e766a78f login: rework login mechanism
We used to have the login functionality in the /env/bin/init script.
This is hard to review and it's too easy to break the login functionality
with changes to this script. Move the places to ask for a password to
C code where we have only a few places where we have to ask for a password.
Mainly these are run_shell() and the menutree command.

This patch introduces a login() function which will only return if the correct
password has been entered. Following calls will return immediately without
asking for a password again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:27 +02:00
Sascha Hauer 4a7534bf07 reset-source: Allow different priorities
Different devices may report the reset source with different levels
of certainty. For example a SoC may see a power-on reset, but this
may only be because an external PMIC has power cycled the SoC. This
means the PMIC knows the real reason better and thus the reset reason
from the PMIC should be preferred.

This patch introduces priorities for the reset_source to handle the
above scenario. Also add a of_get_reset_source_priority() function
to retrieve the desired priority from the device tree.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 07:18:14 +02:00
Sascha Hauer ff2a4a0a13 reset-source: Use globalvar_add_simple_enum
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:07 +02: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 3086fd8bb4 completion: fix device parameter completion
With device parameter completion the '.' separator between the device
name and the parameter was not handled correctly. For example with
a device named global a completion starting with "g." was completed to
"g.obal.". fix this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-07 09:20:39 +02:00
Sascha Hauer fd58dc84cb Merge branch 'for-next/spd' 2015-08-06 12:33:24 +02:00
Sascha Hauer 4ee01d2b46 Merge branch 'for-next/misc' 2015-08-06 12:33:15 +02:00
Sascha Hauer a8525f691d Merge branch 'for-next/imx' 2015-08-06 12:33:06 +02:00
Sascha Hauer ebd6f26412 Merge branch 'for-next/exitcall' 2015-08-06 12:33:06 +02:00
Jan Luebbe 077f9b7ef3 state: fix missing newline in error message
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-03 10:37:06 +02:00
Jan Luebbe bf25de649d state: handle write-protection in the raw backend
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-03 10:37:06 +02:00
Sascha Hauer ca8a4b0ff5 PBL: console: Make independent of DEBUG_LL
With more stuff being done in PBL regular console support gets more and more
useful. This makes the PBL console independent of DEBUG_LL which is only
meant for early debugging but not regular output.
To use the regular PBL console a board must call pbl_set_putc() which stores
a pointer to the putc function to be used.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-31 08:49:42 +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 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 be2edd99c0 efi: add helper to get the GPT partition UUID for a device
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-27 07:23:17 +02:00
Sascha Hauer efeeea3501 drop <stddef.h> includes
The compilers stddef.h should not be included. We declare all types
ourselves.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 16:46:04 +02:00
Sascha Hauer 789203ffe1 console: When deactivating a console, flush it first
Otherwise the last characters may not be sent before deactivating
a console.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-23 15:24:29 +02:00
Sascha Hauer 07cbd9db14 memsize: Compile for PBL aswell
Detecting the memory size is a domain for PBL, so compile it for PBL
aswell.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-16 09:46:01 +02:00
Alexander Smirnov f75fe31095 ddr_spd: add routine for printing DDR2 SPD contents in human-readable format
---=== SPD EEPROM Information ===---
EEPROM Checksum of bytes 0-62                    OK (0xDF)
Total number of bytes in EEPROM                  256
Fundamental Memory type                          DDR2 SDRAM
SPD Revision                                     1.2

---=== Memory Characteristics ===---
Maximum module speed                             800 MHz (PC2-6400)
Size                                             2048 MB
Banks x Rows x Columns x Bits                    8 x 14 x 10 x 64
Ranks                                            2
SDRAM Device Width                               8 bits
Module Height                                    30.0 mm
Module Type                                      SO-DIMM (67.6 mm)
DRAM Package                                     Planar
Voltage Interface Level                          SSTL 1.8V
Module Configuration Type                        No Parity
Refresh Rate                                     Reduced (7.8 us) - Self Refresh
Supported Burst Lengths                          4, 8
Supported CAS Latencies (tCL)                    6T
tCL-tRCD-tRP-tRAS                                6-6-6-18 as DDR2-800
Minimum Cycle Time                               2.5 ns at CAS 6
Maximum Access Time                              0.40 ns at CAS 6
Maximum Cycle Time (tCK max)                     8 ns

---=== Timing Parameters ===---
Address/Command Setup Time Before Clock (tIS)    0.17 ns
Address/Command Hold Time After Clock (tIH)      0.25 ns
Data Input Setup Time Before Strobe (tDS)        0.05 ns
Data Input Hold Time After Strobe (tDH)          0.12 ns
Minimum Row Precharge Delay (tRP)                15.00 ns
Minimum Row Active to Row Active Delay (tRRD)    7.50 ns
Minimum RAS# to CAS# Delay (tRCD)                15.00 ns
Minimum RAS# Pulse Width (tRAS)                  45.00 ns
Write Recovery Time (tWR)                        15.00 ns
Minimum Write to Read CMD Delay (tWTR)           7.50 ns
Minimum Read to Pre-charge CMD Delay (tRTP)      7.50 ns
Minimum Active to Auto-refresh Delay (tRC)       60.00 ns
Minimum Recovery Delay (tRFC)                    127 ns
Maximum DQS to DQ Skew (tDQSQ)                   0.20 ns
Maximum Read Data Hold Skew (tQHS)               0.30 ns

---=== Manufacturing Information ===---
Manufacturer JEDEC ID                            7f 98 00 00 00 00 00 00
Manufacturing Location Code                      0x05
Part Number
Manufacturing Date                               2014-W47
Assembly Serial Number                           0x43266892

Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-14 07:09:19 +02:00
Herve Codina 0fd5944d52 exitcall: move board_shutdown to exitcall infrastructure
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
Herve Codina 74438aa4dc exitcall: move arch_shutdown to exitcall infrastructure
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
Herve Codina a59a48b684 exitcall: move device_shutdown to exitcall infrastructure
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
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
Alexander Smirnov c5e4c38f19 common: move DDR_SPD to common/Kconfig
This patch makes it possible to use ddr_spd-related
routines in any arch not only in ppc.

Signed-off-by: Alexander Smirnov <alllecs@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-06 13:33:09 +02:00
Sascha Hauer d297851b1a Merge branch 'for-next/blspec' 2015-07-06 12:43:29 +02:00
Sascha Hauer 735c570e5a Merge branch 'for-next/state' 2015-07-03 08:38:20 +02:00
Sascha Hauer 7b4e61bbf9 Merge branch 'for-next/mtd'
Conflicts:
	drivers/mtd/core.c
2015-07-03 08:37:52 +02:00
Sascha Hauer f2a2894c27 Merge branch 'for-next/misc' 2015-07-03 08:37:40 +02:00
Sascha Hauer c5438404db Merge branch 'for-next/imx-bbu-nand-fcb'
Conflicts:
	common/Kconfig
2015-07-03 08:37:36 +02:00
Sascha Hauer 907418af60 Merge branch 'for-next/blspec' 2015-07-03 08:37:29 +02:00
Antony Pavlov 177cab00ce treewide: fix 'new blank line at EOF' formatting error
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-02 09:39:58 +02:00
Sascha Hauer 74ac4489cf bbu: Add a standard file-to-device-copy handler
The most standard update handler will simply copy a file to a device.
This can be shared across several users, so add a standard handler for
this operation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-07-01 09:04:22 +02:00
Wadim Egorov 438dcfdb76 images: Add file size check for PBLX files
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:56:24 +02:00
Marc Kleine-Budde 179b75aaca state: fixup: only export default value during fixup if set
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:12:42 +02:00
Marc Kleine-Budde 9116aba49a state: add support for fixed length strings
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 11:12:42 +02:00
Sascha Hauer 292c9e655a blspec: Use device_detect_by_name
device_detect_by_name will automatically separate by colons now,
we no longer have to do this in the blspec code.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-26 09:21:36 +02:00
Marc Kleine-Budde 69cec37e2c state: struct variable_type::import: remove const from node argument
This patch removes the const qualifier of the node argument from struct
variable_type::import. This is a preparation patch to support fixed strings in
state.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 10:58:58 +02:00
Sascha Hauer 716fdbf18c blspec: Automatically append rootarg
This patch makes it possible to automatically add a suitable root= option
for booting Linux from the same filesystem on which the bootspec entry
has been found. This adds an additional 'linux-appendroot' option to
bootspec which if set to 'true' will cause barebox to automatically
add a root= option. This currently works for NFS, UBIFS and regular
block devices like ATA, SD/MMC using the root=PARTUUID= mechanism.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer bc31d85c6e cdev: Add partuuid string to struct cdev
This adds the partuuid string to struct cdev in order to have this
available for constructing a suitable Linux root=PARTUUID= option
for booting Linux.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-18 09:01:01 +02:00
Sascha Hauer 5e55dec814 blspec: Automatically attach UBI devices
When blspec_scan_cdev finds an UBI device then attach it. This
allows us to boot blspec entries found on the UBIFS images inside
UBI volumes by pointing to the corresponding mtd partition.
With this we can do 'boot nand0.root' or even 'boot=nand0' on the
commandline.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-17 11:39:46 +02:00
Marc Kleine-Budde 23c1e105b5 state: uint8: add range check for uint8
Bail out, if the user tries to set a value > 255.

Cc: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-17 07:52:16 +02:00
Marc Kleine-Budde 45204ebce7 state: uint8: use %u as format string
Cc: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-17 07:52:16 +02:00
Sascha Hauer 6ab66787fc imx-bbu-nand-fcb: Split space for firmware in two equal regions
We used to write the second firmware right after the first
firmware. However, splitting the available space into two
equal regions has advantages: When we update barebox the next
time the generated FCB/DBBT blocks will be the same as with the
last update, so in case of power failure it is more likely that
we have valid data in one of the FCB/DBBT areas.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:29:48 +02:00
Sascha Hauer 4e880df347 imx-bbu-nand-fcb: Erase whole partition
Now that we use a partition for the bootloader instead of
the whole NAND device we can erase it completely instead of
hardcoded 2MB.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:29:48 +02:00
Sascha Hauer c3400f3d64 imx-bbu-nand-fcb: Let DBBT start at page 1
We used to put the FCB in the first two NAND blocks and the DBBT
in the third and fourth block. It's much more space efficient to
put the FCB and DBBT together into the same eraseblock in different
pages. This way we can store four FCBs and four DBBTs instead of
two only.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:29:48 +02:00
Sascha Hauer 22f8077c39 imx-bbu-nand-fcb: make available for i.MX28 aswell
The code can be used with slight modifications on i.MX28 aswell.
Add a i.MX28 registration function and move the differences to
function callbacks.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:26 +02:00
Sascha Hauer 103b88ace1 imx-bbu-nand-fcb: Use barebox partition instead of whole device
We used to use nand0 device for storing barebox and made the assumption
that there is enough space at the beginning of the first device. Instead,
use the barebox partition directly. This requires that the partition
where barebox should be stored is named 'barebox', that is the case for
all boards currently.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer 92a5a43ac7 imx-bbu-nand-fcb: Fix debug messages
We should print the block number before increasing it, not afterwards.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer a10366acd8 ARM: i.MX6: bbu nand: Move to common place
The code can be used on i.MX28 aswell, so move it to a common place.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer e7b23c6a9d filetype: Add filetype for MXS bootstream
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-12 08:28:04 +02:00
Sascha Hauer e349701487 Merge branch 'for-next/state' 2015-06-09 09:26:44 +02:00
Sascha Hauer 03510ac4fa Merge branch 'for-next/posix_types' 2015-06-09 09:26:44 +02:00
Sascha Hauer 7a429bfb3b Merge branch 'for-next/misc' 2015-06-09 09:26:44 +02:00
Sascha Hauer 65aa032d11 Merge branch 'for-next/memtest' 2015-06-09 09:26:43 +02:00
Sascha Hauer 0c3bb48db9 Merge branch 'for-next/mem64' 2015-06-09 09:26:43 +02:00
Sascha Hauer d036dd5a66 Merge branch 'for-next/console' 2015-06-09 09:26:43 +02:00
Sascha Hauer 3310d58a60 console: When switching baudrate print console name
Since there may be multiple consoles print the name of the console
whose baudrate shall be switched.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 09:22:13 +02:00
Sascha Hauer e53e7218ad console: Add console_get_by_name
Commands like loadx/loady wish to find a console device by its name. Add
a function for this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 09:22:13 +02:00
Sascha Hauer 56b2fe72e8 console: Add functions to get/set baudrate
So C code can call a function rather than fiddling with device parameters.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 09:22:13 +02:00
Sascha Hauer 4cfc09da38 console: Add functions to get/set active state of console
Currently code needs to fiddle with the active parameter of a console
device directly to enable/disable consoles. Add console_set_active()
to set the status and console_get_active() to get the current status.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-09 08:12:33 +02:00
Jan Luebbe 2532f5dfbf state: add support for uint8 variables
Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 10:20:55 +02:00
Jan Luebbe d0d929927c state: add some more error messages
This helps with finding out why the state cannot be loaded correctly.

Signed-off-by: Jan Luebbe <jluebbe@debian.org>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-06-03 10:20:15 +02:00
Sascha Hauer 5878154ba8 memory_display: Add 64bit support
Add support for showing hexdumps in 64bit width.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-28 12:29:49 +02:00
Sascha Hauer ccd8dd48cd memory_display: Use consistent types
memory_display uses three different types for 32bit variables, three
types for 16bit variables and three types for 8bit variables. Clean up
this mess and use one type per variable width.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-28 12:29:49 +02:00
Wadim Egorov f6c5578eaf bootsource: Add NET bootsource
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-27 08:56:07 +02:00
Marc Kleine-Budde 5a71e981fd state: backend_raw: update documentation of struct state_backend_raw members
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 51b0b010be state: backend_raw: add sanity check of data_len during load
The length of the data must fit into the remaining available space until the
next copy of the data.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde ab1f4aa928 state: backend_raw: rename backend_raw_write_one() -> backend_raw_save_one()
Use a consistent naming scheme: backend_raw_save_one() is called from
backend_raw_save().

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde a44ccc57da state: backend_raw: factor out state_backend_raw_file_get_size() into separate function
This patch factors out the state_backend_raw_file_get_size() into a separate
function and adds some ifdefs to make this code work under Linux aswell.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 8fba554f88 state: backend_raw: properly align write and erase size
This patch makes it easier to share the code with linux, on Linux the ease and
write size have to be aligned. Use stride (which is already aligned to erase
block size) during erase, align size_full to writesize and use it while
writing.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 20fc5623a3 state: backend_raw: rename struct state_backend_raw::step -> stride
This patch renames the member "step" of the struct state_backend_raw to
"stride" and tries to clarifies its meaning.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 7ea826343b state: backend_raw: remove hard coded limit of two copies
Although there is the define RAW_BACKEND_COPIES, the state_backend_raw_save()
function silently assumes exactly two copies. This patch removes that assumtion
by looping over all copies, but saving the one we're read from at the end.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 23846b7301 state: mtd_get_meminfo: make usage of mtd's meminfo compatible to linux
This patch makes it possible to share the code with linux.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde 0dadc9d82b state: mtd_get_meminfo: open path readonly instead of readwrite
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:33:18 +02:00
Marc Kleine-Budde acfe5a4fec state: add fixup to copy state from barebox to kernel device tree
This patch registers a DT fixup, that copies the state nodes from the active
to the kernel DT. The backend reference will be a phandles.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-26 14:21:48 +02:00
Sascha Hauer e617c9b821 tlsf malloc: enable 64bit support on 64bit architectures
On 64bit architectures TLSF_64BIT should be defined. Decide that
depending on the CONFIG_64BIT symbol. When 64bit support is enabled
all allocations will be aligned to 8 byte boundaries which is necessary
for architectures that do not support unaligned accesses or have
a performance penalty for unaligned accesses.
Also changes the undefined tlsf_decl to 'static'.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-22 09:40:31 +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
Uwe Kleine-König 145e65ab12 of: add a function to remove an of_fixup
This function is needed when a device that already registered a fixup in
the probe routine fails later to probe completely. Without unregistering
the fixup the function might later be called with invalid data.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-18 08:06:35 +02:00
Andrey Smirnov f09e7cfb8f common/memtest.c: Distil common error reporting code
Move all of the common code for error message output into a new
function mem_test_report_failure() and convert the rest of the code to
use it.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:16:14 +02:00
Andrey Smirnov 6a69d233bd common/memtest.c: Refactor mem_test() into three surbroutines
Original mem_test() was rather long an contained code to perform two
distinct operations. This patch moves that code into two separate
subroutines and converts mem_test into a high level interface that
calls the subroutines.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:16:14 +02:00
Andrey Smirnov 6ebc8c603a common/memtest.c: Do not omit offset of 0 from tests
Ommiting offset 0 from address line tests allows certain corner cases
of faults to be undetected.

For the "stuck high" case, consider scenario in which all of the
tested address lines are stuck high. In original code first data
filling loop would execute writing data to a single cell multiple
times and second loop would just read data from that cell over and
over again. Adding a write to start[0] should prevent this since it
would cause the second loop to read incorrect data on its first
iteration.

For the "stuck low" case, having any of the tested bits of the address
shorted would effectively "remap" that memory cell to start[0] in this
case excluding start[0] during the verification phase would result in
a false positive result.

Note that both of the changes are present in Michael Barr's code here:
http://www.esacademy.com/en/library/technical-articles-and-documents/miscellaneous/software-based-memory-testing.html

and the code in barebox is based on that code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:16:14 +02:00
Andrey Smirnov 8c15d05054 common/memtest.c: Fix incorrect array boundary check
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:16:14 +02:00
Marc Kleine-Budde 65a8f2f8f1 state: backend: support phandle and of_path references
This patch improves the backend property, it can be either a phandle or a
of_path. During probe() of the state driver the backend property is
dereferenced and the resulting of_path is saved in the state context. In a
later patch it will be used to generate a phandle reference to the backend
during DT fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:03:49 +02:00
Marc Kleine-Budde 74840ebe98 state: add functionality to export state description
This patch adds the functionality to export the description of the state, but
not the contents of the variables to a DT node. This will be used in a later
patch to "copy" the state description to the kernel device tree during DT
fixup.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:49 +02:00
Marc Kleine-Budde 0f56f0c5a1 state: make state_release() non static
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:49 +02:00
Marc Kleine-Budde 142afe0e30 state: print proper error message, if reg property is not found
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:49 +02:00
Marc Kleine-Budde 47056c8cd0 state: print name of property of size mismatch is detected
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:49 +02:00
Sascha Hauer c82d18f0f6 console: use regular malloc for log messages
Using xfunctions to allocate log messages is not a good idea. Should
we be out of memory the xfunctions will panic which will cause another
allocation, so we deadlock the system with no message going out.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:42 +02:00
Sascha Hauer 041b2bd31f startup: introduce postenvironment_initcall
To allow init code that depends on the environment being loaded.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:42 +02:00
Marc Kleine-Budde 880fe656f8 state: state_new_from_fdt(): remove unused function
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:25 +02:00
Marc Kleine-Budde b5e65942e5 state: state_uint32_create: use %u to print unsigned variable
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-15 07:01:20 +02:00
Sascha Hauer 6d4afd96fc setenv: Be more informative when device parameter setting fails
When setting a device parameter fails not only the error code
is of interest, but also what the parameter name is, what the
device name is and whether a device was found for this name.
Add this information to the error message.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-05-04 09:27:35 +02:00
Marc Kleine-Budde 1aa3dbfc1a timeout: factor out wait-for-key-press loop into separate file
This patch factors out the wait-for-key-press loop from the shell command
"timeout" into a sparate file, so that it can be used from C, too.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-23 08:12:28 +02:00
Sascha Hauer ee0035e5cc Merge branch 'for-next/state' 2015-04-13 12:57:14 +02:00
Sascha Hauer 909dbe5334 Merge branch 'for-next/crypto' 2015-04-13 12:57:12 +02:00
Antony Pavlov d2dea77829 make PBL_CONSOLE depend on PBL_IMAGE
PBL_CONSOLE option is used only for building PBL. See this output:

    barebox$ git grep PBL_CONSOLE
    arch/arm/configs/tx28stk5_defconfig:CONFIG_PBL_CONSOLE=y
    common/Kconfig:config PBL_CONSOLE
    common/Makefile:pbl-$(CONFIG_PBL_CONSOLE)       += memory_display.o
    include/printk.h:       (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
    include/stdio.h:        (defined(__PBL__) && defined(CONFIG_PBL_CONSOLE))
    lib/Makefile:pbl-$(CONFIG_PBL_CONSOLE) += vsprintf.o
    pbl/Makefile:pbl-$(CONFIG_PBL_CONSOLE) += console.o

PBL_CONSOLE looks confusing in PBL-less configuration
so it's better to enable it only if PBL is enabled.

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-04-13 10:17:22 +02:00
Jean-Christophe PLAGNIOL-VILLARD e49a47fba8 password: add pbkdf2 support
We will use random 32 bytes salt and 10000 round to generate a
32 bytes key.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-20 11:45:55 +01:00
Jean-Christophe PLAGNIOL-VILLARD 9f15b42105 command: allow runtime usage
This will allow as example to list the currently supported digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-19 07:46:22 +01:00
Sascha Hauer 1487e6b9ad state: add framework for persistent state handling
This patch adds a framework to describe, access, store and restore a set of
variables. A state variable set can be fully described in a devicetree node.
This node could be part of the regular devicetree blob or it could be an extra
devicetree solely for the state. The state variable set contains variables of
different types and a place to store the variable set.

For more information see:
    Documentation/devicetree/bindings/barebox/barebox,state.rst

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 08:28:31 +01:00
Jean-Christophe PLAGNIOL-VILLARD 3a43692412 password: add support for sha512
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 27b2336029 digest: make it multi-instance
Now you need to call digest_alloc and when you finish to use it digest_free.

We need this for upcomming aes encryption support and secure boot
as we will need multiple instance of the same digest.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 804fae5d16 digest: introduce digest_{init/update/final/length}
This will allow to move from a one at a time digest to a multi-instance
with too much impact on the code using it

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Jean-Christophe PLAGNIOL-VILLARD 1ac61317c6 digest: move digest.c to crypto
with not the rest of the implementation

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-12 07:58:24 +01:00
Lucas Stach 444e04ff90 pbl: let pbl-console depend on !CONSOLE_NONE
It doesn't make much sense to have a console in the pbl
but not in the main barebox binary.

Fixes:
pbl/console.c:34:5: error: redefinition of 'ctrlc'
include/stdio.h:60:19: note: previous definition of 'ctrlc' was here

pbl/console.c:39:6: error: redefinition of 'console_putc'
include/stdio.h:49:20: note: previous definition of 'console_putc' was here

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-11 09:36:25 +01:00
Sascha Hauer fa20ea45e0 Merge branch 'for-next/tegra' 2015-03-09 08:32:26 +01:00
Sascha Hauer ac81a0d876 Merge branch 'for-next/misc' 2015-03-09 08:30:24 +01:00
Sascha Hauer 22e42ca3fc Merge branch 'for-next/arm' 2015-03-09 08:30:24 +01:00
Sascha Hauer ea2153ce86 Merge branch 'for-next/am335x' 2015-03-06 08:33:20 +01:00
Marc Kleine-Budde 7033089ddf environment: envfs_{load, save}: add possibility to call with filename and dirname == NULL
This patch moves fallback to default into the envfs_{load,save} functions.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-06 07:43:49 +01:00
Lucas Stach 21294b0516 bbu: make bbu confirm a bit more verbose
It is a lot more user friendly if we give a bit more feedback.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:34:08 +01:00
Sascha Hauer e2290aef31 console: Make locally used function static
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-04 11:32:59 +01:00
Wadim Egorov c918022532 reset_source: Add external reset
Some SoCs have special device pins for external reset signals.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:54:13 +01:00
Sascha Hauer e7e39180ad reset_source: make safe to call earlier
reset_source_init used to set the reset source to unknown in a
coredevice_initcall. This means if reset_source_set() has been called
earlier the value would have been overwritten. Fix this by calling
globalvar_add_simple() each time reset_source_set() is called.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:54:13 +01:00
Lucas Stach 43f133f68b menu: depend on !CONFIG_SHELL_NONE
It doesn't make much sense to have the menuframework but no
shell.

Fixes:
In function `menu_action_command': undefined reference to `run_command'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-03-02 07:35:39 +01:00
Jan Luebbe d8a6e1c266 ARM/mem: handle data aborts gracefully for md
Sometimes memory ranges contain inaccessible registers which trigger a
data abort when accessed. To handle this gracefully, we extend the data
abort exception handler to ignore the exception when configured to do
so.

This allows detecting inaccessible memory from the md command. It will
show XX for unreadable bytes instead.

The previous behaviour:
barebox@TI AM335x BeagleBone:/ md 0x50000000
unable to handle paging request at address 0x500000ac
pc : [<8fe2e0dc>]    lr : [<8fe2e0b9>]
sp : 8ffff898  ip : 00000024  fp : 00000000
r10: 8bfa0204  r9 : 00000000  r8 : 8bfa0204
r7 : 00000100  r6 : 50000000  r5 : 8bfa0204  r4 : 00000004
r3 : 00000f00  r2 : 000000ac  r1 : 00000004  r0 : 00000014
Flags: nZCv  IRQs off  FIQs on  Mode SVC_32
[<8fe2e0dc>] (memcpy_sz+0x40/0x48) from [<8fe2f337>] (mem_read+0x3b/0x48)
[<8fe2f337>] (mem_read+0x3b/0x48) from [<8fe2bb13>] (cdev_read+0x25/0x2e)
[<8fe2bb13>] (cdev_read+0x25/0x2e) from [<8fe2c15b>] (devfs_read+0x1b/0x1e)
[<8fe2c15b>] (devfs_read+0x1b/0x1e) from [<8fe2df5b>] (__read+0x43/0x5c)
[<8fe2df5b>] (__read+0x43/0x5c) from [<8fe2e61f>] (read+0x2b/0x48)
[<8fe2e61f>] (read+0x2b/0x48) from [<8fe1e4a5>] (do_mem_md+0xc1/0x144)
[<8fe1e4a5>] (do_mem_md+0xc1/0x144) from [<8fe02889>] (execute_command+0x21/0x48)
[<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634)
[<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05b43>] (parse_stream_outer+0xdb/0x174)
[<8fe05b43>] (parse_stream_outer+0xdb/0x174) from [<8fe06435>] (run_shell+0x29/0x54)
[<8fe06435>] (run_shell+0x29/0x54) from [<8fe02889>] (execute_command+0x21/0x48)
[<8fe02889>] (execute_command+0x21/0x48) from [<8fe061c1>] (run_list_real+0x549/0x634)
[<8fe061c1>] (run_list_real+0x549/0x634) from [<8fe05efb>] (run_list_real+0x283/0x634)

[<8fe31e1d>] (unwind_backtrace+0x1/0x64) from [<8fe24e61>] (panic+0x1d/0x34)
[<8fe24e61>] (panic+0x1d/0x34) from [<8fe322c1>] (do_exception+0xd/0x10)
[<8fe322c1>] (do_exception+0xd/0x10) from [<8fe32329>] (do_data_abort+0x21/0x2c)
[<8fe32329>] (do_data_abort+0x21/0x2c) from [<8fe31fe8>] (data_abort+0x48/0x60)

The new behaviour:
barebox@TI AM335x BeagleBone:/ md 0x50000000
50000000: 00000060 00000000 00000000 00000000                `...............
50000010: 00000000 00000001 00000000 00000000                ................
50000020: 00000000 00000000 00000000 00000000                ................
50000030: 00000000 00000000 00000000 00000000                ................
50000040: 00001ff0 400000ac 00000211 00000000                .......@........
50000050: 00000a00 00000001 00000000 00000000                ................
50000060: 00000000 00101001 22060514 10057016                ...........".p..
50000070: 010f1111 8f070000 00000f40 00000000                ........@.......
50000080: 00000000 00000000 00000000 00000000                ................
50000090: 00001000 00101001 22060514 10057016                ...........".p..
500000a0: 010f1111 8f070000 00000f00 XXXXXXXX                ................
500000b0: XXXXXXXX XXXXXXXX 00000000 00000000                ................
500000c0: 00001000 00101001 22060514 10057016                ...........".p..
500000d0: 010f1111 8f070000 00000f00 XXXXXXXX                ................
500000e0: XXXXXXXX XXXXXXXX 00000000 00000000                ................
500000f0: 00001000 00101001 22060514 10057016                ...........".p..

The current implementation breaks everything except ARM and takes several
shortcuts which need to be implemented more cleanly. Suggestions are very
welcome!

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-27 13:17:31 +01:00
Sascha Hauer 61fc21c197 environment: Do not remove base env directory
When removing empty directories do not remove the base
directory.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-19 22:15:18 +01:00
Hubert Feurstein f52cf03aad common/bootargs: add blkdevparts variables
The kernel command line option blkdevparts works like mtdparts, but for all
block devices. So it can be used for eMMC devices without the need of a
traditional partition table.

Signed-off-by: Hubert Feurstein <h.feurstein@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-17 08:46:36 +01:00
Andrey Panov 2464c7f7d7 ARM: Rockchip: Add DEBUG_LL based on mach-socfpga
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-13 07:21:56 +01:00
Lucas Stach b2e8ce4b76 imd: provide dummy imd_command_setenv
If CONFIG_CMD_IMD is not set there is no imd_command_setenv in the
barebox binary that can be linked to. Although the whole imd infrastructure
will be removed by the linker later in the build process as soon as it
figures out that nothing inside barebox is using it, we still have to
provide a dummy function to keep the build going.

Fixes:
In function `imd_command': undefined reference to `imd_command_setenv'

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-12 10:58:08 +01:00
Sascha Hauer 6f88d51efd blspec: put blspec bootargs into a .dyn bootargs variable
So that they get deleted later when something else is booted.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-02-10 09:55:43 +01:00
Sascha Hauer 7b0f932bcd Merge branch 'for-next/mxs' 2015-02-04 19:09:15 +01:00
Sascha Hauer ce961e3412 Merge branch 'for-next/misc' 2015-02-04 19:09:15 +01:00
Wadim Egorov f0f6a7477b Fix spelling: pathes -> paths
Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 10:02:56 +01:00
Sascha Hauer 7e22de9c3c pbl: Add support for memory_display
The PBL has console support now, so add memory_display support aswell
which can be a good debugging aid.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-28 08:18:44 +01:00
Lucas Stach 0914ad88d2 common: console_console: put functions under correct ifdef
So they aren't build when no console support is selected.

Fixes:
In function `console_get_by_dev': undefined reference to `console_list'

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-19 08:47:13 +01:00
Jean-Christophe PLAGNIOL-VILLARD a1a582f4e0 console: allow to specify the device id
so we can use dynamic number id with specific devname

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-13 08:48:59 +01:00
Sascha Hauer b396f38596 Merge branch 'for-next/netconsole' 2015-01-09 17:38:27 +01:00
Sascha Hauer 39c6c3480a Merge branch 'for-next/mxs' 2015-01-09 17:38:26 +01:00
Sascha Hauer ff6383c8e4 Merge branch 'for-next/misc' 2015-01-09 17:38:26 +01:00
Sascha Hauer cc843dadfd Merge branch 'for-next/efi' 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
Sascha Hauer ab989e4588 console: Make sure xzalloc is only used when it's available
To make it possible to call the pr_* functions very early before
malloc is initialized test if malloc is available before using
it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer 663b895e49 malloc: Add a function to detect if malloc pool is already initialized
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer a9d7b3d00e Add PBL console support
This adds simple console support to the PBL which makes it
possible to print more complex messages in the PBL than just
strings or hex numbers. For now puts_ll is used to print the
messages, so it depends on CONFIG_DEBUG_LL which makes it
more a debugging option. However, this could be extended later
to get regular output from the PBL if desired.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:59 +01:00
Sascha Hauer ce5299b0bf printf: move panic() to common/misc.c
panic() is not really a printf like function, so move it to common/misc.c.
This is done because we want to have printf support in the PBL, but PBL
has it's own panic() implementation.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-01-05 11:30:58 +01:00
Sascha Hauer 2e1a6c9bce console: Add set_active callback
The netconsole needs to be able to deny activation when the network
has not been enabled. Add an optional callback to the console for
this.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-17 15:08:04 +01:00
Antony Pavlov fbb3be3845 clock: incorporate dummy clocksource into core clock code
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-17 12:15:11 +01:00
Sascha Hauer 631be8e6cb blspec: print error when devicetree not found
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-16 14:29:23 +01:00
Lucas Stach 75889a2900 efi: mount efivarfs by default if enabled
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-12-09 09:59:10 +01:00
Lucas Stach da94ff1e37 efi: add function to determine type of device path
Thanks to the wonders of UEFI we have to walk down the
device path all the way until we arrive at the device
we got this path from...

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
Sascha Hauer b01bc4c810 Merge branch 'for-next/randconfig-1' 2014-12-08 14:54:11 +01:00
Sascha Hauer 3eade89c75 Merge branch 'for-next/persistent-vars'
Conflicts:
	arch/arm/boards/efika-mx-smartbook/defaultenv-efikasb/config
2014-12-08 14:54:09 +01:00
Sascha Hauer c2b5a7015b Merge branch 'for-next/misc' 2014-12-08 14:53:59 +01:00
Sascha Hauer ffc25a1195 Kconfig: make BROKEN invisible
BROKEN is a developer option to keep things in the tree we know
are broken. Make this option invisible so that randconfig builds do
not enable it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:27 +01:00
Sascha Hauer c559baa9e9 ARM: Let MMU depend on !CPU_ARM946E
CPU_ARM946E is selected by boards, so letting it depend on !MMU
leads to broken dependencies. Let MMU depend on !CPU_ARM946E instead.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-28 15:21:26 +01:00
Lucas Stach 3127a942b7 blspec: depend on, not select flexible bootargs
Blspec is a consumer of the flexible bootargs mechanism, so it should
depend on it rather than select it.

Fixes:
warning: (BLSPEC && DEFAULT_ENVIRONMENT_GENERIC_NEW) selects FLEXIBLE_BOOTARGS
which has unmet direct dependencies (COMMAND_SUPPORT && CMD_GLOBAL)

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-26 19:21:09 +01:00
Lucas Stach ceac6c7e14 common: menu needs PROCESS_ESCAPE_SEQUENCE
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:10 +01:00
Lucas Stach 79f2b8a7c9 common: firmware: include libfile
Fixes
common/firmware.c:206:2: error: implicit declaration of function 'copy_file'
in a number of configuration where this file isn't pulled in through
other headers.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-24 14:04:08 +01:00
Andrey Smirnov 84dc21e185 partitions/efi: Fix off-by-one error in 'last_lba'
LBAs are numbered starting from zero so the last LBA # would be equal
to total number of blocks minus one.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-11 15:02:23 +01:00
Lucas Stach 34828e0077 blspec: fix incompatible pointer type warning
The warning is correct in that we pass in size_t instead
of int. As we are not interested in the size of the
property at this point, just remove the assignment.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-07 08:00:29 +01:00
Sascha Hauer 7962e7a0b4 defaultenv-2: Make use of nonvolatile variables
This moves the variable assignments previously done in /env/config-board
to non volatile variables in /env/nv/. This makes the settings adjustable
by the user without editing a file.

Most of the changes are simple conversions which for many boards makes
/env/config-board unnecessary. Some boards had some logic to assign
global.boot.default based on the current bootsource. This has been
moved to /env/init/bootsource. An additional check is added to not
overwrite a nv.boot.default should it exist.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 12:23:12 +01:00
Sascha Hauer 32e879f0a3 globalvar: Add support for printing all global variables
This could previously only be done with 'devinfo global'. While
this is still possible this adds a more direct access via the
globalvar command. This variant also adds a '*' in front of
the variable if the corresponding non volatile variable exists.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 12:23:12 +01:00
Sascha Hauer 3249006a2f Add support for non volatile variables
This adds (back) support for non volatile variables. Non volatile
variables are variables which are stored in the environment over
reboot. They are used in the same way as the global variables, but
with a 'nv' command and device. The variables are stored under
/env/nv/, one variable per file. Adding a nv variable automatically
adds a global variable with the same name. Changing a nv variable
also changes the same global variable, but not the other way round.
This allows for example to configure the username as:

nv user=sha; saveenv

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer 70e718baa1 environment: Only save changes to the defaultenv
Instead of storing the complete files with a 'saveenv' command
only store the files that have changes to the default environment.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer eb3ef18c8c environment: refactor saveenv
Collect all files in a list first and iterate over the list
when creating the actual environment image. Makes the next
patches easier.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-06 10:58:54 +01:00
Sascha Hauer f9ced5832c environment: remove unused variable
fd is unused, remove it.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-05 17:10:54 +01:00
Sascha Hauer 4729b4ba09 environment: drop unnecessary casts
No Need to cast void pointers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-05 17:10:54 +01:00
Sascha Hauer 592d35a47c Merge branch 'for-next/xz' 2014-11-05 15:47:39 +01:00
Sascha Hauer 7b4cc54579 Merge branch 'for-next/tegra' 2014-11-05 15:47:39 +01:00
Zahari Doychev f95ce0fff0 common: fix mbr filetype detection
Sometimes mbr is erroneously recocognised as FAT partion. Due to this the mbr
partition parser is not being called and the partitions on the media are not
detected. This patch should  fix the problem. The checking is done as in the
linux kernel.

I have seen the problem using usb sticks. Although partitioning and formatting
them under linux. The file system type field in the mbr remains there which
causes the wrong detections as FAT32 type and not as mbr.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-05 14:53:28 +01:00
Sascha Hauer ccb2816477 Add xz decompression support
This adds xz decompression support from the kernel. Both compressing
the barebox binary with xz and decompressing xz files on the commandline
is supported.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 12:18:55 +01:00
Lucas Stach f63a42a999 reset_source: add thermal reset
Some SoCs are able to detect if they got reset
in response to an overtemperature event.

Signed-off-by: Lucas Stach <dev@lynxeye.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-11-04 12:16:20 +01:00
Sascha Hauer 2f81d316d2 filetype: Add XZ filetype support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-24 07:51:14 +02:00
Sascha Hauer ade0583602 param: let dev_add_param return the newly created param
dev_add_param creates a new parameter so it makes more sense to
return it than to return an error code. Since the return value
is hardly ever checked this is only a small patch.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 16:33:34 +02:00
Antony Pavlov d096cafff7 clock.c: fix whitespaces
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-10-08 11:12:54 +02:00
Sascha Hauer fa93e4fb60 Merge branch 'for-next/resource-err-ptr' 2014-10-02 08:54:42 +02:00
Sascha Hauer d0064495d3 Merge branch 'for-next/firmware' 2014-10-02 08:54:41 +02:00
Sascha Hauer 930ce6e142 Introduce message logging support
This adds a buffer for log messages and a 'dmesg' command to
print the messages. The log buffer is implemented as log objects
rather than a string buffer. This makes it easy to implement
limiting the messages, cleaning the buffer and timestamping
the messages.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 15:33:22 +02:00
Sascha Hauer 6ae9a40c79 startup: Don't print multiple lines with pr_info
Print the banner with pr_info, but the empty lines before and after
it with printf. This makes the banner show up in the log show up
properly.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 10:44:16 +02:00
Sascha Hauer 8af0569b7b clock: make get_time_ns() safe to be called without clocksource
make it possible to call get_time_ns() before the clocksource
has been registered. Just return 0 in this case which is still
better than crashing the system.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 10:44:15 +02:00
Sascha Hauer 96cae61eba clock: Add a variable with the first timestamp after startup
For measuring the startup time it's useful to save the first
timestamp after the clocksource has been registered.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-30 10:44:15 +02:00
Sascha Hauer d5a82eb095 resource: Let request_ioport_region return an error pointer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:10 +02:00
Sascha Hauer dde56d42ad resource: Let request_iomem_region return an error pointer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:09 +02:00
Sascha Hauer 82ed205466 resource: Let __request_region return an error pointer
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-16 08:32:09 +02:00
Juergen Beisert a6982e2e26 Add a Firmware programming framework
This framework handles a list of registered Firmware programming handlers
to unify a firmware programming interface by hiding the details how
to program a specific Firmware in its handler. This is created with FPGAs
in mind but should be usable for other devices aswell.
A user has two possibilities to load a firmware. A device file is create
under /dev/ which can be used to copy a firmware to. Additionally a
firmwareload command is introduced which can list the registered firmware
handlers and also to upload a firmware.

Signed-off-by: Juergen Beisert <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-09-09 10:30:25 +02:00
Sascha Hauer 7782c08047 Merge branch 'for-next/usb-gadget'
Conflicts:
	commands/Makefile
	common/Kconfig
	common/Makefile
	drivers/usb/gadget/dfu.c
2014-08-07 20:34:28 +02:00
Sascha Hauer 38c3b2455e Merge branch 'for-next/misc'
Conflicts:
	lib/Makefile
2014-08-07 13:13:31 +02:00
Sascha Hauer 5b7b7ee5d9 Merge branch 'for-next/metadata'
Conflicts:
	arch/arm/dts/Makefile
	common/Makefile
	lib/Makefile
2014-08-07 06:15:16 +02:00
Sascha Hauer 50d10b224e Merge branch 'for-next/env' 2014-08-07 06:14:58 +02:00
Sascha Hauer 8a11a59b37 Merge branch 'for-next/efi'
Conflicts:
	.gitignore
	Makefile
	drivers/serial/Makefile
2014-08-07 06:14:56 +02:00
Sascha Hauer 90118343e4 Merge branch 'for-next/console' 2014-08-07 06:14:18 +02:00
Sascha Hauer 97e81f2d78 Add support for metadata in barebox images
It's often useful to get some information about a barebox image
before starting or flashing it. This patch introduces barebox
Image MetaData (IMD). When enabled a barebox image will contain
a list of tags containing the desired information. We have tags
for:

- the barebox release (2014.07.0-00160-g035de50-dirty)
- the build timestamp (#741 Mon Jul 28 15:08:54 CEST 2014)
- the board model the image is intended for
- the device tree toplevel compatible property

Also there is an additional generic key-value store which stores
parameters for which no dedicated tag exists. In this patch it
is used for the memory size an image supports.

Since there is no fixed offset in a barebox image which can be
used for storing the information, the metadata is stored somewhere
in the image and found by iterating over the image. This works
for most image types, but obviously not for SoC images which are
encoded or encrypted in some way.

There is a 'imd' tool compiled from the same sources for barebox,
for the compile host and for the target, so the metadata information
is available whereever needed.

For device tree boards the model and of_compatible tags are automatically
generated.

Example output of the imd tool for a Phytec phyFLEX image:

build: #889 Wed Jul 30 16:08:54 CEST 2014
release: 2014.07.0-00167-g6b2070d-dirty
parameter: memsize=1024
of_compatible: phytec,imx6x-pbab01 phytec,imx6dl-pfla02 fsl,imx6dl
model: Phytec phyFLEX-i.MX6 Duallite Carrier-Board

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-07 06:13:52 +02:00
Sascha Hauer 3cfa4bc00c move file helper functions to separate file
We have our file helper functions in several places. Move them
all to lib/libfile.c.
With this we no longer have file helpers in fs/fs.c which contains
the core fs functions and no functions in lib/libbb.c which are
not from busybox.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-07 06:13:51 +02:00
Sascha Hauer ca22ccd7cd Revert "common: resource: print conflicts as warning"
On several i.MX boards we register SDRAM with the values
from the SDRAM controller and also with values from the
device tree. This now issues a warning each time the board
is started. Revert the commit for now.

A better solution might be to check if the same SDRAM region
already exists before trying to register it again.

This reverts commit c9e2e08edc.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-04 21:00:57 +02:00
Juergen Borleis 72ce27f8e0 envfs: change API to be able to forward special flags into the envfs superblock
In order to be able to mark an stored envfs image with special features
(intentional ignore for example), we now can feed forward these flags.
By forwarding a '0' for the flags nothing changes because the envfs superblock
was already allocated with xzalloc.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-01 08:24:00 +02:00
Juergen Borleis c4c7b16588 envfs: provide an intentional way to ignore an existing external environment
Add a simple flag to envfs to be able to mark an external environment as
"not to be used".
This change should not affect existing systems, because the current envfs
implementation ensures the 'flags' member in the envfs master block is always
zeroed.

Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-08-01 08:24:00 +02:00
Wadim Egorov 6414f69910 barebox: common: Add missing filetype description
Added missing filetype description for UBIFS.

Signed-off-by: Wadim Egorov <w.egorov@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-24 11:34:51 +02:00
Holger Schurig b3265685f7 sandbox: allow "make ARCH=sandbox allyesconfig"
Compiling the tree with allyesconfig is helpful because different
compilers (gcc, clang) or static checkers (e.g. clang's scan-build)
can then process and check more code.

This patch introduces two new configuration symbols that Kconfig files
can depend on. That way, code that is only working where a cache or DMA
implementation exists can be opted out.

Signed-off-by: Holger Schurig <holgerschurig@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-22 21:29:57 +02:00
Holger Schurig 3549cc582c sandbox: disable bareboxcrc32 in sandbox mode
It won't compile currently anyway.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-22 21:29:57 +02:00
Sascha Hauer 0bd652f62a Add release string
Currently we only have version_string which contains information
about the date the binary was compiled and by whom it has been
compiled. This adds a release_string which only contains the
plain release version.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-07-22 08:11:58 +02:00