Commit graph

39960 commits

Author SHA1 Message Date
Michal Krawczyk
af445a63a3 ena: Remove write-only datapath variable
The ena_qid variable value is never used. It can be safely removed.
That also silences the compilation warning.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit d5d5ea8723)
2022-07-26 21:30:16 +02:00
Dawid Gorecki
cbbecd257e ena: Fix styling issues
Align code style with FreeBSD style(9) guidelines.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 82e558eacf)
2022-07-26 21:30:16 +02:00
Dawid Gorecki
5d74711115 ena: Use device_set_desc in probe
During probe the driver created a temporary buffer to which the value of
DEVICE_DESC constant was printed. This buffer was then copied to the
device structure using device_set_desc_copy. Since the value of this
string is exactly the same for every device using the ENA driver, using
sprintf is unnecessary, and device_set_desc can be used instead.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 755e60ca04)
2022-07-26 21:30:15 +02:00
Dawid Gorecki
aea2edcc00 ena: Move ena_copy_eni_metrics into separate task
Copying ENI metrics was done in callout context, this caused the driver
to panic when sample_interval was set to a value other than 0, as the
admin queue call which was executed could sleep while waiting on
a condition variable. Taskqueue, unlike callout, allows for sleeping, so
moving the function to a separate taskqueue fixes the problem.
ena_timer_service is still responsible for scheduling the taskqueue.

Stop draining the callout during ena_up/ena_down. This was done to
prevent a race between ena_up/down and ena_copy_eni_metrics admin queue
calls. Since ena_metrics_task is protected by ENA_LOCK there is no
possibility of a race between ena_up/down and ena_metrics_task.

Remove a comment about locking in ena_timer_service. With ENI metrics
in a separate task this comment became obsolete.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit b899a02ad7)
2022-07-26 21:30:15 +02:00
Dawid Gorecki
c5da1ee63d ena: Use atomic_load/store functions for first_interrupt variable
Surround cases of possible simultaneous access to the first_interrupt
variable with atomic_load/store functions.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 0ac122c388)
2022-07-26 21:30:15 +02:00
Dawid Gorecki
c41b1259ce ena: Store ticks of last Tx cleanup
Store timestamp of last cleanup in Tx ring structure. This does not
change anything during normal operation of the driver but could be
useful when the device fails for some reason.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit d8aba82b5c)
2022-07-26 21:30:15 +02:00
Dawid Gorecki
609b1df672 ena: Prevent LLQ initialization when membar isn't exposed
The ena_com_config_dev_mode() function performs many LLQ related
calculations and sends an admin command to configure LLQ in the device.

All the LLQ related operations are unnecessary if the driver fails to
find LLQ memory bar.

Move LLQ memory bar allocation to separate helper function
ena_map_llq_mem_bar and execute this function before LLQ configuration.
If the LLQ memory bar cannot be allocated, then LLQ configuration is
skipped.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 90232d18ca)
2022-07-26 21:30:14 +02:00
Dawid Gorecki
274af2948a ena: Extend debug prints for invalid req_id resets
Print information about qid if req_id is invalid. Add information about
qid and req_id if mbuf is invalid.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit a9c39b031f)
2022-07-26 21:30:14 +02:00
Dawid Gorecki
963a1b06d9 ena: Move reset completion logging to the reset function
While ena_restore_device is called from the reset task, it can also be
called from other locations in the driver, for example in netmap
specific code. Move the reset completion logging to reset task, so it
better represents when the reset actually happened.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit d209ffee15)
2022-07-26 21:30:14 +02:00
Dawid Gorecki
afc13757ea ena: Add ena_ring_tx_doorbell() function
Add ena_ring_tx_doorbell function to remove code duplication.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 3501d4f17e)
2022-07-26 21:30:14 +02:00
Ed Maste
32120f55ff console: add U+276E and U+276F glyphs
U+276E Heavy Left-Pointing Angle Quotation Mark Ornament
U+276F Heavy Right-Pointing Angle Quotation Mark Ornament

U+276F is used by zprezto (zsh config package).

For the normal font I used the bold font glyphs for U+003C < and
U+003E >.  The bold font glyphs are new.

