Commit graph

1747 commits

Author SHA1 Message Date
Attilio Rao de138ec703 MFC 2011-06-24 16:35:40 +00:00
Nathan Whitehorn e69dff491d Use the ABI-mandated thread pointer register (r2 for ppc32, r13 for ppc64)
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
2011-06-23 22:21:28 +00:00
Nathan Whitehorn 045aee08f3 Clear any outstanding atomic reservations when traps are taken. This fixes
some interesting bugs (mostly on SMP systems) with atomic operations
silently failing in interrupt heavy situations, especially when using
overflow pages.
2011-06-23 16:34:41 +00:00
Andreas Tobler dcf496e844 Fix merge typo. 2011-06-23 09:46:12 +00:00
Andreas Tobler f7688a4194 Add leading zeros when printing the stackframe on __powerpc64__. 2011-06-23 09:43:53 +00:00
Nathan Whitehorn f574af0d6d Use atomic operations to mask and unmask IRQs. This prevents a problem
(obvious in retrospect) in which interrupts on one CPU that are temporarily
masked can end up permanently masked when a handler on another CPU clobbers
the interrupt mask register with an old copy.
2011-06-23 04:35:45 +00:00
Nathan Whitehorn 1c167648c9 Use 4 KB pages for storage bus devices, which seems to be what the HV uses
internally.
2011-06-23 04:06:33 +00:00
Nathan Whitehorn 98934b1fd5 Rework the PS3 disk driver to support NCQ and do its DMA a little
differently.
2011-06-23 03:37:25 +00:00
Nathan Whitehorn 67de2cd330 Add hypervisor call error codes. 2011-06-23 03:20:11 +00:00
Attilio Rao 9b571ec6b3 MFC 2011-06-22 19:42:32 +00:00
Nathan Whitehorn cb705160c6 This is more complicated than I expected. Storage devices need the IOMMU
set up, but must not use it.
2011-06-22 02:23:18 +00:00
Nathan Whitehorn 32638a3a01 The IOMMU is not involved for the storage bus. 2011-06-22 02:11:42 +00:00
Attilio Rao 49ea5c076c MFC 2011-06-21 09:09:53 +00:00
Nathan Whitehorn 044ae57637 Work/hack around some race conditions present in the hardware/HV interface.
Partially inspired by a patch from glevand (geoffrey.levand@mail.ru).
2011-06-20 02:17:34 +00:00
Nathan Whitehorn dfcd47a78d Make this slightly less yelly about regions that the hypervisor protects
from us by not registering them as disks.
2011-06-20 01:43:18 +00:00
Nathan Whitehorn 9ba8a92787 Add an OHCI driver to complement the EHCI one. The infrastructure to attach
both to the parent ps3bus was in r223313. This driver itself comes from the
ps3 project branch.
2011-06-20 00:46:07 +00:00
Nathan Whitehorn 0d3170573e Driver for PS3's internal hard disk. Hopefully this can be CAM-ified in
the future, but presents a set of simple block devices for now. With
(forthcoming) boot loader support or vfs.root.mountfrom, allows booting
PS3s from disk.

Submitted by:	glevand <geoffrey.levand@mail.ru>
2011-06-20 00:17:44 +00:00
Attilio Rao c7c2767e33 Remove pc_other_cpus and pc_cpumask usage from powerpc support.
Tested and reviewed by:	andreast
2011-06-16 07:27:13 +00:00
Nathan Whitehorn 698ef695bc Follow up r222980 on PowerPC: add sound(4) and common device drivers
to PowerPC GENERIC (along with a small rearrangement).
2011-06-11 12:34:08 +00:00
Attilio Rao 3bce356ea4 MFC 2011-06-04 22:05:20 +00:00
Andreas Tobler 03c6aeca84 Add new fan controller driver for the G4 MDD PowerMac. Submitted and tested
by Justin Hibbits.

Approved by:	nwhitehorn (mentor)
2011-06-04 15:17:35 +00:00
Andreas Tobler 564a091bd2 - Improve error handling.
- Add retry loops for the i2c read/write functions.

Approved by:	nwhitehorn (mentor)
2011-06-04 09:25:59 +00:00
Nathan Whitehorn d8c6808ade Retry the memory map-related portions of r222613, written by andreast,
after some minor tweaks and an increase in the early-boot stack space in
r222632.
2011-06-04 04:00:40 +00:00
Nathan Whitehorn 4770f5380e Fix a typo derived from a mismerge from mmu_oea that would cause
pmap_sync_icache() to sync random (possibly uncached or nonexisting!)
memory, causing kernel page faults or machine checks, most easily
triggered by using GDB. While here, add an additional safeguard to only
sync cacheable memory.

MFC after:	2 days
2011-06-04 03:22:16 +00:00
Andreas Tobler 7736fb1874 - Introduce a define for ZERO_C_TO_K.
- Fix the printing of the temperature when we exceed the critical value.

Approved by:	nwhitehorn (mentor)
2011-06-03 20:43:12 +00:00
Attilio Rao d7073a2b3b MFC 2011-06-03 17:09:15 +00:00
Nathan Whitehorn cd507188bc Quantities stored on the stack on ppc64 tend to be twice as large as on
ppc32, so make the early stack correspondingly twice as big.
2011-06-03 00:11:13 +00:00
Nathan Whitehorn 48174c14b5 Temporarily back out those parts of r222613 related to parsing the memory
map. They cause non-understood boot failures on some Apple machines with
more than 2 GB of RAM (like my work desktop).
2011-06-02 17:43:17 +00:00
Nathan Whitehorn 17763042e4 The POWER7 has only 32 SLB slots instead of 64, like other supported
64-bit PowerPC CPUs. Add infrastructure to support variable numbers of
SLB slots and move the user slot from 63 to 0, so that it is always
available.
2011-06-02 14:25:52 +00:00
Nathan Whitehorn 1dff98d9bb If running under a hypervisor, don't yell at the user about starting
unknown CPU types, instead relying on the hypervisor to have given us a
reasonable environment.
2011-06-02 14:23:36 +00:00
Nathan Whitehorn 20ae1015b9 Explicitly initialize the first thread's MSR to PSL_KERNSET. 2011-06-02 14:21:20 +00:00
Nathan Whitehorn 6dd24ab3f1 Include the modules area in the mapped kernel code. This fixes the kernel's
access to modules and loader metadata when started from real mode, but
without a direct map.
2011-06-02 14:19:18 +00:00
Nathan Whitehorn 97f7cde42c Remove some dead code: unnecessary isyncs and memory sorting, which are
handled in mtmsr() and mem_regions(), respectively.
2011-06-02 14:15:44 +00:00
Nathan Whitehorn 1787909001 MFpseries:
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@)
2011-06-02 14:12:37 +00:00
Attilio Rao 61b926921f MFC 2011-05-31 21:22:44 +00:00
Nathan Whitehorn d098f93019 On multi-core, multi-threaded PPC systems, it is important that the threads
be brought up in the order they are enumerated in the device tree (in
particular, that thread 0 on each core be brought up first). The SLIST
through which we loop to start the CPUs has all of its entries added with
SLIST_INSERT_HEAD(), which means it is in reverse order of enumeration
and so AP startup would always fail in such situations (causing a machine
check or RTAS failure). Fix this by changing the SLIST into an STAILQ,
and inserting new CPUs at the end.

Reviewed by:	jhb
2011-05-31 15:11:43 +00:00
Attilio Rao 5b6ea0b538 MFC 2011-05-31 14:18:10 +00:00
Nathan Whitehorn 9d2a3635c1 Use kproc_exit() instead of returning from the management function on
systems with no manageable thermal control devices.
2011-05-29 22:37:23 +00:00
Nathan Whitehorn d015abb774 Add some error handling here: if a sensor returns an error code (a negative
Kelvin temperature, which is impossible except for some contrived magnetic
spin systems), use the previous measurement from that sensor instead of
corrupting everything and randomly changing the fans or shutting off the
machine.
2011-05-29 20:46:53 +00:00
Nathan Whitehorn d54e775e1e Add the next digit of precision to temperatures, which I missed when
converting the reporting format from degrees C to 0.1 degree K.
2011-05-29 20:04:02 +00:00
Nathan Whitehorn cbfd4d0cbc Don't put negative values into the averages. 2011-05-29 19:53:11 +00:00
Nathan Whitehorn 815d7d92c1 Update the I2C-based temperature/fan drivers to connect to the Powermac
thermal control module. This provides automatic fan management on all G5
PowerMacs and Xserves.
2011-05-29 18:35:57 +00:00
Attilio Rao da3dd8b7ab MFC 2011-05-29 18:33:13 +00:00
Andreas Tobler d188174a4f Add a new driver, the ad7417, to read temperatures and voltages on some
PowerMac's.

Approved by:	nwhitehorn (mentor)
2011-05-29 14:25:42 +00:00
Attilio Rao c7df91af4b MFC 2011-05-29 00:59:38 +00:00
Marcel Moolenaar 5f94931e7d The P4080 has 8 cores. Bump MAXCPU to 8 to match. 2011-05-29 00:40:59 +00:00
Marcel Moolenaar ebfbeb83f6 o Add system versions for the P4040(E) and P4080(E).
o   In bare_probe(), change the logic that determines the maximum
    number of processors/cores into a switch statement and take
    advantage of the fact that bit 3 of the SVR value indicates
    whether we're running on a security enabled version. Since we
    don't care about that here, mask the bit. All -E versions
    are taken care of automatically.
2011-05-29 00:27:42 +00:00
Nathan Whitehorn 66e2bfe830 Adapt smusat(4) to use powermac_thermal. This provides automatic fan
management on dual- and quad-core Powermac G5s, and the last G5 iMacs.
2011-05-28 22:11:22 +00:00
Nathan Whitehorn ad84e440a6 Require an error instead of a timeout to decide the new-style fan
commands won't work. This prevents a busy system from making smu(4)
suddenly decide its fans use the old-style command set.

MFC after:	3 days
2011-05-28 21:54:18 +00:00
Nathan Whitehorn 84d7767618 Factor out the SMU fan management code into a new module (powermac_thermal)
that will connect all of the various sensors and fan control modules on
Apple hardware with software-controlled fans (e.g. all G5 systems).

MFC after:	1 month
2011-05-28 21:13:22 +00:00