Commit Graph

1935 Commits

Author SHA1 Message Date
Aleksandr Rybalko
959631351b o Make fields names short.
o Slim down reg fields comments.
2013-07-05 13:37:57 +00:00
Oleksandr Tymoshenko
179232d853 Add support for ePWM submodule of PWMSS
ePWM is controlled by sysctl nodes dev.am335x_pwm.N.period,
dev.am335x_pwm.N.dutyA and dev.am335x_pwm.N.dutyB that controls
PWM period and duty cycles for channels A and B respectively.

Period and duty cycle are measured in clock ticks. Default
clock frequency for AM335x PWM subsystem is 100MHz
2013-07-04 20:13:22 +00:00
Grzegorz Bernacki
fc4c2354ff Remove redundant clearing of the PGA_WRITEABLE flag in
pmap_remove_all()

This flag should already be cleared by pmap_nuke_pv()

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-07-04 10:40:24 +00:00
Grzegorz Bernacki
ad55cd76a6 Fix modified bit emulation for ARMv6/v7
When doing pmap_enter_locked(), enable write permission only when access
type indicates attempt to write. Otherwise, leave the page read only but
mark it writable in pv_flags.

This will result in:
1. Marking page writable during pmap_enter() but only when ensured that it
   will be written right away so that we will not get redundant permissions
   fault on write attempt.
2. Keeping page read only when it is permitted to be written but there was
   no actual write attempt. Hence, we will get permissions fault on write
   access and mark page writable in pmap_fault_fixup() what will indicate
   modification status.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-07-04 10:38:14 +00:00
Oleksandr Tymoshenko
64cf3edab8 Fix one of INVARIANTS-related UMA panics on ARM
Force UMA zone to allocate service structures like slabs using own
allocator.  uma_debug code performs atomic ops on uma_slab_t fields
and safety of this operation is not guaranteed for write-back caches
2013-07-03 23:38:02 +00:00
Andrew Turner
4579f5e5c1 Enable VFP on Raspberry Pi. This has worked as of r251712. 2013-07-02 19:35:04 +00:00
Michael Tuexen
004f2eb2c1 Enable SCTP, since it is also enabled on GENERIC and it works fine on
the Raspberry Pi.

Discussed with: rpaulo
2013-07-01 18:58:59 +00:00
Rui Paulo
95506b814d The mbox driver is actually MP safe, so set the right flag in
bus_setup_intr().
2013-07-01 06:33:35 +00:00
Rui Paulo
623b72a733 Disable debugging. 2013-07-01 06:32:56 +00:00
Rui Paulo
b7a6be5c7c Use the new FDT_FILE rpi.dts. 2013-07-01 05:01:27 +00:00
Konstantin Belousov
70a7dd5d5b Fix issues with zeroing and fetching the counters, on x86 and ppc64.
Issues were noted by Bruce Evans and are present on all architectures.

On i386, a counter fetch should use atomic read of 64bit value,
otherwise carry from the increment on other CPU could be lost for the
given fetch, making error of 2^32.  If 64bit read (cmpxchg8b) is not
available on the machine, it cannot be SMP and it is enough to disable
preemption around read to avoid the split read.

On x86 the counter increment is not atomic on purpose, which makes it
possible for the store of the incremented result to override just
zeroed per-cpu slot.  The effect would be a counter going off by
arbitrary value after zeroing.  Perform the counter zeroing on the
same processor which does the increments, making the operations
mutually exclusive.  On i386, same as for the fetching, if the
cmpxchg8b is not available, machine is not SMP and we disable
preemption for zeroing.

PowerPC64 is treated the same as amd64.

For other architectures, the changes made to allow the compilation to
succeed, without fixing the issues with zeroing or fetching.  It
should be possible to handle them by using the 64bit loads and stores
atomic WRT preemption (assuming the architectures also converted from
using critical sections to proper asm).  If architecture does not
provide the facility, using global (spin) mutex would be non-optimal
but working solution.

