Commit graph

18591 commits

Author SHA1 Message Date
Johan Hedberg
1e5efb9fb7 Bluetooth: SMP: Store original pairing req/rsp values
These values are needed later in the SMP pairing procedure as inputs
to various crypto functions.

Change-Id: I68334ed6d32625c4e7e0668300844af09018e126
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
38a7d345ae Bluetooth: SMP: Fix minor coding style issues
Add missing braces to a couple of one-line branches.

Change-Id: Ie4d703eede3cc03b823bd0a0764a5b999f317322
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
a648bbe9a1 Bluetooth: SMP: Add local random number generation support
The SMP procedures require us to establish a local random number. Use
the HCI_LE_Rand command to generate the necessary 16 bytes (the
command needs to be called twice since it only returns 8 bytes at a
time). Store this number in the SMP context.

To help debugging with various crypto related values add a local h()
helper function for printk/BT_DBG to do hexadecimal conversion.

Change-Id: Id3e8793a77ac635023b3cc3a94e8679170455870
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
653378d031 Bluetooth: Track remote address for connections
We'll need to know the remote address for connections e.g. when
performing SMP based pairing.

Change-Id: I7e398a75c2418ec534b3cac15ab72f76586c2e9b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
4dae513d4b Bluetooth: Add contexts for SMP & ATT specific data
All fixed channels will need per-connection contexts. Right now in
addition to the L2CAP (LE) signaling channel the other two fixed ones
are ATT and SMP.

Change-Id: I56dda6b903ef703e453438e03a99c704aa77899a
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
19deebbecf Bluetooth: Move L2CAP context into dedicated struct
In preparation for having per-fixed channel contexts move the L2CAP
signaling channel specific data into a dedicated struct.

Change-Id: Iaacb5e1c7408be67740434f31ef56f94706ad327
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Szymon Janc
62267639ac Bluetooth: Fix not waiting for all commands to complete on init
For LE-only controller init procedure should wait for last HCI command
(Set Controller To Host Flow Control) to complete before returning.

Change-Id: Ic01e0cbaebf19d61560faab2ae01205c2eb22b77
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
46372d712c Bluetooth: Fix missing bt_buf_pull when parsing adv report
The code would only have worked for reports with num_reports being
equal to 1. Any event with multiple reports would have been
incorrectly parsed because of a missing bt_buf_pull() for the initial
one-byte num_reports value.

Change-Id: I0ac92edb792d559fb8ff84e40a4b4766f46afe58
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
19707e8257 Bluetooth: Use 'void *' also for bt_buf_pull/push return value
To make the bt_buf APIs consistent with the recent bt_but_add changes
and more user friendly, change the pull() and push() return values
also to 'void *'.

Change-Id: I25242635c87882db99152735c22316d4de00d363
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
90b27c478d Bluetooth: Remove unnecessary bt_buf_add type casts
Now that bt_buf_add() returns 'void *' there's no need to explicitly
type cast its return value anymore.

Change-Id: I6d5c9d323dc08cb5a2b928977c1bbf3d741e5d8e
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Johan Hedberg
d6a03600b2 Bluetooth: Change bt_buf_add return type to 'void *'
Almost all callers of bt_buf_add end up having to do explicit type
casts of the return value since 'uint8_t *' rarely fits what's needed.
Changing the return type to 'void *' removes this extra type casting
need and makes the API friendlier to its users.

Change-Id: I6a79605006153b6d09f0d662a051cb599af68c37
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:02 -05:00
Luiz Augusto von Dentz
dd52c0109f Bluetooth: Make use of bt_buf_pull_le16
Remove the memcpy code and instead use bt_buf_pull_le16 for unaligned
access and byte order conversion.

Change-Id: I0216042566e27d6a513b302ae1ea78b49f2f1c31
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:02 -05:00
Luiz Augusto von Dentz
d1b61254f3 Bluetooth: Add bt_buf_pull_le16 helper
bt_buf_pull_le16 convert the initial 16 bits to little endian.

Change-Id: I6f6e9d63fc19b0579d9f445e15e975929fc63ba9
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:02 -05:00
Luiz Augusto von Dentz
009899116d Bluetooth: Fix missing braces in ATT code
Change-Id: Icc241250a357efb06614d841cc37de77dddece2e
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:02 -05:00
Luiz Augusto von Dentz
09f8409bfe Bluetooth: Fix using wrong PDU in handlers
Both Write Command and Signed Write command should use their respective
packed struct.

Change-Id: Id786d1e0ee0327f662c68fa1d2f3d3bf19a237fc
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
2016-02-05 20:14:02 -05:00
Tomasz Bursztyka
0b4413d607 uart: Removing driver specific informations from the generic API
IRQ and registers are hardware and driver specific information and as
such should no be exposed through the generic API.

