Commit Graph

1521 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
990dc2acfb - Set proper KERNLOADADDR
- Add bpf(4) required by dhclient
2013-08-31 01:30:01 +00:00
Oleksandr Tymoshenko
8376ffb561 YAMON is 32-bit application and uses 32-bit pointers to pass kernel
arguments and environment names/values. Cast values to proper pointer type
to make MALTA kernel 64-bit compatible
2013-08-31 01:24:05 +00:00
Hiren Panchasara
631f16444a Add device PicoStation M2HP support.
This is a nice small outdoor/indoor AP from Ubiquity Networks.

The device has:
AR7241 CPU SoC
AR9287 Wifi
8MB flash
32MB RAM

wifi has been tested to work along with leds.

Submitted by:   loos
Approved by:    sbruno (mentor, implicit)
Tested by:      hiren
2013-08-30 20:46:01 +00:00
Oleksandr Tymoshenko
ba74a6f44f Add bpf(4) to config file to get dhclient working 2013-08-30 20:30:33 +00:00
Oleksandr Tymoshenko
f9719fe14b Add PCI bus space implementation that converts all 2 and 4 bytes
values to/from little endian according to PCI spec.
2013-08-30 20:28:35 +00:00
Alan Cox
51321f7c31 Significantly reduce the cost, i.e., run time, of calls to madvise(...,
MADV_DONTNEED) and madvise(..., MADV_FREE).  Specifically, introduce a new
pmap function, pmap_advise(), that operates on a range of virtual addresses
within the specified pmap, allowing for a more efficient implementation of
MADV_DONTNEED and MADV_FREE.  Previously, the implementation of
MADV_DONTNEED and MADV_FREE relied on per-page pmap operations, such as
pmap_clear_reference().  Intuitively, the problem with this implementation
is that the pmap-level locks are acquired and released and the page table
traversed repeatedly, once for each resident page in the range
that was specified to madvise(2).  A more subtle flaw with the previous
implementation is that pmap_clear_reference() would clear the reference bit
on all mappings to the specified page, not just the mapping in the range
specified to madvise(2).

Since our malloc(3) makes heavy use of madvise(2), this change can have a
measureable impact.  For example, the system time for completing a parallel
"buildworld" on a 6-core amd64 machine was reduced by about 1.5% to 2.0%.

Note: This change only contains pmap_advise() implementations for a subset
of our supported architectures.  I will commit implementations for the
remaining architectures after further testing.  For now, a stub function is
sufficient because of the advisory nature of pmap_advise().

Discussed with: jeff, jhb, kib
Tested by:      pho (i386), marcel (ia64)
Sponsored by:   EMC / Isilon Storage Division
2013-08-29 15:49:05 +00:00
Luiz Otavio O Souza
973bf10594 Prevent the full restart cycle every time arge_start() is called. Only
(re)start the interface when it is down.  This change fix a race with
BOOTP where the response packet is lost because the interface is being
reset by a netmask change right after send the packet.

PR:		178318
Approved by:	adrian (mentor)
2013-08-29 12:48:12 +00:00
Luiz Otavio O Souza
b3cb2c4a93 Make ar71xx_spi attach the next free unit of spibus and not only spibus0.
Approved by:	adrian (mentor)
2013-08-28 14:46:15 +00:00
Luiz Otavio O Souza
2557c4beb1 Add the default hints to make the GPIO pins, rf led and reset switch work
out of the box on RouterStation.

PR:	177832
Submitted by:	Petko Bordjukov (bordjukov@gmail.com)
Approved by:	adrian (mentor)
2013-08-28 14:43:04 +00:00
Oleksandr Tymoshenko
feeabf2125 Fix GT PCI controller driver on big-endian hardware 2013-08-28 01:10:51 +00:00
Oleksandr Tymoshenko
e6353b0005 Fixes for compatibility with QEMU:
- Route PCI interrupt for NIC
- Make "no mapping" warning more user-friendly: add device name and mention
    that it's IRQ mapping
- Do not overlap ICUs' IO window with PCI devices' IO windows by starting
    IO rman at offset 0x100
2013-08-27 01:40:13 +00:00
Oleksandr Tymoshenko
c9735f9537 - Initialize freq variable so we will not end up with random value
if there is no YAMON present
2013-08-27 01:08:55 +00:00
Sean Bruno
de1eecea8c Some vendors store the mac addresses of arge(4) as a literal sring in the
form xx:xx:xx:xx:xx:xx complete with ":" characters taking of 18 bytes
instead of 6 integers.  Expose a "readascii" tuneable to handle this case.

Remove restriction on eepromac assignement for the first dev instance only.

Add eepromac address for DIR-825 to hints file.

Add readascii hint for DIR-825

