Commit Graph

36149 Commits

Author SHA1 Message Date
jmcneill
1b71b8280d Add helper functions for walking GTDT subtables. 2018-10-12 21:20:54 +00:00
jmcneill
53c2e439b1 Pull in sys/cpu.h for struct cpu_info and CPU_INFO_ITERATOR. 2018-10-12 21:19:11 +00:00
jmcneill
abc4d7ca98 Fix button type print; "type" is one of PSWITCH_TYPE_*, not ACPI_EVENT_*_BUTTON. 2018-10-11 22:58:36 +00:00
martin
7264592563 Bring back support for enhanced descriptor format in newer core versions.
Fix a few endian bugs and check the main core version before trying to
read the hardware feature mask. Only read the hardware feature register
if core version reported is >= 3.5 (all my older hardware reports 0).
With some hints and patches from jared, and ok from aymeric
2018-10-08 17:09:31 +00:00
christos
8e212b8902 Handle the SATA to USB external enclosure sold by "Sabrent" and
made by JMicro (vendor=0x152d product=0x0578). This bridge does
not understand FUA, so add a quirk for it.
2018-10-07 18:14:32 +00:00
mlelstv
4ceeb5eaf7 Use IO_DIRECT for file I/O to reduce buffer cache contention.
Restore old behaviour to flush pages only when usage exceeds 1MB.

No longer use PGO_SYNCIO, regular writes to the device do not require
the data to reach stable storage, the DIOCCACHESYNC ioctl is used
for that.
2018-10-07 12:00:07 +00:00
mlelstv
eff8919f63 Calculate a missing cylinder count in the geometry spec from image size. 2018-10-07 11:54:14 +00:00
mlelstv
803c93c66f Add flag to enforce file I/O even when bmap/strategy would be possible.
This makes it easier to compare both modes, it also allows coherent
operation between vnd device and image file.
2018-10-07 11:51:26 +00:00
skrll
40b6d94127 Provide an FDTBASE option which allows kernels to access FDT parsing
functions without requiring full blown FDTisation.

This will be used by ODROID-C1 in move to generic start code.
2018-10-06 16:28:21 +00:00
mlelstv
a448221580 Add ioctls to query geometry. 2018-10-06 14:59:11 +00:00
hannken
fef73d22c5 Bring back three state file system suspension:
NORMAL -> SUSPENDING -> SUSPENDED

and add operation fstrans_start_lazy() that only blocks while SUSPENDED.

Change vndthread() support operation handle_with_rdwr() to bracket
its file system operations by fstrans_start_lazy() and fstrans_done().

PR kern/53624 (dom0 freeze on domU exit)
2018-10-05 09:51:55 +00:00
msaitoh
4e37566079 Fix KASSERT to prevent panic on CNP(Intel 300 series + I219) with INTx
interrupt (Xen dom0 or pre netbsd-8).

XXX pullup-[78]
2018-10-05 08:23:58 +00:00
msaitoh
1df5c272a6 Use pci_intr_establish_xname(). 2018-10-05 05:37:49 +00:00
msaitoh
506ff96a4c Don't print extra newline if the PCI extended configuration space doesn't exist. 2018-10-04 07:43:12 +00:00
martin
48f888a08e Add support for Panasonic N5HBZ0000055, from David H. Gutteridge
in PR kern/53647.
2018-10-03 10:02:08 +00:00
martin
97bbb5eb6e Regen 2018-10-03 10:00:29 +00:00
martin
6420f59835 David H. Gutteridge in PR kern/53647: add Panasonic N5HBZ0000055
WiFi device.
2018-10-03 09:59:34 +00:00
msaitoh
01c97f9286 - Don't print TPH requester's ST Table Size if the ST table location field
is not PCI_TPH_REQ_STTBLLOC_TPHREQ because the size field is only applicaple
  for PCI_TPH_REQ_STTBLLOC_TPHREQ case.
