Commit graph

7985 commits

Author SHA1 Message Date
Daniel Leung
41e97c6393 x86: pin timer related get functions
Both arch_k_cycle_get_32() and z_tsc_read() are marked inline.
However, compiler may decide not to inline them which would put
them in the generic text section. Pin them in physical memory
as they are frequently used functions to avoid page fault costs.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
90ddb35d44 x86: x86-32: pin static inline syscall invoke functions
Although they are marked as an inline functions, the compiler
may decide not to inline them which would result in them being
outside the pinned text section. Since these functions are
required for userspace to work correctly, pin them in physical
memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
7ad00b9e47 kernel: syscall: pin generated inline functions
Although they are marked as an inline functions, the compiler
may decide not to inline them which would result in them being
outside the pinned text section. Since these functions are
required for userspace to work correctly, pin them in physical
memory. This also applies to k_is_user_context().

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
2117a2a44b kernel: app_smem: allowing pinning memory partitions
This allows memory partitions to be put into the pinned
section so they are available during boot. For example,
the stack guard (in libc partition) is needed during boot
but before the paging mechanism is initialized. Without
pinning it in physical memory, it would fault in early
boot process.

A new cmake property app_smem,pinned_partitions is
introduced so that additional partitions can be pinned
if needed.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
97f2192195 kernel: macro to define pinned kernel thread stacks
This introduces two new macros K_THREAD_PINNED_STACK_DEFINE()
and K_THREAD_PINNED_STACK_ARRAY_DEFINE() to define thread
stack and thread stack array in pinned section.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
54c4525094 device: give device state variables a linker section
This groups the device state variables in their own linker section.
This is needed for demand paging as these variables are needed
during boot where the paging mechanism has not been initialized.
These variables need to be in the pinned section so they can
be accessed during boot.

Note that if device PM is not enabled, the device state variables
are put into BSS. So we need to pin these.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
e6f168c1bc kernel: each mem slab buffer has its own section attribute
This attaches a unique section attribute for each mem slab
buffer defined with K_MEM_SLAB_DEFINE(). This allows them
to be placed as needed via linker scripts. This is useful
for demand paging as developers can choose which memory
slab buffer is pinned in memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
d92d1f162a kernel: each kheap buffer has its own section attribute
This attaches a unique section attribute for each kheap
buffer defined with K_HEAP_DEFINE(). This allows them
to be placed as needed via linker scripts. This is useful
for demand paging as developers can choose which can be
pinned in memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
99290f7fef linker: allow symbols to be in a named __noinit section
This adds a new __noinit_named() macro which can be used to
attach named section attributes for symbols. The original
__noinit creates a section attribute with source file name
and a sequential counter. This simply replaces the counter
with the supplied name. This is useful for demand paging
as developers can choose which symbols is pinned memory.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Daniel Leung
dc1f4b2715 linker: helper functions to test if pointer/region is pinned
This adds two helper functions to test if a pointer or a region
resides in the pinned region.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-26 21:16:22 -04:00
Ramiro Merello
afe9ee9376 json: cleanup extra line in between macro/function parameters
New line between each parameter which hinders reading of source code

Signed-off-by: Ramiro Merello <rmerello@itba.edu.ar>
2021-08-26 17:11:13 -05:00
Emil Gydesen
4bd326d6c9 Bluetooth: ISO: Remove use of conn->channels for ISO
The channels list were originally meant to be used
for multiple bt_iso_chan per iso connect (bt_conn), but
that is not the case for the current API, and won't be
going forward, so the use of the list has been removed.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 13:14:22 -04:00
Yuval Peress
ab6e724ab4 emul: espi: Add ACPI Shared Memory functions
Add the bare minimum to set and access the ACPI shared memory via the
eSPI emulator.

