The NetBSD Project

CVS log for src/sys/dev/usb/xhci.c

[BACK] Up to [cvs.NetBSD.org] / src / sys / dev / usb

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.72.2.14 / (download) - annotate - [select for diffs], Mon Jan 23 12:10:12 2023 UTC (4 days, 19 hours ago) by martin
Branch: netbsd-8
Changes since 1.72.2.13: +11 -5 lines
Diff to previous 1.72.2.13 (colored) to branchpoint 1.72 (colored) next main 1.73 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1787:

	sys/dev/pci/xhci_pci.c				1.31 via patch
	sys/dev/usb/xhci.c				1.173-1.175
	sys/dev/usb/xhcivar.h				1.22

Support xHCI device which has USB 2 port only.

Revision 1.107.2.11 / (download) - annotate - [select for diffs], Mon Jan 23 12:05:36 2023 UTC (4 days, 19 hours ago) by martin
Branch: netbsd-9
Changes since 1.107.2.10: +11 -5 lines
Diff to previous 1.107.2.10 (colored) to branchpoint 1.107 (colored) next main 1.108 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1570:

	sys/dev/pci/xhci_pci.c				1.31 via patch
	sys/dev/usb/xhci.c				1.173-1.175
	sys/dev/usb/xhcivar.h				1.22

Support xHCI device which has USB 2 port only.

Revision 1.175 / (download) - annotate - [select for diffs], Tue Oct 11 11:01:17 2022 UTC (3 months, 2 weeks ago) by msaitoh
Branch: MAIN
CVS Tags: netbsd-10-base, netbsd-10, HEAD
Changes since 1.174: +9 -7 lines
Diff to previous 1.174 (colored)

KNF a bit. No functional change.

Revision 1.174 / (download) - annotate - [select for diffs], Tue Oct 11 09:30:46 2022 UTC (3 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.173: +4 -4 lines
Diff to previous 1.173 (colored)

"Add" number of ports because the same speed's ECR may appear multiple times.

Revision 1.173 / (download) - annotate - [select for diffs], Tue Oct 11 09:18:22 2022 UTC (3 months, 2 weeks ago) by msaitoh
Branch: MAIN
Changes since 1.172: +6 -2 lines
Diff to previous 1.172 (colored)

There is an xHCI device which has USB 2 port only. Support it.

 - Example:

xhci4 at pci17 dev 0 function 0: AMD product 15b8 (rev. 0x00)
xhci4: 64-bit DMA
allocated pic msix10 type edge pin 0 level 6 to cpu0 slot 32 idt entry 107
xhci4: interrupting at msix10 vec 0
xhci4: xHCI version 1.20
xhci4: hcs1=1000840 hcs2=140000f1 hcs3=7000a
xhci4: hcc=0x110ffc5<XECP=0x110,MAXPSA=0xf,CFC,SEC,SPC,PAE,NSS,LTC,CSZ,AC64>
xhci4: xECP 440
xhci4: hcc2=0x3f<CIC,LEC,CTC,FSC,CMC,U3C>
xhci4: ECR: 0x00000401
xhci4: ECR: 0x02000402
xhci4:  SP: 0x02000402 0x20425355 0x00180101 0x00000000
xhci4:  hs ports 1 - 1
xhci4: ECR: 0x000f000a
xhci4: PAGESIZE 0x00000001
xhci4: sc_pgsz 0x00001000
xhci4: sc_maxslots 0x00000040
xhci4: sc_maxports 1
xhci4: sc_maxspbuf 2
xhci4: eventst: 0x000000013ee60fc0 0xffffb08826f5afc0 1000
xhci4: dcbaa: 0x000000013ee63000 0xffffb08826f5b000 1000
xhci4: current IMOD 0
(snip)
usb8 at xhci4: USB revision 3.1
usb9 at xhci4: USB revision 2.0
uhub8 at usb8: NetBSD (0x0000) xHCI root hub (0x0000), class 9/0, rev 3.00/1.00, addr 0
uhub8: 0 ports with 0 removable, self powered
uhub8: no ports, hub ignored
uhub8: WARNING: power management not supported
autoconfiguration error: usb8: root device is not a hub
usb8: WARNING: power management not supported
uhub9 at usb9: NetBSD (0x0000) xHCI root hub (0x0000), class 9/0, rev 2.00/1.00, addr 0
uhub9: 1 port with 1 removable, self powered

 - To resolve this problem, keep number of ports of SS and HS and use
   it to attach child device(s).
 - Tested on ASUS TUF GAMING X670E-PLUS.
 - OK'd by skrll@.

Revision 1.172 / (download) - annotate - [select for diffs], Sun Sep 25 07:23:07 2022 UTC (4 months ago) by skrll
Branch: MAIN
CVS Tags: bouyer-sunxi-drm-base, bouyer-sunxi-drm
Changes since 1.171: +2 -10 lines
Diff to previous 1.171 (colored)

Remove the bus_space_barrier I added with the commit

    revision 1.103
    date: 2019-01-11 15:43:51 +0000;  author: skrll;  state: Exp;  lines: +12 -2;  commitid: RYSytjLNOZrFCn7B;
    Add a bs_barrier to make ThunderX xhci work.  Not sure why this is
    needed, but I'll work it out later.

Turns out bus_dma.c needed fixing which I did with

    revision 1.115
    date: 2019-06-14 10:09:12 +0100;  author: skrll;  state: Exp;  lines: +39 -34;  commitid: GKW2p7ijoslyu8rB;
    Simplify the _ARM32_NEED_BUS_DMA_BOUNCE #ifdefs and rely on compiler
    optimisation of the bouncing = false case.

    Drain the write buf (aka DSB) in more cases

    Catch all CPUs that support speculation. (thunderx isn't CPU_CORTEX)

Revision 1.72.2.13 / (download) - annotate - [select for diffs], Fri Sep 16 18:34:20 2022 UTC (4 months, 1 week ago) by martin
Branch: netbsd-8
Changes since 1.72.2.12: +3 -2 lines
Diff to previous 1.72.2.12 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1765):

	sys/dev/usb/xhci.c: revision 1.154

Accept USB 3.2 in xhci_id_protocols().

Revision 1.107.2.10 / (download) - annotate - [select for diffs], Fri Sep 16 18:32:49 2022 UTC (4 months, 1 week ago) by martin
Branch: netbsd-9
Changes since 1.107.2.9: +3 -2 lines
Diff to previous 1.107.2.9 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1525):

	sys/dev/usb/xhci.c: revision 1.154

Accept USB 3.2 in xhci_id_protocols().

