Commit graph

39416 commits

Author SHA1 Message Date
Andrew Turner
bc98adaf6a Check cpu_softc is not NULL before dereferencing
In the acpi_cpu_postattach SYSINIT function cpu_softc may be NULL, e.g.
on arm64 when booting from FDT. Check it is not NULL at the start of
the function so we don't try to dereference a NULL pointer.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4e50efb194)
2022-01-04 13:08:58 -05:00
Alexander Motin
6b06f8a792 amdtemp: Revert related part of "Make CPU children" commit.
While it still looks like previous code worked by coincidence, this
change broke things even more instead of fixing.

Reported by:	avg@
MFC after:	1 week

(cherry picked from commit 94a72c5ac4)
2022-01-04 12:21:49 -05:00
Alexander Motin
a77188ffd3 acpi_cpu: Fix panic if some CPU devices are disabled.
While there, remove couple unneeded global variables.

(cherry picked from commit 695323ae88)
2022-01-04 12:21:46 -05:00
Alexander Motin
b7668d009e Make CPU children explicitly share parent unit numbers.
Before this device unit number match was coincidental and broke if I
disabled some CPU device(s).  Aside of cosmetics, for some drivers
(may be considered broken) it caused talking to wrong CPUs.

(cherry picked from commit d3a8f98acb)
2022-01-04 12:21:42 -05:00
Alexander Motin
083a2ff0f0 acpi_cpu: Make device unit numbers match OS CPU IDs.
There are already APIC ID, ACPI ID and OS ID for each CPU.  In perfect
world all of those may match, but at least for SuperMicro server boards
none of them do.  Plus none of them match the CPU devices listing order
by ACPI.  Previous code used the ACPI device listing order to number
cpuX devices.  It looked nice from NewBus perspective, but introduced
4th different set of IDs. Extremely confusing one, since in some places
the device unit numbers were treated as OS CPU IDs (coretemp), but not
in others (sysctl dev.cpu.X.%location).

(cherry picked from commit c8077ccd70)
2022-01-04 12:21:35 -05:00
Alexander Motin
2572b6bd6b xen/blkfront: Remove CTLFLAG_NEEDGIANT from sysctl.
It only converts bit field into string.  It does not need locking.

MFC after:	1 week

(cherry picked from commit 54daceab55)
2022-01-02 16:39:28 -05:00
Bjoern A. Zeeb
a34668185b modules: increase MAXMODNAME and provide backward compat
With various firmware files used by graphics and wireless drivers
we are exceeding the current 32 character module name (file path
in kldxref) length.
In order to overcome this issue bump it to the maximum path length
for the next version.
To be able to MFC provide backward compat support for another version
of the struct as the offsets for the second half change due to the
array size increase.

MAXMODNAME being defined to MAXPATHLEN needs param.h to be
included first.  With only 7 modules (or LinuxKPI module.h) not
doing that adjust them rather than including param.h in module.h [1].

Reported by:	Greg V (greg unrelenting.technology)
Sponsored by:	The FreeBSD Foundation
Suggested by:	imp [1]
Reviewed by:	imp (and others to different level)
Differential Revision:	https://reviews.freebsd.org/D32383

(cherry picked from commit df38ada293)
2021-12-30 18:26:18 +00:00
Bjoern A. Zeeb
8adc24f7c5 USB dwc3 controller: add quirk snps,dis_rxdet_inp3_quirk
Add support for the "snps,dis_rxdet_inp3_quirk" quirk needed
at least on SolidRun's HoneyComb.

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

(cherry picked from commit 3987e50611)
2021-12-29 16:02:51 +00:00
Bjoern A. Zeeb
907c4e7538 USB: add CYUSB330x to usbdevs
Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.

(cherry picked from commit 1910048eb9)
2021-12-29 16:02:38 +00:00
Andriy Gapon
bf206683a8 amdsbwd: always enable watchdog register decoding
This seems to be required even if the watchdog is accessed via the common
MMIO space.

Tested on:
- Ryzen 3 3200U APU;
- Ryzen 7 5800X CPU with X570 chipset.

