36
#include "qemu/error-report.h"
37
#include "qemu/main-loop.h"
38
#include "system/runstate.h"
39
+#include "qemu/log.h"
40
41
#define FRAME_TIMER_FREQ 1000
42
#define FRAME_TIMER_NS (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ)
426
case 2:
427
return USB_TOKEN_SETUP;
428
default:
428
- fprintf(stderr, "bad token\n");
429
+ qemu_log_mask(LOG_GUEST_ERROR, "bad token\n");
430
return 0;
431
}
432
}
533
}
534
if (p->async == EHCI_ASYNC_FINISHED &&
535
p->packet.status == USB_RET_SUCCESS) {
535
- fprintf(stderr,
536
+ qemu_log_mask(LOG_GUEST_ERROR,
537
"EHCI: Dropping completed packet from halted %s ep %02X\n",
538
(p->pid == USB_TOKEN_IN) ? "in" : "out",
539
get_field(p->queue->qh.epchar, QH_EPCHAR_EP));
1043
1044
/* not supporting dynamic frame list size at the moment */
1045
if ((val & USBCMD_FLS) && !(s->usbcmd & USBCMD_FLS)) {
1045
- fprintf(stderr, "attempt to set frame list size -- value %d\n",
1046
- (int)val & USBCMD_FLS);
1046
+ qemu_log_mask(LOG_GUEST_ERROR,
1047
+ "attempt to set frame list size -- value %" PRId64
1048
+ "\n", val & USBCMD_FLS);
1049
val &= ~USBCMD_FLS;
1050
}
1051
1103
1104
case PERIODICLISTBASE:
1105
if (ehci_periodic_enabled(s)) {
1104
- fprintf(stderr,
1106
+ qemu_log_mask(LOG_GUEST_ERROR,
1107
"ehci: PERIODIC list base register set while periodic schedule\n"
1108
" is enabled and HC is enabled\n");
1109
}
1111
1112
case ASYNCLISTADDR:
1113
if (ehci_async_enabled(s)) {
1112
- fprintf(stderr,
1114
+ qemu_log_mask(LOG_GUEST_ERROR,
1115
"ehci: ASYNC list address register set while async schedule\n"
1116
" is enabled and HC is enabled\n");
1117
}
1202
1203
while (bytes > 0) {
1204
if (cpage > 4) {
1203
- fprintf(stderr, "cpage out of range (%u)\n", cpage);
1205
+ qemu_log_mask(LOG_GUEST_ERROR, "cpage out of range (%u)\n", cpage);
1206
qemu_sglist_destroy(&p->sgl);
1207
return -1;
1208
}
1308
break;
1309
default:
1310
/* should not be triggerable */
1309
- fprintf(stderr, "USB invalid response %d\n", p->packet.status);
1311
+ qemu_log_mask(LOG_GUEST_ERROR, "USB invalid response %d\n",
1312
+ p->packet.status);
1313
g_assert_not_reached();
1314
}
1315
1357
p->async == EHCI_ASYNC_INITIALIZED);
1358
1359
if (!(p->qtd.token & QTD_TOKEN_ACTIVE)) {
1357
- fprintf(stderr, "Attempting to execute inactive qtd\n");
1360
+ qemu_log_mask(LOG_GUEST_ERROR, "Attempting to execute inactive qtd\n");
1361
return -1;
1362
}
1363
1398
p->packet.actual_length);
1399
1400
if (p->packet.actual_length > BUFF_SIZE) {
1398
- fprintf(stderr, "ret from usb_handle_packet > BUFF_SIZE\n");
1401
+ qemu_log_mask(LOG_GUEST_ERROR,
1402
+ "ret from usb_handle_packet > BUFF_SIZE\n");
1403
return -1;
1404
}
1405
1483
case USB_RET_SUCCESS:
1484
break;
1485
default:
1482
- fprintf(stderr, "Unexpected iso usb result: %d\n",
1483
- ehci->ipacket.status);
1486
+ qemu_log_mask(LOG_GUEST_ERROR,
1487
+ "Unexpected iso usb result: %d\n",
1488
+ ehci->ipacket.status);
1489
/* Fall through */
1490
case USB_RET_IOERROR:
1491
case USB_RET_NODEV:
1589
1590
/* section 4.8, only QH in async schedule */
1591
if (async && (NLPTR_TYPE_GET(entry) != NLPTR_TYPE_QH)) {
1587
- fprintf(stderr, "non queue head request in async schedule\n");
1592
+ qemu_log_mask(LOG_GUEST_ERROR,
1593
+ "non queue head request in async schedule\n");
1594
return -1;
1595
}
1596
1612
1613
default:
1614
/* TODO: handle FSTN type */
1609
- fprintf(stderr, "FETCHENTRY: entry at %X is of type %u "
1610
- "which is not supported yet\n", entry, NLPTR_TYPE_GET(entry));
1615
+ qemu_log_mask(LOG_GUEST_ERROR,
1616
+ "FETCHENTRY: entry at 0x%x is of type %u "
1617
+ "which is not supported yet\n",
1618
+ entry, NLPTR_TYPE_GET(entry));
1619
return -1;
1620
}
1621
2126
break;
2127
2128
default:
2121
- fprintf(stderr, "Bad state!\n");
2129
g_assert_not_reached();
2130
}
2131
2132
if (again < 0 || itd_count > 16) {
2133
/* TODO: notify guest (raise HSE irq?) */
2127
- fprintf(stderr, "processing error - resetting ehci HC\n");
2134
+ qemu_log_mask(LOG_GUEST_ERROR,
2135
+ "processing error - resetting ehci HC\n");
2136
ehci_reset(ehci);
2137
again = 0;
2138
}
2189
2190
default:
2191
/* this should only be due to a developer mistake */
2184
- fprintf(stderr, "ehci: Bad asynchronous state %d. "
2185
- "Resetting to active\n", ehci->astate);
2192
g_assert_not_reached();
2193
}
2194
}
2237
2238
default:
2239
/* this should only be due to a developer mistake */
2234
- fprintf(stderr, "ehci: Bad periodic state %d. "
2235
- "Resetting to active\n", ehci->pstate);
2240
g_assert_not_reached();
2241
}
2242
}