History log of /linux-master/drivers/misc/mei/init.c
Revision Date Author Comments
# 34a674e9 15-Oct-2023 Vitaly Lubart <vitaly.lubart@intel.com>

mei: me: emit error only if reset was unexpected

GSC devices perform legal firmware initiated resets due to state transition
that may appear as unexpected to the driver. Lower the log level for those
devices to debug level and save the firmware status registers.
When the device comes out of the reset it is possible to check whether the
resets was due to a firmware error or an exception
and only than produce a warning.

Signed-off-by: Vitaly Lubart <vitaly.lubart@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Link: https://lore.kernel.org/r/20231015080540.95922-1-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 6549b2b7 16-Jul-2023 Alexander Usyskin <alexander.usyskin@intel.com>

mei: obtain firmware version only on gsc.

Modern GSC firmwares have both static and dynamic MKHI clients.
Avoid expensive dynamic client call for firmware version retrieval,
in case the firmware version is already retrieved from the fix address
client in bus_fixup().

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


# 9c4625f8 16-Jul-2023 Alexander Usyskin <alexander.usyskin@intel.com>

mei: log firmware status on hw_start failure.

In order to extend debug information log firmware status details
when waiting for firmware ready status fails.

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


# 267cb870 07-Sep-2022 Alexander Usyskin <alexander.usyskin@intel.com>

mei: drop ready bits check after start

The check that hardware and host ready bits are set after start
is redundant and may fail and disable driver if there is
back-to-back link reset issued right after start.
This happens during pxp mode transitions when firmware
undergo reset. Remove these checks to eliminate such failures.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220907215113.1596567-14-tomas.winkler@intel.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>


# 342e4c7e 07-Sep-2022 Tomas Winkler <tomas.winkler@intel.com>

mei: gsc: setup gsc extended operational memory

1. Retrieve extended operational memory physical pointers from the
auxiliary device info.
2. Setup memory registers.
3. Notify firmware that the memory is ready by sending the memory
ready command.
4. Disable PXP device if GSC is not in PXP mode.

CC: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220907215113.1596567-12-tomas.winkler@intel.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>


# 95953618 07-Sep-2022 Alexander Usyskin <alexander.usyskin@intel.com>

mei: extend timeouts on slow devices

Parametrize operational timeouts in order
to support slow firmware on some graphics devices.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220907215113.1596567-9-tomas.winkler@intel.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>


# 9b2e03e2 07-Sep-2022 Alexander Usyskin <alexander.usyskin@intel.com>

mei: gsc: wait for reset thread on stop

Wait for reset work to complete before initiating
stop reset flow sequence.

Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220907215113.1596567-8-tomas.winkler@intel.com
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>


# 2be483f1 15-Feb-2022 Alexander Usyskin <alexander.usyskin@intel.com>

mei: do not overwrite state on hw start

During the hardware start sequence, do not overwrite the driver state
and do not proceed with the initialization sequence if the state
was changed while the driver was waiting for the start interrupt.

This can happen if the driver's removal/stop procedure was triggered
from the parent level while the driver is waiting for the start
interrupt. This may lead to stray the reset work or the timer
after driver were removed.

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


# 38be5687 23-Dec-2021 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add POWERING_DOWN into device state print

The POWERING_DOWN state string was missing from
the device states list, add it.

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


# 36edb140 06-Feb-2021 Alexander Usyskin <alexander.usyskin@intel.com>

mei: allow clients on bus to communicate in remove callback

Introduce new intermediate state to allow the clients on the bus
to communicate with the firmware from the remove handler.
This is to enable to perform a clean shutdown.

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-2-tomas.winkler@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 261e071a 06-Nov-2019 Tomas Winkler <tomas.winkler@intel.com>

mei: abstract fw status register read.

This is to allow working with mei devices embedded within
another pci device, where mei device is represented
as a platform child device and fw status registers
are not necessarily resident in the device pci config space.

Bump the copyright year to 2019 on the modified files.

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


# 43b8a7ed 22-Apr-2019 Alexander Usyskin <alexander.usyskin@intel.com>

mei: expose device state in sysfs

