Home | History | Annotate | Download | only in tc
History log of /src/sys/dev/tc/mfb.c
RevisionDateAuthorComments
 1.64  06-Dec-2021  abs Add WSDISPLAYIO_GET_FBINFO support to most TURBOchannel framebuffers

This adds WSDISPLAYIO_GET_FBINFO to cfb, mfb, sfb, tfb and xcfb
TURBOchannel framebuffers as used by pmax and alpha

It does not add support to px and pxg (they handle ioctls in common
code in stic.c and more careful wiring is required)

These changes allow an Xswfb X server to use the framebuffer
directly, albeit without any special acceleration

A subsequent change will re-enable X server building on pmax, and
also hopefully switch alpha from Xorg 1.10 to 1.20
 1.63  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.62  24-Apr-2021  thorpej branches: 1.62.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.61  10-Nov-2019  chs branches: 1.61.10;
in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
 1.60  24-Jan-2018  riastradh branches: 1.60.4;
Fix integer overflows noted by Silvio Cesare of InfoSect.

Someone^TM should name these idioms so we can eliminate this class of
copypasta bug.
 1.59  04-Nov-2013  christos add __USE() for unused volatile variables, so that we generate the same code.
 1.58  11-Jan-2012  macallan branches: 1.58.6; 1.58.10;
adjust wsfont_find()
 1.57  13-Nov-2010  uebayasi branches: 1.57.8; 1.57.12;
Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.56  15-May-2010  tsutsui Clear RI_NO_AUTO in actual attach functions during autoconf(9)
for console devices that set the flag during consinit().
 1.55  15-May-2010  tsutsui Set RI_NO_AUTO in ri_flg if *fb_common_init() is invoked from cnattach.
Untested.
 1.54  22-Aug-2009  tsutsui branches: 1.54.2; 1.54.4;
u_intNN_t -> uintNN_t
 1.53  17-Dec-2008  cegger kill MALLOC and FREE macros.
 1.52  09-Jul-2008  joerg branches: 1.52.2;
- device/softc split
- make sfbplus at least compilable
 1.51  26-May-2008  nisimura branches: 1.51.2; 1.51.4;
- assign 2 clause TNF license to the files cited as my ownership.
- abandon and remove my copyright notice from the three files were
copied in order to adapt HW I don't have; pvr.c, pm.c and stic.c
 1.50  19-Oct-2007  ad branches: 1.50.16; 1.50.18; 1.50.20; 1.50.22;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.49  04-Mar-2007  yamt branches: 1.49.2; 1.49.14; 1.49.16; 1.49.20;
fix fallout from caddr_t changes.
 1.48  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.47  12-Apr-2006  jmmv branches: 1.47.14;
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.46  31-Mar-2006  thorpej Use ANSI function decls, apply static.
 1.45  30-Mar-2006  thorpej Use device_private().
 1.44  11-Dec-2005  christos branches: 1.44.4; 1.44.6; 1.44.8; 1.44.10; 1.44.12;
merge ktrace-lwp.
 1.43  27-Feb-2005  perry branches: 1.43.4;
nuke trailing whitespace
 1.42  02-Jan-2005  mhitch branches: 1.42.2; 1.42.4;
Fix and simplify incorrect check for screen blanking in WSDISPLAYIO_SVIDEO.
 1.41  20-Dec-2003  nisimura - Minor coding modifications for VDAC register access.
- De-__P() this time.
Tested valid with 4MAXINE.
 1.40  17-Dec-2003  ad - Restore the display to a sane state when leaving mapped mode.
- OR updates into sc_changed, and protect with spltty()/splx().
 1.39  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.38  27-Oct-2003  chs uninitialized variables
 1.37  29-Jun-2003  fvdl branches: 1.37.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.36  29-Jun-2003  simonb Fix 'struct lwp *' lossage.
 1.35  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.34  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.33  04-Jul-2002  junyoung alloc_attr -> allocattr

Approved by Matthias Drochner.
 1.32  17-Mar-2002  atatat branches: 1.32.4;
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.31  13-Mar-2002  ad Reorganise the wsfont stuff slightly so that multiple display adapters
with different bit/byte order requirements can co-exist happily.
 1.30  13-Mar-2002  ad Set RI_FORCEMONO so that wscons doesn't try to use colors (mfb is an 8-bpp
device with a depth of 1).
 1.29  13-Nov-2001  lukem add/cleanup RCSIDs
 1.28  22-Aug-2001  nisimura Nuke fb_devconfig data structure which was found unnecessary to have.
 1.27  05-Aug-2001  jdolecek use unsigned variable types as appropriate
 1.26  16-Jan-2001  nisimura branches: 1.26.2; 1.26.4;
- relocate the code to place sprite cursor inside interrupt handlers
called on every virtical replace.
- efforts to make the code strucutures similar across TC framebuffers.
 1.25  13-Sep-2000  nisimura Found glyph pixel order inverted on screen.
 1.24  28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.23  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.22  16-Mar-2000  nisimura branches: 1.22.4;
Place 34 by 80 console at the center of screen.
 1.21  14-Mar-2000  nisimura Switch to improved flexible video console text rasterizer provided by
rasops and wsfont.
 1.20  06-Dec-1999  drochner update for changed struct wsdisplay_accessops:show_screen signature.
no functional changes
 1.19  29-Nov-1999  nisimura Const poisoning.
 1.18  19-Oct-1999  nisimura branches: 1.18.2;
Enable 'WSSCREEN_REVERSE' scr-capability.
 1.17  02-Aug-1999  nisimura branches: 1.17.2; 1.17.4;
- Fix MX framebuffer size which should occupy 2MB in address range.
- Restore 72Hz interrupt service mistakenly ruined in the previous commit.
 1.16  30-Jul-1999  nisimura - Fix TX 66Hz interrupt handling. Verified ok with PMAG-JA as an 8bpp
console. XXX troubles in cursor color.
- Typo in comments of MX.
 1.15  25-Jun-1999  nisimura - Show 1bpp for MX during configuration stage.
- Replace memory layout 'struct' with array/pointer access.
 1.14  24-Jun-1999  nisimura - Hide memory mapped VDAC hardware register layouts using the array
element access instead of C bitfield (hello, BCPL).
- XXX Some TURBOchannel framebuffers might need shutdownhooks(). It
seems not necessarily hardware sprite cursor images are re-initialized
by DECstation PROMs upon exits from kernel.
- XXX It'd be an arguable point to allow user programs to change the
shade of gray freely for pixel value 0 and 1.
 1.13  23-Jun-1999  nisimura - Allow to choose the 'color' of sprite cursor. Only red cmap makes sense.
- Drop TC Alpha support (OSF/1 and Digital UNIX never supports PMAG-AA).
 1.12  23-Jun-1999  nisimura - Fix an error in the depth of PMAG-AA MX. This driver can take 72Hz
virtical video retrace interrupt and was verified ok on Nanao grayscale
monitor. XXX seems still confusion/mistake on Bt431 cursor image
manipulation.
 1.11  07-May-1999  nisimura - Sweep abit preparing for code merge to have common 'vdacops' across
various graphics cards.
 1.10  29-Mar-1999  nisimura branches: 1.10.4;
- Unnecessary to have '#include <machine/autoconf.h>' for those.
 1.9  24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.8  15-Jan-1999  thorpej __pmax__ -> pmax, like other ports.
 1.7  11-Jan-1999  drochner remove dummy "load_font" entries
 1.6  14-Dec-1998  nisimura - Fix typos in commentary description.
 1.5  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.4  18-Nov-1998  nisimura - Fix cursor image handling bugs escaped in last commit.
 1.3  09-Nov-1998  nisimura - Fix many errors in cursor image manipulation. Hardware expect 2
bit/pixel format, not planer format. Assign MSB for cursor mask and
LSB for cursor image, where 10 means mask color and 11 for image color.
Image bit order of Bt431 and Bt459 are opposite to MIPS/Alpha processors
while IMS G332 and DC503 (PCC) are indentical.
- Assume that cursor images are 32 pixel padded as ULTRIX/DU ws interface
do. It's natural to X server.
- XXX Vast majority of codes are duplicated between mfb<->tfb and cfb<->sfb.
Code sharing might be achieved in the context of TGA/SFB+ merge.
 1.2  30-Oct-1998  nisimura - Assign copyright terms.
 1.1  29-Oct-1998  nisimura - Introduce MI NWSCONS drivers for TURBOchannel framebuffer option cards.

N.B., Digital UNIX never supports neither PMAG-AA (mfb) nor PMAG-BA (cfb)
for TC Alphas. PMAG-DV (xcfb) is Personal DECstation built in. All should
be good for console, but need much works for cursor/colormap completeness.
 1.10.4.3  02-Aug-1999  thorpej Update from trunk.
 1.10.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.10.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.17.4.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.17.2.3  18-Jan-2001  bouyer Sync with head (for UBC+NFS fixes, mostly).
 1.17.2.2  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.17.2.1  20-Oct-1999  thorpej Sync w/ trunk.
 1.18.2.2  19-Oct-1999  nisimura Enable 'WSSCREEN_REVERSE' scr-capability.
 1.18.2.1  19-Oct-1999  nisimura file mfb.c was added on branch fvdl-softdep on 1999-10-19 00:49:35 +0000
 1.22.4.2  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.22.4.1  30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.26.4.6  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.26.4.5  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.26.4.4  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.26.4.3  16-Mar-2002  jdolecek Catch up with -current.
 1.26.4.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.4.1  25-Aug-2001  thorpej Merge Aug 24 -current into the kqueue branch.
 1.26.2.6  18-Oct-2002  nathanw Catch up to -current.
 1.26.2.5  01-Aug-2002  nathanw Catch up to -current.
 1.26.2.4  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.26.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.26.2.1  24-Aug-2001  nathanw Catch up with -current.
 1.32.4.1  15-Jul-2002  gehenna catch up with -current.
 1.37.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.37.2.5  17-Jan-2005  skrll Sync with HEAD.
 1.37.2.4  21-Nov-2004  skrll Adapt to branch. Alpha kernels now compile.
 1.37.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.37.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.37.2.1  03-Aug-2004  skrll Sync with HEAD
 1.42.4.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.42.2.1  29-Apr-2005  kent sync with -current
 1.43.4.3  27-Oct-2007  yamt sync with head.
 1.43.4.2  03-Sep-2007  yamt sync with head.
 1.43.4.1  21-Jun-2006  yamt sync with head.
 1.44.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.44.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.44.10.1  19-Apr-2006  elad sync with head.
 1.44.8.2  24-May-2006  yamt sync with head.
 1.44.8.1  01-Apr-2006  yamt sync with head.
 1.44.6.1  22-Apr-2006  simonb Sync with head.
 1.44.4.1  09-Sep-2006  rpaulo sync with head
 1.47.14.1  12-Mar-2007  rmind Sync with HEAD.
 1.49.20.1  25-Oct-2007  bouyer Sync with HEAD.
 1.49.16.1  06-Nov-2007  matt sync with HEAD
 1.49.14.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.49.2.1  23-Oct-2007  ad Sync with head.
 1.50.22.2  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.50.22.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.50.20.3  11-Aug-2010  yamt sync with head.
 1.50.20.2  16-Sep-2009  yamt sync with head
 1.50.20.1  04-May-2009  yamt sync with head.
 1.50.18.1  04-Jun-2008  yamt sync with head
 1.50.16.3  17-Jan-2009  mjf Sync with HEAD.
 1.50.16.2  28-Sep-2008  mjf Sync with HEAD.
 1.50.16.1  02-Jun-2008  mjf Sync with HEAD.
 1.51.4.1  19-Oct-2008  haad Sync with HEAD.
 1.51.2.1  18-Jul-2008  simonb Sync with head.
 1.52.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.54.4.2  05-Mar-2011  rmind sync with head
 1.54.4.1  30-May-2010  rmind sync with head
 1.54.2.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.57.12.1  18-Feb-2012  mrg merge to -current.
 1.57.8.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.57.8.1  17-Apr-2012  yamt sync with head
 1.58.10.1  18-May-2014  rmind sync with head
 1.58.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.60.4.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.61.10.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.62.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed