Commit Graph

195469 Commits

Author SHA1 Message Date
ian
057c745287 MFC r257738, r259202, r258410, r260288, r260292, r260294, r260320, r260323,
r260326, r260327, r260331, r260333, r260340, r260371, r260372, r260373,
    r260374, r260375

  Add common bus_space tag definition shared for most supported ARMv6/v7 SoCs.
  Correct license statements to reflect the fact that these files were all
  derived from sys/arm/mv/bus_space.c.

  In pmap_unmapdev(), remember the size, and use that as an argument to
  kva_free(), or we'd end up always passing it a size of 0

  In pmap_mapdev(), first check whether a static mapping exists,

  Convert TI static device mapping to use the new arm_devmap_add_entry(),

  Use the common armv6 fdt_bus_tag defintion for tegra instead of a local copy.

  Eliminate use of fdt_immr_addr(), it's not needed for tegra

  Convert lpc from using fdt_immr style to arm_devmap_add_entry() to make
  static device mappings.

  Retire machine/fdt.h as a header used by MI code, as its function is now
  obsolete. This involves the following pieces:
  - Remove it entirely on PowerPC, where it is not used by MD code either
  - Remove all references to machine/fdt.h in non-architecture-specific code
    (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
    non-arch-specific).
  - Fix code relying on header pollution from machine/fdt.h includes
  - Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
    requests to its parent (nexus). This allows x86 FDT devices to allocate
    both memory and IO requests and removes the last notionally MI use of
    fdtbus_bs_tag.
  - On those architectures that retain a machine/fdt.h, unused bits like
    FDT_MAP_IRQ and FDT_INTR_MAX have been removed.

  Add #include <machine/fdt.h> to a few files that used to get it via pollution

  Enable the mv cesa security/crypto device by providing the required property
  in the dts source, and adding the right devices to the kernel config.

  Remove dev/fdt/fdt_pci.c, which was code specific to Marvell ARM SoCs,
  related to setting up static device mappings.  Since it was only used by
  arm/mv/mv_pci.c, it's now just static functions within that file, plus
  one public function that gets called only from arm/mv/mv_machdep.c.

  Switch RPi to using arm_devmap_add_entry() to set up static device mapping.

  Allow 'no static device mappings' to potentially work.

  Don't try to find a static mapping before calling pmap_mapdev(), that logic
  is now part of pmap_mapdev() and doesn't need to be duplicated here.

 Switch a10 to using arm_devmap_add_entry() to set up static device mapping.
2014-05-14 19:18:58 +00:00
ian
21fbbde459 MFC r260281, r260282, r260283, r260285
Implement OFW_BUS_MAP_INTR() in terms of the FDT PIC table

  Reimplement fdt_intr_to_rl() in terms of OFW_BUS_MAP_INTR() and
  OFW_BUS_CONFIG_INTR().

  Use bus_space_map() rather than pmap_mapdev() in nexus_activate_resource(),
  when running on FDT systems.  Unmap memory in nexus_deactivate_resource().

  Remove fdt_pic_table code from MIPS, PowerPC, and x86, as it is no longer
  used by anything.
2014-05-14 18:54:34 +00:00
ian
9e6ff9cd8c MFC r260161, r260163, r260165, r260166, r260189
Add polarity and level support to ARM GIC

  Do not attach to PCI bridges in AHCI driver

  Use only mapped BIOs on ARM

  Fix race condition in DELAY for SP804 timer.
2014-05-14 18:25:13 +00:00
ian
0fce07b314 MFC r260092, r260093, r260121, r260180,
Allow AT91_MCI_ALLOW_OVERCLOCK to be an option in kernel config files.

  Set the SoC name for the atmelbus name.

  Add support for Samsung K9F2G08U0A (256MiB SLC) NAND

  Comment updates.
2014-05-14 18:16:32 +00:00
ian
835175f3b8 MFC r260118
Delete echoed doesn't rub out the previous character, so always
  use <backspace> <space> <backspace> instead. This fixes hitting
  DELETE instead of BACKSPACE at mountroot> prompt.
