Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/luna68k/dev/siotty.c
RevisionDateAuthorComments
 1.54  14-Sep-2025  andvar Fix various typos in comments and log message.
 1.53  15-Jan-2023  tsutsui TAB/space/indent cleanup.
 1.52  22-Nov-2022  tsutsui Use explicit struct to represent RX queue buffer data structure.

No binary change.

Maybe the similar change should be applied to MI com(4) and zsc(4)?
 1.51  25-Sep-2021  tsutsui Refactor and cleanup sio (uPD7201) drivers.

- remove confusing syscn*() functions (and its header) and prepare
explicit siottycninit(), siottycnget() and siottycnput() functions
- use exported struct consdev and cn_tab to initialize siotty console
- enable and handle E/S interrupts to make BREAK signal detected properly
- make CSR (status regsiters) access functions inline static
- make single byte read/write (i.e. cnputc() and cngetc()) functions
static inline and take struct sio_register rather than sio channel
- use proper integer type (uint16_t) for getsiocsr() as siotty.c
- handle channel dependent CR2A and CR2B registers properly
- use more explicit definitions for RR_* macro used by getsiocsr()
- define and use proper RR0 (read register) values
(there is no isStatusReg(r) macro used on 4.4BSD/luna68k)

Tested on LUNA with both wscons console and serial console.
 1.50  04-Sep-2021  tsutsui Fix several styles and formats.
 1.49  04-Sep-2021  tsutsui Use C99 designated initializer.
 1.48  04-Sep-2021  tsutsui Use proper macro for device register addresses.
 1.47  29-Dec-2020  tsutsui Make local functions static.
 1.46  01-Oct-2019  chs branches: 1.46.8;
in many device attach paths, allocate memory with KM_SLEEP instead of KM_NOSLEEP
and remove code to handle failures that can no longer happen.
 1.45  30-Jun-2019  tsutsui Misc KNF.
 1.44  21-Aug-2015  christos branches: 1.44.18;
- move prototypes to common header file
- rename function to avoid confusion with pseudo-device attach
 1.43  20-Aug-2015  christos include "ioconf.h" to get the 'void <driver>attach(int count);' prototype.
 1.42  25-Jul-2014  dholland branches: 1.42.4;
Add d_discard to all struct cdevsw instances I could find.

All have been set to "nodiscard"; some should get a real implementation.
 1.41  18-Jul-2014  tsutsui Minor KNF. No binary changes.
 1.40  16-Mar-2014  dholland branches: 1.40.2;
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.39  02-Feb-2014  tsutsui Misc cleanup of sio drivers.

- register softc of child devices as an argument of the sio interrupt
handler to avoid device_lookup_private() calls on every interrupt
- change type of sc_reg from (void *) to (struct sioreg *)
to avoid weird address offset calculations with redundant casts
- rename struct sio_softc members for consistency
- use a channel number passed via sio_attach_args in lunaws_attach()

No functional chnages. Tested on LUNA.
 1.38  02-Jan-2014  tsutsui Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.37  31-Dec-2013  tsutsui Use softint(9) properly to process TX/RX data between tty(4) layer.

It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.

Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler

Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
 1.36  23-Sep-2013  tsutsui Tab/space cleanup.
 1.35  22-Jan-2013  tsutsui branches: 1.35.2;
Whitespace cleanup.
 1.34  13-Oct-2012  tsutsui struct device * -> device_t, use device_xname() (from chs@)
 1.33  26-Nov-2011  tsutsui branches: 1.33.4; 1.33.8;
Reorganize IPL for devices.
 1.32  27-Jul-2011  tsutsui branches: 1.32.2;
KNF, use uintNN_t, tab/space cosmetics etc.
 1.31  27-Jul-2011  tsutsui - split device_t/softc and use device_t and cfdata_t etc.
- use aprint_normal(9)
- include "ioconf.h" for struct cfdriver decls
No crash on LUNA.
 1.30  24-Apr-2011  rmind Rename ttymalloc() to tty_alloc(), and ttyfree() to tty_free() for
consistency. Remove some unnecessary malloc.h inclusions as well.
 1.29  23-Nov-2009  rmind branches: 1.29.4; 1.29.6;
Use lwp_getpcb() on m68k ports, clean from struct user usage.
 1.28  26-Oct-2009  cegger kill extra whitespaces