Noted by:  bde
Sponsored by:	The FreeBSD Foundation
2013-07-01 02:48:27 +00:00
Rui Paulo
7476f6973c Add INET6. 2013-06-30 23:29:24 +00:00
Aleksandr Rybalko
71c80b4ea0 Replace some spaces to tab. 2013-06-30 19:53:52 +00:00
Aleksandr Rybalko
8f1bc52dfb Decrypt magic numbers - define names for fields of Generic Timer's CNTKCTL reg.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-30 19:52:41 +00:00
Olivier Houchard
247602e3ea In generic_bs_map(), use kmem_alloc_nofault() instead of kmem_alloc(), as we
only need virtual addresses.

Submitted by:	alc
2013-06-30 19:36:17 +00:00
Aleksandr Rybalko
94addbe133 Arndale Board (by Insignal) kernel config file.
More info on the Wiki page https://wiki.freebsd.org/FreeBSD/arm/ArndaleBoard

Submitted by:	Ruslan Bukin <br@bsdpad.com>
Reviewed by:	gonzo
2013-06-29 23:58:16 +00:00
Oleksandr Tymoshenko
396e0d581d - Fix IMAPx registers values calculation
- Initialize SMAPx registers too although they're unused in QEMU
- Do not pass IO/MEM resources to upper bus for activation, handle them locally.
    Previously ACTIVATE method of upper bus was no-op so nothing bad
    happened. But now FDT maps physaddr to vaddr and it causes
    troubles: fdtbus_activate_resource resource assumes that
    bustag/bushandle are already set which in this case is wrong.
2013-06-29 23:51:17 +00:00
Oleksandr Tymoshenko
cbda62170f Enable patth-through of IRQ30 and IRQ31 to PIC just as comment states 2013-06-29 23:40:44 +00:00
Aleksandr Rybalko
02d93bedab Import basic support for Samsung Exynos 5 support.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
Reviewed by:	gonzo
2013-06-29 23:39:05 +00:00
Aleksandr Rybalko
48d5dbc7a2 Add ARM Generic Timer driver.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-29 12:27:50 +00:00
Aleksandr Rybalko
0f10ca6f15 o Initialize interrupt groups as Group 0 (secure interrupts).
o Minor cleanup.

Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-29 12:08:26 +00:00
Aleksandr Rybalko
b94bc5ff9e Bump max number of IRQs for Cortex-Ax family to cover Exynos5 requirement.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-28 22:47:33 +00:00
Aleksandr Rybalko
57ae6edf31 Add identification for Cortex-A15 (R0) cores.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-28 22:31:17 +00:00
Andrew Turner
19d8e1c74a Support reading registers r0-r3 when unwinding. There is a seperate
instruction to load these. We only hit it when unwinding past an trap frame
as in C r0-r3 would never have been saved onto the stack.
2013-06-27 22:26:56 +00:00
Andrew Turner
da01dd9e1e Add UNWINDSVCFRAME to provide the unwind pseudo ops to allow us to unwind
past a trapframe.

Use this macro in exception_exit as it is the function the unwinder enters
as the functions that store the frame setting lr to point to it.
2013-06-27 18:54:18 +00:00
Oleksandr Tymoshenko
02ff64b84f - Request non-cached memory for framebuffer
- Properly probe/initialize syscons
2013-06-27 00:33:08 +00:00
Rui Paulo
8ab18d3034 Print the 'setting internal ...' message only with bootverbose. 2013-06-26 02:56:54 +00:00
Ed Schouten
72790363a3 Make support for atomics on ARM complete.
Provide both __sync_*-style and __atomic_*-style functions that perform
the atomic operations on ARMv5 by using Restartable Atomic Sequences.

While there, clean up some pieces of code where it's sufficient to use
regular uint32_t to store register contents and don't need full reg_t's.
Also sync this back to the MIPS code.
2013-06-15 08:15:22 +00:00
Andrew Turner
93ef7ecb75 Fix the vfp code to work with the 16 register variants of the VFP unit. We
check which variant we are on, and if it is a VFPv3 or v4, and has 32
double registers we save these. This fixes VFP support on Raspberry Pi.

While here clean fmrx and fmxr up to use the register names from vfp.h
as opposed to the raw register names.
2013-06-13 21:31:33 +00:00
Ed Schouten
67ccda16de Add C11 atomic fallbacks for ARM.
Basically the situation is as follows:

- When using Clang + armv6, we should not need any intrinsics. It should
  support it, even though due to a target misconfiguration it does not.
  We should fix this in Clang.
- When using Clang + noarmv6, provide __atomic_* functions that disable
  interrupts.
- When using GCC + armv6, we can provide __sync_* intrinsics, similar to
  what we did for MIPS. As ARM and MIPS are quite similar, simply base
  this implementation on the one I did for MIPS.
- When using GCC + noarmv6, disable the interrupts, like we do for
  Clang.

This implementation still lacks functions for noarmv6 userspace. To be
done.
2013-06-13 18:46:49 +00:00
Olivier Houchard
cd5ff81bd2 Increase the maximum KVM available on TI chips. Not sure why we suddenly need
that much, but that lets me boot with 1GB of RAM.
2013-06-09 22:51:11 +00:00
Andrew Turner
864cbcb81b Merge in changes from NetBSD:
* Remove support for non-elf files.
 * Add the VFP setjmp magic numbers.
 * Add the offsets for the VFP registers within the buffer.
2013-06-08 07:16:22 +00:00
Andrew Turner
0a79452954 Reduce the difference to NetBSD.
* Stop pretending we support anything other than ELF by removing code
   surrounded by #ifdef __ELF__ ... #endif.
 * Remove _JB_MAGIC_SETJMP and _JB_MAGIC__SETJMP, they are defined in
   setjmp.h, which is able to be included from asm.
 * Fix the spelling of dependent.
 * Rename END _END and add END and ASEND to complement ENTRY and ASENTRY
   respectively
 * Add macros to simplify accessing the Global Offset Table, some of these
   will be used in the upcoming update to the setjmp functions.
2013-06-07 21:23:11 +00:00
Grzegorz Bernacki
046b51bfdd Fix the passing of time on Armada XP.
In order to become independent of Coherency Fabric frequency, configure
Timer and Watchdog to operate in 25MHz mode.

Submitted by:	Zbigniew Bodek <zbb@semihalf.com>
2013-06-04 09:33:03 +00:00
Grzegorz Bernacki
df8c5665ac Implement pmap_copy() for ARMv6/v7.
Copy the given range of mappings from the source map to the
destination map, thereby reducing the number of VM faults on fork.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-06-04 09:21:18 +00:00
Oleksandr Tymoshenko
24ca3d19a9 AM335x LCD controller driver with syscons support
Limitations:
- Raster mode only
- 24 and 32 bpp only
2013-05-27 00:23:01 +00:00
Oleksandr Tymoshenko
7747ea65a0 Add PWM module driver for AM335x. Only eCAS subsystem is supported
Export function to configure eCAS submodule from another drivers.
It's used to control LCD panel backlight on AM335x EVM.
2013-05-27 00:13:27 +00:00
Oleksandr Tymoshenko
2487319716 Add SCM registers definitions for AM335x platform 2013-05-27 00:09:04 +00:00
Oleksandr Tymoshenko
2e9f638dbb Add clock definitions for LCD controller and PWM module 2013-05-27 00:06:24 +00:00
Grzegorz Bernacki
9fd7d2ddf4 Rework and organize pmap_enter_locked() function.
pmap_enter_locked() implementation was very ambiguous and confusing.
Rearrange it so that each part of the mapping creation is separated.
Avoid walking through the redundant conditions.
Extract vector_page specific PTE setup from normal PTE setting.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-05-23 12:24:46 +00:00
Grzegorz Bernacki
3bc567b6ad Stop using PVF_MOD, PVF_REF & PVF_EXEC flags in pv_entry, use PTE.
Using PVF_MOD, PVF_REF and PVF_EXEC is redundant as we can get the proper
info from PTE bits.
When the mapping is marked as executable and has been referenced we assume
that it has been executed. Similarly, when the mapping is set to be writable
and is referenced, it must have been due to write access to it.
PVF_MOD and PVF_REF flags are kept just for pmap_clearbit() usage,
to pass the information on which bit should be cleared.

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-05-23 12:23:18 +00:00
Grzegorz Bernacki
2b3e821bcc Improve, optimize and clean-up ARMv6/v7 memory management related code.
Use pmap_find_pv if needed instead of multiplying its code throughout
pmap-v6.

