Commit graph

41120 commits

Author SHA1 Message Date
Jukka Rissanen
0829bce640 net: ethernet: mii: Fix the documentation
The doxygen documents must be placed before the symbol in order
them to be shown in the generated documentation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-15 16:39:06 -05:00
Jukka Rissanen
b288a9d4e5 net: Hide internal code from documentation
No need to add internal code into public documentation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-15 16:39:06 -05:00
Jukka Rissanen
479509e04b net: pkt: Add missing documentation for various insert helpers
The data insert helpers net_pkt_insert_*() did not had function
documentation.

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-15 16:39:06 -05:00
Jukka Rissanen
ef7081ee44 net: Fix the function API documentation generation
Make sure that network related functions are always documented.
This means keeping the prototype and possible stub together.

Fixes #12615

Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2019-02-15 16:39:06 -05:00
Daniel Leung
1e7025c2e7 boards: intel_s1000_crb: fix setting cache attributes
This reverts commit c9ace83c89 which
bypasses setting cache attributes.

The previous cache attributes actually set the text/data/etc.
sections to be inaccessible. So fix it.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-15 16:21:50 -05:00
Andrew Boie
5f4683db34 x86: fix ROM permissions
Only the text area now has execute permissions,
instead of both text and rodata.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 13:10:18 -08:00
Marti Bolivar
4a0f1f2817 west: sign.py: usability fixes
Fix some usability issues with this command.

- add help making it clear that either imgtool must be installed, or
  the path to imgtool.py must be provided using --tool-path.

- in case people don't read that, print a helpful message if imgtool
  is not installed and --tool-path is not provided.

- in case the build directory is not properly set up for an MCUboot
  chain-loaded image, make the BuildConfiguration inspection more
  robust, printing out errors using check_force() when values are
  missing.

- mark the --tool option required to print usage and avoid a
  RuntimeError if it is not provided.

- make sure we search for the default build directory before checking
  for its existence, in case it was not provided

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-02-15 21:07:10 +01:00
Marti Bolivar
f13fa537d7 west: fix issue with sign.py
The arguments have to be saved in self.args for check_force's error
path to work.

Signed-off-by: Marti Bolivar <marti@foundries.io>
2019-02-15 21:07:10 +01:00
Sebastian Bøe
1312ca7cc2 kconfig: flash: Move nrf code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nrf options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe
1f27a456cd kconfig: flash: Move mcux code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the mcux options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Sebastian Bøe
ae846dce75 kconfig: flash: Move nios code into it's own file
Cleanup the Kconfig code for the flash driver. Platform-specific
options should be in their own Kconfig files to be consistent and to
not pollute the common configuration.

To this end we move the nios2 options into it's own file.

Signed-off-by: Sebastian Bøe <sebastian.boe@nordicsemi.no>
2019-02-15 14:12:48 -05:00
Wolfgang Puffitsch
3f4a64cd4e tests: bsim_bt: Extend connection test case.
Change connection parameters and channel map after connection is
established. Test encrypted connection also with split stack. Tighten
pass/fail criteria.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch
4464029fb1 tests: bsim_bt: Make peripheral role part of test case.
Make peripheral role part of test case to build it with
split/non-split stack.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Wolfgang Puffitsch
5a49a0aa1f tests: bsim_bt: Replace ad_parse function with bt_data_parse.
Use shared function, aligning with code in central_hr sample.

