Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 2013 10:32:35 GMT
From:      syuu@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r253646 - soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb
Message-ID:  <201306281032.r5SAWZC7043524@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: syuu
Date: Fri Jun 28 10:32:35 2013
New Revision: 253646
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=253646

Log:
  cpu_to_le32/le32_to_cpus

Modified:
  soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c

Modified: soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c
==============================================================================
--- soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c	Fri Jun 28 09:55:00 2013	(r253645)
+++ soc2013/syuu/bhyve_usb/usr.sbin/bhyve/usb/hcd-uhci.c	Fri Jun 28 10:32:35 2013	(r253646)
@@ -26,6 +26,10 @@
  * THE SOFTWARE.
  */
 #include "hw/usb.h"
+#include <sys/endian.h>
+
+#define le32_to_cpus(x) le32toh(x)
+#define cpu_to_le32(x) htole32(x)
 
 //#define DEBUG
 //#define DEBUG_DUMP_DATA
@@ -709,10 +713,10 @@
 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);
+    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,
@@ -1027,7 +1031,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;
@@ -1037,7 +1041,7 @@
     frame_addr = s->fl_base_addr + ((s->frnum & 0x3ff) << 2);
 
 //    pci_dma_read(&s->dev, frame_addr, &link, 4);
-//    le32_to_cpus(&link);
+    le32_to_cpus(&link);
 
     int_mask = 0;
     curr_qh  = 0;
@@ -1075,8 +1079,8 @@
             }
 
 //            pci_dma_read(&s->dev, link & ~0xf, &qh, sizeof(qh));
-//            le32_to_cpus(&qh.link);
-//            le32_to_cpus(&qh.el_link);
+            le32_to_cpus(&qh.link);
+            le32_to_cpus(&qh.el_link);
 
             if (!is_valid(qh.el_link)) {
                 /* QH w/o elements */
@@ -1098,7 +1102,7 @@
         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);
+            val = cpu_to_le32(td.ctrl);
 //            pci_dma_write(&s->dev, (link & ~0xf) + 4, &val, sizeof(val));
         }
 
@@ -1126,7 +1130,7 @@
             if (curr_qh) {
                 /* update QH element link */
                 qh.el_link = link;
-//                val = cpu_to_le32(qh.el_link);
+                val = cpu_to_le32(qh.el_link);
 //                pci_dma_write(&s->dev, (curr_qh & ~0xf) + 4, &val, sizeof(val));
 
                 if (!depth_first(link)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201306281032.r5SAWZC7043524>