diff -urN ../../src-6/sys/dev/si/si.c dev/si/si.c --- ../../src-6/sys/dev/si/si.c Wed Jan 5 20:43:13 2005 +++ dev/si/si.c Fri Nov 18 14:56:36 2005 @@ -113,10 +113,12 @@ static int si_Nports; static int si_Nmodules; -static int si_debug = 0; /* data, not bss, so it's patchable */ +#ifdef SI_DEBUG +static int si_debug = DBG_ALL & ~DBG_POLL; /* data, not bss, so it's patchable */ SYSCTL_INT(_machdep, OID_AUTO, si_debug, CTLFLAG_RW, &si_debug, 0, ""); TUNABLE_INT("machdep.si_debug", &si_debug); +#endif static int si_numunits; @@ -190,6 +192,7 @@ "SIPCI", "SXPCI", "SXISA", + "SX+", }; /* @@ -271,6 +274,9 @@ sc->sc_ports = NULL; /* mark as uninitialised */ + printf("si%d: maddr offset: %p\n", unit, + (char *)(sc->sc_maddr - sc->sc_baddr)); + maddr = sc->sc_maddr; /* Stop the CPU first so it won't stomp around while we load */ @@ -282,9 +288,23 @@ case SIPCI: *(maddr+SIPCIRESET) = 0; break; + case SIJETCF: case SIJETPCI: /* fall through to JET ISA */ case SIJETISA: *(maddr+SIJETCONFIG) = 0; + *(maddr+SIJETRESET) = 0; + + /* Give the CPU a second to shut down. */ + y = 0; + while (*(maddr+SIJETRESET) & 1) { + y++; + if (y == 10) { + printf("si%d: unable to stop CPU\n", + unit); + return ENXIO; + } + DELAY(100000); + } break; case SIHOST2: *(maddr+SIPLRESET) = 0; @@ -300,7 +320,12 @@ /* OK, now lets download the download code */ - if (SI_ISJET(sc->sc_type)) { + if (sc->sc_type == SIJETCF) { + DPRINT((0, DBG_DOWNLOAD, "si%d: jetcf_download: nbytes %d\n", + unit, si4_cf_dsize)); + si_bcopy(si4_cf_download, sc->sc_baddr + si4_cf_downloadaddr, + si4_cf_dsize); + } else if (SI_ISJET(sc->sc_type)) { DPRINT((0, DBG_DOWNLOAD, "si%d: jet_download: nbytes %d\n", unit, si3_t225_dsize)); si_bcopy(si3_t225_download, maddr + si3_t225_downloadaddr, @@ -332,6 +357,7 @@ *(maddr+SIPCIRESET) = 1; *(maddr+SIPCIINTCL) = 0; break; + case SIJETCF: case SIJETPCI: *(maddr+SIJETRESET) = 0; *(maddr+SIJETCONFIG) = SIJETBUSEN|SIJETIRQEN; @@ -576,7 +602,9 @@ done_chartimes = 1; } - make_dev(&si_Scdevsw, 0, 0, 0, 0600, "si_control"); + if (unit == 0) + make_dev(&si_Scdevsw, 0, UID_ROOT, GID_WHEEL, 0600, + "si_control"); return (0); } @@ -655,6 +683,7 @@ case TCSIMODULES: *ip = si_Nmodules; goto out; +#ifdef SI_DEBUG case TCSISDBG_ALL: SUCHECK; si_debug = *ip; @@ -662,6 +691,12 @@ case TCSIGDBG_ALL: *ip = si_debug; goto out; +#else + case TCSISDBG_ALL: + case TCSIGDBG_ALL: + error = ENOTTY; + goto out; +#endif default: /* * Check that a controller for this port exists @@ -1099,6 +1134,13 @@ if (sc == NULL || sc->sc_type == SIEMPTY) continue; + DPRINT((NULL, arg == NULL ? DBG_POLL:DBG_INTR, + "IRQ_STATUS %#x\n", + (int)sc->sc_maddr[SX_IRQ_STATUS])); + if (SI_ISJET(sc->sc_type) && + (sc->sc_maddr[SX_IRQ_STATUS] & 0x1) != 0) + continue; + /* * First, clear the interrupt */ @@ -1121,6 +1163,7 @@ ((volatile struct si_reg *)maddr)->int_pending = 0; *(maddr+SIPCIINTCL) = 0x0; break; + case SIJETCF: case SIJETPCI: /* fall through to JETISA case */ case SIJETISA: maddr = sc->sc_maddr; @@ -1175,6 +1218,9 @@ if (ccbp->hi_stat == IDLE_CLOSE) { continue; } + DPRINT((pp, arg == NULL ? DBG_POLL:DBG_INTR, + "si_intr hi_stat = 0x%x\n", + ccbp->hi_stat)); /* * Do modem state change if not a local device @@ -1629,6 +1675,7 @@ } break; /* T225 based hosts */ + case SIJETCF: case SIJETPCI: case SIJETISA: switch (uart_type) { diff -urN ../../src-6/sys/dev/si/si_pci.c dev/si/si_pci.c --- ../../src-6/sys/dev/si/si_pci.c Tue Mar 1 03:58:04 2005 +++ dev/si/si_pci.c Thu Nov 17 14:00:09 2005 @@ -33,6 +33,7 @@ #include #include +#include #include static int @@ -42,11 +43,17 @@ switch (pci_get_devid(dev)) { case 0x400011cb: - desc = "Specialix SI/XIO PCI host card"; + desc = "Specialix z280 SI XIO PCI host card"; break; case 0x200011cb: - if (pci_read_config(dev, SIJETSSIDREG, 4) == 0x020011cb) + switch (pci_get_subdevice(dev)) { + case 0x0200: desc = "Specialix SX PCI host card"; + break; + case 0x0300: + desc = "Specialix SX+ PCI host card"; + break; + } break; } if (desc) { @@ -70,11 +77,20 @@ switch (pci_get_devid(dev)) { case 0x400011cb: sc->sc_type = SIPCI; - sc->sc_mem_rid = SIPCIBADR; + sc->sc_mem_rid = PCIR_BAR(0); break; case 0x200011cb: - sc->sc_type = SIJETPCI; - sc->sc_mem_rid = SIJETBADR; + /* The SX card uses BAR2 whereas the SX+ uses BAR3. */ + switch (pci_get_subdevice(dev)) { + case 0x0200: + sc->sc_type = SIJETPCI; + sc->sc_mem_rid = PCIR_BAR(2); + break; + case 0x0300: + sc->sc_type = SIJETCF; + sc->sc_mem_rid = PCIR_BAR(3); + break; + } break; } @@ -86,7 +102,20 @@ goto fail; } sc->sc_paddr = (caddr_t)rman_get_start(sc->sc_mem_res); - sc->sc_maddr = rman_get_virtual(sc->sc_mem_res); + sc->sc_baddr = rman_get_virtual(sc->sc_mem_res); + device_printf(dev, "memory size: %#lx\n", rman_get_size(sc->sc_mem_res)); + if (sc->sc_type == SIJETCF) + /* + * The SX SDK claims that the SX+ BAR3 is 128k in length + * and that the shared memory window starts at 32k from + * the end of the BAR. Howver, in practice it seems that + * at least some SX+ cards have larger BAR3 (e.g. 256k) + * but the offset of the shared memory window is still at + * 0x18000 rather than 32k from the end. + */ + sc->sc_maddr = sc->sc_baddr + 0x18000; + else + sc->sc_maddr = sc->sc_baddr; sc->sc_irq_rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ,