1. 16 Mar, 2021 1 commit
    • Mitchell Horne's avatar
      ns8250: don't drop IER_TXRDY on bus_grab/ungrab · a54c346f
      Mitchell Horne authored
      It has been observed that some systems are often unable to resume from
      ddb after entering with debug.kdb.enter=1. Checking the status further
      shows the terminal is blocked waiting in tty_drain(), but it never makes
      progress in clearing the output queue, because sc->sc_txbusy is high.
      I noticed that when entering polling mode for the debugger, IER_TXRDY is
      set in the failure case. Since this bit is never tracked by the softc,
      it will not be restored by ns8250_bus_ungrab(). This creates a race in
      which a TX interrupt can be lost, creating the hang described above.
      Ensuring that this bit is restored is enough to prevent this, and resume
      from ddb as expected.
      The solution is to track this bit in the sc->ier field, for the same
      lifetime that TX interrupts are enabled.
      PR:		223917, 240122
      Sponsored by:	The FreeBSD Foundation
      (cherry picked from commit 7e7f7bee)
  2. 08 Sep, 2020 1 commit
    • John Baldwin's avatar
      MFC 359899: Correct baud rate error calculation. · db246688
      John Baldwin authored
      Shifting right by 1 is not the same as dividing by 2 for signed
      values.  In particular, dividing a signed value by 2 gives the integer
      ceiling of the (e.g. -5 / 2 == -2) whereas shifting right by 1 always
      gives the floor (-5 >> 1 == -3).
      An embedded board with a 25 Mhz base clock results in an error of
      -30.5% when used with a baud rate of 115200.  Using division, this
      truncates to -30% and is permitted.  Using the shift, this fails and
      is rejected causing TIOCSETA requests to fail with EINVAL and breaking
      Using division gives the same error range for both over and under baud
      rates and also makes the code match the behavior documented in the
      existing comment about supporting boards with 25 Mhz clocks.
  3. 29 Sep, 2019 1 commit
    • Alexander Motin's avatar
      MFC r352369: Relax TX draining in ns8250_bus_transmit(). · 30dc01a7
      Alexander Motin authored
      Since TX interrupt is generated when THRE is set, wait for TEMT set means
      wait for full character transmission time.  At low speeds that may take
      awhile, burning CPU time while holding sc_hwmtx lock, also congested.
      This is partial revert of r317659.
  4. 19 Aug, 2018 1 commit
    • Matt Macy's avatar
      add snps IP uart support / genaralize UART · 381388b9
      Matt Macy authored
      This is an amalgam of a patch by Doug Ambrisko to
      generalize uart_acpi_find_device, imp moving the
      ACPI table to uart_dev_ns8250.c and advice by jhb
      to work around a bug in the EPYC 3151 BIOS
      (the BIOS incorrectly marks the serial ports as
      Reviewed by: imp
      MFC after: 8 weeks
      Differential Revision: https://reviews.freebsd.org/D16432
  5. 22 Jul, 2018 1 commit
    • Matt Macy's avatar
      Add busy detect quirk to list of console options · f30f0f2b
      Matt Macy authored
      This change allows one to set the busy_detect flag
      required by the synopsys UART at the loader prompt.
      This is needed by the EPYC 3000 SoC.
      This will give users a working console up to the point where getty is required:
      Reviewed by:	imp
      MFC after:	4 weeks
      Differential Revision:	https://reviews.freebsd.org/D16399
  6. 27 Nov, 2017 1 commit
    • Pedro F. Giffuni's avatar
      sys/dev: further adoption of SPDX licensing ID tags. · 718cf2cc
      Pedro F. Giffuni authored
      Mainly focus on files that use BSD 2-Clause license, however the tool I
      was using misidentified many licenses so this was mostly a manual - error
      prone - task.
      The Software Package Data Exchange (SPDX) group provides a specification
      to make it easier for automated tools to detect and summarize well known
      opensource licenses. We are gradually adopting the specification, noting
      that the tags are considered only advisory and do not, in any way,
      superceed or replace the license texts.
  7. 10 Oct, 2017 1 commit
  8. 01 May, 2017 1 commit
  9. 17 Nov, 2016 1 commit
  10. 03 May, 2016 1 commit
  11. 01 Apr, 2016 1 commit
  12. 26 Feb, 2016 1 commit
  13. 12 Feb, 2016 1 commit
  14. 20 Jan, 2016 2 commits
  15. 12 Jan, 2016 1 commit
    • Ian Lepore's avatar
      Restore uart PPS signal capture polarity to its historical norm, and add an · fdfbb3f5
      Ian Lepore authored
      option to invert the polarity in software. Also add an option to capture
      very narrow pulses by using the hardware's MSR delta-bit capability of
      latching line state changes.
      This effectively reverts the mistake I made in r286595 which was based on
      empirical measurements made on hardware using TTL-level signaling, in which
      the logic levels are inverted from RS-232. Thus, this re-syncs the polarity
      with the requirements of RFC 2783, which is writen in terms of RS-232
      Narrow-pulse mode uses the ability of most ns8250 and similar chips to
      provide a delta indication in the modem status register. The hardware is
      able to notice and latch the change when the pulse width is shorter than
      interrupt latency, which results in the signal no longer being asserted by
      time the interrupt service code runs. When running in this mode we get
      notified only that "a pulse happened" so the driver synthesizes both an
      ASSERT and a CLEAR event (with the same timestamp for each). When the pulse
      width is about equal to the interrupt latency the driver may intermittantly
      see both edges of the pulse. To prevent generating spurious events, the
      driver implements a half-second lockout period after generating an event
      before it will generate another.
      Differential Revision:	https://reviews.freebsd.org/D4477
  16. 18 Nov, 2015 1 commit
  17. 30 May, 2015 1 commit
  18. 11 Apr, 2015 1 commit
    • Andrew Turner's avatar
      Add support for the uart classes to set their default register shift value. · 405ada37
      Andrew Turner authored
      This is needed with the pl011 driver. Before this change it would default
      to a shift of 0, however the hardware places the registers at 4-byte
      addresses meaning the value should be 2.
      This patch fixes this for the pl011 when configured using the fdt. The
      other drivers have a default value of 0 to keep this a no-op.
      MFC after:	1 week
  19. 07 Mar, 2015 1 commit
  20. 28 Jun, 2014 1 commit
  21. 27 Jun, 2014 2 commits
    • Glen Barber's avatar
      Revert r267961, r267973: · 37a107a4
      Glen Barber authored
      These changes prevent sysctl(8) from returning proper output,
      such as:
       1) no output from sysctl(8)
       2) erroneously returning ENOMEM with tools like truss(1)
          or uname(1)
       truss: can not get etype: Cannot allocate memory
    • Hans Petter Selasky's avatar
      Extend the meaning of the CTLFLAG_TUN flag to automatically check if · 3da1cf1e
      Hans Petter Selasky authored
      there is an environment variable which shall initialize the SYSCTL
      during early boot. This works for all SYSCTL types both statically and
      dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
      which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
      be used in the case a tunable sysctl has a custom initialisation
      function allowing the sysctl to still be marked as a tunable. The
      kernel SYSCTL API is mostly the same, with a few exceptions for some
      special operations like iterating childrens of a static/extern SYSCTL
      node. This operation should probably be made into a factored out
      common macro, hence some device drivers use this. The reason for
      changing the SYSCTL API was the need for a SYSCTL parent OID pointer
      and not only the SYSCTL parent OID list pointer in order to quickly
      generate the sysctl path. The motivation behind this patch is to avoid
      parameter loading cludges inside the OFED driver subsystem. Instead of
      adding special code to the OFED driver subsystem to post-load tunables
      into dynamically created sysctls, we generalize this in the kernel.
      Other changes:
      - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
      to "hw.pcic.intr_mask".
      - Removed redundant TUNABLE statements throughout the kernel.
      - Some minor code rewrites in connection to removing not needed
      TUNABLE statements.
      - Added a missing SYSCTL_DECL().
      - Wrapped two very long lines.
      - Avoid malloc()/free() inside sysctl string handling, in case it is
      called to initialize a sysctl from a tunable, hence malloc()/free() is
      not ready when sysctls from the sysctl dataset are registered.
      - Bumped FreeBSD version to indicate SYSCTL API change.
      MFC after:	2 weeks
      Sponsored by:	Mellanox Technologies
  22. 29 May, 2014 2 commits
  23. 19 Jan, 2014 1 commit
    • Warner Losh's avatar
      Introduce grab and ungrab upcalls. When the kernel desires to grab the · d76a1ef4
      Warner Losh authored
      console, it calls the grab functions. These functions should turn off
      the RX interrupts, and any others that interfere. This makes mountroot
      prompt work again. If there's more generalized need other than
      prompting, many of these routines should be expanded to do those new
      Should have been part of r260889, but waasn't due to command line typo.
      Reviewed by:	bde (with reservations)
  24. 26 Oct, 2013 1 commit
    • Zbigniew Bodek's avatar
      Wait for DesignWare UART transfers completion before accessing line control · 49e368ac
      Zbigniew Bodek authored
      When using DW UART with BUSY detection it is necessary to wait
      until all serial transfers are finished before manipulating the
      line control. LCR will not be affected when UART is busy.
      In addition, if Divisor Latch Access Bit is being set in order to
      modify UART divisors:
      1. We will get BUSY interrupt if interrupts are enabled.
      2. Because LCR will not be affected the THR and (even worse) IER
         contents will be corrupted. This will lead to console hang.
      Approved by:	cognet (mentor)
  25. 30 Aug, 2013 1 commit
    • Marcel Moolenaar's avatar
      A final test with unmodified code has shown that a delay of 150ms · 40a827b6
      Marcel Moolenaar authored
      is not giving us a 100% success rate. Bump the delay to 200ms as
      that seems to do the trick.
      Note that during testing the delay was added to uart_bus_attach()
      in uart_core.c. While having the delay in a different place can
      change the behaviour, it was not expected. Having to bump the
      delay with another 50ms could therefore be an indication that
      the problem can not be solved with delays.
      Reported by: kevlo@
      Tested by: kevlo@
  26. 29 Aug, 2013 1 commit
    • Marcel Moolenaar's avatar
      Work-around a timing problem with the ITE IT8513E now that the core · 4fc49975
      Marcel Moolenaar authored
      calls ns8250_bus_ipend() almost immediately after ns8250_bus_attach().
      As it appears, a line break condition is being signalled for almost
      all received characters due to this. A delay of 150ms seems enough
      to allow the H/W to settle and to avoid the problem.
      More analysis is needed, but for now a regression has been addressed.
      Reported by: kevlo@
      Tested by: kevlo@
  27. 21 Aug, 2013 1 commit
  28. 01 Mar, 2013 1 commit
    • Ganbold Tsagaankhuu's avatar
      Add support for A10 uart. · ac4adddf
      Ganbold Tsagaankhuu authored
      A10 uart is derived from Synopsys DesignWare uart and requires
      to read Uart Status Register when IIR_BUSY has detected.
      Also this change includes FDT check, where it checks device
      specific properties defined in dts and sets the busy_detect variable.
      broken_txfifo is also needed to be set in order to make it work for
      A10 uart case.
      Reviewed by: marcel@
      Approved by: gonzo@
  29. 27 Jan, 2013 1 commit
    • Colin Percival's avatar
      Add a loader tunable "hw.broken_txfifo" which enables a workaround for a · 1c60b24b
      Colin Percival authored
      bug in old versions of QEMU (and Xen, and other places using QEMU code).
      On those buggy emulated UARTs, the "TX idle" interrupt gets lost; with
      this workaround, we spinwait for the TX to happen and then send ourselves
      the interrupt.  It's ugly but it works, while minimizing the impact on
      the code for the !broken_txfifo case.
      MFC after:	2 weeks
  30. 02 Nov, 2011 1 commit
  31. 26 May, 2011 1 commit
  32. 21 Feb, 2011 1 commit
  33. 19 Oct, 2010 1 commit
  34. 10 May, 2010 1 commit
  35. 02 May, 2010 1 commit
  36. 30 Oct, 2009 1 commit
  37. 08 Apr, 2009 1 commit