Commit Graph

92 Commits

Author SHA1 Message Date
Warner Losh
f40d7afa05 Fix the panics for real this time. When something can't be allocated,
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.
2001-05-10 06:55:39 +00:00
Duncan Barclay
0a177c3dca Add additional enumeration types for CARD_SET_RES_FLAGS.
Approved by:	imp
MFC:	after 1 week
2001-05-08 23:56:47 +00:00
Warner Losh
dc8e185f93 Add accessor/ivar for the "function". This is so we can generically
match disks and serial ports and maybe others.
2001-04-21 04:08:39 +00:00
Warner Losh
19f1fe42e6 Only try to delete the resource if we actually got it. 2001-04-21 02:29:09 +00:00
Warner Losh
c33c1284cb First step towards making loadable modules independent of having
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.
2001-03-22 06:00:07 +00:00
Warner Losh
f55f5ee276 Sync to last changes. 2001-03-22 05:52:42 +00:00
Warner Losh
15c1a6aede Add zoom air 4000. 2001-03-22 05:51:58 +00:00
Warner Losh
2873ce752b Style(9) changes:
put parens around return (statements);
	Use ANSI funcitons only.
2001-03-22 05:41:20 +00:00
Poul-Henning Kamp
37d4006626 Another round of the <sys/queue.h> FOREACH transmogriffer.
Created with:   sed(1)
Reviewed by:    md5(1)
2001-02-04 16:08:18 +00:00
Warner Losh
da15fcf11c Convert the vendor/product cis strings to an array of CIS entries. This
allows us to use the PCCARD_CIS #defines generated to distinguish cards
that don't have a Manufacturer and OEM.
2001-01-21 08:09:00 +00:00
Warner Losh
612efca22c remove duplicate entry that snuck in during the merge. 2001-01-21 04:33:12 +00:00
Warner Losh
ac0f7daa5e Sync to pccarddevs 1.9 2001-01-20 02:04:26 +00:00
Warner Losh
e7c584e06b Sync with NetBSD (again, after I got the most up to date file):
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
2001-01-20 02:03:53 +00:00
Warner Losh
d7abc1d83d sync with pccarddevs 1.8. 2001-01-20 01:49:17 +00:00
Warner Losh
464c9a2316 Correct entry for RATOC REX_R280 to comply with style used in the rest
of the file.
2001-01-20 01:48:55 +00:00
Warner Losh
4dff132fa5 Sync with pccarddevs. 2001-01-20 01:42:22 +00:00
Warner Losh
8c4587fd4a Sync with NetBSD. v1.98->1.107:
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)
2001-01-20 01:41:25 +00:00
Peter Wemm
7722df0394 This is a bandaid for a problem that is not entirely fixed yet.
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
2001-01-07 21:32:05 +00:00
Warner Losh
584d978729 This file follows style(9), so adjust various nits in the last few commits
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.
2001-01-07 20:40:23 +00:00
Warner Losh
2f58d9cc31 For bus_setup_intr, cookiep is a pointer to storage for the parent
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).
2001-01-07 20:36:27 +00:00
Warner Losh
486d464d74 o Now that I've had time to test the new interface, reintegrate it back in.
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)
2001-01-07 16:31:09 +00:00
Warner Losh
1bc96f7afd Undo the interface change to CARD_GET_MEMORY_OFFSET. It wasn't tested
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.
2001-01-07 08:08:54 +00:00
Peter Wemm
7e6e7300d0 We do not, and hopefully never will, use the static pccard device table. 2001-01-07 03:58:57 +00:00
Jonathan Chen
0c95c70577 * Better kld support in pccbb/cardbus
- 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
2001-01-06 18:04:55 +00:00
Jonathan Chen
c3342a3d99 Oops, broke newcard because I forgot to commit this in my last round of changes to pccbb.c 2000-11-28 15:50:13 +00:00
Peter Wemm
c20d96e7c4 Regenerate. Note that pccarddevs_data.h is not used. 2000-11-25 03:43:37 +00:00
Peter Wemm
1d75be41ac Add Kingston and the KNE-PC2 card 2000-11-25 03:42:06 +00:00
David Malone
66efa50621 Make a few more mallocs use M_ZERO.
Submitted by:	josh@zipperup.org
Submitted by:	Robert Drehmel <robd@gmx.net>
Approved by:	imp
2000-10-29 16:29:05 +00:00
Warner Losh
fe8d027cd8 o Remove lots of kludges with iospace and irq.
o Make sure that I/O space is aligned properly based on the length of the
  resource we're allocating.
