Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/x68k/dev/ite.c
RevisionDateAuthorComments
 1.72  05-Oct-2024  isaki x68k: Add SIXEL graphics sequence support.
- The palette definition is fixed to the same color as the text (currently,
it's RGB 8 colors). Any palette definition sent will be ignored.
- Aspect ratio and bg color mode is not supported (yet).
- An OR mode is supported. This is proposed by Y.Sugahara in this
implementation and then the mlterm also supports it. It's an advantageous
way for the multi plane color VRAM.
- ITE_SIXEL kernel option is added and is disabled by default for now.

It was first written by me in 2014 and has been demonstrated in Open Source
Conference Hiroshima every year since then. In this year, it's also
demonstrated on real X68030 at Japan NetBSD Users Group booth in OSC 2024
Hiroshima, last week.
https://x.com/OSC_official/status/1841381234804498608
It's useful for showing and explaining about the possibility of NetBSD and
old machines for younger (than X68030) engineers or students.
 1.71  07-Jan-2024  isaki TAB/space/indent cleanup.
 1.70  25-Jun-2022  tsutsui Fix more unintended diffs from a wrong branch.
 1.69  25-Jun-2022  tsutsui Add a minimum box drawing character support for x68k ite(4).

This is for proper appearance of menus in sysinst(8) with TERM=vt220.
Discussed on port-x68k@ etc.

There was "why not all G0/G1/G2/G3" comment, but terminfo and curses
with TERM=vt220 only require "ESC ( <F>" against G0 for DEC special
graphics (including box drawing characters) by smacs/rmacs/acsc.
I hope other various unimplemented ISO/IEC 2022 specifications will
be motivated per further visible demends.
 1.68  28-May-2022  andvar fix various typos, mainly in comments.
 1.67  26-May-2022  tsutsui Remove duplicated function declarations.
 1.66  26-May-2022  tsutsui Explicitly include "ioconf.h" for struct cfdriver.
 1.65  29-Mar-2022  riastradh x68k/ite(4): Include <sys/device_impl.h> to abuse autoconf internals.
 1.64  03-Sep-2018  riastradh 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!)
 1.63  25-Jul-2014  dholland branches: 1.63.26; 1.63.28;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.62  26-Mar-2014  christos branches: 1.62.2;
kill sprintf, fix unused.
 1.61  16-Mar-2014  dholland Change (mostly mechanically) every cdevsw/bdevsw I can find to use
designated initializers.

I have not built every extant kernel so I have probably broken at
least one build; however I've also found and fixed some wrong
cdevsw/bdevsw entries so even if so I think we come out ahead.
 1.60  10-Oct-2012  tsutsui branches: 1.60.2;
Fix device_t/softc split bothces. From Chuck Silvers' patch posted on
current-users and tech-kern:
http://mail-index.netbsd.org/current-users/2012/10/09/msg021233.html
and several more fixes by me.

Not sure if these are fatal (at least 6.0_RC2 works without thise fixes),
but needs more investigation.
 1.59  24-Apr-2011  rmind branches: 1.59.4; 1.59.14;
Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.58  08-Feb-2011  rmind Remove clause 3 (UCB advertising clause) from the University of Utah
copyright. Confirmed by Mike Hibler, mike at cs.utah.edu - thanks!
Also, merge UCB and Utah copyright texts back into one, as they
originally were.

Extra verification by snj@.
 1.57  17-Jan-2009  isaki branches: 1.57.6; 1.57.8; 1.57.10;
Split device_t/softc, use aprint*().
 1.56  17-Jan-2009  isaki Purge x68k_config_found() to simplify consinit routine.
config_console() calls initialization of grf, ite, mfp
directly, instead of tracing special device tree with an
emulated 'struct device'.
 1.55  13-Jun-2008  cegger branches: 1.55.4;
use device_lookup_private to get softc
 1.54  24-Feb-2008  isaki branches: 1.54.2; 1.54.4; 1.54.6; 1.54.8;
G/C unused variables and macros.
 1.53  19-Nov-2007  ad branches: 1.53.10; 1.53.14;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.52  18-Oct-2007  joerg branches: 1.52.2;