Signed-off-by: Yuval Peress <peress@chromium.org>
2021-08-26 13:14:05 -04:00
Gerard Marull-Paretas
e17e0c7b64 devicetree: delete deprecated header
Delete the "generated_dts_board.h" file which was renamed to
devicetree.h a long time ago and was kept for compatibility.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-08-26 12:24:33 -04:00
Danny Oerndrup
94202f3ed7 toolchain: cmake: Off-tree toolchains gets other.h included if selected
To ensure that an off-tree toolchain gets the toolchain/other.h header
included, such that it can include the correct header for the
toolchain via the other.h, the define __TOOLCHAIN_CUSTOM__ will be set
when ever the cmake flag TOOLCHAIN_USE_CUSTOM is set.
An off-tree toolchain needs to set the set(TOOLCHAIN_USE_CUSTOM 1) in
the off-tree generic.cmake and/or target.cmake, in order for the
include/other.h to be included. The generic.cmake and target.cmake will
be under ${TOOLCHAIN_ROOT}/cmake/toolchain/${ZEPHYR_TOOLCHAIN_VARIANT}/

As the TOOLCHAIN_USE_CUSTOM is only set for off-tree toolchains, this
has no impact on in-tree toolchains and their functionality.

Fixes zephyrproject-rtos#36117

Signed-off-by: Danny Oerndrup <daor@demant.com>
2021-08-26 09:28:19 -04:00
Emil Gydesen
51f2022f7b Bluetooth: Audio: Add initial server values in bt_vcs_register_param
Add support for setting initial values in bt_vcs_register_param
when registering a VCS service

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-26 09:13:58 -04:00
Sigvart Hovland
bcbc53015d dfu: boot: Add implementation for multi-image swap type check
Adds multi-image implementations for checking swap type based on image
index.

Signed-off-by: Sigvart Hovland <sigvart.hovland@nordicsemi.no>
2021-08-26 09:13:13 -04:00
Dominik Ermel
8e970554ae include/fs: Remove definitions of ssize_t and off_t
The sys/types.h definitions of ssize_t and off_t will be used.

Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
2021-08-26 06:53:28 -04:00
Flavio Ceolin
3c0e7ade99 tracing: Add k_work_queue_init info
Add tracing information for k_work_queue_init

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 22:07:04 -04:00
Flavio Ceolin
c42cde5b69 kernel: work_q: Fix k_work_queue_start documentation
Inform that the queue has to be initialized in zeroed memory or with
the k_work_queue_init before use.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 22:07:04 -04:00
Flavio Ceolin
d9aa414831 kernel: work_q: Add an init function
k_work_queue_start receives a struct that is expected to be
uninitialized (zeroed). Otherwise the behavior is undefined.

Following the Zephyr semantics, this pr introduce a new init function
for this struct.

Fixes #36865

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-25 22:07:04 -04:00
Jordan Yates
b01e41ccdd device: supported devices visitor API
Adds an API to query and visit supported devices. Follows the example
set by the required devices API.

Implements #37793.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 19:43:54 -04:00
Jordan Yates
0c6588ff47 device: iterable supported devices
Add supported device information to the device `handles` array. This
enables API's to iterate over supported devices for power management
purposes.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 19:43:54 -04:00
Jordan Yates
ec331c6fe2 device: simplify structure of handles array
Force the inclusion of a `DEVICE_HANDLE_SEP` at the end of the
devicetree dependency section of the array. This lets us simplify the
implementation of `device_required_handles_get`, as there is only one
symbol the section ends with.

This does not use any extra ROM as the array is padded out to the
original size with `DEVICE_HANDLE_ENDS` anyway.

Also adds a description of the array format where the array is
instantiated.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 19:43:54 -04:00
Jordan Yates
b5c4140afb device: optimize handles array
Optimize the handles array by making the following observations:
 * The devicetree ordinal at index 0 in pass1 is discarded by
   gen_handles.py, and therefore does not appear in the pass2 array.
 * gen_handles.py does not need `DEVICE_HANDLE_ENDS` to determine the
   end of the handle array, as that information is present in the .elf.

