Date: Fri, 21 Dec 2001 16:27:09 +0100 From: "Petr Holub" <hopet@ics.muni.cz> To: <imp@harmony.village.org>, <akimichi@sfc.wide.ad.jp> Cc: <freebsd-hackers@FreeBSD.ORG>, <firewire-bsd@marahute.cc.uec.ac.jp> Subject: firewire driver Message-ID: <000201c18a33$f4cee710$2603fb93@kloboucek>
next in thread | raw e-mail | index | archive | help
[-- Attachment #1 --] Hi all! I've patched the fwohci driver from the DVTS suite (http://www.sfc.wide.ad.jp/DVTS/) to do the memory allocation for the card on it's own in the case BIOS is too lazy to do it (my case). Patch is in the attachement. I'd like to thank Warner Losh for his help with this problem and for his PCCBB code in the -CURRENT. My patch runs for me on FreeBSD 4.4. So if somebody is interested, here you are... With best regards and best wishes for the year 2002, Petr ================================================================ Petr Holub CESNET z.s.p.o. Supercomputing Center Brno Zikova 2 Institute of Compt. Science 10200 Praha, CZ Masaryk University Czech Republic Botanicka 68a, 60200 Brno, CZ e-mail: Petr.Holub@cesnet.cz phone: +420-5-41512278 e-mail: hopet@ics.muni.cz [-- Attachment #2 --] --- fwohci.c.orig Tue Dec 18 20:44:14 2001 +++ fwohci.c Fri Dec 21 15:55:49 2001 @@ -357,6 +357,8 @@ volatile u_int32_t cmd, fun, latency, cache_line; u_int ch, i; int rid; + u_int32_t sockbase; + #ifdef __FreeBSD__ #if 0 sc = &fwohci[unit]; @@ -398,10 +400,42 @@ rid = PCI_MAP_REG_START; sc->fc.mem = bus_alloc_resource(dev, SYS_RES_MEMORY, &rid, 0, ~0, 1, RF_ACTIVE); + +/* This self-allocation is done using code by Warner Losh in -CURRENT (5.0) + from PCCBB code. Thanks Warner! + Petr Holub (hopet@ics.muni.cz) */ + if (!sc->fc.mem) { - device_printf(dev, "could not map memory\n"); - error = ENXIO; - goto fail; + device_printf(dev, "could not map memory - trying allocation on my own\n"); + /* According to Windows 2000 */ + #define FWOHCI_START_MEM 0xFFAFC000 + /* According to Warner Losh's PCCBB */ + /* #define FWOHCI_START_MEM 0x84000000 */ + sockbase = pci_read_config(dev, rid, 4); + if (sockbase < 0x100000 || sockbase >= 0xfffffff0) { + pci_write_config(dev, rid, 0xffffffff, 4); + sockbase = pci_read_config(dev, rid, 4); + sockbase = (sockbase & 0xfffffff0) & + -(sockbase & 0xfffffff0); + sc->fc.mem = bus_generic_alloc_resource( + device_get_parent(dev), dev, SYS_RES_MEMORY, + &rid, FWOHCI_START_MEM, ~0, sockbase, + RF_ACTIVE|rman_make_alignment_flags(sockbase)); + if (!sc->fc.mem){ + device_printf(dev, + "Could not grab register memory\n"); + error = ENXIO; + goto fail; + } + pci_write_config(dev, PCI_MAP_REG_START, + rman_get_start(sc->fc.mem), 4); + device_printf(dev, "PCI Memory allocated: %08lx\n", + rman_get_start(sc->fc.mem)); + } else { + device_printf(dev, "Could not map register memory\n"); + error = ENXIO; + goto fail; + } } sc->base = rman_get_virtual(sc->fc.mem); #endif /* __FreeBSD__ */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000201c18a33$f4cee710$2603fb93>
