1 /* { dg-do compile { target arm_thumb2 } } */
2 /* { dg-options "-O2 -fdump-rtl-subreg2" } */
4 /* { dg-final { scan-rtl-dump "REG_INC" "subreg2" { target { ! arm_neon } } } } */
5 /* { dg-final { cleanup-rtl-dump "subreg2" } } */
7 typedef unsigned int __u32
;
8 typedef unsigned long long u64
;
10 typedef u64 dma_addr_t
;
11 typedef unsigned gfp_t
;
12 int dev_warn (const struct device
*dev
, const char *fmt
, ...);
15 struct device
*controller
;
21 struct xhci_generic_trb
27 struct xhci_generic_trb generic
;
36 struct xhci_segment
*first_seg
;
40 struct xhci_ring
*cmd_ring
;
41 struct xhci_ring
*event_ring
;
43 struct usb_hcd
*xhci_to_hcd (struct xhci_hcd
*xhci
)
46 dma_addr_t
xhci_trb_virt_to_dma (struct xhci_segment
* seg
,
47 union xhci_trb
* trb
);
48 struct xhci_segment
*trb_in_td (struct xhci_segment
*start_seg
,
49 dma_addr_t suspect_dma
);
51 xhci_test_trb_in_td (struct xhci_hcd
*xhci
, struct xhci_segment
*input_seg
,
52 union xhci_trb
*start_trb
, union xhci_trb
*end_trb
,
53 dma_addr_t input_dma
, struct xhci_segment
*result_seg
,
54 char *test_name
, int test_number
)
56 unsigned long long start_dma
;
57 unsigned long long end_dma
;
58 struct xhci_segment
*seg
;
59 start_dma
= xhci_trb_virt_to_dma (input_seg
, start_trb
);
60 end_dma
= xhci_trb_virt_to_dma (input_seg
, end_trb
);
62 dev_warn (xhci_to_hcd (xhci
)->self
.controller
,
64 dev_warn (xhci_to_hcd (xhci
)->self
.controller
,
65 "Expected seg %p, got seg %p\n", result_seg
, seg
);
69 xhci_check_trb_in_td_math (struct xhci_hcd
*xhci
, gfp_t mem_flags
)
74 struct xhci_segment
*result_seg
;
76 simple_test_vector
[] =
83 xhci
->event_ring
->first_seg
->dma
- 16, ((void *) 0)}
86 xhci
->event_ring
->first_seg
->dma
- 1, ((void *) 0)}
89 xhci
->event_ring
->first_seg
->dma
, xhci
->event_ring
->first_seg
}
92 xhci
->event_ring
->first_seg
->dma
+ (64 - 1) * 16,
93 xhci
->event_ring
->first_seg
97 xhci
->event_ring
->first_seg
->dma
+ (64 - 1) * 16 + 1, ((void *) 0)}
100 xhci
->event_ring
->first_seg
->dma
+ (64) * 16, ((void *) 0)}
103 (dma_addr_t
) (~0), ((void *) 0)
108 struct xhci_segment
*input_seg
;
109 union xhci_trb
*start_trb
;
110 union xhci_trb
*end_trb
;
111 dma_addr_t input_dma
;
112 struct xhci_segment
*result_seg
;
114 complex_test_vector
[] =
117 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
118 xhci
->event_ring
->first_seg
->trbs
,.end_trb
=
119 &xhci
->event_ring
->first_seg
->trbs
[64 - 1],.input_dma
=
120 xhci
->cmd_ring
->first_seg
->dma
,.result_seg
= ((void *) 0),
124 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
125 xhci
->event_ring
->first_seg
->trbs
,.end_trb
=
126 &xhci
->cmd_ring
->first_seg
->trbs
[64 - 1],.input_dma
=
127 xhci
->cmd_ring
->first_seg
->dma
,.result_seg
= ((void *) 0),
131 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
132 xhci
->cmd_ring
->first_seg
->trbs
,.end_trb
=
133 &xhci
->cmd_ring
->first_seg
->trbs
[64 - 1],.input_dma
=
134 xhci
->cmd_ring
->first_seg
->dma
,.result_seg
= ((void *) 0),
138 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
139 &xhci
->event_ring
->first_seg
->trbs
[0],.end_trb
=
140 &xhci
->event_ring
->first_seg
->trbs
[3],.input_dma
=
141 xhci
->event_ring
->first_seg
->dma
+ 4 * 16,.result_seg
= ((void *) 0),
145 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
146 &xhci
->event_ring
->first_seg
->trbs
[3],.end_trb
=
147 &xhci
->event_ring
->first_seg
->trbs
[6],.input_dma
=
148 xhci
->event_ring
->first_seg
->dma
+ 2 * 16,.result_seg
= ((void *) 0),
152 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
153 &xhci
->event_ring
->first_seg
->trbs
[64 - 3],.end_trb
=
154 &xhci
->event_ring
->first_seg
->trbs
[1],.input_dma
=
155 xhci
->event_ring
->first_seg
->dma
+ 2 * 16,.result_seg
= ((void *) 0),
159 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
160 &xhci
->event_ring
->first_seg
->trbs
[64 - 3],.end_trb
=
161 &xhci
->event_ring
->first_seg
->trbs
[1],.input_dma
=
162 xhci
->event_ring
->first_seg
->dma
+ (64 - 4) * 16,.result_seg
=
167 .input_seg
= xhci
->event_ring
->first_seg
,.start_trb
=
168 &xhci
->event_ring
->first_seg
->trbs
[64 - 3],.end_trb
=
169 &xhci
->event_ring
->first_seg
->trbs
[1],.input_dma
=
170 xhci
->cmd_ring
->first_seg
->dma
+ 2 * 16,.result_seg
= ((void *) 0),
173 unsigned int num_tests
;
176 (sizeof (simple_test_vector
) / sizeof ((simple_test_vector
)[0]) +
181 for (i
= 0; i
< num_tests
; i
++)
184 xhci_test_trb_in_td (xhci
, xhci
->event_ring
->first_seg
,
185 xhci
->event_ring
->first_seg
->trbs
,
186 &xhci
->event_ring
->first_seg
->trbs
[64 - 1],
187 simple_test_vector
[i
].input_dma
,
188 simple_test_vector
[i
].result_seg
, "Simple", i
);
192 for (i
= 0; i
< num_tests
; i
++)
195 xhci_test_trb_in_td (xhci
, complex_test_vector
[i
].input_seg
,
196 complex_test_vector
[i
].start_trb
,
197 complex_test_vector
[i
].end_trb
,
198 complex_test_vector
[i
].input_dma
,
199 complex_test_vector
[i
].result_seg
, "Complex", i
);