[go: nahoru, domu]

History log of /drivers/misc/mei/mei_dev.h
Revision Date Author Comments
ce23139c6c2ee92d5eace20f6f10d716cf295a5b 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>
a8605ea2c20c2b97a54d7746c16ebef5ba29632a 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>
764c065a65c31a09340e71d2c41652e7e05bf083 29-Sep-2014 Alexander Usyskin <alexander.usyskin@intel.com> mei: drop me_client_presentation_num

me_client_presentation_num field is not used for any
particular purpose now, so it can be safely 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>
4ad96db6ccdd8b777cff5fd4aa74ec1e86f1afce 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com> mei: push pci cfg structure me hw

Device specific configurations are currently only needed by me hw
so we can remove it from txe

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d08b8fc0dbdbe9bf7edeb46f7a856f993630664f 29-Sep-2014 Tomas Winkler <tomas.winkler@intel.com> mei: remove the reference to pdev from mei_device

For purpose of adding testing HW we would like
to get rid of pci dependency in generic mei code.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1bd30b6a42610466bae2c133e68a8feb1004929c 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>
3a7e9b6c661a23429b4a106d1ffa8aa5ce6c62bb 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>
1beeb4b9fbb27432f93ae8fe157228b7b897974a 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>
bae1cc7d41fd3048f55c21a6e59c35a3f0abaafe 21-Aug-2014 Tomas Winkler <tomas.winkler@intel.com> mei: extract supported features from the hbm version

extract supported hbm features and commands from the hbm version

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cb02efc3a6e96a0dc4aba8ebf0c1136b72fbe8ba 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>
5a8373fba0ab2cec8d206747ad60ca4a30821a37 21-Aug-2014 Tomas Winkler <tomas.winkler@intel.com> mei: use disconnect name consistently

Rename mei_cl_irq_close to mei_cl_irq_disconnect
and MEI_FOP_CLOSE to MEI_FOP_DISCONNECT
Remove unused MEI_FOP_OPEN

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
d880f3294d0576e79dfab4e2cd5a2eb62fe188f0 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>
5ca2d3882d60c040285d0b45df731e11f5da7c64 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>
8f642155c5ddafe1247c085f3f0c7b4e63044878 20-Jul-2014 Alexander Usyskin <alexander.usyskin@intel.com> mei: drop unused hw dependent fw status functions

We introduced unified FW status function in patch
mei: add per device configuration (lkml.org/lkml/2014/5/12/607)

This change made hw_ops functions unused and obsolete
therefore we remove these functions from source 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>
f3d8e8788b4efbd13b6e888e85af51385d87d306 23-Jun-2014 Alexander Usyskin <alexander.usyskin@intel.com> mei: move from misc to char device

We need to support more then one mei interface
hence the simple misc devices is not longer an option

In order not break the user space a device with pci function 0
need to be linked to /dev/mei

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>
c919951d940f28b3b9eb208e289faa27f4bc4678 13-May-2014 Tomas Winkler <tomas.winkler@intel.com> mei: me: move probe quirk to cfg structure

Move quirk FW type detector to cfg structure

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>
8d929d4862fdfc4a524fd4c799b8dfa3b187fe8c 13-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>
04dd36619564c3fcf590c2bf2619b14c09cd0749 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>
e13fa90ce42d8e7ee501426ea414c8ae4a5366ef 18-Mar-2014 Tomas Winkler <tomas.winkler@intel.com> mei: me: use runtime PG pm domain for non wakeable devices

For non wakeable devices we can't use pci runtime framework
as we are not able to wakeup from D3 states.
Instead we create new pg runtime domain that only drives ME power
gating protocol to reduce the power consumption.

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>
a532bbedc85ff3b834ba81e49163a3f543be1775 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>
964a2331e9a207fc15ef9eef833212347498bea1 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>
ee7e5afd2c369b64ffcf419d38ce7ad1c709a53e 18-Mar-2014 Tomas Winkler <tomas.winkler@intel.com> mei: condition PGI support on HW and HBM version

Enable power gating isolation only if hw and fw support it.
This is indicated by ME_PGIC_HRA bit in ME_CSR_HA register
and on HBM protocol version.

The information is exported to MEI layer through
new pg_is_enabled hw op.

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>
4fcbc99b7565f915bea58e14b5e6f089bf9abf16 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>
d63b30954cba971377ce51d9df16949572bc1289 16-Mar-2014 Tomas Winkler <tomas.winkler@intel.com> mei: fix Unnecessary space after function pointer name

