Commit Graph

107 Commits

Author SHA1 Message Date
Warner Losh
d26fb41443 Get the generic name right 2002-03-03 01:04:39 +00:00
Warner Losh
4854d67b1c Add recognition of the Omega 83C094 PCI <-> PCMCIA bridge chip set.
MFC after: 5 days
2002-01-14 13:50:45 +00:00
Warner Losh
751a23649d Better error message when cardtype is not recognized 2001-11-13 06:46:19 +00:00
Warner Losh
b668d9a14a Do not assume that a I/O based bridge is a 6729. Intel made a funky chip
that I have the datasheet on the way for that also does this.
2001-11-11 06:55:15 +00:00
Warner Losh
93da209126 o Try to do 3.3V support better for the 6722 and 6729/30.
o Bite the bullet and create controller types for the 6729 and also for
  the 673x.  Rename the 672x to 6722.
o Define minimal extended register info (just register 0xa for reading VS[12]).

# I think the last version may have broken 673x controllers, but this should
# fix them.

Tested on the 6722, but not the 6729.

Ideas from: Chiharu Shibata-san's article in bsd-nomads:15866
2001-11-09 07:33:54 +00:00
Warner Losh
d1cf40403a Restore the main BAR for the bridge on resume. Some machines don't save
this accross suspend/resume events and this was causing the dreaded false
positive hit on my "static bug" test.

Note: the PCI bus code should do this for us.
Note2: We don't do the same for I/O based pci devices since it is
more code and doesn't appear to be necessary.

Submitted by: Toshiyuki Kawashima-san <tos@fa2.so-net.ne.jp>
Obtained from: bsd-nomads:16012
2001-10-30 15:31:49 +00:00
Warner Losh
e5ee3605a9 Print 4 per line. To do this, we test against i % 16 == 0 rather than i % 4
since that's always true for this loop.
2001-10-17 05:33:51 +00:00
Warner Losh
b79e6caffe ToPIC fixes. scale back what we do for functional interrupts because
it appears to break at least the ToPIC 100.

Submitted by: Mark Santcroos <marks@ripe.net>
2001-10-17 05:20:56 +00:00
Warner Losh
7549e3fe46 takashi shibagaki-san posted a similar patch to nomads. It seems that
more laptops work w/o the shutdown code than with it on reboot.  So
let's disable it for a while.
2001-10-11 05:41:27 +00:00
Warner Losh
f3bfc73757 Use the NetBSD init code for the TOPIC parts as a more complete basis
for initializing the parts.  Since I don't have any of these parts in
any of my working laptops, I'm committing this to allow people to test
it.  Will MFC when I receive reports of it working.
2001-10-11 05:37:32 +00:00
Warner Losh
2d45d0504c Fix, I think, The second slot problem with Cirrus Logic PD6729/30 parts:
o Move initialization of the slot bst and bsh to inside the for loop.
o move sc there as well.
o Remove debug printf that prints the ID of the first slot twice.
o Use the sp for the relevant slot in getb, rather than for the 0th slot.
2001-09-21 06:45:35 +00:00
Warner Losh
89f43a1aa9 Ian Dowse had closed the race a little more in card ejection events.
Maybe this will also fix the suprious eject events that we're seeing?
2001-09-16 06:12:16 +00:00
Warner Losh
7cf44afd1a <jkh> "Hey Rocky, watch me eject this pccard outta my laptop!" "What,
again?  That NEVER works!"  "This time for sure!"

Minor overhaul of how we do interrupts for the pci interrupt routing
case to cope with card ejection better (read: make it not hand on so
many cards):
	o Reintroduce func_intr and func_arg and use the to store the
	  interrupt handler to call.
	o Create a pcic_pci_func_intr to call the real interrupt handler
	  iff the card hasn't been ejected.
	o Remove some checks in pcic_setup_intr now that it is used
	  exclusively for isa routed interrupts.
	o Defer the eject event until later too, but make sure we can't
	  do any client driver ISR calling in the interrum.
	o Add some simple code to make sure that we don't attach more
	  than one child.  This should fix pccardd starting twice
	  problem (ala single user -> multi-user when you started pccardd
	  by hand in SU).

MFC: after jkh thinks I've put the crack pipe away.
2001-09-13 08:26:55 +00:00
Warner Losh
ee148a7240 Call pcic_teardown_intr to make sure that we disestablish the
interrupt for the card.

This seems to fix hangs on my machine.

MFC: pending re approval.
2001-09-12 05:57:31 +00:00
Warner Losh
b8769414cd When booting verbose, print the config space for this device. This
will help debugging problem systems as it will reduce the number of
commands the user needs to type and send me the output of.
2001-09-09 17:42:58 +00:00
Warner Losh
588cfa1095 Don't panic when we don't know the exact chip that is being used.
Also, add support for the following parts:
	O2micro 6912/6972, 6922, 6933
	Cirrus Logic PD6834
	TI PCI-1260 and PCI-1421