Expose mei device state to user-space through sysfs.
This gives indication to applications that driver is in transition,
usefully mostly to detect link reset state.

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>


# 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>


# 6316321f 22-Nov-2018 Tomas Winkler <tomas.winkler@intel.com>

mei: dma ring: implement rx circular buffer logic

Implement circular buffer protocol over receive dma
buffer. Add extension to the mei message header that holds
length of the buffer on the dma buffer.

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>


# af336cab 25-Feb-2018 Alexander Usyskin <alexander.usyskin@intel.com>

mei: limit the number of queued writes

Limit the number of queued writes per client.
Writes above this threshold are blocked till place
in the transmit queue is available.
The limit is configurable via sysfs and defaults to 50.
The implementation should provide blocking I/O behavior.
Prior to this change one would end up in the hands of OOM.

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>


# 8d52af67 12-Dec-2017 Tomas Winkler <tomas.winkler@intel.com>

mei: speed up the power down flow

When mei driver is powering down due to suspend or shutdown
it will iterate over the mei client bus and disconnect
each client device attached in turn.
The power down flow consist of the link rest, which causes all clients
get disconnected at once, hence the individual disconnection
can be omitted and significantly reduce power down flow.

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


# c845736d 11-Jun-2017 Alexander Usyskin <alexander.usyskin@intel.com>

mei: drop unreachable code in mei_start

Device disabled state is caught inside the retry loop, so
there is no need to check it once again afterwards.

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>


# 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>


# a733ded5 05-Mar-2017 Tomas Winkler <tomas.winkler@intel.com>

mei: fix deadlock on mei reset

This patch fixes 'mei: synchronize irq before initiating a reset'
The patch had introduced a deadlock between irq thread and mei_reset()
as they are both holding the same device lock.

---> device_lock:
mei_reset()
<---- interrupt thread
device_lock
---> synchornize_irq()
wait on interrupt thread == (dead lock)

The fix is to call synchronize_irq
prior to call locked mei_reset function.

Cc: <stable@vger.kernel.org> #4.10+
Fixes: f302bb0de6ac (mei: synchronize irq before initiating a reset)
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>


# 4a8efd4a 04-Dec-2016 Tomas Winkler <tomas.winkler@intel.com>

mei: synchronize irq before initiating a reset.

We need to synchronize irqs before issuing reset to make sure that the
clients communication is concluded and doesn't leak to the reset flow
and confusing the state machine.

This issue is happening during suspend/resume stress testing.

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


# 1892fc2e 25-Sep-2016 Alexander Usyskin <alexander.usyskin@intel.com>

mei: stop the stall timer worker if not needed

The stall timer worker checks periodically if there is a stalled i/o
transaction. The issue with the current implementation is that the timer
is ticking also when there is no pending i/o transaction.
This patch provides a simple change that prevents rescheduling
of the delayed work when there is no pending i/o.

Cc: Andy Lutomirski <luto@kernel.org>
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>


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

mei: bus: run rescan on me_clients list change

Since clients can be now added and removed during runtime
we need to run bus rescan whenever me_clients list is modified.

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>


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

mei: amthif: replace amthif_rd_complete_list with rd_completed

Now when we have per client rd_completed list we can remove
the amthif specific amthif_rd_complete_list.
In addition in the function mei_amthif_read do not loop over the
rd_completed list like the original code as the code path is unlocked.

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>


# 97ccf63f 13-Oct-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: cancel driver workers only after client devices were removed

In process of client devices removal from the bus there still
might be communication between a driver and the mei device
hence we need to cancel supporting workers only after all
the client devices were removed.

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


# 6009595a 23-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: bus: link client devices instead of host clients

MEI bus was designed around nfc and was hard to extend.
Instead of the hard coded way of adding the devices on the mei bus
we scan the whole me client list and create a device for each
eligible me client (mei_cl_bus_rescan); currently we support
only clients with single connection and fixed address clients.
NFC radio name detection is run as a fixup routine

The patch replaces handling the device list based on struct me_cl
to device list based on me_cl_devices. The creating a connection
is pushed from the device creation time to device enablement.

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


# 0ff0a8d8 23-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: bus: add me client device list infrastructure