o Add bootverbose message when we fail.
2000-10-22 04:46:56 +00:00
Warner Losh
4659a20822 Get the interrupt correct. 2000-10-20 20:27:22 +00:00
Warner Losh
7ae6b1ebd2 o Fix memory leak in ivars
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.
2000-10-19 22:36:41 +00:00
Warner Losh
cc8e7d4250 o Remove a boatload of debugging printfs.
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.
2000-10-18 02:21:00 +00:00
Warner Losh
c5cdd6f29e More NEWCARD fixes. We now almost properly print the probe message.
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).
2000-10-17 06:29:21 +00:00
Warner Losh
9344caaf08 First cut at allocating the resources from the CIS after the probe, but
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.
2000-10-16 07:51:12 +00:00
Warner Losh
d62abc771f Lots of little fixes. We no longer panic on card insert:
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.
2000-10-15 17:21:50 +00:00
Warner Losh
5f7e36d111 o Record the pccard_function in the ivar.
o Use a macro function to get the ivar for the child rather than the casting
  directly.  This should be a little safer and easier to read.
2000-10-09 03:40:15 +00:00
Warner Losh
e69d122232 o Implement get_ivars so matching routines will work (this causes
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.
2000-10-07 05:48:51 +00:00
Warner Losh
8456e16e24 o Merge in changes to the NetBSD sources:
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.
2000-09-22 01:15:26 +00:00
Warner Losh
2276cee521 Implement indirection in the pccard probe/attach. This should make it
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.
2000-09-19 04:39:20 +00:00
Warner Losh
45713b37cd Change the interface to pccard_function_init. The interface is such
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.
2000-09-16 06:52:20 +00:00
Warner Losh
f245fa0e59 MFNetBSD:
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...
2000-09-05 18:25:49 +00:00
Warner Losh
925c6cf689 Minor tweaks to have the card be properly enabled via the CCR.
Minor debug changes
Minor power management pessimizations
2000-08-26 00:07:40 +00:00
Warner Losh
90cb220e62 Sync to pccarddevs 1.5 2000-08-24 07:01:49 +00:00
Warner Losh
979ca3b327 o Fix unterminated comment
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.
2000-08-24 07:01:12 +00:00
Warner Losh
bd6dd21e8d Save a pointer to the dev, if any, that each function attach.
Remove some bogus printfs.
2000-08-22 04:25:57 +00:00
Warner Losh
c8ce264e17 o Move to using PCCARD_SOFTC(dev)
o fill in the size of the actual softc, rather than 1 in data structure
o minor debugging improvements.
2000-08-19 19:22:04 +00:00
Warner Losh
2c6b3ec454 Define get_memory_offset method 2000-08-11 15:51:51 +00:00
Warner Losh
c8f48f58b7 Matching commits to pccard for last pcic changes. We now at least to
probe/attach.  This is a checkpoint.
2000-06-18 05:28:59 +00:00
Warner Losh
265be3e08a Add new functions. Also add comments to existing functions. These
are needed for the pccard changes I've just committed.
2000-06-18 05:02:09 +00:00
Jake Burkholder
e39756439c Back out the previous change to the queue(3) interface.
It was not discussed and should probably not happen.

Requested by:		msmith and others
2000-05-26 02:09:24 +00:00