Commit Graph

6650 Commits

Author SHA1 Message Date
bouyer 909c025826 Don't print an error message on spurious interrupt. Way too noisy for Xen. 2020-06-03 18:25:26 +00:00
jdolecek 1f937b3fb2 discussed with thorpej@, and it seems it's better to allocate the bss
alignment buffer statically (as part of softc) just to be sure to not
affect performance
2020-05-30 15:55:47 +00:00
jdolecek 6f9c6cfca3 reduce stack usage in bwfm_rx_event_cb(), can use KM_SLEEP because
this is called from workqueue handler (i.e. thread context)
2020-05-30 14:03:08 +00:00
jdolecek 4de17f98a0 constify, and make static where possible 2020-05-30 13:41:58 +00:00
jdolecek cd91c1ceb5 fix wdcprobe_with_reset() to avoid allocating big structures on stack 2020-05-30 13:23:14 +00:00
rin 4f34027fb8 Make this compile again. Not tested. 2020-05-29 09:05:19 +00:00
martin c7910501de Make the readahead-while-sending-output code conditional in
com_common_putc(), only erquest readahead before interrupts are enabled
and when called from comcnputc().
Fixes PR kern/55286.
2020-05-26 13:24:52 +00:00
jmcneill a004389994 Improve RGMII TX / RX delay handling, from OpenBSD. 2020-05-25 19:49:28 +00:00
jdolecek 2e18c54978 in wdctimeout(), do not schedule another timeout handler, as that only
creates race with eventual xfer resubmission - the c_intr()
method does all the necessary handling, including re-scheduling of the
timeout handler if appropriate

also make sure to clear ATACH_IRQ_WAIT before calling c_intr(), same
as real interrupt does; this is important so that eventual spurious timeout
would not interfere with xfer handling in the atabus thread

fixes another race in the atabus thread found by KASAN, reported by Paul Ripke
2020-05-21 09:24:17 +00:00
jdolecek 7992db9e07 in wdctimeout() ignore timeout if not actually waiting for IRQ, to avoid
processing xfer which is not quite setup

in wdcintr() actually write the error message on invocation when
not waiting for IRQ even without ATADEBUG option, as usually that
is a driver bug; might revisit this if this ends up too noisy for
PCI-IDE which seems to ignore WDCTL_IDS and hence trigger irq even
for polled commands
2020-05-19 08:21:29 +00:00
jdolecek 9b3441ff46 only start the timeout machinery once the I/O is completely setup
and successful, particularly after PIO write is finished

fixes crashes in case the setup is so slow that timeout is triggered
e.g. while still waiting in wdc_wait_for_unbusy() or shortly after, without
drive actually having chance to complete the I/O, as seen in some
configuration under QEMU by Paul Ripke
2020-05-19 08:08:51 +00:00
msaitoh af38bc1427 Fix typo in comment. 2020-05-18 05:47:54 +00:00
chs 17e5d3c866 Mask all the MMC counter interrupts if the MMC module is present. 2020-05-17 21:50:47 +00:00
ad 9d5d6dbf80 Store initial TSC/HPET readings for hpet0 only. 2020-05-16 23:06:40 +00:00
maxv 723dead3ea hardclock_ticks -> getticks() 2020-05-15 19:28:09 +00:00
jdc 93f83d92b2 Make the driver endian-independent.
Add a quirk so that the bus front end can specify 1-bit only mode.
Remove unused isa includes.
Change the error returned for unsupported opcodes to ENOTSUP, so that
we can pass this back to sdmmc_mem, where it's handled since r1.72 of
  src/sys/dev/sdmmc/sdmmc_mem.c
2020-05-11 14:55:20 +00:00
ad 3187bd1ecb Fix the TSC timecounter (on the systems I have access to):
- Make the early i8254-based calculation of frequency a bit more accurate.

- Keep track of how far the HPET & TSC advance between HPET attach and
  secondary CPU boot, and use to compute an accurate value before attaching
  the timecounter.  Initial idea from joerg@.

- When determining skew and drift between CPUs, make each measurement 1000
  times and pick the lowest observed value.  Increase the error threshold to
  1000 clock cycles.