PR:		232494
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit f7d5459ece)
2022-07-26 09:41:48 -04:00
Ed Maste
01e2fef446 Update Terminus console font to 4.49
As in the past Dimitar Zhekov provided a copy of Terminus under a BSD
license for use by our console.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit cd8401dbde)
2022-07-26 09:16:16 -04:00
Dimitry Andric
ed4334af24 Fix unused variable warning in fwohci.c
With clang 15, the following -Werror warning is produced:

    sys/dev/firewire/fwohci.c:2762:23: error: variable 'pcnt' set but not used [-Werror,-Wunused-but-set-variable]
            int len, plen, hlen, pcnt, offset;
                                 ^

The 'pcnt' variable is eventually used only in an #if 0'd block,
obviously meant for debugging. Ensure that 'pcnt' is only declared and
used when COUNT_PACKETS is defined, so the debugging can be easily
turned on later, if desired.

MFC after:	3 days

(cherry picked from commit d7e0d962f3)
2022-07-24 13:00:10 +02:00
Dimitry Andric
f931f0d642 Fix unused variable warning in if_re_netmap.h
With clang 15, the following -Werror warning is produced:

    sys/dev/netmap/if_re_netmap.h:179:8: error: variable 'n' set but not used [-Werror,-Wunused-but-set-variable]
            u_int n;
                  ^

The 'n' variable appears to have been a debugging aid that has never
been used for anything, so remove it.

MFC after:	3 days

(cherry picked from commit 8bfedf5852)
2022-07-24 13:00:10 +02:00
Dimitry Andric
249cb0b4c3 Adjust pmc_thread_descriptor_pool_drain() definition to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_mod.c:2462:33: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmc_thread_descriptor_pool_drain()
                                    ^
                                     void

This is because pmc_thread_descriptor_pool_drain() is declared with a
(void) argument list, but defined with an empty argument list. Make the
definition match the declaration.

MFC after:	3 days

(cherry picked from commit 555d2c9394)
2022-07-24 13:00:08 +02:00
Dimitry Andric
ad86a79043 Adjust pcm_md_initialize() definition to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/hwpmc/hwpmc_x86.c:245:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pcm_md_initialize()
                     ^
                      void

This is because pcm_md_initialize() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days

(cherry picked from commit dc0cde7a21)
2022-07-24 13:00:08 +02:00
Dimitry Andric
770520da58 Fix unused variable warning in ocs_cam.c
With clang 15, the following -Werror warning is produced:

    sys/dev/ocs_fc/ocs_cam.c:2556:11: error: variable 'count' set but not used [-Werror,-Wunused-but-set-variable]
            uint32_t        count;
                            ^

The 'count' variable seems to be a left-over from some debugging code
that no longer exists, and can be removed without any functional change.

MFC after:	3 days

(cherry picked from commit 8d9e292846)
2022-07-24 13:00:07 +02:00
Dimitry Andric
e2fae920c5 Fix unused variable warnings in hwpmc_mod.c
With clang 15, the following -Werror warnings are produced:

    sys/dev/hwpmc/hwpmc_mod.c:4805:6: error: variable 'nfree' set but not used [-Werror,-Wunused-but-set-variable]
            int nfree;
                ^
    sys/dev/hwpmc/hwpmc_mod.c:4804:6: error: variable 'ncallchains' set but not used [-Werror,-Wunused-but-set-variable]
            int ncallchains;
                ^

The 'nfree' and 'ncallchains' variables were used in KASSERTs, but these
were removed due to refactoring in d9f1b8dbf2. Remove the variables
since they no longer serve any purpose.

MFC after:      3 days

(cherry picked from commit 38a9b8a00c)
2022-07-24 13:00:07 +02:00
Dimitry Andric
8b5b4fc7ca Adjust tdsaContext_t::NvmdResponseSet declaration to avoid clang 15 warning
With clang 15, the following -Werror warnings are produced:

    In file included from sys/dev/pms/freebsd/driver/ini/src/agtiapi.c:70:
    sys/dev/pms/RefTisa/tisa/sassata/common/tdsatypes.h:346:13: error: type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int [-Wimplicit-int]
      volatile  NvmdResponseSet;
      ~~~~~~~~  ^
      int

