Commit graph

18591 commits

Author SHA1 Message Date
Daniel Leung
792930172a gpio/dw: Kconfig: put DW selections inside GPIO menu
This change puts the DW GPIO Kconfig selections inside GPIO menu.
This also groups all DW GPIO related selections under GPIO_DW.

Change-Id: I776f3f6b89e1a4dc366648f8290abb27de9eceb8
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Daniel Leung
a5876981fe i2c: dw: fix compilation error
This was missing an include file, which caused the macro to not
be expanded correctly. Including init.h fixes the issue.

Change-Id: I6b190e0c75828d9b6eb42a84c213dfc174510740
Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
e09e80d8e7 x86: rename ia32*/*.c files have ia32 as their base name
Rename system.c and platform_config.c files in preparation for merging the ia32
based platforms to remove code duplication.

Change-Id: I88caf5294817e06c235379e92cd8ee7472e88028
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
4210a4df18 x86: Change I2C IRQ configuration function to init system routine
Change-Id: If57b8b0166a7f78b948c65f1c702475fbcb5ed9e
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
c52e6481fe x86: Change GPIO IRQ configuration function to init system routine
Change-Id: If511362ec3f2dba5010052863fc350407f87aedc
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
cf80269f52 x86: Change CONSOLE IRQ configuration function to init system routine
Change-Id: Ie343b241009ab5b63c6dd877b7ce4505fe84fc6d
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
1ac4e50ed8 x86: Change HPET IRQ configuration function to init system routine
Change-Id: I8adc0fe190bd253202145418ab7898bb95b7d7ec
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
25c9d021a5 x86: move IOAPIC driver to device model/init system
Change the IOAPIC driver to be initialized directly from the init
system. The function signature of _ioapic_init() function is updated
accordingly.

Change-Id: I2f824ac745926966eebb23f60445a41e1df9eb8f
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:18 -05:00
Dirk Brandewie
be1b1a4e35 x86: move LOAPIC driver to device model/init system
Change the LOAPIC driver to be initialized directly from the init
system. The function signature of _loapic_init() function is updated
accordingly.

Change-Id: I5ed26d53524c8526d413a05ac9a7a58dd4264c5a
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie
1bcb7a339a x86: Move PIC driver to device model/init system
Change the PIC driver to be initialized by the init system. To be
initialized by the init system the function signature of the
_i8259_init() function needs to be changed to the standard *_init()
function signature specified by the device model.

Change-Id: I63bf1cd0ce78920fa20da94f5966e5aab4bf41b2
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie
2a1e4266e8 IPI console driver with test case
This introduces a generic driver set for console messages routed over
inter-processor interrupt (IPI) channels. These drivers bind to a
low-level IPI driver instance for the actual transport of messages.

ipi_console_sender installs printk and/or stdout hooks to forward
messages over IPI. There is currently no buffering on the sending side.

ipi_console_receiver installs an IPI callback which stashes incoming
characters into a ring buffer, which is monitored by a nanokernel
fiber. The fiber buffers the characters on a per-line basis and sends
them to either printk or stdout. Multiple instances of this driver
may be created in case you need to receive console data from multiple
CPUs.

Change-Id: Icebc110794fbe040f975101cd2ae6e78fb38645a
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie
faaab4831f ipi.h: introduce low-level inter-processor interrupt API
This interface is an abstraction for sending messages between
processors with irq-context callbacks and no definition of
protocol.

We assume that for all IPC implementations, we can send over a
message identifier and a sized data payload, and that the receiving
side gets an interrupt on an incoming message. APIs exist to indicate
the max value of the message id and how much data can be sent over a
single message.

This will be a foundation to build various high-level drivers
which can be bound at runtime to this low-level interface. Some
examples:
* IPC where IPC messages are used as a doorbell to signal new data in
  a shared queue
* IPC with various kinds of message buffering and deferred message
  processing  via semaphores
* IPC for serial console debug output, either a byte or a message at
  a time
* IPC over UARTS in a non-shared memory environment where large-ish
  messages are exchanged
* Shared memory IPC where data pointers are exchanged and a protocol
  for freeing the data once the receiver is done with it

The size parameter passed to ipc_send() isn't propagated to the
receiving side. The receiver needs to infer how many bytes of
data to read in the callback function based on the protocol implemented
in the high-level driver; it can be based on message ID, or bits reserved
in the message ID for the message size, or some other mechanism.

Change-Id: I9a9529beb61cdebdfb1bafd29d037f926fab3c1b
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Jesus Sanchez-Palencia
22e68cbc84 net: Remove EXPERIMENTAL label from net and bluetooth
These features set are not experimental anymore.

Change-Id: Ia9e4803982f625157e78c8002c38fed1e95c4892
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie
858decd162 misc: don't depend on serial drivers for printk()/printf()
We are introducing other kinds of drivers which support a console
that isn't over a UART.

Change-Id: I0dddbdce958437b5709c5ab26252ed47d030413d
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie
6865fb658f x86: i2c: Move system binding code to dw_i2c.c
The code fragment to bind the instances of the I2C driver is not
platform specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: I9ea132c9340437ccb292bb8f3fa3d3a2b2a794db
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie
f4ded7a0c1 x86: spi: Move system binding code to intel_spi.c
The code fragment to bind the instances of the SPI driveri is not
platform specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: Iff40227e3e25d431ae870d585445971f35d934dd
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Dirk Brandewie
586776f961 x86: gpio: Move system binding code to gpio-dw.c
The code fragment to bind the instances of the GPIO driver were being
replicated in every platform_config.c  This code is not platform
specific but is driver specific.

All the information required to bind a driver instance comes from
CONFIG_ variables.  Having the binding code with the driver code
avoids duplicating the code fragments in each platform where the
driver may be used.

Change-Id: Ie07a3d12d25201e82ce7074455e6c036f463851b
Signed-off-by: Dirk Brandewie <dirk.j.brandewie@intel.com>
2016-02-05 20:24:17 -05:00
Jesus Sanchez-Palencia
bb91977835 Kconfig: Fix EXPERIMENTAL features dependency
Features displayed with "[EXPERIMENTAL]" should depend on
CONFIG_EXPERIMENTAL.

Change-Id: I0a86dff442014caa2fa4629138dbe29e69d5b853
Signed-off-by: Jesus Sanchez-Palencia <jesus.sanchez-palencia@intel.com>
2016-02-05 20:24:17 -05:00
Andrew Boie
d5feec5c64 ram_console: driver for emitting console messages to a buffer
This buffer can be examined at runtime with a debugger to see what
is going on. Helpful if there are no other working console drivers
on the system.

Change-Id: I759467a57d16204b4b316c4f6fa8b7d5e1d1d236
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2016-02-05 20:24:17 -05:00
Tomasz Bursztyka
8017b64dcf util: Add some helper to move integers to pointer and vice-versa
This will be useful when an implementation of a generic API requires an
int as user data when such has been defined to be a pointer.

int do_something(struct device *dev, void *user_data);

When the implementation would:

int impl_do_something(struct device *dev, void *user_data)
{
        int identifier = POINTER_TO_INT(user_data);
	...

Change-Id: Ic892927a03ac49e95527ef8e0e817d00256aa3bb
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:24:17 -05:00
heeleyth
df0fd2c8cc ioapic: do not check for CONFIG_IOAPIC from ioapic.h
Match loapic.h and allow 'ioapic like' drivers to export same ioapic
interface.

Change-Id: Ia2e5380cf9c3fc72e27beb198013e7416daa6aca
Signed-off-by: heeleyth <thomas.heeley@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Anas Nashif
3206f0b231 kbuild: remove unnecessary if statements
The c files actually check for the Kconfig variables, so there is no 
need to do the checking in the Makefile again adding double logic.


Change-Id: I8521047bd575c8f9d64f7d8e5abfb5eee8a40cb3
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Anas Nashif
67dbf7531a doc: fixed type sempahores -> semaphores
Change-Id: Iec1748ddcc15f2f42cf195ebd7ad0b9594e4224c
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Anas Nashif
715946b67c microkernel: do not enable workload monitor by default
Do not enable the feature by default when EXPERIMENTAL features
are enabled.

Change-Id: I0538f9f94bb47a4bc870c8974e80faf273070f91
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:17 -05:00
Alexandre dAlton
3bef343493 linker: add whole-archive flag to app lib
Change-Id: I167b67bb227718d18bc383c4562cccaa915ed22b
Signed-off-by: Alexandre d'Alton <alexandre.d'alton@intel.com>
Signed-off-by: Alexandre d'Alton <alexandre.dalton@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:24:04 -05:00
Ricardo de Almeida Gonzaga
0eb46fe0e5 gpio: fix interrupt callback call on gpio-dw
When configured as GPIO_ACCESS_BY_PIN, the callback should
be called only if the pin is enabled and received an interrupt.

Change-Id: I7addeb57c8d46dddc027e9b82a92654cd210ade1
Signed-off-by: Ricardo de Almeida Gonzaga <ricardo.gonzaga@intel.com>
2016-02-05 20:16:17 -05:00
Anas Nashif
66b55a3f7c arc: if printk is disabled, do not set variables
if printk is disabled, the variables will be unused and we will
get compiler warning.

Change-Id: I5dad791ae89d7a8c98f9e4660da472ef0caacc92
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:16:17 -05:00
Johan Hedberg
fd0bd160e6 Bluetooth: Add missing copyright statement to btp_spec.txt
Change-Id: I21f567fa56ee6cd5038838938161ac9cb00e9841
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:17 -05:00
Luiz Augusto von Dentz
d1ca4eb92d Bluetooth: Add subscription type to gatt-subscribe in btshell
This enables passing the value to be used when writing to CCC so it can
be configure for indications in adition to notifications.

Change-Id: Ied89faed422e5c5ec60618d512dbd3f250f50b46
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
1b4fb0d8a6 Bluetooth: GATT: Add value support to bt_gatt_subscribe
This enables bt_gatt_subscribe to subscribe using indication value in
addition to notification.

Change-Id: I25f3b057e36b023a79fb66b11b70716ecc299ba9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
d87d1878b4 Bluetooth: ATT: Handle Indications
This adds the callback necessary to parse Indication PDU generating
proper Confirm response:

> ACL Data RX: Handle 3585 flags 0x02 dlen 8
      ATT: Handle Value Indication (0x1d) len 3
        Handle: 0x0014
          Data: 00
< ACL Data TX: Handle 3585 flags 0x00 dlen 5
      ATT: Handle Value Confirmation (0x1e) len 0

Change-Id: I277c1776f32cc05a55ffad7aa483ff1857c9fb9f
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
b5e8ecf12e Bluetooth: ATT: Fix BT_ATT_OP_CONFIRM code
The correct code is 0x1e not 0x1f.

Change-Id: Icee68ebd01d76a4b3ed31a54e18b1115172f5b71
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
6f580e363b Bluetooth: Ignore completed packets events for unknown connections
Some controllers are broken in that they may send a completed packets
event after a disconnection has already occurred and the handle is
invalid:

> HCI Event: Disconnect Complete (0x05) plen 4
        Status: Success (0x00)
        Handle: 64
        Reason: Remote User Terminated Connection (0x13)
< HCI Command: LE Set Advert.. (0x08|0x000a) plen 1
        Advertising: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4
      LE Set Advertise Enable (0x08|0x000a) ncmd 1
        Status: Success (0x00)
> HCI Event: Number of Completed Pa.. (0x13) plen 5
        Num handles: 1
        Handle: 64
        Count: 1

Since the disconnection code already takes care of updating the
le_pkts_sem semaphore appropriately there is no need to do anything
for this kind of events (except log a warning of a misbehaving
controller).

Change-Id: I67b35aa50f7297d6bcdeeeab62f1f1d224b1a372
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
19b2d6c258 Bluetooth: Factor out pending connection lookup in le_conn_complete
This is in preparation for being able to compile out SMP support.

Change-Id: Idb3597dd16e457d19d592a9b7dce954b950b174e
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
6fc9e71d09 Bluetooth: Refactor bt_conn_security function
Separate connection master role related parts in single block making
it simpler to split. This is a preparation for being able to compile
in only central or peripheral role support.

Change-Id: I27dc9b32048bf4e682149d5f1d5edbd994155e2b
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
a9382fde50 Bluetooth: Fix missing error checks for drv->send()
The HCI driver send() callback may fail and in such a case require
different handling on the core stack side. This patch introduces the
missing error handling to the places calling drv->send().

Change-Id: Ia0e4f05aedd88c268cf0da98b11924eb3c5c4c0b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
4817c96b68 Bluetooth: Fix returning unacknowledged packets upon disconnection
The core specification says the following about the treatment of
unacknowledged packets when a disconnection occurs (page 773 in core
spec 4.2):

"When the Host receives a Disconnection Complete, Disconnection Physical
Link Complete or Disconnection Logical Link Complete event, the Host shall
assume that all unacknowledged HCI Data Packets that have been sent to the
Controller for the returned Handle have been flushed, and that the
corresponding data buffers have been freed. A Primary Controller does not
have to notify the Host about this in a Number Of Completed Packets event"

This patch adds tracking of unacknowledged packets on a per-connection
basis and makes sure the semaphore that counts controller buffers is
given back the appropriate amount when a disconnection occurs.

Change-Id: I2ff4d12ffa50d4dda5b3e8c75fc75b4c0927e609
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Johan Hedberg
4cdcd228a2 Bluetooth: UART: Fix bt_uart_send error return values
The send() callback of HCI drivers should be returning 0 on success
and a negative value on error. The uart_fifo_fill() function returns
the number of transmitted bytes so it can not be directly mapped to
the send() return value.

Change-Id: I59be478c1985f44a46f2a9613f61471423b0e63a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
5b5575a1fe Bluetooth: Refactor bt_le_scan_update function
Separate connection related parts in single block making it
simpler to split. This is a preparation for being able to compile
out connection support.

Change-Id: I992e604cae848ed2dfe821a6971248e53ae23498
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
ff747d6808 Bluetooth: Factor out setting flow control
This patch factors setting up controller to host data flow control
to separate function. This is a preparation for being able to compile
out connection support.

Change-Id: Ibcce0b740534331a6365c2370b7b637877d71560
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
cc261005f2 Bluetooth: Remove includes from internal headers
All required includes should be placed in source file that includes
internal header.

Change-Id: I161e7ebe2e62377ea4cf03f759d48f5900103076
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Arkadiusz Lichwa
348276044f Bluetooth: ATT: Fix write check permission
Writes to GATT attribute that has no write permission set, should
return write not permitted (BT_ATT_ERR_WRITE_NOT_PERMITTED)
in check permission routine.

Change-Id: I95f0988e171294cd98b79d3e7b518383ac47567d
Signed-off-by: Arkadiusz Lichwa <arkadiusz.lichwa@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
8b7097fd20 Bluetooth: Make parts of GATT API internal
Move parts of the API that are not usable for applications to
an internal header.

Change-Id: Idbcd3db8acda74375ea9deec2bf3d7eddc8a4ddb
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Grzegorz Kolodziejczyk
dabb5d49d5 Bluetooth: Fix read attr respond with invalid handle error
If no attribute with given handle is found in database then invalid
handle error should be set and returned. If attribute is found then
pre-set invalid handle error will be cleared.

Change-Id: I4119877bb72693e18003399f9b6764666f801fe4
Signed-off-by: Grzegorz Kolodziejczyk <grzegorz.kolodziejczyk@tieto.com>
2016-02-05 20:16:16 -05:00
Szymon Janc
fb6c412b8d Bluetooth: Move Kconfig Bluetooth settings to submenu
This makes menu cleaner and easier to follow what options
are Bluetooth specific. It is now similar to IP configuration.

Change-Id: Ic2f6002ab30093bed62e71fe268a576d69a9cd0d
Signed-off-by: Szymon Janc <ext.szymon.janc@tieto.com>
2016-02-05 20:16:16 -05:00
Mariusz Skamra
3bb2df0d24 Bluetooth: tester: Add missing GAP_SETTINGS_DISCOVERABLE define
Change-Id: I56cad6462a50783a9518b3bc7a3c6b082f323f8e
Signed-off-by: Mariusz Skamra <mariusz.skamra@tieto.com>
2016-02-05 20:16:16 -05:00
Jukka Rissanen
01d8a82332 net: tinydtls: Add missing header files
Tinydtls had its own .gitignore file that masked away two
include files that are needed in compilation. Removed
the files from ignore file and added those two files.

Change-Id: Ibcfcf4e18ca8f56eef97d41464c4233148e9db9e
Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
c74c6fd453 Bluetooth: ATT: Retry in case of recoverable error
If the remote response with encryption/authentication error attempt to
elevate the security and retry sending the request:

bt: bt_att_recv (0x00112e0c): Received ATT code 0x01 len 5
bt: att_error_rsp (0x00112e0c): request 0x0a handle 0x0018 error 0x0f
bt: security_changed (0x00112e0c): conn 0x0010f5ac level 1
bt: security_changed (0x00112e0c): Retrying
bt: bt_att_recv (0x00112e0c): Received ATT code 0x0b len 1
bt: att_handle_read_rsp (0x00112e0c):
bt: att_read_rsp (0x00112e0c): err 0x00

Change-Id: I9d74fb50385c39b2092357f4fd6912a3eb041442
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Luiz Augusto von Dentz
2045f0ab12 Bluetooth: ATT: Clone request buffer
Clone request buffer so it can later be used to validate the response.

Change-Id: I306f7b01a9a72a6c4b8e97c30789247b28428365
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:16:16 -05:00
Andrei Emeltchenko
41d047f0fa Bluetooth: Fix bug in the shell app
Fixes bug accessing wrong memory.

Change-Id: I13b4bebe807fe3c2694311e72d9d49d3b688bceb
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
2016-02-05 20:16:16 -05:00