Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/macppc/dev/obio.c
RevisionDateAuthorComments
 1.54  20-Aug-2025  macallan add support for Xserve G4:
- fan control via pwm, works the same way as fcu and smu, zones can be
controlled via sysctl machdep.obio0
- add sysctls for pwms ( can be set ) and gpios ( read only )
- control indicator LED via sysctl hw.led
 1.53  28-Dec-2022  macallan one more skiplist entry...
 1.52  28-Dec-2022  macallan suppress 'not configured' message for mpic on G5s
 1.51  22-Jan-2022  thorpej Change the devhandle_from_*() functions to also take a "super handle",
from which the newly created handle will inherit it's implementation.
The root implementation for a new handle type is used if an invalid
"super handle" is passed.
 1.50  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.49  24-Apr-2021  thorpej branches: 1.49.8;
Merge thorpej-cfargs branch:

Simplify and make extensible the config_search() / config_found() /
config_attach() interfaces: rather than having different variants for
which arguments you want pass along, just have a single call that
takes a variadic list of tag-value arguments.

Adjust all call sites:
- Simplify wherever possible; don't pass along arguments that aren't
actually needed.
- Don't be explicit about what interface attribute is attaching if
the device only has one. (More simplification.)
- Add a config_probe() function to be used in indirect configuiration
situations, making is visibly easier to see when indirect config is
in play, and allowing for future change in semantics. (As of now,
this is just a wrapper around config_match(), but that is an
implementation detail.)

Remove unnecessary or redundant interface attributes where they're not
needed.

There are currently 5 "cfargs" defined:
- CFARG_SUBMATCH (submatch function for direct config)
- CFARG_SEARCH (search function for indirect config)
- CFARG_IATTR (interface attribte)
- CFARG_LOCATORS (locators array)
- CFARG_DEVHANDLE (devhandle_t - wraps OFW, ACPI, etc. handles)

...and a sentinel value CFARG_EOL.

Add some extra sanity checking to ensure that interface attributes
aren't ambiguous.

Use CFARG_DEVHANDLE in MI FDT, OFW, and ACPI code, and macppc and shark
ports to associate those device handles with device_t instance. This
will trickle trough to more places over time (need back-end for pre-OFW
Sun OBP; any others?).
 1.48  26-Jan-2021  thorpej branches: 1.48.2;
There is not much point in of_compatible() returning -1 for "no match"
and >= 0 for "match". Just make it return 0 for "no match" and >0 for
"match" so it can be treated like a boolean expression.

As such of_match_compatible() (a wrapper around of_compatible()) is now
obsolete, and will be removed once all call sites are converted to an
appropriate replacement.
 1.47  25-Oct-2020  nia branches: 1.47.2;
Normalize some machine dependent CPU frequenct sysctl variables.

This moves machdep.*.frequency.* to machdep.cpu.frequency.*.

This was proposed on tech-kern some time ago. The intention is to allow
third-party tools such as estd and conky to more easily and reliably
fetch or modify the current CPU frequency without iterating through
various machine-dependent variables to check their presence.
 1.46  08-Jun-2018  macallan fix low CPU speed reporting when using DFS
 1.45  04-May-2018  macallan map 64KB register space on G5, provide function to bus_space_subregion()
from this area so we don't run into mapping conflicts on G5
Not really relevant on 32bit where we BAT-map everything
 1.44  29-Mar-2018  macallan don't map more PCI space than needed, avoid overlap with snapper so this has
a chance of working on G5
 1.43  04-Mar-2018  mrg branches: 1.43.2;
avoid indentation issues. re-do previous in obio.c to avoid the
does-nothing change, by fixing the intended indentation.
 1.42  04-Mar-2018  christos add braces.
 1.41  11-Nov-2014  macallan appease gcc 4.8
 1.40  25-Apr-2013  macallan map more register space on Shasta/K2, needed for SMU mailbox registers
 1.39  17-Apr-2013  macallan support Shasta
from Phileas Fogg
 1.38  27-Oct-2012  chs split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.37  02-Jun-2012  dsl branches: 1.37.2;
Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
the item itself.
In the places where the caller specifies a function and a structure
address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
 1.36  19-Oct-2011  macallan branches: 1.36.2;