The NvmdResponseSet member is effectively only used as a boolean in the
pms(4) driver, so it could be a single bit. But to avoid changing the
semantics at all in this unmaintained driver, simply declare it as a
volatile int.

MFC after:	3 days

(cherry picked from commit 95204d7a63)
2022-07-24 13:00:07 +02:00
Dimitry Andric
8d98688e8b Adjust pcmlog_{initialize,shutdown}() definitions to avoid clang 15 warning
With clang 15, the following -Werror warnings are produced:

    sys/dev/hwpmc/hwpmc_logging.c:1228:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmclog_initialize()
                     ^
                      void
    sys/dev/hwpmc/hwpmc_logging.c:1277:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    pmclog_shutdown()
                   ^
                    void

This is because pcmlog_{initialize,shutdown}() are declared with (void)
argument lists, but defined with empty argument lists. Make the
definitions match the declarations.

MFC after:	3 days

(cherry picked from commit ba95c55602)
2022-07-24 13:00:07 +02:00
Dimitry Andric
56b06ff9f5 Adjust vt_mouse_paste() definition to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/vt/vt_core.c:2129:15: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    vt_mouse_paste()
                  ^
                   void

This is because vt_mouse_paste() is declared with a (void) argument
list, but defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days

(cherry picked from commit b77a5e5f58)
2022-07-24 13:00:06 +02:00
Dimitry Andric
e21693924a Suppress unused variable warning in if_mwl.c
With clang 15, the following -Werror warning is produced:

    sys/dev/mwl/if_mwl.c:3445:8: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
            u_int ix;
                  ^

Here, 'ix' is a variable that is only used when debugging. Mark the
variable as potentially unused, to suppress the warning.

MFC after:	3 days

(cherry picked from commit 52c80d495a)
2022-07-23 10:56:46 +02:00
Dimitry Andric
6204a90c0b Adjust nvd_{load,unload}() definitions to avoid clang 15 warnings
With clang 15, the following -Werror warnings are produced:

    sys/dev/nvd/nvd.c:150:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    nvd_load()
            ^
             void
    sys/dev/nvd/nvd.c:166:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    nvd_unload()
              ^
               void

This is because nvd_load() and nvd_unload() are declared with a (void)
argument list, but defined with an empty argument list. Make the
definitions match the declarations.

MFC after:	3 days

(cherry picked from commit c46c9b3f5f)
2022-07-23 10:56:46 +02:00
Dimitry Andric
9dcb9a1e7b Fix unused variable warning in if_alc.c
With clang 15, the following -Werror warning is produced:

    sys/dev/alc/if_alc.c:3441:6: error: variable 'prog' set but not used [-Werror,-Wunused-but-set-variable]
            int prog;
                ^

The 'prog' variable seems to be a left-over from some debugging code
that no longer exists, and can be removed without any functional change.

MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D35831

(cherry picked from commit 64741244fc)
2022-07-23 10:56:46 +02:00
Dimitry Andric
c3361a4b90 Suppress unused variable warning in if_malo.c
With clang 15, the following -Werror warning is produced:

    sys/dev/malo/if_malo.c:1573:8: error: variable 'ix' set but not used [-Werror,-Wunused-but-set-variable]
            u_int ix;
                  ^

Here, 'ix' is a variable that is only used when MALO_DEBUG is defined.
Mark the variable as potentially unused, to suppress the warning.

MFC after:	3 days

(cherry picked from commit 2186340143)
2022-07-23 10:56:45 +02:00
Dimitry Andric
864ff7a6e5 Suppress unused variable warning in mfi.c
With clang 15, the following -Werror warnings are produced:

    sys/dev/mfi/mfi.c:3698:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable]
            int timedout;
                ^
    sys/dev/mfi/mfi.c:3742:6: error: variable 'timedout' set but not used [-Werror,-Wunused-but-set-variable]
            int timedout = 0;
                ^

Here, 'timedout' are variables that are only used when debugging,
requiring #if 0 statements to be modified. Mark the variables as
potentially unused, to suppress the warnings.

MFC after:	3 days

