xhci patch 20150606

2015-06-05 Thread takahiro hayashi

Hello,

Here are xhci patches of some fixes, comments, and
adding functions.

---
nh-usb_subr-ss.diff
+ Use macro to check speed.
  Forgotten in privious patch.
nh-xhcireg-maxintr.diff
+ Fix num of Max Interrupters to 11 bits width.
nh-uhub-wrc.diff
+ Simplify treatment of WRC condition and add comments.
nh-usb-kernhist.diff
+ Add missing KERNHIST_LINK_STATIC(usbhist).
nh-bos.diff
+ Read Binary Object Store descriptor and store to ud_bdesc.
nh-usbdi_util.diff
+ Add usbd_set_port_u[12]_timeout().
nh-ssp.diff
+ Add usbd_get_port_status_ext().
+ Add some definitions for super speed plus.
+ Update comments.


--
t-hash
--- usb_subr.c.02015-05-29 00:35:08.0 +0900
+++ usb_subr.c.12015-05-29 00:30:56.0 +0900
@@ -1428,10 +1428,11 @@ usbd_fill_deviceinfo(struct usbd_device 
else if (s & UPS_SUSPEND)
err = USB_PORT_SUSPENDED;
/*
-* UPS_PORT_POWER_SS is available only
-* if SS, otherwise it means UPS_LOW_SPEED.
+* Note: UPS_PORT_POWER_SS is available only
+* on 3.x, and UPS_PORT_POWER is available
+* only on 2.0 or 1.1.
 */
-   else if (dev->ud_speed == USB_SPEED_SUPER && 
+   else if (USB_IS_SS(dev->ud_speed) && 
(s & UPS_PORT_POWER_SS))
err = USB_PORT_POWERED;
else if (s & UPS_PORT_POWER)
--- src/sys/dev/usb/xhcireg.h.orig  2015-04-07 01:29:02.0 +0900
+++ src/sys/dev/usb/xhcireg.h   2015-06-02 11:28:19.0 +0900
@@ -51,7 +51,7 @@
 #defineXHCI_HCIVERSION_1_0 0x0100  /* xHCI version 1.0 */
 #defineXHCI_HCSPARAMS1 0x04/* RO structual parameters 1 */
 #defineXHCI_HCS1_MAXSLOTS(x)   ((x) & 0xFF)
-#defineXHCI_HCS1_MAXINTRS(x)   (((x) >> 8) & 0x3FF)
+#defineXHCI_HCS1_MAXINTRS(x)   (((x) >> 8) & 0x7FF)
 #defineXHCI_HCS1_MAXPORTS(x)   (((x) >> 24) & 0xFF)
 #defineXHCI_HCSPARAMS2 0x08/* RO structual parameters 2 */
 #defineXHCI_HCS2_IST(x)((x) & 0xF)
--- src/sys/dev/usb/uhub.c.orig 2015-05-28 15:54:12.0 +0900
+++ src/sys/dev/usb/uhub.c  2015-06-03 11:57:34.0 +0900
@@ -586,11 +586,17 @@ uhub_explore(struct usbd_device *dev)
port);
}
}
-   int is_wrc = 0;
-   if (change & UPS_C_PORT_RESET)
+   if (change & UPS_C_PORT_RESET) {
usbd_clear_port_feature(dev, port, UHF_C_PORT_RESET);
+   }
if (change & UPS_C_BH_PORT_RESET) {
-   is_wrc = 1;
+   /*
+* some xHCs set WarmResetChange instead of CSC
+* when port is reset.
+*/
+   if ((status & UPS_CURRENT_CONNECT_STATUS) != 0) {
+   change |= UPS_C_CONNECT_STATUS;
+   }
usbd_clear_port_feature(dev, port,
UHF_C_BH_PORT_RESET);
}
@@ -603,9 +609,7 @@ uhub_explore(struct usbd_device *dev)
 
/* XXX handle overcurrent and resume events! */
 
