Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: usb and no bus_dma(9)
> > For compromise, how about:
> > - use "#if NUHCI > 0 || NOHCI > 0 || NEHCI > 0" (or so) in *.c sources
> > - prepare dummy typedefs in MD bus.h for structures in headers
> > (I guess landisk one might help)
>
> I remake this patch.
:
> --- usb_mem.c 4 Jan 2011 01:37:55 -0000 1.45
> +++ usb_mem.c 17 Mar 2011 07:58:43 -0000
:
> +#if (NEHCI + NOHCI + NUHCI) > 0
As Manuel suggested, it's better to use usb_dma attribute
because slhci(4) doesn't require functions in usb_mem.c
except MALLOC_DEFINE(), which is not DMA related and
can be moved into usb_subr.c etc. (patch attached)
> --- mmeye/include/bus.h 13 Sep 1999 10:30:54 -0000 1.1
> +++ mmeye/include/bus.h 17 Mar 2011 08:15:02 -0000
:
> +/*
> + * Dummy bus_dma(9)
> + * XXXX: mmeye don't use bus_dma.
> + */
> +typedef void * bus_dma_tag_t;
> +typedef void * bus_dmamap_t;
> +typedef void * bus_dma_segment_t;
bus_dma_tag_t is opaque so it's okay to use void * (or int),
but bus_dmamap_t and bus_dma_segment_t should be structures
with public members as defined in bus_dma(9) man page:
---
typedef struct {
bus_addr_t ds_addr;
bus_size_t ds_len;
} bus_dma_segment_t;
typedef struct {
bus_size_t dm_maxsegsz;
bus_size_t dm_mapsize;
int dm_nsegs;
bus_dma_segment_t *dm_segs;
} bus_dmamap_t;
---
Index: conf/files
===================================================================
RCS file: /cvsroot/src/sys/conf/files,v
retrieving revision 1.1004
diff -u -p -r1.1004 files
--- conf/files 6 Mar 2011 17:08:35 -0000 1.1004
+++ conf/files 17 Mar 2011 12:51:05 -0000
@@ -1153,17 +1153,19 @@ defparam USB_MEM_RESERVE
define usbroothub
file dev/usb/usbroothub_subr.c usbroothub
-device uhci: usbus, usbroothub
+define usb_dma
+
+device uhci: usbus, usbroothub, usb_dma
file dev/usb/uhci.c uhci needs-flag
# OHCI USB controller
#
-device ohci: usbus, usbroothub
+device ohci: usbus, usbroothub, usb_dma
file dev/usb/ohci.c ohci needs-flag
# EHCI USB controller
#
-device ehci: usbus, usbroothub
+device ehci: usbus, usbroothub, usb_dma
file dev/usb/ehci.c ehci needs-flag
# SL811HS/T USB controller
Index: dev/usb/files.usb
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/files.usb,v
retrieving revision 1.104
diff -u -p -r1.104 files.usb
--- dev/usb/files.usb 27 Dec 2010 20:42:51 -0000 1.104
+++ dev/usb/files.usb 17 Mar 2011 12:51:05 -0000
@@ -20,7 +20,7 @@ attach usb at usbus
file dev/usb/usb.c usb needs-flag
file dev/usb/usbdi.c usb
file dev/usb/usbdi_util.c usb
-file dev/usb/usb_mem.c usb
+file dev/usb/usb_mem.c usb & usb_dma
file dev/usb/usb_subr.c usb
file dev/usb/usb_quirks.c usb
file dev/usb/usb_verbose.c usb & usbverbose
Index: dev/usb/usb_mem.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_mem.c,v
retrieving revision 1.45
diff -u -p -r1.45 usb_mem.c
--- dev/usb/usb_mem.c 4 Jan 2011 01:37:55 -0000 1.45
+++ dev/usb/usb_mem.c 17 Mar 2011 12:51:05 -0000
@@ -75,10 +75,6 @@ extern int usbdebug;
#define DPRINTFN(n,x)
#endif
-MALLOC_DEFINE(M_USB, "USB", "USB misc. memory");
-MALLOC_DEFINE(M_USBDEV, "USB device", "USB device driver");
-MALLOC_DEFINE(M_USBHC, "USB HC", "USB host controller");
-
#define USB_MEM_SMALL 64
#define USB_MEM_CHUNKS 64
#define USB_MEM_BLOCK (USB_MEM_SMALL * USB_MEM_CHUNKS)
Index: dev/usb/usb_subr.c
===================================================================
RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v
retrieving revision 1.177
diff -u -p -r1.177 usb_subr.c
--- dev/usb/usb_subr.c 3 Nov 2010 22:34:24 -0000 1.177
+++ dev/usb/usb_subr.c 17 Mar 2011 12:51:06 -0000
@@ -68,6 +68,10 @@ extern int usbdebug;
#define DPRINTFN(n,x)
#endif
+MALLOC_DEFINE(M_USB, "USB", "USB misc. memory");
+MALLOC_DEFINE(M_USBDEV, "USB device", "USB device driver");
+MALLOC_DEFINE(M_USBHC, "USB HC", "USB host controller");
+
Static usbd_status usbd_set_config(usbd_device_handle, int);
Static void usbd_devinfo(usbd_device_handle, int, char *, size_t);
Static void usbd_devinfo_vp(usbd_device_handle, char *, size_t, char *, size_t,
---
Izumi Tsutsui
Home |
Main Index |
Thread Index |
Old Index