Commit Graph

26 Commits (fd7b673c92731fc6c0b1e999adfd87b6762ee797)

Author SHA1 Message Date
Tomas Winkler 1ccb7b6249 staging/mei: propagate error codes up in the write flow
Change mei_write_message's return type from bool to int
to enable propagation of the error code up to caller functions.
The function now returns -EIO when low level write fails and 0
on success.
A similar change is done in intermediate caller functions:
mei_send_flow_control, mei_connect, and mei_disconnect

This makes code more alike to typical Linux kernel error
handling.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-14 12:14:25 -07:00
Justin P. Mattock 5f9092f36f drivers:staging:mei Fix some typos in staging/mei
The below patch fixes some typos in drivers/staging/mei/* that I have found while
doing a little bit of reading.

Signed-off-by: Justin P. Mattock <justinmattock@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-13 15:45:10 -07:00
Tomas Winkler 97d5cb094c staging/mei: don't use read buffer for writing
In mei_irq_thread_read_bus_message we reused mei_hdr
allocated on read buffer to write the stop message.
There is no bug associated with this but for code
clarity we use write buffer also for message header.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-03-07 13:45:42 -08:00
Tomas Winkler 1ca7e78286 staging: mei: kill struct hbm_cmd bit fields
Replace bitfield struct hbm_cmd with simple u8 as we
always access the value as whole. This allows us to remove
few ugly type casts
For possible further uses and documentation purposes we add
corresponding bitmask defines

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-29 15:43:20 -08:00
Devin J. Pohly dc91e2f1c0 staging: mei: fix typo in error code return
~ENODEV is a different number than -ENODEV

Signed-off-by: Devin J. Pohly <djpohly@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-29 15:43:19 -08:00
Tomas Winkler edf1eed466 staging/mei: normalize prototypes of all read buffers
1. convert all read buffers to unsigned char and drop useless castings
2. simplify mei_read_slots implementation

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 09:44:57 -08:00
Tomas Winkler 733ba91cc0 staging/mei: update copyright year to 2012
1. Update Copyright to 2012
2. Also fix mei.h copyright format
   checkpaatch complained:
   WARNING: please, no spaces at the start of a line

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-09 09:44:56 -08:00
Masanari Iida 32de21f75d staging: Fix typo in mei/interrupt.c
Correct spelling "reseting" to "resetting" in
drivers/staging/mei/interrupt.c

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-02-08 17:02:09 -08:00
Tomas Winkler 70cd533763 staging/mei: add watchdog device registration wrappers
add mei_watchdog_register/unregister wrappers for
cleaner  encapsulation

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-22 13:46:16 -08:00
Tomas Winkler 441ab50f20 staging/mei: code style - cleanup blanks
1. Remove redundant blanks
2. Straighten code lines that don't go over 80 characters

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-13 16:22:18 -08:00
Natalia Ovsyanikov e8cd29d8e2 staging/mei: fix failure for multiple mei clients connection
The irq handler processes queued mei clients connect requests, which were
not transferred to the device in ioctl context due to unavailability
of the write buffer.

The handler may transfer the connection request only if there is
no other ongoing  requests for the same mei id.
This condition was implemented inversely which depending on
the write buffer availability lead to seemingly random
failures during connection attempts.

Cc: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Natalia Ovsyanikov <natalia.ovsyanikov@intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-12-08 15:00:44 -08:00
Tomas Winkler b7cd2d9fdc staging/mei: don't check if list is empty before looping
1. No need to check if a list is empty before list_for_each_ looping as
this is already checked by loop stopping conditional.

The side effect is reduced indentation depth
from:
	if (!list_empty)
		list_for_each()
to:
	list_for_each()

2. drop cb_ prefix from cl_pos, cl_next variables used in list_for_each
loops. The code is more compact and readable

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-28 06:46:18 +09:00
Tomas Winkler c83720941f staging/mei: remove status member of mei_io_list
status was never writen

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-28 06:46:17 +09:00
Tomas Winkler 2bcfaa1fa2 staging/mei: remove BUG_ON for testing of the response buffer size overflow
We can remove BUG_ON in mei_irq_thread_read_client_message()
as the testing for response buffer size overflow has already
graceful handling in place.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-11-28 06:46:17 +09:00
Oren Weil abc51b6de5 staging: mei: Organize the initialization state machine.
moving the final state, clearing of the client maps and
updating of mei state out from mei_host_client_properties function.

Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-26 17:26:03 -07:00
Oren Weil a61c6530a6 staging: mei: renaming delayed work field and function to a meaningful name.
the wd_work and mei_wd_timer() function was not just for watchdog.
mei managing the AMT watchdog going to be replace by the kernel watchdog
interface.

the mei_timer() will still manage the mei driver timeouts.

Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-09 13:28:21 -07:00
Oren Weil 8c4a59a789 staging: mei: adding watchdog ping
adding watchdog ping to send ping/heartbeat to the the AMT watchdog client.
in addition removing the heartbeat sending from the driver timers function.

Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-09 13:28:20 -07:00
Oren Weil 9ce178e539 staging: mei: registering the MEI driver with the kernel watchdog core interface
Adding kernel watchdog interface (/dev/watchdog) to the MEI Driver to support AMT Watchdog feature.
This patch and the following one will replace MEI Driver self management of the AMT watchdog
with the standard kernel watchdog interface.

Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Acked-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-09-09 13:28:20 -07:00
Tomas Winkler 4f61a7ad93 staging: mei: enable msi when supported
enable msi when supported
also in that case we can drop the quick handler
from the threaded interrupt that protected us from
handling USB interrupts

Signed-off-by: Maarten Lankhorst <m.b.lankhorst@gmail.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-08-23 12:56:44 -07:00
Tomas Winkler 479bc59d88 staging: mei: fix possible usage of uninitialized variable
Fix warning: reported in http://marc.info/?l=linux-kernel&m=130812960402606&w=2

drivers/staging/mei/interrupt.c: warning: 'buffer' may be used uninitialized in this function:  => 198

It is a real issue and wrong path in execution is taken when
list is empty or (cl && _mei_irq_thread_state_ok(cl, mei_hdr))
evaluates to false

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:21:33 -07:00
Tomas Winkler 0288c7c975 staging: mei: io_list functions revamp
1. remove list used for loop. There were only 2 loops used in non
   time critical places so we can safely unroll them
2. normalize functions names operating on io_list to mei_io_list_<op>
3. rename mei_fe_same_id to mei_cl_cmp_id  used for comparing list
   elements containing struct mei_cl
4. group together  io_list functions in the header file

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:21:33 -07:00
Tomas Winkler cf9673dad4 staging: mei: rename num_mei_me_clients to me_clients_num
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:21:32 -07:00
Tomas Winkler a93218e14c staging: mei: mei_dev - kill unused members
remove write only/unsed variables
mei_dev.write_hang and mei_io_lis.tdevice_extension

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:20:33 -07:00
Tomas Winkler eb9af0acec staging: mei: mei_dev - use type bool instead of int
use type bool for boolean variables in struct mei_dev
this should save some space providing boolean is 8 bits

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:20:33 -07:00
Tomas Winkler c95efb741f staging: mei: fix mei driver namespace
All global functions must start with mei_ to reduce the risk of name colisions

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-06-28 13:20:32 -07:00
Oren Weil fb7d879f3b staging/mei: Interrupt handling.
ISR and interrupt thread for handling incoming data.
e.g. read bus message, read client message, handle reset requests.

quick handler:
	As MEI may share interrupt with GFX and/or USB
	the HW register need to be checked and acknowledged.

thread handler:
	Check if HW has data for read.
	Write data to HW if possible.
	May init reset flow on error

there can be two types of messages:
1) bus messages:
	Management messages between MEI Driver and ME e.g.
		Connect request/response,
		Disconnect request/response
		Enum clients request/response
		Flow control request/response
	those message are indicated by
	ME Address/ID == 0 && Host Address/ID == 0

2) feature/client messages:
	message that are sends between ME Feature/Client and
	an application, the struct of the message is defined
	by the ME Feature Protocol (e.g. APF Protocol, AMTHI Protocol)
	those message are indicated by
	ME Address/ID != 0 && Host Address/ID != 0

MEI Initialization state machine is also managed by this patch.
After MEI Reset is preform:
	Send Start request
		wait for answer
	Send Enumerate Clients request
		wait for answer
	Send Get Client property for each client request
		wait for answers
	Init Done.

Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Itzhak Tzeel-Krupp <itzhak.tzeel-krupp@intel.com>
Signed-off-by: Oren Weil <oren.jer.weil@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2011-05-18 08:30:56 -07:00