Change-Id: I33e6d7ec7bd9fb82a4e343d99b7a5c17886d1470
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
ea4c3d1c0f bluetooth: UART based driver no longer needs to set regs and irq
Now that UART drivers are configured internally when it comes to
hardware specific information such as IRQ and registers (or mmaped
registers), bluetooth UART driver no longer needs to do it by itself. It
only requires to select the port it wants to use.

Change-Id: I5a30500f4b6f4155292609d0ed4a758f91930817
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
088e0a980f arm: Refactor how UART is configured
UART is configured statically into the driver directly and not anymore
in the board's system.c. Thus limiting the information to be scattered
into 2 files instead of 3. Then in future, it will also be possible to
remove driver specific informations from the generic UART API structure.

Change-Id: I001f2a6834df9a41ab395a80e4e39b347d545db3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
4eb6aab3ad x86: Refactor how UART is configured
Now for x86 platforms, UART is configured statically or dynamically into
the driver and not anymore in the board's system.c. Thus limiting the
information to be scattered into 2 files instead of 3. Then in future,
it will also be possible to remove driver specific informations from the
generic UART API structure.

Change-Id: I7b7fa37f10f88316a4d375c99de3bbacf152a3e3
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
68a58ca587 kconf: Add an option to select PCI on x86 architecture
By default it is set to 'n'. This will be useful to enable the PCI layer
code if required. On quark boark, it is selected by default as UART
driver needs it currently.

Change-Id: I7aa38e73c431c66ebbd8092aff0a14d5fb9268d5
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
1cc9c3901e k20uart: Apply a tiny syntax change
Remove camel case style on baseAddr, changing it into base.

Change-Id: Iea1e2d204a38912f4157cc6776a88640e29a04f6
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
724282d27d k20uart: Let's use 'port' everywhere as it is more readable
Using "which" is somehow awkward to use when 'port', on the contrary, is
blatantly more readable.

Change-Id: I355c6e09d7c27b4b07ab6cd10b772a632855516b
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
1eac566143 ns16550: Let's use 'port' everywhere as it is more readable
Using "which" is somehow awkward to use when 'port', on the contrary, is
blatantly more readable.

Change-Id: Id4d3786a192a650ca042024521b94e557a3ec7e8
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
0a7c8ea578 uart: Follow the same parameter naming everywhere
Just a tiny change s/which/port.

Change-Id: I69be83f9805d71f5ec0ad68b146816d2a4fe221a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
e5c8de83a0 quark: Remove MAX_PCI_DEVS Kconf entry
It is useless as PCI scanning is now storing anything.

Change-Id: I6e3b1e328e2f440ac57a2142cab138e4a222f4fc
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
d3a4177d92 pci: Provide a simpler yet powerful PCI enumeration API
This fixes many issues around PCI enumeration from old API:
- a static internal table was fed with scanning results, thus eating
  memory, and worse: due to the limit of its size, scanning for new
  classes was impossible unless growing statically the size of this
  table --> more memory eaten! Not to mention PCI enumeration is done
  once at boot time for driver initialization and that's all, so this
  table is hanging around for nothing afterwards.
- one needs first to scan a class, then maybe he will be able to find
  his device via pci_dev_find. Where all could be done at once.
- pci_dev_find was not trustworthy due again to the internal table. Now
  if the device is not found, one will know it really went through all
  the possbilities.
- still let the possibility for hard-coded BARs value on driver side
  (thus no PCI scan required). However this is greatly advised not to do
  so as BARs might change over a firmware/BIOS update.

Comparison:

old pci_dev_scan: could only filter out via class mask.
new pci_dev_scan: can filter out via a class, a vendor and device ID
(it could easily do the same for Function and BAR index as these are
usually fixed and informed through datasheet)

old pci_dev_scan: was limited in its findings by the size of the
internal result table.
new pci_dev_scan: can proceed through all the buses and devices every
time (there are optimizations to avoid useless work of course)

old results did not tell about the function or BAR index.
new one tells, and the structure has not bloated.