Fix checkpatch warining:
Unnecessary space after function pointer name

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6e4cd27a35622cddbe6c0d6fbeb9da8c232029d1 11-Mar-2014 Tomas Winkler <tomas.winkler@intel.com> mei: make me hw headers private to me hw.

Remove includes of me-hw.h and me-hw-regs.h headers from
the mei generic code.
The mei layer should not depend on hw specific headers

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9d098192c3d45ab6dd90ae87d649950a9ef70ccb 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>
6aae48ff18f2fcfb533d2b448ecae16d1de006c1 19-Feb-2014 Tomas Winkler <tomas.winkler@intel.com> mei: add mei_hbuf_acquire wrapper

A client has to acquire host buffer
before writing, we add lock like wrapper
to replace the code snippet

if (dev->hbuf_is_ready)
dev->hbuf_is_ready = false;

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
64092858acfd995fae0def466126692423c30828 17-Feb-2014 Tomas Winkler <tomas.winkler@intel.com> mei: wd and amthif use mei_cl_ api for dis/connection

Connect wd and amthif through regular mei_cl_connect API
as there is no reason to connect in asynchronous mode.
Also use mei_cl_is_connected in order to protect flows
instead of depending on wd_pending and amthif_timer

Now we can remove all the special handling in hbm layer

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>
487056932d372cc4f6c636f21a928d6667b151d7 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>
6bb948c9e500d24321c36c67c81daf8d1a7e561e 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>
02a7eecc6ee565f5f3af836d56fe25bafcc49c98 12-Feb-2014 Tomas Winkler <tomas.winkler@intel.com> mei: rename MEI_FOP_IOCTL to MEI_FOP_CONNECT

This operation actually only support connection
and not a generic ioctl

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6adb8efb024a7e413b93b22848fc13395b1a438a 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>
33ec0826314734fc4f3c9bf37d12e98063339b31 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>
83ce07411dc2316aaaf95a0f193fa2fd76e2e739 08-Jan-2014 Alexander Usyskin <alexander.usyskin@intel.com> mei: fix syntax in comments and debug output

Fix syntax errors in comments and debug strings

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>
544f94601409653f07ae6e22d4a39e3a90dceead 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>
479327fc42737234a1f76f20010334c99110d256 17-Dec-2013 Tomas Winkler <tomas.winkler@intel.com> mei: enable marking internal commands

Set hbm header bit 30 for internal commands
This mark commands that are generated by
the device driver

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10ee90743e99fb06a0881a35731263c1845275dd 11-Nov-2013 Tomas Winkler <tomas.winkler@intel.com> mei: cleanup mei_irq_read_handler

1. Simplify function flow
2. Display errors in error or warnings level instead of debug.
3. Remove excessive debug messages

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
dc844b0d99b8533d6174e5b9a369f7c2cdacfe66 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>
22f96a0eb6c62b570621d77dacbf2589a6de2997 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>
1aee351a739153529fbb98ee461777b2abd5e1c9 02-Sep-2013 Tomas Winkler <tomas.winkler@intel.com> mei: make me client counters less error prone

1. u8 counters are prone to hard to detect overflow:
make them unsigned long to match bit_ functions argument type

2. don't check me_clients_num for negativity, it is unsigned.

3. init all the me client counters from one place

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>
9049f7932109f3fe189ffa8028f2e23f06a9bd0b 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>
c20c68d535409f2ff000415d5e0578529c016521 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>
7131799b145aa67984cc57e52d6379862c78afa3 23-May-2013 Tomas Winkler <tomas.winkler@intel.com> mei: deprecate the mei_wd_state_independence_msg

wd independence is deprecated, remove it.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
6220d6a05089220d913701416ab9423af23cd1bb 12-May-2013 Tomas Winkler <tomas.winkler@intel.com> mei: revamp interrupt thread handlers

1. Use common prefix mei_cl_irq_ and common parameter list
for client handlers.
2. Update function kdocs

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
0cfee51c7c1fa47d81b3d116df3b53c586aac422 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>
5ceb46e25d727f198c1efe281d19653962a51931 19-Apr-2013 Tomas Winkler <tomas.winkler@intel.com> mei: revamp mei_amthif_irq_read_message

