Update the pci->pcic compatability module to newbus. This is a simple
conversion to eliminate the compatability shims without making any significant changes. This eliminates the shim warnings. Obtained from: n_himba (tweaked by me, don't blame him for this) Approved by: jkh
This commit is contained in:
parent
fb1fb78a63
commit
872309ccd4
|
@ -32,6 +32,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcireg.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcic_p.h>
|
||||
|
@ -39,81 +40,168 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
static u_long pcic_pci_count = 0;
|
||||
/*
|
||||
* Set up the CL-PD6832 to look like a ISA based PCMCIA chip (a
|
||||
* PD672X). This routine is called once per PCMCIA socket.
|
||||
*/
|
||||
static void
|
||||
pd6832_legacy_init(device_t self)
|
||||
{
|
||||
u_long bcr; /* to set interrupts */
|
||||
u_short io_port; /* the io_port to map this slot on */
|
||||
static int num6832; /* The number of 6832s initialized */
|
||||
int unit;
|
||||
|
||||
static const char *pcic_pci_probe(pcici_t, pcidi_t);
|
||||
static void pcic_pci_attach(pcici_t, int);
|
||||
num6832 = 0;
|
||||
unit = device_get_unit(self);
|
||||
/*
|
||||
* Some BIOS leave the legacy address uninitialized. This
|
||||
* insures that the PD6832 puts itself where the driver will
|
||||
* look. We assume that multiple 6832's should be laid out
|
||||
* sequentially. We only initialize the first socket's legacy port,
|
||||
* the other is a dummy.
|
||||
*/
|
||||
io_port = PCIC_INDEX_0 + num6832 * CLPD6832_NUM_REGS;
|
||||
if (unit == 0)
|
||||
pci_write_config(self, CLPD6832_LEGACY_16BIT_IOADDR,
|
||||
io_port & ~PCI_MAP_IO, 4);
|
||||
|
||||
static void pd6832_legacy_init(pcici_t tag, int unit);
|
||||
/*
|
||||
* I think this should be a call to pci_map_port, but that
|
||||
* routine won't map regiaters above 0x28, and the register we
|
||||
* need to map is 0x44.
|
||||
*/
|
||||
io_port = pci_read_config(self, CLPD6832_LEGACY_16BIT_IOADDR, 4) &
|
||||
~PCI_MAP_IO;
|
||||
|
||||
static struct pci_device pcic_pci_driver = {
|
||||
"pcic-pci",
|
||||
pcic_pci_probe,
|
||||
pcic_pci_attach,
|
||||
&pcic_pci_count,
|
||||
NULL
|
||||
};
|
||||
/*
|
||||
* Configure the first I/O window to contain CLPD6832_NUM_REGS
|
||||
* words and deactivate the second by setting the limit lower
|
||||
* than the base.
|
||||
*/
|
||||
pci_write_config(self, CLPD6832_IO_BASE0, io_port | 1, 4);
|
||||
pci_write_config(self, CLPD6832_IO_LIMIT0,
|
||||
(io_port + CLPD6832_NUM_REGS) | 1, 4);
|
||||
|
||||
COMPAT_PCI_DRIVER(pcic_pci, pcic_pci_driver);
|
||||
pci_write_config(self, CLPD6832_IO_BASE1, (io_port + 0x20) | 1, 4);
|
||||
pci_write_config(self, CLPD6832_IO_LIMIT1, io_port | 1, 4);
|
||||
|
||||
/*
|
||||
* Set default operating mode (I/O port space) and allocate
|
||||
* this socket to the current unit.
|
||||
*/
|
||||
pci_write_config(self, PCI_COMMAND_STATUS_REG,
|
||||
CLPD6832_COMMAND_DEFAULTS, 4);
|
||||
pci_write_config(self, CLPD6832_SOCKET, unit, 4);
|
||||
|
||||
/*
|
||||
* Set up the card inserted/card removed interrupts to come
|
||||
* through the isa IRQ.
|
||||
*/
|
||||
bcr = pci_read_config(self, CLPD6832_BRIDGE_CONTROL, 4);
|
||||
bcr |= (CLPD6832_BCR_ISA_IRQ|CLPD6832_BCR_MGMT_IRQ_ENA);
|
||||
pci_write_config(self, CLPD6832_BRIDGE_CONTROL, bcr, 4);
|
||||
|
||||
/* After initializing 2 sockets, the chip is fully configured */
|
||||
if (unit == 1)
|
||||
num6832++;
|
||||
|
||||
if (bootverbose)
|
||||
printf("CardBus: Legacy PC-card 16bit I/O address [0x%x]\n",
|
||||
io_port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the ID string for the controller if the vendor/product id
|
||||
* matches, NULL otherwise.
|
||||
*/
|
||||
static const char *
|
||||
pcic_pci_probe(pcici_t tag, pcidi_t type)
|
||||
static int
|
||||
pcic_pci_probe(device_t self)
|
||||
{
|
||||
switch (type) {
|
||||
u_int32_t device_id;
|
||||
char *desc;
|
||||
|
||||
device_id = pci_get_devid(self);
|
||||
desc = NULL;
|
||||
|
||||
switch (device_id) {
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6832:
|
||||
return ("Cirrus Logic PD6832 PCI/CardBus Bridge");
|
||||
desc = "Cirrus Logic PD6832 PCI/CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1130:
|
||||
return ("TI PCI-1130 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1130 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1131:
|
||||
return ("TI PCI-1131 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1131 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1220:
|
||||
return ("TI PCI-1220 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1220 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1221:
|
||||
return ("TI PCI-1221 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1221 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1225:
|
||||
return ("TI PCI-1225 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1225 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1250:
|
||||
return ("TI PCI-1250 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1250 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1251:
|
||||
return ("TI PCI-1251 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1251 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1251B:
|
||||
return ("TI PCI-1251B PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1251B PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1410:
|
||||
return ("TI PCI-1410 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1410 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1420:
|
||||
return ("TI PCI-1420 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1420 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1450:
|
||||
return ("TI PCI-1450 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1450 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1451:
|
||||
return ("TI PCI-1451 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1451 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_TOSHIBA_TOPIC95:
|
||||
return ("Toshiba ToPIC95 PCI-CardBus Bridge");
|
||||
desc = "Toshiba ToPIC95 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_TOSHIBA_TOPIC97:
|
||||
return ("Toshiba ToPIC97 PCI-CardBus Bridge");
|
||||
desc = "Toshiba ToPIC97 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C465:
|
||||
return ("Ricoh RL5C465 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C465 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C475:
|
||||
return ("Ricoh RL5C475 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C475 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C476:
|
||||
return ("Ricoh RL5C476 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C476 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C478:
|
||||
return ("Ricoh RL5C478 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C478 PCI-CardBus Bridge";
|
||||
break;
|
||||
/* 16bit PC-card bridges */
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6729:
|
||||
return ("Cirrus Logic PD6729/6730 PC-Card Controller");
|
||||
desc = "Cirrus Logic PD6729/6730 PC-Card Controller";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_OZ6729:
|
||||
return ("O2micro OZ6729 PC-Card Bridge");
|
||||
desc = "O2micro OZ6729 PC-Card Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_OZ6730:
|
||||
return ("O2micro OZ6730 PC-Card Bridge");
|
||||
desc = "O2micro OZ6730 PC-Card Bridge";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (NULL);
|
||||
|
||||
if (desc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(self, desc);
|
||||
return 0; /* exact match */
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,16 +209,14 @@ pcic_pci_probe(pcici_t tag, pcidi_t type)
|
|||
* General PCI based card dispatch routine. Right now
|
||||
* it only understands the CL-PD6832.
|
||||
*/
|
||||
static void
|
||||
pcic_pci_attach(pcici_t config_id, int unit)
|
||||
static int
|
||||
pcic_pci_attach(device_t self)
|
||||
{
|
||||
u_long pcic_type; /* The vendor id of the PCI pcic */
|
||||
u_int32_t device_id = pci_get_devid(self);
|
||||
|
||||
pcic_type = pci_conf_read(config_id, PCI_ID_REG);
|
||||
|
||||
switch (pcic_type) {
|
||||
switch (device_id) {
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6832:
|
||||
pd6832_legacy_init(config_id, unit);
|
||||
pd6832_legacy_init(self);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -143,10 +229,10 @@ pcic_pci_attach(pcici_t config_id, int unit)
|
|||
for (j = 0; j < 0x98; j += 16) {
|
||||
printf("%02x: ", j);
|
||||
for (i = 0; i < 16; i += 4)
|
||||
printf(" %08lx", pci_conf_read(config_id, i+j));
|
||||
printf(" %08x", pci_read_config(self, i+j, 4));
|
||||
printf("\n");
|
||||
}
|
||||
p = (u_char *)pmap_mapdev(pci_conf_read(config_id, 0x10),
|
||||
p = (u_char *)pmap_mapdev(pci_read_config(self, 0x10, 4),
|
||||
0x1000);
|
||||
pl = (u_long *)p;
|
||||
printf("Cardbus Socket registers:\n");
|
||||
|
@ -160,71 +246,28 @@ pcic_pci_attach(pcici_t config_id, int unit)
|
|||
for (i = 0; i < 0x40; i += 16)
|
||||
printf("%02x: %16D\n", i, p + 0x800 + i, " ");
|
||||
}
|
||||
|
||||
return 0; /* no error */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the CL-PD6832 to look like a ISA based PCMCIA chip (a
|
||||
* PD672X). This routine is called once per PCMCIA socket.
|
||||
*/
|
||||
static void
|
||||
pd6832_legacy_init(pcici_t tag, int unit)
|
||||
{
|
||||
u_long bcr; /* to set interrupts */
|
||||
u_short io_port; /* the io_port to map this slot on */
|
||||
static int num6832 = 0; /* The number of 6832s initialized */
|
||||
|
||||
/*
|
||||
* Some BIOS leave the legacy address uninitialized. This
|
||||
* insures that the PD6832 puts itself where the driver will
|
||||
* look. We assume that multiple 6832's should be laid out
|
||||
* sequentially. We only initialize the first socket's legacy port,
|
||||
* the other is a dummy.
|
||||
*/
|
||||
io_port = PCIC_INDEX_0 + num6832 * CLPD6832_NUM_REGS;
|
||||
if (unit == 0)
|
||||
pci_conf_write(tag, CLPD6832_LEGACY_16BIT_IOADDR,
|
||||
io_port & ~PCI_MAP_IO);
|
||||
static device_method_t pcic_pci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pcic_pci_probe),
|
||||
DEVMETHOD(device_attach, pcic_pci_attach),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/*
|
||||
* I think this should be a call to pci_map_port, but that
|
||||
* routine won't map regiaters above 0x28, and the register we
|
||||
* need to map is 0x44.
|
||||
*/
|
||||
io_port = pci_conf_read(tag, CLPD6832_LEGACY_16BIT_IOADDR)
|
||||
& ~PCI_MAP_IO;
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Configure the first I/O window to contain CLPD6832_NUM_REGS
|
||||
* words and deactivate the second by setting the limit lower
|
||||
* than the base.
|
||||
*/
|
||||
pci_conf_write(tag, CLPD6832_IO_BASE0, io_port | 1);
|
||||
pci_conf_write(tag, CLPD6832_IO_LIMIT0,
|
||||
(io_port + CLPD6832_NUM_REGS) | 1);
|
||||
static driver_t pcic_pci_driver = {
|
||||
"pcic-pci",
|
||||
pcic_pci_methods,
|
||||
0 /* no softc */
|
||||
};
|
||||
|
||||
pci_conf_write(tag, CLPD6832_IO_BASE1, (io_port + 0x20) | 1);
|
||||
pci_conf_write(tag, CLPD6832_IO_LIMIT1, io_port | 1 );
|
||||
static devclass_t pcic_pci_devclass;
|
||||
|
||||
/*
|
||||
* Set default operating mode (I/O port space) and allocate
|
||||
* this socket to the current unit.
|
||||
*/
|
||||
pci_conf_write(tag, PCI_COMMAND_STATUS_REG, CLPD6832_COMMAND_DEFAULTS );
|
||||
pci_conf_write(tag, CLPD6832_SOCKET, unit);
|
||||
|
||||
/*
|
||||
* Set up the card inserted/card removed interrupts to come
|
||||
* through the isa IRQ.
|
||||
*/
|
||||
bcr = pci_conf_read(tag, CLPD6832_BRIDGE_CONTROL);
|
||||
bcr |= (CLPD6832_BCR_ISA_IRQ|CLPD6832_BCR_MGMT_IRQ_ENA);
|
||||
pci_conf_write(tag, CLPD6832_BRIDGE_CONTROL, bcr);
|
||||
|
||||
/* After initializing 2 sockets, the chip is fully configured */
|
||||
if (unit == 1)
|
||||
num6832++;
|
||||
|
||||
if (bootverbose)
|
||||
printf("CardBus: Legacy PC-card 16bit I/O address [0x%x]\n",
|
||||
io_port);
|
||||
}
|
||||
DRIVER_MODULE(pcic_pci, pci, pcic_pci_driver, pcic_pci_devclass, 0, 0);
|
||||
|
|
259
sys/pci/pcic_p.c
259
sys/pci/pcic_p.c
|
@ -32,6 +32,7 @@
|
|||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/bus.h>
|
||||
#include <pci/pcireg.h>
|
||||
#include <pci/pcivar.h>
|
||||
#include <pci/pcic_p.h>
|
||||
|
@ -39,81 +40,168 @@
|
|||
#include <vm/vm.h>
|
||||
#include <vm/pmap.h>
|
||||
|
||||
static u_long pcic_pci_count = 0;
|
||||
/*
|
||||
* Set up the CL-PD6832 to look like a ISA based PCMCIA chip (a
|
||||
* PD672X). This routine is called once per PCMCIA socket.
|
||||
*/
|
||||
static void
|
||||
pd6832_legacy_init(device_t self)
|
||||
{
|
||||
u_long bcr; /* to set interrupts */
|
||||
u_short io_port; /* the io_port to map this slot on */
|
||||
static int num6832; /* The number of 6832s initialized */
|
||||
int unit;
|
||||
|
||||
static const char *pcic_pci_probe(pcici_t, pcidi_t);
|
||||
static void pcic_pci_attach(pcici_t, int);
|
||||
num6832 = 0;
|
||||
unit = device_get_unit(self);
|
||||
/*
|
||||
* Some BIOS leave the legacy address uninitialized. This
|
||||
* insures that the PD6832 puts itself where the driver will
|
||||
* look. We assume that multiple 6832's should be laid out
|
||||
* sequentially. We only initialize the first socket's legacy port,
|
||||
* the other is a dummy.
|
||||
*/
|
||||
io_port = PCIC_INDEX_0 + num6832 * CLPD6832_NUM_REGS;
|
||||
if (unit == 0)
|
||||
pci_write_config(self, CLPD6832_LEGACY_16BIT_IOADDR,
|
||||
io_port & ~PCI_MAP_IO, 4);
|
||||
|
||||
static void pd6832_legacy_init(pcici_t tag, int unit);
|
||||
/*
|
||||
* I think this should be a call to pci_map_port, but that
|
||||
* routine won't map regiaters above 0x28, and the register we
|
||||
* need to map is 0x44.
|
||||
*/
|
||||
io_port = pci_read_config(self, CLPD6832_LEGACY_16BIT_IOADDR, 4) &
|
||||
~PCI_MAP_IO;
|
||||
|
||||
static struct pci_device pcic_pci_driver = {
|
||||
"pcic-pci",
|
||||
pcic_pci_probe,
|
||||
pcic_pci_attach,
|
||||
&pcic_pci_count,
|
||||
NULL
|
||||
};
|
||||
/*
|
||||
* Configure the first I/O window to contain CLPD6832_NUM_REGS
|
||||
* words and deactivate the second by setting the limit lower
|
||||
* than the base.
|
||||
*/
|
||||
pci_write_config(self, CLPD6832_IO_BASE0, io_port | 1, 4);
|
||||
pci_write_config(self, CLPD6832_IO_LIMIT0,
|
||||
(io_port + CLPD6832_NUM_REGS) | 1, 4);
|
||||
|
||||
COMPAT_PCI_DRIVER(pcic_pci, pcic_pci_driver);
|
||||
pci_write_config(self, CLPD6832_IO_BASE1, (io_port + 0x20) | 1, 4);
|
||||
pci_write_config(self, CLPD6832_IO_LIMIT1, io_port | 1, 4);
|
||||
|
||||
/*
|
||||
* Set default operating mode (I/O port space) and allocate
|
||||
* this socket to the current unit.
|
||||
*/
|
||||
pci_write_config(self, PCI_COMMAND_STATUS_REG,
|
||||
CLPD6832_COMMAND_DEFAULTS, 4);
|
||||
pci_write_config(self, CLPD6832_SOCKET, unit, 4);
|
||||
|
||||
/*
|
||||
* Set up the card inserted/card removed interrupts to come
|
||||
* through the isa IRQ.
|
||||
*/
|
||||
bcr = pci_read_config(self, CLPD6832_BRIDGE_CONTROL, 4);
|
||||
bcr |= (CLPD6832_BCR_ISA_IRQ|CLPD6832_BCR_MGMT_IRQ_ENA);
|
||||
pci_write_config(self, CLPD6832_BRIDGE_CONTROL, bcr, 4);
|
||||
|
||||
/* After initializing 2 sockets, the chip is fully configured */
|
||||
if (unit == 1)
|
||||
num6832++;
|
||||
|
||||
if (bootverbose)
|
||||
printf("CardBus: Legacy PC-card 16bit I/O address [0x%x]\n",
|
||||
io_port);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the ID string for the controller if the vendor/product id
|
||||
* matches, NULL otherwise.
|
||||
*/
|
||||
static const char *
|
||||
pcic_pci_probe(pcici_t tag, pcidi_t type)
|
||||
static int
|
||||
pcic_pci_probe(device_t self)
|
||||
{
|
||||
switch (type) {
|
||||
u_int32_t device_id;
|
||||
char *desc;
|
||||
|
||||
device_id = pci_get_devid(self);
|
||||
desc = NULL;
|
||||
|
||||
switch (device_id) {
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6832:
|
||||
return ("Cirrus Logic PD6832 PCI/CardBus Bridge");
|
||||
desc = "Cirrus Logic PD6832 PCI/CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1130:
|
||||
return ("TI PCI-1130 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1130 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1131:
|
||||
return ("TI PCI-1131 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1131 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1220:
|
||||
return ("TI PCI-1220 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1220 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1221:
|
||||
return ("TI PCI-1221 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1221 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1225:
|
||||
return ("TI PCI-1225 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1225 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1250:
|
||||
return ("TI PCI-1250 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1250 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1251:
|
||||
return ("TI PCI-1251 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1251 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1251B:
|
||||
return ("TI PCI-1251B PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1251B PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1410:
|
||||
return ("TI PCI-1410 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1410 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1420:
|
||||
return ("TI PCI-1420 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1420 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1450:
|
||||
return ("TI PCI-1450 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1450 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_TI1451:
|
||||
return ("TI PCI-1451 PCI-CardBus Bridge");
|
||||
desc = "TI PCI-1451 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_TOSHIBA_TOPIC95:
|
||||
return ("Toshiba ToPIC95 PCI-CardBus Bridge");
|
||||
desc = "Toshiba ToPIC95 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_TOSHIBA_TOPIC97:
|
||||
return ("Toshiba ToPIC97 PCI-CardBus Bridge");
|
||||
desc = "Toshiba ToPIC97 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C465:
|
||||
return ("Ricoh RL5C465 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C465 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C475:
|
||||
return ("Ricoh RL5C475 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C475 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C476:
|
||||
return ("Ricoh RL5C476 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C476 PCI-CardBus Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_RICOH_RL5C478:
|
||||
return ("Ricoh RL5C478 PCI-CardBus Bridge");
|
||||
desc = "Ricoh RL5C478 PCI-CardBus Bridge";
|
||||
break;
|
||||
/* 16bit PC-card bridges */
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6729:
|
||||
return ("Cirrus Logic PD6729/6730 PC-Card Controller");
|
||||
desc = "Cirrus Logic PD6729/6730 PC-Card Controller";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_OZ6729:
|
||||
return ("O2micro OZ6729 PC-Card Bridge");
|
||||
desc = "O2micro OZ6729 PC-Card Bridge";
|
||||
break;
|
||||
case PCI_DEVICE_ID_PCIC_OZ6730:
|
||||
return ("O2micro OZ6730 PC-Card Bridge");
|
||||
desc = "O2micro OZ6730 PC-Card Bridge";
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return (NULL);
|
||||
|
||||
if (desc == NULL)
|
||||
return (ENXIO);
|
||||
|
||||
device_set_desc(self, desc);
|
||||
return 0; /* exact match */
|
||||
}
|
||||
|
||||
|
||||
|
@ -121,16 +209,14 @@ pcic_pci_probe(pcici_t tag, pcidi_t type)
|
|||
* General PCI based card dispatch routine. Right now
|
||||
* it only understands the CL-PD6832.
|
||||
*/
|
||||
static void
|
||||
pcic_pci_attach(pcici_t config_id, int unit)
|
||||
static int
|
||||
pcic_pci_attach(device_t self)
|
||||
{
|
||||
u_long pcic_type; /* The vendor id of the PCI pcic */
|
||||
u_int32_t device_id = pci_get_devid(self);
|
||||
|
||||
pcic_type = pci_conf_read(config_id, PCI_ID_REG);
|
||||
|
||||
switch (pcic_type) {
|
||||
switch (device_id) {
|
||||
case PCI_DEVICE_ID_PCIC_CLPD6832:
|
||||
pd6832_legacy_init(config_id, unit);
|
||||
pd6832_legacy_init(self);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -143,10 +229,10 @@ pcic_pci_attach(pcici_t config_id, int unit)
|
|||
for (j = 0; j < 0x98; j += 16) {
|
||||
printf("%02x: ", j);
|
||||
for (i = 0; i < 16; i += 4)
|
||||
printf(" %08lx", pci_conf_read(config_id, i+j));
|
||||
printf(" %08x", pci_read_config(self, i+j, 4));
|
||||
printf("\n");
|
||||
}
|
||||
p = (u_char *)pmap_mapdev(pci_conf_read(config_id, 0x10),
|
||||
p = (u_char *)pmap_mapdev(pci_read_config(self, 0x10, 4),
|
||||
0x1000);
|
||||
pl = (u_long *)p;
|
||||
printf("Cardbus Socket registers:\n");
|
||||
|
@ -160,71 +246,28 @@ pcic_pci_attach(pcici_t config_id, int unit)
|
|||
for (i = 0; i < 0x40; i += 16)
|
||||
printf("%02x: %16D\n", i, p + 0x800 + i, " ");
|
||||
}
|
||||
|
||||
return 0; /* no error */
|
||||
}
|
||||
|
||||
/*
|
||||
* Set up the CL-PD6832 to look like a ISA based PCMCIA chip (a
|
||||
* PD672X). This routine is called once per PCMCIA socket.
|
||||
*/
|
||||
static void
|
||||
pd6832_legacy_init(pcici_t tag, int unit)
|
||||
{
|
||||
u_long bcr; /* to set interrupts */
|
||||
u_short io_port; /* the io_port to map this slot on */
|
||||
static int num6832 = 0; /* The number of 6832s initialized */
|
||||
|
||||
/*
|
||||
* Some BIOS leave the legacy address uninitialized. This
|
||||
* insures that the PD6832 puts itself where the driver will
|
||||
* look. We assume that multiple 6832's should be laid out
|
||||
* sequentially. We only initialize the first socket's legacy port,
|
||||
* the other is a dummy.
|
||||
*/
|
||||
io_port = PCIC_INDEX_0 + num6832 * CLPD6832_NUM_REGS;
|
||||
if (unit == 0)
|
||||
pci_conf_write(tag, CLPD6832_LEGACY_16BIT_IOADDR,
|
||||
io_port & ~PCI_MAP_IO);
|
||||
static device_method_t pcic_pci_methods[] = {
|
||||
/* Device interface */
|
||||
DEVMETHOD(device_probe, pcic_pci_probe),
|
||||
DEVMETHOD(device_attach, pcic_pci_attach),
|
||||
DEVMETHOD(device_suspend, bus_generic_suspend),
|
||||
DEVMETHOD(device_resume, bus_generic_resume),
|
||||
DEVMETHOD(device_shutdown, bus_generic_shutdown),
|
||||
|
||||
/*
|
||||
* I think this should be a call to pci_map_port, but that
|
||||
* routine won't map regiaters above 0x28, and the register we
|
||||
* need to map is 0x44.
|
||||
*/
|
||||
io_port = pci_conf_read(tag, CLPD6832_LEGACY_16BIT_IOADDR)
|
||||
& ~PCI_MAP_IO;
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
/*
|
||||
* Configure the first I/O window to contain CLPD6832_NUM_REGS
|
||||
* words and deactivate the second by setting the limit lower
|
||||
* than the base.
|
||||
*/
|
||||
pci_conf_write(tag, CLPD6832_IO_BASE0, io_port | 1);
|
||||
pci_conf_write(tag, CLPD6832_IO_LIMIT0,
|
||||
(io_port + CLPD6832_NUM_REGS) | 1);
|
||||
static driver_t pcic_pci_driver = {
|
||||
"pcic-pci",
|
||||
pcic_pci_methods,
|
||||
0 /* no softc */
|
||||
};
|
||||
|
||||
pci_conf_write(tag, CLPD6832_IO_BASE1, (io_port + 0x20) | 1);
|
||||
pci_conf_write(tag, CLPD6832_IO_LIMIT1, io_port | 1 );
|
||||
static devclass_t pcic_pci_devclass;
|
||||
|
||||
/*
|
||||
* Set default operating mode (I/O port space) and allocate
|
||||
* this socket to the current unit.
|
||||
*/
|
||||
pci_conf_write(tag, PCI_COMMAND_STATUS_REG, CLPD6832_COMMAND_DEFAULTS );
|
||||
pci_conf_write(tag, CLPD6832_SOCKET, unit);
|
||||
|
||||
/*
|
||||
* Set up the card inserted/card removed interrupts to come
|
||||
* through the isa IRQ.
|
||||
*/
|
||||
bcr = pci_conf_read(tag, CLPD6832_BRIDGE_CONTROL);
|
||||
bcr |= (CLPD6832_BCR_ISA_IRQ|CLPD6832_BCR_MGMT_IRQ_ENA);
|
||||
pci_conf_write(tag, CLPD6832_BRIDGE_CONTROL, bcr);
|
||||
|
||||
/* After initializing 2 sockets, the chip is fully configured */
|
||||
if (unit == 1)
|
||||
num6832++;
|
||||
|
||||
if (bootverbose)
|
||||
printf("CardBus: Legacy PC-card 16bit I/O address [0x%x]\n",
|
||||
io_port);
|
||||
}
|
||||
DRIVER_MODULE(pcic_pci, pci, pcic_pci_driver, pcic_pci_devclass, 0, 0);
|
||||
|
|
Loading…
Reference in New Issue