pccard layer and rename them PCMCIA_CARD and PCMCIA_CARD2 respectively
(note, this is being done with an eye towards NetBSD integreation so
it is easier to keep lists of cards between us and them in sync).
Use this in the an and wi drivers.
Briefly, the significant changes include:
* Way better resource management in pccbb, pccard and cardbus.
* pccard hot-removal now appears to work.
* support pre-fetchable memory in cardbus.
* update cardbus to support new pci bus interface functions.
* Fix CIS reading to no longer use rman_get_virtual().
What's not there, but in the works:
* pccard needs to do interrupt properly and not read the ISR on single
function cards.
* real resource management for pccard
* a complete implementation of CIS parsing
* need to look into how to correctly use mutex in pccbb
This is the first part of a two-part update to NEWCARD. Changes in this
commit are non-functional, and includes the following:
* indentation and other changes to meet style(9).
* other minor style consistancy changes
* addition of comments
* renaming of device_t variables to be consistant across all of NEWCARD.
(note that not all style violations are fixed in this commit -- those that
aren't will be clobbered by the next commit.)
we need to delete the info from the list as well as zero out the res
pointer we saved in the code.
Also made a few style(9) changes while I was at it. Don't use if
(ptr) or if (!ptr), but compare against NULL. Compare against NULL
rather than 0. Don't have useless blocks.
There are likely other problems as well, but at least the wi based
wireless card with memory listed in its cis doesn't panic the system
when the card is inserted.
pccard in the kernel for those drivers with pccard attachments. This
makes the compat layer a little larger by introducing some inlines,
but should almost make it possible to have independent attachments.
The pccard_match function are the only one left, which I will take
care of shortly.
o 1.111 imp Sync with FreeBSD.
o 1.110 nonaka Add Roland SCP-55
o 1.109 ichiro add NANOSPEED ROOT-RZ2000 WLAN Card
o 1.108 ichiro add EMTAC A2424i 11Mbps WLAN Card
o 1.107 haya Add IO Data CBIDE2 ata interface card.
o 1.106 jhawk s/NULL}/NULL }/
o 1.105 thorpej " " -> "&sp" in two entries, per Rafal Boni.
o 1.104 thorpej Add SMC 2632W. From Rafal Boni, kern/11775.
o 1.103 drochner add IBM microdrive
o 1.102 soren Typo.
o 1.101 hubertf Add ELSA WaveLAN card & a noname clone(?)
o 1.100 toddpw Socket Comm. PC Card Ethernet, and tidy up naming.
o 1.99 msaitoh MELCO LPC2-TX, Telecom Device TCD-HPC100,
MACNICA ME1-JEIDA
o 1.98 imp Sort BAY into numerical order. (already in FreeBSD)
The pccard_function_init() call creates a bunch of inactive resources
that are persistant and configured on demand. When the child driver
"allocates" a resource it is connected up to one of these. When the
child releases the resource, we should not delete our copy, just
deactivate it again. Otherwise there is nothing to recreate it again
after several probe functions have run and done an alloc/release cycle.
INVARIANTS shows 0xdeadc0de without this.
More work is needed to do a sweep though the pccard_function_disable()
call to actually delete the resources for real. Right now, we leak
memory on eject (at best), so Dont Do That(TM) yet. This affects
16 bit pccards on a cardbus bridge only. This will be fixed soon, but
for now it gets the cards working.
Reviewed by: imp
to conform to style(9), plus one other convention that I use:
o Declare variables at the start of the function, rather than in blocks
when it doesn't help understanding (mine).
o 80 column limit.
o BSD style statement continuation, rather than "gnu" style.
bus to use. We need to set it here.
This fixes the problem where a probe routine establishes and
disestablishes the interrupt and then we get a panic in the probe
routine.
However, we pass the pointer to the interrupt hanlder count to the
parent bus, which writes its own cookie there, so there may be some
problems with that which isn't apparent at the moment.
Commit made from: laptop running NEWCARD with sn driver (which works,
but gets the wrong ethernet address).
o Fix OLDCARD to use the new interface.
o Rename the offsetp argument to deltap to more closely reflect what it
is returning (it returns the delta from the requested value to the actual
value).
o Remove duplicate $FreeBSD$ in pccbb.c
o Allow deltap to be NULL.
o Convert new isa pcic driver and add XXX comments that this function isn't
actually implemented there (which means that NEWCARD pccard stuff won't
work there until it is).
o Revert attempts to make old inferface work in NEWCARD.
Subitted by: peter (Parts of the new version code)
by even a compile of the OLDCARD code, was unapproved by me the keeper
of OLDCARD and broke OLDCARD and the ray driver.
Adjust new code to cope with the older interface.
If the interface changes in the future, it ***MUST*** be cleared by me
so that the OLDCARD impacts taken into account. It code in card_if.m
is used jointly by both OLDCARD and NEWCARD.
- pccbb no longer needs to remember whether a card is inserted.
- pccbb reissues insertion on load of cardbus/pccard modules.
- got rid of unnecessary delays in power functions.
- Cardbus children are no longer deleted if probe/attach fails.
- non-attached child devices are reprobed at driver_added.
* CARD interface to read CIS
- added card_cis_read/card_cis_free interface to read arbitrary CIS
data. This currently is only implemented in cardbus.
* pccard begins to work
- pccard can now use higher memory space (and uses it by default).
- set_memory_offset interface changed.
- fixed ccr access, which was broken at multiple locations.
- implement an interrupt handler - pccard can now share interrupts.
- resource alloc/release/activate/deactivate functions gutted: some
resources are allocated by the bridge before the child device is
probed or attached. Thus the resource "belongs" to the bridge, and
the pccard_*_resource functions need to fudge the owner/rid.
- changed some error conditions to panics to speed debugging.
* Mutex fix - Giant is entered at the beginning of thread
o Change name of bus
o Change the panic on resource allocation failure to just a message. We'll
work out why this fails later in the pcic/pccbb code merge.
o Report function number and config index on probe line
o Activate the resources (I hope) when RF_ACTIVE is set on those resources
I'm allocating on behalf of my children.
o Always enable interrupts on multifunction cards in the multifunction
register.
o Remember the resources we allocate for the config entry.
o When we get the resource, do an resource_list_add and do a
resource_list_delete if we fail later in the resource list.
o In the pccard bus, we allocate the resources. When a child asks for
them, just return the resources that we allocated (thanks to Paul
Richards and Mike Smith for the idea).
before the attach. Things aren't completely working, but this is a good
checkpoint.
Also, initialize the dev member of the function as soon as we add it
to the parent.
o initialize ivars with bzero.
o remove interrupt function pointer. netbsd needs it, but we don't.
o add lots of comments about bogus things that I've been kludging to try
to make the simple cases work.
o add new ivar accessor for cis4 to match cis3. likely neither will be
needed, but it doesn't hurt to have it.
compat probe routines to work).
o Have a null driver_added routines. We need to be careful about probing
until after we know we have a card. For the moment, we do nothing
(which is safe). This fixes a panic when a driver is loaded w/o a
card in the slot.
XXX still need to fix the resource list code. It is totally busted and
XXX causes a panic in the child printing routine after the probe has
XXX succeeded.
pcmciavar.h 1.9->1.12
1.12, enami, minor coding nits
1.11, augustss, (pcmcia_devinfo NRFB)
1.10, cgd, add generic lookup routines
pcmcia.c 1.14->1.23
1.23, drochner, (probe code printing, NRFB)
1.22, augustss, KNF
1.21, uch, (hpcmips tweaks NRFB)
1.20, chopps, remove bogus debug
1.19, enami, minor coding nits
1.18, augustss, (pcmcia_devinfo NRFB)
1.17, nathanw, LP64 printf fixes
1.16, cgd, add generic lookup routines
1.15, aymeric, printf fixes
NRFB == not relevant to freebsd
o Expand the pccard matching routines to include the ability to match
against the CIS strings since our current driver database is based on
that.
o Add lots more ivars to get the information necessary to snag these values.
possible to have different probe/attach semantics between the two
systems and yet still use the same driver for both.
Compatibility methods for OLDCARD drivers. We use these routines to make
it possible to call the OLDCARD driver's probe routine in the context that
it expects. For OLDCARD these are implemented as pass throughs to the
device_{probe,attach} routines. For NEWCARD they are implemented such
such that probe becomes strictly a matching routine and attach does both
the old probe and old attach.
compat devices should use the following:
/* Device interface */
DEVMETHOD(device_probe), pccard_compat_probe),
DEVMETHOD(device_attach), pccard_compat_attach),
/* Card interface */
DEVMETHOD(card_compat_match, foo_match), /* newly written */
DEVMETHOD(card_compat_probe, foo_probe), /* old probe */
DEVMETHOD(card_compat_attach, foo_attach), /* old attach */
This will allow a single driver binary image to be used for both
OLDCARD and NEWCARD.
Drivers wishing to not retain OLDCARD compatibility needn't do this.
ep driver minorly updated.
sn driver updated more than minorly. Add module dependencies to allow
module to load. Also change name to if_sn. Add some debugging code.
attempt to fix the cannot allocate memory problem I'd been seeing.
Minor formatting nits.
that it looks for an acceptible one. Once it finds it, it should set
the resources for the device. I say "should" because I've not written
that. Also set an ivar for the child of pccard. Minor fix to the
attach message printed, we lose the slot number, which I'll have to
restore later. Adjust the pccard ivar so that we can save the
function that corresponds to this driver so we can enable and disable
it more easily. Save a pointer to the function so we know what we're
dealing with.
There should be some way for the driver to specify which cfg it wants
to activate. For now the pccard_function_init function just picks
one, but we'll have to revisit this going forward. I'm not doing it
now because I'd need some way to activate the card many times and I'm
not sure that is desirable or even safe with some cards.
1.6 2000/04/12 21:07:55 scw
Add support for the SOHOware PCMCIA Ethernet card, model ND5100-E.
This seems to be a re-badged NDC (National Datacomms. Corp) card.
It needs a quirk entry due to lack of manufacturer tuple in the CIS.
For some reason, the 'Tx/Rx' LED on the connector module is inverted
such that it is off during network activity...
o Sync to NetBSD (rev NetBSD-user edited-log):
1.97 onoe add Samsung MagicLAN SWL-2000N
1.96 gmcgarry Add entries for all Xircom ethernet models.
1.95 onoe Add Farallon SkyLINE 11mb card as Intersil Prism2 [...]
1.94 joda add 3Com 3CRWE737A (AirConnect)
1.93 soren Include vendor name for IBM products.
1.92 onoe Add Farallon SkyLINE Wireless LAN Card for awi(4) [...]
1.91 soren Add Olicom GoCard.
1.90 gmcgarry Clean up XIRCOM entries
- Add entry for Xircom CreditCard Ethernet + Modem 28
- Add entry for Intel EtherExpress PRO/100
- Add entry for Compaq Netelligent 10/100 Ethernet
1.89 is RATOC REX-R280 (another if_mbe_pcmcia card) support by [...]
1.88 joda Panasonic KXLC003
1.87 scw [...] SOHOware PCMCIA Ethernet card, model ND5100-E [...]
1.86 itojun add CIS for Corega Wireless LAN PCC-11 [...]
o Minor diffs between the two files corrected to aid future sync.
I've done this by having requests to allocate memory propigate up the
tree. We'll see how well this works and reevaluate if it isn't
working well. Also initialize ptr in the tuple. As well as minor
reorg of memory allocation. Likely need to do similar things for I/O
when the time comes.
I've move all defines from pccardchip.h into pccardvar.h and
eliminated pccardchip.h.
o Eliminate cross calls between the devices. Instead move to using the
newbus messaging system. Added three new card calls: attach_card,
detach_card, get_type.
o Eliminate interrupt routine in pccard we never use.
o Move from deactivate to detach for removing cards.
o Start mapping CIS memory, but it is broken and causes panics. At least
it is closer to working than before.
o Eliminate struct device everywhere. It was bogus.
o Initialize softc for pccard device so we have valid pointers to
ourselves.
o Implement routine to find the pcic ivar for a child device of the pccard so
we can use it to talk to the pcic hardware.
o Lots of minor tiding up.
This version now panics when we try to read the CIS. The next batch
of work to make this work is what was outlined in my posting to mobile
about resource allocation and such.
Pass sc->dev rather than a bogusly cast pccard_softc *sc.
This allows us to insert and remove cards w/o panicing the kernel.
However, the cis isn't mapped in, so the pccard_scan_cis function
fails.
Remove RF_PCCARD_ATTR in anticipation of removing it from sys/rman.h
Add interface for setting "attributes" of pccard/cardbus devices.
Minor formatting nits.
Many ed-based Ethernet PC-cards can't get correct MAC address without
this patch.
Submitted by: Takanori Watanabe <takawata@shidahara1.planet.sci.kobe-u.ac.jp>
Reviewed by: Warner Losh <imp@village.org>
Driver is not functional yet, but does compile. Tests with xe cards
indicates that it doesn't panic the machine when they are present, but
fail to probe. Interface help in the pcic/pccard layers are needed to
complete this driver.
o ifdef out pccardchip.h (almost all of it, there are dangling bits
o Add rid/res members to pccard_function
o remove pct/pch from pccard_softc
o map memory properly in scan_cis (almost, see XXX for more work)
o manage ccr.
o remove bogus comment I added about touching the ccr being a layering
violation for pccard. It is properly done at that level.
o More function prototyping
layer is trying to access the now unexistant chip functions.
o Added DEVPRINTF which is like DPRINTF only calls device_printf.
o Made it possible to define PCICDEBUG
o Remove ph_parent and use the softc pointer sc instead in pcic_handle.
o Remove all references to dv_xname
o Add some debug messages.
o enable MI attach/detach calling for pccard.
o convert pcic_chip_socket_{en,dis}able to pcic_{dis,en}able_socket
and connect them to the power_{enable,disbale}_socket.
o Remove pccard pointer from pcic_softc.
o GC some unused pccard functions.
o Convert pccard_chip_socket* to POWER_ENABLE_SOCKET
o kill pccard_attach_args.
o power_if.m updates. More to come.
now, but we're getting interrupts!
o Add pcic_suspend/pcic_resume so we can detach our children on suspention
and fix the state of the pcic on resume.
o Remove some unused parts of softc.
o Centralize resource activation/deactivation for pcic bridge chip in
the stylistic pcic_activate/pcic_deactivate.
o Add bus_print_child method so we can see the pccard attachment.
o Add pcic_identify in an attempt to make it possible to automatically id
the pcic devices. This works great, but we cannot divine the irq to use
from this method, nor the memory hole. For the moment, KLUDGE irq to be
10 and memory hold to be 0xd0000.
o Loose the pnp probe stuff. This may be a big mistake, but it is easy
enough to add back later. I did this so the identify routines can do their
thing unmolested by pnp information. The whole identify thing may be a bad
idea to be ripped out later.
o change return type of pcic_intr to void, make it static and ripple
this through the code.
o Add explicit call to bus_generic_attach at the end of pcic_attach to
get any children probed/attached.
o add some comments about future directions/questionable things being
done at different layers, etc.
o Implement memory and I/O activation/deactivation. irq not handled.
o switch pcic_chip functions around to use more convenient types.
o kill __P and most of the old K&R prototypes just to be mean.
o minor other nits
device_add_child_ordered(). 'ivars' may now be set using the
device_set_ivars() function.
This makes it easier for us to change how arbitrary data structures are
associated with a device_t. Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.
Despite my best efforts I've probably forgotten something so let me know
if this breaks anything. I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.
Reviewed by: peter, dfr
Support for TDK LAC-CF010 by Ichiro Fukuhara
(ichiro@ichiro.org) on kern/8900 ichiro test TDK CF Card on
Opensource matsuri,tokyo and send patch to us. thanx.
it would work), or a specialized one. Most of these have been
creatively stolen from pccard_nkb, which in turn stole from isa
showing that generic bus_ versions of bus_{set,get,delete}_resource
might be profitable.
Fix a couple of minor bugs introduced in the last round of updates
from NetBSD.
Start on the pccard_ivar structure which will hold the resources and
slot number.
Add tcic as a possible attachment for pccard and rename the attachment
for pcicx to pcic since the name has changed since I originally wrote
this stuff.
Next up:
stringing together the various memory and I/O
allocation/mapping primitives in i82365.c, final touches on the isa
attach routine and other fun stuff in that line of attach.
socket attach code. We now have at least a chance for pccard devices
appearing in the future.
This is a snapshot of ongoing work. Proceed at your own risk.
incomplete and likely has problem. The code was originally pcmcia,
but I renamed it to pccard and made it compile on FreeBSD -current. I
converted SIMPLEQ to STAILQ as well as a few sc->dev.xname ->
device_printf changes. This is a green port of fairly mature code.
I derived this work from the FreeBSD newconfig project
(http://www.jp.freebsd.org/newconfig). Any problems with it are
likely introduced by me.
Obtained from: newconfig project
This means that we will not have to have a bpf and a non-bpf version
of our driver modules.
This does not open any security hole, because the bpf core isn't loadable
The drivers left unchanged are the "cross platform" drivers where the respective
maintainers are urged to DTRT, whatever that may be.
Add a couple of missing FreeBSD tags.
* Conformance with Dingo specification. This includes:
Collision/error statistics gathering.
Multicast address filtering, eg. the hash filter.
Initialisation and interrupt handling sequences.
Note that I've started on some of this already in v1.20.
* The probe routine needs some more work, to identify oddities such as the
REM10.
* There are still problems with the autonegotiation code; specifically, it
won't autonegotiate with some 10/100 hubs. This might simply be the hardware
not getting along, in which case there's nothing we can do, but it's still
worth investigating
* CEM28/CEM33 support. Should be able to integrate this directly from the
Linux code.
* Performance enhancements:
Full-duplex on 10Mbit networks.
Virtual shared-memory mode.
Early send and receive modes.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/
The cdevsw_add() function now finds the major number(s) in the
struct cdevsw passed to it. cdevsw_add_generic() is no longer
needed, cdevsw_add() does the same thing.
cdevsw_add() will print an message if the d_maj field looks bogus.
Remove nblkdev and nchrdev variables. Most places they were used
bogusly. Instead check a dev_t for validity by seeing if devsw()
or bdevsw() returns NULL.
Move bdevsw() and devsw() functions to kern/kern_conf.c
Bump __FreeBSD_version to 400006
This commit removes:
72 bogus makedev() calls
26 bogus SYSINIT functions
if_xe.c bogusly accessed cdevsw[], author/maintainer please fix.
I4b and vinum not changed. Patches emailed to authors. LINT
probably broken until they catch up.
v1.19 (1999/04/15) updates the CEM56/REM56 support.
Current bugs & misfeatures
--------------------------
* CE2 cards still not working reliably. Unclear if this is related to
packet I/O code or interrupt handling.
* Autonegotiation support remains flaky. We're now OK with 10Mbit auto
hubs, but certain combination of hardware will fail to connect.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/
v1.18 (1999/04/08) adds support for CEM56 and REM56 multifunction cards.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/
v1.17 (1999/03/28) has xperimental fixes to 10Mbit autonegotiation and
CE2 input lockup.
KNOWN BUGS
==========
* Media auto-negotiation is definitely not right. It will work in most
circumstances and seems to connect OK to most 100Mbit networks, however some
pathological combinations of hubs/networks/peers seem to confuse it.
* CE2 support is somewhat flakey (ranging from 'works perfectly' to 'hangs the
machine' so far). I've fixed the probe routine and a potential lockup in
the output routine, but a lot of people still report that they can't receive
or transmit.
* You won't be able to use the modem and Ethenet parts of a multifunction card
simultaneously. This is limitation the current FreeBSD PCMCIA support.
Likewise, there is no support for CardBus devices.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/
v1.16 (1999/03/08) fixed BPF input hang and infinite loop on CE2
short-packet output.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/
This driver is mostly based on the `xirc2ps' driver for Linux by Werner
Koch. Werner has even allowed his code to be distributed under a BSD licence,
making our life considerably easier -- thanks Werner!
This driver supports:
* Intel EtherExpress(TM) PRO/100 PCCARD (16-bit version)
* Xircom CreditCard CE2 / CEM28 / CEM33 / CE3 / CEM56 Ethernet adapters.
* Toshiba Advanced Network 10/100 PCCARD
* Certain Compaq Netelligent 10/100 branded cards
v1.14 has major changes to media selection code, and bugfixes in the
probe routine.
Developed by: Scott Mitchell <scott@uk.freebsd.org>
Obtained from: http://www.freebsd-uk.eu.org/~scott/xe_drv/