2014-05-14 17:43:49 +00:00
ian
3c96028205 MFC r258359, r258742, r258845, r259936, r259640
Apply access flags for managed and unmanaged pages properly on ARMv6/v7

  Set the PGA_WRITEABLE flag when the protections indicate write access, not
  just when the current access is a write.

  Enable missing Access Flag for secondary cores on ARMv6/v7

  Add identification and necessary type checks for Krait CPU cores.
2014-05-14 17:40:18 +00:00
ian
4ee6f0bd3b MFC r256707, r256708, r257291, r258358
Switch to use WBWA mappings for page tables on armv6, this is needed for SMP.
  Fix PTE_SYNC() for PIPT L2 caches, using the virtual address wasn't so useful.
  Use PTE_SYNC() for >= armv6
  Spell cpu_l2cache_wb_range correctly.

  Fix condition that determines PMAP_NEEDS_PTE_SYNC value for ARM

  Use values of the correct defines to determine statement's result.
  ARM_ARCH_ symbols are always defined, hence only values are relevant.

  Avoid clearing EXEC permission bit when setting the page RW on ARMv6/v7

  When emulating modified bit the executable attribute was cleared by
  mistake when calling pmap_set_prot().
2014-05-14 17:01:35 +00:00
ian
13afdc288f MFC r257170, r257171, r257172, r257240, r257278, r257279, r257280, r257281,
r257282, r257332

  Wait for DesignWare UART transfers completion before accessing line control

  Enable UART busy detection handling for Armada XP - based board

  Enable SATA interface on Armada XP
  Run mvs SATA driver on Armada XP instead of old mv_sata

  Retire arm_remap_nocache() and the data and constants associated with it.

  Remove hard-coded mappings related to Armada XP support

  Fix-up DTB for Armada XP registers' base according to the actual settings

  Change Armada XP kernel load address to the u-boot's end address

  Remove not working and deprecated PJ4Bv6 support

  Switch off explicit broadcasting of the TLB flush operations for PJ4B CPU

  Add missing ARMv6 CPU functions to ARM Makefile
2014-05-14 16:32:27 +00:00
marius
bb1ce472d7 MFC: r265535
- Sprinkle const and static as appropriate.
- Fix whitespace bugs.
- Remove pointless returns in void functions.
- Nuke pointless switch cases mirroring the default.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-05-14 16:18:08 +00:00
marius
10d4c26464 MFC: r256561
Prevent an unlikely, but real double free issue in gvinum(8).

Coverity ID: 1018965
2014-05-14 16:16:23 +00:00
bdrewery
21b23c5efb MFC r265072:
Remove redundant include
2014-05-14 15:35:01 +00:00
bdrewery
b53c2b05cd MFC r264499:
Make g_access() KASSERT() more useful.
2014-05-14 15:30:49 +00:00
bdrewery
8cf68bdc10 MFC r264918:
Fix spelling error.
2014-05-14 15:24:25 +00:00
bdrewery
cfa08852ae MFC r264465:
Prefer /etc/login.conf for some of these environment values.
2014-05-14 15:23:06 +00:00
bdrewery
c8a6d26c3c MFC r264795:
Fix grammar error and trailing newline.
2014-05-14 15:21:27 +00:00
bdrewery
729b1e09fe MFC r264385:
Use proper MFSNAMELEN for fs type.
2014-05-14 15:16:02 +00:00
ian
8d9f58e42d MFC r259517, r259518
Add vt support for RPi. (No early stage yet.)
2014-05-14 14:37:27 +00:00
ian
1baea4807a MFC r258800, r258802, r258805, r258806, r258807, r258851, r258857,
r259199, r259484, r259513, r259514, r259516

  The kernel stack guard pages are only below the stack pointer, not above.

  Remove unnecessary double-setting of the thread's onfault state in
  copyinstr().

  Open Firmware mandates that certain cross-references, in particular those
  in /chosen, be ihandles. The ePAPR spec makes those cross-reference phandles,
  since FDT has no concept of ihandles. Have the OF FDT CI module interpret
  queries about ihandles as cross-reference phandles.

  Real OF systems have an ihandle under /chosen/stdout, not a phandle. Use
  the right type.

  Rearchitect platform memory map parsing to make it less
  Open Firmware-centric.

  Remove fdtbus_bs_tag definition, which is now obsolete. The remainder of
  this file is also slated for future demolition.

  Return the correct IEEE 1275 code for "nextprop".

  Use the common Open Firmware PCI interrupt routing code instead of the
  duplicate version in dev/fdt.

  Configure interrupt sense based on device tree information.

  Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf
  internally instead of requiring the caller to allocate it.
