History log of /freebsd-current/sys/dev/cardbus/cardbus_cis.c
Revision Date Author Comments
# 685dc743 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

sys: Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# 4d846d26 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD

The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 44b1283d 01-Sep-2020 Mateusz Guzik <mjg@FreeBSD.org>

cardbus: clean up empty lines in .c and .h files


# f86e6000 04-Dec-2019 Warner Losh <imp@FreeBSD.org>

Regularize my copyright notice

o Remove All Rights Reserved from my notices
o imp@FreeBSD.org everywhere
o regularize punctiation, eliminate date ranges
o Make sure that it's clear that I don't claim All Rights reserved by listing
All Rights Reserved on same line as other copyright holders (but not
me). Other such holders are also listed last where it's clear.


# d6f64df9 12-Dec-2017 Warner Losh <imp@FreeBSD.org>

1k objects on the stack are a bad idea. While it's likely safe in this
context, it's also safe to allocate the memory and free it instead.

Noticed by: Eugene Grosbein's script


# 718cf2cc 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.


# 453130d9 02-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: minor spelling fixes.

Most affect comments, very few have user-visible effects.


# 73a1170a 19-Apr-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

sys/dev: use our nitems() macro when it is avaliable through param.h.

No functional change, only trivial cases are done in this sweep,
Drivers that can get further enhancements will be done independently.

Discussed in: freebsd-current


# da1b038a 17-Mar-2016 Justin Hibbits <jhibbits@FreeBSD.org>

