diff options
author | phk <phk@FreeBSD.org> | 2002-08-31 20:29:46 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2002-08-31 20:29:46 +0000 |
commit | 1ea87921ab8efdb2116f71d355937ce82a869383 (patch) | |
tree | 85e5d2f0293d6573f7ed1ff20f25c501cffd582e /sys/dev/puc | |
parent | ed521becb9f136ee250b6a0301bc5921b3102913 (diff) | |
download | FreeBSD-src-1ea87921ab8efdb2116f71d355937ce82a869383.zip FreeBSD-src-1ea87921ab8efdb2116f71d355937ce82a869383.tar.gz |
More cleaning up and unhacking:
Don't expect all RIDs to be PCI rids. The previous code made at
least 1 mistake, even for PCI.
Give the card definitions a chance to specify a init function.
Use this instead of the gross superio hack.
Move the win877 init function to puc_pci.c where it belongs.
RIDs can actually be zero, don't set badmuxed if so.
Set a less incorrect end for the construct SYS_RES_IOPORT entries,
I guess both sio and lpt happen to use 8 IO ports, but that shouldn't
really be hardcoded this way.
Fixup puc_pccard.c to match.
We're getting closer.
Diffstat (limited to 'sys/dev/puc')
-rw-r--r-- | sys/dev/puc/puc.c | 181 | ||||
-rw-r--r-- | sys/dev/puc/puc_pccard.c | 10 | ||||
-rw-r--r-- | sys/dev/puc/puc_pci.c | 126 | ||||
-rw-r--r-- | sys/dev/puc/pucdata.c | 76 | ||||
-rw-r--r-- | sys/dev/puc/pucvar.h | 8 |
5 files changed, 249 insertions, 152 deletions
diff --git a/sys/dev/puc/puc.c b/sys/dev/puc/puc.c index 672abda..5f4cfc0 100644 --- a/sys/dev/puc/puc.c +++ b/sys/dev/puc/puc.c @@ -108,15 +108,27 @@ struct puc_device { static void puc_intr(void *arg); -static void puc_config_superio(device_t); -static void puc_config_win877(struct resource *); static int puc_find_free_unit(char *); #ifdef PUC_DEBUG -static void puc_print_win877(bus_space_tag_t, bus_space_handle_t, u_int, - u_int); static void puc_print_resource_list(struct resource_list *); #endif +static int +puc_port_bar_index(struct puc_softc *sc, int bar) +{ + int i; + + for (i = 0; i < PUC_MAX_BAR; i += 1) { + if (!sc->sc_bar_mappings[i].used) + break; + if (sc->sc_bar_mappings[i].bar == bar) + return (i); + } + sc->sc_bar_mappings[i].bar = bar; + sc->sc_bar_mappings[i].used = 1; + return (i); +} + int puc_attach(device_t dev, const struct puc_device_description *desc) { @@ -130,7 +142,6 @@ puc_attach(device_t dev, const struct puc_device_description *desc) sc = (struct puc_softc *)device_get_softc(dev); bzero(sc, sizeof(*sc)); sc->sc_desc = desc; - if (sc->sc_desc == NULL) return (ENXIO); @@ -161,10 +172,10 @@ puc_attach(device_t dev, const struct puc_device_description *desc) rid = 0; for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { - if (rid == sc->sc_desc->ports[i].bar) + if (i > 0 && rid == sc->sc_desc->ports[i].bar) sc->barmuxed = 1; rid = sc->sc_desc->ports[i].bar; - bidx = PUC_PORT_BAR_INDEX(rid); + bidx = puc_port_bar_index(sc, rid); if (sc->sc_bar_mappings[bidx].res != NULL) continue; @@ -176,17 +187,21 @@ puc_attach(device_t dev, const struct puc_device_description *desc) } sc->sc_bar_mappings[bidx].res = res; #ifdef PUC_DEBUG - printf("port bst %x, start %x, end %x\n", + printf("port rid %d bst %x, start %x, end %x\n", rid, (u_int)rman_get_bustag(res), (u_int)rman_get_start(res), (u_int)rman_get_end(res)); #endif } - puc_config_superio(dev); + if (desc->init != NULL) { + i = desc->init(sc); + if (i != 0) + return (i); + } for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { rid = sc->sc_desc->ports[i].bar; - bidx = PUC_PORT_BAR_INDEX(rid); + bidx = puc_port_bar_index(sc, rid); if (sc->sc_bar_mappings[bidx].res == NULL) continue; @@ -214,7 +229,7 @@ puc_attach(device_t dev, const struct puc_device_description *desc) res = sc->sc_bar_mappings[bidx].res; resource_list_add(&pdev->resources, SYS_RES_IOPORT, 0, rman_get_start(res) + sc->sc_desc->ports[i].offset, - rman_get_end(res) + sc->sc_desc->ports[i].offset + 8 - 1, + rman_get_start(res) + sc->sc_desc->ports[i].offset + 8 - 1, 8); rle = resource_list_find(&pdev->resources, SYS_RES_IOPORT, 0); @@ -293,6 +308,7 @@ puc_intr(void *arg) int i; struct puc_softc *sc; +printf("puc_intr\n"); sc = (struct puc_softc *)arg; for (i = 0; i < PUC_MAX_PORTS; i++) if (sc->sc_ports[i].ihand != NULL) @@ -320,142 +336,6 @@ puc_find_description(uint32_t vend, uint32_t prod, uint32_t svend, return (NULL); } - -/* - * It might be possible to make these more generic if we can detect patterns. - * For instance maybe if the size of a bar is 0x400 (the old isa space) it - * might contain one or more superio chips. - */ -static void -puc_config_superio(device_t dev) -{ - struct puc_softc *sc = (struct puc_softc *)device_get_softc(dev); - - if (sc->sc_desc->rval[PUC_REG_VEND] == 0x1592 && - sc->sc_desc->rval[PUC_REG_PROD] == 0x0781) - puc_config_win877(sc->sc_bar_mappings[0].res); -} - -#define rdspio(indx) (bus_space_write_1(bst, bsh, efir, indx), \ - bus_space_read_1(bst, bsh, efdr)) -#define wrspio(indx,data) (bus_space_write_1(bst, bsh, efir, indx), \ - bus_space_write_1(bst, bsh, efdr, data)) - -#ifdef PUC_DEBUG -static void -puc_print_win877(bus_space_tag_t bst, bus_space_handle_t bsh, u_int efir, - u_int efdr) -{ - u_char cr00, cr01, cr04, cr09, cr0d, cr14, cr15, cr16, cr17; - u_char cr18, cr19, cr24, cr25, cr28, cr2c, cr31, cr32; - - cr00 = rdspio(0x00); - cr01 = rdspio(0x01); - cr04 = rdspio(0x04); - cr09 = rdspio(0x09); - cr0d = rdspio(0x0d); - cr14 = rdspio(0x14); - cr15 = rdspio(0x15); - cr16 = rdspio(0x16); - cr17 = rdspio(0x17); - cr18 = rdspio(0x18); - cr19 = rdspio(0x19); - cr24 = rdspio(0x24); - cr25 = rdspio(0x25); - cr28 = rdspio(0x28); - cr2c = rdspio(0x2c); - cr31 = rdspio(0x31); - cr32 = rdspio(0x32); - printf("877T: cr00 %x, cr01 %x, cr04 %x, cr09 %x, cr0d %x, cr14 %x, " - "cr15 %x, cr16 %x, cr17 %x, cr18 %x, cr19 %x, cr24 %x, cr25 %x, " - "cr28 %x, cr2c %x, cr31 %x, cr32 %x\n", cr00, cr01, cr04, cr09, - cr0d, cr14, cr15, cr16, cr17, - cr18, cr19, cr24, cr25, cr28, cr2c, cr31, cr32); -} -#endif - -static void -puc_config_win877(struct resource *res) -{ - u_char val; - u_int efir, efdr; - bus_space_tag_t bst; - bus_space_handle_t bsh; - - bst = rman_get_bustag(res); - bsh = rman_get_bushandle(res); - - /* configure the first W83877TF */ - bus_space_write_1(bst, bsh, 0x250, 0x89); - efir = 0x251; - efdr = 0x252; - val = rdspio(0x09) & 0x0f; - if (val != 0x0c) { - printf("conf_win877: Oops not a W83877TF\n"); - return; - } - -#ifdef PUC_DEBUG - printf("before: "); - puc_print_win877(bst, bsh, efir, efdr); -#endif - - val = rdspio(0x16); - val |= 0x04; - wrspio(0x16, val); - val &= ~0x04; - wrspio(0x16, val); - - wrspio(0x24, 0x2e8 >> 2); - wrspio(0x25, 0x2f8 >> 2); - wrspio(0x17, 0x03); - wrspio(0x28, 0x43); - -#ifdef PUC_DEBUG - printf("after: "); - puc_print_win877(bst, bsh, efir, efdr); -#endif - - bus_space_write_1(bst, bsh, 0x250, 0xaa); - - /* configure the second W83877TF */ - bus_space_write_1(bst, bsh, 0x3f0, 0x87); - bus_space_write_1(bst, bsh, 0x3f0, 0x87); - efir = 0x3f0; - efdr = 0x3f1; - val = rdspio(0x09) & 0x0f; - if (val != 0x0c) { - printf("conf_win877: Oops not a W83877TF\n"); - return; - } - -#ifdef PUC_DEBUG - printf("before: "); - puc_print_win877(bst, bsh, efir, efdr); -#endif - - val = rdspio(0x16); - val |= 0x04; - wrspio(0x16, val); - val &= ~0x04; - wrspio(0x16, val); - - wrspio(0x24, 0x3e8 >> 2); - wrspio(0x25, 0x3f8 >> 2); - wrspio(0x17, 0x03); - wrspio(0x28, 0x43); - -#ifdef PUC_DEBUG - printf("after: "); - puc_print_win877(bst, bsh, efir, efdr); -#endif - - bus_space_write_1(bst, bsh, 0x3f0, 0xaa); -} - -#undef rdspio -#undef wrspio - static int puc_find_free_unit(char *name) { devclass_t dc; @@ -482,12 +362,15 @@ static int puc_find_free_unit(char *name) static void puc_print_resource_list(struct resource_list *rl) { +#if 0 struct resource_list_entry *rle; printf("print_resource_list: rl %p\n", rl); SLIST_FOREACH(rle, rl, link) - printf("type %x, rid %x\n", rle->type, rle->rid); + printf(" type %x, rid %x start %x end %x count %x\n", + rle->type, rle->rid, rle->start, rle->end, rle->count); printf("print_resource_list: end.\n"); +#endif } #endif @@ -572,6 +455,7 @@ puc_setup_intr(device_t dev, device_t child, struct resource *r, int flags, int i; struct puc_softc *sc; +printf("puc_setup_intr()\n"); sc = (struct puc_softc *)device_get_softc(dev); for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { if (sc->sc_ports[i].dev == child) { @@ -593,6 +477,7 @@ puc_teardown_intr(device_t dev, device_t child, struct resource *r, int i; struct puc_softc *sc; +printf("puc_teardown_intr()\n"); sc = (struct puc_softc *)device_get_softc(dev); for (i = 0; PUC_PORT_VALID(sc->sc_desc, i); i++) { if (sc->sc_ports[i].dev == child) { diff --git a/sys/dev/puc/puc_pccard.c b/sys/dev/puc/puc_pccard.c index ede1a76..c9ff1fc 100644 --- a/sys/dev/puc/puc_pccard.c +++ b/sys/dev/puc/puc_pccard.c @@ -39,6 +39,7 @@ #define PUC_ENTRAILS 1 #include <dev/puc/pucvar.h> +#include <dev/sio/sioreg.h> #include <dev/pccard/pccardvar.h> #include <opt_puc.h> @@ -46,11 +47,12 @@ const struct puc_device_description rscom_devices = { "RS-com 2 port", + NULL, { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, { - { PUC_PORT_TYPE_COM, 0x0, 0x00, 0 }, - { PUC_PORT_TYPE_COM, 0x1, 0x00, 0 }, + { PUC_PORT_TYPE_COM, 0x0, 0x00, DEFAULT_RCLK }, + { PUC_PORT_TYPE_COM, 0x1, 0x00, DEFAULT_RCLK }, } }; @@ -68,8 +70,10 @@ puc_pccard_probe(device_t dev) if (error) return(error); printf("puc_pccard_probe <%s><%s>\n", vendor, product); - if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) + if (!strcmp(vendor, "PCMCIA") && !strcmp(product, "RS-COM 2P")) { + device_set_desc(dev, rscom_devices.name); return (0); + } return (ENXIO); } diff --git a/sys/dev/puc/puc_pci.c b/sys/dev/puc/puc_pci.c index d822aed..4ea9382 100644 --- a/sys/dev/puc/puc_pci.c +++ b/sys/dev/puc/puc_pci.c @@ -136,3 +136,129 @@ static driver_t puc_pci_driver = { DRIVER_MODULE(puc, pci, puc_pci_driver, puc_devclass, 0, 0); DRIVER_MODULE(puc, cardbus, puc_pci_driver, puc_devclass, 0, 0); + + +#define rdspio(indx) (bus_space_write_1(bst, bsh, efir, indx), \ + bus_space_read_1(bst, bsh, efdr)) +#define wrspio(indx,data) (bus_space_write_1(bst, bsh, efir, indx), \ + bus_space_write_1(bst, bsh, efdr, data)) + +#ifdef PUC_DEBUG +static void +puc_print_win877(bus_space_tag_t bst, bus_space_handle_t bsh, u_int efir, + u_int efdr) +{ + u_char cr00, cr01, cr04, cr09, cr0d, cr14, cr15, cr16, cr17; + u_char cr18, cr19, cr24, cr25, cr28, cr2c, cr31, cr32; + + cr00 = rdspio(0x00); + cr01 = rdspio(0x01); + cr04 = rdspio(0x04); + cr09 = rdspio(0x09); + cr0d = rdspio(0x0d); + cr14 = rdspio(0x14); + cr15 = rdspio(0x15); + cr16 = rdspio(0x16); + cr17 = rdspio(0x17); + cr18 = rdspio(0x18); + cr19 = rdspio(0x19); + cr24 = rdspio(0x24); + cr25 = rdspio(0x25); + cr28 = rdspio(0x28); + cr2c = rdspio(0x2c); + cr31 = rdspio(0x31); + cr32 = rdspio(0x32); + printf("877T: cr00 %x, cr01 %x, cr04 %x, cr09 %x, cr0d %x, cr14 %x, " + "cr15 %x, cr16 %x, cr17 %x, cr18 %x, cr19 %x, cr24 %x, cr25 %x, " + "cr28 %x, cr2c %x, cr31 %x, cr32 %x\n", cr00, cr01, cr04, cr09, + cr0d, cr14, cr15, cr16, cr17, + cr18, cr19, cr24, cr25, cr28, cr2c, cr31, cr32); +} +#endif + +int +puc_config_win877(struct puc_softc *sc) +{ + u_char val; + u_int efir, efdr; + bus_space_tag_t bst; + bus_space_handle_t bsh; + struct resource *res; + + res = sc->sc_bar_mappings[0].res; + + bst = rman_get_bustag(res); + bsh = rman_get_bushandle(res); + + /* configure the first W83877TF */ + bus_space_write_1(bst, bsh, 0x250, 0x89); + efir = 0x251; + efdr = 0x252; + val = rdspio(0x09) & 0x0f; + if (val != 0x0c) { + printf("conf_win877: Oops not a W83877TF\n"); + return (ENXIO); + } + +#ifdef PUC_DEBUG + printf("before: "); + puc_print_win877(bst, bsh, efir, efdr); +#endif + + val = rdspio(0x16); + val |= 0x04; + wrspio(0x16, val); + val &= ~0x04; + wrspio(0x16, val); + + wrspio(0x24, 0x2e8 >> 2); + wrspio(0x25, 0x2f8 >> 2); + wrspio(0x17, 0x03); + wrspio(0x28, 0x43); + +#ifdef PUC_DEBUG + printf("after: "); + puc_print_win877(bst, bsh, efir, efdr); +#endif + + bus_space_write_1(bst, bsh, 0x250, 0xaa); + + /* configure the second W83877TF */ + bus_space_write_1(bst, bsh, 0x3f0, 0x87); + bus_space_write_1(bst, bsh, 0x3f0, 0x87); + efir = 0x3f0; + efdr = 0x3f1; + val = rdspio(0x09) & 0x0f; + if (val != 0x0c) { + printf("conf_win877: Oops not a W83877TF\n"); + return(ENXIO); + } + +#ifdef PUC_DEBUG + printf("before: "); + puc_print_win877(bst, bsh, efir, efdr); +#endif + + val = rdspio(0x16); + val |= 0x04; + wrspio(0x16, val); + val &= ~0x04; + wrspio(0x16, val); + + wrspio(0x24, 0x3e8 >> 2); + wrspio(0x25, 0x3f8 >> 2); + wrspio(0x17, 0x03); + wrspio(0x28, 0x43); + +#ifdef PUC_DEBUG + printf("after: "); + puc_print_win877(bst, bsh, efir, efdr); +#endif + + bus_space_write_1(bst, bsh, 0x3f0, 0xaa); + return (0); +} + +#undef rdspio +#undef wrspio + diff --git a/sys/dev/puc/pucdata.c b/sys/dev/puc/pucdata.c index 2547d5a..47240e1 100644 --- a/sys/dev/puc/pucdata.c +++ b/sys/dev/puc/pucdata.c @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); const struct puc_device_description puc_devices[] = { { "Comtrol RocketPort 550/4 RJ45", + NULL, { 0x11fe, 0x8014, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -61,6 +62,7 @@ const struct puc_device_description puc_devices[] = { }, { "Comtrol RocketPort 550/Quad", + NULL, { 0x11fe, 0x8015, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -72,6 +74,7 @@ const struct puc_device_description puc_devices[] = { }, { "Comtrol RocketPort 550/8 RJ11 part A", + NULL, { 0x11fe, 0x8010, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -82,6 +85,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Comtrol RocketPort 550/8 RJ11 part B", + NULL, { 0x11fe, 0x8011, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -93,6 +97,7 @@ const struct puc_device_description puc_devices[] = { }, { "Comtrol RocketPort 550/8 Octa part A", + NULL, { 0x11fe, 0x8012, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -103,6 +108,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Comtrol RocketPort 550/8 Octa part B", + NULL, { 0x11fe, 0x8013, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -114,6 +120,7 @@ const struct puc_device_description puc_devices[] = { }, { "Comtrol RocketPort 550/8 part A", + NULL, { 0x11fe, 0x8018, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -124,6 +131,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Comtrol RocketPort 550/8 part B", + NULL, { 0x11fe, 0x8019, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -135,6 +143,7 @@ const struct puc_device_description puc_devices[] = { }, { "Comtrol RocketPort 550/16 part A", + NULL, { 0x11fe, 0x8016, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -145,6 +154,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Comtrol RocketPort 550/16 part B", + NULL, { 0x11fe, 0x8017, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -175,6 +185,7 @@ const struct puc_device_description puc_devices[] = { * network/misc (0x02/0x80) device. */ { "Dolphin Peripherals 4014", + NULL, { 0x10b5, 0x9050, 0xd84d, 0x6810 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -195,6 +206,7 @@ const struct puc_device_description puc_devices[] = { * network/misc (0x02/0x80) device. */ { "Dolphin Peripherals 4035", + NULL, { 0x10b5, 0x9050, 0xd84d, 0x6808 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -208,6 +220,7 @@ const struct puc_device_description puc_devices[] = { * (Dolpin 4025 has the same ID but only one port) */ { "Dolphin Peripherals 4036", + NULL, { 0x1409, 0x7168, 0x0, 0x0 }, { 0xffff, 0xffff, 0x0, 0x0 }, { @@ -238,6 +251,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C550 (10x family): 1S */ { "SIIG Cyber Serial PCI 16C550 (10x family)", + NULL, { 0x131f, 0x1000, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -247,6 +261,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C650 (10x family): 1S */ { "SIIG Cyber Serial PCI 16C650 (10x family)", + NULL, { 0x131f, 0x1001, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -256,6 +271,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C850 (10x family): 1S */ { "SIIG Cyber Serial PCI 16C850 (10x family)", + NULL, { 0x131f, 0x1002, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -265,6 +281,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C550 (10x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C550 (10x family)", + NULL, { 0x131f, 0x1010, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -275,6 +292,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C650 (10x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C650 (10x family)", + NULL, { 0x131f, 0x1011, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -285,6 +303,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C850 (10x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C850 (10x family)", + NULL, { 0x131f, 0x1012, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -295,6 +314,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Parallel PCI (10x family): 1P */ { "SIIG Cyber Parallel PCI (10x family)", + NULL, { 0x131f, 0x1020, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -304,6 +324,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Parallel Dual PCI (10x family): 2P */ { "SIIG Cyber Parallel Dual PCI (10x family)", + NULL, { 0x131f, 0x1021, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -314,6 +335,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C550 (10x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C550 (10x family)", + NULL, { 0x131f, 0x1030, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -324,6 +346,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C650 (10x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C650 (10x family)", + NULL, { 0x131f, 0x1031, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -334,6 +357,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C850 (10x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C850 (10x family)", + NULL, { 0x131f, 0x1032, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -344,6 +368,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C550 (10x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C550 (10x family)", + NULL, { 0x131f, 0x1034, 0, 0 }, /* XXX really? */ { 0xffff, 0xffff, 0, 0 }, { @@ -355,6 +380,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C650 (10x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C650 (10x family)", + NULL, { 0x131f, 0x1035, 0, 0 }, /* XXX really? */ { 0xffff, 0xffff, 0, 0 }, { @@ -366,6 +392,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C850 (10x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C850 (10x family)", + NULL, { 0x131f, 0x1036, 0, 0 }, /* XXX really? */ { 0xffff, 0xffff, 0, 0 }, { @@ -377,6 +404,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C550 (10x family): 4S */ { "SIIG Cyber 4S PCI 16C550 (10x family)", + NULL, { 0x131f, 0x1050, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -389,6 +417,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C650 (10x family): 4S */ { "SIIG Cyber 4S PCI 16C650 (10x family)", + NULL, { 0x131f, 0x1051, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -401,6 +430,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C850 (10x family): 4S */ { "SIIG Cyber 4S PCI 16C850 (10x family)", + NULL, { 0x131f, 0x1052, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -417,6 +447,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Parallel PCI (20x family): 1P */ { "SIIG Cyber Parallel PCI (20x family)", + NULL, { 0x131f, 0x2020, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -426,6 +457,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Parallel Dual PCI (20x family): 2P */ { "SIIG Cyber Parallel Dual PCI (20x family)", + NULL, { 0x131f, 0x2021, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -436,6 +468,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2P1S PCI 16C550 (20x family): 1S, 2P */ { "SIIG Cyber 2P1S PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2040, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -447,6 +480,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2P1S PCI 16C650 (20x family): 1S, 2P */ { "SIIG Cyber 2P1S PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2041, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -458,6 +492,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2P1S PCI 16C850 (20x family): 1S, 2P */ { "SIIG Cyber 2P1S PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2042, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -469,6 +504,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C550 (20x family): 1S */ { "SIIG Cyber Serial PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2000, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -478,6 +514,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C650 (20x family): 1S */ { "SIIG Cyber Serial PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2001, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -487,6 +524,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial PCI 16C850 (20x family): 1S */ { "SIIG Cyber Serial PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2002, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -496,6 +534,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C550 (20x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2010, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -506,6 +545,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C650 (20x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2011, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -516,6 +556,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber I/O PCI 16C850 (20x family): 1S, 1P */ { "SIIG Cyber I/O PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2012, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -526,6 +567,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C550 (20x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2030, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -536,6 +578,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C650 (20x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2031, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -546,6 +589,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber Serial Dual PCI 16C850 (20x family): 2S */ { "SIIG Cyber Serial Dual PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2032, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -556,6 +600,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C550 (20x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2060, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -567,6 +612,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C650 (20x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2061, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -578,6 +624,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 2S1P PCI 16C850 (20x family): 2S, 1P */ { "SIIG Cyber 2S1P PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2062, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -589,6 +636,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C550 (20x family): 4S */ { "SIIG Cyber 4S PCI 16C550 (20x family)", + NULL, { 0x131f, 0x2050, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -601,6 +649,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C650 (20x family): 4S */ { "SIIG Cyber 4S PCI 16C650 (20x family)", + NULL, { 0x131f, 0x2051, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -613,6 +662,7 @@ const struct puc_device_description puc_devices[] = { /* SIIG Cyber 4S PCI 16C850 (20x family): 4S */ { "SIIG Cyber 4S PCI 16C850 (20x family)", + NULL, { 0x131f, 0x2052, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -625,6 +675,7 @@ const struct puc_device_description puc_devices[] = { /* VScom PCI-200L: 2S */ { "VScom PCI-200L", + NULL, { 0x14d2, 0x8020, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -635,6 +686,7 @@ const struct puc_device_description puc_devices[] = { /* VScom PCI-400: 4S */ { "VScom PCI-400", + NULL, { 0x10b5, 0x1077, 0x10b5, 0x1077 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -647,6 +699,7 @@ const struct puc_device_description puc_devices[] = { /* VScom PCI-800: 8S */ { "VScom PCI-800", + NULL, { 0x10b5, 0x1076, 0x10b5, 0x1076 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -666,6 +719,7 @@ const struct puc_device_description puc_devices[] = { * device ID 3 and PCI device 1 device ID 4. */ { "Titan PCI-800H", + NULL, { 0x14d2, 0xa003, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -676,6 +730,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Titan PCI-800H", + NULL, { 0x14d2, 0xa004, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -686,6 +741,7 @@ const struct puc_device_description puc_devices[] = { }, }, { "Titan PCI-200H", + NULL, { 0x14d2, 0xa005, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -697,6 +753,7 @@ const struct puc_device_description puc_devices[] = { /* NEC PK-UG-X001 K56flex PCI Modem card. NEC MARTH bridge chip and Rockwell RCVDL56ACF/SP using. */ { "NEC PK-UG-X001 K56flex PCI Modem", + NULL, { 0x1033, 0x0074, 0x1033, 0x8014 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -706,6 +763,7 @@ const struct puc_device_description puc_devices[] = { /* NEC PK-UG-X008 */ { "NEC PK-UG-X008", + NULL, { 0x1033, 0x007d, 0x1033, 0x8012 }, { 0xffff, 0xffff, 0xffff, 0xffff }, { @@ -715,6 +773,7 @@ const struct puc_device_description puc_devices[] = { /* Lava Computers 2SP-PCI */ { "Lava Computers 2SP-PCI parallel port", + NULL, { 0x1407, 0x8000, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -724,6 +783,7 @@ const struct puc_device_description puc_devices[] = { /* Lava Computers 2SP-PCI and Quattro-PCI serial ports */ { "Lava Computers dual serial port", + NULL, { 0x1407, 0x0100, 0, 0 }, { 0xffff, 0xfffc, 0, 0 }, { @@ -734,6 +794,7 @@ const struct puc_device_description puc_devices[] = { /* Lava Computers newer Quattro-PCI serial ports */ { "Lava Computers Quattro-PCI serial port", + NULL, { 0x1407, 0x0120, 0, 0 }, { 0xffff, 0xfffc, 0, 0 }, { @@ -744,6 +805,7 @@ const struct puc_device_description puc_devices[] = { /* Lava Computers DSerial PCI serial ports */ { "Lava Computers serial port", + NULL, { 0x1407, 0x0110, 0, 0 }, { 0xffff, 0xfffc, 0, 0 }, { @@ -753,6 +815,7 @@ const struct puc_device_description puc_devices[] = { /* Lava Computers Octopus-550 serial ports */ { "Lava Computers Octopus-550 8-port serial", + NULL, { 0x1407, 0x0180, 0, 0 }, { 0xffff, 0xfffc, 0, 0 }, { @@ -765,6 +828,7 @@ const struct puc_device_description puc_devices[] = { /* US Robotics (3Com) PCI Modems */ { "US Robotics (3Com) 3CP5609 PCI 16550 Modem", + NULL, { 0x12b9, 0x1008, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -774,6 +838,7 @@ const struct puc_device_description puc_devices[] = { /* Actiontec 56K PCI Master */ { "Actiontec 56K PCI Master", + NULL, { 0x11c1, 0x0480, 0x0, 0x0 }, { 0xffff, 0xffff, 0x0, 0x0 }, { @@ -793,6 +858,7 @@ const struct puc_device_description puc_devices[] = { /* Oxford Semiconductor OX16PCI954 PCI UARTs */ { "Qxford Semiconductor OX16PCI954 UARTs", + NULL, { 0x1415, 0x9501, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -805,6 +871,7 @@ const struct puc_device_description puc_devices[] = { /* Oxford Semiconductor OX16PCI954 PCI Parallel port */ { "Qxford Semiconductor OX16PCI954 Parallel port", + NULL, { 0x1415, 0x9513, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -814,6 +881,7 @@ const struct puc_device_description puc_devices[] = { /* NetMos 2S1P PCI 16C650 : 2S, 1P */ { "NetMos NM9835 Dual UART and 1284 Printer port", + NULL, { 0x9710, 0x9835, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -828,6 +896,7 @@ const struct puc_device_description puc_devices[] = { * uses a PCI interface implemented in FPGA. */ { "Middle Digital, Inc. Weasel serial port", + NULL, { 0xdeaf, 0x9051, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -837,6 +906,7 @@ const struct puc_device_description puc_devices[] = { /* SD-LAB PCI I/O Card 4S2P */ { "Syba Tech Ltd. PCI-4S2P-550-ECP", + puc_config_win877, { 0x1592, 0x0781, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -851,6 +921,7 @@ const struct puc_device_description puc_devices[] = { /* Moxa Technologies Co., Ltd. PCI I/O Card 4S RS232/422/485 */ { "Moxa Technologies, Industio CP-114", + NULL, { 0x1393, 0x1141, 0, 0 }, { 0xffff, 0xffff, 0, 0, }, { @@ -863,6 +934,7 @@ const struct puc_device_description puc_devices[] = { /* Moxa Technologies Co., Ltd. PCI I/O Card 8S RS232 */ { "Moxa Technologies, C168H/PCI", + NULL, { 0x1393, 0x1680, 0, 0 }, { 0xffff, 0xffff, 0, 0, }, { @@ -878,6 +950,7 @@ const struct puc_device_description puc_devices[] = { }, { "Avlab Technology, PCI IO 2S", + NULL, { 0x14db, 0x2130, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -888,6 +961,7 @@ const struct puc_device_description puc_devices[] = { /* Avlab Technology, Inc. Low Profile PCI 4 Serial: 4S */ { "Avlab Low Profile PCI 4 Serial", + NULL, { 0x14db, 0x2150, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -900,6 +974,7 @@ const struct puc_device_description puc_devices[] = { /* Decision Computer Inc, serial ports */ { "Decision Computer Inc, PCCOM 4-port serial", + NULL, { 0x6666, 0x0001, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { @@ -911,6 +986,7 @@ const struct puc_device_description puc_devices[] = { }, { "PCCOM dual port RS232/422/485", + NULL, { 0x6666, 0x0004, 0, 0 }, { 0xffff, 0xffff, 0, 0 }, { diff --git a/sys/dev/puc/pucvar.h b/sys/dev/puc/pucvar.h index 441bb09..e5a082d 100644 --- a/sys/dev/puc/pucvar.h +++ b/sys/dev/puc/pucvar.h @@ -66,8 +66,11 @@ #define PUC_MAX_PORTS 12 +struct puc_softc; +typedef int puc_init_t(struct puc_softc *sc); struct puc_device_description { const char *name; + puc_init_t *init; uint32_t rval[4]; uint32_t rmask[4]; struct { @@ -89,7 +92,6 @@ struct puc_device_description { #define PUC_PORT_VALID(desc, port) \ ((port) < PUC_MAX_PORTS && (desc)->ports[(port)].type != PUC_PORT_TYPE_NONE) -#define PUC_PORT_BAR_INDEX(bar) (((bar) - PCIR_MAPS) / 4) #define PUC_MAX_BAR 6 @@ -122,6 +124,8 @@ struct puc_softc { void *intr_cookie; struct { + int used; + int bar; struct resource *res; } sc_bar_mappings[PUC_MAX_BAR]; @@ -135,4 +139,6 @@ struct puc_softc { }; #endif /* PUC_ENTRAILS */ + +int puc_config_win877(struct puc_softc *); extern const struct puc_device_description puc_devices[]; |