]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoDeprecate the 'devclass' argument from *DRIVER_MODULE() macros.
John Baldwin [Tue, 19 Apr 2022 17:43:06 +0000 (10:43 -0700)]
Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.

This argument is useless for the vast majority of drivers.  For now,
use __VA_ARGS__ wrapper macros so that that the *DRIVER_MODULE()
macros accept both the old version (with a devclass) and the new
version (which omits the argument and stores NULL in the
driver_module_data structure).  This provides an API compatiblity
shim that can be merged to older stable branches.

Once all drivers relevant to 14.0 (both in and out of tree) have been
updated, the API compat shims can be dropped.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34963

(cherry picked from commit 2a99dd30dfaac98fea79f084b3a13c45199e1348)
(cherry picked from commit 0fdf5bc531fbde4fa80a85614ba40230062ebde4)
(cherry picked from commit b7d4192598fed6581be627fc767f06a62195dfd5)

2 years agodevclass_add_driver: Permit NULL to be passed in dcp.
John Baldwin [Tue, 19 Apr 2022 17:42:38 +0000 (10:42 -0700)]
devclass_add_driver: Permit NULL to be passed in dcp.

This permits a driver module structure that doesn't want to store a
pointer to the new driver's devclass.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34962

(cherry picked from commit 5bdea8826bdd48e2221f1b436ce86021ede412f2)

2 years agomips: Remove EXT_RESOURCES from kernel configs.
John Baldwin [Tue, 17 May 2022 21:15:45 +0000 (14:15 -0700)]
mips: Remove EXT_RESOURCES from kernel configs.

This is a direct commit to stable/13 as these kernel configs are not
present in main.

2 years agoAdd the extres pseudo devices to some kernels.
John Baldwin [Tue, 17 May 2022 21:15:44 +0000 (14:15 -0700)]
Add the extres pseudo devices to some kernels.

This is a direct commit to stable/13 as these kernel configs are not
present in main.

2 years agoiscsid: Push #ifdef ICL_KERNEL_PROXY into cap_ioctl_limits list.
John Baldwin [Mon, 18 Apr 2022 19:44:36 +0000 (12:44 -0700)]
iscsid: Push #ifdef ICL_KERNEL_PROXY into cap_ioctl_limits list.

This reduces duplication in the two lists and makes it clearer which
ioctls are needed in the ICL_KERNEL_PROXY case.

Reviewed by: mav
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D34927

(cherry picked from commit f0df72273377daf5e1e97b80a4e542362b261a1d)

2 years agonfscl: Acquire a refcount on "cred" for mirrored pNFS RPCs
Rick Macklem [Tue, 3 May 2022 14:22:15 +0000 (07:22 -0700)]
nfscl: Acquire a refcount on "cred" for mirrored pNFS RPCs

When the NFSv4.1/4.2 client is doing a pnfs mount to
mirrored DS(s), asynchronous threads are used to do the
RPCs against the DS(s) concurrently.  If a DS is slow
to reply, it is possible for the "cred" to be free'd
before the asynchronous thread is done with it, causing
a panic/crash.

This patch fixes the problem by acquiring a refcount on
the "cred" while it is being used by the asynchronous thread
for a DS RPC.  This bug was found during a recent IETF
NFSv4 testing event.

This bug only affects "pnfs" mounts to mirrored pNFS
servers.

(cherry picked from commit 70910e4b55ca976ca0ad4aa3e34252ba148a6126)

2 years agoUFS: clear fs_fmod once more, in the buffer data copy.
Konstantin Belousov [Mon, 9 May 2022 20:46:05 +0000 (23:46 +0300)]
UFS: clear fs_fmod once more, in the buffer data copy.

PR: 263765

(cherry picked from commit ca7c2d2eedf690ae0c780451f53d9ce36bb2c337)

2 years agoffs_use_bwrite: make the superblock snapshot more consistent
Konstantin Belousov [Sun, 8 May 2022 14:00:37 +0000 (17:00 +0300)]
ffs_use_bwrite: make the superblock snapshot more consistent

PR: 263765

(cherry picked from commit 4ac2df8f4cd91017c000543224204f823008f699)

2 years agonfsd: Fix session slot freeing for NFSv4.1/4.2
Rick Macklem [Mon, 2 May 2022 19:45:42 +0000 (12:45 -0700)]
nfsd: Fix session slot freeing for NFSv4.1/4.2

Without this patch the NFSv4.1/4.2 server erroneously
always frees session slot zero for callbacks.  This only
affects 4.1/4.2 mounts if the server has delegations
enabled or is a pNFS configuration.  Even for those
cases, the effect is mainly to only use slot 0 for
callbacks, serializing all of them.  There is a slight
chance that callbacks will fail if the client performs
them in a different order than received on the TCP
connection.

If this bug affects your server, you will see console
messages like:
  newnfs_request: Bad session slot

This patch fixes the problem.  Found during a recent
IETF NFSv4 testing event.

PR: 263728

(cherry picked from commit 271f6d52a606e86c11b366082f11fe69350f24da)

2 years agoarm: rockchip: rk3288: Use the macros that already exists in rk_cru.h
Emmanuel Vadot [Wed, 15 Sep 2021 18:10:42 +0000 (20:10 +0200)]
arm: rockchip: rk3288: Use the macros that already exists in rk_cru.h

(cherry picked from commit 78bf40e10c5a1504ba364abc068893de431263d4)

2 years agoarm64: rockchip: rk3328: Add watchdog clock
Emmanuel Vadot [Wed, 15 Sep 2021 17:09:56 +0000 (19:09 +0200)]
arm64: rockchip: rk3328: Add watchdog clock

The watchdog clock is controlled by the secure world but we need a clock
to sastify the driver so add a fixed clock for it.

Reported by:   avg

(cherry picked from commit 548a706608d7291a72ed37e6c400654ee1ceadef)

2 years agoarm64: rockchip: rk3328: Finish implementing clocks
Emmanuel Vadot [Wed, 15 Sep 2021 16:33:38 +0000 (18:33 +0200)]
arm64: rockchip: rk3328: Finish implementing clocks