Use uintmax_t (typedef'd to rman_res_t type) for rman ranges.

On some architectures, u_long isn't large enough for resource definitions.
Particularly, powerpc and arm allow 36-bit (or larger) physical addresses, but
type `long' is only 32-bit. This extends rman's resources to uintmax_t. With
this change, any resource can feasibly be placed anywhere in physical memory
(within the constraints of the driver).

Why uintmax_t and not something machine dependent, or uint64_t? Though it's
possible for uintmax_t to grow, it's highly unlikely it will become 128-bit on
32-bit architectures. 64-bit architectures should have plenty of RAM to absorb
the increase on resource sizes if and when this occurs, and the number of
resources on memory-constrained systems should be sufficiently small as to not
pose a drastic overhead. That being said, uintmax_t was chosen for source
clarity. If it's specified as uint64_t, all printf()-like calls would either
need casts to uintmax_t, or be littered with PRI*64 macros. Casts to uintmax_t
aren't horrible, but it would also bake into the API for
resource_list_print_type() either a hidden assumption that entries get cast to
uintmax_t for printing, or these calls would need the PRI*64 macros. Since
source code is meant to be read more often than written, I chose the clearest
path of simply using uintmax_t.

Tested on a PowerPC p5020-based board, which places all device resources in
0xfxxxxxxxx, and has 8GB RAM.
Regression tested on qemu-system-i386
Regression tested on qemu-system-mips (malta profile)

Tested PAE and devinfo on virtualbox (live CD)

Special thanks to bz for his testing on ARM.

Reviewed By: bz, jhb (previous)
Relnotes: Yes
Sponsored by: Alex Perez/Inertial Computing
Differential Revision: https://reviews.freebsd.org/D4544


# 06c9ee05 12-Sep-2011 John Baldwin <jhb@FreeBSD.org>

Partially revert 222753: If a CardBus card stores its CIS in a BAR, delete
the BAR after parsing the CIS. This forces the resource range to be
reallocated if the BAR is reused by the device.

Submitted by: deischen
Reviewed by: imp
Approved by: re (kib)


# 40895595 21-Jun-2011 Warner Losh <imp@FreeBSD.org>

Minor cleanup:
o Consider No CIS a normal event and stop whining about it so much
(too many cards are like this, espeically usb/firewire cards).
o Add comments to the cis reading code.
o Made the read from config space a smidge easier to read and eliminate
a loop that can be done mathematically.


# 0d439b5f 06-Jun-2011 John Baldwin <jhb@FreeBSD.org>

More properly handle Cardbus cards that that store their CIS in a BAR after
the recent changes to track BAR state explicitly. The code would now
attempt to add the same BAR twice in this case. Instead, change this so
that it recognizes this case and only adds it once and do not delete the
BAR outright after parsing the CIS.

Tested by: bschmidt


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 3a6b4b04 30-Dec-2009 John Baldwin <jhb@FreeBSD.org>

Fix an error case I missed in the previous change so that the CIS resource
is fully cleaned up if we fail to find the CIS in the devices ROM.


# 767dff0a 30-Dec-2009 John Baldwin <jhb@FreeBSD.org>

Delete the CIS resource after releasing it. This is needed when the CIS is
stored in a BAR since the CIS BAR is mapped before the PCI bus driver
enumerates all the BARs. Without this change, the PCI bus driver would
attempt to initialize a BAR that was already allocated resulting in a panic.


# 4e8790e9 30-Dec-2009 John Baldwin <jhb@FreeBSD.org>

Teach the PCI bus driver to handle PCIR_BIOS BARs properly and remove special
handling for the PCIR_BIOS decoding enable bit from the cardbus driver.
The PCIR_BIOS BAR does include type bits like other BARs. Instead, it is
always a 32-bit non-prefetchable memory BAR where the low bit is used as a
flag to enable decoding.

Reviewed by: imp


# f26d7f8e 30-Dec-2009 John Baldwin <jhb@FreeBSD.org>

Use bus_*() rather than bus_space_*().


# e6d3b1bd 12-Mar-2009 Warner Losh <imp@FreeBSD.org>

Minorly improved debugging. Use the DEVPRINTF macro and report the
offset for memory when mapping in the CIS.


# a7de0b74 16-Nov-2008 Warner Losh <imp@FreeBSD.org>

Overhaul of CIS parsing, next step: keep a cached copy of the CIS,
read before we configure the card, so we can implement
/dev/cardbus*.cis. Also, do this on a per-child basis, so we now have
a different name than before. I think i'll have to fix that for some
legacy tools to keep working.

I can now do a dumpcis on my running atheros card and have it still work!


# e371fa45 14-Nov-2008 Warner Losh <imp@FreeBSD.org>

First step in cleaning up CIS parsing and /dev/cardbus*.cis: remove
redundant malloc/free. Add comments about how this should really be
done. Fix an overly verbose comment about under 1MB mapping: go ahead
and set the bits, but we ignore them.


# 89558ee8 02-Nov-2008 Warner Losh <imp@FreeBSD.org>

Use child (the card) in preference to cbdev (the bridge) when
allocating resources to read the CIS. I'm not sure when this changed,
but it is totally wrong. Also, add a minor improvement to the
debugging.

This should help everybody trying to run dumpcis on atheros wireless
card as well.

MFC after: 2 days


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 17ee700b 07-Jun-2007 Warner Losh <imp@FreeBSD.org>

gcc 4.2 thinks that tupleid is uninitialized. Or might be used
uninitialized. It gets passed into other routines that initialize
it... Cope by initializing.

Submitted by: mjacob


# 4b333740 16-May-2007 Warner Losh <imp@FreeBSD.org>

Change PCIM_CIS_ASI_TUPLE to _CONFIG.
Add PCI_MAX_BAR_0
minor style nit.
Add PCIM_CIS_CONFIG_MASK


# 1acd1e20 11-Jun-2006 Warner Losh <imp@FreeBSD.org>

Minor cleanup of CIS parsing.


# 9dfcc662 11-Jun-2006 Warner Losh <imp@FreeBSD.org>

Better error message when the CIS is a non-standards conforming '0'.


# bee89c73 02-Jan-2006 Warner Losh <imp@FreeBSD.org>

Use the child to allocate the resource rather than bridge, since we're
allocating a resource that's in the card itself.

Remove more now-redundant resource_list_add, and now-redunant code
that lives in the pci layer.

# This fixes the atheros card that I have which had its CIS in one of
# the BARs. Don't know yet if this fixes the amd64 issues reported.


# c732cf3b 02-Jan-2006 Warner Losh <imp@FreeBSD.org>

Minor style(9) hacking, plus use a macro in place of (struct resource *)~0UL
(what the heck does that mean?).


# 93d9fd11 30-Dec-2005 Tai-hwa Liang <avatar@FreeBSD.org>

Fixing build bustage.


# f3d3468d 30-Dec-2005 Warner Losh <imp@FreeBSD.org>

The RID2BAR macro returns a number, not a bitmask. Fix this.

Spotted by: ru, jhb


# 3cd242d1 29-Dec-2005 Warner Losh <imp@FreeBSD.org>

Retire BARBIT in favor of new PCI_RID2BAR.


# 47147ce7 28-Dec-2005 Warner Losh <imp@FreeBSD.org>

Implement /dev/cardbus%d.cis, same thing as /dev/pccard%d.cis. There
are some rough edges with this still, but it seems to work well enough
to commit.


# 41ac33a2 27-Oct-2005 Warner Losh <imp@FreeBSD.org>

Eliminate even more duplication, and move some definitions into pcireg.h


# 495036f2 27-Oct-2005 Warner Losh <imp@FreeBSD.org>

Simplify code a little, prefer PCI?_FOO registers where possible.


# 509cfe6f 20-Feb-2005 Warner Losh <imp@FreeBSD.org>

Be more verbose on errors with CIS reading. This should be a noop, but
appears to fix the ath problem that had been reported. I don't see how
it can, so there's likely some other hidden bug.


# 440b5ade 06-Feb-2005 Warner Losh <imp@FreeBSD.org>

Move resource allocation routines from cardbus_cis.c to cardbus.c.
They have nothing at all to do with CIS parsing.

Remove some unused funce parsing: nothing used the results.

Use more of pccard_cis.h's deifnitions for the cardbus specific cis
parsing we do. More work is needed in this area.

This reduces the size of the cardbus module by 380 bytes or so...


# 2dd5c91e 13-Jan-2005 Warner Losh <imp@FreeBSD.org>

Use the standard FreeBSD license

Approved by: imp, jon


# 098ca2bd 05-Jan-2005 Warner Losh <imp@FreeBSD.org>

Start each of the license/copyright comments with /*-, minor shuffle of lines


# a7c43559 11-Apr-2004 Warner Losh <imp@FreeBSD.org>

Add note about why we're ignoring the below 1MB bit.


# 5f96beb9 17-Mar-2004 Nate Lawson <njl@FreeBSD.org>

Convert callers to the new bus_alloc_resource_any(9) API.

Submitted by: Mark Santcroos <marks@ripe.net>
Reviewed by: imp, dfr, bde


# 4ea2d18a 06-Oct-2003 Warner Losh <imp@FreeBSD.org>

remove obsolete quirks for cardbus cis. none have proven to be needed.


# a294cdb6 06-Oct-2003 Warner Losh <imp@FreeBSD.org>

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.


# 5e7c50d0 06-Oct-2003 John Baldwin <jhb@FreeBSD.org>

Remove prototype for decode_tuple_copy() which was axed in the last
revision to fix compile.


# f6e01094 06-Oct-2003 Warner Losh <imp@FreeBSD.org>

remove the cardbus cis reading code. nobody ever used it and it has
locking issues down to the api level.


# e27951b2 02-Sep-2003 John Baldwin <jhb@FreeBSD.org>

Use PCIR_BAR(x) instead of PCIR_MAPS.

Glanced over by: imp, gibbs
Tested by: i386 LINT


# aad970f1 24-Aug-2003 David E. O'Brien <obrien@FreeBSD.org>

Use __FBSDID().
Also some minor style cleanups.


# b44f8087 01-Jun-2003 Poul-Henning Kamp <phk@FreeBSD.org>

Don't leak "barlist" allocation on failure.

Found by: FlexeLint


# f9aedaa4 24-May-2003 Warner Losh <imp@FreeBSD.org>

Ignore the 'must allocate below 1MB' flag for the TPL_BAR_REG. It is
set on realtek cards, but they work without it (and don't work with
it). The standard seems to imply that this is just a hint anyway, so
this should be harmless. It doesn't appear to be set on any other
cardbus cards that I have (or have seen).

This should make the rl based CardBus cards work again. I've been
running it for about a month now.

Approved by: re@ (jhb)


# 6d9fcd03 08-Apr-2003 Warner Losh <imp@FreeBSD.org>

MFp4: when you can't allocate a resource, print a message, don't panic.


# a163d034 18-Feb-2003 Warner Losh <imp@FreeBSD.org>

Back out M_* changes, per decision of the TRB.

Approved by: trb


# 51715fe7 18-Feb-2003 Warner Losh <imp@FreeBSD.org>

Move the resource handling down into the pci bus as well.
Minor CIS resource allocation code cleanup
Remove some fairly useless debug writes.

This finishes the work to move as much cardbus code as possible into
pci. We wind up removing 800-odd lines from cardbus.c: we go from
1285 to 400 lines.

Reviewed by: mdodd


# 72d3502e 17-Feb-2003 Scott Long <scottl@FreeBSD.org>

Sanity check the BAR length reported by the CIS with the BAR length that
is encoded in the PCI BAR. The latter is more reliable.

This allows the sio/modem function of the Xircom RealPort ethernet+modem
card to work. Note that there still seem to be issues with sio_pci not
releasing resources on detach.


# 1e962d00 15-Feb-2003 Scott Long <scottl@FreeBSD.org>

Clean up the CIS BAR parsing code by removing several pointless checks.
Don't complain about the Option ROM BAR type since it's perfectly valid.


# 22acd92b 11-Feb-2003 Warner Losh <imp@FreeBSD.org>

MF-p4:
Kill the slightly bogus #define for DECODE_PROTOTYPE
Be less verbose. Hide most (all I hope) of the CIS
parsing behind cardbus_debug_cis (which is set with
hw.cardbus.debug_cis=1).

This doesn't fix problems with parsing, but should make cardbus
less chatty. There appears to be some issues still with the
parsing of the CIS, but this won't fix them.

Prompted by: scottl


# 0cba4097 11-Feb-2003 Warner Losh <imp@FreeBSD.org>

Whitespace nits.


# 66e390fe 26-Jan-2003 Warner Losh <imp@FreeBSD.org>

MFp4:
u_int*_t -> uint*_t to conform more closely with C99.


# 44956c98 21-Jan-2003 Alfred Perlstein <alfred@FreeBSD.org>

Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.
Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.


# fbe9cff1 26-Nov-2002 Warner Losh <imp@FreeBSD.org>

Implement PCI_IVAR_ETHADDR. Cardbus has the MAC addr in the CIS,
sometimes, so return it when requested and it does. Also a little
more infrastructure for a few other things.

Submitted by: sam
Approved by: re (blanket for NEWCARD)


# 01f2fb65 13-Nov-2002 Warner Losh <imp@FreeBSD.org>

minor correction to comment


# 9fb92b64 13-Nov-2002 Scott Long <scottl@FreeBSD.org>

When parsing the CIS, if a BAR tuple is encountered, enable the corresponding
bit in the PCI command register for the device. Otherwise, device drivers
that look at this register to see which types of BARs are usable will think
that none of them are.
This allows my Adaptec 1480A cardbus card to finally work.

Reviewed by: imp


# 1e06ae99 12-Nov-2002 Scott Long <scottl@FreeBSD.org>

Fix two typos from the previous commit. This code is definitely infectious.


# e6e272b9 12-Nov-2002 Scott Long <scottl@FreeBSD.org>

Step one of cleaning and fixing cardbus:
- Fix some especially bad style in the CIS BAR tuple parsing code.
- activate Option ROMS correctly.
- de-obfuscate the Option ROM image selection code.
- Fix mis-interpretation of the PCI spec that prevented Option ROMs whose
CIS section wasn't in the first image from working.
- Fix mis-interpretation of the PCI spec that prevented CIS's mapped into
MEMIO space from working at all.
- Reject invalid CIS pointers.

Reviewed by: imp


# 02ccdce8 06-Nov-2002 John Baldwin <jhb@FreeBSD.org>

Use the explicit value 0xffffffff instead of assuming that is what ~0UL
equals.

Approved by: imp


# 214c0b3d 29-Sep-2002 Warner Losh <imp@FreeBSD.org>

Don't leak the bar list for each thing we allocate.

# This code really needs a rewrite

Spotted by the eagle eyes of: phk


# 78b226dc 01-Jun-2002 Alfred Perlstein <alfred@FreeBSD.org>

Silence warning.

When casting a "const void *" to a "struct foo **" you want to actually
cast it to "struct foo * const *" not simply "const struct foo **".


# 80f10018 30-May-2002 Takanori Watanabe <takawata@FreeBSD.org>

Make oldcard and newcard kernel module work.


# 21677473 14-Mar-2002 Warner Losh <imp@FreeBSD.org>

Revert most of the recent PCI merge. This has proven to be too
unstable for the coming DP1 release. Instead, I'll develop that on
the IMP_CB_MERGE branch until it is more stable.


# 86d1f894 12-Mar-2002 Warner Losh <imp@FreeBSD.org>

Cleanup the recent cardbus cleanups. This fixes some of the panics
that I introduced with -v. However, other problems still remain (including
the loss of interrupts).


# a268f9db 07-Mar-2002 Warner Losh <imp@FreeBSD.org>

Don't use __FBSDID yet. Looks like most (all?) of the rest of the kernel
doesn't do that.


# b3889b68 07-Mar-2002 Warner Losh <imp@FreeBSD.org>

Implement hw.cardbus.debug and hw.cardbus.cis_debug to help debug some
of the cardbus problems that people may start seeing.


# a3133b58 06-Mar-2002 Warner Losh <imp@FreeBSD.org>

Two style(9) fixes:
- return(foo); (note parens)
- use __FBSDID()


# 8e635fb7 06-Mar-2002 Warner Losh <imp@FreeBSD.org>

Check for NULL on resource allocation. For the moment, punt, but we should
be smarter about a) cleanup and b) fallback.


# 7ba175ac 26-Feb-2002 Warner Losh <imp@FreeBSD.org>

Use the pci.c code wherever possible, rather than copying all the pci
code into cardbus and s/pci/cardbus. This exposes a few pci_*
functions that are now static.

This work is similar to work Justin posted to the mobile list about a
year or two ago, which I have neglected since then.

This is a subset of his current work with the multiple inheritance
newbus architecutre. When completed, that will eliminate the need for
pci/pci_private.h.

Similar work is needed for the cardbus_cis and pccard_cis code as well.


# 63fa9f4c 26-Aug-2001 Jonathan Chen <jon@FreeBSD.org>

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


# 255b159f 26-Aug-2001 Jonathan Chen <jon@FreeBSD.org>

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.)


# ca604d26 05-Jun-2001 Warner Losh <imp@FreeBSD.org>

Use bus_space when reading CIS. This allows us to access it in 8 bit
mode, which is what the standard mandates.

Submitted by: Takanori Watanabe-san
Reviewed by: jhb


# 6f39832c 07-Jan-2001 Peter Wemm <peter@FreeBSD.org>

This cannot possibly be right:
foo(int *nret)
{
for (i = 0; i < nret; i++) {
free(array[i], ....
Fix to do the logically correct thing.. (s/nret/*nret/)


# 0c95c705 06-Jan-2001 Jonathan Chen <jon@FreeBSD.org>

* 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


# fd121bf8 30-Nov-2000 Justin T. Gibbs <gibbs@FreeBSD.org>

Remove an unused variable.

Properly advance to the next image while searching for the ROM image
that contains CIS data.

KNF an if statement.


# d58b9dbc 29-Nov-2000 Jonathan Chen <jon@FreeBSD.org>

This fixes several problems with CIS as suggested by Justin Gibbs:
4) The cardbus CIS code treats the CIS_PTR as a mapping register if
it is mentioned in the CIS. I don't have a spec handy to understand
why the CIS_PTR is mentioned in the CIS, but allocating a memory range
for it is certainly bogus. My patch ignores bar #6 to prevent the
mapping.
[The pccard spec says that BAR 0 and 7 (-1 and 6 in thic case since we
did a minus one) is "reserved". The off by 1 error has been fixed.
also bar=5 is invalid for IO maps, so we check it.]

5) The CIS code allocated duplicate resources to those already found
by cardbus_add_resources(). The fix is to pass in the bar computed
from the CIS instead of the particular resource ID for that bar,
so bus_generic_alloc_resource succeeds in finding the old resource.
[fixed, also removed superfluous (and incorrect) writing back to the
PCI config space.]

7) The CIS code seems to use the wrong bit to determine rather a particular
register mapping is for I/O or memory space. From looking at the
two cards I have, it seems TPL_BAR_REG_AS should be 0x10 instead
of 0x08. Otherwise, all registers that should be I/O mapped gain
a second mapping in memory space.
[Oops, the spec does say 0x10..., fixed]

Submitted by: Justin Gibbs


# 49f158cc 29-Nov-2000 Jonathan Chen <jon@FreeBSD.org>

Oops, broke CIS reading from ROM on my last commit.
This should fix it.


# c669d6a0 27-Nov-2000 Jonathan Chen <jon@FreeBSD.org>

1) When mucking with mapping registers, it is best to *not* have
io or memory space access enabled. This patch defers the setting
of these bits until after all of the mapping registers are probed.
It might be even better to defer this until a particular mapping
is activated and to disable that type of access when a new
register is activated.

2) The PCI spec is very explicit about how mapping registers and
the expansion ROM mapping register should be probed. This patch
makes cardbus_add_map() follow the spec.

3) The PCI spec allows a device to use the same address decoder for
expansion ROM access as is used for memory mapped register access.
This patch carefully enables and disables ROM access along with
resource (de)activiation.

This doesn't include the prefetching detection stuff (maybe later when code is written to actually turn on prefetching). It also does not use the PCI definitions (yet, I'll try to put this in all at once later)

Submitted by: Justin T. Gibbs


# 7bec1dd5 27-Nov-2000 Jonathan Chen <jon@FreeBSD.org>

overhaul cis functions to read cis tuple by tuple (instead of all at once).
Also fix incorrect parsing of BAR.


# 0db7e66c 17-Oct-2000 Jonathan Chen <jon@FreeBSD.org>

Initial commit of NEWCARD cardbus side (that actually compiles and works)

Files:
dev/cardbus/cardbus.c
dev/cardbus/cardbusreg.h
dev/cardbus/cardbusvar.h
dev/cardbus/cardbus_cis.c
dev/cardbus/cardbus_cis.h
dev/pccbb/pccbb.c
dev/pccbb/pccbbreg.h
dev/pccbb/pccbbvar.h
dev/pccbb/pccbb_if.m

This should support:
- cardbus controllers:
* TI 113X
* TI 12XX
* TI 14XX
* Ricoh 47X
* Ricoh 46X
* ToPIC 95
* ToPIC 97
* ToPIC 100
* Cirrus Logic CLPD683x
- cardbus cards
* 3c575BT
* 3c575CT
* Xircom X3201 (includes IBM, Xircom and, Intel cards)
[ 3com support already in kernel, Xircom will be committed real soon now]

This doesn't work with 16bit pccards under NEWCARD.

Enable in your config by having "device pccbb" and "device cardbus".
(A "device pccard" will attach a pccard bus, but it means you system have
a high chance of panicing when a 16bit card is inserted)

It should be fairly simple to make a driver attach to cardbus under
NEWCARD -- simply add an entry for attaching to cardbus on a new
DRIVER_MODULE and add new device IDs as necessary. You should also make
sure the card can be detached nicely without the interrupt routine doing
something weird, like going into an infinite loop. Usually that should
entail adding an additional check when a pci register or the bus space is
read to check if it equals 0xffffffff.

Any problems, please let me know.

Reviewed by: imp