- Add comment.
2018-10-03 06:46:09 +00:00
bouyer
704a6a18c7 Expand code covered by sc->sc_mtx, to make sure an interrupt would not be
handled before the cv_timedwait_sig() call, or while polling.
Seems to fix "sunxitwi0: send STOP failed" messages frequently seen related
to axp20x0 sensors.
2018-10-01 09:39:20 +00:00
jmcneill
0b6b611fe4 Suppress "not configured" message when no device is present 2018-09-30 15:44:22 +00:00
jmcneill
ebb89df1fe Fix 64-bit build 2018-09-29 15:56:25 +00:00
aymeric
65b11eda1e Revert the recent support for enhanced descriptors until a viable solution is
found.

It broke at least Cubietruck, Orange Pi One, and maybe Rock64 ethernets in
different ways. Unfortunately it works on my Olinuxino Micro and Lime 2 so I
can't reproduce the bugs for now.

Should fix PR#53637
2018-09-28 21:51:42 +00:00
msaitoh
2c9f9f4e93 Root Complex Event Collector Bus Number Association ECN.
- If capability version is 2 (or greater), decode RCEC Associated Bus Numbers
  register.
2018-09-27 07:09:29 +00:00
msaitoh
3e1e7ef885 Don't set LRO capability flags because we don't support it yet.
This doesn't change any behavior other than if_capabilities' visibility
(e.g. ifconfig).
2018-09-27 05:40:27 +00:00
manu
fd1575217d Fix hdaudio device configuration
When disabling unassociated devices, we have a special handling
for pins of type COP_AWCAP_TYPE_PIN_COMPLEX, but it came after code
that may disable any pins, including the ones that should be handled
as COP_AWCAP_TYPE_PIN_COMPLEX.

The result was that hdaudio could fail to detect some devices.  We
fix the situation by making sure that COP_AWCAP_TYPE_PIN_COMPLEX
pins always get their specific handling.

The change makes the built-in speaker work on Dell OptiPlex 5060
2018-09-27 01:18:11 +00:00
jakllsch
7079c61c32 match spdmem_i2c on "atmel,spd" compatible string 2018-09-26 20:15:08 +00:00
jakllsch
31eb212203 Set "i2c-indirect-config" to false in the right place so that iic(4)
better behaves itself.
2018-09-26 20:03:36 +00:00
jakllsch
6f07e5262f Add dwiic_fdt attachment for "snps,designware-i2c". 2018-09-26 19:06:33 +00:00
jakllsch
6615e1568e Sync with OpenBSD src/sys/dev/ic/dwiic.c r1.4.
Makes split command+data write operations in the exec() function work.
2018-09-26 18:32:51 +00:00
jakllsch
c4dbefb5b4 Correctly use device_printf() rather than aprint_error_dev() for errors
that can occur at runtime.
2018-09-26 18:06:59 +00:00
bouyer
4d36eda8b0 Introduce wsdisplay_isconsole(struct wsdisplay_softc *), which
returns sc->sc_isconsole
2018-09-26 09:04:12 +00:00
jakllsch
a12c8a44e6 return 0 on success of dwiic_i2c_acquire_bus(), not 1 (failure) 2018-09-25 16:29:41 +00:00
nakayama
276930195c pad(4) mixer has only 1 channel, so return EINVAL in the case other than 1.
This fixes the following strange output of mixerctl(1):

        outputs.master=255,0
        inputs.dac=255,0
2018-09-25 06:55:23 +00:00
nakayama
3718cdade0 Revert to rev.1.53.
I accidentally committed the netbsd-8 branch file in rev.1.54.
2018-09-25 06:53:49 +00:00
kre
2ed63bfbf6 Since we need an int paramater, and uio_resid is size_t cast it to int
to avoid warnings from the ever friendly compiler... (check that size if
in range was already made).
2018-09-23 23:34:45 +00:00
kre
233da0ae1f Open code min() so we don't need to find its prototype ... 2018-09-23 23:30:51 +00:00
nakayama
1950bffe53 pad(4) mixer has only 1 channel, so return EINVAL in the case other than 1.
This fixes the following strange output of mixerctl(1):

	outputs.master=255,0
	inputs.dac=255,0
