diff options
author | Eric Anholt <anholt@freebsd.org> | 2005-08-26 23:27:19 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2005-08-26 23:27:19 +0000 |
commit | 22ec8ebb17d959486e4a865b17115e609eb688ee (patch) | |
tree | fccdebaad43251fca7ea1ae7e416d013446e7a64 /bsd-core/drm_pci.c | |
parent | c425ad1a34439d019edd589c32a7161d01b4d822 (diff) |
- Don't try to allocate mappings of less than a PAGE_SIZE in MGA DMA code.
- Comment out the "is this mapping/bufs in allocated AGP" bits in BSD
because they break mga (which uses AGP allocation that doesn't track
entries). It's not a security issue when we still have the related
ioctls marked root-only.
- Apply some power-of-two alignment restrictions to hopefully avoid some
panicing in bad cases of drm_pci_alloc() on FreeBSD.
- Add verbosity to some error handling that I found useful while debugging.
Diffstat (limited to 'bsd-core/drm_pci.c')
-rw-r--r-- | bsd-core/drm_pci.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/bsd-core/drm_pci.c b/bsd-core/drm_pci.c index 0f431dd6..a33f5f9c 100644 --- a/bsd-core/drm_pci.c +++ b/bsd-core/drm_pci.c @@ -58,6 +58,13 @@ drm_pci_alloc(drm_device_t *dev, size_t size, size_t align, dma_addr_t maxaddr) drm_dma_handle_t *dmah; int ret; + /* Need power-of-two alignment, so fail the allocation if it isn't. */ + if ((align & (align - 1)) != 0) { + DRM_ERROR("drm_pci_alloc with non-power-of-two alignment %d\n", + (int)align); + return NULL; + } + dmah = malloc(sizeof(drm_dma_handle_t), M_DRM, M_ZERO | M_NOWAIT); if (dmah == NULL) return NULL; |