2014-05-14 14:17:51 +00:00
ian
796f2c87ad MFC r258268, r258271, r258272, r258274, r258275, r258427, r258694, r258696,
r258697, r258757

  Do not assume a value for #address-cells when parsing the OF translations
  map. This allows the kernel to get farther with OpenBIOS on 64-bit CPUs.

  Actually look up #address-cells instead of assuming it is correlated with
  the Uninorth version number.

  #interrupt-cells belongs to the iparent, not the device parent.

  Add a sysctl to allow disabling resetting the OF syscons.

  For PCI<->PCI bridges, #address-cells may be 3.

  Make RTAS calls, which call setfault() to recover from machine checks,
  preserve any existing fault buffer.

  badaddr() is used only in the grackle PCI driver, so move its definition
  there. Clean up a spurious setfault() declaration as well.

  This [phyp_console] driver doesn't need the /options node, so don't check
  for it.

  Use the Open Firmware-based CPU frequency determination as a generic
  fallback if we can't measure CPU frequency. This is also useful on a
  variety of embedded systems using FDT.
2014-05-14 14:08:45 +00:00
brueffer
deadfc3726 MFC: r265362
Mention the axge(4) driver in the hardware notes.
2014-05-14 13:54:07 +00:00
marius
3e683c8bb7 MFC: r265454
- Allow foot shooting with the resetconfig command via the -f option.
- Fix typos preventing -f to actually work with the create command.
- Initialize flags to zero rather than using stack garbage when handling
  the grow command.

Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-05-14 13:47:50 +00:00
smh
77d524f93b MFC r265149
Make uninteresting PCI devices with no attached drivers only print out
on a verbose boot.

Sponsored by:	Multiplay
2014-05-14 09:12:01 +00:00
ian
4a602a8957 MFC r258259, r258798, r259010
Unify handling of illegal instruction faults between AIM and Book-E.

  Make uart_cpu_powerpc work on both FDT and OFW systems.

  Fix debug printfs in FPU_EMU to compile on powerpc64 and enable it for
  powerpc64.
2014-05-14 04:57:55 +00:00
ian
9277bb1a2b MFC r258247, r258250, r258257
Remove a pointless #ifdef AIM. This is just PPC64 specific, including
  64-bit Book-E.

  Make single precision floating point arithmetic actually work

  Split the function of the PCB_FPU flags into two: PCB_FPU now indicates that
  the actual FPU is enabled, while PCB_FPREGS indicates that the FPU state
  structure in the PCB is valid.
2014-05-14 04:42:38 +00:00
ian
d168d59495 MFC r257995, r258244, r258246,
Rename the "bare" platform "mpc85xx"
 Also turn "bare" into a truly bare platform

 Move CCSR discovery into the platform module

 There is no reason Book-E needs to save XER and CTR on context switches.
2014-05-14 04:14:58 +00:00
ian
f7cf17218e MFC r258002, r258024, r258027, r258051, r258052, r258243, r258244, r258002,
r258024, r258027, r258051, r258052, r258243,

  Follow up r223485, which made AIM use the ABI thread pointer instead of
  PCPU fields for curthread, by doing the same to Book-E.

  Use the same implementation of copyinout.c for both AIM and Book-E.

  Actually add IOMMU domain to the list of known mappings.

  Following the approach with ACPI DMAR on x86, split IOMMU handling into
  a variant PCI bus instead of trying to shoehorn it into the PCI host bridge
  adapter.

  Make sure that TLB1 mappings are aligned correctly.
