Commit Graph

722 Commits

Author SHA1 Message Date
Michal Meloun
f5c06c61e4 ARM: Fix ATAG handling in LINUX_BOOT_API:
- Don't convert atags address passed from U-Boot. It's real physical
   address (and we have 1:1 mapping).
 - Size of tags is encoded in words, not in bytes
2016-03-26 06:57:36 +00:00
Michal Meloun
fda16d46fe ARM: Teach LINUX_BOOT_ABI to recognize DT blob.
This allow us to boot FreeBSD kernel (using uImage encapsulation) directly
from U-boot using 'bootm' command or by Android fastboot loader.
For now, kernel uImage must be marked as Linux, but we can add support for
FreeBSD into U-Boot later.
2016-03-26 06:55:55 +00:00
Svatopluk Kraus
61c8fde5d6 Generalize IPI support for ARM intrng and use it for interrupt
controller IPI provider.

New struct intr_ipi is defined which keeps all info about an IPI:
its name, counter, send and dispatch methods. Generic intr_ipi_setup(),
intr_ipi_send() and intr_ipi_dispatch() functions are implemented.

An IPI provider must implement two functions:
(1) an intr_ipi_send_t function which is able to send an IPI,
(2) a setup function which initializes itself for an IPI and
    calls intr_ipi_setup() with appropriate arguments.

Differential Revision:	https://reviews.freebsd.org/D5700
2016-03-24 09:55:11 +00:00
Svatopluk Kraus
5b70c08cdf Move IPI related parts back to (ARM) machine specific file now, when
the interrupt framework is also going to be used by another (MIPS)
architecture. IPI implementations may vary much across different
architectures.

An IPI implementation should still define INTR_IPI_COUNT and use
intr_ipi_setup_counters() to setup IPI counters which are inside of
intrcnt[] and intrnames[] arrays. Those are used for sysctl and ddb.
Then, intr_ipi_increment_count() should be used to increment obtained
counter.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D5459
2016-02-27 12:03:07 +00:00
Andrew Turner
7133fe0f33 Almost all copies of platform_mp_init_secondary just called
intr_pic_init_secondary. Replace them with a direct call. On BCM2836
and ARMADA XP we need to add this function, but it can be empty.

Reviewed by:	ian, imp
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5460
2016-02-26 16:04:47 +00:00
Andrew Turner
3210b87554 Remove platform_mp_probe as it's almost identical on most ARM SoCs, and
slightly wrong on the others. We should just check if mp_ncpus is set to
more than one CPU as we may wish to run on a single core even when SMP is
available.

Reviewed by:	ian
Sponsored by:	ABT Systems Ltd
Differential Revision:	https://reviews.freebsd.org/D5458
2016-02-26 15:54:34 +00:00
Andrew Turner
243b36c321 Remove platform_ipi_send, it's an unneeded as all implementations are
identical.

Sponsored by:	 ABT Systems Ltd
2016-02-25 20:48:23 +00:00
Svatopluk Kraus
fe6928058c Remove redundant __ARM_ARCH >= 6 check in armv6 specific files. 2016-02-23 10:12:50 +00:00
Svatopluk Kraus
3d5822f1a9 Remove not used definitions and fix some style nits.
No functional changes.
2016-02-19 10:32:17 +00:00
Svatopluk Kraus
a569bb2f9f Remove AP_KRW definition not needed after r295801. 2016-02-19 09:52:11 +00:00
Svatopluk Kraus
08674c4573 Rename pte.h to pte-v4.h and start including directly either pte-v4.h
or pte-v6.h in files which needs it.

There are quite internal definitions in pte-v4.h and pte-v6.h headers
specific for corresponding pmap implementation. These headers should be
included only in very few files and an intention is to not hide for
which implementation such files are.

Further, sys/arm/arm/elf_trampoline.c is an example of file which
uses armv4 like pmap implementation for both armv4 and armv6 platforms.
This is another reason why pte.h which includes specific header
according to __ARM_ARCH is not created.
2016-02-19 09:23:32 +00:00
Svatopluk Kraus
12fdcefc8d Move common definitions from both pmap-v4.h and pmap-v6.h into pmap.h.
(1) MI interface needed for vm subsystem.
(2) MD interface created for ARM architecture to be used in files
    shared by armv4 and armv6 platforms.
2016-02-19 08:41:47 +00:00
Svatopluk Kraus
3e1cfddd47 Rename pmap.h to pmap-v4.h and remove pmap-v6.h include from it.
Create new pmap.h which includes specific header according to
__ARM_ARCH.

Note that <machine/pmap.h> is included from <vm/pmap.h> so one common
<machine/pmap.h> must exist.
2016-02-19 08:35:29 +00:00
Svatopluk Kraus
d97d068fe8 Remove redundant ARM_L2_ADDR_BITS and L2_ADDR_BITS definitions and
replace them by primary ones where needed.
2016-02-18 09:30:04 +00:00
Svatopluk Kraus
9395e5a634 Remove redundant L2_ADDR_MASK definition and replace it by primary one. 2016-02-18 09:28:16 +00:00
Svatopluk Kraus
ac9a695a93 Remove unneeded definitions after r291406. Also remove redundant and
not used L1_ADDR_BITS definition.
2016-02-18 09:26:58 +00:00
Svatopluk Kraus
ddf8a6680e Do not use PMAP_DOMAIN_KERNEL definition for __ARM_ARCH >= 6 as domains
are not utilized there. Only domain #0 is used and there is no reference
to it in the whole pmap-v6.c. Thus initialize domain access register in
locore-v6.c without reference too.
2016-02-17 14:39:29 +00:00
Svatopluk Kraus
bcbc0ff17d Remove unneeded vector_page_setprot() for __ARM_ARCH >= 6. A vector
page is always mapped in KVA space and so it's always writeable.
2016-02-17 13:29:17 +00:00
Svatopluk Kraus
195ea683fb Include pte-v6.h only where needed. 2016-02-17 12:57:05 +00:00
Svatopluk Kraus
1413a3ab64 Remove pd_prot and pd_cache members from struct arm_devmap_entry.
The struct is used for definition of static device mappings which
should always have same protection and attributes.
2016-02-17 12:36:24 +00:00
Adrian Chadd
d6233babae Break out the shared bits of the arm intrng definitions into sys/intr.h;
leave the machine dependent bits in sys/arm/.

This is in preparation for MIPS INTRNG work.

Submitted by:	Stanislav Galabov <sgalabov@gmail.com>
2016-02-10 04:43:08 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Michal Meloun
3025d19dfc ARM: Introduce new cpu-v4.h header and move all ARMv4 specific code
from cpu-v6.h to it.
Remove unneeded cpu-v6.h includes.
2016-02-05 09:46:24 +00:00
Svatopluk Kraus
82f313b3f0 Make VM_MEMATTR_xxx definitions independent on pmap internals
for __ARM_ARCH >= 6.

It's TEX class number now, so it still has some meaning.
2016-02-04 14:15:24 +00:00
Michal Meloun
0b5afe4aea ARM: Don't use ugly (and hidden) global variable, control register is
readable at any time.
2016-02-04 12:11:18 +00:00
Michal Meloun
d1e8cd8a88 ARM: Consistently use cpu_setttb() instead of setttb().
Remove unused #define for drain_writebuf.
2016-02-03 16:44:06 +00:00
Michal Meloun
d397c7a0af ARM: Replace only once used cpu_icache_sync_all() by ranged equivalent.
Remove it from cpu_functions table.
2016-02-03 13:47:50 +00:00
Svatopluk Kraus
b4ae00fcd7 Partly revert r295168 and define PTE_DEVICE in pmap-v6.h header again.
It turned out that devmap.c is not only file in which PTE_DEVICE
is used and simultaneously, built for both armv4 and armv6 platforms.

When I tried to build all arm kernels before r295168 commit, it was
hid by some other local changes in my tree. I hope that this is just
temporary workaround before VM_MEMATTR_DEVICE could be used instead of
PTE_DEVICE outside of pmap code for __ARM_ARCH < 6.
2016-02-03 12:11:07 +00:00
Michal Meloun
afdcfee483 ARM: Remove support for xscale i80219 and i80321 CPUs. We haven't single
supported config/board with these CPUs.
2016-02-03 09:15:44 +00:00
Svatopluk Kraus
677ba8502b Use pmap_preboot_map_attr() directly in arm_devmap_bootstrap()
instead of hiding behind pmap_map_chunk(). It's not longer needed
after old pmap-v6 code was removed.

For compatibility with __ARM_ARCH < 6, define PTE_DEVICE in devmap.c
file. Certainly, it would be nice if VM_MEMATTR_DEVICE could be used
even for __ARM_ARCH < 6.
2016-02-02 21:17:25 +00:00
Svatopluk Kraus
0a57d9e4c3 Make pmap_preboot_map_attr() vm subsystem compliant, so its arguments
do not depend on pmap internals. This is a preparation for hiding
internal pmap definitions as much as possible from the rest of system.