2018-09-23 21:18:30 +00:00
jmcneill
76af637362 Support rescan and child detachment 2018-09-23 19:32:03 +00:00
maxv
ebec90347e Remove ISDN from the kernel. It has remained unmaintained for a long time,
is of poor quality, and is now an obstacle to MP-ification. It was removed
ten years ago from FreeBSD for the same reason.

This retires a big user of the mbuf API, and will ease maintenance of the
kernel.
2018-09-23 09:20:57 +00:00
maxv
89453def58 Remove isic(4). It is part of ISDN, which we are now retiring. 2018-09-22 16:22:22 +00:00
maxv
217f541c2d Unreference iwic (now removed), forgot that. 2018-09-22 12:56:16 +00:00
maxv
7210117d62 Remove iwic(4). It is part of ISDN, which we are now retiring. This driver
was still marked as experimental (its man page dates back to 2002).
2018-09-22 12:41:00 +00:00
maxv
cb736bae86 Remove the "ifritz" driver (no man page). It is part of ISDN, which we are
retiring.
2018-09-22 12:26:27 +00:00
maxv
a48d481e84 Remove ifpci(4). It is part of ISDN, which we are retiring. 2018-09-22 12:19:11 +00:00
nakayama
b2613a2ff5 ixg and ixv depend on mii and mii_phy. 2018-09-22 05:24:22 +00:00
maxv
ff948ad040 Remove iavc(4). 2018-09-21 18:38:25 +00:00
khorben
8a9c018cb1 Prevent a panic in umb(4) when roaming is disabled
From OpenBSD.
2018-09-20 09:48:54 +00:00
khorben
c7216ffc4d Use usb_rem_task_wait() now that it is available
This should avoid panics while detaching devices.
2018-09-20 09:45:16 +00:00
jmcneill
459047f448 Use machdep.cpu for the first instance 2018-09-20 09:19:56 +00:00
jmcneill
7eaa7ef21d Add support for RK805 2018-09-20 09:02:46 +00:00
mlelstv
289f3a91a7 getdisksize only operates on device vnodes. Use the ioctl on the underlying
device instead.
2018-09-20 07:18:38 +00:00
maxv
9d7954dab6 Remove daic(4), it has never been functional.
ok martin@
2018-09-19 13:58:26 +00:00
jdolecek
caac3a6421 fix ata_xfer leak on drive probe 2018-09-18 21:28:22 +00:00
uwe
f2a23f2810 Clarify the comment in the "unconst" version of hpckbd_keymap_setup.
Both sh3 (P1) and mips (kseg0) have the kernel directly mapped.
2018-09-18 14:57:32 +00:00
uwe
4be5e413fc Fix comment formatting in previous. 2018-09-18 09:09:26 +00:00
mrg
5fd899306d fix wsdisplay/wskbd and cngetc() return value issues:
- return -1 for error / no character
- allow 0 as a character

cngetc() itself considers any value >= 0 valid, and this matches
the usage in other drivers that return -1 for "not data", vs
polling until something arrives.

removes ^G from spewing out the askname/etc prompts when no key
has been pressed (these come from cngetsn(), ignoring unknown
non printable characters.)

from @skrll with help from @mlelstv.
2018-09-18 06:19:28 +00:00
mrg
ce7cf81a7e 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.
2018-09-18 05:37:54 +00:00
mrg
bf4930390e 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
2018-09-18 05:24:10 +00:00
rin
0a7ec1b328 Apply workaround introduced in r1.32 to hpcmips.
Fix kernel crash when console is attached. Now, my MC/R550 boots multiuser.

Thanks Masahiko Ito for encouraging me to do bisection to find this out.

XXX pullup-8, pullup-7
2018-09-18 02:58:10 +00:00
mrg
2375cb2fb0 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().
2018-09-18 02:00:06 +00:00
mrg
275f5ff63e 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.
2018-09-18 01:36:44 +00:00
aymeric
33f05017e8 Add support for the enhanced descriptors feature.
This makes "recent" dwc gmac controllers, as found e.g. on the Cyclone V, work.
The change was also tested working on an Allwinner A20 which doesn't have the
feature.

No negative reaction on port-arm.
2018-09-17 20:25:49 +00:00
mrg
cbde71dbbb reorder some struct members to remove holes. 2018-09-17 08:27:41 +00:00
mrg
85526a327c don't print a blank line that ends up in logs and console output. 2018-09-16 23:20:18 +00:00
mrg
b627726203 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.
2018-09-16 20:21:56 +00:00
mrg
b180551746 avoid __diagused. 2018-09-16 10:29:39 +00:00
skrll
713f51737a interrupt has two 'r's
fix another typo while I'm here (flsah)
2018-09-16 09:25:46 +00:00
rin
6391ba3d30 Style. No functional changes. 2018-09-16 02:00:36 +00:00
rin
b79058d601 Check range of EEPROM address rather truncate implicitly. 2018-09-16 01:56:29 +00:00
rin
c1d4c3b495 Correct nonsense message in KASSERTMSG. 2018-09-16 01:44:11 +00:00
rin
c2482958e2 - Style (total_len ---> totlen).
- Fix printf format (totlen is unsigned).
2018-09-16 01:41:28 +00:00
rin
f1ec6c2114 Do not turn on IFF_OACTIVE if transfer fails.
Remove redundant error message.
2018-09-16 01:29:28 +00:00
rin
3b4ff95765 Drop wrong KASSERT; we don't need TCP headers here. 2018-09-16 01:27:21 +00:00
rin
fd65daa9df Rewrite mue_encap(); drop too long packets rather than panic. 2018-09-16 01:23:09 +00:00
rin
337f02b78e Allow ethernet frame with VLAN tag. 2018-09-16 01:18:30 +00:00
rin
254c2fea1f Correct lower bound of RX packet length; don't forget FCS. 2018-09-16 01:13:26 +00:00
rin
941621605c - Improve error messages.
- Switch from debug printf to normal printf for real errors.
2018-09-16 01:07:38 +00:00
rin
0ba488d9d4 Use proper integer types. 2018-09-16 00:58:47 +00:00
rin
59ee5c0ac5 Style. No binary changes. 2018-09-16 00:55:16 +00:00
jakllsch
6a84e9bccb fdtvar.h: Use _KERNEL_OPT wrapper where necessary. 2018-09-15 13:42:41 +00:00
jakllsch
8262d5806f msk(4): add 64-bit DMA support
portions of this change set provided by mrg@
2018-09-14 18:46:47 +00:00
msaitoh
1f5c6814c6 - Fix a bug that Denverton accessed wrong register in
ixgbe_setup_low_power_mode(). The location of some registers in Denverton
  were changed. The GRC register is one of them, so use IXGBE_GRC_BY_MAC(hw)
  instead of IXGBE_GRC.
- ixgbe_check_wol_support() tests the capability of WOL, but the sysctl
  knobs for WOL were added only for IXGBE_DEV_ID_X550EM_X_10G_T. Add the
  knobs when adapter->wol_support is not 0.

XXX pullup-8
2018-09-14 09:51:09 +00:00
christos
60d3fae6ae Don't have modules depend on bpf; they will find the dependency dynamically
at runtime. Otherwise builtin modules will complain about non-builtin bpf.
2018-09-12 21:57:18 +00:00
jakllsch
b961019252 if_msk: detach/reattach fixes
- Fill in sc->sk_bsize upon pci_mapreg_map() so that we'll correctly
   bus_space_unmap() on detach.
 - Clear sc->sk_intrhand after interrupt disestablish, to prevent
   disestablishing unestablished interrupt.
