From owner-freebsd-amd64@FreeBSD.ORG Thu Oct 30 17:59:19 2014 Return-Path: Delivered-To: freebsd-amd64@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 141E5C73 for ; Thu, 30 Oct 2014 17:59:19 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E11BDCDC for ; Thu, 30 Oct 2014 17:59:18 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 8795DB926; Thu, 30 Oct 2014 13:59:17 -0400 (EDT) From: John Baldwin To: Sourish Mazumder Subject: Re: memory type e820 Date: Thu, 30 Oct 2014 13:53:05 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.4-CBSD-20140415; KDE/4.5.5; amd64; ; ) References: <201410301208.50164.jhb@freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201410301353.05185.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Thu, 30 Oct 2014 13:59:17 -0400 (EDT) Cc: freebsd-amd64@freebsd.org X-BeenThere: freebsd-amd64@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Porting FreeBSD to the AMD64 platform List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Oct 2014 17:59:19 -0000 On Thursday, October 30, 2014 12:39:27 pm Sourish Mazumder wrote: > Hi John, > > I want to make a block device out of this nvram memory. So, I will need to > perform memcpy() operation into this memory. > Do I need to add this memory into the vm system, if I need to do operations > like memcpy(). Ah, so you just need to map it. The most expedient thing you can do for this is: void *p; p = pmap_mapdev(physaddr, len); (This uses an uncached mapping). When you are finished (e.g during a detach routine if you need to unload the driver) you can do: pmap_unmapdev((vm_offset_t)p, len); Note that for a PCI BAR you would do something different, but for a resource you discover via the SMAP and is x86 specific this is ok. -- John Baldwin