(cherry picked from commit cca0d3bbd8)
2021-12-27 13:37:29 +02:00
Andriy Gapon
96097be6a8 vmxnet3: skip zero-length descriptor in the middle of a packet
Passing up such descriptors to iflib is obviously wasteful.
But the main conern is that we may overrun iri_frags array because of
them.  That's been observed in practice.

Also, assert that the number of fragments / descriptors / segments is
less than IFLIB_MAX_RX_SEGS.

Sponsored by:	Panzura LLC

(cherry picked from commit 9c612a5d0a)
2021-12-27 13:37:12 +02:00
黃清隆
a6f70ce9fc sys/dev/arcmsr: Update Areca RAID driver to fix some issues on ARC-1886.
1. Doorbell interrupt status may arrive lately when doorbell interrupt on
   ARC-1886.
2. System boot up hung when ARC-1886 with no volume created or no device
   attached.

Many thanks to Areca for continuing to support FreeBSD.

(cherry picked from commit 6964b77e59)
2021-12-26 22:54:48 -08:00
Mark Johnston
2520c9ba7e qat: Address -Wunused-but-set-variable warnings
(cherry picked from commit 8fcf230c13)
2021-12-26 19:15:14 -05:00
Andriy Gapon
fe3c0370da twsi: use twsi_error() to handle wrong bus status when starting
(cherry picked from commit 46e0c03795)
2021-12-26 12:15:18 +02:00
Alexander Motin
e6140a05bc hwpmc: Add IDs for Intel Comet/Ice/Tiger/Rocketlake CPUs.
MFC after:	1 month

(cherry picked from commit 913c07a049)
2021-12-25 19:47:16 -05:00
Gordon Bergling
56cb816fb7 sound(4): Fix a typo in a source code comment
- s/aggresively/aggressively/

(cherry picked from commit d34632a235)
2021-12-25 11:40:16 +01:00
Ram Kishore Vegesna
cc3114e17b ocs_fc: Populate subvendor and subdevice ids.
Enable serialnumber reporting.

Reviewed by: mav
MFC after: 3 days

(cherry picked from commit cba757ef2a)

ocs_fs(4): Fix some common typos in source code comments

- s/transfered/transferred/
- s/associted/associated/

MFC after:	3 days

(cherry picked from commit 16b71d98d9)
2021-12-24 14:28:15 +05:30
Alexander Motin
f9c97b8ada hpt27xx: Remove FreeBSD 9.x support including Giant.
MFC after:	2 weeks

(cherry picked from commit 63e0f96ace)
2021-12-23 20:05:21 -05:00
Alexander Motin
7f703988b5 ahc: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks

(cherry picked from commit 35b2021a0a)
2021-12-23 20:05:13 -05:00
Alexander Motin
4fd804ef66 ahci(4): Allow enclosure emulation without hardware.
After 53f5ac1310 allowed SATA device mapping to enclosure slots,
it may have sense to provide enclosure device emulation even without
real hardware interface like SGPIO just for purposes of physical
device location tracking (still assuming straight cabling).

MFC after:	1 week
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 9aba757e92)
2021-12-23 20:05:10 -05:00
Alexander Motin
dee2739713 wbwd: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks

(cherry picked from commit fdec27ed82)
2021-12-23 20:05:06 -05:00
Alexander Motin
93ce10ed26 hptiop: Remove Giant locking around ioctls.
The methods have their own locking and don't require Giant.

MFC after:	2 weeks

(cherry picked from commit e06c67eef8)
2021-12-23 20:05:03 -05:00
Alexander Motin
951183ac83 fxp: Mark sysctls with CTLFLAG_MPSAFE.
MFC after:	2 weeks

(cherry picked from commit 35efbedc98)
2021-12-23 20:03:09 -05:00
Alexander Motin
c5794c708c fxp: Remove unneeded Giant from bus_dma_tag_create().
All bus_dmamap_load() calls here use BUS_DMA_NOWAIT.

MFC after:	2 weeks