2018-09-12 13:52:36 +00:00
mrg
2e49bfcbfb use pa_dmat64 if pci_dma64_available(). 2018-09-12 09:49:03 +00:00
msaitoh
15dcfcae4f Add ATS Relaxed Ordering supported bit described in Address Translation
Relaxed Ordering ECN.
2018-09-12 07:42:21 +00:00
msaitoh
6999f5bea0 Fix comment. 2018-09-12 05:03:05 +00:00
msaitoh
09defd7cc8 - Try m_defrag() to reduce the number of DMA segment if bus_dmamap_load_mbuf()
returned EFBIG. When m_defrag() is called, txqNNdefrag event counter is
  incremented. If the 2nd try of bus_dmamap_load_mbuf() failed, txqNNtoomanyseg
  event counter is incremented.

- Reduce the max number of DMA segemts from 256 to 64 (it's the same valuse
  as other BSD's (EM_MAX_SCATTER) and more than before if_wm.c rev. 1.75's
  value (40)) because we do m_defrag() now.
2018-09-12 04:59:26 +00:00
msaitoh
ecc67856aa - Split txdrop evcnt into pcqdrop and descdrop.
- Simplify evcnt name by removing duplicated "tx" or "rx".
- s/tu/underrun/
2018-09-12 04:37:18 +00:00
mrg
fd52598385 use pci_mapreg_type() instead of assuming PCI_MAPREG_TYPE_MEM.
suggested by riastradh@.

fixes hdaudio on thinkpad P51 where the registers are mapped
over 4GB range.  probably fixes intel X10-based systems that
map hdaudio high as well, but i was able to work around that
in the BIOS.  not so for the P51.

XXX: pullup-7, pullup-8.
2018-09-12 03:23:38 +00:00
jmcneill
fa8f1d440c Attach cpu nodes with status "disabled" if they have an enable-method
property. This is a valid configuration according to the devicetree
specification.
2018-09-09 21:15:21 +00:00
jmcneill
5ad7c977bd Add fdt_add_bus_match, which is like fdt_add_bus but allows for the caller to filter child nodes on their own 2018-09-09 21:14:04 +00:00
aymeric
51b425ef08 Pass clock provider's phandle to fdtbus_clock_controller_func.decode()
and update callers.

This allows to accomodate clock managers whose clocks are identified
directly by a clock instead of a pair (clock provider, index).

ok jmcneill@ on port-arm
2018-09-09 07:21:17 +00:00
mlelstv
bd1f3f76ac Make smsc(4) MPSAFE. Patch from skrll@. 2018-09-08 13:10:08 +00:00
jmcneill
f092d0ca97 Add fdtbus_intr_establish_raw and fdtbus_intr_str_raw, for establishing
interrupts directly using an interrupt controller's phandle and specifier.
2018-09-06 22:54:05 +00:00
msaitoh
2e2af9a8fa Fix a bug that ixgbe_mq_start(an if_transmit function) returned wrong
vaue on error. pcq_put returns false on error, so returning it to caller
indicated no error.

XXX pullup-8
2018-09-06 08:20:12 +00:00
maxv
6c90bd5a8d Retire the 'midway' driver. Discussed on tech-net@ recently and also three
years ago, part of removing the network ATM code.
2018-09-06 05:36:49 +00:00
jmcneill
58e62e22aa Use PRIx64 (fixes 64-bit build) 2018-09-03 23:19:01 +00:00
jmcneill
254a9a348e Add generic AHCI SATA controller bus glue 2018-09-03 23:15:12 +00:00
riastradh
d1579b2d70 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!)
2018-09-03 16:29:22 +00:00
maya
864097d489 Initialize if_stop so suspend won't jump to NULL. 2018-09-02 19:46:53 +00:00
jmcneill
35517e5ce1 Add driver for Rockchip RK808 Power Management IC. 2018-09-02 01:16:58 +00:00
jmcneill
af0c930185 Don't print an error message for shared opp tables 2018-09-01 23:41:16 +00:00
riastradh
3ac319b184 bwfm has only one tx descriptor; limit mbuf chains to one segment.
PR kern/53287

