Commit Graph

46 Commits

Author SHA1 Message Date
Mateusz Guzik
654548838b arm: clean up empty lines in .c and .h files 2020-09-01 21:17:24 +00:00
Pawel Biernacki
7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00
Conrad Meyer
e2e050c8ef Extract eventfilter declarations to sys/_eventfilter.h
This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h"
in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header
pollution substantially.

EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c
files into appropriate headers (e.g., sys/proc.h, powernv/opal.h).

As a side effect of reduced header pollution, many .c files and headers no
longer contain needed definitions.  The remainder of the patch addresses
adding appropriate includes to fix those files.

LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by
sys/mutex.h since r326106 (but silently protected by header pollution prior
to this change).

No functional change (intended).  Of course, any out of tree modules that
relied on header pollution for sys/eventhandler.h, sys/lock.h, or
sys/mutex.h inclusion need to be fixed.  __FreeBSD_version has been bumped.
2019-05-20 00:38:23 +00:00
Emmanuel Vadot
dbfb4063ae arm: Add kern_clocksource.c directly in files.arm
This files is needed and included in all our config so move it to a common
location.

MFC after:	2 weeks
2019-04-16 20:04:22 +00:00
Warner Losh
49a49b37df Move options INTRNG into std.armv6 and std.armv7
INTRNG is required on all armv6 and armv7 systems, so make it
standard.
2018-08-20 20:31:53 +00:00
Andrew Turner
e4c66ddabd Remove IPI_IRQ_START and IPI_IRQ_END from the arm kernel config files.
These are unneeded with INTRNG.
2018-07-28 06:46:10 +00:00
Oleksandr Tymoshenko
217d17bcd3 Clean up OF_getprop_alloc API
OF_getprop_alloc takes element size argument and returns number of
elements in the property. There are valid use cases for such behavior
but mostly API consumers pass 1 as element size to get string
properties. What API users would expect from OF_getprop_alloc is to be
a combination of malloc + OF_getprop with the same semantic of return
value. This patch modifies API signature to match these expectations.

For the valid use cases with element size != 1 and to reduce
modification scope new OF_getprop_alloc_multi function has been
introduced that behaves the same way OF_getprop_alloc behaved prior to
this patch.

Reviewed by:	ian, manu
Differential Revision:	https://reviews.freebsd.org/D14850
2018-04-08 22:59:34 +00:00
Andrew Turner
7bc28467ef Switch users of fdt_is_enabled to use ofw_bus_node_status_okay. These are
equivalent, so to prepare to remove the former move users to call the
latter.

Sponsored by:	DARPA, AFRL
2018-04-03 11:01:50 +00:00
Michal Meloun
f8759facd2 Convert extres/phy to kobj model.
Similarly as other extres pseudo-drivers, implement phy by using kobj model.
This detaches it from provider device, so single device driver can export
multiple different phys. Additionally, this  allows phy to be subclassed to
more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug
capability.

Tested by:	manu (previous version, on Allwinner board)
MFC after:	1 month
2018-01-20 17:02:17 +00:00
Ian Lepore
2d09b07279 Make kernel option KERNVIRTADDR optional, remove it from std.<platform>
files that can use the default value.

It used to be required that the low-order bits of KERNVIRTADDR matched
the low-order bits of the physical load address for all arm platforms.
That hasn't been a requirement for armv6 platforms since FreeBSD 10.
There is no longer any relationship between load addr and KERNVIRTADDR
except that both must be aligned to a 2 MiB boundary.

This change makes the default KERNVIRTADDR value 0xc0000000, and removes the
options from all the platforms that can use the default value.  The default
is now defined in vmparam.h, and that file is now included in a few new
places that reference KERNVIRTADDR, since it may not come in via the
forced-include of opt_global.h on the compile command line.
2017-12-30 00:20:49 +00:00
Emmanuel Vadot
ee070097f2 Revert r327250 as it broke the build for some armv6 kernel and all armv4/5
Reported by:	ian
2017-12-28 07:31:14 +00:00
Emmanuel Vadot
d06955f9bd arm: Add kern/kern_clocksource.c to files.arm
Instead of adding it to every files.vendor, add it to the common arch file.
2017-12-27 21:39:57 +00:00
Emmanuel Vadot
59c4192cd3 tegra: Do not define early printf function
Since tegra is now in GENERIC, do not enable the early printf
function as it can conflict with others.
2017-10-19 20:52:17 +00:00
Warner Losh
094fc1ed0f Tag all armv7 kernels as such in their machine config line.
Transition all boards that support arm cortex CPUs to armv7. This
leaves two armv6 kernels in the tree. RPI-B, which uses the BCM2835
which has a ARM1176 core, and VERSATILEPB, which is a qemu board setup
around the time RPI-B went in. Copy std.armv6 to std.armv7, even
though that duplicates a lot of stuff. More work needs to be done to
sort out the duplication.

