summaryrefslogtreecommitdiffstats
path: root/sys/pci/pci_compat.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-07-28 07:57:48 +0000
committerdfr <dfr@FreeBSD.org>1999-07-28 07:57:48 +0000
commit37dec27558a97e62dc2669724f0b5a5c01f68004 (patch)
tree5672adb8a1af1c7d22f04417b999392ec13d2791 /sys/pci/pci_compat.c
parentebe74fdfd56f23f10570dee683db44117f20e4f8 (diff)
downloadFreeBSD-src-37dec27558a97e62dc2669724f0b5a5c01f68004.zip
FreeBSD-src-37dec27558a97e62dc2669724f0b5a5c01f68004.tar.gz
Add support for SYS_RES_DENSE and SYS_RES_BWX resource types. These are
equivalent to SYS_RES_MEMORY for x86 but for alpha, the rman_get_virtual() address of the resource is initialised to point into either dense-mapped or bwx-mapped space respectively, allowing direct memory pointers to be used to device memory. Reviewed by: Andrew Gallatin <gallatin@cs.duke.edu>
Diffstat (limited to 'sys/pci/pci_compat.c')
-rw-r--r--sys/pci/pci_compat.c50
1 files changed, 21 insertions, 29 deletions
diff --git a/sys/pci/pci_compat.c b/sys/pci/pci_compat.c
index 48ba902..db4d56a 100644
--- a/sys/pci/pci_compat.c
+++ b/sys/pci/pci_compat.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: pci_compat.c,v 1.29 1999/05/31 22:13:36 roger Exp $
+ * $Id: pci_compat.c,v 1.30 1999/07/03 20:17:08 peter Exp $
*
*/
@@ -108,20 +108,16 @@ pci_map_mem(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
int
pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
{
- if (pci_map_mem(cfg, reg, va, pa)){
-#ifdef __alpha__
- vm_offset_t dense;
-
- dense = pci_cvt_to_dense(*pa);
- if (dense) {
- *pa = dense;
- *va = ALPHA_PHYS_TO_K0SEG(*pa);
- return (1);
- }
-#endif
-#ifdef __i386__
- return(1);
-#endif
+ int rid;
+ struct resource *res;
+
+ rid = reg;
+ res = bus_alloc_resource(cfg->dev, SYS_RES_DENSE, &rid,
+ 0, ~0, 1, RF_ACTIVE);
+ if (res) {
+ *pa = rman_get_start(res);
+ *va = (vm_offset_t) rman_get_virtual(res);
+ return (1);
}
return (0);
}
@@ -129,20 +125,16 @@ pci_map_dense(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
int
pci_map_bwx(pcici_t cfg, u_long reg, vm_offset_t* va, vm_offset_t* pa)
{
- if (pci_map_mem(cfg, reg, va, pa)){
-#ifdef __alpha__
- vm_offset_t bwx;
-
- bwx = pci_cvt_to_bwx(*pa);
- if (bwx) {
- *pa = bwx;
- *va = ALPHA_PHYS_TO_K0SEG(*pa);
- return (1);
- }
-#endif
-#ifdef __i386__
- return(1);
-#endif
+ int rid;
+ struct resource *res;
+
+ rid = reg;
+ res = bus_alloc_resource(cfg->dev, SYS_RES_BWX, &rid,
+ 0, ~0, 1, RF_ACTIVE);
+ if (res) {
+ *pa = rman_get_start(res);
+ *va = (vm_offset_t) rman_get_virtual(res);
+ return (1);
}
return (0);
}
OpenPOWER on IntegriCloud