Therefore, instead of replacing the devicetree ordinal with an
additional `DEVICE_HANDLE_ENDS` at the end (to preserve lengths), we
can simply move the ordinal to the end and have it be the original
`DEVICE_HANDLE_ENDS` symbol. This reduces the size of the array by
one handle per device (2 bytes).

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 19:43:54 -04:00
Jordan Yates
1660386f11 device: whitespace cleanup
Remove double spaces after full stops in doxygen comments.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 19:43:54 -04:00
Martí Bolívar
36c73da2f5 dt-bindings: b91-pinctrl: use new DT pinctrl accessors
Update to use the new APIs.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Martí Bolívar
f4115423fa devicetree: add devicetree/pinctrl.h
This contains accessor macros for getting phandles out of pinctrl
properties by name and index. As usual, the representation in C for a
phandle is a node identifier.

Add these new macros:

- DT_PINCTRL_BY_IDX(node_id, pc_idx, idx): phandle at index idx
  in the pinctrl-<pc_idx> property

- DT_PINCTRL_0(node_id, idx): pinctrl-0 convenience for the same

- DT_PINCTRL_BY_NAME(node_id, name, idx): phandle at index idx
  in the pinctrl property named 'name'

- DT_PINCTRL_NAME_TO_IDX(node_id, name): convert a pinctrl property
  name to its index number

- DT_NUM_PINCTRLS_BY_IDX(node_id, pc_idx): number of phandles in
  pinctrl-<pc_idx>

- DT_NUM_PINCTRLS_BY_NAME(node_id, name): number of phandles in a
  named pinctrl property

- DT_NUM_PINCTRL_STATES(node_id): total number of pinctrl-<pc_idx>
  properties

- DT_PINCTRL_HAS_IDX(node_id, pc_idx): does pinctrl-<pc_idx> exist?

- DT_PINCTRL_HAS_NAME(node_id, name): does a named pinctrl property
  exist?

- DT_PINCTRL_IDX_TO_NAME_TOKEN(node_id, pc_idx): convert a pinctrl
  index to its name as a token, similar to DT_STRING_TOKEN()

- DT_PINCTRL_IDX_TO_NAME_UPPER_TOKEN(node_id, pc_idx): like
  DT_PINCTRL_IDX_TO_NAME_TOKEN, but with an uppercase result

As well as DT_DRV_INST equivalents, which take inst wherever node_id
appears above:

- DT_INST_PINCTRL_BY_IDX()
- DT_INST_PINCTRL_0()
- DT_INST_PINCTRL_BY_NAME()
- DT_INST_PINCTRL_NAME_TO_IDX()
- DT_INST_NUM_PINCTRLS_BY_IDX()
- DT_INST_NUM_PINCTRLS_BY_NAME()
- DT_INST_NUM_PINCTRL_STATES()
- DT_INST_PINCTRL_HAS_IDX()
- DT_INST_PINCTRL_HAS_NAME()
- DT_INST_PINCTRL_IDX_TO_NAME_TOKEN()
- DT_INST_PINCTRL_IDX_TO_NAME_UPPER_TOKEN()

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-25 18:09:00 -04:00
Jordan Yates
b2dc1fc9fb linker: arm: move IDT_LIST region
Move the IDT_LIST memory region to the location recommended by
`intlist.ld`. The documentation specifies that this region should not
overlap other regions, and there is no guarantee that the area after the
`SRAM` region is not used. The end of the address space is much less
likely to be a valid RAM address.

Signed-off-by: Jordan Yates <jordan.yates@data61.csiro.au>
2021-08-25 18:08:36 -04:00
Emil Gydesen
a6fa3fb3aa Bluetooth: host: Define recommended per adv constants
These constants are based on (i.e. exactly as) the
recommended values for regular (i.e. non-periodic)
advertising.

