summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjsg <jsg@openbsd.org>2015-02-22 13:09:46 +0000
committerjsg <jsg@openbsd.org>2015-02-22 13:09:46 +0000
commit77c80349eea2d69f787b570bfd77e1644674dd65 (patch)
tree54786051683d3f5376c3d06cf214adadb7ed7891
parentRecent changes haven't been completely stable, so revert for the 5.7 release (diff)
downloadwireguard-openbsd-77c80349eea2d69f787b570bfd77e1644674dd65.tar.xz
wireguard-openbsd-77c80349eea2d69f787b570bfd77e1644674dd65.zip
Give RS* IGP radeons a better chance of working thanks to Imre Vadasz
for debugging the problem on RS690 and coming up with an initial diff. Align the gart table allocation to the size of the allocation (rounded up to nearest page size by bus_dmamem_alloc). Matches the behaviour of the original Linux code's use of pci_alloc_consistent()/dma_alloc_coherent(). Correct PAGE_MASK usage in rs400_gart_set_page(). Linux defines PAGE_MASK to be (~(PAGE_SIZE - 1)) where as our kernel defines it as (PAGE_SIZE - 1). Most of the other occurances in the drm code have been adjusted accordingly but this one seems to have been missed.
-rw-r--r--sys/dev/pci/drm/radeon/radeon_gart.c6
-rw-r--r--sys/dev/pci/drm/radeon/rs400.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/radeon/radeon_gart.c b/sys/dev/pci/drm/radeon/radeon_gart.c
index 9de93f01d62..d17b676ae09 100644
--- a/sys/dev/pci/drm/radeon/radeon_gart.c
+++ b/sys/dev/pci/drm/radeon/radeon_gart.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_gart.c,v 1.6 2015/02/12 08:48:32 jsg Exp $ */
+/* $OpenBSD: radeon_gart.c,v 1.7 2015/02/22 13:09:46 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -75,8 +75,8 @@ int radeon_gart_table_ram_alloc(struct radeon_device *rdev)
flags |= BUS_DMA_NOCACHE;
}
#endif
- dmah = drm_dmamem_alloc(rdev->dmat, rdev->gart.table_size, 0,
- 1, rdev->gart.table_size, flags, 0);
+ dmah = drm_dmamem_alloc(rdev->dmat, rdev->gart.table_size,
+ rdev->gart.table_size, 1, rdev->gart.table_size, flags, 0);
if (dmah == NULL) {
return -ENOMEM;
}
diff --git a/sys/dev/pci/drm/radeon/rs400.c b/sys/dev/pci/drm/radeon/rs400.c
index ea320eb9f80..45172b1dad1 100644
--- a/sys/dev/pci/drm/radeon/rs400.c
+++ b/sys/dev/pci/drm/radeon/rs400.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rs400.c,v 1.5 2015/02/11 07:01:37 jsg Exp $ */
+/* $OpenBSD: rs400.c,v 1.6 2015/02/22 13:09:46 jsg Exp $ */
/*
* Copyright 2008 Advanced Micro Devices, Inc.
* Copyright 2008 Red Hat Inc.
@@ -220,7 +220,7 @@ int rs400_gart_set_page(struct radeon_device *rdev, int i, uint64_t addr)
return -EINVAL;
}
- entry = (lower_32_bits(addr) & PAGE_MASK) |
+ entry = (lower_32_bits(addr) & ~PAGE_MASK) |
((upper_32_bits(addr) & 0xff) << 4) |
RS400_PTE_WRITEABLE | RS400_PTE_READABLE;
entry = cpu_to_le32(entry);