(cherry picked from commit 5ae7518b7b)
2021-12-23 20:03:05 -05:00
Andriy Gapon
a520d08538 twsi: fix handling of consecuitve write messages in transaction
Make sure to reset 'message_done' flag when jumping from a message to the
next one within the same interrupt handler call.  This happens only when
a write with no-stop flag message is followed by a write with no-start
flag message.
Without this fix the second message would be prematurely "completed"
without waiting for an ACK (or NACK) for its first byte and without
sending subsequent bytes (if any).

Fixes:		ff1e8581 twsi: support more message combinations in transfers

(cherry picked from commit e5268c3d43)
2021-12-23 10:45:38 +02:00
Andriy Gapon
524020aa37 ds3231: allow configuration via hints on FDT systems
(cherry picked from commit 1256067c5c)
(cherry picked from commit b277ef3304)
2021-12-23 10:44:54 +02:00
Vincenzo Maffione
ecb7f44be9 e1000: fix interface capabilities management
The e1000 drivers (em, lem, igb) are currently looking at the
iflib copies of the capabilities bitvectors (scctx->isc_capabilities
and scctx->isc_capenable) rather than the ifnet ones
(ifp->if_capabilities and ifp->if_capenable). However, the latter
are the ones that are actually updated by ifconfig and that should
be used by the drivers during interface operation. The former are
set by the driver on interface attach (for iflib internal use)
and should not be used anymore by the driver.
This patch fixes the e1000 driver to use the correct bitvectors.

PR:		260068
Reviewed by:	markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33154

(cherry picked from commit e0f4cdba53)
2021-12-22 08:50:35 +00:00
Emmanuel Vadot
6bd6344f13 fb: Add new FBTYPE_EFIFB
Currently the type isn't set in the fbtype struct so any userland
program that call the FBIOGTYPE ioctl will think it's a FBTYPE_SUN1BW
which is far from the truth.
No app that I found find checks the type but at least now it's correct.

Reviewed by:	emaste, tsoome
MFC after:	2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33221

(cherry picked from commit ca23e9d2ac)
2021-12-21 10:21:26 +01:00
Emmanuel Vadot
0c543a6541 fb: Remove some unused ioctls
6d1699583d added the FBIOGXINFO,FBIOMONINFO and FBIOPUTCMAPI/FBIOGETCMAPI
ioctls and said that implementation in driver will come later.
Since it was in 2001 I think we can remove this.

Reviewed by:	emaste, imp, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33218
Differential Revision:	https://reviews.freebsd.org/D33219
Differential Revision:	https://reviews.freebsd.org/D33220

(cherry picked from commit 706f32db8a)
2021-12-21 10:21:26 +01:00
Emmanuel Vadot
cee79df364 fb: Remove unused cursors ioctls
The cursors related ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by:	emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33217

(cherry picked from commit b9d3b253e2)

arm/freescale: remove FBIOSCURSOR

Unbreaks building EFIKA_MX

Fixes:	b9d3b253e2 ("fb: Remove unused cursors ioctls")
Sponsored by:	Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 793c74e415)
2021-12-21 10:21:16 +01:00
Emmanuel Vadot
906e705e08 fb: Remove unused FBIOVERTICAL ioctl
Commit 6d1699583d added the FBIOVERTICAL ioctl and said that implementation
in driver will come later.
Since it was in 2001 I think we can remove this.

MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 87fae70dc5)
2021-12-21 10:18:52 +01:00
Emmanuel Vadot
cc72313664 fb: Remove unused FBIOSVIDEO/FBIOGVIDEO ioctls
The FBIOSVIDEO/FBIOGVIDEO ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by:	emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33216

(cherry picked from commit 26542b33a4)
2021-12-21 10:18:50 +01:00
Emmanuel Vadot
2d8d4ade23 fb: Remove unused FBIOSATTR/FBIOGATTR ioctls
The FBIOSATTR/FBIOGATTR ioctls were added in 1994 with the 4.4 Lite import
but were never implemented in either sc(4), fb(4) or vt(4).
Remove it.

Reviewed by:	emaste, tsoome
MFC after:      2 weeks
Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33215

