socsvn commit: r253559 - in soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb: . include/hw include/qemu

syuu at FreeBSD.org syuu at FreeBSD.org
Wed Jun 26 20:35:15 UTC 2013


Author: syuu
Date: Wed Jun 26 20:35:14 2013
New Revision: 253559
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253559

Log:
  temporary comment out to make it able to compile

Modified:
  soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/core.c
  soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c
  soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/hw/usb.h
  soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/qemu/queue.h

Modified: soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/core.c
==============================================================================
--- soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/core.c	Wed Jun 26 20:33:52 2013	(r253558)
+++ soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/core.c	Wed Jun 26 20:35:14 2013	(r253559)
@@ -23,10 +23,10 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "qemu-common.h"
+#include <string.h>
 #include "hw/usb.h"
-#include "qemu/iov.h"
-#include "trace.h"
+
+#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
 void usb_attach(USBPort *port)
 {
@@ -37,7 +37,7 @@
     assert(dev->state == USB_STATE_NOTATTACHED);
     port->ops->attach(port);
     dev->state = USB_STATE_ATTACHED;
-    usb_device_handle_attach(dev);
+//    usb_device_handle_attach(dev);
 }
 
 void usb_detach(USBPort *port)
@@ -68,7 +68,7 @@
     dev->remote_wakeup = 0;
     dev->addr = 0;
     dev->state = USB_STATE_DEFAULT;
-    usb_device_handle_reset(dev);
+//    usb_device_handle_reset(dev);
 }
 
 void usb_wakeup(USBEndpoint *ep, unsigned int stream)
