|
@@ -1990,6 +1990,8 @@ static void xhci_address_device_input ( struct xhci_device *xhci,
|
1990
|
1990
|
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( 1, 0, slot->psiv,
|
1991
|
1991
|
slot->route ) );
|
1992
|
1992
|
slot_ctx->port = slot->port;
|
|
1993
|
+ slot_ctx->tt_id = slot->tt_id;
|
|
1994
|
+ slot_ctx->tt_port = slot->tt_port;
|
1993
|
1995
|
|
1994
|
1996
|
/* Populate control endpoint context */
|
1995
|
1997
|
ep_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_EP0 ) );
|
|
@@ -2039,7 +2041,7 @@ static inline int xhci_address_device ( struct xhci_device *xhci,
|
2039
|
2041
|
* @v input Input context
|
2040
|
2042
|
*/
|
2041
|
2043
|
static void xhci_configure_endpoint_input ( struct xhci_device *xhci,
|
2042
|
|
- struct xhci_slot *slot __unused,
|
|
2044
|
+ struct xhci_slot *slot,
|
2043
|
2045
|
struct xhci_endpoint *endpoint,
|
2044
|
2046
|
void *input ) {
|
2045
|
2047
|
struct xhci_control_context *control_ctx;
|
|
@@ -2054,7 +2056,9 @@ static void xhci_configure_endpoint_input ( struct xhci_device *xhci,
|
2054
|
2056
|
/* Populate slot context */
|
2055
|
2057
|
slot_ctx = ( input + xhci_input_context_offset ( xhci, XHCI_CTX_SLOT ));
|
2056
|
2058
|
slot_ctx->info = cpu_to_le32 ( XHCI_SLOT_INFO ( ( XHCI_CTX_END - 1 ),
|
2057
|
|
- 0, 0, 0 ) );
|
|
2059
|
+ ( slot->ports ? 1 : 0 ),
|
|
2060
|
+ slot->psiv, 0 ) );
|
|
2061
|
+ slot_ctx->ports = slot->ports;
|
2058
|
2062
|
|
2059
|
2063
|
/* Populate endpoint context */
|
2060
|
2064
|
ep_ctx = ( input + xhci_input_context_offset ( xhci, endpoint->ctx ) );
|
|
@@ -2587,7 +2591,9 @@ static int xhci_endpoint_stream ( struct usb_endpoint *ep,
|
2587
|
2591
|
*/
|
2588
|
2592
|
static int xhci_device_open ( struct usb_device *usb ) {
|
2589
|
2593
|
struct xhci_device *xhci = usb_bus_get_hostdata ( usb->port->hub->bus );
|
|
2594
|
+ struct usb_port *tt = usb_transaction_translator ( usb );
|
2590
|
2595
|
struct xhci_slot *slot;
|
|
2596
|
+ struct xhci_slot *tt_slot;
|
2591
|
2597
|
size_t len;
|
2592
|
2598
|
int type;
|
2593
|
2599
|
int id;
|
|
@@ -2621,6 +2627,11 @@ static int xhci_device_open ( struct usb_device *usb ) {
|
2621
|
2627
|
slot->xhci = xhci;
|
2622
|
2628
|
slot->usb = usb;
|
2623
|
2629
|
slot->id = id;
|
|
2630
|
+ if ( tt ) {
|
|
2631
|
+ tt_slot = usb_get_hostdata ( tt->hub->usb );
|
|
2632
|
+ slot->tt_id = tt_slot->id;
|
|
2633
|
+ slot->tt_port = tt->address;
|
|
2634
|
+ }
|
2624
|
2635
|
|
2625
|
2636
|
/* Allocate a device context */
|
2626
|
2637
|
len = xhci_device_context_offset ( xhci, XHCI_CTX_END );
|
|
@@ -2817,6 +2828,51 @@ static void xhci_bus_poll ( struct usb_bus *bus ) {
|
2817
|
2828
|
xhci_event_poll ( xhci );
|
2818
|
2829
|
}
|
2819
|
2830
|
|
|
2831
|
+/******************************************************************************
|
|
2832
|
+ *
|
|
2833
|
+ * Hub operations
|
|
2834
|
+ *
|
|
2835
|
+ ******************************************************************************
|
|
2836
|
+ */
|
|
2837
|
+
|
|
2838
|
+/**
|
|
2839
|
+ * Open hub
|
|
2840
|
+ *
|
|
2841
|
+ * @v hub USB hub
|
|
2842
|
+ * @ret rc Return status code
|
|
2843
|
+ */
|
|
2844
|
+static int xhci_hub_open ( struct usb_hub *hub ) {
|
|
2845
|
+ struct xhci_slot *slot;
|
|
2846
|
+
|
|
2847
|
+ /* Do nothing if this is the root hub */
|
|
2848
|
+ if ( ! hub->usb )
|
|
2849
|
+ return 0;
|
|
2850
|
+
|
|
2851
|
+ /* Get device slot */
|
|
2852
|
+ slot = usb_get_hostdata ( hub->usb );
|
|
2853
|
+
|
|
2854
|
+ /* Update device slot hub parameters. We don't inform the
|
|
2855
|
+ * hardware of this information until the hub's interrupt
|
|
2856
|
+ * endpoint is opened, since the only mechanism for so doing
|
|
2857
|
+ * provided by the xHCI specification is a Configure Endpoint
|
|
2858
|
+ * command, and we can't issue that command until we have a
|
|
2859
|
+ * non-EP0 endpoint to configure.
|
|
2860
|
+ */
|
|
2861
|
+ slot->ports = hub->ports;
|
|
2862
|
+
|
|
2863
|
+ return 0;
|
|
2864
|
+}
|
|
2865
|
+
|
|
2866
|
+/**
|
|
2867
|
+ * Close hub
|
|
2868
|
+ *
|
|
2869
|
+ * @v hub USB hub
|
|
2870
|
+ */
|
|
2871
|
+static void xhci_hub_close ( struct usb_hub *hub __unused ) {
|
|
2872
|
+
|
|
2873
|
+ /* Nothing to do */
|
|
2874
|
+}
|
|
2875
|
+
|
2820
|
2876
|
/******************************************************************************
|
2821
|
2877
|
*
|
2822
|
2878
|
* Root hub operations
|
|
@@ -2830,7 +2886,7 @@ static void xhci_bus_poll ( struct usb_bus *bus ) {
|
2830
|
2886
|
* @v hub USB hub
|
2831
|
2887
|
* @ret rc Return status code
|
2832
|
2888
|
*/
|
2833
|
|
-static int xhci_hub_open ( struct usb_hub *hub ) {
|
|
2889
|
+static int xhci_root_open ( struct usb_hub *hub ) {
|
2834
|
2890
|
struct usb_bus *bus = hub->bus;
|
2835
|
2891
|
struct xhci_device *xhci = usb_bus_get_hostdata ( bus );
|
2836
|
2892
|
struct usb_port *port;
|
|
@@ -2880,7 +2936,7 @@ static int xhci_hub_open ( struct usb_hub *hub ) {
|
2880
|
2936
|
*
|
2881
|
2937
|
* @v hub USB hub
|
2882
|
2938
|
*/
|
2883
|
|
-static void xhci_hub_close ( struct usb_hub *hub ) {
|
|
2939
|
+static void xhci_root_close ( struct usb_hub *hub ) {
|
2884
|
2940
|
|
2885
|
2941
|
/* Clear hub driver private data */
|
2886
|
2942
|
usb_hub_set_drvdata ( hub, NULL );
|
|
@@ -2893,7 +2949,7 @@ static void xhci_hub_close ( struct usb_hub *hub ) {
|
2893
|
2949
|
* @v port USB port
|
2894
|
2950
|
* @ret rc Return status code
|
2895
|
2951
|
*/
|
2896
|
|
-static int xhci_hub_enable ( struct usb_hub *hub, struct usb_port *port ) {
|
|
2952
|
+static int xhci_root_enable ( struct usb_hub *hub, struct usb_port *port ) {
|
2897
|
2953
|
struct xhci_device *xhci = usb_hub_get_drvdata ( hub );
|
2898
|
2954
|
uint32_t portsc;
|
2899
|
2955
|
unsigned int i;
|
|
@@ -2930,7 +2986,7 @@ static int xhci_hub_enable ( struct usb_hub *hub, struct usb_port *port ) {
|
2930
|
2986
|
* @v port USB port
|
2931
|
2987
|
* @ret rc Return status code
|
2932
|
2988
|
*/
|
2933
|
|
-static int xhci_hub_disable ( struct usb_hub *hub, struct usb_port *port ) {
|
|
2989
|
+static int xhci_root_disable ( struct usb_hub *hub, struct usb_port *port ) {
|
2934
|
2990
|
struct xhci_device *xhci = usb_hub_get_drvdata ( hub );
|
2935
|
2991
|
uint32_t portsc;
|
2936
|
2992
|
|
|
@@ -2950,7 +3006,7 @@ static int xhci_hub_disable ( struct usb_hub *hub, struct usb_port *port ) {
|
2950
|
3006
|
* @v port USB port
|
2951
|
3007
|
* @ret rc Return status code
|
2952
|
3008
|
*/
|
2953
|
|
-static int xhci_hub_speed ( struct usb_hub *hub, struct usb_port *port ) {
|
|
3009
|
+static int xhci_root_speed ( struct usb_hub *hub, struct usb_port *port ) {
|
2954
|
3010
|
struct xhci_device *xhci = usb_hub_get_drvdata ( hub );
|
2955
|
3011
|
uint32_t portsc;
|
2956
|
3012
|
unsigned int psiv;
|
|
@@ -3000,8 +3056,8 @@ static int xhci_hub_speed ( struct usb_hub *hub, struct usb_port *port ) {
|
3000
|
3056
|
* @v ep USB endpoint
|
3001
|
3057
|
* @ret rc Return status code
|
3002
|
3058
|
*/
|
3003
|
|
-static int xhci_hub_clear_tt ( struct usb_hub *hub, struct usb_port *port,
|
3004
|
|
- struct usb_endpoint *ep ) {
|
|
3059
|
+static int xhci_root_clear_tt ( struct usb_hub *hub, struct usb_port *port,
|
|
3060
|
+ struct usb_endpoint *ep ) {
|
3005
|
3061
|
struct ehci_device *ehci = usb_hub_get_drvdata ( hub );
|
3006
|
3062
|
|
3007
|
3063
|
/* Should never be called; this is a root hub */
|
|
@@ -3041,10 +3097,14 @@ static struct usb_host_operations xhci_operations = {
|
3041
|
3097
|
.hub = {
|
3042
|
3098
|
.open = xhci_hub_open,
|
3043
|
3099
|
.close = xhci_hub_close,
|
3044
|
|
- .enable = xhci_hub_enable,
|
3045
|
|
- .disable = xhci_hub_disable,
|
3046
|
|
- .speed = xhci_hub_speed,
|
3047
|
|
- .clear_tt = xhci_hub_clear_tt,
|
|
3100
|
+ },
|
|
3101
|
+ .root = {
|
|
3102
|
+ .open = xhci_root_open,
|
|
3103
|
+ .close = xhci_root_close,
|
|
3104
|
+ .enable = xhci_root_enable,
|
|
3105
|
+ .disable = xhci_root_disable,
|
|
3106
|
+ .speed = xhci_root_speed,
|
|
3107
|
+ .clear_tt = xhci_root_clear_tt,
|
3048
|
3108
|
},
|
3049
|
3109
|
};
|
3050
|
3110
|
|