This finish (almost) the clocks implementations for the RK3328 SoC.
The clocks are now correctly implemented respecting the clock hiearchy.
The missing clocks are mostly the DDR clocks, implementing those is only
useful for debugging as we will never set them in the kernel.
The ARMCLK still needs to be rewritten so it looks closer to how the
hardware is done.

Tested-on: Rock64
(cherry picked from commit cc2f9bbbad3b9cd81b8e66d57f9d34d8a42048dd)

2 years agoarm64: rockchip: clk: Add MUXRAW macros
Emmanuel Vadot [Wed, 15 Sep 2021 16:25:09 +0000 (18:25 +0200)]
arm64: rockchip: clk: Add MUXRAW macros

Some clocks in the RK3328 SoC (and possibly others) have registers not in
the CLKSEL_CON range. Add a macros for muxes which lives not in the range
of CLKSEL_CON which just takes a raw offset.

(cherry picked from commit deff1fb3dccb13b6961b1e8595f74a2134e65b93)

2 years agoarm64: rockchip: clk_mux: Add support for mux in GRF type clock
Emmanuel Vadot [Thu, 9 Sep 2021 16:24:33 +0000 (18:24 +0200)]
arm64: rockchip: clk_mux: Add support for mux in GRF type clock

Some clocks have their mux register in the GRF and not in the CRU.
Add support for that in the rk_clk_mux clock type.

(cherry picked from commit 731e418bd748f6602bb184ca3a35bab8af241cf1)

2 years agopkgbase: move devd's hyperv.conf to hyperv-tools package
Mina Galić [Mon, 2 May 2022 14:49:43 +0000 (15:49 +0100)]
pkgbase: move devd's hyperv.conf to hyperv-tools package

This devd config file is useless without hyperv-tools, so we're moving
it into the hyperv-tools package. pr#263691

PR: 263691
MFC after: 3 days

(cherry picked from commit 7ac164dc8e2ec3e6d3cda1d9ca13d461a534a6e8)

2 years agobsdinstall/script: umount before zpool export
Corvin Köhne [Tue, 3 May 2022 14:01:22 +0000 (16:01 +0200)]
bsdinstall/script: umount before zpool export

When running zpool export first, boot/efi and dev is still mounted so
zpool export fails. By running bsdinstall umount first the pool can be
cleanly exported.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35114
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC After: 3 days

(cherry picked from commit 450b4ac23c75e2dde996c96049c0887864e22d09)

2 years agobsdinstall: stop messing with file descriptors
Corvin Köhne [Tue, 3 May 2022 14:00:09 +0000 (16:00 +0200)]
bsdinstall: stop messing with file descriptors

Throughout the bsdinstall script fd 3 is used by f_dprintf (set through
$TERMINAL_STDOUT_PASSTHRU). By closing file descriptor 3 here, the
final f_dprintf "Installation Completed ... does not work anymore.

By putting the code into a subshell, file descriptors can be edited
without interference with the calling script.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D35113
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 3 days

(cherry picked from commit 1f7746d81f53447ac15cc99395bb714d4dd0a4da)

2 years agobhyve: avoid uninitialized variable
Corvin Köhne [Fri, 1 Apr 2022 08:19:53 +0000 (10:19 +0200)]
bhyve: avoid uninitialized variable

Reviewed by: markj
Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
Reported-by: Andy Fiddaman <andy@omniosce.org>
Differential Revision: https://reviews.freebsd.org/D34688
(cherry picked from commit 8ac8adda8dbaceebd296e4fd7df36b7a8db7f6d3)

2 years agobhyve: avoid overflow of BAR index
Corvin Köhne [Fri, 1 Apr 2022 08:18:52 +0000 (10:18 +0200)]
bhyve: avoid overflow of BAR index

At the moment, writes to BAR registers that aren't 4 byte aligned are
ignored. So, there's no overflow yet. Nevertheless, if this behaviour
changes in the future, it could unintentionally, introduce a buffer
overflow. Additionally, some compiler or tools will detect this
potential overflow and complain about it.

Reviewed by: markj
Signed-off-by: Corvin Köhne <c.koehne@beckhoff.com>
Reported-by: Andy Fiddaman <andy@omniosce.org>
Differential Revision: https://reviews.freebsd.org/D34689
(cherry picked from commit 45ddbf211274eb28c0ccd0042640de57015dd390)

2 years agobhyve: avoid an empty passthru config value
Corvin Köhne [Fri, 1 Apr 2022 08:20:55 +0000 (10:20 +0200)]
bhyve: avoid an empty passthru config value

pci_parse_legacy_config splits the options string by comma characters.
strchr returns a pointer to the first occurence of a character. In that
case, it's a comma. So, pci_parse_legacy_config will stop at the first
character and creates a new config node with a name of NULL.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D34600

(cherry picked from commit 3256b7ca36e739a08f141a7ee52b9db9d995db85)

2 years agompsutil: Fix device speed reporting.
Alexander Motin [Mon, 9 May 2022 21:57:29 +0000 (17:57 -0400)]
mpsutil: Fix device speed reporting.

Report controller SAS phy speed only for directly attached devices.
For others try to read and report parent expander phy speed.

MFC after: 1 week

(cherry picked from commit bce02a0ea43a0cd4ee9aa23c815189d2ccb83745)

2 years agompsutil: fix set but not used warning
Alexander Motin [Mon, 9 May 2022 21:55:47 +0000 (17:55 -0400)]
mpsutil: fix set but not used warning

MFC after: 1 week

(cherry picked from commit 53c184cf06055fea79893e5620711fe164282480)

2 years agoFix formatting of the usage() output
Scott Long [Fri, 7 Jan 2022 05:59:18 +0000 (22:59 -0700)]
Fix formatting of the usage() output

(cherry picked from commit 638e2a132e38b51b385b2731822294c73621aea9)

2 years agoAdd deprecation notices to ISA sound cards
Ed Maste [Fri, 18 Mar 2022 15:50:23 +0000 (11:50 -0400)]
Add deprecation notices to ISA sound cards

