From owner-freebsd-hackers Mon Dec 28 06:45:39 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id GAA07247 for freebsd-hackers-outgoing; Mon, 28 Dec 1998 06:45:39 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from tornado.cisco.com (tornado.cisco.com [171.69.104.22]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id GAA07242 for ; Mon, 28 Dec 1998 06:45:38 -0800 (PST) (envelope-from bmcgover@bmcgover-pc.cisco.com) Received: from bmcgover-pc.cisco.com (bmcgover-pc.cisco.com [171.69.104.147]) by tornado.cisco.com (8.8.5-Cisco.1/8.6.5) with ESMTP id JAA01150 for ; Mon, 28 Dec 1998 09:45:15 -0500 (EST) Received: from bmcgover-pc.cisco.com (localhost.pa.dtd.cisco.com [127.0.0.1]) by bmcgover-pc.cisco.com (8.9.1/8.9.1) with ESMTP id JAA04498 for ; Mon, 28 Dec 1998 09:45:19 -0500 (EST) (envelope-from bmcgover@bmcgover-pc.cisco.com) Message-Id: <199812281445.JAA04498@bmcgover-pc.cisco.com> To: hackers@FreeBSD.ORG Reply-to: bmcgover@cisco.com Subject: Aquiring contiguous wired physical memory in the kernel... Date: Mon, 28 Dec 1998 09:45:19 -0500 From: Brian McGovern Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I've been looking through the mailing lists for the better part of a half hour or so trying to find the answer to this, but it seems that the answers either conflict for method, or the answers work for a specific case. So, I'll ask the question directly, and hopefully get the "best" answer :) I'm about 1/3 of the way through writing a device driver for a high-density tty-like device (108 modems in a PCI slot form factor). While the module has on-board RAM that I can use for buffering, the device is also capable of using the host's RAM for buffering, which I'd like to take advantage of. What I need to be able to do is malloc() a chunk of memory (say 512K-1MB) that is physically contiguous. Then, I need to be able to get the PHYSICAL address of this memory chunk, and pass it back off to the board so it can directly access the memory. Looking through some of the drivers in the pci subdirectory, it appears that they use a macro caled vtophys, which calls pmap_kextract, then adds 1073741825 ((1024 * 1024 * 1024) + 1) to the result. Others seem to use kv_top() to get the physical address. Anyone care to comment? -Brian To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message