summaryrefslogtreecommitdiffstats
path: root/drivers/misc/mei/amthif.c
Commit message (Collapse)AuthorAgeFilesLines
* mei: amthif: fix checkpatch errorTomas Winkler2014-03-171-2/+1Star
| | | | | | | | | ERROR: else should follow close brace '}' + } + else { Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: report consistently copy_from/to_user failuresAlexander Usyskin2014-03-171-1/+3
| | | | | | | | | Consistently display error on possible copy_from/to_user failures use dev_dbg so it cannot be abused to flood the kernel log Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: make me hw headers private to me hw.Tomas Winkler2014-03-171-1/+0Star
| | | | | | | | | 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>
* mei: make return values consistent across the driverAlexander Usyskin2014-03-011-7/+5Star
| | | | | | | | | | | | 1. Propagate ENOTTY to user space if the client is not present in the system 2. Use ETIME consistently on timeouts 3. Return EIO on write failures 4. Return ENODEV on recoverable device failures such as resets 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>
* mei: revamp writing slot countingTomas Winkler2014-03-011-9/+10
| | | | | | | | | | 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>
* mei: add mei_hbuf_acquire wrapperTomas Winkler2014-03-011-6/+1Star
| | | | | | | | | | | | 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>
* mei: don't of list_for_each_entry_safe when not deletingTomas Winkler2014-02-181-7/+5Star
| | | | | | | | We can use simply list_for_each_entry if there is no entry removal Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: wd and amthif use mei_cl_ api for dis/connectionTomas Winkler2014-02-181-8/+5Star
| | | | | | | | | | | | | 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>
* mei: rename MEI_FOP_IOCTL to MEI_FOP_CONNECTTomas Winkler2014-02-141-1/+1
| | | | | | | | 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>
* drivers/misc: delete non-required instances of include <linux/init.h>Paul Gortmaker2014-02-081-1/+0Star
| | | | | | | | | | | | None of these files are actually using any __init type directives and hence don't need to include <linux/init.h>. Most are just a left over from __devinit and __cpuinit removal, or simply due to code getting copied from one driver to the next. Cc: Arnd Bergmann <arnd@arndb.de> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: fix syntax in comments and debug outputAlexander Usyskin2014-01-091-2/+2
| | | | | | | | 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>
* mei: enable marking internal commandsTomas Winkler2013-12-191-0/+2
| | | | | | | | | 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>
* mei: amthif: mei_amthif_host_init: propagate errors from called functionsTomas Winkler2013-10-041-4/+7
| | | | | | | propagate error codes from called functions, they are correct. Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: revamp open handler countsTomas Winkler2013-10-041-2/+3
| | | | | | | | | | | | | | | | | | | 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>
* Merge 3.12-rc3 into char-misc-nextGreg Kroah-Hartman2013-09-301-0/+1
|\ | | | | | | | | | | | | We need/want the mei fixes in here so we can apply other updates that are depending on them. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * mei: cancel stall timers in mei_resetAlexander Usyskin2013-09-261-0/+1
| | | | | | | | | | | | | | | | | | | | | | 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>
* | mei: push credentials inside the irq write handlerTomas Winkler2013-09-261-0/+9
| | | | | | | | | | | | | | | | | | this eventually allows as use a single write queue both for control and data messages and removing possible race Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | mei: propagate error from write routines instead of ENODEVTomas Winkler2013-09-261-11/+13
|/ | | | | | | | | | ENODEV will cause application to try to reconnect since it assumes that device went through the reset write errors are not always fatal it can happen due to resource contention Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: don't get stuck in select during resetTomas Winkler2013-07-271-3/+11
| | | | | | | | | | | | 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>
* mei: revamp interrupt thread handlersTomas Winkler2013-05-211-3/+3
| | | | | | | | | 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>
* Merge branch 'for-linus' of ↵Linus Torvalds2013-04-301-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial Pull trivial tree updates from Jiri Kosina: "Usual stuff, mostly comment fixes, typo fixes, printk fixes and small code cleanups" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/trivial: (45 commits) mm: Convert print_symbol to %pSR gfs2: Convert print_symbol to %pSR m32r: Convert print_symbol to %pSR iostats.txt: add easy-to-find description for field 6 x86 cmpxchg.h: fix wrong comment treewide: Fix typo in printk and comments doc: devicetree: Fix various typos docbook: fix 8250 naming in device-drivers pata_pdc2027x: Fix compiler warning treewide: Fix typo in printks mei: Fix comments in drivers/misc/mei treewide: Fix typos in kernel messages pm44xx: Fix comment for "CONFIG_CPU_IDLE" doc: Fix typo "CONFIG_CGROUP_CGROUP_MEMCG_SWAP" mmzone: correct "pags" to "pages" in comment. kernel-parameters: remove outdated 'noresidual' parameter Remove spurious _H suffixes from ifdef comments sound: Remove stray pluses from Kconfig file radio-shark: Fix printk "CONFIG_LED_CLASS" doc: put proper reference to CONFIG_MODULE_SIG_ENFORCE ...
| * mei: Fix comments in drivers/misc/meiMasanari Iida2013-04-051-3/+3
| | | | | | | | | | | | | | | | Correct typos and fix stray comments. Signed-off-by: Masanari Iida <standby24x7@gmail.com> Acked-by: Winkler, Tomas <tomas.winkler@intel.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* | mei: revamp mei_amthif_irq_read_messageTomas Winkler2013-04-191-5/+5
| | | | | | | | | | | | | | | | 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>
* | mei: revamp mei_data2slotsTomas Winkler2013-03-151-5/+6
|/ | | | | | | | | | 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>
* mei: rename to mei_host_buffer_is_empty to hbuf_is_readyTomas Winkler2013-02-061-4/+4
| | | | | | | | | 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>
* mei: separate compilation of the ME hardware specificsTomas Winkler2013-02-061-3/+3
| | | | | | | | | 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>
* Merge 3.8-rc4 into char-misc-nextGreg Kroah-Hartman2013-01-181-3/+3
|\ | | | | | | | | | | | | This brings in all of the mei and other fixes that are needed to continue development in this branch. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * mei: fix mismatch in mutex unlock-lock in mei_amthif_read()Alexey Khoroshilov2013-01-071-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users of mei_amthif_read() expect it leaves dev->device_lock held, while there is a path where mei_amthif_read() unlocks device_lock and returns -ERESTARTSYS. The patch move code locking device_lock back before the return. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Cc: Sedat Dilek <sedat.dilek@gmail.com> Acked-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | mei: move MEI_IAMTHIF_IDLE to amthif host init functionTomas Winkler2013-01-091-0/+2
| | | | | | | | | | | | | | | | 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>
* | mei: normalize me host client linking routinesTomas Winkler2013-01-091-16/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | mei: rename remaining amthi strings to amthifTomas Winkler2013-01-091-31/+31
| | | | | | | | | | | | | | | | 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>
* | mei: rename interface to hw-meTomas Winkler2013-01-091-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | mei: fix client functions namesTomas Winkler2013-01-091-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | mei: add new hbm.h header to export hbm protocolTomas Winkler2013-01-091-0/+1
| | | | | | | | | | | | | | | | 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>
* | mei: add common prefix to hbm functionTomas Winkler2013-01-071-3/+4
| | | | | | | | | | | | | | | | | | 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>
* | mei: use structured buffer for the write bufferTomas Winkler2013-01-071-13/+12Star
| | | | | | | | | | | | | | | | | | | | 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>
* | mei: include local headers after the system onesTomas Winkler2013-01-071-2/+1Star
| | | | | | | | | | | | | | | | 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>
* | mei: use unified format for printing mei message headerTomas Winkler2013-01-071-2/+1Star
| | | | | | | | | | | | | | 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>
* | mei: drop redundant length parameter from mei_write_message functionTomas Winkler2013-01-071-4/+2Star
|/ | | | | | | | 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>
* mei: streamline amthif write complete functionTomas Winkler2012-11-211-54/+44Star
| | | | | | | | | | | | 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>
* mei: use link and unlink terms for connecting ME and HOST clientTomas Winkler2012-11-161-2/+2
| | | | | | | | | | 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>
* mei: extract amthif specific code from mei_poll to mei_amthif_pollTomas Winkler2012-11-161-0/+19
| | | | | Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: move amthif specific release code to amithifTomas Winkler2012-11-161-0/+114
| | | | | | | | | | 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>
* mei: rename enum mei_cb_major_types to enum mei_cb_file_opsTomas Winkler2012-11-161-1/+1
| | | | | | | | | 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>
* mei: use type struct mei_cl *cl instead of void in struct mei_cbTomas Winkler2012-11-161-10/+4Star
| | | | | | | | | | | | | | 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>
* mei: amthif: prefix cb list with amthifTomas Winkler2012-11-161-5/+5
| | | | | | | | 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>
* mei: move amthif specific code from mei_write to mei_amthif_writeTomas Winkler2012-11-011-3/+36
| | | | | | | | | | | | | For sake of amthif consolidation move amthif specific code from mei_write to mei_amthif_write The original mei_amthif_write to mei_amthif_send_cmd as this function deals with sending single command while mei_amthif_write is interface function called from the main driver which in turns calls mei_amthif_send_cmd Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* mei: extract AMTHI functions into the amthif.c fileTomas Winkler2012-11-011-0/+572
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>