summaryrefslogtreecommitdiffstats
path: root/sys/pccard/pcic_pci.c
Commit message (Collapse)AuthorAgeFilesLines
* Better error message when cardtype is not recognizedimp2001-11-131-1/+1
|
* Do not assume that a I/O based bridge is a 6729. Intel made a funky chipimp2001-11-111-1/+1
| | | | that I have the datasheet on the way for that also does this.
* o Try to do 3.3V support better for the 6722 and 6729/30.imp2001-11-091-5/+5
| | | | | | | | | | | | | 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
* Restore the main BAR for the bridge on resume. Some machines don't saveimp2001-10-301-1/+21
| | | | | | | | | | | | 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
* Print 4 per line. To do this, we test against i % 16 == 0 rather than i % 4imp2001-10-171-1/+1
| | | | since that's always true for this loop.
* ToPIC fixes. scale back what we do for functional interrupts becauseimp2001-10-171-1/+2
| | | | | | it appears to break at least the ToPIC 100. Submitted by: Mark Santcroos <marks@ripe.net>
* takashi shibagaki-san posted a similar patch to nomads. It seems thatimp2001-10-111-1/+6
| | | | | more laptops work w/o the shutdown code than with it on reboot. So let's disable it for a while.
* Use the NetBSD init code for the TOPIC parts as a more complete basisimp2001-10-111-8/+33
| | | | | | 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.
* Fix, I think, The second slot problem with Cirrus Logic PD6729/30 parts:imp2001-09-211-6/+5
| | | | | | | 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.
* Ian Dowse had closed the race a little more in card ejection events.imp2001-09-161-16/+18
| | | | Maybe this will also fix the suprious eject events that we're seeing?
* <jkh> "Hey Rocky, watch me eject this pccard outta my laptop!" "What,imp2001-09-131-15/+78
| | | | | | | | | | | | | | | | | | | | | | 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.
* Call pcic_teardown_intr to make sure that we disestablish theimp2001-09-121-1/+1
| | | | | | | | interrupt for the card. This seems to fix hangs on my machine. MFC: pending re approval.
* When booting verbose, print the config space for this device. Thisimp2001-09-091-0/+19
| | | | | will help debugging problem systems as it will reduce the number of commands the user needs to type and send me the output of.
* Don't panic when we don't know the exact chip that is being used.imp2001-09-061-4/+44
| | | | | | | | Also, add support for the following parts: O2micro 6912/6972, 6922, 6933 Cirrus Logic PD6834 TI PCI-1260 and PCI-1421 MFC: Soon
* Patric Gualat tells me that I can't do basic bit math. He's right.imp2001-09-051-4/+4
| | | | | | | | 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
* Don't report power interrupts.imp2001-09-041-2/+0
|
* Make the csc and function interrupts ISA on shutdown. This shouldimp2001-09-041-1/+13
| | | | | | | 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.
* Kill init_t type, and minor white space changes to match original -stable ↵imp2001-09-041-4/+1
| | | | version
* Add support for changing the way that ToPIC csc interrupts are routed.imp2001-09-041-4/+36
| | | | | | | | | # 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.
* Move to using a chip function + function pointers to deal with theimp2001-09-041-128/+460
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add recognition for ToPIC95Bimp2001-09-031-0/+3
|
* Add names for the TI PCI-1210, TI PCI-4410 and TI PCI-4450 parts. I hadimp2001-08-301-0/+9
| | | | this for a while, and don't know how it didn't make it into the tree.
* Note the status of the card, so we don't print inserted lines twice onimp2001-08-291-0/+3
| | | | boot.
* Fix typo in my last commitimp2001-08-271-1/+1
|
* CL-PD6729 and CLPD-6730 chips (the only ones with I/O bars in the pciimp2001-08-271-5/+4
| | | | | | | | 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.
* A number of fixes for the TI-1130 and ISA interrupt routing cases:imp2001-08-271-13/+23
| | | | | | | | | | | | | | | | | | | | | | | 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.
* Stop dereferencing 'r' unconditionally. Maybe it is NULL when ISAimp2001-08-261-6/+5
| | | | mode and using polling mode.
* Fix last second typoimp2001-08-251-1/+1
|
* Back out the isa/pci string reporting. It may cause panics.imp2001-08-251-17/+2
|
* Fix cut-and-paste-o that Nate found. We were setting csc_route twice,imp2001-08-251-1/+1
| | | | | rather than setting it once and setting func_route when we can't route PCI interrupts.
* First cut at getting the ISA routing working. If we can't route a PCIimp2001-08-251-31/+57
| | | | | | | | | | | 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.
* Explain what we're doing in pcic_pci_shutdown a little better. Try toimp2001-08-241-5/+16
| | | | | | | | | | | | 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.
* Move code to shutdown the pcic_pci_shutdown. Call it on systemimp2001-08-241-13/+25
| | | | | | | | | | | | | 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).
* Two fixes. First, put into place a more generic chipset specificimp2001-08-241-94/+123
| | | | | | | | 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.
* Report the interrupt path via the sysctl to userland as a string.imp2001-08-211-4/+18
| | | | Submitted by: green
* Rearrange how we do interrupt routing tweaking. We now haveimp2001-08-211-23/+34
| | | | | hw.pcic.intr_path {1,2} 1 == ISA, 2 == PCI hw.pcic.init_route Force TI chipset initializations in edge case.
* It looks like we're doing the wrong thing by catching the setup_intrimp2001-08-211-41/+2
| | | | | | | | | | | | | | | | | | 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.
* These appear to be necessary for a pci cardbus card, but not for laptops.imp2001-08-211-0/+2
| | | | | | | | 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.
* Improve interlocking for card removal. We now can remove the card inimp2001-08-191-26/+56
| | | | | | | | | 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.
* For TI12xx and newer, clear register 0x84. This is the "Multimedia"imp2001-08-141-15/+36
| | | | | | | | | | 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.
* Try to support the Cirrus Logic PD6833 better in pci mode. This isimp2001-08-141-15/+39
| | | | | | | 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.
* TI cardbus bridges, 12xx and newer, have an interesting register. Itimp2001-08-011-7/+21
| | | | | | | | | | | | | | | 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.
* bsh and bst are unused in softc, except for setting them. We do use theimp2001-07-311-4/+4
| | | | bsh and bst in the pcic_slot structures.
* Fix typo where I assigned the bus tag and not the bus handled. Itimp2001-07-311-1/+1
| | | | | | appears that this may be unused, but I'll keep it for the moment. Noticed by: Shizuka Kudo <shizukakudo_99@yahoo.com>
* A bunch of interrupt related cleanup.imp2001-07-311-29/+58
| | | | | | | | | | | | | 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.
* Don't use a buffer for the state info from the TI chips. Just printimp2001-07-301-14/+13
| | | | | it directly. Also, minor style(9) nits near one or two of these sites.
* Introduce two new tunables from the boot loader.imp2001-07-271-1/+16
| | | | | | | | | | | | | | | | | | | | | | 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.
* Minor nits merged from my stable tree:imp2001-07-271-2/+2
| | | | | | | | | | | | 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).
* Give hopefully better diagnostics about the card types we reject.imp2001-07-271-2/+16
|
* Make the multiple interrupts attachment an error not a panic.imp2001-07-251-2/+5
| | | | | | | | Sometimes, when pccardd is restarted, it fails to realize that the device is already attached and tries to attach it again. This leads to bad mojo since the pccard code isn't setup to handle that, so the panic was put in. Now it appears that it is triggering too easily, so I'm backing it off to a non-fatal error.
OpenPOWER on IntegriCloud