Commit Graph

3314 Commits

Author SHA1 Message Date
Svatopluk Kraus
765b884ede Fix pmap_fault(). It turned out that alignment abort may have higher
priority than both translation and permission ones.

Approved by:	kib (mentor)
2015-11-10 13:15:34 +00:00
Konstantin Belousov
081432a88f Implement atomic_testandset_{32,int,long,64} for ARMv6. Only
little-endian configuration for 64-bit variant is supported.

Reviewed by:	mmel
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D4113
2015-11-10 12:15:13 +00:00
Michal Meloun
4dbc00835d ARM: Remove trailing whitespace from sys/arm/include
No functional changes.

Approved by:    kib (mentor)
2015-11-10 12:02:41 +00:00
Michal Meloun
89b4b66950 ARM: Improve robustness of locore_v6.S and fix errors.
- boot page table is not allocated in data section, so must be
  cleared before use
- map only one section (1 MB) for SOCDEV mapping (*)
- DSB must be used for ensuring of finishing TLB operations
- Invalidate BTB when appropriate

PR:		198360
Reported by:	Daisuke Aoyama <aoyama at peach.ne.jp> (*)
Approved by:	kib (mentor)
2015-11-10 11:45:41 +00:00
Tijl Coosemans
ad3c3dbe18 Fix typo (s/ncpus/mp_ncpus/)
Reported by:	bz
2015-11-09 22:12:29 +00:00
Bjoern A. Zeeb
eeaf6acbfd Now that the PMU implementation is independent of HWPMC
as of r288992 use it to manage the CCNT.

Use the CNNT for get_cyclecount() instead of binuptime() when device pmu
is compiled in; if it fails to attach, fall back to the former method.

Enable by default for the BeagleBoneBlack configuration.

Optained from:		Cambridge/L41
Sponsored by:		DARPA/AFRL
Reviewed by:		andrew
Differential Revision:	https://reviews.freebsd.org/D3837
2015-11-09 17:57:32 +00:00
Tijl Coosemans
27f38a8d69 Since r289279 bufinit() uses mp_ncpus, but some architectures set this
variable during mp_start() which is too late.  Move this to mp_setmaxid()
where other architectures set it and move x86 assertions to MI code.

Reviewed by:	kib (x86 part)
2015-11-08 14:26:50 +00:00
Svatopluk Kraus
bee75f52d1 Make usermode variable the bool type. It's already used that way.
Suggested by:	kib
Approved by:	kib (mentor)
2015-11-08 08:31:34 +00:00
Oleksandr Tymoshenko
ebb62474ab Fix some of WITNESS complaints and bootup lock by removing msg_avail
condvar/mutex. They're basically no-op because error is not propagated
up the call chain. We still report message failures in VC service callback
2015-11-08 04:15:52 +00:00
Oleksandr Tymoshenko
b805a8c3eb - Replace semaphore-base locking with sleep/wait synchronization:
sema_trywait/sema_timedwait can't be used while holding
    non-sleepable mutex

- Fix infinite loop if response from VideoCore never received
2015-11-08 03:34:19 +00:00
Warner Losh
971c23c9a0 Correct !FDT case with proper name. 2015-11-07 22:58:56 +00:00
Warner Losh
7535619977 Implement the phy-mode property for ate and macb. If it is set to
"rmii", use rmii mode for the MAC, otherwise use MII mode. The code is
somewhat duplicated between these drivers for this.

Also, add AT91RM9200 compatibility strings to the ate driver. In the
future, there's a good chance that ate will lose the MACB support and
only attach to the AT91RM9200 EMAC device since the macb works now
that RMII support has been added to it.
2015-11-07 22:52:06 +00:00
Warner Losh
56ea9c7b08 Add support for RMII in macb, cribbed slightly from the ate
driver. This is taken from the MAC at boot, but can be overridden with
'options AT91_MACB_USE_RMII'.

Switch to macb for HL201 and SAM9G20EK boards. It now works both
places. Also start to sneak up on FDT for the SAM9G20EK board, but
leave disabled due to issues with MMC that haven't been resolved.
Add early debug support for the SAM9G20EK since that is required
for FDT to work presently on these SoC.
2015-11-07 20:02:07 +00:00
Svatopluk Kraus
9a54871fd8 Set correct code for signal in abort_align() routine.
Remove superfluous printf() and both unnecessary and obsolete comments.

