Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/macppc/dev/ofb.c
RevisionDateAuthorComments
 1.73  20-Dec-2023  thorpej Remove unnecessary <sys/malloc.h>.
 1.72  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.71  24-Apr-2021  thorpej branches: 1.71.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.70  23-May-2016  chs branches: 1.70.32;
remove unused variables.
 1.69  27-Oct-2012  chs branches: 1.69.14;
split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
 1.68  13-Mar-2012  elad branches: 1.68.2;
Replace the remaining KAUTH_GENERIC_ISSUSER authorization calls with
something meaningful. All relevant documentation has been updated or
written.

Most of these changes were brought up in the following messages:

http://mail-index.netbsd.org/tech-kern/2012/01/18/msg012490.html
http://mail-index.netbsd.org/tech-kern/2012/01/19/msg012502.html
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012728.html

Thanks to christos, manu, njoly, and jmmv for input.

Huge thanks to pgoyette for spinning these changes through some build
cycles and ATF.
 1.67  01-Jul-2011  dyoung branches: 1.67.2; 1.67.6;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.66  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.65  20-Dec-2010  matt branches: 1.65.6;
Move counting of faults, traps, intrs, soft[intr]s, syscalls, and nswtch
from uvmexp to per-cpu cpu_data and move them to 64bits. Remove unneeded
includes of <uvm/uvm_extern.h> and/or <uvm/uvm.h>.
 1.64  06-May-2009  elad branches: 1.64.4;
Replace curlwp->l_cred with kauth_cred_get().

Mailing list reference:

http://mail-index.netbsd.org/tech-kern/2009/05/05/msg005038.html
 1.63  26-Nov-2007  garbled branches: 1.63.18; 1.63.32;
Apply a set of patches from Frank Wille to make the genfb attachment work
better on ofppc. In doing so, we also move a few functions around in
macppc and the generic ofw powerpc stuff to allow better sharing of code.
Also, introduce a model_init function.

move ofb_cons.c from macppc/dev to powerpc/oea and rename it to rascons.
This gets rid of some naming confusion, and makes it OFW-MI rather than
macppc specific.
 1.62  17-Oct-2007  garbled branches: 1.62.2;
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.61  05-Aug-2007  macallan branches: 1.61.2;
fix another typo, now wsfb on ofb should work properly
 1.60  24-Jul-2007  macallan branches: 1.60.4;
add support for ioctl(WSDISPLAYIO_LINEBYTES) so XFree86/wsfb should work now.
Doh.
 1.59  21-Jul-2007  ad Don't depend on uvm_extern.h pulling in proc.h.
 1.58  16-Jul-2007  macallan branches: 1.58.2; 1.58.4;
fix a typo - if we pass no parameters to OF_interpret we better don't say
we do...
 1.57  25-Mar-2007  macallan branches: 1.57.4;
attach a drm
 1.56  04-Mar-2007  christos branches: 1.56.2; 1.56.4; 1.56.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.55  28-Feb-2007  thorpej TRUE -> true, FALSE -> false
 1.54  20-Jan-2007  he branches: 1.54.2;
Unify the declaration of OF_interpret() between sparc{,64} and macppc
by adding the "nargs" argument to the macppc version, and fix the macppc
ports uses of OF_interpret() accordingly.

Also move the declaration of OF_interpt() from macppc's autoconf.h to
ofw/openfirm.h. This fixes the build of the macppc port.

Approved by macallan@.
 1.53  16-Dec-2006  macallan (hopefully) fix a panic when ofb attaches without being console
 1.52  08-Nov-2006  macallan branches: 1.52.2;
split ofb into one part that attaches right on kernel startup and one that
attaches to pci so we can build kernels with - say - machfb but without
ofb at pci.
 1.51  05-Aug-2006  sanjayl branches: 1.51.4; 1.51.6;
1st cut of Powermac G5 support (uses bridge mode).
 1.50  23-Jul-2006  ad Use the LWP cached credentials where sane.
 1.49  14-May-2006  elad integrate kauth.
 1.48  12-Apr-2006  jmmv Add an extra cookie to the ioctl and mmap wsdisplay accessops that points
to the screen on which they are being called. The driver cannot guess
this by itself but it is needed to implement, at least, the getwschar and
putwschar functions in the correct place. There are no functional changes
yet.

Tested on i386 (vga, vga_raster, machfb, vesafb), macppc and sparc64.
Suggested and reviewed by macallan@.
 1.47  16-Feb-2006  macallan branches: 1.47.2; 1.47.4; 1.47.6;
also check child nodes when checking if we attach to what OF thinks is the
console since some Radeons ( and probably others ) can have more than one
display - in this case /chosen and ofb's node would mismatch.
 1.46  16-Feb-2006  macallan bail out when trying to attach to something that's not the console.
