win-pvdrivers

changeset 616:fd445db0c603

Added usbif.h and updated xenbus.h to include new Reconfiguring states
author James Harper <james.harper@bendigoit.com.au>
date Sun Jul 26 23:06:09 2009 +1000 (2009-07-26)
parents 0436238bcda5
children 1478103c6ef5
files common/include/public/io/usbif.h common/include/public/io/xenbus.h
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/common/include/public/io/usbif.h	Sun Jul 26 23:06:09 2009 +1000
     1.3 @@ -0,0 +1,122 @@
     1.4 +
     1.5 +/*
     1.6 + * usbif.h
     1.7 + *
     1.8 + * USB I/O interface for Xen guest OSes.
     1.9 + *
    1.10 + * Copyright (C) 2009, FUJITSU LABORATORIES LTD.
    1.11 + * Author: Noboru Iwamatsu <n_iwamatsu@jp.fujitsu.com>
    1.12 + *
    1.13 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    1.14 + * of this software and associated documentation files (the "Software"), to
    1.15 + * deal in the Software without restriction, including without limitation the
    1.16 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    1.17 + * sell copies of the Software, and to permit persons to whom the Software is
    1.18 + * furnished to do so, subject to the following conditions:
    1.19 + *
    1.20 + * The above copyright notice and this permission notice shall be included in
    1.21 + * all copies or substantial portions of the Software.
    1.22 + *
    1.23 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    1.24 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    1.25 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    1.26 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    1.27 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    1.28 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    1.29 + * DEALINGS IN THE SOFTWARE.
    1.30 + */
    1.31 +
    1.32 +#ifndef __XEN_PUBLIC_IO_USBIF_H__
    1.33 +#define __XEN_PUBLIC_IO_USBIF_H__
    1.34 +
    1.35 +#include "ring.h"
    1.36 +#include "../grant_table.h"
    1.37 +
    1.38 +/*
    1.39 + *  USB pipe in usbif_request
    1.40 + *
    1.41 + *  bits 0-5 are specific bits for virtual USB driver.
    1.42 + *  bits 7-31 are standard urb pipe.
    1.43 + *
    1.44 + *  - port number(NEW): bits 0-4
    1.45 + *                              (USB_MAXCHILDREN is 31)
    1.46 + *
    1.47 + *  - operation flag(NEW):      bit 5
    1.48 + *                              (0 = submit urb,
    1.49 + *                               1 = unlink urb)
    1.50 + *
    1.51 + *  - direction:                bit 7
    1.52 + *                              (0 = Host-to-Device [Out]
    1.53 + *                           1 = Device-to-Host [In])
    1.54 + *
    1.55 + *  - device address:   bits 8-14
    1.56 + *
    1.57 + *  - endpoint:         bits 15-18
    1.58 + *
    1.59 + *  - pipe type:                bits 30-31
    1.60 + *                              (00 = isochronous, 01 = interrupt,
    1.61 + *                           10 = control, 11 = bulk)
    1.62 + */
    1.63 +#define usbif_pipeportnum(pipe) ((pipe) & 0x1f)
    1.64 +#define usbif_setportnum_pipe(pipe,portnum) \
    1.65 +        ((pipe)|(portnum))
    1.66 +#define usbif_pipeunlink(pipe) ((pipe) & 0x20)
    1.67 +#define usbif_setunlink_pipe(pipe) ((pipe)|(0x20))
    1.68 +
    1.69 +#define USBIF_BACK_MAX_PENDING_REQS (128)
    1.70 +#define USBIF_MAX_SEGMENTS_PER_REQUEST (10)
    1.71 +
    1.72 +struct usbif_request_segment {
    1.73 +        grant_ref_t gref;
    1.74 +        uint16_t offset;
    1.75 +        uint16_t length;
    1.76 +};
    1.77 +
    1.78 +struct usbif_request {
    1.79 +        uint16_t id; /* request id */
    1.80 +        uint16_t nr_buffer_segs; /* number of urb->transfer_buffer segments */
    1.81 +
    1.82 +        /* basic urb parameter */
    1.83 +        uint32_t pipe;
    1.84 +        uint16_t transfer_flags;
    1.85 +        uint16_t buffer_length;
    1.86 +        union {
    1.87 +                uint8_t ctrl[8]; /* setup_packet (Ctrl) */
    1.88 +
    1.89 +                struct {
    1.90 +                        uint16_t interval; /* maximum (1024*8) in usb core */
    1.91 +                        uint16_t start_frame; /* start frame */
    1.92 +                        uint16_t number_of_packets; /* number of ISO packet */
    1.93 +                        uint16_t nr_frame_desc_segs; /* number of iso_frame_desc segments */
    1.94 +                } isoc;
    1.95 +
    1.96 +                struct {
    1.97 +                        uint16_t interval; /* maximum (1024*8) in usb core */
    1.98 +                        uint16_t pad[3];
    1.99 +                } intr;
   1.100 +
   1.101 +                struct {
   1.102 +                        uint16_t unlink_id; /* unlink request id */
   1.103 +                        uint16_t pad[3];
   1.104 +                } unlink;
   1.105 +
   1.106 +        } u;
   1.107 +
   1.108 +        /* urb data segments */
   1.109 +        struct usbif_request_segment seg[USBIF_MAX_SEGMENTS_PER_REQUEST];
   1.110 +};
   1.111 +typedef struct usbif_request usbif_request_t;
   1.112 +
   1.113 +struct usbif_response {
   1.114 +        uint16_t id; /* request id */
   1.115 +        uint16_t start_frame;  /* start frame (ISO) */
   1.116 +        int32_t status; /* status (non-ISO) */
   1.117 +        int32_t actual_length; /* actual transfer length */
   1.118 +        int32_t error_count; /* number of ISO errors */
   1.119 +};
   1.120 +typedef struct usbif_response usbif_response_t;
   1.121 +
   1.122 +DEFINE_RING_TYPES(usbif, struct usbif_request, struct usbif_response);
   1.123 +#define USB_RING_SIZE __RING_SIZE((struct usbif_sring *)0, PAGE_SIZE)
   1.124 +
   1.125 +#endif /* __XEN_PUBLIC_IO_USBIF_H__ */
   1.126 \ No newline at end of file
     2.1 --- a/common/include/public/io/xenbus.h	Sat Jul 18 09:24:52 2009 +1000
     2.2 +++ b/common/include/public/io/xenbus.h	Sun Jul 26 23:06:09 2009 +1000
     2.3 @@ -1,73 +1,80 @@
     2.4 -/*****************************************************************************
     2.5 - * xenbus.h
     2.6 - *
     2.7 - * Xenbus protocol details.
     2.8 - *
     2.9 - * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.10 - * of this software and associated documentation files (the "Software"), to
    2.11 - * deal in the Software without restriction, including without limitation the
    2.12 - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    2.13 - * sell copies of the Software, and to permit persons to whom the Software is
    2.14 - * furnished to do so, subject to the following conditions:
    2.15 - *
    2.16 - * The above copyright notice and this permission notice shall be included in
    2.17 - * all copies or substantial portions of the Software.
    2.18 - *
    2.19 - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.20 - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.21 - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.22 - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.23 - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.24 - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    2.25 - * DEALINGS IN THE SOFTWARE.
    2.26 - *
    2.27 - * Copyright (C) 2005 XenSource Ltd.
    2.28 - */
    2.29 -
    2.30 -#ifndef _XEN_PUBLIC_IO_XENBUS_H
    2.31 -#define _XEN_PUBLIC_IO_XENBUS_H
    2.32 -
    2.33 -/*
    2.34 - * The state of either end of the Xenbus, i.e. the current communication
    2.35 - * status of initialisation across the bus.  States here imply nothing about
    2.36 - * the state of the connection between the driver and the kernel's device
    2.37 - * layers.
    2.38 - */
    2.39 -enum xenbus_state {
    2.40 -    XenbusStateUnknown       = 0,
    2.41 -
    2.42 -    XenbusStateInitialising  = 1,
    2.43 -
    2.44 -    /*
    2.45 -     * InitWait: Finished early initialisation but waiting for information
    2.46 -     * from the peer or hotplug scripts.
    2.47 -     */
    2.48 -    XenbusStateInitWait      = 2,
    2.49 -
    2.50 -    /*
    2.51 -     * Initialised: Waiting for a connection from the peer.
    2.52 -     */
    2.53 -    XenbusStateInitialised   = 3,
    2.54 -
    2.55 -    XenbusStateConnected     = 4,
    2.56 -
    2.57 -    /*
    2.58 -     * Closing: The device is being closed due to an error or an unplug event.
    2.59 -     */
    2.60 -    XenbusStateClosing       = 5,
    2.61 -
    2.62 -    XenbusStateClosed        = 6
    2.63 -};
    2.64 -typedef enum xenbus_state XenbusState;
    2.65 -
    2.66 -#endif /* _XEN_PUBLIC_IO_XENBUS_H */
    2.67 -
    2.68 -/*
    2.69 - * Local variables:
    2.70 - * mode: C
    2.71 - * c-set-style: "BSD"
    2.72 - * c-basic-offset: 4
    2.73 - * tab-width: 4
    2.74 - * indent-tabs-mode: nil
    2.75 - * End:
    2.76 - */
    2.77 +/*****************************************************************************
    2.78 + * xenbus.h
    2.79 + *
    2.80 + * Xenbus protocol details.
    2.81 + *
    2.82 + * Permission is hereby granted, free of charge, to any person obtaining a copy
    2.83 + * of this software and associated documentation files (the "Software"), to
    2.84 + * deal in the Software without restriction, including without limitation the
    2.85 + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
    2.86 + * sell copies of the Software, and to permit persons to whom the Software is
    2.87 + * furnished to do so, subject to the following conditions:
    2.88 + *
    2.89 + * The above copyright notice and this permission notice shall be included in
    2.90 + * all copies or substantial portions of the Software.
    2.91 + *
    2.92 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    2.93 + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    2.94 + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    2.95 + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    2.96 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
    2.97 + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
    2.98 + * DEALINGS IN THE SOFTWARE.
    2.99 + *
   2.100 + * Copyright (C) 2005 XenSource Ltd.
   2.101 + */
   2.102 +
   2.103 +#ifndef _XEN_PUBLIC_IO_XENBUS_H
   2.104 +#define _XEN_PUBLIC_IO_XENBUS_H
   2.105 +
   2.106 +/*
   2.107 + * The state of either end of the Xenbus, i.e. the current communication
   2.108 + * status of initialisation across the bus.  States here imply nothing about
   2.109 + * the state of the connection between the driver and the kernel's device
   2.110 + * layers.
   2.111 + */
   2.112 +enum xenbus_state {
   2.113 +    XenbusStateUnknown       = 0,
   2.114 +
   2.115 +    XenbusStateInitialising  = 1,
   2.116 +
   2.117 +    /*
   2.118 +     * InitWait: Finished early initialisation but waiting for information
   2.119 +     * from the peer or hotplug scripts.
   2.120 +     */
   2.121 +    XenbusStateInitWait      = 2,
   2.122 +
   2.123 +    /*
   2.124 +     * Initialised: Waiting for a connection from the peer.
   2.125 +     */
   2.126 +    XenbusStateInitialised   = 3,
   2.127 +
   2.128 +    XenbusStateConnected     = 4,
   2.129 +
   2.130 +    /*
   2.131 +     * Closing: The device is being closed due to an error or an unplug event.
   2.132 +     */
   2.133 +    XenbusStateClosing       = 5,
   2.134 +
   2.135 +    XenbusStateClosed        = 6,
   2.136 +
   2.137 +    /*
   2.138 +     * Reconfiguring: The device is being reconfigured.
   2.139 +     */
   2.140 +    XenbusStateReconfiguring = 7,
   2.141 +
   2.142 +    XenbusStateReconfigured  = 8
   2.143 +};
   2.144 +typedef enum xenbus_state XenbusState;
   2.145 +
   2.146 +#endif /* _XEN_PUBLIC_IO_XENBUS_H */
   2.147 +
   2.148 +/*
   2.149 + * Local variables:
   2.150 + * mode: C
   2.151 + * c-set-style: "BSD"
   2.152 + * c-basic-offset: 4
   2.153 + * tab-width: 4
   2.154 + * indent-tabs-mode: nil
   2.155 + * End:
   2.156 + */