(cherry picked from commit f1105fb8f7)
2021-12-21 10:18:49 +01:00
Alexander Motin
dd8d32c669 isp(4): Allow more than 2 ports to read WWNs from NVRAM.
It appears at least on QLE2694L cards 3rd and 4th ports follow the
same NVRAM addressing logic as the first two.  In lack of proper
documentation this guess is as good as it can be.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.

(cherry picked from commit 483e464ed4)
2021-12-20 20:06:32 -05:00
Scott Long
8a45f0ab20 FIx "set but not used" in the isp driver.
Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 14c912c60d)
2021-12-20 20:05:59 -05:00
Andriy Gapon
ac55524730 pcf8591: remove write-only variables
(cherry picked from commit b416345d5b)
2021-12-20 12:47:38 +02:00
Vincenzo Maffione
56eeb84f10 em: skip rxcsum offload processing when disabled
Similarly to the other Intel drivers, don't try to process
RX checksum offloads when this feature (IFCAP_RXCSUM) is
disabled.

Reviewed by:	gallatin, kbowling, erj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33155

(cherry picked from commit d0633af765)
2021-12-18 12:00:25 +00:00
Vincenzo Maffione
a00d9c7f8c e1000: remove unused ifp backpointer
The ifp (struct ifnet) backpointer in the e1000 private ifnet
data is not used anymore since the iflib transition.
Remove it so that developers are not tempted to use it and
get a NULL pointer dereference.

Reviewed by:	markj, kbowling, erj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D33157

(cherry picked from commit d91559564d)
2021-12-18 11:46:41 +00:00
Ram Kishore Vegesna
de7809c1ee ocs_fc: Remove unused function delarations.
Remove unused function declarations.
Changes required for internal tool.

Approved by: ken

(cherry picked from commit 6f78736cb1)
2021-12-17 16:01:06 +05:30
Ram Kishore Vegesna
161148e61f ocs_fc: Fix device lost timer where device is not getting deleted.
Issue: Devices wont go away after the link down.

Device lost timer functionality in ocs_fc is broken,
`is_target` flag is not set in the target database and target delete is skipped.

Fix: Remove unused flags and delete the device when timer expires.

Reported by: ken@kdm.org
Reviewed by: mav, ken

(cherry picked from commit 41e9466943)
2021-12-17 16:01:06 +05:30
Ram Kishore Vegesna
0fff02894f ocs_fc: When commands complete with an error, freeze the device queue.
Proper error recovery depends on freezing the device queue when an
error occurs, so we can recover from an error before sending
additional commands.

The ocs_fc(4) driver was not freezing the device queue for most
SCSI errors, and that broke error recovery.

sys/dev/ocs_fc/ocs_cam.c:
	In ocs_scsi_initiator_io_cb(), freeze the device queue if
        we're passing back status other than CAM_REQ_CMP.

Submitted by: ken@kdm.org
Reviewed by: mav, ken

(cherry picked from commit d063d1bc92)
2021-12-17 16:01:06 +05:30
Ram Kishore Vegesna
4821da88ab ocs_fc: Fix CAM status reporting in ocs_fc(4) when no data is returned.
In ocs_scsi_initiator_io_cb(), if the SCSI command that is
        getting completed had a residual equal to the transfer length,
        it was setting the CCB status to CAM_REQ_CMP.

        That breaks the expected behavior for commands like READ ATTRIBUTE.
        For READ ATTRIBUTE, if the first attribute requested doesn't exist,
        the command is supposed to return an error (Illegal Request,
        Invalid Field in CDB).  The broken behavior for READ ATTRIBUTE
        caused LTFS tape formatting to fail.  It looks for attribute
        0x1623, and expects to see an error if the attribute isn't present.

        In addition, if the residual is negative (indicating an overrun),
        only set the CCB status to CAM_DATA_RUN_ERR if we have not already
        reported an error.  The SCSI sense data will have more detail about
        what went wrong.

        sys/dev/ocs_fc/ocs_cam.c:
                In ocs_scsi_initiator_io_cb(), don't set the status to
                CAM_REQ_CMP if the residual is equal to the transfer length.

                Also, only set CAM_DATA_RUN_ERR if we didn't get SCSI
                status.

