History log of /freebsd-9.3-release/sys/dev/pccbb/
Revision Date Author Comments
267654 20-Jun-2014 gjb

Copy stable/9 to releng/9.3 as part of the 9.3-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


261293 30-Jan-2014 jhb

MFC 261216:
Explicitly enable I/O and memory decoding in the bridge's command register
when activating an I/O or memory window on the CardBus bridge.


254306 13-Aug-2013 scottl

Merge r254263:

Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI
command register. The lazy BAR allocation code in FreeBSD sometimes
disables this bit when it detects a range conflict, and will re-enable
it on demand when a driver allocates the BAR. Thus, the bit is no longer
a reliable indication of capability, and should not be checked. This
results in the elimination of a lot of code from drivers, and also gives
the opportunity to simplify a lot of drivers to use a helper API to set
the busmaster enable bit.

This changes fixes some recent reports of disk controllers and their
associated drives/enclosures disappearing during boot.

Candidate for 9.2

Submitted by: jhb
Reviewed by: jfv, marius, adrian, achim


248085 09-Mar-2013 marius

MFC: r227309 (partial)

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


240287 09-Sep-2012 adrian

MFC r238954 - Restore the PCI bridge configuration upon resume.

This allows my TI1510 cardbus/PCI bridge to work after a suspend/resume,
without having to unload/reload the cbb driver.

PR: kern/170058


235743 21-May-2012 jhb

Toss bogus mergeinfo.


235738 21-May-2012 sbruno

MFC r235634

Fix and update battery status bits according to linux driver


229093 31-Dec-2011 hselasky

MFC r226173, r227843, r227848 and r227908:
Use DEVMETHOD_END to mark end of device methods.
Remove superfluous device methods.
Add some missing __FBSBID() macros.


225736 23-Sep-2011 kensmith

Copy head to stable/9 as part of 9.0-RELEASE release cycle.

Approved by: re (implicit)


223352 21-Jun-2011 imp

Mark the card as bad on shutdown. This means that bus_child_present
will return false on shutdown and massive spewage from usb disappears
for usb cardbus adapters.


223219 18-Jun-2011 imp

More expeirmentation suggests that 10ms isn't as reliable as
previously thought, but 100ms seems to be. Likely there's a good
middle ground, but for now be conservative.


223218 18-Jun-2011 imp

After we get a good power signal, always wait about 10ms before
proceeding.

On boot, some laptops with certain cards in them sometimes fail on
boot, but if the card is inserted after boot it works. Experiments
show that small delays here makes things more reliable. It is
believed that some combinations need a little more time before the
power on the card is really stable enough to be reliable once the
power is stable in the bridge.


217323 12-Jan-2011 mdf

sysctl(9) cleanup checkpoint: amd64 GENERIC builds cleanly.

Commit the rest of the devices.


196403 20-Aug-2009 jhb

Temporarily revert the new-bus locking for 8.0 release. It will be
reintroduced after HEAD is reopened for commits by re@.

Approved by: re (kib), attilio


196037 02-Aug-2009 attilio

Make the newbus subsystem Giant free by adding the new newbus sxlock.
The newbus lock is responsible for protecting newbus internIal structures,
device states and devclass flags. It is necessary to hold it when all
such datas are accessed. For the other operations, softc locking should
ensure enough protection to avoid races.

Newbus lock is automatically held when virtual operations on the device
and bus are invoked when loading the driver or when the suspend/resume
take place. For other 'spourious' operations trying to access/modify
the newbus topology, newbus lock needs to be automatically acquired and
dropped.

For the moment Giant is also acquired in some key point (modules subsystem)
in order to avoid problems before the 8.0 release as module handlers could
make assumptions about it. This Giant locking should go just after
the release happens.

Please keep in mind that the public interface can be expanded in order
to provide more support, if there are really necessities at some point
and also some bugs could arise as long as the patch needs a bit of
further testing.

Bump __FreeBSD_version in order to reflect the newbus lock introduction.

Reviewed by: ed, hps, jhb, imp, mav, scottl
No answer by: ariff, thompsa, yongari
Tested by: pho,
G. Trematerra <giovanni dot trematerra at gmail dot com>,
Brandon Gooch <jamesbrandongooch at gmail dot com>
Sponsored by: Yahoo! Incorporated
Approved by: re (ksmith)


190878 10-Apr-2009 thompsa

Revert r190676,190677

The geom and CAM changes for root_hold are the wrong solution for USB design
quirks.

Requested by: scottl


190676 03-Apr-2009 thompsa

Add a how argument to root_mount_hold() so it can be passed NOWAIT and be called
in situations where sleeping isnt allowed.


189723 12-Mar-2009 imp

Better name for this routine... it doesn't reset the card, but resets
the power to the card...


188701 17-Feb-2009 imp

Hold off root mounting until we've gone through the loop of our thread
almost once. After we've configured the devices that were present the
first time through, then we know that we're done. If the device has
other devices that are deferred, then it must do a similar dance.
This catches both PC Cards and CardBus cards.


188129 04-Feb-2009 imp

Correct signatures to match kobj function definitions.


185910 11-Dec-2008 imp

Update to the interrupt handling code:

o Try to be smarter about reading the ExCA CSC register. Now, we only
do it for 16-bit cards. Add some experimental code to treat it like
a power interrupt, but I'm not 100% sure that I like it. It may be
removed upon further testing. It seemed to help in one test case, but
the evidence may be inconclusive. This may be beneficial for cleaning up
exca_reset and exca_wait_ready.
o Check for CSTS events on the socket event register. We ask for it when
we're powering up a card, but I don't think we're otherwise using
it. Just ACK the interrupt for now. In theory, we can use it
instead of the busy wait we do in cbb_cardbus_reset. More research
is necessary to see if we can optimize things there when we're
waiting for the DEVVENDOR register to become valid.
o Rework the comments a bit. Minor tidying up. Etc.


185749 07-Dec-2008 imp

Minor tweaks to some of the comments. Also, add a XXX wondering if we
need to frob the 16-bit EXCA registers during the new interrupt-driven
power-up sequence.


185741 07-Dec-2008 imp

Use '0' rather than PZERO to not change the priority that I'm waiting
at. I don't think this will make a huge difference, but I have
received a report of a interrupt storm on one 16-bit card that this
might fix (chances are it won't, since I think that we may need to
check both the CBB registers for the 16-bit card as well as the PCIC
registers for power state change).

Submitted by: jhb@


185740 07-Dec-2008 imp

Use atomic_add_int rather than a simple ++ to ensure no cache races if
the power interrupt and init code waiting for the interrupt are
running on different CPUs. I haven't seen this make any real
difference, but I've also had some reports of odd behavior I can't
otherwise explain. It is an infrequent operation, and certainly
wouldn't hurt.


185625 05-Dec-2008 imp

Move to using filter for the change interrupts. Also rework the power
interrupt code to be more robust. I've been running these changes for
over a year... With these changes, I don't see the ath card going
into reset like the code in the tree.


185624 05-Dec-2008 imp

Minor style nit.


185623 05-Dec-2008 imp

Augment comments, and move things around a smidge.


185622 05-Dec-2008 imp

Implement a method described in NetBSD PR 36652 for coping with the
BAD VCC bit.


183558 02-Oct-2008 imp

Return BUS_PROBE_GENERIC rather BUS_PROBE_DEFAULT for generic CBB we match.

Reviewed by: jhb@


183539 02-Oct-2008 imp

Don't forget to match on a CLASS of PCIC_BRIDGE as well as subclass
PCIS_BRIDGE_CARDBUS. Otherwise, we may hit a few false positives....


181523 10-Aug-2008 imp

Read the config space of the child, not the bridge, to determine when
the child is out of reset... <blush>


181472 09-Aug-2008 imp

fix typo

Submitted by: N.J. Mann


181470 09-Aug-2008 imp

It turns out that checking the first DWORD register is more reliable
on a variety of cards. Adjust the comments accordingly to match the
code. Even if the vendor chose 0xffff for the device ID, the vendor
ID can't be 0xffff, so the test is still valid from a standards
perspective.


181458 09-Aug-2008 imp

After some intial testing, there are even slower cards than the ones
that I have. Wait up to 1.1s for the card to become ready. Document
what the standards say, and use that to justify the behavior in the
code: PCI standard says that a card must respond to configuration
cycles within 2^25 cycles after reset goes high, which is
approximately 1s. Therefore, give cards a little break and wait for
up to 1.1s for VENDOR to become valid. Only look at the vendor part
of the ID, since only it can't be 0xffff (although in practice
vendor/device will always be != 0xfffffffff). Include detailed
pointers to standards so epople understand why we're doing what we're
doing and why it just might be OK. Make it clear in the timeout
message that it is just a warning, sinc we try to soldier on as best
we can anyway.

This should eliminate an error message that r181453 produced on
certain Atheros cards.


181453 09-Aug-2008 imp

Rather than waiting a fixed amount of time, which might not be enough
and also holds things up, check every 20ms to see if we can read the
vendor of device 0.0. It will be 0xffffffff until the card is out of
reset. Always wait at least 20ms, for safety.

I think this is a better fix to the reset problem. However, I did it
as a separate commit in case something bad happens, people can roll
back to the commit before this one to see if that gives them reliable
behavior. I don't have FreeBSD up on enough machines to do exhaustive
testing on all known bridges...


181451 09-Aug-2008 imp

While most bridges can bring a card out of reset in 20ms, there are
some bridge + card combinations that take longer for reasons unknown.
Adjust the timeout to be 100ms on all !RICOH bridges, but leave RICOH
at 400ms. The 400ms is "lore" from other open source projects, and
I've never see my ricoh bridge chips take this long. Maybe it is the
same thing? Maybe a bit should be read instead of a hard-wired pause?

After this adjustment, a few cards that I'd insert and get only:
cbb0: card_power: 3V
cbb0: card_power: 0V
with full debugging enabled would actually try to attach.

Reported by: sam@ (I think)
MFC after: 3 days


172836 20-Oct-2007 julian

Rename the kthread_xxx (e.g. kthread_create()) calls
to kproc_xxx as they actually make whole processes.
Thos makes way for us to add REAL kthread_create() and friends
that actually make theads. it turns out that most of these
calls actually end up being moved back to the thread version
when it's added. but we need to make this cosmetic change first.

I'd LOVE to do this rename in 7.0 so that we can eventually MFC the
new kthread_xxx() calls.


172394 30-Sep-2007 marius

Make the PCI code aware of PCI domains (aka PCI segments) so we can
support machines having multiple independently numbered PCI domains
and don't support reenumeration without ambiguity amongst the
devices as seen by the OS and represented by PCI location strings.
This includes introducing a function pci_find_dbsf(9) which works
like pci_find_bsf(9) but additionally takes a domain number argument
and limiting pci_find_bsf(9) to only search devices in domain 0 (the
only domain in single-domain systems). Bge(4) and ofw_pcibus(4) are
changed to use pci_find_dbsf(9) instead of pci_find_bsf(9) in order
to no longer report false positives when searching for siblings and
dupe devices in the same domain respectively.
Along with this change the sole host-PCI bridge driver converted to
actually make use of PCI domain support is uninorth(4), the others
continue to use domain 0 only for now and need to be converted as
appropriate later on.
Note that this means that the format of the location strings as used
by pciconf(8) has been changed and that consumers of <sys/pciio.h>
potentially need to be recompiled.

Suggested by: jhb
Reviewed by: grehan, jhb, marcel
Approved by: re (kensmith), jhb (PCI maintainer hat)


170272 04-Jun-2007 imp

Migrate from setting a CARD_OK flag in a shared word, to setting its
own entry in the softc. This should allow more of cbb_pci_intr() to
migrate to a new cbb_pci_filt() so that we don't have to run cbb's ISR
in almost every case we get an interrupt. We can't just move
cbb_pci_intr into cbb_pci_filt because it does things that aren't safe
to do from a fast interrupt handler, err I mean from a filter. This is
an important first step.

# I wonder if I need to make cardok volatile or not.


170270 04-Jun-2007 imp

Don't register cb_func_filt if the client driver doesn't have a filter.
ditto for the isr.

Reviewed/Suggested by: simokawa-san


170232 03-Jun-2007 imp

Minor filter tweaks:
o If we don't have a filter, also check to make sure the card is there before
calling the scheduled ISR. This is necessary to help old drivers whose
ISRs can't cope with being called with the hardware missing, which sadly
still exist in the tree. This is the main reason why we have an extra
layer of indirection for cardbus interrupts.
o If the card is no longer present, mark the interrupt as 'handled' rather
than 'stray' because this accounts for why the interrupt happened. Stray
isn't all bad, since there are other filters that would claim it...
o Fix some comments
+ Add comment about why we check for CARD_OK and touch the hardware in both
the filter and ISR.
+ add a note about why we don't care about Giant
+ also note that giant can't be taken out in a filter...
+ Some minor formatting nits on very long comments.


170163 31-May-2007 piso

Make the interrupt handler wrapper capable of correctly support filter+ithread handler.

Discussed and reviewed with: bsdimp, simokawa


169618 16-May-2007 imp

o Don't hold lock over bus_teardown_intr when we're waiting for the
thread to die, since that can cause deadlock with the ISR (in theory).
o Minor cleanup
o comment nit


169617 16-May-2007 imp

Better message on cbb resource alloc failure


167217 05-Mar-2007 imp

Use different wait channel name for second of two sleeps. Minor commentary
addition.


167208 04-Mar-2007 imp

Reduce the number of retries to 10 from 20 for not_a_card retry test.
Add some comments to explain how 10 was picked. 20 was completely
arbitrary, at least 10 has some reasoning behind it.

Also, update the comments about how long we sleep to reflect the new,
shorter timeout we use.


167087 27-Feb-2007 jhb

Use pause() instead of tsleep()'s on the softc pointer that have no
corresponding wakeups. Also, at least some of the comments nearby indicate
that these are fixed-length I/O sleeps.


166901 23-Feb-2007 piso

o break newbus api: add a new argument of type driver_filter_t to
bus_setup_intr()

o add an int return code to all fast handlers

o retire INTR_FAST/IH_FAST

For more info: http://docs.freebsd.org/cgi/getmsg.cgi?fetch=465712+0+current/freebsd-current

Reviewed by: many
Approved by: re@