Can't use m_defrag because it always yields two segments.

Discussion on tech-net:
https://mail-index.netbsd.org/tech-net/2018/09/01/msg007031.html

Diagnosed and tested by maya.
2018-09-01 22:01:03 +00:00
jmcneill
bd8cd1136e Add support for opp-v2 tables and multiple instances of the cpufreqdt
driver.
2018-09-01 19:36:53 +00:00
mlelstv
4e28deebe1 fix diagnostic build. 2018-09-01 09:57:12 +00:00
mlelstv
0b4ba8daf5 Wait in detach if the discovery thread is still running. Avoids crashes
when a device is attached/detached rapidly.
2018-09-01 07:20:29 +00:00
mlelstv
43a5ce6146 Make wdcdebug_atapi_mask configurable like the other debug variables. 2018-09-01 07:19:19 +00:00
jdolecek
d3cc8201fb one less 2018-08-31 18:44:04 +00:00
jdolecek
5705ba588f constify mvsata_pci_products[] 2018-08-31 18:43:29 +00:00
rin
6beeab4ca6 Convert debug printf to KASSERTMSG for check of RX buffer length.
Also turn KASSERT into KASSERTMSG for that of TX buffer.
2018-08-31 11:21:00 +00:00
jakllsch
d618b4a1c8 silence "not known to be supported" message for all version 1.x xHCIs 2018-08-30 13:13:24 +00:00
rin
61e1d7f4ae Check buffer length before copy. 2018-08-30 09:59:12 +00:00
rin
78b69985c0 Support added for TCP segmentation offload (TSO).
Improve TX performance around 10% if enabled.
2018-08-30 09:00:08 +00:00
rin
a498596f74 Note added for a strange value of residual counts in successful read/write.
Seems like a H/W bug. The best thing we can do would be to leave the code as is.

No binary changes.
2018-08-29 16:51:51 +00:00
jmcneill
8a2d1497e7 Initialize transition slew rate if specified in the DT 2018-08-29 11:08:30 +00:00
hannken
bdbfbc99b0 Add two new states FSS_CREATING and FSS_DESTROYING and use them
while creating or destroying a snapshot.

Remove now unneeded sc_lock that made fss_ioctl mutually exclusive.

Fss_ioctl no longer blocks forever because a snapshot gets
created or destroyed.

Serialize snapshot creation and make it interruptible.
2018-08-29 09:04:40 +00:00
hannken
1624e66471 Convert flags FSS_ACTIVE and FSS_ERROR into new member sc_state
with states FSS_IDLE, FSS_ACTIVE and FSS_ERROR.

No functional change intended.
2018-08-29 09:04:03 +00:00
msaitoh
17a63b5d7a Fix a bug that media change may fail. I noticed that ifconfig ixgN media XXX
took a 10 or more seconds on a Denverton machie. I occurred by trying take a
lock and timed out. The reason was that ixgbe_media_change() didn't take
CORE_LOCK. Do it.

 This problem was from FreeBSD's pre-iflib ixgbe (I don't know whether this
problem really occurs on FreeBSD or not). Post-iflib ixgbe has no problem
because iflib_media_change() takes a lock.

XXX pullup-8
2018-08-29 09:03:14 +00:00
jmcneill
a61e0fbcba Add driver for Silergy SY827/SY828 step down regulator. 2018-08-29 01:57:38 +00:00
rin
2e56c8b44a Check ifp->if_capenable, not ifp->if_capabilities, when enable some features.
Not a real problem since ifp->if_capabilities = 0 at the moment.
2018-08-27 14:59:04 +00:00
riastradh
6f5b5d2a36 Fill struct agp_info::ai_devid with the PCI id. 2018-08-27 07:34:54 +00:00
riastradh
6ff71a6f22 Restore gtt page table control register on resume.
Additional subroutine agp_i810_reset is used by i915drmkms to make
sure it happens early enough, since i915drmkms resumes before agp.

