Commit Graph

49 Commits

Author SHA1 Message Date
Andreas Tobler
ec664c11dc Fix null string handling in ofw_real_nextprop function. Pass the right
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)
2011-01-05 21:38:02 +00:00
Nathan Whitehorn
fe3b4685c7 Remove use of a separate ofw_pmap on 32-bit CPUs. Many Open Firmware
mappings need to end up in the kernel anyway since the kernel begins
executing in OF context. Separating them adds needless complexity,
especially since the powerpc64 and mmu_oea64 code gave up on it a long
time ago.

As a side effect, the PPC ofw_machdep code is no longer AIM-specific,
so move it to powerpc/ofw.
2010-11-12 05:12:38 +00:00
Nathan Whitehorn
680a18f951 Map the Open Firmware framebuffer console with write combining turned on,
and set memory attributes appropriately for mmap() calls on /dev/console.
Xorg no longer uses /dev/console to mmap the framebuffer, so framebuffer
write combining support in X will arrive in the next patch.
2010-10-01 19:02:31 +00:00
Marius Strobl
cdb25d827e Change OF_interpret() to also take an array of cell_t (missed in r209801).
Reviewed by:	nwhitehorn
2010-09-11 18:55:00 +00:00
Nathan Whitehorn
900d6c6a00 Make ofw_syscons work on 64-bit systems. 2010-07-08 14:40:46 +00:00
Nathan Whitehorn
70d75337eb Fix several bugs in the real-mode Open Firmware implementation and provide
a virtual-mode version for use on 64-bit systems, which have 32-bit
firmware implementations and require similar constraints on addressing
to the real-mode implementation.
2010-07-08 14:35:35 +00:00
Nathan Whitehorn
054e5dcbe4 Change the argument type to OF_call_method to take an array of cell_t
instead of unsigned longs to prepare for platforms where they are not
the same.
2010-07-08 14:29:23 +00:00
Nathan Whitehorn
8aa8e94d34 Add MSI support for PCI devices attached to the CPC925 and CPC945 bridges
found in Apple and IBM G5 systems.
2010-06-18 17:39:56 +00:00
Nathan Whitehorn
a7a32004a4 Change the default interrupt polarity on PowerPC systems from high to low.
On Apple systems at least, all the level interrupts are wired active low.
Before this change, our PIC programming only worked because Apple hardware
ignores the interrupt polarity bit on all interrupts except IRQ 0.
2010-06-18 14:16:24 +00:00
Nathan Whitehorn
eaef5f0af8 Provide for multiple, cascaded PICs on PowerPC systems, and extend the
OFW interrupt map interface to also return the device's interrupt parent.

MFC after:	8.1-RELEASE
2010-06-18 14:06:27 +00:00
Nathan Whitehorn
96c170aa1a Modify the console mouse pointer drawing routine to use single-byte writes
instead of 4-byte ones. Because the mouse pointer can start part way
through a character cell, 4-byte memory operations are not necessarily
aligned, triggering a fatal alignment exception when the console pointer
was moved on PowerPC G5 systems.

MFC after:	3 days
2010-06-15 22:01:38 +00:00
Rafal Jaworowski
8297758a22 Prepare and extend OFW layer for FDT support.
o Let OFW_INIT() and OF_init() return status value.

o Provide helper routines for 'compatible' property handling.

o Only compile OF and OFW code, which is relevant in FDT scenario.

o Other minor cosmetics

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
2010-05-28 10:43:56 +00:00
Nathan Whitehorn
4a26780b9a Pull OF_quiesce() out of the MI Open Firmware layer and entirely into
PPC ofw_machdep.c, in recognition of its state as a machine specific hack.

Requested by:	marius
2010-05-16 22:01:43 +00:00
Nathan Whitehorn
4dea0435b5 Relocate interrupt sense setting for K2 SATA from the ATA driver to the
OFW PCI layer and read the sense directly from the device tree instead
of guessing.

MFC after:	1 week
2010-05-16 17:55:09 +00:00
Nathan Whitehorn
79bf3fcd18 On PowerMac11,2 and (presumably) PowerMac12,1, we need to quiesce the
firmware in order to take over control of the SMU. Without doing this,
the firmware background process doing fan control will run amok as we
take over the system and crash the management chip.

This is limited to these two machines because our kernel is heavily
dependent on firmware accesses, and so quiescing firmware can cause
nasty problems.
2010-05-16 15:56:59 +00:00
Marius Strobl
bd7e69e4c5 With r205496 in place we should ensure that nargs and nreturns are always
set to sane values as they no longer default to 0, otherwise some OFW
implementation might copy in or out arguments not based on what the actual
function takes but what ever stack garbage nargs and nreturns supply.

