summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/powermac
Commit message (Collapse)AuthorAgeFilesLines
* 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)
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-103-3/+3
| | | | Found with devel/coccinelle.
* Reduce OFW PCI code duplication - involves ARM, PPC and SPARC64zbb2016-03-294-8/+6
| | | | | | | | | | | | | | | | | 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-223-10/+10
| | | | Missed a bunch from r297000.
* Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.jhibbits2016-03-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* As <machine/pmap.h> is included from <vm/pmap.h>, there is no need toskra2016-02-223-3/+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-204-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Extract common code from PowerPC's ofw_pcizbb2016-02-184-7/+3
| | | | | | | | | | | | | | | | | | | 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
* Convert rman to use rman_res_t instead of u_longjhibbits2016-01-273-6/+11
| | | | | | | | | | | | | | | | | | | | Summary: Migrate to using the semi-opaque type rman_res_t to specify rman resources. For now, this is still compatible with u_long. This is step one in migrating rman to use uintmax_t for resources instead of u_long. Going forward, this could feasibly be used to specify architecture-specific definitions of resource ranges, rather than baking a specific integer type into the API. This change has been broken out to facilitate MFC'ing drivers back to 10 without breaking ABI. Reviewed By: jhb Sponsored by: Alex Perez/Inertial Computing Differential Revision: https://reviews.freebsd.org/D5075
* Use setjmp() instead of the identical-except-for-having-a-wrong-prototypenwhitehorn2016-01-101-4/+3
| | | | | setfault() when testing for faults. This should also help the compiler do the right thing with this complicated-to-optimize function.
* Where appropriate, use the endian-flipping OF_getencprop() instead ofnwhitehorn2015-11-173-7/+7
| | | | | | | | | | | | | OF_getprop() to get encode-int encoded values from the OF tree. This is a no-op at present, since all existing PowerPC ports are big-endian, but it is a correctness improvement and will be required if we have a little-endian kernel at some future point. Where it is totally impossible for the code ever to be used on a little-endian system (much of powerpc/powermac, for instance), I have not necessarily made the appropriate changes. MFC after: 1 month
* Allow PowerMac systems to be booted from an FDT as well as Open Firmware.nwhitehorn2015-03-101-13/+24
| | | | | | This is not complete yet: the gem(4) interface on my laptop seems to disappear from the PCI bus as a result of quiescing Open Firmware in the boot loader.
* Make the PowerMac fan control nonlinearjhibbits2015-02-201-5/+23
| | | | | | | | | | | | | | | | | Summary: Currently, fan control is linear between the target temperature and max temperature, which is far from ideal. This changes it to be proportional to the distance between the current temperature and the two endpoints (target and max temp). This also adds a hysteresis, so that fans keep going when the temperature drops, for about 10 seconds, before slowing down. Reviewers: nwhitehorn Reviewed By: nwhitehorn Differential Revision: https://reviews.freebsd.org/D1549 MFC after: 3 weeks
* Match the right backlight driver.jhibbits2015-02-182-2/+13
| | | | | | | | Some ATI-based PowerBooks use the string 'mnca' in the backlight controller device tree entry, so account for this and don't use nVidia when it's not an nVidia device. MFC after: 3 weeks
* Don't set the write bit if we're just reading.jhibbits2015-02-181-4/+3
| | | | | | Also fix a couple typos. MFC after: 3 weeks
* Add support for Power Button PMU events on non-ADB macs, such as aluminumjhibbits2014-11-202-4/+5
| | | | | | | PowerBooks. MFC after: 2 weeks Relnotes: yes
* Fix multiple incorrect SYSCTL arguments in the kernel:hselasky2014-10-212-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | - Wrong integer type was specified. - Wrong or missing "access" specifier. The "access" specifier sometimes included the SYSCTL type, which it should not, except for procedural SYSCTL nodes. - Logical OR where binary OR was expected. - Properly assert the "access" argument passed to all SYSCTL macros, using the CTASSERT macro. This applies to both static- and dynamically created SYSCTLs. - Properly assert the the data type for both static and dynamic SYSCTLs. In the case of static SYSCTLs we only assert that the data pointed to by the SYSCTL data pointer has the correct size, hence there is no easy way to assert types in the C language outside a C-function. - Rewrote some code which doesn't pass a constant "access" specifier when creating dynamic SYSCTL nodes, which is now a requirement. - Updated "EXAMPLES" section in SYSCTL manual page. MFC after: 3 days Sponsored by: Mellanox Technologies
* Move the adm1030 driver to the proper location, and rename it.jhibbits2014-10-161-240/+0
| | | | | For compatibility, 'device windtunnel' is still supported, but one should use 'device adm1030' instead, and this has been updated in GENERIC and NOTES.
* Add a sysctl to allow disabling the monitoring thread.jhibbits2014-10-151-8/+41
| | | | | | | | | | | | | | | | | Summary: If a user uses powerd, or doesn't want to use the cycles monitoring, they can now suspend the monitoring thread. While here, reorganize the added prototypes to match existing groupings. Reviewers: nwhitehorn, #powerpc, rpaulo Reviewed By: #powerpc, rpaulo Differential Revision: https://reviews.freebsd.org/D944 X-MFC-with: r273009 MFC after: 3 weeks
* Add an AC line monitor so power_profile can workjhibbits2014-10-121-0/+46
| | | | | | | | | | | | | | | | | | | Summary: Add a polling loop (1Hz) to monitor the battery and AC status, to notify devd like ACPI does for power monitoring. This allows /etc/rc.d/power_profile to work on PowerPC laptops Test Plan: Tested on a Titanium PowerBook, configuring economy_cpu_freq and performance_cpu_freq, disabling powerd. Reviewers: #powerpc, nwhitehorn Reviewed By: nwhitehorn Subscribers: rpaulo Differential Revision: https://reviews.freebsd.org/D937
* Rename OF_xref_phandle() to OF_node_from_xref() and add a new functionian2014-09-011-1/+1
| | | | | | that provides the inverse translation, OF_xref_from_node(). Discussed with: nwhitehorn
* Clear the backlight level when it's turned off. Also, reduce the delay times tojhibbits2014-04-061-4/+4
| | | | | | | less conservative values, also found in the radeonkms driver. MFC after: 2 weeks X-MFC-with: r264205
* Fix the ATI backlight driver off/on handling. Now this driver works correctlyjhibbits2014-04-061-6/+61
| | | | | | | | | with the ATI Radeon 9700 in the PowerBook G4 1.67GHz. Code shamelessly taken in spirit from the radeonkms driver, which I hope will make this driver redundant in the future. MFC after: 2 weeks
* Move Open Firmware device root on PowerPC, ARM, and MIPS systems tonwhitehorn2014-02-055-5/+5
| | | | | | | | 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. Reviewed by: imp, ian
* Unbreak non-SMP builds. This was broken by r259284. Also, reorganize thejhibbits2014-01-312-177/+14
| | | | | | | code introduced in that revision a bit. Reviewed by: nwhitehorn MFC after: 3 weeks
* Fix the resource information for the i2s-a node on certain G5 PowerMacs.andreast2014-01-202-2/+56
| | | | | | | | | | | | This is the first step needed to get the snapper codec working on those machines. The second step is to enable the corresponding I2S device and its clock. Tested on machines where the snapper codec was already working, a G4 PowerBook and a PowerMac9,1 with a Shasta based macio. The PowerMac7,2/7,3 with a K2 based macio can now also play sound. MFC after: 1 month
* There's actually no data in the PMU_GET_VERSION command. Don't send any.jhibbits2014-01-191-1/+1
| | | | | | This change now allows the PMU to be used on PowerBook5,8. MFC after: 1 week
* Save and restore the GPIOs on the macio for suspend/resume.jhibbits2014-01-112-2/+48
|
* Add suspend/resume state saving for OpenPIC on PowerMac. It's likely thisjhibbits2013-12-211-0/+1
| | | | can be used on the others (cpcht and psim), but that has not been tested.
* Add suspend/resume to DBDMA and ATA on PowerMacs.jhibbits2013-12-213-0/+61
| | | | | | This, and several subsequent commits, are suspend/resume for various PowerMac drivers, which will include a change to the global suspend/resume code eventually.
* Add suspend/resume handlers for ATI backlight ppc driver.jhibbits2013-12-201-14/+76
| | | | | | | With this, also shut shut off the display (DPMS-style) and disable the clocking when the backlight level is set to 0. This is taken from the radeonkms driver (radeon_legacy_encoders.c) which doesn't yet support PowerPC, and won't for a while, as it's missing full AGP support.
* Add PMU-based CPU frequency scaling. This method is used on most Titaniumjhibbits2013-12-136-25/+300
| | | | | | PowerBooks. MFC after: 1 month
* Make more unsigned ints signed.jhibbits2013-12-071-1/+2
| | | | | Found by: clang (powerpc64) MFC after: 1 week
* Rearchitect platform memory map parsing to make it lessnwhitehorn2013-12-011-5/+55
| | | | | | | | | | Open Firmware-centric: - Keep the static list of regions in platform.c instead of ofw_machdep.c - Move various merging and sorting operations to platform.c as well - Move apple_hacks code out of ofw_machdep.c and into platform_powermac.c, where it belongs - Move CHRP-specific dynamic-reconfiguration memory parsing into platform_chrp.c instead of pretending it is shared code
* Fix undefined behavior: (1 << 31) is not defined as 1 is an int and thiseadler2013-11-301-1/+1
| | | | | | | | | | | | | shifts into the sign bit. Instead use (1U << 31) which gets the expected result. This fix is not ideal as it assumes a 32 bit int, but does fix the issue for most cases. A similar change was made in OpenBSD. Discussed with: -arch, rdivacky Reviewed by: cperciva
* badaddr() is used only in the grackle PCI driver, so move its definitionnwhitehorn2013-11-271-2/+48
| | | | there. Clean up a spurious setfault() declaration as well.
* #interrupt-cells belongs to the iparent, not the device parent.nwhitehorn2013-11-171-4/+4
|
* Use #address-cells and #size-cells here too instead of guessing. There isnwhitehorn2013-11-172-7/+17
| | | | | | | | some comment I wrote about these values "lying" in the negative diff, which referes to an earlier misunderstanding about which node to read them from. This gets at least the PPC64 kernel booting in the mac99 system model in QEMU after bypassing the MacIO ATA driver, which apparently still has problems.
* Actually look up #address-cells instead of assuming it is correlated withnwhitehorn2013-11-171-7/+13
| | | | | | the Uninorth version number. MFC after: 2 weeks
* Be a little more suspicious of thermal sensors, which can have singlenwhitehorn2013-10-251-7/+24
| | | | | | | | | | crazy readings occasionally. One wild reading should not be enough to trigger a shutdown, so instead wait for several concerning readings in a row. PR: powerpc/180593 Submitted by: Julio Merino MFC after: 1 week
* Standards-conformance and code deduplication:nwhitehorn2013-10-221-110/+0
| | | | | | | | | | - 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.
* Move the resource allocation from the ata_*_probe section to the ata_*_attachandreast2013-10-152-41/+47
| | | | | | | | | | | | | section. This prevents a boot crash on nearly all iMacs and PowerMacs/Books. The allocation in the probe section was working before because ata_probe was returning 0 which did not invoke a second DEVICE_PROBE. Now it returns a BUS_PROBE_DEFAULT which can invoke a second DEVICE_PROBE which results in a "failed to reserve resource" exit. PR: powerpc/182978 Discussed with: grehan@ MFC after: 1 Week
* Rework handling of ofw_quiesce(), making it the responsibility of thenwhitehorn2013-09-271-0/+31
| | | | | | | | | | 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)
* Attach only on hardware that is actually supported as opposed to hardwarenwhitehorn2013-09-091-2/+16
| | | | | | that seems like it has some of the problems we might want. Approved by: re (kib)
* Only add the backlight device if it actually exists in OF.jhibbits2013-08-312-0/+4
| | | | MFC after: 1 week
* Return EIO iso -1, the kiic_transfer has an signed return.andreast2013-08-231-1/+1
| | | | Submitted by: Luiz Otavio O Souza <loos.br AT gmail.com>
* Add the macio attachment for wi(4). Partially obtained from NetBSD.jhibbits2013-07-312-0/+51
| | | | | Reviewed by: adrian Obtained from: NetBSD (partially)
* Only check fan type once. Not only is continuously rechecking pointless, anwhitehorn2013-05-051-11/+40
| | | | | | single random failure can reprogram what control mechanism we try to use. MFC after: 2 weeks
* - With the demise of !ATA_CAM, ATA_STATIC_ID is the only ata(4) relatedmarius2013-04-063-17/+17
| | | | | | | | | option left but actually consumed by ada(4), so move it to opt_ada.h and get rid of opt_ata.h. - Fix stand-alone build of atacore(4) by adding opt_cam.h. - Use __FBSDID. - Use DEVMETHOD_END. - Use NULL instead of 0 for pointers.
* Introduce PLATFORMMETHOD_END and use it.rpaulo2013-02-131-1/+1
|
OpenPOWER on IntegriCloud