Commit Graph

31 Commits

Author SHA1 Message Date
Warner Losh
f8a935ff17 Remove OLDCARD vestiges from here 2005-09-25 01:39:04 +00:00
Warner Losh
fe364ce963 Add a few new functions interfaces to allow reading/writing attribute
memory, the CCR and a tweak to cis_scan.
2005-09-13 17:56:36 +00:00
Warner Losh
26db48b9b2 Add a much-requested feature: The ability for pccard attachments to
scan the CIS for interesting tuples.  95% of what can be obtained from
the CIS is harvested by the pccard layer and presented to the user in
standard function calls.  However, there are special needs at times
where the standard stuff doesn't suffice.  This is for those special
cases.

CARD_SCAN_CIS(device_get_parent(dev), function, argp)
	scans the CIS of the card, passing each tuple to function with
	the tuple and argp as its arguments.  Returning 0 continues the scan,
	while returning 1 terminates the scan.  The value of the last
	invocation of function is returned from this function.

int (*pccard_scan_t)(struct pccard_tuple *tuple, void *argp)
	function called for each tuple.  Elements of the CIS tuple can be
	read with pccard_tuple_read_{1,2,3,4,n}().  You are reading
	the actual tuple memory each time, in case your card has
	registers in the CIS.

# I suppose these things should be documented in pccard(4) or something like
# that.

# I plan on unifying cardbus CIS support in a similar way.

Approved by: re (scottl)
2005-07-01 03:40:28 +00:00
Warner Losh
77ab642f58 Remove more deadwood that never got implemented in NEWCARD, since NEWCARD
went a different direction than was anticipated when these compatibility
shims were added.
2005-02-15 02:54:53 +00:00
Warner Losh
78ac8a9391 Remove card_get_function. It looks like it was intended to be a
bridge between OLDCARD and NEWCARD for drivers to inquire after the
function number (eg, 0, 1, 2).  Nobody ever used it, so retire it
with honors.  NEWCARD never implemented it, and the same information
can be obtained by the pccard_get_function_number().

MFC After: 3 days
2005-02-14 07:00:39 +00:00
Warner Losh
7d57300f4c u_intXX_t -> uintXX_t 2005-01-24 06:48:26 +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
33de92af3f Include required machine/bus.h 2004-05-28 02:23:10 +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
6ea91a6bcb Remove the cis reading bus methods. They were never implemented and
there's been some critism about the API not being lock friendly.
2003-10-06 07:10:40 +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
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
c1bb793bbb Eliminate the need for pccard_common.c by moving the function inline
in the .h file.  Make it static __inline to make sure that it doesn't
wind up defined in any files.

Also, fix a typo that said null_do_attach instead of null_do_probe.
2002-07-17 05:20:43 +00:00
Takanori Watanabe
80f1001813 Make oldcard and newcard kernel module work. 2002-05-30 17:38:00 +00:00
Warner Losh
fd173deae3 Remove DETACH_NOWARN 2002-02-07 06:43:29 +00:00
Jonathan Chen
63fa9f4c0d Part two of this NEWCARD update:
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
2001-08-27 00:09:42 +00:00
Jonathan Chen
c83acdc307 Non-functional changes to NEWCARD stuff.
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.)
2001-08-26 23:56:49 +00:00
Assar Westerlund
20de0f980e null_do_probe: mark as unused 2001-07-21 17:10:30 +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
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
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
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
2c6b3ec454 Define get_memory_offset method 2000-08-11 15:51:51 +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
Warner Losh
41ad2b329a Remove bogus comment 2000-04-20 07:54:59 +00:00
Warner Losh
4e84c35af2 Include <sys/bus.h>, which is needed after Doug's latest object changes. 2000-04-16 06:04:13 +00:00
Warner Losh
3a6352bdee checkpoint latest pccard/pcic hacking:
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.
2000-04-13 06:42:58 +00:00
Warner Losh
e14c13dae0 Minor changes to some of the interfaces.
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.
2000-03-26 07:01:52 +00:00
Warner Losh
f27f6c0076 Add resource activation routines to pcic driver. Minor cleanup of
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.
1999-11-28 21:11:13 +00:00