Commit Graph

2183 Commits

Author SHA1 Message Date
Justin Hibbits
fe938c0835 Use a loop of dcbz, instead of calling bzero() to zero a page. This matches
what is done in mmu_oea64.c.

MFC after:	1 month
2014-01-29 05:58:08 +00:00
Justin Hibbits
b65c25f54a Fix 32-bit signal handling on ppc64. This was broken when the PSL_USERSTATIC
macro was changed.  Since copying 64-bit srr1 into 32-bit srr1 drops the upper
32 bits, any bits set in the context were dropped, meaning the context check
fails.  Since 32-bit set_context can't change those bits anyway, copy the ones
from the current context (td->td_frame) before calling set_context().

MFC after:	3 weeks
2014-01-24 02:57:00 +00:00
Andreas Tobler
d25b22e12b Fix the resource information for the i2s-a node on certain G5 PowerMacs.
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
2014-01-20 21:54:05 +00:00
Justin Hibbits
feb0538308 There's actually no data in the PMU_GET_VERSION command. Don't send any.
This change now allows the PMU to be used on PowerBook5,8.

MFC after:	1 week
2014-01-19 00:23:59 +00:00
Andreas Tobler
feb86bbe4f Described in the man page but not implemented. Here it comes,
atomic_swap_32/64. The latter only for powerpc64.

MFC after:	1 month
2014-01-13 22:21:29 +00:00
Justin Hibbits
e68afcedbc Save and restore the GPIOs on the macio for suspend/resume. 2014-01-11 06:35:29 +00:00
Nathan Whitehorn
dcd08302e5 Retire machine/fdt.h as a header used by MI code, as its function is now
obsolete. This involves the following pieces:
- Remove it entirely on PowerPC, where it is not used by MD code either
- Remove all references to machine/fdt.h in non-architecture-specific code
  (aside from uart_cpu_fdt.c, shared by ARM and MIPS, and so is somewhat
  non-arch-specific).
- Fix code relying on header pollution from machine/fdt.h includes
- Legacy fdtbus.c (still used on x86 FDT systems) now passes resource
  requests to its parent (nexus). This allows x86 FDT devices to allocate
  both memory and IO requests and removes the last notionally MI use of
  fdtbus_bs_tag.
- On those architectures that retain a machine/fdt.h, unused bits like
  FDT_MAP_IRQ and FDT_INTR_MAX have been removed.
2014-01-05 18:46:58 +00:00
Ed Maste
0e5e176f1f Remove TNF license clauses 3 and 4, matching upstream
Approved by raj@ (Semihalf has a copyright statement in the license block
as well).
2014-01-01 20:04:43 +00:00
Justin Hibbits
1c8eb4c44b Set the PMC trapframe macros appropriately
MFC after:	2 weeks
2013-12-22 00:04:50 +00:00
Justin Hibbits
9a2edf0198 Add suspend/resume state saving for OpenPIC on PowerMac. It's likely this
can be used on the others (cpcht and psim), but that has not been tested.
2013-12-21 04:31:54 +00:00
Justin Hibbits
cab8300efb Add suspend/resume to DBDMA and ATA on PowerMacs.
This, and several subsequent commits, are suspend/resume for various PowerMac
drivers, which will include a change to the global suspend/resume code
eventually.
2013-12-21 00:07:56 +00:00
Justin Hibbits
c63e7b9304 Add suspend/resume handlers for ATI backlight ppc driver.
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.
2013-12-20 16:37:03 +00:00
Nathan Whitehorn
95e3bfe889 Simplify the ofw_bus_lookup_imap() API slightly: make it allocate maskbuf
internally instead of requiring the caller to allocate it.
2013-12-17 15:11:24 +00:00
Nathan Whitehorn
cb6d9d6cb1 Configure interrupt sense based on device tree information. This extends
the OF interrupt map API to return sense information to the caller and
the PowerPC Open Firmware PCI base driver to use it to program the PIC.
2013-12-17 14:50:35 +00:00
Justin Hibbits
ac01bc33c9 Save r3 before using it for the trap check, else we end up saving the new r3,
containing the trap instruction encoding (0x7c810808), and restoring it back
with the frame on return.  This caused it to panic on my ppc32 machine, but
somehow my ppc64 machine overlooked it, because I was using such a simple
dtrace probe.