Approved by:	kib (mentor)
2015-11-06 23:17:00 +00:00
Olivier Houchard
b34e5f2e07 Include opt_platform.h to get FDT defined. 2015-11-06 20:12:31 +00:00
Svatopluk Kraus
3084b64cd9 Make interrupt dispatching MP safe. Use GPU interrupt bit in per-core
interrupt status register to process shared interrupts only if the bit
is active and only on core to which they are routed.

Reviewed by:	imp, loos
Approved by:	kib (mentor)
Differential Revision:	https://reviews.freebsd.org/D3723
2015-11-06 17:12:33 +00:00
Olivier Houchard
c973c8b228 Make if_macb work with FDT. 2015-11-05 22:03:42 +00:00
Olivier Houchard
a3f8e2c7fc Make at91_pmc probe any at91 pmc device we support, not just at91rm9200.
MFC after:	1 week
2015-11-05 22:03:20 +00:00
Oleksandr Tymoshenko
f4f73431bc Add /dev/vcio, userland access point to VideoCore mailbox property channel
It's required by some applications in raspberrypi-userland package
2015-11-05 04:16:03 +00:00
Oleksandr Tymoshenko
8826550b5a Refactor mailbox property API to make it usable for /dev/vcio driver:
- Add bcm2835_mbox_property for generic property request, it accepts
    pointer to prepared property chan message and its size, forwards
    it to MBOX and copies result back
- Make all bcm2835_mbox_XXX functions that use property channel go
    through bcm2835_mbox_property path. Do not accept device_t as
    an argument, it's not required: all DMA operatiosn should go
    through mbox device, and all API consumers should report errors
    on their side.
2015-11-05 03:46:54 +00:00
Svatopluk Kraus
36fb9d5fc8 Fix comment about unpriviledged instructions. Now, it matches with
current state after r289372.

While here, do some style and comment cleanups.  No functional changes.

Approved by:	kib (mentor)
2015-11-04 15:35:22 +00:00
Oleksandr Tymoshenko
23e00b90da Revert r290243, it's vaid "illegal instruction" case
DEX bit is set to 1 and exception raised whenever vectorized operation is
attempted on the VFP implementation that does not support it (i.e. on Cortex A7)
2015-11-04 04:01:59 +00:00
Ian Lepore
0c1daec859 Eliminate the last dregs of the old global arm_root_dma_tag.
In the old days, device drivers passed NULL for the parent tag when creating
a new tag, and on arm platforms that resulted in a global tag representing
overall platform constraints being substituted in the busdma code.  Now all
drivers use bus_get_dma_tag() and if there is a need to represent overall
platform constraints they will be inherited from a tag supplied by nexus or
some bus driver in the hierarchy.

The only arm platforms still relying on the old global-tag scheme were some
xscale boards with special PCI-bus constraints.  This change provides those
constraints through a tag supplied by the xscale PCI bus driver, and
eliminates the few remaining references to the old global var.

Reviewed by:	cognet
2015-11-02 22:49:39 +00:00
Zbigniew Bodek
232e189a56 Add support for branch instruction on armv7 with ptrace single step
Previous code supported only "continuous" code without any kind of
branch instructions. To change that, new function was implemented
which parses current instruction and returns an addres where
the jump might happen (alternative addr).
mdthread structure was extended to support two breakpoints
(one directly below current instruction and the second placed
at the alternative location).
One of them must trigger regardless the instruction has or has not been
executed due to condition field.
Upon cleanup, both software breakpoints are removed.

This implementation parses only the most common instructions
that are present in the code (like 99.99% of all), but there
is a chance there are some left, not covered by the parsing routine.
Parsing is done only for 32-bit instruction, no Thumb nor Thumb-2
support is provided.

