Commit Graph

1596 Commits

Author SHA1 Message Date
Mark Johnston
be09cd5706 Fix some lingering build failures caused by fixing implicit inclusion of
if_var.h. Also explicitly include lock.h and mutex.h in if_kr.c rather than
depending on if_var.h to bring them in.
2013-10-31 05:00:50 +00:00
Mark Johnston
57170f49f2 Remove references to an unused fasttrap probe hook, and remove the
corresponding x86 trap type. Userland DTrace probes are currently handled
by the other fasttrap hooks (dtrace_pid_probe_ptr and
dtrace_return_probe_ptr).

Discussed with:	rpaulo
2013-10-31 02:35:00 +00:00
Mark Johnston
9f6f3311f4 Fix a typo introduced in r257338. 2013-10-31 02:27:16 +00:00
Andre Oppermann
a742d143c7 nclude missing net/if_var.h.
Due to header pollution it wasn't noticed before.
2013-10-30 16:56:46 +00:00
Nathan Whitehorn
a5c296c5c5 Panics about how things can't be attached should probably happen in the
attach method rather than probe.

Submitted by:	brooks
2013-10-29 20:38:58 +00:00
Nathan Whitehorn
5543a1b98e Devices that rely on hints or identify routines for discovery need to
return BUS_PROBE_NOWILDCARD from their probe routines to avoid claiming
wildcard devices on their parent bus. Do a sweep through the MIPS tree.

MFC after: 2 weeks
2013-10-29 14:07:31 +00:00
Gleb Smirnoff
66e01d73cd - Provide necessary includes.
- Remove unnecessary includes.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-29 11:17:49 +00:00
Gleb Smirnoff
104dc21415 - Provide necessary includes, that before came via if.h pollution.
- Remove unnecessary ones.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-28 22:26:03 +00:00
Konstantin Belousov
80938e75f0 Add bus_dmamap_load_ma() function to load map with the array of
vm_pages.  Provide trivial implementation which forwards the load to
_bus_dmamap_load_phys() page by page.  Right now all architectures use
bus_dmamap_load_ma_triv().

Tested by:	pho (as part of the functional patch)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
2013-10-27 21:39:16 +00:00
Adrian Chadd
dfd325ea2c Add a configuration file and hints file for the Alfa Networks Hornet UB
board.

This is another AR9331 board similar to the Carambola2. It has different
ethernet and LED wiring though.

They make a variety of boards that mostly differ on the amount of RAM/flash
available.  Alfa Networks graciously donated a handful of 64MB RAM/16MB flash
boards so I can finish off 802.11s support for the AR93xx chips and do up
a tech demonstration with it.

This is enough to bring up the board.

Tested:

* Alfa networks UB Hornet board - 64MB ram, 16MB flash version.

Thankyou to Alfa Networks for the development boards!

Sponsored by:	Alfa Networks (hardware only)
2013-10-25 04:06:54 +00:00
Brooks Davis
dd2f74a820 MFP4:
Change 221534 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/01/27 16:05:30

        FreeBSD/mips stores page-table entries in a near-identical format
        to MIPS TLB entries -- only it overrides certain "reserved" bits
        in the MIPS-defined EntryLo register to hold software-defined bits
        (swbits) to avoid significantly increasing the page table memory
        footprint.  On n32 and n64, these bits were (a) colliding with
        MIPS64r2 physical memory extensions and (b) being improperly
        cleared.

        Attempt to fix both of these problems by pushing swbits further
        along 64-bit EntryLo registers into the reserved space, and
        improving consistency between C-based and assembly-based clearing
        of swbits -- in particular, to use the same definition.  This
        should stop swbits from leaking into TLB entries -- while ignored
        by most current MIPS hardware, this would cause a problem with
        (much) larger physical memory sizes, and also leads to confusing
        hardware-level tracing as physical addresses contain unexpected
        (and inconsistent) higher bits.

        Discussed with: imp, jmallett

Change 1187301 by brooks@brooks_zenith on 2013/10/23 14:40:10
        Loop back the initial commit of 221534 to HEAD.  Correct its
        implementation for mips32.

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-23 21:35:39 +00:00
Brooks Davis
8a60ded44f BERI_SIM.hint is no longer used, remove it.
MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-23 15:24:05 +00:00
Brooks Davis
0e902f8a24 Revert r256934, it needs work to build on mips32. 2013-10-23 13:32:52 +00:00
Brooks Davis
341039a7d2 MFP4:
Change 221767 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/02/05 14:18:53

        When printing out information on a TLB MOD exception for a user
        process (e.g., an attempt to write to a read-only page), report
        it as a "write" in the console message, rather than "unknown".