@@ -101,12 +101,14 @@
 {
     int request, value, index;
 
+#if 0
     if (p->iov.size != 8) {
         p->status = USB_RET_STALL;
         return;
     }
 
     usb_packet_copy(p, s->setup_buf, p->iov.size);
+#endif
     p->actual_length = 0;
     s->setup_len   = (s->setup_buf[7] << 8) | s->setup_buf[6];
     s->setup_index = 0;
@@ -116,8 +118,8 @@
     index   = (s->setup_buf[5] << 8) | s->setup_buf[4];
 
     if (s->setup_buf[0] & USB_DIR_IN) {
-        usb_device_handle_control(s, p, request, value, index,
-                                  s->setup_len, s->data_buf);
+//        usb_device_handle_control(s, p, request, value, index,
+//                                  s->setup_len, s->data_buf);
         if (p->status == USB_RET_ASYNC) {
             s->setup_state = SETUP_STATE_SETUP;
         }
@@ -159,8 +161,8 @@
     switch(s->setup_state) {
     case SETUP_STATE_ACK:
         if (!(s->setup_buf[0] & USB_DIR_IN)) {
-            usb_device_handle_control(s, p, request, value, index,
-                                      s->setup_len, s->data_buf);
+//            usb_device_handle_control(s, p, request, value, index,
+//                                      s->setup_len, s->data_buf);
             if (p->status == USB_RET_ASYNC) {
                 return;
             }
@@ -172,9 +174,11 @@
     case SETUP_STATE_DATA:
         if (s->setup_buf[0] & USB_DIR_IN) {
             int len = s->setup_len - s->setup_index;
+#if 0
             if (len > p->iov.size) {
                 len = p->iov.size;
             }
+#endif
             usb_packet_copy(p, s->data_buf + s->setup_index, len);
             s->setup_index += len;
             if (s->setup_index >= s->setup_len) {
@@ -208,9 +212,11 @@
     case SETUP_STATE_DATA:
         if (!(s->setup_buf[0] & USB_DIR_IN)) {
             int len = s->setup_len - s->setup_index;
+#if 0
             if (len > p->iov.size) {
                 len = p->iov.size;
             }
+#endif
             usb_packet_copy(p, s->data_buf + s->setup_index, len);
             s->setup_index += len;
             if (s->setup_index >= s->setup_len) {
@@ -255,8 +261,8 @@
         usb_packet_copy(p, s->data_buf, s->setup_len);
     }
 
-    usb_device_handle_control(s, p, request, value, index,
-                              s->setup_len, s->data_buf);
+//    usb_device_handle_control(s, p, request, value, index,
+//                              s->setup_len, s->data_buf);
     if (p->status == USB_RET_ASYNC) {
         return;
     }
@@ -313,7 +319,8 @@
 /* XXX: fix overflow */
 int set_usb_string(uint8_t *buf, const char *str)
 {
-    int len, i;
+    size_t len;
+    int i;
     uint8_t *q;
 
     q = buf;
@@ -337,7 +344,8 @@
     if (dev->addr == addr) {
         return dev;
     }
-    return usb_device_find_device(dev, addr);
+//    return usb_device_find_device(dev, addr);
+    return 0;
 }
 
 static void usb_process_one(USBPacket *p)
@@ -372,7 +380,7 @@
         }
     } else {
         /* data pipe */
-        usb_device_handle_data(dev, p);
+//        usb_device_handle_data(dev, p);
     }
 }
 
@@ -437,10 +445,12 @@
     assert(QTAILQ_FIRST(&ep->queue) == p);
     assert(p->status != USB_RET_ASYNC && p->status != USB_RET_NAK);
 
+#if 0
     if (p->status != USB_RET_SUCCESS ||
             (p->short_not_ok && (p->actual_length < p->iov.size))) {
         ep->halted = true;
     }
+#endif
     usb_packet_set_state(p, USB_PACKET_COMPLETE);
     QTAILQ_REMOVE(&ep->queue, p, queue);
     dev->port->ops->complete(dev->port, p);
@@ -487,14 +497,14 @@
     usb_packet_set_state(p, USB_PACKET_CANCELED);
     QTAILQ_REMOVE(&p->ep->queue, p, queue);
     if (callback) {
-        usb_device_cancel_packet(p->ep->dev, p);
+//        usb_device_cancel_packet(p->ep->dev, p);
     }
 }
 
 
 void usb_packet_init(USBPacket *p)
 {
-    qemu_iovec_init(&p->iov, 1);
+//    qemu_iovec_init(&p->iov, 1);
 }
 
 static const char *usb_packet_state_name(USBPacketState state)
@@ -523,24 +533,30 @@
     }
     dev = p->ep->dev;
     bus = usb_bus_from_device(dev);
+#if 0
     trace_usb_packet_state_fault(bus->busnr, dev->port->path, p->ep->nr, p,
                                  usb_packet_state_name(p->state),
                                  usb_packet_state_name(expected));
+#endif
     assert(!"usb packet state check failed");
 }
 
 void usb_packet_set_state(USBPacket *p, USBPacketState state)
 {
     if (p->ep) {
+#if 0
         USBDevice *dev = p->ep->dev;
         USBBus *bus = usb_bus_from_device(dev);
         trace_usb_packet_state_change(bus->busnr, dev->port->path, p->ep->nr, p,
                                       usb_packet_state_name(p->state),
                                       usb_packet_state_name(state));
+#endif
     } else {
+#if 0
         trace_usb_packet_state_change(-1, "", -1, p,
                                       usb_packet_state_name(p->state),
                                       usb_packet_state_name(state));
+#endif
     }
     p->state = state;
 }
@@ -550,7 +566,7 @@
                       uint64_t id, bool short_not_ok, bool int_req)
 {
     assert(!usb_packet_is_inflight(p));
-    assert(p->iov.iov != NULL);
+//    assert(p->iov.iov != NULL);
     p->id = id;
     p->pid = pid;
     p->ep = ep;
@@ -561,17 +577,18 @@
     p->short_not_ok = short_not_ok;
     p->int_req = int_req;
     p->combined = NULL;
-    qemu_iovec_reset(&p->iov);
+//    qemu_iovec_reset(&p->iov);
     usb_packet_set_state(p, USB_PACKET_SETUP);
 }
 
 void usb_packet_addbuf(USBPacket *p, void *ptr, size_t len)
 {
-    qemu_iovec_add(&p->iov, ptr, len);
+//    qemu_iovec_add(&p->iov, ptr, len);
 }
 
 void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes)
 {
+#if 0
     QEMUIOVector *iov = p->combined ? &p->combined->iov : &p->iov;
 
     assert(p->actual_length >= 0);
@@ -589,10 +606,12 @@
         abort();
     }
     p->actual_length += bytes;
+#endif
 }
 
 void usb_packet_skip(USBPacket *p, size_t bytes)
 {
+#if 0
     QEMUIOVector *iov = p->combined ? &p->combined->iov : &p->iov;
 
     assert(p->actual_length >= 0);
@@ -601,17 +620,21 @@
         iov_memset(iov->iov, iov->niov, p->actual_length, 0, bytes);
     }
     p->actual_length += bytes;
+#endif
 }
 
 size_t usb_packet_size(USBPacket *p)
 {
+#if 0
     return p->combined ? p->combined->iov.size : p->iov.size;
+#endif
+    return 0;
 }
 
 void usb_packet_cleanup(USBPacket *p)
 {
     assert(!usb_packet_is_inflight(p));
-    qemu_iovec_destroy(&p->iov);
+//    qemu_iovec_destroy(&p->iov);
 }
 
 void usb_ep_reset(USBDevice *dev)