Revision 1.171 / (download) - annotate - [select for diffs], Tue Sep 13 10:33:37 2022 UTC (4 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.170: +4 -2 lines
Diff to previous 1.170 (colored)

xhci(4): After attach, access to sc_child/2 requires sc_intr_lock.

Serializes access with xhci_intr.

XXX Need to ensure the interrupt handler is quiesced at this point or
else it will trip over the assertion in xhci_intr about having at
least one child.

Revision 1.170 / (download) - annotate - [select for diffs], Tue Sep 13 10:15:28 2022 UTC (4 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.169: +12 -7 lines
Diff to previous 1.169 (colored)

xhci(4): Resume commands even if USBSTS.SRE is set.

Commands might not work after this but let's at least not deadlock --
give them an opportunity to time out or fail.

XXX Maybe set sc_dying here to skip the timeout.

Revision 1.169 / (download) - annotate - [select for diffs], Thu Sep 1 18:09:45 2022 UTC (4 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.168: +3 -2 lines
Diff to previous 1.168 (colored)

xhci(4): Make sure to destroy sc_rhlock on detach.

Revision 1.168 / (download) - annotate - [select for diffs], Tue Aug 23 15:16:44 2022 UTC (5 months ago) by riastradh
Branch: MAIN
Changes since 1.167: +12 -2 lines
Diff to previous 1.167 (colored)

xhci(4): Fix error branch for failed suspend.

If suspend failed, at least we can stop it from blocking all
subsequent xhci commands or making a second suspend crash.

Revision 1.167 / (download) - annotate - [select for diffs], Tue May 24 20:50:19 2022 UTC (8 months ago) by andvar
Branch: MAIN
Changes since 1.166: +3 -3 lines
Diff to previous 1.166 (colored)

fix various typos in comment, documentation and log messages.

Revision 1.166 / (download) - annotate - [select for diffs], Sat May 14 19:44:37 2022 UTC (8 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.165: +26 -4 lines
Diff to previous 1.165 (colored)

xhci(4): Handle race between software abort and hardware stall.

Revision 1.165 / (download) - annotate - [select for diffs], Sat May 14 19:44:26 2022 UTC (8 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.164: +12 -12 lines
Diff to previous 1.164 (colored)

xhci(4): Fix edge case in simultaneous xfer abort and failure.

On successful usbd_xfer_trycomplete, caller must set ux_status and
call usb_transfer_complete before releasing the pipe (bus) lock.
Failing to call usb_transfer_complete is a mistake.  Presumably this
was intended to claim the xfer to complete it only on the last
packet.

I previously introduced the violation of this rule when the code
looked like

	xfer->ux_status = err;
	if (trb stuff)
		usb_transfer_complete(xfer);

I mostly mechanically changed all the assignments of xfer->ux_status
to do usbd_xfer_trycomplete first and then usb_transfer_complete.

In the original, the extra assignment of xfer->ux_status in the event
we _don't_ immediately call usb_transfer_complete was likely
redundant and (except insofar as the abort protocol was broken)
harmless.  But now it is a problem because of the contract between
usbd_xfer_trycomplete and usb_transfer_complete under the pipe (bus)
lock.  In retrospect, the original probably should have been

	if (trb stuff) {
		xfer->ux_status = err;
		usb_transfer_complete(xfer);
	}

and my mechanical transformation should have worked, but also in
retrospect I should have put more thought into the change and done it
a little less mechanically.

Revision 1.164 / (download) - annotate - [select for diffs], Wed Apr 6 22:01:45 2022 UTC (9 months, 3 weeks ago) by mlelstv
Branch: MAIN
Changes since 1.163: +91 -176 lines
Diff to previous 1.163 (colored)

revert accidental last commit (except ukbd.c)

Revision 1.163 / (download) - annotate - [select for diffs], Wed Apr 6 21:51:29 2022 UTC (9 months, 3 weeks ago) by mlelstv
Branch: MAIN
Changes since 1.162: +178 -93 lines
Diff to previous 1.162 (colored)

remove debug printf

Revision 1.162 / (download) - annotate - [select for diffs], Sun Mar 13 11:30:04 2022 UTC (10 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.161: +36 -5 lines
Diff to previous 1.161 (colored)

xhci(4): Serialize access to portsc registers.

Both xhci_roothub_ctrl and xhci_suspend/resume do r/m/w on them, so
use a mutex to serialize access to avoid stomping on each other.

Revision 1.161 / (download) - annotate - [select for diffs], Sun Mar 13 11:29:55 2022 UTC (10 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.160: +43 -26 lines
Diff to previous 1.160 (colored)

xhci(4): Restore synchronous abort.

In revision 1.155, I made the logic to abort the hardware
asynchronous, under the misapprehension that it is necessary for
ubm_abortx not to release the bus lock.

Not only is this not necessary, but it is harmful to for the logic to
be asynchronous because the caller assumes the hardware won't use any
DMA buffers by the time ubm_abortx has returned so it is safe to
recycle them -- which is false if we don't synchronously wait for the
hardware to stop.

Revision 1.160 / (download) - annotate - [select for diffs], Wed Mar 9 22:19:07 2022 UTC (10 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.159: +11 -9 lines
Diff to previous 1.159 (colored)

xhci(4): Avoid holding bus lock across usb_delay_ms.

We may still need a mechanism to serialize access to the portsc
registers between xhci_roothub_ctrl and xhci_suspend/resume, but the
bus lock is no longer that, and holding the bus lock across
usb_delay_ms may lead to deadlock by blocking the softints that wake
usb_delay_ms.

Revision 1.159 / (download) - annotate - [select for diffs], Wed Mar 9 22:17:41 2022 UTC (10 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.158: +2 -4 lines
Diff to previous 1.158 (colored)

usb: Provisionally release bus lock around ubm_rhctrl.

This isn't quite correct, but it avoids a deadlock:

- *_roothub_ctrl holds bus lock, waits in usb_delay_ms for kpause
- softint waits for bus lock, holds up kpause wakeup

The deadlock is new since recent changes to hold the bus lock over
upm_start/upm_transfer.  Making this change regresses to other
problems:

- *_suspend/resume and *_roothub_ctrl often touch the same portsc
   registers

- roothub_ctrl_abort needs to wait for ubm_rhctrl to complete.

  When the bus lock was held across both, a noop served here, but we
  can't hold the bus lock across both, so that doesn't work.

However, these problems -- which we've had for a long time -- seem to
be less bad than the deadlock.  So let's avoid the deadlock for now
and then work out another way to serialize suspend/resume/rhctrl and
aborts.

Candidate fix for PR kern/56739.

Revision 1.158 / (download) - annotate - [select for diffs], Thu Mar 3 06:12:11 2022 UTC (10 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.157: +19 -42 lines
Diff to previous 1.157 (colored)

usb: Hold pipe lock across upm_transfer and upm_start.

This simplifies the code and fixes races with abort.  Access to the
pipe's queue is now done exclusively while the pipe is locked.

Revision 1.157 / (download) - annotate - [select for diffs], Thu Mar 3 06:08:50 2022 UTC (10 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.156: +2 -4 lines
Diff to previous 1.156 (colored)

usb: Factor usb_transfer_complete out of ubm_abortx method.

Revision 1.156 / (download) - annotate - [select for diffs], Thu Mar 3 06:04:31 2022 UTC (10 months, 3 weeks ago) by riastradh
Branch: MAIN
Changes since 1.155: +4 -60 lines
Diff to previous 1.155 (colored)

usb: Factor usb_insert_transfer out of upm_transfer and make private.

Almost every upm_transfer function starts with:

	mutex_enter(&sc->sc_lock);
	err = usb_insert_transfer(xfer);
	mutex_exit(&sc->sc_lock);
	if (err)
		return err;

Some of them have debug messages sprinkled in here too, or assert
that err == USBD_NORMAL_COMPLETION (alternative is USBD_IN_PROGRESS,
only for pipes with up_running or up_serialise, presumably not
applicable for these types of pipes).  Some of them also assert
xfer->ux_status == USBD_NOT_STARTED, which is guaranteed on entry and
preserved by usb_insert_transer.

Exceptions:

- arch/mips/adm5120/dev/ahci.c ahci_device_isoc_transfer just returns
  USBD_NORMAL_COMPLETION, but I'm pretty sure this is and always has
  been broken anyway, so won't make anything worse (if anything, might
  make it better...)

- external/bsd/dwc2/dwc2.c dwc2_device_bulk_transfer and
  dwc2_device_isoc_transfer _also_ issue dwc2_device_start(xfer)
  under the lock.  This is probably a better way to do it, but let's
  do it uniformly across all HCIs at once.

- rump/dev/lib/libugenhc/ugenhc.c rumpusb_device_bulk_transfer
  sometimes returns USBD_IN_PROGRESS _without_ queueing the transfer,
  in the !rump_threads case.  Not really sure how this is supposed to
  work...  If it actually breaks anything, we can figure it out.

Revision 1.155 / (download) - annotate - [select for diffs], Sat Jan 29 21:36:12 2022 UTC (11 months, 4 weeks ago) by riastradh
Branch: MAIN
Changes since 1.154: +151 -159 lines
Diff to previous 1.154 (colored)

xhci(4): Fix handling of endpoint reset/stop.

Use the same asynchronous task resetting a stalled/halted endpoint
and stopping a running endpoint -- either way we need to put the
endpoint back into a known state and, if there are transfers waiting
to run, start them up again.

- xhci_abortx must not drop the pipe (bus) lock -- usbdi(9) requires
  this.  So arrange to stop the endpoint and empty the queue
  asynchronously.

- If the xhci softint claims an xfer for completion with
  usbd_xfer_trycomplete, it must call usb_transfer_complete without
  ever releasing the pipe (bus) lock -- it can't claim the xfer and
  then defer the usb_transfer_complete to a task.  So arrange to
  reset the endpoint asynchronously, hold up new transfers until the
  endpoint has been reset, and then do usb_transfer_complete
  immediately.

Revision 1.154 / (download) - annotate - [select for diffs], Tue Jan 25 11:17:39 2022 UTC (12 months ago) by msaitoh
Branch: MAIN
Changes since 1.153: +3 -2 lines
Diff to previous 1.153 (colored)

Accept USB 3.2 in xhci_id_protocols().

Revision 1.153 / (download) - annotate - [select for diffs], Sun Jan 16 20:25:36 2022 UTC (12 months, 1 week ago) by riastradh
Branch: MAIN
Changes since 1.152: +3 -3 lines
Diff to previous 1.152 (colored)

xhci(4): Fix citation in comment.

4.15.2.1 is device-initiated resume, but we are doing host-initiated.

No functional change.

Revision 1.152 / (download) - annotate - [select for diffs], Sun Jan 16 20:25:18 2022 UTC (12 months, 1 week ago) by riastradh
Branch: MAIN
Changes since 1.151: +3 -3 lines
Diff to previous 1.151 (colored)

xhci(4): Fix copypasto in resume error message.

Revision 1.151 / (download) - annotate - [select for diffs], Tue Dec 21 09:51:22 2021 UTC (13 months, 1 week ago) by skrll
Branch: MAIN
Changes since 1.150: +19 -19 lines
Diff to previous 1.150 (colored)

Change the usb_mem API to take a bus_dma_tag_t in usb_allocmem instead of
a struct usbd_bus *.

This allows an HCD to use more than one tag.

Revision 1.150 / (download) - annotate - [select for diffs], Sat Oct 23 20:40:23 2021 UTC (15 months ago) by jakllsch
Branch: MAIN
Changes since 1.149: +20 -36 lines
Diff to previous 1.149 (colored)

xhci: Always read/write both halves of 64-bit registers

Access the 64-bit registers in their entirety at all times, independent
of the AC64 parameter of the hardware implementation.

Makes xhci(4) work on SolidRun MACCHIATObin (Marvell 8040 SoC)

Revision 1.149 / (download) - annotate - [select for diffs], Sun Oct 10 20:10:12 2021 UTC (15 months, 2 weeks ago) by jmcneill
Branch: MAIN
Changes since 1.148: +10 -11 lines
Diff to previous 1.148 (colored)

xhci: shrink port reset delay

Instead of waiting for USB_PORT_ROOT_RESET_DELAY (250ms) before checking
the port reset status, poll the PORTSC register and return early if the
reset has completed.

Revision 1.148 / (download) - annotate - [select for diffs], Tue Aug 17 22:00:32 2021 UTC (17 months, 1 week ago) by andvar
Branch: MAIN
Changes since 1.147: +3 -3 lines
Diff to previous 1.147 (colored)

fix multiplei repetitive typos in comments, messages and documentation. mainly because copy paste code big amount of files are affected.

Revision 1.147 / (download) - annotate - [select for diffs], Fri Aug 13 20:47:55 2021 UTC (17 months, 2 weeks ago) by andvar
Branch: MAIN
Changes since 1.146: +3 -3 lines
Diff to previous 1.146 (colored)

fix typos in words "pointer" and s/fram /frame/

Revision 1.107.2.9 / (download) - annotate - [select for diffs], Tue Jun 22 05:10:50 2021 UTC (19 months, 1 week ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-3-RELEASE
Changes since 1.107.2.8: +5 -5 lines
Diff to previous 1.107.2.8 (colored) to branchpoint 1.107 (colored)

Fix pullup #1302 by adapting the changes to this branch
(there was a misunderstanding in the ticket handling)

Revision 1.107.2.8 / (download) - annotate - [select for diffs], Mon Jun 21 17:11:46 2021 UTC (19 months, 1 week ago) by martin
Branch: netbsd-9
Changes since 1.107.2.7: +422 -15 lines
Diff to previous 1.107.2.7 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1301):

	sys/dev/usb/xhci.c: revision 1.140
	sys/dev/usb/xhci.c: revision 1.141
	sys/dev/usb/xhci.c: revision 1.143
	sys/dev/usb/xhcivar.h: revision 1.18
	sys/dev/usb/xhcivar.h: revision 1.19
	sys/dev/usb/xhcireg.h: revision 1.19
	sys/dev/usb/xhci.c: revision 1.139

xhci(4): Draft suspend/resume.

Work almost entirely done and tested by maya@ based on xhci 1.2 spec;
tidied up and tweaked by me.

Not sure about issuing Stop Endpoint commands or ensuring the Command
Ring is in the Stopped or Idle state, but this seems to work as is,
so it's already an improvement over what we had before which was no
xhci suspend/resume at all.

In particular, it's not clear to us:
- if we don't have any pending USB activity whether we need to issue
  the Stop Endpoints or quiesce the command ring; but
- if we do have any pending USB activity whether issuing Stop
  Endpoint is enough or whether we also need to do anything to
  synchronize with other software logic to quiesce it too.

xhci(4): Block commands and issue Stop Endpoint on suspend.

xhci: Fix logic in waiting for command queue access.
_Either_ an existing command in progress, _or_ an existing suspend in
progress that is not done by us, should block us; the logic I wrote
previously erroneously blocked only if both conditions happened at
the same time.

Should fix issue reported by Andrius V in the PR kern/56050 followup
discussion.

xhci(4): Wait USB_RESUME_WAIT ms, not 20 ms.
Better to use the named constant, and although the spec says 20 ms is
enough, apparently for some devices it's not.

Revision 1.138.4.1 / (download) - annotate - [select for diffs], Thu Jun 17 04:46:31 2021 UTC (19 months, 1 week ago) by thorpej
Branch: thorpej-i2c-spi-conf
Changes since 1.138: +429 -16 lines
Diff to previous 1.138 (colored) next main 1.139 (colored)

Sync w/ HEAD.

Revision 1.146 / (download) - annotate - [select for diffs], Sat Jun 12 13:58:05 2021 UTC (19 months, 2 weeks ago) by riastradh
Branch: MAIN
CVS Tags: thorpej-i2c-spi-conf2-base, thorpej-i2c-spi-conf2, thorpej-i2c-spi-conf-base, thorpej-futex2-base, thorpej-futex2, thorpej-cfargs2-base, thorpej-cfargs2
Changes since 1.145: +4 -2 lines
Diff to previous 1.145 (colored)

usb(4): Fix racy endpoint reference counting.

Rules:

1. After usbd_setup_pipe*, must usbd_kill_pipe.
2. After usbd_open_pipe*, must usbd_close_pipe.

Still haven't merged the logic in usbd_kill_pipe and usbd_close_pipe,
but getting closer.

Revision 1.145 / (download) - annotate - [select for diffs], Sat Jun 12 12:13:10 2021 UTC (19 months, 2 weeks ago) by riastradh
Branch: MAIN
Changes since 1.144: +4 -2 lines
Diff to previous 1.144 (colored)

usb(4): Sprinkle kernel lock assertions.

Revision 1.144 / (download) - annotate - [select for diffs], Sun Jun 6 18:37:20 2021 UTC (19 months, 3 weeks ago) by jdolecek
Branch: MAIN
Changes since 1.143: +3 -2 lines
Diff to previous 1.143 (colored)

also reset xs->xs_xr[dci] to NULL when closing the pipe

avoids KASSERT() on next xhci_open()

should fix PR kern/56194 by nia

Revision 1.138.6.1 / (download) - annotate - [select for diffs], Mon May 31 22:15:19 2021 UTC (19 months, 4 weeks ago) by cjep
Branch: cjep_staticlib_x
Changes since 1.138: +424 -16 lines
Diff to previous 1.138 (colored) next main 1.139 (colored)

sync with head

Revision 1.143 / (download) - annotate - [select for diffs], Sat May 29 16:49:30 2021 UTC (20 months ago) by riastradh
Branch: MAIN
CVS Tags: cjep_sun2x-base1, cjep_sun2x-base, cjep_sun2x, cjep_staticlib_x-base1
Changes since 1.142: +3 -3 lines
Diff to previous 1.142 (colored)

xhci(4): Wait USB_RESUME_WAIT ms, not 20 ms.

Better to use the named constant, and although the spec says 20 ms is
enough, apparently for some devices it's not.

Revision 1.142 / (download) - annotate - [select for diffs], Thu May 27 11:09:15 2021 UTC (20 months ago) by skrll
Branch: MAIN
Changes since 1.141: +4 -3 lines
Diff to previous 1.141 (colored)

Fix error handling botch in 1.138. Thanks to jmcneill@ for spotting it.

Revision 1.141 / (download) - annotate - [select for diffs], Wed May 26 22:37:21 2021 UTC (20 months ago) by riastradh
Branch: MAIN
Changes since 1.140: +4 -5 lines
Diff to previous 1.140 (colored)

xhci: Fix logic in waiting for command queue access.

_Either_ an existing command in progress, _or_ an existing suspend in
progress that is not done by us, should block us; the logic I wrote
previously erroneously blocked only if both conditions happened at
the same time.

Should fix issue reported by Andrius V in the PR kern/56050 followup
discussion.

Revision 1.140 / (download) - annotate - [select for diffs], Sun May 23 21:12:28 2021 UTC (20 months ago) by riastradh
Branch: MAIN
Changes since 1.139: +107 -38 lines
Diff to previous 1.139 (colored)

xhci(4): Block commands and issue Stop Endpoint on suspend.

Revision 1.139 / (download) - annotate - [select for diffs], Sun May 23 11:49:45 2021 UTC (20 months ago) by riastradh
Branch: MAIN
Changes since 1.138: +348 -9 lines
Diff to previous 1.138 (colored)

xhci(4): Draft suspend/resume.

Work almost entirely done and tested by maya@ based on xhci 1.2 spec;
tidied up and tweaked by me.

Not sure about issuing Stop Endpoint commands or ensuring the Command
Ring is in the Stopped or Idle state, but this seems to work as is,
so it's already an improvement over what we had before which was no
xhci suspend/resume at all.

In particular, it's not clear to us:

- if we don't have any pending USB activity whether we need to issue
  the Stop Endpoints or quiesce the command ring; but

- if we do have any pending USB activity whether issuing Stop
  Endpoint is enough or whether we also need to do anything to
  synchronize with other software logic to quiesce it too.

Revision 1.135.2.2 / (download) - annotate - [select for diffs], Sat Apr 3 22:28:51 2021 UTC (21 months, 3 weeks ago) by thorpej
Branch: thorpej-futex
Changes since 1.135.2.1: +8 -12 lines
Diff to previous 1.135.2.1 (colored) next main 1.136 (colored)

Sync with HEAD.

Revision 1.138 / (download) - annotate - [select for diffs], Tue Jan 5 18:00:21 2021 UTC (2 years ago) by skrll
Branch: MAIN
CVS Tags: thorpej-futex-base, thorpej-cfargs-base, thorpej-cfargs, cjep_staticlib_x-base
Branch point for: thorpej-i2c-spi-conf, cjep_staticlib_x
Changes since 1.137: +8 -12 lines
Diff to previous 1.137 (colored)

More converstion from usbd_status to int for function error reporting.
This time it's the turn of usb_allocmem.

Revision 1.135.2.1 / (download) - annotate - [select for diffs], Sun Jan 3 16:35:02 2021 UTC (2 years ago) by thorpej
Branch: thorpej-futex
Changes since 1.135: +15 -17 lines
Diff to previous 1.135 (colored)

Sync w/ HEAD.

Revision 1.137 / (download) - annotate - [select for diffs], Sat Jan 2 12:39:33 2021 UTC (2 years ago) by jmcneill
Branch: MAIN
Changes since 1.136: +15 -16 lines
Diff to previous 1.136 (colored)

Use USBMALLOC_ZERO to ensure that all DMA memory is zero initialized.

Revision 1.107.2.7 / (download) - annotate - [select for diffs], Wed Dec 23 12:34:38 2020 UTC (2 years, 1 month ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-2-RELEASE
Changes since 1.107.2.6: +2 -3 lines
Diff to previous 1.107.2.6 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by riastradh in ticket #1159):

	sys/dev/usb/ohci.c: revision 1.314
	sys/external/bsd/dwc2/dwc2.c: revision 1.75
	sys/dev/usb/ehci.c: revision 1.284
	sys/dev/usb/uhci.c: revision 1.305
	sys/dev/usb/xhci.c: revision 1.136

usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.

These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT
endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to
pass the struct usbd_xfer object to usbd_close_pipe to free later.

In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints,
up_intrxfer is never initialized, so the assertion cannot be right.
In principle we might even have more than one outstanding interrupt
transfer at a time, rendering the point of the assertion moot anyway.

Found by interrupting a uhidev write to a u2f device.

ok nick

Revision 1.136 / (download) - annotate - [select for diffs], Tue Dec 22 01:07:23 2020 UTC (2 years, 1 month ago) by riastradh
Branch: MAIN
Changes since 1.135: +2 -3 lines
Diff to previous 1.135 (colored)

usb: Omit bogus assertions about struct usbd_pipe::up_intrxfer.

These assertions were only valid for pipes at UE_IN_DIR, UE_INTERRUPT
endpoints created with usbd_open_pipe_intr, which uses up_intrxfer to
pass the struct usbd_xfer object to usbd_close_pipe to free later.

In contrast, for pipes at UE_OUT_DIR, UE_INTERRUPT endpoints,
up_intrxfer is never initialized, so the assertion cannot be right.
In principle we might even have more than one outstanding interrupt
transfer at a time, rendering the point of the assertion moot anyway.

Found by interrupting a uhidev write to a u2f device.

ok nick

Revision 1.135 / (download) - annotate - [select for diffs], Thu Oct 15 09:37:40 2020 UTC (2 years, 3 months ago) by jmcneill
Branch: MAIN
Branch point for: thorpej-futex
Changes since 1.134: +9 -10 lines
Diff to previous 1.134 (colored)

Rename xhci_op_barrier to xhci_barrier and remove offset/length parameters.
Barriers will be applied to the entire XHCI register space.

Revision 1.134 / (download) - annotate - [select for diffs], Fri Aug 21 20:46:03 2020 UTC (2 years, 5 months ago) by jakllsch
Branch: MAIN
Changes since 1.133: +195 -4 lines
Diff to previous 1.133 (colored)

xhci(4): initial support for Isochronous pipes

Needs more cleanup, and more work, particularly transaction scheduling
may need to be examined with bus analyzer (to check if too frequent/
infrequent) or various isoc pipe consumers (to check if too infrequent)
and fixed if incorrect.

Begins to address PR kern/55574.

Revision 1.133 / (download) - annotate - [select for diffs], Fri Aug 21 20:16:39 2020 UTC (2 years, 5 months ago) by jakllsch
Branch: MAIN
Changes since 1.132: +17 -18 lines
Diff to previous 1.132 (colored)

xhci(4): copy HCCPARAMS regs to softc, use when needed

We'll need more than just the AC64 bit for the Isoc support coming up;
and we don't need to keep all the bits as bools in the softc.

Revision 1.132 / (download) - annotate - [select for diffs], Sat Jun 6 08:56:30 2020 UTC (2 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.131: +5 -5 lines
Diff to previous 1.131 (colored)

More __BITS.  NFCI.

Revision 1.131 / (download) - annotate - [select for diffs], Thu Jun 4 20:54:37 2020 UTC (2 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.130: +4 -3 lines
Diff to previous 1.130 (colored)

Near complete conversion to __BITS

Revision 1.130 / (download) - annotate - [select for diffs], Mon Jun 1 10:25:00 2020 UTC (2 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.129: +11 -6 lines
Diff to previous 1.129 (colored)

Remove some unnecessary bit shifts by using appropriate read size

Revision 1.107.2.6 / (download) - annotate - [select for diffs], Mon May 25 15:31:45 2020 UTC (2 years, 8 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-1-RELEASE
Changes since 1.107.2.5: +16 -9 lines
Diff to previous 1.107.2.5 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by jakllsch in ticket #921):

	sys/dev/usb/xhci.c: revision 1.129

xhci(4): only usbd_xfer_trycomplete() if certain to usb_transfer_complete()

Previously we'd cancel the timeout after the data stage of control xfers, and
then hope that the status stage would eventually interrupt.

Revision 1.129 / (download) - annotate - [select for diffs], Thu May 21 15:28:35 2020 UTC (2 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.128: +16 -9 lines
Diff to previous 1.128 (colored)

xhci(4): only usbd_xfer_trycomplete() if certain to usb_transfer_complete()

Previously we'd cancel the timeout after the data stage of control xfers, and
then hope that the status stage would eventually interrupt.

Revision 1.128 / (download) - annotate - [select for diffs], Thu May 21 13:47:10 2020 UTC (2 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.127: +17 -4 lines
Diff to previous 1.127 (colored)

xhci(4): dynamically allocate xhci_xfer->xx_trb buffer

Allocation size remains the same for now.

Revision 1.127 / (download) - annotate - [select for diffs], Thu May 21 13:23:38 2020 UTC (2 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.126: +25 -15 lines
Diff to previous 1.126 (colored)

xhci(4): Check for overflows with KASSERT when putting TRBs on xfer TRB buffer.

Also more-correctly check for overruns when putting TRBs on a ring.

Revision 1.126 / (download) - annotate - [select for diffs], Thu May 21 12:46:44 2020 UTC (2 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.125: +4 -5 lines
Diff to previous 1.125 (colored)

xhci(4): Be more concise in putting the setup request in TRB immediate data.

Or: memcpy(),htole64() is replaced by functionally-identical le64dec().

Revision 1.125 / (download) - annotate - [select for diffs], Wed May 20 17:32:27 2020 UTC (2 years, 8 months ago) by jakllsch
Branch: MAIN
Changes since 1.124: +10 -9 lines
Diff to previous 1.124 (colored)

Use more-semantically-correct types in xhci allocx/freex functions.

Revision 1.92.2.2 / (download) - annotate - [select for diffs], Mon Apr 13 08:04:51 2020 UTC (2 years, 9 months ago) by martin
Branch: phil-wifi
Changes since 1.92.2.1: +338 -334 lines
Diff to previous 1.92.2.1 (colored) to branchpoint 1.92 (colored) next main 1.93 (colored)

Mostly merge changes from HEAD upto 20200411

Revision 1.124 / (download) - annotate - [select for diffs], Sun Apr 5 20:59:38 2020 UTC (2 years, 9 months ago) by skrll
Branch: MAIN
CVS Tags: phil-wifi-20200421, phil-wifi-20200411, phil-wifi-20200406, bouyer-xenpvh-base2, bouyer-xenpvh-base1, bouyer-xenpvh-base, bouyer-xenpvh
Changes since 1.123: +29 -16 lines
Diff to previous 1.123 (colored)

Switch USB to use non-coherent buffers for data transfers in the
same way as OpenBSD.

The use of coherent (uncacheable on ARM and other arches) mappings
for transfer buffers impacts performance, espcially where memcpys
are involved.

Audit the necessary usb_syncmem operations - a few were missing.

Revision 1.123 / (download) - annotate - [select for diffs], Thu Apr 2 11:37:23 2020 UTC (2 years, 9 months ago) by skrll
Branch: MAIN
Changes since 1.122: +107 -77 lines
Diff to previous 1.122 (colored)

Reduce the memory footprint by allocating a ring per endpoint/pipe on
pipe open.

From sc.dying on tech-kern

Revision 1.122 / (download) - annotate - [select for diffs], Sat Mar 14 03:01:36 2020 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.121: +4 -4 lines
Diff to previous 1.121 (colored)

fix more broken kernhist formats (now I got them all).

Revision 1.121 / (download) - annotate - [select for diffs], Sat Mar 14 02:35:34 2020 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.120: +34 -34 lines
Diff to previous 1.120 (colored)

revert the 0x% -> %# change for fixed width formats pointed out by uwe.

Revision 1.120 / (download) - annotate - [select for diffs], Fri Mar 13 18:17:41 2020 UTC (2 years, 10 months ago) by christos
Branch: MAIN
Changes since 1.119: +46 -46 lines
Diff to previous 1.119 (colored)

PR/55068: sc.dying: Fix printf formats:
- no %s/%p for kernel log
- 0x% -> %#
- always %j for kernel log

Revision 1.107.2.5 / (download) - annotate - [select for diffs], Sun Mar 1 12:35:16 2020 UTC (2 years, 10 months ago) by martin
Branch: netbsd-9
Changes since 1.107.2.4: +66 -137 lines
Diff to previous 1.107.2.4 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by riastradh in ticket #744):

	sys/dev/usb/uhci.c: revision 1.292
	sys/dev/usb/uhci.c: revision 1.293
	sys/dev/usb/usbdi.h: revision 1.99
	sys/dev/usb/motg.c: revision 1.26
	sys/dev/usb/motg.c: revision 1.27
	sys/dev/usb/motg.c: revision 1.28
	sys/dev/usb/motg.c: revision 1.29
	sys/external/bsd/dwc2/dwc2.c: revision 1.70
	sys/external/bsd/dwc2/dwc2.c: revision 1.71
	sys/dev/usb/usb.c: revision 1.181
	sys/arch/mips/adm5120/dev/ahci.c: revision 1.20
	sys/dev/usb/usb.c: revision 1.182
	sys/dev/usb/xhci.c: revision 1.116
	sys/dev/usb/xhci.c: revision 1.117
	sys/dev/usb/xhci.c: revision 1.118
	sys/dev/usb/uhci.c: revision 1.289
	sys/dev/usb/usbdivar.h: revision 1.121
	sys/dev/usb/usbdi.c: revision 1.190
	sys/dev/usb/usbdivar.h: revision 1.122
	sys/dev/usb/usbdi.c: revision 1.191
	sys/dev/usb/usbdi.c: revision 1.192
	sys/external/bsd/dwc2/dwc2var.h: revision 1.7
	sys/dev/usb/motg.c: revision 1.30
	sys/dev/usb/motg.c: revision 1.31
	sys/dev/usb/motg.c: revision 1.32
	sys/dev/usb/motg.c: revision 1.33
	sys/external/bsd/dwc2/dwc2.c: revision 1.67
	sys/external/bsd/dwc2/dwc2.c: revision 1.68
	sys/dev/usb/ehci.c: revision 1.270
	sys/external/bsd/dwc2/dwc2.c: revision 1.69
	sys/dev/usb/usbdi.h: revision 1.100
	sys/dev/usb/ehci.c: revision 1.271
	sys/arch/mips/adm5120/dev/ahci.c: revision 1.18
	sys/dev/usb/usbdi.h: revision 1.101
	sys/dev/usb/ehci.c: revision 1.272
	sys/dev/ic/sl811hs.c: revision 1.103
	sys/arch/mips/adm5120/dev/ahci.c: revision 1.19
	sys/dev/usb/ehci.c: revision 1.273
	sys/dev/usb/ohci.c: revision 1.293
	sys/dev/usb/uhci.c: revision 1.290
	sys/dev/usb/ohci.c: revision 1.294
	sys/dev/usb/uhci.c: revision 1.291
	sys/dev/usb/ohci.c: revision 1.295

Teach usb_rem_task to return whether removed from queue or not.

New function usb_task_pending for diagnostic assertions.
Usable only for negative diagnostic assertions:

        KASSERT(!usb_task_pending(dev, task))

If you can think of a better name for this than !usb_task_pending,
I'm all ears.

 -

Nothing guarantees xfer's timeout has completed.

Wait for it when we free the xfer.

 -


New xfer state variables ux_timeout_set and ux_timeout_reset.

These are needed because:
- The host controller interrupt cannot wait for the callout or task
  to finish running.
- Nothing in the USBD API as is waits for the callout or task to
  finish running.
- Callers expect to be able to resubmit USB xfers from xfer callbacks
  without waiting for anything to finish running.

The variable ux_timeout_set can be used by a host controller to
decide on submission whether to schedule the callout or to ask an
already-scheduled callout or already-queued task to reschedule the
callout, by setting the variable ux_timeout_reset to true.

When the callout or task runs and sees that ux_timeout_reset is true,
rather than queue the task or abort the xfer, it can instead just
schedule the callout anew.

 -

Fix steady state of timeouts in ehci.

This is complicated because:
1. There are three ways that an xfer can be completed:
   (a) hardware interrupt completes xfer
   (b) software decision aborts xfer with USBD_CANCELLED
   (c) timeout aborts xfer with USBD_TIMEOUT
2. The timeout abort can't be done in callout because ehci_sync_hc,
   called unconditionally by ehci_abort_xfer to wait until the device
   has finished using any references to the xfer, may sleep.  So we
   have to schedule a callout that, when run, will schedule a usb_task.
3. The hardware completion interrupt can't sleep waiting for a callout
   or task to finish -- can't use callout_halt or usb_rem_task_wait.
   So the callout and usb_task must be able to run _after_ the hardware
   completion interrupt, and recognize that they're late to the party.
   (Note, though, that usbd_free_xfer does wait for the callout and
   task to complete, so there's no danger they may use themselves after
   free.)
4. The xfer may resubmitted -- and the timeout may be rescheduled --
   immediately after the hardware completion interrupt, _while_ the
   callout and/or usb_task may still be scheduled.  Specifically, we
   may have the following sequence of events:
   (a) hardware completion interrupt
   (b) callout or usb_task fires
   (c) driver resubmits xfer
   (d) callout or usb_task acquires lock and looks around dazed and
       bewildered at the firehose of events like reading the news in 2019

The mechanism for sorting this out is that we have two bits of state:
- xfer->ux_timeout_set informs the driver, when submitting an xfer and
  setting up its timeout, whether either the callout or usb_task is
  already scheduled or not.
- xfer->ux_timeout_reset informs the callout or usb_task whether it
  should reschedule the callout, because the xfer got resubmitted, or
  not.

 -

Factor out HCI-independent xfer completion logic.

New API for HCI drivers to synchronize hardware completion
interrupts, synchronous aborts, and asynchronous timeouts:
- When submitting an xfer to hardware, call
  usbd_xfer_schedule_timeout(xfer).
- On HCI completion interrupt for xfer completion:
        if (!usbd_xfer_trycomplete(xfer))
                return;         /* timed out or aborted, ignore it */
- In upm_abort methods, call usbd_xfer_abort(xfer).

For HCI drivers that use this API (not needed in drivers that don't,
or for xfers like root intr xfers that don't use it):
- New ubm_abortx method serves role of former *hci_abort_xfer, but
  without any logic for wrangling timeouts/callouts/tasks -- caller
  in usbd_xfer_abort has already handled them.
- New ubm_dying method, returns true if the device is in the process
  of detaching, used by the timeout logic.

Converted and tested:
- ehci
- ohci

Converted and compile-tested:
- ahci (XXX did this ever work?)
- dwc2
- motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?)
- uhci
- xhci

Not changed:
- slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer
  callout for timeouts (XXX but maybe should?)
- ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its
  own transfer timeouts

 -

Fix steady state of root intr xfers.

Why?
- Avoid completing a root intr xfer multiple times in races.
- Avoid potential use-after-free in poll_hub callouts (uhci, ahci).

How?
- Use sc->sc_intr_xfer or equivalent to store only a pending xfer
  that has not yet completed -- whether successfully, by timeout, or
  by synchronous abort.  When any of those happens, set it to null
  under the lock, so the xfer is completed only once.
- For hci drivers that use a callout to poll the root hub (uhci, ahci):
  . Pass the softc pointer, not the xfer, to the callout, so the
    callout is not even tempted to use xfer after free -- if the
    callout fires, but the xfer is synchronously aborted before the
    callout can do anything, the xfer might be freed by the time the
    callout starts to examine it.
  . Teach the callout to do nothing if it is callout_pending after it
    has fired.  This way:
    1. completion or synchronous abort can just callout_stop
    2. start can just callout_schedule
    If the callout had already fired before (1), and doesn't acquire
    the bus lock until after (2), it may be tempted to abort the new
    root intr xfer just after submission, which would be wrong -- so
    instead we just have the callout do nothing if it notices it has
    been rescheduled, since it will fire again after the appropriate
    time has elapsed.

 -

Initialize xfer->ux_status in uhci_root_intr_start.

Otherwise, it will be USBD_NOT_STARTED, so usbd_ar_pipe will skip
calling upm_abort.
Candidate fix for PR kern/54963, same problem as reported at:
href="https://mail-index.NetBSD.org/current-users/2020/02/13/msg037740.html

 -

Set ux_isdone in uhci_poll_hub for DIAGNOSTIC.

 -

Fix mistakes in previous sloppy change with root intr xfers.
- Make sure ux_status is set to USBD_IN_PROGRESS when started.
  Otherwise, if it is still in flight when we abort the pipe,
  usbd_ar_pipe will skip calling upm_abort.
- Initialize ux_status under the lock; in principle a completion
  interrupt (or a delay) could race with the initialization.
- KASSERT that the xfer is in progress when we're about to complete
  it.

Candidate fix for PR kern/54963 for other HCI drivers than uhci.
ok nick
ok phone
(This is the change that nick evidently MEANT to ok when he ok'd the
previous one!)

 -

Fix build

 -

Fix non-DIAGNOSTIC builds.

 -

Fix wrong KASSERT in motg abort.
This has been wrong since last summer when we did the transition to
xfer->ux_status = USBD_CANCELLED earlier.
XXX pullup-9

 -

Fix mistakes in timeout/abort/completion changes in motg(4).
- Call usbd_xfer_schedule_timeout so we actually do time out.
- Don't call usbd_xfer_trycomplete until all the data have been
  transferred -- it commits to completion, not timeout.
- Use xfer->ux_status != USBD_IN_PROGRESS to test whether, after a
  partial write, an xfer has been interrupted or timed out and need
  not be continued.
- Remove wrong assertion.

 -

Fix mistake in use of usbd_xfer_schedule_timeout in motg.

This code path is used both for xfers that are new, and xfers that
are being done piece by piece and are partway done.  For the latter
case, skip usbd_xfer_schedule_timeout so we schedule it only once per
xfer.

 -

Simplify some branches and kassert some redundant assignments.

Revision 1.115.2.1 / (download) - annotate - [select for diffs], Sat Feb 29 20:19:17 2020 UTC (2 years, 10 months ago) by ad
Branch: ad-namecache
Changes since 1.115: +69 -140 lines
Diff to previous 1.115 (colored) next main 1.116 (colored)

Sync with head.

Revision 1.119 / (download) - annotate - [select for diffs], Sat Feb 15 09:26:07 2020 UTC (2 years, 11 months ago) by skrll
Branch: MAIN
CVS Tags: is-mlppp-base, is-mlppp, ad-namecache-base3
Changes since 1.118: +5 -5 lines
Diff to previous 1.118 (colored)

Change bNbrPorts for loop to start from 1 to match others.  NFCI.

Revision 1.118 / (download) - annotate - [select for diffs], Sat Feb 15 01:21:56 2020 UTC (2 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.117: +4 -2 lines
Diff to previous 1.117 (colored)

Fix mistakes in previous sloppy change with root intr xfers.

- Make sure ux_status is set to USBD_IN_PROGRESS when started.
  Otherwise, if it is still in flight when we abort the pipe,
  usbd_ar_pipe will skip calling upm_abort.

- Initialize ux_status under the lock; in principle a completion
  interrupt (or a delay) could race with the initialization.

- KASSERT that the xfer is in progress when we're about to complete
  it.

Candidate fix for PR kern/54963 for other HCI drivers than uhci.

ok nick
ok phone

(This is the change that nick evidently MEANT to ok when he ok'd the
previous one!)

Revision 1.117 / (download) - annotate - [select for diffs], Wed Feb 12 16:02:01 2020 UTC (2 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.116: +31 -7 lines
Diff to previous 1.116 (colored)

Fix steady state of root intr xfers.

Why?

- Avoid completing a root intr xfer multiple times in races.
- Avoid potential use-after-free in poll_hub callouts (uhci, ahci).

How?

- Use sc->sc_intr_xfer or equivalent to store only a pending xfer
  that has not yet completed -- whether successfully, by timeout, or
  by synchronous abort.  When any of those happens, set it to null
  under the lock, so the xfer is completed only once.

- For hci drivers that use a callout to poll the root hub (uhci, ahci):

  . Pass the softc pointer, not the xfer, to the callout, so the
    callout is not even tempted to use xfer after free -- if the
    callout fires, but the xfer is synchronously aborted before the
    callout can do anything, the xfer might be freed by the time the
    callout starts to examine it.

  . Teach the callout to do nothing if it is callout_pending after it
    has fired.  This way:

    1. completion or synchronous abort can just callout_stop
    2. start can just callout_schedule

    If the callout had already fired before (1), and doesn't acquire
    the bus lock until after (2), it may be tempted to abort the new
    root intr xfer just after submission, which would be wrong -- so
    instead we just have the callout do nothing if it notices it has
    been rescheduled, since it will fire again after the appropriate
    time has elapsed.

Revision 1.116 / (download) - annotate - [select for diffs], Wed Feb 12 16:01:00 2020 UTC (2 years, 11 months ago) by riastradh
Branch: MAIN
Changes since 1.115: +35 -132 lines
Diff to previous 1.115 (colored)

Factor out HCI-independent xfer completion logic.

New API for HCI drivers to synchronize hardware completion
interrupts, synchronous aborts, and asynchronous timeouts:

- When submitting an xfer to hardware, call
  usbd_xfer_schedule_timeout(xfer).

- On HCI completion interrupt for xfer completion:

	if (!usbd_xfer_trycomplete(xfer))
		return;		/* timed out or aborted, ignore it */

- In upm_abort methods, call usbd_xfer_abort(xfer).

For HCI drivers that use this API (not needed in drivers that don't,
or for xfers like root intr xfers that don't use it):

- New ubm_abortx method serves role of former *hci_abort_xfer, but
  without any logic for wrangling timeouts/callouts/tasks -- caller
  in usbd_xfer_abort has already handled them.

- New ubm_dying method, returns true if the device is in the process
  of detaching, used by the timeout logic.

Converted and tested:
- ehci
- ohci

Converted and compile-tested:
- ahci (XXX did this ever work?)
- dwc2
- motg (XXX missing usbd_xfer_schedule_timeout in motg_*_start?)
- uhci
- xhci

Not changed:

- slhci (sys/dev/ic/sl811hs.c) -- doesn't use a separate per-xfer
  callout for timeouts (XXX but maybe should?)

- ugenhc (sys/rump/dev/lib/libugenhc/ugenhc.c) -- doesn't manage its
  own transfer timeouts

- vhci -- times transfers out only on detach; could be adapted easily
  if we wanted to use the xfer->ux_callout

Revision 1.107.2.4 / (download) - annotate - [select for diffs], Tue Jan 21 11:43:27 2020 UTC (3 years ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RELEASE, netbsd-9-0-RC2
Changes since 1.107.2.3: +17 -5 lines
Diff to previous 1.107.2.3 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by taca in ticket #625):

	sys/dev/usb/xhci.c: revision 1.115

Acquire bus lock (if not polling) when changing xfer status, resetting
the timeout and ringing the doorbell in the start methods.

Revision 1.115 / (download) - annotate - [select for diffs], Sun Dec 29 09:17:51 2019 UTC (3 years, 1 month ago) by skrll
Branch: MAIN
CVS Tags: ad-namecache-base2, ad-namecache-base1, ad-namecache-base
Branch point for: ad-namecache
Changes since 1.114: +17 -5 lines
Diff to previous 1.114 (colored)

Acquire bus lock (if not polling) when changing xfer status, resetting
the timeout and ringing the doorbell in the start methods.

Revision 1.72.2.12 / (download) - annotate - [select for diffs], Sat Nov 16 16:30:09 2019 UTC (3 years, 2 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-2-RELEASE
Changes since 1.72.2.11: +21 -5 lines
Diff to previous 1.72.2.11 (colored) to branchpoint 1.72 (colored)

Pull up the following revisions, requested by msaitoh in ticket #1443:

	sys/arch/arm/nvidia/tegra_xusb.c	1.13-1.14 via patch
	sys/dev/pci/xhci_pci.c			1.13
	sys/dev/usb/usb.c			1.169
	sys/dev/usb/usbdivar.h			1.116
	sys/dev/usb/xhci.c			1.93, 1.95, 1.97
	sys/dev/usb/xhcireg.h			1.11-1.12

Detect USB 3.1

Revision 1.72.2.11 / (download) - annotate - [select for diffs], Tue Sep 17 18:53:52 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-8
Changes since 1.72.2.10: +8 -5 lines
Diff to previous 1.72.2.10 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by mrg in ticket #1377):

	sys/dev/usb/xhci.c: revision 1.113
	sys/dev/usb/xhci.c: revision 1.109

match xhci version 3.10.  allows properly finding all the USB
busses on new ryzen 3 based systems.

unfortunately, the USB busses are still non-functional.

 -

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.

XXX: pullup-all
from sc.dying

Revision 1.23.2.9 / (download) - annotate - [select for diffs], Tue Sep 17 18:04:15 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-7
Changes since 1.23.2.8: +8 -5 lines
Diff to previous 1.23.2.8 (colored) to branchpoint 1.23 (colored) next main 1.24 (colored)

Pull up following revision(s) (requested by mrg in ticket #1707):

	sys/dev/usb/xhci.c: revision 1.113
	sys/dev/usb/xhci.c: revision 1.109

match xhci version 3.10.  allows properly finding all the USB
busses on new ryzen 3 based systems.

unfortunately, the USB busses are still non-functional.

 -

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.

XXX: pullup-all
from sc.dying

Revision 1.107.2.3 / (download) - annotate - [select for diffs], Fri Sep 13 06:32:11 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-9
CVS Tags: netbsd-9-0-RC1
Changes since 1.107.2.2: +107 -90 lines
Diff to previous 1.107.2.2 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by mrg in ticket #196):

	sys/dev/usb/xhci.c: revision 1.111
	sys/dev/usb/xhci.c: revision 1.112
	sys/dev/usb/xhci.c: revision 1.113
	sys/dev/usb/xhci.c: revision 1.114

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".
add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.
from sc.dying

avoid non-debug kernel build issues.

Revision 1.114 / (download) - annotate - [select for diffs], Sun Sep 8 18:58:38 2019 UTC (3 years, 4 months ago) by mrg
Branch: MAIN
CVS Tags: phil-wifi-20191119
Changes since 1.113: +5 -4 lines
Diff to previous 1.113 (colored)

avoid non-debug kernel build issues.

Revision 1.113 / (download) - annotate - [select for diffs], Sat Sep 7 22:56:47 2019 UTC (3 years, 4 months ago) by mrg
Branch: MAIN
Changes since 1.112: +5 -5 lines
Diff to previous 1.112 (colored)

fix ryzen usb issue: we set TD size to '1', where has xhci spec 4.11.2.4
says final TRB for a TD should have this set to '0'.  since we currently
only generate sinel TRB TDs, set this to 0.

XXX: pullup-all

from sc.dying

Revision 1.112 / (download) - annotate - [select for diffs], Sat Sep 7 22:20:42 2019 UTC (3 years, 4 months ago) by mrg
Branch: MAIN
Changes since 1.111: +8 -4 lines
Diff to previous 1.111 (colored)

fix 32-bit debug build, and also vmstat -y.  reported by sc.dying.

Revision 1.107.2.2 / (download) - annotate - [select for diffs], Sun Sep 1 13:00:37 2019 UTC (3 years, 4 months ago) by martin
Branch: netbsd-9
Changes since 1.107.2.1: +6 -3 lines
Diff to previous 1.107.2.1 (colored) to branchpoint 1.107 (colored)

Pull up following revision(s) (requested by mrg in ticket #135):

	distrib/sets/lists/comp/mi			1.2279
	distrib/sets/lists/modules/mi			1.123
	share/man/man9/Makefile				1.438
	share/man/man9/usbnet.9				1.1-1.9
	sys/dev/ic/rndisreg.h				1.3
	sys/dev/usb/TODO				1.47-1.52
	sys/dev/usb/TODO.usbmp				1.15,1.16
	sys/dev/usb/files.usb				1.157-1.167
	sys/dev/usb/if_aue.c				1.155-1.161
	sys/dev/usb/if_auereg.h				1.30-1.32
	sys/dev/usb/if_axe.c				1.103-1.119
	sys/dev/usb/if_axen.c				1.51-1.53,1.55-1.67
	sys/dev/usb/if_axenreg.h			1.15
	sys/dev/usb/if_cdce.c				1.54-1.67
	sys/dev/usb/if_cue.c				1.85,1.86
	sys/dev/usb/if_cuereg.h				1.23
	sys/dev/usb/if_kue.c				1.97-1.100
	sys/dev/usb/if_kuereg.h				1.23,1.24
	sys/dev/usb/if_mue.c				1.51-1.55
	sys/dev/usb/if_muereg.h				1.6
	sys/dev/usb/if_muevar.h				1.9
	sys/dev/usb/if_smsc.c				1.46-1.61
	sys/dev/usb/if_smscreg.h			1.6
	sys/dev/usb/if_smscvar.h			delete
	sys/dev/usb/if_udav.c				1.60-1.71
	sys/dev/usb/if_udavreg.h			1.14,1.15
	sys/dev/usb/if_upl.c				1.65,1.66
	sys/dev/usb/if_ure.c				1.15-1.31
	sys/dev/usb/if_urevar.h				1.4,1.5
	sys/dev/usb/if_url.c				1.67-1.70
	sys/dev/usb/if_urlreg.h				1.14
	sys/dev/usb/if_urndis.c				1.22-1.33
	sys/dev/usb/if_urtwn.c				1.72
	sys/dev/usb/ohci.c				1.290
	sys/dev/usb/uhub.c				1.143
	sys/dev/usb/usb.c				1.180
	sys/dev/usb/usb.h				1.118
	sys/dev/usb/usb_mem.c				1.71
	sys/dev/usb/usb_subr.c				1.238,1.239
	sys/dev/usb/usbdevs				1.772
	sys/dev/usb/usbdi.c				1.183,1.186
	sys/dev/usb/usbdi.h				1.97
	sys/dev/usb/usbdi_util.c			1.75
	sys/dev/usb/usbhist.h				1.5,1.6
	sys/dev/usb/usbnet.c				1.1-1.24
	sys/dev/usb/usbnet.h				1.1-1.14
	sys/dev/usb/usbroothub.c			1.9
	sys/dev/usb/xhci.c				1.109,1.110
	sys/modules/Makefile				1.223
	sys/modules/usbnet/Makefile			1.1

usbnet(9): Add common framework for USB network devices.
This bring various safety fixes to all updated drivers,
and includes locking clean up, detach safety when being
used or not, separate rx/tx locks to improve performance,
porting to NET_MPSAFE, many edge/error case bugs in
drivers fixed, as well as resovling PRs 54303 and 54308.
These drivers are converted: axe(4), axen(4), aue(4),
cdce(4), cue(4), kue(4), mue(4), smsc(4), udav(4),
upl(4), ure(4), url(4), and urndis(4).

Revision 1.111 / (download) - annotate - [select for diffs], Wed Aug 28 07:09:52 2019 UTC (3 years, 5 months ago) by mrg
Branch: MAIN
Changes since 1.110: +99 -87 lines
Diff to previous 1.110 (colored)

introduce and use XHCIHIST_CALLARGS().  reduces lots of double logs,
and includes useful info in all cases instead of just "called".

add a couple of more logs that i've wanted while debugging ryzen3
vs USB issues.

Revision 1.110 / (download) - annotate - [select for diffs], Fri Aug 23 04:34:01 2019 UTC (3 years, 5 months ago) by mrg
Branch: MAIN
Changes since 1.109: +3 -3 lines
Diff to previous 1.109 (colored)

convert a debug message to an error message.  will help more quickly
identify next time xhci version changes.

Revision 1.107.2.1 / (download) - annotate - [select for diffs], Wed Aug 21 14:34:56 2019 UTC (3 years, 5 months ago) by martin
Branch: netbsd-9
Changes since 1.107: +3 -3 lines
Diff to previous 1.107 (colored)

Pull up following revision(s) (requested by skrll in ticket #104):

	sys/dev/usb/xhci.c: revision 1.108

typo in error message

Revision 1.109 / (download) - annotate - [select for diffs], Wed Aug 21 06:19:43 2019 UTC (3 years, 5 months ago) by mrg
Branch: MAIN
Changes since 1.108: +5 -2 lines
Diff to previous 1.108 (colored)

match xhci version 3.10.  allows properly finding all the USB
busses on new ryzen 3 based systems.

unfortunately, the USB busses are still non-functional.

Revision 1.108 / (download) - annotate - [select for diffs], Tue Aug 20 12:40:18 2019 UTC (3 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.107: +3 -3 lines
Diff to previous 1.107 (colored)

typo in error message

Revision 1.92.2.1 / (download) - annotate - [select for diffs], Mon Jun 10 22:07:35 2019 UTC (3 years, 7 months ago) by christos
Branch: phil-wifi
Changes since 1.92: +198 -103 lines
Diff to previous 1.92 (colored)

Sync with HEAD

Revision 1.107 / (download) - annotate - [select for diffs], Wed May 8 06:31:02 2019 UTC (3 years, 8 months ago) by mrg
Branch: MAIN
CVS Tags: phil-wifi-20190609, netbsd-9-base
Branch point for: netbsd-9
Changes since 1.106: +16 -3 lines
Diff to previous 1.106 (colored)

new comment explains this hack:

 * XXXMRG: Stall task can run after slot is disabled when yanked.
 * This hack notices that the xs has been memset() in
 * xhci_disable_slot() and returns.  Both xhci_reset_endpoint()
 * and xhci_set_dequeue() rely upon a valid ring setup for correct
 * operation, and the latter will fault, as would
 * usb_transfer_complete() if it got that far.

this truly fixes yanking active ucom devices (uchcom, uplcom and
umcs all tested.)  prior efforts largely worked by allowing the
stall task to run first, as a side effect to their actual work.

ok @skrll.

XXX: pullup.

Revision 1.106 / (download) - annotate - [select for diffs], Sun Feb 17 04:17:52 2019 UTC (3 years, 11 months ago) by rin
Branch: MAIN
CVS Tags: isaki-audio2-base, isaki-audio2
Changes since 1.105: +4 -3 lines
Diff to previous 1.105 (colored)

Fix assertion failures triggered by usbdi.c,v 1.182, when devices
are detached.

This is because xfers of USBD_NOT_STARTED can be removed from queue
in an invisible way to host controller drivers.

Discussed on tech-kern.

Revision 1.105 / (download) - annotate - [select for diffs], Tue Jan 22 15:02:33 2019 UTC (4 years ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-compat-20190127
Changes since 1.104: +2 -3 lines
Diff to previous 1.104 (colored)

Revert the KASSERT

Revision 1.104 / (download) - annotate - [select for diffs], Tue Jan 22 06:42:33 2019 UTC (4 years ago) by skrll
Branch: MAIN
Changes since 1.103: +3 -2 lines
Diff to previous 1.103 (colored)

Add a KASSERT

Revision 1.86.2.9 / (download) - annotate - [select for diffs], Fri Jan 18 08:50:44 2019 UTC (4 years ago) by pgoyette
Branch: pgoyette-compat
CVS Tags: pgoyette-compat-merge-20190127
Changes since 1.86.2.8: +45 -25 lines
Diff to previous 1.86.2.8 (colored) to branchpoint 1.86 (colored) next main 1.87 (colored)

Synch with HEAD

Revision 1.103 / (download) - annotate - [select for diffs], Fri Jan 11 15:43:51 2019 UTC (4 years ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-compat-20190118
Changes since 1.102: +12 -2 lines
Diff to previous 1.102 (colored)

Add a bs_barrier to make ThunderX xhci work.  Not sure why this is needed,
but I'll work it out later.

Revision 1.102 / (download) - annotate - [select for diffs], Fri Jan 11 15:39:24 2019 UTC (4 years ago) by skrll
Branch: MAIN
Changes since 1.101: +4 -3 lines
Diff to previous 1.101 (colored)

Style

Revision 1.101 / (download) - annotate - [select for diffs], Mon Jan 7 03:00:39 2019 UTC (4 years ago) by jakllsch
Branch: MAIN
Changes since 1.100: +33 -24 lines
Diff to previous 1.100 (colored)

Seperate xHCI and xhci(4) TRB structs so as to avoid some of them
(the ones that the hardware doesn't touch) ending up less-aligned
than the compiler assumed.

Additionally, fix the most obvious problems that xhci(4) had on
big endian systems.

Briefly tested on a Jetson TK1 in LE and BE w/ evbarm GENERIC kernel.

Revision 1.72.2.10 / (download) - annotate - [select for diffs], Fri Jan 4 14:55:40 2019 UTC (4 years ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-1-RELEASE, netbsd-8-1-RC1
Changes since 1.72.2.9: +5 -5 lines
Diff to previous 1.72.2.9 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by mrg in ticket #1155):

	sys/dev/usb/xhci.c: revision 1.100

use xhci_polling_p().  this might miss when bus2 is active.
XXX: pullup-7, pullup-8.

Revision 1.86.2.8 / (download) - annotate - [select for diffs], Mon Nov 26 01:52:49 2018 UTC (4 years, 2 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.7: +5 -5 lines
Diff to previous 1.86.2.7 (colored) to branchpoint 1.86 (colored)

Sync with HEAD, resolve a couple of conflicts

Revision 1.100 / (download) - annotate - [select for diffs], Sun Oct 28 21:36:34 2018 UTC (4 years, 3 months ago) by mrg
Branch: MAIN
CVS Tags: pgoyette-compat-1226, pgoyette-compat-1126
Changes since 1.99: +5 -5 lines
Diff to previous 1.99 (colored)

use xhci_polling_p().  this might miss when bus2 is active.

XXX: pullup-7, pullup-8.

Revision 1.86.2.7 / (download) - annotate - [select for diffs], Sun Sep 30 01:45:51 2018 UTC (4 years, 3 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.6: +17 -8 lines
Diff to previous 1.86.2.6 (colored) to branchpoint 1.86 (colored)

Ssync with HEAD

Revision 1.72.2.9 / (download) - annotate - [select for diffs], Fri Sep 28 08:33:43 2018 UTC (4 years, 4 months ago) by martin
Branch: netbsd-8
Changes since 1.72.2.8: +8 -5 lines
Diff to previous 1.72.2.8 (colored) to branchpoint 1.72 (colored)

Fixup for ticket #1037 - parts of the patch were accidently missing.

Revision 1.72.2.8 / (download) - annotate - [select for diffs], Thu Sep 27 14:52:26 2018 UTC (4 years, 4 months ago) by martin
Branch: netbsd-8
Changes since 1.72.2.7: +17 -8 lines
Diff to previous 1.72.2.7 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by mrg in ticket #1037):

	sys/dev/usb/uhub.c: revision 1.139
	sys/external/bsd/dwc2/dwc2.c: revision 1.55
	sys/ddb/db_output.c: revision 1.34
	sys/ddb/db_command.c: revision 1.160
	sys/dev/usb/ehci.c: revision 1.264
	sys/dev/usb/xhci.c: revision 1.99
	sys/dev/usb/ehci.c: revision 1.265
	sys/kern/subr_userconf.c: revision 1.27
	sys/dev/usb/ehcivar.h: revision 1.46
	sys/dev/usb/ohci.c: revision 1.287
	sys/dev/usb/uhci.c: revision 1.284
	sys/dev/usb/usbdi.c: revision 1.178
	sys/dev/usb/usb.c: revision 1.172
	sys/dev/pci/xhci_pci.c: revision 1.14
	sys/dev/usb/usb.c: revision 1.173
	sys/dev/usb/usb.c: revision 1.174
	share/man/man4/usb.4: revision 1.110
	sys/ddb/db_command.c: revision 1.159
	sys/dev/usb/usb_subr.c: revision 1.227
	sys/dev/usb/uhcivar.h: revision 1.56
	(all via patch)

consolidate the handling of polling across HC drivers, and generic USB:
- don't take mutexes if polling
- normalise the code across all drivers
- add some not yet code to block discovery to/from polling
- minor CSE
- adjust comment for usbd_set_polling() to reality now i properly
  understand what it is used for and why.

this, with a hack to make RB_ASKNAME to wait 5 seconds allows boot -a
work with USB keyboards.  there are still multiple issues remaining:
- discovery and polling need to be mutually exclusive
- attachment of ukbd and wskbd is not handled by config_pending, and
  the 5 second delay isn't going to always be enough.

call cnpollc(1) and cnpollc(0) around cngetc().
(christos has a good idea to add a function that does all 3,
and we should switch all the callers in this sequence to use
it (and fix the MD ones missing it still).  not all can, as
eg, line-grabbing functions can use cngetsn(), which only
calls cnpollc() twice.)


When this file is used when not building the kernel (eg: /usr/sbin/crash)
make cnpollc() go away.


reorder some struct members to remove holes.


add config_pending usage to uhub and general USB device attachment.
- call config_pending_incr() and config_pending_decr() around attaching
  devices against "usbdevif" attribute.

uhub:
- convert sc_explorepending and sc_running to bool.  add new sc_first_explore.
- call config_pending_incr() at the start of uhub_attach().  dropped in
  uhub_explore(), if this is the first explore.


implement a gross hack to fix "boot -a" on systems with usb keyboards on
systems with ehci handover to uhci (and maybe ohci), and fix a similar
problem for "boot -s".

there is effort to ensure that all devices attached via USB are probed
before RB_ASKNAME or RB_SINGLE attempts to ask any questions on the console,
and largely this works, often by chance, today, for USB disks and root.
i've recently pushed this more into uhub and general USB device attachment
as well, and kept a config_pending reference across the first explore of
a bus.  these fix many issues with directly attached hubs.

however, on systems where devices connected to ehci ports are handed over
to a companion uhci or ohci port, it may not be the first, or even second,
bus explore that finds the device finally before attachment, and at this
point all config_pending references are dropped.

there is no direct communication between drivers, the potentials are
looked up but their device_t is only used for generic things like the name,
so informing the correct companion to expect a device and deal with the
config_pending references is not possible without some fairly ugly layer
violations or multi-level callbacks (eg, we have "ehci0", and usually an
the relevant companion, eg, "uhci2", but it is the uhub that uhci2 has
attached that will deal with the device attachment.)

with the above fixes to generic USB code, the disown happens during the
first explore.  the hack works by, at this point, checking if (a) root
is not mounted, (b) single user or ask name are set, and (c) if the hack
as not been triggered already.  if all 3 conditions are true, then a
config_pending_incr() is called and a callback is triggered for (default)
5 seconds to call config_pending_decr().  ehci detach pauses waiting for
this callback if scheduled.

this allows enough time for the uhub and the ukbd/wskbd to attach before
the RK_ASKROOT prompts appear.  testing shows it takes between 1.5 and
2 seconds for the keyboard to appear after the disown occurs.

Index: dev/usb/ehcivar.c
- new sc_compcallout, sc_compcallout, sc_complock, and a state for th
  handover hack.

Index: dev/usb/ehci.c
ehci_init():
- use aprint_normal_dev() instead of manual device_xname().
- initialise sc_compcallout, sc_compcallout, sc_complock, and sc_comp_state.
ehci_detach():
- if there are companion controllers, tear own the above, including waiting
  if there is a callback scheduled.
ehci_disown_callback():
- new callout to call config_pending_decr() in the the future.
  schedule this ca
ehci_disown_sched_callback():
- if booting to single user or asking names, call config_pending_incr() and
  schedule the callout above, default 5 second delay.
ehci_disown():
- if disowning a port call ehci_disown_sched_callback().
deal with partial attach failures in usb_attach vs usb_detach aka PR 53598.
- make sure xhci's sc->sc_ios is NULL if failure happens.
- rearrange usb_attach() / usb_doattach() to make it simpler to clean up.
- move usb_async_intr softint into usb_once_init().  previously, each USB
  controller would start a new one, and leave the old one leaked.
- handle controller interrupts without a bus attached


remove usb(4)'s "flags 1" code.  it has been dead for a while,
as it runs during the interrupts part of configuration now,
and all the devices try attach as early as possible, including
any root or boot required disk or keyboard device, which is
what this flag was for.

Revision 1.99 / (download) - annotate - [select for diffs], Sun Sep 16 20:21:56 2018 UTC (4 years, 4 months ago) by mrg
Branch: MAIN
CVS Tags: pgoyette-compat-1020, pgoyette-compat-0930
Changes since 1.98: +17 -8 lines
Diff to previous 1.98 (colored)

consolidate the handling of polling across HC drivers, and generic USB:
- don't take mutexes if polling
- normalise the code across all drivers
- add some not yet code to block discovery to/from polling
- minor CSE
- adjust comment for usbd_set_polling() to reality now i properly
  understand what it is used for and why.

this, with a hack to make RB_ASKNAME to wait 5 seconds allows boot -a
work with USB keyboards.  there are still multiple issues remaining:
- discovery and polling need to be mutually exclusive
- attachment of ukbd and wskbd is not handled by config_pending, and
  the 5 second delay isn't going to always be enough.

Revision 1.86.2.6 / (download) - annotate - [select for diffs], Thu Sep 6 06:56:06 2018 UTC (4 years, 4 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.5: +99 -66 lines
Diff to previous 1.86.2.5 (colored) to branchpoint 1.86 (colored)

Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

Revision 1.98 / (download) - annotate - [select for diffs], Mon Sep 3 16:29:34 2018 UTC (4 years, 4 months ago) by riastradh
Branch: MAIN
CVS Tags: pgoyette-compat-0906
Changes since 1.97: +6 -6 lines
Diff to previous 1.97 (colored)

Rename min/max -> uimin/uimax for better honesty.

These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)

Revision 1.97 / (download) - annotate - [select for diffs], Thu Aug 30 13:13:24 2018 UTC (4 years, 4 months ago) by jakllsch
Branch: MAIN
CVS Tags: jdolecek-ncqfixes-base, jdolecek-ncqfixes
Changes since 1.96: +3 -3 lines
Diff to previous 1.96 (colored)

silence "not known to be supported" message for all version 1.x xHCIs

Revision 1.23.2.8 / (download) - annotate - [select for diffs], Sat Aug 25 14:57:35 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-2-RELEASE
Changes since 1.23.2.7: +95 -61 lines
Diff to previous 1.23.2.7 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by mrg in ticket #1632):

	sys/dev/usb/usbdivar.h: revision 1.117
	sys/external/bsd/dwc2/dwc2.c: revision 1.52
	sys/dev/usb/xhcivar.h: revision 1.10
	sys/dev/usb/motg.c: revision 1.22
	sys/dev/usb/ehci.c: revision 1.260
	sys/dev/usb/ehci.c: revision 1.261
	sys/dev/usb/xhci.c: revision 1.96
	sys/dev/usb/ohci.c: revision 1.282
	sys/dev/usb/ohci.c: revision 1.283
	sys/dev/usb/ehcivar.h: revision 1.45
	sys/dev/usb/uhci.c: revision 1.281
	sys/dev/usb/uhci.c: revision 1.282
	sys/dev/usb/usbdi.c: revision 1.177
	sys/dev/usb/ohcivar.h: revision 1.60
	sys/dev/usb/uhcivar.h: revision 1.55
	(all via patch)

pull across abort fixes from nick-nhusb.  add more abort fixes, using
ideas from Taylor and Nick, and myself.  special thanks to both who
inspired much of the code here, if not wrote it directly.

among other problems, this assert should no longer trigger:

   panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914

using usbhist i was able to track down my instance of it being related
to userland close() beginning, dropping the sc_lock, and then the usb
softintr completes the transfer normally, and when it is done, the
abort path attempts to re-complete the transfer, and the above assert
is tripped.

changes from nhusb were commited with these logs:
--
Move the struct usb_task to struct usbd_xfer for everyone to use.
--
Set device transfer status to USBD_IN_PROGRESS if start methods succeeds
--
Actually set the transfer status on transfers in ohci_abort_xfer and
the controller is dying
--
Don't supply the lock to callout_halt when polling as it won't be held
--
Improve transfer abort
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--

additional changes include:
- initialise the usb abort task in the HCI allocx routine, so that it
  can be safely usb_rem_task()'d.
- rework the handling of softintr vs cancellation vs timeout abort based
  upon a scheme from Taylor:
  when completing a transfer normally:
  - if the status is not in progress, it must be cancelled or timed out,
    and we should not process this xfer.
  - set the status as normal.
  - unconditionallly callout_stop() and usb_rem_task().  they're safe and
    either aren't running, or will run and do nothing.
  - finally call usb_transfer_complete().
  when aborting a transfer:
  - status should be cancelled or timed out.
  - if cancelling, callout_halt and usb_rem_task_wait() to make sure the
    timer is either done or cancelled.
  - at this point, the ux_status must not be cancelled or timed out, and
    if it is not in progress we're done.
  - set the status.
  - if the controller is dying, just return.
  - perform HCI-specific tasks to abort this xfer.
  - finally call usb_transfer_complete().
  for the timeout and timeout task:
  - if the HCI is not dying, and the ux_status is in progress, then
    trigger the usb abort task.
- remove UXFER_ABORTWAIT and UXFER_ABORTING.

tested on:
- multiple PC systems with several types of devices: ugen/UPS, ucom,
  umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci
  and xhci.
- erlite3: sd@umass on dwc2.
- sunblade2000: kbd/ms and umass disk on ohci.

untested:
- motg, slhci and ahci.  motg has some portion of the new scheme
  applied, but slhci and ahci require more study.

future work includes pushing a lot of the common abort handling into
usbdi.c and leaving upm_abort() for HC specific tasks, but this change
is pullup-able to netbsd-7 and netbsd-8 as it does not change any
external API, as well as removing over 100 lines of code while adding
over 30 new asserts.

XXX: pullup-7, pullup-8.

fix DIAGNOSTIC build by not copying ub_usepolling to stack before use

Sprinkle __diagused

Revision 1.72.2.7 / (download) - annotate - [select for diffs], Sat Aug 25 11:29:52 2018 UTC (4 years, 5 months ago) by martin
Branch: netbsd-8
Changes since 1.72.2.6: +94 -61 lines
Diff to previous 1.72.2.6 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by mrg in ticket #980):

	sys/dev/usb/usbdivar.h: revision 1.117
	sys/external/bsd/dwc2/dwc2.c: revision 1.52
	sys/dev/usb/xhcivar.h: revision 1.10
	sys/dev/usb/motg.c: revision 1.22
	sys/dev/usb/ehci.c: revision 1.260
	sys/dev/usb/ehci.c: revision 1.261
	sys/dev/usb/xhci.c: revision 1.96
	sys/dev/usb/ohci.c: revision 1.282
	sys/dev/usb/ohci.c: revision 1.283
	sys/dev/usb/ehcivar.h: revision 1.45
	sys/dev/usb/uhci.c: revision 1.281
	sys/dev/usb/uhci.c: revision 1.282
	sys/dev/usb/usbdi.c: revision 1.177
	sys/dev/usb/ohcivar.h: revision 1.60
	sys/dev/usb/uhcivar.h: revision 1.55
	(all via patch)

pull across abort fixes from nick-nhusb.  add more abort fixes, using
ideas from Taylor and Nick, and myself.  special thanks to both who
inspired much of the code here, if not wrote it directly.
among other problems, this assert should no longer trigger:

   panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914

using usbhist i was able to track down my instance of it being related
to userland close() beginning, dropping the sc_lock, and then the usb
softintr completes the transfer normally, and when it is done, the
abort path attempts to re-complete the transfer, and the above assert
is tripped.

changes from nhusb were commited with these logs:
--
Move the struct usb_task to struct usbd_xfer for everyone to use.
--
Set device transfer status to USBD_IN_PROGRESS if start methods succeeds
--
Actually set the transfer status on transfers in ohci_abort_xfer and
the controller is dying
--
Don't supply the lock to callout_halt when polling as it won't be held
--
Improve transfer abort
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--

additional changes include:
- initialise the usb abort task in the HCI allocx routine, so that it
  can be safely usb_rem_task()'d.
- rework the handling of softintr vs cancellation vs timeout abort based
  upon a scheme from Taylor:
  when completing a transfer normally:
  - if the status is not in progress, it must be cancelled or timed out,
    and we should not process this xfer.
  - set the status as normal.
  - unconditionallly callout_stop() and usb_rem_task().  they're safe and
    either aren't running, or will run and do nothing.
  - finally call usb_transfer_complete().
  when aborting a transfer:
  - status should be cancelled or timed out.
  - if cancelling, callout_halt and usb_rem_task_wait() to make sure the
    timer is either done or cancelled.
  - at this point, the ux_status must not be cancelled or timed out, and
    if it is not in progress we're done.
  - set the status.
  - if the controller is dying, just return.
  - perform HCI-specific tasks to abort this xfer.
  - finally call usb_transfer_complete().
  for the timeout and timeout task:
  - if the HCI is not dying, and the ux_status is in progress, then
    trigger the usb abort task.
- remove UXFER_ABORTWAIT and UXFER_ABORTING.

tested on:
- multiple PC systems with several types of devices: ugen/UPS, ucom,
  umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci
  and xhci.
- erlite3: sd@umass on dwc2.
- sunblade2000: kbd/ms and umass disk on ohci.

untested:
- motg, slhci and ahci.  motg has some portion of the new scheme
  applied, but slhci and ahci require more study.

future work includes pushing a lot of the common abort handling into
usbdi.c and leaving upm_abort() for HC specific tasks, but this change
is pullup-able to netbsd-7 and netbsd-8 as it does not change any
external API, as well as removing over 100 lines of code while adding
over 30 new asserts.

XXX: pullup-7, pullup-8.

fix DIAGNOSTIC build by not copying ub_usepolling to stack before use

Sprinkle __diagused

Revision 1.96 / (download) - annotate - [select for diffs], Thu Aug 9 06:26:47 2018 UTC (4 years, 5 months ago) by mrg
Branch: MAIN
Changes since 1.95: +94 -61 lines
Diff to previous 1.95 (colored)

pull across abort fixes from nick-nhusb.  add more abort fixes, using
ideas from Taylor and Nick, and myself.  special thanks to both who
inspired much of the code here, if not wrote it directly.

among other problems, this assert should no longer trigger:

   panic: kernel diagnostic assertion "xfer->ux_state == XFER_ONQU" failed: file "/current/src/sys/dev/usb/usbdi.c", line 914

using usbhist i was able to track down my instance of it being related
to userland close() beginning, dropping the sc_lock, and then the usb
softintr completes the transfer normally, and when it is done, the
abort path attempts to re-complete the transfer, and the above assert
is tripped.


changes from nhusb were commited with these logs:
--
Move the struct usb_task to struct usbd_xfer for everyone to use.
--
Set device transfer status to USBD_IN_PROGRESS if start methods succeeds
--
Actually set the transfer status on transfers in ohci_abort_xfer and
the controller is dying
--
Don't supply the lock to callout_halt when polling as it won't be held
--
Improve transfer abort
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--
#ifdef DIAGNOSTIC -> KASSERT and add another KASSERT
--
Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling
--

additional changes include:
- initialise the usb abort task in the HCI allocx routine, so that it
  can be safely usb_rem_task()'d.
- rework the handling of softintr vs cancellation vs timeout abort based
  upon a scheme from Taylor:
  when completing a transfer normally:
  - if the status is not in progress, it must be cancelled or timed out,
    and we should not process this xfer.
  - set the status as normal.
  - unconditionallly callout_stop() and usb_rem_task().  they're safe and
    either aren't running, or will run and do nothing.
  - finally call usb_transfer_complete().
  when aborting a transfer:
  - status should be cancelled or timed out.
  - if cancelling, callout_halt and usb_rem_task_wait() to make sure the
    timer is either done or cancelled.
  - at this point, the ux_status must not be cancelled or timed out, and
    if it is not in progress we're done.
  - set the status.
  - if the controller is dying, just return.
  - perform HCI-specific tasks to abort this xfer.
  - finally call usb_transfer_complete().
  for the timeout and timeout task:
  - if the HCI is not dying, and the ux_status is in progress, then
    trigger the usb abort task.
- remove UXFER_ABORTWAIT and UXFER_ABORTING.

tested on:
- multiple PC systems with several types of devices: ugen/UPS, ucom,
  umass with disk, ssd and cdrom backends, kbd, ms, using uhci, ehci
  and xhci.
- erlite3: sd@umass on dwc2.
- sunblade2000: kbd/ms and umass disk on ohci.

untested:
- motg, slhci and ahci.  motg has some portion of the new scheme
  applied, but slhci and ahci require more study.

future work includes pushing a lot of the common abort handling into
usbdi.c and leaving upm_abort() for HC specific tasks, but this change
is pullup-able to netbsd-7 and netbsd-8 as it does not change any
external API, as well as removing over 100 lines of code while adding
over 30 new asserts.

XXX: pullup-7, pullup-8.

Revision 1.86.2.5 / (download) - annotate - [select for diffs], Sat Jul 28 04:37:59 2018 UTC (4 years, 6 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.4: +28 -9 lines
Diff to previous 1.86.2.4 (colored) to branchpoint 1.86 (colored)

Sync with HEAD

Revision 1.95 / (download) - annotate - [select for diffs], Wed Jul 18 10:44:17 2018 UTC (4 years, 6 months ago) by msaitoh
Branch: MAIN
CVS Tags: pgoyette-compat-0728
Changes since 1.94: +20 -3 lines
Diff to previous 1.94 (colored)

 Read xHCI 1.1's HCCPARAMS2 registar and print it with aprint_debug_dev().
e.g.: xhci0: hcc2=0x7d<ETC,CIC,LEC,CTC,FSC,U3C>

Revision 1.94 / (download) - annotate - [select for diffs], Mon Jul 16 23:07:31 2018 UTC (4 years, 6 months ago) by christos
Branch: MAIN
Changes since 1.93: +10 -7 lines
Diff to previous 1.93 (colored)

make typing on the console work during boot:
1. if polling avoid mutex
2. convert spin mutex calls to regular calls in xhci_poll so that we don't
   spinout while waiting for the user to type.
Tested by phil@

Revision 1.93 / (download) - annotate - [select for diffs], Fri Jun 29 17:48:24 2018 UTC (4 years, 7 months ago) by msaitoh
Branch: MAIN
Changes since 1.92: +2 -3 lines
Diff to previous 1.92 (colored)

 Detect USB 3.1.

Revision 1.86.2.4 / (download) - annotate - [select for diffs], Mon May 21 04:36:12 2018 UTC (4 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.3: +4 -3 lines
Diff to previous 1.86.2.3 (colored) to branchpoint 1.86 (colored)

Sync with HEAD

Revision 1.92 / (download) - annotate - [select for diffs], Mon May 14 00:26:02 2018 UTC (4 years, 8 months ago) by jakllsch
Branch: MAIN
CVS Tags: phil-wifi-base, pgoyette-compat-0625, pgoyette-compat-0521
Branch point for: phil-wifi
Changes since 1.91: +3 -2 lines
Diff to previous 1.91 (colored)

With the hope it fixes PR #52911, be extra paranoid about assuring the
Device Context DMA memory is sync'd immediately before reading from it.

Revision 1.72.2.6 / (download) - annotate - [select for diffs], Sat May 5 15:05:39 2018 UTC (4 years, 8 months ago) by martin
Branch: netbsd-8
CVS Tags: netbsd-8-0-RELEASE, netbsd-8-0-RC2
Changes since 1.72.2.5: +31 -8 lines
Diff to previous 1.72.2.5 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by jdolecek in ticket #787):

	sys/dev/usb/xhci.c: revision 1.88-1.90
	sys/dev/usb/xhcireg.h: revision 1.10

add KASSERT() that sc_child* is set to NULL after child detach; just for
readability, it's not immediatelly obvious this is done in xhci_childdet()
no functional changes

trigger the softint processing on that child bus which is not detached yet
fixes PR kern/53066 by Martin Husemann

enable code to only trigger usb processing when EINT is set, to
avoid misinterpreting shared interrupt for another device

when clearing USBSTS, actually preserve the bits which spec requires to
preserve, and actually clear bit 1, which should be actually always
cleared to zero by spec

also #ifdef XHCI_DEBUG some unnecessary register reads
this should finally resolve PR kern/53066 also for Martin

Revision 1.91 / (download) - annotate - [select for diffs], Wed May 2 09:55:22 2018 UTC (4 years, 8 months ago) by jmcneill
Branch: MAIN
Changes since 1.90: +3 -3 lines
Diff to previous 1.90 (colored)

"Root Hub" -> "root hub" for consistency with other HC drivers

Revision 1.86.2.3 / (download) - annotate - [select for diffs], Wed May 2 07:20:12 2018 UTC (4 years, 8 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.2: +29 -8 lines
Diff to previous 1.86.2.2 (colored) to branchpoint 1.86 (colored)

Synch with HEAD

Revision 1.90 / (download) - annotate - [select for diffs], Mon Apr 23 19:55:00 2018 UTC (4 years, 9 months ago) by jdolecek
Branch: MAIN
CVS Tags: pgoyette-compat-0502
Changes since 1.89: +19 -7 lines
Diff to previous 1.89 (colored)

enable code to only trigger usb processing when EINT is set, to
avoid misinterpreting shared interrupt for another device

when clearing USBSTS, actually preserve the bits which spec requires to
preserve, and actually clear bit 1, which should be actually always
cleared to zero by spec

also #ifdef XHCI_DEBUG some unnecessary register reads

this should finally resolve PR kern/53066 also for Martin

Revision 1.89 / (download) - annotate - [select for diffs], Sun Apr 22 07:47:14 2018 UTC (4 years, 9 months ago) by jdolecek
Branch: MAIN
Changes since 1.88: +12 -3 lines
Diff to previous 1.88 (colored)

trigger the softint processing on that child bus which is not detached yet

fixes PR kern/53066 by Martin Husemann

Revision 1.86.2.2 / (download) - annotate - [select for diffs], Sun Apr 22 07:20:26 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86.2.1: +4 -2 lines
Diff to previous 1.86.2.1 (colored) to branchpoint 1.86 (colored)

Sync with HEAD

Revision 1.88 / (download) - annotate - [select for diffs], Sat Apr 21 15:53:24 2018 UTC (4 years, 9 months ago) by jdolecek
Branch: MAIN
CVS Tags: pgoyette-compat-0422
Changes since 1.87: +4 -2 lines
Diff to previous 1.87 (colored)

add KASSERT() that sc_child* is set to NULL after child detach; just for
readability, it's not immediatelly obvious this is done in xhci_childdet()

no functional changes

Revision 1.86.2.1 / (download) - annotate - [select for diffs], Mon Apr 16 02:00:02 2018 UTC (4 years, 9 months ago) by pgoyette
Branch: pgoyette-compat
Changes since 1.86: +2 -14 lines
Diff to previous 1.86 (colored)

Sync with HEAD, resolve some conflicts

Revision 1.87 / (download) - annotate - [select for diffs], Mon Apr 9 16:21:11 2018 UTC (4 years, 9 months ago) by jakllsch
Branch: MAIN
CVS Tags: pgoyette-compat-0415
Changes since 1.86: +2 -14 lines
Diff to previous 1.86 (colored)

Stop potential misuse of vendor names and USB vendor IDs in root hub
device and string descriptors.

Firstly: Few vendors have identical PCI-SIG vendor IDs and USB-IF vendor
IDs.  As such, using the PCI vendor ID as a USB vendor ID may trample
on whomever is allocated that USB vendor ID.

Secondly: The vendor of the host controller hardware implementation has
little to nothing to do with our usbroothub implementation.  Thus we
should not potentially associate any problems therewith to such third
party.

This change will result in root hubs being identified by USB Vendor ID
0x0000.  Root hub vendor string will now be "NetBSD" (or, specifically:
ostype). Product ID (0x0000) and product strings remain unchanged.

Revision 1.86 / (download) - annotate - [select for diffs], Wed Feb 7 15:55:58 2018 UTC (4 years, 11 months ago) by prlw1
Branch: MAIN
CVS Tags: pgoyette-compat-base, pgoyette-compat-0407, pgoyette-compat-0330, pgoyette-compat-0322, pgoyette-compat-0315
Branch point for: pgoyette-compat
Changes since 1.85: +3 -3 lines
Diff to previous 1.85 (colored)

xhci.c: avoid unused variable in non-DIAGNOSTIC build

Revision 1.85 / (download) - annotate - [select for diffs], Thu Feb 1 09:55:37 2018 UTC (4 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.84: +2 -5 lines
Diff to previous 1.84 (colored)

 Fix KASSERT panic. When detaching USB host controoler, the following panic
occured:
kernel diagnostic assertion "sc->sc_intrxfer == xfer" failed: file "../../../../dev/usb/ohci.c", line 1720
Clear sc_intrxfer correctly. Adviced by Nick and tested by me.

Revision 1.84 / (download) - annotate - [select for diffs], Tue Jan 30 08:53:39 2018 UTC (4 years, 11 months ago) by msaitoh
Branch: MAIN
Changes since 1.83: +6 -4 lines
Diff to previous 1.83 (colored)

 Avoid panic while detaching xhci. The xhci driver has both sc_child and
sc_child2 but xhci_childdet() only supported sc_child. OK'd by Nick.

Revision 1.23.2.7 / (download) - annotate - [select for diffs], Wed Jan 3 20:02:37 2018 UTC (5 years ago) by snj
Branch: netbsd-7
Changes since 1.23.2.6: +3 -3 lines
Diff to previous 1.23.2.6 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #1529):
	sys/dev/usb/ehci.c: revision 1.257
	sys/dev/usb/motg.c: revision 1.19
	sys/dev/usb/ohci.c: revision 1.276
	sys/dev/usb/uhci.c: revision 1.279
	sys/dev/usb/xhci.c: revision 1.77
	sys/external/bsd/dwc2/dwc2.c: revision 1.47
s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method

Revision 1.23.2.6 / (download) - annotate - [select for diffs], Wed Jan 3 19:48:45 2018 UTC (5 years ago) by snj
Branch: netbsd-7
Changes since 1.23.2.5: +7 -3 lines
Diff to previous 1.23.2.5 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #1526):
	sys/dev/usb/xhci.c: revision 1.76
Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang
(Errata).

Revision 1.72.2.5 / (download) - annotate - [select for diffs], Thu Dec 21 21:53:31 2017 UTC (5 years, 1 month ago) by snj
Branch: netbsd-8
CVS Tags: netbsd-8-0-RC1
Changes since 1.72.2.4: +22 -25 lines
Diff to previous 1.72.2.4 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by skrll in ticket #459):
	sys/dev/usb/xhci.c: 1.78, 1.83
PR/52791: Robert Sprowson: avoid duplicate tests (use accessor variables)
--
Fix the logic around TT Hub Slot ID, TT Port Number and Multi-TT in
xhci_setup_tthub.  TT Hub/Port need to reference the upstream HS hub and
Multi-TT needs to reflect the capabilities of a HS hub itself or the same
upstream HS hub.

Revision 1.83 / (download) - annotate - [select for diffs], Wed Dec 20 08:21:11 2017 UTC (5 years, 1 month ago) by skrll
Branch: MAIN
Changes since 1.82: +18 -17 lines
Diff to previous 1.82 (colored)

Fix the logic around TT Hub Slot ID, TT Port Number and Multi-TT in
xhci_setup_tthub.  TT Hub/Port need to reference the upstream HS hub and
Multi-TT needs to reflect the capabilities of a HS hub itself or the same
upstream HS hub.

Revision 1.82 / (download) - annotate - [select for diffs], Tue Dec 19 16:04:27 2017 UTC (5 years, 1 month ago) by skrll
Branch: MAIN
Changes since 1.81: +3 -3 lines
Diff to previous 1.81 (colored)

Trailing whitespace

Revision 1.81 / (download) - annotate - [select for diffs], Sun Dec 10 17:50:01 2017 UTC (5 years, 1 month ago) by hannken
Branch: MAIN
Changes since 1.80: +3 -3 lines
Diff to previous 1.80 (colored)

Use USB_DEBUG, not XHCI_DEBUG to protect `dci', DPRINTFN() always uses it.

Revision 1.80 / (download) - annotate - [select for diffs], Sat Dec 9 00:54:31 2017 UTC (5 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.79: +3 -3 lines
Diff to previous 1.79 (colored)

adjust for hexdump signature

Revision 1.79 / (download) - annotate - [select for diffs], Fri Dec 8 21:51:07 2017 UTC (5 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.78: +21 -41 lines
Diff to previous 1.78 (colored)

coalesce the two copies of hexdump into libkern

Revision 1.78 / (download) - annotate - [select for diffs], Thu Dec 7 22:56:23 2017 UTC (5 years, 1 month ago) by christos
Branch: MAIN
Changes since 1.77: +12 -16 lines
Diff to previous 1.77 (colored)

PR/52791: Robert Sprowson: avoid duplicate tests (use accessor variables)

Revision 1.26.2.3 / (download) - annotate - [select for diffs], Sun Dec 3 11:37:36 2017 UTC (5 years, 1 month ago) by jdolecek
Branch: tls-maxphys
Changes since 1.26.2.2: +2479 -1285 lines
Diff to previous 1.26.2.2 (colored) next main 1.27 (colored)

update from HEAD

Revision 1.72.2.4 / (download) - annotate - [select for diffs], Thu Nov 23 13:29:32 2017 UTC (5 years, 2 months ago) by martin
Branch: netbsd-8
Changes since 1.72.2.3: +3 -3 lines
Diff to previous 1.72.2.3 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by skrll in ticket #385):
	sys/dev/usb/xhci.c: revision 1.77
	sys/external/bsd/dwc2/dwc2.c: revision 1.47
	sys/dev/usb/motg.c: revision 1.19
	sys/dev/usb/ehci.c: revision 1.257
	sys/dev/usb/ohci.c: revision 1.276
	sys/dev/usb/uhci.c: revision 1.279

s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method

Revision 1.72.2.3 / (download) - annotate - [select for diffs], Fri Nov 17 20:35:57 2017 UTC (5 years, 2 months ago) by snj
Branch: netbsd-8
Changes since 1.72.2.2: +7 -3 lines
Diff to previous 1.72.2.2 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by msaitoh in ticket #356):
	sys/dev/usb/xhci.c: revision 1.76
Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang
(Errata).

Revision 1.77 / (download) - annotate - [select for diffs], Fri Nov 17 08:22:02 2017 UTC (5 years, 2 months ago) by skrll
Branch: MAIN
CVS Tags: tls-maxphys-base-20171202
Changes since 1.76: +3 -3 lines
Diff to previous 1.76 (colored)

s/PR_NOWAIT/PR_WAITOK/ in HCD allocx (allocate xfer) method

Revision 1.76 / (download) - annotate - [select for diffs], Thu Nov 9 10:03:46 2017 UTC (5 years, 2 months ago) by msaitoh
Branch: MAIN
Changes since 1.75: +7 -3 lines
Diff to previous 1.75 (colored)

 Wait 1ms first. Existing Intel xHCI requies 1ms delay to prevent system hang
(Errata).

XXX pullup-[78]

Revision 1.72.2.2 / (download) - annotate - [select for diffs], Thu Nov 2 21:29:52 2017 UTC (5 years, 2 months ago) by snj
Branch: netbsd-8
CVS Tags: matt-nb8-mediatek-base, matt-nb8-mediatek
Changes since 1.72.2.1: +126 -111 lines
Diff to previous 1.72.2.1 (colored) to branchpoint 1.72 (colored)

Pull up following revision(s) (requested by pgoyette in ticket #335):
	share/man/man9/kernhist.9: 1.5-1.8
	sys/arch/acorn26/acorn26/pmap.c: 1.39
	sys/arch/arm/arm32/fault.c: 1.105 via patch
	sys/arch/arm/arm32/pmap.c: 1.350, 1.359
	sys/arch/arm/broadcom/bcm2835_bsc.c: 1.7
	sys/arch/arm/omap/if_cpsw.c: 1.20
	sys/arch/arm/omap/tiotg.c: 1.7
	sys/arch/evbarm/conf/RPI2_INSTALL: 1.3
	sys/dev/ic/sl811hs.c: 1.98
	sys/dev/usb/ehci.c: 1.256
	sys/dev/usb/if_axe.c: 1.83
	sys/dev/usb/motg.c: 1.18
	sys/dev/usb/ohci.c: 1.274
	sys/dev/usb/ucom.c: 1.119
	sys/dev/usb/uhci.c: 1.277
	sys/dev/usb/uhub.c: 1.137
	sys/dev/usb/umass.c: 1.160-1.162
	sys/dev/usb/umass_quirks.c: 1.100
	sys/dev/usb/umass_scsipi.c: 1.55
	sys/dev/usb/usb.c: 1.168
	sys/dev/usb/usb_mem.c: 1.70
	sys/dev/usb/usb_subr.c: 1.221
	sys/dev/usb/usbdi.c: 1.175
	sys/dev/usb/usbdi_util.c: 1.67-1.70
	sys/dev/usb/usbroothub.c: 1.3
	sys/dev/usb/xhci.c: 1.75
	sys/external/bsd/drm2/dist/drm/i915/i915_gem.c: 1.34
	sys/kern/kern_history.c: 1.15
	sys/kern/kern_xxx.c: 1.74
	sys/kern/vfs_bio.c: 1.275-1.276
	sys/miscfs/genfs/genfs_io.c: 1.71
	sys/sys/kernhist.h: 1.21
	sys/ufs/ffs/ffs_balloc.c: 1.63
	sys/ufs/lfs/lfs_vfsops.c: 1.361
	sys/ufs/lfs/ulfs_inode.c: 1.21
	sys/ufs/lfs/ulfs_vnops.c: 1.52
	sys/ufs/ufs/ufs_inode.c: 1.102
	sys/ufs/ufs/ufs_vnops.c: 1.239
	sys/uvm/pmap/pmap.c: 1.37-1.39
	sys/uvm/pmap/pmap_tlb.c: 1.22
	sys/uvm/uvm_amap.c: 1.108
	sys/uvm/uvm_anon.c: 1.64
	sys/uvm/uvm_aobj.c: 1.126
	sys/uvm/uvm_bio.c: 1.91
	sys/uvm/uvm_device.c: 1.66
	sys/uvm/uvm_fault.c: 1.201
	sys/uvm/uvm_km.c: 1.144
	sys/uvm/uvm_loan.c: 1.85
	sys/uvm/uvm_map.c: 1.353
	sys/uvm/uvm_page.c: 1.194
	sys/uvm/uvm_pager.c: 1.111
	sys/uvm/uvm_pdaemon.c: 1.109
	sys/uvm/uvm_swap.c: 1.175
	sys/uvm/uvm_vnode.c: 1.103
	usr.bin/vmstat/vmstat.c: 1.219
Reorder to test for null before null deref in debug code
--
Reorder to test for null before null deref in debug code
--
KNF
--
No need for '\n' in UVMHIST_LOG
--
normalise a BIOHIST log message
--
Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...
(As proposed on tech-kern@ with additional changes and enhancements.)
Details of changes:
* All history arguments are now stored as uintmax_t values[1], both in
   the kernel and in the structures used for exporting the history data
   to userland via sysctl(9).  This avoids problems on some architectures
   where passing a 64-bit (or larger) value to printf(3) can cause it to
   process the value as multiple arguments.  (This can be particularly
   problematic when printf()'s format string is not a literal, since in
   that case the compiler cannot know how large each argument should be.)
* Update the data structures used for exporting kernel history data to
   include a version number as well as the length of history arguments.
* All [2] existing users of kernhist(9) have had their format strings
   updated.  Each format specifier now includes an explicit length
   modifier 'j' to refer to numeric values of the size of uintmax_t.
* All [2] existing users of kernhist(9) have had their format strings
   updated to replace uses of "%p" with "%#jx", and the pointer
   arguments are now cast to (uintptr_t) before being subsequently cast
   to (uintmax_t).  This is needed to avoid compiler warnings about
   casting "pointer to integer of a different size."
* All [2] existing users of kernhist(9) have had instances of "%s" or
   "%c" format strings replaced with numeric formats; several instances
   of mis-match between format string and argument list have been fixed.
* vmstat(1) has been modified to handle the new size of arguments in the
   history data as exported by sysctl(9).
* vmstat(1) now provides a warning message if the history requested with
   the -u option does not exist (previously, this condition was silently
   ignored, with only a single blank line being printed).
* vmstat(1) now checks the version and argument length included in the
   data exported via sysctl(9) and exits if they do not match the values
   with which vmstat was built.
* The kernhist(9) man-page has been updated to note the additional
   requirements imposed on the format strings, along with several other
   minor changes and enhancements.
[1] It would have been possible to use an explicit length (for example,
     uint64_t) for the history arguments.  But that would require another
     "rototill" of all the users in the future when we add support for an
     architecture that supports a larger size.  Also, the printf(3)
format
     specifiers for explicitly-sized values, such as "%"PRIu64, are much
     more verbose (and less aesthetically appealing, IMHO) than simply
     using "%ju".
[2] I've tried very hard to find "all [the] existing users of
kernhist(9)"
     but it is possible that I've missed some of them.  I would be glad
to
     update any stragglers that anyone identifies.
--
For some reason this single kernel seems to have outgrown its declared
size as a result of the kernhist(9) changes.  Bump the size.
XXX The amount of increase may be excessive - anyone with more detailed
XXX knowledge please feel free to further adjust the value
appropriately.
--
Misssed one cast of pointer --> uintptr_t in previous kernhist(9) commit
--
And yet another one.  :(
--
Use correct mark-up for NetBSD version.
--
More improvements in grammar and readability.
--
Remove a stray '"' (obvious typo) and add a couple of casts that are
probably needed.
--
And replace an instance of "%p" conversion with "%#jx"
--
Whitespace fix. Give Bl tag table a width. Fix Xr.

Revision 1.75 / (download) - annotate - [select for diffs], Sat Oct 28 00:37:13 2017 UTC (5 years, 3 months ago) by pgoyette
Branch: MAIN
Changes since 1.74: +126 -111 lines
Diff to previous 1.74 (colored)

Update the kernhist(9) kernel history code to address issues identified
in PR kern/52639, as well as some general cleaning-up...

(As proposed on tech-kern@ with additional changes and enhancements.)

Details of changes:

* All history arguments are now stored as uintmax_t values[1], both in
  the kernel and in the structures used for exporting the history data
  to userland via sysctl(9).  This avoids problems on some architectures
  where passing a 64-bit (or larger) value to printf(3) can cause it to
  process the value as multiple arguments.  (This can be particularly
  problematic when printf()'s format string is not a literal, since in
  that case the compiler cannot know how large each argument should be.)

* Update the data structures used for exporting kernel history data to
  include a version number as well as the length of history arguments.

* All [2] existing users of kernhist(9) have had their format strings
  updated.  Each format specifier now includes an explicit length
  modifier 'j' to refer to numeric values of the size of uintmax_t.

* All [2] existing users of kernhist(9) have had their format strings
  updated to replace uses of "%p" with "%#jx", and the pointer
  arguments are now cast to (uintptr_t) before being subsequently cast
  to (uintmax_t).  This is needed to avoid compiler warnings about
  casting "pointer to integer of a different size."

* All [2] existing users of kernhist(9) have had instances of "%s" or
  "%c" format strings replaced with numeric formats; several instances
  of mis-match between format string and argument list have been fixed.

* vmstat(1) has been modified to handle the new size of arguments in the
  history data as exported by sysctl(9).

* vmstat(1) now provides a warning message if the history requested with
  the -u option does not exist (previously, this condition was silently
  ignored, with only a single blank line being printed).

* vmstat(1) now checks the version and argument length included in the
  data exported via sysctl(9) and exits if they do not match the values
  with which vmstat was built.

* The kernhist(9) man-page has been updated to note the additional
  requirements imposed on the format strings, along with several other
  minor changes and enhancements.

[1] It would have been possible to use an explicit length (for example,
    uint64_t) for the history arguments.  But that would require another
    "rototill" of all the users in the future when we add support for an
    architecture that supports a larger size.  Also, the printf(3) format
    specifiers for explicitly-sized values, such as "%"PRIu64, are much
    more verbose (and less aesthetically appealing, IMHO) than simply
    using "%ju".

[2] I've tried very hard to find "all [the] existing users of kernhist(9)"
    but it is possible that I've missed some of them.  I would be glad to
    update any stragglers that anyone identifies.

Revision 1.74 / (download) - annotate - [select for diffs], Mon Sep 25 00:03:10 2017 UTC (5 years, 4 months ago) by jmcneill
Branch: MAIN
Changes since 1.73: +21 -14 lines
Diff to previous 1.73 (colored)

If the bus glue calls xhci_init with interrupts enabled, there is a window
between when xhci interrupts are enabled and the usb bus driver is
attached. If an irq occurs in this window, xhci will attempt to schedule
a softint with an invalid softint handle.

Add a quirk flag, XHCI_DEFERRED_START, that when set skips starting the
controller at the end of xhci_init. Bus glue that sets this is responsible
to call xhci_start after attaching the child usb devices.

Revision 1.28.2.86 / (download) - annotate - [select for diffs], Mon Aug 28 17:52:30 2017 UTC (5 years, 5 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.85: +22 -16 lines
Diff to previous 1.28.2.85 (colored) to branchpoint 1.28 (colored) next main 1.29 (colored)

Sync with HEAD

Revision 1.72.2.1 / (download) - annotate - [select for diffs], Fri Aug 25 05:44:48 2017 UTC (5 years, 5 months ago) by snj
Branch: netbsd-8
Changes since 1.72: +21 -11 lines
Diff to previous 1.72 (colored)

Pull up following revision(s) (requested by skrll in ticket #226):
	sys/dev/usb/xhci.c: revision 1.73
Check both buses for ub_usepolling and schedule the soft interrupt handler
or call it directly.  Fixes usb keyboard in ddb when attached to xhci.

Revision 1.73 / (download) - annotate - [select for diffs], Tue Aug 22 16:57:00 2017 UTC (5 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20170825
Changes since 1.72: +21 -11 lines
Diff to previous 1.72 (colored)

Check both buses for ub_usepolling and schedule the soft interrupt handler
or call it directly.  Fixes usb keyboard in ddb when attached to xhci.

Revision 1.72 / (download) - annotate - [select for diffs], Thu Jun 1 02:45:12 2017 UTC (5 years, 7 months ago) by chs
Branch: MAIN
CVS Tags: perseant-stdc-iso10646-base, perseant-stdc-iso10646, netbsd-8-base
Branch point for: netbsd-8
Changes since 1.71: +2 -5 lines
Diff to previous 1.71 (colored)

remove checks for failure after memory allocation calls that cannot fail:

  kmem_alloc() with KM_SLEEP
  kmem_zalloc() with KM_SLEEP
  percpu_alloc()
  pserialize_create()
  psref_class_create()

all of these paths include an assertion that the allocation has not failed,
so callers should not assert that again.

Revision 1.62.2.3 / (download) - annotate - [select for diffs], Wed Apr 26 02:53:24 2017 UTC (5 years, 9 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.62.2.2: +3 -4 lines
Diff to previous 1.62.2.2 (colored) to branchpoint 1.62 (colored) next main 1.63 (colored)

Sync with HEAD

Revision 1.67.2.1 / (download) - annotate - [select for diffs], Fri Apr 21 16:53:53 2017 UTC (5 years, 9 months ago) by bouyer
Branch: bouyer-socketcan
Changes since 1.67: +240 -87 lines
Diff to previous 1.67 (colored) next main 1.68 (colored)

Sync with HEAD

Revision 1.71 / (download) - annotate - [select for diffs], Thu Apr 13 19:54:22 2017 UTC (5 years, 9 months ago) by skrll
Branch: MAIN
CVS Tags: prg-localcount2-base3, prg-localcount2-base2, prg-localcount2-base1, prg-localcount2-base, prg-localcount2, pgoyette-localcount-20170426, bouyer-socketcan-base1
Changes since 1.70: +3 -4 lines
Diff to previous 1.70 (colored)

PR/52154: xHCI Slot Context Not Include in configure endpoint process

eXtensible Host Controller Interface Specification(rev 1.1), 4.6.6:

"A0 shall be set to 1 and refer to section 6.2.2.2 for the Slot Context fields
used by the Configure Endpoint Command."

Revision 1.23.2.5 / (download) - annotate - [select for diffs], Wed Apr 5 19:54:21 2017 UTC (5 years, 9 months ago) by snj
Branch: netbsd-7
Changes since 1.23.2.4: +2436 -1287 lines
Diff to previous 1.23.2.4 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #1395):
	share/man/man4/axe.4: netbsd-7-nhusb
	share/man/man4/axen.4: netbsd-7-nhusb
	share/man/man4/cdce.4: netbsd-7-nhusb
	share/man/man4/uaudio.4: netbsd-7-nhusb
	share/man/man4/ucom.4: netbsd-7-nhusb
	share/man/man4/uep.4: netbsd-7-nhusb
	share/man/man4/urtw.4: netbsd-7-nhusb
	share/man/man4/usb.4: netbsd-7-nhusb
	share/man/man4/uyap.4: netbsd-7-nhusb
	share/man/man4/xhci.4: netbsd-7-nhusb
	share/man/man9/usbdi.9: netbsd-7-nhusb
	sys/arch/amd64/conf/ALL: netbsd-7-nhusb
	sys/arch/amd64/conf/GENERIC: netbsd-7-nhusb
	sys/arch/amiga/dev/slhci_zbus.c: netbsd-7-nhusb
	sys/arch/arm/allwinner/awin_otg.c: netbsd-7-nhusb
	sys/arch/arm/allwinner/awin_usb.c: netbsd-7-nhusb
	sys/arch/arm/amlogic/amlogic_dwctwo.c: netbsd-7-nhusb
	sys/arch/arm/at91/at91ohci.c: netbsd-7-nhusb
	sys/arch/arm/broadcom/bcm2835_dwctwo.c: netbsd-7-nhusb
	sys/arch/arm/broadcom/bcm53xx_usb.c: netbsd-7-nhusb
	sys/arch/arm/ep93xx/epohci.c: netbsd-7-nhusb
	sys/arch/arm/gemini/obio_ehci.c: netbsd-7-nhusb
	sys/arch/arm/imx/files.imx23: netbsd-7-nhusb
	sys/arch/arm/imx/imxusb.c: netbsd-7-nhusb
	sys/arch/arm/imx/imxusbreg.h: netbsd-7-nhusb
	sys/arch/arm/omap/obio_ohci.c: netbsd-7-nhusb
	sys/arch/arm/omap/omap3_ehci.c: netbsd-7-nhusb
	sys/arch/arm/omap/omapl1x_ohci.c: netbsd-7-nhusb
	sys/arch/arm/omap/tiotg.c: netbsd-7-nhusb
	sys/arch/arm/s3c2xx0/ohci_s3c24x0.c: netbsd-7-nhusb
	sys/arch/arm/samsung/exynos_usb.c: netbsd-7-nhusb
	sys/arch/arm/xscale/pxa2x0_ohci.c: netbsd-7-nhusb
	sys/arch/arm/zynq/zynq_usb.c: netbsd-7-nhusb
	sys/arch/hpcarm/dev/nbp_slhci.c: netbsd-7-nhusb
	sys/arch/hpcmips/dev/plumohci.c: netbsd-7-nhusb
	sys/arch/i386/conf/ALL: netbsd-7-nhusb
	sys/arch/i386/conf/GENERIC: netbsd-7-nhusb
	sys/arch/i386/pci/gcscehci.c: netbsd-7-nhusb
	sys/arch/luna68k/conf/GENERIC: netbsd-7-nhusb
	sys/arch/mips/adm5120/dev/ahci.c: netbsd-7-nhusb
	sys/arch/mips/adm5120/dev/ahcivar.h: netbsd-7-nhusb
	sys/arch/mips/alchemy/dev/ohci_aubus.c: netbsd-7-nhusb
	sys/arch/mips/atheros/dev/ehci_arbus.c: netbsd-7-nhusb
	sys/arch/mips/atheros/dev/ohci_arbus.c: netbsd-7-nhusb
	sys/arch/mips/conf/files.adm5120: netbsd-7-nhusb
	sys/arch/mips/ralink/ralink_ehci.c: netbsd-7-nhusb
	sys/arch/mips/ralink/ralink_ohci.c: netbsd-7-nhusb
	sys/arch/mips/rmi/rmixl_ehci.c: netbsd-7-nhusb
	sys/arch/mips/rmi/rmixl_ohci.c: netbsd-7-nhusb
	sys/arch/playstation2/dev/ohci_sbus.c: netbsd-7-nhusb
	sys/arch/powerpc/booke/dev/pq3ehci.c: netbsd-7-nhusb
	sys/arch/powerpc/ibm4xx/dev/dwctwo_plb.c: netbsd-7-nhusb
	sys/arch/x68k/dev/slhci_intio.c: netbsd-7-nhusb
	sys/conf/files: netbsd-7-nhusb
	sys/dev/cardbus/ehci_cardbus.c: netbsd-7-nhusb
	sys/dev/cardbus/ohci_cardbus.c: netbsd-7-nhusb
	sys/dev/cardbus/uhci_cardbus.c: netbsd-7-nhusb
	sys/dev/ic/sl811hs.c: netbsd-7-nhusb
	sys/dev/ic/sl811hsvar.h: netbsd-7-nhusb
	sys/dev/isa/slhci_isa.c: netbsd-7-nhusb
	sys/dev/marvell/ehci_mv.c: netbsd-7-nhusb
	sys/dev/pci/ehci_pci.c: netbsd-7-nhusb
	sys/dev/pci/ohci_pci.c: netbsd-7-nhusb
	sys/dev/pci/uhci_pci.c: netbsd-7-nhusb
	sys/dev/pci/xhci_pci.c: netbsd-7-nhusb
	sys/dev/pcmcia/slhci_pcmcia.c: netbsd-7-nhusb
	sys/dev/usb/Makefile.usbdevs: netbsd-7-nhusb
	sys/dev/usb/TODO: netbsd-7-nhusb
	sys/dev/usb/TODO.usbmp: netbsd-7-nhusb
	sys/dev/usb/aubtfwl.c: netbsd-7-nhusb
	sys/dev/usb/auvitek.c: netbsd-7-nhusb
	sys/dev/usb/auvitek_audio.c: netbsd-7-nhusb
	sys/dev/usb/auvitek_dtv.c: netbsd-7-nhusb
	sys/dev/usb/auvitek_i2c.c: netbsd-7-nhusb
	sys/dev/usb/auvitek_video.c: netbsd-7-nhusb
	sys/dev/usb/auvitekvar.h: netbsd-7-nhusb
	sys/dev/usb/ehci.c: netbsd-7-nhusb
	sys/dev/usb/ehcireg.h: netbsd-7-nhusb
	sys/dev/usb/ehcivar.h: netbsd-7-nhusb
	sys/dev/usb/emdtv.c: netbsd-7-nhusb
	sys/dev/usb/emdtv_dtv.c: netbsd-7-nhusb
	sys/dev/usb/emdtv_ir.c: netbsd-7-nhusb
	sys/dev/usb/emdtvvar.h: netbsd-7-nhusb
	sys/dev/usb/ezload.c: netbsd-7-nhusb
	sys/dev/usb/ezload.h: netbsd-7-nhusb
	sys/dev/usb/files.usb: netbsd-7-nhusb
	sys/dev/usb/hid.c: netbsd-7-nhusb
	sys/dev/usb/hid.h: netbsd-7-nhusb
	sys/dev/usb/if_athn_usb.c: netbsd-7-nhusb
	sys/dev/usb/if_athn_usb.h: netbsd-7-nhusb
	sys/dev/usb/if_atu.c: netbsd-7-nhusb
	sys/dev/usb/if_atureg.h: netbsd-7-nhusb
	sys/dev/usb/if_aue.c: netbsd-7-nhusb
	sys/dev/usb/if_auereg.h: netbsd-7-nhusb
	sys/dev/usb/if_axe.c: netbsd-7-nhusb
	sys/dev/usb/if_axen.c: netbsd-7-nhusb
	sys/dev/usb/if_axenreg.h: netbsd-7-nhusb
	sys/dev/usb/if_axereg.h: netbsd-7-nhusb
	sys/dev/usb/if_cdce.c: netbsd-7-nhusb
	sys/dev/usb/if_cdcereg.h: netbsd-7-nhusb
	sys/dev/usb/if_cue.c: netbsd-7-nhusb
	sys/dev/usb/if_cuereg.h: netbsd-7-nhusb
	sys/dev/usb/if_kue.c: netbsd-7-nhusb
	sys/dev/usb/if_kuereg.h: netbsd-7-nhusb
	sys/dev/usb/if_otus.c: netbsd-7-nhusb
	sys/dev/usb/if_otusvar.h: netbsd-7-nhusb
	sys/dev/usb/if_rum.c: netbsd-7-nhusb
	sys/dev/usb/if_rumreg.h: netbsd-7-nhusb
	sys/dev/usb/if_rumvar.h: netbsd-7-nhusb
	sys/dev/usb/if_run.c: netbsd-7-nhusb
	sys/dev/usb/if_runvar.h: netbsd-7-nhusb
	sys/dev/usb/if_smsc.c: netbsd-7-nhusb
	sys/dev/usb/if_smscreg.h: netbsd-7-nhusb
	sys/dev/usb/if_smscvar.h: netbsd-7-nhusb
	sys/dev/usb/if_udav.c: netbsd-7-nhusb
	sys/dev/usb/if_udavreg.h: netbsd-7-nhusb
	sys/dev/usb/if_upgt.c: netbsd-7-nhusb
	sys/dev/usb/if_upgtvar.h: netbsd-7-nhusb
	sys/dev/usb/if_upl.c: netbsd-7-nhusb
	sys/dev/usb/if_ural.c: netbsd-7-nhusb
	sys/dev/usb/if_uralreg.h: netbsd-7-nhusb
	sys/dev/usb/if_uralvar.h: netbsd-7-nhusb
	sys/dev/usb/if_url.c: netbsd-7-nhusb
	sys/dev/usb/if_urlreg.h: netbsd-7-nhusb
	sys/dev/usb/if_urndis.c: netbsd-7-nhusb
	sys/dev/usb/if_urndisreg.h: netbsd-7-nhusb
	sys/dev/usb/if_urtw.c: netbsd-7-nhusb
	sys/dev/usb/if_urtwn.c: netbsd-7-nhusb
	sys/dev/usb/if_urtwn_data.h: netbsd-7-nhusb
	sys/dev/usb/if_urtwnreg.h: netbsd-7-nhusb
	sys/dev/usb/if_urtwnvar.h: netbsd-7-nhusb
	sys/dev/usb/if_urtwreg.h: netbsd-7-nhusb
	sys/dev/usb/if_zyd.c: netbsd-7-nhusb
	sys/dev/usb/if_zydreg.h: netbsd-7-nhusb
	sys/dev/usb/irmce.c: netbsd-7-nhusb
	sys/dev/usb/moscom.c: netbsd-7-nhusb
	sys/dev/usb/motg.c: netbsd-7-nhusb
	sys/dev/usb/motgvar.h: netbsd-7-nhusb
	sys/dev/usb/ohci.c: netbsd-7-nhusb
	sys/dev/usb/ohcireg.h: netbsd-7-nhusb
	sys/dev/usb/ohcivar.h: netbsd-7-nhusb
	sys/dev/usb/pseye.c: netbsd-7-nhusb
	sys/dev/usb/slurm.c: netbsd-7-nhusb
	sys/dev/usb/stuirda.c: netbsd-7-nhusb
	sys/dev/usb/u3g.c: netbsd-7-nhusb
	sys/dev/usb/uark.c: netbsd-7-nhusb
	sys/dev/usb/uatp.c: netbsd-7-nhusb
	sys/dev/usb/uaudio.c: netbsd-7-nhusb
	sys/dev/usb/uberry.c: netbsd-7-nhusb
	sys/dev/usb/ubsa.c: netbsd-7-nhusb
	sys/dev/usb/ubsa_common.c: netbsd-7-nhusb
	sys/dev/usb/ubsavar.h: netbsd-7-nhusb
	sys/dev/usb/ubt.c: netbsd-7-nhusb
	sys/dev/usb/uchcom.c: netbsd-7-nhusb
	sys/dev/usb/ucom.c: netbsd-7-nhusb
	sys/dev/usb/ucomvar.h: netbsd-7-nhusb
	sys/dev/usb/ucycom.c: netbsd-7-nhusb
	sys/dev/usb/udl.c: netbsd-7-nhusb
	sys/dev/usb/udl.h: netbsd-7-nhusb
	sys/dev/usb/udsbr.c: netbsd-7-nhusb
	sys/dev/usb/udsir.c: netbsd-7-nhusb
	sys/dev/usb/uep.c: netbsd-7-nhusb
	sys/dev/usb/uftdi.c: netbsd-7-nhusb
	sys/dev/usb/uftdireg.h: netbsd-7-nhusb
	sys/dev/usb/ugen.c: netbsd-7-nhusb
	sys/dev/usb/ugensa.c: netbsd-7-nhusb
	sys/dev/usb/uhci.c: netbsd-7-nhusb
	sys/dev/usb/uhcireg.h: netbsd-7-nhusb
	sys/dev/usb/uhcivar.h: netbsd-7-nhusb
	sys/dev/usb/uhid.c: netbsd-7-nhusb
	sys/dev/usb/uhidev.c: netbsd-7-nhusb
	sys/dev/usb/uhidev.h: netbsd-7-nhusb
	sys/dev/usb/uhmodem.c: netbsd-7-nhusb
	sys/dev/usb/uhso.c: netbsd-7-nhusb
	sys/dev/usb/uhub.c: netbsd-7-nhusb
	sys/dev/usb/uipad.c: netbsd-7-nhusb
	sys/dev/usb/uipaq.c: netbsd-7-nhusb
	sys/dev/usb/uirda.c: netbsd-7-nhusb
	sys/dev/usb/uirdavar.h: netbsd-7-nhusb
	sys/dev/usb/ukbd.c: netbsd-7-nhusb
	sys/dev/usb/ukbdmap.c: netbsd-7-nhusb
	sys/dev/usb/ukyopon.c: netbsd-7-nhusb
	sys/dev/usb/ukyopon.h: netbsd-7-nhusb
	sys/dev/usb/ulpt.c: netbsd-7-nhusb
	sys/dev/usb/umass.c: netbsd-7-nhusb
	sys/dev/usb/umass_isdata.c: netbsd-7-nhusb
	sys/dev/usb/umass_isdata.h: netbsd-7-nhusb
	sys/dev/usb/umass_quirks.c: netbsd-7-nhusb
	sys/dev/usb/umass_quirks.h: netbsd-7-nhusb
	sys/dev/usb/umass_scsipi.c: netbsd-7-nhusb
	sys/dev/usb/umass_scsipi.h: netbsd-7-nhusb
	sys/dev/usb/umassvar.h: netbsd-7-nhusb
	sys/dev/usb/umcs.c: netbsd-7-nhusb
	sys/dev/usb/umct.c: netbsd-7-nhusb
	sys/dev/usb/umidi.c: netbsd-7-nhusb
	sys/dev/usb/umidi_quirks.c: netbsd-7-nhusb
	sys/dev/usb/umidi_quirks.h: netbsd-7-nhusb
	sys/dev/usb/umodem.c: netbsd-7-nhusb
	sys/dev/usb/umodem_common.c: netbsd-7-nhusb
	sys/dev/usb/umodemvar.h: netbsd-7-nhusb
	sys/dev/usb/ums.c: netbsd-7-nhusb
	sys/dev/usb/uplcom.c: netbsd-7-nhusb
	sys/dev/usb/urio.c: netbsd-7-nhusb
	sys/dev/usb/urio.h: netbsd-7-nhusb
	sys/dev/usb/usb.c: netbsd-7-nhusb
	sys/dev/usb/usb.h: netbsd-7-nhusb
	sys/dev/usb/usb_mem.c: netbsd-7-nhusb
	sys/dev/usb/usb_mem.h: netbsd-7-nhusb
	sys/dev/usb/usb_quirks.c: netbsd-7-nhusb
	sys/dev/usb/usb_quirks.h: netbsd-7-nhusb
	sys/dev/usb/usb_subr.c: netbsd-7-nhusb
	sys/dev/usb/usbdevices.config: netbsd-7-nhusb
	sys/dev/usb/usbdevs: netbsd-7-nhusb
	sys/dev/usb/usbdevs.h: netbsd-7-nhusb
	sys/dev/usb/usbdevs_data.h: netbsd-7-nhusb
	sys/dev/usb/usbdi.c: netbsd-7-nhusb
	sys/dev/usb/usbdi.h: netbsd-7-nhusb
	sys/dev/usb/usbdi_util.c: netbsd-7-nhusb
	sys/dev/usb/usbdi_util.h: netbsd-7-nhusb
	sys/dev/usb/usbdivar.h: netbsd-7-nhusb
	sys/dev/usb/usbhid.h: netbsd-7-nhusb
	sys/dev/usb/usbhist.h: netbsd-7-nhusb
	sys/dev/usb/usbroothub.c: netbsd-7-nhusb
	sys/dev/usb/usbroothub.h: netbsd-7-nhusb
	sys/dev/usb/usbroothub_subr.c: delete
	sys/dev/usb/usbroothub_subr.h: delete
	sys/dev/usb/uscanner.c: netbsd-7-nhusb
	sys/dev/usb/uslsa.c: netbsd-7-nhusb
	sys/dev/usb/usscanner.c: netbsd-7-nhusb
	sys/dev/usb/ustir.c: netbsd-7-nhusb
	sys/dev/usb/uthum.c: netbsd-7-nhusb
	sys/dev/usb/utoppy.c: netbsd-7-nhusb
	sys/dev/usb/uts.c: netbsd-7-nhusb
	sys/dev/usb/uvideo.c: netbsd-7-nhusb
	sys/dev/usb/uvisor.c: netbsd-7-nhusb
	sys/dev/usb/uvscom.c: netbsd-7-nhusb
	sys/dev/usb/uyap.c: netbsd-7-nhusb
	sys/dev/usb/uyap_firmware.h: netbsd-7-nhusb
	sys/dev/usb/uyurex.c: netbsd-7-nhusb
	sys/dev/usb/x1input_rdesc.h: netbsd-7-nhusb
	sys/dev/usb/xhci.c: netbsd-7-nhusb
	sys/dev/usb/xhcireg.h: netbsd-7-nhusb
	sys/dev/usb/xhcivar.h: netbsd-7-nhusb
	sys/dev/usb/xinput_rdesc.h: netbsd-7-nhusb
	sys/external/bsd/common/conf/files.linux: netbsd-7-nhusb
	sys/external/bsd/common/include/linux/err.h: netbsd-7-nhusb
	sys/external/bsd/common/include/linux/kernel.h: netbsd-7-nhusb
	sys/external/bsd/common/include/linux/workqueue.h: netbsd-7-nhusb
	sys/external/bsd/common/linux/linux_work.c: netbsd-7-nhusb
	sys/external/bsd/drm2/dist/drm/radeon/atombios_encoders.c: netbsd-7-nhusb
	sys/external/bsd/drm2/dist/drm/radeon/radeon_legacy_encoders.c: netbsd-7-nhusb
	sys/external/bsd/drm2/drm/files.drmkms: netbsd-7-nhusb
	sys/external/bsd/drm2/i915drm/files.i915drmkms: netbsd-7-nhusb
	sys/external/bsd/drm2/include/linux/err.h: delete
	sys/external/bsd/drm2/include/linux/workqueue.h: delete
	sys/external/bsd/drm2/linux/files.drmkms_linux: netbsd-7-nhusb
	sys/external/bsd/drm2/linux/linux_work.c: delete
	sys/external/bsd/dwc2/dwc2.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dwc2.h: netbsd-7-nhusb
	sys/external/bsd/dwc2/dwc2var.h: netbsd-7-nhusb
	sys/external/bsd/dwc2/dwctwo2netbsd: netbsd-7-nhusb
	sys/external/bsd/dwc2/conf/files.dwc2: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_core.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_core.h: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_coreintr.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hcd.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hcd.h: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hcdddma.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hcdintr.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hcdqueue.c: netbsd-7-nhusb
	sys/external/bsd/dwc2/dist/dwc2_hw.h: netbsd-7-nhusb
	sys/modules/drmkms_linux/Makefile: netbsd-7-nhusb
	sys/modules/i915drmkms/Makefile: netbsd-7-nhusb
	sys/rump/dev/lib/libugenhc/ugenhc.c: netbsd-7-nhusb
	sys/rump/dev/lib/libusb/Makefile: netbsd-7-nhusb
	sys/rump/dev/lib/libusb/USB.ioconf: netbsd-7-nhusb
	sys/rump/dev/lib/libusb/usb_at_ugenhc.c: delete
	sys/rump/dev/lib/libusb/opt/opt_usb.h: delete
	sys/rump/dev/lib/libusb/opt/opt_usbverbose.h: delete
	sys/sys/mbuf.h: netbsd-7-nhusb
	usr.sbin/usbdevs/usbdevs.8: netbsd-7-nhusb
	usr.sbin/usbdevs/usbdevs.c: netbsd-7-nhusb
Merge netbsd-7-nhusb:
- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
     - kern/48308
     - uhub status notification improvements
     - umass(4) probe fix (applied to HEAD already)
     - ohci(4) short transfer fix
- Change the SOFTINT level from NET to SERIAL for the USB softint handler.
  This gives the callback a chance of running when another softint handler
  at SOFTINT_NET has blocked holding a lock, e.g. softnet_lock and most of
  the network stack.
     - kern/49065 - ifconfig tun0 ... sequence locks up system / lockup:
       softnet_lock held across usb xfr
     - kern/50491 - unkillable wait in usbd_transfer while using usmsc0
       on raspberry pi 2
     - kern/51395 - USB Ethernet makes xhci hang
- Various improvements to slhci(4)
- Various improvements to dwc2(4)

Revision 1.62.2.2 / (download) - annotate - [select for diffs], Mon Mar 20 06:57:39 2017 UTC (5 years, 10 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.62.2.1: +247 -86 lines
Diff to previous 1.62.2.1 (colored) to branchpoint 1.62 (colored)

Sync with HEAD

Revision 1.28.2.85 / (download) - annotate - [select for diffs], Sun Feb 5 13:40:48 2017 UTC (5 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.84: +7 -5 lines
Diff to previous 1.28.2.84 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.23.2.4.2.3 / (download) - annotate - [select for diffs], Thu Jan 26 21:54:25 2017 UTC (6 years ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.23.2.4.2.2: +239 -85 lines
Diff to previous 1.23.2.4.2.2 (colored) to branchpoint 1.23.2.4 (colored) next main 1.23.2.5 (colored)

Sync with HEAD/nhusb

Revision 1.70 / (download) - annotate - [select for diffs], Sat Jan 21 07:39:30 2017 UTC (6 years ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-localcount-20170320, nick-nhusb-base-20170204, jdolecek-ncq-base, jdolecek-ncq
Changes since 1.69: +6 -4 lines
Diff to previous 1.69 (colored)

Fix a kmem_{zalloc,free} size

Revision 1.69 / (download) - annotate - [select for diffs], Thu Jan 19 20:35:44 2017 UTC (6 years ago) by skrll
Branch: MAIN
Changes since 1.68: +3 -3 lines
Diff to previous 1.68 (colored)

Fix build

Revision 1.68 / (download) - annotate - [select for diffs], Thu Jan 19 16:05:00 2017 UTC (6 years ago) by skrll
Branch: MAIN
Changes since 1.67: +237 -85 lines
Diff to previous 1.67 (colored)

Pull across xhci(4) improvemnts from nick-nhusb

Revision 1.28.2.84 / (download) - annotate - [select for diffs], Tue Jan 3 12:50:50 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.83: +7 -8 lines
Diff to previous 1.28.2.83 (colored) to branchpoint 1.28 (colored)

Improve handling of roothub device and free up a bus address for LS/FS/HS
controllers.

Revision 1.28.2.83 / (download) - annotate - [select for diffs], Mon Jan 2 16:55:50 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.82: +212 -73 lines
Diff to previous 1.28.2.82 (colored) to branchpoint 1.28 (colored)

Parse the extended capabilies to and log each controller port to SS/HS
bus root hub ports.

Create/attach the two buses and adapt the xhci_roothub_ctrl to deal with
both buses and sets of roothub ports.

XXX the roothub ub_devices entry needs work to interact with usbdevs(1)
XXX correctly

Revision 1.28.2.82 / (download) - annotate - [select for diffs], Mon Jan 2 16:54:15 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.81: +3 -3 lines
Diff to previous 1.28.2.81 (colored) to branchpoint 1.28 (colored)

Use %s for __func__... oops

Revision 1.28.2.81 / (download) - annotate - [select for diffs], Mon Jan 2 16:45:30 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.80: +3 -3 lines
Diff to previous 1.28.2.80 (colored) to branchpoint 1.28 (colored)

Use __func__ in panic message

Revision 1.28.2.80 / (download) - annotate - [select for diffs], Mon Jan 2 16:34:40 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.79: +3 -3 lines
Diff to previous 1.28.2.79 (colored) to branchpoint 1.28 (colored)

Actually print the bus root hub device in debug output

Revision 1.28.2.79 / (download) - annotate - [select for diffs], Mon Jan 2 16:32:23 2017 UTC (6 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.78: +4 -4 lines
Diff to previous 1.28.2.78 (colored) to branchpoint 1.28 (colored)

Remove unnecessary brackets

Revision 1.28.2.78 / (download) - annotate - [select for diffs], Thu Dec 29 09:52:00 2016 UTC (6 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.77: +51 -30 lines
Diff to previous 1.28.2.77 (colored) to branchpoint 1.28 (colored)

Mark device transfers as USBD_IN_PROGRESS appropriately and improve
abort handling

Revision 1.28.2.77 / (download) - annotate - [select for diffs], Wed Oct 5 20:55:59 2016 UTC (6 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.76: +212 -93 lines
Diff to previous 1.28.2.76 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.23.2.4.2.2 / (download) - annotate - [select for diffs], Wed Sep 7 10:26:39 2016 UTC (6 years, 4 months ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.23.2.4.2.1: +12 -8 lines
Diff to previous 1.23.2.4.2.1 (colored) to branchpoint 1.23.2.4 (colored)

Sync with HEAD

Revision 1.23.2.4.2.1 / (download) - annotate - [select for diffs], Tue Sep 6 20:33:09 2016 UTC (6 years, 4 months ago) by skrll
Branch: netbsd-7-nhusb
Changes since 1.23.2.4: +2244 -1253 lines
Diff to previous 1.23.2.4 (colored)

First pass at netbsd-7 updated with USB code from HEAD

Revision 1.67 / (download) - annotate - [select for diffs], Sat Sep 3 12:07:41 2016 UTC (6 years, 4 months ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-localcount-20170107, pgoyette-localcount-20161104, nick-nhusb-base-20161204, nick-nhusb-base-20161004, localcount-20160914, bouyer-socketcan-base
Branch point for: bouyer-socketcan
Changes since 1.66: +10 -3 lines
Diff to previous 1.66 (colored)

Fix "spurious event" when command ring rolls over.
When the enqueue pointer of command ring points at the last TRB,
address of Link TRB was stored in sc_command_addr.
It should be address of 0th TRB of ring.

From t-hash

Revision 1.66 / (download) - annotate - [select for diffs], Sat Sep 3 12:06:50 2016 UTC (6 years, 4 months ago) by skrll
Branch: MAIN
Changes since 1.65: +4 -7 lines
Diff to previous 1.65 (colored)

Suppress stopping-endpoint in xhci_close_pipe if the endpoint is
already stopped.

From t-hash

Revision 1.65 / (download) - annotate - [select for diffs], Thu Aug 18 07:18:52 2016 UTC (6 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.64: +52 -47 lines
Diff to previous 1.64 (colored)

Put Link TRB always at the end of ring.  Should fix ctrl xfer problem on
Intel xHC.

From t-hash.

Revision 1.64 / (download) - annotate - [select for diffs], Thu Aug 18 07:08:32 2016 UTC (6 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.63: +3 -3 lines
Diff to previous 1.63 (colored)

Byte swap the address in xhci_new_device appropriately.  From t-hash

Revision 1.62.2.1 / (download) - annotate - [select for diffs], Tue Jul 26 03:24:21 2016 UTC (6 years, 6 months ago) by pgoyette
Branch: pgoyette-localcount
Changes since 1.62: +150 -41 lines
Diff to previous 1.62 (colored)

Sync with HEAD

Revision 1.63 / (download) - annotate - [select for diffs], Sun Jul 17 20:13:19 2016 UTC (6 years, 6 months ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-localcount-20160806, pgoyette-localcount-20160726
Changes since 1.62: +150 -41 lines
Diff to previous 1.62 (colored)

Various improvement from t-hash (and a bit from me).

- Flesh out the abort routine
- Avoid using EVENT_DATA
- Miscellaneous debug
- Comment improvement

Revision 1.28.2.76 / (download) - annotate - [select for diffs], Sat Jul 9 20:25:17 2016 UTC (6 years, 6 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.75: +35 -20 lines
Diff to previous 1.28.2.75 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.62 / (download) - annotate - [select for diffs], Fri Jul 8 05:38:31 2016 UTC (6 years, 6 months ago) by skrll
Branch: MAIN
CVS Tags: pgoyette-localcount-base, nick-nhusb-base-20160907
Branch point for: pgoyette-localcount
Changes since 1.61: +7 -4 lines
Diff to previous 1.61 (colored)

Don't ignore return value of xhci_update_ep0_mps and remove KASSERT at
the end of that function.

From t-hash

Revision 1.61 / (download) - annotate - [select for diffs], Fri Jul 8 05:37:38 2016 UTC (6 years, 6 months ago) by skrll
Branch: MAIN
Changes since 1.60: +18 -7 lines
Diff to previous 1.60 (colored)

More debug in new_device.

From t-hash.

Revision 1.60 / (download) - annotate - [select for diffs], Fri Jul 8 05:36:51 2016 UTC (6 years, 6 months ago) by skrll
Branch: MAIN
Changes since 1.59: +5 -5 lines
Diff to previous 1.59 (colored)

s/UBS/USB/

From t-hash

Revision 1.59 / (download) - annotate - [select for diffs], Thu Jul 7 10:53:03 2016 UTC (6 years, 6 months ago) by maya
Branch: MAIN
Changes since 1.58: +12 -11 lines
Diff to previous 1.58 (colored)

Turn a few KASSERTs into KASSERTMSG mentioning the tested values

Some of these values are optimized out, so knowing why the test failed
can be challenging.

Revision 1.28.2.75 / (download) - annotate - [select for diffs], Sun Jun 12 15:25:38 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.74: +2 -6 lines
Diff to previous 1.28.2.74 (colored) to branchpoint 1.28 (colored)

Remove KASSERTs that don't make sense.

Revision 1.58 / (download) - annotate - [select for diffs], Sun Jun 12 15:20:02 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.57: +2 -6 lines
Diff to previous 1.57 (colored)

Remove KASSERTs that don't make sense.

Revision 1.57 / (download) - annotate - [select for diffs], Fri Jun 10 15:19:27 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.56: +3 -2 lines
Diff to previous 1.56 (colored)

Add callout_stop while clearing stall.  From t-hash.

Revision 1.28.2.74 / (download) - annotate - [select for diffs], Fri Jun 10 14:53:31 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.73: +3 -2 lines
Diff to previous 1.28.2.73 (colored) to branchpoint 1.28 (colored)

Add callout_stop while clearing stall.  From t-hash.

Revision 1.28.2.73 / (download) - annotate - [select for diffs], Fri Jun 10 14:44:56 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.72: +3 -2 lines
Diff to previous 1.28.2.72 (colored) to branchpoint 1.28 (colored)

Don't forget to destroy sc_cmdbusy_cv.  From t-hash.

Revision 1.28.2.72 / (download) - annotate - [select for diffs], Fri Jun 10 14:43:35 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.71: +2 -5 lines
Diff to previous 1.28.2.71 (colored) to branchpoint 1.28 (colored)

Only call sc_vendor_init once. Spotted by t-hash.

Revision 1.28.2.71 / (download) - annotate - [select for diffs], Sun Jun 5 10:50:36 2016 UTC (6 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.70: +566 -447 lines
Diff to previous 1.28.2.70 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.56 / (download) - annotate - [select for diffs], Sun Jun 5 10:45:16 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20160529
Changes since 1.55: +3 -9 lines
Diff to previous 1.55 (colored)

PR/51202: XHCI driver sends stale TRBs from a pipe previously opened

Use xhci_host_dequeue in xhci_set_dequeue

Revision 1.55 / (download) - annotate - [select for diffs], Sun Jun 5 09:16:02 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.54: +27 -6 lines
Diff to previous 1.54 (colored)

PR/51202: XHCI driver sends stale TRBs from a pipe previously opened

A similar patch was sent to me by t-hash and the xhci_setup_ctx is taken
from that.

Revision 1.54 / (download) - annotate - [select for diffs], Sun Jun 5 08:25:05 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.53: +36 -14 lines
Diff to previous 1.53 (colored)

Update some comments.  Some from t-hash with updates from me.

Revision 1.53 / (download) - annotate - [select for diffs], Sun Jun 5 08:12:00 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.52: +19 -10 lines
Diff to previous 1.52 (colored)

More debug

Revision 1.52 / (download) - annotate - [select for diffs], Sun Jun 5 08:10:59 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.51: +4 -4 lines
Diff to previous 1.51 (colored)

Replace num of TRBs with xr->xr_ntrb.  From t-hash.

Revision 1.51 / (download) - annotate - [select for diffs], Sun Jun 5 08:05:27 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.50: +425 -392 lines
Diff to previous 1.50 (colored)

From t-hash
    + Gather up setting slot and device context into xhci_setup_ctx(),
      and split out setting route string and TT hub params.
    + Apply htole{32,64} to contexts at once as possible.
    + Use xhci_setup_ctx in xhci_set_address and xhci_configure_endpoint.

Revision 1.50 / (download) - annotate - [select for diffs], Sun Jun 5 07:55:28 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.49: +11 -6 lines
Diff to previous 1.49 (colored)

Wrap long lines and other whitespace.  From t-hash.

Revision 1.49 / (download) - annotate - [select for diffs], Sun Jun 5 07:54:01 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.48: +5 -5 lines
Diff to previous 1.48 (colored)

Reduce the scope of some variable.  From t-hash

Revision 1.48 / (download) - annotate - [select for diffs], Sun Jun 5 07:52:16 2016 UTC (6 years, 7 months ago) by skrll
Branch: MAIN
Changes since 1.47: +69 -34 lines
Diff to previous 1.47 (colored)

From t-hash
    + Split out setting address device.
    + Split out freeing slot structure.
    + Use xhci_free_slot() in xhci_disable_slot().

Revision 1.47 / (download) - annotate - [select for diffs], Tue May 31 09:22:11 2016 UTC (6 years, 7 months ago) by mlelstv
Branch: MAIN
Changes since 1.46: +3 -3 lines
Diff to previous 1.46 (colored)

Flush memory correctly during ring put.
See PR 51199.

From Sprow, ok skrll@.

Revision 1.28.2.70 / (download) - annotate - [select for diffs], Mon May 30 06:48:46 2016 UTC (6 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.69: +21 -9 lines
Diff to previous 1.28.2.69 (colored) to branchpoint 1.28 (colored)

Serialise commands

Revision 1.28.2.69 / (download) - annotate - [select for diffs], Sun May 29 08:44:31 2016 UTC (6 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.68: +308 -193 lines
Diff to previous 1.28.2.68 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.46 / (download) - annotate - [select for diffs], Tue May 10 15:14:03 2016 UTC (6 years, 8 months ago) by pooka
Branch: MAIN
Changes since 1.45: +4 -2 lines
Diff to previous 1.45 (colored)

sprinkle _KERNEL_OPT

Revision 1.45 / (download) - annotate - [select for diffs], Sat May 7 08:11:49 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.44: +2 -17 lines
Diff to previous 1.44 (colored)

G/C more unused code

Revision 1.44 / (download) - annotate - [select for diffs], Fri May 6 10:27:14 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.43: +4 -2 lines
Diff to previous 1.43 (colored)

Print LF in hexdump when datalen % 16 != 0.  From t-hash.

Revision 1.43 / (download) - annotate - [select for diffs], Fri May 6 10:25:56 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.42: +2 -30 lines
Diff to previous 1.42 (colored)

G/C some #if 0 code

Revision 1.42 / (download) - annotate - [select for diffs], Fri May 6 10:24:06 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.41: +8 -8 lines
Diff to previous 1.41 (colored)

Remove magic numbers from xhci_hc_reset.  From t-hash.

Revision 1.41 / (download) - annotate - [select for diffs], Sat Apr 30 15:03:55 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.40: +25 -20 lines
Diff to previous 1.40 (colored)

Comment updates from t-hash
    + Add and update comments.
    + Update spec URLs.

Revision 1.40 / (download) - annotate - [select for diffs], Sat Apr 30 15:02:53 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.39: +151 -113 lines
Diff to previous 1.39 (colored)

Updates from t-hash
    + Split out printing PSI and taking ownership.
    + Split out resetting HC.
    + Split out calculating TRB index.

XXX magic numbers
XXX waits

Revision 1.39 / (download) - annotate - [select for diffs], Sat Apr 30 15:00:24 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.38: +43 -4 lines
Diff to previous 1.38 (colored)

Cancel command when command times out.  From t-hash.

XXX interrupt context?

Revision 1.38 / (download) - annotate - [select for diffs], Sat Apr 30 14:56:20 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.37: +3 -3 lines
Diff to previous 1.37 (colored)

Fix type of return value in xhci_do_command

Revision 1.37 / (download) - annotate - [select for diffs], Sat Apr 30 14:53:06 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.36: +95 -27 lines
Diff to previous 1.36 (colored)

Updates from t-hash
    + Change xhci_init() returns errno.
    + Fix memory leaks in error paths.
    + Add more messages for critical errors.

Revision 1.36 / (download) - annotate - [select for diffs], Sat Apr 30 14:51:04 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.35: +4 -3 lines
Diff to previous 1.35 (colored)

Wrap long line.  From t-hash.

Revision 1.35 / (download) - annotate - [select for diffs], Sat Apr 30 14:46:05 2016 UTC (6 years, 8 months ago) by skrll
Branch: MAIN
Changes since 1.34: +5 -5 lines
Diff to previous 1.34 (colored)

Use XHCI_XFER2XXFER

From t-hash

Revision 1.28.2.68 / (download) - annotate - [select for diffs], Sat Apr 30 10:34:14 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.67: +4 -4 lines
Diff to previous 1.28.2.67 (colored) to branchpoint 1.28 (colored)

Move the struct usb_task to struct usbd_xfer for everyone to use.

Revision 1.34 / (download) - annotate - [select for diffs], Sat Apr 23 10:15:32 2016 UTC (6 years, 9 months ago) by skrll
Branch: MAIN
Changes since 1.33: +1517 -954 lines
Diff to previous 1.33 (colored)

Merge nick-nhusb

- API / infrastructure changes to support memory management changes.
- Memory management improvements and bug fixes.
- HCDs should now be MP safe
- conversion to KERNHIST based debug
- FS/LS isoc support on ehci(4).
- conversion to kmem(9)
- Some USB 3 support - mostly from Takahiro HAYASHI (t-hash).
- interrupt transfers now get proper DMA operations
- general bug fixes
    - kern/48308
    - uhub status notification improvements
    - umass(4) probe fix (applied to HEAD already)
    - ohci(4) short transfer fix

Revision 1.28.2.67 / (download) - annotate - [select for diffs], Sat Apr 16 13:54:38 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.66: +2 -3 lines
Diff to previous 1.28.2.66 (colored) to branchpoint 1.28 (colored)

Remove an unnecessary ux_hcpriv assignement

Revision 1.28.2.66 / (download) - annotate - [select for diffs], Mon Apr 11 06:50:05 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.65: +6 -5 lines
Diff to previous 1.28.2.65 (colored) to branchpoint 1.28 (colored)

Don't use USB_IS_SS when there's a switch (speed) to use.

Revision 1.28.2.65 / (download) - annotate - [select for diffs], Sun Apr 10 22:16:00 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.64: +10 -23 lines
Diff to previous 1.28.2.64 (colored) to branchpoint 1.28 (colored)

Simplify xhci_do_command*

Revision 1.28.2.64 / (download) - annotate - [select for diffs], Sun Apr 10 21:30:41 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.63: +4 -4 lines
Diff to previous 1.28.2.63 (colored) to branchpoint 1.28 (colored)

route is a uint32_t in xhci_init_slot so pass it as such

Revision 1.28.2.63 / (download) - annotate - [select for diffs], Sun Apr 10 20:48:56 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.62: +21 -13 lines
Diff to previous 1.28.2.62 (colored) to branchpoint 1.28 (colored)

Free DMA buffer after disabling slot.
Fix bug DCBA was not cleared after disabling slot.

From Takahiro HAYASHI

Revision 1.28.2.62 / (download) - annotate - [select for diffs], Sun Apr 10 15:51:32 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.61: +4 -4 lines
Diff to previous 1.28.2.61 (colored) to branchpoint 1.28 (colored)

Fix set_port_feature U[12]_TIMEOUT to work when speed > 4.

From Takahiro HAYASHI

Revision 1.28.2.61 / (download) - annotate - [select for diffs], Sun Apr 10 15:50:24 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.60: +3 -3 lines
Diff to previous 1.28.2.60 (colored) to branchpoint 1.28 (colored)

Fix a DPRINTF where the route string and roothub port were swapped.

From Takahiro HAYASHI

Revision 1.28.2.60 / (download) - annotate - [select for diffs], Sun Apr 10 15:49:26 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.59: +4 -5 lines
Diff to previous 1.28.2.59 (colored) to branchpoint 1.28 (colored)

Remove variable v0 becasue ~XHCI_PS_CLEAR does not mask speed bits.

From Takahiro HAYASHI

Revision 1.28.2.59 / (download) - annotate - [select for diffs], Sun Apr 10 15:48:34 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.58: +3 -3 lines
Diff to previous 1.28.2.58 (colored) to branchpoint 1.28 (colored)

Fix assertion of upper limit of slot index.

From Takahiro HAYASHI

Revision 1.28.2.58 / (download) - annotate - [select for diffs], Sun Apr 10 15:47:58 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.57: +4 -4 lines
Diff to previous 1.28.2.57 (colored) to branchpoint 1.28 (colored)

Fix lock assertion in xhci_softintr() when entering DDB on ukbd.
Move this KASSERT to xhci_softintr() from xhci_handle_event().

From Takahiro HAYASHI

Revision 1.28.2.57 / (download) - annotate - [select for diffs], Sun Apr 10 15:46:46 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.56: +6 -9 lines
Diff to previous 1.28.2.56 (colored) to branchpoint 1.28 (colored)

Unwrap lines and other whitespace.

From Takahiro HAYASHI

Revision 1.28.2.56 / (download) - annotate - [select for diffs], Sun Apr 10 15:32:26 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.55: +2 -4 lines
Diff to previous 1.28.2.55 (colored) to branchpoint 1.28 (colored)

Fix merge botch

Revision 1.28.2.55 / (download) - annotate - [select for diffs], Fri Apr 8 09:48:14 2016 UTC (6 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.54: +3 -10 lines
Diff to previous 1.28.2.54 (colored) to branchpoint 1.28 (colored)

Don't rely on XHCI_IMAN_INTR_PEND.  Instead do as others do and simply
clear the bit and handle any pending events.

usb 3 now works on my toshiba laptop (and probably elsewhere)

Revision 1.28.2.54 / (download) - annotate - [select for diffs], Sat Mar 19 11:30:21 2016 UTC (6 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.53: +4 -2 lines
Diff to previous 1.28.2.53 (colored) to branchpoint 1.28 (colored)

Sync with HEAD

Revision 1.28.2.53 / (download) - annotate - [select for diffs], Sun Feb 28 09:16:20 2016 UTC (6 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.52: +9 -6 lines
Diff to previous 1.28.2.52 (colored) to branchpoint 1.28 (colored)

Centralise the up_repeat handling and use the standard pipe method to
start the next transfer.  This allows the removal of a bunch of code
in the upm_done methods for interrupt transfers which had copies of
the upm_start method code.

At the same time we can perform the upm_done method before calling the
transfer callback allowing correct bus_dma(9) operations before
using the transfer DMA buffer.

Revision 1.28.2.52 / (download) - annotate - [select for diffs], Sat Feb 13 09:33:12 2016 UTC (6 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.51: +14 -9 lines
Diff to previous 1.28.2.51 (colored) to branchpoint 1.28 (colored)

Improve transfer callout handling

Revision 1.23.2.4 / (download) - annotate - [select for diffs], Sat Feb 6 20:58:13 2016 UTC (6 years, 11 months ago) by snj
Branch: netbsd-7
CVS Tags: netbsd-7-nhusb-base-20170116, netbsd-7-nhusb-base, netbsd-7-1-RELEASE, netbsd-7-1-RC2, netbsd-7-1-RC1, netbsd-7-1-2-RELEASE, netbsd-7-1-1-RELEASE, netbsd-7-1
Branch point for: netbsd-7-nhusb
Changes since 1.23.2.3: +4 -2 lines
Diff to previous 1.23.2.3 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #1097):
	sys/dev/usb/usb.c: revision 1.161
	sys/dev/usb/usb_subr.c: revisions 1.207, 1.208
	sys/dev/usb/usbdivar.h: revision 1.111
	sys/dev/usb/xhci.c: revision 1.33
Get the iManufacturer, iProduct, and iSerialNumber strings before probing
for drivers and cache them for later use.  This reduces bus transactions
and fixes attachment for at least two of my umass(4)s.
--
Need sys/kmem.h

Revision 1.28.2.51 / (download) - annotate - [select for diffs], Sat Feb 6 08:58:07 2016 UTC (6 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.50: +2 -6 lines
Diff to previous 1.28.2.50 (colored) to branchpoint 1.28 (colored)

Remove unintended commit

Revision 1.28.2.50 / (download) - annotate - [select for diffs], Sat Feb 6 08:50:52 2016 UTC (6 years, 11 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.49: +24 -22 lines
Diff to previous 1.28.2.49 (colored) to branchpoint 1.28 (colored)

Use if (!expr) { ... } instead of a if (expr) goto label; ... ; label:

Revision 1.28.2.49 / (download) - annotate - [select for diffs], Sun Jan 10 10:33:43 2016 UTC (7 years ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.48: +4 -2 lines
Diff to previous 1.28.2.48 (colored) to branchpoint 1.28 (colored)

Bring the following change from HEAD

Get the iManufacturer, iProduct, and iSerialNumber strings before probing
for drivers and cache them for later use.  This reduces bus transactions
and fixes attachment for at least two of my umass(4)s.

Revision 1.33 / (download) - annotate - [select for diffs], Wed Jan 6 22:12:49 2016 UTC (7 years ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20160422, nick-nhusb-base-20160319
Changes since 1.32: +4 -2 lines
Diff to previous 1.32 (colored)

Get the iManufacturer, iProduct, and iSerialNumber strings before probing
for drivers and cache them for later use.  This reduces bus transactions
and fixes attachment for at least two of my umass(4)s.

Revision 1.28.2.48 / (download) - annotate - [select for diffs], Wed Dec 23 08:07:40 2015 UTC (7 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.47: +3 -3 lines
Diff to previous 1.28.2.47 (colored) to branchpoint 1.28 (colored)

Revert previous... I got ahead of myself

Revision 1.28.2.47 / (download) - annotate - [select for diffs], Wed Dec 23 07:59:19 2015 UTC (7 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.46: +3 -3 lines
Diff to previous 1.28.2.46 (colored) to branchpoint 1.28 (colored)

Transfer are only ever allocated from thread context now.  Change IPL_USB
to IPL_NONE in pool_cache_init for the xfer struct pool.

Revision 1.32 / (download) - annotate - [select for diffs], Thu Dec 10 17:07:07 2015 UTC (7 years, 1 month ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20151226
Changes since 1.31: +4 -6 lines
Diff to previous 1.31 (colored)

Unwrap lines

Revision 1.31 / (download) - annotate - [select for diffs], Thu Dec 10 16:35:45 2015 UTC (7 years, 1 month ago) by skrll
Branch: MAIN
Changes since 1.30: +22 -21 lines
Diff to previous 1.30 (colored)

Fix indentation

Revision 1.30 / (download) - annotate - [select for diffs], Thu Dec 10 15:50:17 2015 UTC (7 years, 1 month ago) by skrll
Branch: MAIN
Changes since 1.29: +4 -4 lines
Diff to previous 1.29 (colored)

Trailing whitespace

Revision 1.28.2.46 / (download) - annotate - [select for diffs], Sat Oct 24 08:43:25 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.45: +4 -2 lines
Diff to previous 1.28.2.45 (colored) to branchpoint 1.28 (colored)

xhci_xspeed2speed is unused for now

Revision 1.28.2.45 / (download) - annotate - [select for diffs], Sat Oct 24 08:24:15 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.44: +5 -4 lines
Diff to previous 1.28.2.44 (colored) to branchpoint 1.28 (colored)

Do the following slightly differently to the diff from t-hash

    + Fix the bug that port feature UHF_PORT_{U1,U2}_TIMEOUT
      were never set.
      PS_SPEED bits were always cleared.
    + Fix the bug of logic inversion whether port speed is SS
      when setting feature UHF_PORT_{U1,U2}_TIMEOUT.

Revision 1.28.2.44 / (download) - annotate - [select for diffs], Wed Oct 21 21:36:08 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.43: +5 -2 lines
Diff to previous 1.28.2.43 (colored) to branchpoint 1.28 (colored)

Comments

Revision 1.28.2.43 / (download) - annotate - [select for diffs], Wed Oct 21 21:34:11 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.42: +4 -4 lines
Diff to previous 1.28.2.42 (colored) to branchpoint 1.28 (colored)


Whitespace.

Revision 1.28.2.42 / (download) - annotate - [select for diffs], Tue Oct 20 15:31:21 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.41: +34 -34 lines
Diff to previous 1.28.2.41 (colored) to branchpoint 1.28 (colored)

Consistently providei/use *_{XFER,PIPE,BUS}2SC, etc macros

Revision 1.28.2.41 / (download) - annotate - [select for diffs], Sun Oct 11 09:17:51 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.40: +4 -4 lines
Diff to previous 1.28.2.40 (colored) to branchpoint 1.28 (colored)

Update ubm_allocx with the isoc frame count parameter and use it in
dwctwo(4)

Revision 1.28.2.40 / (download) - annotate - [select for diffs], Sat Oct 3 16:33:33 2015 UTC (7 years, 3 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.39: +3 -4 lines
Diff to previous 1.28.2.39 (colored) to branchpoint 1.28 (colored)

Report as USB 3.0

Revision 1.28.2.39 / (download) - annotate - [select for diffs], Tue Sep 29 11:38:29 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.38: +3 -3 lines
Diff to previous 1.28.2.38 (colored) to branchpoint 1.28 (colored)

sizeof KNF

Revision 1.28.2.38 / (download) - annotate - [select for diffs], Wed Sep 23 13:44:01 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.37: +3 -3 lines
Diff to previous 1.28.2.37 (colored) to branchpoint 1.28 (colored)

Grammar

Revision 1.28.2.37 / (download) - annotate - [select for diffs], Sun Sep 13 09:27:54 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.36: +242 -166 lines
Diff to previous 1.28.2.36 (colored) to branchpoint 1.28 (colored)

Various improvements from t-hash (updated by me)

    + Improve xhci_configure_endpoint().
        + Split off maxburst and interval calculation.
            + Start interval calculation with 10, not 11.
            + Put correct maxburst value.
        + Split off constructing endpoint context.
    + Improve xhci_event_transfer()
        + Remove case of unlikely completion codes I added.
    + Clear xr_cookies too when xhci_set_dequeue() clears xr_trb.
    + Return USBD_NO_ADDR if xhci_address_device fails with
      XHCI_TRB_ERROR_NO_SLOTS.
    + Add aprint_debug xhci capability registers.
    + Add & update comments.

I checked HCCPARAMS1 against version 1.1 of the XHCI specification.  Not
sure of previous version formats

Revision 1.28.2.36 / (download) - annotate - [select for diffs], Sun Sep 13 06:50:09 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.35: +190 -147 lines
Diff to previous 1.28.2.35 (colored) to branchpoint 1.28 (colored)

Split xhci_handle_event() into 3 functions.  Whitespace.

From t-hash.

Revision 1.28.2.35 / (download) - annotate - [select for diffs], Sun Sep 13 06:48:03 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.34: +3 -3 lines
Diff to previous 1.28.2.34 (colored) to branchpoint 1.28 (colored)

Fix locking botch.  From t-hash.

Revision 1.28.2.34 / (download) - annotate - [select for diffs], Mon Aug 31 08:33:03 2015 UTC (7 years, 4 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.33: +30 -18 lines
Diff to previous 1.28.2.33 (colored) to branchpoint 1.28 (colored)

Various improvements from t-hash (very very slightly tweaked by me)

    + Use usbd_xfer_isread().
    + Change mutex to be initialized at IPL_USB.
    + Add vendor init/portsc hook.
    + Modify xhci_trb_put() to take host byte order arguments and
      convert them to little endian byte order.
    + Return PCI vendor ID of xhci instead of NetBSD(0x0) as a root hub
      vendor ID like other HCs do.
    + Move sc_ih in struct xhci_softc to struct xhci_pci_softc.
    + Improve debug message.

Revision 1.29 / (download) - annotate - [select for diffs], Wed Aug 19 06:23:35 2015 UTC (7 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20150921
Changes since 1.28: +3 -3 lines
Diff to previous 1.28 (colored)

More IPL_SCHED -> IPL_USB

Revision 1.28.2.33 / (download) - annotate - [select for diffs], Fri Jun 26 15:51:05 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.32: +13 -14 lines
Diff to previous 1.28.2.32 (colored) to branchpoint 1.28 (colored)

Make xhci_close_pipe void - nothing cares about any errors.

From t-hash.

Revision 1.28.2.32 / (download) - annotate - [select for diffs], Fri Jun 26 15:43:46 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.31: +9 -3 lines
Diff to previous 1.28.2.31 (colored) to branchpoint 1.28 (colored)

Add port range check in xhci_rhpsc().

KASSERT xfer->ux_pipe != NULL in xhci_handle_event().

Based on a diff from t-hash

Revision 1.28.2.31 / (download) - annotate - [select for diffs], Fri Jun 26 15:39:55 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.30: +5 -14 lines
Diff to previous 1.28.2.30 (colored) to branchpoint 1.28 (colored)

Revert previous (for now)

Revision 1.28.2.30 / (download) - annotate - [select for diffs], Thu Jun 25 06:30:13 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.29: +28 -12 lines
Diff to previous 1.28.2.29 (colored) to branchpoint 1.28 (colored)

Improve bInterval handling in xhci_configure_endpoint - should help
keyboards.

From t-hash

Revision 1.28.2.29 / (download) - annotate - [select for diffs], Tue Jun 23 12:22:35 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.28: +14 -5 lines
Diff to previous 1.28.2.28 (colored) to branchpoint 1.28 (colored)

Comment updates from t-hash.

Revision 1.28.2.28 / (download) - annotate - [select for diffs], Sun Jun 7 08:04:52 2015 UTC (7 years, 7 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.27: +7 -4 lines
Diff to previous 1.28.2.27 (colored) to branchpoint 1.28 (colored)

Update comment.

From t-hash.

Revision 1.28.2.27 / (download) - annotate - [select for diffs], Thu May 28 06:15:47 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.26: +48 -41 lines
Diff to previous 1.28.2.26 (colored) to branchpoint 1.28 (colored)

More changes from Takahiro HAYASHI

+ Add sc_statuspend that stores ports bitmap of pending interrupts
  instead of sc_isxhciroothub hack til someone implements suspend pipe.
  While sc_explorepending == 1, uhub_intr shall merge sc_status into
  sc_statuspend.
+ Eliminate confusing UPS_SUPER_SPEED flag and introduce
  UPS_OTHER_SPEED flag that indicates ud_speed of device is
  super speed (or more).
  uhub shall set this flag if ud_speed is super speed (or more).
+ Add the macro that checks ud_speed is super speed.
  The codes shall use this macro to check ud_speed is super speed.
+ Add speed type conversion functions.
+ Include port link status in port_status if port is super speed.

Various other changes to support SS hubs and devices

Revision 1.28.2.26 / (download) - annotate - [select for diffs], Wed May 27 07:22:51 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.25: +4 -10 lines
Diff to previous 1.28.2.25 (colored) to branchpoint 1.28 (colored)

Add patch for intel chips quirk from ryoon@ in
    https://mail-index.netbsd.org/netbsd-bugs/2014/08/31/msg038109.html
slightly modified to set quirks before calling xhci_init.

Set special IMOD value and route ports to xhci for intel chips.

From Takahiro HAYASHI.

Revision 1.28.2.25 / (download) - annotate - [select for diffs], Wed May 27 07:08:16 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.24: +21 -9 lines
Diff to previous 1.28.2.24 (colored) to branchpoint 1.28 (colored)

Rewrite if-else-if chains with switch-case.

From Takahiro HAYASHI.

Revision 1.28.2.24 / (download) - annotate - [select for diffs], Wed May 27 07:06:58 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.23: +22 -3 lines
Diff to previous 1.28.2.23 (colored) to branchpoint 1.28 (colored)

Add some sanity checks for xfer. [Ed: should really find the bugs]

From Takahiro HAYASHI.

Revision 1.28.2.23 / (download) - annotate - [select for diffs], Wed May 27 07:03:18 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.22: +10 -2 lines
Diff to previous 1.28.2.22 (colored) to branchpoint 1.28 (colored)

Fix slot leak when address_device fails.

From Takahiro HAYASHI.

Revision 1.28.2.22 / (download) - annotate - [select for diffs], Wed May 27 06:56:16 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.21: +6 -6 lines
Diff to previous 1.28.2.21 (colored) to branchpoint 1.28 (colored)

Don't abuse pipe->up_async_task for xhci_clear_endpoint_stall_async_task.
Add member struct usb_task xp_async_task to struct xhci_pipe.

From Takahiro HAYASHI.

Revision 1.28.2.21 / (download) - annotate - [select for diffs], Wed May 27 06:54:18 2015 UTC (7 years, 8 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.20: +20 -6 lines
Diff to previous 1.28.2.20 (colored) to branchpoint 1.28 (colored)

Add comments. Some cosmetic changes.

From Takahiro HAYASHI.

Revision 1.28.2.20 / (download) - annotate - [select for diffs], Tue Apr 7 06:52:03 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.19: +94 -2 lines
Diff to previous 1.28.2.19 (colored) to branchpoint 1.28 (colored)

Comments.  From Takahiro HAYASHI.

Revision 1.28.2.19 / (download) - annotate - [select for diffs], Tue Apr 7 06:49:10 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.18: +746 -176 lines
Diff to previous 1.28.2.18 (colored) to branchpoint 1.28 (colored)

USB 3.0 snapshot from Takahiro HAYASHI

Revision 1.28.2.18 / (download) - annotate - [select for diffs], Mon Apr 6 19:28:40 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.17: +11 -10 lines
Diff to previous 1.28.2.17 (colored) to branchpoint 1.28 (colored)

Cosmetic/Whitespace changes from Takahiro HAYASHI

Revision 1.28.2.17 / (download) - annotate - [select for diffs], Mon Apr 6 18:30:39 2015 UTC (7 years, 9 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.16: +3 -3 lines
Diff to previous 1.28.2.16 (colored) to branchpoint 1.28 (colored)

*** empty log message ***

Revision 1.28.2.16 / (download) - annotate - [select for diffs], Sun Mar 22 08:09:44 2015 UTC (7 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.15: +35 -38 lines
Diff to previous 1.28.2.15 (colored) to branchpoint 1.28 (colored)

Indentation and whitespace.

Revision 1.28.2.15 / (download) - annotate - [select for diffs], Sun Mar 22 08:07:34 2015 UTC (7 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.14: +6 -6 lines
Diff to previous 1.28.2.14 (colored) to branchpoint 1.28 (colored)

Fix spellos

Revision 1.28.2.14 / (download) - annotate - [select for diffs], Thu Mar 19 17:26:43 2015 UTC (7 years, 10 months ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.13: +73 -73 lines
Diff to previous 1.28.2.13 (colored) to branchpoint 1.28 (colored)

Do the same as OpenBSD and get rid of the *_handle typedefs and use
plain structures insteads

Revision 1.23.2.3 / (download) - annotate - [select for diffs], Fri Jan 2 22:44:34 2015 UTC (8 years ago) by martin
Branch: netbsd-7
CVS Tags: netbsd-7-0-RELEASE, netbsd-7-0-RC3, netbsd-7-0-RC2, netbsd-7-0-RC1, netbsd-7-0-2-RELEASE, netbsd-7-0-1-RELEASE, netbsd-7-0
Changes since 1.23.2.2: +6 -6 lines
Diff to previous 1.23.2.2 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #372):
	sys/dev/usb/xhcireg.h: revision 1.2
	sys/dev/usb/xhci.c: revision 1.28
kern/49391: Fixes to XHCI driver command ring and status TRB
CRCR needs 64byte aligned address
Use usb_allocmem instead of usb_allocmem_flags(..., 0)
Correct status stage TRB in xhci_device_ctrl_start - direction logic was
wrong.
Correct a typo in a comment

Revision 1.28.2.13 / (download) - annotate - [select for diffs], Fri Dec 5 09:37:50 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.12: +10 -10 lines
Diff to previous 1.28.2.12 (colored) to branchpoint 1.28 (colored)

KNF. Remove ( ) from return statements.

Revision 1.28.2.12 / (download) - annotate - [select for diffs], Thu Dec 4 08:04:31 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.11: +47 -311 lines
Diff to previous 1.28.2.11 (colored) to branchpoint 1.28 (colored)

Rework roothub control transfers so that much of the code is shared
across HCDs.

I have retained the vendor/product reporting for each HCD for now,
but it maybe get removed later.

ahci(4) now reports a language table and uses the usb_makestrdesc
function instead of rolling its own version.

Revision 1.28.2.11 / (download) - annotate - [select for diffs], Wed Dec 3 23:05:06 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.10: +3 -3 lines
Diff to previous 1.28.2.10 (colored) to branchpoint 1.28 (colored)

Rename usbroothub_subr.[ch] to usbroothub.[ch]

Revision 1.28.2.10 / (download) - annotate - [select for diffs], Wed Dec 3 22:40:55 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.9: +8 -9 lines
Diff to previous 1.28.2.9 (colored) to branchpoint 1.28 (colored)

Provide a USETWD macro for use with USB words designated
initialisers.

Revision 1.28.2.9 / (download) - annotate - [select for diffs], Wed Dec 3 22:33:56 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.8: +2 -3 lines
Diff to previous 1.28.2.8 (colored) to branchpoint 1.28 (colored)

Remove #include <sys/malloc.h> where it's not (no longer) needed

Revision 1.28.2.8 / (download) - annotate - [select for diffs], Wed Dec 3 14:18:07 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.7: +3 -3 lines
Diff to previous 1.28.2.7 (colored) to branchpoint 1.28 (colored)

Replace malloc(9) with kmem(9)

Revision 1.28.2.7 / (download) - annotate - [select for diffs], Wed Dec 3 13:19:38 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.6: +45 -44 lines
Diff to previous 1.28.2.6 (colored) to branchpoint 1.28 (colored)

Use designated initializers for more descriptors.

Revision 1.28.2.6 / (download) - annotate - [select for diffs], Wed Dec 3 13:09:00 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.5: +16 -12 lines
Diff to previous 1.28.2.5 (colored) to branchpoint 1.28 (colored)

Use designated initialisers for usb_device_descriptor_t structs.

Revision 1.28.2.5 / (download) - annotate - [select for diffs], Wed Dec 3 12:52:07 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.4: +173 -173 lines
Diff to previous 1.28.2.4 (colored) to branchpoint 1.28 (colored)

The grand renaming of structure members.

No functional change.

Revision 1.28.2.4 / (download) - annotate - [select for diffs], Tue Dec 2 09:00:34 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.3: +5 -45 lines
Diff to previous 1.28.2.3 (colored) to branchpoint 1.28 (colored)

Step #1 of memory allocation re-organisation.

Centralised the buffer allocation routine which now supports DMA
and non-DMA capable host controllers.  Remove the
ubm_{alloc,free}m methods from usbd_bus_methods.

The buffer allocation is only allowed in thread context and,
therefore, negates the usefulness of the reserve dma code which
is removed in this change.

USBD_NO_COPY is also no longer required as usbd_transfer and
usbd_transfer_complete now track buffer usage and handle any
copying.

Revision 1.28.2.3 / (download) - annotate - [select for diffs], Mon Dec 1 12:38:39 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.2: +42 -42 lines
Diff to previous 1.28.2.2 (colored) to branchpoint 1.28 (colored)

Add prefixes to method structures member names. No functional change.

Revision 1.28.2.2 / (download) - annotate - [select for diffs], Mon Dec 1 08:12:09 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28.2.1: +2 -3 lines
Diff to previous 1.28.2.1 (colored) to branchpoint 1.28 (colored)

Remove usbd_bus no_intrs member it was (virtually) unused.

Revision 1.28.2.1 / (download) - annotate - [select for diffs], Sun Nov 30 12:18:58 2014 UTC (8 years, 1 month ago) by skrll
Branch: nick-nhusb
Changes since 1.28: +5 -5 lines
Diff to previous 1.28 (colored)

Use C99 types. u_int{8,16,32,64}_t to uint{8,16,32,64}_t.

No functional change.

Revision 1.28 / (download) - annotate - [select for diffs], Tue Nov 18 10:18:45 2014 UTC (8 years, 2 months ago) by skrll
Branch: MAIN
CVS Tags: nick-nhusb-base-20150606, nick-nhusb-base-20150406, nick-nhusb-base
Branch point for: nick-nhusb
Changes since 1.27: +6 -6 lines
Diff to previous 1.27 (colored)

kern/49391: Fixes to XHCI driver command ring and status TRB

CRCR needs 64byte aligned address

Use usb_allocmem instead of usb_allocmem_flags(..., 0)

Correct status stage TRB in xhci_device_ctrl_start - direction logic was
wrong.

Correct a typo in a comment

Revision 1.27 / (download) - annotate - [select for diffs], Fri Oct 3 11:05:36 2014 UTC (8 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.26: +233 -164 lines
Diff to previous 1.26 (colored)

Convert to USB_HIST.

From Takahiro HAYASHI with tweaks from me.

Revision 1.26.2.2 / (download) - annotate - [select for diffs], Wed Aug 20 00:03:51 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.26.2.1: +2922 -0 lines
Diff to previous 1.26.2.1 (colored)

Rebase to HEAD as of a few days ago.

Revision 1.23.2.2 / (download) - annotate - [select for diffs], Wed Aug 13 21:47:18 2014 UTC (8 years, 5 months ago) by riz
Branch: netbsd-7
Changes since 1.23.2.1: +16 -5 lines
Diff to previous 1.23.2.1 (colored) to branchpoint 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #11):
	sys/dev/usb/xhci.c: revision 1.25
Serialise xhci_intr1 calls with sc_intr_lock.  From Takahiro HAYASHI.

Revision 1.26.2.1, Tue Aug 12 13:50:42 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-maxphys
Changes since 1.26: +0 -2936 lines
FILE REMOVED

file xhci.c was added on branch tls-maxphys on 2014-08-20 00:03:51 +0000

Revision 1.26 / (download) - annotate - [select for diffs], Tue Aug 12 13:50:42 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
Branch point for: tls-maxphys
Changes since 1.25: +6 -3 lines
Diff to previous 1.25 (colored)

Set the correct MPS for LS devices.  From Takahiro HAYASHI.

Revision 1.25 / (download) - annotate - [select for diffs], Tue Aug 12 13:48:29 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.24: +16 -5 lines
Diff to previous 1.24 (colored)

Serialise xhci_intr1 calls with sc_intr_lock.  From Takahiro HAYASHI.

Revision 1.23.2.1 / (download) - annotate - [select for diffs], Mon Aug 11 15:36:45 2014 UTC (8 years, 5 months ago) by martin
Branch: netbsd-7
Changes since 1.23: +11 -4 lines
Diff to previous 1.23 (colored)

Pull up following revision(s) (requested by skrll in ticket #3):
	sys/dev/usb/xhci.c: revision 1.24
PR/49091: xhci: wrong wMaxPacketSize value
While this is correct according to the specification only fixed sizes
are allowed, i.e. 512 for SS, etc. Maybe these should be used?

Revision 1.24 / (download) - annotate - [select for diffs], Mon Aug 11 10:37:59 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: tls-maxphys-base
Changes since 1.23: +11 -4 lines
Diff to previous 1.23 (colored)

PR/49091: xhci: wrong wMaxPacketSize value

While this is correct according to the specification only fixed sizes
are allowed, i.e. 512 for SS, etc. Maybe these should be used?

Revision 1.16.2.1 / (download) - annotate - [select for diffs], Sun Aug 10 06:54:59 2014 UTC (8 years, 5 months ago) by tls
Branch: tls-earlyentropy
Changes since 1.16: +17 -13 lines
Diff to previous 1.16 (colored) next main 1.17 (colored)

Rebase.

Revision 1.23 / (download) - annotate - [select for diffs], Tue Aug 5 10:33:46 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
CVS Tags: tls-earlyentropy-base, netbsd-7-base
Branch point for: netbsd-7
Changes since 1.22: +2 -4 lines
Diff to previous 1.22 (colored)

Remove #ifdef DIAGNOSTIC around sc from the root interrupt abort methods
now it's always used.

Revision 1.22 / (download) - annotate - [select for diffs], Tue Aug 5 08:33:50 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.21: +4 -2 lines
Diff to previous 1.21 (colored)

Prevent the root hub sending updates once the root interrupt abort is
called.

Revision 1.21 / (download) - annotate - [select for diffs], Tue Aug 5 06:35:24 2014 UTC (8 years, 5 months ago) by skrll
Branch: MAIN
Changes since 1.20: +7 -10 lines
Diff to previous 1.20 (colored)

Simplify the freeing of the interrupt pipe transfer.  Inspired by OpenBSD.

Revision 1.20 / (download) - annotate - [select for diffs], Sat Jul 26 00:17:57 2014 UTC (8 years, 6 months ago) by pgoyette
Branch: MAIN
Changes since 1.19: +4 -3 lines
Diff to previous 1.19 (colored)

Another __diagused

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jul 15 03:40:06 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.18: +6 -4 lines
Diff to previous 1.18 (colored)

Unbreak the build for i386

__debugused => XHCI_DEBUG

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jul 15 02:25:45 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.17: +5 -3 lines
Diff to previous 1.17 (colored)

Suppress another debug output

It's output when DDB.

Fix previous: DEBUG => XHCI_DEBUG

Revision 1.17 / (download) - annotate - [select for diffs], Mon Jul 14 00:58:35 2014 UTC (8 years, 6 months ago) by ozaki-r
Branch: MAIN
Changes since 1.16: +6 -4 lines
Diff to previous 1.16 (colored)

Suppress debug output of xhci_device_intr_done

It's annoying because it is output even on keyboard inputs.

Revision 1.16.6.2 / (download) - annotate - [select for diffs], Thu May 22 11:40:37 2014 UTC (8 years, 8 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.16.6.1: +2911 -0 lines
Diff to previous 1.16.6.1 (colored) to branchpoint 1.16 (colored) next main 1.17 (colored)

sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs.  ("Protocol error: too many arguments")

Revision 1.16.4.2 / (download) - annotate - [select for diffs], Sun May 18 17:45:48 2014 UTC (8 years, 8 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.16.4.1: +2911 -0 lines
Diff to previous 1.16.4.1 (colored) to branchpoint 1.16 (colored) next main 1.17 (colored)

sync with head

Revision 1.16.6.1, Mon Mar 10 13:21:22 2014 UTC (8 years, 10 months ago) by yamt
Branch: yamt-pagecache
Changes since 1.16: +0 -2911 lines
FILE REMOVED

file xhci.c was added on branch yamt-pagecache on 2014-05-22 11:40:37 +0000

Revision 1.16.4.1, Mon Mar 10 13:21:22 2014 UTC (8 years, 10 months ago) by rmind
Branch: rmind-smpnet
Changes since 1.16: +0 -2911 lines
FILE REMOVED

file xhci.c was added on branch rmind-smpnet on 2014-05-18 17:45:48 +0000

Revision 1.16 / (download) - annotate - [select for diffs], Mon Mar 10 13:21:22 2014 UTC (8 years, 10 months ago) by skrll
Branch: MAIN
CVS Tags: yamt-pagecache-base9, rmind-smpnet-nbase, rmind-smpnet-base, riastradh-xf86-video-intel-2-7-1-pre-2-21-15, riastradh-drm2-base3
Branch point for: yamt-pagecache, tls-earlyentropy, rmind-smpnet
Changes since 1.15: +40 -40 lines
Diff to previous 1.15 (colored)

Code style. No functional change.

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 10 13:10:41 2014 UTC (8 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.14: +11 -11 lines
Diff to previous 1.14 (colored)

Don't abuse usbd_status in xhci_init

Revision 1.14 / (download) - annotate - [select for diffs], Mon Mar 10 13:01:28 2014 UTC (8 years, 10 months ago) by skrll
Branch: MAIN
Changes since 1.13: +4 -3 lines
Diff to previous 1.13 (colored)

Comment style.

Revision 1.13 / (download) - annotate - [select for diffs], Thu Jan 16 20:55:56 2014 UTC (9 years ago) by dsl
Branch: MAIN
Changes since 1.12: +8 -3 lines
Diff to previous 1.12 (colored)

Add another XXX comment, I'm not in a postition to fix the code.
The 'cycle' bit of a LINK trb must not be changed until the cycle bit
of the following trb has been set.

Revision 1.12 / (download) - annotate - [select for diffs], Sat Dec 14 16:03:04 2013 UTC (9 years, 1 month ago) by jakllsch
Branch: MAIN
Changes since 1.11: +13 -13 lines
Diff to previous 1.11 (colored)

In xhci_init() use aprint_debug_dev() instead of device_printf().

Revision 1.11 / (download) - annotate - [select for diffs], Tue Dec 10 19:39:42 2013 UTC (9 years, 1 month ago) by dsl
Branch: MAIN
Changes since 1.10: +24 -2 lines
Diff to previous 1.10 (colored)

Add a few comments about some perversities of the xhci specification.
XXX: I can't see any code that ensures there is space in the rings.
XXX: Nothing stops buffer fragments crossing 64kB boundaries.

Revision 1.10 / (download) - annotate - [select for diffs], Sun Nov 17 16:11:35 2013 UTC (9 years, 2 months ago) by skrll
Branch: MAIN
Changes since 1.9: +4 -4 lines
Diff to previous 1.9 (colored)

Fix locking botch.

PR/48383

Revision 1.9 / (download) - annotate - [select for diffs], Wed Nov 13 21:36:57 2013 UTC (9 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.8: +7 -7 lines
Diff to previous 1.8 (colored)

CID 1125827: Avoid buffer overrun (read past end of struct)

Revision 1.8 / (download) - annotate - [select for diffs], Sun Nov 10 03:38:58 2013 UTC (9 years, 2 months ago) by mrg
Branch: MAIN
Changes since 1.7: +6 -2 lines
Diff to previous 1.7 (colored)

add a default case in xhci_init_slot().
ok jakllsch.

Revision 1.7 / (download) - annotate - [select for diffs], Fri Nov 8 03:12:17 2013 UTC (9 years, 2 months ago) by christos
Branch: MAIN
Changes since 1.6: +4 -4 lines
Diff to previous 1.6 (colored)

fix unused variable warnings

Revision 1.6.2.2 / (download) - annotate - [select for diffs], Tue Nov 5 18:36:31 2013 UTC (9 years, 2 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.6.2.1: +2881 -0 lines
Diff to previous 1.6.2.1 (colored) next main 1.7 (colored)

Pull down xhci support from HEAD

Revision 1.6.2.1, Mon Nov 4 08:08:58 2013 UTC (9 years, 2 months ago) by matt
Branch: matt-nb5-mips64
Changes since 1.6: +0 -2879 lines
FILE REMOVED

file xhci.c was added on branch matt-nb5-mips64 on 2013-11-05 18:36:31 +0000

Revision 1.6 / (download) - annotate - [select for diffs], Mon Nov 4 08:08:58 2013 UTC (9 years, 2 months ago) by skrll
Branch: MAIN
Branch point for: matt-nb5-mips64
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

PR/48366 Always zero the allocated memory in xhci_alloc, not just in
DIAGNOSTIC.

Revision 1.5 / (download) - annotate - [select for diffs], Mon Oct 28 17:49:33 2013 UTC (9 years, 3 months ago) by matt
Branch: MAIN
Changes since 1.4: +39 -13 lines
Diff to previous 1.4 (colored)

Add support for scratchpad buffers (required for some XHCI devices).
Fix an endian issue.

Revision 1.4 / (download) - annotate - [select for diffs], Fri Oct 18 08:39:22 2013 UTC (9 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.3: +12 -2 lines
Diff to previous 1.3 (colored)

Wrap several unused static inline functions with #if 0.
I didn't delete them because I suspect that they might be needed later.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Oct 18 08:35:24 2013 UTC (9 years, 3 months ago) by skrll
Branch: MAIN
Changes since 1.2: +6 -4 lines
Diff to previous 1.2 (colored)

Wrap some long lines.

Revision 1.2 / (download) - annotate - [select for diffs], Fri Oct 18 08:25:49 2013 UTC (9 years, 3 months ago) by apb
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1 (colored)

Don't refer to uninitialised variable 'v'
in case C(UR_GET_DESCRIPTOR, UT_READ_CLASS_DEVICE)
in xhci_root_ctrl_start().
This code was apparently pasted from the ehci driver.

OK nick.

Revision 1.1 / (download) - annotate - [select for diffs], Sat Sep 14 00:40:31 2013 UTC (9 years, 4 months ago) by jakllsch
Branch: MAIN

Add work-in-progress xhci(4) driver code.  Currently (mostly) supports
interrupt-driven control, interrupt and bulk transfers at the three USB
2.0 speeds on root hub ports.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>