Rename the function to mei_amthif_irq_read_msg
and change parameters order

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9b0d5efc421ac79d9a6d97c681eff93288093784 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>
59fcd7c63abf0340f551f487264b67ff5f7a0b86 11-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>
e46980a10a76ec3282dd6832c1974b880acd23d3 09-Apr-2013 Samuel Ortiz <sameo@linux.intel.com> mei: bus: Add device enabling and disabling API

It should be left to the drivers to enable and disable the device on the
MEI bus when e.g getting probed.
For drivers to be able to safely call the enable and disable hooks, the
mei_cl_ops must be set before it's probed and thus this should happen
before registering the device on the MEI bus. Hence the mei_cl_add_device()
prototype change.

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>
4234a6deb5ab04e50cfd6d72761345727bd2de21 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>
30e53bb8ffb1f3270ad89196d9799057008d9537 05-Apr-2013 Tomas Winkler <tomas.winkler@intel.com> mei: add debugfs hooks

debugfs exposes device state and list of me clients and their
properties

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
44d88d919261256e3bd999cde05572c8c4afb642 27-Mar-2013 Samuel Ortiz <sameo@linux.intel.com> mei: bus: Synchronous API for the data transmission

Define a truly synchronous API for the bus Tx path by putting all pending
request to the write list and wait for the interrupt tx handler to wake
us up.
The ___mei_cl_send() out path is also slightly reworked to make it look more
like main.c:mei_write().

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>
cf3baefba04073237decb1b8a8c114b0b45bfc80 27-Mar-2013 Samuel Ortiz <sameo@linux.intel.com> mei: bus: Call bus routines from the core code

Register the MEI bus type against the kernel core bus APIs and
call the bus Rx handler from interrupt.c

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>
a7b71bc043aded9da4cf51f85271e0779161fe22 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>
3e8332952dedd2c17bb497e3909e3b6fbac10ce7 27-Mar-2013 Samuel Ortiz <sameo@linux.intel.com> mei: bus: Initial implementation for I/O routines

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>
e5354107e14755991da82e0d2a4791db92908d9d 27-Mar-2013 Samuel Ortiz <sameo@linux.intel.com> mei: bus: Initial MEI Client bus type implementation

mei client bus will present some of the mei clients
as devices for other standard subsystems

Implement the probe, remove, match, device addtion routines, along with
the sysfs and uevent ones. mei_cl_device_id is also added to
mod_devicetable.h
A mei-cleint-bus.txt document describing the rationale and the API usage
is also added while ABI/testing/sysfs-bus-mei describeis the modalias ABI.

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>
c4d589be4405d475f7b529134debdf37f1ada957 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>
cea6aec451586afef2bace28d08145a869131b5b 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>
4c6e22b8a93ef038b70661e590de250a09417af7 17-Mar-2013 Tomas Winkler <tomas.winkler@intel.com> mei: add mei_irq_compl_handler function

similar to read/write add also irq completion handler
that is called for the irq thread

rename missnamed mei_irq_complete_handler to
mei_cl_complete_handler as it operates on a single client

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
7cb035d9e619a8d20f5d3b9791f8cb5160d19e70 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>
aafae7ecd80181983403de13db0b4895acdc233d 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>
c8c8d080ed94cea6757f2d781b6e360a74b256fd 11-Mar-2013 Tomas Winkler <tomas.winkler@intel.com> mei: revamp mei_data2slots

1. Move the mei_data2slots to mei_dev.h as it will be used
by the all supported HW.
2. Change return value from u8 to u32 to catch possible overflows
3. Eliminate computing the slots number twice in the same function

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
330dd7da5ec80e2c49c66bf353d8b4fa4fb8f5a9 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com> mei: rename to mei_host_buffer_is_empty to hbuf_is_ready

we rename the mei_host_buffer_is_empty to keep naming
convention of hbuf and also make the query more generic
to be correct also for other under laying hardware

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
06ecd6459800962155c485e27d9dd30268b579bf 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com> mei: move interrupt handlers to be me hw specific

interrupt handler are platform specifics so we move
them to hw-mei.c. For sake of that we need to export
write, read, and complete handlers from the interrupt.c

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
827eef51f8dd9a4ab62b4ad270c15472f46938f2 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>
52c34561415b420301f1580413a9d1891d079494 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>
2703d4b2e673cc240ad06d79d131fd1d0f77d65d 06-Feb-2013 Tomas Winkler <tomas.winkler@intel.com> mei: sperate interface and pci code into two files