- Use the frequency computed on the boot CPU for secondary CPUs too.

- Remove cpu_counter_serializing().
2020-05-08 22:01:54 +00:00
tsutsui 9b81b6d763 Add bitmap access ops support for EVRX framebuffer on HP9000/425e.
8bpp Xorg wsfb server and mlterm-wscons (formerly mlterm-fb) work.
No particular comment on port-hp300@ and port-hppa@:
 https://mail-index.netbsd.org/port-hp300/2020/05/02/msg000170.html

Special thanks to Miod Vallat, for his advice about HP-UX implementation
and binutils patches to disassemble old HP-UX a.out-hp300hpux binaries
(and also contributing his 425e back in 2014).
2020-05-04 06:52:53 +00:00
simonb a7fbf566cf Get rid of needless __predict_true() and move a comment slightly. 2020-05-01 07:27:51 +00:00
riastradh d4d6cae1b0 Zero rndsource before using it.
XXX pullup
2020-05-01 01:34:57 +00:00
riastradh 4df5e81c43 rnd_attach_source calls the callback itself now.
No need for every driver to explicitly call it to prime the pool.

Eliminate now-unused <sys/rndpool.h>.
2020-04-30 03:40:52 +00:00
jmcneill 691963c205 Add missing receive error status bit definitions, from Robert Sprowson in
PR# kern/55199
2020-04-25 10:21:41 +00:00
ad e2a03ec54a On attach figure out how long a single read of the counter register takes
and use that for the adjustment in hpet_delay().
2020-04-24 23:29:17 +00:00
ad 6dfea3c27b BUS_SPACE_MAP_PREFETCHABLE yields a write combining region on x86 and that's
not what I intended.. BUS_SPACE_MAP_CACHEABLE is enough.
2020-04-24 22:31:35 +00:00
ad 6e5d662f34 On attach figure out how long a single read of the counter register takes
and use that for the adjustment in hpet_delay().
2020-04-24 22:25:07 +00:00
ad e5210a69c7 Implement a HPET based DELAY(). 2020-04-23 20:33:57 +00:00
rin 72d26a2dda Revert previous for now:
http://mail-index.netbsd.org/source-changes/2020/04/16/msg116278.html

The reasoning turned out to be wrong; __KERNEL_RCSID() in header files
does *not* overwrite RCSID in main source files. The real problem is that
it inserts its RCSID into *every* object files. However, it can be still
useful even if heavily duplicated.
2020-04-16 23:29:52 +00:00
rin 364b1f4e0a Stop using __KERNEL_RCSID() in header files; it confuses ident(1) by
overwriting RCSID in main source files.

XXX
The first argument of __KERNEL_RCSID() is neglected for ELF. If we wish
to have RCSID of header files in kernel binary, we need something like
__FBSDID() macro in FreeBSD.
2020-04-16 21:56:41 +00:00
nat a7c4415c1f Correct rx packet count for 8192EU. Tested OK. 2020-04-16 17:18:27 +00:00
jdolecek c61cfedcc1 fix use-after-free for ata xfer on bio submission found by KASAN
driver ata_bio hooks read parts of the xfer after ata_exec_xfer()
call in order to determine return value, change so that the hook
doesn't return any value - callers do not care already,
as all I/O requests are asynchronous

this problem was uncovered by recent change for wd(4) to not hold
wd mutex during ata_bio call, the interrupt for the xfer might
thus actually fire immediately

adjust also ata_exec_command driver hooks similarily - remove all
completion and waiting logic from drivers, upper layer ata code
using AT_WAIT/AT_POLL changed to call ata_wait_cmd() itself