The GAP spec does not actually specifiy these numbers (or any
numbers for periodic advertising), but they are sane
numbers to use for periodic advertisement.

The issue with using the non-periodic advertising
whereas the peridic advertising unit is 1.25ms.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-25 18:07:00 -04:00
Emil Gydesen
96dfad0eef Bluetooth: host: Add ISO support for num_completed_packets event
Change so that num_completed_packets event handling is also
enabled for broadcast ISO only builds. This is because sending
data on a broadcast ISO still generates this event.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-25 18:06:09 -04:00
Toby Firth
893bfc0fc1 drivers: counter: added ctimer driver for lpcexpresso55s69
Added shim driver for the CTIMERs for the lpcexpresso55s69 board.

Fixes: #22705

Signed-off-by: Toby Firth <tobyjfirth@gmail.com>
2021-08-24 17:13:22 -04:00
Emil Gydesen
c47dae8c6d Bluetooth: ISO: Update connected ISO API
Update the connected ISO API to be more
similar to the broadcast ISO API as well
as the HCI spec.

This updated API allows for more flexibility
and will better support scenarios such as true
wireless setup, as ISO channels and connections
are more independent now.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2021-08-24 07:29:11 -04:00
Erwan Gouriou
7406ad8553 dts/bindings: Add binding for STM32WL HSE Clock
STM32WL features a specific HSE clock with dedicated properties.
Add a dedicated binding and update STM32 clock control driver
header to take it into account.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-08-24 07:19:12 -04:00
Michał Barnaś
5a1fcb609c doc: replace courge with corge
Grault and corge are both syntactical variables used globally.
Courge is misspelling of corge.

Signed-off-by: Michał Barnaś <mb@semihalf.com>
2021-08-23 18:54:27 -04:00
Flavio Ceolin
a8c4916ac0 pm: device: Fix pm_device_state_set documentation
Document one more possible return value to this API.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-08-23 17:46:33 -04:00
Maxime Bittan
39614b8960 boards: arm: Add Legend 2.5" boards
This commit adds support for the Legend 2.5" boards (legend25_ssd and
legend25_hdd) based on the STM32F070CB MCU. These boards can be found in
the Seagate FireCuda Gaming Drive, Gaming Drive for Xbox, SSD Gaming
Drive for Xbox, and Gaming Drive for PlayStation devices. Both boards
contain the following hardware components:
- A B1414 LED strip connected to the PA7 pin (SPI MOSI)
- A SPI flash (FM25F005) connected on SPI2 bus

The Legend 2.5" HDD board also contains an activity LED connected on
TIM3 CH3

Signed-off-by: Maxime Bittan <maxime.bittan@seagate.com>
Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2021-08-23 08:26:23 -04:00
Lingao Meng
5989cfbfc7 Bluetooth: Missing _ when concat with name field
Add missing `_` between struct type with _name.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-23 15:16:10 +03:00
Mark Wang
c11ef74605 Bluetooth: SDP: add one API bt_sdp_get_add_proto_param
The bt_sdp_get_add_proto_param is used to get the protocol
parameter from Additional Protocol Descriptor List.
In order to implement it, one parameter
(proto_profile_index) is added to sdp_get_uuid_data_index
to get the indexed item.
Fix one bug in sdp_get_uuid_data because there may be more
than 2 consequent "seq len item".

Signed-off-by: Mark Wang <yichang.wang@nxp.com>
2021-08-23 15:11:24 +03:00
Evgeniy Paltsev
27de1e2bdb ARC: MWDT: explicitly forbid to use NEWLIB / NATIVE_APPLICATION
ARC MWDT doesn't support building Zephyr as an native
application (CONFIG_NATIVE_APPLICATION).
ARC MWDT doesn't support building with CONFIG_NEWLIB_LIBC
as it doesn't have newlib.