XXX pullup-7
XXX pullup-8
2018-08-27 00:51:37 +00:00
rin
559388397c Add mue(4), driver for Microchip LAN75xx/LAN78xx known as internal NIC of
Raspberry Pi 3 B+, from OpenBSD.

Tested on Raspberry Pi 3 B+ (LAN7800) and Z-TEK ZE582 (LAN7500).

* BUGS/TODO

- If the media type is set to something other than 1000baseT-FDX, data
  transmission becomes quite unstable. Also, ukphy(4) recognize 1000baseT as
  a supported media type, but it is not in fact.

- Catch up with changes made to usmsc(4) in nick-nhusb branch, i.e.,
  make the driver MP-safe.

- Support RX/VLAN/TX chekcsum offloading.
2018-08-25 20:12:21 +00:00
maxv
2ec2a169a3 Retire NDIS. It appears that it has never worked, after 13 years it was
still marked as "experimental", and nowadays it may be one more obstacle
to MPification of the network stack.

Discussed on tech-net@.
2018-08-25 07:48:56 +00:00
jmcneill
8256152684 Add of_getprop_uint64 2018-08-23 13:24:44 +00:00
maxv
de34ad68d6 Fix buffer overflow, detected by kASan.
[    1.044878] kASan: Unauthorized Access In 0xffffffff804ec7e2: Addr 0xffffffff818a51e4 [2 bytes, read]
[    1.044878] #0 0xffffffff804ec7e2 in mskc_probe <netbsd>
[    1.044878] #1 0xffffffff80e92a77 in mapply <netbsd>
[    1.044878] #2 0xffffffff80e92e5f in config_search_loc <netbsd>
[    1.044878] #3 0xffffffff80e93fb5 in config_found_sm_loc <netbsd>
[    1.044878] #4 0xffffffff802ca9ea in pci_probe_device <netbsd>
[    1.044878] #5 0xffffffff802cad97 in pci_enumerate_bus <netbsd>
[    1.044878] #6 0xffffffff802caf00 in pcirescan <netbsd>
[    1.044878] #7 0xffffffff802cb1ee in pciattach <netbsd>
[    1.044878] #8 0xffffffff80e93e5b in config_attach_loc <netbsd>
[    1.044878] #9 0xffffffff80e93fce in config_found_sm_loc <netbsd>
[    1.044878] #10 0xffffffff80271212 in mp_pci_scan <netbsd>
[    1.044878] #11 0xffffffff8022d9ee in mainbus_attach <netbsd>
[    1.044878] #12 0xffffffff80e93e5b in config_attach_loc <netbsd>
[    1.044878] #13 0xffffffff8021e38b in cpu_configure <netbsd>
[    1.044878] #14 0xffffffff814a7068 in main <netbsd>
2018-08-23 11:53:15 +00:00
msaitoh
f45d53144a Regen. 2018-08-23 05:19:11 +00:00
msaitoh
561e3fb162 - Add C62x to the descriptions of Intel C620 series devices.
- Add 0xa1ca for Intel C629 LPC or eSPI.
2018-08-23 05:18:45 +00:00
riastradh
ce78ed4e7f Suspend the getrfkill thread while we're suspended.
Otherwise it tries to futz with device registers, which doesn't work,
and who knows, maybe is bad.
2018-08-20 04:50:56 +00:00
riastradh
16f08e23ae What we have created, we must destroy. 2018-08-20 02:33:17 +00:00
skrll
e2ddbcb5ea Remove useless header arm/broadcom/bcm2835reg.h
From Aymeric Vincent on port-arm
2018-08-15 07:46:15 +00:00
mrg
444fbe2a79 - add commented entries that exist in amd64 GENERIC: oboe, mos, umb.
(XXX: mos might be deleteable now?).
- comment uscanner(4) -- usb scanners use ugen(4) interface.
- minor sort.
2018-08-13 17:35:31 +00:00
jmcneill
cdd95abb51 Add support for RK3399 2018-08-12 19:10:14 +00:00
jmcneill
e54cae7795 Use more generic rk3288 compatible string, and do clock assignments when present 2018-08-12 16:34:28 +00:00
jmcneill
69bb614b1d Register shutdown handlers 2018-08-12 16:33:58 +00:00
rin
e868280e94 Add missing __KERNEL_RCSID. 2018-08-12 06:02:38 +00:00
rin
e6d192f476 regen. 2018-08-12 04:19:31 +00:00
rin
07b51ce8c1 Add SMSC LAN7505 USB 2.0 gigabit ethernet device. 2018-08-12 04:17:54 +00:00
jdolecek
be7eb61c6b fix race in wd_lastclose() on systems with two ide disks on same
channel, which happened when one disk had pending I/O while the other
disk executed the final disk flush - need to restart bufq processing
once xfer is freed in this case

