Home | History | Annotate | Download | only in hd64461
History log of /src/sys/arch/hpcsh/dev/hd64461/hd64461pcmcia.c
RevisionDateAuthorComments
 1.57  06-Aug-2025  andvar s/attibute/attribute/ and s/previosly/previously/ in comments.
 1.56  02-Jun-2024  andvar fix various typos in word `interrupt', mainly in comments.
 1.55  11-Oct-2021  rin Fix workaround for SH-3 PCMCIA bug in accordance with description
found in TECH I vol. 14 (CQ Publishing, Tokyo, 2002, in Japanese),
as well as experiment on real hardware:

Byte-access to area 6 becomes word-access (both CE1# and CE2# are
wrongly asserted), if preceding access is word-wise. Inserting a
dummy byte-access works around the problem. Area 5 is not affected.

Therefore,

(1) Insert a dummy byte-read before all byte-wise operations.

(2) Restrict the workaround to area 6 (channel 0), and rename
fixup_sh3_pcmcia_area() to fixup_sh3_pcmcia_area6() for clarity.

Also, we used to use 0xba000000 (== HD64461_PCC0_IOBASE) as target
for the dummy read. However, this can modify device states, which
breaks ep(4) at least. Thus,

(3) Use HD64461_PCC0_MEMBASE as target for the dummy read. This is
assigned to attribute memory space, and byte-read should be
harmless.
 1.54  07-Aug-2021  thorpej Merge thorpej-cfargs2.
 1.53  24-Apr-2021  thorpej branches: 1.53.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.52  21-Nov-2020  thorpej branches: 1.52.2;
malloc(9) -> kmem(9)
 1.51  09-Nov-2013  christos branches: 1.51.42;
fix unused variable warnings
 1.50  13-Oct-2013  riz Catch up to recent changes in config_pending_{incr,decr}().
 1.49  26-Jul-2011  dyoung branches: 1.49.2; 1.49.12; 1.49.16;
Don't set the iobase and iosize members of pcmciabus_attach_args because
they're not used in any meaningful way.
 1.48  20-Jul-2011  dyoung Move macros _BUS_SPACE_WRITE(), _BUS_SPACE_WRITE_MULTI(), et
cetera, into <hpcsh/bus_util.h> for both hpcsh/bus_space.c and
dev/hd64461/hd64461pcmcia.c to use them.

(I haven't had a close look at what hd64461pcmcia.c is doing, but I have
a hunch that it is a good use for bus_space_tag_create(9).)
 1.47  19-Jul-2011  dyoung Change <machine/bus.h> to <sys/bus.h> throughout.

Split bus.h -> bus_{defs,funcs}.h.

Mark hpcsh/bus.h obsolete.
 1.46  05-Apr-2009  uwe Register null hooks with pmf(9) for now, which is no worse than before
and allows us to test other things.
 1.45  21-Mar-2009  uwe In the current code the even loop is never exited, but it's cleaner to
have explicit kthread_exit at the end of the event thread routine.
 1.44  21-Mar-2009  uwe Move channel attachment to event thread (we already have one, so it's
easier to do it there rather than mess with config_interrupts()).

From kiyohara@. Discussed with drochner@, who pointed out that pcmcia
drivers are expected to attach with interrupts enabled.
 1.43  28-Apr-2008  martin branches: 1.43.8; 1.43.14;
Remove clause 3 and 4 from TNF licenses
 1.42  27-Mar-2008  uwe branches: 1.42.2; 1.42.4;
Split device_t and softc.
 1.41  17-Feb-2008  uwe branches: 1.41.6;
Use aprint_*, device_xname.
 1.40  17-Feb-2008  uwe hd64461_set_bus_width - use named constants instead of bit shift magic.
 1.39  15-Dec-2007  perry __FUNCTION__ -> __func__
 1.38  17-Oct-2007  garbled branches: 1.38.2; 1.38.4; 1.38.8;
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.37  11-Jul-2007  uwe branches: 1.37.10;
Fix previous: sc_event_thread should be a pointer to lwp_t.
 1.36  09-Jul-2007  ad Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.35  03-Jan-2006  uwe branches: 1.35.28; 1.35.30; 1.35.36;
Fix constification fallout under #ifdef HD64461PCMCIA_DEBUG.
 1.34  03-Jan-2006  uwe HD64461PCMCIA options now come from "opt_hd64461pcmcia.h".
 1.33  18-Dec-2005  uwe branches: 1.33.2;
Use ANSI uintN_t types. Propagate "static" to function definitions.
 1.32  11-Dec-2005  christos merge ktrace-lwp.
 1.31  26-Aug-2005  drochner s/locdesc_t/int/g
 1.30  28-Jun-2005  drochner branches: 1.30.2;
convert remaining autoconf bus "submatch" functions to use the new
signature (passing locators), and remove some which obviously don't
serve any purpose
(untested, sorry)
 1.29  11-Aug-2004  mycroft Forget to reset to memory mode on power up.
The hd64465 looks a bit incomplete, but "not my problem".
 1.28  11-Aug-2004  mycroft Attempt to fix these up, but I have no way to test them.
 1.27  14-Jul-2004  uch enable to power off and reset card.
 1.26  11-Jul-2004  uch cosmetic changes. (whitespace,<tab>)
 1.25  27-Mar-2004  uwe When we attach a channel, set a high level to DRV control pin of the
external buffer for the PC card connected to the channel. This hack
makes pcmcia cards "being used" at the boot time (by WinCE or NetBSD)
correctly detected. A machine running with root on NFS can now be
properly rebooted.
 1.24  27-Mar-2004  uwe Add option HD64461PCMCIA_REORDER_ATTACH that attaches channels in
reversed order.

When you boot with two CF cards inserted, this options makes the one
in the "memory only" slot (channel 1), which is almost always the card
with the NetBSD install, attached as wd0.

Unlike using fixed unit numbers in the kernel config, if you boot with
only a single CF card, that single card will still be wd0 regardless
of which slot it is inserted in.

http://mail-index.netbsd.org/port-hpcsh/2003/10/23/0000.html provides
a more verbose description of why this option is convenient for most
usage patterns.
 1.23  23-Oct-2003  uwe In hd64461pcmcia_chip_io_map set *windowp to 0.

This driver ignores i/o window handle, but most 'at pcmcia'
attachments init their sc_io_window to -1 and then check at detach
time if it was changed from the "bad" value. Keep them happy, so that
they can correctly clean up when card is detached.
 1.22  15-Jul-2003  lukem __KERNEL_RCSID()
 1.21  01-Jan-2003  thorpej branches: 1.21.2;
Use aprint_normal() for cfprint routines.
 1.20  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL
 1.19  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.18  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.17  27-Sep-2002  thorpej Introduce a new routine, config_match(), which invokes the
cfattach->ca_match function in behalf of the caller. Use it
rather than invoking cfattach->ca_match directly.
 1.16  01-Jun-2002  lukem branches: 1.16.2;
SIMPLEQ rototill:
- implement SIMPLEQ_REMOVE(head, elm, type, field). whilst it's O(n),
this mirrors the functionality of SLIST_REMOVE() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE()
- remove the unnecessary elm arg from SIMPLEQ_REMOVE_HEAD().
this mirrors the functionality of SLIST_REMOVE_HEAD() (the other
singly-linked list type) and FreeBSD's STAILQ_REMOVE_HEAD()
- remove notes about SIMPLEQ not supporting arbitrary element removal
- use SIMPLEQ_FOREACH() instead of home-grown for loops
- use SIMPLEQ_EMPTY() appropriately
- use SIMPLEQ_*() instead of accessing sqh_first,sqh_last,sqe_next directly
- reorder manual page; be consistent about how the types are listed
- other minor cleanups
 1.15  28-Mar-2002  uch branches: 1.15.2;
rework HD64461, HD64465 interrupt handling.
 1.14  03-Mar-2002  uch platform dependent HD64461 PCMCIA module (power supply).
 1.13  28-Feb-2002  uch Cleanup register definition
 1.12  17-Feb-2002  uch SH3/SH4 common kernel support.
 1.11  11-Feb-2002  uch {} -> do {} (0)
 1.10  29-Jan-2002  uch clean up debug print and configuration.
 1.9  27-Jan-2002  uch clean up debug print and configuration.
 1.8  15-Dec-2001  soren To make dev/pcmcia work on platforms with 64-bit bus_addr_t and
32-bit bus_size_t (sparc), change the pcmcia_mem_map(9) offsetp
argument to bus_size_t as it is used as a bus_space offset.
 1.7  08-Oct-2001  uch HITACHI PERSONA support. patch by KIYOHARA Takashi
 1.6  13-Jul-2001  uch branches: 1.6.2;
cosmetic changes.
 1.5  13-Jul-2001  uch fix interrupt, voltage supply bug of channel 1.
(patch by Masanori Kanaoka).
 1.4  04-Jul-2001  uch branches: 1.4.2;
#ifdef notyet power on/off sequence code. it doesn't work.
 1.3  15-Mar-2001  uch HD64461 UART module support.
 1.2  08-Mar-2001  uch branches: 1.2.2;
channel 1 interface don't provide fake pcmcia io space tag.
 1.1  21-Feb-2001  uch branches: 1.1.2;
HD64461 driver (SH3 companion chip for Windows CE)
 1.1.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.2.2.3  27-Mar-2001  bouyer Sync with HEAD.
 1.2.2.2  12-Mar-2001  bouyer Sync with HEAD.
 1.2.2.1  08-Mar-2001  bouyer file hd64461pcmcia.c was added on branch thorpej_scsipi on 2001-03-12 13:28:52 +0000
 1.4.2.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.4.2.5  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.4.2.4  16-Mar-2002  jdolecek Catch up with -current.
 1.4.2.3  11-Feb-2002  jdolecek Sync w/ -current.
 1.4.2.2  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.4.2.1  03-Aug-2001  lukem update to -current
 1.6.2.1  11-Oct-2001  fvdl Catch up with -current. Fix some bogons in the sparc64 kbd/ms
attach code. cd18xx conversion provided by mrg.
 1.15.2.1  14-Jul-2002  gehenna catch up with -current.
 1.16.2.3  03-Jan-2003  thorpej Sync with HEAD.
 1.16.2.2  18-Oct-2002  nathanw Catch up to -current.
 1.16.2.1  01-Jun-2002  nathanw file hd64461pcmcia.c was added on branch nathanw_sa on 2002-10-18 02:37:23 +0000
 1.21.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.21.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.21.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.21.2.2  12-Aug-2004  skrll Sync with HEAD.
 1.21.2.1  03-Aug-2004  skrll Sync with HEAD
 1.30.2.4  27-Feb-2008  yamt sync with head.
 1.30.2.3  21-Jan-2008  yamt sync with head
 1.30.2.2  03-Sep-2007  yamt sync with head.
 1.30.2.1  21-Jun-2006  yamt sync with head.
 1.33.2.1  15-Jan-2006  yamt sync with head.
 1.35.36.1  03-Oct-2007  garbled Sync with HEAD
 1.35.30.1  11-Jul-2007  mjf Sync with head.
 1.35.28.1  15-Jul-2007  ad Sync with head.
 1.37.10.3  23-Mar-2008  matt sync with HEAD
 1.37.10.2  09-Jan-2008  matt sync with HEAD
 1.37.10.1  06-Nov-2007  matt sync with HEAD
 1.38.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.38.4.1  26-Dec-2007  ad Sync with head.
 1.38.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.41.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.41.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.42.4.2  04-May-2009  yamt sync with head.
 1.42.4.1  16-May-2008  yamt sync with head.
 1.42.2.1  18-May-2008  yamt sync with head.
 1.43.14.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.43.8.1  28-Apr-2009  skrll Sync with HEAD.
 1.49.16.1  18-May-2014  rmind sync with head
 1.49.12.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.49.2.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.51.42.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.52.2.2  22-Mar-2021  thorpej Audit CFARG_IATTR in config_found() calls, and remove it in situations
where the interface attribute is not ambiguous.
 1.52.2.1  22-Mar-2021  thorpej Mechanical conversion of config_found_sm_loc() -> config_found().
CFARG_IATTR usage needs to be audited.
 1.53.8.1  04-Aug-2021  thorpej Adapt to CFARGS().

RSS XML Feed