summaryrefslogtreecommitdiffstats
path: root/sys/arm
Commit message (Collapse)AuthorAgeFilesLines
* MFC 332891,332892: Fixes for atomic_*cmpset() on arm.jhb2018-05-162-31/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 332891: Fix some harmless type mismatches in the ARM atomic_cmpset implementations. The return value of atomic_cmpset() and atomic_fcmpset() is an int (which is really a bool) that has the values 0 or 1. Some of the inlines were using the type being operated on (e.g. uint32_t) as either the return type of the function, or the type of a local 'ret' variable used to hold the return value. Fix all of these to just use plain 'int'. Due to C promotion rules and the fact that the value can only be 0 or 1, these should all be harmless. 332892: Implement 32-bit atomic_fcmpset() in userland for armv4/v5. - Add an implementation of atomic_fcmpset_32() using RAS for armv4/v5. This fixes recent world breakage due to use of atomic_fcmpset() in userland. - While here, be more careful to not expose wrapper macros for 64-bit atomic_*cmpset to userland for armv4/v5 as only 32-bit cmpset is implemented. This has been reviewed, but not runtime-tested, but should fix the arm.arm and arm.armeb worlds that have been broken for a while. Approved by: re (kib)
* MFC r331906:gonzo2018-05-151-21/+0
| | | | | | | | | | | | | | | | | | | | Approved by: re (gjb) Fix accidental USB port resets by GPIO on Zynq/Zedboard boards The Zynq/Zedboard GPIO driver attempts to tri-state all GPIO pins on boot up but the order in which I reset the hardware can cause the pins to be briefly held low before being tri-stated. This is a problem on boards that use GPIO pins to reset devices. In particular, the Zybo and ZC-706 boards use a GPIO pin as a USB PHY reset. If U-boot enables the USB port before booting the kernel, the GPIO driver attach causes a glitch on the USB PHY reset and the USB port loses power. My fix is to have the GPIO driver leave the pins in whatever configuration U-boot placed them. PR: 225713 Submitted by: Thomas Skibo <thoma555-bsd@yahoo.com>
* MFC r328195:trasz2018-04-161-0/+3
| | | | | Add usb_template(4) to RPI-B kernel config. This is to support the USB OTG functionality on Raspberry Pi 0.
* MFC r329859,r329860: Float protection in standkevans2018-04-061-0/+2
| | | | | | | | | | | r329859: Do not include float interfaces when using libsa. We don't support float in the boot loaders, so don't include interfaces for float or double in systems headers. In addition, take the unusual step of spiking double and float to prevent any more accidental seepage. r329860: Floaty McFloatface is funnier...
* MFC r328201:mmel2018-04-048-54/+113
| | | | | | | | Convert extres/phy to kobj model. Similarly as other extres pseudo-drivers, implement phy by using kobj model. This detaches it from provider device, so single device driver can export multiple different phys. Additionally, this allows phy to be subclassed to more specialized drivers, like is USB OTG phy, or PCIe phy with hot-plug capability.
* MFC (cherry pick)r306197,r306327,r306328,r308390,r308391,r310600,r314703:mmel2018-04-0420-310/+8921
| | | | | | | | | | | | | | | | | | | | | cherry pick from r306197: Nvidia Tegra 124 and Jetson TK1 related DTS. r306327: Update AHCI driver to match new dts tree r306328: Update PCI driver to match new dts tree r308390: Rework NVIDIA Tegra124 XUSBPAD driver. - Adapt it for new, incompatible, DT bindings introduced by r306197. - Add support for USB super speed pads/ports. r308391: Add NVIDIA Tegra XHCI driver and coresponding firmware blob. r310600: Implement drivers for NVIDIA tegra124 display controller, HDMI source and host1x module. Unfortunately, tegra124 SoC doesn't have 2D acceleration engine and 3D requires not yet started nouveau driver. r314703: Add support for card detect and write protect gpio pins to Tegra SDHCI.
* MFC r328467:mmel2018-04-048-2/+243
| | | | Implement mitigation for Spectre version 2 attacks on ARMv7.
* MFC r309531,r309553,r309604:mmel2018-04-042-1/+7
| | | | | | | | | | | | r309531: Implement fake pmap_mapdev_attr() for ARMv6. This function is referenced, but never called from DRM2 code. Also, real behavior of pmap_mapdev_attr() in ARM world is unclear as we don't have any additional attribute for a device memory type. r309553: Fix build breakage caused by r309531. r309604: Fix the armv6 build after r309553.
* MFC r319896,r320054:mmel2018-04-045-9/+62
| | | | | | | | | | | r319896: Implement tunable CPU quirks. These quirks are intended for optimizing CPU performance, not for applying errata workarounds. Nobody can expect that CPU with unfixed errata is stable enough to execute the kernel until quirks are applied. r320054: Manually load tunable CPU quirks. These are needed too early, far before SYSINIT is processed.
* MFC r307943-r307944, r308698gonzo2018-04-033-15/+31
| | | | | | | | | | | | | | | | | | | | | | | | | r307943 by andrew: Remove the need for the delay to be zero when MULTIDELAY is undefined, it may be useful to only enable this in some configs. Sponsored by: ABT Systems Ltd r307944 by andrew: Add MULTIDELAY support to the am335x dmtimer. This will be useful for testing Cortex-A8 support in GENERIC. Sponsored by: ABT Systems Ltd r308698 by loos: After r308533, the platform compatible string must be an exact match. Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every DTS we support. This fixes the boot on TI SoCs after r308533. Suggested by: gonzo Sponsored by: Rubicon Communications, LLC (Netgate)
* MFC r330727 (without optional dts part):gonzo2018-04-031-85/+12
| | | | | | | | | | | | | | | | [rpi] remove IRQ support for BCM233x RNG Upstream DTBs don't provide IRQ lines for the RNG. Moreover, harvesting bytes as often as the RNG interrupt is triggered (87 times per sec) is an overkill. For these reasons, get rid of the interrupt mode and make callout mode the default, with random bits harvested every 4 seconds. Submitted by: Sylvain Garrigues <sylgar@gmail.com> Reviewed by: ian, imp, manu, mmel Approved by: emaste Differential Revision: https://reviews.freebsd.org/D14541
* MFC r314672, r315967, r324184, r325768gonzo2018-04-024-23/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r314672: [rpi] rpi3 should use the same cpufreq logic as rpi2, not rpi-b RPi3 cpufreq is more like that on RPi2. Setting arm frequency above min (say, "sysctl hw.cpufreq.arm_freq=600000001") turns on turbo mode, and the firmware automatically raises voltage, sets frequency to max 1200MHz, and throttle when overheat, etc. Swap if/else parts and use SOC_BCM2835 def so RPi3 can share the same cpufreq logic as RPi2, instead of falling to that for RPi. Submitted by: Jia-Shiun Li <jiashiun@gmail.com> Differential Revision: https://reviews.freebsd.org/D9640 r315967: [rpi] Use compatibility string from upstream DTB for I2C controller FreeBSD uses upstream DTB for RPi3 build and compatibility string for i2c device is different there. Add this new string to compatibility data. Reported by: Karl Denninger r324184 by ian: Allow Raspberry Pi platform and drivers to be configured with upstream DTBs. - Added more compatibility strings to drivers not yet converted - Added new RPI platform code compatibility string to match the ones used upstream - Adapted RPI and RPI2 DTS to match the new platform code compatibility string The goal is to use the upstream DTBs as a replacement for our custom one. This is now possible with these changes. Additionally, as the RPI firmware automatically chooses the right DTB for us, this would allow to have one common armv6 kernel for RPI0 and RPI1 (BCM2835-based), and one common armv7 kernel for RPI2 v1.1 (BCM2836-based), and RPI2 v1.2 / RPI3 (BCM2837-based). Submitted by: Sylvain Garrigues <sylgar@gmail.com> Differential Revision: https://reviews.freebsd.org/D12360 r325768 by manu: arm: rpi2: Fix cpufreq(4) Since r324184 the root node compatible for rpi2 is "brcm,bcm2836", add it to the compatible list of bcm2835_cpufreq. Tested On: RPI2 v1.1 RPI2 v1.2 Reported by: many on freebsd-arm@
* MFC r306436-r306437, r306489, r306491gonzo2018-04-027-15/+91
| | | | | | | | | | | | | | | | | | | | | | | | r306436 by manu: RPI-B: Add support for MULTIDELAY 100 cycles per us seems accurate enough, at least it's better than the 200 value that was used before. Reviewed by: andrew, imp Differential Revision: https://reviews.freebsd.org/D8062 r306437 by manu: RPI2: Add support for PLATFORM_SMP so we can later add it to GENERIC. Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D8063 r306489 by manu: bcm2835_cpufreq: Only attach driver if we correcly match on the machine compatible string. r306491 by manu: RPI2: Add support for MULTIDELAY, this is needed for inclusion into GENERIC.
* MFC r306263, r306268gonzo2018-04-0210-24/+51
| | | | | | | | | | | | r306263 by andrew: Move cpu_reset to be a platform method to allow multiple implementations. Reviewed by: mmel Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D8010 r306268 by andrew: Also implement platform_cpu_reset on bcm2836
* MFC r304488, r304623gonzo2018-04-021-4/+31
| | | | | | | | | | | | | | | | | | | | | r304488 by manu: Keep boot parameters in ARM trampoline code Currently boot parameters (r0 - r3) are forgotten in ARM trampoline code. This patch save them at startup and restore them before jumping into kernel _start() routine. This is usefull when booting with Linux ABI and/or custom bootloader. Submitted by: Grégory Soutadé <soutade@gmail.com> Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D7395 r304623 by manu: Fix building for ARM kernel that have FLASHADDR, PHYSADDR and LOADERRAMADDR defined. Pointy Hat: myself Reported by: bz
* MFC r305094, r305096-r305097gonzo2018-04-026-10/+14
| | | | | | | | | | | | | | | | r305094 by cognet: Garbage collect bits forgotten in r295267. r305096 by cognet: Some old arm ports don't load the kernel at the beginning of the memory, because the bootloader, ie redboot, won't let them do so, and so used the memory before the kernel for early memory allocation, such as pagetables, stacks, etc... Make a bit of an effort to try to get that memory mapped. r305097 by cognet: Nuke obio_bs_tag, it was used before it was initialized, and arm_base_bs_tag is the same, anyway.
* MFC r303035 by markm:gonzo2018-04-022-0/+535
| | | | | | | | | | | | | | | | | | | Random bit generator (RBG) driver for RPi and RPi2. Summary: This driver supports the following methods to trigger gathering random bits from the hardware: 1. interrupt when the FIFO is full (default) fed into the harvest queue 2. callout (when BCM2835_RNG_USE_CALLOUT is defined) every second if hz is less than 100, otherwise hz / 100, feeding the random bits into the harvest queue If the kernel is booted with verbose enabled, the contents of the registers will be dumped after the RBG is started during the attach routine. Author: hackagadget_gmail.com (Stephen J. Kiernan) Test Plan: Built RPI2 kernel and booted on board. Tested the different methods to feed the harvest queue (callout, interrupt) and the interrupt driven approach seems best. However, keeping the other method for people to be able to experiment with. Reviewed By: adrian, delphij, markm Differential Revision: https://reviews.freebsd.org/D6888
* MFC r302498 by andrew:gonzo2018-04-021-4/+2
| | | | | | Remove an unneeded call to fdt_get_unit, the return value is unused. Sponsored by: ABT Systems Ltd
* Revert r330897:eadler2018-03-29419-869/+31
| | | | | | | | | | | | | | | | | This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code. Revert with prejudice. This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes. Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes. Requested by: gjb (re)
* MFC r314568 (by emaste):dim2018-03-273-6/+3
| | | | | | | | | | | | | | | | | | | | kern_sig.c: ANSIfy and remove archaic register keyword Sponsored by: The FreeBSD Foundation MFC r318389 (by emaste): Remove register keyword from sys/ and ANSIfy prototypes A long long time ago the register keyword told the compiler to store the corresponding variable in a CPU register, but it is not relevant for any compiler used in the FreeBSD world today. ANSIfy related prototypes while here. Reviewed by: cem, jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D10193
* MFC r329989, r330044ian2018-03-253-3/+25
| | | | | | | | | | | | | | | | r329989: Add support for booting into kdb on arm platforms when the RB_KDB is set (using "boot -d" at the loader propmt or setting boot_ddb in loader.conf). Submitted by: Thomas Skibo <thomasskibo@yahoo.com> Differential Revision: https://reviews.freebsd.org/D14428 r330044: Add a hw.model sysctl oid for armv6/7 which reports the CPU model, similar to what other arches (all except riscv and armv4/5) do. Submitted by: Hyun Hwang <hyun@caffeinated.codes> Differential Revision: https://reviews.freebsd.org/D14465
* MFC r330050:ian2018-03-251-0/+2
| | | | | | | | Initialize all members of vm_page::md_page for armv4/5 systems. This fixes a hang in SI_SUB_KMEM sysinit, and is apparently required after r323290. Inspired by the commit message for r323676. Reported by: andreast@
* MFC r330437-r330438, r330440, r331045ian2018-03-252-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r330437: Do not stop the loop that configures gpio chipselect pins on the first error, just ignore pins that don't configure and keep setting up the ones that do. (But when bootverbose is on, whine about the errors.) r330438: Defer attaching the spibus until timers and interrupts are working. The driver requires interrupts to do transfers, and the drivers for the SPI devices on the bus quite reasonably expect to be able to do IO while probing and attaching. r330440: Switch imx_gpio to attach at BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE. Pretty much any other device might need to manipulate a gpio pin during its probe or attach routines, so these devices must be available as early as possible. The gpio device is an interrupt controller, but I didn't choose the INTERRUPT pass for that reason (it works fine as an interrupt controller as long as it attaches any time before interrupts are enabled). That just looked like the right place in the passes to ensure that it attaches before any type of device that might need gpio pin manipulations. r331045: Add required interface header. Reported by: andreast@
* MFC r310017, r310229, r312289, r327260, r329539, r329544-r329546, r329620,ian2018-03-2413-2/+647
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r329729, r329911, r329999 r310017: [spi] reformat message This commit corrects print of nomatch (newline was too early) Submitted by: Hiroki Mori <yamori813@yahoo.co.jp> Reviewed by: ray, loos, mizhka Differential Revision: https://reviews.freebsd.org/D8749 r310229: ofw_spi: Parse property for the SPI mode and CS polarity. As cs is stored in a uint32_t, use the last bit to store the active high flag as it's unlikely that we will have that much CS. Reviewed by: loos Differential Revision: https://reviews.freebsd.org/D8614 r312289: [spibus] small code refactoring Merge 3 sequential printf calls into one. Reported by: rpokala Reviewed by: rpokala, adrian Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D8795 r327260: SPDX: fix wrong license ID tag in dev/spibus. r329539: Provide public declarations for ofw_spibus_driver and ofw_spibus_devclass so other drivers can refer to them in DRIVER_MODULE() decls. r329544: Add modules/spi as a gathering point for SPI-related modules, analagous to modules/i2c for i2c/iicbus modules. Build spibus as a module. r329545: Add ofw_bus_if.h to SRCS. r329546: Build at45d and mx25l SPI flash drivers as modules. r329620: Add missing MODULE_DEPENDS(). r329729: Remove some files that snuck in via cut and paste. Having these compiled into the module causes the kobj method descriptors to be resolved incorrectly (by the compile-time linker instead of the kernel linker), which then leads to hours of frustrating debugging. r329911: Add a functional detach() routine, to make things kldunload-friendly. r329999: Add a SPI driver for imx5 and imx6. It can be compiled into the kernel with "device imx_spi" or loaded as a module, which is also named "imx_spi".
* MFC r329642:ian2018-03-241-108/+108
| | | | | Adjust whitespace of things added in the past couple years to match the original style of the file. No functional changes.
* MFC r329479-r329480, r329483, r329506-r329507, r329526, r329529, r329536,ian2018-03-244-5/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r329541, r329730, r329841, r329988, r330397 r329479: Do not try to deallocate memory that wasn't allocated (you'd think that would be safe, but the function also tries to destroy mutexes that never got created). I guess this can only happen when imx_ehci_detach() is called on the error-exit path from imx_ehci_attach(), and that path never got exercised before today. r329480: Don't call sdhci_cleanup_slot() if sdhci_init_slot() never got called. Also, do callout_init() very early in attach, so that callout_drain() can be called in detach without worrying about whether it ever got init'd. r329483: Fix fallout from the import of fresh dts source files from linux 4.15. It appears that node names no longer include leading zeroes in the @address qualifiers, so we have to search for the nodes involved in interrupt fixup using both flavors of name to be compatible with old and new .dtb files. (You know you're in a bad place when you're applying a workaround to code that exists only as a workaround for another problem.) r329506: Add a detach method so that this can be a kldunload-friendly module. r329507: Build modules specific to imx5/imx6 only when building those kernels. This adds sys/modules/imx with a SUBDIR makefile to make the whole collection of modules that are specific to these SoCs. Initially, that "whole collection" consists of the if_ffec and imx_i2c drivers. The if_ffec driver is referenced in its existing home in ../ffec rather than moving it into the imx directory, because it's used by powerpc too, but it is no longer built for all armv6/7 systems. The imx_i2c driver is newly added as a module. r329526: Allow i2c hardware drivers to declare their own relationships to ofw_iicbus rather than relying on a set of canned EARLY_DRIVER_MODULE() statements in the ofw_iicbus source. This means hw drivers will no longer be required to use one of a few predefined driver names. They will also now be able to decide themselves if they want to use DRIVER_MODULE or EARLY_DRIVER_MODULE and to set which pass to attach on for early modules. Mainly, this adds extern declarations for the driver and devclass variables. It also renames ofwiicbus_devclass to ofw_iicbus_devclass to be consistant with the way we use ofw_ prefixes on this stuff. r329529: Give the imx_i2c driver its own name, set up its relationship to ofw_iicbus. Previously it called itself 'iichb' to link up with the EARLY_DRIVER_MODULE declaration in ofw_iicbus.c. r329536: Add the MODULE_DEPEND()s needed so that the kernel linker can resolve all the symbols at load time when iicbus is not compiled into the kernel. r329541: Build ofw_iicbus as a module if OPT_FDT is defined. r329730: Add required header files. Reported by: andreast@ r329841: Add a missing line continuation. How many commits does it take to get a simple module makefile working? Apparently at least three. Pointy hat to: ian r329988: Instead of building ofw_iicbus as a separate module, just compile it in to the iicbus module for FDT-based systems. The primary motivation for this is that host controller drivers which declare DRIVER_MODULE(ofw_iicbus, thisdriver, etc, etc) now only need a single MODULE_DEPEND(thisdriver, ofw_iicbus) for runtime linking to resolve all the symbols. With ofw_iicbus and iicbus in separate modules, drivers would need to declare a MODULE_DEPEND() on both, because symbol lookup is non-recursive through the dependency chain. Requiring a driver to have MODULE_DEPENDS() on both amounts to requiring the drivers to understand the kobj inheritence details of how ofw_iicbus is implemented, which seems like something they shouldn't have to know (and could even change some day). Also, this is somewhat analogous to how the drivers get built when compiled into the kernel. You don't have to ask for ofw_iicbus separately, it just gets built in along with iicbus when option FDT is in effect. r330397: Fix a paste-o: use the IICBUS version constants, not IICBB bitbang driver's.
* MFC r328345, r328349, r328405, r328407, r328442ian2018-03-244-65/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r328345: Reformat indentation to match other imx5/6 register definition headers, and tweak some comments. No functional changes. r328349: Make the trivial imx_soc_family() function an inline in imx_machdep.h. The imx_machdep.c file is on the fast path to non-existance and this would be the only thing left in it after some watchdog changes are completed. r328405: Minor cleanups... Move DRIVER_MODULE() and other boilerplate stuff to the bottom of the file, where it is in most imx5/6 drivers. Switch from an RD2 macro using bus_space_read_2() to an inline function using bus_read_2(); likewise for WR2. Use RESOURCE_SPEC_END to end the resource_spec list. Net effect should be no functional changes. r328407: Fix return style in RD2. Remove bogus return value from a void function in WR2 (I have no idea why that didn't result in a compile error). r328442: Add support to the imx5/6 watchdog for the external reset signal. Also, if the "power down" watchdog used by the ROM boot code is still active when the regular watchdog is activated, turn off the power-down watchdog. This adds support for the "fsl,ext-reset-output" FDT property. When present, that property indicates that a chip reset is accomplished by asserting the WDOG1_B external signal, which is supposed to trigger some external component such as a PMIC to ready the hardware for reset (for example, adjusting voltages from idle to full-power levels), and assert the POR signal to SoC when ready. To guard against misconfiguation leading to a non-rebootable system, the external reset signal is backstopped by code that asserts a normal internal chip reset if nothing responds to the external reset signal within one second.
* MFC r324186:ian2018-03-243-6/+1
| | | | | | | | | Define a single instance of ahci_devclass and reference it from all the attachment code for various SOCs and busses. Remove all the static and should-have-been-static and named-differently instances of it. This should eliminate the recently-grown build warnings about multiple definitions when building arm kernels.
* MFC r316370-r316371gonzo2018-03-237-67/+296
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r316370: [versatilepb] Convert VERSATILEPB kernel to INTRNG and switch to upstream DTB Scope of this change is somewhat larger than just converting to INTRNG. The reason for this is that INTRNG support required switching from custom to upstream DTS because custom DTS didn't have interrup routing information. This switch caused rewrite of PCI and CLCD drivers and adding SCM module. List of changes in this commit: - Enable INTRNG and switch to versatile-pb.dts - Add SCM driver that controls various peripheral devices like LCD or PCI controller. Previously registers required for power-up and configuring peripherals were part of their respective nodes. Upstream DTS has dedicated node for SCM - Convert PL190 driver to INTRNG - Convert Versatile SIC (secondary interrupt controller) to INTRNG - Refactor CLCD driver to use SCM API to power up and configuration - Refactor PCI driver to use SCM API to enable controller - Refactor PCI driver to use interrupt map provided in DTS for interrupt routing. As a result it fixes broken IRQ routing and it's no longer required to run QEMU with "-global versatile_pci.broken-irq-mapping=1" command-line arguments r316371: [versatilepb] Fix keyboard driver after switching to upstream DTS FreeBSD's DTS contained only one PL050 node and driver considered it to be PS/2 keyboard. In reality PL050 is a PS/2 port that pushes bytes to/from the periphers connected to it. New DTS contains two nodes and QEMU emulates keyboard connected to port #0 and mouse connected to port #1. Since there is no way to say what's connected to port by checking DTS we hardcode this knowledge in the driver: it assumes keyboard on port #0 and ignores port #1 altogether. Also QEMU defaults emulated keyboard to scan code set 2 while driver used to work with scan code set 1 so when initializing driver make sure keyboard is switched to scan code set 1
* MFC r327184:eadler2018-03-195-5/+5
| | | | Change the remaining files using my personnal email address to my freebsd one
* MFC r317055,r317056 (glebius): Include sys/vmmeter.h as includedkevans2018-03-155-0/+5
| | | | | | | r317055: All these files need sys/vmmeter.h, but now they got it implicitly included via sys/pcpu.h. r317056: Typo!
* Partial merge of the SPDX changeseadler2018-03-14427-117/+1269
| | | | | | | These changes are incomplete but are making it difficult to determine what other changes can/should be merged. No objections from: pfg
* MFC r325410:gonzo2018-02-201-3/+9
| | | | | | | | | | | | | | | | | | Increase TX_MAX_SEGS from 10 to 20 for the if_awg.c driver Under certain traffic pattern awg driver does not recover from TX queue full condition. The actual source of the problem is not identified yet but jmcneill@ agreed that bumping TX_MAX_SEGS to 20 is OK as a workaround for the problem (NetBSD has it set to 128). Also add some diagnostic printfs to prevent silent failure of bus_dma functions in the future PR will be kept open until root cause of the issue is identified and fixed PR: 219927 Submitted by: Tom Vijlbrief <tvijlbrief@gmail.com> Approved by: jmcneill
* MFC r320387:gonzo2018-02-141-2/+2
| | | | | | | [arm] Use correct index value when checking range validity Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D9145
* MFC r325321:skra2018-02-141-41/+75
| | | | | | | | Take into account race conditions in case of accessed or modified bit emulation in fast path of data/prefetch abort common routine. Process these bits only if related page table entries are consistent with provided abort info. In case of inconsistency, do nothing and let processor to signal new abort if still needed.
* MFC Loader Fixes 2017q4p6: r324649,r324650,r324651,r324652,r324653,r324654,kevans2018-02-111-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r324700,r324702,r324709,r324717,r324719,r324841,r324842,r324843,r324845, r324850,r324876,r324877,r324878,r324879,r324880,r324881,r324883,r324980, r324981,r324982,r324995,r325014,r325093,r325094,r325114,r325170,r325171, r325172,r325173,r325174,r325175,r325176,r325248,r325286,r325310,r325332, r325338,r325339,r325376,r325377,r325379,r325380,r325382,r325478,r325479, r325480,r325482,r325483,r325484,r325485,r325556,r325641,r325681,r325685, r325686,r325687,r325688,r325689,r325690,r325691,r325692,r325693,r325694, r325743,r325744,r325748,r325775,r325779,r325780 r324649: Move common/Makefile.inc to sys/boot/loader.mk. r324650: tweak style r324651: create defs.mk for common definitions r324652: Move all the ficl common code into ficl.mk r324653: LOADER_foo_SUPPORTED r324654: Explicitly inlcude SYSDIR in the include path r324700: loader: initialize dv_cleanup in md.c to eliminate clang warning r324702: We need to include disk.o in libuboot.a when we're building with support for disk access. r324709: Revert "Unify boot1 with loader" change r324646 r324717: libsa/ip.c: misplaced comment, ip_v is half char, not ip_p r324719: libsa/ip: stop read loop on bad fragments r324841: Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot. r324842: Introduce BOOTOBJ: The top level object directory for the boot tree r324843: Stopgap fix to the mistmatch between LOADER_GELI_SUPPORT and LOADER_NO_GELI_SUPPORT. r324845: Use BOOTOBJ and BOOTDIR to find geli includes and libraries. r324850: Define LIBSA32 to LIBSA on i386 to fix build. r324876: Move fdt and uboot defines into common uboot.mk. r324877: End source directories with SRC rather than a hodgepodge of names r324878: Make at91 boot loader compile again. r324879: Prefer SRCTOP paths for bits we're grabbing from libc. r324880: Use BOOTSRC here. r324881: Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys. r324883: Use preferred defined paths, rather than relative paths in fdt. r324980: Use BOOTDIR consistently. r324981: Move BINDIR definition to defs.mk, and override where it isn't /boot r324982: Remove sys/boot/arm/at91 and ixp425 r324995: loader.efi: Make framebuffer commands available for arm64 r325014: Add a 'place holder' arm struct efi_fb until a real one comes r325093: Define new EFI variables r325094: Cleanup non-arch Makefiles r325114: Use defs.mk defins in most MD code r325170: Use defs.mk values for userboot r325171: Use defs.mk name and prefer bsd.init.mk r325172: Remove the -nostdlib stuff I added. Instead, fix LDFLAGS to be honored correctly with the new Makefile.inc include order. r325173: We don't need to build a special ficl for userboot. r325174: Minor cleanup r325175: For amd64, compile both zfs and zfs32 libraries. r325176: Actually add zfs32/Makefile r325248: loader ptblread() is broken with >512B sectors r325286: efipart_strategy is using wrong offset with >512B sectors r325310: zfs.c:vdev_read() needs to be careful about large sectors r325332: loader: re-enable gzip support for x86 r325338: loader: fix BOOTSRC -> BOOTOBJ in a library path r325339: This used to have bzip2 support too. r325376: WIP: centralize machine links r325377: mostly libsa r325379: Revert "mostly libsa" r325380: Revert "WIP: centralize machine links" r325382: Cleanup stray libstand names to be libsa names. r325478: Powerpc is a 32-bit boot loader. r325479: Define LIBFICL32 to be libficl.a on i386 and libficl32.a on amd64. r325480: Use DO32 for all the places that we need to flag we're building a 32-bit version of a library. r325482: Move machine and other link creation to defs.mk r325483: MACHINE can never be powerpc64, so cleanup code that thinks it can. r325484: Prefer bsd.init.mk to src.opts.mk r325485: Centralize all 32-bit builds on 64-bit platform stuff. r325556: loader: set options before including bsd.init.mk r325641: loader.efi: efi_devpath_is_prefix should return bool r325681: boot1: avoid using NULL device path r325685: libsa32 isn't needed for i386. It's already a 32-bit platform. r325686: Simplify this if to a direct assignment. r325687: Remove all the empty help files from the powerpc build. r325688: FDT support doesn't make sense for ps3, remove it. r325689: Remove LOADER_FDT_SUPPORT as a Makefile variable. r325690: Remove LOADER_ZFS_SUPPORT as a Makefile variable r325691: Remove useless PNP define here. r325692: Replace LOADER_FIREWIRE_SUPPORT variable r325693: Move LOADER_{NO,}_GELI_SUPPORT to MK_LOADER_GELI r325694: Install the 4th files in sys/boot/forth instead of each loader r325743: Make sure the proper loader.rc gets installed. r325744: boot1: also check for NULL device r325748: Use proper include file. r325775: Add loader.conf to the list of files that are MD. r325779: Add /boot/dts to the list of default modules. r325780: Don't add /boot/dt*s* but /boot/dt*b*. Stupid think-o.
* MFC r324821:mmel2018-02-071-2/+2
| | | | Fix spelling.
* MFC r325438:mmel2018-02-072-6/+6
| | | | | All CP15 registers are bit fields or counters, don't use signed type when accessing them.
* MFC r316648:pkelsey2018-01-252-3/+3
| | | | | | | | | | | | | Corrected misspelled versions of rendezvous. The MFC maintains smp_no_rendevous_barrier() as a symbol alias of smp_no_rendezvous_barrier(). __FreeBSD_version bumped to indicate presence of the new name smp_no_rendezvous_barrier(). Reviewed by: gnn, jhb (email), kib Differential Revision: https://reviews.freebsd.org/D10313
* MFC r327222:ian2018-01-072-3/+17
| | | | | | | | | | | Add a new ARM kernel option, LOCORE_MAP_MB, to control the size of the kernel VA mapping in the temporary page tables set up by locore-v6.S. The number used to be hard-coded to 64MB, which is still the default if the kernel option is not specified. However, 64MB is insufficient for using a large mdroot filesystem. The hard-coded number can't be safely increased because too large a number may run into memory-mapped IO space on some SoCs that must not be mapped as ordinary memory.
* MFC r327367:ian2018-01-0723-50/+18
| | | | | | | | | | | | | | | | | Make kernel option KERNVIRTADDR optional, remove it from std.<platform> files that can use the default value. It used to be required that the low-order bits of KERNVIRTADDR matched the low-order bits of the physical load address for all arm platforms. That hasn't been a requirement for armv6 platforms since FreeBSD 10. There is no longer any relationship between load addr and KERNVIRTADDR except that both must be aligned to a 2 MiB boundary. This change makes the default KERNVIRTADDR value 0xc0000000, and removes the options from all the platforms that can use the default value. The default is now defined in vmparam.h, and that file is now included in a few new places that reference KERNVIRTADDR, since it may not come in via the forced-include of opt_global.h on the compile command line.
* MFC r327048-r327050ian2018-01-062-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | r327048: Restore the ability to use EARLY_PRINTF support during most of initarm(). The real kernel page tables are set up much earlier in initarm() now than they were when early printf support was first added, and they end up undoing the mapping made in locore.S for early printf support. This re-adds the mapping after switching to the new/real kernel page tables, making early printf work again right after switching to them. r327049: Allow pmap_kremove() to remove 1MB section mappings as well as 4K pages. This will allow it to undo temporary device mappings such as those made with pmap_preboot_map_attr(). Reviewed by: cognet r327050: If a temporary mapping is made to support EARLY_PRINTF, undo that mapping after cninit() runs, otherwise we leave a bogus device-memory mapping in userspace VA in the kernel pmap forever. Pointed out by: cognet
* MFC r326924-r326925ian2018-01-061-3/+3
| | | | | | | | | | | | | r326924: Fix debugging output, fallout from something like s/read/readctl/g while renaming variables in a previous change. r326925: Do not attempt to refill the TX fifo if there is no data left to transfer. A comment in bcm_bsc_fill_tx_fifo() even lists sc_totlen > 0 as a precondition for calling the routine. I apparently forgot to make the code do what my comment said.
* Fix imx6 hdmi init after r323553.ian2018-01-061-16/+44
| | | | | | | | | | | | | | | | | | | | | | | | This is a direct commit to 11-stable because major architectural changes in 12 prevent a direct MFC of the affected code. Conceptually, this is... MFC r324416: Fix imx6 hdmi init after r323553, which used a config_intrhook to defer the attachment of i2c devices needed by hdmi. The hdmi init also uses an intrhook callback to defer initialization, and if the hdmi callback runs first, the i2c devices will not yet have registered their device_t in association with their FDT phandle, which allows cross- device references on FDT systems. Now the hdmi deferred init checks for the i2c device registration, and if it's not complete yet, it registers as an eventhandler watching for newbus attach events. When the i2c device eventually attaches, the hdmi driver unregisters from watching further events, and continues with the hdmi init. Because the function signatures for an intrhook callback and an event handler callback are the same, a single function is used for both callbacks. Reported by: Russell Haley <russ.haley@gmail.com>
* MFC r324185:ian2018-01-052-51/+511
| | | | | | | | | | | | | | | | | | | | | Enhance the interrupt capabilities of ti_pruss driver. The existing ti_pruss driver for the PRUSS Hardware provided by the AM335x ARM CPU has basic interrupt capabilities. This updated driver provides some more options: - Sysctl based configuration for the interrupts (for some examples, see the test plan in the phabricator review cited below). - A device file (/dev/pruss0.irqN) for each enabled interrupt. This file can be read and the device blocks if no irq has happened or returns an uint64_t timestamp based on nanouptime(). - Each interrupt device file provides kqueue-based event notification, blocking read(), or select(). Submitted by: Manuel Stuhn <freebsdnewbie@freenet.de> Differential Revision: https://reviews.freebsd.org/D11959
* MFC r324169:ian2018-01-053-58/+306
| | | | | | | | | | | | | | | | | | | | | | Work around bcm283x silicon bugs to make i2c repeat-start work for the most common case where it's needed -- a write followed by a read to the same slave. The i2c controller in this chip only performs complete transfers, it does not provide control over start/repeat-start/stop operations on the bus. Thus, we have gotten a full stop/start sequence rather than a repeat-start when doing a typical i2c slave access of "write address, read data". Some i2c slave devices require a repeat-start to work correctly. These changes cause the controller to do a repeat-start by pre-staging the read parameters in the controller registers immediate after the controller has latched the values for the initial write operation, but before any bytes are actually written. With the values pre-staged, when the write portion of the transfer completes, the state machine in the silicon sees a new start operation already staged and that causes it to perform a repeat-start. The key to tricking the buggy hardware into doing this is to avoid prefilling any output data in the transmit FIFO so that it is possible to catch the silicon in the state where transmit values are latched but the transmit isn't completed yet.
* MFC r326971, r327047 (by ian), r327053 (by marius), r327074, r327097:kib2017-12-261-27/+2
| | | | Add atomic_load(9) and atomic_store(9) operations.
* MFC r326228 and r326229:ed2017-12-101-2/+2
| | | | | | | | Use TO_PTR() to convert integers to pointers. For FreeBSD/arm64's cloudabi32 support, I'm going to need a TO_PTR() in this place. Also use it for all of the other source files, so that the difference remains as minimal as possible.
* MFC r326137:andrew2017-11-281-10/+14
| | | | | | | | | | | | Ensure we check the program state set in the trap frame on arm and arm64. This value may be set by userspace so we need to check it before using it. If this is not done correctly on exception return the kernel may continue in kernel mode with all registers set to a userspace controlled value. Fix this by moving the check into set_mcontext, and also add the missing sanitisation from the arm64 set_regs. Discussed with: security-officer@ Sponsored by: DARPA, AFRL
* MFC 323584: Add a NT_ARM_VFP ELF core note to hold VFP registers for each ↵jhb2017-11-151-2/+15
| | | | | | | | thread. The core note matches the format and layout of NT_ARM_VFP on Linux. Debuggers use the AT_HWCAP flags to determine how many VFP registers are actually used and their format.
OpenPOWER on IntegriCloud