Reviewed by:   kib
Submitted by:  Wojciech Macek <wma@semihalf.com>
Obtained from: Semihalf
Sponsored by:  Juniper Networks Inc.
Differential Revision: https://reviews.freebsd.org/D4021
2015-11-02 16:56:34 +00:00
Oleksandr Tymoshenko
85645c5669 Add mailbox tag/structure for touchscreen buffer address property 2015-11-01 23:50:07 +00:00
Oleksandr Tymoshenko
0265aa0a15 Treat synchronous VFP exception just like aynchronous: as an FP exception,
not as illegal instruction
2015-11-01 21:59:56 +00:00
Oleksandr Tymoshenko
5ab55ce398 Fix framebuffer compatibility with new RPi firmware. Framebuffer driver
receives video memory address from VideoCore through property mailbox
channel. Older versions of firmware (and the one that is currently part
of sysutils/u-boot-rpi and sysutils/u-boot-rpi2) returned real physical
address, newer one returns VideoCore bus address, so we need to convert
it to actual physical address. this version works with both older and
newer interface.
2015-10-30 00:24:37 +00:00
Oleksandr Tymoshenko
5da8f2b69b Fix LEAVE_HYP macro: spsr is not guaranteed to contain valid value at this
point, e.g. on RaspberryPi 2 when control is passed from loader to kernel
it contains garbage. So we use cpsr as a base for new cpsr value: if we
have reached this point it means current value is OK

Reviewed by:	andrew
2015-10-29 22:12:03 +00:00
Jason A. Harmening
d58d7ad4a8 Retire pmap_dmap_iscurrent(). It is only a wrapper around pmap_is_current(), and is no longer called. 2015-10-28 21:17:38 +00:00
Andrew Turner
4648ee9525 Remove the s3c2xx0 code, it's no longer used. As far as I know I as the
main user of this code, however I haven't used it in over two years, and
don't expect to in the future.
2015-10-28 13:14:16 +00:00
Andrew Turner
7c07418e51 Start to remove support for the XScale i80321. As far as I can tell nobody
uses this which makes it difficult to support.
2015-10-28 13:07:56 +00:00
Andrew Turner
5635dd52eb Start to remove support for the Samsung s3c24x0 SoCs by removing the kernel
config, and support from NOTES.
2015-10-27 23:37:54 +00:00
Zbigniew Bodek
3c71b84f0a Add etherswitch support to mge
This commit introduces support for etherswitch devices that utilize SMI as
a way of accessing its registers. SMI register is located in address space
of mge -- access to it was exported through MDIO interface.

Attachment functions were enhanced so as to ensure proper initialisation
in both cases: 1) PHYs attached directly to mge, 2) PHYs attached to
switch device and switch attached to mge. Attachment of etherswitch device
depends on dts entry with compatible="mrvl,sw" property. If none is found,
typical PHY attachment procedure follows.

In case of switch attached, PHYs' status and configuration is accessible
via etherswitchcfg, and ifconfig shows always-up, non-configurable mge
interfaces.

Due to the fact that there may be simultaneous accessess to SMI
registers (e.g. from PHY attached to one of mge instances and switch
to the other), SMI access interlock was added. It is SX lock,
because sleep ability is necessary -- busy-waiting would result
in poor performance due to long delays required by hardware.
Underlying switch driver is obliged to use sleepable locks as well.

