Commit Graph

125 Commits

Author SHA1 Message Date
Warner Losh
aa3a855755 Add back the plain i82365 to the list of bridges that do special
things to get 3.3V.  It appears that some cardbus chipsets have id
registers that say they are C step parts, but they really support the
DF step 3.3V functionality.

# Need to verify that IBM KING is handled properly since the MISC1
# register is really a cirrus logic only register.
2001-05-19 06:36:09 +00:00
Warner Losh
0eee936491 Initialize cinfo structure at compile time rather than run time since
they are now constant.
2001-05-19 06:17:37 +00:00
Warner Losh
11695ef016 Now that we've moved the mecia support out of pcic.c to its own
driver, we no longer need to go through the cinfo.XXXX indirections.
restore the direct calls that were replaced earlier.
2001-05-19 05:50:42 +00:00
Warner Losh
bc0f2245d1 Move ISA specific code into pcic_isa. This is the probe routine, the
get/setb1 routines.  Also expose clrb and setb as pcic_{clrb,setb} so
we can use it from the probe.  pcic_probe is no longer needed.
2001-05-19 05:21:23 +00:00
Warner Losh
08db6b5c8e It turns out that Intel's i82365sl-DF step has the same ID as the VLSI
82C146.  The Intel i82365SL-DF supports 3.3V cards.  The Step A/B/C
parts do not appear to support this.  This is hard to know for sure
since it was deduced from "compatible" parts' data sheets and the
article mentioned below.

Rework the VLSI detection to be a little nicer and not depend on
scanning cards twice.  This would allow bad VLSI cards to coexist with
a good intel card, for example.  We now detect i82365SL-DF cards where
before we'd detect a VLSI.  For the most part, this is good, but we
run a small chance of detecting a single slot 82C146 as a i82365SL-DF.
Since I can't find a datasheet for the 82c146, I don't know if this is
a problem or not.

This work is based on an excellent article, in Japanese, by NAKAGAWA,
Yoshihisa-san that appeared in FreeBSD Press Number 4.  He provided a
patch against PAO3 in his article.  Since the pcic.c code has changed
some since then, I've gone ahead and cleaned up his patch somewhat and
changed how the code detects the buggy '146 cards.

I also removed the comment asking if there were other cards that
matched the 82C146 since we found one and additional information isn't
necessary.
2001-05-19 04:53:20 +00:00
Warner Losh
5a695e4878 Separate out isa attachment to its own file. The pci attachment will
soon attach directly to pcic rather than the kludge pci-pcic device we
have now.

