Permalink
Browse files

Update Synopsys USB OTG driver to v2.94a and disable CRYPTOLIB

  • Loading branch information...
ddv2005 committed Aug 15, 2012
1 parent c664352 commit df9a56229363ae095a7687df117f3f79ba42a20d
Showing 364 changed files with 77,086 additions and 71,826 deletions.
View
@@ -4,34 +4,47 @@
ifneq ($(KERNELRELEASE),)
-#CPPFLAGS += -DDEBUG_MEMORY
+EXTRA_CFLAGS += -DDWC_LINUX
+#EXTRA_CFLAGS += -DDEBUG
+#EXTRA_CFLAGS += -DDWC_DEBUG_REGS
+#EXTRA_CFLAGS += -DDWC_DEBUG_MEMORY
-ifeq ($(CONFIG_USB_DEBUG),y)
-CPPFLAGS += -DDEBUG
-endif
-CPPFLAGS += -DDWC_LINUX
+EXTRA_CFLAGS += -DDWC_LIBMODULE
+EXTRA_CFLAGS += -DDWC_CCLIB
+#EXTRA_CFLAGS += -DDWC_CRYPTOLIB
+EXTRA_CFLAGS += -DDWC_NOTIFYLIB
+EXTRA_CFLAGS += -DDWC_UTFLIB
obj-$(CONFIG_USB_DWCOTG) += dwc_common_port_lib.o
-dwc_common_port_lib-objs := dwc_cc.o \
- dwc_notifier.o \
- dwc_common_linux.o dwc_mem.o
+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \
+ dwc_crypto.o dwc_notifier.o \
+ dwc_common_linux.o dwc_mem.o
kernrelwd := $(subst ., ,$(KERNELRELEASE))
kernrel3 := $(word 1,$(kernrelwd)).$(word 2,$(kernrelwd)).$(word 3,$(kernrelwd))
-
+
ifneq ($(kernrel3),2.6.20)
# grayg - I only know that we use EXTRA_CFLAGS in 2.6.31 actually
EXTRA_CFLAGS += $(CPPFLAGS)
endif
else
+ifeq ($(KDIR),)
+$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
+endif
+
+ifeq ($(ARCH),)
+$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
+endif
+
ifeq ($(DOXYGEN),)
-DOXYGEN := $(DOXYGEN)
+DOXYGEN := doxygen
endif
default:
- $(MAKE) -C$(KDIR) M=$(PWD) modules
+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
docs: $(wildcard *.[hc]) doc/doxygen.cfg
$(DOXYGEN) doc/doxygen.cfg
@@ -42,5 +55,4 @@ tags: $(wildcard *.[hc])
endif
clean:
- rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers
-
+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
@@ -0,0 +1,17 @@
+CFLAGS += -I/sys/i386/compile/GENERIC -I/sys/i386/include -I/usr/include
+CFLAGS += -DDWC_FREEBSD
+CFLAGS += -DDEBUG
+#CFLAGS += -DDWC_DEBUG_REGS
+#CFLAGS += -DDWC_DEBUG_MEMORY
+
+#CFLAGS += -DDWC_LIBMODULE
+#CFLAGS += -DDWC_CCLIB
+#CFLAGS += -DDWC_CRYPTOLIB
+#CFLAGS += -DDWC_NOTIFYLIB
+#CFLAGS += -DDWC_UTFLIB
+
+KMOD = dwc_common_port_lib
+SRCS = dwc_cc.c dwc_modpow.c dwc_dh.c dwc_crypto.c dwc_notifier.c \
+ dwc_common_fbsd.c dwc_mem.c
+
+.include <bsd.kmod.mk>
View
@@ -3,25 +3,39 @@
#
ifneq ($(KERNELRELEASE),)
-#CPPFLAGS += -DDEBUG_MEMORY
-
-#CPPFLAGS += -DDEBUG
-CPPFLAGS += -DDWC_LINUX
-
-obj-m := dwc_common_port_lib.o
-dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \
- dwc_crypto.o dwc_notifier.o \
- dwc_common_linux.o dwc_mem.o
+EXTRA_CFLAGS += -DDWC_LINUX
+#EXTRA_CFLAGS += -DDEBUG
+#EXTRA_CFLAGS += -DDWC_DEBUG_REGS
+#EXTRA_CFLAGS += -DDWC_DEBUG_MEMORY
+
+EXTRA_CFLAGS += -DDWC_LIBMODULE
+EXTRA_CFLAGS += -DDWC_CCLIB
+EXTRA_CFLAGS += -DDWC_CRYPTOLIB
+EXTRA_CFLAGS += -DDWC_NOTIFYLIB
+EXTRA_CFLAGS += -DDWC_UTFLIB
+
+obj-m := dwc_common_port_lib.o
+dwc_common_port_lib-objs := dwc_cc.o dwc_modpow.o dwc_dh.o \
+ dwc_crypto.o dwc_notifier.o \
+ dwc_common_linux.o dwc_mem.o
else
+ifeq ($(KDIR),)
+$(error Must give "KDIR=/path/to/kernel/source" on command line or in environment)
+endif
+
+ifeq ($(ARCH),)
+$(error Must give "ARCH=<arch>" on command line or in environment. Also, if \
+ cross-compiling, must give "CROSS_COMPILE=/path/to/compiler/plus/tool-prefix-")
+endif
ifeq ($(DOXYGEN),)
-DOXYGEN := $(DOXYGEN)
+DOXYGEN := doxygen
endif
default:
- $(MAKE) -C$(KDIR) M=$(PWD) modules
+ $(MAKE) -C$(KDIR) M=$(PWD) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) modules
docs: $(wildcard *.[hc]) doc/doxygen.cfg
$(DOXYGEN) doc/doxygen.cfg
@@ -32,5 +46,4 @@ tags: $(wildcard *.[hc])
endif
clean:
- rm -rf *.o *.ko .*cmd *.mod.c .tmp_versions Module.symvers
-
+ rm -rf *.o *.ko .*.cmd *.mod.c .*.o.d .*.o.tmp modules.order Module.markers Module.symvers .tmp_versions/
@@ -0,0 +1,174 @@
+
+dwc_read_reg32() and friends now take an additional parameter, a pointer to an
+IO context struct. The IO context struct should live in an os-dependent struct
+in your driver. As an example, the dwc_usb3 driver has an os-dependent struct
+named 'os_dep' embedded in the main device struct. So there these calls look
+like this:
+
+ dwc_read_reg32(&usb3_dev->os_dep.ioctx, &pcd->dev_global_regs->dcfg);
+
+ dwc_write_reg32(&usb3_dev->os_dep.ioctx,
+ &pcd->dev_global_regs->dcfg, 0);
+
+Note that for the existing Linux driver ports, it is not necessary to actually
+define the 'ioctx' member in the os-dependent struct. Since Linux does not
+require an IO context, its macros for dwc_read_reg32() and friends do not
+use the context pointer, so it is optimized away by the compiler. But it is
+necessary to add the pointer parameter to all of the call sites, to be ready
+for any future ports (such as FreeBSD) which do require an IO context.
+
+
+Similarly, dwc_alloc(), dwc_alloc_atomic(), dwc_strdup(), and dwc_free() now
+take an additional parameter, a pointer to a memory context. Examples:
+
+ addr = dwc_alloc(&usb3_dev->os_dep.memctx, size);
+
+ dwc_free(&usb3_dev->os_dep.memctx, addr);
+
+Again, for the Linux ports, it is not necessary to actually define the memctx
+member, but it is necessary to add the pointer parameter to all of the call
+sites.
+
+
+Same for dwc_dma_alloc() and dwc_dma_free(). Examples:
+
+ virt_addr = dwc_dma_alloc(&usb3_dev->os_dep.dmactx, size, &phys_addr);
+
+ dwc_dma_free(&usb3_dev->os_dep.dmactx, size, virt_addr, phys_addr);
+
+
+Same for dwc_mutex_alloc() and dwc_mutex_free(). Examples:
+
+ mutex = dwc_mutex_alloc(&usb3_dev->os_dep.mtxctx);
+
+ dwc_mutex_free(&usb3_dev->os_dep.mtxctx, mutex);
+
+
+Same for dwc_spinlock_alloc() and dwc_spinlock_free(). Examples:
+
+ lock = dwc_spinlock_alloc(&usb3_dev->osdep.splctx);
+
+ dwc_spinlock_free(&usb3_dev->osdep.splctx, lock);
+
+
+Same for dwc_timer_alloc(). Example:
+
+ timer = dwc_timer_alloc(&usb3_dev->os_dep.tmrctx, "dwc_usb3_tmr1",
+ cb_func, cb_data);
+
+
+Same for dwc_waitq_alloc(). Example:
+
+ waitq = dwc_waitq_alloc(&usb3_dev->os_dep.wtqctx);
+
+
+Same for dwc_thread_run(). Example:
+
+ thread = dwc_thread_run(&usb3_dev->os_dep.thdctx, func,
+ "dwc_usb3_thd1", data);
+
+
+Same for dwc_workq_alloc(). Example:
+
+ workq = dwc_workq_alloc(&usb3_dev->osdep.wkqctx, "dwc_usb3_wkq1");
+
+
+Same for dwc_task_alloc(). Example:
+
+ task = dwc_task_alloc(&usb3_dev->os_dep.tskctx, "dwc_usb3_tsk1",
+ cb_func, cb_data);
+
+
+In addition to the context pointer additions, a few core functions have had
+other changes made to their parameters:
+
+The 'flags' parameter to dwc_spinlock_irqsave() and dwc_spinunlock_irqrestore()
+has been changed from a uint64_t to a dwc_irqflags_t.
+
+dwc_thread_should_stop() now takes a 'dwc_thread_t *' parameter, because the
+FreeBSD equivalent of that function requires it.
+
+And, in addition to the context pointer, dwc_task_alloc() also adds a
+'char *name' parameter, to be consistent with dwc_thread_run() and
+dwc_workq_alloc(), and because the FreeBSD equivalent of that function
+requires a unique name.
+
+
+Here is a complete list of the core functions that now take a pointer to a
+context as their first parameter:
+
+ dwc_read_reg32
+ dwc_read_reg64
+ dwc_write_reg32
+ dwc_write_reg64
+ dwc_modify_reg32
+ dwc_modify_reg64
+ dwc_alloc
+ dwc_alloc_atomic
+ dwc_strdup
+ dwc_free
+ dwc_dma_alloc
+ dwc_dma_free
+ dwc_mutex_alloc
+ dwc_mutex_free
+ dwc_spinlock_alloc
+ dwc_spinlock_free
+ dwc_timer_alloc
+ dwc_waitq_alloc
+ dwc_thread_run
+ dwc_workq_alloc
+ dwc_task_alloc Also adds a 'char *name' as its 2nd parameter
+
+And here are the core functions that have other changes to their parameters:
+
+ dwc_spinlock_irqsave 'flags' param is now a 'dwc_irqflags_t *'
+ dwc_spinunlock_irqrestore 'flags' param is now a 'dwc_irqflags_t'
+ dwc_thread_should_stop Adds a 'dwc_thread_t *' parameter
+
+
+
+The changes to the core functions also require some of the other library
+functions to change:
+
+ dwc_cc_if_alloc() and dwc_cc_if_free() now take a 'void *memctx'
+ (for memory allocation) as the 1st param and a 'void *mtxctx'
+ (for mutex allocation) as the 2nd param.
+
+ dwc_cc_clear(), dwc_cc_add(), dwc_cc_change(), dwc_cc_remove(),
+ dwc_cc_data_for_save(), and dwc_cc_restore_from_data() now take a
+ 'void *memctx' as the 1st param.
+
+ dwc_dh_modpow(), dwc_dh_pk(), and dwc_dh_derive_keys() now take a
+ 'void *memctx' as the 1st param.
+
+ dwc_modpow() now takes a 'void *memctx' as the 1st param.
+
+ dwc_alloc_notification_manager() now takes a 'void *memctx' as the
+ 1st param and a 'void *wkqctx' (for work queue allocation) as the 2nd
+ param, and also now returns an integer value that is non-zero if
+ allocation of its data structures or work queue fails.
+
+ dwc_register_notifier() now takes a 'void *memctx' as the 1st param.
+
+ dwc_memory_debug_start() now takes a 'void *mem_ctx' as the first
+ param, and also now returns an integer value that is non-zero if
+ allocation of its data structures fails.
+
+
+
+Other miscellaneous changes:
+
+The DEBUG_MEMORY and DEBUG_REGS #define's have been renamed to
+DWC_DEBUG_MEMORY and DWC_DEBUG_REGS.
+
+The following #define's have been added to allow selectively compiling library
+features:
+
+ DWC_CCLIB
+ DWC_CRYPTOLIB
+ DWC_NOTIFYLIB
+ DWC_UTFLIB
+
+A DWC_LIBMODULE #define has also been added. If this is not defined, then the
+module code in dwc_common_linux.c is not compiled in. This allows linking the
+library code directly into a driver module, instead of as a standalone module.
View
No changes.
@@ -1,81 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
-<title>Synopsys DWC Portability and Common Library for UWB: dwc_common_port/ Directory Reference</title>
-<link href="doxygen.css" rel="stylesheet" type="text/css">
-<link href="tabs.css" rel="stylesheet" type="text/css">
-</head><body>
-<!-- Generated by Doxygen 1.4.7 -->
-<div class="tabs">
- <ul>
- <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
- <li><a href="files.html"><span>Files</span></a></li>
- <li><a href="dirs.html"><span>Directories</span></a></li>
- <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
- </ul></div>
-<div class="nav">
-<a class="el" href="dir_c13d72e45af28cdc461a5f284d3d36fc.html">dwc_common_port</a></div>
-<h1>dwc_common_port Directory Reference</h1>
-<p>
-<table border="0" cellpadding="0" cellspacing="0">
-<tr><td></td></tr>
-<tr><td colspan="2"><br><h2>Files</h2></td></tr>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_cc.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__cc_8h.html">dwc_cc.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file defines the Context Context library. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_common_linux.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__crypto_8c.html">dwc_crypto.c</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file contains the WUSB cryptographic routines. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__crypto_8h.html">dwc_crypto.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file contains declarations for the WUSB Cryptographic routines as defined in the WUSB spec. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_dh.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__dh_8h.html">dwc_dh.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file defines the common functions on device and host for performing numeric association as defined in the WUSB spec. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__list_8h.html">dwc_list.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file defines linked list operations. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_mem.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_modpow.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__modpow_8h.html">dwc_modpow.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">This file defines the module exponentiation function which is only used internally by the DWC UWB modules for calculation of PKs during numeric association. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>dwc_notifier.c</b></td></tr>
-
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__notifier_8h.html">dwc_notifier.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A simple implementation of the Observer pattern. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="dwc__os_8h.html">dwc_os.h</a></td></tr>
-
-<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">DWC portability library, low level os-wrapper functions. <br></td></tr>
-
-<p>
-<tr><td class="memItemLeft" nowrap align="right" valign="top">file &nbsp;</td><td class="memItemRight" valign="bottom"><b>usb.h</b></td></tr>
-
-</table>
-<hr size="1"><address style="align: right;"><small>Generated on Tue May 5 02:22:50 2009 for Synopsys DWC Portability and Common Library for UWB by&nbsp;
-<a href="http://www.doxygen.org/index.html">
-<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.7 </small></address>
-</body>
-</html>
Oops, something went wrong.

0 comments on commit df9a562

Please sign in to comment.