leave misc file operations in the main
and move PCI related code into pci-me

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
e7e0c231aaa7a01df28634390381974cb76d3cb2 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>
88eb99f29c0026f4b7d7702652eb529f04c69073 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: reenable mei_hcsr_set abstraction

Now when mei_hcsr_set is local to hw-me.c
we can benefit form the fact that it wraps
H_IS removal from the host csr.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
115ba28c5e075c6bffd8106a2b5e23db88d0c3b5 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>
adfba3220b625ce4bee08e7e6f48c8a27aac23bb 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>
528c8eb4e7c08c5531533de62a558aaf3d076ebb 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: remove mei_csr_clear_his prototype

The function mei_csr_clear_his is not implemented

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a9f6b133ab97bd481d82731a30b7d4a90427f56a 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>
781d0d89224bbbc438c2c0360cfd4822bb35d280 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>
1a1aca42c989051dce34d49b4e04a25dafe01d74 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: rename remaining amthi strings to amthif

the only real thing that left was mei_amthi_guid
the rest was in the strings and comments

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
038c8a6ebc50ec981557f02197ed2dc5795c40fb 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: mei_dev.h - remove prototypes of dropped functions

mei_task_initialize_clients and mei_initialize_clients
are no longer among us

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a40b260da6d96ab5231ebdabd06e70568ca81885 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>
d91aaed30a938c5daae2641e6758dfab8727862e 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: drop read_pending member form struct mei_cl

read_pending never changes, it is a leftover from the old code.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9dc64d6a26b016df52d222abe9279a92d9f7cc4c 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>
37e7d6e74f2e80196410f6e5c7533d99fe9aa9d1 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: move watchdog prototypes to mei_dev.h from interface.h

interface.h contains lower layer functionality

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9f81abdac3629629a246fdc9e2a7c01ffd52ce8a 08-Jan-2013 Tomas Winkler <tomas.winkler@intel.com> mei: implement mei_cl_connect function

Implement mei_cl_connect that warps host client
parts of the connection and leave the ioctl specifics
in the mei_ioctl_connect_client function.
Move mei_ioctl_connect_client to main.c where it
belongs

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
90e0b5f18569bdd03c5ddd1d8c99946f42af77b8 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>
0edb23fc3451c84350edcc999c023d225a49530d 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>
6bbda15f279ec99c4ac0d56c4ad680299d0b768b 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: move hbm responses from interrupt.c to hbm.c

1. Add common prefix mei_hbm_ to all handlers
and made them static
2. Drop now useless function same_flow_addr

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8120e7201cf9795bc98ffb2e3064b657c0f34c05 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>
e46f187487a8c28e64417e51ba628746a5397838 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: use structured buffer for the write buffer

We can drop useless castings and use proper types.
We remove the casting in mei_hbm_hdr function
and add new function mei_hbm_stop_request_prepare that
utilize the new structure

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2efdf54603806cba681f7a09ec6c6205bddfd9a9 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: drop nonexistent function prototype

mei_amthif_read_message prototype was not dropped
in one of the moving/renaming patches

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
bb1b0133b3780987c2c74f267e294d016f9fa04c 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>
3a65dd4ea32c3e3a3befec58ad20d1c96580834e 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>
db7da79df1a9eafb4f07653bf9011537325a9b62 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: mei_me_client is not hw API move to mei_dev.h

Move struct mei_me_client from hw.h to mei_dev.h as it is not
part of the hardware API. The structutre doesn't have to
be packed. Add kdoc for this structure.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fecb0d584ee96fb2ab3c65825029a66a23ee7e31 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: kill not used BAR0 length and base variables

1. mem_base and mem_length are not used so we can delete
them
2. add kdoc for mem_addr member of mei_device

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
66ef5ea9b0984110eb62f46c40932d49707f89bb 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: extract device dependent constants into hw-me.h

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1d3f3da3e20b154eecf840c2e589130868a98634 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: move internal host clients ids to mei_dev.h from hw.h

Internal clients numbers are implementation choice
and not defined by the hardware.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
15d4acc57f23b6e02e587b773458a7c0e23e501d 25-Dec-2012 Tomas Winkler <tomas.winkler@intel.com> mei: use unified format for printing mei message header