old internal code: was storing a big table of results
new internal code: is only storing a small lookup structure and an
array of Bus:Dev pairs for each PCI class for optimizations purpose.
(though, if needed, we could disable this through some #ifdef)

Usage:

- Have a local struct dev_info
- Fill it with what you want to look for, currently: only class and
  vendor_id/device_id. Function and BAR index could be added if needed.
- Call pci_bus_scan_init(): this will reset the internal lookup
  structure.
- Call pci_dev_scan(<a pointer to your dev_info>): at first call, the
  internal lookup structure will pick up the informations from dev_info
  and will try to find out what has been requested. It will return 1 on
  success, or 0. On 1, your dev_info structure will be updated with the
  found informations. If more devices can be found against the same
  lookup informations, just call again pci_dev_scan(<a pointer to your
  dev_info>) as long as it returns 1. When 0 is hit, it will mean you
  found all.

Change-Id: Ibc2a16c4485ee3fed7ef4946af0ece032ae406e4
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Tomasz Bursztyka
1425fd8449 pci: Apply code style changes
- always add {} on any sub-statements
- proper indentation
- 80 chars limit

Change-Id: I869239bf2e309a6e73fb180cf29acf66c019489a
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2016-02-05 20:14:01 -05:00
Johan Hedberg
15bf447614 kconf: Fix build with gcc 5.1.1
Building zconf.hash.c fails with gcc 5.1.1 from Fedora 22:

In file included from zconf.tab.c:159:0:
zconf.hash.c:233:55: error: ‘kconf_id_strings_contents’ is static but used in inline function ‘kconf_id_lookup’ which is not static [-Werror]
zconf.hash.c:226:23: error: ‘kconf_id_hash’ is static but used in inline function ‘kconf_id_lookup’ which is not static [-Werror]
    register int key = kconf_id_hash (str, len);
                       ^
zconf.hash.c:177:26: error: ‘wordlist’ is static but declared in inline function ‘kconf_id_lookup’ which is not static [-Werror]
   static struct kconf_id wordlist[] =
                          ^
Import the necessary change from the latest Linux source tree.

Change-Id: Ib6297b5cc3da161bd99c2e92c366206e6c08b4e5
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
2016-02-05 20:14:01 -05:00
Anas Nashif
dba6188b58 doc: fix formatting and move around optional requirements
- Fix missing spaces between package names
- Move optional software to its own section, no need to have
  it in the main requirement section if it is options
- crosstool-NG instead of crosstool-next Generation. Treat that
  as a brand name.
- Fixed command line for installing groups with yum
- minor fixes

Change-Id: Ib231bb09dea3aa6d3af00961eae8a2e3d6ded011
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:01 -05:00
Anas Nashif
7d23b99ae2 doc: fix missing spaces in package list
Change-Id: Ie788720bc0c164b7c4810eacd2a13eb73ab2f77a
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2016-02-05 20:14:01 -05:00
Rodrigo Caballero
08ff46718c ADD Collaboration Guideline ReST content files.
Includes the Collaboration Guideline. It contains the infromation
regarding the use of the mailing list, Gerrit, the coding style and
other usefull collaboration information.

This Collaboration Guideline is constantly changing as new methods of
collaboration are used.


Change-Id: I9f1e66556e99defa8729f87f19052b539e8628d3
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:14:01 -05:00
Rodrigo Caballero
6eab071e07 ADD Installation Guide ReST content files.
Includes the Linux Installation Guide. It contains the requirements and
required steps to install a development environment and to run a sample
application. The optional steps include information regarding running
Tiny Mountain on additional hardware.


Change-Id: I0f0c78fbec6816310d893b40dea5649ead98e92f
Signed-off-by: Rodrigo Caballero <rodrigo.caballero.abraham@intel.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
5ce539ca21 Relocate misplaced pipe buffer code
Several pipe buffer definitions now reside with the other
pipe buffer code. (One routine is also made non-global,
since it only referenced by the pipe buffer code itself.)

Change-Id: I76785d113edd62c9626a7116c9206472656128ec
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
c41b4d24e2 Cosmetic changes to microkernel pipe buffer code
1) Re-orders routines to eliminate the need for forward referencing.
2) Makes routines non-global if they are only referenced by pipe
   buffer code itself.
3) Optimizes out an unnecessary wrapper routine.

Change-Id: I731db9c9125c58d98c5e350bdd1708456e2cf40c
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
11994f52bf Rename and relocate miscellaneous microkernel pipe files
Brings file names into alignment with current naming conventions,
and relocates them to the main microkernel directory.

Note: Since the microkernel/channel directory is now empty, the
build system no longer attempts to build its contents.

Change-Id: I936c7cdf2e08f675dd66a87cacf3b4fa5a7a6441
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
ea39fe6c50 Consolidate microkernel pipe marker routines
Relocates several marker-related routines that didn't reside with
the main set of such routines. This move allows one of them to be
made non-global, and the other two to be optimized out (since they
were now just unnecessary wrapper routines).