Simultaneously, the protection argument evaluation is fixed. Happily,
it did not effect the mappings. And it's the reason why it was not fixed
earlier.
2016-02-02 21:10:55 +00:00
Michal Meloun
e3f95afdec ARM: All remaining functions in cpufunc_asm_arm10.S are identical with
functions in cpufunc_asm_arm9.S. Use arm9 variants and remove
cpufunc_asm_arm10.S completly.
2016-02-02 14:53:34 +00:00
Michal Meloun
fc4c15c466 ARM: Remove last unused function, cpu_flush_prefetchbuf(),
from cpu_functions table.
2016-02-02 10:50:32 +00:00
Svatopluk Kraus
e81df52303 Remove all remaining references to old and not more used struct
pmap_devmap, pmap_devmap_bootstrap() and pmap_devmap[]. It was
replaced in r257660.
2016-02-02 10:32:45 +00:00
Svatopluk Kraus
d713568142 Remove all stuff related to __ARM_ARCH >= 6 from pmap.h header except
for <machine/pmap-v6.h> include. It was used by old pmap-v6 code.
2016-02-01 19:43:04 +00:00
Michal Meloun
03fa312bb7 ARM: Remove never used cpu_tlb_flushI and cpu_tlb_flushI_SE() functions
and their implementations.
2016-02-01 13:13:53 +00:00
Michal Meloun
bf488b9dde ARM: cpufunc_domains, cpufunc_faultstatus and cpufunc_faultaddress
functions are equal for all ARM variants. Remove them from cpu_functions
table.
2016-01-31 16:34:06 +00:00
Michal Meloun
0d87509689 ARM: Next round of cpufunc.* cleaning. Nobody uses flush_brnchtgt* functions,
delete them.
2016-01-31 15:36:13 +00:00
Michal Meloun
24338d26d4 ARM: First round of cpufunc.* cleaning. All abort_fixup functions are
not currently used or defined. Delete them.
2016-01-31 13:59:16 +00:00
Michal Meloun
83242da4a9 ARM: Rename ARM specific VM_MEMATTR_WT memory attribute to standard one. 2016-01-31 09:16:20 +00:00
Michal Meloun
eefa6312dd ARM: Remove TLB IPI.
We don't support SMP on ARMv6. All ARMv7 multicore cpus already uses
hardware broadcast for TLB and cache operations.
2016-01-30 13:11:13 +00:00
Svatopluk Kraus
37b8426b33 Retire pmap_pte_init_mmu_v6() which was used by old pmap-v6. 2016-01-29 17:43:03 +00:00
Svatopluk Kraus
1fc390d1a1 Remove NPTEPG definition which is not used anywhere now after
introduction of new pmap dump interface (r294722). And do not
expose pt_entry_t type.
2016-01-29 16:42:03 +00:00
Svatopluk Kraus
480f7464c1 Use kernel_pmap directly instead of pmap_kernel(). The kernel_pmap is
already used for __ARM_ARCH >= 6 and so even for __ARM_ARCH < 6 on some
common places.
2016-01-29 16:01:37 +00:00
Michal Meloun
41a7c569b0 ARM: remove old pmap-v6 code. The new pmap-v6 is mature enough, and
dual implementation is showstopper for major cleanup.

This patch only removes old code from tree. Cleanups will follow asap.
2016-01-29 10:31:54 +00:00
Zbigniew Bodek
60ba692c78 SMP support for ARMv6/v7 HW watchpoints
Use per-CPU structure to store HW watchpoints registers state
for each CPU present in the system. Those registers will be restored
upon wake up from the STOP state if requested by the debug_monitor
code. The method is similar to the one introduced to AMD64.

We store all possible 16 registers for HW watchpoints
(maximum allowed by the architecture).
HW breakpoints are not maintained since they are used for single
stepping only.

Pointed out by: kib
Reviewed by:    wma
No strong objections from: kib
Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4338
2016-01-28 12:43:58 +00:00
Andrew Turner
1e7b9e9e68 Allow us to be told about memory past the first 4GB point, but ignore it.
This allows, for example, UEFI pass a memory map with some ram in this
region, but for us to ignore it. This is the case when running under the
qemu virt machine type.

Sponsored by:	ABT Systems Ltd
2016-01-25 23:04:40 +00:00
Zbigniew Bodek
595f8a5905 Introduce support for HW watchpoints and single stepping for ARMv6/v7
Allows for using hardware watchpoints for 1, 2, 4, 8 byte long addresses.
The default configuration of watchpoint is RW but code allows to select
RO or WO and X.
Since debugging registers are per-CPU (CP14) the watchpoint is set on
the CPU that was lucky (or not) to enter DDB.

HW breakpoints are used to perform single step in KDB.
When HW breakpoint is enabled all watchpoints are temporary disabled
to avoid recursive abort on both watchpoint and breakpoint.
In case of branch, the breakpoint is set to both - next instruction
and possible branch address. This requires at least 2 breakpoints
supported in the CPU however this is a must for ARMv6/v7 CPUs.

Reviewed by:   imp
Submitted by:  Zbigniew Bodek <zbb@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4037
2016-01-25 18:02:28 +00:00
Svatopluk Kraus
971962e4d9 Create new pmap dump interface for minidump and use it for existing
pmap implementations on ARM. This way minidump code can be used without
any platform specific modification.

Also, this is the last piece missing for ARM_NEW_PMAP.

Differential Revision:	https://reviews.freebsd.org/D5023
2016-01-25 12:43:07 +00:00
Andrew Turner
2aa4a62da3 Use __ARM_ARCH to decide when ARM_TP_ADDRESS needs to be set. This fixes
an issue with clang 3.8.0 where none of the __ARM_ARCH_*__ macros were
defined on some ARMv6 kernel configs.

Sponsored by:	ABT Systems Ltd
2016-01-16 10:12:50 +00:00