PERFORCE change 169599 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Mon Oct 19 16:07:40 UTC 2009
http://p4web.freebsd.org/chv.cgi?CH=169599
Change 169599 by hselasky at hselasky_laptop001 on 2009/10/19 16:07:33
IFC @ 169589
Affected files ...
.. //depot/projects/usb/src/sys/amd64/amd64/intr_machdep.c#12 integrate
.. //depot/projects/usb/src/sys/amd64/amd64/nexus.c#8 integrate
.. //depot/projects/usb/src/sys/amd64/include/intr_machdep.h#10 integrate
.. //depot/projects/usb/src/sys/cddl/compat/opensolaris/rpc/xdr.h#4 branch
.. //depot/projects/usb/src/sys/dev/gem/if_gem_pci.c#7 integrate
.. //depot/projects/usb/src/sys/dev/hwpmc/hwpmc_mod.c#13 integrate
.. //depot/projects/usb/src/sys/dev/pci/pci.c#28 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#37 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehci.h#13 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehci_ixp4xx.c#10 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehci_mbus.c#9 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehci_pci.c#15 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ehcireg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#29 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ohci.h#12 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ohci_atmelarm.c#9 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ohci_pci.c#12 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/ohcireg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#27 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/uhci.h#12 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/uhci_pci.c#12 integrate
.. //depot/projects/usb/src/sys/dev/usb/controller/uhcireg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#35 integrate
.. //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#23 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_urtw.c#10 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_urtwreg.h#2 integrate
.. //depot/projects/usb/src/sys/dev/usb/wlan/if_urtwvar.h#4 integrate
.. //depot/projects/usb/src/sys/i386/i386/intr_machdep.c#13 integrate
.. //depot/projects/usb/src/sys/i386/i386/nexus.c#7 integrate
.. //depot/projects/usb/src/sys/i386/include/intr_machdep.h#9 integrate
.. //depot/projects/usb/src/sys/kern/bus_if.m#7 integrate
.. //depot/projects/usb/src/sys/kern/imgact_elf.c#16 integrate
.. //depot/projects/usb/src/sys/kern/kern_intr.c#16 integrate
.. //depot/projects/usb/src/sys/kern/sched_ule.c#19 integrate
.. //depot/projects/usb/src/sys/kern/subr_bus.c#32 integrate
.. //depot/projects/usb/src/sys/kern/tty.c#31 integrate
.. //depot/projects/usb/src/sys/kern/tty_ttydisc.c#8 integrate
.. //depot/projects/usb/src/sys/net/pfil.c#5 integrate
.. //depot/projects/usb/src/sys/net/pfil.h#6 integrate
.. //depot/projects/usb/src/sys/netinet/if_ether.c#30 integrate
.. //depot/projects/usb/src/sys/netinet/in.c#38 integrate
.. //depot/projects/usb/src/sys/netinet/ip_input.c#32 integrate
.. //depot/projects/usb/src/sys/nfsclient/nfs_vnops.c#31 integrate
.. //depot/projects/usb/src/sys/powerpc/aim/platform_chrp.c#3 integrate
.. //depot/projects/usb/src/sys/sparc64/include/elf.h#6 integrate
.. //depot/projects/usb/src/sys/sun4v/include/elf.h#5 integrate
.. //depot/projects/usb/src/sys/sys/bus.h#12 integrate
.. //depot/projects/usb/src/sys/sys/interrupt.h#9 integrate
.. //depot/projects/usb/src/sys/vm/swap_pager.c#17 integrate
Differences ...
==== //depot/projects/usb/src/sys/amd64/amd64/intr_machdep.c#12 (text+ko) ====
@@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.45 2009/07/01 17:20:07 jhb Exp $
+ * $FreeBSD: src/sys/amd64/amd64/intr_machdep.c,v 1.47 2009/10/16 12:00:59 kib Exp $
*/
/*
@@ -400,6 +400,23 @@
}
#endif
+/* Add a description to an active interrupt handler. */
+int
+intr_describe(u_int vector, void *ih, const char *descr)
+{
+ struct intsrc *isrc;
+ int error;
+
+ isrc = intr_lookup_source(vector);
+ if (isrc == NULL)
+ return (EINVAL);
+ error = intr_event_describe_handler(isrc->is_event, ih, descr);
+ if (error)
+ return (error);
+ intrcnt_updatename(isrc);
+ return (0);
+}
+
#ifdef DDB
/*
* Dump data about interrupt handlers
==== //depot/projects/usb/src/sys/amd64/amd64/nexus.c#8 (text+ko) ====
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.80 2008/03/20 21:24:32 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/nexus.c,v 1.81 2009/10/15 14:54:35 jhb Exp $");
/*
* This code implements a `root nexus' for Intel Architecture
@@ -92,6 +92,9 @@
#endif
static int nexus_config_intr(device_t, int, enum intr_trigger,
enum intr_polarity);
+static int nexus_describe_intr(device_t dev, device_t child,
+ struct resource *irq, void *cookie,
+ const char *descr);
static int nexus_activate_resource(device_t, device_t, int, int,
struct resource *);
static int nexus_deactivate_resource(device_t, device_t, int, int,
@@ -135,6 +138,7 @@
DEVMETHOD(bus_bind_intr, nexus_bind_intr),
#endif
DEVMETHOD(bus_config_intr, nexus_config_intr),
+ DEVMETHOD(bus_describe_intr, nexus_describe_intr),
DEVMETHOD(bus_get_resource_list, nexus_get_reslist),
DEVMETHOD(bus_set_resource, nexus_set_resource),
DEVMETHOD(bus_get_resource, nexus_get_resource),
@@ -479,6 +483,14 @@
return (intr_config_intr(irq, trig, pol));
}
+static int
+nexus_describe_intr(device_t dev, device_t child, struct resource *irq,
+ void *cookie, const char *descr)
+{
+
+ return (intr_describe(rman_get_start(irq), cookie, descr));
+}
+
static struct resource_list *
nexus_get_reslist(device_t dev, device_t child)
{
==== //depot/projects/usb/src/sys/amd64/include/intr_machdep.h#10 (text+ko) ====
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/amd64/include/intr_machdep.h,v 1.24 2009/07/01 17:20:07 jhb Exp $
+ * $FreeBSD: src/sys/amd64/include/intr_machdep.h,v 1.25 2009/10/15 14:54:35 jhb Exp $
*/
#ifndef __MACHINE_INTR_MACHDEP_H__
@@ -151,6 +151,7 @@
#endif
int intr_config_intr(int vector, enum intr_trigger trig,
enum intr_polarity pol);
+int intr_describe(u_int vector, void *ih, const char *descr);
void intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame);
u_int intr_next_cpu(void);
struct intsrc *intr_lookup_source(int vector);
==== //depot/projects/usb/src/sys/dev/gem/if_gem_pci.c#7 (text+ko) ====
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem_pci.c,v 1.26 2009/06/23 20:36:59 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/gem/if_gem_pci.c,v 1.27 2009/10/18 17:11:16 nwhitehorn Exp $");
/*
* PCI bindings for Apple GMAC, Sun ERI and Sun GEM Ethernet controllers
@@ -295,6 +295,16 @@
GEM_PCI_ROM_OFFSET + j + PCI_VPDRES_LARGE_SIZE + PCI_VPD_SIZE,
sc->sc_enaddr, ETHER_ADDR_LEN);
#endif
+ /*
+ * The Xserve G5 has a fake GMAC with an all-zero MAC address.
+ * Check for this, and don't attach in this case.
+ */
+
+ for (i = 0; i < ETHER_ADDR_LEN && sc->sc_enaddr[i] == 0; i++) {}
+ if (i == ETHER_ADDR_LEN) {
+ device_printf(dev, "invalid MAC address\n");
+ goto fail;
+ }
if (gem_attach(sc) != 0) {
device_printf(dev, "could not be attached\n");
==== //depot/projects/usb/src/sys/dev/hwpmc/hwpmc_mod.c#13 (text+ko) ====
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.43 2009/06/25 20:59:37 attilio Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/hwpmc/hwpmc_mod.c,v 1.44 2009/10/18 13:51:49 rpaulo Exp $");
#include <sys/param.h>
#include <sys/eventhandler.h>
@@ -504,7 +504,7 @@
pcd = pmc_rowindex_to_classdep[ri];
KASSERT(pcd != NULL,
- ("[amd,%d] ri %d null pcd", __LINE__, ri));
+ ("[pmc,%d] ri %d null pcd", __LINE__, ri));
*adjri = ri - pcd->pcd_ri;
==== //depot/projects/usb/src/sys/dev/pci/pci.c#28 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.387 2009/09/22 15:43:03 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/pci/pci.c,v 1.388 2009/10/15 20:07:08 thompsa Exp $");
#include "opt_bus.h"
==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#37 (text+ko) ====
@@ -44,7 +44,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci.c,v 1.28 2009/10/01 18:37:16 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci.c,v 1.29 2009/10/15 20:07:08 thompsa Exp $");
#include <sys/stdint.h>
#include <sys/stddef.h>
==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.h#13 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/controller/ehci.h,v 1.8 2009/05/29 18:46:57 thompsa Exp $ */
+/* $FreeBSD: src/sys/dev/usb/controller/ehci.h,v 1.9 2009/10/15 20:07:08 thompsa Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
* All rights reserved.
==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_ixp4xx.c#10 (text+ko) ====
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_ixp4xx.c,v 1.7 2009/06/23 02:19:59 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_ixp4xx.c,v 1.8 2009/10/15 20:07:08 thompsa Exp $");
#include "opt_bus.h"
==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_mbus.c#9 (text+ko) ====
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_mbus.c,v 1.7 2009/06/23 02:19:59 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_mbus.c,v 1.8 2009/10/15 20:07:08 thompsa Exp $");
#include "opt_bus.h"
==== //depot/projects/usb/src/sys/dev/usb/controller/ehci_pci.c#15 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_pci.c,v 1.9 2009/09/28 07:06:47 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ehci_pci.c,v 1.10 2009/10/15 20:07:08 thompsa Exp $");
/*
* USB Enhanced Host Controller Driver, a.k.a. USB 2.0 controller.
==== //depot/projects/usb/src/sys/dev/usb/controller/ehcireg.h#2 (text+ko) ====
==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#29 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci.c,v 1.21 2009/07/30 00:14:34 alfred Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci.c,v 1.22 2009/10/15 20:07:08 thompsa Exp $");
/*
* USB Open Host Controller driver.
==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.h#12 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/controller/ohci.h,v 1.7 2009/05/29 18:46:57 thompsa Exp $ */
+/* $FreeBSD: src/sys/dev/usb/controller/ohci.h,v 1.8 2009/10/15 20:07:08 thompsa Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
==== //depot/projects/usb/src/sys/dev/usb/controller/ohci_atmelarm.c#9 (text+ko) ====
@@ -23,7 +23,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci_atmelarm.c,v 1.6 2009/06/23 02:19:59 thompsa Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci_atmelarm.c,v 1.7 2009/10/15 20:07:08 thompsa Exp $");
#include <sys/stdint.h>
#include <sys/stddef.h>
==== //depot/projects/usb/src/sys/dev/usb/controller/ohci_pci.c#12 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci_pci.c,v 1.8 2009/07/30 00:12:47 alfred Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/ohci_pci.c,v 1.9 2009/10/15 20:07:08 thompsa Exp $");
/*
* USB Open Host Controller driver.
==== //depot/projects/usb/src/sys/dev/usb/controller/ohcireg.h#2 (text+ko) ====
==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#27 (text+ko) ====
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci.c,v 1.21 2009/07/30 00:14:34 alfred Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci.c,v 1.22 2009/10/15 20:07:08 thompsa Exp $");
/*
* USB Universal Host Controller driver.
==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.h#12 (text+ko) ====
@@ -1,4 +1,4 @@
-/* $FreeBSD: src/sys/dev/usb/controller/uhci.h,v 1.7 2009/05/29 18:46:57 thompsa Exp $ */
+/* $FreeBSD: src/sys/dev/usb/controller/uhci.h,v 1.8 2009/10/15 20:07:08 thompsa Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
==== //depot/projects/usb/src/sys/dev/usb/controller/uhci_pci.c#12 (text+ko) ====
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci_pci.c,v 1.8 2009/07/30 00:12:47 alfred Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/controller/uhci_pci.c,v 1.9 2009/10/15 20:07:08 thompsa Exp $");
/* Universal Host Controller Interface
*
==== //depot/projects/usb/src/sys/dev/usb/controller/uhcireg.h#2 (text+ko) ====
==== //depot/projects/usb/src/sys/dev/usb/input/ukbd.c#35 (text+ko) ====
@@ -1,5 +1,5 @@
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/input/ukbd.c,v 1.19 2009/10/12 19:19:08 hrs Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/input/ukbd.c,v 1.20 2009/10/15 20:09:27 thompsa Exp $");
/*-
==== //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#23 (text+ko) ====
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/net/if_cdce.c,v 1.16 2009/08/24 05:00:33 alfred Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/net/if_cdce.c,v 1.18 2009/10/15 20:15:29 thompsa Exp $");
#include <sys/stdint.h>
#include <sys/stddef.h>
==== //depot/projects/usb/src/sys/dev/usb/wlan/if_urtw.c#10 (text+ko) ====
@@ -15,7 +15,7 @@
*/
#include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/usb/wlan/if_urtw.c,v 1.12 2009/10/14 20:30:27 weongyo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/usb/wlan/if_urtw.c,v 1.13 2009/10/18 00:11:49 weongyo Exp $");
#include <sys/param.h>
#include <sys/sockio.h>
#include <sys/sysctl.h>
@@ -76,6 +76,7 @@
URTW_DEBUG_STATE = 0x00000020, /* 802.11 state transitions */
URTW_DEBUG_STAT = 0x00000040, /* statistic */
URTW_DEBUG_INIT = 0x00000080, /* initialization of dev */
+ URTW_DEBUG_TXSTATUS = 0x00000100, /* tx status */
URTW_DEBUG_ANY = 0xffffffff
};
#define DPRINTF(sc, m, fmt, ...) do { \
@@ -326,13 +327,47 @@
{ 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 }
};
-static struct urtw_pair urtw_8225v2b_rf_part1[] = {
+static struct urtw_pair urtw_8225v2b_rf_part0[] = {
{ 0x00, 0x00b7 }, { 0x01, 0x0ee0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
{ 0x04, 0x08c3 }, { 0x05, 0x0c72 }, { 0x06, 0x00e6 }, { 0x07, 0x082a },
{ 0x08, 0x003f }, { 0x09, 0x0335 }, { 0x0a, 0x09d4 }, { 0x0b, 0x07bb },
{ 0x0c, 0x0850 }, { 0x0d, 0x0cdf }, { 0x0e, 0x002b }, { 0x0f, 0x0114 }
};
+static struct urtw_pair urtw_8225v2b_rf_part1[] = {
+ {0x0f0, 0x32}, {0x0f1, 0x32}, {0x0f2, 0x00},
+ {0x0f3, 0x00}, {0x0f4, 0x32}, {0x0f5, 0x43},
+ {0x0f6, 0x00}, {0x0f7, 0x00}, {0x0f8, 0x46},
+ {0x0f9, 0xa4}, {0x0fa, 0x00}, {0x0fb, 0x00},
+ {0x0fc, 0x96}, {0x0fd, 0xa4}, {0x0fe, 0x00},
+ {0x0ff, 0x00}, {0x158, 0x4b}, {0x159, 0x00},
+ {0x15a, 0x4b}, {0x15b, 0x00}, {0x160, 0x4b},
+ {0x161, 0x09}, {0x162, 0x4b}, {0x163, 0x09},
+ {0x1ce, 0x0f}, {0x1cf, 0x00}, {0x1e0, 0xff},
+ {0x1e1, 0x0f}, {0x1e2, 0x00}, {0x1f0, 0x4e},
+ {0x1f1, 0x01}, {0x1f2, 0x02}, {0x1f3, 0x03},
+ {0x1f4, 0x04}, {0x1f5, 0x05}, {0x1f6, 0x06},
+ {0x1f7, 0x07}, {0x1f8, 0x08}, {0x24e, 0x00},
+ {0x20c, 0x04}, {0x221, 0x61}, {0x222, 0x68},
+ {0x223, 0x6f}, {0x224, 0x76}, {0x225, 0x7d},
+ {0x226, 0x84}, {0x227, 0x8d}, {0x24d, 0x08},
+ {0x250, 0x05}, {0x251, 0xf5}, {0x252, 0x04},
+ {0x253, 0xa0}, {0x254, 0x1f}, {0x255, 0x23},
+ {0x256, 0x45}, {0x257, 0x67}, {0x258, 0x08},
+ {0x259, 0x08}, {0x25a, 0x08}, {0x25b, 0x08},
+ {0x260, 0x08}, {0x261, 0x08}, {0x262, 0x08},
+ {0x263, 0x08}, {0x264, 0xcf}, {0x272, 0x56},
+ {0x273, 0x9a}, {0x034, 0xf0}, {0x035, 0x0f},
+ {0x05b, 0x40}, {0x084, 0x88}, {0x085, 0x24},
+ {0x088, 0x54}, {0x08b, 0xb8}, {0x08c, 0x07},
+ {0x08d, 0x00}, {0x094, 0x1b}, {0x095, 0x12},
+ {0x096, 0x00}, {0x097, 0x06}, {0x09d, 0x1a},
+ {0x09f, 0x10}, {0x0b4, 0x22}, {0x0be, 0x80},
+ {0x0db, 0x00}, {0x0ee, 0x00}, {0x091, 0x03},
+ {0x24c, 0x00}, {0x39f, 0x00}, {0x08c, 0x01},
+ {0x08d, 0x10}, {0x08e, 0x08}, {0x08f, 0x00}
+};
+
static struct urtw_pair urtw_8225v2_rf_part2[] = {
{ 0x00, 0x01 }, { 0x01, 0x02 }, { 0x02, 0x42 }, { 0x03, 0x00 },
{ 0x04, 0x00 }, { 0x05, 0x00 }, { 0x06, 0x40 }, { 0x07, 0x00 },
@@ -478,6 +513,7 @@
static usb_callback_t urtw_bulk_rx_callback;
static usb_callback_t urtw_bulk_tx_callback;
+static usb_callback_t urtw_bulk_tx_status_callback;
static const struct usb_config urtw_8187b_usbconfig[URTW_8187B_N_XFERS] = {
[URTW_8187B_BULK_RX] = {
@@ -492,6 +528,18 @@
},
.callback = urtw_bulk_rx_callback
},
+ [URTW_8187B_BULK_TX_STATUS] = {
+ .type = UE_BULK,
+ .endpoint = 0x89,
+ .direction = UE_DIR_IN,
+ .bufsize = MCLBYTES,
+ .flags = {
+ .ext_buffer = 1,
+ .pipe_bof = 1,
+ .short_xfer_ok = 1
+ },
+ .callback = urtw_bulk_tx_status_callback
+ },
[URTW_8187B_BULK_TX_BE] = {
.type = UE_BULK,
.endpoint = URTW_8187B_TXPIPE_BE,
@@ -703,9 +751,6 @@
static usb_error_t urtw_adapter_start_b(struct urtw_softc *);
static usb_error_t urtw_set_mode(struct urtw_softc *, uint32_t);
static usb_error_t urtw_8187b_cmd_reset(struct urtw_softc *);
-static usb_error_t urtw_write16_i(struct urtw_softc *, int, uint16_t, int);
-static usb_error_t urtw_write8_i(struct urtw_softc *, int, uint8_t, int);
-static usb_error_t urtw_write32_i(struct urtw_softc *, int, uint32_t, int);
static usb_error_t urtw_do_request(struct urtw_softc *,
struct usb_device_request *, void *);
static usb_error_t urtw_8225v2b_set_txpwrlvl(struct urtw_softc *, int);
@@ -713,6 +758,10 @@
static void urtw_abort_xfers(struct urtw_softc *);
static struct urtw_data *
urtw_getbuf(struct urtw_softc *sc);
+static int urtw_compute_txtime(uint16_t, uint16_t, uint8_t,
+ uint8_t);
+static void urtw_updateslot(struct ifnet *);
+static void urtw_updateslottask(void *, int);
static int
urtw_match(device_t dev)
@@ -757,6 +806,7 @@
MTX_DEF);
usb_callout_init_mtx(&sc->sc_led_ch, &sc->sc_mtx, 0);
TASK_INIT(&sc->sc_led_task, 0, urtw_ledtask, sc);
+ TASK_INIT(&sc->sc_updateslot_task, 0, urtw_updateslottask, sc);
callout_init(&sc->sc_watchdog_ch, 0);
if (sc->sc_flags & URTW_RTL8187B) {
@@ -845,7 +895,7 @@
ic->ic_scan_start = urtw_scan_start;
ic->ic_scan_end = urtw_scan_end;
ic->ic_set_channel = urtw_set_channel;
-
+ ic->ic_updateslot = urtw_updateslot;
ic->ic_vap_create = urtw_vap_create;
ic->ic_vap_delete = urtw_vap_delete;
ic->ic_update_mcast = urtw_update_mcast;
@@ -878,6 +928,7 @@
return (0);
urtw_stop(ifp, 1);
+ ieee80211_draintask(ic, &sc->sc_updateslot_task);
ieee80211_draintask(ic, &sc->sc_led_task);
usb_callout_drain(&sc->sc_led_ch);
@@ -1014,6 +1065,9 @@
if (error != 0)
goto fail;
+ if (sc->sc_flags & URTW_RTL8187B)
+ usbd_transfer_start(sc->sc_xfer[URTW_8187B_BULK_TX_STATUS]);
+
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
ifp->if_drv_flags |= IFF_DRV_RUNNING;
@@ -1036,7 +1090,6 @@
urtw_adapter_start_b(struct urtw_softc *sc)
{
#define N(a) (sizeof(a) / sizeof((a)[0]))
- int i;
uint8_t data8;
usb_error_t error;
@@ -1068,81 +1121,12 @@
if (error)
goto fail;
- urtw_write16_m(sc, 0x2d, 0xfff);
- urtw_read8_m(sc, URTW_CW_CONF, &data8);
- urtw_write8_m(sc, URTW_CW_CONF, data8 | URTW_CW_CONF_PERPACKET_RETRY);
- urtw_read8_m(sc, URTW_TX_AGC_CTL, &data8);
- data8 |= URTW_TX_AGC_CTL_PERPACKET_GAIN |
- URTW_TX_AGC_CTL_PERPACKET_ANTSEL;
- urtw_write8_m(sc, URTW_TX_AGC_CTL, data8);
-
- error = urtw_write16_i(sc, 0xe0, 0xfff, 1);
- if (error)
- goto fail;
-
- urtw_read8_m(sc, URTW_RATE_FALLBACK, &data8);
- urtw_write8_m(sc, URTW_RATE_FALLBACK, data8 | URTW_RATE_FALLBACK_ENABLE);
-
- urtw_write16_m(sc, URTW_ATIM_WND, 2);
- urtw_write16_m(sc, URTW_BEACON_INTERVAL, 100);
- error = urtw_write16_i(sc, 0xd4, 0xffff, 1);
- if (error)
- goto fail;
-
- error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
- if (error)
- goto fail;
- urtw_read8_m(sc, URTW_CONFIG1, &data8);
- urtw_write8_m(sc, URTW_CONFIG1, (data8 & 0x3f) | 0x80);
- error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL);
- if (error)
- goto fail;
-
- urtw_write8_m(sc, URTW_WPA_CONFIG, 0);
- for (i = 0; i < N(urtw_8187b_reg_table); i++) {
- error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0],
- urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]);
- if (error)
- goto fail;
- }
-
- urtw_write16_m(sc, URTW_TID_AC_MAP, 0xfa50);
- urtw_write16_m(sc, URTW_INT_MIG, 0);
-
- error = urtw_write32_i(sc, 0xf0, 0, 1);
- if (error)
- goto fail;
- error = urtw_write32_i(sc, 0xf4, 0, 1);
- if (error)
- goto fail;
- error = urtw_write8_i(sc, 0xf8, 0, 1);
- if (error)
- goto fail;
-
- urtw_write32_m(sc, URTW_RF_TIMING, 0x00004001);
-
- error = urtw_write16_i(sc, 0x72, 0x569a, 2);
- if (error)
- goto fail;
-
- error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
- if (error)
- goto fail;
- urtw_read8_m(sc, URTW_CONFIG3, &data8);
- urtw_write8_m(sc, URTW_CONFIG3, data8 | URTW_CONFIG3_ANAPARAM_WRITE);
- error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL);
- if (error)
- goto fail;
-
- urtw_write16_m(sc, URTW_RF_PINS_OUTPUT, 0x0480);
- urtw_write16_m(sc, URTW_RF_PINS_SELECT, 0x2488);
- urtw_write16_m(sc, URTW_RF_PINS_ENABLE, 0x1fff);
- usb_pause_mtx(&sc->sc_mtx, 100);
-
error = sc->sc_rf_init(sc);
if (error != 0)
goto fail;
+ urtw_write8_m(sc, URTW_CMD, URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE);
+ /* fix RTL8187B RX stall */
error = urtw_intr_enable(sc);
if (error)
goto fail;
@@ -1171,42 +1155,21 @@
urtw_read8_m(sc, 0xdb, &data8);
urtw_write8_m(sc, 0xdb, data8 | (1 << 2));
- error = urtw_write16_i(sc, 0x72, 0x59fa, 3);
- if (error)
- goto fail;
- error = urtw_write16_i(sc, 0x74, 0x59d2, 3);
- if (error)
- goto fail;
- error = urtw_write16_i(sc, 0x76, 0x59d2, 3);
- if (error)
- goto fail;
- error = urtw_write16_i(sc, 0x78, 0x19fa, 3);
- if (error)
- goto fail;
- error = urtw_write16_i(sc, 0x7a, 0x19fa, 3);
- if (error)
- goto fail;
- error = urtw_write16_i(sc, 0x7c, 0x00d0, 3);
- if (error)
- goto fail;
+ urtw_write16_m(sc, 0x372, 0x59fa);
+ urtw_write16_m(sc, 0x374, 0x59d2);
+ urtw_write16_m(sc, 0x376, 0x59d2);
+ urtw_write16_m(sc, 0x378, 0x19fa);
+ urtw_write16_m(sc, 0x37a, 0x19fa);
+ urtw_write16_m(sc, 0x37c, 0x00d0);
urtw_write8_m(sc, 0x61, 0);
- error = urtw_write8_i(sc, 0x80, 0x0f, 1);
- if (error)
- goto fail;
- error = urtw_write8_i(sc, 0x83, 0x03, 1);
- if (error)
- goto fail;
+
+ urtw_write8_m(sc, 0x180, 0x0f);
+ urtw_write8_m(sc, 0x183, 0x03);
urtw_write8_m(sc, 0xda, 0x10);
- error = urtw_write8_i(sc, 0x4d, 0x08, 2);
- if (error)
- goto fail;
+ urtw_write8_m(sc, 0x24d, 0x08);
+ urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321b);
- urtw_write32_m(sc, URTW_HSSI_PARA, 0x0600321B);
-
- error = urtw_write16_i(sc, 0xec, 0x800, 1);
- if (error)
- goto fail;
-
+ urtw_write16_m(sc, 0x1ec, 0x800); /* RX MAX SIZE */
fail:
return (error);
#undef N
@@ -1310,41 +1273,11 @@
device_printf(sc->sc_dev, "reset timeout\n");
goto fail;
}
-
- error = urtw_set_mode(sc, URTW_EPROM_CMD_LOAD);
- if (error)
- goto fail;
-
- for (i = 0; i < 20; i++) {
- usb_pause_mtx(&sc->sc_mtx, 4);
- urtw_read8_m(sc, URTW_EPROM_CMD, &data8);
- if (!(data8 & URTW_EPROM_CMD_CONFIG))
- break;
- }
- if (i >= 20) {
- device_printf(sc->sc_dev, "eeprom reset timeout\n");
- goto fail;
- }
-
fail:
return (error);
}
static usb_error_t
-urtw_write16_i(struct urtw_softc *sc, int val, uint16_t data, int idx)
-{
- struct usb_device_request req;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, idx & 0x3);
- USETW(req.wLength, sizeof(uint16_t));
-
- return (urtw_do_request(sc, &req, &data));
-}
-
-static usb_error_t
urtw_do_request(struct urtw_softc *sc,
struct usb_device_request *req, void *data)
{
@@ -1367,34 +1300,6 @@
return (err);
}
-static usb_error_t
-urtw_write8_i(struct urtw_softc *sc, int val, uint8_t data, int idx)
-{
- struct usb_device_request req;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, idx & 0x3);
- USETW(req.wLength, sizeof(uint8_t));
-
- return (urtw_do_request(sc, &req, &data));
-}
-
-static usb_error_t
-urtw_write32_i(struct urtw_softc *sc, int val, uint32_t data, int idx)
-{
- struct usb_device_request req;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, idx & 0x3);
- USETW(req.wLength, sizeof(uint32_t));
-
- return (urtw_do_request(sc, &req, &data));
-}
-
static void
urtw_stop_locked(struct ifnet *ifp, int disable)
{
@@ -1534,6 +1439,7 @@
}
sc->sc_txtimer = 5;
+ callout_reset(&sc->sc_watchdog_ch, hz, urtw_watchdog, sc);
}
URTW_UNLOCK(sc);
}
@@ -1733,14 +1639,12 @@
urtw_tx_start(struct urtw_softc *sc, struct ieee80211_node *ni, struct mbuf *m0,
struct urtw_data *data, int prior)
{
- int xferlen;
struct ifnet *ifp = sc->sc_ifp;
struct ieee80211_frame *wh = mtod(m0, struct ieee80211_frame *);
struct ieee80211_key *k;
const struct ieee80211_txparam *tp;
struct ieee80211com *ic = ifp->if_l2com;
struct ieee80211vap *vap = ni->ni_vap;
- struct urtw_8187b_txhdr *hdr;
struct usb_xfer *rtl8187b_pipes[URTW_8187B_TXPIPE_MAX] = {
sc->sc_xfer[URTW_8187B_BULK_TX_BE],
sc->sc_xfer[URTW_8187B_BULK_TX_BK],
@@ -1748,6 +1652,10 @@
sc->sc_xfer[URTW_8187B_BULK_TX_VO]
};
struct usb_xfer *xfer;
+ int dur = 0, rtsdur = 0, rtsenable = 0, ctsenable = 0, rate,
+ pkttime = 0, txdur = 0, isshort = 0, xferlen;
+ uint16_t acktime, rtstime, ctstime;
+ uint32_t flags;
usb_error_t error;
URTW_ASSERT_LOCKED(sc);
@@ -1780,60 +1688,107 @@
ieee80211_radiotap_tx(vap, m0);
}
+ if ((wh->i_fc[10] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_MGT ||
+ (wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == IEEE80211_FC0_TYPE_CTL) {
+ tp = &vap->iv_txparms[ieee80211_chan2mode(ic->ic_curchan)];
+ rate = tp->mgmtrate;
+ } else {
+ tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
+ /* for data frames */
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+ rate = tp->mcastrate;
+ else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
+ rate = tp->ucastrate;
+ else
+ rate = urtw_rtl2rate(sc->sc_currate);
+ }
+
+ if (IEEE80211_IS_MULTICAST(wh->i_addr1))
+ txdur = pkttime = urtw_compute_txtime(m0->m_pkthdr.len +
+ IEEE80211_CRC_LEN, rate, 0, 0);
+ else {
+ acktime = urtw_compute_txtime(14, 2,0, 0);
+ if ((m0->m_pkthdr.len + 4) > vap->iv_rtsthreshold) {
+ rtsenable = 1;
+ ctsenable = 0;
+ rtstime = urtw_compute_txtime(URTW_ACKCTS_LEN, 2, 0, 0);
+ ctstime = urtw_compute_txtime(14, 2, 0, 0);
+ pkttime = urtw_compute_txtime(m0->m_pkthdr.len +
+ IEEE80211_CRC_LEN, rate, 0, isshort);
+ rtsdur = ctstime + pkttime + acktime +
+ 3 * URTW_ASIFS_TIME;
+ txdur = rtstime + rtsdur;
+ } else {
+ rtsenable = ctsenable = rtsdur = 0;
+ pkttime = urtw_compute_txtime(m0->m_pkthdr.len +
+ IEEE80211_CRC_LEN, rate, 0, isshort);
+ txdur = pkttime + URTW_ASIFS_TIME + acktime;
+ }
+
+ if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG)
+ dur = urtw_compute_txtime(m0->m_pkthdr.len +
+ IEEE80211_CRC_LEN, rate, 0, isshort) +
+ 3 * URTW_ASIFS_TIME +
+ 2 * acktime;
+ else
+ dur = URTW_ASIFS_TIME + acktime;
+ }
+ *(uint16_t *)wh->i_dur = htole16(dur);
+
xferlen = m0->m_pkthdr.len;
xferlen += (sc->sc_flags & URTW_RTL8187B) ? (4 * 8) : (4 * 3);
if ((0 == xferlen % 64) || (0 == xferlen % 512))
xferlen += 1;
bzero(data->buf, URTW_TX_MAXSIZE);
- data->buf[0] = m0->m_pkthdr.len & 0xff;
- data->buf[1] = (m0->m_pkthdr.len & 0x0f00) >> 8;
- data->buf[1] |= (1 << 7);
-
+ flags = m0->m_pkthdr.len & 0xfff;
+ flags |= URTW_TX_FLAG_NO_ENC;
if ((ic->ic_flags & IEEE80211_F_SHPREAMBLE) &&
(ni->ni_capinfo & IEEE80211_CAPINFO_SHORT_PREAMBLE) &&
(sc->sc_preamble_mode == URTW_PREAMBLE_MODE_SHORT) &&
(sc->sc_currate != 0))
- data->buf[2] |= 1;
- if ((m0->m_pkthdr.len > vap->iv_rtsthreshold) &&
- prior == URTW_PRIORITY_LOW) {
- device_printf(sc->sc_dev, "TODO tx.\n");
- return (EIO);
- }
+ flags |= URTW_TX_FLAG_SPLCP;
if (wh->i_fc[1] & IEEE80211_FC1_MORE_FRAG)
- data->buf[2] |= (1 << 1);
- /* RTS rate - 10 means we use a basic rate. */
- data->buf[2] |= (urtw_rate2rtl(2) << 3);
- /*
- * XXX currently TX rate control depends on the rate value of
- * RX descriptor because I don't know how to we can control TX rate
- * in more smart way. Please fix me you find a thing.
- */
- data->buf[3] = sc->sc_currate;
- if (prior == URTW_PRIORITY_NORMAL) {
- tp = &vap->iv_txparms[ieee80211_chan2mode(ni->ni_chan)];
- if (IEEE80211_IS_MULTICAST(wh->i_addr1))
- data->buf[3] = urtw_rate2rtl(tp->mcastrate);
- else if (tp->ucastrate != IEEE80211_FIXED_RATE_NONE)
- data->buf[3] = urtw_rate2rtl(tp->ucastrate);
- }
+ flags |= URTW_TX_FLAG_MOREFRAG;
+
+ flags |= (sc->sc_currate & 0xf) << URTW_TX_FLAG_TXRATE_SHIFT;
if (sc->sc_flags & URTW_RTL8187B) {
- hdr = (struct urtw_8187b_txhdr *)data->buf;
- hdr->rts_duration = 0;
- hdr->len = 0;
- hdr->retry = 3 | (7 << 4) | 11;
- hdr->tx_duration = ieee80211_compute_duration(ic->ic_rt,
- m0->m_pkthdr.len + IEEE80211_CRC_LEN,
- urtw_rtl2rate(data->buf[3]),
- (ic->ic_flags & IEEE80211_F_SHPREAMBLE) != 0);
- /* XXX MUST fill another variables like rts_duration, tx_.. */
- m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[32]);
+ struct urtw_8187b_txhdr *tx;
+
+ tx = (struct urtw_8187b_txhdr *)data->buf;
+ if (ctsenable)
+ flags |= URTW_TX_FLAG_CTS;
+ if (rtsenable) {
+ flags |= URTW_TX_FLAG_RTS;
+ flags |= (urtw_rate2rtl(11) & 0xf) <<
+ URTW_TX_FLAG_RTSRATE_SHIFT;
+ tx->rtsdur = rtsdur;
+ }
+ tx->flag = htole32(flags);
+ tx->txdur = txdur;
+ if ((wh->i_fc[0] & IEEE80211_FC0_TYPE_MASK) ==
+ IEEE80211_FC0_TYPE_MGT &&
+ (wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) ==
+ IEEE80211_FC0_SUBTYPE_PROBE_RESP)
+ tx->retry = 1;
+ else
+ tx->retry = URTW_TX_MAXRETRY;
+ m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1));
} else {
- data->buf[8] = 3; /* CW minimum */
- data->buf[8] |= (7 << 4); /* CW maximum */
- data->buf[9] |= 11; /* retry limitation */
- m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)&data->buf[12]);
+ struct urtw_8187l_txhdr *tx;
+
+ tx = (struct urtw_8187l_txhdr *)data->buf;
+ if (rtsenable) {
+ flags |= URTW_TX_FLAG_RTS;
+ tx->rtsdur = rtsdur;
+ }
+ flags |= (urtw_rate2rtl(11) & 0xf) << URTW_TX_FLAG_RTSRATE_SHIFT;
+ tx->flag = htole32(flags);
+ tx->retry = 3; /* CW minimum */
+ tx->retry = 7 << 4; /* CW maximum */
+ tx->retry = URTW_TX_MAXRETRY << 8; /* retry limitation */
+ m_copydata(m0, 0, m0->m_pkthdr.len, (uint8_t *)(tx + 1));
}
data->buflen = xferlen;
@@ -2054,8 +2009,8 @@
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = URTW_8187_GETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, 0);
+ USETW(req.wValue, (val & 0xff) | 0xff00);
+ USETW(req.wIndex, (val >> 8) & 0x3);
USETW(req.wLength, sizeof(uint8_t));
error = urtw_do_request(sc, &req, data);
@@ -2072,8 +2027,8 @@
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = URTW_8187_GETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, 0);
+ USETW(req.wValue, (val & 0xff) | 0xff00);
+ USETW(req.wIndex, (val >> 8) & 0x3);
USETW(req.wLength, sizeof(uint16_t));
error = urtw_do_request(sc, &req, data);
@@ -2090,8 +2045,8 @@
req.bmRequestType = UT_READ_VENDOR_DEVICE;
req.bRequest = URTW_8187_GETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, 0);
+ USETW(req.wValue, (val & 0xff) | 0xff00);
+ USETW(req.wIndex, (val >> 8) & 0x3);
USETW(req.wLength, sizeof(uint32_t));
error = urtw_do_request(sc, &req, data);
@@ -2107,8 +2062,8 @@
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, 0);
+ USETW(req.wValue, (val & 0xff) | 0xff00);
+ USETW(req.wIndex, (val >> 8) & 0x3);
USETW(req.wLength, sizeof(uint8_t));
return (urtw_do_request(sc, &req, &data));
@@ -2123,8 +2078,8 @@
req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xff00);
- USETW(req.wIndex, 0);
+ USETW(req.wValue, (val & 0xff) | 0xff00);
+ USETW(req.wIndex, (val >> 8) & 0x3);
USETW(req.wLength, sizeof(uint16_t));
return (urtw_do_request(sc, &req, &data));
>>> TRUNCATED FOR MAIL (1000 lines) <<<
More information about the p4-projects
mailing list