Reviewed by:	adrian@
2013-08-23 13:14:18 +00:00
Konstantin Belousov
e68c64f0ba Revert r254501. Instead, reuse the type stability of the struct pmap
which is the part of struct vmspace, allocated from UMA_ZONE_NOFREE
zone.  Initialize the pmap lock in the vmspace zone init function, and
remove pmap lock initialization and destruction from pmap_pinit() and
pmap_release().

Suggested and reviewed by:	alc (previous version)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
2013-08-22 18:12:24 +00:00
Adrian Chadd
d52d5066e7 Add a missing break. 2013-08-12 00:38:47 +00:00
Attilio Rao
c7aebda8a1 The soft and hard busy mechanism rely on the vm object lock to work.
Unify the 2 concept into a real, minimal, sxlock where the shared
acquisition represent the soft busy and the exclusive acquisition
represent the hard busy.
The old VPO_WANTED mechanism becames the hard-path for this new lock
and it becomes per-page rather than per-object.
The vm_object lock becames an interlock for this functionality:
it can be held in both read or write mode.
However, if the vm_object lock is held in read mode while acquiring
or releasing the busy state, the thread owner cannot make any
assumption on the busy state unless it is also busying it.

Also:
- Add a new flag to directly shared busy pages while vm_page_alloc
  and vm_page_grab are being executed.  This will be very helpful
  once these functions happen under a read object lock.
- Move the swapping sleep into its own per-object flag

The KPI is heavilly changed this is why the version is bumped.
It is very likely that some VM ports users will need to change
their own code.

Sponsored by:	EMC / Isilon storage division
Discussed with:	alc
Reviewed by:	jeff, kib
Tested by:	gavin, bapt (older version)
Tested by:	pho, scottl
2013-08-09 11:11:11 +00:00
Jeff Roberson
5df87b21d3 Replace kernel virtual address space allocation with vmem. This provides
transparent layering and better fragmentation.

 - Normalize functions that allocate memory to use kmem_*
 - Those that allocate address space are named kva_*
 - Those that operate on maps are named kmap_*
 - Implement recursive allocation handling for kmem_arena in vmem.

Reviewed by:	alc
Tested by:	pho
Sponsored by:	EMC / Isilon Storage Division
2013-08-07 06:21:20 +00:00
David E. O'Brien
0e6a0799a9 Back out r253779 & r253786. 2013-07-31 17:21:18 +00:00
Sean Bruno
969eca8b4a Adjust magic numbers to allow attachment of ath(4) modules. 2013-07-31 16:27:56 +00:00
Sean Bruno
d439f5d933 device if_bridge gets me a bridge device 2013-07-31 16:26:34 +00:00
David E. O'Brien
99ff83da74 Decouple yarrow from random(4) device.
* Make Yarrow an optional kernel component -- enabled by "YARROW_RNG" option.
  The files sha2.c, hash.c, randomdev_soft.c and yarrow.c comprise yarrow.

* random(4) device doesn't really depend on rijndael-*.  Yarrow, however, does.

* Add random_adaptors.[ch] which is basically a store of random_adaptor's.
  random_adaptor is basically an adapter that plugs in to random(4).
  random_adaptor can only be plugged in to random(4) very early in bootup.
  Unplugging random_adaptor from random(4) is not supported, and is probably a
  bad idea anyway, due to potential loss of entropy pools.
  We currently have 3 random_adaptors:
  + yarrow
  + rdrand (ivy.c)
  + nehemeiah

* Remove platform dependent logic from probe.c, and move it into
  corresponding registration routines of each random_adaptor provider.
  probe.c doesn't do anything other than picking a specific random_adaptor
  from a list of registered ones.

* If the kernel doesn't have any random_adaptor adapters present then the
  creation of /dev/random is postponed until next random_adaptor is kldload'ed.

* Fix randomdev_soft.c to refer to its own random_adaptor, instead of a
  system wide one.

Submitted by: arthurmesh@gmail.com, obrien
Obtained from: Juniper Networks
Reviewed by: obrien
2013-07-29 20:26:27 +00:00
Andriy Gapon
a29cc9a34b Revert r253748,253749
This WIP should not have been committed yet.

Pointyhat to:	avg
2013-07-28 18:44:17 +00:00
Andriy Gapon
366d8bfb7b put contents of cpu.h under _KERNEL
no userland-serviceable parts inside

MFC after:	20 days
2013-07-28 18:32:27 +00:00
Warner Losh
2018efd098 This file isn't derived from anything delivered by Berkeley, so remove
this statement.
2013-07-22 03:55:15 +00:00
Adrian Chadd
f5937ee8e6 Add some initial board support for the AR934x and the Qualcomm Atheros
DB120 development board.

The AR934x SoCs are a MIPS74k based system with increased RAM addressing
space, some scratch-pad RAM, an improved gige switch PHY and 2x2 or 3x3
on-board dual-band wifi.

