From: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
xen-devel-GuqFBffKawuULHF6PoxzQEEOCMrvLtNR@public.gmane.org,
konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org,
boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org
Cc: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
Subject: [Patch V4 1/3] usb: Add Xen pvUSB protocol description
Date: Tue, 23 Jun 2015 08:53:23 +0200 [thread overview]
Message-ID: <1435042405-14235-2-git-send-email-jgross@suse.com> (raw)
In-Reply-To: <1435042405-14235-1-git-send-email-jgross-IBi9RG/b67k@public.gmane.org>
Add the definition of pvUSB protocol used between the pvUSB frontend in
a Xen domU and the pvUSB backend in a Xen driver domain (usually Dom0).
This header was originally provided by Fujitsu for Xen based on Linux
2.6.18.
Changes are:
- adapt to Linux style guide
Signed-off-by: Juergen Gross <jgross-IBi9RG/b67k@public.gmane.org>
---
include/xen/interface/io/usbif.h | 252 +++++++++++++++++++++++++++++++++++++++
1 file changed, 252 insertions(+)
create mode 100644 include/xen/interface/io/usbif.h
diff --git a/include/xen/interface/io/usbif.h b/include/xen/interface/io/usbif.h
new file mode 100644
index 0000000..4ce0b40
--- /dev/null
+++ b/include/xen/interface/io/usbif.h
@@ -0,0 +1,252 @@
+/*
+ * usbif.h
+ *
+ * USB I/O interface for Xen guest OSes.
+ *
+ * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
+ * Author: Noboru Iwamatsu <n_iwamatsu-+CUm20s59erQFUHtdCDX3A@public.gmane.org>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to
+ * deal in the Software without restriction, including without limitation the
+ * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef __XEN_PUBLIC_IO_USBIF_H__
+#define __XEN_PUBLIC_IO_USBIF_H__
+
+#include "ring.h"
+#include "../grant_table.h"
+
+/*
+ * Feature and Parameter Negotiation
+ * =================================
+ * The two halves of a Xen pvUSB driver utilize nodes within the XenStore to
+ * communicate capabilities and to negotiate operating parameters. This
+ * section enumerates these nodes which reside in the respective front and
+ * backend portions of the XenStore, following the XenBus convention.
+ *
+ * Any specified default value is in effect if the corresponding XenBus node
+ * is not present in the XenStore.
+ *
+ * XenStore nodes in sections marked "PRIVATE" are solely for use by the
+ * driver side whose XenBus tree contains them.
+ *
+ *****************************************************************************
+ * Backend XenBus Nodes
+ *****************************************************************************
+ *
+ *------------------ Backend Device Identification (PRIVATE) ------------------
+ *
+ * num-ports
+ * Values: unsigned [1...31]
+ *
+ * Number of ports for this (virtual) USB host connector.
+ *
+ * usb-ver
+ * Values: unsigned [1...2]
+ *
+ * USB version of this host connector: 1 = USB 1.1, 2 = USB 2.0.
+ *
+ * port/[1...31]
+ * Values: string
+ *
+ * Physical USB device connected to the given port, e.g. "3-1.5".
+ *
+ *****************************************************************************
+ * Frontend XenBus Nodes
+ *****************************************************************************
+ *
+ *----------------------- Request Transport Parameters -----------------------
+ *
+ * event-channel
+ * Values: unsigned
+ *
+ * The identifier of the Xen event channel used to signal activity
+ * in the ring buffer.
+ *
+ * urb-ring-ref
+ * Values: unsigned
+ *
+ * The Xen grant reference granting permission for the backend to map
+ * the sole page in a single page sized ring buffer. This is the ring
+ * buffer for urb requests.
+ *
+ * conn-ring-ref
+ * Values: unsigned
+ *
+ * The Xen grant reference granting permission for the backend to map
+ * the sole page in a single page sized ring buffer. This is the ring
+ * buffer for connection/disconnection requests.
+ *
+ * protocol
+ * Values: string (XEN_IO_PROTO_ABI_*)
+ * Default Value: XEN_IO_PROTO_ABI_NATIVE
+ *
+ * The machine ABI rules governing the format of all ring request and
+ * response structures.
+ *
+ */
+
+enum xenusb_spec_version {
+ XENUSB_VER_UNKNOWN = 0,
+ XENUSB_VER_USB11,
+ XENUSB_VER_USB20,
+ XENUSB_VER_USB30, /* not supported yet */
+};
+
+/*
+ * USB pipe in xenusb_request
+ *
+ * - port number: bits 0-4
+ * (USB_MAXCHILDREN is 31)
+ *
+ * - operation flag: bit 5
+ * (0 = submit urb,
+ * 1 = unlink urb)
+ *
+ * - direction: bit 7
+ * (0 = Host-to-Device [Out]
+ * 1 = Device-to-Host [In])
+ *
+ * - device address: bits 8-14
+ *
+ * - endpoint: bits 15-18
+ *
+ * - pipe type: bits 30-31
+ * (00 = isochronous, 01 = interrupt,
+ * 10 = control, 11 = bulk)
+ */
+
+#define XENUSB_PIPE_PORT_MASK 0x0000001f
+#define XENUSB_PIPE_UNLINK 0x00000020
+#define XENUSB_PIPE_DIR 0x00000080
+#define XENUSB_PIPE_DEV_MASK 0x0000007f
+#define XENUSB_PIPE_DEV_SHIFT 8
+#define XENUSB_PIPE_EP_MASK 0x0000000f
+#define XENUSB_PIPE_EP_SHIFT 15
+#define XENUSB_PIPE_TYPE_MASK 0x00000003
+#define XENUSB_PIPE_TYPE_SHIFT 30
+#define XENUSB_PIPE_TYPE_ISOC 0
+#define XENUSB_PIPE_TYPE_INT 1
+#define XENUSB_PIPE_TYPE_CTRL 2
+#define XENUSB_PIPE_TYPE_BULK 3
+
+#define xenusb_pipeportnum(pipe) ((pipe) & XENUSB_PIPE_PORT_MASK)
+#define xenusb_setportnum_pipe(pipe, portnum) ((pipe) | (portnum))
+
+#define xenusb_pipeunlink(pipe) ((pipe) & XENUSB_PIPE_UNLINK)
+#define xenusb_pipesubmit(pipe) (!xenusb_pipeunlink(pipe))
+#define xenusb_setunlink_pipe(pipe) ((pipe) | XENUSB_PIPE_UNLINK)
+
+#define xenusb_pipein(pipe) ((pipe) & XENUSB_PIPE_DIR)
+#define xenusb_pipeout(pipe) (!xenusb_pipein(pipe))
+
+#define xenusb_pipedevice(pipe) \
+ (((pipe) >> XENUSB_PIPE_DEV_SHIFT) & XENUSB_PIPE_DEV_MASK)
+
+#define xenusb_pipeendpoint(pipe) \
+ (((pipe) >> XENUSB_PIPE_EP_SHIFT) & XENUSB_PIPE_EP_MASK)
+
+#define xenusb_pipetype(pipe) \
+ (((pipe) >> XENUSB_PIPE_TYPE_SHIFT) & XENUSB_PIPE_TYPE_MASK)
+#define xenusb_pipeisoc(pipe) (xenusb_pipetype(pipe) == XENUSB_PIPE_TYPE_ISOC)
+#define xenusb_pipeint(pipe) (xenusb_pipetype(pipe) == XENUSB_PIPE_TYPE_INT)
+#define xenusb_pipectrl(pipe) (xenusb_pipetype(pipe) == XENUSB_PIPE_TYPE_CTRL)
+#define xenusb_pipebulk(pipe) (xenusb_pipetype(pipe) == XENUSB_PIPE_TYPE_BULK)
+
+#define XENUSB_MAX_SEGMENTS_PER_REQUEST (16)
+#define XENUSB_MAX_PORTNR 31
+
+/*
+ * RING for transferring urbs.
+ */
+struct xenusb_request_segment {
+ grant_ref_t gref;
+ __u16 offset;
+ __u16 length;
+};
+
+struct xenusb_urb_request {
+ __u16 id; /* request id */
+ __u16 nr_buffer_segs; /* # of urb->transfer_buffer segments */
+
+ /* basic urb parameter */
+ __u32 pipe;
+ __u16 transfer_flags;
+ __u16 buffer_length;
+ union {
+ __u8 ctrl[8]; /* pipe type control */
+ /* setup packet */
+
+ struct {
+ __u16 interval; /* max (1024*8) in usb core */
+ __u16 start_frame; /* start frame */
+ __u16 number_of_packets; /* # of ISO packets */
+ __u16 nr_frame_desc_segs;
+ /* # of iso_frame_desc segments */
+ } isoc; /* pipe type isochronous */
+
+ struct {
+ __u16 interval; /* max (1024*8) in usb core */
+ __u16 pad[3];
+ } intr; /* pipe type interrupt */
+
+ struct {
+ __u16 unlink_id; /* unlink request id */
+ __u16 pad[3];
+ } unlink; /* pipe unlink */
+
+ } u;
+
+ /* urb data segments */
+ struct xenusb_request_segment seg[XENUSB_MAX_SEGMENTS_PER_REQUEST];
+};
+
+struct xenusb_urb_response {
+ __u16 id; /* request id */
+ __u16 start_frame; /* start frame (ISO) */
+ __s32 status; /* status (non-ISO) */
+ __s32 actual_length; /* actual transfer length */
+ __s32 error_count; /* number of ISO errors */
+};
+
+DEFINE_RING_TYPES(xenusb_urb, struct xenusb_urb_request,
+ struct xenusb_urb_response);
+#define XENUSB_URB_RING_SIZE __CONST_RING_SIZE(xenusb_urb, PAGE_SIZE)
+
+/*
+ * RING for notifying connect/disconnect events to frontend
+ */
+struct xenusb_conn_request {
+ __u16 id;
+};
+
+struct xenusb_conn_response {
+ __u16 id; /* request id */
+ __u8 portnum; /* port number */
+ __u8 speed; /* usb device speed */
+#define XENUSB_SPEED_NONE 0
+#define XENUSB_SPEED_LOW 1
+#define XENUSB_SPEED_FULL 2
+#define XENUSB_SPEED_HIGH 3
+};
+
+DEFINE_RING_TYPES(xenusb_conn, struct xenusb_conn_request,
+ struct xenusb_conn_response);
+#define XENUSB_CONN_RING_SIZE __CONST_RING_SIZE(xenusb_conn, PAGE_SIZE)
+
+#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
next prev parent reply other threads:[~2015-06-23 6:53 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-23 6:53 [Patch V4 0/3] xen, usb: support pvUSB frontend driver Juergen Gross
[not found] ` <1435042405-14235-1-git-send-email-jgross-IBi9RG/b67k@public.gmane.org>
2015-06-23 6:53 ` Juergen Gross [this message]
2015-07-22 23:46 ` [Patch V4 1/3] usb: Add Xen pvUSB protocol description Greg KH
2015-07-23 4:04 ` Juergen Gross
[not found] ` <55B067D7.3030904-IBi9RG/b67k@public.gmane.org>
2015-07-23 4:36 ` Greg KH
[not found] ` <20150723043653.GA31524-U8xfFu+wG4EAvxtiuMwx3w@public.gmane.org>
2015-07-23 6:46 ` Juergen Gross
[not found] ` <55B08DB9.60902-IBi9RG/b67k@public.gmane.org>
2015-07-23 9:38 ` [Xen-devel] " David Vrabel
2015-07-23 19:08 ` Greg KH
2015-07-23 21:29 ` Pasi Kärkkäinen
2015-07-24 3:51 ` Juergen Gross
[not found] ` <55B1B628.7090200-IBi9RG/b67k@public.gmane.org>
2015-07-24 18:57 ` Greg KH
2015-07-24 19:25 ` Konrad Rzeszutek Wilk
[not found] ` <1435042405-14235-2-git-send-email-jgross-IBi9RG/b67k@public.gmane.org>
2015-07-23 9:39 ` [Xen-devel] " David Vrabel
2015-06-23 6:53 ` [Patch V4 2/3] usb: Introduce Xen pvUSB frontend (xen hcd) Juergen Gross
[not found] ` <1435042405-14235-3-git-send-email-jgross-IBi9RG/b67k@public.gmane.org>
2015-07-23 9:47 ` David Vrabel
2015-06-23 6:53 ` [Patch V4 3/3] xen: add Xen pvUSB maintainer Juergen Gross
2015-07-20 5:13 ` [Patch V4 0/3] xen, usb: support pvUSB frontend driver Juergen Gross
2016-03-17 19:43 ` Oleksandr Tyshchenko
[not found] ` <CAJEb2DHesrZn0H=d4KVn6sbyXFA8ykdUFMftyAZqbwSKk_JKKQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-03-18 8:32 ` [Xen-devel] " Juergen Gross
2016-03-18 12:28 ` Oleksandr Tyshchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1435042405-14235-2-git-send-email-jgross@suse.com \
--to=jgross-ibi9rg/b67k@public.gmane.org \
--cc=boris.ostrovsky-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=david.vrabel-Sxgqhf6Nn4DQT0dZR+AlfA@public.gmane.org \
--cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
--cc=konrad.wilk-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=xen-devel-GuqFBffKawuULHF6PoxzQEEOCMrvLtNR@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).