ISA sound cards (and ISA itself) are long obsolete.  NYCBUG dmesgd has
no entries for any of these devices after 2005.

Mail to -current and -stable revealed some nostalgic interest, but
no offers to test or requests to pospone the deprecation.

Add deprecation notices to device attach routines and man pages for:

snd_ad1816  Analog Devices AD1816 SoundPort
snd_ess     Ensoniq ESS
snd_gusc    Gravis UltraSound (MAX and newer AFAIK)
snd_mss     Microsoft Sound System
snd_sbc     Creative Sound Blaster

Reviewed by: cy, mav
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34604

(cherry picked from commit e39ec8933be4d6e74cfb32680fb3e67469e66bb7)

2 years agovt: use TERMINAL_DECLARE_EARLY() macro
Mitchell Horne [Mon, 20 Sep 2021 19:50:04 +0000 (16:50 -0300)]
vt: use TERMINAL_DECLARE_EARLY() macro

It simplifies the declaration of the driver structures a little. There
are no current consumers of this macro, in fact it looks like it was
added for exactly this purpose.

This decreases the scope of some variables, so rework the initialization
in vt_init_logos() such that it doesn't require them.

No functional change intended.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34820

(cherry picked from commit ff1c8af8c34965cc13e53f8290adc5a2fe09501b)

2 years agoaw_wdog: support Allwinner D1 watchdog
Julien Cassette [Tue, 12 Apr 2022 22:12:49 +0000 (19:12 -0300)]
aw_wdog: support Allwinner D1 watchdog

This device is present on the Allwinner D1-based SoCs. Without this
driver, the watchdog timeout will trigger a reset a few seconds after
control is given to the kernel.

Reviewed By: manu, mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34749

(cherry picked from commit 3a6f0bb25f06056c92d7e53ce63e2d297932c96f)

2 years agoriscv: add iicbus and iicoc to GENERIC
Philip Paeps [Mon, 1 Nov 2021 05:16:27 +0000 (13:16 +0800)]
riscv: add iicbus and iicoc to GENERIC

The iicoc driver supports the OpenCores I2C IP.  This is included in at
least the SiFive "Unleashed" and "Unmatched" cores and probably others.

Suggested by: jrtc27

(cherry picked from commit 91feb4f42075e2d7c8d6d50cd5faa651ab3a0e7d)

2 years agocgem: support SGMII PHY connection mode
Milan Obuch [Thu, 7 Apr 2022 13:04:18 +0000 (10:04 -0300)]
cgem: support SGMII PHY connection mode

As the PolarFire SoC needs SGMII to connect the PHY, check the
'phy-mode' property of device tree node for ethernet and act on it
appropriately.

Add the compatible strings for the PolarFire SoC device tree.
'microchip,mpfs-mss-gem" is not officially documented but has been
observed in the available firmware for this platform, so it is included
for now.

Also, fix a typo in if_cgem_hw.h.

Reviewed by: mhorne
MFC after: 1 week
Sponsored by: Conclusive Engineering
Differential Revision: https://reviews.freebsd.org/D34764

(cherry picked from commit 34f4c17a2b3df50e9badd030edba187d6acf3b87)

2 years agocgem: rework hardware quirk detection
Milan Obuch [Thu, 7 Apr 2022 12:57:25 +0000 (09:57 -0300)]
cgem: rework hardware quirk detection

Rather than doing these checks based on the detected hardware variant, allow
quirks to be specified as a set of flags for each compatible string.
This simplifies adding support for new compatible hardware.

Reviewed by: mhorne
MFC after: 1 week
Sponsored by: Conclusive Engineering
Differential Revision: https://reviews.freebsd.org/D34764

(cherry picked from commit 66cc0c61b023a5d8ae1c05897bfaf7726be40934)

2 years agosavecore: factor out info file handling
Mitchell Horne [Mon, 18 Apr 2022 15:21:36 +0000 (12:21 -0300)]
savecore: factor out info file handling

Move it to a separate function, allowing its reuse.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34822

(cherry picked from commit cf02cf8dbfe718e1f14cec0cce4663812c0e26f1)

2 years agosavecore: decrease filename buffer sizes
Mitchell Horne [Mon, 18 Apr 2022 15:19:14 +0000 (12:19 -0300)]
savecore: decrease filename buffer sizes

All files are now created relative to savedirfd, e.g. with openat(2).
Therefore, we do not need character buffers to be PATH_MAX bytes long,
just long enough to hold the complete filename. 32 bytes is long enough
in all cases. These can be allocated on the stack.

While here, fix an error message that attempts to use an uninitialized
infoname.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34821

(cherry picked from commit fafeb5342b6402e112e00ecef4e4b49e894e2c11)

2 years agosavecore: fold maxdumps check into getbounds()
Mitchell Horne [Mon, 18 Apr 2022 15:18:13 +0000 (12:18 -0300)]
savecore: fold maxdumps check into getbounds()

So that new callers of getbounds() don't need to duplicate it.

Reviewed by: markj
MFC after: 3 days
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D34783

(cherry picked from commit 4243d307d397dedb2161499742288450fd311e1b)

2 years agofiles: Make mmc_fdt_helper and sdhci depends on clk and regulator
Emmanuel Vadot [Wed, 23 Feb 2022 07:43:45 +0000 (08:43 +0100)]
files: Make mmc_fdt_helper and sdhci depends on clk and regulator

Those two frameworks are needed.

(cherry picked from commit b7bfded1469e66d0531d688066d417f8e83f88c0)

2 years agofiles: Make mmc_pwrseq depends on regulator and clk
Emmanuel Vadot [Tue, 22 Feb 2022 10:22:23 +0000 (11:22 +0100)]
files: Make mmc_pwrseq depends on regulator and clk

It uses those two frameworks too.

(cherry picked from commit adbb32d3e6b3a595e096f14422d0146967927305)

2 years agofiles: Make mmc_helpers depends on regulator and clk
Emmanuel Vadot [Tue, 22 Feb 2022 09:01:22 +0000 (10:01 +0100)]
files: Make mmc_helpers depends on regulator and clk