Change 221768 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/02/05 14:28:00

        Fix post-compile but pre-commit typo in last changeset.

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 21:27:22 +00:00
Brooks Davis
f2de4d722e MFP4:
Change 231031 by brooks@brooks_zenith on 2013/07/11 16:22:08

        Turn the unused and uncompilable MIPS_DISABLE_L1_CACHE define in
        cache.c into an option and when set force I- and D-cache line
        sizes to 0 (the latter part might be better as a tunable).

        Fix some casts in an #if 0'd bit of code which attempts to
        disable L1 cache ops when the cache is coherent.

Sponsored by:	DARPA/AFRL
2013-10-22 21:16:57 +00:00
Brooks Davis
9baa380649 Remove a bit of debugging output that slipped into r256911.
MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 21:13:02 +00:00
Brooks Davis
f66834b69a MFP4:
Change 228019 by bz@bz_zenith on 2013/04/23 13:55:30

	Add kernel side support for large TLB on BERI/CHERI.
	Modelled similar to NLM

MFC after:	3 days
Sponsored by:	DAPRA/AFRL
2013-10-22 21:08:25 +00:00
Brooks Davis
cf193ef13e MFP4:
Change 221534 by rwatson@rwatson_zenith_cl_cam_ac_uk on 2013/01/27 16:05:30

        FreeBSD/mips stores page-table entries in a near-identical format
        to MIPS TLB entries -- only it overrides certain "reserved" bits
        in the MIPS-defined EntryLo register to hold software-defined bits
        (swbits) to avoid significantly increasing the page table memory
        footprint.  On n32 and n64, these bits were (a) colliding with
        MIPS64r2 physical memory extensions and (b) being improperly
        cleared.

        Attempt to fix both of these problems by pushing swbits further
        along 64-bit EntryLo registers into the reserved space, and
        improving consistency between C-based and assembly-based clearing
        of swbits -- in particular, to use the same definition.  This
        should stop swbits from leaking into TLB entries -- while ignored
        by most current MIPS hardware, this would cause a problem with
        (much) larger physical memory sizes, and also leads to confusing
        hardware-level tracing as physical addresses contain unexpected
        (and inconsistent) higher bits.

        Discussed with: imp, jmallett

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 21:06:27 +00:00
Brooks Davis
c40ecff1b2 Enable ATSE_CFI_HACK in BERI configs, stable MAC addresses are useful.
MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 20:50:41 +00:00
Brooks Davis
cb7de87666 Sync BERI kernel configs with P4:
Switch the majority of device configuration to FDT from hints.

Add BERI_*_BASE configs to reduce duplication in the MDROOT and SDROOT
kernels.

Add NFS and GSSAPI support by default.

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 15:45:31 +00:00
Brooks Davis
fdd228fcd6 MFP4: 223121 (PIC portion), 225861, 227822, 229692 (PIC only), 229693,
230523, 1123614

Implement a driver for Robert Norton's PIC as an FDT interrupt
controller. Devices whose interrupt-parent property points to a beripic
device will have their interrupt allocation, activation , and setup
operations routed through the IC rather than down the traditional bus
hierarchy.

This driver largely abstracts the underlying CPU away allowing the
PIC to be implemented on CPU's other than BERI. Due to insufficient
abstractions a small amount of MIPS specific code is currently required
in fdt_mips.c and to implement counters.

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-22 15:29:59 +00:00
Brooks Davis
a33ce322b6 Remove the isf(4) driver. It was created by accident and is subset of
the cfi(4) driver.  It remained in the tree longer than would be ideal
due to the time required to bring cfi(4) to feature parity.

Sponsored by:	DARPA/AFRL
MFC after:	3 days
2013-10-21 22:43:38 +00:00
Brooks Davis
f570e9e145 MFP4: 221483, 221567, 221568, 221670, 221677, 221678, 221800, 221801,
221804, 221805, 222004, 222006, 222055, 222820, 1135077, 1135118, 1136259

Add atse(4), a driver for the Altera Triple Speed Ethernet MegaCore.

