Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/mac68k/dev/adb_direct.c
RevisionDateAuthorComments
 1.73  14-Jun-2025  nat Increase delay when resetting adb.

This fixes intermittent device detection and no lockups when pressing the
keyboard or moving the mouse when the kernel is booting.
 1.72  05-Mar-2024  andvar Remove duplicate "when" word in comments.
 1.71  28-Feb-2024  thorpej Fix up the mac68k interrupt handlers to work with the new style common
clockframe layout and remove the CLOCK_FORMAT0 work-around. As a nice
side-effect, this also eliminates the super-sketchy stack unwinding used
by rtclock_intr to get at the interrupt stack frame.
 1.70  09-Feb-2024  andvar s/anthing/anything/ and s/be to/too/ in comments.
 1.69  21-Sep-2023  msaitoh s/ for for / for / in comment.
 1.68  08-Jan-2019  jdolecek no need to include <machine/param.h> if <sys/param.h> already included
 1.67  18-Oct-2014  snj branches: 1.67.18; 1.67.20;
src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
 1.66  25-Oct-2013  martin Mark potentially unused variable
 1.65  19-Oct-2013  martin Make sure we don't accidently pass an unsolicited packet as "ack only"
(which would dereference unitialized pointers)
 1.64  18-Oct-2013  martin Remove set but unused variables.
 1.63  04-Apr-2008  yamt branches: 1.63.38; 1.63.48; 1.63.54;
adb_read_date_time: remove an unused variable.
 1.62  03-Apr-2008  scottr Factor out ADB spin-wait timeout loop, and use it for synchronous
operations to access the PRAM RTC, etc. in the IIsi and Cuda cases.
Thanks to Martin Husemann for pointing out the flaw.

This is a slightly more thorough workaround for the issue Martin found
in PR 37611, as it affected more than just adb_read_date_time().
 1.61  01-Apr-2008  martin Add timeout to busy loops waiting for ADB command completition.
Turns the hard hang in PR port-mac68k/37611 into a warning.
 1.60  03-Dec-2007  ad branches: 1.60.14;
Interrupt handling changes, in discussion since February:

- Reduce available SPL levels for hardware devices to none, vm, sched, high.
- Acquire kernel_lock only for interrupts at IPL_VM.
- Implement threaded soft interrupts.
 1.59  17-Oct-2007  garbled branches: 1.59.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.58  09-Jul-2007  ad branches: 1.58.8; 1.58.10;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.57  08-Mar-2007  tsutsui branches: 1.57.2; 1.57.4; 1.57.10;
MI softintr(9)'fy.
Probably problematic, but LC630 is running at single user.
 1.56  24-Jan-2007  hubertf branches: 1.56.2;
Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
 1.55  24-Nov-2006  wiz s/independant/independent/, from Zafer.
 1.54  21-Jun-2006  rjs branches: 1.54.4; 1.54.6;
Rename shadowing time variable.
 1.53  24-Dec-2005  perry branches: 1.53.4; 1.53.8; 1.53.16;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.
 1.52  11-Dec-2005  christos merge ktrace-lwp.
 1.51  16-Jun-2005  jmc branches: 1.51.2;
Fixes for volatile problems
 1.50  15-Jan-2005  chs de-__P, remove register, ansify, b* -> mem*.
 1.49  15-Jul-2003  lukem __KERNEL_RCSID()
 1.48  03-Nov-2002  shiba branches: 1.48.6;
Support internal ADB keyboard of PowerBook 190,190cs.
The keyboard works fine now. I don't confirm working internal
ADB track pad.

But an internal IDE drive is not recognized, and
an internal SCSI host controller(sbc driver) don't work yet.
 1.47  30-May-2002  thorpej - Don't use multi-line string literals.
- Statements must follow labels.
 1.46  05-Mar-2002  shiba branches: 1.46.6;
Fix up a bug which PB150 shuts down when one boots up in progress.
PB150 will work with SCSI disk. But we cannot use an internal IDE
disk yet.

Reviewed by briggs
 1.45  20-Nov-2001  chs prepare for ELF:
- add "%" prefix to register names in assembly code.
- use _C_LABEL() where necessary.
- use packed structures where necessary to match the old ABI.
 1.44  27-Sep-2000  scottr branches: 1.44.4; 1.44.8;
Set up ADB hardware type before making decisions based on same.
This is part of PR 9852 from Daishi Kato.
 1.43  03-Jul-2000  scottr Stabilize ADB support for some non-Apple ADB peripherals. This is the
second (and final) part of the fix for PR 10086. (There are no longer
any infinite-wait busy loops in the ADB driver!)
 1.42  23-Mar-2000  thorpej branches: 1.42.4;
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.41  19-Mar-2000  scottr Add and use macros to build ADB FLUSH, LISTEN, and TALK commands.
 1.40  18-Mar-2000  scottr Check to make sure we get a valid handler ID in response to a TALK R3.
 1.39  07-Mar-2000  scottr Low-level drivers, like the Power Manager driver, can get us into a major
funk when they misbehave and give us unexpected results. Specifically:

- Don't assume that the first free slot is at the top of the table if
we can't find one.
- Don't increment ADBNumDevices when backfilling "holes" left by devices
that didn't respond to a TALK R3 during the initial device scan.
- Don't assume that an address reassignment worked; make sure something
responds on the new address before plowing forward.
- If after device reassignment there are no free slots, make sure to
indicate this fact.
- Failing all else, handle the situation where we run out of slots in
the device table -- which now should "never" happen -- gracefully.

While the Power Manager driver still sometimes misbehaves, it shouldn't
cause the system to crash/hang due to us walking off the end of the
device table.
 1.38  21-Feb-2000  scottr Explicitly include headers needed by iopreg.h
 1.37  21-Feb-2000  scottr Bracket disabled IIfx IOP code with #ifdef __notyet__, rather than
commenting it out or using #if 0.
 1.36  25-Dec-1999  scottr Apparently, the Mac TV is a re-packaged Performa 550. Add code to
recognize this so that Mac TV users can finally ditch the MRG_ADB option.
 1.35  10-Dec-1999  scottr An interrupt handler may change adbInCount underneath us, so qualify the declaration
with volatile. The bug didn't show its face until more agressive
optimization showed up, apparently a result of the last egcs upgrade.
(The interrupt handling changes from June have certainly also played
a part.) Thanks to Ken'ichi Ishizaka for discovering the problem.
 1.34  28-Nov-1999  scottr If there is only one ADB device, it will do us no good to avoid it
when guessing which device to poll next. Resolves PR 7407, but the
bug is a lot older than that.
 1.33  07-Nov-1999  scottr In the interrupt handlers, check adb_polling instead of
adb_initted to decide whether to handle 'recovered' interrupts
immediately.
 1.32  07-Nov-1999  scottr Oops... last rev created an unused variable. While here, clean up
adb_reinit()'s variables a bit, too.
 1.31  07-Nov-1999  scottr Convert one more buffer copy that I missed in rev 1.28.
 1.30  07-Nov-1999  scottr Always using polling for poweroff (from macppc).
 1.29  07-Nov-1999  scottr ite_polling -> adb_polling
 1.28  06-Nov-1999  scottr Convert buffer copies to memcpy().
 1.27  06-Nov-1999  scottr Add more delay in adb_reinit() (from macppc).
 1.26  06-Nov-1999  scottr branches: 1.26.2;
Don't invoke the upper half handler unless we're still
initializing the ADB bus. This fixes PR 7870.
 1.25  29-Jun-1999  briggs branches: 1.25.2; 1.25.4; 1.25.6;
Poll for serial interrupts. Return to 3000us delay instead of 4000us in init.
 1.24  28-Jun-1999  briggs Unfortunately, several changes that are intermingled:
- Add initial IOP support. ADB doesn't work yet for me, but it's here so
that others will be encouraged to work on it. ADB_HW_IOP basically
is configured as a NOP so that serial consoles will continue to work.
- Roll via1_intr and via2_intr into the intr.c scheme--this also required
changing rtclock_intr to grovel the stack differently so that hardclock
gets the right arguments and softclock() doesn't get all reentrant.
- Make via1 interrupts parallel to via2 interrupts--handlers get a pass-
through pointer and we can register handlers. Register via1 interrupt
with intr_establish()--normally level 1, level 6 for A/UX scheme.
- Use intr_establish() to set real via2 interrupt handler instead of the
hacked function pointer.
- Reorganize adb-direct interrupts so that a function call is removed.
- Implement A/UX interrupts for all Quadras right now. We may need to
special case some Quadras, but Linux folks are reporting success on
several models.
- Fix intrnames to be accurate for the normal, PSC, and A/UX interrupt
configurations.
 1.23  15-May-1999  scottr From Yasuhiro Endoh: Performa 58x uses ADB soft poweroff.
 1.22  06-May-1999  scottr Correct two more problems of the same type as in rev 1.21: use the length