Modified: soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c
==============================================================================
--- soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c	Wed Jun 26 20:33:52 2013	(r253558)
+++ soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c	Wed Jun 26 20:35:14 2013	(r253559)
@@ -25,13 +25,7 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-#include "hw/hw.h"
 #include "hw/usb.h"
-#include "hw/pci/pci.h"
-#include "qemu/timer.h"
-#include "qemu/iov.h"
-#include "sysemu/dma.h"
-#include "trace.h"
 
 //#define DEBUG
 //#define DEBUG_DUMP_DATA
@@ -102,12 +96,12 @@
     uint16_t   device_id;
     uint8_t    revision;
     uint8_t    irq_pin;
-    int        (*initfn)(PCIDevice *dev);
+//    int        (*initfn)(PCIDevice *dev);
     bool       unplug;
 };
 
 struct UHCIPCIDeviceClass {
-    PCIDeviceClass parent_class;
+//    PCIDeviceClass parent_class;
     UHCIInfo       info;
 };
 
@@ -143,8 +137,8 @@
 } UHCIPort;
 
 struct UHCIState {
-    PCIDevice dev;
-    MemoryRegion io_bar;
+//    PCIDevice dev;
+//    MemoryRegion io_bar;
     USBBus bus; /* Note unused when we're a companion controller */
     uint16_t cmd; /* cmd register */
     uint16_t status;
@@ -154,8 +148,8 @@
     uint8_t sof_timing;
     uint8_t status2; /* bit 0 and 1 are used to generate UHCI_STS_USBINT */
     int64_t expire_time;
-    QEMUTimer *frame_timer;
-    QEMUBH *bh;
+//    QEMUTimer *frame_timer;
+//    QEMUBH *bh;
     uint32_t frame_bytes;
     uint32_t frame_bandwidth;
     bool completions_only;
@@ -206,7 +200,7 @@
 {
     UHCIQueue *queue;
 
-    queue = g_new0(UHCIQueue, 1);
+//    queue = g_new0(UHCIQueue, 1);
     queue->uhci = s;
     queue->qh_addr = qh_addr;
     queue->token = uhci_queue_token(td);
@@ -214,7 +208,7 @@
     QTAILQ_INIT(&queue->asyncs);
     QTAILQ_INSERT_HEAD(&s->queues, queue, next);
     queue->valid = QH_VALID;
-    trace_usb_uhci_queue_add(queue->token);
+//    trace_usb_uhci_queue_add(queue->token);
     return queue;
 }
 
@@ -229,9 +223,9 @@
     }
     usb_device_ep_stopped(queue->ep->dev, queue->ep);
 
-    trace_usb_uhci_queue_del(queue->token, reason);
+//    trace_usb_uhci_queue_del(queue->token, reason);
     QTAILQ_REMOVE(&s->queues, queue, next);
-    g_free(queue);
+//    g_free(queue);
 }
 
 static UHCIQueue *uhci_queue_find(UHCIState *s, UHCI_TD *td)