This support isn't complete by any stretch; it's just enough to bring
the board up for others to tinker with.  Notably, the MIPS74k support
is broken.  However it boots enough to echo some basic probe/attach
messages, before dying somewhere in the TLB code.

Thankyou to Qualcomm Atheros for their continued support of me doing
open source work with their hardware.

Tested:

* AR9344, mips74k
2013-07-21 04:00:48 +00:00
Adrian Chadd
ea5f837ece Implement some initial AR934x support routines.
This code reads the PLL configuration registers and correctly programs
things so the UART and such can come up.

There's MIPS74k platform issues that need fixing; but this at least brings
things up enough to echo stuff out the serial port and allow for interactive
debugging with ddb.

Tested:

* AR71xx SoCs
* AR933x SoC
* AR9344 board (DB120)

Obtained from:	Qualcomm Atheros; Linux/OpenWRT
2013-07-21 03:56:57 +00:00
Adrian Chadd
9cf72c2c22 Teach the GPIO code about the AR934x GPIO register and pin counts. 2013-07-21 03:55:18 +00:00
Adrian Chadd
ced43d8890 Use the UART frequency when programming the UART clock.
This allows the 16550 support to work correctly on the upcoming
AR934x support.
2013-07-21 03:54:39 +00:00
Adrian Chadd
6dbf63db67 Initialise the watchdog and UART frequencies.
For all pre-AR933x chips, the frequency is just the APB frequency.
For the AR933x, the UART frequency is different but we just hacked around
it.

For the AR934x, there's a different PLL setting for these, so they have
to be broken out.
2013-07-21 03:52:52 +00:00
Adrian Chadd
766c980a8b Add two new CPU specific definitions - the watchdog clock frequency and
the UART clock frequency.

The AR933x and AR934x have separate PLL settings for these.
2013-07-21 03:51:24 +00:00
Andrey V. Elsukov
dbd4437b06 Include sys/systm.h after sys/param.h.
Suggested by:	pluknet
2013-07-15 15:40:57 +00:00
Andrey V. Elsukov
05d1f5bce0 Introduce new structure sfstat for collecting sendfile's statistics
and remove corresponding fields from struct mbstat. Use PCPU counters
and SFSTAT_INC() macro for update these statistics.

Discussed with:	glebius
2013-07-15 06:16:57 +00:00
Warner Losh
5163701c22 Nearly a complete rewrite of elf.h.
Start with NetBSD's sys/arch/mips/include/elf_machdep.h 1.18. Remove the NetBSD
specific glue pieces (leaving mostly just relocation types).

Add in FreeBSD specific glue pieces from older versions of this file, and
move to the top of the file:
r237430 | kib | 2012-06-22 00:38:31 -0600 (Fri, 22 Jun 2012) | 5 lines
r232449 | jmallett | 2012-03-03 01:19:18 -0700 (Sat, 03 Mar 2012) | 18 lines
r217097 | kib | 2011-01-07 07:22:34 -0700 (Fri, 07 Jan 2011) | 3 lines
r211412 | kib | 2010-08-17 02:55:45 -0600 (Tue, 17 Aug 2010) | 7 lines
r202908 | gonzo | 2010-01-23 19:59:22 -0700 (Sat, 23 Jan 2010) | 4 lines
r195356 | imp | 2009-07-05 01:00:51 -0600 (Sun, 05 Jul 2009) | 6 lines
r195128 | gonzo | 2009-06-27 17:27:41 -0600 (Sat, 27 Jun 2009) | 4 lines
r197933 | kib | 2009-10-10 09:31:24 -0600 (Sat, 10 Oct 2009) | 9 lines
r189926 | kib | 2009-03-17 06:50:16 -0600 (Tue, 17 Mar 2009) | 9 lines
r186191 | imp | 2008-12-16 13:07:47 -0700 (Tue, 16 Dec 2008) | 7 lines
as closely as I can tell, the projects/mips branch merge was disruptive
to good history.

This should make merges easier in the future from NetBSD and vice versa.
2013-07-09 19:01:38 +00:00
Adrian Chadd
93286afa73 Import the initial SoC register definitions for the AR934x MIPS74k SoC.
Obtained from:	Linux/OpenWRT
2013-07-08 06:12:38 +00:00
Adrian Chadd
4178f27320 Add AR9341, AR9342, AR9344 SoC types. 2013-07-08 06:10:29 +00:00
Warner Losh
8d77cd5069 Remove all the NOPs after SYNC. They aren't needed.
They originated in the original Octeon port. They weren't present, as
far as I can tell, on the projects/mips branch until after this
point. They were in the original Octeon port in code picked up from
the vendor, who I've been able to find out trolling old email put them
there to get around an SMP problem that most likely was fixed in other
ways.