Change-Id: I517779be1778b032ee08654d244039ef36d30d1c
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
57f462281a Consolidate microkernel pipe buffer routines
Merges buffer-related routines into a single file, which also allows
a number of them to be made non-global (and eliminates the needs for
them to be declared in an include file).

Change-Id: Ib4fcf70afef548fd493540753f996a50c78f7521
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
2cab57c7ab Simplify determination of priority for moving pipe data
Uses a simpler algorithm to choose the lower priority value
(i.e. more urgent value) associated with the sender and receiver.

Change-Id: I4e8d2ff9678dfefdcd9941c96a75105841c73fcd
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
f6122e2caf Delete unnecessary microkernel pipe subsystem include file
Relocates non-public symbols to the locations they are really
needed (except for CHAN_DEBUG, which is dropped since it is unused).

Change-Id: I52743959a283fec675aa2b3168ef1a122a27ce55
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
bdd9b51999 Consolidate microkernel pipe data transfer routines
Merges related routines into a single file, which also allows a
number of them to be made non-global.

Change-Id: Ib749d3908b86a93bf97c0859861c6eaffe5f5f0a
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
278a5ba641 Consolidate microkernel pipe put and get routines
Merges the routines which process the four command packet types
used to process a pipe "put" operation into a single file, so that
the flow of control can be more easily comprehended. Also merges
the analogous routines which process a pipe "get" operation into
a single file.

Change-Id: I56befa0f9a772b3269fd6ece19f003a5c2578a6f
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
e3a7b9d808 Consolidate microkernel pipe public APIs
Merges the four main pipe public APIs into a single file,
similar to what is done for other microkernel object subsystems.

Change-Id: Ib3dab0a9330700d77c9fd6f88500590c0004d7b6
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
12c59a1d70 Eliminate unnecessary initialization of pipe structure fields
There is no need to initialize fields to zero that are already
nulled out by the build system.

Change-Id: Ib37e77aaadb1beee800ad74dcfba7caff932015e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
4b3e0c9945 Cosmetic cleanup of pipe-related code
1) Eliminates non-functional (i.e. commented out) code.
2) Improves adherence to coding conventions.

Change-Id: I78ad1dd173a49f36c126e1c9f349bace62200174
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
2412e1e50f Limit exposure of non-public pipe types
These structures are only used by the microkernel itself, so they
now reside with other non-public microkernel structures.

Change-Id: I4bbba22e46c5336b7b3c41dcdc76e0d9de4e7e2b
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
b2d95338a8 Limit exposure of non-public pipe constants
There's no need to expose option combinations that are only used
internally by the microkernel itself.

Change-Id: I4e2725b060ce5edefdd1918c00fbd915cd67d8dc
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:01 -05:00
Allan Stephens
b57e2d11b7 Rename microkernel/chan.h to microkernel/pipe.h
Aligns file name with revised terminology for pipe objects.

Change-Id: I247f151f0496f33212f8a2ff7c6d126ecaf520ba
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:00 -05:00
Allan Stephens
267753d967 Streamline public pipe APIs
1) Now invokes pipe routines directly, without the use of function
   pointers.
2) Eliminates unreferenced _DEVICE_CHANNEL symbol.

Change-Id: I6e26476265ed8f33febb5a06c9d03daf7147ee5e
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
2016-02-05 20:14:00 -05:00
Juro Bystricky
18a2427f0a defs.qemu.custom.yocto: Definitions for Yocto SDK
Specify Yocto SDK qemu and qemu Bios locations.
If the environment is initialized with:

export VXMICRO_QEMU=yocto

then the settings from the file

make/target/run/defs.qemu.custom.yocto

will be used.

Change-Id: I537f07f55461fcbadfbfe8af3a4639068587e056
Signed-off-by: Juro Bystricky <juro.bystricky@intel.com>
2016-02-05 20:14:00 -05:00
Peter Mitsis
18fa789ca0 Rework constructor macros
Routines are no longer flagged as constructors using the FUNC_CONSTRUCT(level)
macro.  This is because some compilers do not support constructor levels.

To indicate that a routine should be a constructor, the SYS_PREKERNEL_INIT()
macro should be used AFTER the definition of the routine.  For example ...

void my_library_init(void)
{
    ...
}

SYS_PREKERNEL_INIT(my_library_init, 500);

The first parameter to SYS_PREKERNEL_INIT() is the name of the routine.  The
second is the priority level (000...999).  The lower the number, the higher
the priority.  NOTE: It is important that all three digits are specified;
otherwise the linker may put the constructors in an undesired order.

Change-Id: Ic334875c60a453b39c10a2ffdee856b4851cb16c
Signed-off-by: Peter Mitsis <peter.mitsis@windriver.com>
2016-02-05 20:14:00 -05:00