[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 04/26] ehci: Move get / put_dwords upwards
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 04/26] ehci: Move get / put_dwords upwards |
Date: |
Fri, 14 Dec 2012 14:35:25 +0100 |
No other changes.
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/hcd-ehci.c | 84 +++++++++++++++++++++++++++----------------------------
1 file changed, 42 insertions(+), 42 deletions(-)
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index 04301ce..934af55 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -438,6 +438,48 @@ static inline bool ehci_periodic_enabled(EHCIState *s)
return ehci_enabled(s) && (s->usbcmd & USBCMD_PSE);
}
+/* Get an array of dwords from main memory */
+static inline int get_dwords(EHCIState *ehci, uint32_t addr,
+ uint32_t *buf, int num)
+{
+ int i;
+
+ if (!ehci->dma) {
+ ehci_raise_irq(ehci, USBSTS_HSE);
+ ehci->usbcmd &= ~USBCMD_RUNSTOP;
+ trace_usb_ehci_dma_error();
+ return -1;
+ }
+
+ for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
+ dma_memory_read(ehci->dma, addr, buf, sizeof(*buf));
+ *buf = le32_to_cpu(*buf);
+ }
+
+ return num;
+}
+
+/* Put an array of dwords in to main memory */
+static inline int put_dwords(EHCIState *ehci, uint32_t addr,
+ uint32_t *buf, int num)
+{
+ int i;
+
+ if (!ehci->dma) {
+ ehci_raise_irq(ehci, USBSTS_HSE);
+ ehci->usbcmd &= ~USBCMD_RUNSTOP;
+ trace_usb_ehci_dma_error();
+ return -1;
+ }
+
+ for (i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
+ uint32_t tmp = cpu_to_le32(*buf);
+ dma_memory_write(ehci->dma, addr, &tmp, sizeof(tmp));
+ }
+
+ return num;
+}
+
static bool ehci_verify_qh(EHCIQueue *q, EHCIqh *qh)
{
uint32_t devaddr = get_field(qh->epchar, QH_EPCHAR_DEVADDR);
@@ -1054,48 +1096,6 @@ static void ehci_opreg_write(void *ptr, hwaddr addr,
*mmio, old);
}
-/* Get an array of dwords from main memory */
-static inline int get_dwords(EHCIState *ehci, uint32_t addr,
- uint32_t *buf, int num)
-{
- int i;
-
- if (!ehci->dma) {
- ehci_raise_irq(ehci, USBSTS_HSE);
- ehci->usbcmd &= ~USBCMD_RUNSTOP;
- trace_usb_ehci_dma_error();
- return -1;
- }
-
- for(i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
- dma_memory_read(ehci->dma, addr, buf, sizeof(*buf));
- *buf = le32_to_cpu(*buf);
- }
-
- return num;
-}
-
-/* Put an array of dwords in to main memory */
-static inline int put_dwords(EHCIState *ehci, uint32_t addr,
- uint32_t *buf, int num)
-{
- int i;
-
- if (!ehci->dma) {
- ehci_raise_irq(ehci, USBSTS_HSE);
- ehci->usbcmd &= ~USBCMD_RUNSTOP;
- trace_usb_ehci_dma_error();
- return -1;
- }
-
- for(i = 0; i < num; i++, buf++, addr += sizeof(*buf)) {
- uint32_t tmp = cpu_to_le32(*buf);
- dma_memory_write(ehci->dma, addr, &tmp, sizeof(tmp));
- }
-
- return num;
-}
-
/*
* Write the qh back to guest physical memory. This step isn't
* in the EHCI spec but we need to do it since we don't share
--
1.8.0.1
- [Qemu-devel] [PATCH 00/26] usb: Hans' pending qemu usb patches, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 01/26] ehci: Add a ehci_writeback_async_complete_packet helper function, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 02/26] ehci: Add ehci_verify_qh and ehci_verify_qtd helper functions, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 03/26] ehci: Verify guest does not change the token of inflight qtd-s, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 05/26] ehci: writeback_async_complete_packet: verify qh and qtd, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 06/26] ehci: Verify qtd for async completed packets, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 04/26] ehci: Move get / put_dwords upwards,
Hans de Goede <=
- [Qemu-devel] [PATCH 08/26] ehci: Verify a queue's ep direction does not change, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 07/26] ehci: Add an ehci_get_pid helper function, Hans de Goede, 2012/12/14
- [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/14
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/17
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Hans de Goede, 2012/12/18
- Re: [Qemu-devel] [PATCH 09/26] ehci: Use uframe precision for interrupt threshold checking, Gerd Hoffmann, 2012/12/18