Reviewed by:    adrian
Obtained from:  Semihalf
Submitted by:   Bartosz Szczepanek <bsz@semihalf.com>
Differential revision: https://reviews.freebsd.org/D3900
2015-10-25 22:00:56 +00:00
Ian Lepore
e6bbb5d227 Define a couple macros to access cacheline size/mask in an arch-dependent
way.  This code should now work for all arm versions v4 thru v7.
2015-10-24 21:27:09 +00:00
Ian Lepore
ce6ce41cac Provide armv4/v5 implementations of several of the armv6 cache maintenance
functions.  This will make it possible to use the same busdma code for all
arm platforms v4 thru v7.
2015-10-24 21:25:53 +00:00
Ian Lepore
d818f2b6b9 Rename dcache_dma_preread() to dcache_inv_poc_dma() to make it clear that it
is a dcache invalidate to point of coherency just like dcache_inv_poc(), but
a slightly different version specific to dma operations.  Elaborate the
comment about how and why it's different.
2015-10-24 19:39:41 +00:00
Ian Lepore
872fb8b006 A few more whitespace, style, and comment cleanups. No functional changes. 2015-10-24 03:01:47 +00:00
Ian Lepore
5c738111f9 Bring in all the new(-ish) statistics code from armv6. 2015-10-24 02:44:13 +00:00
Ian Lepore
ba4e597710 Change the preallocation of a busdma segment mapping array from per-tag to
per-map.  The per-tag scheme is not safe, and a mutex can't be used to
protect it because the mapping routines can't sleep.  Code brought in
from armv6 implementation.
2015-10-24 02:18:14 +00:00
Ian Lepore
c83f1f12aa Instead of all memory allocations using M_DEVBUF, use new categories
M_BUSDMA for allocations of metadata (tags, maps, segment tracking lists),
and M_BOUNCE for bounce pages.
2015-10-23 22:52:00 +00:00
Ian Lepore
7a8c92a2c2 Instead of all memory allocations using M_DEVBUF, use new categories
M_BUSDMA for allocations of metadata (tags, maps, segment tracking lists),
and M_BOUNCE for bounce pages.
2015-10-23 22:51:48 +00:00
Ian Lepore
cce940d2f6 Catch up to r232356: change the boundary constraint type to bus_addr_t.
This code lived in the projects/armv6 branch when that change got applied
to all the other arches.
2015-10-23 21:29:37 +00:00
Ian Lepore
99bcf5e5b6 Whitespace and style nits, no functional changes.
The goal is to make these two files cosmetically alike so that the actual
implementation differences are visible.  The only changes which aren't
spaces<->tabs and rewrapping and reindenting lines are a couple fields
shuffled around in the tag and map structs so that everything is in the same
order in both versions (which should amount to no functional change).
2015-10-23 20:49:34 +00:00
Jason A. Harmening
a50730587b Remove unclear comment about address truncation in busdma. Add (hopefully much clearer) comment at declaration of PHYS_TO_VM_PAGE().
Noted by:	avg
2015-10-23 12:03:25 +00:00
Jason A. Harmening
0820c78e93 Use pmap_quick* functions in armv6 busdma, for bounce buffers and cache maintenance. This makes it safe to sync buffers that have no VA mapping associated with the busdma map, but may have other mappings, possibly on different CPUs. This also makes it safe to sync unmapped bounce buffers in non-sleepable thread contexts.
Similar to r286787 for x86, this treats userspace buffers the same as unmapped buffers and no longer borrows the UVA for sync operations.

Submitted by: 	Svatopluk Kraus <onwahe@gmail.com> (earlier revision)
Tested by:	Svatopluk Kraus
Differential Revision:	https://reviews.freebsd.org/D3869
2015-10-22 16:38:01 +00:00
Ian Lepore
9a2bb68894 Fix parsing of I2C addresses properties in fdt data. I2C address is
represented in 7-bits format in DT files, but system expect it in 8-bit
format.  Also, fix two drivers that locally hack around this bug.

Submitted by:	Michal Meloun <meloun@miracle.cz>
2015-10-21 15:41:16 +00:00
Ian Lepore
7b19ce31bb Move arm_gic_bind() out of the #ifdef SMP block to fix compile errors in
the not-SMP case.  This is safe because arm_irq_next_cpu() will return
the cpuid of the current/only core in the not-SMP case.

Submitted by:	 Bartosz Szczepanek @ semihalf
2015-10-21 13:59:00 +00:00
Jason A. Harmening
845baf1922 Use pmap_quick* for out-of-context bounce buffers and (limited) cache maintenance of unmapped buffers in armv5 busdma.
Tested by:	Mattia Rossi <mattia.rossi.mailinglists@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3522
2015-10-21 04:53:34 +00:00
Ian Lepore
d891769473 Uncomment some rather important code that was commented out for benchmarking.
Normally this routine is supposed to loop until the PIC returns a "no more
interrupts pending" indication.  I had commented that out to do just one
interrupt per invokation to do some timing tests.

Spotted by:   	Svata Kraus
Pointy Hat:	ian
2015-10-20 15:15:30 +00:00
Ganbold Tsagaankhuu
ba27fc087c Include "opt_platform.h" to fix kernel build for amlogic devices. 2015-10-20 13:47:36 +00:00