From owner-freebsd-hackers Sun Sep 8 12:24:37 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 422EF37B400 for ; Sun, 8 Sep 2002 12:24:34 -0700 (PDT) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id 73F5943E3B for ; Sun, 8 Sep 2002 12:24:33 -0700 (PDT) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.3/8.12.3) with ESMTP id g88JOWGq027721; Sun, 8 Sep 2002 13:24:32 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Sun, 08 Sep 2002 13:24:25 -0600 (MDT) Message-Id: <20020908.132425.21514062.imp@bsdimp.com> To: bms@spc.org Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: PCMCIA questions: mapping attribute and common memory? From: "M. Warner Losh" In-Reply-To: <20020908190057.GE3235@spc.org> References: <20020906093215.GI15218@spc.org> <20020906.235110.108188889.imp@bsdimp.com> <20020908190057.GE3235@spc.org> X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 In message: <20020908190057.GE3235@spc.org> Bruce M Simpson writes: : Many thanks! The only other question I have is - how would I go about : doing a bus_space_mmap() to be able to copy the attribute memory off : to a calling process? I just re-read this, and you could also be asking how to implement a read function for your device... In that case, you'd have to do something like the crd driver does. Since you already have the window picked out, I've removed the pick a window code. I'm also assuming that you have only 1 4k window and that you don't have to move it around. static int crdread(dev_t dev, struct uio *uio, int ioflag) { if (uio->uio_offset > 0x1000) return (EIO); while (uio->uio_resid && error == 0) { offs = (unsigned int)uio->uio_offset & (0x1000 - 1); p = rman_get_virtual(am_res) + offs; count = MIN(0x1000 - offs, uio->uio_resid); error = uiomove(p, count, uio); } return (error); } I don't recall if uiomove does anything to optimize the memory moving, but if it does, or if your data is non-linear, you'll have to uiomove it one byte at a time into userland. Warner To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message