NetBSD and Linux don't have these, except for some specific uses of
SYNC on the alchemy parts (which we don't support, but even if we did
it is only a specific case and would be specifically coded
anyway). This is true of the current Linux code, as well as one old
version I polled.

I looked back at the old R12000, R8000, R6000, R4000, R4400 errata
that I have, and could find no mention of SYNC needing NOPs for
silicon bugs (although plenty of other cases where NOPs and other
contortions were needed).

An Google search turned up no old mailing list discussions on this on
Linux, NetBSD or FreeBSD (except the disussion that kicked off these
studies).

I've test booted this on my Octeon Plus eval board and survived a
buildworld. Adrian Chadd reports that this patch has no ill effects on
the Ahteros platforms he tested it on.

I conclude it is safe to just remove the NOPs. But added
__MIPS_PLATFORM_SYNC_NOPS as a failsafe in case we find some platform
where these are, in fact, required.

Reviewed by:	adrian@
2013-07-07 16:12:22 +00:00
Adrian Chadd
e243f3cef2 Oops - fix bad hint numbering for the ART section. 2013-07-04 08:42:20 +00:00
Adrian Chadd
eb12447d83 Add in a configuration file and hints for the Engenius ENH-200.
This is an AR7240 based device with an AR9285 on-board.

I've tested the initial boot and wifi support; however at the moment
the ethernet switch driver doesn't seem to be picking up carrier on the
active ethernet port. Basic flood pinging works however, so I think
we're on the right track.

Thank you to Adrian Woodley <adrian@diskworld.com.au> for purchasing me
one of these devices to bootstrap FreeBSD-HEAD on.
2013-07-04 08:13:14 +00:00
Adrian Chadd
eaa0f58f05 Add the missing link back to the EEPROM firmware name. 2013-07-04 08:09:54 +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
Adrian Chadd
0cfc028fcb Add the EEPROM start offset and size in so ath_ahb will use the
supplied EEPROM data.

This needs to die in a fire and replaced with the firmware API
to store the calibration data early ..
2013-06-26 05:03:47 +00:00
Adrian Chadd
5dbf20a630 Add in the vendor / device id so the ath_ahb glue works. 2013-06-26 05:02:47 +00:00
Adrian Chadd
46b620a1aa Add the wireless support to the AR933x base kernel, as the support
actually works now.
2013-06-26 05:02:30 +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
Jeff Roberson
17a2737732 - Add a BIT_FFS() macro and use it to replace cpusetffs_obj()
Discussed with:	attilio
Sponsored by:	EMC / Isilon Storage Division
2013-06-13 20:46:03 +00:00
Ed Schouten
f5c2e46822 Bring the stdatomic for MIPS code slightly more in sync with the ARM version. 2013-06-13 18:47:28 +00:00
Ed Schouten
2c482d3a72 Merge the 1 and 2 byte versions of the atomic functions into one.
After pushing in my fix for the 2 byte functions, I realized that the
functions for 1 and 2 byte operations had become identical. Reduce the
code size by merging the functions for 1 and 2 byte operations together.

While there, slightly improve variable naming and comments.
2013-06-08 23:45:11 +00:00
Adrian Chadd
82aa6e614b Add 8devices CARAMBOLA2 support.
This is based on the AR933x (Hornet) SoC from Qualcomm Atheros.

It's a much nicer board to do development on - 64MB RAM, 16MB flash.
The development board breaks out the GPIO pins, ethernet, serial (via
a USB<->RS232 chip), USB host and of course a small wifi antenna.

Everything but the wifi works thus far.
2013-06-08 20:21:17 +00:00
Ed Schouten
87dd390211 Actually make the 2-byte atomics work.
Even though I tested the 1-byte operations on arbitrarily aligned bytes,
it seems I did not do this for the 2-byte operations.

Create easy to read functions that are used to get/put bytes and
halfwords in words. To keep the compiler happy, explicitly read two
bytes into a union to obtain a 16-bit value.
2013-06-08 16:24:49 +00:00
Ed Schouten
2e5d5dc936 Add proper __sync_*() intrinsics for MIPS.
To make <stdatomic.h> work on MIPS (and ARM) using GCC, we need to
provide implementations of the __sync_*() functions. I already added
these functions for 4 and 8 byte types to libcompiler-rt some time ago,
based on top of <machine/atomic.h>.

Unfortunately, <machine/atomic.h> only provides a subset of the features
needed to implement <stdatomic.h>. This means that in some cases we had
to do compare-and-exchange calls in loops, where a simple ll/sc would
suffice.

Also implement these functions for 1 and 2 byte types. MIPS only
provides ll/sc instructions for 4 and 8 byte types, but this is of
course no limitation. We can simply load 4 bytes and use some bitmask
tricks to modify only the bytes affected.

Discussed on:	mips, arch
Tested with:	QEMU
2013-06-08 13:19:11 +00:00