Home | History | Annotate | Download | only in kern
History log of /src/sys/kern/subr_userconf.c
RevisionDateAuthorComments
 1.27  16-Sep-2018  mrg 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.)
 1.26  23-Dec-2013  skrll branches: 1.26.22; 1.26.28; 1.26.30;
Remove local getsn and use cngetsn.
 1.25  01-Aug-2011  drochner branches: 1.25.2; 1.25.12; 1.25.16;
modify parsing of device names so that it can deal with names which
have numbers is it, eg "i915drm*"
 1.24  31-May-2011  dyoung Don't use the C preprocessor to configure USERCONF. Instead, either do
or do not link in subr_userconf.c and x86_userconf.c.

Provide no-op stubs for userconf_bootinfo(), userconf_init(), and
userconf_prompt().

Delete all occurrences of #include "opt_userconf.h" as well as USERCONF
and __HAVE_USERCONF_BOOTINFO #ifdef'age.
 1.23  26-May-2011  uebayasi Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.

From jmmv@, no objections seen in the proposed thread:

http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html
 1.22  24-May-2011  joerg Use proper format string
 1.21  24-Apr-2011  rmind - Replace few malloc(9) uses with kmem(9).
- Rename buf_malloc() to buf_alloc(), fix comments.
- Remove some unnecessary inclusions.
 1.20  12-Sep-2010  drochner branches: 1.20.2;
improve "const" consistency
 1.19  20-Oct-2009  snj branches: 1.19.2; 1.19.4;
Follow upstream's lead and remove third and fourth clauses (except on
from usr.sbin/mopd/common/pf.c, where only the ad clause is removed,
because it has a shared UCB copyright) on Mats O Jansson's files.

thorpej OK'd usr.sbin/rpc.yppasswdd/yppasswdd_mkpw.c, where he shares
copyright.
 1.18  11-Dec-2005  christos branches: 1.18.74;
merge ktrace-lwp.
 1.17  08-Sep-2005  drochner make use of the locator information: print "?" if a locator is
at its default value, and accept "?" in the "change" command
 1.16  25-Aug-2005  drochner Replace the "locnames", attached to cfdata, which was solely good for
userconf, by more complete information (including default values) about
interface attributes, attached to the drivers which provide them.
 1.15  23-Jun-2005  thorpej branches: 1.15.2;
Use ANSI decls, liberally apply static.
 1.14  29-May-2005  christos - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
 1.13  26-Feb-2005  perry nuke trailing whitespace
 1.12  21-Apr-2004  itojun branches: 1.12.4; 1.12.6;
kill sprintf, use snprintf
 1.11  23-Mar-2004  junyoung Nuke __P().
 1.10  22-Oct-2002  simonb branches: 1.10.6;
Remove some variables that are set but not used.
 1.9  04-Oct-2002  thorpej Overhaul the way cfattach structures are looked up. The cfdata entry
now carries the name of the attachment (e.g. "tlp_pci" or "audio"),
and cfattach structures are registered at boot time on a per-driver
basis. The cfdriver and cfattach pointers are cached in the device
structure when attached.
 1.8  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.7  26-Sep-2002  thorpej Overhaul the way parent attachments are specified; instead of using
a vector of indices into the cfdata table to specify potential parents,
record the interface attributes that devices have and add a new "parent
spec" structure which lists the iattr, as well as optionally listing
specific parent device instances.

See:

http://mail-index.netbsd.org/tech-kern/2002/09/25/0014.html

...for a detailed description.

While here, const poison some things, as suggested by Matt Thomas.
 1.6  23-Sep-2002  simonb Remove breaks after returns, unreachable returns and returns after
returns(!).
 1.5  12-Nov-2001  lukem add RCSIDs
 1.4  18-Jul-2001  thorpej branches: 1.4.2; 1.4.6;
bcopy -> memcpy
 1.3  03-Jul-2001  itojun branches: 1.3.2;
remove a #ifdef __OpenBSD__ segment.
 1.2  02-Jul-2001  itojun typo (should we get rid of this portion?
 1.1  01-Jul-2001  gmcgarry In-kernel device configuration manager - allows modification
of device locators at run-time.

Written by Mats O Jansson <moj@stacken.kth.se>. Reworked by
Jun-ichiro itojun Hagino <itojun@netbsd.org>.
 1.3.2.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.3.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.3.2.1  03-Aug-2001  lukem update to -current
 1.4.6.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.4.2.5  11-Nov-2002  nathanw Catch up to -current
 1.4.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.4.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.4.2.2  24-Aug-2001  nathanw Catch up with -current.
 1.4.2.1  18-Jul-2001  nathanw file subr_userconf.c was added on branch nathanw_sa on 2001-08-24 00:11:37 +0000
 1.10.6.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.10.6.4  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.10.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.6.1  03-Aug-2004  skrll Sync with HEAD
 1.12.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.12.4.1  29-Apr-2005  kent sync with -current
 1.15.2.1  21-Jun-2006  yamt sync with head.
 1.18.74.2  09-Oct-2010  yamt sync with head
 1.18.74.1  11-Mar-2010  yamt sync with head
 1.19.4.3  12-Jun-2011  rmind sync with head
 1.19.4.2  31-May-2011  rmind sync with head
 1.19.4.1  05-Mar-2011  rmind sync with head
 1.19.2.1  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.20.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.25.16.1  18-May-2014  rmind sync with head
 1.25.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.25.2.1  22-May-2014  yamt 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")
 1.26.30.1  10-Jun-2019  christos Sync with HEAD
 1.26.28.1  30-Sep-2018  pgoyette Ssync with HEAD
 1.26.22.1  27-Sep-2018  martin 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.

RSS XML Feed