PR kern/55169 by Nick Hudson
2020-04-13 10:49:34 +00:00
chs 328da78dac slightly change and fix the semantics of pool_set*wat(), pool_sethardlimit()
and pool_prime() (and their pool_cache_* counterparts):

 - the pool_set*wat() APIs are supposed to specify thresholds for the count of
   free items in the pool before pool pages are automatically allocated or freed
   during pool_get() / pool_put(), whereas pool_sethardlimit() and pool_prime()
   are supposed to specify minimum and maximum numbers of total items
   in the pool (both free and allocated).  these were somewhat conflated
   in the existing code, so separate them as they were intended.

 - change pool_prime() to take an absolute number of items to preallocate
   rather than an increment over whatever was done before, and wait for
   any memory allocations to succeed.  since pool_prime() can no longer fail
   after this, change its return value to void and adjust all callers.

 - pool_setlowat() is documented as not immediately attempting to allocate
   any memory, but it was changed some time ago to immediately try to allocate
   up to the lowat level, so just fix the manpage to describe the current
   behaviour.

 - add a pool_cache_prime() to complete the API set.
2020-04-13 00:27:16 +00:00
msaitoh f247c48be2 Correctly spell "count". 2020-04-08 04:32:14 +00:00
ryo 1518c9789e avoid "panic: LOCKDEBUG: Mutex error: rw_vector_enter,309: spin lock held"
ok nonaka@. thanks
2020-04-07 07:25:41 +00:00
jdolecek 2f9d652e0f fix deadlock in wdcwait() when xfer timeout happens while the atabus
thread sleeps in wdcwait() - check current lwp rather than relying
on global ATACH_TH_RUN channel flag

should fix the hang part of the problem reported in
http://mail-index.netbsd.org/netbsd-users/2020/03/12/msg024249.html

thanks to Paul Ripke for providing extensive debugging info
2020-04-04 21:36:15 +00:00
riastradh d10b865ffb Mark res __diagused; #ifdef DIAGNOSTIC panic ---> KASSERT. 2020-04-04 00:01:28 +00:00
nisimura 53d01bfb1c add aprint_debug_dev() call for CI20 2020-04-02 13:38:50 +00:00
skrll 020ee1400e Fix evmips CI20 build 2020-04-02 07:26:45 +00:00
nisimura 19d13790fc fix negated loop condition. make break when reset. 2020-03-31 07:50:42 +00:00
nisimura 40012bae25 add comment to clearify hw nature 2020-03-31 02:47:34 +00:00
nisimura 938df3c71a - reorgazine the entire structure to utilise ifmedia(4)/mii(4) and
redefine starting point of debug.
- nuke duplicated standard MII register definition.  Davicom PHY extension
  is defined in dev/mii/dmphyreg.h
2020-03-31 02:32:25 +00:00
nisimura a916f33b3e DM9000 add register description 2020-03-30 00:01:57 +00:00
nisimura d195453210 reorganise rcv frame address filter code 2020-03-29 23:16:52 +00:00
jmcneill ba489ce6cd Try to use the existing HW address programmed into the device if possible. 2020-03-29 13:20:04 +00:00
jmcneill e5fc96bd4a Avoid "hole in RX ring" condition by ensuring a new mbuf is available
before using an existing one.
2020-03-29 13:04:15 +00:00
thorpej f9050a9a92 Add a file type entry for CLM files. 2020-03-25 04:53:11 +00:00
thorpej 66858ba7e1 - Refactor the firmware loading code into a set of common routines in the
core driver that understand how to find model-specific files before the
  generic files.  This greatly simplifies the firmware loading procedure
  in each of the bus front ends.  Adding additional firmware file types
  (such as CLM files) much simpler.
- Make firmware image selection table-driven rather than a set of switch()
  and if() statements.
- Add several additional firmware image entries.
2020-03-25 03:44:44 +00:00
msaitoh 2744d7ee42 Fix unused area size found by pgoyette@. 2020-03-24 04:12:13 +00:00
msaitoh 45298eaa48 Calculate DDR3's tRAS correctly. 2020-03-24 03:47:39 +00:00
msaitoh f2e2af514d - Define some new parameters of DDR3 SPD ROM.
- Use fine timebase parameters for time calculation on DDR3. This change
  makes PC3-XXXX vaule more correctly on newer DDR3.
2020-03-24 03:45:25 +00:00
msaitoh 81751ae509 KNF. No functional change. 2020-03-24 03:35:25 +00:00