Differential Revision: https://reviews.freebsd.org/D12027
2017-10-05 23:01:50 +00:00
Michal Meloun
93a065e749 Remake support for SMP kernel on UP cpu:
- Use new option SMP_ON_UP instead of (mis)using specific CPU type.
   By this, any SMP kernel can be compiled with SMP_ON_UP support.
 - Enable runtime detection of CPU multiprocessor extensions only
   if SMP_ON_UP option is used. In other cases (pure SMP or UP),
   statically compile only required variant.
 - Don't leak multiprocessor instructions to UP kernel.
 - Correctly handle data cache write back to point of unification.
   DCCMVAU is supported on all armv7 cpus.
 - For SMP_ON_UP kernels, detect proper TTB flags on runtime.

Differential Revision: https://reviews.freebsd.org/D9133
2017-02-02 06:14:44 +00:00
Michal Meloun
a0a23564a3 Implement drivers for NVIDIA tegra124 display controller, HDMI source
and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration
engine and 3D requires not yet started nouveau driver.

These drivers forms a first non-x86 DRM2 enabled graphic stack.

Note, there are 2 outstanding issues:
 - The code uses gross hack in order to be comply with
   OBJT_MGTDEVICE pager. (See tegra_bo_init_pager() in tegra_bo.c)
 - Due to improper(probably) refcounting in drm_gem_mmap_single()
   (in drm_gem.c), the gem objects are never released.
I hope that I will be able to address both issues in finite time,
but I don't want to touch x86 world now.

MFC after: 1 month
2016-12-26 14:36:05 +00:00
Andrew Turner
6c925b9c81 All armv6 platforms have the same implementation of platform_lastaddr.
Replace them with a default handler that returns devmap_lastaddr.

Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8806
2016-12-16 10:31:13 +00:00
Andrew Turner
ba9f40ca3b Use the platform_*_t typedefs to help check the platform function types are
correct.

Sponsored by:	ABT Systems Ltd
2016-12-13 13:46:09 +00:00
Michal Meloun
6f1eb3052e Fixes for NVIDIA Tegra124 clocks:
- EMC clock have standard peripheral clock block. Use it.
 - Implement full frequency set method for PLLD2. This PLL
   is used as HDMI pixel clock so we must be able to set it
   to wide range of frequencies, within 5% tolerance allowed
   by HDMI specification. Due to this, full state space search
   (over m, n, p fields) is necessary.

MFC after: 3 weeks
2016-12-04 16:04:22 +00:00
Andrew Turner
df7675353e Stop including fdt_common.h from the arm code when it's unneeded.
Sponsored by:	ABT Systems Ltd
2016-11-14 11:41:22 +00:00
Michal Meloun
ccf5e68e5b Add NVIDIA Tegra XHCI driver and coresponding firmware blob.
MFC after: 3 weeks
Approved by: core@ (NVIDIA license)
2016-11-07 05:37:10 +00:00
Michal Meloun
59b591b1b1 Rework NVIDIA Tegra124 XUSBPAD driver.
- Adapt it for new, incompatible, DT bindings introduced by r306197.
 - Add support for USB super speed pads/ports.

MFC after: 3 weeks
2016-11-07 05:34:44 +00:00
Michal Meloun
7961a970c7 TEGRA: Fix numerous issues in clock code.
Define and export clocks related to XUSB driver.
2016-11-04 11:40:11 +00:00
Michal Meloun
47a232c660 TEGRA: Add basic driver for memory controller.
For now, it only reports memory and SMMU access errors.
2016-11-04 11:39:19 +00:00
Michal Meloun
99746e4658 TEGRA: Raise minimum voltage for CPU, original 0.9 V was too optimistic.
While I'm in, remove duplicated line from CPU frequency table.

MFC after: 2 weeks
2016-10-19 14:28:51 +00:00
Michal Meloun
4d517b66a0 TEGRA: Attach cpufreq and coretemp drivers only on tegra124 SoC.
It's needed by GENERIC kernel.

MFC after: 2 weeks
2016-10-18 12:26:22 +00:00
Michal Meloun
69c48a2805 TEGRA: Really implement early printf. The original version
was cut&pasted from another SoC.

Pointy-hat to: mmel

MFC after: 2 weeks
2016-10-18 12:21:45 +00:00
Michal Meloun
7cc70732a3 ARM: SEV/WFE instructions are implemented starting from ARMv6K,
use it directly.

MFC after: 1 week
2016-10-06 13:18:18 +00:00
Andrew Turner
1834282de6 Split CPU_CORTEXA into CPU_CORTEXA8, for the Cortex-A8, and CPU_CORTEXA_MP,
for later Cortex-A CPUs that support the Multiprocessor Extensions. This
will be needed to support both in a single GENERIC kernel while still
being able to only build for a single SoC.

Reviewed by:	mmel
Relnotes:	yes
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8138
2016-10-04 12:25:44 +00:00
Michal Meloun
a7b380d7d6 TEGRA: Fix bindings for cpufreq and coretemp drivers,
it was broken in r306477.
Correct a description for coretemp driver.
2016-10-01 06:50:16 +00:00
Michal Meloun
a27852480c TEGRA: Extend timeout for PLLs lock to 5 ms. Real lock time for PLLA
has been very near to old limit.
2016-10-01 03:35:03 +00:00
Michal Meloun
4bda238a9b TEGRA: Prepare Tegra subtree for inclusion into ARM generic kernel.
- use DEFINE_CLASS_0() for driver classes
 - unify driver names
 - cleanup driver definitions and bindings
2016-09-30 05:25:15 +00:00
Michal Meloun
114abe7615 TEGRA: Return back kern_clocksource.c into tegra config file. It was removed in r306444 by mistake. 2016-09-29 12:54:27 +00:00
Michal Meloun
ef3639e852 TEGRA: Don't include files already included by system or arch configs. 2016-09-29 12:25:04 +00:00
Michal Meloun
92fa5c23d9 TEGRA: Add support for MULTIDELAY option. 2016-09-29 11:13:51 +00:00
Andrew Turner
0a4c0732a9 Restrict where we need to define fdt_fixup_table to just PowerPC and
Marvell.

Sponsored by:	ABT Systems Ltd
2016-09-23 14:11:23 +00:00
Andrew Turner
0dbb8873c8 Move cpu_reset to be a platform method to allow multiple implementations.
Reviewed by:	mmel
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D8010
2016-09-23 13:08:15 +00:00
Andrew Turner
c35b5d8372 Remove bus_dma_get_range and bus_dma_get_range_nb on armv6. We only need
this on a few earlier arm SoCs.

Reviewed by:	manu (earlier version)
Sponsored by:	ABT Systems Ltd
2016-09-23 12:38:05 +00:00
Michal Meloun
dac935533b EXTRES: Add OF node as argument to all <foo>_get_by_ofw_<bar>() functions.
In some cases, the driver must handle given properties located in
specific OF subnode. Instead of creating duplicate set of function, add
'node' as argument to existing functions, defaulting it to device OF node.

MFC after: 3 weeks
2016-07-10 18:28:15 +00:00
Pedro F. Giffuni
95a9e5d682 tegra124: use roundup/rounddown macros from <sys/param.h>. 2016-06-03 21:11:34 +00:00
Oleksandr Tymoshenko
bebd526933 Use OF_prop_free instead of direct call to free(9)
Reviewed by:	mmel@
2016-05-14 05:00:17 +00:00
Andrew Turner
cca48a59de Add a MULTIDELAY option to allow the ARM kernel to have multiple DELAY
implementations. Early in the boot the kernel will use an approximate,
however after the timer has been probed it will switch to a more accurate
implementation.

Reviewed by:	manu
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5762
2016-04-30 17:27:33 +00:00
Ruslan Bukin
30b72b6871 Move arm's devmap to some generic place, so it can be used
by other architectures.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D6091
Sponsored by:	DARPA, AFRL
Sponsored by:	HEIF5
2016-04-26 11:53:37 +00:00
Andrew Turner
59c3cb81c1 Rename ARM_INTRNG and MIPS_INTRNG to INTRNG. This will help with machine
independent code that needs to know about INTRNG such as PCI drivers.

Obtained from:	ABT Systems Ltd
Sponsored by:	The FreeBSD Foundation
2016-04-15 16:05:41 +00:00
Michal Meloun
b799783990 TEGRA: Fix CPU frequency switching.
The PLL_X, base CPU frequency source, doesn't have a bypass switch and thus
we must use another frequency source for CPU while changing its frequency.
PLL_P is ideal for this, it runs at 480MHz and CPU can be clocked at this
frequency at any CPU voltage.
2016-04-05 09:20:52 +00:00
Michal Meloun
ef2ee5d07a Import basic support for Nvidia Jetson TK1 board and tegra124 SoC.
The following pheripherals are supported: UART, MMC, AHCI, EHCI, PCIe, I2C,
PMIC, GPIO, CPU temperature and clock.

Note: The PCIe driver is pure mash at this moment. It will be reworked
immediately when both D5237 and D2579 enter the current tree.
2016-03-16 13:01:48 +00:00