It also needs those two framework.

(cherry picked from commit 832adbd4c48346a71650b327de7360ab2eb37ff4)

2 years agofiles: Make mmc_helper depend on gpio
Emmanuel Vadot [Mon, 21 Feb 2022 17:31:00 +0000 (18:31 +0100)]
files: Make mmc_helper depend on gpio

mmc_helper have an hard dependency on gpio_if.h
gpio(4) isn't in the default x86 kernel and none of the x86
sd/mmc drivers uses mmc_helper so just add a dependency on gpio.

Fixes: 85b3794ceef ("files: Make ext_resources non-optional")
(cherry picked from commit f898e419255a7f2e309cb3ccc567ff84ecba2eea)

2 years agocpufreq: dt: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:04:09 +0000 (11:04 +0100)]
cpufreq: dt: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit eb80ba8d543f59231ff2161da4b42ee2703dbc7f)

2 years agotwsi: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:57 +0000 (11:03 +0100)]
twsi: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4f118605ad5f8aa5df749e99ee9822f5f1c997b5)

2 years agoif_dwc: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:03:25 +0000 (11:03 +0100)]
if_dwc: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 79778f86922582c44a777c98f54b6f7cf842cbed)

2 years agoarm: allwinner: a10_timer: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 10:02:53 +0000 (11:02 +0100)]
arm: allwinner: a10_timer: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 8604ba7423134df2dd285becba3dd980b9d6baed)

2 years agoarm: allwinner: clk: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:55:07 +0000 (10:55 +0100)]
arm: allwinner: clk: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4c5b550e632ff7de5f1365d369ad25e7033d9b9c)

2 years agoarm64: allwinner: aw_usb3phy: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:54:47 +0000 (10:54 +0100)]
arm64: allwinner: aw_usb3phy: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit cfd8b9545e62f2dbe5b03453aa34a53ee1a2cce9)

2 years agoarm: allwinner: aw_gpio: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:53:58 +0000 (10:53 +0100)]
arm: allwinner: aw_gpio: Plug set but not used variable

Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 3dc60bab2750cdab9963c179786cd7d4f1931303)

2 years agoarm64: allwinner: axp81x: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:39:05 +0000 (10:39 +0100)]
arm64: allwinner: axp81x: Plug set but not used variable
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit aeb70a6707f79ab9f31cb812ff7550a7c68f4fb1)

2 years agoarm64: allwinner: aw_sid: Plug set but not used variable
Emmanuel Vadot [Mon, 21 Feb 2022 09:38:06 +0000 (10:38 +0100)]
arm64: allwinner: aw_sid: Plug set but not used variable
Sponsored by: Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 34abc89413a4c14f68b3a8c54a8bc5b6e1d2d787)

2 years agofiles: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 10:03:05 +0000 (11:03 +0100)]
files: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33834

(cherry picked from commit 85b3794ceef5f3591e21759f592f09afb4b7a1dd)

2 years agoarmv7: allwinner: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:51:52 +0000 (10:51 +0100)]
armv7: allwinner: Make ext_resources non-optional

The only valid condition for if_awg and aw_syscon is syscon.
EXT_RESOURCES is enabled in GENERIC since 12-CURRENT.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33833

(cherry picked from commit ee2e56c6d7f604e7aab8a8414753951a5809a985)

2 years agobhyve/usage: memory size is not in MB
Corvin Köhne [Thu, 10 Mar 2022 10:30:17 +0000 (11:30 +0100)]
bhyve/usage: memory size is not in MB

For backward compatibility, the memory size will be interpreted in MB if
it's smaller than1 MB and has no suffix. Nowadays, the -m switch accepts
more than just MB. Respect it in the usage message.

Differential Revision: https://reviews.freebsd.org/D34506
Reviewed by: grehan
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month

(cherry picked from commit afd4f7fa25324608c59a56f38cf4c624522c99fc)

2 years agobhyve: add ROM emulation
Corvin Köhne [Thu, 10 Mar 2022 10:28:06 +0000 (11:28 +0100)]
bhyve: add ROM emulation

Some PCI devices especially GPUs require a ROM to work properly.
The ROM is executed by boot firmware to initialize the device.
To add a ROM to a device use the new ROM option for passthru device
(e.g. -s passthru,0/2/0,rom=<path>/<to>/<rom>).

It's necessary that the ROM is executed by the boot firmware.
It won't be executed by any OS.
Additionally, the boot firmware should be configured to execute the
ROM file.
For that reason, it's only possible to use a ROM when using
OVMF with enabled bus enumeration.

Differential Revision: https://reviews.freebsd.org/D33129
Sponsored by:   Beckhoff Automation GmbH & Co. KG
MFC after:      1 month

(cherry picked from commit e47fe3183e1f2d531230ffc627ec165ea23e72cb)

2 years agobhyve: export funcs for read/write pci config
Corvin Köhne [Thu, 10 Mar 2022 10:26:19 +0000 (11:26 +0100)]
bhyve: export funcs for read/write pci config

Export functions for reading and writing the pci config space from passthru
device to be used by other devices.
This is required for lpc devices to set their vendor/device ids to their
physical values.
Otherwise, GPU passthrough for integrated Intel GPUs won't work properly.

Differential Revision: https://reviews.freebsd.org/D33769
Reviewed by: markj
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 month

(cherry picked from commit 563fd2240e13cfb53f6e5d50e9d1dc738b7c441e)

2 years agolibutil: eliminate one syscall from kinfo_getproc
Ed Maste [Fri, 6 May 2022 16:41:04 +0000 (12:41 -0400)]
libutil: eliminate one syscall from kinfo_getproc

Previously we invoked the sysctl with a NULL buffer to query the size,
allocated a buffer, then invoked it again to fetch the data.

As we only handle the case where the sysctl provides data of the
expected size we can just allocate a correctly-sized buffer to begin
with.

Reported by: Thomas Hurst via Twitter
Reviewed by: kevans
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35140

