Commit Graph

2690 Commits

Author SHA1 Message Date
Ian Lepore
60f47da972 The anatop driver controls power and PLLs and needs to be available before
just about anything else (other than octop which provides it config info),
so make it an EARLY_DRIVER_MODULE().
2014-09-02 02:56:43 +00:00
Ian Lepore
866180c3fc The ocotp driver provides access to registers containing chip configuration
data that is needed by other drivers, so make it an EARLY_DRIVER_MODULE()
that loads before just about anything else.
2014-09-02 02:54:55 +00:00
Ian Lepore
8c8f31e7b2 sdhci.h has grown a dependency on sysctl.h, include the latter where needed. 2014-09-01 19:20:34 +00:00
Ian Lepore
752ba93078 Rename OF_xref_phandle() to OF_node_from_xref() and add a new function
that provides the inverse translation, OF_xref_from_node().

Discussed with:	nwhitehorn
2014-09-01 18:51:01 +00:00
Ian Lepore
156688371b Do not generate unwind info in asm functions if _STANDALONE is defined.
The .fnend op causes the assembler to emit RELOC references to unwind
support functions that don't exist in libstand.
2014-09-01 14:57:04 +00:00
Warner Losh
877c97e5bd Resync comments about scbus and pass for life after AHCI joined CAM.
Sponsored by: Netflix
2014-09-01 03:49:21 +00:00
Ruslan Bukin
99d7e0a9a8 GIC (Cortex A's interrupt controller) supports up to 1020 IRQs. 2014-08-31 17:40:19 +00:00
Ian Lepore
93844d3203 Put option FDT into the base IMX6 config and remove it from the config
of boards based on IMX6.
2014-08-31 15:25:40 +00:00
Ian Lepore
46dd56e781 The Marvell PJ4B cpu family is armv7, not armv6. 2014-08-31 15:23:49 +00:00
Ian Lepore
4863c75af7 Fix the handling of MMU type in the AP entry code. The ARM_MMU_V6/V7
symbols are always #defined to 0 or 1, so use #if SYM not #if defined(SYM).
Also, it helps if you include the header file that defines the symbols.
2014-08-30 22:21:57 +00:00
Michael Tuexen
65d495a87e Enable SCTP support. It runs perfectly fine on a Wandboard quad.
MFC after: 3 days
2014-08-30 20:18:47 +00:00
Michael Tuexen
3cb6ceedb7 Remove FDT option, since it is in every file, which includes this one. 2014-08-30 20:00:18 +00:00
Luiz Otavio O Souza
801abb3eba Rewrite of ti_i2c based on gonzo's patch, fix the following bugs/problems:
. interrupt storm detected on "intr70:"; throttling interrupt source;

  . Added access serialization on iicbus_transfer(), previously there was
    no such protection and a new transfer could easily confuse the
    controller;

  . Add error checkings (i.e. stop the transfer when a error is detected
    and do _not_ overwrite the previous error);

  . On command done interrupt do not assume that the transfer was finished
    sucessfully as we will receive the command done interrupt even after
    errors;

  . Simplify the FIFO handling;

  . Reset the FIFO between the transfers as the FIFO may contain data from
    the last (failed) transfer;

  . Fix the iicbus speed for AM335x, which in turn will make better use of
    the I2C noise filter (set to one internal clock cycle);

  . Move the read and write handler to ithread instead of notifying the
    requesting thread with wakeup(9);

  . Fix the comments based on OMAP4 TRM.

The above changes allows me to read the EDID from my HDMI monitor on BBB
with gonzo's patches to support TDA19988 (which does 128 bytes reads) and
repeatedly scan the iicbus (with a modified i2c(8)) without lock up the bus.

Phabric:	D465
2014-08-20 17:02:37 +00:00
Warner Losh
ef9bab8ec8 Make note about reset vs RTOE actions... 2014-08-18 21:04:35 +00:00
Warner Losh
40ad132dfd /usr/libexec/ld.so.1 never was a thing on FreeBSD/arm. This was the
FreeBSD 3.x and 4.x run time linker. FreeBSD/arm's first release was
5.0. Retire this long-dead code.
2014-08-18 02:45:06 +00:00
Warner Losh
817dc00433 Expand the elf brandelf infrastructure to give access to the whole ELF
header (Elf_Ehdr) to determine if a particular interpretor wants to
accept it or not. Use this mechanism to filter EABI arm on OABI arm
kernels, and vice versa. This method could also be used to implement
OABI on EABI arm kernels, if desired, or to allow a single mips kernel
to run o32, n32 and n64 binaries.

Differential Revision: https://reviews.freebsd.org/D609
2014-08-18 02:44:56 +00:00
Bjoern A. Zeeb
e6b802649c Remove keyboard entropy [1] from r270105.
Reported by:		ian [1]
(Pointy hat)^2 to:	imp
2014-08-17 18:27:02 +00:00
Warner Losh
71db9bfe7d Add missing license to at91_common.c. It was committed w/o a license.
Pointy hat to: imp@
2014-08-17 16:53:19 +00:00
Warner Losh
7945ebfd6c Define at91_master_clock in only one file to eliminate warnings about
it multiply defined commons.
2014-08-17 16:53:14 +00:00
Warner Losh
8f5f93be3a Convert the HL201 config file to use FDT. 2014-08-17 16:53:10 +00:00
Ian Lepore
6a3fc532ab When the initarm_* routines were renamed to platform_* and moved to their
own header file, the lovely block of comments explaining what the generic
init code expects of the soc implementations got lost, restore it.
2014-08-17 02:56:58 +00:00
Ian Lepore
93f6c1b54f Rename the old initarm_* functions to the new platform_* names. Also
move the registration of the static device map table into the function
intended to do devmap init stuff.
2014-08-17 02:53:36 +00:00
Ian Lepore
1dfe3d275c Move the imx6 sysctl temperature info to hw.imx6 where all the other
soc-wide info lives.  It was under dev.imx6_anatop.0.

What does anatop mean anyway?  Nobody seems to know, so it's probably
not where somebody will think to look for imx6 hardware info.
2014-08-16 20:44:45 +00:00
Warner Losh
d90e30ba36 Implement the FDT static pinctl/pinmux spec for Atmel. This will
configure the mux and config registers for PIO devices based on what
we find in the FDT. I developed it per the spec that had been
committed to Linux in the January 2014 time frame and haven't
updated. In short, bundles of pins are activated in specific ways for
specific configurations, and we implement all of that.

What's not included is a MI device infrastructure, any dynamic
run-time changing of these pins, etc. Also not included are hooks into
all the drivers to enable the latter (static at boot no driver changes
are needed). These larger questions will need to be answered once we
have more drivers like this for more platforms, or somebody has a heck
of a lot of time to research a bunch of platforms, the Linux solution
(which is good, but has its warts), etc.
2014-08-15 16:08:52 +00:00
Warner Losh
6e8f9f5113 Print the symbolic bit names for the status when we get a timeout. 2014-08-14 23:17:33 +00:00
Warner Losh
9fedbe51c6 Add AIC to at91sam9260 support, now that it is needed for multipass to
work. This gets my AT91SAM9260-based boards almost booting with
current in multi pass. The MCI driver is broken, but it is equally
broken before multi-pass.
2014-08-14 04:21:31 +00:00
Warner Losh
9a6e86e109 Add support for multipass to Atmel, for both FDT and !FDT cases. 2014-08-14 04:21:25 +00:00
Warner Losh
66f2388712 Start to add FDT support. 2014-08-14 04:21:20 +00:00
Warner Losh
280cfc8438 Add support for FDT and !FDT configs on Atmel, though FDT isn't
working yet.
Bump rev on arm Makefile since files.at91 uses new '!' operator.
2014-08-14 04:21:14 +00:00
Warner Losh
161fedb9cc From https://sourceware.org/ml/newlib/2014/msg00113.html
By Richard Earnshaw at ARM
>
>GCC has for a number of years provides a set of pre-defined macros for
>use with determining the ISA and features of the target during
>pre-processing.  However, the design was always somewhat cumbersome in
>that each new architecture revision created a new define and then
>removed the previous one.  This meant that it was necessary to keep
>updating the support code simply to recognise a new architecture being
>added.
>
>The ACLE specification (ARM C Language Extentions)
>(http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.set.swdev/index.html)
>provides a much more suitable interface and GCC has supported this
>since gcc-4.8.
>
>This patch makes use of the ACLE pre-defines to map to the internal
>feature definitions.  To support older versions of GCC a compatibility
>header is provided that maps the traditional pre-defines onto the new
>ACLE ones.

Stop using __FreeBSD_ARCH_armv6__ and switch to __ARM_ARCH >= 6 in the
couple of places in tree. clang already implements ACLE. Add a define
that says we implement version 1.1, even though the implementation
isn't quite complete.
2014-08-14 04:20:13 +00:00
Jean-Sébastien Pédron
ca885fdfde Fix two files forgotten in r269783 (vt_generate_cons_palette)
Reported by:	bz
MFC after:	1 week
MFC with:	269783
2014-08-10 22:24:14 +00:00
Warner Losh
a17de72b25 Per discussion on arm@, the compiler generates misaligned
relocations. Cope with memcpy when needed.

Submitted by: fabient@ (plus changes suggested by thread)
2014-08-09 22:51:26 +00:00
Konstantin Belousov
39ffa8c138 Change pmap_enter(9) interface to take flags parameter and superpage
mapping size (currently unused).  The flags includes the fault access
bits, wired flag as PMAP_ENTER_WIRED, and a new flag
PMAP_ENTER_NOSLEEP to indicate that pmap should not sleep.

For powerpc aim both 32 and 64 bit, fix implementation to ensure that
the requested mapping is created when PMAP_ENTER_NOSLEEP is not
specified, in particular, wait for the available memory required to
proceed.

In collaboration with:	alc
Tested by:	nwhitehorn (ppc aim32 and booke)
Sponsored by:	The FreeBSD Foundation and EMC / Isilon Storage Division
MFC after:	2 weeks
2014-08-08 17:12:03 +00:00
Nathan Whitehorn
e2284b1f34 Remove unnecessary inclusion of FDT headers. 2014-08-08 06:30:17 +00:00
Nathan Whitehorn
2d4c9dd88f Use OF_getencprop() in preference to OF_getprop() and manual byte-swapping. 2014-08-08 06:29:30 +00:00
Ian Lepore
9ce4512ccd Add a missing clock register definition. 2014-08-08 01:23:43 +00:00
Ian Lepore
2ac725a4ec Use a SYSINIT to init the array of interrupt names on arm. This was
called from initarm() in arm/machdep.c, but many legacy arm platforms
have their own private initarm(), so a SYSINIT fixes everyone.

Reported by:	jmg
2014-08-06 21:27:15 +00:00
John-Mark Gurney
4beaa0151a put these under bootverbose, they are only needed for debugging, not
useful for the normal user durning normal runtime...
2014-08-06 21:16:15 +00:00
Ian Lepore
5fdc7f7e8f Cache the imx6 SoC type in a static var so that it only has to be figured
out by sniffing hardware registers once.
2014-08-05 19:10:53 +00:00
Ian Lepore
970775a5d2 Add an arm option, ARM_DEVICE_MULTIPASS, used to opt-in to multi-pass
device attachment on arm platforms.  If this is defined, nexus attaches
early in BUS_PASS_BUS, and other busses and devices attach later, in the
pass number they are set up for.  Without it defined, nexus attaches in
BUS_PASS_DEFAULT and thus so does everything else, which is status quo.

Arm platforms which use FDT data to enumerate devices have been relying
on devices being attached in the exact order they're listed in the dts
source file.  That's one of things currently preventing us from using
vendor-supplied fdt data (because then we don't control the order of the
devices in the data).  Multi-pass attachment can go a long way towards
solving that problem by ensuring things like clock and interrupt drivers
are attached before the more mundane devices that need them.

The long-term goal is to have all arm fdt-based platforms using multipass.
This option is a bridge to that, letting us enable it selectively as
platforms are converted and tested (the alternative being to just throw
a big switch and try to fight fires as they're reported).
2014-08-05 19:06:45 +00:00
Ian Lepore
333b6dcede Attach arm generic interrupt and timer drivers in the middle of
BUS_PASS_INTERRUPT and BUS_PASS_TIMER, respectively.
2014-08-05 18:51:51 +00:00
Ian Lepore
59866d11b5 Set the pl310 L2 cache driver to attach during the middle of BUS_PASS_CPU.
Because that's earlier than interrupts are available, set up deferred
configuration of interrupts (which are used only for debugging).
2014-08-05 17:39:58 +00:00
Gleb Smirnoff
c8d2ffd6a7 Merge all MD sf_buf allocators into one MI, residing in kern/subr_sfbuf.c
The MD allocators were very common, however there were some minor
differencies. These differencies were all consolidated in the MI allocator,
under ifdefs. The defines from machine/vmparam.h turn on features required
for a particular machine. For details look in the comment in sys/sf_buf.h.

As result no MD code left in sys/*/*/vm_machdep.c. Some arches still have
machine/sf_buf.h, which is usually quite small.

Tested by:	glebius (i386), tuexen (arm32), kevlo (arm32)
Reviewed by:	kib
Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2014-08-05 09:44:10 +00:00
Alan Cox
a695d9b25b Retire pmap_change_wiring(). We have never used it to wire virtual pages.
We continue to use pmap_enter() for that.  For unwiring virtual pages, we
now use pmap_unwire(), which unwires a range of virtual addresses instead
of a single virtual page.

Sponsored by:	EMC / Isilon Storage Division
2014-08-03 20:40:51 +00:00
Ian Lepore
c311f7078c When arm 64-bit atomic ops are available, define ARM_HAVE_ATOMIC64. Use
that symbol (which will be correct in both kernel and userland contexts)
rather than just __arm__ to decide whether to use a local implementation.
2014-08-02 03:44:27 +00:00
Ian Lepore
eaa4e27642 Use atomic_load/store_64() in the arm implementation of counter(9), and
remove the XXX comments about non-atomic access to the counters.
2014-08-01 23:06:38 +00:00
Ian Lepore
9d203d4512 Add 64-bit atomic ops for armv4, only for kernel code, mostly so that we
don't need any #ifdef stuff to use atomic_load/store_64() elsewhere in
the kernel.  For armv4 the atomics are trivial to implement for kernel
code (just disable interrupts), less so for user mode, so this only has
the kernel mode implementations for now.
2014-08-01 22:56:41 +00:00
Ian Lepore
59561ab3e1 Add 64-bit atomic ops for armv6. The only safe way to access a 64-bit
value shared across multiple cores is with atomic_load_64() and
atomic_store_64(), because the normal 64-bit load/store instructions
are not atomic on 32-bit arm.  Luckily the ldrexd/strexd instructions
that are atomic are fairly cheap on armv6.  Because it's fairly simple
to do, this implements all the ops for 64-bit, not just load/store.

Reviewed by:	andrew, cognet
2014-08-01 22:28:36 +00:00
Ian Lepore
bda25c28ac Tell the assembler we're building for armv7a with security extensions,
so that the 'smc' (secure monitor call) opcode is valid.

Submitted by:	Stepan Dyatkovskiy <stpworld@narod.ru>
2014-08-01 20:32:29 +00:00
Ian Lepore
25166187e3 Fix unwind-info errors in our hand-written arm assembler code.
We have functions nested within functions, and places where we start a
function then never end it, we just jump to the middle of something else.
We tried to express this with nested ENTRY()/END() macros (which result
in .fnstart and .fnend directives), but it turns out there's no way to
express that nesting in ARM EHABI unwind info, and newer tools treat
multiple .fnstart directives without an intervening .fnend as an error.

These changes introduce two new macros, EENTRY() and EEND().  EENTRY()
creates a global label you can call/jump to just like ENTRY(), but it
doesn't emit a .fnstart.  EEND() is a no-op that just documents the
conceptual endpoint that matches up with the same-named EENTRY().

This is based on patches submitted by Stepan Dyatkovskiy, but I made some
changes and added the EEND() stuff, so blame any problems on me.

Submitted by:	Stepan Dyatkovskiy <stpworld@narod.ru>
2014-08-01 18:24:44 +00:00
Ruslan Bukin
d440ef2d73 Rename files: keep codename only to make it shorter. 2014-08-01 15:10:55 +00:00
Ruslan Bukin
835b36e211 Add support for Chromebook2 -- next-generation 8-core
(4 in operation), 4GB ram (3.5 usable) ARM machine.

Support covers device drivers for:
- Serial Peripheral Interface (SPI)
- Chrome Embedded Controller (EC) - SPI-based version
- XHCI and USB 3.0 dual-role device PHY

Also:
- Add support for Exynos5420 in Pad module
- Move power-related functions to separate driver --
  Power Management Unit (PMU)
- Enable XHCI for Chromebook1

Special thanks to grehan@ for hardware, and to
hselasky@ for r269139.
2014-08-01 06:20:25 +00:00
Ian Lepore
e58f02735f Switch to using counter(9) for the new 64-bit stats kept by armv6 busdma. 2014-07-31 03:59:00 +00:00
Ruslan Bukin
d6fb2fd561 Remove unused option. 2014-07-29 12:44:19 +00:00
Aleksandr Rybalko
d5a20b9777 Remove SC_DFLT_FONT option. vt(4) don't use it.
Suggested by:	emaste
Sponsored by:	The FreeBSD Foundation
2014-07-29 12:04:11 +00:00
Ian Lepore
15fc287383 Export some new busdma stats via sysctl for armv6. Added:
hw.busdma.tags_total: 46
 hw.busdma.maps_total: 1302
 hw.busdma.maps_dmamem: 851
 hw.busdma.maps_coherent: 849
 hw.busdma.maploads_total: 1568812
 hw.busdma.maploads_bounced: 16750
 hw.busdma.maploads_coherent: 920
 hw.busdma.maploads_dmamem: 920
 hw.busdma.maploads_mbuf: 1542766
 hw.busdma.maploads_physmem: 0
2014-07-29 02:38:02 +00:00
Ian Lepore
b92672d0cb A while back, the array of segments used for a load/mapping operation was
moved from the stack into the tag structure.  In retrospect that was a bad
idea, because nothing protects that array from concurrent access by
multiple threads.

This change moves the array to the map structure (actually it's allocated
following the structure, but all in a single malloc() call).

This also establishes a "sane" limit of 4096 segments per map.  This is
mostly to prevent trying to allocate all of memory if someone accidentally
uses a tag with nsegments set to BUS_SPACE_UNRESTRICTED.  If there's ever
a genuine need for more than 4096, don't hesitate to increase this (or
maybe make it tunable).

Reviewed by:	cognet
2014-07-29 02:37:48 +00:00
Ian Lepore
0e58c32732 We never need bounce pages for memory we allocate. We cleverly allocate
memory the matches all the constraints of the dma tag so that bouncing
will never be required.

Reviewed by:	cognet
2014-07-29 02:37:31 +00:00
Ian Lepore
409b23f7a7 Replace a bunch of double-indirection with a local pointer var (that is,
(*mapp)->something becomes map->something).  No functional changes.

Reviewed by:	cognet
2014-07-29 02:37:24 +00:00
Ian Lepore
2746b8c41f Don't clear the DMAMAP_DMAMEM_ALLOC flag set a few lines earlier. Doh!
Reviewed by:	cognet
2014-07-29 02:36:50 +00:00
Ian Lepore
1da97d052e Memory belonging to an mbuf, or allocated by bus_dmamem_alloc(), never
triggers a need to bounce due to cacheline alignment.  These buffers
are always aligned to cacheline boundaries, and even when the DMA operation
starts at an offset within the buffer or doesn't extend to the end of the
buffer, it's safe to flush the complete cachelines that were only partially
involved in the DMA.  This is because there's a very strict rule on these
types of buffers that there will not be concurrent access by the CPU and
one or more DMA transfers within the buffer.

Reviewed by:	cognet
2014-07-29 02:36:41 +00:00
Ian Lepore
688e9d85f4 The run_filter() function doesn't just run dma tag exclusion filter
functions, it has evolved to make a variety of decisions about whether
the DMA needs to bounce, so rename it to must_bounce().  Rewrite it to
perform checks outside of the ancestor loop if they're based on information
that's wholly contained within the original tag.  Now the loop only checks
exclusion zones in ancestor tags.

Also, add a new function, might_bounce() which does a fast inline check
of flags within the tag and map to quickly eliminate the need to call
the more expensive must_bounce() for each page in the DMA operation.

Within the mapping loops, use map->pagesneeded != 0 as a proxy for all
the various checks on whether bouncing might be required.  If no pages
were reserved for bouncing during the checks before the mapping loop,
then there's no need to re-check any of the conditions that can lead
to bouncing -- all those checks already decided there would be no bouncing.

Reviewed by:	cognet
2014-07-29 02:36:27 +00:00
Ian Lepore
befb477022 Propagate any alignment restriction from the parent tag to a new tag,
keeping the more restrictive of the two values.

Reviewed by:	cognet
2014-07-29 02:36:09 +00:00
Ian Lepore
3de4bbe357 Reformat some continuation lines. No functional changes.
Reviewed by:	cognet
2014-07-29 02:36:02 +00:00
Ian Lepore
7b1ee35189 Correct the comparison logic when looking for intersections between
exclusion zones and phsyical memory.  The phys_avail[i] entries are the
address of the first byte of ram in the region, and phys_avail[i+1]
entries are the address of the first byte of ram in the next region
(i.e., they're not included in the region that starts at phys_avail[i]).

Reviewed by:	cognet
2014-07-29 02:35:44 +00:00
Ian Lepore
7c54a52475 The exclusion_bounce() routine compares unchanging values in the tag with
unchanging values in the phys_avail array, so do the comparisons just once
at tag creation time and set a flag to remember the result.

Reviewed by:	cognet
2014-07-29 02:34:32 +00:00
Ian Lepore
751428ce88 Rename _bus_dma_can_bounce(), add new inline routines.
DMA on arm can bounce for several reasons, and _bus_dma_can_bounce() only
checks for the lowaddr/highaddr exclusion ranges in the dma tag, so now
it's named exclusion_bounce().  The other reasons for bouncing are checked
by the new functions alignment_bounce() and cacheline_bounce().

Reviewed by:	cognet
2014-07-29 02:31:29 +00:00
Ruslan Bukin
4d3ff0c3e6 Add the rest of combined interrupt groups. 2014-07-28 05:37:10 +00:00
Ian Lepore
510b2cb75c Pull in the armv4 "fast out" code for checking whether busdma can bounce
due to an excluded region of physical memory.
2014-07-26 18:19:43 +00:00
Ian Lepore
9ec89d355f Remove completely bogus alignment check -- it's the physical address that
needs to be aligned, not the virtual, and it doesn't seem worth the cost
of a vtophys() call just to see if kmem_alloc_contig() works properly.
2014-07-26 18:14:16 +00:00
Gavin Atkinson
f6b4f5ca21 Add error return to dumpsys(), and use it in doadump().
This commit does not add error returns to minidumpsys() or
textdump_dumpsys(); those can also be added later.

Submitted by:	Conrad Meyer (EMC / Isilon storage division)
2014-07-25 23:52:53 +00:00
Ruslan Bukin
40d7d6323b Enable Freescale i.MX I2C driver for i.MX6. 2014-07-22 04:39:32 +00:00
Ruslan Bukin
484b4fd46c Rename i.MX I2C driver file. 2014-07-22 03:59:14 +00:00
Ian Lepore
677a88cec2 Add dl_unwind_find_exidx() for ARM EABI, required for C++ exception
handling.  For statically linked apps this uses the __exidx_start/end
symbols set up by the linker.  For dynamically linked apps it finds the
shared object that contains the given address and returns the location and
size of the exidx section in that shared object.

The dl_unwind_find_exidx() name is used by other BSD projects and Android,
and is mentioned in clang 3.5 comments as "the BSD interface" for finding
exidx data.  GCC (in libgcc_s) expects the exact same API and functionality
to be provided by a function named __gnu_Unwind_Find_exidx(), so we provide
that with an alias ("strong reference").

Reviewed by:	kib@
MFC after:	1 week
2014-07-19 22:13:27 +00:00
Ruslan Bukin
f040f3b317 Add support for Toradex Apalis i.MX6 development board.
Sponsored by:	Toradex AG
2014-07-18 08:23:53 +00:00
Ruslan Bukin
0495dcef49 Rename gpio driver file. 2014-07-18 07:52:35 +00:00
Ruslan Bukin
e18aa9229a o Enable GPIO device driver for i.MX6.
It was originally written for i.MX5 and compatible with newer chip.
o Extend device tree information
o style(9) fixes

Discussed with:	ian
2014-07-18 07:47:50 +00:00
Alan Cox
526ed91414 Implement pmap_unwire(). See r268327 for the motivation behind this change. 2014-07-16 21:06:43 +00:00
Alan Cox
87dd8ef960 Actually set the "no execute" bit on 1 MB page mappings in pmap_protect().
Previously, the "no execute" bit was being set directly in the PTE, instead
of the local variable in which the new PTE value is being constructed.  So,
when the local variable was finally assigned to the PTE, the "no execute"
bit setting was lost.
2014-07-15 17:16:06 +00:00
Alan Cox
c3c820296f Eliminate repeated calculation of next_bucket in pmap_protect() and
pmap_remove().  Eliminate an unnecessary variable from pmap_remove() and
pmap_advise().
2014-07-15 05:34:27 +00:00
Ian Lepore
0f822edead Fix the Zedboard/Zynq ethernet driver to handle media speed changes so
that it can connect to switches at speeds other than 1gb.

This requires changing the reference clock speed.  Since we still don't
have a general clock API that lets a SoC-independant driver manipulate its
own clocks, this change includes a weak reference to a routine named
cgem_set_ref_clk().  The default implementation is a no-op; SoC-specific
code can provide an implementation that actually changes the speed.

Submitted by:	Thomas Skibo <ThomasSkibo@sbcglobal.net>
2014-07-14 20:58:57 +00:00
Alan Cox
db3ddfd672 Eliminate dead code. There is no direct map. This code was cut-and-pasted
from amd64.
2014-07-14 17:16:09 +00:00
Ian Lepore
8d99c2a062 Pending interrupt status is cleared by writing to the ISR, not the data reg.
MFC after:	1 week
2014-07-10 14:06:18 +00:00
Ian Lepore
1e3d53c687 Use named constant rather than '0' to access the reset controller register. 2014-07-08 14:35:09 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
Andrew Turner
8b04766b28 Remove the incomplete Tegra 2 code, nobody was maintaining it. The AC100
never booted to single user mode.

It can be brought back if someone is willing to get it into a stable state
and maintain it.
2014-06-22 15:15:52 +00:00
Michael Tuexen
2ff25a8b1c Different versions of the ARM processor use different registers.
Fix the code used on a Raspberry Pi.

Reviewed by: markm@
2014-06-17 21:48:04 +00:00
John Baldwin
a2677ff239 Don't bother clearing maps for static DMA allocations to NULL. Instead,
leave them as purely opaque values that are only set by bus_dmamem_alloc().
2014-06-17 18:10:06 +00:00
Attilio Rao
3ae10f7477 - Modify vm_page_unwire() and vm_page_enqueue() to directly accept
the queue where to enqueue pages that are going to be unwired.
- Add stronger checks to the enqueue/dequeue for the pagequeues when
  adding and removing pages to them.

Of course, for unmanaged pages the queue parameter of vm_page_unwire() will
be ignored, just as the active parameter today.
This makes adding new pagequeues quicker.

This change effectively modifies the KPI.  __FreeBSD_version will be,
however, bumped just when the full cache of free pages will be
evicted.

Sponsored by:	EMC / Isilon storage division
Reviewed by:	alc
Tested by:	pho
2014-06-16 18:15:27 +00:00
Ruslan Bukin
b9402e3d56 Add very basic driver for 12-bit Analog to Digital Converter (ADC). 2014-06-15 12:08:33 +00:00
John-Mark Gurney
4f4bd09dd1 clear the write bit... This allows my AVILA board to survive a
portsnap extract, where previously it would panic..  clearly someone
who knows pmap should optimize this code per alc's comment...

Submitted by:	alc
MFC after:	probably
2014-06-12 16:31:15 +00:00
Ruslan Bukin
d17024dfd7 Enable SMP for both Exynos5 models we support. 2014-06-12 11:44:26 +00:00
Ruslan Bukin
f0687d366a Activate IRQ 30 (non-secure private timer IRQ) for case we are running
in non-secure state.
2014-06-12 11:41:04 +00:00
Ruslan Bukin
f098889377 Add machine-dependent SMP part for Exynos5420 2014-06-12 11:37:38 +00:00
John Baldwin
068d8643ad Fix various NIC drivers to properly cleanup static DMA resources.
In particular, don't check the value of the bus_dma map against NULL
to determine if either bus_dmamem_alloc() or bus_dmamap_load() succeeded.
Instead, assume that bus_dmamap_load() succeeeded (and thus that
bus_dmamap_unload() should be called) if the bus address for a resource
is non-zero, and assume that bus_dmamem_alloc() succeeded (and thus
that bus_dmamem_free() should be called) if the virtual address for a
resource is not NULL.

In many cases these bugs could result in leaks when a driver was detached.

Reviewed by:	yongari
MFC after:	2 weeks
2014-06-11 14:53:58 +00:00
Ruslan Bukin
2aaaabd4c1 Add a driver for Serial Peripheral Interface (SPI). 2014-06-11 10:03:06 +00:00
John Baldwin
f07894dbde Don't destroy bus_dma maps created by bus_dmamem_alloc(). In some cases,
don't create a map before calling bus_dmamem_alloc() (such maps were
leaked).  It is believed that the extra destroy of the map was generally
harmless since bus_dmamem_alloc() often uses special maps for which
bus_dmamap_destroy() is a no-op (e.g. on x86).

Reviewed by:	scottl
2014-06-10 20:25:45 +00:00
Alan Cox
dd05fa1945 Add a page size field to struct vm_page. Increase the page size field when
a partially populated reservation becomes fully populated, and decrease this
field when a fully populated reservation becomes partially populated.

Use this field to simplify the implementation of pmap_enter_object() on
amd64, arm, and i386.

On all architectures where we support superpages, the cost of creating a
superpage mapping is roughly the same as creating a base page mapping.  For
example, both kinds of mappings entail the creation of a single PTE and PV
entry.  With this in mind, use the page size field to make the
implementation of vm_map_pmap_enter(..., MAP_PREFAULT_PARTIAL) a little
smarter.  Previously, if MAP_PREFAULT_PARTIAL was specified to
vm_map_pmap_enter(), that function would only map base pages.  Now, it will
create up to 96 base page or superpage mappings.

Reviewed by:	kib
Sponsored by:	EMC / Isilon Storage Division
2014-06-07 17:12:26 +00:00