Signed-off-by: Wolfgang Puffitsch <wopu@oticon.com>
2019-02-15 14:12:27 -05:00
Tomasz Gorochowik
8adf39aae3 scripts: gen_kobject_list: Fix error log call
A trivial bug that caused the following error when this situation
actually happened:

  Too many thread objects (21)
  Traceback (most recent call last):
    File "/zephyr/scripts/gen_kobject_list.py", line 307, in <module>
      main()
    File "/zephyr/scripts/gen_kobject_list.py", line 281, in main
      -(-thread_counter // 8))
  TypeError: write() takes exactly one argument (2 given)

With this commit, the detected error is printed correctly, e.g:

  Too many thread objects (21)
  Increase CONFIG_MAX_THREAD_BYTES to 3

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2019-02-15 10:19:52 -08:00
Kumar Gala
10f2bdfc57 linker: riscv32: Fix .riscv.attributes orphan sections warning
Add similar fix to riscv32 linker scripts that we have on ARM for
.riscv.attributes section.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2019-02-15 12:37:21 -05:00
Mark Ruvald Pedersen
479df56858 bluetooth: controller: Add a few ticker comments
No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-15 09:52:14 -05:00
Mark Ruvald Pedersen
d315dbd67b bluetooth: controller: Commentary in LLL header
No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-15 09:51:54 -05:00
Mark Ruvald Pedersen
e4892abe31 bluetooth: controller: Document more of memq, mfifo
* Slight tweaks to memq comments,
 * Document most of mfifo through commentary.

No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-15 09:49:45 -05:00
Mark Ruvald Pedersen
a61938130b bluetooth: controller: Add comments across ull
* Clarify certain functions and data structures in upper link layer.
 * Disambiguate node rx event done, add commentary.

MFIFO_DEQUEUE macro does string concatenation.
Thus MFIFO_DEQUEUE(done) does not refer to done (the stack local), but
mfifo_done.

No functional change expected.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-15 09:49:34 -05:00
Mark Ruvald Pedersen
9d8a614ed7 bluetooth: controller: Introduce ull_ref_dec for consistency
ull_ref_inc already existed, but not ull_ref_dec.
No functional change expected.
Consistency is preferred due to code navigation.

Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
2019-02-15 09:49:21 -05:00
Andrew Boie
65da531aed x86: fix exception stack pointer reporting
If the faulting context is in user mode, then we are
not on the same stack due to HW-level stack switching
on privilege elevation, and the faulting ESP is on
the stack itself.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 09:48:37 -05:00
Andrew Boie
21337019b0 x86: get oops reason code more robustly
The code did not consider privilege level stack switches.
We have the original stack pointer in the NANO_ESF,
just use that.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 09:48:37 -05:00
Andrew Boie
4ae33f0b55 tests: fatal: refactor and add user mode tests
We weren't testing whether stack overflows in user mode
were correctly reported.

A more aggressive stack overflow logic is enabled if
HW-based stack overflow detection is enabled.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 09:48:37 -05:00
Andrew Boie
747dcbc8f2 x86: improve stack overflow detection
We now have a dedicated function to test whether
a memory region is withing the boundary of the
faulting context's stack buffer.

We use this to determine whether a page or double fault
was due to ESP being outside the bounds of the stack,
as well as when unwinding stack frames to print debug
output.

Fixes two issues:
- Stack overflows in user mode being incorrectly reported
  as just page fault exceptions
- Exceptions that occur when unwinding corrupted stacks

The type of fault which triggered the stack overflow
logic (double or page fault) is now always shown.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-15 09:48:37 -05:00
Rajavardhan Gundi
95e8a582b4 drivers: flash: spi_nor.c: Correct the calculation of SECTORS_COUNT
The patch 44758977f8 made a change where
SECTORS_COUNT was not calculated properly. This patch corrects it.

Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
2019-02-14 22:18:25 -05:00
Daniel Glöckner
26d3576e0f ext: hal: atmel: sam: really fix GMAC priority queues related registers
Commit 0a7b45d55f ("ext: hal: atmel: sam: fix GMAC priority queues
related registers") tried to correct register offsets, but failed to do
so in the structure that is used by our driver to access the registers.

Fixes: #12945

Signed-off-by: Daniel Glöckner <dg@emlix.com>
2019-02-14 22:17:53 -05:00
Carlos Stuart
75f77db432 include: misc: util.h: Rename min/max to MIN/MAX
There are issues using lowercase min and max macros when compiling a C++
application with a third-party toolchain such as GNU ARM Embedded when
using some STL headers i.e. <chrono>.

This is because there are actual C++ functions called min and max
defined in some of the STL headers and these macros interfere with them.
By changing the macros to UPPERCASE, which is consistent with almost all
other pre-processor macros this naming conflict is avoided.

All files that use these macros have been updated.

Signed-off-by: Carlos Stuart <carlosstuart1970@gmail.com>
2019-02-14 22:16:03 -05:00
Aurelien Jarno
413ede4b89 driver: eth: gmac: remove ring_buf usage in the RX path
The ring_buf implementation is basically used as an array of net_buf
pointers in the RX path. The tail and head indexes are taken from the
RX descriptors and not from the ring_buf. That's why for example the
fact that head is never initialized doesn't cause problem. Only len is
used in free_rx_bufs(), but anyway this function is plainly broken as
it always free the first net_buf and doesn't set it back to NULL.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-14 22:15:29 -05:00
Aurelien Jarno
cc1d1478ac driver: eth: gmac: wait until the packet is sent before returning
Scale down the TX path of the GMAC driver by waiting for a packet to be
fully sent before returning from the send function. This has a small
performance impact, but has a few advantages:
- It allows the Ethernet code to modify the packet afterward, fixing PTP
  support on this board (see PR #12563).
- It returns an error to the IP stack in case of a transmit failure.
- It doesn't require net_buf to be thread safe.

This change can be reverted by changing GMAC_MULTIPLE_TX_PACKETS from 0
to 1.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2019-02-14 22:15:29 -05:00
Daniel Leung
1d55411a96 boards/intel_s1000_crb: fix Python string format
Fix the support script to actually use Python string formatting,
instead of C-style printf().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2019-02-14 19:51:45 -05:00
Andrzej Głąbek
41e09725bb boards: nrf: Enable HW PWMs on nrf52832_mdk and nrf52840_mdk
This is a follow-up to commit e2b38e02bf.
Default PWM instances are enabled in Kconfig and DTS (with channel 0
set to LED0 pin) for these boards so that it is possible to build basic
samples blink_led and fade_led for them without extra modifications.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2019-02-14 18:50:00 -06:00
Andy Ross
86380483da kernel/work_q: Fix block-in-spinlock bug
Work queues are implemented in terms of k_queue objects which provide
their own synchronization.  In particular insertion is potentially
blocking and always acts as a reschedule point, which means that it
must not be called with spinlocks held.

Release the lock first, and do a little cleanup of the resulting
k_delayed_work_submit_to_queue() logic.

Fixes #13411

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2019-02-14 19:45:20 -05:00
Marc Herbert
82df254512 doc/getting_started: mention ZEPHYR_TOOLCHAIN_VARIANT=host briefly
Skipping the setup of a toolchain is especially nice for brand new users
who just want to give qemu_x86[_64] or native_posix a quick try, gives a
great first impression.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
2019-02-14 19:43:25 -05:00
Alberto Escolar Piedras
65451db6b9 tracing: POSIX arch: Trace switch to main thread
Add tracing of the switch to the main thread

Relatest to #13357

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-14 15:41:19 -05:00
Alberto Escolar Piedras
eb6534ffa6 tracing: POSIX arch: Remove redundant trace call
The thread switching tracing calls are done by the kernel,
and not by the archs. So, remove the redundant trace call.

Related to #13357

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-14 15:41:19 -05:00
Alberto Escolar Piedras
143552550f tracing: Add missing isr_exit() for posix arch boards
For the native_posix board, and for the nrf52_bsim boards,
the sys_trace_irs_exit() call was missing. Add it.

Relates to #13357

Signed-off-by: Alberto Escolar Piedras <alpi@oticon.com>
2019-02-14 15:41:19 -05:00
Andrew Boie
62d866385e x86: fix crash in _arch_buffer_validate
The code wasn't checking if the memory address to check
corresponded to a non-present page directory pointer
table entry.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
9af5089dee build: remove meltdown warning
Now addressed by KPTI.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
2cfeba8507 x86: implement interrupt stack trampoline
Upon hard/soft irq or exception entry/exit, handle transitions
off or onto the trampoline stack, which is the only stack that
can be used on the kernel side when the shadow page table
is active. We swap page tables when on this stack.

Adjustments to page tables are now as follows:

- Any adjustments for stack memory access now are always done
  to the user page tables

- Any adjustments for memory domains are now always done to
  the user page tables

- With KPTI, resetting a page now clears the present bit

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
eea0f93a83 x86: generate user mode page tables
If kernel page table isolation is enabled, we generate a second
set of page tables. These tables, except for the shared page, have
all non-user pages marked as non-present.

The MMU generation script has been refactored:

- Debugging output has been make significantly simpler and less
  verbose

- Useless globals removed or adjusted

- MMU region list is validated as it is read

- Some tuples unpacked into individual variables to make the
  code easier to read.

- Useless command line option for output binary endian-ness
  remobved

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
f093285345 x86: modify MMU APIs for multiple page tables
Current set of APIs and macros assumed that only one set
of page tables would ever be in use.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
db6acbfb95 x86: set up shared kernel page
KPTI requires that there exist one kernel page marked
'present', because switching between the kernel and the
shadow page tables is not done automatically and certain
other CPU data structures must always be in a present page.

Move IDT, GDT, all TSS to this page, and set up a small
trampoline stack as a safe landing area when doing
privilege level transitions.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Andrew Boie
89a127bc8e x86: add Kconfig for KPTI
This will be enabled by default for any x86 that isn't
noted as being immune to this CPU bug.

Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2019-02-14 12:46:36 -05:00
Ulf Magnusson
732fa65956 scripts/dts: Rename dict_merge() to merge_properties()
It's special-cased for merging bindings and not a general dictionary
merging function.

Also simplify the documentation a bit.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00
Ulf Magnusson
14de997f25 scripts/dts: dict_merge(): Rename dct/merge_dct to to_dict/from_dict
Makes it easier to remember what's being merged into what. "merge_dct"
is ambiguous.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00
Ulf Magnusson
298b4431b9 scripts/dts: Do title/version/description special-casing in dict_merge()
Simpler to do it there than in merge_included_bindings().

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00
Ulf Magnusson
f0eeb11fc0 scripts/dts: Add helper for reporting !include-related errors
Makes the message end up on stderr along with the exception, and removes
some code.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00
Ulf Magnusson
35b3d440c1 scripts/dts: Replace the Bindings class with plain functions
The Bindings class was only used to implement '!include foo.yaml'
(easier to see after some things were moved out of it). Use plain
functions instead, which might be a bit more transparent and gives
simpler code.

Also remove the recursive '!include' detection for now, which is broken
in that the same .yaml being included twice will always trigger it, even
for non-circular cases.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00
Ulf Magnusson
4a99dbcf9e scripts/dts: Simplify and remove dead code in Bindings._extract_file()
As written, this function could take e.g. '!include bar', find 'foo-bar'
(due to the endswith()), and include it. This is undocumented and
doesn't seem to be used, so I'm guessing that it isn't intentional.

Removing that bug/feature also makes the code much simpler.

Signed-off-by: Ulf Magnusson <Ulf.Magnusson@nordicsemi.no>
2019-02-14 10:49:44 -06:00