Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Oct 2014 13:53:05 -0400
From:      John Baldwin <jhb@freebsd.org>
To:        Sourish Mazumder <sourish@cloudbyte.com>
Cc:        freebsd-amd64@freebsd.org
Subject:   Re: memory type e820
Message-ID:  <201410301353.05185.jhb@freebsd.org>
In-Reply-To: <CABv3qbFKSQrA0M8h3S_gdq0apPXRowNKoAMxA6pGf3pSgvsDsQ@mail.gmail.com>
References:  <CABv3qbEuggLT=9vsHAs5Rdp8a0V-=DG7DnPO1BQk4Ghn4r_9Dw@mail.gmail.com> <201410301208.50164.jhb@freebsd.org> <CABv3qbFKSQrA0M8h3S_gdq0apPXRowNKoAMxA6pGf3pSgvsDsQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410301353.05185.jhb>