Fixes problems with more than one graphics card. Since OF doesn't set up
any secondary graphics devices anyway we don't lose anything.
 1.45  12-Feb-2006  macallan Add support for colour and virtual consoles
 1.44  07-Feb-2006  macallan ansify, de-__P(), sprinkle static
 1.43  11-Dec-2005  christos branches: 1.43.2; 1.43.4; 1.43.6;
merge ktrace-lwp.
 1.42  22-Sep-2005  macallan - center output to match firmware settings when using the ROM font
- allow the super user to mmap() the PCI IO area corresponding to ofb at offset
0xf2000000 - needed by some XFree drivers ( approved by Bill Studenmund )
- add a hack to allow mmap()ing offset 0xa0000 - 0xbffff if not covered by the
regular framebuffer mapping at offset 0 ( disabled by default, use options
OFB_FAKE_VGA_FB ) - this allows buggy XFree drivers which expect the VGA
framebuffer at this address to work.
 1.41  17-Dec-2004  briggs branches: 1.41.10;
Back out part of previous. OF_open() works fine with /chaos/control, but
is a bit picky about interrupts.
 1.40  15-Dec-2004  briggs * Don't try to clear the screen if we failed to map it.
* Don't try to call OF_open for /chaos@F0000000/control@B -- it hangs.
 1.39  24-Apr-2004  kleink Update for new pci_devinfo(9) signature.
 1.38  13-Nov-2003  chs eliminate uvm_useracc() in favor of checking the return value of
copyin() or copyout().

uvm_useracc() tells us whether the mapping permissions allow access to
the desired part of an address space, and many callers assume that
this is the same as knowing whether an attempt to access that part of
the address space will succeed. however, access to user space can
fail for reasons other than insufficient permission, most notably that
paging in any non-resident data can fail due to i/o errors. most of
the callers of uvm_useracc() make the above incorrect assumption. the
rest are all misguided optimizations, which optimize for the case
where an operation will fail. we'd rather optimize for operations
succeeding, in which case we should just attempt the access and handle
failures due to insufficient permissions the same way we handle i/o
errors. since there appear to be no good uses of uvm_useracc(), we'll
just remove it.
 1.37  20-Oct-2003  matt Reorganize the way powerpc port install machine specific headers.
Use <powerpc/oea/bat.h> exclusively and remove <machine/bat.h> and
<powerpc/bat.h>. Remove unneeded <machine/cpufunc.h>. To insure
1:1 correspondence of <powerpc/FOO.h> to <machine/FOO.h> include
"../../powerpc/include/Makefile" in "arch/FOO/include/Makefile".
Incororpate <byte_swap.h> into <bswap.h> and then byte_swap.h
 1.36  15-Jul-2003  lukem __KERNEL_RCSID()
 1.35  29-Jun-2003  fvdl branches: 1.35.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.34  29-Jun-2003  darrenr 'struct proc *' -> 'struct lwp *' as required to get GENERIC for macppc built
 1.33  15-Feb-2003  briggs Initialize the framebuffer BAT with BAT_G, too. This marks the region
as (G)uarded, protecting it from the processor being too aggressive in
reordering and prefetching. This allows OFB_ENABLE_CACHE to work on my
Powerbook G4.

Thanks to matt@ for suggesting this fix. "It's the right thing to do."
 1.32  02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.31  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.30  07-Aug-2002  chs for ofb_enable_cache, turn on the BAT_M bit as well to prevent
the framebuffer from getting scrambled on MP systems.
 1.29  07-Jul-2002  matt Update OFB_ENABLE_CACHE to search for a empty bat that does not
conflict the USER_SR or one of the kernel SRs.
 1.28  04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.27  24-Jun-2002  nathanw Pass through the PCI configuration ioctls, like vga_pci.c does.
 1.26  17-Mar-2002  atatat branches: 1.26.4; 1.26.6;
Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command". ERESTART is -1, which can lead to
confusion. ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4. No ioctl code should now return -1 anywhere. The
ioctl() system call is now properly restartable.
 1.25  05-Aug-2001  jdolecek branches: 1.25.6;
use unsigned variable types as appropriate
 1.24  22-Jul-2001  wiz bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
 1.23  10-Jun-2001  tsubai branches: 1.23.2;
Use machine/bat.h rather than powerpc/mpc6xx/bat.h.
 1.22  10-Jun-2001  tsubai Use ofb_softc again.
 1.21  10-Jun-2001  tsubai Enable color! call in ofb_putcmap again.
Matt, please don't remove codes silently without confirmation.
(At least, leave a log message!)
 1.20  08-Jun-2001  matt Make macppc compile by default with -Wall -Wmissing-prototype in addition