In some ways, this is similar to the work PAO3 did to try to support
cardbus bridges.  In some ways different.  This and future commits
will be taking from the spirit of many of those changes.  pcicvar.h is
completely different from the pcicvar.h that appeared in PAO3, but
similar in concept.
2001-05-16 07:32:04 +00:00
Warner Losh
fae3b4e989 The mecia support has moved to the mecia driver, so remove the copy of
it here.
2001-05-15 23:50:58 +00:00
Warner Losh
ca4d6d4f8c {G,S}ET_UNIT are now unused, gc them 2001-05-15 03:32:45 +00:00
Warner Losh
f81f90ff95 It turns out that pcic_slot::slotnum was really unused, so don't set
it.
2001-05-14 23:14:23 +00:00
Warner Losh
12d6689ccd Remove static array of slots. We now have state information for each
slot in a softc for each unit that we probe.  Also remove validunits
static, since it is no longer necessary.
2001-05-14 23:08:58 +00:00
Warner Losh
07e0ca29b5 Fix the so called "static bug" in polling mode. Some desktop cards
have bad grounding characteristics which allow small static discharges
(or sunspots, we're not 100% sure which) to reach the bridge chip.
This causes the bridge chip to wedge/reset itself.  There's no known
cure short of rebooting.

The bug manifests itself by the STAT_CHG return 0xff when read.  This
is impossible because the upper bits are reserved (and therefore
zero).  In addition, some of the lower bits are one only for memory
cards, which OLDCARD doesn't support, so if they are set, something
seriously foobar'd is going on.

So far we've seen this in exactly one brand of pcmcia <-> isa bridge
which plug and play identifies only as "VIA PCMCIA CARD".  This card
just has buffers on the isa card and the actual bridge chip on the
remote slot, which is connected by long ribbon cables.  We think this
long cable run, coupled with the lack of coupling capacitors is a
major reason why it is so static sensitive while its bretheren aren't.

Work Supported by: Timing Solutions, Inc.

MFC After: 3 days
2001-05-14 21:08:20 +00:00
Warner Losh
3ad72a92eb When activating or deactivating a resource, only attempt to deal with
the resource activation if we're dealing with our grandchild.
Otherwise, we run into two problems.  One, if the pccard layer wanted
to allocate and activate something, we'd wind up trying to do the
wrong thing twice: the ivars are wrong and we don't want the bridge to
map the resource to the slot.  If we're more than a grandchild, then
who knows what kind of ivar is present.  In either of these cases, we
just pass it up the food chain.
2001-05-14 04:53:02 +00:00
Warner Losh
180c9afb62 Return errors for unsupported operations on pcic_get_res_flags rather
than 0.
2001-05-13 04:44:45 +00:00
Warner Losh
87c53da12e Change #ifdef PC98 to #ifdef MECIA_SUPPORT and define MECIA_SUPPORT
when PC98 is defined.  This is in perparation for a mecia driver
separate from pcic, assuming that all goes well with that effort.
MECIA_SUPPORT won't be removed until after that support is working.
2001-05-13 04:16:09 +00:00
Warner Losh
804e80065b o Get rid of static array of slots in pccard layer. Move this to the
softc.
o Store pointers to softc in dev_t in si_drv1.
o Change 'kludge version' to 'classic version' since things are getting less
  kludgy.
o Minor code shuffling so that we probe and attach the pccard slots.
o Minor style(9) changes.
2001-05-13 01:44:27 +00:00
Duncan Barclay
7b8ec2c952 Use enumeration values for CARD_SET_RES_FLAGS.
Remove panic on out of range io window and return ENXIO. Add a similar
check for memory windows.

Approved by:	imp
2001-05-08 23:59:13 +00:00
Warner Losh
bc5797c7de Set the slot pointer in the pc98 case. Correct the name of the bridge
chip to the one that the Japanese use.  Now we get insert/remove
events on my PC-9821Ne.  More work in bus space is needed to make
drivers work.

MFC after: 3 days
2001-05-07 22:28:05 +00:00
Warner Losh
a66173abd2 Disable the card after sending the removed event up to the pccard
layer.  This fixes an ordering problem that would cause the ISR for
the device to run with now power applied to the device.  Most cards
failed to deal with this gracefully, and thus would hang on card
eject.

The power down event, for those keeping score, is what causes the
interrupt for the card.

Many folks in the Japanese nomads list have reported this, so I'll be
MFCing quickly for their benefit.

Submitted by: Masayuki FUKUI
MFC after: 2 days
2001-05-07 16:50:34 +00:00
Warner Losh
04a3a05381 Set the device name for NEC PC98 PCMCIA Controller on boot.
# We really need to allocate i/o ports for it, but I need to learn
# the pc98 bus space better before attempting that.
2001-04-21 07:08:03 +00:00
Warner Losh
3fb5ffd286 Indirect off cinfo rather than calling pcic_ functions directly. This
means that the pcic98 functionality might now work (I've tested it on
my pcic machine, but not the pcic98).  Since these functions are
rarely called, it is unlikely that this will have a measurable impact
on performance.
2001-04-19 05:45:51 +00:00
Warner Losh
7402675de4 First cut at bringing NEC PC98 original pccard bridge code back into
FreeBSD.  This code doesn't work just yet, but does compile.  We need
to start indirecting via the cinfo pointers, rather than directly
calling pcic_*.  There may be other issues as well, but you gotta
start somewhere.

Obtained from: PAO3
2001-04-19 00:04:08 +00:00
Warner Losh
e5eac10b13 Add #define for IBM3765.
Fix SWAMPBOX.  It had actiontec's ID.
Reorder pnpids so they are in alphabetical order.
2001-04-11 20:18:29 +00:00
Warner Losh
cc2310a949 Axe a few __P() while I'm in the neighborhood. 2001-03-22 05:49:18 +00:00
Warner Losh
36260de0cf Lots of minor cleanup, plus a couple of interesting things.
o Attempt to disable the slot when we detect that there are problems with
  it in our ISR.  This should make polling mode work better for more cards,
  but more work may be needed.  This "disabling" sets the card interrupt
  register to 0.  This worked for me for lots of tests in polling mode.
o Now that I've found datasheets, fix a boatload of magic numbers in the
  source to make it easier to understand.
o Use a table of names rather than a big case statement.
o Cull a few of the "unused" controller types that we map to other times
  that were a vestiage of PAO code that we never merged in the same way.
o Enforce legal IRQs.  You are no longer allowed to try to use IRQs that
  will fail on all known ISA/PCI <-> PCMCIA bridges.  The bridges do not
  have pins for these illegal interrupts, and all of them are listed as
  reserved and/or illegeal in the datasheets depending on which one you
  look at.
o Add comments about how IBM-AT based computers and NEC PC-98 based computers
  map these interrupts and which ones are valid.
o Always clear the bit that steers the management interrupt either to the
  value listed in the PCIC_STAT_INT register.  I've seen this bit get set
  on suspend/resume and after windows boot, and it does't hurt to clear it.
  NOTE: this might mean we can share this interrupt in the future.
2001-03-19 07:10:38 +00:00
Duncan Barclay
25522b4ef4 Fix a minor bug that prevents NEWBUS users from setting more than
one memory map. The memory window for the PCIC is identifed by the resource id
for NEWSBUS drivers. pccardd always uses window 0 and rid 0 when setting maps
up. This fix does not affect pccardd's handling of common memory for ed cards.

Reviewed by:	imp
2001-01-09 23:39:32 +00:00
Garrett Wollman
0a2c3d48c6 select() DKI is now in <sys/selinfo.h>. 2001-01-09 04:33:49 +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
MIHIRA Sanpei Yoshiro
23f344f985 add PNPID for PnP PCMCIA, SCM SwapBox Classic X2P.
PR:		kern/23344 (Kaho Toshikazu <kaho@elam.kais.kyoto-u.ac.jp>)
2000-12-11 15:02:50 +00:00
Poul-Henning Kamp
db7e3af111 Remove unneeded #include <machine/clock.h> 2000-10-15 14:19:01 +00:00
Warner Losh
5984fd1d1f Another PnP pcic card: SMC Swapbox Plug and Play
Submitted by: gallatin
2000-10-12 03:51:16 +00:00
Warner Losh
d186a392ba o Remove 9 unnecessary includes.
o Add Vpp power at 5.0V rather than 0. Setting it to zero violates
  the pccard spec.  Most pcic devices in use today don't let us
  violate the spec, but some older ones do.  Bill Paul sent this to
  me a long time ago and I thought I'd commit it before now.
o Add some debug stuff hidden behind bootverbose.
2000-09-20 20:02:49 +00:00
John Baldwin
9a94c9c5c3 - Remove the inthand2_t type and use the equivalent driver_intr_t type from
newbus for referencing device interrupt handlers.
- Move the 'struct intrec' type which describes interrupt sources into
  sys/interrupt.h instead of making it just be a x86 structure.
- Don't create 'ithd' and 'intrec' typedefs, instead, just use 'struct ithd'
  and 'struct intrec'
- Move the code to translate new-bus interrupt flags into an interrupt thread
  priority out of the x86 nexus code and into a MI ithread_priority()
  function in sys/kern/kern_intr.c.
- Remove now-uneeded x86-specific headers from sys/dev/ata/ata-all.c and
  sys/pci/pci_compat.c.
2000-09-13 18:33:25 +00:00
Warner Losh
2563e6f5b8 Add some infrastructure support for dealing with large attribute
memory space needed by the raylink driver (in progress, nearing
completion).

This is a minorly cleaned up diff from Duncan to help him reduce the
diffs from stock FreeBSD.

Submitted by: Duncan Barclay <dmlb@ragnet.demon.co.uk>
2000-08-10 17:35:11 +00:00
Mitsuru IWASAKI
df56ce3e40 Fix a bug so that we have correct number of pccard instances in pcic_attach().
pcic_attach() got a wrong pointer to pcic_slots since device haven't
set correct unit number yet, so always accessed elements of pcic_slots
which belong to pcic0 (unit number 0).

Now we set unit number to pcic device first, then access to pcic_slots
based on the unit number we've just set.
2000-07-24 21:44:00 +00:00
Warner Losh
6a2b5130e3 Add ACTIONTECH #define for plug and play. Also add PnP support to NEWCARD
for this card.

Submitted by: Kazuya Kodama <kodama@rd.nacsis.ac.jp>
2000-05-29 02:44:33 +00:00
Warner Losh
2b91ff7819 Add PnP ID for vadem based plug and play card.
Submitted by: Dave Belfer-Shevett <shevett@stonekeep.com>
Fix by: Bill Paul
2000-05-02 06:50:17 +00:00
Warner Losh
da05ca010e Checkin my first batch of New Mexico changes:
o minor whitespace things (bad because this is also a functional commit)
o Backport reading in of CIS entries from the driver level.
2000-04-25 06:07:27 +00:00
Warner Losh
db5ca7b1d2 o Preliminary support for mapping the CIS by the driver.
o Modify xe driver to use this.

There's still some issues with this code, so xe can't map the cis just
yet.  I'm thinking about how to resolve the issue.  pccard_nbk's
pccard_alloc_resource is getting in the way.
2000-04-20 08:37:46 +00:00
Warner Losh
595166f0f7 Add support for PnP ISA cards, and some laptop PnP support:
o break out some of the probe routine the allocation of resources
  into an attach routine
o Recognize PnP ids
o Allocate IRQ per card rather than per system
o Better polling reporting
o Remove unneeded include files in slot.h
o store a pseudo unit number on each device we find.
o Pass a unit number to interrupt/timeout routine and use it for polling
  the hardware.

Tested on: My VAIO and with the Linksys pccard reader.
Approved by: jkh
2000-03-10 05:43:29 +00:00
Warner Losh
da144b9373 /tmp/msg 2000-02-21 06:52:20 +00:00
Tatsumi Hosokawa
d789ee6ac8 Fixed a bug in PCIC polling mode.
(it does not work without this fix)
2000-01-15 12:02:03 +00:00
Warner Losh
88f1ea0a8c Move the turning on of the interrupts for the card at the bridge from
the activate method to the setup_intr, and turn it off to
teardown_intr.

This makes the ed driver not enter its interrupt routine during the
probe.  Apparently, an interrupt happens when you disable the
interrupts.  There are other problems with ed still.
1999-12-10 07:02:41 +00:00
Matthew N. Dodd
fe0d408987 Remove the 'ivars' arguement to device_add_child() and
device_add_child_ordered().  'ivars' may now be set using the
device_set_ivars() function.

This makes it easier for us to change how arbitrary data structures are
associated with a device_t.  Eventually we won't be modifying device_t
to add additional pointers for ivars, softc data etc.

Despite my best efforts I've probably forgotten something so let me know
if this breaks anything.  I've been running with this change for months
and its been quite involved actually isolating all the changes from
the rest of the local changes in my tree.

Reviewed by:	peter, dfr
1999-12-03 08:41:24 +00:00
Warner Losh
27e8060d4a Kill unneeded includes
Found by phk's script a while ago.
1999-11-20 05:02:00 +00:00
Warner Losh
78d7954c0f Do not add children for new bus kludge version of pccard.
Fix some compile warnings.
1999-10-28 04:51:39 +00:00
Warner Losh
923a651ddf Remove debug printfs and Debugger() calls.
Add support for memory mapping

This should allow pccard that need memory mapping to work, but I don't
have one to test against.
1999-10-25 23:17:24 +00:00
Warner Losh
4f76d87b21 Massive rewrite of pccard to convert it to newbus.
o Gut the compatibility interface, you now must attach with newbus.
o Unit numbers from pccardd are now ignored.  This may change the units
  assigned to a card.  It now uses the first available unit.
o kill old skeleton code that is now obsolete.
o Use newbus attachment code.
o cleanup interfile dependencies some.
o kill list of devices per slot.  we use the device tree for what we need.
o Remove now obsolete code.
o The ep driver (and maybe ed) may need some config file tweaks to
  allow it to attach.  See config files that were committed for examples
  on how to do this.

Drivers to be commited shortly.

This is an interrum fix until the new pccard.  ed, ep and sio will be
supported by me with this release, although others are welcome to try
to support other devices before new pccard is working.

I plan on doing minimal further work on this code base.  Be careful
when upgrading, since this code is known to work on my laptop and
those of a couple others as well, but your milage may vary.

BUGS TO BE FIXED:

o system memory isn't allocated yet, it will be soon.
o No devices actually have a pccard newbus attach in the tree.

BUGS THAT MIGHT BE FIXED:

o card removal, including suspend, usually hangs the system.

Many thanks to Peter Wemm and Doug Rabson for helping me to fill in
the missing bits of New Bus understanding at FreeBSD Con '99.
1999-10-25 02:41:58 +00:00
Warner Losh
35c0baa6b7 Remove name field from controller information. Fix name setting in
pc98 case that I missed before.  Attempt to get the irq for the PCIC
first from the loader env var and second from the config system.  I've
been able to boot my laptop with a kernel that hardwired the irq to
10.  This should allow boot -c to finally start working for pcic irq,
but I've not tested that.  Add $FreeBSD$ to slot.h.
1999-10-16 05:11:46 +00:00
Warner Losh
b5137699ae Reorganize the attachement point for pcic (it was unattached and
floating before).  Attach pccard devices to pcic, one per slot
(although this may change to one per pcic).  pcic is now attached to
isa (to act as a bridge) and pccard is attached to pcic, cbb and
pc98ic (the last two are card bus bridge and the pc98ic version of
pcic, neither of which are in the tree yet).  Move pccard compat code
into pccard/pccard_compat.c.

THIS REQUIRES A CONFIG FILE CHANGE.  You must change your pcic/card
entries to be:
# PCCARD (PCMCIA) support
controller	pcic0	at isa?
controller	pcic1	at isa?
controller	card0

The old system was upside down and this corrects that problem.  It
will make it easier to add support for YENTA pccard/card bus bridges.

Much more cleanup needs to happen before newbus devices can have
pccard attachments.  My previous commit's comments were premature.
1999-10-15 17:29:21 +00:00
Warner Losh
58a49816c7 *** empty log message *** 1999-09-26 21:52:43 +00:00