Submitted by: ken@kdm.org
Reviewed by: mav, ken

(cherry picked from commit 1af49c2eeb)
2021-12-17 16:01:05 +05:30
Ram Kishore Vegesna
661875cecb ocs_fc: Increase maximum supported SG elements to support larger transfer sizes.
Reported by: ken@kdm.org
Reviewed by: mav, ken

(cherry picked from commit 322dbb8ce8)
2021-12-17 16:01:05 +05:30
Ram Kishore Vegesna
ccd32c6513 ocs_fc: Emulex Gen 7 HBA support.
Emulex Gen7 adapter support in ocs_fc driver.

Reviewed by: mav, ken

(cherry picked from commit 3bf42363b0)
2021-12-17 16:01:05 +05:30
Ram Kishore Vegesna
44a78c21df ocs_fc: Add gendump and dump_to_host ioctl command support.
Support to generate firmware dump.

Approved by: mav(mentor)

(cherry picked from commit 29e2dbd42c)

Add ocs_gendump.c to the build, missed in 29e2dbd42c.

(cherry picked from commit d0732fa819)
2021-12-17 16:00:59 +05:30
Ram Kishore Vegesna
5749a57326 ocs_fc: Fix use after free bug in ocs_hw_async_call()
Freed ctx is used in the later callee ocs_hw_command(),
which is a use after free bug.

Return error if sli_cmd_common_nop() failed.

PR: 255865
Reported by: lylgood@foxmail.com
Approved by:: markj

(cherry picked from commit 7377d3831b)
2021-12-17 15:42:25 +05:30
Ram Kishore Vegesna
f7a7748afc ocs_fc: Fix a use after free in ocs_sport_free
Domain which could be freed is used while freeing the sport.
Use ocs from sport.

PR: 255866
Reported by: lylgood@foxmail.com
Approved by:: markj

(cherry picked from commit dd722ccd6e)
2021-12-17 15:42:09 +05:30
Ram Kishore Vegesna
92d579a9ae ocs_fc: Fix memory leak in ocs_scsi_io_alloc()
PR: 254690
Approved by: mav(mentor)
MFC after: 2 weeks

(cherry picked from commit fc620f9782)
2021-12-17 15:41:49 +05:30
Andriy Gapon
6820d578bb twsi: support more message combinations in transfers
Most prominently, add support for a transfer where a write with no-stop
flag is followed by a write with no-start flag.  Logically, it's a
single larger write, but consumers may want to split it like that
because one part can be a register ID and the other part can be data to
be written to (or starting at) that register.

Such a transfer can be created by i2c tool and iic(4) driver, e.g., for
an EEPROM write at specific offset:
    i2c -m tr -a 0x50 -d w -w 16 -o 0 -c 8 -v < /dev/random

This should be fixed by new code that handles the end of data transfer
for both reads and writes.  It handles two existing conditions and one
new.  Namely:
- the last message has been completed -- end of transfer;
- a message has been completed and the next one requires the start
  condition;
- a message has been completed and the next one should be sent without
  the start condition.

In the last case we simply switch to the next message and start sending
its data.  Reads without the start condition are not supported yet,
though.  That's because we NACK the last byte of the previous message,
so the device stops sending data.  To fix this we will need to add a
look-ahead at the next message when handling the penultimate byte of the
current one.

This change also fixed a bug where msg_idx was not incremented after a
read message.  Apparently, typically a read message is a last message in
a transfer, so the bug did not cause much trouble.

PR:		258994

(cherry picked from commit ff1e858180)
2021-12-17 09:30:58 +02:00
Andriy Gapon
86af87acd1 twsi: make data receiving code safer
Assert that we are not receiving data beyond the requested length.
Assert that we have not NACK-ed incoming data prematurely.
Abort the current transfer if the incoming data is NACK-ed or not
NACK-ed unexpectedly.

Add debug logging of received data to complement logging of sent data.

(cherry picked from commit 00c07d9559)
2021-12-17 09:30:54 +02:00