The current driver support gigabit Ethernet speeds only and works with
the MegaCore only in the internal FIFO configuration in the soon to be
open sourced BERI CPU configuration.

Submitted by:	bz
MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-18 20:44:19 +00:00
Brooks Davis
224d11f577 MFP4:
Change 227630 by bz@bz_zenith on 2013/04/12 08:50:27

	Implement soft reset setting sr in sr and just in case loop
	endlessly afterwards.

MFC after:	3 days
Sponsored by:	DARPA/AFRL
2013-10-18 15:40:37 +00:00
Adrian Chadd
ae222aa987 Whilst here, document that this TX alignment requirement may acutally
not be required on later hardware.

It would allow for higher packet rates so yes, it would be nice
to disable it.
2013-10-16 19:53:50 +00:00
Adrian Chadd
c572da7f10 Allow the MDIO bus frequency to be selected.
The MDIO bus frequency is configured as a divisor off of the MDIO bus
reference clock.  For the AR9344 and later, the MDIO bus frequency can
be faster than normal (ie, up to 100MHz) and thus a static divisor may
not be very applicable.

So, for those boards that may require an actual frequency to be selected
regardless of what crazy stuff the vendor throws in uboot, one can now
set the MDIO bus frequency.  It uses the MDIO frequency and the target
frequency to choose a divisor that doesn't exceed the target frequency.

By default it will choose:

* DIV_28 on everything; except
* DIV_58 on the AR9344 to be conservative.

Whilst I'm here, add some comments about the defaults being not quite
right.  For the other internal switch devices (like the AR933x, AR724x)
the divisor can be higher - it's internal and the reference MDIO clock
is much lower than 100MHz.

The divisor tables and loop code is inspired from Linux/OpenWRT.  It's very
simple; I didn't feel that reimplementing it would yield a substantially
different solution.

Tested:

* AR9331 (mips24k)
* AR9344 (mips74k)

Obtained from:	Linux/OpenWRT
2013-10-16 19:36:50 +00:00
Adrian Chadd
564cc3654b Now that all of the on-chip switch and basic platform support is updated,
we can now add all the hardware bits for the DB120.

* arge0/argemdio0 is hooked up to an AR8327 switch - which there's currently
  no support for.  However, the bootloader on this board does set it up as
  a basic switch so we can at least _use_ it ourselves.

  So we should at least configure the arge0 side of things, including the GMAC
  register.

* .. the GMAC config peels off arge0 from the internal switch and exposes it
  as an RGMII to said AR8327.

* arge1/argemdio1 are hooked up to an internal 10/100 switch.  So, that also
  needs configuring.

* Add support for the NOR flash layout.

* Add support for the wifi (which works, with bugs, but it works.)

What's missing!

* No GPIO stuff yet!
* No sound (I2S) and no NAND flash support yet, sorry!
* The normal DB120 has an external AR95xx wifi chip on PCIe but with the
  actual calibration data in the NOR flash.  My DB120 has been modified
  to let me use the PCIe slot as a normal PCIe slot.  I'll add the "default"
  settings later when I have access to a non-modified one.
* Other stuff, like why the wifi unit gets upset and spits out stuck beacons
  and interrupt storms everywhere.  Sigh.

Tested:

* DB120 board - AR9344 (mips74k SoC) booting off of SPI flash into multi-user
  mode.
2013-10-16 04:22:26 +00:00
Adrian Chadd
f968a86f9d Yes, this board has 128mb of RAM. 2013-10-16 04:16:54 +00:00
Adrian Chadd
0348c9f480 Add in the platform specific quirks to get the AR934x SoC ethernet
up and running.

* The MAC FIFO configurations needed updating;
* Reset the MDIO block at the same time the MAC block is reset;
* The default divisor needs changing as the DB120 runs at a higher
  base MDIO bus clock compared to other chips.

The long-term fix is to allow the system to have a target MDIO bus
clock rate and then calculate the most suitable divider to meet
that.  This will likely need implementing before stable external
PHY or switch support can be committed.

Tested:

* AR9344 (mips74k)
* AR9331 (mips24k)
2013-10-16 03:11:18 +00:00
Adrian Chadd
ff7824ff52 Add in a write barrier after each if_arge write.
Without correct barriers, this code just plain doesn't work on the
mips74k cores (specifically the AR9344.)

In particular, the MDIO register accesses need this barriering or MII bus
access results in out-of-order garbage.

