summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/ofw
Commit message (Collapse)AuthorAgeFilesLines
* MFC r275779, r275963, r276101, r276161, r276297:ian2015-02-121-214/+0
| | | | | | | | | | | Move ofw_cpu.c to sys/dev/ofw so that it can be used by other architectures. Add driver for CPU frequency/voltage control on the Raspberry Pi. On initialization, do not use bcm_mbox_intr() to read the pending messages. This fixes the hang that happens on boot while initializing the cpufreq on Raspberry Pi.
* MFC r272109, r272181:ian2014-10-261-23/+2
| | | | | | | | | Replace multiple nearly-identical copies of code to walk through an FDT node's interrupts=<...> property creating resource list entries with a single common implementation. This change makes ofw_bus_intr_to_rl() the one true copy of that code and removes the copies of it from other places. This also adds handling of the interrupts-extended property.
* MFC r270945:ian2014-10-261-2/+2
| | | | | Rename OF_xref_phandle() to OF_node_from_xref() and add a new function that provides the inverse translation, OF_xref_from_node().
* MFC r261423, r261424, r261516, r261513, r261562, r261563, r261564, r261565,ian2014-05-152-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | r261596, r261606 Add the imx sdhci controller. Move Open Firmware device root on PowerPC, ARM, and MIPS systems to a sub-node of nexus (ofwbus) rather than direct attach under nexus. This fixes FDT on x86 and will make coexistence with ACPI on ARM systems easier. SPARC is unchanged. Add the missing ')' at end of sentence. Reword it to use a more common idiom. Pass the kernel physical address to initarm through the boot param struct. Make functions only used in vfp.c static, and remove vfp_enable. Fix __syscall on armeb EABI. As it returns a 64-bit value it needs to place 32-bit data in r1, not r0. 64-bit data is already packed correctly. Use abp_physaddr for the physical address over KERNPHYSADDR. This helps us remove the need to load the kernel at a fixed address. Remove references to PHYSADDR where it's used only in debugging output. Dynamically generate the page table. This will allow us to detect the physical address we are loaded at to change the mapping.
* MFC r261351, r261352, r261355, r261396, r261397, r261398, r261403, r261404,ian2014-05-153-25/+21
| | | | | | | | | | | | | | | | | | | | | | | | | r261405 Open Firmware interrupt specifiers can consist of arbitrary-length byte strings and include arbitrary information (IRQ line/domain/sense). When the ofw_bus_map_intr() API was introduced, it assumed that, as on most systems, these were either 1 cell, containing an interrupt line, or 2, containing a line number plus a sense code. It turns out a non-negligible number of ARM systems use 3 (or even 4!) cells for interrupts, so make this more general. Provide a simpler and more standards-compliant simplebus implementation to get the Routerboard 800 up and running with the vendor device tree. This does not implement some BERI-specific features (which hopefully won't be necessary soon), so move the old code to mips/beri, with a higher attach priority when built, until MIPS interrupt domain support is rearranged. Allow nesting of simplebuses. Add a set of helpers (ofw_bus_get_status() and ofw_bus_status_okay()) to process "status" properties of OF nodes. Fix one remnant endian flaw in nexus.
* MFC r258800, r258802, r258805, r258806, r258807, r258851, r258857,ian2014-05-143-234/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* MFC r258268, r258271, r258272, r258274, r258275, r258427, r258694, r258696,ian2014-05-141-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* MFC r256994, r257016, r257055, r257059, r257060, r257075ian2014-05-134-11/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* MFC r256870, r256898, r256899, r256900 (by nwhitehorn):ian2014-05-131-0/+129
| | | | | | | | | | | | | | 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).
* MFC r256814, r256816, r256818, r256846, r256855, r256864 (by nwhitehorn):ian2014-05-134-13/+35
| | | | | | | | | | - 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.
* MFC: r261884brueffer2014-02-281-1/+1
| | | | | | | Correct the order of arguments to mtx_init(). PR: 186701 Submitted by: Takanori Sawada <tak.swd at gmail.com>
* MFC: r258427, r258694andreast2013-12-121-2/+3
| | | | | | | | | | | | | | | | r258694: Make RTAS calls, which call setfault() to recover from machine checks, preserve any existing fault buffer. RTAS calls are meant to be safe from interrupt context (and are indeed used there to implement the xics PIC driver). Without this, calling into RTAS in interrupt context would have the effect of clearing any existing onfault state of the interrupted thread, potentially leading to a panic. r258427: For PCI<->PCI bridges, #address-cells may be 3. Allow this when parsing the ibm,dma-window properties. This is especially a concern when #ibm,dma-address-cells is not specified and we have to use the regular #address-cells property.
* MFC: r258051, r258052andreast2013-12-122-6/+55
| | | | | | | | | | | | | | r258052: 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. Besides matching better the architecture on other platforms, this also allows systems with multiple partitionable endpoints per PCI host bridge to work correctly. r258051: Actually add IOMMU domain to the list of known mappings. This fixes a bug where multiple devices in the same IOMMU domain would be allocated conflicting mappings unless they also shared a DMA tag.
* MFC r257991, r257992, 257993, 258504andreast2013-12-111-14/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | r257991: Consolidate Apple firmware hacks and improve them by switching on the presence of mac-io devices in the tree, which uniquely identifies Apple hardware. r257992: Allow OF_decode_addr() to also be able to map resources on big-endian devices. To this end, make PCI device detection rely on the device_type field rather than name, as per the standard. r257993: Make tsec work with the device tree present on the RB800. The previous code assumed that the MDIO bus was a direct child of the Ethernet interface. It may not be and indeed on many device trees is not. While here, add proper locking for MII transactions, which may be on a bus shared by several MACs. r258504: Save and restore the trap vectors when doing OF calls on pSeries machines. It turned out that on pSeries machines the call into OF modified the trap vectors and this made further behaviour unpredictable. With this commit I'm now able to boot multi user on a network booted environment on my IntelliStation 285. This is a POWER5+ machine.
* MFC r258778andreast2013-12-111-0/+1
| | | | | Add a printf to inform about the logical memory block size which is in use by the system. This might give a hint why a pSeries system is not booting.
* Rework handling of ofw_quiesce(), making it the responsibility of thenwhitehorn2013-09-271-29/+6
| | | | | | | | | | platform modules. Whether to call this function or not is highly machine dependent: on some systems, it is required, while on others it breaks everything. Platform modules are in a better position to figure this out. This is required for POWER hypervisor SCSI to work correctly. There are no functional changes on Powermac systems. Approved by: re (kib)
* Allow Open Firmware syscons to attach to devices without an "address"nwhitehorn2013-09-263-30/+74
| | | | | | | | | | property such as those found on some real and emulated IBM systems. The approach, which is taken from Linux, is to scan through the PCI bars until we find one large enough to contain the linear framebuffer and which is ideally prefetchable if no "address" property can be found. This makes the graphical console work with the pSeries target in QEMU. Approved by: re (delphij)
* Only attach if properties we need (address, in particular) are present.nwhitehorn2013-09-171-0/+6
| | | | | | This is the correct version of r255420. Approved by: re (kib)
* Add a loader tunable to use only device tree-provided PCI devices. This isnwhitehorn2013-09-161-2/+6
| | | | | | | | needed on some more fragile systems to avoid machine checks when blindly probing the PCI bus. Also reduce ofw_pcibus's priority slightly so that it can be overridden. Approved by: re (gjb)
* Add a kernel interface (OF_xref_phandle()) for systems where phandlesnwhitehorn2013-09-151-4/+5
| | | | | | | | | | | | | used as cross-references in the device tree and phandles as used by the Open Firmware client interface are in different namespaces. This include IBM pSeries hardware as well as FDT systems. FDT certainly abuses ihandles for this purpose and should be modified to use this API eventually. This changes no behavior on systems where FreeBSD already worked. Reviewed by: marius Approved by: re (kib) MFC after: 2 weeks
* Revert r255420. This seems to break some Powermac systems and will benwhitehorn2013-09-091-13/+1
| | | | | | | revisited much later. Pointy hat to: me Approved by: re (kib, implicit due to breakage 10 minutes ago)
* Attach only on hardware that is actually supported as opposed to hardwarenwhitehorn2013-09-091-1/+13
| | | | | | that seems like it has some of the problems we might want. Approved by: re (kib)
* Use a spin lock instead of a mutex to gate RTAS. This is required if RTASnwhitehorn2013-09-091-3/+3
| | | | | | calls are involved in interrupt handling. Approved by: re (kib)
* Fix error in r252115: space for the softc needs to be allocated. Thisnwhitehorn2013-09-071-1/+1
| | | | seemed to be working by chance on most systems.
* Micro-optimize OFW syscons 8-bit blank.jhibbits2013-08-061-5/+13
| | | | MFC after: 1 week
* Increase the size of the OFW bounce buffer to 4 pages. With this I can now runjhibbits2013-07-241-3/+3
| | | | | | 'ofwdump -ap' on my quad G5. MFC after: 9.2 branch
* Cache the Open Firmware CPU properties at attach time, so we don't alwaysjhibbits2013-06-231-8/+19
| | | | enter it at runtime to get static data.
* Remove leftover from r215163.andreast2012-09-211-1/+0
|
* Don't probe the openfirmware framebuffer if the system is a Wii or itadrian2012-08-211-0/+6
| | | | | | will crash. Submitted by: Margarida Gouveia
* Make ofw_bus_get_node() consistently return -1 when there is no associatednwhitehorn2012-03-152-2/+2
| | | | | | | OF node, instead of a random mixture of 0 and -1. Update all checks for 0 to check for -1 instead. MFC after: 4 weeks
* - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge.jhb2012-03-021-5/+6
| | | | | | | | | | | | | | | The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. MFC after: 2 weeks
* The bus resource adjustment API is not meant to work on active resources.nwhitehorn2012-02-071-16/+6
| | | | | | | Return an error if a driver attempts this, and, if INVARIANTS is on, panic. Reviewed by: jhb
* Inherit from PCI bridge driver instead of manually specifying all of itsnwhitehorn2012-02-051-24/+3
| | | | | | | methods. Obtained from: sparc64 MFC after: 1 week
* Make sure to remap adjusted resources.nwhitehorn2012-02-051-1/+17
|
* Add support for bus_adjust_resource() on all PowerPC/AIM PCI bridges. Withnwhitehorn2012-02-051-0/+28
| | | | | this change, NEW_PCIB appears to work without incident at least on a G5 iMac. More testing will be required before it is turned on in GENERIC.
* Unify OF PCI infrastructure, including changing from parsing the devicenwhitehorn2012-02-042-0/+575
| | | | | | | tree based on heuristics to parsing it based on the spec. This should also lay the foundation for NEW_PCIB on PowerPC. MFC after: 3 months
* Avoid warnings about duplicate modules.nwhitehorn2012-02-041-1/+1
| | | | MFC after: 2 weeks
* This commit adds profiling support for powerpc64. Now we can do applicationandreast2012-01-201-2/+2
| | | | | | | | | | | | | profiling and kernel profiling. To enable kernel profiling one has to build kgmon(8). I will enable the build once I managed to build and test powerpc (32-bit) kernels with profiling support. - add a powerpc64 PROF_PROLOGUE for _mcount. - add macros to avoid adding the PROF_PROLOGUE in certain assembly entries. - apply these macros where needed. - add size information to the MCOUNT function. MFC after: 3 weeks, together with r230291
* Prevent an error resulting from signed/unsigned comparison on systemsnwhitehorn2012-01-201-2/+2
| | | | | | | that do not comply with the OF spec. Submitted by: Anders Gavare MFC after: 1 week
* - There's no need to overwrite the default device method with the defaultmarius2011-11-222-14/+10
| | | | | | | | | | one. Interestingly, these are actually the default for quite some time (bus_generic_driver_added(9) since r52045 and bus_generic_print_child(9) since r52045) but even recently added device drivers do this unnecessarily. Discussed with: jhb, marcel - While at it, use DEVMETHOD_END. Discussed with: jhb - Also while at it, use __FBSDID.
* Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.ed2011-11-071-1/+1
| | | | | | The SYSCTL_NODE macro defines a list that stores all child-elements of that node. If there's no SYSCTL_DECL macro anywhere else, there's no reason why it shouldn't be static.
* Mark MALLOC_DEFINEs static that have no corresponding MALLOC_DECLAREs.ed2011-11-072-2/+3
| | | | This means that their use is restricted to a single C file.
* Add better error handling for RTAS calls. These can potentially causenwhitehorn2011-06-261-1/+18
| | | | | | | machine checks (e.g. invalid PCI configuration cycles), but these can be caught and recovered from. This change also the RTAS PCI driver to work without modification as a replacement for the Grackle driver on Grackle-based Powermacs.
* Use the ABI-mandated thread pointer register (r2 for ppc32, r13 for ppc64)nwhitehorn2011-06-231-6/+8
| | | | | | | | | | | | | | | instead of a PCPU field for curthread. This averts a race on SMP systems with a high interrupt rate where the thread looking up the value of curthread could be preempted and migrated between obtaining the PCPU pointer and reading the value of pc_curthread, resulting in curthread being observed to be the current thread on the thread's original CPU. This played merry havoc with the system, in particular with mutexes. Many thanks to jhb for helping me work this one out. Note that Book-E is in principle susceptible to the same problem, but has not been modified yet due to lack of Book-E hardware. MFC after: 2 weeks
* Retry the memory map-related portions of r222613, written by andreast,nwhitehorn2011-06-041-26/+145
| | | | | after some minor tweaks and an increase in the early-boot stack space in r222632.
* Temporarily back out those parts of r222613 related to parsing the memorynwhitehorn2011-06-021-144/+25
| | | | | map. They cause non-understood boot failures on some Apple machines with more than 2 GB of RAM (like my work desktop).
* MFpseries:nwhitehorn2011-06-026-42/+905
| | | | | | | | | | Renovate and improve the AIM Open Firmware support: - Add RTAS (Run-Time Abstraction Services) support, found on all IBM systems and some Apple ones - Improve support for 32-bit real mode Open Firmware systems - Pull some more OF bits over from the AIM directory - Fix memory detection on IBM LPARs and systems with more than one /memory node (by andreast@)
* Fix whitespace nit.nwhitehorn2011-03-091-1/+1
|
* Rename INTR_VEC to MAP_IRQ. From the OFW or FDT we obtain amarcel2011-02-022-4/+4
| | | | | PIC handle with interrupt pin. This we map to the resource called SYS_RES_IRQ.
* Fix null string handling in ofw_real_nextprop function. Pass the rightandreast2011-01-051-4/+10
| | | | | | | | length to ofw_real_map in case of a null string. This makes ofwdump(8) work correctly when trying to print all properties with ofwdump -p. Approved by: nwhitehorn (mentor)
OpenPOWER on IntegriCloud