MFC: Soon
2001-09-06 20:55:25 +00:00
Warner Losh
98435cf714 Patric Gualat tells me that I can't do basic bit math. He's right.
When either bit 3 or 4 is set, we need to *SET* bit 5, not clear it in
the card control register.  This makes TI PCI-1030, 1130 and 1131 not
work anymore without this fix.

MFC: soon
2001-09-05 22:26:14 +00:00
Warner Losh
0b19e7ccab Don't report power interrupts. 2001-09-04 20:10:23 +00:00
Warner Losh
a23c775553 Make the csc and function interrupts ISA on shutdown. This should
help with the hanging problem on reboot.  Note: we need to do the
other things as well.  Also, turn off the bits in the stat change
interrupt mask and the cardbus interrupt mask as well in an attempt to
shut off all interrupt sources.
2001-09-04 17:46:31 +00:00
Warner Losh
d8b10a2b0e Kill init_t type, and minor white space changes to match original -stable version 2001-09-04 05:57:00 +00:00
Warner Losh
1ead03c2ba Add support for changing the way that ToPIC csc interrupts are routed.
# Note: The ToPIC 100 and the ToPIC 97 datasheets are in disagreement
# as to if this bit is supposed to be set or cleared to enable INTA routing
# so I made my best guess.

Also, comments about the various chipsets, including some grumpy ones
about how vague the O2micro datasheets are.
2001-09-04 05:50:08 +00:00
Warner Losh
592823383b Move to using a chip function + function pointers to deal with the
function and csc interrupt routing path (eg, ISA or PCI) so that we
can more easily switch between the two.

When we don't have a card ISR, put the function interrupt into ISA
mode.  This effectively masks the interrupt since it happens once, and
not again until we have an ISR.  This should help hangs, and might
help people that unwisely update the kernel w/o updating pccardd.
This is done at mapirq time.

Force CL-PD6729/30 to use ISA interrupt routing and maybe even detect
the number of pccard slots properly (this is still WIP).  We aren't
going to support PCI interrupts for this release.  A future release
should support them, however.  Shibata-san's 3.3V fixes are not
included.

Add a hack which should, in i386, rewrite IRQ 0 cardbus bridges to be
IRQ 255, which should cause interrupts to be routed.  This is mostly
untested since my one tester disappeared after reporting nothing
changed.

