Commit graph

286552 commits

Author SHA1 Message Date
Emmanuel Vadot
d10e2facd6 arm64: dtb: Add rk3566-quartz64-a.dts to the build
We can boot on this board.

(cherry picked from commit 2303980cfcb1e709c17b108ce66a25a8e7eea337)
2023-10-18 16:33:37 +02:00
Emmanuel Vadot
fd4760cbda arm64: rockchip: rk_clk_composite: Remove gate code
It was a bad idea to have composite clock directly managing gates.
All clocks drivers have been rewrite to not use this functionality
and directly export the gate. We can now remove this code.

(cherry picked from commit db34f02028f30bbf099bf1bce7ce66184f51b332)
2023-10-18 16:33:35 +02:00
Emmanuel Vadot
57209137eb arm64: rockchip: rk3399_pmucru: Finish exporting all clocks
- All used clocks are now exported.
- Use the macros from rk_cru.h so code is similar to other rk clock drivers.

(cherry picked from commit 829b06ad8f6f3317777c2395a090a898fdcd550c)
2023-10-18 16:33:33 +02:00
Emmanuel Vadot
66765585ab arm64: rockchip: Remove CRU_GATE macro
It's unused now

(cherry picked from commit 5b7fe78032a0d07995c1c1c005d82c3a1fe8a056)
2023-10-18 16:33:32 +02:00
Emmanuel Vadot
1469218c9c arm64: rockchip: rk3399_pmucru: Use GATE macro
It make it easier to read the code and the register number

(cherry picked from commit 3d2ccc352db54b9fb11c4c1373a577e3e9d25114)
2023-10-18 16:33:31 +02:00
Emmanuel Vadot
14652ce3f5 arm64: rockchip: rk3328_cru: Use GATE macro
It make it easier to read the code and the register number

(cherry picked from commit 7c6c426f29831799d1eae1ca5d4036a219b52fca)
2023-10-18 16:33:29 +02:00
Emmanuel Vadot
4bb49357e0 arm64: rockchip: rk3568_cru: Rewrite
Rewrite correctly the clocks for cru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:  a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
(cherry picked from commit 50a0f1ce28b7f04fc23915fb06124242632a013c)
2023-10-18 16:33:28 +02:00
Emmanuel Vadot
90b135d8c2 arm64: rockchip: rk3568_pmucru: Rewrite
Rewrite correctly the clocks for pmucru :
- Export all clocks
- Use names from the TRM
- Respect clock topology

Fixes:	a48301a5e0 ("Add initial clocks support for Rockchip RK3568 SoC.")
(cherry picked from commit 7b6ae431cf70cd8683270b3e315a14e61d666522)
2023-10-18 16:33:26 +02:00
Emmanuel Vadot
dda809fb31 arm64: rockchip: clk: Define PLIST macro in rk_cru.h
We use it in all clock drivers so no need to define it everywhere

(cherry picked from commit 8ae54db63970e9370d3d88f6eb57c102e085a128)
2023-10-18 16:33:25 +02:00
Emmanuel Vadot
26bf8fff64 xilinx: reset: Remove debug printfs
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 257405d707d77bc55b38e7c2bb83b8a9247a86ae)
2023-10-18 16:32:37 +02:00
Emmanuel Vadot
b4cd14485a i2c: Add Microcrystal RV3032 RTC driver
This is a simple RTC driver for the rv3032 from Microcrystal.
Just the basic functionality is implemented (no timer, alarm etc ..).

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41995

(cherry picked from commit 1d6a6a524409662992ca96bc91ae69b2a2a5ff35)
2023-10-18 16:32:19 +02:00
Emmanuel Vadot
7b824791e7 i2c: Add cadence iic driver
This IP is found in Xilinx SoC, it only been tested on ZynqMP (arm64)
so only enable it there for now.

Differential Revision:	https://reviews.freebsd.org/D41994