X-MFC-with:	r259245
MFC after:	2 weeks
2013-12-15 18:07:25 +00:00
Nathan Whitehorn
d2a94a7764 Set max_lun to zero. This field is ignored unless we are manually probing
LUNs anyway, and we certainly don't want to probe 2^32 values by hand in
that case.

MFC after:	2 weeks
2013-12-15 16:58:23 +00:00
Justin Hibbits
46cf9b63fd Rebase the PMC indices at 1, since PMC_SOFT is at 0.
MFC after:	1 week
2013-12-14 19:01:24 +00:00
Justin Hibbits
10b31d0b54 Some style(9) fixes
MFC after:	1 month
X-MFC with: r259284
2013-12-13 05:54:25 +00:00
Justin Hibbits
4702d987cd Add PMU-based CPU frequency scaling. This method is used on most Titanium
PowerBooks.

MFC after:	1 month
2013-12-13 02:37:35 +00:00
Justin Hibbits
8d7b300516 FBT now does work fully on PowerPC.
MFC after:	2 weeks
2013-12-12 04:12:19 +00:00
Justin Hibbits
e17bec9172 Make more unsigned ints signed.
Found by:	clang (powerpc64)
MFC after:	1 week
2013-12-07 22:25:07 +00:00
John Baldwin
43fdca95b6 Fix debug printfs in FPU_EMU to compile on powerpc64 and enable it for
powerpc64.  This fixes the LINT64 kernel config.

Approved by:	nwhitehorn (the idea, not the actual patch)
2013-12-05 21:49:14 +00:00
Andreas Tobler
f5dfbe2f69 Do some cosmetic fixes. 2013-12-05 21:35:52 +00:00
Andreas Tobler
05e1c598cc Increase PHYS_AVAIL_SZ because on pSeries machines we can have many logical
regions which represent the total amount of memory. The size of these regions
is not the physical size of the chip but it is a logical one and it is given
by the OpenFirmware, it is selectable at boot time and varies between 16MB and
256MB in my case. There is an 'automatic' option which would select the size as
64MB in case you have around 16GB of RAM.
To make sure we can allocate RAM with the automatic option bump this value
of PHYS_AVAIL_SZ to 256.
2013-12-05 21:34:33 +00:00
Andreas Tobler
6df3000ccd In case we have many continous regions without gaps we have to make soure that
we collapse them into one region. The previous version missed to go back one
step and do it again.
2013-12-05 21:25:56 +00:00
Nathan Whitehorn
c5476f1b8b Fix typo. 2013-12-02 22:00:15 +00:00
Nathan Whitehorn
fa6b4c32ba Remove fdtbus_bs_tag definition, which is now obsolete. The remainder of
this file is also slated for future demolition.
2013-12-02 17:45:43 +00:00
Nathan Whitehorn
4aa3cee65a Revert last few revisions; apologies for the noise. There are very rare,
broken systems that require SPRG state to be preserved.
2013-12-01 19:59:36 +00:00
Nathan Whitehorn
c7291bdcd0 Deleted one line too many. 2013-12-01 19:56:30 +00:00
Nathan Whitehorn
ff4ae2ead1 No actual hardware supported by FreeBSD requires this SPRG save/restore
paranoia, so kill it. In particular, changes to SPRG0 are dangerous, since
that is where the PCPU pointer is kept.
2013-12-01 19:45:04 +00:00
Nathan Whitehorn
c1cb22d755 Rearchitect platform memory map parsing to make it less
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
2013-12-01 19:43:15 +00:00
Nathan Whitehorn
9d2c48c0e3 Remove unnecessary double-setting of the thread's onfault state in
copyinstr().
2013-12-01 17:29:07 +00:00
Nathan Whitehorn
3df046183e The kernel stack guard pages are only below the stack pointer, not above.
Prevent erroneous detection of stack overflows on legitimate faults on the
page after this thread's stack.

MFC after:	3 days
2013-12-01 17:28:28 +00:00
Eitan Adler
7a22215c53 Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this
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
2013-11-30 22:17:27 +00:00
Andreas Tobler
86b2b302f9 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.
2013-11-30 21:54:55 +00:00
Pawel Jakub Dawidek
f2b525e6b9 Make process descriptors standard part of the kernel. rwhod(8) already
requires process descriptors to work and having PROCDESC in GENERIC
seems not enough, especially that we hope to have more and more consumers
in the base.

MFC after:	3 days
2013-11-30 15:08:35 +00:00
Nathan Whitehorn
e30a29aa7c 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.
2013-11-29 21:59:03 +00:00
Rui Paulo
19107ce5e7 Add an interface for the Wii IOS kernels.
Multiple IOS interfaces can exist at the same time.
2013-11-29 00:40:32 +00:00
Andreas Tobler
a07c08cea5 Give some output about the CPU clock on IBMPOWER machines, currently read
from OF. Linux does it similar, means they also read the OF values and
display them.

Tested under qemu and real hardware:

	cpu0: IBM POWER5+ revision 2.0, 1898.10 MHz
2013-11-28 21:57:17 +00:00
Nathan Whitehorn
9b00150b2c This driver doesn't need the /options node, so don't check for it. 2013-11-27 22:02:55 +00:00
Nathan Whitehorn
a0d0d6d88b badaddr() is used only in the grackle PCI driver, so move its definition
there. Clean up a spurious setfault() declaration as well.
2013-11-27 22:01:09 +00:00
Nathan Whitehorn
1679c30254 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
drvier). 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.
2013-11-27 21:51:34 +00:00
Andreas Tobler
90653c1c5c Take care to handle the full 16 byte buffer in the get/put routines. Also,
skip the VTERM header once when receiving data from the hypervisor call when
we have a HVTERMPROT connection.

MFC after:	1 week
2013-11-26 05:26:10 +00:00
Attilio Rao
54366c0bd7 - For kernel compiled only with KDTRACE_HOOKS and not any lock debugging
option, unbreak the lock tracing release semantic by embedding
  calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined
  version of the releasing functions for mutex, rwlock and sxlock.
  Failing to do so skips the lockstat_probe_func invokation for
  unlocking.
- As part of the LOCKSTAT support is inlined in mutex operation, for
  kernel compiled without lock debugging options, potentially every
  consumer must be compiled including opt_kdtrace.h.
  Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the
  dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES
  is linked there and it is only used as a compile-time stub [0].

[0] immediately shows some new bug as DTRACE-derived support for debug
in sfxge is broken and it was never really tested.  As it was not
including correctly opt_kdtrace.h before it was never enabled so it
was kept broken for a while.  Fix this by using a protection stub,
leaving sfxge driver authors the responsibility for fixing it
appropriately [1].

Sponsored by:	EMC / Isilon storage division
Discussed with:	rstone
[0] Reported by:	rstone
[1] Discussed with:	philip
2013-11-25 07:38:45 +00:00
Andreas Tobler
f367ffdecc 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.

Discussed with:		nwhitehorn
MFC after:	1 week
2013-11-23 18:58:17 +00:00
Andreas Tobler
4af7c8949e Limit the large page size to 16MB for now.
MFC after:	1 week
2013-11-23 18:52:14 +00:00
Nathan Whitehorn
e941e1e94a 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 after:	1 week
2013-11-21 15:41:52 +00:00
Justin Hibbits
c27f33b56c Remove stale comment. The PID provider is handled elsewhere already. 2013-11-21 06:54:28 +00:00
Justin Hibbits
776fd11e30 Add a sysctl to allow disabling resetting the OF syscons.
On some machines (G5 with lots of RAM), entering OF sometimes causes the
machine to hang.  Once the machine is booted, currently the only entry point
into OF is through resetting the framebuffer on mode switch on these machines.
Disabling this allows the machine to stay up at the expense of less usable
consoles after X is started.

MFC after:	Never, this is only a hack
2013-11-17 20:29:33 +00:00
Nathan Whitehorn
8ec08b0a21 #interrupt-cells belongs to the iparent, not the device parent. 2013-11-17 19:50:50 +00:00