Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jul 2013 17:16:23 GMT
From:      bguan@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r255006 - soc2013/bguan/head/sys/dev/xen/usbfront
Message-ID:  <201307211716.r6LHGN7J054583@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bguan
Date: Sun Jul 21 17:16:23 2013
New Revision: 255006
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=255006

Log:
  get rid of the pci stuff

Modified:
  soc2013/bguan/head/sys/dev/xen/usbfront/usbfront.c

Modified: soc2013/bguan/head/sys/dev/xen/usbfront/usbfront.c
==============================================================================
--- soc2013/bguan/head/sys/dev/xen/usbfront/usbfront.c	Sun Jul 21 17:15:35 2013	(r255005)
+++ soc2013/bguan/head/sys/dev/xen/usbfront/usbfront.c	Sun Jul 21 17:16:23 2013	(r255006)
@@ -26,6 +26,8 @@
 //__FBSDID("$FreeBSD: release/9.1.0/sys/dev/xen/usbfront/usbfront.c 237873 2013-07-01 05:13:50Z ken $");
 __FBSDID("$FreeBSD$");
 
+#include <sys/stdint.h>
+#include <sys/stddef.h>
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/malloc.h>
@@ -74,8 +76,8 @@
 #include <dev/usb/usb_bus.h>
 #include <dev/usb/usb_pci.h>
 
-#include <dev/xen/usbfront/xenhci.h>
 #include <dev/usb/usb_device.h>
+#include <dev/xen/usbfront/xenhci.h>
 
 #include "xenbus_if.h"
 
@@ -86,13 +88,18 @@
 #define DPRINTK(fmt, args...)
 #endif
 
+static int usbfront_probe(device_t dev);
+static int usbfront_attach(device_t dev);
 static int usbfront_detach(device_t dev);
+static int usbfront_suspend(device_t dev);
+static int usbfront_resume(device_t dev);
+
 
 /**
  * Entry point to this code when a new device is created. Allocate the basic
  * structures and the ring buffers for communication with the backend, and
  * inform the backend of the appropriate details for those. Switch to
- * Connected state. 
+ * Connected state.
  */
 static int
 usbfront_probe(device_t dev)
@@ -119,7 +126,7 @@
 {
 	struct 			xenhci_softc *sc;
 	int 			err;
-	int 			rid;
+	//int 			rid;
 
 	int 			i;
 	int 			num_ports;
@@ -130,15 +137,11 @@
 
 	sc = device_get_softc(dev);
 
-	/* initialise some bus fields */
-	sc->sc_bus.parent = dev;
-
-	/* set up the bus struct */
-	sc->sc_bus.methods = &xenhci_bus_methods;
-
-	/* setup devices array */
-	sc->sc_bus.devices = sc->sc_devices;
-	sc->sc_bus.devices_max = XENHCI_MAX_DEVICES;
+	/* initialise some bus fields */	
+	if (xenhci_init(sc, dev)) {
+		device_printf(dev, "Could not initialize xen usb hc softc\n");
+		goto error;
+	}
 
 	/* set the bus revision, read the revision from xenstore */
 	backend_path = xenbus_get_otherend_path(dev);
@@ -162,38 +165,15 @@
 			return (err);
 	}
 
-	/* allocate resource for usb host controller (copy from xhci_pci.c) */
-	pci_enable_busmaster(dev);
-
-	rid = PCI_CBMEM;
-	sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
-	    RF_ACTIVE);
-	if (!sc->sc_io_res) {
-		device_printf(dev, "Could not map memory\n");
-		goto error;
-	}
-	sc->sc_io_tag = rman_get_bustag(sc->sc_io_res);
-	sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res);
-	sc->sc_io_size = rman_get_size(sc->sc_io_res);
-
-	usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0);
-
-	rid = 0;
-	sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
-	    RF_SHAREABLE | RF_ACTIVE);
-	if (sc->sc_irq_res == NULL) {
-		device_printf(dev, "Could not allocate IRQ\n");
-	}
-
 	sc->sc_bus.bdev = device_add_child(dev, "usbus", -1);
 	if (sc->sc_bus.bdev == NULL) {
 		device_printf(dev, "Could not add USB device\n");
 		goto error;
 	}
+	printf("[gbdebug-pvusb]device_add_child() done!\n");
 	device_set_ivars(sc->sc_bus.bdev, &sc->sc_bus);
 
-
-	/* xen related stuff*/
+	/* xen shared ring related stuff*/
 	err = xs_scanf(XST_NIL, backend_path, "num-ports", NULL, "%d", &num_ports);
 	if (err) {
 		xenbus_dev_fatal(dev, err, "reading num-ports");
@@ -216,7 +196,7 @@
 	sc->shadow[USB_URB_RING_SIZE-1].req.id = 0x0fff;
 
 
-	/* attach the xen host controller */
+	/* attach the xen host controller */ //TODO??
 	err = device_probe_and_attach(sc->sc_bus.bdev);
 	if (err) {
 		device_printf(dev, "XENHCI halt/start/probe failed err=%d\n", err);



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