of the buffer you're copying from as the loop interator, not the length
of the buffer you're copying to. Also, rewrite print_single() with
pointer instead of array operators. Appears to correct some ADB-related
`hangs' during autoconfig.
 1.21  18-Mar-1999  scottr branches: 1.21.2;
Fix an obscure bug in send_adb_cuda() found be comparison with
the macppc version.
 1.20  11-Feb-1999  ender branches: 1.20.2;
o Change various attach arg and softc datatypes to ints.
o Use explicit typecasts when interfacing with MRG data

Should fix port-mac68k/6839. Patch supplied by
Frederick Bruckman <fb@enteract.com>
 1.19  14-Nov-1998  briggs Make this compile _and_ link with DEBUG / ADB_DEBUG defined.
 1.18  14-Nov-1998  briggs Allow this to compile with DEBUG defined.
 1.17  26-Oct-1998  scottr Make it compile for MRG_ADB kernels.
 1.16  23-Oct-1998  ender New ADB "bus" interface:
o Separate ms and kbd drivers
o aed device for compatibility
o debug message cleanup in hardware direct support (from scottr)
 1.15  12-Aug-1998  scottr New framework for handling processor interrupts, derived in part from
the hp300 port.

- Interrupts 3-6 use this immediately. Interrupt 7 is a special case,
and the VIA interrupts (1 and 2) will be addressed when that code is
rototilled.

- Modify the zs front end to register with the appropriate interrupt
controller: through the PSC on the AV Quadras, and direct to
interrupt 4 on the rest. Arrange to have the appropriate zsc_softc
supplied to us at interrupt time.

- Modify the direct ADB driver (and its PowerManager cousin) to call
intr_dispatch(), rather than zshard(). XXX This is a kludge, but at
least limits the brokenness to the ADB drivers, now.

As a side effect, this should fix PR 5590. Thanks to Bill Studenmund for
correctly determining the cause of the problem reported there.
 1.14  29-Mar-1998  scottr Better integration of Power Manager IC ADB driver into the direct ADB driver framework,
from Takashi Hamada. Also includes a handler for unsolicited ADB
packets.
 1.13  26-Mar-1998  scottr Add Performa 580/588 to the list of machines which have a Cuda chip.
XXX - we should really be using machine ID symbolic constants here, not
numbers.
 1.12  23-Feb-1998  scottr Rewritten II-series ADB code from John Wittkoski. Also, a whole
lotta KNF.
 1.11  21-Feb-1998  scottr Unify ADB options and place them all into opt_adb.h. Provide a knob to
enable ADB debugging messages if ADB_DEBUG is configured.
 1.10  09-Jan-1998  scottr Another update from John: if we're polling, e.g. in ddb, pass the
keystroke to the upper half directly.
 1.9  07-Jan-1998  scottr Update from John Wittkoski: the Color Classic and Color Classic II
have Cuda hardware, not IIsi-based.
 1.8  07-Nov-1997  scottr Update from John Wittkoski: bug fixes for Cuda support.
 1.7  04-Nov-1997  briggs remove an obsolete comment.
 1.6  11-Aug-1997  scottr branches: 1.6.4;
Make #include directives consistent. All MD headers are of the form:

#include <mac68k/{dev,mac68k}/foo.h>
 1.5  21-Apr-1997  scottr branches: 1.5.4;
April 18 update from John Wittkoski, w/space vs. tab KNFing by me.
 1.4  18-Apr-1997  scottr Make sure to call adbop() on Power Manager-based machines. Noted by
Takashi Hamada, who also provided the code I based this modifcation
on.
 1.3  14-Apr-1997  scottr Use the new opt_mrg_adb.h header.
 1.2  08-Apr-1997  scottr Fix several more instances where the volatile modifier was needed.
From Allen.
 1.1  08-Apr-1997  scottr Direct-to-hardware ADB interface/driver, written by John P. Wittkoski.
 1.5.4.1  23-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.6.4.2  29-Jan-1998  mellon Pull up 1.9
 1.6.4.1  11-Nov-1997  mellon Pull rev 1.7 and 1.8 up from trunk (scottr)
 1.20.2.7  25-Dec-1999  scottr Sync with main branch.
 1.20.2.6  12-Dec-1999  scottr Sync with main branch.
 1.20.2.5  28-Nov-1999  scottr Sync with main branch.
 1.20.2.4  09-Nov-1999  scottr Sync with main branch.
 1.20.2.3  02-Nov-1999  scottr [Redo] Sync with main branch.
 1.20.2.2  16-May-1999  scottr Sync with main branch.
 1.20.2.1  05-Mar-1999  scottr checkpoint: input side code should work. no output side yet.
 1.21.2.5  16-Dec-1999  he Pull up revision 1.35 (requested by scottr):
Make adbInCount volatile to fix problems uncovered by aggressive
optimization.
 1.21.2.4  29-Nov-1999  he Pull up revision 1.34 (requested by scottr):
Make it possible to have only one ADB device on machines with
first-generation ADB hardware. Fixes PR#7407.
 1.21.2.3  21-Nov-1999  he Pull up revisions 1.26-1.33 (via patch, requested by sr):
Clean up the ADB driver, and eliminate duplicate keystrokes under
heavy load, fixing PR#7870.
 1.21.2.2  07-Jun-1999  perry pullup 1.22->1.23 (scottr): make auto power off work on Performa 58x's
 1.21.2.1  06-May-1999  cgd branches: 1.21.2.1.2; 1.21.2.1.4;
pull up rev 1.22 from trunk (scottr)
 1.21.2.1.4.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.21.2.1.2.2  01-Jul-1999  thorpej Sync w/ -current.
 1.21.2.1.2.1  21-Jun-1999  thorpej Sync w/ -current.
 1.25.6.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.25.4.1  15-Nov-1999  fvdl Sync with -current
 1.25.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.26.2.2  06-Nov-1999  scottr Don't invoke the upper half handler unless we're still
initializing the ADB bus. This fixes PR 7870.
 1.26.2.1  06-Nov-1999  scottr file adb_direct.c was added on branch comdex-fall-1999 on 1999-11-06 22:25:21 +0000
 1.42.4.2  28-Sep-2000  scottr Pull up rev 1.44 from scottr (approved by thorpej):
Set up ADB hardware type before making decisions based on same.
 1.42.4.1  21-Sep-2000  scottr Pull up rev 1.43 from scottr:
Stabilize ADB support for some non-Apple ADB peripherals.
 1.44.8.4  11-Nov-2002  nathanw Catch up to -current
 1.44.8.3  20-Jun-2002  nathanw Catch up to -current.
 1.44.8.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.44.8.1  08-Jan-2002  nathanw Catch up to -current.
 1.44.4.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.44.4.2  16-Mar-2002  jdolecek Catch up with -current.
 1.44.4.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.46.6.1  14-Jul-2002  gehenna catch up with -current.
 1.48.6.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.48.6.4  17-Jan-2005  skrll Sync with HEAD.
 1.48.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.48.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.48.6.1  03-Aug-2004  skrll Sync with HEAD
 1.51.2.5  07-Dec-2007  yamt sync with head
 1.51.2.4  03-Sep-2007  yamt sync with head.
 1.51.2.3  26-Feb-2007  yamt sync with head.
 1.51.2.2  30-Dec-2006  yamt sync with head.
 1.51.2.1  21-Jun-2006  yamt sync with head.
 1.53.16.1  13-Jul-2006  gdamore Merge from HEAD.
 1.53.8.1  26-Jun-2006  yamt sync with head.
 1.53.4.1  09-Sep-2006  rpaulo sync with head
 1.54.6.1  10-Dec-2006  yamt sync with head.
 1.54.4.2  01-Feb-2007  ad Sync with head.
 1.54.4.1  12-Jan-2007  ad Sync with head.
 1.56.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.57.10.1  03-Oct-2007  garbled Sync with HEAD
 1.57.4.1  11-Jul-2007  mjf Sync with head.
 1.57.2.2  03-Dec-2007  ad Sync with HEAD.
 1.57.2.1  15-Jul-2007  ad Sync with head.
 1.58.10.2  09-Jan-2008  matt sync with HEAD
 1.58.10.1  06-Nov-2007  matt sync with HEAD
 1.58.8.1  09-Dec-2007  jmcneill Sync with HEAD.
 1.59.2.1  08-Dec-2007  mjf Sync with HEAD.
 1.60.14.2  02-Jun-2008  mjf Sync with HEAD.
 1.60.14.1  03-Apr-2008  mjf Sync with HEAD.
 1.63.54.1  18-May-2014  rmind sync with head
 1.63.48.2  03-Dec-2017  jdolecek update from HEAD
 1.63.48.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.63.38.1  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.67.20.1  10-Jun-2019  christos Sync with HEAD
 1.67.18.1  18-Jan-2019  pgoyette Synch with HEAD

RSS XML Feed