(cherry picked from commit 3dbe05f61b)
2022-07-23 10:56:45 +02:00
Dimitry Andric
1538007bb5 Adjust t4_tracer_mod{load,unload}() definitions to avoid clang 15 warnings
With clang 15, the following -Werror warnings are produced:

    sys/dev/cxgbe/t4_tracer.c:234:18: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    t4_tracer_modload()
                     ^
                      void
    sys/dev/cxgbe/t4_tracer.c:243:20: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    t4_tracer_modunload()
                       ^
                        void

This is because t4_tracer_modload() and t4_tracer_modunload() are
declared with a (void) argument list, but defined with an empty argument
list. Make the definitions match the declarations.

MFC after:	3 days

(cherry picked from commit 54e5efb264)
2022-07-23 10:56:44 +02:00
Dimitry Andric
09ed6ce409 Adjust fbd_list() definition to avoid clang 15 warning
With clang 15, the following -Werror warnings is produced:

    sys/dev/fb/fbd.c:205:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    fbd_list()
            ^
             void

This is because fbd_list() is declared with a (void) argument list, but
defined with an empty argument list. Make the definition match the
declaration.

MFC after:	3 days

(cherry picked from commit 9863e501c8)
2022-07-23 10:56:43 +02:00
Dimitry Andric
fde05f9864 Fix clang 15 warning in cxgbe
Clang 15 warns:

    sys/dev/cxgbe/cudbg/cudbg_lib.c:2949:6: error: variable 'i' set but not used [-Werror,-Wunused-but-set-variable]
            int i = 0;
                ^

Apparently 'i' was meant as the current retry counter, but '1' was used
in the while loop comparison instead, making the loop potentially
infinite, if 'busy' never gets reset.

MFC after:	3 days
Reviewed by:	np
Differential Revision: https://reviews.freebsd.org/D35834

(cherry picked from commit fb0493d559)
2022-07-20 18:51:15 +02:00
Dimitry Andric
ac1daaa6f8 Adjust agp_find_device() definition in agp.c to avoid clang 15 warning
With clang 15, the following -Werror warning is produced:

    sys/dev/agp/agp.c:910:16: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes]
    agp_find_device()
                   ^
                    void

This is because agp_find_device() is declared with a (void) argument
list, and defined with an empty argument list. Make the definition match
the declaration.

MFC after:	3 days

(cherry picked from commit c0817e2aba)
2022-07-19 20:02:06 +02:00
Dimitry Andric
dae26c1153 Remove unused but set variable in cxgb_sge
Clang 15 warns:

    sys/dev/cxgb/cxgb_sge.c:1290:21: error: variable 'txsd' set but not used [-Werror,-Wunused-but-set-variable]
            struct tx_sw_desc *txsd = &txq->sdesc[txqs->pidx];
                               ^

It appears 'txsd' is a leftover from a previous refactoring (see
3f345a5d09), but is no longer used for anything, and can be removed
without any functional change.

MFC after:	3 days
Reviewed by:	np
Differential Revision: https://reviews.freebsd.org/D35833

(cherry picked from commit cab040039d)
2022-07-19 20:01:49 +02:00
Gordon Bergling
9fd95378f3 qat(4): Fix a typo in a source code comment
- s/bufer/buffer/

Obtained from:	NetBSD

(cherry picked from commit e4a203234a)
2022-07-19 18:01:23 +02:00
Gordon Bergling
000e2a5b3d qat(4): Fix a typo in a source code comment
- s/mirco/micro/

Obtained from:	NetBSD

(cherry picked from commit db1c3dbe82)
2022-07-19 18:00:51 +02:00
Gordon Bergling
ee4dc8211a cxgbe(4): Fix a typo in a source code comment
- s/alredy/already/

(cherry picked from commit 63303133a7)
2022-07-19 17:59:46 +02:00
Mark Johnston
b7806e7bae ktls: Zero out TLS_GET_RECORD control messages
Otherwise we end up copying one uninitialized byte into the socket
buffer.

Reported by:	KMSAN
Reviewed by:	jhb
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 6be8944d96)
2022-07-19 09:53:41 -04:00
Kornel Dulęba
0627a69cd8 e6000sw: Fix direct register write logic
When accessing a register directly from etherswitchcfg one must specify
a register group(e.g. registers of portN) and the register offset within
the group. The latter is passed as the 5 least significant bits.
Extract the former by dividing the register address by 32, not by 5.