166786 16-Feb-2007 imp

Two changes:
(1) change debounce period from 1s to 250ms. This appears to be fine and
speeds things up a little.
(2) In the middle of cbb_pcic_power_disable_socket we write 0 to the EXCA_INTR
register to put the card into reset. However, this turns off CSC
interrupts for TI bridges (and maybe others). So no further card
insertion events would be noticed. To compensate, after we've gone
through the entire power down sequence, turn on EXCA_INTR_ENABLE so
that CSC events happen.

#2 should fix the 'dead slot' problem that has been reported after
card ejection (but only 16-bit cards).


166785 16-Feb-2007 imp

Fix typo in comment


166742 15-Feb-2007 imp

It turns out that it is easier to not NULL out pccard and cardbus
device pointers. They don't change as the children device drivers
come and go. Rather, check to see if the device is attached where we
would have checked ! NULL. This solves many asymmetries in the code
that likely could lead to crashes when loading/unloading cbb without
one or more of the expected children's driver not present.


166741 15-Feb-2007 imp

Fix three bugs:
o When detaching all children, try really hard to get all the children
list before giving up. This is based on an observation by hans petter
selasky in his usb p4 branch.
o When rescanning devices after a driver is added, abort if we can't get
the child list with a message.
o when rescanning devices, if the reprobe/attach is successful, save the
device for cardbus/pccard.


161241 12-Aug-2006 imp

Batch of changes:
o when turning off the socket for a 16-bit card, write 0 to INTR register
rather than just tying to just clear the rest bit. this seems to fix
card insert detection after an eject on TI bridges (ricoh bridges work
either way, apparently). This is a MFp4.
o Cope better with TOPIC95 bridges on powerup. According to NetBSD driver,
these bridges don't set POWER_STATE, so cope accordingly in our power
code. They also need a little extra time to settle, so do that as well.
o It appears that we need to turn on/off one of the clocks to the card
when we power up/down that socket on a TOPIC97, also from NetBSD.
o TOPIC97 bridges need to specifically enable LV card support. Unconditionally
do this in the hopes that all laptops that have these chips support LV
voltages (they should, since they are required for CardBus).
o TOPIC register name regularization. Registers specific to models of TOPIC
are now called out as such.

# I need a machine with a TOPIC95 for testing.


159207 03-Jun-2006 imp

We don't have a ISA specific shutdown routine at this time, so remove
it. We just moved it to be pci specific, so this was causing compile
problems (linking problems, so I didn't notice since I unwisely just
built the module).


159206 03-Jun-2006 imp

Since we turn off the interrupts, we don't need to disestablish
our ISR.


159197 03-Jun-2006 imp

Move shutdown, and pci specific methods into pccbb_pci.c. Many more
are needed still.


159196 03-Jun-2006 imp

The interrupt routine is pci specific. Move it into pccbb_pci.c.


159195 03-Jun-2006 imp

Fix a couple printf's to be properly terminated.
Use a better name for the cbb thread.


159194 03-Jun-2006 imp

Succeed for writing bus value... nobody that calls must care :-(


159161 02-Jun-2006 imp

Zero out the devices when they are deleted. We can access the pointer after
the bus detaches which can lead to core dumps. This is quite rare.


158893 24-May-2006 imp

Export the pribus, secbus and subbus as sysctls for information
purposes only. Additional information may be exported in the future.


158892 24-May-2006 imp

Suspend the children before we turn off card events in hardware. This
was done, I believe, to work around some cards having issues in the
suspend case. I think that this helped my Sony VAIO TS505 work better
when it had certain wireless cards in it and I did a apm -z. I've not
tested suspend/resume on other laptops in a long time, so I hope this
doesn't cause greif. Please let me know if it does.


158891 24-May-2006 imp

Fix a race when detaching the cbb worker thread. There were a couple
of cases where we didn't take out the lock before setting or clearing
a bit. This apparently can lead to a race at kldunload time (at least
on my Turion64 laptop, never saw it on my Sony Vaio).


158865 23-May-2006 imp

Whitespace nits


158651 16-May-2006 phk

Since DELAY() was moved, most <machine/clock.h> #includes have been
unnecessary.


157803 16-Apr-2006 imp

Add missing ~. We want all the INVALID bits to be 0... Let's see if this
helps people with their interrupt storm problem on card eject.


157281 30-Mar-2006 imp

On some laptops, under very high loads, the socket event register read
in the ISR doesn't read the actual socket event register, but instead
reads garbage (usually 0xffffffff, but other times other things).
This totally violates the PCI spec, but happens rarely enough that a
workaround is in order. This adds one test when we have a real
interrupt to service (which is very rare), and doesn't affect the
usualy 'nothing to see here' case at all.

Problem reported by many, but sam@ gave me this workaround after
diagnosing the problem.


157278 30-Mar-2006 imp

Add a mask of valid socket events
While I'm hear, fix define<sp> to be define<tab>.


157092 24-Mar-2006 imp

For each of the voltages that a card might support, make sure that the
socket also supports the voltage. Some XV cards have appeared on the
scene (or cards that report they support XV), and in older machines
that have sockets that do not support XV, we were bogusly trying to
power them at XV rather than at 3.3V. Now, power up the card at the
lowest voltage supported by both the card and the socket.

MFC After: 3 days


155434 07-Feb-2006 imp

Detach the children before we delete them. This is a little cleaner
than just deleting them. Also add comments about why we do this.
Given the current behavior of delete_child, I don't think this changes
anything. It just feels cleaner.


155316 04-Feb-2006 imp

Now that TUNABLE_ULONG is in the tree, and has been for a while, use it.
This also avoids typepunning.


153945 31-Dec-2005 imp

Remove extra debugging that crept in with the integration from p4.


153860 29-Dec-2005 imp

Simplify the opening of the resources for cardbus cards. Before we'd
try very hard to be perfect. However, these attempts broke down when
there were large numbers of resources. We'd not be able to map them all.

Instead, accept that we might pass more range to thse subbus than
might be optimal be able to compute. However, there's little harm in
this and it allows us to pass greater resources through.

# it has been suggested that we allocate a fixed amount of resources
# on attach and give it out upon request. This might not be a bad idea...


153757 27-Dec-2005 imp

Ensure that we're aligned at leas tto the size of the resource being requested.
When cbb_debug is on, print the windows that we're mapping.


153756 27-Dec-2005 imp

nits


152193 08-Nov-2005 imp

Mollify the whitespace police


151838 29-Oct-2005 imp

Shutdown a little better by commenting the shutdown code and acknowledging
any interrupts after we turn off the interrupt mask.


151837 29-Oct-2005 imp

Shut down the card bus bridge hardware on detach. Before we'd just
free the resoruces w/o actually turning off the interrupts. This lead
to interrupt storms if you were to insert a card after kldunloading
the driver.


151457 19-Oct-2005 imp

Make sure we set bst and bsh in the softc.

This gets us probing, but not attaching to, ISA cards. More work
needed since the ISA attach routine is return ENXIO right now :-)


151308 14-Oct-2005 imp

Merge in WIP from p4 for supporting ISA pccard bridges conforming to
the ExCA spec, and close cousins:

o Write an activate routine that works.
o merge a couple of items from oldcard before they are lost
o write a deactivate routine

I suspect we're still a ways away from having this work, but maybe for
6.1/5.5?


151081 08-Oct-2005 imp

MFP4: More removal of unused stuff.


151080 08-Oct-2005 imp

MFP4: Changes to hopefully make the new power code work better

o Rather than just try to turn off EXCA_INTR_RESET, set the entire register
to 0. This is slightly faster, and a better hammer.
o Move attempted clearing of the output enable (EXCA_PWRCTL_OE) back to
after we turn off the power. Modify it to write 0 so that we don't get
Bad Vcc messages on TI bridges (untested, but ru@ sent me a similar patch)
while at the same time avoiding interrupt storms on Ricoh bridges (tested
by me on my Sony).

# Many of my observations of 'breakage' for this patch are due to some bug
# in the load/unload of cbb.ko unlreated to this change. I'll be investigating
# and fixing that bug in the fullness of time.


151079 08-Oct-2005 imp

MFP4: We no longer use intr_handlers, so remove it.


151078 08-Oct-2005 imp

MFP4: Note why we do the dance we do for waiting for the thread to die.


150730 29-Sep-2005 imp

Fix bad compile. Pointy hat to: imp


150728 29-Sep-2005 imp

o Add a bunch of o2micro controller IDs
o Add SMC34C90 to list as well, since I've found enough more data about it
since my original research to know it is appropriate for this driver.


150713 29-Sep-2005 imp

I added the device IDs to the header, but not to the table. Add them
to the table.

MFC After: 3 days


150460 22-Sep-2005 imp

'PC Card' instead of other variants


150017 12-Sep-2005 imp

This appears to be good for some folks, but really bad for others.
Until we know why, back out 1.127.


149892 08-Sep-2005 imp

Minor improvement for the suspend case for Ricoh based (and others)
CardBus bridges.


148105 17-Jul-2005 imp

o The ricoh bridge needs us to turn off the function interrupts for
16-bit cards when we're powering them up. Other bridges may have
similar issues, so we do this for all of them by setting the
interrupt in the PCIC register 3 to be 0 (done always anyway)
and turning on the bit in the bridge control register to route these
interrupts via the ISA bus (or via the interrupt configured in the
PCIC register 3). '0' means disable completely. There's a small
chance this may interfere with the o2micro power hacks, but I'll
wait for reports to come in from o2micro users.
o Expand some of the comments about why we do certain things.

# this gets rid of the interrupt storm warnings on my 505TS. I think
# that we may need to do something similar on suspend, but I'm unsure
# since I don't have a laptop that supports suspened/resume with a
# ricoh chipset in it.


148102 17-Jul-2005 imp

Rename a bit to make it clearer that it enables routing of the function
interrupts to the ISA bus.


148090 17-Jul-2005 imp

The CD interrupt should only be enabled after we've initialized the
card. Mask it while we're doing power things, as the PC Card standard
suggests. Also, poll the POWER_CYCLE bit 10x a second as well as
providing a timeout for power cycle interrupt to happen.

The Ricoh '475 that I have doesn't seem to generate an interrupt for
power at the present time, so the polling is necessary for reasons as
yet unknown. This results in an interrupt storm warning that I'm
still trying to quantify (the o2micro trick doesn't work to mitigate
this storm). At the very least, this should help those users that
lost pccards on boot with the prior rev of this code. My VAIO
PCG-505TS is now happier, but more investigation is necessary.


148026 15-Jul-2005 imp

s/_us//


148025 15-Jul-2005 imp

Move to using tsleeps in the cardbus reset case as well. This
eliminates the last of the DELAYs in pccbb.


148013 14-Jul-2005 imp

Omnibus power and interrupt fixes:
o Don't busy wait on powerup. Instead, use the power up interrupt to wait
for the card to power up. Don't wait when we're turning the card off,
since no interrupt happens in that case.
o Convert many of the long DELAYs to tsleeps. We do not run before
the timer have stared, so DELAY isn't necessary. More DELAYs can likely
be eliminated in the future.
o When powering up the card, don't do anything if the card is already
powered up (before we'd power cycle it). This means that for most
cards we power them up once and then never change the power.
o On card eject, mask (by clearing) the CD bit. Before we set it, which
was wrong. We don't want to see any CD events past the first one since
they need to be debounced.

With these changes, I can insert/eject 16bit cards without glitching xmms'
sound output. Something very important to the development of better pccard
drivers :-)


147047 06-Jun-2005 imp

Not yet ready to burn this, so unmark power stuff.... non-type 0 busses still need to do this


145020 13-Apr-2005 imp

Since cbb implements the pcib_ interface, it must also implement the
pcib_route_interrupt interface. Since there's only one interrupt pin
in the CardBus form factor, everybody gets to share it. Implement
cbb_route_interrupt to return the interrupt we have.

Suggested by: bms


143158 05-Mar-2005 imp

Use BUS_PROBE_DEFAULT for pci probe return value


140197 13-Jan-2005 imp

Use the standard FreeBSD license for these files.

Approved by: imp, jon


140037 11-Jan-2005 imp

The card activation failured message is lame, and not done for other
busses, nor for the 16-bit cards. Eliminate it.


140036 11-Jan-2005 imp

/* -> /*- for a second clause


140035 11-Jan-2005 imp

Use the FreeBSD standard license, since there's no reason to use the
version I have here.


139749 06-Jan-2005 imp

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


139225 23-Dec-2004 imp

Add recognition of O2Micro 711M1.

Submitted by: Gordon Bergling


133811 16-Aug-2004 imp

Don't need to declare cbb module. don't know why I never saw
duplicate messages..


133553 12-Aug-2004 imp

Move towards isa attachment for pccbb. This is a work in progress, but
works well with the pci attachment.


132552 22-Jul-2004 imp

Add IDs from TI's web site. Reports from the field and inspection of
the data sheets leads me to believe these will just work. Those parts
with the various media readers on them may not have the required
FreeBSD drivers that will attach to the subdevices that will be seen
on some of these parts.

PCI 1515, 1530, 1620, 4520, 6411, 6420, 7410, 7510, 7610

Prompted by: Havard Eidnes


132551 22-Jul-2004 imp

More TI device IDs.
These are from the datasheets downloaded from TI's web site.
They describe the PCI[67]x[12]1 and PCI[67]x20 parts, with and without
the smartcard enabled.


132530 22-Jul-2004 imp

Update comment about fast interrupts to be closer to reality


130976 23-Jun-2004 imp

Improve the kludge assignment of sub-bus numbers a little by fixing an
off by one error. subbus must be > than pribus, so the right test is
<= not just <.

Reported by: Peter Losher


129876 30-May-2004 phk

Add some missing <sys/module.h> includes which are masked by the
one on death-row in <sys/kernel.h>


129532 21-May-2004 imp

When attaching pccard and cardbus children, there's no need to set the
device == NULL on failure. A warning should suffice.

# I wrote this back before I understood the unattached but loosely bound
# newbus concept...


129531 21-May-2004 imp

Now that we have the resource allocation code in current, the kludge
to try to allocate things on my parent can be taken out. It duplicates code.

Also, add comment about why the power state stuff is here (type 2
devices don't participate in the power state save/restore due to
larger Bx issues).


128906 04-May-2004 imp

Need to mark the interrupt from cbb as being MP safe on resume too.


128569 23-Apr-2004 imp

Start programming the bus numbers for the pci<->cardbus. When the
secondary bus is 0, we program the primary bus, the secondary bus and
the suborindate bus. This isn't ideal, since we start at parent_bus +
1 and store this in a static.

Ideally, we'd walk the tree and assign bus numbers. However, that's
harder to accomplish without some help from the bus layer which we're
not planning on doing that until 6.

This fixes my CardBus problems on my Sony PCG-Z1WA, and might fix the
Dells that have had problems.


128193 13-Apr-2004 imp

Remove extra copy of code.

Noticed by: Carlos Velasco


128170 12-Apr-2004 imp

MFp4:
Alignment for pccards should also be treated in a similar way that
we tread it for cardbus cards.

Remove bogus debugs while I'm here.

# This is also necessary to make the CIS reading work.

Submitted by: Carlos Velasco


127966 06-Apr-2004 imp

Better checks to make sure that we get good alignment. This code is a
bit of a bandaide until I get better pci bus code committed to head
from my p4 tree.


127965 06-Apr-2004 imp

Fix mis-merge from p4 by adding line getting sc.
Attempt to deal with larger memory allocation better.


127960 06-Apr-2004 imp

MFP4: Power up with OE disabled. Similar patches went into NetBSD a
while ago, and it does seem to help at least one card I have and has
been in my p4 tree for many months.


127135 17-Mar-2004 njl

Convert callers to the new bus_alloc_resource_any(9) API.

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


126674 05-Mar-2004 jhb

kthread_exit() no longer requires Giant, so don't force callers to acquire
Giant just to call kthread_exit().

Requested by: many


124137 04-Jan-2004 imp

MFp4:
o O2Micro OZ711e1 is now recognized (note: I don't have one, and the current
owner of the Dell laptop is reporting problems).
o minor nits wrt copyright date.


123717 22-Dec-2003 imp

Fix typo in ENE CB710 description. It isn't a 720.


122534 12-Nov-2003 imp

Fix a harmless typo (use of res instead of rle: if rle is NULL, we'd
still get a panic, just not a nice message) and update to new
__FBSDID.

Submitted by: charnier@


122291 08-Nov-2003 imp

-Wunused


122263 07-Nov-2003 imp

Remove channeling interrupts to IRQ1. Some chipsets don't do the
expected thing and that causes interference with keyboards.


121460 24-Oct-2003 imp

Backswards is as backwards does: If we're MPSAFE, then we don't need
giant, which implies that we need to take out giant it we're NOT
MPSAFE.

# I can't believe the number of people that looked at this failed to
# detect this.


119293 22-Aug-2003 imp

Add newly discovered ENE Technologies CardBus bridges to the list:
CB710, CB720, CB1211, CB1225, CB1410 and CB1420
These are likely licensed designed from TI, and the Linux PCMCIA code
treats them as TI chips.

Add comment, but no ID for the 711E1 from O2Micro.


119285 22-Aug-2003 imp

Prefer new location of pci include files (which have only been in the
tree for two or more years now), except in a few places where there's
code to be compatible with older versions of FreeBSD.


119191 20-Aug-2003 imp

In my efforts to make checking the CD bits less error-prone, I
introduced an error. In power_enable_socket, we only return ENODEV if
there isn't a card, not if there is a card. Ooops.

Pointy hat to: bsdimp


119176 20-Aug-2003 mux

Fix typo in last commit.


119165 20-Aug-2003 imp

Use CBB_CARD_PRESENT instead of checking STATE_CD directly since it is
hard to get right.


119094 18-Aug-2003 imp

The CD bits in the CBB_SOCKET_STATE register are 0 when the card is
present, and non-zero when it is (or may be) absent. The test
cbb_child_present was backwards. However, typical usage in the tree
would cause it to do the right thing because the card really wasn't
there the OK flag would be turned on.

Also, assume that if any of these bits are turned on we don't have a
card, rather than requiring both of them in the suspend/resume
routines.

Noticed by: cognet


119061 18-Aug-2003 imp

Put the clearing of the socket cd interrupt and setting of it under
protection of sc->mtx. Sometimes multiple insert/ejections could
cause further insertion/removals to not happen due to racing an ISR...


118899 14-Aug-2003 imp

trivial optimization: use nameunit here.


118715 10-Aug-2003 imp

MF p4:

Minor style(9) nit.


118713 10-Aug-2003 imp

Some bridges, like o2 micro and maybe ricoh, have some issues between
the time the card is inserted and the time that the card is
configured. This can lead to interrupt storms. The O2Micro suggested
workaround is to route the card function interrupt to IRQ1. It
appears from my testing that this is an acceptable workaround for most
chipsets (there's still some issue with the ricoh chipset).

Also, only look at the NOT_A_CARD bit when the bridge tells us there's
a card present. At least one test caused this to be true after the
card was removed, but the author couldn't recreate it with the
workaround in place. The change is more conservative than the
previous code, but still has the work around that wasn't present in
the older code.


118706 09-Aug-2003 imp

Add code to cope more with strange conditions after careful study of
the standard.

1) When the bridge tells us that we have a card that isn't recognized, we
use the force register to force the CV_TEST to run. This test causes the
bridge to re-evaluate the card. Once this re-evaluation process happens,
we get a new interrupt that may say it is ready to process. We try this up
to 20 times. Tests have shown that this appears to correctly reset the
'Unknown card type' problem that I saw on my Sony PCG-505TS.
2) Take a page from OLDCARD and always read the CSC register in the ISR.
Some TI (and it seems maybe Ricoh) chipsets require this to behave
properly. This work around appears to work due to some power management
protocols that were improperly implemented. Maybe it can be removed when
this driver supports the full PME# protocol described in the standards.
3) Minor additional debug printf when debugging is enabled.
4) Minor additional commentary for things that are obvious only after study.

# I'm committing this from my Sony PCG-505TS using shared PCI interrupts
# and NEWCARD, but there are some issues with the Ricoh bridge still, but
# at least now I can boot with the card inserted and have it work.


118705 09-Aug-2003 imp

CBB_SOCKET_STAT_ is too long. Change it to CBB_STATE_. Also, make
some minor changes to more closely match the bit names used in the 7.0
version of the PCMCIA standard. Also add bits from the FORCE
register.


118703 09-Aug-2003 imp

When allocating memory, align it to the minimum alignment required for
cardbus bridges if the alignment requirements were less restrictive.


118701 09-Aug-2003 imp

Add comments about some alignment that looks a little strange.


118700 09-Aug-2003 imp

Minor fixes to a couple of comments.


118607 07-Aug-2003 jhb

Consistently use the BSD u_int and u_short instead of the SYSV uint and
ushort. In most of these files, there was a mixture of both styles and
this change just makes them self-consistent.

Requested by: bde (kern_ktrace.c)


117198 03-Jul-2003 imp

All current uses of pci_set_powerstate are bogus, at least in theory.
However, they are presently necessary due to bigger bogusness in the
pci bus layer not doing the right thing on suspend/resume or on
initial device probe. This is exactly the sort of thing that the
BURN_BRIDGES option was invented for. Mark all of them as
BURN_BRIDGES. As soon as I have the powerstate stuff properly
integrated into the pci bus code, I intend to remove all these
workarounds.


116249 12-Jun-2003 imp

Unlock after ISR.

Noticed by: njr
Pointy hat to: the impable one.


116244 12-Jun-2003 imp

s/BURN_THE_BOATS/BURN_BRIDGES/g to adopt to new world order


116232 12-Jun-2003 imp

Make cbb interrupts MPSAFE:
o Register ISR INTR_MPSAFE.
o Loop on KTHREAD_DONE == 0 in the thread.
o Safe the INTR_MPSAFE flag for client drivers (don't know if there are any
CardBus/PCI drivers that are INTR_MPSAFE)
o Read status after acquiring mtx_lock(Giant) rather than before so that we
catch state changes that happen while Giant is being acquired.
o Turn off the CD bit when we see a CD interrupt, and turn it back on after
we've attached/detached the card.
o On suspend, actually set the CBB_SOCKET_MASK to zero rather than oring
in '0' to turn it off on suspend.
o If the ISR that's registerd is MPSAFE, don't acquire Giant around call to
client ISR.
o Fix comments to reflect these changes.


115989 07-Jun-2003 imp

MFp4:

Migrate some common pccard code into exca.


115986 07-Jun-2003 imp

Simplify the power code somewhat (this makes the module about 100
bytes smaller).


115887 06-Jun-2003 imp

Add two of three workarounds for interrupt storms for o2micro parts as
obtained from o2micro. These should only be needed for 'older'
o2micro bridges (anything before the 7xxx series of bridges), but will
work with the new bridges.

# I don't plan on porting it to oldcard, but will happily commit to
# oldcard if someone else needs them.


115552 31-May-2003 phk

Remove return after goto.
Remove break after return;

Found by: FlexeLint


114683 04-May-2003 imp

Back out accidentally committed debugging


114663 04-May-2003 imp

fix typo in TI1515 ID.


114643 04-May-2003 imp

Grab some of the latest TI cardbus bridge IDs. Inspired by a similar
commit to NetBSD. I'll add these to various tables soon.


114196 29-Apr-2003 imp

Fix typo on O2Micro devices names.

Submitted by: noda-san


114169 28-Apr-2003 imp

Make IRQ shareable for the cardbus case too.


113240 08-Apr-2003 imp

Don't need to read this config register if we're just going to
overwrite it in the next line.


113239 08-Apr-2003 imp

MFp4: Massively unbreak module loading/unloading:
o Only complain about detached children that aren't pccard/cardbus.
o Don't NULL out the pccarddev and cbdev devices. detach just
disassociates the device and driver. It doesn't delete the child.
o on driver added, just probe_and_attach the children. If there's
any children attached, wakeup the device add/delete thread.
o wakeup the add/delete thread with the correct cv_signal() rather
than the bogus wakeup(sc). It used to be that we did a tsleep on
sc in this thread, but switched to the more reliable cv stuff a while
ago w/o changing this.
o Remove bogus checks when reallocating memory for the registers. They
weren't needed and turned out to be completely bogus.

This lets me load/unload pccard with a pccard in a slot and have the
child correctly detach/attach. This should help people that have wi
in their kernel, but that kldload cbb and pccard, for example.


111533 26-Feb-2003 imp

Add a number of IDs from linux for old, rare pci devices:
o A second 82092AA id.
o SMC 34c90
Plus a couple of trivial formatting changes.


110842 14-Feb-2003 imp

o transition from exca_write to exca_putb and read->getb. This is so that
we can have additional different types of bridges.
o remove now bogus comment.
o Don't clear CARD_OK when we can't attach a card.
o minor style nits

# this make kldload of cardbus drivers work for me when the card is
# present on boot.


107194 23-Nov-2002 imp

Remove a comple of bogus debug printfs that snuck in during some
debugging I was doing 3 months ago :-(.

Noticed by: scottl
Aproved by: the re blanket (different than the security blanket).


106900 14-Nov-2002 imp

MFp4:
o Add support for bus_child_present call by implementing that method for cbb.


106899 14-Nov-2002 imp

MFp4:
o Make this code a little easier to understand by using simpler if
statements, but nesting them.


106395 04-Nov-2002 imp

Detach the pccard bus children when we eject a 16-bit card, not the
32-bit ones. This was introduced in the last commit.


106362 02-Nov-2002 imp

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


104830 11-Oct-2002 imp

o Set CBB_CARD_OK just before CARD_ATTACH_CARD. If ATTACH_CARD fails, then
clear the bit. This allows ata driver to attach its children because
it needs the interrupts enabled to succeed.

Submitted by: iwasaki-san

o Spell CardBus as CardBus, not Cardbus or CardBUS while I'm here.


104651 08-Oct-2002 imp

Make kldunload cbb work:
o Implement the thread killing interlock as described by jhb in arch@
while talking to markm.
o Hold Giant around cbb_insert()/cbb_remove(). Deep in the belly of
the vm code we panic if we don't hold this when we activate the memory
for reading the CIS.
o If we had to do the kludge alloc, then do a kludge free.


104642 07-Oct-2002 imp

MFp4:
o Better resume code. Move the comments around. Force the socket state to
be querried. Ack the interrupts properly.
o Intercept the interrupt requests and keep a list of interrupts to service
ourselves. When the card attaches, set its OK bit. When we get a card
status change interrupt for that card, clear the OK bit. Don't call the
ISR if the OK bit is cleared. Iwasaki-san and yamamoto-san have both
sent me patches that fix the same problem this fixes, but at the pccard
level.
o Try to get the signalling of the thread to actually die. This might not be
100% right, but it is less wrong than before.
o Add a SIC next to a TI type that looks like it could be wrong, but isn't.


104354 02-Oct-2002 scottl

Some kernel threads try to do significant work, and the default KSTACK_PAGES
doesn't give them enough stack to do much before blowing away the pcb.
This adds MI and MD code to allow the allocation of an alternate kstack
who's size can be speficied when calling kthread_create. Passing the
value 0 prevents the alternate kstack from being created. Note that the
ia64 MD code is missing for now, and PowerPC was only partially written
due to the pmap.c being incomplete there.
Though this patch does not modify anything to make use of the alternate
kstack, acpi and usb are good candidates.

Reviewed by: jake, peter, jhb


103173 10-Sep-2002 imp

reprobe not needed here either


102354 24-Aug-2002 blackend

Fix typos: s/O2Mirco/O2Micro/

Approved by: imp


101904 15-Aug-2002 imp

Rename the pccbb device to cbb.


101633 10-Aug-2002 imp

When we allocate our bus address via the kludge that we have in the
code to do it when the bios doesn't do it for us, flag it. Then, when
we dealloc, do an equal kludge to get rid of the address. This should
address the can't get IRQ and panic bug in a more graceful way.

# really should write a dealloc routine and just call it instead, since
# this might not fix things in the kldunload case.


101632 10-Aug-2002 imp

confirmed OZ6912 and 6972 share same pci ID


100730 26-Jul-2002 imp

No doubt about it, I gotta get a better hat:

Add the definition for sockbase that I accidentally removed two
revisions ago and didn't notice until some kind soul pointed it out to
me.


100723 26-Jul-2002 imp

Looks like a last second change wasn't completely backed out.


100704 26-Jul-2002 imp

MFp4:
o Rename the insanely long PCIC bridge ids.
o Add my copyright to pccbb.c
o Add support for the TI-1510, TI-1520 and TI-4510 series of upcoming
bridges.
o Init MFUNC if it is zero and the TI part has a MFUNC register
at offset 0x8c (1030, 1130 and 1131 don't have anything there, the
1250,1251,1251B and 1450 have a different thing there. The rest
have it. TI is likely to only do MFUNC from now on. The IRQMUX
in the 1250 series of chips needs no tweaks.
o Adjust to new exca interface.
o Add comments about TI chips that I learned in talking to an
engineer at TI.
o Add register definitions for MFUNC.
o Create CB_TI125X chipset type.


100424 21-Jul-2002 imp

Reset the 16-bit bus and turn off power. More work in this area may
be needed, but this seems sane on my laptop.


98156 13-Jun-2002 imp

Use a cv rather than tsleep and friends to do the sleep/wakeup
handshake between the ISR and the worker thread. Move the mutex lock
so that it only protects the cv_wait. This elimiates the not sleeping
with pccbb1 held messages some people were seeing.

Reviewed by: jhb (at least an early version)


97613 30-May-2002 takawata

Make oldcard and newcard kernel module work.


95709 29-Apr-2002 imp

Spell hw.cbb.start_memory the same in the HINT as well as the sysctl.

Noted by: bde


95708 29-Apr-2002 imp

Make sysctl RW


94570 13-Apr-2002 imp

Restore NetBSD copyrights that shouldn't have been removed in the first place.


93818 04-Apr-2002 jhb

Change callers of mtx_init() to pass in an appropriate lock type name. In
most cases NULL is passed, but in some cases such as network driver locks
(which use the MTX_NETWORK_LOCK macro) and UMA zone locks, a name is used.

Tested on: i386, alpha, sparc64


90981 20-Feb-2002 imp

Check the status of the card bridge first thing, rather than last in
the loop. This fixes the "my card is in the laptop on boot, but
doesn't attach" problem.


90751 17-Feb-2002 imp

Bulk changes made during the BSDcon kernel summit and travel afterwards.
Appologies for making this one bulk commit, but I have tested all these
changes together and don't want to break anything by trying to disentangle
it.

o Make debugging a sysctl/tunable
o Remove flags word from yenta chip info, it is unused
o Make 16-bit card I/O range and 32-bit card I/O range tunables
o Start the rename of pccbb to cbb to match NetBSD by misc renames.
o Kill the now bogus list of softcs to create kthread. Instead, just
create the kthread in the attach routine.
o Remove sc_ from some structure names. It isn't needed.
o Refine chipset lookup code.
o Match generic PCI <-> CardBus bridges. We specifically don't generically
match PCI PCMCIA bridges because they are not, with one exception, yenta
devices.
o Add some comments about the why we need to have a function table ala
OLDCARD
o The PCI interrupt routing by using the ExCA registers is needed for
for all bridges, per the spec, not just TI ones.
o Collapse TOPIC95 and TOPIC95B.
o Using the ToPIC 97 and 100 datasheets, try to support these bridges better,
but more work is needed.
o Generally clarify some XXX comments and add them in a few places where
things didn't look right to me.
o Move interrupt generating register access until after we establish an ISR.
o Add support for YV and XV cards. X and Y are numbers to be determined
later (but maybe never).
o factor powerup code for 16-bit and 32-bit cards.
o When a card supports more than one voltage, prefer the lowest supported
volage. Windows does this, and MS's design guides imply this is the
right thing to do.
o Document race between kthread_exit(0) and kldunload's unmapping of pages
that John Baldwin and I discovered.
o Debounce the CSC interrupt a little better.
o When a 16-bit card is inserted when we don't have a pccard child,
warn about it better. Ditto for 32-bit card.
o Ack ALL the interrupt bits that we get, not just 0x1.
o maybe a couple minor style nits corrected.


90746 16-Feb-2002 des

I am sick of being told that "cstsevent occures".


90444 10-Feb-2002 imp

o Use INTR_TYPE_AV (the highest possible) rather than INTR_TYPE_BIO
o Don't allow INTR_TYPE_FAST. Since we are sharing the interrupt between
CSC and the functions, they can't be FAST because fast interrupts can't
be shared.
o Add the same workaround for resume that we have in OLDCARD.
o Also, return the error from bus_generic_resume rather than ignoring it.


90187 04-Feb-2002 imp

Default debugging to OFF now.


89949 29-Jan-2002 imp

Migrate towards using the new exca module for 16bit stuff. This is a
WIP, but works for me.

Also do some minor code factoring and code cleanup while I'm here.


89947 29-Jan-2002 imp

Minor sorting orders


89406 15-Jan-2002 imp

better namespsace of static functions


89405 15-Jan-2002 imp

o Sync the device list with OLDCARD.
o Remove bogus flags that aren't used (if we need them in the future, we can
add them back).
o Add support for the TI-1031. This is the only YENTA compatible PCI-PCMCIA
bridge that I'm aware of (all the others are PCIC on a PCI bus, which is
different).


89326 14-Jan-2002 imp

use bus_space(9) rather than the memory mapped register set. This is
the first step towrads merging pcic and pccbb for 16-bit cards.


87975 15-Dec-2001 imp

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>


86908 26-Nov-2001 imp

Make the start memory address that we use configurable via a boot
loader parameter. This allows us to more easily boot on big memory
configuration machines. hw.pccbb.start_mem. Reflect this in a sysctl
so we can read it from userland.

# Note: we need a TUNABLE_ULONG to do this right. I'll add that to
# kernel.h soon.


86904 26-Nov-2001 imp

style(9) fixes:
o declare variables at the start of the function, not the start of
a block.
o return (retval);
o minor {} tweaks.


86901 26-Nov-2001 imp

peter pointed out that I missed a hard coded location for the memory.
Also add a define for I/O stuff (for cardbus).


86899 26-Nov-2001 imp

Make the address we kludily allocate in pccbb be a #define for easier
changing. Also change it from 0x44000000 to 0x84000000 for large memory
machines.

# the PCI bus code should do this for us. This is a bandaide, not a
# solution.


86265 11-Nov-2001 imp

Move Intel 82092AA into the list of devices. It appears to be a one
off chip that was on one prototype board. However, this appears to be
a design that many chipsets are compatible with its PPEC register set
(eg the Omega 82c094). Through the kindness of the Red Hat developer
David Woodhouse, I now have this datasheet.

I may take the advise of one of the bsd-nomads (whose name
unfortunately escapes me at the moment) and split out all these 16-bit
I/O mapped PCI devices into a separate driver...


86264 11-Nov-2001 imp

Add Omega 82c094 PCI PCMCIA bridge. It is similar to the CL-PD6729 in
that it has one BAR that's mapped to 0x3e0 and is I/O only. It does
not conform to the Yenta spec, like other PCI PCMICA bridges do (eg
the TI 1031, which is mostly a 1131 w/o 32bit card support). It
appears that this chip may also need to not route PCI interrupts
as well.

This chip is used in the NEC Versa 2430CD (and it appears that
sometimes it works, while other times it doesn't) and others in the
2400 series. While the NEC website claims Cardbus support, I can't figure
out how that is possible.

Submitted by: Ben Timby <ben@webexc.com>


85978 03-Nov-2001 phk

Add PCIC_TI4410

(patch probably from imp@, can't remember figuring this out myself.)


83159 06-Sep-2001 imp

Surf the net again and find more device IDs:

Cirrus Logic PD6834
O2micro OZ6836
O2micro OZ6912/6972
O2micro OZ6922
O2micro OZ6933
TI1260 Note: These two aren't on TI's site, but are in
TI1260B http://www.yourvote.com/pci/vendors.txt

Plus comments for other chips found in Windows INF files, and also
referenced in various spots on the net:

* Intel 82092AA 0x12218086 16bit
* smc/Databook DB87144 0x310610b3
* SMC/databook smc34c90 0xb10610b3
* Omega/Trident 82c094 0x00940123?
* Omega/Trident 82c194 0x01941023
* Omega/Trident 82c722 0x07221023?
* Opti 82c814 0xc8141045
* Opti 82c824 0xc8241045
* NEC uPD66369 0x003e1033


83158 06-Sep-2001 imp

minor commentary


82522 29-Aug-2001 imp

First, The Ricoh 5C47x chips don't have the disable the 3e0 bits.
Second, the TI 1130 need to have the PCI_INTR set, not cleared.

This gets Soren's machine working with NEWCARD again.

# The whole initialization is a mess and needs to be organized ala OLDCARD.


82414 27-Aug-2001 jon

Fix the hack that allocates memory when the bios haven't already done so.

We can't rely on rman to give us a useable memory window if we tell it to
do auto-allocation. This should probably be fixed on the pci bus/rman side.


82385 27-Aug-2001 imp

Note difficulties we had in OLDCARD using NEWCARD's methods of debouncing card event interrupts.


82378 27-Aug-2001 jon

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


82375 26-Aug-2001 jon

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


79007 30-Jun-2001 imp

Fix warning message.

Suggested by: julian


78489 20-Jun-2001 imp

Revert last change: it was unintended at this time.


78488 20-Jun-2001 imp

Add new entries for:
TI1210, TI4410 and TI4450
and fix what looks like a typo in the OZ6860 entry.

Obtained from: NetBSD


77195 25-May-2001 imp

Separate out pci cardbus bridge definitions to a common file for use
by both OLDCARD and NEWCARD.

# didn't make the tables the same because oldcard supports more devices than
# newcard and newcard's 16-bit stuff needs some work.


75645 18-Apr-2001 imp

Add some more O2Micro devices I gleened from the web site/linux pcmcia cs.
Add TI4451 as well.

These are untested since I don't have the hardware to test against.

Also, some O2Micro devices are #define w/o numbers as place holders so that
I can encourage people to submit them when they appear in the channels.


75643 18-Apr-2001 imp

Add support for the OZ6832.

Submitted by: Martin Nilsson <martin@svenskabutiker.se>


75414 11-Apr-2001 imp

Add O2Micro's OZ6872 Cardbus bridge.

Submitted by: Robert Sexton <robert@kudra.com>


75021 30-Mar-2001 jesper

Change the previous commit to be in style(9)

Reviewed by: jhb


74985 29-Mar-2001 jesper

Fix building NEWCARD again, by including
sys/types.h and sys/lock.h in pccbb.c, as
jhb noted in rev 1.12 of src/share/man/man9/mutex.9


72200 09-Feb-2001 bmilekic

Change and clean the mutex lock interface.

mtx_enter(lock, type) becomes:

mtx_lock(lock) for sleep locks (MTX_DEF-initialized locks)
mtx_lock_spin(lock) for spin locks (MTX_SPIN-initialized)

similarily, for releasing a lock, we now have:

mtx_unlock(lock) for MTX_DEF and mtx_unlock_spin(lock) for MTX_SPIN.
We change the caller interface for the two different types of locks
because the semantics are entirely different for each case, and this
makes it explicitly clear and, at the same time, it rids us of the
extra `type' argument.

The enter->lock and exit->unlock change has been made with the idea
that we're "locking data" and not "entering locked code" in mind.

Further, remove all additional "flags" previously passed to the
lock acquire/release routines with the exception of two:

MTX_QUIET and MTX_NOSWITCH

The functionality of these flags is preserved and they can be passed
to the lock/unlock routines by calling the corresponding wrappers:

mtx_{lock, unlock}_flags(lock, flag(s)) and
mtx_{lock, unlock}_spin_flags(lock, flag(s)) for MTX_DEF and MTX_SPIN
locks, respectively.

Re-inline some lock acq/rel code; in the sleep lock case, we only
inline the _obtain_lock()s in order to ensure that the inlined code
fits into a cache line. In the spin lock case, we inline recursion and
actually only perform a function call if we need to spin. This change
has been made with the idea that we generally tend to avoid spin locks
and that also the spin locks that we do have and are heavily used
(i.e. sched_lock) do recurse, and therefore in an effort to reduce
function call overhead for some architectures (such as alpha), we
inline recursion for this case.

Create a new malloc type for the witness code and retire from using
the M_DEV type. The new type is called M_WITNESS and is only declared
if WITNESS is enabled.

Begin cleaning up some machdep/mutex.h code - specifically updated the
"optimized" inlined code in alpha/mutex.h and wrote MTX_LOCK_SPIN
and MTX_UNLOCK_SPIN asm macros for the i386/mutex.h as we presently
need those.

Finally, caught up to the interface changes in all sys code.

Contributors: jake, jhb, jasone (in no particular order)


72189 08-Feb-2001 imp

Fix memory leaks with dev_get_children().

Submitted by: Jeroen Ruigrok/Asmodai <asmodai@wxs.nl>


70748 07-Jan-2001 imp

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)


70746 07-Jan-2001 imp

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.


70715 06-Jan-2001 jon

* 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


69954 13-Dec-2000 msmith

Updates to match changes elsewhere in the PCI subsystem:

- Remove redundant header-type-specific support in the cardbus pcibus
clone. The bridges don't need this anymore.
- Use pcib_get_bus instead of the deprecated pci_get_secondarybus.
- Implement read/write ivar support for the pccbb, and teach it how
to report its secondary bus number. Save the subsidiary bus number
as well, although we don't use it yet.


69288 28-Nov-2000 jon

A bunch of newcard/cardbus changes that's been sitting in my tree for a while:

- Make pccbb/cardbus kld loadable and unloadable.
- Make pccbb/cardbus use the power interface from pccard instead of inventing its own.
- some other minor fixes


67423 22-Oct-2000 imp

Cleanup allocation of resources for 16-bits. We now do the right
thing in pccbb bridge (the pcic bridge will be updated as I merge the
two copies of the code that were in the original cardbus commit).


67400 20-Oct-2000 imp

Allow interrupts to be sharable.

This allows us to probe, but not attach.


67284 18-Oct-2000 imp

Go ahead and disable the legacy mapping of the pcic registers on the
RF5C47x. Before the code would only do this on the RF5C46x bridges.

Submitted by: Jonathan Chen


67276 18-Oct-2000 jon

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