Instead of holding the list of host clients (me_cl)
we want to keep the list me client devices (mei_cl_device)
This way we can create host to me client connection only when needed.
Add list head to mei_cl_device and cl_bus_lock
Add bus_added flag to the me client (mei_me_client) to track if
the appropriate mei_cl_device was already created and is_added
flag to mei_cl_device to track if it was already added to the device
list across the bus rescans

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


# 4f273959 07-Jul-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: nfc: fix deadlock on shutdown/suspend path

In function mei_nfc_host_exit mei_cl_remove_device cannot be called
under the device mutex as device removing flow invokes the device driver
remove handler that calls in turn to mei_cl_disable_device which
naturally acquires the device mutex.

Also remove mei_cl_bus_remove_devices which has the same issue, but is
never executed as currently the only device on the mei client bus is NFC
and a new device cannot be easily added till the bus revamp is
completed.

This fixes regression caused by commit be9b720a0ccb ("mei_phy: move all
nfc logic from mei driver to nfc")

Prior to this change the nfc driver remove handler called to no-op
disable function while actual nfc device was disabled directly from the
mei driver.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 41c95b04 07-May-2015 Tomas Winkler <tomas.winkler@intel.com>

mei: add also write waiting list to runtime pm blockers

The io callback is clear from write_waitling_list after
we receive interrupt from the hw to ack the write completion.
We need to wait for this interrupt deliver before we try
to enter low power state

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>


# 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>


# 6c15a851 10-Feb-2015 Alexander Usyskin <alexander.usyskin@intel.com>

mei: make device disabled on stop unconditionally

Set the internal device state to to disabled after hardware reset in stop flow.
This will cover cases when driver was not brought to disabled state because of
an error and in stop flow we wish not to retry the reset.

Cc: <stable@vger.kernel.org> #3.10+
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>


# edca5ea3 19-Nov-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: read and print all six FW status registers

ME devices prior to PCH8 (Lynx Point) have two FW status registers,
on PCH8 and newer excluding txe there are six FW status registers.

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>


# ce23139c 29-Sep-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: fix kernel-doc warnings

Add missed parameters descriptions and return values descriptions

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>


# a8605ea2 29-Sep-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: fix KDoc documentation formatting

Fix Kdoc documentation formatting warnings
genertaed by ./scripts/kernel-doc

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>


# 1f180359 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: remove include to pci header from mei module files

Remove inclusion of linux/pci.h in mei layer
however we need to include the headers that before
got included implicitly from linux/pci.h.

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


# 1bd30b6a 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: move fw_status back to hw ops handlers

fw status retrieval has pci specific implementation
so we push it back to the hw layer

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>


# 3a7e9b6c 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: push all standard settings into mei_device_init

Setting of hw_ops and device has should be in
mei_device_init.
We add reference to the parent device and remove
pci dependent cfg

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>


# 92db1555 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: fix style warning: Missing a blank line after declarations

fix new style warning: Missing a blank line after declarations

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


# 1beeb4b9 29-Sep-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add hbm and pg state in devstate debugfs print

Add hbm state, pg enablement and state to devstate file in debugfs
(<debugfs>/mei/devstate)

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>


# cb02efc3 21-Aug-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: wait for hbm start non-interruptible

We cannot handle user interrupt in context of hbm start
so we only wait for time out which is reasonably short.

1. Add kdoc
2. Rename state to better reflect its function
3. Simplify wait condition and rename
wait_recvd_msg to wait_hbm_start

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>


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

mei: use list for me clients book keeping

To support dynamic addition/remove of clients
it is more convenient to use list instead of
static array

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


# 8d929d48 12-May-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: add per device configuration

Add mei_cfg structure that holds per device configuration
data and hooks, as the first step we add firmware
status register offsets

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>


# 84b3294a 07-May-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: fix memory leak of mei_clients array

we never freed the mei_clients array on driver shutdown
only on reset
add mei_hbm_reset function that wraps the hbm cleanup

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


# 04dd3661 31-Mar-2014 Alexander Usyskin <alexander.usyskin@intel.com>

mei: extract fw status registers

Fetch FW status registers, as they are important in
in understanding of FW reset reasons

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>


# a532bbed 18-Mar-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: add function to check write queues

The driver needs to check whether the write
queue idle before entering power gating

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>


# 964a2331 18-Mar-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: expose hardware power gating state to mei layer

Since the runtime pm and the internal power gating
cannot be in complete sync in regards to I/O
operations, we need to expose the device
hardware internal power gating state to mei layer

2. We add pg_state handler that translate the hw
internal pg state to mei layer

2. We add power gating event variable to keep
power track of power gating transitions

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


# 4fcbc99b 18-Mar-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: implement power gating isolation hbm layer

Add send message functions and receive dispatch stubs
for power gating isolation hbm protocol.

The protocol consist of requests for entering and exiting
the power gating isolation state and their responses.

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>


# 48705693 17-Feb-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: Remove all bus devices from the mei_dev list when stopping the MEI

When stopping the MEI, we should remove and potentially unregister
all bus devices queued on the mei_dev linked list.

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


# 6bb948c9 12-Feb-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: get rid of ext_msg

Use more standard message writing for
oob data.

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


# 7d93e58d 14-Jan-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: allow multiple retries if the hw reset has failed

In some rare case mei hw reset may take long time to settle.
Instead of blocking resume flow we span another driver reset flow in
separate work context

This allows as to shorten hw reset timeout to something more acceptable
by DPM_WATCHDOG_TIMEOUT

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>


# 6adb8efb 11-Jan-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: limit the number of consecutive resets

give up reseting after 3 unsuccessful tries

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>


# 33ec0826 11-Jan-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp mei reset state machine

1. MEI_DEV_RESETTING device state spans only hardware reset flow
while starting dev state is saved into a local variable for further
reference, this let us to reduce big if statements in case we
are trying to avoid nested resets

2. During initializations if the reset ended in MEI_DEV_DISABLED device
state we bail out with -ENODEV

3. Remove redundant interrupts_enabled parameter as this
can be deduced from the starting dev_state

4. mei_reset propagates error code to the caller

5. Add mei_restart function to wrap the pci resume

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>


# 66ae460b 08-Jan-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: use hbm idle state to prevent spurious resets

When reset is caused by hbm protocol mismatch or timeout
we might end up in an endless reset loop and hbm protocol
will never sync

Cc: <stable@vger.kernel.org>
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>


# 544f9460 08-Jan-2014 Tomas Winkler <tomas.winkler@intel.com>

mei: do not run reset flow from the interrupt thread

This fixes a potential deadlock in case of a firmware
initiated reset

mei_reset has a dialog with the interrupt thread hence
it has to be run from an another work item

Most of the mei_resets were called from mei_hbm_dispatch
which is called in interrupt thread context so this
function underwent major revamp. The error code is
propagated to the interrupt thread and if needed
the reset is scheduled from there.

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>


# dc844b0d 11-Nov-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: remove flash_work_queue

Cancel each work properly and remove flash_work_queue.

Quoting documentation:

In most situations flushing the entire workqueue is overkill; you merely
need to know that a particular work item isn't queued and isn't running.
In such cases you should use cancel_delayed_work_sync() or
cancel_work_sync() instead.

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


# f931f4f3 21-Oct-2013 Alexander Usyskin <alexander.usyskin@intel.com>

mei: print correct device state during unexpected reset

Move the unexpected state print to the beginning of mei_reset,
thus printing right state.

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>


# eec86b8e 17-Oct-2013 Alexander Usyskin <alexander.usyskin@intel.com>

mei: move host_clients_map cleanup to device init

Move host_clients_map cleanup from host client init to device init.

This fixes bug where we cleaned up the bitmask that servers as pool for
host client ids while file descriptors are kept open during suspend.
On resume a new connection will be assigned id that is already taken
by opened file descriptor. Consequently read/write will fail due to
mismatched book keeping.

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>


# 22f96a0e 16-Sep-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp open handler counts

Make open counter to be incremented and decremented
from mei_cl_link and mei_cl_unlik function respectively

Nfc was assuming symmetric linking API and thus open handler
count was never decreased. This patch fixes that.
We need to add separate open hander count for amthif which
is handled out of link/unlink functions and doesn't break
the symmetric API.

Last we do not waste clients slots if amthif or wd are not present
in the device. we don't need to allocates slots ahead
it is all covered by link/unlink before the devices is responding
to user space connection and thus not racing on allocation

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


# 4a704575 02-Sep-2013 Alexander Usyskin <alexander.usyskin@intel.com>

mei: cancel stall timers in mei_reset

Unset init_clients_timer and amthif_stall_timers
in mei_reset in order to cancel timer ticking and hence
avoid recursive reset calls.

Cc: <stable@vger.kernel.org> # 3.9+
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>


# 99f22c4e 17-Jul-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: don't have to clean the state on power up

When powering up, we don't have to clean up the device state
nothing is connected.

Tested-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


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

mei: check whether hw start has succeeded

hw start may fail therefore the reset flow has
to check for the return value

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


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

mei: check if the hardware reset succeeded

The hw may have multiple steps for resetting
so we need to check if it has really succeeded.

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


# 2c9b48ac 16-Jun-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: support HBM versioning

Driver can work properly if device support driver HBM version
or driver can downgrade its supported HBM version level

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


# 5e85b364 10-Jun-2013 Samuel Ortiz <sameo@linux.intel.com>

mei: init: Flush scheduled work before resetting the device

Flushing pending work items before resetting the device makes more
sense than doing so afterwards. Some of them, like e.g. the NFC
initialization one, find themselves with client IDs changed after
the reset, eventually leading to trigger a client.c:mei_me_cl_by_id()
warning after a few modprobe/rmmod cycles.

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


# 8b513d0c 21-May-2013 Masanari Iida <standby24x7@gmail.com>

treewide: Fix typo in printk

Correct spelling typo in various part of drivers

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 0cfee51c 19-Apr-2013 Bill Nottingham <notting@redhat.com>

mei: reseting -> resetting

This enum leaks out to userspace via error messages, so fix the spelling.

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


# 9b0d5efc 18-Apr-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp hbm state machine

1. Rename init_clients_state to hbm_state and use
MEI_HBM_ prefix for HBM states

2. Remove recvd_msg and use hbm state for synchronizing
hbm protocol has successful start.
We can wake up the hbm event from start response handler
and remove the hack from the interrupt thread

3. mei_hbm_start_wait function encapsulate start completion
waiting

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


# 59fcd7c6 10-Apr-2013 Samuel Ortiz <sameo@linux.intel.com>

mei: nfc: Initial nfc implementation

NFC ME device is exported through the MEI bus to be consumed by the
NFC subsystem.

NFC is represented by two mei clients: An info one and the actual
NFC one. In order to properly build the ME id we first need to retrieve
the firmware information from the info client and then disconnect from it.

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


# a7b71bc0 27-Mar-2013 Samuel Ortiz <sameo@linux.intel.com>

mei: bus: Add bus related structures to mei_cl

We keep track of all MEI devices on the bus through a specific linked list.
We also have a mei_device instance in the mei_cl structure.

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


# 40e0b67b 27-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move mei-me to separate module

mei layer provides host bus message layer, client management,
and os interface

mei-me - provides access to ME hardware through
the pci bus

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


# c4d589be 27-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: rename function mei_hw_init to mei_start

The hw initialization is now done as part of
hw specific code this makes the name mei_hw_init little misleading.

We rename it to mei_start in spirit of already existing
functions mei_stop and mei_reset.

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


# d0265f12 27-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: ME structures should be initialized in mei_device_init

mei_timer and mei_host_client_init belongs to mei framework
and are not ME hw specific.
AMTHIF and WD are available only for ME but are above the hardware layer
so move the initialization back from mei_me_dev_init to mei_device_init.

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


# 2e647124 27-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: unregister watchdog from mei_stop function

we need to unregister watchdog device both in suspend and remove
as the registration is recreated on reset

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


# cea6aec4 27-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: drop RECOVERING_FROM_RESET device state

ECOVERING_FROM_RESET device state is never set
we can remove it

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


# 7cb035d9 10-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: add mei_stop function to stop mei device

mei_stop calls mei_reset with disabling the interrupts.
It will have the same effect as the open code it replaces in the mei_remove.

The reset sequence on remove is required for the Lynx Point LP devices
to clean the reset state.

mei_stop is called from mei_pci_suspend and mei_remove functions

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


# aafae7ec 11-Mar-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: add hw start callback

This callback wraps up hardware dependent details
of the hardware initialization.

This callback also contains host ready setting
so we can remove host_set_ready callback

In ME we switch to waiting on event so
we can streamline the initialization flow.

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>


# 827eef51 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: separate compilation of the ME hardware specifics

We add struct mei_hw_ops to virtualize access to hw specific
configurations. This allows us to separate the compilation
of the ME interface from the ME hardware specifics

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


# 52c34561 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: initial extract of ME hw specifics from mei_device

This is initial step of move the ME hw specifics
out of mei_device structure into mei_me_hw

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


# 627ca757 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move work initialization to mei_device_init

Let mei_device_init initialize all the software constructs.

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


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

mei: make host csr and me csr internal to hw-me

Move csr reading into me hardware functional calls.
Since we gave up on registers caching we remove some of the unnecessary
queries in mei_hw_init ane mei_reset functions.

We add mei_hw_config function to wrap up host buffer depth configuration.

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


# 115ba28c 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: abstract host and device readieness

Add mei_host_set_ready function to enable the device
and is_ready function to query the host and me readiness

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


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

mei: don't use cached value for hcsr in mei_hw_reset

Open code mei_hw_reset to avoid using cached hcsr.
Using cached hcsr can cause unwanted side effects.

Move mei_hw_restet function to hw-me.c as it is hw dependent

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


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

mei: remove write only need_reset member of struct mei_device

need_reset is not used anymore

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


# 6222f7bf 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move MEI_IAMTHIF_IDLE to amthif host init function

Since the amthif state is not examined until amthif is connected
we can safely move it to the amthif host init function

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>


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

mei: move me client storage allocation to hbm.c

rename function to mei_me_cl_allocate to match the current
names convention: mei_hbm_me_cl_allocate

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


# 9dc64d6a 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: rename interface to hw-me

Rename hw-me.h to hw-me-regs.h as this file
contains only register definitions.
Files hw-me.[ch] now contains ME hw dependant
functionality

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>


# 9ca9050b 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: move client functions to client.c

This file now contains me and host client functions
and also io callback helpers
We also kill iorw.c which is no longer needed

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


# 0edb23fc 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com>

mei: add new hbm.h header to export hbm protocol

hbm.h provides access host bus messaging functionality
for other MEI layers

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


# 8120e720 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: add common prefix to hbm function

1. use mei_hbm_ for basic host bus message function
2. use mei_hbm_cl prefix for host bus messages that operation
on behalf of a client

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


# bb1b0133 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: move host bus message handling to hbm.c

for sake of more layered design we move host
bus message handling to the new hbm.c file

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


# 3a65dd4e 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: move hw dependent functions to interface.c

1. move direct register handling to interface.c and make them static
2. add new function mei_clear_interrupts that wraps direct register
access
3. export other functions in mei_dev.h

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


# 47a73801 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: include local headers after the system ones

first include linux/mei.h then only local headers
to avoid possible false dependencies

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


# 438763f3 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: drop redundant length parameter from mei_write_message function

The length is already part of the message header and it is validated
before the function call

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


# c1174c0e 18-Nov-2012 Samuel Ortiz <sameo@linux.intel.com>

mei: Simplify the ME client enumeration code

After enumerating all ME clients we call the client init functions for
all matching UUIDs from a separate context.
This remove the hackish cascading client initialisation process that was
interleaving properties and connection command replies.

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


# 5fb54fb4 18-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: use structured buffer for extra write buffer

The structure of the message is static so we don't have
to use and cast the buffer. We can also drop extra_write_index
variable as this information can be extracted directly
from the message header

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


# 5bd64714 18-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: compact code for mei bus message creation

1. replace boilerplate code for filling up the bus message header
with a common wrapper function
2. shorten variable names and use temporal variables
to save some screen space

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


# ff8b2f4e 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: use link and unlink terms for connecting ME and HOST client

1. rename mei_me_cl_update_filext to mei_me_cl_link
2. rename mei_remove_client_from_file_list to mei_me_cl_unlink

Code style, documenation, and usage of both function is updated

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


# 4b8960b4 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: rename enum mei_cb_major_types to enum mei_cb_file_ops

1. Rename mei_cb_major_types to more understandable mei_cb_file_ops
2. Rename member struct mei_cl_cb of this type to simple 'fop_type'
3. Add kernel doc for the type

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


# db3ed431 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: use type struct mei_cl *cl instead of void in struct mei_cb

We can use correct type 'struct mei_cl' instead of
'void *' for file_private in the struct mei_cb
as there is no other type assigned to this member of the structure

We rename the member from file_private to cl

Remove about 10 lines of declarations of temporary variables
used for type casting

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


# e773efc4 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: amthif: prefix cb list with amthif

amthif cb list were prefixed with amthi_ instead
if amthif.

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


# c7d3df35 01-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: use internal watchdog device registration tracking

remove bool wd_interface_reg as watchdog device already
keeps track of its registration

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


# 19838fb8 01-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: extract AMTHI functions into the amthif.c file

Move AMT Host Interface functions into the new amthif.c file.
All functions has now common prefix: mei_amthif_

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


# 3870c320 01-Nov-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: normalize timeouts definitions

1. The hardware book defines timeouts in seconds
so we stick to this and define the wrapper function
mei_secs_to_jiffies around msecs_to_jiffies
to use be used instead multiplying by HZ

2. We add name space prefix MEI_ to all timer defines

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


# 664df38b 11-Oct-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: use mei_io_cb_ warppers also for control flows

move the mei_io_cb_ wrappers to to iorw.c for global use
and use them also for handling control flows

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


# 601a1efa 09-Oct-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: rename mei_free_cb_private to mei_io_cb_free

1. cb_private was an old name that we depriacated in earlier
cleanups

2. we also group the funcion declaration with other _io_
functions

3. Don't check cb for NULL as mei_io_cb_free is NULL safe

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


# fb601adb 14-Oct-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: kill usless struct mei_io_list

kill useless mei_io_list list wrapper and use directly
struct mei_cl_cb mei_cb which was its only member for managing io queues

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


# c216fdeb 16-Aug-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: wd: decouple and revamp watchdog state machine

Before ME watchdog was exported through standard watchdog interface
it was closed and started together with the mei device.

The major issue is that closing ME watchdog disabled also MEI device,
to fix this the watchdog state machine has to be independent from MEI
state machine.

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


# b210d750 06-Aug-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: name space for mei device state

1. add MEI_DEV_ prefix for mei device state enums
2. rename mei_state to dev_state
3. add constant to string translation for debug purposes

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


# 07b509b7 23-Jul-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: revamp me client search function

me client search functions returns index
into me_client array according me client id
or me client uuid.

1. Add common prefix for the functions mei_me_cl_<>
2. create new function mei_me_cl_by_id that wraps open
coded loops scattered over the code
3. rename mei_find_me_client_index to mei_me_cl_by_uuid
4. rename mei_find_me_client_update_filext to
mei_me_cl_update_filext and updates its parameter names

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


# d242a0af 04-Jul-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: remove write only wariable wd_due_counter

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


# 24aadc80 25-Jun-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: don't query HCSR for host buffer depth

1. We record host (write) buffer depth during reset
so we don't need to query HCSR register later on.
The host buffer depth doesn't change after the reset
2. Use mei_hbuf_max_data function to compute payload size in bytes

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


# 4f3afe1d 09-May-2012 Tomas Winkler <tomas.winkler@intel.com>

mei: export mei.h for the user space

The header exports API for application layer

1. move under include/linux and add to the export list
2. update include path n the sources
3. update TODO

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


# ffc2825c 01-May-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Staging: mei: move the mei code out of staging

It's been cleaned up, and there's nothing else left to do, so move it
out of staging into drivers/misc/ where all can use it now.

Cc: Tomas Winkler <tomas.winkler@intel.com>
Cc: Oren Weil <oren.jer.weil@intel.com>
Cc: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>