From owner-freebsd-hackers Fri Dec 21 7:28:32 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from aragorn.ics.muni.cz (aragorn.ics.muni.cz [147.251.4.33]) by hub.freebsd.org (Postfix) with ESMTP id 0742437B426 for ; Fri, 21 Dec 2001 07:28:17 -0800 (PST) Received: from dior.ics.muni.cz (dior.ics.muni.cz [147.251.6.10]) by aragorn.ics.muni.cz (8.8.5/8.8.5) with ESMTP id QAA02688; Fri, 21 Dec 2001 16:28:08 +0100 (MET) Received: from kloboucek (root@localhost) (authenticated as hopet with LOGIN) by dior.ics.muni.cz (8.10.1/8.10.0.Beta12) with ESMTP id fBLFS5H07687; Fri, 21 Dec 2001 16:28:05 +0100 (MET) From: "Petr Holub" To: , Cc: , Subject: firewire driver Date: Fri, 21 Dec 2001 16:27:09 +0100 Message-ID: <000201c18a33$f4cee710$2603fb93@kloboucek> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0003_01C18A3C.56934F10" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG This is a multi-part message in MIME format. ------=_NextPart_000_0003_01C18A3C.56934F10 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit 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 ------=_NextPart_000_0003_01C18A3C.56934F10 Content-Type: application/octet-stream; name="fwohci.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="fwohci.diff" --- fwohci.c.orig Tue Dec 18 20:44:14 2001=0A= +++ fwohci.c Fri Dec 21 15:55:49 2001=0A= @@ -357,6 +357,8 @@=0A= volatile u_int32_t cmd, fun, latency, cache_line;=0A= u_int ch, i;=0A= int rid;=0A= + u_int32_t sockbase;=0A= +=0A= #ifdef __FreeBSD__=0A= #if 0=0A= sc =3D &fwohci[unit];=0A= @@ -398,10 +400,42 @@=0A= rid =3D PCI_MAP_REG_START;=0A= sc->fc.mem =3D bus_alloc_resource(dev, SYS_RES_MEMORY, &rid,=0A= 0, ~0, 1, RF_ACTIVE);=0A= +=0A= +/* This self-allocation is done using code by Warner Losh in -CURRENT = (5.0)=0A= + from PCCBB code. Thanks Warner!=0A= + Petr Holub (hopet@ics.muni.cz) */=0A= +=0A= if (!sc->fc.mem) {=0A= - device_printf(dev, "could not map memory\n");=0A= - error =3D ENXIO;=0A= - goto fail;=0A= + device_printf(dev, "could not map memory - trying allocation on my = own\n");=0A= + /* According to Windows 2000 */=0A= + #define FWOHCI_START_MEM 0xFFAFC000=0A= + /* According to Warner Losh's PCCBB */=0A= + /* #define FWOHCI_START_MEM 0x84000000 */=0A= + sockbase =3D pci_read_config(dev, rid, 4);=0A= + if (sockbase < 0x100000 || sockbase >=3D 0xfffffff0) {=0A= + pci_write_config(dev, rid, 0xffffffff, 4);=0A= + sockbase =3D pci_read_config(dev, rid, 4);=0A= + sockbase =3D (sockbase & 0xfffffff0) &=0A= + -(sockbase & 0xfffffff0);=0A= + sc->fc.mem =3D bus_generic_alloc_resource(=0A= + device_get_parent(dev), dev, SYS_RES_MEMORY,=0A= + &rid, FWOHCI_START_MEM, ~0, sockbase,=0A= + RF_ACTIVE|rman_make_alignment_flags(sockbase));=0A= + if (!sc->fc.mem){=0A= + device_printf(dev,=0A= + "Could not grab register memory\n");=0A= + error =3D ENXIO;=0A= + goto fail;=0A= + }=0A= + pci_write_config(dev, PCI_MAP_REG_START,=0A= + rman_get_start(sc->fc.mem), 4);=0A= + device_printf(dev, "PCI Memory allocated: %08lx\n",=0A= + rman_get_start(sc->fc.mem));=0A= + } else {=0A= + device_printf(dev, "Could not map register memory\n");=0A= + error =3D ENXIO;=0A= + goto fail;=0A= + }=0A= }=0A= sc->base =3D rman_get_virtual(sc->fc.mem);=0A= #endif /* __FreeBSD__ */=0A= ------=_NextPart_000_0003_01C18A3C.56934F10-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message