add cpufreq support
 1.35  01-Aug-2011  macallan sanitize sysctl interface in order to appease gcc 4.5
 1.34  26-Jul-2011  macallan finish device_t-ification
 1.33  18-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
use device accessors, use device_private.
some softc/device_t splits (macppc needs a bunch more)
aprint*_dev used considerably more
 1.32  16-Mar-2011  macallan branches: 1.32.2;
change the CPU speed sysctl to look more like the ACPI ones, as in
machdep.<name>.frequency.available etc. so estd can work with minimal changes
 1.31  05-Dec-2010  phx branches: 1.31.2;
The gpio children have either register offsets based on gpio or on obio.
Implemented a workaround to deal with this uncertainty.
This fixes the machdep.cpu_speed control for 7447A-based iBookG4s.
 1.30  20-Oct-2010  phx Support sysctl machdep.cpu_speed for 7447A and 7448 based Macs. On those
machines the CPU's DFS (Dynamic Frequency Switching) feature is used instead
of a GPIO to control the speed.
Two new functions in powerpc/oea/cpu_subr.c were introduced to support
reading and writing of DFS: cpu_get_dfs() and cpu_set_dfs(). Also works
for multiple CPUs, but not before interrupts are enabled.
 1.29  14-Mar-2009  dsl branches: 1.29.2; 1.29.4;
Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
 1.28  26-Sep-2008  macallan branches: 1.28.2; 1.28.8;
Provide access functions for mac-io registers in order to get rid of
private mappings some drivers use which won't work anymore in the new
post-ppcoea-renovation world order.
 1.27  17-Oct-2007  garbled branches: 1.27.16; 1.27.20; 1.27.22; 1.27.26;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.26  18-Jan-2007  macallan branches: 1.26.6; 1.26.14; 1.26.22; 1.26.24; 1.26.26; 1.26.28;
fix accidential commit, this time really only add the bus_space_tag
 1.25  18-Jan-2007  macallan pass a bus_space_tag to children
 1.24  05-Aug-2006  sanjayl branches: 1.24.4;
1st cut of Powermac G5 support (uses bridge mode).
 1.23  11-Dec-2005  christos branches: 1.23.4; 1.23.8;
merge ktrace-lwp.
 1.22  05-Jun-2005  nathanw branches: 1.22.2;
constify skiplist.
 1.21  08-Jan-2005  briggs Make obio match multiple times to allow access to devices on systems
where there might be devices under two I/O bridges (like PowerBook G3s).
Attempt to have devices under 'gatwick' share parental interrupt. This
may still need some work, but a step in the right direction.
From Tim Kelly.
 1.20  09-Dec-2004  briggs Apply patch from Makoto Fujiwara (and Timm Wetzel) in PR port-macppc/15505
to enable internal modem for KeyLargo and Pangea.
 1.19  15-Jul-2003  lukem __KERNEL_RCSID()
 1.18  11-Jun-2003  hamajima branches: 1.18.2;
Support the PowerBook G4 12-inch (and maybe 17-inch).
Kauai ATA, new obio chip, and Japanese keymap for WSDISPLAY_COMPAT_RAWKBD

I tested only 12-inch Japanese model.
 1.17  01-Jan-2003  thorpej Use aprint_normal() for cfprint routines.
 1.16  02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.15  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.14  17-Jun-2001  tsubai branches: 1.14.2; 1.14.8; 1.14.18;
Support the new iBook.
 1.13  02-Mar-2001  tsubai branches: 1.13.2;
Enable CD and microphone sound input on paddington based systems.
 1.12  27-Feb-2001  matt Back out change to print irq.
 1.11  27-Feb-2001  matt print out irq on unconf devices.
 1.10  03-Nov-2000  tsubai Get 6 interrupt cells from OF.
 1.9  08-Feb-2000  tsubai branches: 1.9.4;
Fix typo.
 1.8  07-Feb-2000  tsubai Don't print "... not configured" message for non real devices
like escc-legacy.
 1.7  23-Jan-2000  tsubai Match "keylargo".
 1.6  01-May-1999  tsubai branches: 1.6.2;
Find "mac-io" and "/pci/mac-io".
 1.5  22-Dec-1998  tsubai branches: 1.5.2;
Search "interrupts" property if "AAPL,interrupts" is not found.
 1.4  03-Nov-1998  tsubai Add "Paddington" ID.
 1.3  13-Jul-1998  tsubai Add support for G3 Mac.
 1.2  21-Jun-1998  tsubai Add support for "ohare" I/O controller.
 1.1  15-May-1998  tsubai Initial import of macppc port.
 1.5.2.1  06-May-1999  perry branches: 1.5.2.1.2;
pullup 1.5->1.6 (thorpej)
 1.5.2.1.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.6.2.3  12-Mar-2001  bouyer Sync with HEAD.
 1.6.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.6.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.9.4.1  18-Jun-2001  jhawk Pull up revision 1.14 (requested by tsubai):
Support the new dual USB iBook.
 1.13.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.14.18.1  19-Jun-2003  grant Pull up revision 1.18 (requested by hamajima in ticket #1323):

Support the PowerBook G4 12-inch (and maybe 17-inch).
Kauai ATA, new obio chip, and Japanese keymap for WSDISPLAY_COMPAT_RAWKBD
 1.14.8.3  03-Jan-2003  thorpej Sync with HEAD.
 1.14.8.2  18-Oct-2002  nathanw Catch up to -current.
 1.14.8.1  17-Jun-2001  nathanw file obio.c was added on branch nathanw_sa on 2002-10-18 02:38:36 +0000
 1.14.2.1  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.18.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.18.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.18.2.4  18-Dec-2004  skrll Sync with HEAD.
 1.18.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.18.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.18.2.1  03-Aug-2004  skrll Sync with HEAD
 1.22.2.3  27-Oct-2007  yamt sync with head.
 1.22.2.2  26-Feb-2007  yamt sync with head.
 1.22.2.1  30-Dec-2006  yamt sync with head.
 1.23.8.1  11-Aug-2006  yamt sync with head
 1.23.4.1  09-Sep-2006  rpaulo sync with head
 1.24.4.1  01-Feb-2007  ad Sync with head.
 1.26.28.1  25-Oct-2007  bouyer Sync with HEAD.
 1.26.26.1  18-Oct-2007  yamt sync with head.
 1.26.24.1  06-Nov-2007  matt sync with HEAD
 1.26.22.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.26.14.3  14-Aug-2007  macallan add support for bus speed control found in some Intrepid-based *Books,
like the 800MHz iBook G4
 1.26.14.2  18-Jun-2007  macallan fix a couple typos and don't forget to initialize ca_tag before using it
 1.26.14.1  07-Jun-2007  garbled Convert macppc to powerpc bus_space. Lots of work here from Matt Thomas,
as well as the common ofwoea code from myself. Compile tested only,
still probably needs some fine tuning.

Also in this commit:
Convert macppc to new shared ofwoea routines.
Lots of KNF.
 1.26.6.1  23-Oct-2007  ad Sync with head.
 1.27.26.1  19-Oct-2008  haad Sync with HEAD.
 1.27.22.1  10-Oct-2008  skrll Sync with HEAD.
 1.27.20.1  04-May-2009  yamt sync with head.
 1.27.16.1  28-Sep-2008  mjf Sync with HEAD.
 1.28.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.28.2.1  28-Apr-2009  skrll Sync with HEAD.
 1.29.4.2  21-Apr-2011  rmind sync with head
 1.29.4.1  05-Mar-2011  rmind sync with head
 1.29.2.1  22-Oct-2010  uebayasi Sync with HEAD (-D20101022).
 1.31.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.32.2.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.36.2.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.36.2.1  30-Oct-2012  yamt sync with head
 1.37.2.3  03-Dec-2017  jdolecek update from HEAD
 1.37.2.2  23-Jun-2013  tls resync from head
 1.37.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.43.2.3  25-Jun-2018  pgoyette Sync with HEAD
 1.43.2.2  21-May-2018  pgoyette Sync with HEAD
 1.43.2.1  30-Mar-2018  pgoyette Resolve conflicts between branch and HEAD
 1.47.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.48.2.2  04-Apr-2021  thorpej Associate the OpenFirmware phandle associated with a found device (including
PCI bus instances) by using CFARG_DEVHANDLE.
 1.48.2.1  21-Mar-2021  thorpej Give config_found() the same variadic arguments treatment as
config_search(). This commit only adds the CFARG_EOL sentinel
to the existing config_found() calls. Conversion of config_found_sm_loc()
and config_found_ia() call sites will be in subsequent commits.
 1.49.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed