|
|
298366 |
From b6d163fdd8131285a01fe46e6afdba727e4df9ca Mon Sep 17 00:00:00 2001
|
|
|
840b28 |
From: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
840b28 |
Date: Mon, 9 Sep 2013 10:18:17 +0200
|
|
|
840b28 |
Subject: [PATCH] ehci: save device pointer in EHCIState
|
|
|
840b28 |
|
|
|
840b28 |
We'll need a pointer to the actual pci/sysbus device,
|
|
|
840b28 |
stick a pointer to it into the EHCIState struct.
|
|
|
840b28 |
|
|
|
840b28 |
https://bugzilla.redhat.com/show_bug.cgi?id=1005495
|
|
|
840b28 |
|
|
|
840b28 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
840b28 |
(cherry picked from commit adbecc89731cf3e0ae656d50ea9fa58c589c4bdc)
|
|
|
298366 |
|
|
|
298366 |
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
|
|
|
840b28 |
---
|
|
|
840b28 |
hw/usb/hcd-ehci.c | 7 +++----
|
|
|
840b28 |
hw/usb/hcd-ehci.h | 1 +
|
|
|
840b28 |
2 files changed, 4 insertions(+), 4 deletions(-)
|
|
|
840b28 |
|
|
|
840b28 |
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
|
|
|
840b28 |
index 010a0d0..e9fb20c 100644
|
|
|
840b28 |
--- a/hw/usb/hcd-ehci.c
|
|
|
840b28 |
+++ b/hw/usb/hcd-ehci.c
|
|
|
840b28 |
@@ -1241,13 +1241,11 @@ static int ehci_init_transfer(EHCIPacket *p)
|
|
|
840b28 |
{
|
|
|
840b28 |
uint32_t cpage, offset, bytes, plen;
|
|
|
840b28 |
dma_addr_t page;
|
|
|
840b28 |
- USBBus *bus = &p->queue->ehci->bus;
|
|
|
840b28 |
- BusState *qbus = BUS(bus);
|
|
|
840b28 |
|
|
|
840b28 |
cpage = get_field(p->qtd.token, QTD_TOKEN_CPAGE);
|
|
|
840b28 |
bytes = get_field(p->qtd.token, QTD_TOKEN_TBYTES);
|
|
|
840b28 |
offset = p->qtd.bufptr[0] & ~QTD_BUFPTR_MASK;
|
|
|
840b28 |
- qemu_sglist_init(&p->sgl, qbus->parent, 5, p->queue->ehci->as);
|
|
|
840b28 |
+ qemu_sglist_init(&p->sgl, p->queue->ehci->device, 5, p->queue->ehci->as);
|
|
|
840b28 |
|
|
|
840b28 |
while (bytes > 0) {
|
|
|
840b28 |
if (cpage > 4) {
|
|
|
840b28 |
@@ -1486,7 +1484,7 @@ static int ehci_process_itd(EHCIState *ehci,
|
|
|
840b28 |
return -1;
|
|
|
840b28 |
}
|
|
|
840b28 |
|
|
|
840b28 |
- qemu_sglist_init(&ehci->isgl, DEVICE(ehci), 2, ehci->as);
|
|
|
840b28 |
+ qemu_sglist_init(&ehci->isgl, ehci->device, 2, ehci->as);
|
|
|
840b28 |
if (off + len > 4096) {
|
|
|
840b28 |
/* transfer crosses page border */
|
|
|
840b28 |
uint32_t len2 = off + len - 4096;
|
|
|
840b28 |
@@ -2529,6 +2527,7 @@ void usb_ehci_realize(EHCIState *s, DeviceState *dev, Error **errp)
|
|
|
840b28 |
|
|
|
840b28 |
s->frame_timer = qemu_new_timer_ns(vm_clock, ehci_frame_timer, s);
|
|
|
840b28 |
s->async_bh = qemu_bh_new(ehci_frame_timer, s);
|
|
|
840b28 |
+ s->device = dev;
|
|
|
840b28 |
|
|
|
840b28 |
qemu_register_reset(ehci_reset, s);
|
|
|
840b28 |
qemu_add_vm_change_state_handler(usb_ehci_vm_state_change, s);
|
|
|
840b28 |
diff --git a/hw/usb/hcd-ehci.h b/hw/usb/hcd-ehci.h
|
|
|
840b28 |
index 15a28e8..065c9fa 100644
|
|
|
840b28 |
--- a/hw/usb/hcd-ehci.h
|
|
|
840b28 |
+++ b/hw/usb/hcd-ehci.h
|
|
|
840b28 |
@@ -255,6 +255,7 @@ typedef QTAILQ_HEAD(EHCIQueueHead, EHCIQueue) EHCIQueueHead;
|
|
|
840b28 |
|
|
|
840b28 |
struct EHCIState {
|
|
|
840b28 |
USBBus bus;
|
|
|
840b28 |
+ DeviceState *device;
|
|
|
840b28 |
qemu_irq irq;
|
|
|
840b28 |
MemoryRegion mem;
|
|
|
840b28 |
AddressSpace *as;
|