Initialise the callbacks for tty.t_rstrt_ch in ttymalloc
as all drivers but Sun/SPARC's kd.c use the same arguments.
Separate callout_reset into callout_schedule and the initial
callout_setfunc using that.
 1.51  17-Oct-2007  garbled 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.50  12-May-2007  isaki branches: 1.50.8; 1.50.10; 1.50.14;
Clean up white spaces and tabs.
 1.49  11-Mar-2007  isaki branches: 1.49.2; 1.49.8;
white space, indent and KNF.
 1.48  04-Mar-2007  christos branches: 1.48.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.47  01-Oct-2006  elad branches: 1.47.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN, batch #2 from Matt Fleming, thanks!

Also, add forgotten splx() calls in some places.
 1.46  23-Jul-2006  ad branches: 1.46.4; 1.46.6;
Use the LWP cached credentials where sane.
 1.45  14-May-2006  elad integrate kauth.
 1.44  28-Mar-2006  thorpej Use device_unit().
 1.43  24-Dec-2005  perry branches: 1.43.4; 1.43.6; 1.43.8; 1.43.10; 1.43.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.42  11-Dec-2005  christos merge ktrace-lwp.
 1.41  06-Sep-2005  kleink Change the driver open function's conditional for overriding exclusive tty
use from checking the proc's uid to suser(9), and account for the use of
privileges. Noted by David Holland in PR kern/31126.
 1.40  12-Jun-2005  he branches: 1.40.2;
Change the last arg of ite_sendstr() to const char*, so that this builds
under -Wcast-qual. Also rename a local variable to build with -Wshadow.
 1.39  18-Jan-2005  chs use a new "addr" locator for grf instead of the unit to match the instance
to the hardware. use a new "grfaddr" locator to match ites to their grfs,
instead of requiring that their unit numbers be the same.
 1.38  18-Jan-2005  chs de-__P, remove register, ansify.
 1.37  23-Apr-2004  simonb branches: 1.37.4;
s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
 1.36  01-Nov-2003  jdolecek g/c local index() routine and switch to (libkern's) strchr()
 1.35  07-Aug-2003  agc Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.
 1.34  15-Jul-2003  lukem rcsid
 1.33  23-Oct-2002  jdolecek branches: 1.33.6;
merge kqueue branch into -current

kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
 1.32  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.31  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.30  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.29  06-Sep-2002  gehenna Merge the gehenna-devsw branch into the trunk.

This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
by using this grammer.

- Added the new naming convention.
The name of the device switch must be <prefix>_[bc]devsw for auto-generation
of device switch tables.

- The backward compatibility of loading block/character device
switch by LKM framework is broken. This is necessary to convert
from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
the LKM framework will refer it to assign device major number dynamically.
 1.28  17-Mar-2002  atatat branches: 1.28.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.27  27-Dec-2001  wiz bcopy/bcmp/bzero -> memcpy/memcmp/memset
 1.26  21-Oct-2001  isaki branches: 1.26.4;
Change 3 glyphs according to SRAM flags (0xed0059),
when ITELOADFONT ioctl is issued.
 1.25  02-May-2001  scw branches: 1.25.2; 1.25.4;
Add `l_poll' to `struct linesw' and provide an xxxpoll() entry point
in each tty driver to indirect through it.

This allows tty line-disciplines to handle poll(2) system calls.
 1.24  13-Nov-2000  minoura branches: 1.24.2;
New line discipline.
 1.23  02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.22  25-May-2000  itohy Fix the problem where pressing a key at
scsibus0: waiting 2 seconds for devices to settle...
message during boot crashes the system.
This is because ite_filter() is called before init(8) opens the console.
 1.21  23-Mar-2000  thorpej New callout mechanism with two major improvements over the old
timeout()/untimeout() API:
- Clients supply callout handle storage, thus eliminating problems of
resource allocation.
- Insertion and removal of callouts is constant time, important as
this facility is used quite a lot in the kernel.

The old timeout()/untimeout() API has been removed from the kernel.
 1.20  27-Jun-1999  minoura branches: 1.20.2;
Restore scroll registers after X server exits.
 1.19  05-May-1999  minoura Shut up gcc -Wall.
 1.18  05-May-1999  minoura Move config_console to ensure that it is always called.
 1.17  30-Mar-1999  minoura branches: 1.17.2; 1.17.4; 1.17.6;
defopt EXTENDED_MEMORY and ITE_KERNEL_ATTR.
 1.16  24-Mar-1999  minoura G/c amiga's key repeat handler.
 1.15  22-Mar-1999  minoura Check unit.
This bug seems to be introduced on merging the bus.h patches.
 1.14  16-Mar-1999  minoura Merged minoura_x68k_bus_h branch.
 1.13  06-Aug-1998  minoura branches: 1.13.6;
Moved grfioctl.h and iteioctl.h to the public include directory.
 1.12  05-Aug-1998  minoura Fixed stray pointer access reported by Yasufumi Itoh.
 1.11  04-Aug-1998  minoura __BROKEN_INDIRECT_CONFIG fixes.
 1.10  30-Jun-1998  msaitoh sync with -current after a long silence
 1.9  12-Jan-1998  thorpej Update for changes to config.
 1.8  12-Oct-1997  oki branches: 1.8.2;
Added prototypes.
 1.7  26-Jan-1997  oki branches: 1.7.8;
Rename in_xxxx to tv_xxxx (Use new ite_tv.c)
 1.6  13-Oct-1996  christos backout previous kprintf change
 1.5  11-Oct-1996  christos printf -> kprintf, sprintf -> ksprintf
 1.4  17-Jul-1996  oki XXX grf has some routines call ite function directly.
XXX check whether grf has no associated ite. fixed PR/2626.
 1.3  05-Jun-1996  oki add tty_attach(tp);
 1.2  21-May-1996  oki branches: 1.2.2;
Some cleanup.
- Add missing return-type of function.
- Add missing prototype.
- some gcc -Wall printf warning.
 1.1  05-May-1996  oki branches: 1.1.1;
Initial revision
 1.1.1.1  05-May-1996  oki NetBSD/x68k, by Masaru Oki.
 1.2.2.2  17-Jul-1996  jtc Pulled up from rev 1.4 by request from Masaru Oki
 1.2.2.1  05-Jun-1996  oki pull up tty_attach() changes from trunk
 1.7.8.1  14-Oct-1997  thorpej Update marc-pcmcia branch from trunk.
 1.8.2.1  13-Oct-1998  cgd pull up some (but not all) changes from 1.10 and 1.12, via patch. (minoura)
 1.13.6.2  14-Mar-1999  minoura scsirom driver to probe CZ-6BS1-clone and Mach-2 SCSI host adaptor board
itself.
Modifications to spc and mha drivers.
NOTE: mha is not fully bus.h'fied.
 1.13.6.1  23-Dec-1998  minoura First import of bus_space implementation for x68k port.
 1.17.6.1  30-Nov-1999  itojun bring in latest KAME (as of 19991130, KAME/NetBSD141) into kame branch
just for reference purposes.
This commit includes 1.4 -> 1.4.1 sync for kame branch.

The branch does not compile at all (due to the lack of ALTQ and some other
source code). Please do not try to modify the branch, this is just for
referenre purposes.

synchronization to latest KAME will take place on HEAD branch soon.
 1.17.4.2  01-Jul-1999  thorpej Sync w/ -current.
 1.17.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.17.2.2  02-Jul-1999  perry pullup 1.19->1.20 (minoura): Restore scroll registers after X server exits
 1.17.2.1  22-Jun-1999  perry pullup 1.17->1.18 (minoura)
 1.20.2.2  22-Nov-2000  bouyer Sync with HEAD.
 1.20.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.24.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.25.4.2  13-Oct-2001  fvdl Revert the t_dev -> t_devvp change in struct tty. The way that tty
structs are currently used (especially by console ttys) aren't
ready for it, and this will require quite a few changes.
 1.25.4.1  10-Oct-2001  fvdl Convert all remaining devices.
 1.25.2.4  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.25.2.3  24-Jun-2002  jdolecek add dummy itestop(), so that we can use cdev_tty_init() in conf.c
 1.25.2.2  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.25.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.26.4.6  11-Nov-2002  nathanw Catch up to -current
 1.26.4.5  18-Oct-2002  nathanw Catch up to -current.
 1.26.4.4  17-Sep-2002  nathanw Catch up to -current.
 1.26.4.3  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.26.4.2  08-Jan-2002  nathanw Catch up to -current.
 1.26.4.1  21-Oct-2001  nathanw file ite.c was added on branch nathanw_sa on 2002-01-08 00:28:40 +0000
 1.28.4.1  19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.33.6.6  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.33.6.5  04-Feb-2005  skrll Adapt to branch.
 1.33.6.4  24-Jan-2005  skrll Sync with HEAD.
 1.33.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.33.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.33.6.1  03-Aug-2004  skrll Sync with HEAD
 1.37.4.1  29-Apr-2005  kent sync with -current
 1.40.2.6  27-Feb-2008  yamt sync with head.
 1.40.2.5  07-Dec-2007  yamt sync with head
 1.40.2.4  27-Oct-2007  yamt sync with head.
 1.40.2.3  03-Sep-2007  yamt sync with head.
 1.40.2.2  30-Dec-2006  yamt sync with head.
 1.40.2.1  21-Jun-2006  yamt sync with head.
 1.43.12.2  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.43.12.1  31-Mar-2006  tron Merge 2006-03-31 NetBSD-current into the "peter-altq" branch.
 1.43.10.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.43.10.3  19-Apr-2006  elad sync with head - hopefully this will work
 1.43.10.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.43.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.43.8.3  11-Aug-2006  yamt sync with head
 1.43.8.2  24-May-2006  yamt sync with head.
 1.43.8.1  01-Apr-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.46.6.1  22-Oct-2006  yamt sync with head
 1.46.4.1  18-Nov-2006  ad Sync with head.
 1.47.4.2  17-May-2007  yamt sync with head.
 1.47.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.48.2.4  03-Dec-2007  ad Sync with HEAD.
 1.48.2.3  23-Oct-2007  ad Sync with head.
 1.48.2.2  27-May-2007  ad Sync with head.
 1.48.2.1  13-Mar-2007  ad Sync with head.
 1.49.8.1  22-May-2007  matt Update to HEAD.
 1.49.2.1  11-Jul-2007  mjf Sync with head.
 1.50.14.2  21-Nov-2007  bouyer Sync with HEAD
 1.50.14.1  25-Oct-2007  bouyer Sync with HEAD.
 1.50.10.3  23-Mar-2008  matt sync with HEAD
 1.50.10.2  09-Jan-2008  matt sync with HEAD
 1.50.10.1  06-Nov-2007  matt sync with HEAD
 1.50.8.2  21-Nov-2007  joerg Sync with HEAD.
 1.50.8.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.52.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.53.14.3  17-Jan-2009  mjf Sync with HEAD.
 1.53.14.2  29-Jun-2008  mjf Sync with HEAD.
 1.53.14.1  03-Apr-2008  mjf Sync with HEAD.
 1.53.10.1  24-Mar-2008  keiichi sync with head.
 1.54.8.1  18-Jun-2008  simonb Sync with head.
 1.54.6.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.54.4.1  04-May-2009  yamt sync with head.
 1.54.2.1  17-Jun-2008  yamt sync with head.
 1.55.4.1  19-Jan-2009  skrll Sync with HEAD.
 1.57.10.1  17-Feb-2011  bouyer Sync with HEAD
 1.57.8.1  06-Jun-2011  jruoho Sync with HEAD.
 1.57.6.2  31-May-2011  rmind sync with head
 1.57.6.1  05-Mar-2011  rmind sync with head
 1.59.14.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.59.14.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.59.4.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.59.4.1  30-Oct-2012  yamt sync with head
 1.60.2.1  18-May-2014  rmind sync with head
 1.62.2.1  10-Aug-2014  tls Rebase.
 1.63.28.1  10-Jun-2019  christos Sync with HEAD
 1.63.26.1  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)

RSS XML Feed