Reviewed by:	nwhitehorn
2010-04-02 21:48:27 +00:00
Nathan Whitehorn
e0cbed6815 Set hw.ofwfb.relax_mmap=1 by default. While these checks may be a good
idea in principle, X does not work without them on basically any hardware,
and this is probably the most frequent problem people run into on PowerPC.

Prodded by:	rnoland
MFC after:	1 week
2010-03-28 17:17:32 +00:00
Nathan Whitehorn
d4bccd63a2 Do not declare the various OFW command buffers static. It does not
appear to be necessary on either sparc64 or powerpc, and is a
concurrency nightmare.

Reviewed by:	marius
2010-03-23 01:09:45 +00:00
Robert Noland
cfd7bacef2 Update d_mmap() to accept vm_ooffset_t and vm_memattr_t.
This replaces d_mmap() with the d_mmap2() implementation and also
changes the type of offset to vm_ooffset_t.

Purge d_mmap2().

All driver modules will need to be rebuilt since D_VERSION is also
bumped.

Reviewed by:	jhb@
MFC after:	Not in this lifetime...
2009-12-29 21:51:28 +00:00
Andriy Gapon
4fc23012c6 strict kobj signatures: some ofw_setprop fixes
propname parameter is const

Reviewed by:	imp, current@
Approved by:	jhb (mentor)
2009-06-11 17:15:20 +00:00
Nathan Whitehorn
9eb9db93da Introduce support for cpufreq on PowerPC with the dynamic frequency
switching capabilities of the MPC7447A and MPC7448.
2009-05-31 09:01:23 +00:00
Nathan Whitehorn
8446b20662 Add an Open Firmware access module for real-mode OF accesses to the PowerPC
build. This is required for the IBM Mambo simulator, as well as a variety
of non-Apple PowerPC hardware.
2009-04-05 18:40:15 +00:00
Nathan Whitehorn
1c96bdd146 Add support for 64-bit PowerPC CPUs operating in the 64-bit bridge mode
provided, for example, on the PowerPC 970 (G5), as well as on related CPUs
like the POWER3 and POWER4.

This also adds support for various built-in hardware found on Apple G5
hardware (e.g. the IBM CPC925 northbridge).

Reviewed by:    grehan
2009-04-04 00:22:44 +00:00
Nathan Whitehorn
94b4a038a1 Adapt parts of the sparc64 Open Firmware bus enumeration code (in particular,
the code for parsing interrupt maps) to PowerPC and reflect their new MI
status by moving them to the shared dev/ofw directory.

This commit also modifies the OFW PCI enumeration procedure on PowerPC to
allow the bus to find non-firmware-enumerated devices that Apple likes to add,
and adds some useful Open Firmware properties (compat and name) to the pnpinfo
string of children on OFW SBus, EBus, PCI, and MacIO links. Because of the
change to PCI enumeration on PowerPC, X has started working again on PPC
machines with Grackle hostbridges.

Reviewed by:	marius
Obtained from:	sparc64
2008-12-15 15:31:10 +00:00
Nathan Whitehorn
68124cc7f8 Allow OFW syscons to restore itself when the X server exits or there is a VT switch
by redoing the Open Firmware card initialization calls in ofwfb_set_mode(). This
uses the same trick (setting V_ADP_MODECHANGE) to arrange this as machfb(4) and
creatorfb(4).
2008-12-13 20:53:57 +00:00
Nathan Whitehorn
05156b9b7e Add support for a console mouse pointer on Open Firmware syscons.
MFC after:	7.1-RELEASE
2008-12-13 20:13:22 +00:00
Nathan Whitehorn
fc7a9640c7 Prevent the OF syscons module from trying to attach to real devices on the
nexus by only attaching to a device with no OF node.
2008-10-15 03:38:03 +00:00
Nathan Whitehorn
51d163d3e9 Convert PowerPC AIM PCI and nexus busses to standard OFW bus interface. This
simplifies certain device attachments (Kauai ATA, for instance), and makes
possible others on new hardware.

On G5 systems, there are several otherwise standard PCI devices
(Serverworks SATA) that will not allow their interrupt properties to be
written, so this information must be supplied directly from Open Firmware.

Obtained from:	sparc64
2008-10-14 14:54:14 +00:00
Maxim Sobolev
d3e5e8d1b6 Improve rev 183168, so that if /chosen/stdout is connected to the serial
port by OF the syscons won't take over console. Only attach syscons to "screen"
if /chosen/stdout is not connected, which could be the case when loader(8)
is booted directly from the OF. This fixes Marcel's Xserver.

Reported by:	marcel
2008-09-23 22:16:23 +00:00
Maxim Sobolev
ccb33393cc When attaching framebuffer to "/chosen/stdout" node fails, try attaching
to "screen" node directly. The problem is that by default OF on some (all?)
Macs either doesn't provide "/chosen/stdout" or redirects it somewhere,
unless you boot in manual mode via CMD-ALT-O-F. It's nice to see normal
FreeBSD boot output instead of blank gray screen.
2008-09-19 03:22:47 +00:00
John Baldwin
04dda605c5 - Make pcib_devclass private to sys/dev/pci/pci_pci.c and change all the
various pcib drivers to use their own private devclass_t variables for
  their modules.
- Use the DEFINE_CLASS_0() macro to declare drivers for the various pcib
  drivers while I'm here.
2006-01-06 19:22:19 +00:00
Marius Strobl
b7c96c0d0b Add a font width argument to vi_load_font_t, vi_save_font_t and vi_putm_t
and do some preparations for handling 12x22 fonts (currently lots of code
implies and/or hardcodes a font width of 8 pixels). This will be required
on sparc64 which uses a default font size of 12x22 in order to add font
loading and saving support as well as to use a syscons(4)-supplied mouse
pointer image.
This API breakage is committed now so it can be MFC'ed in time for 6.0
and later on upcoming framebuffer drivers destined for use on sparc64
and which are expected to rely on using font loading internally and on
a syscons(4)-supplied mouse pointer image can be easily MFC'ed to
RELENG_6 rather than requiring a backport.

Tested on:	i386, sparc64, make universe
MFC after:	1 week
2005-09-28 14:54:07 +00:00
Peter Grehan
1f0baa8e5f Remove unnecessary and alarming printf.
MFC after:  1 day
2005-08-16 02:38:02 +00:00
Peter Grehan
bd8fa19da3 Quick hack-o-rama to allow the Xorg Radeon driver to start up. It
tries to mmap memory outside of the available BARs, so allow the
range checks to be relaxed with a sysctl.
2005-05-21 00:22:57 +00:00
Peter Grehan
eb1c12f028 Optimize putc routine to write 2 ints instead of 8 chars to uncached
framebuffer memory. Speeds up system time of large ascii file cat
by 4x.

Inspired by:  Linux scrolling so damned fast.
2005-03-19 01:43:29 +00:00
Peter Grehan
b4ac36978f Mods for Xorg server:
- store assigned PCI addresses at cninit time for later mmap range
   check
 - implement set_border to scrub X remnants when switching back to VTYs
 - implement mmap, only allowing addresses within the range of the
   console adapter.
2005-02-25 02:29:01 +00:00
Warner Losh
60727d8b86 /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
Marius Strobl
39513fa664 Instead of "OpenFirmware", "openfirmware", etc. use the official spelling
"Open Firmware" from IEEE 1275 and OpenFirmware.org (no pun intended).

Ok'ed by:	tmm
2004-08-16 15:45:27 +00:00
Peter Grehan
dbc13869ee Advertise that color is supported so that syscons doesn't come up
in monochrome mode when run as init.
2004-08-16 06:26:15 +00:00
Peter Grehan
45329b8ee6 Add 32-bit framebuffer support. Tested on PearPC at lo-res, too painful
to watch at hi-res.
2004-07-06 03:22:05 +00:00
Peter Grehan
40cdee9dab Catchup to now-required <sys/module.h> for PowerPC 2004-06-25 13:42:48 +00:00
Poul-Henning Kamp
89c9c53da0 Do the dreaded s/dev_t/struct cdev */
Bump __FreeBSD_version accordingly.
2004-06-16 09:47:26 +00:00
Peter Grehan
439696f355 Correctly create interrupt key for PCI, which is the OpenFirmware
pci-hi/med/lo + node 'interrupts' property. This worked by
accident until recent notebooks required correct operation.

Tested by:  Suleiman Souhlal <refugee@segfaulted.com>
2004-02-10 23:57:35 +00:00
Peter Grehan
462ded3729 A syscons implementation using the 8-bit framebuffer set up by
OpenFirmware. Not at all optimized, but provides a PC-style
user-experience.

Tested on revA imac, B&W G3, 2k iBook, and G4 eMac.
2004-01-21 05:16:23 +00:00
Warner Losh
d2c5276d96 Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.
2003-08-22 07:39:05 +00:00
Peter Grehan
03f5c00144 Simplify ofw_pci_fixup(). It doesn't need to be recursive, since the
bridge code already handles IRQ adjustment on the far side of a bridge.

Reviewed by:  benno
2003-03-03 12:05:06 +00:00
Benno Rice
f13d93ce55 Make ofw_pci_find_node() use the reg property instead of the
assigned-addresses property. This works a lot better.
2003-01-09 12:24:19 +00:00
Benno Rice
a65a280612 Add a pcib variant to allow us to fix up interrupt assignments.
We probably want to do something wrt bus enumeration as well at some point.
2003-01-09 12:04:18 +00:00
Benno Rice
2686f05627 OpenFirmware PCI support code.
This and the sparc64 equivalent should probably be merged at some point.
2002-07-09 13:27:58 +00:00