Tested:

* AR9344 (mips74k)
* AR9331 (mips24k)
2013-10-16 02:46:00 +00:00
Adrian Chadd
8c25111afe Add bus space barriers to the AR71xx SPI code.
This is required for correct, stable operation on the MIPS74k SoCs
that are dual-issue, superscalar pipelines.

Tested:

* AR9344 SoC (MIPS74k)
* AR9331 SoC (MIPS24k)
2013-10-16 02:10:35 +00:00
Warner Losh
0013199a74 Elminate NON_LEAF and use NESTED instead to unify our assembler
conventions.

Reviewed by:	jmallet@
2013-10-15 04:45:09 +00:00
Warner Losh
10eb94556e Replace NLEAF with LEAF_NOPROFILE to unify the conventions we use in
our assembler files.

Reviewed by:	jmallet@
2013-10-15 04:44:21 +00:00
Warner Losh
f7cad617a1 Replace uses of the ALEAF macro with XLEAF and remove ALEAF macro to
try to unify the conventions used in our assembler.

Reviewed by:	jmallet@
2013-10-15 04:43:31 +00:00
Warner Losh
22da86aaf3 Move DO_AST into pcb.h where it should have been all along. Move some
common macros for saving/restoring registers into pcb.h as well.
2013-10-15 04:36:34 +00:00
Warner Losh
9ab238ab88 Move DO_AST into pcb.h where it should have been all along. Move some
common macros for saving/restoring registers into pcb.h as well.

Reviewed by:	jmallet@
2013-10-15 04:32:06 +00:00
Adrian Chadd
b582e3ab93 Update the AR934x SoC support.
* Add the MDIO clock probe during clock initialisation;
* Update the ethernet PLL configuration function to use the correct
  values;
* Add a GMAC block configuration to pull the configuration out of hints;
* Add an ethernet switch reconfiguration method.

Tested:

* AR9344 SoC (DB120)

.. however, this has been tested with extra patches in my tree (to fix
the ethernet/MDIO support, SPI support, ethernet switch support)
and thus it isn't enough to bring the full board support up.
2013-10-15 03:28:32 +00:00
Adrian Chadd
07e5ae88f0 Update the AR933x SoC support to include a few new knobs:
* Initialise the MDIO clock to default to the reference clock;
* Add some code to allow the hints mechanism to allow setup of the GMAC
  config block.
* Document how the switch is wired up internally.

Tested:

* AR9331 SoC (Carambola 2)
2013-10-15 03:23:08 +00:00
Adrian Chadd
8c56b727e4 Fix the Atheros MIPS startup path a little.
* Print out the platform frequency the same as the other frequencies.
* Print out the MDIO frequency.
* Optionally do GMAC and ethernet switch setup if required.

Tested:

* AR9344
2013-10-15 01:37:00 +00:00
Adrian Chadd
2418402399 Add new features - an MDIO clock, WMAC reset, GMAC reset and ethernet
switch reset/initialise functions.

The AR934x and QC955x SoCs both have a configurable MDIO base clock.
The others have the MDIO clock use the same clock as the system
reference clock, whatever that may be.

Tested:

* AR9344 SoC

TODO:

* mips24k - AR933x would be fine for now, just to ensure that things
  are sane.
2013-10-15 01:35:48 +00:00
Adrian Chadd
1ba1edb39d Add the rest of the AR934x SoC reset register definitions.
Obtained from:	Linux/OpenWRT
2013-10-14 23:58:52 +00:00
Adrian Chadd
34141ebcda Add register definitions for the AR933x SoC GMAC (ie, ethernet MAC)
control block.

The GMAC configuration block allows for some configuration of how
the GMAC0 (ie, arge0) port is connected to the on-board switch
(if indeed there is one.)  It both can be pushed into the on-board
switch; it could also be torn out and exposed via an external
MII (and that operational mode is also controllable.)

Obtained from:	Linux/OpenWRT
2013-10-14 23:57:12 +00:00
Mark Murray
cc4d059c03 Merge from project branch. Uninteresting commits are trimmed.
Refactor of /dev/random device. Main points include:

* Userland seeding is no longer used. This auto-seeds at boot time
on PC/Desktop setups; this may need some tweeking and intelligence
from those folks setting up embedded boxes, but the work is believed
to be minimal.

* An entropy cache is written to /entropy (even during installation)
and the kernel uses this at next boot.