Implement, but do not use, a power method called cardbus.  It looked
like a great way to get around the 3.3V problem, but it seems that you
can only use it to power cardbus cards (I get no CIS when I enable it,
so maybe we're programming things bogusly).

GC the intr and argp stuff from the slot database.

Improve the ToPIC support with the power hacks that Nakagawa-san
published in FreeBSD Press and that Hiroyuki Aizu-san ported to
-stable.  The ToPIC hacks were for 3.3V support in ToPIC 100, but it
looks like the '97 also has identical registers, so use them too.

Add some #defines for the cardbus power stuff.

Finally implement making CSC on the Ricoh chips ISA or PCI.  This will
allow polling mode to work on vaios, I think.

Add some minor debugging.  This should likely be cleaned up or put
behing a bootverbose.

Some of this work, and earlier work, was influanced by Chiharu
Shibata-san's power handing patches posted to bsd-nomads:15866.

MFC: Soon, if possible.
2001-09-04 04:47:58 +00:00
Warner Losh
5d98f538d8 Add recognition for ToPIC95B 2001-09-03 08:20:52 +00:00
Warner Losh
f99a696093 Add names for the TI PCI-1210, TI PCI-4410 and TI PCI-4450 parts. I had
this for a while, and don't know how it didn't make it into the tree.
2001-08-30 22:48:47 +00:00
Warner Losh
51af6062b4 Note the status of the card, so we don't print inserted lines twice on
boot.
2001-08-29 15:54:12 +00:00
Warner Losh
a828573f43 Fix typo in my last commit 2001-08-27 15:18:26 +00:00
Warner Losh
fb141a4c6c CL-PD6729 and CLPD-6730 chips (the only ones with I/O bars in the pci
config space that I'm aware of) work.  I'm committing this from such
a machine.

Remove warning about I/O based bridges.  Warn users that the PCI routing
of interrupts still doesn't work for these cards.
2001-08-27 01:59:57 +00:00
Warner Losh
afd9750bfd A number of fixes for the TI-1130 and ISA interrupt routing cases:
o For TI PCI-1130, you need to set bit 5 of register 91 if you want
  ANY pci interrupts.  Then set bits 3 and/or 4 as appropriate.  This
  will fix those people with 1030, 1130 and 1131 in their machines
  trying to do PCI interrupts.
o Fix case where we were trying to automatically fail back to ISA
  interrupt routing.  We were dereferencing a NULL pointer.  This
  was true of ANY chipset.
o The bus_setup_intr method needs to be pcic_setup_intr so that "FAST"
  interrupts fail on PCI case (modems act flakey if we don't force
  them to fall back to normal interrupts).  Also needed so that the
  proper ISA IRQ can be set in the ExCA register.  This fixes the
  people whose ISA routing was failing[*].
o When we find a generic yenta/pccard bridge, go ahead and print its
  vendor ID in boot verbose.

Machine with theses symptoms and a serial console by: jedgar

[*] Looks like my pc98 machine has some interrupt source on IRQ 15
that gave about 30 interrupts per second, which masked this problem on
my PC-9821Nr15.
2001-08-27 01:00:27 +00:00
Warner Losh
f711f84740 Stop dereferencing 'r' unconditionally. Maybe it is NULL when ISA
mode and using polling mode.
2001-08-26 04:05:07 +00:00
Warner Losh
826fac3f15 Fix last second typo 2001-08-25 22:53:47 +00:00
Warner Losh
1fa93154aa Back out the isa/pci string reporting. It may cause panics. 2001-08-25 22:45:45 +00:00
Warner Losh
5cb1fce026 Fix cut-and-paste-o that Nate found. We were setting csc_route twice,
rather than setting it once and setting func_route when we can't route
PCI interrupts.
2001-08-25 22:04:00 +00:00
Warner Losh
0b370908b2 First cut at getting the ISA routing working. If we can't route a PCI
interrupt for the CSC interrupt, then we revert to ISA.  If we didn't
have an interrupt set up with hw.pcic.irq, then do polling.

Also, don't complain about ignoring function 1 for any devices except
pcic devices.  This would normally only show up if someone set
hw.pcic.ignore_function_1=1.

MFC: as soon as I can test it on some troublesome laptops.
2001-08-25 06:40:00 +00:00
Warner Losh
d625c99d74 Explain what we're doing in pcic_pci_shutdown a little better. Try to
explain the subtle side effects that are going to happen and why we go
ahead and ack the interrupt source.  This stuff is tricky to get
right.

Also, emperical tests have shown that doing a shutdown in attach to be
ineffectual, so remove it from there.  Analysis of the code paths
shows that nearly identical writes to these registers happen in later
parts of the code.  The hanging problem on thinkpads when we change
the interrupt routing type is something else.
2001-08-24 17:29:42 +00:00
Warner Losh
662460d3d5 Move code to shutdown the pcic_pci_shutdown. Call it on system
shutdown and also before we get going with the device initialization.
This may fix the hangs some people are seeing on warmboot.  It appears
that some machines will reset the cardbus bridge on boot, while others
don't.  So we turn off the card, and ack the interrupts (which likely
is a nop in the shutdown case since we're still fielding interrupts).
This should turn off the interrupts.

Since I don't have hardware that hangs on reboot, I'm committing this
without testing that aspect of the patch (it causes no harm on my
Dell).
2001-08-24 07:43:35 +00:00
Warner Losh
9bec31a4c0 Two fixes. First, put into place a more generic chipset specific
initialization structure.  Warn the user for those chipsets that
aren't yet customized that they might not work.  Second, try to power
off the slot on attach and ack the interrupts.  I don't know, but this
might solve the hangs that people will see on Thinkpads if they set
hw.pcic.init_routing=1.
2001-08-24 07:30:18 +00:00
Warner Losh
c08288b540 Report the interrupt path via the sysctl to userland as a string.
Submitted by: green
2001-08-21 21:31:27 +00:00
Warner Losh
0f102020db Rearrange how we do interrupt routing tweaking. We now have
hw.pcic.intr_path	{1,2}	1 == ISA, 2 == PCI
	hw.pcic.init_route	Force TI chipset initializations in edge case.
2001-08-21 20:04:42 +00:00
Warner Losh
df1d57cdb9 It looks like we're doing the wrong thing by catching the setup_intr
request and just calling it when we get a bridge interrupt.  The
problem is that if other code wants to block hardware interrupts for a
little bit with splXXX, those masks aren't updated the way we're doing
it.  This doesn't matter for -current, but does for -stable.

The whole reason that we were catching interrupts was to detect that
the card was still there.  Ian's fixes however ensure that the card
will be there with an interrupt handler, or not there at all.  Since
the pcic interrupt is at a high priority, this should be OK.

This should fix the network related crashes people started seeing in
stable after I merged the pcic as a pci device code.

Submitted indirectly by: Ian Dowse
MFC when: Ian has had a chance to do his torture hang testing.
2001-08-21 18:13:16 +00:00
Warner Losh
abd21a2011 These appear to be necessary for a pci cardbus card, but not for laptops.
Ifdef them out until I figure out the right way to configure this.

This solves Nate's hangs as well as Anders Andersson's.

MCF: Soon.
2001-08-21 07:38:13 +00:00
Warner Losh
6ac061b532 Improve interlocking for card removal. We now can remove the card in
the ISR.  We keep track of the card state and don't call the IRS when
the card isn't inserted.  This helps quite a bit with card ejection
problems that Ian was seeing.

Submitted by: Ian Dowse
MFC upon: re approvel.
2001-08-19 05:01:18 +00:00
Warner Losh
e423aa38ba For TI12xx and newer, clear register 0x84. This is the "Multimedia"
register.  It enables Zoom Video.  It appears that on at least one
card that Monzoon is using sets these bits by default.  Nothing works
when these bits are set, everything works when they are clear.

Add commentary on some of the ti bits.  Make code a little clearer.
Also remove a call to pcic_pci_pd6729 which was prematurely added in
the last commit.
2001-08-14 07:31:47 +00:00
Warner Losh
82c38f3a43 Try to support the Cirrus Logic PD6833 better in pci mode. This is
done from the datasheets since I'm ahving problems with my laptop that
has the 6833 in it...

Minor rework of TI code.  Should be the same as before.
2001-08-14 05:31:56 +00:00
Warner Losh
53af1c8a3d TI cardbus bridges, 12xx and newer, have an interesting register. It
is the diagnostics register at offset 0x93.  When bit 5 is set in this
register, bits 4-7 in ExCA register 0x5 being 0000 are required for
pci interrupt routing.  When it is clear, then bit 4 of ExCA register
0x3 is used to enable it.

The only other issue is that when you route interrupts this way, you
must read ExCA register 0x4 in order to clear the interrupt, else you
get an interrupt storm.

Deal with this requirement by setting things up.  It is believed that
this won't hurt other chipsets, but other chipsets may require their
own work arounds.
2001-08-01 19:41:56 +00:00
Warner Losh
6d5c3c4c96 bsh and bst are unused in softc, except for setting them. We do use the
bsh and bst in the pcic_slot structures.
2001-07-31 15:53:17 +00:00
Warner Losh
1b64899001 Fix typo where I assigned the bus tag and not the bus handled. It
appears that this may be unused, but I'll keep it for the moment.

Noticed by: Shizuka Kudo <shizukakudo_99@yahoo.com>
2001-07-31 15:42:44 +00:00
Warner Losh
372458622f A bunch of interrupt related cleanup.
o Move PIOCSRESOURCE from pccard to pcic so the kernel can give pccardd
  better hints as to what resources to use.
o Implement an undocumented hw.pcic.interrupt_route to allow people that
  need to do so to route their interrupts in a non-standard way.
o Only preallocate a resource in probe if we're routing via pci.
o If we aren't routing via pci, then set the irq to use explicitly
  to defeat the automatic IRQ routing of the pci layer.

This, with the pccardd code should be close to what can be committed
to -stable.
2001-07-31 06:44:37 +00:00
Warner Losh
7e766053f8 Don't use a buffer for the state info from the TI chips. Just print
it directly.  Also, minor style(9) nits near one or two of these
sites.
2001-07-30 07:17:40 +00:00
Warner Losh
d13600a5af Introduce two new tunables from the boot loader.
hw.pcic.irq		Globally set the IRQ for all pcic devices' management
			interrupt (aka card status change or CSC interrupt)
			This is what used to be known as
			machdep.pccard.pcic_irq (which has been retained for
			now for compatibility).
hw.pcic.ignore_fuction_1 Ignores function 1 for all PCIC bridges by not
			attaching to them.  Lucent released a huge batch
			of cards that were imporperly manufactuered (lacking
			the 0 ohm resister to disable slot 1).  This is
			a big hammer to keep those cards from causing problems
			(I've had 4 people contact me saying my patches
			worked great once they added a kludge to always ignore
			function 1, or until they soldered these resistors
			in place!).

No clue where to document these.  They act as both boot loader environment
variables, as well as read-only sysctls after boot.

At the same time, sort sys/systm.h in its proper order after sys/sysctl.h.
2001-07-27 16:07:02 +00:00
Warner Losh
ebea20aed7 Minor nits merged from my stable tree:
o kill blank line that I introduced in cardinfo.h
o Delete unused variable wasinactive.
o return 0 from pccard_resume.
o Set the state and lastsate initially to be empty.
o move comment above code for interrupt dispatching.
o Powerstate interface is now available as of 430002, not 500000 (note that
  this change will be not 100% correct since the power state stuff didn't
  enter current until well after 500000, but it is good enough for the two
  branche we have going now).
2001-07-27 07:47:35 +00:00