it could happen e.g. on boot when system executes fsck on different
partitions on the two drives in parallell and hence open and closes
the disk devices repeatedly

add KASSERT() for empty bufq on wd_lastclose(), and fix similar issue
also on suspend/standby path

this was introduced by the NCQ merge and not dksubr - before the merge
each drive had their own xfer, so they could not block each other

fixes PR kern/52783 by Onno van der Linden; many thanks for extensive
help with tracking this down
2018-08-10 22:43:22 +00:00
riastradh
de7ebfbfbb Don't hold up boot: defer acpibat(4) inquiry until threads are running.
ok jmcneill@
2018-08-10 17:11:56 +00:00
prlw1
f7de34c5d7 whitespace 2018-08-09 21:23:23 +00:00
prlw1
0a9d9aef68 Sprinkle __diagused 2018-08-09 21:16:43 +00:00
jakllsch
85d1c65a6d fix DIAGNOSTIC build by not copying ub_usepolling to stack before use 2018-08-09 18:17:39 +00:00
msaitoh
fb08723998 Fix two bugs for non-SERDES fiber. Tested on 82544EI(0x1009), 82545GM(0x1027),
82546GB(0x107a), 82571GB(0x105f), 82572EI(0x107e). Tested on SERDES
82580(0x150e (Winyao SERDES SFP)) and 82580(0x150e) as regression test:

- Fix a bug that the link can't detect in link interrupt function for
  non-SERDES fiber. When the signal is detected & STATUS_LU == 0 & RXCW == 0,
  it's required to set CTRL_SLU and CTRL_FD bit. wm_check_for_link() is the
  function to do it. If a link status change interrupt occured, call
  wm_check_for_link() before checking current link staus.
- Fix a bug that 82542 misunderstand fiber's signal detection. CTRL_SWDPIN(1)
  is used for fiber's signal and it's value is reversed only on 82543 and
  82544. Simplify the code and move it into a new function wm_tbi_havesignal()
  and use it.
2018-08-09 16:27:23 +00:00
mrg
05774bb7a7 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.
2018-08-09 06:26:47 +00:00
maya
a0a7b72761 Remove NetOctave NSP2000 support
This code has bitrotted - it hasn't been adjusted from the old module
framework.

Discussed on tech-kern:
https://mail-index.netbsd.org/tech-kern/2018/07/10/msg023638.html
2018-08-08 21:00:28 +00:00
msaitoh
37bfea848b Add MDIC_WA and CLSEMWA to snprintb() string for WM_F_* flags. 2018-08-08 03:15:18 +00:00
jdolecek
6d0fcbdb88 add wddebug() which dumps some status for attached disks; indended for
debugging of PR kern/52783
2018-08-06 20:07:05 +00:00
skrll
224d0a81a5 Fix build 2018-08-03 13:19:33 +00:00