Introduce MEI_HDR_FMT and MEI_HDR_PRM macros.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c1174c0edf546805a0ebc10d5d6154edbb56e1cf 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>
24c656e55f3985b6f5c0e2264243f7076f376193 18-Nov-2012 Tomas Winkler <tomas.winkler@intel.com> mei: streamline amthif write complete function

Rename the function mei_amthif_irq_process_completed
to mei_amthif_irq_write_complete
Remove cl from the parameter list as it
can be extracted from cb block.
Extract the common flow from if statements
and document the logic properly

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
5fb54fb456f77128f817ab3491d6b131bec480b5 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>
5bd647144151082f0e8beb58741e27e6dbd23827 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>
ff8b2f4e424a489222d3c7d55fb2d04c9639ef98 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>
744f0f2f424d374b233cea5f9b34caa851543755 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com> mei: extract amthif specific code from mei_poll to mei_amthif_poll

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
a562d5c25aa48c23774ab8d60bfd3bbcbca4bf1d 11-Nov-2012 Tomas Winkler <tomas.winkler@intel.com> mei: move amthif specific release code to amithif

Move amthif code part into separate function
mei_amthif_release.
Also helper functions mei_clear_list and mei_clear_lists
are moved along

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4b8960b492360c115f8214ec116f469338ac2734 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>
db3ed43185c6f5d4fd6c5ac963347b849540996e 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>
e773efc405026bb8540c84bf45420bd66d5b34a7 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>
c7d3df354dcb7477900b29a1200744a8c976c03a 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>
19838fb85306905a373b6449c1428791d653fc21 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>
3870c3206b96c900ce29c8068bd5ad46fae71f5b 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>
664df38b3c74656261d4227b4dd380cfa453f78f 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>
601a1efa630aab0ca72bf8d638c441a09654b250 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>
fb601adb350f82738210c0a1dc6af928a15391db 15-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>
ebb108ef93605a68f6f38d5eb407e7d5138e8028 09-Oct-2012 Tomas Winkler <tomas.winkler@intel.com> mei: rename mei_cl_cb.information to mei_cl_cb.buf_idx

rename 'information' member of the struct mei_cl_cb to
more self-descriptive 'buf_idx'

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
f060939d7c86344a071b03d892903f47028329cb 10-Sep-2012 Tomas Winkler <tomas.winkler@intel.com> mei: struct mei_message_data doesn't have to be packed

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1e2776c3aff1a4c79751b2a7045524fb141c2405 23-Aug-2012 Tomas Winkler <tomas.winkler@intel.com> mei: fix max number of open handles

There was internal confusion in wether bus message
clinet (0) is counted in or not

The bitmap me_clients_map that accomodate
was initialized w/o it (255) but later on it
the clinet 0 was reserved

Thus were able to open only 252 instead of 253 clients

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
daed6b5e78c11f34f08cc2bc1640b7f248884cee 17-Aug-2012 Tomas Winkler <tomas.winkler@intel.com> mei: rename struct pci_dev *mei_device to mei_pdev

1. rename mei_device variable to mei_pdev to remove
confusion with type 'struct mei_device'
2. mei_pdev no longer need to be gloabal so make it static
and remove the declaration from the header file

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
c216fdeb2e7371554c56ba457c374cce9c77f91a 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>
248ffdf7c95726a8dae76e25fdb037899c5b77fa 16-Aug-2012 Tomas Winkler <tomas.winkler@intel.com> mei: wd: rename watchdog constants to be more descriptive

1. rename defines to more be descriptive
2. remove duplicated defines from interface.h
3. add common prefix MEI_

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
b210d7506f416e7250eb52c314e5ed08928639dd 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>
07b509b7943e5594f3f228e5b62a49cf6a033709 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>
d242a0afb2e5bf1db83c6a0504e55addef425e61 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>
4a0d6a74638f44055ea536abdd428007e5f2f89e 04-Jul-2012 Tomas Winkler <tomas.winkler@intel.com> mei: mei_device can be const for mei register access functions

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
24aadc809f270857743e62d0882865fb3ba195d9 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>
21c66d1be7c586b56c2902ada4ba030a12b00063 19-Jun-2012 Tomas Winkler <tomas.winkler@intel.com> mei: group wd_interface_reg with watchdog variables within struct mei_device

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4f3afe1d8c8e5dc41bb5820c01b4f3cfc2dc1205 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>
ffc2825c2942b57c5dbfbcb3ad798696438aed62 02-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>