Approved by:	mw(mentor)
Obtained from:	Semihalf
Sponsored by:	Stormshield
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D35672

(cherry picked from commit 6654825907)
2022-07-19 11:36:55 +02:00
Kornel Dulęba
94c272b4c6 igc: Change default duplex setting
During media selection through ifconfig one might not specify
the duplex setting through the mediaopt flag.
In that case the igc driver would default to full-duplex.
The problem with this approach is that e1000(em/igb) driver
defaults to half-duplex.
Because of that if one connects both NICs and sets media to
e.g. 100baseTX on both of them no link will be found.
Fix that by matching igc behaviour with what e1000 does.

Reviewed by: grehan
Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35673

(cherry picked from commit 3b8d04f845)
2022-07-19 11:36:48 +02:00
Andrew Turner
2069f112f0 Clean up in the pci host generic driver
Add clean up on failure and a detach function to the pci host generic
driver.

Reviewed by:	jhb (earlier version)
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35291

(cherry picked from commit d843dd0e1a)
2022-07-19 08:03:30 +01:00
Bjoern A. Zeeb
30f6e37522 dwc3: add ACPI attachment
Split the current FDT-only implementation up into an FDT and an
ACPI part reusing and sharing as much code as possible (thanks mw!).

This makes the Synopsis XHCI root hubs attach correctly on SolidRun's
HoenyComb instead of just the generic XHCI root and this means we
are also doing proper chip setup and applying the quirk needed there [1].

There is one problem with ACPI attachment in that it uses the generic
XHCI PNP ID.  So we need to do extra checks in order to not claim
all xhci, which means we check for a known quirk to be present
in acpi_probe.  Long term this isn't scaling and this was discussed
in SolidRun's Discord Channel in 2021 with the intend that "jnettlet"
will take this to a steering committee.  Since then ACPI has kind-of
become a technology non grata (due to not getting changes into Linux
timely) so it is unclear if this will ever happen.  If there will be
further hardware with dwc3/ACPI we should go and make sure this problem
gets solved.

[1] 24698f90b7/Silicon/NXP/LX2160A/AcpiTables/Dsdt/Usb.asl

Reviewed by:		manu, mw
Differential Revision:	https://reviews.freebsd.org/D32256

(cherry picked from commit fbb5cb66f7)
2022-07-18 01:00:21 +00:00
Bjoern A. Zeeb
ae33d74d47 dwc3: improve debugging
Rather than hiding behind #if 0, hide the debugging behind DWC3_DEBUG
so it can be turned on with a single define.  Require bootverbose
to print anything so we can still avoid spamming the console if DWC3_DEBUG
is on.
Harmonize the format string in snsp_dwc3_dump_regs() to always print the
full register and also print the XHCI quirks.
Call snsp_dwc3_dump_regs() twice, before and after generic XHCI attachment
and initialisation as this may have an effect on the confirgumation state.

Obtained from:	an old debug patch
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35700

(cherry picked from commit 11a7d5e5d9)
2022-07-18 01:00:21 +00:00
Bjoern A. Zeeb
a7717dc610 dwc3: add more quirks and checks
Rather than just printing the Global SNPS ID Register store it as well
so we can do a version check later.
In addition, for debugging purposes, read the Global Hardware Parameters
Registers and print them.

Based on the snpsid disable an XHCI feature using a quirk prepared
in 447c418da0.
Add the "snps,dis_u3_susphy_quirk" quirk and handle Suspend USB3.0 SS PHY
after power-on-reset/during core initialization (suggested to be cleared)
based on the DWC3_GHWPARAMS0 register.

Obtained from:	an old debugging patch
Reviewed by:	mw (earlier version), mmel
Differential Revision: https://reviews.freebsd.org/D35699

(cherry picked from commit 09cdf4878c)
(cherry picked from commit ec32fc2af5)
2022-07-18 01:00:21 +00:00
Bjoern A. Zeeb
486d99faa3 dwc3: uncondinationally enable Host IN Auto Retry
Enable dwc3's auto retry feature. For IN transfers with crc errors
or internal overruns this will make the host reply with a
non-terminating retry ACK.  I believe the hope was to improve
reliability after seeing occasional hiccups.