reviewed by tsutsui@
 1.27  18-Mar-2009  cegger bcopy -> memcpy
 1.26  14-Mar-2009  dsl ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
 1.25  14-Mar-2009  dsl 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.24  14-Mar-2009  dsl Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
 1.23  13-Jun-2008  cegger branches: 1.23.4; 1.23.10;
use device_lookup_private to get softc
 1.22  28-Apr-2008  martin branches: 1.22.2; 1.22.4;
Remove clause 3 and 4 from TNF licenses
 1.21  19-Nov-2007  ad branches: 1.21.14; 1.21.16; 1.21.18;
- Factor out too many copies of the same bit of tty code.
- Fix another tty signalling/wakeup problem.
 1.20  04-Mar-2007  christos branches: 1.20.2; 1.20.18; 1.20.20; 1.20.24; 1.20.26;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.19  01-Oct-2006  elad branches: 1.19.4;
Adapt MD code to KAUTH_DEVICE_TTY_OPEN. Patch from Matt Fleming, thanks!
 1.18  23-Jul-2006  ad branches: 1.18.4; 1.18.6;
Use the LWP cached credentials where sane.
 1.17  14-May-2006  elad integrate kauth.
 1.16  11-Dec-2005  christos branches: 1.16.4; 1.16.6; 1.16.8; 1.16.10; 1.16.12;
merge ktrace-lwp.
 1.15  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.14  25-Apr-2004  matt branches: 1.14.12;
Constify the speedtab arrays
 1.13  28-Mar-2003  he branches: 1.13.2;
Initialize the two new members of consdev (cn_halt, cn_flush) to NULL so
that this compiles again.
 1.12  23-Oct-2002  jdolecek 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.11  02-Oct-2002  thorpej Use CFATTACH_DECL().
 1.10  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.9  17-Mar-2002  atatat branches: 1.9.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.8  02-May-2001  scw branches: 1.8.2; 1.8.4; 1.8.8;
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.7  31-Mar-2001  enami Remove unnecessary test of tp->t_linesw against NULL; they are results
of confusion while correcting compilation error after t_line is
replaced with t_linesw.
 1.6  07-Nov-2000  nisimura branches: 1.6.2; 1.6.4;
Fix a minor typo in the previous change of tp->t_linesw introduction.
 1.5  02-Nov-2000  eeh Adapt to new line discipline scheme.
 1.4  06-Mar-2000  thorpej - Implement cnbell() -- ring the console bell. The cn_bell entrypoint
is optional.
- Add cn_bell to statically allocated consdevs as appropriate.
 1.3  12-Jan-2000  nisimura Put a comment about BREAK detection; DDB fails to resume. Need to clear
the condition before resume?
 1.2  07-Jan-2000  nisimura - Make SCSI work; by kludges of machine/bus.h. TEAC streamer tape drive
found to be tweaked. Need extensive verifications.
- Add wsmouse node under ws; not useful this moment.
 1.1  05-Jan-2000  nisimura Introduce NetBSD/luna68k port into CVS repository.
 1.6.4.2  21-Jun-2001  nathanw Catch up to -current.
 1.6.4.1  09-Apr-2001  nathanw Catch up with -current.
 1.6.2.4  21-Apr-2001  bouyer Sync with HEAD
 1.6.2.3  22-Nov-2000  bouyer Sync with HEAD.
 1.6.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.6.2.1  07-Nov-2000  bouyer file siotty.c was added on branch thorpej_scsipi on 2000-11-20 20:10:26 +0000
 1.8.8.5  11-Nov-2002  nathanw Catch up to -current
 1.8.8.4  18-Oct-2002  nathanw Catch up to -current.
 1.8.8.3  17-Sep-2002  nathanw Catch up to -current.
 1.8.8.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.8.8.1  02-May-2001  nathanw file siotty.c was added on branch nathanw_sa on 2002-04-01 07:40:45 +0000
 1.8.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.8.4.1  10-Oct-2001  fvdl Convert all remaining devices.
 1.8.2.2  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.8.2.1  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.9.4.1  19-May-2002  gehenna Add device switch.