(cherry picked from commit 904c148f1c939f080b9fad345b76caa8ccb6d03c)

2 years agoarm: Add extres pseudo devices to some kernel
Emmanuel Vadot [Wed, 23 Feb 2022 07:44:16 +0000 (08:44 +0100)]
arm: Add extres pseudo devices to some kernel

All the pseudo devices and framework are required by drivers.

Reported by: mjg

(cherry picked from commit f34560385c730c8b1db4f46a9c711a60511864bf)

2 years agoofw_cpu: Make ext_resources non-optional for arm* and riscv
Emmanuel Vadot [Tue, 11 Jan 2022 10:08:18 +0000 (11:08 +0100)]
ofw_cpu: Make ext_resources non-optional for arm* and riscv

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.
For RISC-V it was always enabled.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33835

(cherry picked from commit 02398e581d4511bd1c5e8ffad5155f9b9684b4b8)

2 years agovf_i2c: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:51:06 +0000 (10:51 +0100)]
vf_i2c: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33832

(cherry picked from commit 4bcdfeb06fc7e7463904a8a89d7e45b277f21483)

2 years agoimx_gpio: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:50:05 +0000 (10:50 +0100)]
imx_gpio: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33831

(cherry picked from commit 90a5fc326e6484f02f9889ea7a356342f36731f4)

2 years agoimx_i2c: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:49:32 +0000 (10:49 +0100)]
imx_i2c: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33830

(cherry picked from commit 774a4b6a51532b1a63530973d5bf8d798bc16669)

2 years agobcm2835_sdhci: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:48:15 +0000 (10:48 +0100)]
bcm2835_sdhci: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

Reviewed by: kevans
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33829

(cherry picked from commit 14444bf7c8cd2bb875378e470b6fb2a85bcad0e5)

2 years agouart_dev_snps: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:46:50 +0000 (10:46 +0100)]
uart_dev_snps: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33828

(cherry picked from commit 5c00765bf2378c8ed92abe78028f203e91ddbf91)

2 years agousb: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:45:42 +0000 (10:45 +0100)]
usb: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33827

(cherry picked from commit fb6cebd8bdf457444c02e7a30b4b9d24f45568c6)

2 years agouart_dev_imx: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:43:40 +0000 (10:43 +0100)]
uart_dev_imx: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33826

(cherry picked from commit 4f64df4e32a7c14c5862b5f866bae2b090d25edb)

2 years agoif_cgem: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:42:34 +0000 (10:42 +0100)]
if_cgem: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33825

(cherry picked from commit d46fd9e855a2212f59ae35e84162d2d1a44f2035)

2 years agosdhci: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:41:23 +0000 (10:41 +0100)]
sdhci: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33824

(cherry picked from commit a813b0965d8e9765135ad92a78ce62c8b762b99f)

2 years agotwsi: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:39:47 +0000 (10:39 +0100)]
twsi: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33823

(cherry picked from commit 36498b14083d5be64052e65bd7d1c81c1352dce4)

2 years agodwmmc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:38:24 +0000 (10:38 +0100)]
dwmmc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33822

(cherry picked from commit b4cc0f7d28e2f4ae12db3be75658ac5b8c1293f1)

2 years agommc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:37:02 +0000 (10:37 +0100)]
mmc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D33821

(cherry picked from commit 78f8b4aafaa0030cfda4d1a775150441ac0a5343)

2 years agodwc: Make ext_resources non-optional
Emmanuel Vadot [Tue, 11 Jan 2022 09:34:36 +0000 (10:34 +0100)]
dwc: Make ext_resources non-optional

EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D33820

(cherry picked from commit a5339ba3ff147618e21f45a11f062ccb9fadafb2)

2 years agodwmmc: Properly implement power_off/power_up
Emmanuel Vadot [Tue, 21 Sep 2021 14:10:11 +0000 (16:10 +0200)]
dwmmc: Properly implement power_off/power_up

Write to the PWREN register should be done in update_ios based
on the power_mode value in the ios struct.
Also none of the manual (RockChip and Altera) and Linux talks about
the needed for an inverted PWREN value so just remove this.
This fixes eMMC (and possibly SD) when u-boot didn't setup the controller.

Reported by: avg
Tested-on: Rock64, RockPro64

(cherry picked from commit af32e2cc32b2516826e301d5f857ff7343b1210e)

2 years agodwmmc: Remove dwmmc_setup_bus call from start_cmd
Emmanuel Vadot [Tue, 21 Sep 2021 15:52:38 +0000 (17:52 +0200)]
dwmmc: Remove dwmmc_setup_bus call from start_cmd

There is no need to re-setup the bus before each commands.
Tested-on:  Rock64, RockPro64
Reported by:     avg

(cherry picked from commit 559f60214b7498ac068c5aa1f2bdecc1610bab53)

2 years agodwmmc: Fix MMCCAM block size support
Emmanuel Vadot [Wed, 14 Jul 2021 15:25:05 +0000 (17:25 +0200)]
dwmmc: Fix MMCCAM block size support

When using SDIO the block size if per function and most of the time
not equal to MMC_SECTOR_SIZE, fix sdio on dwmmc by setting the correct
block size in the mmc registers.

MFC after:    1 month
Sponsored by: Diablotin Systems

(cherry picked from commit 990a1dbf6fe1a9f4dc491d3e4e276034919b94f3)

2 years agoMap the ACPI tables into the DMAP
Andrew Turner [Fri, 29 Apr 2022 12:02:15 +0000 (13:02 +0100)]
Map the ACPI tables into the DMAP

When we try to load these tables via acpidump(8) we need them to be in
the DMAP for /dev/mem to access. Add the EFI ACPI reclaim memory type
to the list of memory we map into DMAP but not used by the kernel as
this is the recommended place to put these.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5b651b501a466a0c2a8ec6b5afaae348c410f116)

2 years agong_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp
Eugene Grosbein [Sun, 1 May 2022 16:34:08 +0000 (23:34 +0700)]
ng_pppoe: introduce new sysctl net.graph.pppoe.lcp_pcp