* An entropy file written to /boot/entropy can be loaded by loader(8)

* Hardware sources such as rdrand are fed into Yarrow, and are no
longer available raw.

------------------------------------------------------------------------
r256240 | des | 2013-10-09 21:14:16 +0100 (Wed, 09 Oct 2013) | 4 lines

Add a RANDOM_RWFILE option and hide the entropy cache code behind it.
Rename YARROW_RNG and FORTUNA_RNG to RANDOM_YARROW and RANDOM_FORTUNA.
Add the RANDOM_* options to LINT.

------------------------------------------------------------------------
r256239 | des | 2013-10-09 21:12:59 +0100 (Wed, 09 Oct 2013) | 2 lines

Define RANDOM_PURE_RNDTEST for rndtest(4).

------------------------------------------------------------------------
r256204 | des | 2013-10-09 18:51:38 +0100 (Wed, 09 Oct 2013) | 2 lines

staticize struct random_hardware_source

------------------------------------------------------------------------
r256203 | markm | 2013-10-09 18:50:36 +0100 (Wed, 09 Oct 2013) | 2 lines

Wrap some policy-rich code in 'if NOTYET' until we can thresh out
what it really needs to do.

------------------------------------------------------------------------
r256184 | des | 2013-10-09 10:13:12 +0100 (Wed, 09 Oct 2013) | 2 lines

Re-add /dev/urandom for compatibility purposes.

------------------------------------------------------------------------
r256182 | des | 2013-10-09 10:11:14 +0100 (Wed, 09 Oct 2013) | 3 lines

Add missing include guards and move the existing ones out of the
implementation namespace.

------------------------------------------------------------------------
r256168 | markm | 2013-10-08 23:14:07 +0100 (Tue, 08 Oct 2013) | 10 lines

Fix some just-noticed problems:

o Allow this to work with "nodevice random" by fixing where the
MALLOC pool is defined.

o Fix the explicit reseed code. This was correct as submitted, but
in the project branch doesn't need to set the "seeded" bit as this
is done correctly in the "unblock" function.

o Remove some debug ifdeffing.

o Adjust comments.

------------------------------------------------------------------------
r256159 | markm | 2013-10-08 19:48:11 +0100 (Tue, 08 Oct 2013) | 6 lines

Time to eat crow for me.

I replaced the sx_* locks that Arthur used with regular mutexes;
this turned out the be the wrong thing to do as the locks need to
be sleepable. Revert this folly.

# Submitted by:	Arthur Mesh <arthurmesh@gmail.com> (In original diff)

------------------------------------------------------------------------
r256138 | des | 2013-10-08 12:05:26 +0100 (Tue, 08 Oct 2013) | 10 lines

Add YARROW_RNG and FORTUNA_RNG to sys/conf/options.

Add a SYSINIT that forces a reseed during proc0 setup, which happens
fairly late in the boot process.

Add a RANDOM_DEBUG option which enables some debugging printf()s.

Add a new RANDOM_ATTACH entropy source which harvests entropy from the
get_cyclecount() delta across each call to a device attach method.

------------------------------------------------------------------------
r256135 | markm | 2013-10-08 07:54:52 +0100 (Tue, 08 Oct 2013) | 8 lines

Debugging. My attempt at EVENTHANDLER(multiuser) was a failure; use
EVENTHANDLER(mountroot) instead.

This means we can't count on /var being present, so something will
need to be done about harvesting /var/db/entropy/... .

Some policy now needs to be sorted out, and a pre-sync cache needs
to be written, but apart from that we are now ready to go.

Over to review.

------------------------------------------------------------------------
r256094 | markm | 2013-10-06 23:45:02 +0100 (Sun, 06 Oct 2013) | 8 lines

Snapshot.

Looking pretty good; this mostly works now. New code includes:

* Read cached entropy at startup, both from files and from loader(8)
preloaded entropy. Failures are soft, but announced. Untested.

* Use EVENTHANDLER to do above just before we go multiuser. Untested.

------------------------------------------------------------------------
r256088 | markm | 2013-10-06 14:01:42 +0100 (Sun, 06 Oct 2013) | 2 lines

Fix up the man page for random(4). This mainly removes no-longer-relevant
details about HW RNGs, reseeding explicitly and user-supplied
entropy.