Obtained from:	an old debugging patch
Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35698

(cherry picked from commit cec0a5ec6b)
2022-07-18 01:00:21 +00:00
Bjoern A. Zeeb
9ffd5ef82f dwc3: fix snps,dis-del-phy-power-chg-quirk
If snps,dis-del-phy-power-chg-quirk is set, the register bit should be
cleared not ored on (it's the "dis" version).

Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35697

(cherry picked from commit 0084212bfd)
2022-07-18 01:00:20 +00:00
Bjoern A. Zeeb
bf7ce29414 USB: dwc3: use device_{has,get}_property()
Switch the driver to use device based functions which will work not
only with FDT but also ACPI.

While here make dr_mode a local variable as it is only used during
probe and not needed later in the softc.

Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D33170

(cherry picked from commit b11f52f4db)
2022-07-18 01:00:20 +00:00
Bjoern A. Zeeb
ab82f64eb5 pca954x: harmonize pca9547 and pca954x and add pca9540 support
The two implementations for the pca9548 switch and the pca9547 mux
seemed close enough so we can put them together and with a bit more
abstraction add pca9540 support.

While here apply a bit of consistency in variable and driver naming and
use device_has_property instead of the FDT-only OF_ variant.

This disconnects pca9547 from the build but does not yet delete it.

Reviewed by:	mmel (earlier version), avg
Sponsored by:	Traverse Technologies (providing Ten64 HW for testing)
Differential Revision: https://reviews.freebsd.org/D35701

(cherry picked from commit 97dbd37753)
2022-07-18 01:00:20 +00:00
Bjoern A. Zeeb
74c7b2d74a tca6416: add support for tca9539
Programming-wise tca6416 and tca9539 seem identical so all we have to
do is add the extra ofw_compat_data line.

Reviewed by:	mw
Sponsored by:	Traverse Technologies (providing Ten64 HW for testing)
Differential Revision: https://reviews.freebsd.org/D35702

(cherry picked from commit c4b98101c5)
2022-07-18 00:44:05 +00:00
Bjoern A. Zeeb
e4d7f82bf5 ACPI: change arguments to internal acpi_find_dsd()
acpi_find_dsd() is not a bus function and we only need the acpi_device (ad).
The only caller has already looked up the ad (from ivars) for us.
Directly pass the ad to acpi_find_dsd() instead of bus, dev and remove
the extra call to device_get_ivars(); the changed argument also means we
now call AcpiEvaluateObject directly on the handle.

This optimisation was done a while ago while debugging a driver which
ended up with a bad bus, dev combination making the old version fail.

Reviewed by:	mw
Differential Revision: https://reviews.freebsd.org/D35558

(cherry picked from commit 945eaca155)
2022-07-18 00:43:32 +00:00
John Baldwin
46b46bb774 hwpmc: Permit the minimum sampling count to be set as a sysctl.
A rarely occurring event (e.g. an event that occurs less than 1000
times during execution of a program) may require a lower minimum
threshold than 1000.  Replace the hardcoded 1000 with a sysctl that
the administrator can use to permit smaller sampling count values.

Reviewed by:	mhorne, mav
Sponsored by:	University of Cambridge, Google, Inc.
Differential Revision:	https://reviews.freebsd.org/D35400

(cherry picked from commit ca341f3cf5)
2022-07-13 09:19:13 -07:00
Doug Moore
069ec467c1 iommu_gas: Drop needless bound check in lowermatch
The loop iteration in iommu_gas_lowermatch checks the bound
a->common->lowaddr twice per loop iteration. Rewrite to test only once
per iteration.  Do not worry about passing to iommu_gas_match_one a
range wholly beyond lowaddr. Since that function checks the upper end
of the range against lowaddr, it'll get rejected there.

Reviewed by:	alc
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D35522

(cherry picked from commit 70b5d8fa0f)
2022-07-12 12:37:48 -05:00
Doug Moore
0cbb744f96 iommu_gas: Rename a function missed earlier
Reported by:	jenkins
Fixes:	c606ab59e7 vm_extern: use standard address checkers everywhere

(cherry picked from commit cfb2aa3f53)
2022-07-12 11:26:07 -05:00