(cherry picked from commit 137b58e4d2044adc200d13c8989d3746a0a4bd7f)
2023-10-18 16:32:17 +02:00
Emmanuel Vadot
c133589105 iicbus: Move opencores i2c driver into controller subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41914

(cherry picked from commit 125f5c5b48b1fdccf364b821ce48bfdbd9687ed1)
2023-10-18 16:32:15 +02:00
Emmanuel Vadot
96edbfe36b iicbus: Move i2c sensors drivers into new sensor subdirectory
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41913

(cherry picked from commit 7c569caa0a6fffa7e1cc0a7f61e986dbc7c59074)
2023-10-18 16:32:14 +02:00
Emmanuel Vadot
83dcc494a7 iicbus: conf: Fix pcf8574 entry
It lives in the gpio subdirectory

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41912

(cherry picked from commit 918a10c9f792d2c2f78b75626f7bf2abc85a0fff)
2023-10-18 16:32:12 +02:00
Emmanuel Vadot
cd2f6226e7 iicbus: Move ADC drivers into a new adc subfolder
No reason that they should live directly under iicbus

Sponsored by:   Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41911

(cherry picked from commit 06589d6e029c6ff64a7816d743e0a508abe6193b)
2023-10-18 16:32:11 +02:00
Emmanuel Vadot
26dd10a4f3 iicbus: Move adm1030 and adt746x to new pwm subdirectory
Those are (mainly) pwm controller so move it under a new subdirectory.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41910

(cherry picked from commit 22d7dd834bc5cd189810e414701e3ad1e98102e4)
2023-10-18 16:32:10 +02:00
Emmanuel Vadot
8d715e2f49 iicbus: Move Silergy pmic/regulators under pmic/silergy subdirectory
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41909

(cherry picked from commit 062944cc4227e7bd002e4de2be48ec9b710bfaa5)
2023-10-18 16:32:08 +02:00
Emmanuel Vadot
5e25c410bd iicbus: Move remaining rtc driver into rtc subfolder
No reason that they should live directly under iicbus

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41908

(cherry picked from commit 2f16049c985a364e2bd2b256f5bef9af17e10c62)
2023-10-18 16:32:07 +02:00
Emmanuel Vadot
a5b3cbe6cc iicbus: Move twsi under a new controller subdirectory
The folder is a mess so start moving stuff into sub-directories.

Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D41907

(cherry picked from commit 580d00f42fdd94ce43583cc45fe3f1d9fdff47d4)
2023-10-18 16:32:05 +02:00
Emmanuel Vadot
1e685c7dd5 if_cgem: Rewrite clock part
- pclk and hclk are mandatory so always try to get them.
   Don't make it fatal if it fails as some platform (like Zynq) don't
   have a proper clock driver.
 - Always use pclk for the reference clock.
 - Try to get all the possible clocks and enable them.

Reviewed-by:	mhorne
Tested-by:	Milan Obuch <bsd@dino.sk>
Differential Revision:	https://reviews.freebsd.org/D41857
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4c52dde5bda099936d43820da84e569dccc6f475)
2023-10-18 16:31:13 +02:00
Emmanuel Vadot
770b790eab if_cgem: Cleanup compatible and add new ones
- Remove cdns,gem, it's the generic binding but for all platform that include
  this one we need specific drivers setup so remove it.
- Remove cdns,macb, it's the generic binding for Atmel AT91 which we don't suport
- Remove cadence,gem, it's not an official binding and seems to be only used in some
  obscure ARM11 SoC.
- Note that the cdns,zynq* are deprecated
- Add the new Xilinx compatible for zynq and zynqmp

Reviewed-by:	mhorne
Tested-by:	skibo, Milan Obuch <bsd@dino.sk>
Differential Revision:	https://reviews.freebsd.org/D41856
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit bdbbbbb32104569fccd786d9cc07d17f6231a713)
2023-10-18 16:31:11 +02:00
Emmanuel Vadot
0af2307d59 sdhci: fdt: Correctly export clock per the binding
The binding says that we can have one or two clocks to export.
The first one is the actual sdclock while the second is the sample clock.
Both have the same parent, clk_xin.
Correctly export the clocks for RK3399 and ZynqMP.
No need to use a high ID as before, we have our own clock domain so use
ids starting at 1 as all exported clocks should be.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41810
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 81a4fe38a6ce818bb7cba548bb2c697429fa9479)
2023-10-18 16:31:10 +02:00
Emmanuel Vadot
62b14a7531 sdhci: fdt: Always try to get the phy and the syscon
Per the bindings the phy and the syscon can always be present not just
for RK3399.

Reviewed-by:	bz
Differiential Revision:	https://reviews.freebsd.org/D41809
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 0ee5d6fcfc63be48fd7c1b461917dfb880dc7f72)
2023-10-18 16:31:08 +02:00
Emmanuel Vadot
d6a1d41df4 sdhci: fdt: Always enable clock for ZynqMP and RK3399
Those two (in fact all of the supported one in this driver except RK3568) always
needs the clocks to be enabled.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41808
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 9377d7049c846d1e35c8fc8809c23e6413909fca)
2023-10-18 16:31:07 +02:00
Emmanuel Vadot
023ba06b4f sdhci: fdt: Remove sdhci_generic compatible string
This was used when we had our own DTS, it's not used anymore.

Reviewed-by:	bz
Differential Revision:	https://reviews.freebsd.org/D41807
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 8c7e747491ad636d6ee4069a74ddb24814870540)
2023-10-18 16:31:05 +02:00
Emmanuel Vadot
20d6c796fa arm64: zynqmp: Add clock driver
Add clock and reset drivers for the ZynqMP SoC.
The clocks are discovered by talking to the firmware as the topology isn't
fixed on this SoC.

Differential Revision:	https://reviews.freebsd.org/D41812
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 4e579ad047720775ab580b74192c7de8a3386fea)
2023-10-18 16:31:03 +02:00
Emmanuel Vadot
ab8f34675a arm64: zynqmp: Add firmware driver
The ZynqMP SoC have a MCU running a firmware to control clocks, resets,
fpga loading etc ...
Add a driver that can be use to communicate with it.
For now only the clock and reset part are implemented.

Differential Revision:	https://reviews.freebsd.org/D41811
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 9e88711f28dc9afa7d68ae8dd027d2399a2a290b)
2023-10-18 16:31:01 +02:00
Emmanuel Vadot
62ce4a798f cpufreq_dt: Find the closest frequency
When building the frequencies table we convert the value in the DTS to
megahertz and loose precision. While it's not a problem for most of the
DTS it is when the expected frequency value is strict down to the hertz.
So it's either we don't truncate the value and have some ugly and long
values in the sysctls or we just find the closest frequency.
Do the latter.

Reviewed by:	mmel
Differential Revision:	https://reviews.freebsd.org/D41762
Sponsored by:	Beckhoff Automation GmbH & Co. KG

(cherry picked from commit 17c17872ca98df0e2b9f9c7a2c41ef73f7dee21a)
2023-10-18 16:30:22 +02:00
Kristof Provost
ce3ab9dfee ifconfig: add static bridge addresses for vlan 0, not 1
Since fd7edfcdc3 ("bridge: fix lookup for untagged packets in
bridge_transmit()") and b0e38a1373 ("bridge: distinguish no vlan and
vlan 1") we do a better job of distinguishing between untagged and VLAN
1 traffic.

However, ifconfig still defaulted to adding addresses for VLAN 1, rather
than for untagged traffic. Change this to be the most common (i.e.
untagged) option.

Reviewed by:	zlei, philip
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D42188

(cherry picked from commit 6ace92326f3cc4bbee9b74f6b656cb13699a78a2)
2023-10-18 08:43:40 +02:00
Gordon Bergling
44e3ce37f2 uma.h: Fix a typo in a source code comment
- s/setable/settable/

(cherry picked from commit fc9f1d2c6391b1a4b133aab56ace625b72c9ea85)
2023-10-18 07:57:16 +02:00
Dmitry Chagin
133ada6bff linux(4): Drop the outdated comment, nosys is fine since 39024a89
MFC after:		1 week

(cherry picked from commit 03f5bd1e462576838e79145379ce314e2e03e4b3)
2023-10-18 08:52:33 +03:00
Dmitry Chagin
c9ec2fb86c linux(4): Drop the outdated comments about sixth register on i386 int0x80
This is well documented in the Linux syscall(2).

MFC after:		1 week

(cherry picked from commit 5bdd74cc05e6c7d110688feacdbd22b6dffe5d72)
2023-10-18 08:52:33 +03:00
Olivier Certner
c8ca21cc94 sysctl(8): Mention more security.bsd knobs; Refer to security(7)
Reviewed by:            mhorne, pauamma_gundo.com, emaste
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D41113

(cherry picked from commit 8d7a48d367ffde2a29419ef943c4099984e3af4d)
2023-10-17 16:42:59 -03:00
Olivier Certner
b018679002 ptrace(2): Disabling: Describe influence of security.bsd.see_jail_proc
Reviewed by:            mhorne, emaste, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D41109

(cherry picked from commit d952820105d6a2ad87ddf3bdc6c5fc5215d13b87)
2023-10-17 16:42:59 -03:00
Olivier Certner
4a85852519 security(7): security.bsd.see*: Be more accurate
Reviewed by:            mhorne, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D41108

(cherry picked from commit 61b6e00bee1d39e9c688e728fbf3a4efcdb61e66)
2023-10-17 16:42:59 -03:00
Olivier Certner
b6b76c1c09 groupmember(), realgroupmember(): Return a bool instead of an int
Requested by:           mhorne
Reviewed by:            mhorne
MFC after:              2 weeks
MFC to:                 stable/14 releng/14.0
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40958
Differential Revision:  https://reviews.freebsd.org/D40959

(cherry picked from commit ffd3ef8ee0253ffaf214cf711251d112f6a2bcf6)
(cherry picked from commit 845b7c80887ac84c82ee776836ef86d68ea71c94)
2023-10-17 16:42:59 -03:00
Olivier Certner
f482bc9584 cr_canseeothergids(): Use real instead of effective group membership
Using the effective group and not the real one when testing membership
has the consequence that unprivileged processes cannot see setuid
commands they launch until these have relinquished their privileges.
This is also in contradiction with how the similar cr_canseeotheruids()
works, i.e., by taking into account real user IDs.

Fix this by substituting groupmember() with realgroupmember().  While
here, simplify the code.

PR:                     272093
Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40642
Differential Revision:  https://reviews.freebsd.org/D40644

(cherry picked from commit 91658080f1a598ddda03943a783c9a941199f7d2)
(cherry picked from commit 0452dd841336cea7cd979b13ef12b6ea5e992eff)
2023-10-17 16:42:59 -03:00
Olivier Certner
d1fde7841f New realgroupmember()
Like groupmember(), but taking into account the real group instead of
the effective group.  Leverages the new supplementary_group_member()
function.

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40641
Differential Revision:  https://reviews.freebsd.org/D40643

(cherry picked from commit 2a2bfa6ad92e9c82dcc55733ad2fd58fd2ea7559)
(cherry picked from commit 5d9f38405a10fdcd9fc108c940dcf2642e9f1833)
2023-10-17 16:42:59 -03:00
Olivier Certner
f3de805ace groupmember(): Extract the supplementary group search in a separate function
This is in preparation for the introduction of the new realgroupmember()
function, which does the same search into supplementary groups as
groupmember().

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40640

(cherry picked from commit b725f232f3b09b4bcbc426854fe1545234c66965)
2023-10-17 16:42:59 -03:00
Olivier Certner
8d935c419f prison_check(9): Bring up-to-date with hierarchical jails
Reviewed by:            bcr, emaste, pauamma_gundo.com, mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40639

(cherry picked from commit e9fdd494537ca45b14e0917e8bb1595b6460f3a3)
2023-10-17 16:42:59 -03:00
Olivier Certner
7678195065 p_candebug(9): cr_bsd_visible() impacts, misc fixes
Mention cr_bsd_visible(9).  Remove references to cr_canseeothergids(9)
and cr_canseeotheruids(9), as well as indirect references not
immediately useful.

Fix description of credentials checks to match reality.

Re-order errors to match code's check order.

Reviewed by:            bcr, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40638

(cherry picked from commit eb94f24fab4b44f13ca045370d9fcf12ca8835f2)
2023-10-17 16:42:58 -03:00
Olivier Certner
fea4e20afb p_cansee(9): Bring up-to-date, misc fixes
Essentially defer to cr_cansee(9), except for the specifics.

Be more specific on the return codes.

Reviewed by:            bcr, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40637

(cherry picked from commit 2ede38aff5d4c91a17ab6d093f2e8cce24b5418b)
2023-10-17 16:42:58 -03:00
Olivier Certner
2ecbfdaecb cr_cansee(9): cr_bsd_visible() impacts, simplifications
Remove references to cr_canseeothergids(9) and cr_canseeotheruids(9).
Defer to cr_bsd_visible() for controlling sysctl(8) variables.

Reviewed by:            bcr, mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40636

(cherry picked from commit 82f9bc9ea8ed660c61050ad1d92f1a64108c7004)
2023-10-17 16:42:58 -03:00
Olivier Certner
e04b81f8b7 cr_canseeotheruids(9): Revamp, mark as internal
Significantly clarify.  Replace references to cr_canseeothergids(9) by
ones to cr_bsd_visible(9).

Reviewed by:            bcr, mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40635

(cherry picked from commit 4ddd253b38dff8725555355cc1b5238b1bbfd380)
2023-10-17 16:42:58 -03:00
Olivier Certner
60cc4f16d4 groupmember(9): Detail which groups are considered, simplify
Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40634

(cherry picked from commit 75a45ca3b34062fe793ae326ad9da614a1a06df1)
2023-10-17 16:42:58 -03:00
Olivier Certner
ad1486b625 cr_canseeothergids(9): Revamp, mark as internal
Significantly clarify.  Replace references to cr_canseeotheruids(9) by
ones to cr_bsd_visible(9).

Reviewed by:            pauamma_gundo.com, mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40633

(cherry picked from commit 3fe9ea4d2d04d48a249b2e6161d416bb4d5b364e)
2023-10-17 16:42:58 -03:00
Olivier Certner
d9181d86c6 cr_bsd_visible(9): New man page
Reviewed by:            bcr, pauamma_gundo.com
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40632

(cherry picked from commit 0d6bf73c4f20e6ed719c29c1b382d24bb0a81a2f)
2023-10-17 16:42:58 -03:00
Olivier Certner
ce4c78b612 cr_canseejailproc(9): New man page
Reviewed by:            pauamma_gundo.com, mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40631

(cherry picked from commit 29d863bb7ffc692998f21fa3e7a91afa1151cf1c)
2023-10-17 16:42:58 -03:00
Olivier Certner
f173bbdbc1 cr_canseeotheruids(), cr_canseeothergids(): Man pages: Impacts of rename
When these functions were renamed 7 years ago, their man pages were not.
Rename the latter in accordance and fix the names inside them.  Fix
references to them as well.  Add the old man pages to the list of
obsolete files.

Reviewed by:            mhorne
MFC after:              2 weeks
Sponsored by:           Kumacom SAS
Differential Revision:  https://reviews.freebsd.org/D40630

(cherry picked from commit c59ab75c04fa32bc6d292596ff5e4593a05a6b1b)
2023-10-17 16:42:58 -03:00