2014-05-14 03:09:37 +00:00
ian
14106897a1 MFC r257702, r257745, r257746, r257747, r257751, r257791, r257793,
r257794, r257795, r257992

  Teach nexus(4) about Open Firmware (e.g. FDT) on ARM and MIPS, retiring
  fdtbus in most cases.

  Make OF_nextprop() work correctly for FDT by using the libfdt
  fdt_next_property_offset() API.

  Do not panic if pmap_mincore() is called.

  An addendum: it is possible, though of questionable utility, for a node
  to have no properties at all.
  Add definition for the Atheros 8021 gigabit PHY.

  Consolidate Apple firmware hacks and improve them by switching on the
  presence of mac-io devices in the tree, which uniquely identifies Apple
  hardware.

  Allow OF_decode_addr() to also be able to map resources on big-endian
  devices.

  Make tsec work with the device tree present on the RB800.

  Be more flexible about which compatible strings to accept.  This brings up
  the PCI Express bus on the RB800 using the firmware device tree.

  Rename the "bare" platform "mpc85xx", which is what it actually is, and
  add actual platform probing based on PVR.
2014-05-14 01:53:20 +00:00
ian
ae2bbb5100 MFC r257334, r257336, r257337, r257338, r257341, r257342, r257343, r257370,
r257368, r257416

  Hints-only devices should return BUS_PROBE_NOWILDCARD from their probe
  methods.
2014-05-14 01:35:43 +00:00
ian
147aa314a7 MFC r257180, r257195, r257196, r257198, r257209, r257295
Add some extra sanity checking and checks to printf format specifiers.

 Try even harder to find a console before giving up.

 Make devices with registers into the KVA region work reliably.

 Turn on VM_KMEM_SIZE_SCALE on 32-bit as well as 64-bit PowerPC.

 Return NOKEY instead of 0 if there are no more key presses queued.
2014-05-14 01:16:05 +00:00
ian
2963fd0dfb MFC r257161, r257169, r257178, r257190, r257191
Add pmap_mapdev_attr() and pmap_kenter_attr() interfaces.

 Fix concurrency issues with TLB1 updates and make pmap_kextract() search
 TLB1 mappings as well

  Interrelated improvements to early boot mappings:
  - Remove explicit requirement that the SOC registers be found except as an
    optimization (although the MPC85XX LAW drivers still require they be found
    externally, which should change).
  - Remove magic CCSRBAR_VA value.
  - Allow bus_machdep.c's early-boot code to handle non 1:1 mappings and
    systems not in real-mode or global 1:1 maps in early boot.
  - Allow pmap_mapdev() on Book-E to reissue previous addresses if the
    area is already mapped. Additionally have it check all mappings, not
    just the CCSR area.

 Add some extra sanity checking and checks to printf format specifiers.

 Bump initial TLB size. The kernel is not necessarily less than 16 MB

 Handle (in a slightly ugly way) ePAPR-type loaders that just place a
 device tree into r3.
2014-05-14 00:51:26 +00:00
delphij
065f33ceea Fix OpenSSL NULL pointer deference vulnerability.
Obtained from:	OpenBSD
Security:	FreeBSD-SA-14:09.openssl
Security:	CVE-2014-0198
2014-05-13 23:19:16 +00:00
gjb
8921815288 Document r265922, mrsas(4) merge.
Sponsored by:	The FreeBSD Foundation
2014-05-13 22:43:02 +00:00
edwin
361ea06a9b MFC of tzdata2014c
- Egypt will go into DST in 15 May 2014
2014-05-13 22:35:06 +00:00
ian
8bff46167d MFC r257162, r257175
The old trap.h (then trap_aim.h) actually had trap ID codes for Book-E CPUs.
  Use it universally. Book-E traps may also need revisiting due to the
  introduction of fixed-offset traps and the deprecation of IVORs in POWER
  ISA 2.06, but that's very much an issue for another day.
2014-05-13 19:12:53 +00:00
ian
7d01a916d9 MFC r257111, r257144, r257157, r257183
Test UARTs physical address instead of virtual.

  Be a bit more flexible in how we find the console from the properties on
  /chosen, following the list of allowed console properties in ePAPR. Also
  do not require that stdin be defined and equal to stdout: stdin is
  nonstandard (for ePAPR) and console in an unexpected place is after all
  better than no console.