New sysctl allows to mark transmitted PPPoE LCP Control
ethernet frames with needed 3-bit Priority Code Point (PCP) value.
Confirming driver like if_vlan(4) uses the value to fill
IEEE 802.1p class of service field.

This is similar to Cisco IOS "control-packets vlan cos priority"
command.

It helps to avoid premature disconnection of user sessions
due to control frame drops (LCP Echo etc.)
if network infrastructure has a botteleck at a switch
or the xdsl DSLAM.

See also:
https://sourceforge.net/p/mpd/discussion/44692/thread/c7abe70e3a/

Tested by: Klaus Fokuhl at SourceForge

(cherry picked from commit 2e547442ab3822d3d7c46a68f152032ef5fe337c)
(cherry picked from commit 28903f396af4b151e16ea606cda66a9244fb179f)

2 years agonfsd: Add a sanity check to SecinfoNoname for file type
Rick Macklem [Sun, 1 May 2022 20:41:31 +0000 (13:41 -0700)]
nfsd: Add a sanity check to SecinfoNoname for file type

Robert Morris reported that, for the case of SecinfoNoname
with the Parent option, providing a non-directory could
cause a crash.

This patch adds a sanity check for v_type == VDIR for
this case, to avoid the crash.

PR: 260300

(cherry picked from commit 47d75c29f5510ad844f0bc7fbc07d481ebb7fd9e)

2 years agoe1000: Increase rx_buffer_size to 32b
Kevin Bowling [Thu, 12 May 2022 15:38:09 +0000 (08:38 -0700)]
e1000: Increase rx_buffer_size to 32b

Extend the size of the local rx_buffer_size variable to account for
larger buffer sizes possible on 82580, i350 chips.

From i350 datasheet, 6.2.10 Initialization Control 4 (LAN Base Address
+ Offset 0x13):
When 4 ports are enabled maximum buffer size is 36 KB. When 2 ports are
enabled maximum buffer size is 72 KB. When only a single port is
enabled maximum buffer size is 144 KB.

and 8.3:
The overall available internal buffer size in the I350 for all ports is
144 KB for receive buffers and 80 KB for transmit Buffers. Disabled
ports memory can be shared between active ports and sharing can be
asymmetric. The default buffer size for each port is loaded from the
EEPROM on initialization.

From the reporter:
But for I350 when only 2 ports are used PBA size can be set as 72KB
(see datasheet RXPbsize or e1000_rxpbs_adjust_82580 function in
e1000_82575.c). In this case calculating the rx_buffer_size overflows
as 0x0048 << 10 = 73728 or 0x12000 pushed into u16. It is then set as
0x2000 or 8192.

PR: 263896
Reported by: hannula@gmail.com
Tested by: hannula@gmail.com
Approved by: markj
Differential Revision: https://reviews.freebsd.org/D35167

(cherry picked from commit 6987c47569b377f4b6eba9966afdedfb1b39fca8)

2 years agoDefault to always accepting the PHY that's present. Linux did
Scott Long [Sun, 27 Feb 2022 01:29:08 +0000 (18:29 -0700)]
Default to always accepting the PHY that's present.  Linux did
something similar a while back, and there are devices in the wild
that otherwise won't attach.  This patch is temporary until the
PHY code is further cleared up.

Obtained from: grehan

(cherry picked from commit 6f3c0d2764f230444818a95009028861493c1594)

2 years agoepair: unbind prior to returning to userspace
Kristof Provost [Sat, 7 May 2022 15:15:34 +0000 (17:15 +0200)]
epair: unbind prior to returning to userspace

If 'options RSS' is set we bind the epair tasks to different CPUs. We
must take care to not keep the current thread bound to the last CPU when
we return to userspace.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit cbbce42345c51536d7dc63643f47a3cbf87d647e)

2 years agoepair: fix set but not used warning
Kristof Provost [Sat, 7 May 2022 14:00:42 +0000 (16:00 +0200)]
epair: fix set but not used warning

If 'options RSS' is set.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit a6b0c8d04d2a72b3b3b7cd4ad5251aa35ff6353e)

2 years agoin_rss: fix set but not used warning
Kristof Provost [Sat, 7 May 2022 14:01:13 +0000 (16:01 +0200)]
in_rss: fix set but not used warning

If 'options RSS' is set.

MFC after: 1 week
Sponsored by: Orange Business Services

(cherry picked from commit 017e7d0390870061372f8f708dcbff612983f97a)

2 years agoOpenSSL: KTLS: Enable KTLS for receiving as well in TLS 1.3
John Baldwin [Wed, 4 May 2022 20:08:36 +0000 (13:08 -0700)]
OpenSSL: KTLS: Enable KTLS for receiving as well in TLS 1.3

This removes a guard condition that prevents KTLS being enabled for
receiving in TLS 1.3.  Use the correct sequence number and BIO for
receive vs transmit offload.

Approved by: jkim
Obtained from: OpenSSL commit 7c78932b9a4330fb7c8db72b3fb37cbff1401f8b
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34976

(cherry picked from commit 913616b88505b2a5ff40f3d0a4b504d39ee563bb)

2 years agoOpenSSL: KTLS: Handle TLS 1.3 in ssl3_get_record.
John Baldwin [Wed, 4 May 2022 20:08:27 +0000 (13:08 -0700)]
OpenSSL: KTLS: Handle TLS 1.3 in ssl3_get_record.

- Don't unpad records, check the outer record type, or extract the
  inner record type from TLS 1.3 records handled by the kernel.  KTLS
  performs all of these steps and returns the inner record type in the
  TLS header.

- When checking the length of a received TLS 1.3 record don't allow
  for the extra byte for the nested record type when KTLS is used.

- Pass a pointer to the record type in the TLS header to the
  SSL3_RT_INNER_CONTENT_TYPE message callback.  For KTLS, the old
  pointer pointed to the last byte of payload rather than the record
  type.  For the non-KTLS case, the TLS header has been updated with
  the inner type before this callback is invoked.

Approved by: jkim
Obtained from: OpenSSL commit a5fb9605329fb939abb536c1604d44a511741624
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34975

(cherry picked from commit c0f977bfb6d9853fd6f762444310c23d8d7ec252)

2 years agoOpenSSL: KTLS: Add using_ktls helper variable in ssl3_get_record().
John Baldwin [Wed, 4 May 2022 20:08:17 +0000 (13:08 -0700)]
OpenSSL: KTLS: Add using_ktls helper variable in  ssl3_get_record().

When KTLS receive is enabled, pending data may still be present due to
read ahead.  This data must still be processed the same as records
received without KTLS.  To ease readability (especially in
consideration of additional checks which will be added for TLS 1.3),
add a helper variable 'using_ktls' that is true when the KTLS receive
path is being used to receive a record.

Approved by: jkim
Obtained from: OpenSSL commit 031132c297e54cbc20404a0bf8de6ed863196399
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34974

(cherry picked from commit 4f1f9c550227667efaad65e7f2a0034355d94dc8)

2 years agoOpenSSL: KTLS: Check for unprocessed receive records in ktls_configure_crypto.
John Baldwin [Wed, 4 May 2022 20:08:03 +0000 (13:08 -0700)]
OpenSSL: KTLS: Check for unprocessed receive records in ktls_configure_crypto.

KTLS implementations currently assume that the start of the in-kernel
socket buffer is aligned with the start of a TLS record for the
receive side.  The socket option to enable KTLS specifies the TLS
sequence number of this initial record.

When read ahead is enabled, data can be pending in the SSL read buffer
after negotiating session keys.  This pending data must be examined to
ensurs that the kernel's socket buffer does not contain a partial TLS
record as well as to determine the correct sequence number of the
first TLS record to be processed by the kernel.

In preparation for enabling receive kernel offload for TLS 1.3, move
the existing logic to handle read ahead from t1_enc.c into ktls.c and
invoke it from ktls_configure_crypto().

Approved by: jkim
Obtained from: OpenSSL commit 85773128d0e80cd8dcc772a6931d385b8cf4acd1
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34973

(cherry picked from commit 019cff03b32ce1fbf91dbf84f0805662cd04d459)

2 years agoOpenSSL: Cleanup record length checks for KTLS
John Baldwin [Wed, 4 May 2022 20:07:36 +0000 (13:07 -0700)]
OpenSSL: Cleanup record length checks for KTLS

In some corner cases the check for packets
which exceed the allowed record length was missing
when KTLS is initially enabled, when some
unprocessed packets are still pending.

Approved by: jkim
Obtained from: OpenSSL commit 8fff986d52606e1a33f9404504535e2e2aee3e8b
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D34972

(cherry picked from commit f6e5fcdc848fc24fe71f01ba583f13e762c0ab54)

2 years agoKTLS: Free the MAC session when destroying AES-CBC software sessions.
John Baldwin [Thu, 21 Apr 2022 20:49:40 +0000 (13:49 -0700)]
KTLS: Free the MAC session when destroying AES-CBC software sessions.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35013

(cherry picked from commit 4b337ada34bc795e6d992ee10c879afe45f04cdb)

2 years agodestroy_dev_sched*: Don't hold Giant for all deferred destroy_dev.
John Baldwin [Mon, 18 Apr 2022 19:04:30 +0000 (12:04 -0700)]
destroy_dev_sched*: Don't hold Giant for all deferred destroy_dev.

Rather than using taskqueue_swi_giant which holds Giant for all
deferred destroy_dev calls, create a separate queue for destroyed
devices with D_NEEDGIANT set in the corresponding cdevsw.  The task
for this queue holds Giant whild destroying deferred devices while the
task for the default queue does not hold Giant.

In addition, switch to taskqueue_thread for destroy_dev_sched.
Deferred destroy_dev requests don't need to run at an SWI priority.

Reviewed by: imp, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34915

(cherry picked from commit d139909d6e8d540c0b832554d1b77fef0cf215b6)

2 years agoarm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.
John Baldwin [Mon, 18 Apr 2022 21:09:20 +0000 (14:09 -0700)]
arm ti_mbox_attach: Write sysconfig to TI_MBOX_SYSCONFIG to request reset.

This variable was flagged as a set but unused warning as its value was
read from a register and then modified to set a bit
(TI_MBOX_SYSCONFIG_SOFTRST).  After the variable is modified, the code
then loops waiting for the SOFTRST bit to go clear in the
TI_MBOX_SYSCONFIG register.  Presumably merely reading from the
register does not request a reset as other places in the driver read
this register, so most likely the updated value of sysconfig setting
the reset bit is supposed to be written to the register to request a
reset before the polling loop that waits for the reset to finish.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34856

(cherry picked from commit ecbe50447d04d7e9e042a20d88e7773d03b4f68e)

2 years agoas3722_gpio_pin_setflags: Use computed mode instead of hardcoded PUSHPULL.
John Baldwin [Mon, 18 Apr 2022 19:28:48 +0000 (12:28 -0700)]
as3722_gpio_pin_setflags: Use computed mode instead of hardcoded PUSHPULL.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D34855

(cherry picked from commit dca7f696322a06247a1f73ad0e843ff9795457a1)

2 years agoata_kauai: Fix support for "shasta" controllers.
John Baldwin [Mon, 18 Apr 2022 19:06:52 +0000 (12:06 -0700)]
ata_kauai: Fix support for "shasta" controllers.

The probe routine was setting a value in the softc, but since the
probe routine was not returning zero, this value was lost since the
softc was reallocated (and re-zeroed) when the device was attached.
This is similar in nature to the fixes from
965205eb66cae3fd5de75a70a3aef2f014f98020.

To fix, move the code to set the 'shasta' flag to the start of attach
along with related code to set an IRQ resource on some non-shasta
devices.  The IRQ resource still "worked" being in the probe routine
as the IRQ resource persisted after probe returned, but it is cleaner
to go ahead and move it to attach after setting the 'shasta' flag.

I have no way to test this, but noticed this while reading the code.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D34888

(cherry picked from commit d5472cd4b3a3fedd56589a16a96f997d1d8fa1dc)

2 years agoix: Remove cpu_id and related code from ixgbe_if_msix_intr_assign.
John Baldwin [Wed, 13 Apr 2022 00:01:46 +0000 (17:01 -0700)]
ix: Remove cpu_id and related code from ixgbe_if_msix_intr_assign.

Reviewed by: erj
Differential Revision: https://reviews.freebsd.org/D34828

(cherry picked from commit c0a42a04513de99fc02b30a88a6de0f85cf644db)

2 years agonetgraph: Remove the rethook parameter from NG_NODE_FOREACH_HOOK.
John Baldwin [Tue, 12 Apr 2022 21:58:59 +0000 (14:58 -0700)]
netgraph: Remove the rethook parameter from NG_NODE_FOREACH_HOOK.

This parameter was set to the hook that terminated the iteration
early.  However, none of the remaining callers used this argument and
it was always set to an otherwise-unused variable.

(cherry picked from commit 6d5f002ed1187547b0b40f8b46a3db38bf89c6dc)

2 years agopowerpc pmu: Don't use garbage battery info.
John Baldwin [Tue, 12 Apr 2022 21:58:58 +0000 (14:58 -0700)]
powerpc pmu: Don't use garbage battery info.

If pmu_query_battery fails, don't notify a change in battery status.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D34889

(cherry picked from commit 5f2995aa950f99ca124a450e4e57c9966fba802a)

2 years agopowermac_nvram: Actually return EBUSY on error from open.
John Baldwin [Tue, 12 Apr 2022 21:58:58 +0000 (14:58 -0700)]
powermac_nvram: Actually return EBUSY on error from open.

(cherry picked from commit 124b6786e4de5be21e86b27c03510e62af166b48)

2 years agox86: Remove silly checks for <sys/cdefs.h>.
John Baldwin [Tue, 12 Apr 2022 17:05:39 +0000 (10:05 -0700)]
x86: Remove silly checks for <sys/cdefs.h>.

These headers #include <sys/cdefs.h> right after checking if it has
already been #included.  The nested #include already existed when the
check for _SYS_CDEFS_H_ was added, so the check shouldn't have been
added in the first place.

PR: 263102 (exp-run)
Reported by: brooks
Reviewed by: brooks, imp, emaste
Differential Revision: https://reviews.freebsd.org/D34796

(cherry picked from commit 1c1bf5bd7c1e479a7889839b941f53e689aa2569)

2 years agoDrop an OBE MP safe comment.
John Baldwin [Fri, 25 Mar 2022 17:01:39 +0000 (10:01 -0700)]
Drop an OBE MP safe comment.

(cherry picked from commit a7eb8afe9a8b9ac3a61e819e3940ad16a84b63a0)

2 years agoce,cp: Remove pointless checks for <sys/cdefs.h>
John Baldwin [Tue, 12 Apr 2022 17:05:34 +0000 (10:05 -0700)]
ce,cp: Remove pointless checks for <sys/cdefs.h>

Both of these headers check for _SYS_CDEFS_H_ after including
<sys/param.h> which itself includes <sys/cdefs.h>.

PR: 263102 (exp-run)
Reviewed by: brooks, imp, emaste
Differential Revision: https://reviews.freebsd.org/D34795

(cherry picked from commit 17554af4e8531f443fce1a58ab6d4b45d82af5f2)

2 years agobcm2835_audio_callback: Don't process garbage if there is no message.
John Baldwin [Sat, 9 Apr 2022 01:31:29 +0000 (18:31 -0700)]
bcm2835_audio_callback: Don't process garbage if there is no message.

If vchi_msg_dequeue failed due to an empty queue, return rather than
treating stack garbage as a valid message.

(cherry picked from commit 4f6be8c788ca0339a84e935515d290b59dbec31b)

2 years agosbni: Use memset to clear flags structure in attach.
John Baldwin [Sat, 9 Apr 2022 00:25:14 +0000 (17:25 -0700)]
sbni: Use memset to clear flags structure in attach.

NFC, just less nausea-inducing.

(cherry picked from commit 9c11e6af89c3a9c50e52af5fa2645936dc7eff5d)

2 years agoPass the computed enum of the correct type to dbg_setup_watchpoint.
John Baldwin [Sat, 9 Apr 2022 00:25:14 +0000 (17:25 -0700)]
Pass the computed enum of the correct type to dbg_setup_watchpoint.

The two sets of constants happen to have the same values, so this is
just a cosmetic fix.

(cherry picked from commit 533b6ecfdcae61a47740381193e050de91f1f430)

2 years agortwn: Restore RF_ENV control type after initializing RF.
John Baldwin [Fri, 8 Apr 2022 00:01:28 +0000 (17:01 -0700)]
rtwn: Restore RF_ENV control type after initializing RF.

Both rwlwifi in Linux and rtwn in OpenBSD restore this register,
and the existing code was saving the value and not using it.

Reported by: -Wunused-but-set-variable
Reviewed by: imp
Obtained from: OpenBSD
Differential Revision: https://reviews.freebsd.org/D34838

(cherry picked from commit 50e3b6aa480b34e6eb87530d307db7ceba591a17)

2 years agoqlnx: Return error from qlnxr_mod_load if it fails.
John Baldwin [Fri, 8 Apr 2022 00:01:27 +0000 (17:01 -0700)]
qlnx: Return error from qlnxr_mod_load if it fails.

Fix qlnx_rdma_register_if return ENXIO rather than -1 on error and
propagate that error to the caller in qlnxr_mod_load.

(cherry picked from commit ee07d712131468908a61b948851ce17be76931ac)

2 years agootus: Return computed error value instead of ENXIO from otus_raw_xmit.
John Baldwin [Fri, 8 Apr 2022 00:01:27 +0000 (17:01 -0700)]
otus: Return computed error value instead of ENXIO from otus_raw_xmit.

(cherry picked from commit c0ca75b0db2fac9c4fd900a0ba8fe453c4c6156c)