@@ -260,6 +254,7 @@
 
 static UHCIAsync *uhci_async_alloc(UHCIQueue *queue, uint32_t td_addr)
 {
+#if 0
     UHCIAsync *async = g_new0(UHCIAsync, 1);
 
     async->queue = queue;
@@ -268,40 +263,44 @@
     trace_usb_uhci_packet_add(async->queue->token, async->td_addr);
 
     return async;
+#endif
+    return 0;
 }
 
 static void uhci_async_free(UHCIAsync *async)
 {
-    trace_usb_uhci_packet_del(async->queue->token, async->td_addr);
+//    trace_usb_uhci_packet_del(async->queue->token, async->td_addr);
     usb_packet_cleanup(&async->packet);
     if (async->buf != async->static_buf) {
-        g_free(async->buf);
+//        g_free(async->buf);
     }
-    g_free(async);
+//    g_free(async);
 }
 
 static void uhci_async_link(UHCIAsync *async)
 {
     UHCIQueue *queue = async->queue;
     QTAILQ_INSERT_TAIL(&queue->asyncs, async, next);
-    trace_usb_uhci_packet_link_async(async->queue->token, async->td_addr);
+//    trace_usb_uhci_packet_link_async(async->queue->token, async->td_addr);
 }
 
 static void uhci_async_unlink(UHCIAsync *async)
 {
     UHCIQueue *queue = async->queue;
     QTAILQ_REMOVE(&queue->asyncs, async, next);
-    trace_usb_uhci_packet_unlink_async(async->queue->token, async->td_addr);
+//    trace_usb_uhci_packet_unlink_async(async->queue->token, async->td_addr);
 }
 
 static void uhci_async_cancel(UHCIAsync *async)
 {
+#if 0
     uhci_async_unlink(async);
     trace_usb_uhci_packet_cancel(async->queue->token, async->td_addr,
                                  async->done);
     if (!async->done)
         usb_cancel_packet(&async->packet);
     uhci_async_free(async);
+#endif
 }
 
 /*
@@ -379,11 +378,12 @@
     } else {
         level = 0;
     }
-    qemu_set_irq(s->dev.irq[s->irq_pin], level);
+//    qemu_set_irq(s->dev.irq[s->irq_pin], level);
 }
 
 static void uhci_reset(void *opaque)
 {
+#if 0
     UHCIState *s = opaque;
     uint8_t *pci_conf;
     int i;
@@ -413,8 +413,10 @@
     uhci_async_cancel_all(s);
     qemu_bh_cancel(s->bh);
     uhci_update_irq(s);
+#endif
 }
 
+#if 0
 static const VMStateDescription vmstate_uhci_port = {
     .name = "uhci port",
     .version_id = 1,
@@ -425,18 +427,20 @@
         VMSTATE_END_OF_LIST()
     }
 };
+#endif
 
 static int uhci_post_load(void *opaque, int version_id)
 {
-    UHCIState *s = opaque;
+//    UHCIState *s = opaque;
 
     if (version_id < 2) {
-        s->expire_time = qemu_get_clock_ns(vm_clock) +
-            (get_ticks_per_sec() / FRAME_TIMER_FREQ);
+//        s->expire_time = qemu_get_clock_ns(vm_clock) +
+//            (get_ticks_per_sec() / FRAME_TIMER_FREQ);
     }
     return 0;
 }
 
+#if 0
 static const VMStateDescription vmstate_uhci = {
     .name = "uhci",
     .version_id = 3,
@@ -461,10 +465,12 @@
         VMSTATE_END_OF_LIST()
     }
 };
+#endif
 
 static void uhci_port_write(void *opaque, hwaddr addr,
                             uint64_t val, unsigned size)
 {
+#if 0
     UHCIState *s = opaque;
 
     trace_usb_uhci_mmio_writew(addr, val);
@@ -555,10 +561,12 @@
         }
         break;
     }
+#endif
 }
 
 static uint64_t uhci_port_read(void *opaque, hwaddr addr, unsigned size)
 {
+#if 0
     UHCIState *s = opaque;
     uint32_t val;
 
@@ -604,6 +612,8 @@
     trace_usb_uhci_mmio_readw(addr, val);
 
     return val;
+#endif
+    return 0;
 }
 
 /* signal resume if controller suspended */
@@ -698,17 +708,17 @@
 
 static void uhci_read_td(UHCIState *s, UHCI_TD *td, uint32_t link)
 {
-    pci_dma_read(&s->dev, link & ~0xf, td, sizeof(*td));
-    le32_to_cpus(&td->link);
-    le32_to_cpus(&td->ctrl);
-    le32_to_cpus(&td->token);
-    le32_to_cpus(&td->buffer);
+//    pci_dma_read(&s->dev, link & ~0xf, td, sizeof(*td));
+//    le32_to_cpus(&td->link);
+//    le32_to_cpus(&td->ctrl);
+//    le32_to_cpus(&td->token);
+//    le32_to_cpus(&td->buffer);
 }
 
 static int uhci_handle_td_error(UHCIState *s, UHCI_TD *td, uint32_t td_addr,
                                 int status, uint32_t *int_mask)
 {
-    uint32_t queue_token = uhci_queue_token(td);
+//    uint32_t queue_token = uhci_queue_token(td);
     int ret;
 
     switch (status) {
@@ -718,14 +728,14 @@
 
     case USB_RET_STALL:
         td->ctrl |= TD_CTRL_STALL;
-        trace_usb_uhci_packet_complete_stall(queue_token, td_addr);
+//        trace_usb_uhci_packet_complete_stall(queue_token, td_addr);
         ret = TD_RESULT_NEXT_QH;
         break;
 
     case USB_RET_BABBLE:
         td->ctrl |= TD_CTRL_BABBLE | TD_CTRL_STALL;
         /* frame interrupted */
-        trace_usb_uhci_packet_complete_babble(queue_token, td_addr);
+//        trace_usb_uhci_packet_complete_babble(queue_token, td_addr);
         ret = TD_RESULT_STOP_FRAME;
         break;
 
@@ -734,7 +744,7 @@
     default:
         td->ctrl |= TD_CTRL_TIMEOUT;
         td->ctrl &= ~(3 << TD_CTRL_ERROR_SHIFT);
-        trace_usb_uhci_packet_complete_error(queue_token, td_addr);
+//        trace_usb_uhci_packet_complete_error(queue_token, td_addr);
         ret = TD_RESULT_NEXT_QH;
         break;
     }
@@ -775,19 +785,23 @@
         *int_mask |= 0x01;
 
     if (pid == USB_TOKEN_IN) {
-        pci_dma_write(&s->dev, td->buffer, async->buf, len);
+//        pci_dma_write(&s->dev, td->buffer, async->buf, len);
         if ((td->ctrl & TD_CTRL_SPD) && len < max_len) {
             *int_mask |= 0x02;
             /* short packet: do not update QH */
+#if 0
             trace_usb_uhci_packet_complete_shortxfer(async->queue->token,
                                                      async->td_addr);
+#endif
             return TD_RESULT_NEXT_QH;
         }
     }
 
     /* success */
+#if 0
     trace_usb_uhci_packet_complete_success(async->queue->token,
                                            async->td_addr);
+#endif
     return TD_RESULT_COMPLETE;
 }
 
