1997-12-02 21:26:41 +00:00
|
|
|
/*
|
2003-01-04 17:26:35 +00:00
|
|
|
* Copyright (c) 2000, 2002 M. Warner Losh. All Rights Reserved.
|
2001-05-25 18:03:07 +00:00
|
|
|
* Copyright (c) 1997 Ted Faber All rights reserved.
|
1997-12-02 21:26:41 +00:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice immediately at the beginning of the file, without modification,
|
|
|
|
* this list of conditions, and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. Absolutely no warranty of function or purpose is made by the author
|
|
|
|
* Ted Faber.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1998-02-07 20:41:20 +00:00
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
* $FreeBSD$
|
1997-12-02 21:26:41 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
2001-06-04 06:49:46 +00:00
|
|
|
#include <sys/bus.h>
|
1997-12-02 21:26:41 +00:00
|
|
|
#include <sys/kernel.h>
|
2001-06-04 06:49:46 +00:00
|
|
|
#include <sys/module.h>
|
2001-07-27 16:07:02 +00:00
|
|
|
#include <sys/sysctl.h>
|
1997-12-02 21:26:41 +00:00
|
|
|
#include <sys/systm.h>
|
2001-06-04 06:49:46 +00:00
|
|
|
|
2001-07-19 21:43:01 +00:00
|
|
|
#if __FreeBSD_version < 500000
|
|
|
|
#include <pci/pcireg.h>
|
|
|
|
#include <pci/pcivar.h>
|
|
|
|
#else
|
2001-06-04 06:49:46 +00:00
|
|
|
#include <dev/pci/pcireg.h>
|
|
|
|
#include <dev/pci/pcivar.h>
|
2001-07-19 21:43:01 +00:00
|
|
|
#endif
|
2001-06-04 06:49:46 +00:00
|
|
|
|
2001-05-13 01:52:55 +00:00
|
|
|
#include <pccard/pcic_pci.h>
|
1998-01-20 21:11:03 +00:00
|
|
|
#include <pccard/i82365.h>
|
2001-06-04 06:49:46 +00:00
|
|
|
#include <pccard/cardinfo.h>
|
|
|
|
#include <pccard/slot.h>
|
|
|
|
#include <pccard/pcicvar.h>
|
|
|
|
|
|
|
|
#include <dev/pccard/pccardvar.h>
|
|
|
|
#include "card_if.h"
|
1997-12-02 21:26:41 +00:00
|
|
|
|
2001-07-27 16:07:02 +00:00
|
|
|
#define PRVERB(x) do { \
|
|
|
|
if (bootverbose) { device_printf x; } \
|
|
|
|
} while (0)
|
2000-03-25 20:29:55 +00:00
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
static int pcic_pci_get_memory(device_t dev);
|
|
|
|
|
2001-07-31 06:44:37 +00:00
|
|
|
SYSCTL_DECL(_hw_pcic);
|
|
|
|
|
2001-07-27 16:07:02 +00:00
|
|
|
static int pcic_ignore_function_1 = 0;
|
|
|
|
TUNABLE_INT("hw.pcic.ignore_function_1", &pcic_ignore_function_1);
|
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, ignore_function_1, CTLFLAG_RD,
|
|
|
|
&pcic_ignore_function_1, 0,
|
2002-07-17 06:02:07 +00:00
|
|
|
"When set, driver ignores pci function 1 of the bridge. This option\n\
|
|
|
|
is obsolete and will be deleted before FreeBSD 4.8.");
|
2001-07-27 16:07:02 +00:00
|
|
|
|
2001-07-31 06:44:37 +00:00
|
|
|
/*
|
|
|
|
* The following should be a hint, so we can do it on a per device
|
|
|
|
* instance, but this is convenient. Do not set this unless pci
|
|
|
|
* routing doesn't work. It is purposely vague and undocumented
|
2002-06-13 17:28:55 +00:00
|
|
|
* at the moment. Sadly, this seems to be needed way too often.
|
2001-07-31 06:44:37 +00:00
|
|
|
*/
|
2001-08-21 21:31:27 +00:00
|
|
|
static int pcic_intr_path = (int)pcic_iw_pci;
|
2001-08-21 20:04:42 +00:00
|
|
|
TUNABLE_INT("hw.pcic.intr_path", &pcic_intr_path);
|
2001-08-25 22:53:47 +00:00
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, intr_path, CTLFLAG_RD, &pcic_intr_path, 0,
|
2002-07-17 06:02:07 +00:00
|
|
|
"Which path to send the interrupts over. Normally interrupts for\n\
|
|
|
|
cardbus bridges are routed over the PCI bus (2). However, some laptops\n\
|
|
|
|
will hang when using PCI interrupts due to bugs in this code. Those\n\
|
|
|
|
bugs can be worked around by forcings ISA interrupts (1).");
|
2001-08-21 20:04:42 +00:00
|
|
|
|
|
|
|
static int pcic_init_routing = 0;
|
|
|
|
TUNABLE_INT("hw.pcic.init_routing", &pcic_init_routing);
|
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, init_routing, CTLFLAG_RD,
|
|
|
|
&pcic_init_routing, 0,
|
|
|
|
"Force the interrupt routing to be initialized on those bridges where\n\
|
2002-07-17 06:02:07 +00:00
|
|
|
doing so will cause probelms. This is very rare and generally is not\n\
|
|
|
|
needed. The default of 0 is almost always appropriate. Only set to 1 if\n\
|
2002-07-17 06:29:35 +00:00
|
|
|
instructed to do so for debugging. Only TI bridges are affected by this\n\
|
|
|
|
option, and what the code does is of dubious value. This option is obsolete\n\
|
|
|
|
and will be deleted before FreeBSD 4.8.");
|
2001-07-31 06:44:37 +00:00
|
|
|
|
2002-06-13 17:28:55 +00:00
|
|
|
static int pcic_ignore_pci = 0;
|
|
|
|
TUNABLE_INT("hw.pcic.ignore_pci", &pcic_ignore_pci);
|
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, ignore_pci, CTLFLAG_RD,
|
|
|
|
&pcic_ignore_pci, 0,
|
2002-07-17 06:02:07 +00:00
|
|
|
"When set, driver ignores pci cardbus bridges it would otherwise claim.\n\
|
|
|
|
Generally speaking, this option is not needed for anything other than as an\n\
|
|
|
|
aid in debugging.");
|
|
|
|
|
|
|
|
static int pcic_pd6729_intr_path = (int)pcic_iw_isa;
|
|
|
|
TUNABLE_INT("hw.pcic.pd6729_intr_path", &pcic_pd6729_intr_path);
|
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, pd6729_intr_path, CTLFLAG_RD,
|
|
|
|
&pcic_pd6729_intr_path, 0,
|
2002-07-17 06:29:35 +00:00
|
|
|
"Determine the interrupt path or method for Cirrus Logic PD6729 and\n\
|
|
|
|
similar I/O space based pcmcia bridge. Chips on a PCI expansion card need\n\
|
|
|
|
a value of 2, while chips installed in a laptop need a value of 1 (which is\n\
|
|
|
|
also the default). This is similar to hw.pcic.intr_path, but separate so\n\
|
|
|
|
that it can default to ISA when intr_path defaults to PCI.");
|
2002-06-13 17:28:55 +00:00
|
|
|
|
2003-01-04 17:26:35 +00:00
|
|
|
static int pcic_ti12xx_enable_pci_clock = 0;
|
|
|
|
TUNABLE_INT("hw.pcic.ti12xx_enable_pci_clock", &pcic_ti12xx_enable_pci_clock);
|
|
|
|
SYSCTL_INT(_hw_pcic, OID_AUTO, ti12xx_enable_pci_clock, CTLFLAG_RD,
|
|
|
|
&pcic_ti12xx_enable_pci_clock, 0,
|
|
|
|
"Some TI-12xx parts need to have the PCI clock enabled. These designs do\n\
|
|
|
|
not provide a clock themselves. Most of the reference boards have the\n\
|
|
|
|
required oscillator parts, so the number of machines that needs this to be\n\
|
|
|
|
set is vanishingly small.");
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void pcic_pci_cardbus_init(device_t);
|
2001-09-06 20:55:25 +00:00
|
|
|
static pcic_intr_way_t pcic_pci_gen_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_gen_csc;
|
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
|
|
|
static pcic_intr_mapirq_t pcic_pci_gen_mapirq;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_oz67xx_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_oz67xx_csc;
|
|
|
|
static pcic_init_t pcic_pci_oz67xx_init;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_oz68xx_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_oz68xx_csc;
|
|
|
|
static pcic_init_t pcic_pci_oz68xx_init;
|
|
|
|
|
2003-01-04 17:26:35 +00:00
|
|
|
static pcic_intr_way_t pcic_pci_pd6729_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_pd6729_csc;
|
|
|
|
static pcic_init_t pcic_pci_pd6729_init;
|
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
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_pd68xx_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_pd68xx_csc;
|
|
|
|
static pcic_init_t pcic_pci_pd68xx_init;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_ricoh_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_ricoh_csc;
|
|
|
|
static pcic_init_t pcic_pci_ricoh_init;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_ti113x_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_ti113x_csc;
|
|
|
|
static pcic_init_t pcic_pci_ti_init;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_ti12xx_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_ti12xx_csc;
|
|
|
|
|
|
|
|
static pcic_intr_way_t pcic_pci_topic_func;
|
|
|
|
static pcic_intr_way_t pcic_pci_topic_csc;
|
|
|
|
static pcic_init_t pcic_pci_topic_init;
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_oz67xx_chip = {
|
|
|
|
pcic_pci_oz67xx_func,
|
|
|
|
pcic_pci_oz67xx_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_oz67xx_init
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_oz68xx_chip = {
|
|
|
|
pcic_pci_oz68xx_func,
|
|
|
|
pcic_pci_oz68xx_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_oz68xx_init
|
|
|
|
};
|
|
|
|
|
2003-01-04 17:26:35 +00:00
|
|
|
static struct pcic_chip pcic_pci_pd6729_chip = {
|
|
|
|
pcic_pci_pd6729_func,
|
|
|
|
pcic_pci_pd6729_csc,
|
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
|
|
|
pcic_pci_gen_mapirq,
|
2003-01-04 17:26:35 +00:00
|
|
|
pcic_pci_pd6729_init
|
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
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_pd68xx_chip = {
|
|
|
|
pcic_pci_pd68xx_func,
|
|
|
|
pcic_pci_pd68xx_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_pd68xx_init
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_ricoh_chip = {
|
|
|
|
pcic_pci_ricoh_func,
|
|
|
|
pcic_pci_ricoh_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_ricoh_init
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_ti113x_chip = {
|
|
|
|
pcic_pci_ti113x_func,
|
|
|
|
pcic_pci_ti113x_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_ti_init
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_ti12xx_chip = {
|
|
|
|
pcic_pci_ti12xx_func,
|
|
|
|
pcic_pci_ti12xx_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_ti_init
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct pcic_chip pcic_pci_topic_chip = {
|
|
|
|
pcic_pci_topic_func,
|
|
|
|
pcic_pci_topic_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_topic_init
|
|
|
|
};
|
|
|
|
|
2001-09-06 20:55:25 +00:00
|
|
|
static struct pcic_chip pcic_pci_generic_chip = {
|
|
|
|
pcic_pci_gen_func,
|
|
|
|
pcic_pci_gen_csc,
|
|
|
|
pcic_pci_gen_mapirq,
|
|
|
|
pcic_pci_cardbus_init
|
|
|
|
};
|
|
|
|
|
2002-07-26 08:07:55 +00:00
|
|
|
/* Chipset specific flags */
|
|
|
|
#define TI_NO_MFUNC 0x10000
|
|
|
|
|
2001-05-25 19:22:36 +00:00
|
|
|
struct pcic_pci_table
|
|
|
|
{
|
|
|
|
u_int32_t devid;
|
|
|
|
const char *descr;
|
|
|
|
int type;
|
|
|
|
u_int32_t flags;
|
2001-09-04 05:57:00 +00:00
|
|
|
struct pcic_chip *chip;
|
2001-05-25 19:22:36 +00:00
|
|
|
} pcic_pci_devs[] = {
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OMEGA_82C094, "Omega 82C094G",
|
2003-01-04 17:26:35 +00:00
|
|
|
PCIC_I82365, PCIC_DF_POWER, &pcic_pci_pd6729_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_CLPD6729, "Cirrus Logic PD6729/6730 PCI-PCMCIA Bridge",
|
2003-01-04 17:26:35 +00:00
|
|
|
PCIC_PD6729, PCIC_PD_POWER, &pcic_pci_pd6729_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_CLPD6832, "Cirrus Logic PD6832 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_PD673X, PCIC_CARDBUS_POWER, &pcic_pci_pd68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_CLPD6833, "Cirrus Logic PD6833 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_PD673X, PCIC_CARDBUS_POWER, &pcic_pci_pd68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_CLPD6834, "Cirrus Logic PD6834 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_PD673X, PCIC_CARDBUS_POWER, &pcic_pci_pd68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6729, "O2micro OZ6729 PC-Card Bridge",
|
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
|
|
|
PCIC_I82365, PCIC_AB_POWER, &pcic_pci_oz67xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6730, "O2micro OZ6730 PC-Card Bridge",
|
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
|
|
|
PCIC_I82365, PCIC_AB_POWER, &pcic_pci_oz67xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6832, "O2micro 6832/6833 PCI-Cardbus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6860, "O2micro 6836/6860 PCI-Cardbus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6872, "O2micro 6812/6872 PCI-Cardbus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6912, "O2micro 6912 PCI-Cardbus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6922, "O2micro 6922 PCI-Cardbus Bridge",
|
2001-09-06 20:55:25 +00:00
|
|
|
PCIC_I82365, PCIC_AB_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_OZ6933, "O2micro 6933 PCI-Cardbus Bridge",
|
2001-09-06 20:55:25 +00:00
|
|
|
PCIC_I82365, PCIC_AB_POWER, &pcic_pci_oz68xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_RICOH_RL5C465, "Ricoh RL5C465 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_ricoh_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_RICOH_RL5C475, "Ricoh RL5C475 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_ricoh_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_RICOH_RL5C476, "Ricoh RL5C476 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_ricoh_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_RICOH_RL5C477, "Ricoh RL5C477 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_ricoh_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_RICOH_RL5C478, "Ricoh RL5C478 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_ricoh_chip },
|
2003-02-26 05:45:48 +00:00
|
|
|
{ PCIC_ID_SMC_34C90, "SMC 34C90 PCI-CardBus Bridge",
|
|
|
|
PCIC_RF5C296, PCIC_CARDBUS_POWER, &pcic_pci_generic_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1031, "TI PCI-1031 PCI-PCMCIA Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti113x_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1130, "TI PCI-1130 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti113x_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1131, "TI PCI-1131 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti113x_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1210, "TI PCI-1210 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1211, "TI PCI-1211 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1220, "TI PCI-1220 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1221, "TI PCI-1221 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1225, "TI PCI-1225 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1250, "TI PCI-1250 PCI-CardBus Bridge",
|
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER | TI_NO_MFUNC,
|
|
|
|
&pcic_pci_ti12xx_chip },
|
|
|
|
{ PCIC_ID_TI1251, "TI PCI-1251 PCI-CardBus Bridge",
|
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER | TI_NO_MFUNC,
|
|
|
|
&pcic_pci_ti12xx_chip },
|
|
|
|
{ PCIC_ID_TI1251B, "TI PCI-1251B PCI-CardBus Bridge",
|
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER | TI_NO_MFUNC,
|
|
|
|
&pcic_pci_ti12xx_chip },
|
|
|
|
{ PCIC_ID_TI1260, "TI PCI-1260 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1260B, "TI PCI-1260B PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1410, "TI PCI-1410 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1420, "TI PCI-1420 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1421, "TI PCI-1421 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1450, "TI PCI-1450 PCI-CardBus Bridge",
|
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER | TI_NO_MFUNC,
|
|
|
|
&pcic_pci_ti12xx_chip },
|
|
|
|
{ PCIC_ID_TI1451, "TI PCI-1451 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1510, "TI PCI-1510 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI1520, "TI PCI-1520 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI4410, "TI PCI-4410 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI4450, "TI PCI-4450 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI4451, "TI PCI-4451 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TI4510, "TI PCI-4510 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365SL_DF, PCIC_CARDBUS_POWER, &pcic_pci_ti12xx_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TOPIC95, "Toshiba ToPIC95 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_topic_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TOPIC95B, "Toshiba ToPIC95B PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_topic_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TOPIC97, "Toshiba ToPIC97 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_topic_chip },
|
2002-07-26 08:07:55 +00:00
|
|
|
{ PCIC_ID_TOPIC100, "Toshiba ToPIC100 PCI-CardBus Bridge",
|
2002-06-23 01:55:10 +00:00
|
|
|
PCIC_I82365, PCIC_CARDBUS_POWER, &pcic_pci_topic_chip },
|
2001-08-24 07:30:18 +00:00
|
|
|
{ 0, NULL, 0, 0, NULL }
|
2001-05-25 19:22:36 +00:00
|
|
|
};
|
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
/*
|
|
|
|
* Read a register from the PCIC.
|
|
|
|
*/
|
|
|
|
static unsigned char
|
|
|
|
pcic_pci_getb2(struct pcic_slot *sp, int reg)
|
|
|
|
{
|
|
|
|
return (bus_space_read_1(sp->bst, sp->bsh, sp->offset + reg));
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Write a register on the PCIC
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
pcic_pci_putb2(struct pcic_slot *sp, int reg, unsigned char val)
|
|
|
|
{
|
|
|
|
bus_space_write_1(sp->bst, sp->bsh, sp->offset + reg, val);
|
|
|
|
}
|
|
|
|
|
2001-05-25 19:22:36 +00:00
|
|
|
/*
|
|
|
|
* lookup inside the table
|
|
|
|
*/
|
|
|
|
static struct pcic_pci_table *
|
|
|
|
pcic_pci_lookup(u_int32_t devid, struct pcic_pci_table *tbl)
|
|
|
|
{
|
2001-05-25 19:24:58 +00:00
|
|
|
while (tbl->devid) {
|
2001-05-25 19:22:36 +00:00
|
|
|
if (tbl->devid == devid)
|
|
|
|
return (tbl);
|
|
|
|
tbl++;
|
|
|
|
}
|
|
|
|
return (NULL);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* The standard way to control fuction interrupts is via bit 7 in the BCR
|
|
|
|
* register. Some data sheets indicate that this is just for "intterupts"
|
|
|
|
* while others are clear that it is for function interrupts. When this
|
|
|
|
* bit is set, function interrupts are routed via the ExCA register. When
|
|
|
|
* this bit is clear, they are routed via the PCI bus, usually via the int
|
|
|
|
* in the INTPIN register.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_gen_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
u_int16_t bcr;
|
|
|
|
|
|
|
|
bcr = pci_read_config(sp->sc->dev, CB_PCI_BRIDGE_CTRL, 2);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
bcr &= ~CB_BCR_INT_EXCA;
|
|
|
|
else
|
|
|
|
bcr |= CB_BCR_INT_EXCA;
|
|
|
|
pci_write_config(sp->sc->dev, CB_PCI_BRIDGE_CTRL, bcr, 2);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-09-06 20:55:25 +00:00
|
|
|
static int
|
|
|
|
pcic_pci_gen_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
return (0);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
/*
|
|
|
|
* The O2micro OZ67xx chips functions.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_oz67xx_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_oz67xx_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
/*
|
|
|
|
* Need datasheet to find out what's going on. However, the
|
|
|
|
* 68xx datasheets are so vague that it is hard to know what
|
|
|
|
* the right thing to do is.
|
|
|
|
*/
|
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
|
|
|
/* XXX */
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_oz67xx_init(device_t dev)
|
|
|
|
{
|
|
|
|
device_printf(dev, "Warning: O2micro OZ67xx chips may not work\n");
|
|
|
|
pcic_pci_cardbus_init(dev);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* The O2micro OZ68xx chips functions.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_oz68xx_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_oz68xx_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
/*
|
|
|
|
* The 68xx datasheets make it hard to know what the right thing
|
2002-06-27 18:16:16 +00:00
|
|
|
* to do here is. We do what we know, which is nothing, and
|
2001-09-04 05:50:08 +00:00
|
|
|
* hope for the best.
|
|
|
|
*/
|
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
|
|
|
/* XXX */
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_oz68xx_init(device_t dev)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* This is almost certainly incomplete.
|
|
|
|
*/
|
|
|
|
device_printf(dev, "Warning: O2micro OZ68xx chips may not work\n");
|
|
|
|
pcic_pci_cardbus_init(dev);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* The Cirrus Logic PD6729/30. These are weird beasts, so be careful.
|
2002-07-17 06:02:07 +00:00
|
|
|
* They are ISA parts glued to the PCI bus and do not follow the yenta
|
|
|
|
* specification for cardbus bridges. They seem to be similar to the
|
|
|
|
* intel parts that were also cloned by o2micro and maybe others, but
|
|
|
|
* they are so much more common that the author doesn't have experience
|
|
|
|
* with them to know for sure.
|
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
|
|
|
*/
|
|
|
|
static int
|
2003-01-04 17:26:35 +00:00
|
|
|
pcic_pci_pd6729_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
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
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
/*
|
2002-07-17 06:02:07 +00:00
|
|
|
* For pci interrupts, we need to set bit 3 of extension register
|
|
|
|
* 3 to 1. For ISA interrupts, we need to clear it.
|
2001-09-04 05:50:08 +00:00
|
|
|
*/
|
2002-07-17 06:02:07 +00:00
|
|
|
sp->putb(sp, PCIC_EXT_IND, PCIC_EXTCTRL1);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
pcic_setb(sp, PCIC_EXTENDED, PCIC_EC1_CARD_IRQ_INV);
|
|
|
|
else
|
|
|
|
pcic_clrb(sp, PCIC_EXTENDED, PCIC_EC1_CARD_IRQ_INV);
|
|
|
|
|
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
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2003-01-04 17:26:35 +00:00
|
|
|
pcic_pci_pd6729_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
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
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
/*
|
2002-07-17 06:02:07 +00:00
|
|
|
* For pci interrupts, we need to set bit 4 of extension register
|
|
|
|
* 3 to 1. For ISA interrupts, we need to clear it.
|
2001-09-04 05:50:08 +00:00
|
|
|
*/
|
2002-07-17 06:02:07 +00:00
|
|
|
sp->putb(sp, PCIC_EXT_IND, PCIC_EXTCTRL1);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
pcic_setb(sp, PCIC_EXTENDED, PCIC_EC1_CSC_IRQ_INV);
|
|
|
|
else
|
|
|
|
pcic_clrb(sp, PCIC_EXTENDED, PCIC_EC1_CSC_IRQ_INV);
|
|
|
|
|
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
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void
|
2003-01-04 17:26:35 +00:00
|
|
|
pcic_pci_pd6729_init(device_t dev)
|
2001-08-24 07:30:18 +00:00
|
|
|
{
|
2001-08-27 01:59:57 +00:00
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
|
|
|
|
2003-01-04 17:26:35 +00:00
|
|
|
/*
|
|
|
|
* Tell the chip to do its routing thing.
|
|
|
|
*/
|
|
|
|
pcic_pci_pd6729_func(&sc->slots[0], sc->func_route);
|
|
|
|
pcic_pci_pd6729_csc(&sc->slots[0], sc->csc_route);
|
2001-08-24 07:30:18 +00:00
|
|
|
}
|
|
|
|
|
2000-02-02 16:49:21 +00:00
|
|
|
/*
|
2001-09-06 20:55:25 +00:00
|
|
|
* Set up the CL-PD6832, 6833 and 6834.
|
2000-02-02 16:49:21 +00:00
|
|
|
*/
|
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
|
|
|
static int
|
|
|
|
pcic_pci_pd68xx_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
2000-02-02 16:49:21 +00:00
|
|
|
{
|
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
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_pd68xx_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = sp->sc;
|
|
|
|
device_t dev = sc->dev;
|
2001-08-14 05:31:56 +00:00
|
|
|
u_int32_t device_id = pci_get_devid(dev);
|
|
|
|
u_long bcr;
|
|
|
|
u_long cm1;
|
2000-03-25 20:29:55 +00:00
|
|
|
|
2001-07-31 06:44:37 +00:00
|
|
|
/*
|
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
|
|
|
* CLPD6832 management interrupt enable bit is bit 11
|
|
|
|
* (MGMT_IRQ_ENA) in bridge control register(offset 0x3d).
|
|
|
|
* When on, card status interrupts are ISA controlled by
|
|
|
|
* the ExCA register 0x05.
|
2001-08-14 05:31:56 +00:00
|
|
|
*
|
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
|
|
|
* The CLPD6833 does things differently. It doesn't have bit
|
|
|
|
* 11 in the bridge control register. Instead, this
|
|
|
|
* functionality appears to be in the "Configuration
|
2001-08-14 05:31:56 +00:00
|
|
|
* Miscellaneous 1" register bit 1.
|
2001-09-06 20:55:25 +00:00
|
|
|
*
|
|
|
|
* I'm assuming that the CLPD6834 does things like the '33
|
2000-02-02 16:49:21 +00:00
|
|
|
*/
|
2002-07-26 08:07:55 +00:00
|
|
|
if (device_id == PCIC_ID_CLPD6832) {
|
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
|
|
|
bcr = pci_read_config(dev, CB_PCI_BRIDGE_CTRL, 2);
|
|
|
|
if (way == pcic_iw_pci)
|
2001-08-14 05:31:56 +00:00
|
|
|
bcr &= ~CLPD6832_BCR_MGMT_IRQ_ENA;
|
|
|
|
else
|
|
|
|
bcr |= CLPD6832_BCR_MGMT_IRQ_ENA;
|
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
|
|
|
pci_write_config(dev, CB_PCI_BRIDGE_CTRL, bcr, 2);
|
2001-08-14 05:31:56 +00:00
|
|
|
}
|
2002-07-26 08:07:55 +00:00
|
|
|
if (device_id != PCIC_ID_CLPD6832) {
|
2001-08-14 05:31:56 +00:00
|
|
|
cm1 = pci_read_config(dev, CLPD6833_CFG_MISC_1, 4);
|
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
|
|
|
if (way == pcic_iw_pci)
|
2001-08-14 05:31:56 +00:00
|
|
|
cm1 &= ~CLPD6833_CM1_MGMT_EXCA_ENA;
|
|
|
|
else
|
|
|
|
cm1 |= CLPD6833_CM1_MGMT_EXCA_ENA;
|
|
|
|
pci_write_config(dev, CLPD6833_CFG_MISC_1, cm1, 4);
|
|
|
|
}
|
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
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
pcic_pci_pd68xx_init(device_t dev)
|
|
|
|
{
|
2001-08-24 07:30:18 +00:00
|
|
|
pcic_pci_cardbus_init(dev);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static int
|
|
|
|
pcic_pci_ricoh_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_ricoh_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = sp->sc;
|
|
|
|
device_t dev = sc->dev;
|
|
|
|
u_int16_t mcr2;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For CSC interrupts via ISA, we can't do that exactly.
|
|
|
|
* However, we can disable INT# routing, which is usually what
|
|
|
|
* we want. This is bit 7 in the field. Note, bit 6 looks
|
|
|
|
* interesting, but appears to be unnecessary.
|
|
|
|
*/
|
|
|
|
mcr2 = pci_read_config(dev, R5C47X_MISC_CONTROL_REGISTER_2, 2);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
mcr2 &= ~R5C47X_MCR2_CSC_TO_INTX_DISABLE;
|
|
|
|
else
|
|
|
|
mcr2 |= R5C47X_MCR2_CSC_TO_INTX_DISABLE;
|
|
|
|
pci_write_config(dev, R5C47X_MISC_CONTROL_REGISTER_2, mcr2, 2);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_ricoh_init(device_t dev)
|
|
|
|
{
|
|
|
|
u_int16_t brgcntl;
|
|
|
|
u_int32_t device_id = pci_get_devid(dev);
|
|
|
|
|
|
|
|
switch (device_id) {
|
2002-07-26 08:07:55 +00:00
|
|
|
case PCIC_ID_RICOH_RL5C465:
|
|
|
|
case PCIC_ID_RICOH_RL5C466:
|
2001-08-24 07:30:18 +00:00
|
|
|
/*
|
|
|
|
* Ricoh chips have a legacy bridge enable different than most
|
|
|
|
* Code cribbed from NEWBUS's bridge code since I can't find a
|
|
|
|
* datasheet for them that has register definitions.
|
|
|
|
*/
|
|
|
|
brgcntl = pci_read_config(dev, CB_PCI_BRIDGE_CTRL, 2);
|
|
|
|
brgcntl &= ~(CB_BCR_RL_3E2_EN | CB_BCR_RL_3E0_EN);
|
|
|
|
pci_write_config(dev, CB_PCI_BRIDGE_CTRL, brgcntl, 2);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
pcic_pci_cardbus_init(dev);
|
2000-02-02 16:49:21 +00:00
|
|
|
}
|
1997-12-02 21:26:41 +00:00
|
|
|
|
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
|
|
|
/*
|
|
|
|
* TI 1030, 1130, and 1131.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_ti113x_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
u_int32_t cardcntl;
|
|
|
|
device_t dev = sp->sc->dev;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The TI-1130 (and 1030 and 1131) have a different interrupt
|
2003-01-04 17:26:35 +00:00
|
|
|
* routing control than the newer chips. assume we're not
|
|
|
|
* routing either csc or func interrupts via PCI, but enable
|
|
|
|
* as necessary when we find someone uses PCI interrupts. In
|
|
|
|
* order to get any pci interrupts, PCI_IRQ_ENA (bit 5) must
|
|
|
|
* be set. If either PCI_IREQ (bit 4) or PCI_CSC (bit 3) are
|
|
|
|
* set, then set bit 5 at the same time, since setting them
|
|
|
|
* enables the PCI interrupt routing.
|
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
|
|
|
*
|
|
|
|
* It also appears necessary to set the function routing bit
|
|
|
|
* in the bridge control register, but cardbus_init does that
|
|
|
|
* for us.
|
|
|
|
*/
|
|
|
|
cardcntl = pci_read_config(dev, TI113X_PCI_CARD_CONTROL, 1);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
cardcntl |= TI113X_CARDCNTL_PCI_IREQ;
|
|
|
|
else
|
|
|
|
cardcntl &= ~TI113X_CARDCNTL_PCI_IREQ;
|
|
|
|
if (cardcntl & (TI113X_CARDCNTL_PCI_IREQ | TI113X_CARDCNTL_PCI_CSC))
|
|
|
|
cardcntl |= TI113X_CARDCNTL_PCI_IRQ_ENA;
|
2001-09-05 22:26:14 +00:00
|
|
|
else
|
|
|
|
cardcntl &= ~TI113X_CARDCNTL_PCI_IRQ_ENA;
|
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
|
|
|
pci_write_config(dev, TI113X_PCI_CARD_CONTROL, cardcntl, 1);
|
|
|
|
|
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_ti113x_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
|
|
|
u_int32_t cardcntl;
|
|
|
|
device_t dev = sp->sc->dev;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The TI-1130 (and 1030 and 1131) have a different interrupt
|
|
|
|
* routing control than the newer cards. assume we're not
|
|
|
|
* routing PCI, but enable as necessary when we find someone
|
|
|
|
* uses PCI interrupts. In order to get any pci interrupts,
|
|
|
|
* PCI_IRQ_ENA (bit 5) must be set. If either PCI_IREQ (bit
|
|
|
|
* 4) or PCI_CSC (bit 3) are set, then set bit 5 at the same
|
|
|
|
* time, since setting them enables the PCI interrupt routing.
|
|
|
|
*
|
|
|
|
* It also appears necessary to set the function routing bit
|
|
|
|
* in the bridge control register, but cardbus_init does that
|
|
|
|
* for us.
|
|
|
|
*/
|
|
|
|
cardcntl = pci_read_config(dev, TI113X_PCI_CARD_CONTROL, 1);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
cardcntl |= TI113X_CARDCNTL_PCI_CSC;
|
|
|
|
else
|
|
|
|
cardcntl &= ~TI113X_CARDCNTL_PCI_CSC;
|
|
|
|
if (cardcntl & (TI113X_CARDCNTL_PCI_IREQ | TI113X_CARDCNTL_PCI_CSC))
|
|
|
|
cardcntl |= TI113X_CARDCNTL_PCI_IRQ_ENA;
|
2001-09-05 22:26:14 +00:00
|
|
|
else
|
|
|
|
cardcntl &= ~TI113X_CARDCNTL_PCI_IRQ_ENA;
|
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
|
|
|
pci_write_config(dev, TI113X_PCI_CARD_CONTROL, cardcntl, 1);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_ti12xx_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2002-07-26 08:07:55 +00:00
|
|
|
u_int32_t syscntl, devcntl, cardcntl, mfunc;
|
|
|
|
device_t dev = sp->sc->dev;
|
|
|
|
|
|
|
|
syscntl = pci_read_config(dev, TI113X_PCI_SYSTEM_CONTROL, 4);
|
|
|
|
devcntl = pci_read_config(dev, TI113X_PCI_DEVICE_CONTROL, 1);
|
|
|
|
cardcntl = pci_read_config(dev, TI113X_PCI_CARD_CONTROL, 1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Special code for the Orinoco cards (and a few others). They
|
|
|
|
* seem to need this special code to make them work only over pci
|
|
|
|
* interrupts. Sadly, doing this code also causes problems for
|
|
|
|
* many laptops, so we have to make it controlled by a tunable.
|
|
|
|
* Actually, experience has shown that this rarely, if ever,
|
|
|
|
* helps.
|
|
|
|
*/
|
|
|
|
if (way == pcic_iw_pci) {
|
|
|
|
/*
|
|
|
|
* pcic_init_routing seems to do nothing useful towards
|
|
|
|
* fixing the hang problems. I plan on removing it in
|
|
|
|
* 4.8 or so.
|
|
|
|
*/
|
|
|
|
if (pcic_init_routing) {
|
|
|
|
devcntl &= ~TI113X_DEVCNTL_INTR_MASK;
|
|
|
|
pci_write_config(dev, TI113X_PCI_DEVICE_CONTROL,
|
|
|
|
devcntl, 1);
|
|
|
|
syscntl |= TI113X_SYSCNTL_INTRTIE;
|
|
|
|
}
|
2003-01-04 17:26:35 +00:00
|
|
|
|
2002-09-29 23:37:07 +00:00
|
|
|
/*
|
|
|
|
* I've had reports that we need the pci clock enabled,
|
2003-01-04 17:26:35 +00:00
|
|
|
* provide a hook to do so. The number of cards that
|
|
|
|
* require this is quite small.
|
2002-07-26 08:07:55 +00:00
|
|
|
*/
|
2003-01-04 17:26:35 +00:00
|
|
|
if (pcic_ti12xx_enable_pci_clock) {
|
|
|
|
syscntl |= TI12XX_SYSCNTL_PCI_CLOCK;
|
|
|
|
pci_write_config(dev, TI113X_PCI_SYSTEM_CONTROL,
|
|
|
|
syscntl, 4);
|
|
|
|
}
|
2002-07-26 08:07:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Some PCI add-in cards don't have good EEPROMs on them,
|
|
|
|
* so they get this MUX register wrong. The MUX register
|
|
|
|
* defaults to 0, which is usually wrong for this register,
|
|
|
|
* so we initialize it to make sense.
|
|
|
|
*
|
|
|
|
* We don't bother to turn it off in the ISA case since it
|
|
|
|
* is an initialization issue.
|
|
|
|
*
|
|
|
|
* A few weird TI bridges don't have MFUNC, so filter
|
|
|
|
* those out too.
|
|
|
|
*/
|
|
|
|
if ((sp->sc->flags & TI_NO_MFUNC) == 0) {
|
|
|
|
mfunc = pci_read_config(dev, TI12XX_PCI_MFUNC, 4);
|
|
|
|
if (mfunc == 0) {
|
|
|
|
mfunc = (mfunc & ~TI12XX_MFUNC_PIN0) |
|
|
|
|
TI12XX_MFUNC_PIN0_INTA;
|
|
|
|
if ((syscntl & TI113X_SYSCNTL_INTRTIE) == 0)
|
|
|
|
mfunc = (mfunc & ~TI12XX_MFUNC_PIN1) |
|
|
|
|
TI12XX_MFUNC_PIN1_INTB;
|
|
|
|
pci_write_config(dev, TI12XX_PCI_MFUNC, mfunc,
|
|
|
|
4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
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
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_ti12xx_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
/*
|
|
|
|
* Nothing happens here. The TI12xx parts will route the
|
|
|
|
* CSC interrupt via PCI if ExCA register tells it to use
|
|
|
|
* interrupt 0. And via IRQ otherwise (except for reserved
|
|
|
|
* values which may or may not do anything).
|
|
|
|
*
|
|
|
|
* We just hope for the best here that doing nothing is the
|
|
|
|
* right thing to do.
|
|
|
|
*/
|
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
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2000-03-25 20:29:55 +00:00
|
|
|
/*
|
2001-06-04 06:49:46 +00:00
|
|
|
* TI PCI-CardBus Host Adapter specific function code.
|
2000-03-25 20:29:55 +00:00
|
|
|
* This function is separated from pcic_pci_attach().
|
|
|
|
* Takeshi Shibagaki(shiba@jp.freebsd.org).
|
|
|
|
*/
|
|
|
|
static void
|
2001-06-04 06:49:46 +00:00
|
|
|
pcic_pci_ti_init(device_t dev)
|
2000-03-25 20:29:55 +00:00
|
|
|
{
|
2001-08-01 19:41:56 +00:00
|
|
|
u_int32_t syscntl, diagctl, devcntl, cardcntl;
|
|
|
|
u_int32_t device_id = pci_get_devid(dev);
|
2002-07-26 08:07:55 +00:00
|
|
|
int ti113x = (device_id == PCIC_ID_TI1031) ||
|
|
|
|
(device_id == PCIC_ID_TI1130) ||
|
|
|
|
(device_id == PCIC_ID_TI1131);
|
2000-03-25 20:29:55 +00:00
|
|
|
|
|
|
|
syscntl = pci_read_config(dev, TI113X_PCI_SYSTEM_CONTROL, 4);
|
|
|
|
devcntl = pci_read_config(dev, TI113X_PCI_DEVICE_CONTROL, 1);
|
|
|
|
cardcntl = pci_read_config(dev, TI113X_PCI_CARD_CONTROL, 1);
|
|
|
|
|
2001-08-14 07:31:47 +00:00
|
|
|
if (ti113x) {
|
2001-07-30 07:17:40 +00:00
|
|
|
device_printf(dev, "TI113X PCI Config Reg: ");
|
2001-06-04 06:49:46 +00:00
|
|
|
if (syscntl & TI113X_SYSCNTL_CLKRUN_ENA) {
|
2000-03-25 20:29:55 +00:00
|
|
|
if (syscntl & TI113X_SYSCNTL_CLKRUN_SEL)
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[clkrun irq 12]");
|
2000-03-25 20:29:55 +00:00
|
|
|
else
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[clkrun irq 10]");
|
2000-03-25 20:29:55 +00:00
|
|
|
}
|
2001-08-14 07:31:47 +00:00
|
|
|
} else {
|
|
|
|
device_printf(dev, "TI12XX PCI Config Reg: ");
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Turn on async CSC interrupts. This appears to
|
|
|
|
* be the default, but the old, pre pci-aware, code
|
|
|
|
* did this and it appears PAO does as well.
|
|
|
|
*/
|
|
|
|
diagctl = pci_read_config(dev, TI12XX_PCI_DIAGNOSTIC, 1);
|
|
|
|
diagctl |= TI12XX_DIAG_CSC_INTR;
|
|
|
|
pci_write_config(dev, TI12XX_PCI_DIAGNOSTIC, diagctl, 1);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Turn off Zoom Video. Some cards have this enabled,
|
|
|
|
* some do not but it causes problems when enabled. This
|
|
|
|
* register doesn't exist on the 1130 (and likely the 1131,
|
|
|
|
* but without a datasheet it is impossible to know).
|
|
|
|
* Some 12xx chips may not have it, but setting it is
|
2002-07-26 08:07:55 +00:00
|
|
|
* believed to be harmless on those models.
|
2001-08-14 07:31:47 +00:00
|
|
|
*/
|
|
|
|
pci_write_config(dev, TI12XX_PCI_MULTIMEDIA_CONTROL, 0, 4);
|
2000-03-25 20:29:55 +00:00
|
|
|
}
|
|
|
|
if (cardcntl & TI113X_CARDCNTL_RING_ENA)
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[ring enable]");
|
2000-03-25 20:29:55 +00:00
|
|
|
if (cardcntl & TI113X_CARDCNTL_SPKR_ENA)
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[speaker enable]");
|
2000-03-25 20:29:55 +00:00
|
|
|
if (syscntl & TI113X_SYSCNTL_PWRSAVINGS)
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[pwr save]");
|
2001-08-01 19:41:56 +00:00
|
|
|
switch(devcntl & TI113X_DEVCNTL_INTR_MASK){
|
2000-03-25 20:29:55 +00:00
|
|
|
case TI113X_DEVCNTL_INTR_ISA :
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[CSC parallel isa irq]");
|
2000-03-25 20:29:55 +00:00
|
|
|
break;
|
|
|
|
case TI113X_DEVCNTL_INTR_SERIAL :
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[CSC serial isa irq]");
|
2000-03-25 20:29:55 +00:00
|
|
|
break;
|
|
|
|
case TI113X_DEVCNTL_INTR_NONE :
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[pci only]");
|
2000-03-25 20:29:55 +00:00
|
|
|
break;
|
|
|
|
case TI12XX_DEVCNTL_INTR_ALLSERIAL :
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("[FUNC pci int + CSC serial isa irq]");
|
2000-03-25 20:29:55 +00:00
|
|
|
break;
|
|
|
|
}
|
2001-07-30 07:17:40 +00:00
|
|
|
printf("\n");
|
2001-08-24 07:30:18 +00:00
|
|
|
pcic_pci_cardbus_init(dev);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
/*
|
|
|
|
* Code for TOPIC chips
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_topic_func(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2001-10-17 05:20:56 +00:00
|
|
|
#ifdef THIS_BRAEKS_THINGS
|
2001-10-11 05:37:32 +00:00
|
|
|
device_t dev = sp->sc->dev;
|
|
|
|
u_int32_t scr;
|
|
|
|
|
|
|
|
scr = pci_read_config(dev, TOPIC_SOCKET_CTRL, 4);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
scr |= TOPIC_SOCKET_CTRL_SCR_IRQSEL;
|
|
|
|
else
|
|
|
|
scr &= ~TOPIC_SOCKET_CTRL_SCR_IRQSEL;
|
|
|
|
pci_write_config(dev, TOPIC_SLOT_CTRL, scr, 4);
|
2001-10-17 05:20:56 +00:00
|
|
|
#endif
|
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
|
|
|
return (pcic_pci_gen_func(sp, way));
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_topic_csc(struct pcic_slot *sp, enum pcic_intr_way way)
|
|
|
|
{
|
2001-09-04 05:50:08 +00:00
|
|
|
device_t dev = sp->sc->dev;
|
2001-10-11 05:37:32 +00:00
|
|
|
u_int32_t scr;
|
|
|
|
u_int32_t device_id;
|
2001-09-04 05:50:08 +00:00
|
|
|
|
2001-10-11 05:37:32 +00:00
|
|
|
device_id = pci_get_devid(dev);
|
2002-07-26 08:07:55 +00:00
|
|
|
if (device_id == PCIC_ID_TOPIC100 || device_id == PCIC_ID_TOPIC97) {
|
2001-10-11 05:37:32 +00:00
|
|
|
scr = pci_read_config(dev, TOPIC_SLOT_CTRL, 4);
|
|
|
|
if (way == pcic_iw_pci)
|
|
|
|
scr |= TOPIC97_SLOT_CTRL_PCIINT;
|
|
|
|
else
|
|
|
|
scr &= ~TOPIC97_SLOT_CTRL_PCIINT;
|
|
|
|
pci_write_config(dev, TOPIC_SLOT_CTRL, scr, 4);
|
|
|
|
}
|
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
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
2001-08-24 07:30:18 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_topic_init(device_t dev)
|
|
|
|
{
|
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
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
2001-10-11 05:37:32 +00:00
|
|
|
u_int32_t reg;
|
|
|
|
u_int32_t device_id;
|
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
|
|
|
|
|
|
|
device_id = pci_get_devid(dev);
|
2002-06-23 01:55:10 +00:00
|
|
|
reg = pci_read_config(dev, TOPIC_SLOT_CTRL, 4);
|
|
|
|
reg |= (TOPIC_SLOT_CTRL_SLOTON | TOPIC_SLOT_CTRL_SLOTEN |
|
|
|
|
TOPIC_SLOT_CTRL_ID_LOCK | TOPIC_SLOT_CTRL_CARDBUS);
|
|
|
|
reg &= ~TOPIC_SLOT_CTRL_SWDETECT;
|
2002-07-26 08:07:55 +00:00
|
|
|
if (device_id == PCIC_ID_TOPIC100 || device_id == PCIC_ID_TOPIC97) {
|
2002-06-23 01:55:10 +00:00
|
|
|
reg |= TOPIC97_SLOT_CTRL_PCIINT;
|
|
|
|
reg &= ~(TOPIC97_SLOT_CTRL_STSIRQP | TOPIC97_SLOT_CTRL_IRQP);
|
|
|
|
}
|
|
|
|
pci_write_config(dev, TOPIC_SLOT_CTRL, reg, 4);
|
|
|
|
pcic_pci_cardbus_init(dev);
|
|
|
|
|
2002-07-26 08:07:55 +00:00
|
|
|
if (device_id == PCIC_ID_TOPIC100 || device_id == PCIC_ID_TOPIC97) {
|
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
|
|
|
/*
|
|
|
|
* We need to enable voltage sense and 3V cards explicitly
|
|
|
|
* in the bridge. The datasheets I have for both the
|
|
|
|
* ToPIC 97 and 100 both lists these ports. Without
|
|
|
|
* datasheets for the ToPIC95s, I can't tell if we need
|
|
|
|
* to do it there or not.
|
|
|
|
*/
|
|
|
|
pcic_setb(&sc->slots[0], PCIC_TOPIC_FCR,
|
|
|
|
PCIC_FCR_3V_EN | PCIC_FCR_VS_EN);
|
|
|
|
}
|
2000-03-25 20:29:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2001-06-04 06:49:46 +00:00
|
|
|
pcic_pci_cardbus_init(device_t dev)
|
2000-03-25 20:29:55 +00:00
|
|
|
{
|
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
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
2000-03-25 20:29:55 +00:00
|
|
|
u_int16_t brgcntl;
|
|
|
|
int unit;
|
|
|
|
|
|
|
|
unit = device_get_unit(dev);
|
|
|
|
|
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
|
|
|
brgcntl = pci_read_config(dev, CB_PCI_BRIDGE_CTRL, 2);
|
|
|
|
brgcntl |= CB_BCR_WRITE_POST_EN | CB_BCR_MASTER_ABORT;
|
|
|
|
pci_write_config(dev, CB_PCI_BRIDGE_CTRL, brgcntl, 2);
|
2001-06-04 06:49:46 +00:00
|
|
|
|
|
|
|
/* Turn off legacy address */
|
|
|
|
pci_write_config(dev, CB_PCI_LEGACY16_IOADDR, 0, 2);
|
2001-07-01 23:41:24 +00:00
|
|
|
|
|
|
|
/*
|
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
|
|
|
* Write zeros into the remaining memory I/O windows. This
|
|
|
|
* seems to turn off the pci configuration of these things and
|
|
|
|
* make the cardbus bridge use the values for memory
|
|
|
|
* programmed into the pcic registers.
|
2001-07-01 23:41:24 +00:00
|
|
|
*/
|
|
|
|
pci_write_config(dev, CB_PCI_MEMBASE0, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_MEMLIMIT0, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_MEMBASE1, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_MEMLIMIT1, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_IOBASE0, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_IOLIMIT0, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_IOBASE1, 0, 4);
|
|
|
|
pci_write_config(dev, CB_PCI_IOLIMIT1, 0, 4);
|
|
|
|
|
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
|
|
|
/*
|
2002-07-17 06:02:07 +00:00
|
|
|
* Tell the chip to do its routing thing.
|
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
|
|
|
*/
|
2002-07-17 06:02:07 +00:00
|
|
|
sc->chip->func_intr_way(&sc->slots[0], sc->func_route);
|
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
|
|
|
sc->chip->csc_intr_way(&sc->slots[0], sc->csc_route);
|
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2001-07-27 07:14:12 +00:00
|
|
|
static const char *
|
|
|
|
pcic_pci_cardtype(u_int32_t stat)
|
|
|
|
{
|
|
|
|
if (stat & CB_SS_NOTCARD)
|
2001-11-13 06:46:19 +00:00
|
|
|
return ("unrecognized by bridge");
|
2001-07-27 07:14:12 +00:00
|
|
|
if ((stat & (CB_SS_16BIT | CB_SS_CB)) == (CB_SS_16BIT | CB_SS_CB))
|
|
|
|
return ("16-bit and 32-bit (can't happen)");
|
|
|
|
if (stat & CB_SS_16BIT)
|
|
|
|
return ("16-bit pccard");
|
|
|
|
if (stat & CB_SS_CB)
|
|
|
|
return ("32-bit cardbus");
|
|
|
|
return ("none (can't happen)");
|
|
|
|
}
|
|
|
|
|
2001-08-19 05:01:18 +00:00
|
|
|
/*
|
|
|
|
* Card insertion and removal code. The insertion events need to be
|
|
|
|
* debounced so that the noisy insertion/removal events don't result
|
|
|
|
* in the hardware being initialized many times, only to be torn down
|
|
|
|
* as well. This may also cause races with pccardd. Instead, we wait
|
|
|
|
* for the insertion signal to be stable for 0.5 seconds before we declare
|
2001-09-13 08:26:55 +00:00
|
|
|
* it to be a real insertion event. Removal is also debounced. We turn
|
|
|
|
* off interrupt servicing during the settling time to prevent infinite
|
|
|
|
* loops in the driver.
|
2001-08-19 05:01:18 +00:00
|
|
|
*
|
|
|
|
* Note: We only handle the card detect change events. We don't handle
|
|
|
|
* power events and status change events.
|
|
|
|
*/
|
2001-06-04 06:49:46 +00:00
|
|
|
static void
|
2001-09-13 08:26:55 +00:00
|
|
|
pcic_cd_change(void *arg)
|
2001-06-04 06:49:46 +00:00
|
|
|
{
|
|
|
|
struct pcic_softc *sc = (struct pcic_softc *) arg;
|
|
|
|
struct pcic_slot *sp = &sc->slots[0];
|
|
|
|
u_int32_t stat;
|
2001-08-19 05:01:18 +00:00
|
|
|
|
|
|
|
sc->cd_pending = 0;
|
2001-06-04 06:49:46 +00:00
|
|
|
stat = bus_space_read_4(sp->bst, sp->bsh, CB_SOCKET_STATE);
|
2001-08-19 05:01:18 +00:00
|
|
|
|
2001-09-16 06:12:16 +00:00
|
|
|
/* Status changed while present; remove the card from the system. */
|
|
|
|
if (sc->cd_present) {
|
2001-09-13 08:26:55 +00:00
|
|
|
sc->cd_present = 0;
|
|
|
|
pccard_event(sp->slt, card_removed);
|
|
|
|
}
|
2001-09-16 06:12:16 +00:00
|
|
|
/* Nothing to do if the debounced state is 'not present'. */
|
|
|
|
if ((stat & CB_SS_CD) != 0)
|
|
|
|
return;
|
|
|
|
|
2001-08-19 05:01:18 +00:00
|
|
|
sc->cd_present = 1;
|
2001-09-16 06:12:16 +00:00
|
|
|
if (bootverbose && (stat & CB_SS_BADVCC) != 0)
|
2002-06-23 01:55:10 +00:00
|
|
|
device_printf(sc->dev, "BAD Vcc request: 0x%x\n", stat);
|
2001-08-19 05:01:18 +00:00
|
|
|
if ((stat & CB_SS_16BIT) == 0)
|
|
|
|
device_printf(sp->sc->dev, "Card type %s is unsupported\n",
|
|
|
|
pcic_pci_cardtype(stat));
|
|
|
|
else
|
|
|
|
pccard_event(sp->slt, card_inserted);
|
2000-03-25 20:29:55 +00:00
|
|
|
}
|
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_intr(void *arg)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = (struct pcic_softc *) arg;
|
|
|
|
struct pcic_slot *sp = &sc->slots[0];
|
|
|
|
u_int32_t event;
|
|
|
|
|
|
|
|
event = bus_space_read_4(sp->bst, sp->bsh, CB_SOCKET_EVENT);
|
2001-07-01 23:41:43 +00:00
|
|
|
if (event != 0) {
|
2001-08-19 05:01:18 +00:00
|
|
|
if (bootverbose)
|
2001-09-16 06:12:16 +00:00
|
|
|
device_printf(sc->dev, "Event mask 0x%x\n", event);
|
2001-08-19 05:01:18 +00:00
|
|
|
|
2001-09-16 06:12:16 +00:00
|
|
|
/*
|
|
|
|
* Treat all card-detect signal transitions the same way
|
|
|
|
* since we can't reliably tell if this is an insert or a
|
|
|
|
* remove event. Stop the card from getting interrupts and
|
|
|
|
* defer the insert/remove event until the CB_SOCKET_STATE
|
|
|
|
* signals have had time to settle.
|
|
|
|
*/
|
|
|
|
if ((event & CB_SE_CD) != 0) {
|
2001-08-19 05:01:18 +00:00
|
|
|
if (sc->cd_pending) {
|
2001-09-13 08:26:55 +00:00
|
|
|
untimeout(pcic_cd_change, arg, sc->cd_ch);
|
2001-08-19 05:01:18 +00:00
|
|
|
sc->cd_pending = 0;
|
|
|
|
}
|
2001-09-13 08:26:55 +00:00
|
|
|
sc->cd_pending = 1;
|
|
|
|
sc->cd_ch = timeout(pcic_cd_change, arg, hz/2);
|
2001-09-16 06:12:16 +00:00
|
|
|
sc->func_intr = NULL;
|
2001-06-04 06:49:46 +00:00
|
|
|
}
|
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
|
|
|
|
2001-08-19 05:01:18 +00:00
|
|
|
/* Ack the interrupt */
|
|
|
|
bus_space_write_4(sp->bst, sp->bsh, 0, event);
|
2001-06-04 06:49:46 +00:00
|
|
|
}
|
2001-07-01 23:41:43 +00:00
|
|
|
|
2001-08-01 19:41:56 +00:00
|
|
|
/*
|
2001-08-19 05:01:18 +00:00
|
|
|
* Some TI chips also require us to read the old ExCA register for
|
2001-08-01 19:41:56 +00:00
|
|
|
* card status change when we route CSC via PCI! So, we go ahead
|
|
|
|
* and read it to clear the bits. Maybe we should check the status
|
|
|
|
* ala the ISA interrupt handler, but those changes should be caught
|
|
|
|
* in the CD change.
|
2001-09-13 08:26:55 +00:00
|
|
|
*
|
|
|
|
* We have to check it every interrupt because these bits can sometimes
|
|
|
|
* show up indepentently of the CB_SOCKET_EVENT register above.
|
2001-08-01 19:41:56 +00:00
|
|
|
*/
|
|
|
|
sp->getb(sp, PCIC_STAT_CHG);
|
2001-06-04 06:49:46 +00:00
|
|
|
}
|
2000-03-25 20:29:55 +00:00
|
|
|
|
1997-12-02 21:26:41 +00:00
|
|
|
/*
|
1997-12-02 22:13:59 +00:00
|
|
|
* Return the ID string for the controller if the vendor/product id
|
|
|
|
* matches, NULL otherwise.
|
1997-12-02 21:26:41 +00:00
|
|
|
*/
|
2000-02-02 16:49:21 +00:00
|
|
|
static int
|
2000-03-25 20:29:55 +00:00
|
|
|
pcic_pci_probe(device_t dev)
|
1997-12-02 21:26:41 +00:00
|
|
|
{
|
2001-06-04 06:49:46 +00:00
|
|
|
u_int8_t subclass;
|
|
|
|
u_int8_t progif;
|
|
|
|
const char *desc;
|
|
|
|
u_int32_t device_id;
|
2001-05-25 19:22:36 +00:00
|
|
|
struct pcic_pci_table *itm;
|
2001-06-04 06:49:46 +00:00
|
|
|
struct resource *res;
|
|
|
|
int rid;
|
2000-02-02 16:49:21 +00:00
|
|
|
|
2002-06-13 17:28:55 +00:00
|
|
|
if (pcic_ignore_pci)
|
|
|
|
return (ENXIO);
|
2000-03-25 20:29:55 +00:00
|
|
|
device_id = pci_get_devid(dev);
|
2000-02-02 16:49:21 +00:00
|
|
|
desc = NULL;
|
2001-05-25 19:22:36 +00:00
|
|
|
itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
|
2001-08-25 06:40:00 +00:00
|
|
|
if (pcic_ignore_function_1 && pci_get_function(dev) == 1) {
|
|
|
|
if (itm != NULL)
|
|
|
|
PRVERB((dev, "Ignoring function 1\n"));
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
2001-05-25 19:22:36 +00:00
|
|
|
if (itm != NULL)
|
|
|
|
desc = itm->descr;
|
2001-07-01 23:41:57 +00:00
|
|
|
if (desc == NULL && pci_get_class(dev) == PCIC_BRIDGE) {
|
|
|
|
subclass = pci_get_subclass(dev);
|
|
|
|
progif = pci_get_progif(dev);
|
|
|
|
if (subclass == PCIS_BRIDGE_PCMCIA && progif == 0)
|
|
|
|
desc = "Generic PCI-PCMCIA Bridge";
|
|
|
|
if (subclass == PCIS_BRIDGE_CARDBUS && progif == 0)
|
2002-03-03 01:04:39 +00:00
|
|
|
desc = "YENTA PCI-CardBus Bridge";
|
2001-08-27 01:00:27 +00:00
|
|
|
if (bootverbose && desc)
|
|
|
|
printf("Found unknown %s devid 0x%x\n", desc, device_id);
|
1997-12-02 22:13:59 +00:00
|
|
|
}
|
2000-02-02 16:49:21 +00:00
|
|
|
if (desc == NULL)
|
|
|
|
return (ENXIO);
|
2000-03-25 20:29:55 +00:00
|
|
|
device_set_desc(dev, desc);
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2001-06-04 17:14:28 +00:00
|
|
|
/*
|
2001-08-27 01:00:27 +00:00
|
|
|
* Take us out of power down mode, if necessary. It also
|
|
|
|
* appears that even reading the power register is enough on
|
|
|
|
* some systems to cause correct behavior.
|
2001-06-04 17:14:28 +00:00
|
|
|
*/
|
|
|
|
if (pci_get_powerstate(dev) != PCI_POWERSTATE_D0) {
|
|
|
|
/* Reset the power state. */
|
|
|
|
device_printf(dev, "chip is in D%d power mode "
|
|
|
|
"-- setting to D0\n", pci_get_powerstate(dev));
|
|
|
|
pci_set_powerstate(dev, PCI_POWERSTATE_D0);
|
|
|
|
}
|
|
|
|
|
2001-04-17 23:15:00 +00:00
|
|
|
/*
|
2001-06-04 06:49:46 +00:00
|
|
|
* Allocated/deallocate interrupt. This forces the PCI BIOS or
|
|
|
|
* other MD method to route the interrupts to this card.
|
2001-06-04 17:14:28 +00:00
|
|
|
* This so we get the interrupt number in the probe message.
|
2001-07-31 06:44:37 +00:00
|
|
|
* We only need to route interrupts when we're doing pci
|
|
|
|
* parallel interrupt routing.
|
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
|
|
|
*
|
2002-07-18 08:05:00 +00:00
|
|
|
* We use two different variables for the memory based and I/O
|
|
|
|
* based cards, so the check here is a little more complex than
|
|
|
|
* one would otherwise hope.
|
|
|
|
*
|
|
|
|
* XXX The bus code for PCI really should do this for us.
|
2001-04-17 23:15:00 +00:00
|
|
|
*/
|
2002-07-18 08:05:00 +00:00
|
|
|
if ((pcic_intr_path == pcic_iw_pci &&
|
2002-07-26 08:07:55 +00:00
|
|
|
device_id != PCIC_ID_CLPD6729) ||
|
2002-07-18 08:05:00 +00:00
|
|
|
(pcic_pd6729_intr_path == pcic_iw_pci &&
|
2002-07-26 08:07:55 +00:00
|
|
|
device_id == PCIC_ID_CLPD6729)) {
|
2001-07-31 06:44:37 +00:00
|
|
|
rid = 0;
|
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
|
|
|
#ifdef __i386__
|
|
|
|
/*
|
|
|
|
* IRQ 0 is invalid on x86, but not other platforms.
|
|
|
|
* If we have irq 0, then write 255 to force a new, non-
|
2002-07-18 08:05:00 +00:00
|
|
|
* bogus one to be assigned. I think that in -current
|
|
|
|
* the code in this ifdef may be obsolete with the new
|
|
|
|
* invalid mapping that we're doing in the pci layer -- imp
|
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
|
|
|
*/
|
|
|
|
if (pci_get_irq(dev) == 0) {
|
|
|
|
pci_set_irq(dev, 255);
|
|
|
|
pci_write_config(dev, PCIR_INTLINE, 255, 1);
|
|
|
|
}
|
|
|
|
#endif
|
2001-07-31 06:44:37 +00:00
|
|
|
res = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
|
|
|
RF_ACTIVE);
|
|
|
|
if (res)
|
|
|
|
bus_release_resource(dev, SYS_RES_IRQ, rid, res);
|
|
|
|
}
|
2001-06-04 06:49:46 +00:00
|
|
|
|
|
|
|
return (0);
|
2001-04-17 23:15:00 +00:00
|
|
|
}
|
|
|
|
|
2001-08-24 07:43:35 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_shutdown(device_t dev)
|
|
|
|
{
|
2001-10-11 05:41:27 +00:00
|
|
|
/*
|
|
|
|
* More reports of things working w/o this code than with it.
|
|
|
|
*/
|
|
|
|
#if 0
|
2001-08-24 07:43:35 +00:00
|
|
|
struct pcic_softc *sc;
|
|
|
|
struct pcic_slot *sp;
|
2001-10-11 05:41:27 +00:00
|
|
|
|
2001-08-24 07:43:35 +00:00
|
|
|
sc = (struct pcic_softc *) device_get_softc(dev);
|
|
|
|
sp = &sc->slots[0];
|
|
|
|
|
|
|
|
/*
|
2001-08-24 17:29:42 +00:00
|
|
|
* Turn off the power to the slot in an attempt to
|
|
|
|
* keep the system from hanging on reboot. We also turn off
|
|
|
|
* card interrupts in an attempt to control interrupt storms.
|
|
|
|
* on some (all?) this has the effect of also turning off
|
|
|
|
* card status change interrupts. A side effect of writing 0
|
|
|
|
* to INT_GEN is that the card is placed into "reset" mode
|
|
|
|
* where nothing happens until it is taken out of "reset"
|
|
|
|
* mode.
|
2001-09-04 17:46:31 +00:00
|
|
|
*
|
|
|
|
* Also, turn off the generation of status interrupts too.
|
2001-08-24 07:43:35 +00:00
|
|
|
*/
|
|
|
|
sp->putb(sp, PCIC_INT_GEN, 0);
|
2001-09-04 17:46:31 +00:00
|
|
|
sp->putb(sp, PCIC_STAT_INT, 0);
|
2001-08-24 07:43:35 +00:00
|
|
|
sp->putb(sp, PCIC_POWER, 0);
|
2001-10-11 05:37:32 +00:00
|
|
|
DELAY(4000);
|
2001-08-24 07:43:35 +00:00
|
|
|
|
2001-08-24 17:29:42 +00:00
|
|
|
/*
|
|
|
|
* Writing to INT_GEN can cause an interrupt, so we blindly
|
|
|
|
* ack all possible interrupts here. Reading the stat change
|
|
|
|
* shouldn't be necessary, but some TI chipsets need it in the
|
|
|
|
* normal course of operations, so we do it here too. We can't
|
|
|
|
* lose any interrupts after this point, so go ahead and ack
|
|
|
|
* everything. The bits in INT_GEN clear upon reading them.
|
2001-09-04 17:46:31 +00:00
|
|
|
* We also set the interrupt mask to 0, in an effort to avoid
|
|
|
|
* getting further interrupts.
|
2001-08-24 17:29:42 +00:00
|
|
|
*/
|
2001-09-04 17:46:31 +00:00
|
|
|
bus_space_write_4(sp->bst, sp->bsh, CB_SOCKET_MASK, 0);
|
|
|
|
bus_space_write_4(sp->bst, sp->bsh, CB_SOCKET_EVENT, 0xffffffff);
|
2001-08-24 07:43:35 +00:00
|
|
|
sp->getb(sp, PCIC_STAT_CHG);
|
2001-10-11 05:41:27 +00:00
|
|
|
#endif
|
2001-08-24 07:43:35 +00:00
|
|
|
}
|
|
|
|
|
2001-09-09 17:42:58 +00:00
|
|
|
/*
|
|
|
|
* Print out the config space
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
pcic_pci_print_config(device_t dev)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
device_printf(dev, "PCI Configuration space:");
|
|
|
|
for (i = 0; i < 256; i += 4) {
|
2001-10-17 05:33:51 +00:00
|
|
|
if (i % 16 == 0)
|
2001-09-09 17:42:58 +00:00
|
|
|
printf("\n 0x%02x: ", i);
|
|
|
|
printf("0x%08x ", pci_read_config(dev, i, 4));
|
|
|
|
}
|
|
|
|
printf("\n");
|
|
|
|
}
|
|
|
|
|
1997-12-02 22:13:59 +00:00
|
|
|
/*
|
2002-07-18 08:05:00 +00:00
|
|
|
* Generic pci interrupt attach routine. It tries to understand all parts,
|
|
|
|
* and do sane things for those parts it does not understand.
|
1997-12-02 22:13:59 +00:00
|
|
|
*/
|
2000-02-02 16:49:21 +00:00
|
|
|
static int
|
2000-03-25 20:29:55 +00:00
|
|
|
pcic_pci_attach(device_t dev)
|
1997-12-02 22:13:59 +00:00
|
|
|
{
|
2000-03-25 20:29:55 +00:00
|
|
|
u_int32_t device_id = pci_get_devid(dev);
|
|
|
|
u_long command;
|
2001-06-04 06:49:46 +00:00
|
|
|
struct pcic_slot *sp;
|
|
|
|
struct pcic_softc *sc;
|
|
|
|
u_int32_t sockbase;
|
2001-08-29 15:54:12 +00:00
|
|
|
u_int32_t stat;
|
2001-06-04 06:49:46 +00:00
|
|
|
struct pcic_pci_table *itm;
|
|
|
|
int rid;
|
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
|
|
|
int i;
|
2001-08-25 06:40:00 +00:00
|
|
|
struct resource *r = NULL;
|
2001-06-04 06:49:46 +00:00
|
|
|
int error;
|
2001-08-26 04:05:07 +00:00
|
|
|
u_long irq = 0;
|
2001-08-25 06:40:00 +00:00
|
|
|
driver_intr_t *intr = NULL;
|
2000-03-25 20:29:55 +00:00
|
|
|
|
|
|
|
/*
|
2000-05-28 16:31:35 +00:00
|
|
|
* In sys/pci/pcireg.h, PCIR_COMMAND must be separated
|
2000-03-25 20:29:55 +00:00
|
|
|
* PCI_COMMAND_REG(0x04) and PCI_STATUS_REG(0x06).
|
|
|
|
* Takeshi Shibagaki(shiba@jp.freebsd.org).
|
|
|
|
*/
|
2001-07-31 06:44:37 +00:00
|
|
|
command = pci_read_config(dev, PCIR_COMMAND, 4);
|
|
|
|
command |= PCIM_CMD_PORTEN | PCIM_CMD_MEMEN;
|
|
|
|
pci_write_config(dev, PCIR_COMMAND, command, 4);
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
sc = (struct pcic_softc *) device_get_softc(dev);
|
|
|
|
sp = &sc->slots[0];
|
|
|
|
sp->sc = sc;
|
|
|
|
sockbase = pci_read_config(dev, 0x10, 4);
|
|
|
|
if (sockbase & 0x1) {
|
2001-06-09 07:34:17 +00:00
|
|
|
sc->iorid = CB_PCI_SOCKET_BASE;
|
|
|
|
sc->iores = bus_alloc_resource(dev, SYS_RES_IOPORT,
|
|
|
|
&sc->iorid, 0, ~0, 1, RF_ACTIVE | RF_SHAREABLE);
|
|
|
|
if (sc->iores == NULL)
|
|
|
|
return (ENOMEM);
|
2002-07-18 08:05:00 +00:00
|
|
|
|
2001-06-09 07:34:17 +00:00
|
|
|
sc->flags = PCIC_PD_POWER;
|
2001-08-24 07:30:18 +00:00
|
|
|
itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
|
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
|
|
|
for (i = 0; i < 2; i++) {
|
2001-09-21 06:45:35 +00:00
|
|
|
sp[i].bst = rman_get_bustag(sc->iores);
|
|
|
|
sp[i].bsh = rman_get_bushandle(sc->iores);
|
|
|
|
sp[i].sc = sc;
|
|
|
|
sp[i].revision = 0;
|
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
|
|
|
sp[i].getb = pcic_getb_io;
|
|
|
|
sp[i].putb = pcic_putb_io;
|
|
|
|
sp[i].offset = i * PCIC_SLOT_SIZE;
|
2001-11-11 06:55:15 +00:00
|
|
|
sp[i].controller = itm ? itm->type : PCIC_PD6729;
|
2001-09-21 06:45:35 +00:00
|
|
|
if ((sp[i].getb(&sp[i], PCIC_ID_REV) & 0xc0) == 0x80)
|
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
|
|
|
sp[i].slt = (struct slot *) 1;
|
|
|
|
}
|
2002-07-17 06:02:07 +00:00
|
|
|
sc->csc_route = sc->func_route = pcic_pd6729_intr_path;
|
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
|
|
|
if (itm)
|
|
|
|
sc->flags = itm->flags;
|
2002-07-18 08:05:00 +00:00
|
|
|
/*
|
|
|
|
* We have to use the ISA interrupt routine for status
|
|
|
|
* changes since we don't have any "yenta" pci registers.
|
|
|
|
* We have to do this even when we're using pci type
|
|
|
|
* interrupts because on these cards the interrupts are
|
|
|
|
* cleared in the same way that the ISA cards clear them.
|
|
|
|
*/
|
|
|
|
intr = pcic_isa_intr;
|
2001-06-04 06:49:46 +00:00
|
|
|
} else {
|
|
|
|
sc->memrid = CB_PCI_SOCKET_BASE;
|
|
|
|
sc->memres = bus_alloc_resource(dev, SYS_RES_MEMORY,
|
|
|
|
&sc->memrid, 0, ~0, 1, RF_ACTIVE);
|
|
|
|
if (sc->memres == NULL && pcic_pci_get_memory(dev) != 0)
|
|
|
|
return (ENOMEM);
|
|
|
|
sp->getb = pcic_pci_getb2;
|
|
|
|
sp->putb = pcic_pci_putb2;
|
|
|
|
sp->offset = CB_EXCA_OFFSET;
|
2001-07-31 15:53:17 +00:00
|
|
|
sp->bst = rman_get_bustag(sc->memres);
|
|
|
|
sp->bsh = rman_get_bushandle(sc->memres);
|
2001-06-04 06:49:46 +00:00
|
|
|
itm = pcic_pci_lookup(device_id, &pcic_pci_devs[0]);
|
|
|
|
if (itm != NULL) {
|
|
|
|
sp->controller = itm->type;
|
2001-08-24 07:30:18 +00:00
|
|
|
sp->revision = 0;
|
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
|
|
|
sc->flags = itm->flags;
|
2001-06-04 06:49:46 +00:00
|
|
|
} else {
|
|
|
|
/* By default, assume we're a D step compatible */
|
|
|
|
sp->controller = PCIC_I82365SL_DF;
|
|
|
|
sp->revision = 0;
|
2002-06-23 01:55:10 +00:00
|
|
|
sc->flags = PCIC_CARDBUS_POWER;
|
2001-06-04 06:49:46 +00:00
|
|
|
}
|
2002-07-20 22:29:23 +00:00
|
|
|
/* All memory mapped cardbus bridges have these registers */
|
|
|
|
sc->flags |= PCIC_YENTA_HIGH_MEMORY;
|
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
|
|
|
sp->slt = (struct slot *) 1;
|
|
|
|
sc->csc_route = pcic_intr_path;
|
|
|
|
sc->func_route = pcic_intr_path;
|
|
|
|
stat = bus_space_read_4(sp->bst, sp->bsh, CB_SOCKET_STATE);
|
|
|
|
sc->cd_present = (stat & CB_SS_CD) == 0;
|
2001-06-04 06:49:46 +00:00
|
|
|
}
|
|
|
|
sc->dev = dev;
|
2001-09-06 20:55:25 +00:00
|
|
|
if (itm)
|
|
|
|
sc->chip = itm->chip;
|
|
|
|
else
|
|
|
|
sc->chip = &pcic_pci_generic_chip;
|
2001-06-04 06:49:46 +00:00
|
|
|
|
2001-08-25 06:40:00 +00:00
|
|
|
if (sc->csc_route == pcic_iw_pci) {
|
|
|
|
rid = 0;
|
|
|
|
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, 0, ~0, 1,
|
|
|
|
RF_ACTIVE | RF_SHAREABLE);
|
|
|
|
if (r == NULL) {
|
|
|
|
sc->csc_route = pcic_iw_isa;
|
2001-08-25 22:04:00 +00:00
|
|
|
sc->func_route = pcic_iw_isa;
|
2001-08-25 06:40:00 +00:00
|
|
|
device_printf(dev,
|
|
|
|
"No PCI interrupt routed, trying ISA.\n");
|
2001-08-27 01:00:27 +00:00
|
|
|
} else {
|
2002-07-18 08:05:00 +00:00
|
|
|
if (intr == NULL)
|
|
|
|
intr = pcic_pci_intr;
|
2001-08-27 01:00:27 +00:00
|
|
|
irq = rman_get_start(r);
|
2001-08-25 06:40:00 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (sc->csc_route == pcic_iw_isa) {
|
|
|
|
rid = 0;
|
|
|
|
irq = pcic_override_irq;
|
|
|
|
if (irq != 0) {
|
|
|
|
r = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, irq,
|
|
|
|
irq, 1, RF_ACTIVE);
|
|
|
|
if (r == NULL) {
|
|
|
|
device_printf(dev,
|
|
|
|
"Can't route ISA CSC interrupt.\n");
|
|
|
|
pcic_dealloc(dev);
|
|
|
|
return (ENXIO);
|
|
|
|
}
|
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
|
|
|
device_printf(dev,
|
|
|
|
"Management interrupt on ISA IRQ %ld\n", irq);
|
2002-07-18 08:05:00 +00:00
|
|
|
if (intr == NULL)
|
|
|
|
intr = pcic_isa_intr;
|
2001-08-25 06:40:00 +00:00
|
|
|
} else {
|
|
|
|
sc->slot_poll = pcic_timeout;
|
2001-08-26 04:05:07 +00:00
|
|
|
sc->timeout_ch = timeout(sc->slot_poll, sc, hz/2);
|
2001-08-25 06:40:00 +00:00
|
|
|
device_printf(dev, "Polling mode\n");
|
|
|
|
intr = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Initialize AFTER we figure out what kind of interrupt we're
|
|
|
|
* going to be using, if any.
|
|
|
|
*/
|
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
|
|
|
if (!sc->chip)
|
|
|
|
panic("Bug: sc->chip not set!\n");
|
|
|
|
sc->chip->init(dev);
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2001-08-25 06:40:00 +00:00
|
|
|
/*
|
|
|
|
* Now install the interrupt handler, if necessary.
|
|
|
|
*/
|
2001-06-04 06:49:46 +00:00
|
|
|
sc->irqrid = rid;
|
|
|
|
sc->irqres = r;
|
2001-08-26 04:05:07 +00:00
|
|
|
sc->irq = irq;
|
2001-08-25 06:40:00 +00:00
|
|
|
if (intr) {
|
2001-08-26 04:05:07 +00:00
|
|
|
error = bus_setup_intr(dev, r, INTR_TYPE_AV, intr, sc, &sc->ih);
|
2001-08-25 06:40:00 +00:00
|
|
|
if (error) {
|
|
|
|
pcic_dealloc(dev);
|
|
|
|
return (error);
|
|
|
|
}
|
1997-12-02 21:26:41 +00:00
|
|
|
}
|
2001-09-09 17:42:58 +00:00
|
|
|
if (bootverbose)
|
|
|
|
pcic_pci_print_config(dev);
|
2001-06-04 06:49:46 +00:00
|
|
|
return (pcic_attach(dev));
|
2000-02-02 16:49:21 +00:00
|
|
|
}
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2000-08-30 06:57:38 +00:00
|
|
|
static int
|
|
|
|
pcic_pci_detach(device_t dev)
|
|
|
|
{
|
2001-08-24 07:43:35 +00:00
|
|
|
return (EBUSY); /* Can't detach this device */
|
2000-08-30 06:57:38 +00:00
|
|
|
}
|
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
/*
|
|
|
|
* The PCI bus should do this for us. However, it doesn't quite yet, so
|
|
|
|
* we cope by doing it ourselves. If it ever does, this code can go quietly
|
|
|
|
* into that good night.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
pcic_pci_get_memory(device_t dev)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc;
|
|
|
|
u_int32_t sockbase;
|
|
|
|
|
|
|
|
sc = (struct pcic_softc *) device_get_softc(dev);
|
|
|
|
sockbase = pci_read_config(dev, sc->memrid, 4);
|
|
|
|
if (sockbase >= 0x100000 && sockbase < 0xfffffff0) {
|
2003-02-26 05:45:48 +00:00
|
|
|
device_printf(dev, "Could not map register memory 0x%x\n",
|
|
|
|
sockbase);
|
2001-06-04 06:49:46 +00:00
|
|
|
return (ENOMEM);
|
|
|
|
}
|
|
|
|
pci_write_config(dev, sc->memrid, 0xffffffff, 4);
|
|
|
|
sockbase = pci_read_config(dev, sc->memrid, 4);
|
|
|
|
sockbase = (sockbase & 0xfffffff0) & -(sockbase & 0xfffffff0);
|
2002-06-27 19:56:22 +00:00
|
|
|
#define CARDBUS_SYS_RES_MEMORY_START 0x88000000
|
2001-07-31 06:44:37 +00:00
|
|
|
#define CARDBUS_SYS_RES_MEMORY_END 0xFFFFFFFF
|
2001-06-04 06:49:46 +00:00
|
|
|
sc->memres = bus_generic_alloc_resource(device_get_parent(dev),
|
|
|
|
dev, SYS_RES_MEMORY, &sc->memrid,
|
|
|
|
CARDBUS_SYS_RES_MEMORY_START, CARDBUS_SYS_RES_MEMORY_END,
|
|
|
|
sockbase, RF_ACTIVE | rman_make_alignment_flags(sockbase));
|
|
|
|
if (sc->memres == NULL) {
|
|
|
|
device_printf(dev, "Could not grab register memory\n");
|
|
|
|
return (ENOMEM);
|
|
|
|
}
|
|
|
|
sockbase = rman_get_start(sc->memres);
|
|
|
|
pci_write_config(dev, sc->memrid, sockbase, 4);
|
|
|
|
device_printf(dev, "PCI Memory allocated: 0x%08x\n", sockbase);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
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
|
|
|
static int
|
|
|
|
pcic_pci_gen_mapirq(struct pcic_slot *sp, int irq)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* If we're doing ISA interrupt routing, then just go to the
|
|
|
|
* generic ISA routine. Also, irq 0 means turn off the interrupts
|
2002-07-17 06:02:07 +00:00
|
|
|
* at the bridge.
|
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
|
|
|
*/
|
|
|
|
if (sp->sc->func_route == pcic_iw_isa || irq == 0)
|
|
|
|
return (pcic_isa_mapirq(sp, irq));
|
|
|
|
|
2002-07-17 06:02:07 +00:00
|
|
|
/*
|
|
|
|
* Ohterwise we're doing PCI interrupts. For those cardbus bridges
|
|
|
|
* that follow yenta (and the one pcmcia bridge that does), we don't
|
|
|
|
* do a thing to get the IRQ mapped into the system. However,
|
|
|
|
* for other controllers that are PCI, but not yetna compliant, we
|
|
|
|
* need to do some special mapping.
|
2002-10-07 07:02:48 +00:00
|
|
|
*
|
|
|
|
* XXX Maybe we shouldn't assume INTA#, but rather as the function
|
|
|
|
* XXX what Intline to use.
|
2002-07-17 06:02:07 +00:00
|
|
|
*/
|
|
|
|
if (sp->controller == PCIC_PD6729) {
|
|
|
|
/*
|
|
|
|
* INTA - 3
|
|
|
|
* INTB - 4
|
|
|
|
* INTC - 5
|
|
|
|
* INTD - 7
|
|
|
|
*/
|
|
|
|
sp->putb(sp, PCIC_INT_GEN, /* Assume INTA# */
|
|
|
|
(sp->getb(sp, PCIC_INT_GEN) & 0xF0) | 3);
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
return (0);
|
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
|
|
|
}
|
|
|
|
|
2001-09-13 08:26:55 +00:00
|
|
|
static void
|
|
|
|
pcic_pci_func_intr(void *arg)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = (struct pcic_softc *) arg;
|
|
|
|
struct pcic_slot *sp = &sc->slots[0];
|
|
|
|
u_int32_t stat;
|
2002-07-18 08:05:00 +00:00
|
|
|
int doit = 0;
|
2001-09-13 08:26:55 +00:00
|
|
|
|
2002-07-18 08:05:00 +00:00
|
|
|
/*
|
|
|
|
* The 6729 controller is a weird one, and we have to use
|
|
|
|
* the ISA registers to check to see if the card is there.
|
|
|
|
* Otherwise we look at the PCI state register to find out
|
|
|
|
* if the card is there.
|
|
|
|
*/
|
|
|
|
if (sp->controller == PCIC_PD6729) {
|
|
|
|
if ((sp->getb(sp, PCIC_STATUS) & PCIC_CD) == PCIC_CD)
|
|
|
|
doit = 1;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
stat = bus_space_read_4(sp->bst, sp->bsh, CB_SOCKET_STATE);
|
|
|
|
if ((stat & CB_SS_CD) == 0 && sc->func_intr != 0)
|
|
|
|
doit = 1;
|
|
|
|
}
|
|
|
|
if (doit && sc->func_intr != NULL)
|
2001-09-13 08:26:55 +00:00
|
|
|
sc->func_intr(sc->func_arg);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_setup_intr(device_t dev, device_t child, struct resource *irq,
|
|
|
|
int flags, driver_intr_t *intr, void *arg, void **cookiep)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
|
|
|
struct pcic_slot *sp = &sc->slots[0];
|
|
|
|
int err;
|
|
|
|
|
|
|
|
if (sc->func_route == pcic_iw_isa)
|
|
|
|
return(pcic_setup_intr(dev, child, irq, flags, intr, arg,
|
|
|
|
cookiep));
|
|
|
|
|
|
|
|
#if __FreeBSD_version >= 500000
|
|
|
|
if ((flags & INTR_FAST) != 0)
|
|
|
|
#else
|
|
|
|
if ((flags & INTR_TYPE_FAST) != 0)
|
|
|
|
#endif
|
|
|
|
return (EINVAL);
|
|
|
|
if (sc->func_intr != NULL) {
|
|
|
|
device_printf(child, "Can't establish another ISR\n");
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
err = bus_generic_setup_intr(dev, child, irq, flags,
|
|
|
|
pcic_pci_func_intr, sc, cookiep);
|
|
|
|
if (err != 0)
|
|
|
|
return (err);
|
|
|
|
sc->chip->map_irq(sp, rman_get_start(irq));
|
|
|
|
sc->func_intr = intr;
|
|
|
|
sc->func_arg = arg;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
pcic_pci_teardown_intr(device_t dev, device_t child, struct resource *irq,
|
|
|
|
void *cookie)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
|
|
|
|
|
|
|
if (sc->func_route == pcic_iw_isa)
|
|
|
|
return (pcic_teardown_intr(dev, child, irq, cookie));
|
|
|
|
sc->func_intr = NULL;
|
|
|
|
return (bus_generic_teardown_intr(dev, child, irq, cookie));
|
|
|
|
}
|
|
|
|
|
2001-10-30 15:31:49 +00:00
|
|
|
static int
|
|
|
|
pcic_pci_resume(device_t dev)
|
|
|
|
{
|
|
|
|
struct pcic_softc *sc = device_get_softc(dev);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Some BIOSes will not save the BARs for the pci chips, so we
|
|
|
|
* must do it ourselves. If the BAR is reset to 0 for an I/O
|
|
|
|
* device, it will read back as 0x1, so no explicit test for
|
|
|
|
* memory devices are needed.
|
|
|
|
*
|
|
|
|
* Note: The PCI bus code should do this automatically for us on
|
|
|
|
* suspend/resume, but until it does, we have to cope.
|
|
|
|
*/
|
|
|
|
if (pci_read_config(dev, CB_PCI_SOCKET_BASE, 4) == 0)
|
|
|
|
pci_write_config(dev, CB_PCI_SOCKET_BASE,
|
|
|
|
rman_get_start(sc->memres), 4);
|
|
|
|
return (bus_generic_resume(dev));
|
|
|
|
}
|
|
|
|
|
2000-02-02 16:49:21 +00:00
|
|
|
static device_method_t pcic_pci_methods[] = {
|
|
|
|
/* Device interface */
|
|
|
|
DEVMETHOD(device_probe, pcic_pci_probe),
|
|
|
|
DEVMETHOD(device_attach, pcic_pci_attach),
|
2000-08-30 06:57:38 +00:00
|
|
|
DEVMETHOD(device_detach, pcic_pci_detach),
|
2000-02-02 16:49:21 +00:00
|
|
|
DEVMETHOD(device_suspend, bus_generic_suspend),
|
2001-10-30 15:31:49 +00:00
|
|
|
DEVMETHOD(device_resume, pcic_pci_resume),
|
2001-08-24 07:43:35 +00:00
|
|
|
DEVMETHOD(device_shutdown, pcic_pci_shutdown),
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
/* Bus interface */
|
|
|
|
DEVMETHOD(bus_print_child, bus_generic_print_child),
|
|
|
|
DEVMETHOD(bus_alloc_resource, pcic_alloc_resource),
|
|
|
|
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
|
|
|
DEVMETHOD(bus_activate_resource, pcic_activate_resource),
|
|
|
|
DEVMETHOD(bus_deactivate_resource, pcic_deactivate_resource),
|
2001-09-13 08:26:55 +00:00
|
|
|
DEVMETHOD(bus_setup_intr, pcic_pci_setup_intr),
|
|
|
|
DEVMETHOD(bus_teardown_intr, pcic_pci_teardown_intr),
|
2001-06-04 06:49:46 +00:00
|
|
|
|
|
|
|
/* Card interface */
|
|
|
|
DEVMETHOD(card_set_res_flags, pcic_set_res_flags),
|
|
|
|
DEVMETHOD(card_get_res_flags, pcic_get_res_flags),
|
|
|
|
DEVMETHOD(card_set_memory_offset, pcic_set_memory_offset),
|
|
|
|
DEVMETHOD(card_get_memory_offset, pcic_get_memory_offset),
|
|
|
|
|
2000-02-02 16:49:21 +00:00
|
|
|
{0, 0}
|
|
|
|
};
|
1997-12-02 22:13:59 +00:00
|
|
|
|
2000-02-02 16:49:21 +00:00
|
|
|
static driver_t pcic_pci_driver = {
|
2001-06-04 06:49:46 +00:00
|
|
|
"pcic",
|
2000-02-02 16:49:21 +00:00
|
|
|
pcic_pci_methods,
|
2001-06-04 06:49:46 +00:00
|
|
|
sizeof(struct pcic_softc)
|
2000-02-02 16:49:21 +00:00
|
|
|
};
|
1997-12-02 21:26:41 +00:00
|
|
|
|
2001-06-04 06:49:46 +00:00
|
|
|
DRIVER_MODULE(pcic, pci, pcic_pci_driver, pcic_devclass, 0, 0);
|