------------------------------------------------------------------------
r256087 | markm | 2013-10-06 13:43:42 +0100 (Sun, 06 Oct 2013) | 6 lines

As userland writing to /dev/random is no more, remove the "better
than nothing" bootstrap mode.

Add SWI harvesting to the mix.

My box seeds Yarrow by itself in a few seconds! YMMV; more to follow.

------------------------------------------------------------------------
r256086 | markm | 2013-10-06 13:40:32 +0100 (Sun, 06 Oct 2013) | 11 lines

Debug run. This now works, except that the "live" sources haven't
been tested. With all sources turned on, this unlocks itself in
a couple of seconds! That is no my box, and there is no guarantee
that this will be the case everywhere.

* Cut debug prints.

* Use the same locks/mutexes all the way through.

* Be a tad more conservative about entropy estimates.

------------------------------------------------------------------------
r256084 | markm | 2013-10-06 13:35:29 +0100 (Sun, 06 Oct 2013) | 5 lines

Don't use the "real" assembler mnemonics; older compilers may not
understand them (like when building CURRENT on 9.x).

# Submitted by:	Konstantin Belousov <kostikbel@gmail.com>

------------------------------------------------------------------------
r256081 | markm | 2013-10-06 10:55:28 +0100 (Sun, 06 Oct 2013) | 12 lines

SNAPSHOT.

Simplify the malloc pools; We only need one for this device.

Simplify the harvest queue.

Marginally improve the entropy pool hashing, making it a bit faster
in the process.

Connect up the hardware "live" source harvesting. This is simplistic
for now, and will need to be made rate-adaptive.

All of the above passes a compile test but needs to be debugged.

------------------------------------------------------------------------
r256042 | markm | 2013-10-04 07:55:06 +0100 (Fri, 04 Oct 2013) | 25 lines

Snapshot. This passes the build test, but has not yet been finished or debugged.

Contains:

* Refactor the hardware RNG CPU instruction sources to feed into
the software mixer. This is unfinished. The actual harvesting needs
to be sorted out. Modified by me (see below).

* Remove 'frac' parameter from random_harvest(). This was never
used and adds extra code for no good reason.

* Remove device write entropy harvesting. This provided a weak
attack vector, was not very good at bootstrapping the device. To
follow will be a replacement explicit reseed knob.

* Separate out all the RANDOM_PURE sources into separate harvest
entities. This adds some secuity in the case where more than one
is present.

* Review all the code and fix anything obviously messy or inconsistent.
Address som review concerns while I'm here, like rename the pseudo-rng
to 'dummy'.

# Submitted by:	Arthur Mesh <arthurmesh@gmail.com> (the first item)

------------------------------------------------------------------------
r255319 | markm | 2013-09-06 18:51:52 +0100 (Fri, 06 Sep 2013) | 4 lines

Yarrow wants entropy estimations to be conservative; the usual idea
is that if you are certain you have N bits of entropy, you declare
N/2.

------------------------------------------------------------------------
r255075 | markm | 2013-08-30 18:47:53 +0100 (Fri, 30 Aug 2013) | 4 lines

Remove short-lived idea; thread to harvest (eg) RDRAND enropy into the
usual harvest queues. It was a nifty idea, but too heavyweight.

# Submitted by:	Arthur Mesh <arthurmesh@gmail.com>

------------------------------------------------------------------------
r255071 | markm | 2013-08-30 12:42:57 +0100 (Fri, 30 Aug 2013) | 4 lines

Separate out the Software RNG entropy harvesting queue and thread
into its own files.

# Submitted by:	 Arthur Mesh <arthurmesh@gmail.com>

------------------------------------------------------------------------
r254934 | markm | 2013-08-26 20:07:03 +0100 (Mon, 26 Aug 2013) | 2 lines

Remove the short-lived namei experiment.

------------------------------------------------------------------------
r254928 | markm | 2013-08-26 19:35:21 +0100 (Mon, 26 Aug 2013) | 2 lines

Snapshot; Do some running repairs on entropy harvesting. More needs
to follow.

------------------------------------------------------------------------
r254927 | markm | 2013-08-26 19:29:51 +0100 (Mon, 26 Aug 2013) | 15 lines

Snapshot of current work;

1) Clean up namespace; only use "Yarrow" where it is Yarrow-specific
or close enough to the Yarrow algorithm. For the rest use a neutral
name.

2) Tidy up headers; put private stuff in private places. More could
be done here.