2014-05-13 19:09:00 +00:00
ian
7efcec8976 MFC r257115, r257116, r257117
Remove dead and duplicated code.
2014-05-13 18:24:02 +00:00
ian
df87ef4409 MFC r257114, r257118
Use common OFW root code to set up fdtbus. This is an almost purely
  negative diff that should improve reliability somewhat. There should be
  no differences in behavior -- please report any that crop up. This has been
  tested on ARM and PPC systems.

  Make sure to get the right node when looking up #interrupt-cells.
2014-05-13 18:14:31 +00:00
ian
0c0ccc18b5 MFC r257093:
Be a little more suspicious of thermal sensors, which can have single
  crazy readings occasionally. One wild reading should not be enough to
  trigger a shutdown, so instead wait for several concerning readings in
  a row.
2014-05-13 18:08:15 +00:00
ian
399f183366 MFC r256994, r257016, r257055, r257059, r257060, r257075
Add two new interfaces to ofw_bus:
  - ofw_bus_map_intr()
    Maps an (iparent, IRQ) tuple to a system-global interrupt number in some
    platform dependent way. This is meant to be implemented as a replacement
    for [FDT_]MAP_IRQ() that is an MI interface that knows about the bus
    hierarchy.
  - ofw_bus_config_intr()
    Configures an interrupt (previously mapped) based on firmware sense flags.
    This replaces manual interpretation of the sense field in bus drivers and
    will, in a follow-up, allow that interpretation to be redirected to the PIC
    drivers where it belongs. This will eventually replace the tables in
    /sys/dev/fdt/fdt_ARCH.c

  The PowerPC/AIM code has been converted to use these globally, with an
  implementation in terms of MAP_IRQ() and powerpc_config_intr(), assuming
  OpenPIC, at the bus root in nexus(4). The ofw_bus_config_intr() will shortly
  be integrated into pic_if.m and bounced through nexus into the PIC tree.

  Factor out MI portions of the PowerPC nexus device into /sys/dev/ofw. The
  sparc64 driver will be modified to use this shortly.

  Allow PIC drivers to translate firmware sense codes for themselves. This
  is designed to replace the tables in dev/fdt/fdt_ARCH.c, but will not
  happen quite yet.

  Do not map IRQs twice. This fixes PowerPC/FDT systems with multiple PICs,
  which would try to treat the previously-mapped interrupts from
  fdt_decode_intr() as interrupt line numbers on the same parent PIC.

  Remove some of the code required for supporting ssm(4) on SPARC in favor
  of a more PowerPC/FDT-focused design. Whenever SPARC64 is integrated
  into this rework, this should be (trivially) revisited.
2014-05-13 18:06:26 +00:00
ian
41e4178a5b MFC r256973, r256974
If the device tree directly contains the timebase frequency, use it. This
 property is required by ePAPR, but maintain the fallback to bus-frequency
 for compatibility.  Allow 32 or 64 bits.
2014-05-13 18:00:41 +00:00
ian
4c1631c2b1 MFC r256932, r256938, r256966, r256953, r256967, r256969, r257015:
Add a new function (OF_getencprop()) that undoes the transformation applied
  by encode-int. Specifically, it takes a set of 32-bit cell values and
  changes them to host byte order. Most non-string instances of OF_getprop()
  should be using this function, which is a no-op on big-endian platforms.

  Use the new function all over the place.
2014-05-13 17:59:17 +00:00
ian
7353aa0b49 MFC r256901, r256914 (by nwhitehorn):
Catch up on 6 years of improvements in Open Firmware nexus devices by
  importing the sparc64 one. At least 90% of this code is MI and will be
  moved into /sys/dev/ofw at some point in the future.

  Ignore registers on devices where the reg property is malformed. Issue a
  warning if this happens under bootverbose. This prevents some
  strange-looking entries in dmesg for SMU devices on Apple G5 systems.
