Commit graph

37 commits

Author SHA1 Message Date
Viresh Kumar c002b0ec60 greybus: ap: function_id is already set by svc_msg_alloc()
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-19 10:38:50 -08:00
Viresh Kumar 64e69291d9 greybus: Pass '*ptr' to sizeof() wherever possible
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-19 10:38:50 -08:00
Viresh Kumar a4040ab7e6 greybus: ap: keep all svc function routines together
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-19 10:38:50 -08:00
Viresh Kumar e2dabb7c31 greybus: ap: remove extra parameter to convert_ap_message()
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-19 10:38:50 -08:00
Viresh Kumar 2206ea9cf8 greybus: interface: move gb_module_interface_init() to interface.c
That's where it belong to. Also rename it in a similar way to:
gb_interface_create() and gb_interface_destroy().

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 13:49:04 -08:00
Viresh Kumar f66832dae0 greybus: nullify dangling pointers
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 13:32:27 -08:00
Alex Elder 6b09938a48 greybus: improve some error messages
Add a few error messages to help explain the reason for failures.
Add a missing space in a message in svc_management().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-05 14:12:26 -08:00
Alex Elder 2d5e4fa9dc greybus: update AP id service message
Rename and renumber the values for the AP ID service message
and related symbols to match the recently-updated spec.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 18:46:21 +08:00
Matt Porter 8a9bf8a996 greybus: svc: remove the DDB function message support
We removed the DDB function messages from the spec as they are
not needed. Now remove it from the code.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 18:29:35 +08:00
Alex Elder c41b4f1212 greybus: only initialize interfaces when up
Rather than bringing up all interfaces described in the manifest,
wait until we get a link up message, and at that time go initialize
the link.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 17:22:22 +08:00
Alex Elder 525f1467bc greybus: make svc_set_route_send() public
Give svc_set_route_send() non-private scope so it can be used by a
function outside "ap.c" in the next patch.  Change its type so it
can tell its caller if an error occurs.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 17:20:28 +08:00
Matt Porter 060b93ddbb greybus: ap: add svc_set_route_send() command and use it on a link up event
When the AP receives a link up event, request that the SVC set a
route to the interface's device id (this device id has been
previously reported to the AP). In the future, we may not always
immediately set a route upon receiving a link up event but this
is sufficient for the known use cases at this time.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 14:12:17 +08:00
Matt Porter 6232b073d4 greybus: ap: process the UniPro link up message
The link up message is the event that tells the AP what device ID
has been assigned to a particular interface on a module during
enumeration. The link up is sent *only* after the hotplug event
for a particular module has been sent to the AP.

The link up payload must carry the Module ID and Interface ID
to uniquely identify the struct gb_interface to which the
Device ID has been assigned.

After processing of the link up message, the interface's device_id
field will contain the assigned Device ID so that the AP has the
information necessary to issue network route commands.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-22 13:57:49 +08:00
Matt Porter 98f4ab2df9 greybus: ap: add support for the AP Device ID unipro management function message
The AP needs to know its assigned Device ID in order to establish
Greybus connections between CPorts. We could have pulled the Device
ID from the controller hardware in a driver specific manner, but
instead we define one generic message from the SVC to let the
AP know this information. Add this additional unipro management
message and handle it by setting the supplied Device ID in the
struct greybus_host_device. The greybus core will use this to
populate the source Device ID when establishing a connection
between the AP and another module's CPort.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-21 14:37:21 +08:00
Alex Elder 51c75fd060 greybus: reorder greybus_svc_in() arguments
The two functions greybus_svc_in() and greybus_cport_in() do
very similar things, but their arguments are in a different order.
Move the greybus_host_device structure argument for greybus_svc_in()
to be first so the functions' prototypes are better aligned.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-29 18:08:14 -07:00
Alex Elder 0db32a6d5e greybus: some more renames
This patch renames of symbols, for better clarity and consistency.

    cport -> cport_id (when it represents a cport *number*)
    send_svc_msg -> submit_svc (like submit_gbuf)
    greybus_cport_in_data -> greybus_cport_in
    gb_new_ap_msg -> greybus_svc_in (like greybus_cport_in)
    cport->number -> cport->id (like cport_id)