@@ -886,14 +900,14 @@
     if (max_len <= sizeof(async->static_buf)) {
         async->buf = async->static_buf;
     } else {
-        async->buf = g_malloc(max_len);
+//        async->buf = g_malloc(max_len);
     }
     usb_packet_addbuf(&async->packet, async->buf, max_len);
 
     switch(pid) {
     case USB_TOKEN_OUT:
     case USB_TOKEN_SETUP:
-        pci_dma_read(&s->dev, td->buffer, async->buf, max_len);
+//        pci_dma_read(&s->dev, td->buffer, async->buf, max_len);
         usb_handle_packet(q->ep->dev, &async->packet);
         if (async->packet.status == USB_RET_SUCCESS) {
             async->packet.actual_length = max_len;
@@ -928,7 +942,7 @@
 
 static void uhci_async_complete(USBPort *port, USBPacket *packet)
 {
-    UHCIAsync *async = container_of(packet, UHCIAsync, packet);
+    UHCIAsync *async /*= container_of(packet, UHCIAsync, packet) */;
     UHCIState *s = async->queue->uhci;
 
     if (packet->status == USB_RET_REMOVE_FROM_QUEUE) {
@@ -939,7 +953,7 @@
     async->done = 1;
     /* Force processing of this packet *now*, needed for migration */
     s->completions_only = true;
-    qemu_bh_schedule(s->bh);
+//    qemu_bh_schedule(s->bh);
 }
 
 static int is_valid(uint32_t link)
@@ -999,7 +1013,7 @@
         if (uhci_queue_token(&ptd) != q->token) {
             break;
         }
-        trace_usb_uhci_td_queue(plink & ~0xf, ptd.ctrl, ptd.token);
+//        trace_usb_uhci_td_queue(plink & ~0xf, ptd.ctrl, ptd.token);
         ret = uhci_handle_td(q->uhci, q, q->qh_addr, &ptd, plink, &int_mask);
         if (ret == TD_RESULT_ASYNC_CONT) {
             break;
@@ -1013,7 +1027,7 @@
 
 static void uhci_process_frame(UHCIState *s)
 {
-    uint32_t frame_addr, link, old_td_ctrl, val, int_mask;
+    uint32_t frame_addr, link, old_td_ctrl, /*val,*/ int_mask;
     uint32_t curr_qh, td_count = 0;
     int cnt, ret;
     UHCI_TD td;
@@ -1022,8 +1036,8 @@
 
     frame_addr = s->fl_base_addr + ((s->frnum & 0x3ff) << 2);
 
-    pci_dma_read(&s->dev, frame_addr, &link, 4);
-    le32_to_cpus(&link);
+//    pci_dma_read(&s->dev, frame_addr, &link, 4);
+//    le32_to_cpus(&link);
 
     int_mask = 0;
     curr_qh  = 0;
@@ -1034,12 +1048,12 @@
         if (!s->completions_only && s->frame_bytes >= s->frame_bandwidth) {
             /* We've reached the usb 1.1 bandwidth, which is
                1280 bytes/frame, stop processing */
-            trace_usb_uhci_frame_stop_bandwidth();
+//            trace_usb_uhci_frame_stop_bandwidth();
             break;
         }
         if (is_qh(link)) {
             /* QH */
-            trace_usb_uhci_qh_load(link & ~0xf);
+//            trace_usb_uhci_qh_load(link & ~0xf);
 
             if (qhdb_insert(&qhdb, link)) {
                 /*
@@ -1050,19 +1064,19 @@
                  * since we've been here last time.
                  */
                 if (td_count == 0) {
-                    trace_usb_uhci_frame_loop_stop_idle();
+//                    trace_usb_uhci_frame_loop_stop_idle();
                     break;
                 } else {
-                    trace_usb_uhci_frame_loop_continue();
+//                    trace_usb_uhci_frame_loop_continue();
                     td_count = 0;
                     qhdb_reset(&qhdb);
                     qhdb_insert(&qhdb, link);
                 }
             }
 
-            pci_dma_read(&s->dev, link & ~0xf, &qh, sizeof(qh));
-            le32_to_cpus(&qh.link);
-            le32_to_cpus(&qh.el_link);
+//            pci_dma_read(&s->dev, link & ~0xf, &qh, sizeof(qh));
+//            le32_to_cpus(&qh.link);
+//            le32_to_cpus(&qh.el_link);
 
             if (!is_valid(qh.el_link)) {
                 /* QH w/o elements */
@@ -1078,14 +1092,14 @@
 
         /* TD */
         uhci_read_td(s, &td, link);
-        trace_usb_uhci_td_load(curr_qh & ~0xf, link & ~0xf, td.ctrl, td.token);
+//        trace_usb_uhci_td_load(curr_qh & ~0xf, link & ~0xf, td.ctrl, td.token);
 
         old_td_ctrl = td.ctrl;
         ret = uhci_handle_td(s, NULL, curr_qh, &td, link, &int_mask);
         if (old_td_ctrl != td.ctrl) {
             /* update the status bits of the TD */
-            val = cpu_to_le32(td.ctrl);
-            pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val));
+//            val = cpu_to_le32(td.ctrl);
+//            pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val));
         }
 
         switch (ret) {
@@ -1094,17 +1108,17 @@
 
         case TD_RESULT_NEXT_QH:
         case TD_RESULT_ASYNC_CONT:
-            trace_usb_uhci_td_nextqh(curr_qh & ~0xf, link & ~0xf);
+//            trace_usb_uhci_td_nextqh(curr_qh & ~0xf, link & ~0xf);
             link = curr_qh ? qh.link : td.link;
             continue;
 
         case TD_RESULT_ASYNC_START:
-            trace_usb_uhci_td_async(curr_qh & ~0xf, link & ~0xf);
+//            trace_usb_uhci_td_async(curr_qh & ~0xf, link & ~0xf);
             link = curr_qh ? qh.link : td.link;
             continue;
 
         case TD_RESULT_COMPLETE:
-            trace_usb_uhci_td_complete(curr_qh & ~0xf, link & ~0xf);
+//            trace_usb_uhci_td_complete(curr_qh & ~0xf, link & ~0xf);
             link = td.link;
             td_count++;
             s->frame_bytes += (td.ctrl & 0x7ff) + 1;
@@ -1112,8 +1126,8 @@
             if (curr_qh) {
                 /* update QH element link */
                 qh.el_link = link;
-                val = cpu_to_le32(qh.el_link);
-                pci_dma_write(&s->dev, (curr_qh & ~0xf) + 4, &val, sizeof(val));
+//                val = cpu_to_le32(qh.el_link);
+//                pci_dma_write(&s->dev, (curr_qh & ~0xf) + 4, &val, sizeof(val));
 
                 if (!depth_first(link)) {
                     /* done with this QH */
@@ -1145,15 +1159,15 @@
     UHCIState *s = opaque;
     uint64_t t_now, t_last_run;
     int i, frames;
-    const uint64_t frame_t = get_ticks_per_sec() / FRAME_TIMER_FREQ;
+    const uint64_t frame_t /* = get_ticks_per_sec() / FRAME_TIMER_FREQ */;
 
     s->completions_only = false;
-    qemu_bh_cancel(s->bh);
+//    qemu_bh_cancel(s->bh);
 
     if (!(s->cmd & UHCI_CMD_RS)) {
         /* Full stop */
-        trace_usb_uhci_schedule_stop();
-        qemu_del_timer(s->frame_timer);
+//        trace_usb_uhci_schedule_stop();
+//        qemu_del_timer(s->frame_timer);
         uhci_async_cancel_all(s);
         /* set hchalted bit in status - UHCI11D 2.1.2 */
         s->status |= UHCI_STS_HCHALTED;
@@ -1162,7 +1176,7 @@
 
     /* We still store expire_time in our state, for migration */
     t_last_run = s->expire_time - frame_t;
-    t_now = qemu_get_clock_ns(vm_clock);
+//    t_now = qemu_get_clock_ns(vm_clock);
 
     /* Process up to MAX_FRAMES_PER_TICK frames */
     frames = (t_now - t_last_run) / frame_t;
@@ -1178,7 +1192,7 @@
 
     for (i = 0; i < frames; i++) {
         s->frame_bytes = 0;
-        trace_usb_uhci_frame_start(s->frnum);
+//        trace_usb_uhci_frame_start(s->frnum);
         uhci_async_validate_begin(s);
         uhci_process_frame(s);
         uhci_async_validate_end(s);
@@ -1196,9 +1210,10 @@
     }
     s->pending_int_mask = 0;
 
-    qemu_mod_timer(s->frame_timer, t_now + frame_t);
+//    qemu_mod_timer(s->frame_timer, t_now + frame_t);
 }
 
+/*
 static const MemoryRegionOps uhci_ioport_ops = {
     .read  = uhci_port_read,
     .write = uhci_port_write,
@@ -1216,10 +1231,11 @@
     .wakeup = uhci_wakeup,
     .complete = uhci_async_complete,
 };
+*/
 
+#if 0
 static USBBusOps uhci_bus_ops = {
 };
-
 static int usb_uhci_common_initfn(PCIDevice *dev)
 {
     PCIDeviceClass *pc = PCI_DEVICE_GET_CLASS(dev);
@@ -1266,7 +1282,8 @@
 
     return 0;
 }
-
+#endif
+#if 0
 static int usb_uhci_vt82c686b_initfn(PCIDevice *dev)
 {
     UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
@@ -1281,14 +1298,18 @@
 
     return usb_uhci_common_initfn(dev);
 }
+#endif
 
+#if 0
 static void usb_uhci_exit(PCIDevice *dev)
 {
     UHCIState *s = DO_UPCAST(UHCIState, dev, dev);
 
     memory_region_destroy(&s->io_bar);
 }
+#endif
 
+#if 0
 static Property uhci_properties[] = {
     DEFINE_PROP_STRING("masterbus", UHCIState, masterbus),
     DEFINE_PROP_UINT32("firstport", UHCIState, firstport, 0),
@@ -1296,7 +1317,9 @@
     DEFINE_PROP_UINT32("maxframes", UHCIState, maxframes, 128),
     DEFINE_PROP_END_OF_LIST(),
 };
+#endif
 
+#if 0
 static void uhci_class_init(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -1315,7 +1338,9 @@
     dc->props = uhci_properties;
     u->info = *info;
 }
+#endif
 
+#if 0
 static UHCIInfo uhci_info[] = {
     {
         .name       = "piix3-usb-uhci",
@@ -1383,9 +1408,11 @@
         .unplug    = false,
     }
 };
+#endif
 
 static void uhci_register_types(void)
 {
+#if 0
     TypeInfo uhci_type_info = {
         .parent        = TYPE_PCI_DEVICE,
         .instance_size = sizeof(UHCIState),
@@ -1399,6 +1426,7 @@
         uhci_type_info.class_data = uhci_info + i;
         type_register(&uhci_type_info);
     }
+#endif
 }
 
-type_init(uhci_register_types)
+//type_init(uhci_register_types)

Modified: soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/hw/usb.h
==============================================================================
--- soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/hw/usb.h	Wed Jun 26 20:33:52 2013	(r253558)
+++ soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/hw/usb.h	Wed Jun 26 20:35:14 2013	(r253559)
@@ -25,9 +25,15 @@
  * THE SOFTWARE.
  */
 
-#include "hw/qdev.h"
+#include <stdio.h>
+#include <sys/types.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <assert.h>
 #include "qemu/queue.h"
 
+typedef uint64_t hwaddr;
+
 /* Constants related to the USB / PCI interaction */
 #define USB_SBRN    0x60 /* Serial Bus Release Number Register */
 #define USB_RELEASE_1  0x10 /* USB 1.0 */
@@ -202,7 +208,7 @@
 
 /* definition of a USB device */
 struct USBDevice {
-    DeviceState qdev;
+//    DeviceState qdev;
     USBPort *port;
     char *port_path;
     char *serial;
@@ -250,7 +256,7 @@
      OBJECT_GET_CLASS(USBDeviceClass, (obj), TYPE_USB_DEVICE)
 
 typedef struct USBDeviceClass {
-    DeviceClass parent_class;
+//    DeviceClass parent_class;
 
     int (*init)(USBDevice *dev);
 
@@ -364,7 +370,7 @@
     uint64_t id;
     USBEndpoint *ep;
     unsigned int stream;
-    QEMUIOVector iov;
+//    QEMUIOVector iov;
     uint64_t parameter; /* control transfers */
     bool short_not_ok;
     bool int_req;
@@ -380,7 +386,7 @@
 struct USBCombinedPacket {
     USBPacket *first;
     QTAILQ_HEAD(packets_head, USBPacket) packets;
-    QEMUIOVector iov;
+//    QEMUIOVector iov;
 };
 
 void usb_packet_init(USBPacket *p);
@@ -390,8 +396,8 @@
                       USBEndpoint *ep, unsigned int stream,
                       uint64_t id, bool short_not_ok, bool int_req);
 void usb_packet_addbuf(USBPacket *p, void *ptr, size_t len);
-int usb_packet_map(USBPacket *p, QEMUSGList *sgl);
-void usb_packet_unmap(USBPacket *p, QEMUSGList *sgl);
+//int usb_packet_map(USBPacket *p, QEMUSGList *sgl);
+//void usb_packet_unmap(USBPacket *p, QEMUSGList *sgl);
 void usb_packet_copy(USBPacket *p, void *ptr, size_t bytes);
 void usb_packet_skip(USBPacket *p, size_t bytes);
 size_t usb_packet_size(USBPacket *p);
@@ -440,10 +446,10 @@
 
 /* usb-linux.c */
 USBDevice *usb_host_device_open(USBBus *bus, const char *devname);
-void usb_host_info(Monitor *mon, const QDict *qdict);
+//void usb_host_info(Monitor *mon, const QDict *qdict);
 
 /* usb-bt.c */
-USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci);
+//USBDevice *usb_bt_init(USBBus *bus, HCIInfo *hci);
 
 /* usb ports of the VM */
 
@@ -468,7 +474,7 @@
 };
 
 typedef struct MUSBState MUSBState;
-MUSBState *musb_init(DeviceState *parent_device, int gpio_base);
+//MUSBState *musb_init(DeviceState *parent_device, int gpio_base);
 void musb_reset(MUSBState *s);
 uint32_t musb_core_intr_get(MUSBState *s);
 void musb_core_intr_clear(MUSBState *s, uint32_t mask);
@@ -480,7 +486,7 @@
 #define USB_BUS(obj) OBJECT_CHECK(USBBus, (obj), TYPE_USB_BUS)
 
 struct USBBus {
-    BusState qbus;
+//    BusState qbus;
     USBBusOps *ops;
     int busnr;
     int nfree;
@@ -496,7 +502,7 @@
     void (*wakeup_endpoint)(USBBus *bus, USBEndpoint *ep, unsigned int stream);
 };
 
-void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host);
+//void usb_bus_new(USBBus *bus, USBBusOps *ops, DeviceState *host);
 USBBus *usb_bus_find(int busnr);
 void usb_legacy_register(const char *typename, const char *usbdevice_name,
                          USBDevice *(*usbdevice_init)(USBBus *bus,
@@ -519,10 +525,11 @@
 
 static inline USBBus *usb_bus_from_device(USBDevice *d)
 {
-    return DO_UPCAST(USBBus, qbus, d->qdev.parent_bus);
+//    return DO_UPCAST(USBBus, qbus, d->qdev.parent_bus);
+    return NULL;
 }
 
-extern const VMStateDescription vmstate_usb_device;
+//extern const VMStateDescription vmstate_usb_device;
 
 #define VMSTATE_USB_DEVICE(_field, _state) {                         \
     .name       = (stringify(_field)),                               \
@@ -556,7 +563,7 @@
 
 const USBDesc *usb_device_get_usb_desc(USBDevice *dev);
 
-int ehci_create_ich9_with_companions(PCIBus *bus, int slot);
+//int ehci_create_ich9_with_companions(PCIBus *bus, int slot);
 
 /* quirks.c */
 

Modified: soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/qemu/queue.h
==============================================================================
--- soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/qemu/queue.h	Wed Jun 26 20:33:52 2013	(r253558)
+++ soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/include/qemu/queue.h	Wed Jun 26 20:35:14 2013	(r253559)
@@ -78,8 +78,6 @@
  * For details on the use of these macros, see the queue(3) manual page.
  */
 
-#include "qemu/atomic.h" /* for smp_wmb() */
-
 /*
  * List definitions.
  */


More information about the svn-soc-all mailing list