Commit Graph

98 Commits

Author SHA1 Message Date
Warner Losh
d4c6cdea21 Ignore the expected function number.
NetBSD went this route a while ago.  FreeBSD originally tried this to
cope with multifunction cards.  However, it turns out that we're
better off not worrying about the function number, and instead worry
about the function type for the function.  This has worked well in
NetBSD, and all FreeBSD's relevant drivers have been converted.

# I'll rework the macros that specify them shortly, as soon as I can
# come up with a good, compatible way to deal...
2005-01-24 06:54:05 +00:00
Warner Losh
7d57300f4c u_intXX_t -> uintXX_t 2005-01-24 06:48:26 +00:00
Warner Losh
b72e9f1719 Fix spelling error
submitted by: Anders Hanssen
2005-01-19 20:21:44 +00:00
Warner Losh
ddd8ec50b0 Go ahead and match on CIS3 and CIS4 strings as well. These are NULL
for the vast majority of our cards.  However, they are critically
needed to distinguish different fe based PC Cards (the FMV-182 from
the 182A) which need to be treated differently (the ethernet address
is loaded not from the standard CIS-based ethernet tuples, but from
differing locations in attribute space based on the version string in
CIS3.  This should have no impact for other users of this function.
2005-01-17 06:54:48 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Warner Losh
977b24f6e6 Some cards don't have the info entries in the CIS, so vendorstr and/or
prodstr may be NULL when fetched.  For the default device description,
guard against this and return the numeric IDs instead when this
happens.  For the matching routines, and consider NULL to not match
those entries that aren't NULL w/o calling strcmp.

Early patches by: Anders Hanssen
2004-08-16 15:57:18 +00:00
Nate Lawson
5f96beb9e0 Convert callers to the new bus_alloc_resource_any(9) API.
Submitted by:	Mark Santcroos <marks@ripe.net>
Reviewed by:	imp, dfr, bde
2004-03-17 17:50:55 +00:00
Warner Losh
a93efa3c97 Use %#jx for both args.
Non-use of %# mocked by: bde
2003-11-04 06:30:59 +00:00
Warner Losh
50d2d4c753 Fix two small style nits pointed out by bde: Remove spaces after cast and
indent continued line 4 spaces instead of 2.
2003-11-03 21:54:24 +00:00
Warner Losh
9e53a7290a o Use %j and uintmax_t rather than uint64_t for casting.
o use more proper bus_size_t for iosize rather than bus_addr_t.

Noticed by: bde
2003-11-03 16:04:31 +00:00
Warner Losh
2f8298dd1f ia64 tenderbox hates what I did wrt a printf, so cast the snot out of
it and hope for the best.
2003-11-03 01:30:03 +00:00
Warner Losh
4f9303c05a MFp4:
o Fix MFC cards.  We were bogusly setting CCR_IOBASE[01] and CCR_IOLIMIT.
  now when we activate the resource, we adjust these for MFC cards, per the
  spec.
o Change type of pf_mfc_* to be bus_addr_t, which is more correct than
  long.

This makes my 3C362D/3C363D and 3CXEM556 cards work!  Woo Hoo!
2003-11-02 20:18:19 +00:00
Warner Losh
595670d932 Const poison string accessor functions. 2003-10-26 00:51:40 +00:00
Warner Losh
a294cdb6b5 o move the cis tuple definitions into a common file.
o minor optimization of cardbus_cis processing.  Remove a bunch of generic
  entries that are handled by generic.
o no longer need the card_get_type stuff.
2003-10-07 03:33:54 +00:00
Warner Losh
a48c0be85d Whacked out CIS configurations can cause us to not have any child. When
such a card is ejected, we'd panic.  Instead, just ignore it.

I should also add a sanity check in the FUNCID code as well, but this
isn't wrong since the check is cheap and happens infrequently.
2003-09-05 03:08:08 +00:00
Warner Losh
533b7cef1e Probe routines can return < 0 for speculative matches. In the
compatibility routine, go ahead and accept that as 'success'.  A
properly written compatible driver should return < 0 for both the
compat match and compat probe routines, so this will wind up doing the
right thing.
2003-08-25 18:20:03 +00:00
David E. O'Brien
aad970f1fe Use __FBSDID().
Also some minor style cleanups.
2003-08-24 17:55:58 +00:00
Warner Losh
f1b0a0f432 pc98pcic isn't the name of the media driver. tcic likely will never
happen (unless someone sends one to me).  Kill bogus module depend
that I commented out over a year ago.
2003-08-20 05:50:56 +00:00
Warner Losh
309971e12e Add a comment about the MPSAFEness of this pccard_intr handler. Given
how we registered pccard_intr, it is MPSAFE.  However, since we
register the pccard_intr handler with the flags of the ISR we call,
that is the gating factor.  We need do nothing specific here.

Prompted by: seeing pccard_intr in a panic.
2003-06-13 21:30:29 +00:00
Warner Losh
7de3ac49a9 In [bsd-nomads:16650] shibagaki-san presented an example product id of
0 in a problem that is being discussed.  That means that the test for
product != 0 may cause problems.  Looking at pccarddevs (which i
should have done earlier) we see:

product	BONDWELL B236		0x0000 Game Card Joystick
product CONTEC CNETPC		0x0000 Contec C-NET(PC)C
product IBM MICRODRIVE		0x0000 IBM Microdrive
product RAYTHEON WLAN		0x0000 WLAN Adapter
product SOCKET EA_ETHER		0x0000 Socket Communications EA
product TDK LAK_CD011WL		0x0000 TDK LAK-CD011WL

so use only the vendor field for the end sentinel.
2003-04-10 04:11:15 +00:00
Warner Losh
60feb70860 1.77 was bogus: there is no logic bug. Back it out and compare the
correct fields instead.
2003-04-09 22:07:02 +00:00
John Baldwin
685a76429a Fix a logic bug in previous commit (use || rather than &&). In order to
terminate the loop only when both the name and vendor are zero, we should
keep looping so long as either one is not zero.
2003-04-09 21:24:23 +00:00
Warner Losh
7e9b53e399 Make sure that both pp_name and pp_vendor are zero to know we're at the
end of the list now that some valid entries don't have pp_name set.  Also,
don't print a warning if pp->name is NULL and it is a total wildcard.
2003-04-09 15:54:00 +00:00
Warner Losh
6586fa7c43 MFP4:
o don't access struct resource members directly.
o Set a default device description based on the CIS name.
2003-04-08 07:02:03 +00:00
MIHIRA Sanpei Yoshiro
e21115ab06 fix typo 2003-04-04 14:40:01 +00:00
Warner Losh
b43a533ddb Use %jd and a cast to intmax_t instead of a cast to long.
Minor style nit while I'm here.
2003-03-18 02:40:40 +00:00
Warner Losh
a163d034fa Back out M_* changes, per decision of the TRB.
Approved by: trb
2003-02-19 05:47:46 +00:00
Alfred Perlstein
44956c9863 Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
2003-01-21 08:56:16 +00:00
Maxime Henrion
b2423a5f88 Fix printf() format errors.
Reviewed by:	imp
2002-11-14 14:02:32 +00:00
Warner Losh
41e6d507ba Remove an impossible condition. pf->dev is always non-null here. 2002-11-14 05:13:52 +00:00
Warner Losh
bcaa6b0541 MFp4:
o Always release the resources on device detach.
o Attach resources the same with driver added as we do we do in the insert
  case (maybe this should be a routine).
o signal the wakeup of the thread on resume instead of trying to force an
  interrupt.
o Minor debug hacks.
o use 0xffffffff instead of -1 for uint32_t items.
o Don't complain when we're asked to detach no cards.  This is normal.
o Eliminate the now worthless second parameter to card_detach_card.
o minor style(9)isms

Some of these patches may be from: iwasaki-san, jhb, iadowse
2002-11-02 23:00:28 +00:00
Warner Losh
3688a119c4 o Add a nomatch routine so we whine when we don't know what to attach to
the card.
o Add comments about how we're doing the CIS activation.
o Add location and pnp info functions.
o Add better code to hopefully deal with ata cards better (and other drivers
  that allocate resources that we didn't preallocate from the CIS).  OLDCARD
  used to allow it, but NEWCARD was pickier.  I'm not 100% sure this works,
  but it doesn't break anything.
2002-10-07 23:05:33 +00:00
Warner Losh
ca407d8777 MFp4:
o Return the right string for CIS4_STR
	o kill obsolete comment about not doing something that we now do.
2002-10-07 07:18:32 +00:00
Warner Losh
2d7a3e94bd o Dike out the bogus reprobe stuff. It was getting in the way of newbus' own
reprobe code working.  This bogusness was thrust upon me.
o Don't delete the device if no drivers attach.  I had thrust this bogusness
  upon others.

These two changes make kldload of a pccard driver work again.
2002-09-10 06:32:18 +00:00
Warner Losh
912f17daa2 More in the continuing saga of phk vs his strange serial card.
In this installment, we learn that it is bad to access registers that
are only defined for mfc cards in the interrupt handler when we do not
in fact have a mfc card.  For MFC cards, we'll only call the ISR if
the this card interrupted bit is set.  For non mfc cards (which are
basically 90% of pccards in use), we always call the ISR and avoid
touching the suspect registers.  We always pacify the bit in the MFC
case on the off chance that will help in the itnerrupt handler not
being registed.
2002-09-04 06:53:37 +00:00
Poul-Henning Kamp
13c33c582a Drop another cookie to wet Warners appetite:
We need to call the drivers interrupt function even though the card is not
multifunction.
2002-09-03 11:24:25 +00:00
Warner Losh
4ee27e3969 Make modems work:
Don't set the CCR_OPTION register when registering/deregistering
interrupts unless the card is a MFC card.  This makes a lot of cards
work that didn't work before.  These bits are only defined for MFC
cards.

Remove COOKIE_FOR_WARNER kludges that phk introduced.

Add more debug info.

Annoy the purists by committing two minor style nits at the same time.

Many thanks to phk.  He tracked this problem down to what was screwing
things up, so fixing it became trivially easy once the problem was
understood.
2002-08-31 18:34:30 +00:00
Poul-Henning Kamp
a15ddbdd65 Different and more correct workaround for broken cards under NEWCARD:
don't spam the configuration index register.

I'm not sure where those bits truly belong, but spamming the config
index sure doesn't do us any good.
2002-08-31 16:07:17 +00:00
Poul-Henning Kamp
49bf3e26d1 Ignore all config entries which have a non-zero start I/O address.
This is a bandaid which makes some more PCCards work under NEWCARD
which would otherwise not work.

Cards with only fixed address windows still loose.
2002-08-31 14:38:24 +00:00
Warner Losh
6c596e8d0b pccbb -> cbb 2002-08-15 08:02:23 +00:00
Warner Losh
db64ac4457 Don't redundantly include \n in panic messages 2002-08-12 22:34:12 +00:00
Takanori Watanabe
80f1001813 Make oldcard and newcard kernel module work. 2002-05-30 17:38:00 +00:00
Warner Losh
7cdb5c5ec4 Make hw.pccard.debug and hw.pccard.cis_debug tunable/sysctl. Setting to 1
will enable more verbose debugging output from the pccard system.
2002-03-07 08:03:53 +00:00
Takeshi Shibagaki
57ffbd6e54 Add u_int16 prodext value in CISTPL_MANF_ID. This gets a fifth byte
when manufacturer id tuple length is 5. This change is for xe driver.
This is a dirty hack. But there is no better idea.

Reviewd by: imp
2002-02-20 14:30:46 +00:00
Warner Losh
b0fc3f6b1b o Count the number of mem and io spaces we allocate. If none work, bail out
o Add some better debugging code.
o Minor style(9) fixes.
2002-02-19 05:04:37 +00:00
Warner Losh
fbf6f7f1d6 Null interrupt handlers should be OK, so if we don't have a function,
just return.
2002-02-10 05:04:20 +00:00
Warner Losh
27d4dd7420 o Use bus_generic_setup_intr instead of bus_setup_intr.
o Call bus_generic_setup_intr and check its return value.  Don't setup
  func until we successfully get the interrupt from our parent.
o Add comments about some maybe questionable stuff so I can check later
  to make sure that it really is that way.
2002-02-10 03:34:44 +00:00
Warner Losh
5e0cb3e9d3 Boot verbosify printing the CIS, since we don't normally need to do that. 2002-02-09 21:34:06 +00:00
Warner Losh
a0e457a620 Default debugging to OFF now. 2002-02-04 15:55:21 +00:00
Warner Losh
a432b68b87 Add support for suspending/resuming CardBus bridges.
We really should have and use power state information, but none exists
today.

Submitted by: YAMAMOTO Shigeru-san <shigeru@iij.ad.jp>
2001-12-15 05:58:28 +00:00