Avoid possible NULL pointer dereference in pmap_enter_locked()
When trying to get m->md.pv_memattr, make sure that m != NULL,
in particular that vector_page is set to be NULL.

Do not set PGA_REFERENCED flag in pmap_enter_pv().
On ARM any new page reference will result in either entering the new
mapping by calling pmap_enter, etc. or fixing-up the existing mapping in
pmap_fault_fixup().
Therefore we set PGA_REFERENCED flag in the earlier mentioned cases and
setting it later in pmap_enter_pv() is just waste of cycles.

Delete unused pm_pdir pointer from the pmap structure.

Rearrange brackets in the fault cause detection in trap.c
Place the brackets correctly in order to see course of the conditions
instantaneously.

Unify naming in pmap-v6.c and improve style
Use naming common for whole pmap and compatible with other pmaps,
improve style where possible:
pm   -> pmap
pg   -> m
opg  -> om
*pt  -> *ptep
*pte -> *ptep
*pde -> *pdep

Submitted by:   Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:   The FreeBSD Foundation, Semihalf
2013-05-23 12:15:23 +00:00
Grzegorz Bernacki
b8b08befd0 Switch to AP[2:1] access permissions model. Store "referenced"
bit in PTE.

Enable Access Flag in CPU control. With AF enabled each valid mapping
needs to have referenced bit in PTE set in order to be able to cache
it in the TLB.

AP[0] bit is to be used as reference flag.
All access permissions are encoded by AP[2:1] wherein AP[1] is in fact
"user enable" and AP[2](APX) is "write disable".

All mappings are always set to be valid. Reference emulation is performed
by setting/clearing reference flag in PTE.

md.pvh_attrs are no longer necessary however pv_flags are still being used
for now.

Marking vm_page as "dirty" or "referenced" is being performed on:
- page or flag fault servicing in pmap_fault_fixup(), basing on the fault
  type
- vm_fault servicing in pmap_enter() according to the desired protections
  and faulty access type
Redundant page marking has been removed as on ARM we know exactly when the
particular page is referenced or is going to be written.

Submitted by:	Zbigniew Bodek <zbb@semihalf.com>
Sponsored by:	The FreeBSD Foundation, Semihalf
2013-05-23 12:07:41 +00:00
Attilio Rao
9af6d512f5 o Relax locking assertions for vm_page_find_least()
o Relax locking assertions for pmap_enter_object() and add them also
  to architectures that currently don't have any
o Introduce VM_OBJECT_LOCK_DOWNGRADE() which is basically a downgrade
  operation on the per-object rwlock
o Use all the mechanisms above to make vm_map_pmap_enter() to work
  mostl of the times only with readlocks.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
2013-05-21 20:38:19 +00:00
Andrew Turner
0d8d860f6e Add a comment explaining why stack_capture is empty for EABI and clang.
While here add a comment pointing out that, while r11 is not the frame
pointer on EABI as there is no frame pointer, it's value is unused so is
safe.
2013-05-19 16:25:09 +00:00
Tim Kientzle
11ee687c67 Back out r250768 until I can further investigate why it might
be causing problems with the BeagleBone Black boot.
2013-05-18 22:42:21 +00:00
Tim Kientzle
b5eb012033 Label the mmc child after the parent. 2013-05-18 12:53:20 +00:00
Rui Paulo
613c4afd62 Revert r250692. We'll use 1 kernel config file for the BeagleBone models. 2013-05-17 15:20:45 +00:00
Grzegorz Bernacki
0a98e01821 Fix L2 cache write-back invalidate for Sheeva core.
Submitted by:	Michal Dubiel
Obtained from:	Netasq, Semihalf
2013-05-16 09:43:04 +00:00
Rui Paulo
78a4f635f8 Add a kernel config file for the BeableBone Black SoC. 2013-05-16 03:51:00 +00:00