diff options
Diffstat (limited to 'sys/dev/firewire/fwohci_pci.c')
-rw-r--r-- | sys/dev/firewire/fwohci_pci.c | 77 |
1 files changed, 52 insertions, 25 deletions
diff --git a/sys/dev/firewire/fwohci_pci.c b/sys/dev/firewire/fwohci_pci.c index 2498720..14fb1ce 100644 --- a/sys/dev/firewire/fwohci_pci.c +++ b/sys/dev/firewire/fwohci_pci.c @@ -1,4 +1,5 @@ /* + * Copyright (c) 2003 Hidetoshi Shimokawa * Copyright (c) 1998-2002 Katsushi Kobayashi and Hidetoshi Shimokawa * All rights reserved. * @@ -33,6 +34,8 @@ * $FreeBSD$ */ +#define BOUNCE_BUFFER_TEST 0 + #include <sys/param.h> #include <sys/systm.h> #include <sys/kernel.h> @@ -50,6 +53,7 @@ #include <dev/firewire/firewire.h> #include <dev/firewire/firewirereg.h> +#include <dev/firewire/fwdma.h> #include <dev/firewire/fwohcireg.h> #include <dev/firewire/fwohcivar.h> @@ -103,7 +107,7 @@ fwohci_pci_probe( device_t dev ) return 0; } if (id == (FW_VENDORID_SONY | FW_DEVICE_CX3022)) { - device_set_desc(dev, "SONY CX3022"); + device_set_desc(dev, "Sony CX3022"); return 0; } if (id == (FW_VENDORID_VIA | FW_DEVICE_VT6306)) { @@ -150,7 +154,7 @@ fwohci_dummy_intr(void *arg) static int fwohci_pci_init(device_t self) { - int latency, cache_line; + int olatency, latency, ocache_line, cache_line; u_int16_t cmd; cmd = pci_read_config(self, PCIR_COMMAND, 2); @@ -161,25 +165,26 @@ fwohci_pci_init(device_t self) #endif pci_write_config(self, PCIR_COMMAND, cmd, 2); - latency = pci_read_config(self, PCIR_LATTIMER, 1); + latency = olatency = pci_read_config(self, PCIR_LATTIMER, 1); #define DEF_LATENCY 0x20 - if( latency < DEF_LATENCY ) { + if (olatency < DEF_LATENCY) { latency = DEF_LATENCY; - device_printf(self, "PCI bus latency was changing to"); - pci_write_config(self, PCIR_LATTIMER,latency, 1); - } else - { - device_printf(self, "PCI bus latency is"); + pci_write_config(self, PCIR_LATTIMER, latency, 1); + } + + cache_line = ocache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); +#define DEF_CACHE_LINE 8 + if (ocache_line < DEF_CACHE_LINE) { + cache_line = DEF_CACHE_LINE; + pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); + } + + if (firewire_debug) { + device_printf(self, "latency timer %d -> %d.\n", + olatency, latency); + device_printf(self, "cache size %d -> %d.\n", + ocache_line, cache_line); } - printf(" %d.\n", (int) latency); - cache_line = pci_read_config(self, PCIR_CACHELNSZ, 1); -#if 0 -#define DEF_CACHE_LINE 0xc - cache_line = DEF_CACHE_LINE; - pci_write_config(self, PCIR_CACHELNSZ, cache_line, 1); -#endif - if (bootverbose) - device_printf(self, "cache size %d.\n", (int) cache_line); return 0; } @@ -199,12 +204,12 @@ fwohci_pci_attach(device_t self) #ifdef __i386__ device_printf(self, "Please switch PNP-OS to 'No' in BIOS\n"); #endif -#if 0 - return ENXIO; -#endif } #endif + if (bootverbose) + firewire_debug = bootverbose; + fwohci_pci_init(self); rid = PCI_CBMEM; @@ -235,7 +240,12 @@ fwohci_pci_attach(device_t self) } device_set_ivars(sc->fc.bdev, sc); - err = bus_setup_intr(self, sc->irq_res, INTR_TYPE_NET, + err = bus_setup_intr(self, sc->irq_res, +#if FWOHCI_TASKQUEUE + INTR_TYPE_NET | INTR_MPSAFE, +#else + INTR_TYPE_NET, +#endif (driver_intr_t *) fwohci_intr, sc, &sc->ih); #if __FreeBSD_version < 500000 /* XXX splcam() should mask this irq for sbp.c*/ @@ -248,6 +258,26 @@ fwohci_pci_attach(device_t self) return ENXIO; } + err = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, + /*boundary*/0, +#if BOUNCE_BUFFER_TEST + /*lowaddr*/BUS_SPACE_MAXADDR_24BIT, +#else + /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, +#endif + /*highaddr*/BUS_SPACE_MAXADDR, + /*filter*/NULL, /*filterarg*/NULL, + /*maxsize*/0x100000, + /*nsegments*/0x20, + /*maxsegsz*/0x8000, + /*flags*/BUS_DMA_ALLOCNOW, + &sc->fc.dmat); + if (err != 0) { + printf("fwohci_pci_attach: Could not allocate DMA tag " + "- error %d\n", err); + return (ENOMEM); + } + err = fwohci_init(sc, self); if (!err) @@ -263,9 +293,6 @@ fwohci_pci_attach(device_t self) * Clear the bus reset event flag to start transactions even when * interrupt is disabled during the boot process. */ -#if 0 - DELAY(100); -#endif s = splfw(); fwohci_intr((void *)sc); splx(s); |