History log of /linux-master/drivers/misc/mei/client.h
Revision Date Author Comments
# 83f47eea 16-Nov-2022 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add timeout to send

When driver wakes up the firmware from the low power state,
it is sending a memory ready message.
The send is done via synchronous/blocking function to ensure
that firmware is in ready state. However, in case of firmware
undergoing reset send might be block forever.
To address this issue a timeout is added to blocking
write command on the internal bus.

Introduce the __mei_cl_send_timeout function to use instead of
__mei_cl_send in cases where timeout is required.
The mei_cl_write has only two callers and there is no need to split
it into two functions.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Link: https://lore.kernel.org/r/20221116124735.2493847-2-alexander.usyskin@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0912ef48 28-Jul-2021 Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>

mei: constify passed buffers and structures

Buffers and structures passed to MEI bus and client API can be made
const for safer code and clear indication that it is not modified.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Link: https://lore.kernel.org/r/20210729102803.46289-1-krzysztof.kozlowski@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 369aea84 06-Feb-2021 Alexander Usyskin <alexander.usyskin@intel.com>

mei: implement client dma setup.

Implement HBM message protocol to setup and tear down
DMA buffer on behalf of an client. On top there DMA
buffer allocation and its life time management.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20210206144325.25682-5-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bcbc0b2e 29-Oct-2020 Alexander Usyskin <alexander.usyskin@intel.com>

mei: protect mei_cl_mtu from null dereference

A receive callback is queued while the client is still connected
but can still be called after the client was disconnected. Upon
disconnect cl->me_cl is set to NULL, hence we need to check
that ME client is not-NULL in mei_cl_mtu to avoid
null dereference.

Cc: <stable@vger.kernel.org>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20201029095444.957924-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f35fe5f4 18-Aug-2020 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add a vtag map for each client

Vtag map is a list of tuples of vtag and file pointer (struct
mei_cl_vtag) associated with a particular me host client.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20200818115147.2567012-8-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d1376f3d 18-Aug-2020 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add a spin lock to protect rd_completed queue

In order to support vtags we need to access read completed
queue out of driver big lock.
Add a spin lock to protect rd_completed queue.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20200818115147.2567012-7-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2dd1e5ae 18-Aug-2020 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add vtag support bit in client properties

Vtag support is on a client basis, meaning not every client
supports it. The vtag capability is communicated via the client properties
structure during client enumeration process.
Export the propertiy via sysfs.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20200818115147.2567012-4-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 64498695 16-Nov-2019 Alexander Usyskin <alexander.usyskin@intel.com>

mei: bus: add more client attributes to sysfs

Export more client attributes via sysfs that are usually obtained
upon connection. In some cases, for example a monitoring application
may wish to know the attributes without actually performing the connection.
Added attributes:
max number of connections, fixed address, max message length.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20191116142136.17535-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1e55b609 11-Mar-2019 Tomas Winkler <tomas.winkler@intel.com>

mei: adjust the copyright notice in the files.

Use unified version of the copyright notice in the files
Update copyright years according the year the files
were touched, except this patch and SPDX conversions.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9fff0425 11-Mar-2019 Tomas Winkler <tomas.winkler@intel.com>

mei: convert to SPDX license tags

Replace boiler plate licenses texts with the SPDX license
identifiers in the mei files header.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5151e2b5 12-Jul-2018 Tomas Winkler <tomas.winkler@intel.com>

mei: fix ssize_t to int assignment in read and write ops.

Use ssize_t for rets variables in mei_write(), mei_read(), and
mei_cl_write() as well as change the return type of mei_cl_write()
to ssize_t, to prevent assignment of possible 64bit size_t
to int 32 bit variable.

As by product also eliminate warning
drivers/misc/mei/client.c:1702:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 394a77d0 20-Mar-2017 Alexander Usyskin <alexander.usyskin@intel.com>

mei: drop amthif internal client

AMTHIF has special support in the mei drive, it handles multiplexing
multiple user space connection above single me client connection.
Since there is no additional addressing information there is a strict
requirement on the traffic order on each connection and on the "read
after write" order within the connection. This creates a lot of
complexity mostly because the other client types do not necessarily fall
under the same restriction. After carefully studying the use of the
AMTHIF client, we came to conclusion that the multiplexing is not really
utilized by any application and we may safely remove that support and
significantly simplify the driver.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f046192d 27-Jan-2017 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp io list cleanup function.

Specify in function names by which object is the io list filtered:
cl for a client and fp for file descriptor.
In that course a code duplication is resolved by dropping
mei_cl_read_cb_flush and mei_clear_list and using
mei_io_list_free_fp function.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 962ff7bc 27-Jan-2017 Alexander Usyskin <alexander.usyskin@intel.com>

mei: replace callback structures used as list head by list_head

mei_dev structure used struct mei_cl_cb type variables as for holding
callbacks list heads. Replace them by the actual struct list_head
as there is no other info that is handled. This slims down
the mei_dev structure and mostly streamline the code.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 669c256c 19-Jan-2017 Alexander Usyskin <alexander.usyskin@intel.com>

mei: make mei_cl_set_disconnected static

mei_cl_set_disconnected is used only in client.c,
so make it local to the file and mark static.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 29fe7d59 19-Jan-2017 Alexander Usyskin <alexander.usyskin@intel.com>

mei: make mei_io_list_flush static

mei_io_list_flush is used only in client.c
so make it local to the file and mark static.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e0cb6b2f 08-Nov-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: enable to set the internal flag for client write

Prepare the client write functions to set the internal flag in message
header. Carry both blocking and internal modes inside the transmit cb,
and call internal bus function __mei_cl_send() with send mode bit mask.
The Internal flag should be added only on messages generated by the
driver.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3030dc05 25-Jul-2016 Tomas Winkler <tomas.winkler@intel.com>

mei: add wrapper for queuing control commands.

Enclose the boiler plate code of allocating a control/hbm command cb
and enqueueing it onto ctrl_wr.list in a convenient wrapper
mei_cl_enqueue_ctrl_wr_cb().

This is a preparatory patch for enabling consecutive reads.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aab3b1a3 24-May-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: drop mei_io_cb_alloc_buf

mei_io_cb_alloc_buf have a single caller :mei_cl_alloc_cb. After amthif
stopped using it, the code can be integrated into the caller and the
function can be dropped.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 025fb792 07-Feb-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: split amthif client init from end of clients enumeration

The amthif FW client can appear after the end of client enumeration.
Amthif host client initialization is done now at FW client discovery
time.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 7851e008 07-Feb-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: drop reserved host client ids

The reserved host clients can be obsoleted now, a portion of the
platforms is shipped without iAMT enabled, where the reservation is not
relevant and for platforms with iAMT dynamic allocation is sufficient.
Dropping reserved ids makes enumeration more flexible and generic

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6938c192 07-Feb-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: hbm: warn about fw-initiated disconnect

The FW can initiate client disconnection only because an error
condition, hence it make sense to bump the debug message to the warning
level to have an entery in the log.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a4307fe4 07-Feb-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: clean write queues and wake waiters on disconnect

Clean write and write_waiting queues in disconnect.
Requests in those queues are stale and processing will lead to
fat warnings.

In multi thread operations on disconnect and in FW disconnect case -
write/read/event waiters should end wait and return error.
Wake all waiters for disconnecting client to achieve that.

Drop wake all and write queue clean on reset,
as now we waking all waiters and cleaning write queues on disconnect.
No need to do it twice.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f23e2cc4 07-Feb-2016 Tomas Winkler <tomas.winkler@intel.com>

mei: constify struct file pointer

The struct file file pointer is used as an opaque handle to for a
connected client, for this part the pointer should be immutable and
should be set to count.

Reviewed-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fdd9b865 07-Jan-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: wd: drop the watchdog code from the core mei driver

Instead of integrating the iAMT watchdog in the mei core driver
we will create a watchdog device on the mei client bus and
create a driver for it.

This patch removes the watchdog code from the mei core driver.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 40b7320e 10-Sep-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: bus: export client protocol version

export me client protocol version to sysfs and uevent

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 237092bf 26-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: implement fasync for event notification

A process can be informed about client notification also via
SIGIO with POLL_PRI event.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b38a362f 26-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: add a handler that waits for notification on event

mei_cl_notify_get is to be called by a host client
to wait, receive, and ack the event notification.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 51678ccb 26-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: add mei_cl_notify_request command

Add per client notification request infrastructure
that allows client to enable or disable async
event notification.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1df629ef 04-May-2015 Alexander Usyskin <alexander.usyskin@intel.com>

mei: support for fixed address clients

Fixed address is simplified FW client that doesn't require
connection and doesn't support flow control.
So it can be only one host client per fixed FW client.
Fixed client access is available only for drivers on mei bus,
connection from user-space is blocked.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d49ed64a 04-May-2015 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add a reference from the host client to the me client

Keep a pointer to associated me client in the host client object to
eliminate me client searches. Check if the me client is active in the
firmware by checking if its is linked on the me clients list
Add accessors for the me client properties from host client.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0c53357c 04-May-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp client connection

Simplify connect state machine by changing the logic around
Connection request in progress - only check if we have a callback in
relevant queue.
Extract common code into mei_cl_send_connect() function

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3c666182 04-May-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp client disconnection flow

Split disconnected state into two parts first reception disconnect
response from the firmware and second actually setting of disconnected
state. Book keeping data are needed for processing and after firmware
disconnected the client and are cleaned when setting the disconnected
state in mei_cl_set_disconneted() function.
Add mei_cl_send_disconnect to reduce code duplication.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6a84d63d 26-Mar-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: replace check for connection instead of transitioning

The function mei_cl_is_transitioning is just opposite
of mei_cl_is_connected. What we actually wanted to
check is if we lost connection so we can discard
the check for transition and check for 'not connected'

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ab3ae009 18-Mar-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: fix regression on NFC connection

In mei_host_client_init function we enable the all internal
connected clients including NFC. This is done before we set the device
to enabled state and let userspace call open.
We need to check only for MEI_FILE_CONNECTED in mei_cl_is_connected
in order to enable the communication with the clients before
MEI_DEV_ENABLED is set.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# a9bed610 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: allow read concurrency

Replace clunky read state machine with read stack
implemented as per client read list, this is important
mostly for mei drivers with unsolicited reads

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 03b8d341 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: add mei_cl_alloc_linked function

Add convenient wrapper mei_cl_alloc_linked
to simplify error handling

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# bca67d68 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: always initialize the callback with the intended operation type

We set the operation type at initialization time as each cb is used only
for a single type of operation

As a byproduct we add a convenient wrapper for allocating cb with
the data buffer.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5db7514d 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: use only one buffer in callback

The callback structure is used exclusively for reading or writing
therefore there is no reason to hold both response and request buffers
in the callback structure

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 331e4187 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: iamthif: use regular client read functions

Reduce code duplication in amthif by reusing
regular client read functions.

The change also removes the need for amthif
own buffering

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b7d88514 10-Feb-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp me clients list handling

1. Use rw lock to access the me_clients list

2. Reuse already defined find functions also when
removing particular me client

3. Add wrappers for addition and deletion

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 79563db9 10-Jan-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: add reference counting for me clients

To support dynamic addition and removal of
me clients we add reference counter.

Update kdoc with locking requirements.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 2bf94cab 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: get rid of most of the pci dependencies in mei

For purpose of adding testing HW we would like
to get rid of pci dependency in generic mei code
This patch provides only straight forward changes
FW status and prob quirks need to be handled separately

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d880f329 21-Aug-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: add mei_me_cl_by_uuid_id function

When handling dynamic clients there might be a race
scenario in which two me clients with the same me
address would be linked in the me clients list,
therefore we need to search by both uuid and me address.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 25ca6472 21-Aug-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: add me client remove functions

To support dynamic addition/remove we add wrappers
for removal of me clients

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d320832f 23-Aug-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: me_client lookup function to return me_client object

For support of dynamic addition and removal of me clients
it is more convenient to use a list instead of static array
as is use now.
As the first step of the transition to the new data structure
we change the lookup function so it returns me client address
instead of an index.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5456796b 14-Aug-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: amthif: use service function to flush amthif queue

Replace open coded loop with an existing service function:
mei_io_list_flush

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1adc1674 17-Mar-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: client.h fix checkpatch errors

Fix checkpatch error
return is not a function, parentheses are not required

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cc99ecfd 10-Mar-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: fix memory leak of pending write cb objects

Write callbacks are released on the write completed path but
when file handler is closed before the writes are
completed those are left dangling on write and write_waiting queues.

We add mei_io_list_free function to perform this task

Also move static functions to client.c form client.h

Cc: stable <stable@vger.kernel.org> # 3.11+
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9d098192 19-Feb-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp writing slot counting

Since txe use doorbell and not circular buffer
we have to cheat in write slot counting, txe always consume all the
slots upon write. In order for it to work we need to track
slots using mei_hbuf_empty_slots() instead of tracking it in mei layer

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e2b31644 02-Sep-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: bus: stop wait for read during cl state transition

Bus layer omitted check for client state transition while waiting
for read completion
The client state transition may occur for example as result
of firmware initiated reset

Add mei_cl_is_transitioning wrapper to reduce the code
repetition.:

Cc: <stable@vger.kernel.org> # 3.9+
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c0abffbd 15-Sep-2013 Alexander Usyskin <alexander.usyskin@intel.com>

mei: prefix client log messages with client me and host ids

define cl_dbg and cl_err macros that add me and host id
prefix for debug and error log messages so we can track
for the client context of the flow.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# b950ac1d 25-Jul-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: don't get stuck in select during reset

Clear pending connection after hw reset but before hw start
and wake up the waiting task in poll. Signal POLLERR in select
when device went through reset.

Add wrapper mei_cl_is_connected for checking if
the device and client are connected.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 5290801c 24-Jul-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: wake also writers on reset

wake writers otherwise might have processes waiting
endlessly on wait_tx during reset

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 21767546 23-Jun-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move mei_cl_irq_write_complete to client.c

mei_cl_irq_write_complete operates on a client so move it
to client.c

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# db086fa9 12-May-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move mei_cl_complete to client.c

1. rename mei_cl_complete_handler to mei_cl_complete
2. move the function client.c where it belongs

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# fcb136e1 19-Apr-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: fix reading large reposnes

While writting to device is limitted to max_msg_length advertized
in client properites the read can be much longer delivered consequiting chunks.

We use krealloc to enlarge the buffer when needed.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4234a6de 08-Apr-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: add mei_cl_write function

consolidate write code to a specific me client in mei_cl_write function
the function is called from mei device write handler and from
mei_cl bus send function

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 074b4c01 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move clients cleanup code from init.c to client.c

during reset we clean up client data structures
we move that code into wrappers in client
and call the wrappers

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 781d0d89 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: normalize me host client linking routines

In order we can use the same code pattern for in-kernel
and user space host clients we replace mei_cl_link_to_me
with mei_cl_link function.
We then have to keep me client lookupout of the new link function.

The unlinking cannot be yet symetric due to amthif connection
handling

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 90e0b5f1 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: fix client functions names

Use common prefix for function names:

mei_cl_ - for host clients
mei_me_ - for me clients
mei_io_ - for io callback functions

Because mei_cl holds mei_device back pointer
we can also drop the dev argument from the client
functions

add client.h header to export the clients API

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>