2014-05-13 17:18:48 +00:00
ian
42a63a26cf MFC r256870, r256898, r256899, r256900 (by nwhitehorn):
Standards-conformance and code deduplication:
  - Use bus reference phandles in place of FDT offsets as IRQ domain keys
  - Unify the identical macio/fdt/mambo OpenPIC drivers into one
  - Be more forgiving (following ePAPR) about what we need from the device
    tree to identify an OpenPIC
  - Correctly map all IRQs into an interrupt domain
  - Set IRQ_*_CONFORM for interrupts on an unknown PIC type instead of
    failing attachment for that device.

  Allow lots of interrupts (useful on multi-domain platforms) and do not
  set device_quiet() on all devices attached under nexus(4).
2014-05-13 17:12:07 +00:00
ian
3d20d204d8 MFC r256814, r256816, r256818, r256846, r256855, r256864 (by nwhitehorn):
- Handle 2GB of ram
 - Allow the OFW interrupt mapping code to work with PCI devices not
   enumerated by Open Firmware, as in the case of FDT.
 - Provide an interface for PCI bus drivers that need some of ofw_pci's
   metadata during attach.
 - Use standard ofw_bus helpers instead of reinventing the wheel.
 - Make hard-wired TLB allocations be at minimum one page.
2014-05-13 16:59:50 +00:00
ian
788d947f59 MFC r256798: Return BUS_PROBE_NOWILDCARD from fdtbus_probe. 2014-05-13 16:52:21 +00:00
ian
a7a560a760 MFC r256792, r256793, r256799 (by nwhitehorn): Unify AIM and booke code. 2014-05-13 16:50:10 +00:00
kevlo
9a6f8ee2e6 MFC r264216, r265817, r265822:
Add man page for udplite(4).
2014-05-13 06:09:01 +00:00
kevlo
69da76e9e5 MFC r264212,r264213,r264248,r265776,r265811,r265909:
- Add support for UDP-Lite protocol (RFC 3828) to IPv4 and IPv6 stacks.
  Tested with vlc and a test suite [1].
  [1] http://www.erg.abdn.ac.uk/~gerrit/udp-lite/files/udplite_linux.tar.gz

  Reviewed by:	jhb, glebius, adrian

- Fix a logic bug which prevented the sending of UDP packet with 0 checksum.

- Disable TX checksum offload for UDP-Lite completely. It wasn't used for
  partial checksum coverage, but even for full checksum coverage it doesn't
  work.
2014-05-13 06:05:53 +00:00
alc
ab793415d0 MFC r265418
Prior to r254304, a separate function, vm_pageout_page_stats(), was used
  to periodically update the reference status of the active pages.  This
  function was called, instead of vm_pageout_scan(), when memory was not
  scarce.  The objective was to provide up to date reference status for
  active pages in case memory did become scarce and active pages needed to
  be deactivated.

  The active page queue scan performed by vm_pageout_page_stats() was
  virtually identical to that performed by vm_pageout_scan(), and so r254304
  eliminated vm_pageout_page_stats().  Instead, vm_pageout_scan() is
  called with the parameter "pass" set to zero.  The intention was that when
  pass is zero, vm_pageout_scan() would only scan the active queue.
  However, the variable page_shortage can still be greater than zero when
  memory is not scarce and vm_pageout_scan() is called with pass equal to
  zero.  Consequently, the inactive queue may be scanned and dirty pages
  laundered even though that was not intended by r254304.  This revision
  fixes that.
2014-05-13 05:26:43 +00:00
alc
498371bb43 MFC r260567
Correctly update the count of stuck pages, "addl_page_shortage", in
  vm_pageout_scan().  There were missing increments in two less common
  cases.

  Don't conflate the count of stuck pages and the pageout deficit provided
  by vm_page_alloc{,_contig}().

  Handle held pages consistently in the inactive queue scan.  In the more
  common case, we did not move the page to the tail of the queue.  Whereas,
  in the less common case, we did.  There's no particular reason to move
  the page in the less common case, so remove it.

  Perform the calculation of the page shortage for the active queue scan a
  little earlier, before the active queue lock is acquired.  The correctness
  of this calculation doesn't depend on the active queue lock being held.

  Eliminate a redundant variable, "pcount".  Use the more descriptive
  variable, "maxscan", in its place.

  Apply a few nearby style fixes, e.g., eliminate stray whitespace and
  excess parentheses.
2014-05-13 05:21:54 +00:00