-   /* xHCI sets WRC instead of CSC when port is reset */
-   if (!reconnect && !(change & UPS_C_CONNECT_STATUS) &&
-   !(is_wrc && (status & UPS_CURRENT_CONNECT_STATUS))) {
+   if (!reconnect && !(change & UPS_C_CONNECT_STATUS)) {
/* No status change, just do recursive explore. */
if (up->up_dev != NULL && up->up_dev->ud_hub != NULL)
up->up_dev->ud_hub->uh_explore(up->up_dev);
--- src/sys/dev/usb/usb.c.orig  2015-05-29 02:06:38.0 +0900
+++ src/sys/dev/usb/usb.c   2015-05-31 15:45:07.0 +0900
@@ -276,6 +276,8 @@ usb_once_init(void)
struct usb_taskq *taskq;
int i;
 
+   KERNHIST_LINK_STATIC(usbhist);
+
selinit(&usb_selevent);
mutex_init(&usb_event_lock, MUTEX_DEFAULT, IPL_NONE);
cv_init(&usb_event_cv, "usbrea");
--- src/sys/dev/usb/usb_subr.c.orig 2015-05-29 00:30:56.0 +0900
+++ src/sys/dev/usb/usb_subr.c  2015-05-29 00:29:27.0 +0900
@@ -529,6 +529,7 @@ usbd_status
 usbd_set_config_index(struct usbd_device *dev, int index, int msg)
 {
usb_config_descriptor_t cd, *cdp;
+   usb_bos_descriptor_t bd, *bdp = NULL;
usbd_status err;
int i, ifcidx, nifc, len, selfpowered, power;
 
@@ -552,8 +553,12 @@

usbd_do_request_flags_pipe diagnostic panic

2015-06-05 Thread takahiro hayashi

Hello,

On nick-nhusb branch kernel panics in usbd_transfer() when the
zero-length request gets stalled.

This happens when the uhidev driver issues usbd_set_idle to my
USB keyboard, one of its uhidevs returns stall for SET_IDLE request.

While usbd_do_request_flags_pipe() processes the xfer for SET_IDLE,
it tries to read endpoint's status and clear stall condition
if the endpoint is stalled.
It reuses the xfer to store GET_STATUS request, but ux_buf of xfer
is not allocated, then KASSERT at line 298 in usbd_transfer() fails.

Should usbd_do_request*() allocate ux_buf even if ux_length is 0?
Should I file PR this prob?


regards,
--
t-hash


Re: Not Groff! Heirloom Doctools!

2015-06-05 Thread Gerard Lally
At date and time Thu, 04 Jun 2015 12:32:55 -0700, Greg A. Woods wrote:

| At Thu, 04 Jun 2015 14:53:56 +0200, Johnny Billquist  
wrote:
| Subject: Re: Groff
| > 
| > On 2015-06-04 12:44, Robert Swindells wrote:
| > > 
| > > Johnny Billquist  wrote:
| > > 
| > > > What happened to the original roff? I mean, groff is just a gnu
| > > > replacement for roff. Maybe switch back to the original?
| > >
| > > The sources to all of DWB are available from AT&T:
| > >
| > > 
| > >
| > > It needs a bit of work to get it to build on NetBSD though.
| > 
| > Hmm. What about roff from 2.11BSD? That shouldn't be so hard to get
| > building on NetBSD...
| 
| Have my posts since 2009 about Heirloom Doctools somehow mostly going
| into a black hole or something!?!?!?!  I get responses of "yes, please!"
| on the lists, but nothing happens and people still keep posting truly
| lame suggestions as if they've never heard of Heirloom Doctools.  I
| posted about it in a response to this very thread just three days ago
| (though I redirected to tech-userlevel then too)!
| 
| Yes, sorry Johnny, but your suggestion really is poor.  Ancient troff,
| was a poor fit for "modern" use even 25 years ago with psroff to
| generate PostScript from its C/A/T output -- it's full of bugs and
| missing tons of features (beyond being device independent), and still
| written in what's basically PDP11 assembler dressed up as C (i.e. it's
| missing all of BWK's extensive rework), never mind that it's not
| actually in the original 2.11BSD release, which contains just Berkeley's
| bits (and the same small bits are in the 4.4BSD release too).
| 
| Heirloom Doctools _is_ the original troff, in its very latest form!
| (well, there's a fork on github that's got a bunch more bug fixes)
| 
| A better place to get the original troff, in modern form, with an
| open-source license would be Plan-9.
| 
| However Heirloom Doctools is equivalent to the Plan-9 version, but
| without Plan-9 dependencies, and with more fixes and features.
| I.e. Heirloom Doctools are the very most up-to-date code from the very
| people who wrote and maintained it since the beginning (sans Joe
| Ossanna, of course) .
| 
| Back before 2009 it already produced PDFs and handled UTF-8.
| 
| Heirloom Doctools already builds and works on NetBSD just fine, and
| has done so since before 2009 (advertised as working on 2.0 in 2007).
| 
| Heirloom Doctools is the essentially the complete set of tools from the
| AT&T Documenter's Work Bench suite -- i.e. it contains all the other
| _necessary_ pre-processors like eqn, pic, tbl, grap, refer, and vgrind,
| and it contains the back-end drivers and font tables for PostScript and
| PDF and other printers.  The only thing it's really missing are the
| papers from /usr/{share/}doc, but those are freely available elsewhere,
| including from the DWB release.
| 
| As I discussed back in 2009, Heirloom Doctools is essentially better
| quality and far more feature-full than the last DWB release, and
| arguably has a much better license, and of course DWB since 2009 is
| probably never going to see another public maintenance release now that
| Glen Fowler has retired.  The only thing DWB has over Heirloom Doctools
| is arguably better PostScript support (oh, and 'pm', but it's C++ :-)).
| 
| Why do people keep forgetting about it, and WTF are we still waiting for?

Can Peter Schaffter's mom macros[1] for groff be used with heirloom
troff? These macros turned groff into a much more user-friendly and
powerful typesetting system. The advantage of heirloom troff is that it
does paragraph-at-once formatting while groff is still restricted to
line-at-once formatting. Being able to use the mom macros in heirloom
troff would make for a powerful combination. A tiny memory footprint
producing documents almost on a par with those output by the much
bigger TeX (Thierry Laronde's KerTex excepted, of course!).

[1] http://www.schaffter.ca/mom/mom-01.html

-- 
Gerard Lally



Re: retrocomputing NetBSD style

2015-06-05 Thread Andrew Cagney
>>
>> GAW Wrote:
>> > I really don't understand anyone who has the desire to try to run
>> > build.sh on a VAX-750 to build even just a kernel, let alone the
>> > whole distribution.
>>
>> I recall a time where NetBSD/vax was broken for a long time because
>> everyone was cross-building; as soon as a native build was attemped,
>> the brokenness showed up.
>>
>> I native build on _everything_.  If it can't native build, it isn't
>> really part of my stable, so to speak.
>
> Yes, there is that issue!
>
> See, for instance, my recent posts comparing assembler output from
> kernel compiles done by the same compiler when run on amd64 vs. i386.
>
> However those are the kinds of bugs one might hope can be caught by
> decent enough regression tests of the compiler and its toolchain.

Could always set up the machine (or simulator) as a remote target and
run the cross-compiler against that; or perhaps that is a lost art :-(

Andrew


Re: Groff

2015-06-05 Thread Rhialto
On Thu 04 Jun 2015 at 08:05:16 +0300, Aleksej Saushev wrote:
> pages to a human-readable and human-writable format,

and

> which is XML,

in one sentence... Hahaha! XML and readable? No way.
Have you ever seen some document in Docbook?
> 
> 3. XML can be used immediately, without preprocessing step (just point
> web browser at it, and it will load stylesheet and perform XSL
> transformation for you).

XSLT is even worse. It is an abomination. XSL is totally unsuited for
writing programs. Its notation is completely unreadable and its
semantics are incomprehensible.

-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- The Doctor: No, 'eureka' is Greek for
\X/ rhialto/at/xs4all.nl-- 'this bath is too hot.'


pgpr5Lnq4tytd.pgp
Description: PGP signature