Making the svc and cport message stuff more similar is done with an
eye toward having SVC messages and messages exchanged with other
modules use some more common communication mechanisms.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-29 18:00:55 -07:00
Matt Porter be5064c75b greybus: initialize all fields in an SVC handshake message
Currently only the handshake_type is being initialized when
responding to an SVC handshake request. Update this to
explicitly set all header/payload fields appropriately.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-22 13:23:05 -07:00
Greg Kroah-Hartman d0cfd109c7 greybus: ap: validate the rest of the svc message buffer sizes 2014-09-21 19:10:39 -07:00
Greg Kroah-Hartman 00c52e4d3e greybus: ap: start validating the message better
We check the type of the message now.

Start to check the size of the payload to match the size of the message
type.  Still more work to do needed here.

Also "hooked up" the hotplug message, but doesn't call anything as the
core doesn't implement that yet...
2014-09-21 18:19:54 -07:00
Matt Porter e94e17143e greybus: move versioning from svc message header to handshake function
The Greybus spec has been updated to improve the efficiency of the
version major/minor information that had been previously carried in
every SVC message header. The version major/minor is now provided
as part of the handshake function.

Update the SVC msg header and handshake function payload definitions
and move the version major/minor validation into the SVC handshake
handling routine.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-18 20:06:08 -07:00
Matt Porter 710ecb0605 greybus: update svc_msg_header fields and users to match spec
The Greybus spec has been updated to clarify some of the original
intent of the SVC message definition. The svc_msg_header was:

struct svc_msg_header {
	__u8 function;
	__u8 message_type;
...
}

and is now

struct svc_msg_header {
	__u8 function_id;
	__u8 message_type;
...
}

to match the spec. The function_id carries enum svc_function_id values
and message_type is now clarified to be a session layer level field
that is simply "data" or "error".

Change all references of function type to function id. For now, don't
parse the message_type field but add the two allowable svc_msg_type enums.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-18 20:06:08 -07:00
Greg Kroah-Hartman 772149b6df greybus: fix hd init sequence of setting up parent and driver pointers properly 2014-09-14 12:27:28 -07:00
Greg Kroah-Hartman 45f3678bcf greybus: gbuf: cport in buffer stream logic 2014-09-14 11:40:35 -07:00
Greg Kroah-Hartman 80e04f0994 greybus: gbuf recieve path work, not done, dinner time... 2014-09-13 18:20:54 -07:00
Greg Kroah-Hartman b57b06241b greybus: ap: cleanup of process ap message loop 2014-09-13 12:18:09 -07:00
Greg Kroah-Hartman 88929c593d greybus: ap: convert to workqueue from thread 2014-09-13 11:35:02 -07:00
Greg Kroah-Hartman 9c8d3afdb5 greybus: es1: handle cport data in and out 2014-09-13 11:09:35 -07:00
Greg Kroah-Hartman 8c53e073f7 greybus: AP: move a bunch of svc message handling logic into ap.c
Add a send_svc_msg() callback to the host driver.
hook up ES1 driver to send control USB messages as it's SVC transport.
2014-09-12 20:47:11 -07:00
Alex Elder 05ad189c23 greybus: switch to the term "manifest"
We agreed to rename a few things to improve clarity.  This patch
implements one of those changes.  The blob of data that describes
what's relevant to Greybus within an Ara module will now be called
the "module manifest."  In addition, in the context of Greybus we'll
also be calling what's in an Ara module a "module" or "Greybus module."

So this patch renames some structures and updates some comments.  It
also renames "greybus_desc.h" to be "greybus_manifest.h", and renames
greybus_new_device() to be greybus_new_module().

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-09-09 15:05:25 -07:00
Greg Kroah-Hartman 43cc32a2ab greybus: first cut at parsing svc messages sent to the AP 2014-09-07 13:51:12 -07:00
Greg Kroah-Hartman 68f1fc4d2c greybus: more hd work 2014-09-07 13:12:11 -07:00
Greg Kroah-Hartman d94a44a54e greybus: export gb_new_ap_msg so that the es1 module can use it 2014-09-01 14:39:34 -07:00
Greg Kroah-Hartman 80ebe8a631 greybus: greybus_desc.h created 2014-08-31 18:08:52 -07:00
Greg Kroah-Hartman b9b2a46265 greybus: split svc msg out into separate header file 2014-08-31 17:43:38 -07:00
Greg Kroah-Hartman 2ecd536de7 greybus: more structure definitions added 2014-08-31 17:25:22 -07:00
Greg Kroah-Hartman be1e2e9cd1 greybus: structures added 2014-08-31 16:21:33 -07:00
Greg Kroah-Hartman de536e3094 greybus: ap message loop added. 2014-08-31 16:17:04 -07:00