Replace the access to devsw table and the hard-coded majors with devsw API.
 1.13.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.13.2.4  25-Jan-2005  skrll Adapt to branch.
 1.13.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.13.2.1  03-Aug-2004  skrll Sync with HEAD
 1.14.12.4  07-Dec-2007  yamt sync with head
 1.14.12.3  03-Sep-2007  yamt sync with head.
 1.14.12.2  30-Dec-2006  yamt sync with head.
 1.14.12.1  21-Jun-2006  yamt sync with head.
 1.16.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.16.10.3  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.16.10.2  10-Mar-2006  elad generic_authorize() -> kauth_authorize_generic().
 1.16.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.

I expect *some* lossage here...
 1.16.8.2  11-Aug-2006  yamt sync with head
 1.16.8.1  24-May-2006  yamt sync with head.
 1.16.6.1  01-Jun-2006  kardel Sync with head.
 1.16.4.1  09-Sep-2006  rpaulo sync with head
 1.18.6.1  22-Oct-2006  yamt sync with head
 1.18.4.1  18-Nov-2006  ad Sync with head.
 1.19.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.20.26.1  08-Dec-2007  mjf Sync with HEAD.
 1.20.24.1  21-Nov-2007  bouyer Sync with HEAD
 1.20.20.1  09-Jan-2008  matt sync with HEAD
 1.20.18.1  21-Nov-2007  joerg Sync with HEAD.
 1.20.2.1  03-Dec-2007  ad Sync with HEAD.
 1.21.18.3  11-Mar-2010  yamt sync with head
 1.21.18.2  04-May-2009  yamt sync with head.
 1.21.18.1  16-May-2008  yamt sync with head.
 1.21.16.2  17-Jun-2008  yamt sync with head.
 1.21.16.1  18-May-2008  yamt sync with head.
 1.21.14.2  29-Jun-2008  mjf Sync with HEAD.
 1.21.14.1  02-Jun-2008  mjf Sync with HEAD.
 1.22.4.1  18-Jun-2008  simonb Sync with head.
 1.22.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.23.10.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.23.4.1  28-Apr-2009  skrll Sync with HEAD.
 1.29.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.29.4.1  31-May-2011  rmind sync with head
 1.32.2.3  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.32.2.2  30-Oct-2012  yamt sync with head
 1.32.2.1  17-Apr-2012  yamt sync with head
 1.33.8.4  03-Dec-2017  jdolecek update from HEAD
 1.33.8.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.33.8.2  25-Feb-2013  tls resync with head
 1.33.8.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.33.4.1  12-Jan-2014  bouyer Pull up following revision(s) (requested by tsutsui in ticket #1004):
sys/arch/luna68k/dev/siotty.c: revision 1.35
sys/arch/luna68k/dev/siotty.c: revision 1.36
sys/arch/luna68k/dev/siotty.c: revision 1.37
sys/arch/luna68k/dev/siotty.c: revision 1.38
sys/arch/luna68k/dev/lunaws.c: revision 1.25
sys/arch/luna68k/dev/lunaws.c: revision 1.26
sys/arch/luna68k/dev/lunaws.c: revision 1.27
sys/arch/luna68k/dev/siovar.h: revision 1.7
sys/arch/luna68k/dev/siotty.c: revision 1.34
struct device * -> device_t, use device_xname() (from chs@)
Whitespace cleanup.
Use softint(9) to pass received data into wskbd(9) and wsmouse(9) layers.
It might be problematic to call them from an interrupt handler at IPL_SERIAL.
Tab/space cleanup.
Use softint(9) properly to process TX/RX data between tty(4) layer.
It could cause possible locking issue to call tty(4) layer functions
from IPL_SERIAL interrupt handlers.
Changes details (mostly similar to com(4) and z8530tty(4)):
- allocate RX buffer and put data and status into it in the interrupt handler
- call t_linesw->l_rint from the software interrupt handler
- set the only first byte in siottystart() and use t_outq buffer to send
multiple TX data
- call the next t_linesw->l_start on TX complete in the software interrupt
handler
Also put more changes:
- handle cnmagic(9) properly (now entering ddb(4) by console BREAK works)
- allocate tty in the attach function as other drivers rather than first open
- use proper variable types
Remove initialization of unused t_softc in struct tty (to make pullup easier).
 1.35.2.1  18-May-2014  rmind sync with head
 1.40.2.1  10-Aug-2014  tls Rebase.
 1.42.4.1  22-Sep-2015  skrll Sync with HEAD
 1.44.18.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.46.8.1  03-Jan-2021  thorpej Sync w/ HEAD.

RSS XML Feed