to its currently enabled warnings. For the lack of a better place, most
global function prototype wound up in <machine/autoconf.h> unless there
was a better place for them. ofb_* structs renamed to offb_* to avoid
conflict with ofb_softc in <dev/ofw/openfirm.h>
 1.19  06-Jun-2001  matt Changes new pmap, common param.h, vmparam.h, and moved includes.
 1.18  15-Mar-2001  tsubai Use write-through caching for video ram. (Disabled by default, for now.)
 1.17  02-Nov-2000  tsubai branches: 1.17.2;
Don't assume 12x22 font.
 1.16  01-Oct-2000  tsubai Get the correct OF node of the screen because PowerBooks have two screens
in one PCI device.
 1.15  29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.14  26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.13  19-Jun-2000  tsubai branches: 1.13.2;
Allow mmap of frame buffer registers.
 1.12  02-Apr-2000  tsubai branches: 1.12.2;
Make sure color rgb:0/0/0 is black.
 1.11  09-Feb-2000  tsubai Use dev/rasops instead of dev/rcons.
 1.10  06-Dec-1999  drochner update for changed struct wsdisplay_accessops:show_screen signature.
no functional changes
 1.9  24-Mar-1999  mrg branches: 1.9.8; 1.9.14;
completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.8  19-Feb-1999  tsubai Use 6x11 font if screen size is smaller than 1024x768.
(Open Firmware ROM has 6x11 font.)
 1.7  02-Feb-1999  tsubai Don't use BAT register. (not needed now.)
 1.6  11-Jan-1999  drochner remove dummy "load_font" entries
 1.5  22-Dec-1998  tsubai Display frame buffer type when attached.
 1.4  19-Nov-1998  mrg fix problems in many d_mmap routines:
- returned EOPNOTSUPP rather than -1.
- no check for negative offset.
many of these fix potential security problems in these drivers.


XXX XXX XXX
the d_mmap cdev routine should be changed to have a prototype like:
paddr_t (*d_mmap) __P((dev_t, off_t, int));

by someone!
 1.3  15-Oct-1998  tsubai /chaos/control support. (tested 640x480 mode only)
 1.2  14-Oct-1998  tsubai Fix typo.
 1.1  14-Oct-1998  tsubai akbd: wskbd support.
ofb: OpenFirmware generic framebuffer.
 1.9.14.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.9.8.3  27-Mar-2001  bouyer Sync with HEAD.
 1.9.8.2  22-Nov-2000  bouyer Sync with HEAD.
 1.9.8.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.12.2.1  22-Jun-2000  minoura Sync w/ netbsd-1-5-base.
 1.13.2.3  16-Aug-2001  tv Pullup [jdolecek]:

sys/arch/amiga/dev/grf_cl.c 1.26
sys/arch/amiga/dev/grfioctl.h 1.14
sys/arch/hpcmips/dev/plumvideo.c 1.20
sys/arch/macppc/dev/ofb.c 1.25
sys/arch/sparc/dev/cgtwo.c 1.35
sys/arch/sparc/include/fbio.h patch
sys/arch/sparc64/include/fbio.h patch
sys/arch/sun3/dev/cg2.c 1.14
sys/arch/sun3/include/fbio.h patch
sys/dev/pci/tga.c 1.35
sys/dev/tc/cfb.c 1.28
sys/dev/tc/mfb.c 1.27
sys/dev/tc/sfb.c 1.46
sys/dev/tc/sfbplus.c 1.10 via patch
sys/dev/tc/tfb.c 1.30
sys/dev/tc/xcfb.c 1.23
sys/net/if_ppp.c 1.71

Use unsigned variable types to make bounds checking more correct.
 1.13.2.2  01-Nov-2000  tv Pullup 1.16 [tsubai, mycroft]:
Get the correct OF node of the screen because PowerBooks have two screens
in one PCI device.
 1.13.2.1  30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.17.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.17.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.23.2.5  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.23.2.4  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.23.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.23.2.2  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.23.2.1  03-Aug-2001  lukem update to -current
 1.25.6.5  18-Oct-2002  nathanw Catch up to -current.
 1.25.6.4  13-Aug-2002  nathanw Catch up to -current.
 1.25.6.3  01-Aug-2002  nathanw Catch up to -current.
 1.25.6.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.25.6.1  05-Aug-2001  nathanw file ofb.c was added on branch nathanw_sa on 2002-04-01 07:40:53 +0000
 1.26.6.1  24-Jun-2003  grant Pull up revisions 1.29-1.30, 1.33 (requested by briggs in ticket #1274):

Update OFB_ENABLE_CACHE to search for a empty bat that does not
conflict the USER_SR or one of the kernel SRs.

for ofb_enable_cache, turn on the BAT_M bit as well to prevent
the framebuffer from getting scrambled on MP systems.

Initialize the framebuffer BAT with BAT_G, too. This marks the region
as (G)uarded, protecting it from the processor being too aggressive in
reordering and prefetching. This allows OFB_ENABLE_CACHE to work on my
Powerbook G4.
 1.26.4.2  31-Aug-2002  gehenna catch up with -current.
 1.26.4.1  16-Jul-2002  gehenna catch up with -current.
 1.35.2.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.35.2.5  18-Dec-2004  skrll Sync with HEAD.
 1.35.2.4  18-Nov-2004  skrll Adapt to branch. macppc release builds.
 1.35.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.35.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.35.2.1  03-Aug-2004  skrll Sync with HEAD
 1.41.10.5  07-Dec-2007  yamt sync with head
 1.41.10.4  03-Sep-2007  yamt sync with head.
 1.41.10.3  26-Feb-2007  yamt sync with head.
 1.41.10.2  30-Dec-2006  yamt sync with head.
 1.41.10.1  21-Jun-2006  yamt sync with head.
 1.43.6.2  01-Jun-2006  kardel Sync with head.
 1.43.6.1  22-Apr-2006  simonb Sync with head.
 1.43.4.1  09-Sep-2006  rpaulo sync with head
 1.43.2.1  18-Feb-2006  yamt sync with head.
 1.47.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.47.4.4  13-May-2006  elad sprinkle some #include <sys/kauth.h> in files that use kauth kpi but
don't include it yet. hopefully this will prevent some fallout.
 1.47.4.3  19-Apr-2006  elad sync with head - hopefully this will work
 1.47.4.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.47.4.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.47.2.2  11-Aug-2006  yamt sync with head
 1.47.2.1  24-May-2006  yamt sync with head.
 1.51.6.2  18-Dec-2006  yamt sync with head.
 1.51.6.1  10-Dec-2006  yamt sync with head.
 1.51.4.3  01-Feb-2007  ad Sync with head.
 1.51.4.2  12-Jan-2007  ad Sync with head.
 1.51.4.1  18-Nov-2006  ad Sync with head.
 1.52.2.2  20-Aug-2008  bouyer Pull up following revision(s) (requested by macallan in ticket #1178):
sys/arch/macppc/dev/ofb.c: revision 1.61
fix another typo, now wsfb on ofb should work properly
 1.52.2.1  12-Jan-2007  bouyer branches: 1.52.2.1.2;
Pull up following revision(s) (requested by macallan in ticket #349):
sys/arch/macppc/dev/ofb.c: revision 1.53
sys/arch/macppc/dev/ofb_cons.c: revision 1.2
(hopefully) fix a panic when ofb attaches without being console
 1.52.2.1.2.1  04-Sep-2008  skrll Sync with netbsd-4.
 1.54.2.2  15-Apr-2007  yamt sync with head.
 1.54.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.56.6.1  29-Mar-2007  reinoud Pullup to -current
 1.56.4.1  11-Jul-2007  mjf Sync with head.
 1.56.2.3  03-Dec-2007  ad Sync with HEAD.
 1.56.2.2  20-Aug-2007  ad Sync with HEAD.
 1.56.2.1  10-Apr-2007  ad Sync with head.
 1.57.4.3  03-Oct-2007  garbled Sync with HEAD
 1.57.4.2  07-Aug-2007  macallan sync with HEAD
 1.57.4.1  02-Aug-2007  macallan sync with HEAD
 1.58.4.1  15-Aug-2007  skrll Sync with HEAD.
 1.58.2.1  07-Aug-2007  matt Sync with HEAD.
 1.60.4.2  27-Nov-2007  joerg Sync with HEAD. amd64 Xen support needs testing.
 1.60.4.1  09-Aug-2007  jmcneill Sync with HEAD.
 1.61.2.2  09-Jan-2008  matt sync with HEAD
 1.61.2.1  06-Nov-2007  matt sync with HEAD
 1.62.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.63.32.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.63.18.1  16-May-2009  yamt sync with head
 1.64.4.1  05-Mar-2011  rmind sync with head
 1.65.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.67.6.1  05-Apr-2012  mrg sync to latest -current.
 1.67.2.2  30-Oct-2012  yamt sync with head
 1.67.2.1  17-Apr-2012  yamt sync with head
 1.68.2.2  03-Dec-2017  jdolecek update from HEAD
 1.68.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.69.14.1  29-May-2016  skrll Sync with HEAD
 1.70.32.3  24-Apr-2021  thorpej Make sure to explcitly specify the "wsemuldisplaydev" interface attribute
when attaching the wscons display instance, because these devices can
also attach children using the "drm" interface attribute.
 1.70.32.2  02-Apr-2021  thorpej config_found_ia() -> config_found() w/ CFARG_IATTR.
 1.70.32.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.71.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed