Commit Graph

97 Commits

Author SHA1 Message Date
mrg bad08472e0 add or adjust fallthru comments. 2019-02-05 06:12:39 +00:00
tnn 87c768469b machfb: guard against absent mode information from firmware 2019-02-03 12:39:38 +00:00
riastradh d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
macallan 1322169bda enable font loading and screen resizing, now that the glyph cache can be
reconfigured whenever needed
2017-06-02 19:35:54 +00:00
macallan 8e9e89c07f g/c some unused / #if 0-ed goop, support firmware-provided EDID, get rid of
private list of video modes
tested on macppc, should Just Work(tm) on sparc64
2017-05-28 05:27:13 +00:00
msaitoh 71fbb921c3 KNF. No functional change. 2016-07-11 11:31:49 +00:00
macallan 612b1d90d4 get rid of /dev/fb support which has never been used for anything other than
some highly experimental code in xf86/Xsun
2013-12-18 11:53:17 +00:00
macallan 95bb5188d6 Don't turn off aperture registers - some firmwares don't know how to turn
them back on. Also distinguish between WSDISPLAYIO_MODE_MAPPED and _DUMBFB -
we only need to turn the registers off in _DUMBFB mode when mapping all 8MB
of video memory.
2013-11-06 14:52:25 +00:00
macallan da28d6ec38 support WSDISPLAYIO_GET_FBINFO 2013-10-09 17:18:23 +00:00
macallan 4453737ff6 avoid uninitialized use of defattr 2013-07-30 19:16:50 +00:00
macallan 7cccdd71c6 support RI_FULLCLEAR 2013-05-28 10:55:34 +00:00
chs cbab9cadce split device_t/softc for all remaining drivers.
replace "struct device *" with "device_t".
use device_xname(), device_unit(), etc.
2012-10-27 17:17:22 +00:00
macallan 49041e500d gc_attr is no more 2012-10-05 01:12:15 +00:00
jdc 5b7bfe8cd0 Match the Rage Mobility M1 used in the Tadpole SPARCle. 2012-10-01 09:25:01 +00:00
macallan 5bd724ecd0 fix a bunch of typos, thinkos and cargocultos 2012-08-16 18:37:14 +00:00
macallan 2d5d33f2d3 don't forget to clear the screen and wipe the glyph cache when re-entering
terminal emulation mode
2012-08-15 17:43:59 +00:00
macallan 0950a8b00e some cleanup:
- get rid of some redundant variables ( sc_*phys and sc_*base were essentially
  the same )
- we don't access video memory directly anymore, so:
  * no more need for byte order tests
  * don't map video memory if we have a MMIO register aperture
  * get rid of various bits of support code dealing with video memory
    access
- use MMIO register aperture if available, turn off register blocks in the main
  aperture if not in use, to avoid overlap with video memory on 8MB cards
- don't scissor off access to off-screen memory. How the hell did this work on
  Rage II? Apparently Rage XL treats the scissor registers slightly different.
Now this works properly on 8MB and Rage XL boards like Sun's PGX64.
2012-08-15 17:02:41 +00:00
macallan f3a407118e machfb's memsize is in MB, glyphcache_init expects bytes. doh. 2012-08-03 01:23:32 +00:00
macallan 96245bbb0f add support for anti-aliased fonts 2012-08-02 00:17:44 +00:00
macallan ebbeb0ed68 more preparation for alpha support:
- use R3G3B2 colour map
- consistently use ri_devcmap[]
- reshuffle cmap setup, screen cleaning, msg buffer replay etc. to deal
  with the above
2012-06-14 00:56:37 +00:00
macallan 651641ee60 do some minimal setup if we're not the console 2012-06-14 00:21:55 +00:00
macallan a0d170a779 cosmetics:
- fix/remove outdated comments
- printf() -> aprint_*()
- #if 1 removal
2012-06-14 00:15:07 +00:00
macallan c92dd73582 don't enable IO access - we don't use it and at least on some macppc machines
the IO BAR contains garbage
should probably be pulled into 6.0
2012-05-08 02:25:25 +00:00
elad 0c9d8d15c9 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.
2012-03-13 18:40:26 +00:00
drochner d8e1a7b61a Use pci_aprint_devinfo(9) instead of pci_devinfo+aprint_{normal,naive}
where it looks straightforward, and pci_aprint_devinfo_fancy in a few
others where drivers want to supply their own device names instead
of the pcidevs generated one. More complicated cases, where names
are composed at runtime, are left alone for now. It certainly makes
sense to simplify the drivers here rather than inventing a catch-all API.
This should serve as as example for new drivers, and also ensure
consistent output in the AB_QUIET ("boot -q") case. Also, it avoids
excessive stack usage where drivers attach child devices because the
buffer for the device name is not kept on the local stack anymore.
2012-01-30 19:41:18 +00:00
macallan 1fa79ac882 use rasops_init(0, 0) 2012-01-11 15:53:32 +00:00
jakllsch bd5bcd64f7 Fix machfb build on ports not based on powerpc or sparc. 2011-08-04 00:57:33 +00:00
macallan e7215d9880 don't try to a 'better' vertical frequency, it's almost certainly wrong with
flat panels
2011-08-03 05:27:08 +00:00
mbalmer 631d5867a0 According to the Oxford Dictionary of Etymology, a wether is a male sheep
or ram.
2011-08-01 12:28:53 +00:00
macallan 7ebc354766 support WSDISPLAYIO_GET_EDID 2011-06-29 03:14:36 +00:00
macallan dd3292d9f1 move wsdisplay_accessops into the softc so multiple instances have a chance
to work without stepping on each other's toes
2011-06-01 05:06:17 +00:00
macallan a37153870a don't leave a mess on screen when attaching, while there use VCONS_DONT_READ
if VCONS_DRAW_INTR is set
2011-05-16 00:59:37 +00:00
dyoung e4c26632ea Stop abuse of PCI_FLAGS_IO_ENABLED and PCI_FLAGS_MEM_ENABLED. The flags
specifically tell a driver that bridges upstream forward PCI I/O (or
memory) transactions to the device."  Only bus drivers have any business
modifying these.
2011-05-10 18:31:33 +00:00
macallan bcb7f01345 add support for (ancient) Mach64 CX and GX, while there make sure the visible
vram area starts at the same offset as the area we're going to draw into -
zero that is.
from David Riley
2011-05-04 23:36:21 +00:00
cegger e28cc170ed Implement new WSDISPLAYIO_GET_BUSID ioctl.
It returns the bus id and allows userland (like Xorg) to create mapping
of ttyE? and bus id. For now only PCI is implemented.

First discussed with macallan@ then public on tech-kern@ and tech-x11@
2011-01-22 15:14:27 +00:00
cegger ca7fa2468a ioctl: KNF switch-case, remove useless brackets 2010-12-16 06:45:50 +00:00
macallan 7ad510fcea cleanup debug code 2010-10-02 23:54:03 +00:00
macallan 7540c6ba94 fix a typo 2010-10-02 23:50:04 +00:00
macallan d87e1bf08e this has been sitting in my tree too long:
- device_t-ify
- sanitize debugging #ifdefs
- deal with firmwares setting up modes using other clocks than #0
- get rid of sparc and macppc-specific code, use device properties instead
- while there, use alternate box drawing font if needed
2010-05-04 05:07:14 +00:00
mrg ebc9e23316 various aprint_* fixes. 2010-03-11 03:54:56 +00:00
elad 105d9a093d Replace curlwp->l_cred with kauth_cred_get().
Mailing list reference:

	http://mail-index.netbsd.org/tech-kern/2009/05/05/msg005038.html
2009-05-06 18:41:54 +00:00
yamt b1fea83762 remove extra semicolons. 2009-01-03 03:43:21 +00:00
dyoung 9b4187042c Comment out some device IDs that do not actually belong to mach64
devices.  This stops machfb0 from trying and failing to attach as
console on my G4 PowerBook.  Now, genfb0 will attach as console,
instead.

Apparently, Michael Lorenz made a similar change on the netbsd-4
branch, but it was never committed to -current.
2008-07-01 23:25:06 +00:00
dyoung dcfcd6affa Cosmetic: use device_t, cfdata_t, __arraycount(), device_private(). 2008-07-01 23:19:48 +00:00
cegger 3bde75a1bc use device_lookup_private to get softc 2008-06-12 22:44:47 +00:00
cegger 9d57c80079 use aprint_*_dev and device_xname 2008-04-10 19:13:36 +00:00
elad b2b4fb68be Introduce two missing KAUTH_GENERIC_ISSUSER check in the voodoo and machfb
mmap() code.

This and similar requests will be replaced Soon, but these two in
particular should be pulled up to netbsd-4, and to allow doing that
smoothly, we're first introducing the "issuser" version.

Discussed with and okay macallan@.
2008-03-24 14:16:04 +00:00
jmcneill cdd511a2fb For WSDISPLAY_GINFO, depth should be sc->bits_per_pixel, not
sc->color_depth. While we're here, implement WSDISPLAYIO_LINEBYTES.
2008-01-15 02:00:49 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00