Let's explicitly forbid to use these Kconfig options for the
MWDT toolchain.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-21 21:33:18 -04:00
Evgeniy Paltsev
0900d9e972 ARC: MWDT: workaround for libs with stackcheck
As of today we have libraries provided by MWDT build with
stackcheck enabled. So we have to provide dummy
_fstack, _estack to make it working.

Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com>
2021-08-21 21:33:18 -04:00
Yonatan Schachter
f5b90e7b1f ring_buffer: Link buffer data to the .noinit section
The ring buffer's static declarations now declare the
ring buffer's data as __noinit, to avoid unnecessary
initialization of the buffer.

Signed-off-by: Yonatan Schachter <yonatan.schachter@gmail.com>
2021-08-21 21:32:45 -04:00
Jim Shu
073cfa9cdf arch: riscv: introduce global pointer relative addressing support
Enable RISC-V GP relative addressing by linker relaxation to reduce
the code size. It optimizes addressing of globals in small data section
(.sdata).

The gp initialization at program start needs each SoC support. Also,
if RISC-V SoC has custom linker script, SoC should provide
__global_pointer$ symbol in it's linker script.

Signed-off-by: Jim Shu <cwshu@andestech.com>
2021-08-20 18:53:23 -04:00
Joakim Andersson
8c2e99d328 Bluetooth: host: Document name option behavior in update adv params
Document the behavior of the include name option when this is changed by
updating the advertising parameters of the advertising set.
In this case we cannot update the advertising data since the host does
not have a copy to modify. The application will have to do update with
its current advertising data.

Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
2021-08-20 12:49:06 +02:00
Tomasz Bursztyka
f70ecc1099 drivers/pcie: Improve and fix MBAR retrieval depending on use cases
So far pcie_get_mbar() has been the only way to retrieve a MBAR. But
it's logic does not fit all uses cases as we will see further.
The meaning of its parameter "index" is not about BAR index but about
a valid Base Address count instead. It's an arbitrary way to index
MBARs unrelated to the actual BAR index.

While this has proven to be just the function we needed so far, this has
not been the case for MSI-X, which one (through BIR info) needs to
access the BAR by their actual index. Same as ivshmem in fact, though
that one did not generate any bug since it never has IO BARs nor 64bits
BARs (so far?).

So:

- renaming existing pcie_get_mbar() to pcie_probe_mbar(), which is a
  more relevant name as it indeed probes the BARs to find the nth valid
  one.
- Introducing a new pcie_get_mbar() which this time really asks for the
  BAR index.
- Applying the change where relevant. So all use pcie_probe_mbar() now
  but MSI-X and ivshmem.

Fixes #37444

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2021-08-20 06:30:20 -04:00
Francois Ramu
c4161024c4 drivers: dma: stm32 dma of type V1 with mux
This is the configuration of the stm32h723 where the
dma1 & dma2 of type V1 with a MUX. Even if DMA is of type V1,
the 'feature' does not exist with DMAMUX

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-20 06:28:32 -04:00
Lingao Meng
8131d848f2 Bluetooth: Mesh: Missing _ when concate with _name
Add `_` for concate with _name.

Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
2021-08-20 06:28:12 -04:00
Martí Bolívar
fbd5e1f316 drivers: clock_control_litex: remove MMCM_NAME
This now unused and unnecessary.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2021-08-19 17:20:21 -04:00
Henrik Brix Andersen
d2ddd379c9 drivers: pwm: clarify API details
Clarify the PWM pwm_pin_set_cycles() function API details.

The API aims for synchronous (glitch-free) updates of the PWM period and
pulse width, but not all PWM controllers support this.

Similarly, the API aims for independance between channels on
multi-channel PWM controllers, but not all PWM controllers support this.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2021-08-19 17:14:48 -04:00
Francois Ramu
be2f0bfaa9 include: drivers: dma format the documentation from header file
This patch is re-formating the doc generated from the dma.h
header file. Result to be accessible on the
https://docs.zephyrproject.org/latest/reference/peripherals/dma.html

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-08-19 10:22:20 -04:00