3) Streamline the hashing/encryption; no need for a 256-bit counter;
128 bits will last for long enough.

There are bits of debug code lying around; these will be removed
at a later stage.

------------------------------------------------------------------------
r254784 | markm | 2013-08-24 14:54:56 +0100 (Sat, 24 Aug 2013) | 39 lines

1) example (partially humorous random_adaptor, that I call "EXAMPLE")
 * It's not meant to be used in a real system, it's there to show how
   the basics of how to create interfaces for random_adaptors. Perhaps
   it should belong in a manual page

2) Move probe.c's functionality in to random_adaptors.c
 * rename random_ident_hardware() to random_adaptor_choose()

3) Introduce a new way to choose (or select) random_adaptors via tunable
"rngs_want" It's a list of comma separated names of adaptors, ordered
by preferences. I.e.:
rngs_want="yarrow,rdrand"

Such setting would cause yarrow to be preferred to rdrand. If neither of
them are available (or registered), then system will default to
something reasonable (currently yarrow). If yarrow is not present, then
we fall back to the adaptor that's first on the list of registered
adaptors.

4) Introduce a way where RNGs can play a role of entropy source. This is
mostly useful for HW rngs.

The way I envision this is that every HW RNG will use this
functionality by default. Functionality to disable this is also present.
I have an example of how to use this in random_adaptor_example.c (see
modload event, and init function)

5) fix kern.random.adaptors from
kern.random.adaptors: yarrowpanicblock
to
kern.random.adaptors: yarrow,panic,block

6) add kern.random.active_adaptor to indicate currently selected
adaptor:
root@freebsd04:~ # sysctl kern.random.active_adaptor
kern.random.active_adaptor: yarrow

# Submitted by:	Arthur Mesh <arthurmesh@gmail.com>

Submitted by:	Dag-Erling Smørgrav <des@FreeBSD.org>, Arthur Mesh <arthurmesh@gmail.com>
Reviewed by:	des@FreeBSD.org
Approved by:	re (delphij)
Approved by:	secteam (des,delphij)
2013-10-12 12:57:57 +00:00
Adrian Chadd
d5cc57e6ab Add read/write bus barriers for MIPS.
Tested:

* AR9344 - mips74k SoC

Approved by:	re@ (delphij)
2013-10-09 22:10:03 +00:00
Mark Murray
a332c3c798 MFC - tracking commit 2013-10-09 07:55:21 +00:00
Adrian Chadd
490cbcd9cb Add some missing AR934x register definitions.
These are needed for ethernet bootstrap.

Approved by:	re@ (gjb)
2013-10-09 03:19:05 +00:00
Adrian Chadd
50c5514227 Fix interrupt handling from the APB periperals (ie, UART) - it
also requires an explicit acknowledgement.

Tested:

* AR9344 (DB120) SoC

Approved by:	re@ (gjb)
2013-10-09 02:01:20 +00:00
Adrian Chadd
83220b2e9f Mark AR934x based boards to be mips74k.
Reviewed by:	imp@
Approved by:	re@ (gjb)
2013-10-09 00:27:33 +00:00
Adrian Chadd
4cfbfdd4b3 Add "better" MIPS24k and MIPS74k barriers.
* the mips74k cores only need EHB (which is 'sll $0, $0, 3')
  here; NOPs don't actually work.

* add EHB as the last NOP for the default barriers/hazards;
  that is "better" behaviour and should work on a wider
  variety of processors.

This allows the existing (icky) TLB code to work, allowing
the AR9344 SoC (mips74k) to actually get through kernel startup.

Tested:

* AR9344 SoC - (mips74k)
* AR9331 SoC - (mips24k)

TODO:

* test on mips4k CPUs, just to be sure.

* document that sll $0, $0, 3 is actually "EHB" and that it
  falls back to being a NOP for pre-mips32r1.

* mips24k has an errata that we currently don't correctly explicitly
  state - ie, that after DERET/ERET, the only valid instruction is
  a NOP.

Reviewed by:	imp@
Approved by:	re@ (gjb)
2013-10-09 00:27:12 +00:00
Adrian Chadd
2e2f21556e Shuffle the includes around so they occur after opt_global.h is included;
this way the CPU ABI / core #define items are there.

Reviewed by:	imp@
Approved by:	re@ (gjb)
2013-10-09 00:22:21 +00:00