summaryrefslogtreecommitdiffstats
path: root/sys/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* Remove GENERIC-NODEBUG kernel configurations, missed duringgjb2016-07-141-38/+0
| | | | | | | | | the stable/11 branch. This is a direct commit to stable/11. Approved by: re (kib) Sponsored by: The FreeBSD Foundation
* Turn off WITNESS, INVARIANTS, etc., in the powerpc GENERIC64gjb2016-07-101-8/+0
| | | | | | | | kernel configuration, missed after the stable/11 branch. Approved by: re (kib) PR: 210974 Sponsored by: The FreeBSD Foundation
* - Remove debugging from GENERIC* kernel configurationsgjb2016-07-081-8/+0
| | | | | | | | | - Enable MALLOC_PRODUCTION - Default dumpdev=NO - Remove UPDATING entry regarding debugging features Approved by: re (implicit) Sponsored by: The FreeBSD Foundation
* Replace a number of conflations of mp_ncpus and mp_maxid with eithernwhitehorn2016-07-062-7/+3
| | | | | | | | | | | | | | | | | | | mp_maxid or CPU_FOREACH() as appropriate. This fixes a number of places in the kernel that assumed CPU IDs are dense in [0, mp_ncpus) and would try, for example, to run tasks on CPUs that did not exist or to allocate too few buffers on systems with sparse CPU IDs in which there are holes in the range and mp_maxid > mp_ncpus. Such circumstances generally occur on systems with SMT, but on which SMT is disabled. This patch restores system operation at least on POWER8 systems configured in this way. There are a number of other places in the kernel with potential problems in these situations, but where sparse CPU IDs are not currently known to occur, mostly in the ARM machine-dependent code. These will be fixed in a follow-up commit after the stable/11 branch. PR: kern/210106 Reviewed by: jhb Approved by: re (glebius)
* Remove SoC-specific integrations from dTSEC, to make it SoC agnostic.jhibbits2016-07-057-43/+3
| | | | | | This will allow a single kernel to run on all SoCs supported by the dTSEC driver. Approved by: re@(gjb)
* Unbreak the LBC driver, broken with the large RMan and 36-bit physical ↵jhibbits2016-07-051-21/+32
| | | | | | | | | | address changes. Remove the use of fdt_data_to_res(), and instead construct the resources manually. Additionally, avoid the 32-bit size limitation of fdt_data_get(), by building physical addresses manually from the lbc ranges property. Approved by: re@(gjb)
* Fix fat-fingering: #if AIM should have been #ifdef AIM to avoid failures onnwhitehorn2016-06-291-1/+1
| | | | | | | Book-E kernels. Approved by: re (gjb) Pointy hat to: nwhitehorn
* Do not rely on firmware having pre-enabled the MMU in a reasonable way fornwhitehorn2016-06-292-1/+13
| | | | | | | | late boot: enable it explicitly after installing the page tables. If booting from an FDT, also make sure to escape the firmware's MMU context early before overwriting firmware page tables. Approved by: re (gjb)
* Enter 64-bit mode as early as possible in the 64-bit PowerPC boot sequence.nwhitehorn2016-06-262-11/+8
| | | | | | | | | | | | | Most of the effect of setting MSR[SF] is that the CPU will stop ignoring the high 32 bits of registers containing addresses in load/store instructions. As such, the kernel was setting it only when it began to need access to high memory. MSR[SF] also affects the operation of some conditional instructions, however, and so setting it at late times could subtly break code at very early times. This fixes use of the FDT mode in loader, and FDT boot more generally, on 64-bit PowerPC systems. Hardware provided by: IBM LTC Approved by: re (kib)
* Update comments for the MD functions managing contexts for newkib2016-06-162-4/+4
| | | | | | | | | | | | | | | | threads, to make it less confusing and using modern kernel terms. Rename the functions to reflect current use of the functions, instead of the historic KSE conventions: cpu_set_fork_handler -> cpu_fork_kthread_handler (for kthreads) cpu_set_upcall -> cpu_copy_thread (for forks) cpu_set_upcall_kse -> cpu_set_upcall (for new threads creation) Reviewed by: jhb (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 week Approved by: re (hrs) Differential revision: https://reviews.freebsd.org/D6731
* Fix the deciKelvin to Celsius conversion in kernel.loos2016-05-223-7/+7
| | | | | | | | | | | After r285994, sysctl(8) was fixed to use 273.15 instead of 273.20 as 0C reference and as result, the temperature read in sysctl(8) now exibits a +0.1C difference. This commit fix the kernel references to match the reference value used in sysctl(8) after r285994. Sponsored by: Rubicon Communications (Netgate)
* Add macro to convert errno and use it when appropriate.dchagin2016-05-221-5/+1
| | | | MFC after: 1 week
* Use OF_prop_free instead of direct call to free(9)gonzo2016-05-142-4/+4
| | | | Reviewed by: jhibbits
* Native PCI-express HotPlug support.jhb2016-05-052-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | PCI-express HotPlug support is implemented via bits in the slot registers of the PCI-express capability of the downstream port along with an interrupt that triggers when bits in the slot status register change. This is implemented for FreeBSD by adding HotPlug support to the PCI-PCI bridge driver which attaches to the virtual PCI-PCI bridges representing downstream ports on HotPlug slots. The PCI-PCI bridge driver registers an interrupt handler to receive HotPlug events. It also uses the slot registers to determine the current HotPlug state and drive an internal HotPlug state machine. For simplicty of implementation, the PCI-PCI bridge device detaches and deletes the child PCI device when a card is removed from a slot and creates and attaches a PCI child device when a card is inserted into the slot. The PCI-PCI bridge driver provides a bus_child_present which claims that child devices are present on HotPlug-capable slots only when a card is inserted. Rather than requiring a timeout in the RC for config accesses to not-present children, the pcib_read/write_config methods fail all requests when a card is not present (or not yet ready). These changes include support for various optional HotPlug capabilities such as a power controller, mechanical latch, electro-mechanical interlock, indicators, and an attention button. It also includes support for devices which require waiting for command completion events before initiating a subsequent HotPlug command. However, it has only been tested on ExpressCard systems which support surprise removal and have none of these optional capabilities. PCI-express HotPlug support is conditional on the PCI_HP option which is enabled by default on arm64, x86, and powerpc. Reviewed by: adrian, imp, vangyzen (older versions) Relnotes: yes Differential Revision: https://reviews.freebsd.org/D6136
* powerpc: Replace rounddown() from r298856 with roundup().pfg2016-04-301-3/+3
| | | | | | | Both are equivalent but roundup is more logical for this case. Catch another case while here. Pointed out by: jhibbits
* powerpc: Make use of our rounddown() macro when sys/param.h is available.pfg2016-04-301-3/+3
| | | | No functional change.
* Move 'device pci' for the PCI bus driver to the MI NOTES file.jhb2016-04-291-1/+0
| | | | | The PCI bus was already listed in all of the MD NOTES files and the driver should at least compile on all platforms.
* Remove vestiges of IEEE-488/GPIB drivers removed in r276214.jhb2016-04-291-3/+0
|
* Add a bus_null_rescan() method that always fails with an error.jhb2016-04-271-1/+1
| | | | | Use this in place of kobj_error_method to disable BUS_RESCAN() on PCI drivers that do not use the "standard" scanning algorithm.
* Add a pcib_attach_child() method to manage adding the child "pci" device.jhb2016-04-271-4/+1
| | | | | | | | | | | | This allows the PCI-PCI bridge driver to save a reference to the child device in its softc. Note that this required moving the "pci" device creation out of acpi_pcib_attach(). Instead, acpi_pcib_attach() is renamed to acpi_pcib_fetch_prt() as it's sole action now is to fetch the PCI interrupt routing table. Differential Revision: https://reviews.freebsd.org/D6021
* Implement a PCI bus rescan method.jhb2016-04-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | Rescanning a PCI bus uses the following steps: - Fetch the current set of child devices and save it in the 'devlist' array. - Allocate a parallel array 'unchanged' initalized with NULL pointers. - Scan the bus checking each slot (and each function on slots with a multifunction device). - If a valid function is found, look for a matching device in the 'devlist' array. If a device is found, save the pointer in the 'unchanged' array. If a device is not found, add a new device. - After the scan has finished, walk the 'devlist' array deleting any devices that do not have a matching pointer in the 'unchanged' array. - Finally, fetch an updated set of child devices and explicitly attach any devices that are not present in the 'unchanged' array. This builds on the previous changes to move subclass data management into pci_alloc_devinfo(), pci_child_added(), and bus_child_deleted(). Subclasses of the PCI bus use custom rescan logic explicitly override the rescan method to disable rescans. Differential Revision: https://reviews.freebsd.org/D6018
* sys/powerpc: make use of the howmany() macro when available.pfg2016-04-263-4/+4
| | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* OR in the unsigned form of the MCAR lower register.jhibbits2016-04-251-1/+1
| | | | | | | When ORing in a register_t to a wider integer (vm_paddr_t), it gets sign extended, so high addresses overwrite the upper word with all 0xf. Cast to the unsigned form (u_register_t), to avoid this problem, and get correct addresses printed.
* Init static compiled-in env when no metadata present.jhibbits2016-04-251-0/+1
| | | | | | With this, a static environment can be compiled in via config(5). This allows, among other things, the use of a compiled-in debug console (hw.uart.dbgport) for kgdb.
* sys: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-214-8/+8
| | | | | | | | | | rounddown2 tends to produce longer lines than the original code and when the code has a high indentation level it was not really advantageous to do the replacement. This tries to strike a balance between readability using the macros and flexibility of having the expressions, so not everything is converted.
* Use our nitems() macro when param.h is available.pfg2016-04-202-3/+3
| | | | | | Replacements specific to arm, mips, pc98, powerpc and sparc64. Discussed in: freebsd-current
* Fix SMP booting for PowerPC Book-Ejhibbits2016-04-196-207/+245
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: PowerPC Book-E SMP is currently broken for unknown reasons. Pull in Semihalf changes made c2012 for e500mc/e5500, which enables booting SMP. This eliminates the shared software TLB1 table, replacing it with tlb1_read_entry() function. This does not yet support ePAPR SMP booting, and doesn't handle resetting CPUs already released (ePAPR boot releases APs to a spin loop waiting on a specific address). This will be addressed in the near future by using the MPIC to reset the AP into our own alternate boot address. This does include a change to the dpaa/dtsec(4) driver, to mark the portals as CPU-private. Test Plan: Tested on Amiga X5000/20 (P5020). Boots, prints the following messages: Adding CPU 0, pir=0, awake=1 Waking up CPU 1 (dev=1) Adding CPU 1, pir=20, awake=1 SMP: AP CPU #1 launched top(1) shows CPU1 active. Obtained from: Semihalf Relnotes: Yes Differential Revision: https://reviews.freebsd.org/D5945
* powerpc: for pointers replace 0 with NULL.pfg2016-04-154-5/+5
| | | | | | | | These are mostly cosmetical, no functional change. Found with devel/coccinelle. Reviewed by: jhibbits
* Add a new PCI bus interface method to alloc the ivars (dinfo) for a device.jhb2016-04-151-3/+14
| | | | | | | | | | | | | | The ACPI and OFW PCI bus drivers as well as CardBus override this to allocate the larger ivars to hold additional info beyond the stock PCI ivars. This removes the need to pass the size to functions like pci_add_iov_child() and pci_read_device() simplifying IOV and bus rescanning implementations. As a result of this and earlier changes, the ACPI PCI bus driver no longer needs its own device_attach and pci_create_iov_child methods but can use the methods in the stock PCI bus driver instead. Differential Revision: https://reviews.freebsd.org/D5891
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-103-3/+3
| | | | Found with devel/coccinelle.
* VM_MAXUSER_ADDRESS is highest page start, not highest address.jhibbits2016-04-101-1/+1
| | | | | In case a single page mapping is requested first, which might overlap the user address space, fix the device map block to the next page.
* Restructure device mappings for Book-E.jhibbits2016-04-102-18/+19
| | | | | | | | | | | | | | | | | | Summary: There is currently a 1GB hole between user and kernel address spaces into which direct (1:1 PA:VA) device mappings go. This appears to go largely unused, leaving all devices to contend with the 128MB block at the end of the 32-bit space (0xf8000000-0xffffffff). This easily fills up, and needs to be densely packed. However, dense packing wastes precious TLB1 space, of which there are only 16 (e500v2) or 64(e5500) entries available. Change this by using the 1GB space for all device mappings, and allow the kernel to use the entire upper 1GB for KVA. This also allows us to use sparse device mappings, freeing up TLB entries. Test Plan: Boot tested on p5020. Differential Revision: https://reviews.freebsd.org/D5832
* Convert pci_delete_child() to a bus_child_deleted() method.jhb2016-04-061-0/+12
| | | | | | | | | | | | | | | | | | | | Instead of providing a wrapper around device_delete_child() that the PCI bus and child bus drivers must call explicitly, move the bulk of the logic from pci_delete_child() into a bus_child_deleted() method (pci_child_deleted()). This allows PCI devices to be safely deleted via device_delete_child(). - Add a bus_child_deleted method to the ACPI PCI bus which clears the device_t associated with the corresponding ACPI handle in addition to the normal PCI bus cleanup. - Change cardbus_detach_card to call device_delete_children() and move CardBus-specific delete logic into a new cardbus_child_deleted() method. - Use device_delete_child() instead of pci_delete_child() in the SRIOV code. - Add a bus_child_deleted method to the OpenFirmware PCI bus drivers which frees the OpenFirmware device info for each PCI device. Reviewed by: imp Tested on: amd64 (CardBus and PCI-e hotplug) Differential Revision: https://reviews.freebsd.org/D5831
* Make i2c device child auto-probe work for MPC85xx and QorIQ SoCs.jhibbits2016-04-051-1/+11
| | | | | | OFW i2c probing requires a new method ofw_bus_get_node(), and the bus device is assumed iichb. With these changes, i2c devices attached in fdt are probed and attached automagically.
* Reduce OFW PCI code duplication - involves ARM, PPC and SPARC64zbb2016-03-296-13/+9
| | | | | | | | | | | | | | | | | Import portions of the PowerPC OF PCI implementation into new file "ofwpci.c", common for other platforms. The files ofw_pci.c and ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations are moved to sys/dev/ofw/ofwpci.h. This creates a new ofw_pci_write_ivar() function and modifies some others methods. Most functions contain existing ppc implementations in the majority unchanged. Now there is no need to have multiple identical copies of methods for various architectures. Requested by: jhibbits Reviewed by: jhibbits, marius Submitted by: Marcin Mazurek <mma@semihalf.com> Obtained from: Semihalf Sponsored by: Annapurna Labs Differential Revision: https://reviews.freebsd.org/D4879
* Fix the resource_list_print_type() calls to use uintmax_t.jhibbits2016-03-226-14/+14
| | | | Missed a bunch from r297000.
* Fix fallout from r292180 (Dec 2015)... ensure that every driver which hasian2016-03-211-1/+1
| | | | | | | | | a DRIVER_MODULE() referencing mmc_driver has a MODULE_DEPEND() on mmc. This is because the kernel linker only searches for symbols in dependent modules, so loading sdhci_pci (and other bus-flavors of sdhci) would fail when mmc was not compiled into the kernel (even if you hand-loaded mmc first). (Thanks to jilles@ for providing the vital clue about the kernel linker.)
* Increase booke bus max address to 36-bits.jhibbits2016-03-181-0/+5
| | | | Sponsored by: Alex Perez/Inertial Computing
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.jhibbits2016-03-184-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On some architectures, u_long isn't large enough for resource definitions. Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but type `long' is only 32-bit. This extends rman's resources to uintmax_t. With this change, any resource can feasibly be placed anywhere in physical memory (within the constraints of the driver). Why uintmax_t and not something machine dependent, or uint64_t? Though it's possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on 32-bit architectures. 64-bit architectures should have plenty of RAM to absorb the increase on resource sizes if and when this occurs, and the number of resources on memory-constrained systems should be sufficiently small as to not pose a drastic overhead. That being said, uintmax_t was chosen for source clarity. If it's specified as uint64_t, all printf()-like calls would either need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t aren't horrible, but it would also bake into the API for resource_list_print_type() either a hidden assumption that entries get cast to uintmax_t for printing, or these calls would need the PRI*64 macros. Since source code is meant to be read more often than written, I chose the clearest path of simply using uintmax_t. Tested on a PowerPC p5020-based board, which places all device resources in 0xfxxxxxxxx, and has 8GB RAM. Regression tested on qemu-system-i386 Regression tested on qemu-system-mips (malta profile) Tested PAE and devinfo on virtualbox (live CD) Special thanks to bz for his testing on ARM. Reviewed By: bz, jhb (previous) Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D4544
* Only check for SYS_freebsd6_lseek if the syscall code is defined.bz2016-03-141-2/+5
| | | | | Whether this is the right or best solution is unclear but it fixes the build for now.
* Let rman_init() initialize the default rman range.jhibbits2016-03-031-2/+0
| | | | | If rm_start and rm_end are both 0 on input to rman_init(), rman_init() pre-initializes them to the default range. No need to set it before.
* Fix 2 bugs in the mpc85xx local bus controller driver.jhibbits2016-03-021-2/+26
| | | | | | | | | | 1) Include opt_platform.h to get QORIQ_DPAA. Otherwise the definition of OCP85XX_TGTIF_LBC is incorrect. 2) The child resources are already allocated, just activate them, instead of incorrectly remapping the memory regions (resource lists for lbc consist of the virtual address of the child's resources, not the physical address). Sponsored by: Alex Perez/Inertial Computing
* Add another compatibility check for QorIQ GPIO driver.jhibbits2016-03-011-1/+2
| | | | | | | | Some MPC85xx GPIO controllers are compatible with QorIQ. It may make more sense in the future to rename this and mpc85xx_gpio.c, as mpc85xx_gpio.c appears to only be compatible with a few mpc85xx SoCs. All other MPC85xx SoCs use the same controller as QorIQ.
* Add VM_MEMATTR_CACHEABLE support for AIM, for parity with Book-E.jhibbits2016-03-012-0/+4
| | | | Not used right now, but may be in the future anyway.
* Add support for the Freescale dTSEC DPAA-based ethernet controller.jhibbits2016-02-2913-6/+298
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Freescale's QorIQ line includes a new ethernet controller, based on their Datapath Acceleration Architecture (DPAA). This uses a combination of a Frame manager, Buffer manager, and Queue manager to improve performance across all interfaces by being able to pass data directly between hardware acceleration interfaces. As part of this import, Freescale's Netcomm Software (ncsw) driver is imported. This was an attempt by Freescale to create an OS-agnostic sub-driver for managing the hardware, using shims to interface to the OS-specific APIs. This work was abandoned, and Freescale's primary work is in the Linux driver (dual BSD/GPL license). Hence, this was imported directly to sys/contrib, rather than going through the vendor area. Going forward, FreeBSD-specific changes may be made to the ncsw code, diverging from the upstream in potentially incompatible ways. An alternative could be to import the Linux driver itself, using the linuxKPI layer, as that would maintain parity with the vendor-maintained driver. However, the Linux driver has not been evaluated for reliability yet, and may have issues with the import, whereas the ncsw-based driver in this commit was completed by Semihalf 4 years ago, and is very stable. Other SoC modules based on DPAA, which could be added in the future: * Security and Encryption engine (SEC4.x, SEC5.x) * RAID engine Additional work to be done: * Implement polling mode * Test vlan support * Add support for the Pattern Matching Engine, which can do regular expression matching on packets. This driver has been tested on the P5020 QorIQ SoC. Others listed in the dtsec(4) manual page are expected to work as the same DPAA engine is included in all. Obtained from: Semihalf Relnotes: Yes Sponsored by: Alex Perez/Inertial Computing
* Implement pmap_change_attr() for PowerPC (Book-E only for now)jhibbits2016-02-275-0/+94
| | | | | | | | | | | | | | | | | | | | | | Summary: Some drivers need special memory requirements. X86 solves this with a pmap_change_attr() API, which DRM uses for changing the mapping of the GART and other memory regions. Implement the same function for PowerPC. AIM currently does not need this, but will in the future for DRM, so a default is added for that, for business as usual. Book-E has some drivers coming down that do require non-default memory coherency. In this case, the Datapath Acceleration Architecture (DPAA) based ethernet controller has 2 regions for the buffer portals: cache-inhibited, and cache-enabled. By default, device memory is cache-inhibited. If the cache-enabled memory regions are mapped cache-inhibited, an alignment exception is thrown on access. Test Plan: Tested with a new driver to be added after this (DPAA dTSEC ethernet driver). No alignment exceptions thrown, driver works as expected with this. Reviewed By: nwhitehorn Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5471
* Move another range check to use RMAN_IS_DEFAULT_RANGE().jhibbits2016-02-271-1/+1
|
* Allow the size argument for law_enable() to be non-power-of-2.jhibbits2016-02-231-1/+2
| | | | | Although the local access windows are powers of 2 in size, allow arguments that aren't power of 2, and round up.
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toskra2016-02-2216-16/+0
| | | | | | | include it explicitly when <vm/pmap.h> is already included. Reviewed by: alc, kib Differential Revision: https://reviews.freebsd.org/D5373
* Revert r295756:zbb2016-02-206-5/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | Extract common code from PowerPC's ofw_pci Import portions of the PowerPC OF PCI implementation into new file "ofw_pci.c", common for other platforms. The files ofw_pci.c and ofw_pci.h from sys/powerpc/ofw no longer exist. All required declarations are moved to sys/dev/ofw/ofw_pci.h. This creates a new ofw_pci_write_ivar() function and modifies ofw_pci_nranges(), ofw_pci_read_ivar(), ofw_pci_route_interrupt() methods. Most functions contain existing ppc implementations in the majority unchanged. Now there is no need to have multiple identical copies of methods for various architectures. Submitted by: Marcin Mazurek <mma@semihalf.com> Obtained from: Semihalf Sponsored by: Annapurna Labs Reviewed by: jhibbits, mmel Differential Revision: https://reviews.freebsd.org/D4879 This needs to return to the drawing board as it breaks both PowerPC and Sparc64 build. Pointed out by: jhibbits
OpenPOWER on IntegriCloud