diff options
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_device.c')
-rw-r--r-- | drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c index ffaa703e89f5..fcf83178b113 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | |||
@@ -516,6 +516,29 @@ int amdgpu_wb_get(struct amdgpu_device *adev, u32 *wb) | |||
516 | } | 516 | } |
517 | 517 | ||
518 | /** | 518 | /** |
519 | * amdgpu_wb_get_64bit - Allocate a wb entry | ||
520 | * | ||
521 | * @adev: amdgpu_device pointer | ||
522 | * @wb: wb index | ||
523 | * | ||
524 | * Allocate a wb slot for use by the driver (all asics). | ||
525 | * Returns 0 on success or -EINVAL on failure. | ||
526 | */ | ||
527 | int amdgpu_wb_get_64bit(struct amdgpu_device *adev, u32 *wb) | ||
528 | { | ||
529 | unsigned long offset = bitmap_find_next_zero_area_off(adev->wb.used, | ||
530 | adev->wb.num_wb, 0, 2, 7, 0); | ||
531 | if ((offset + 1) < adev->wb.num_wb) { | ||
532 | __set_bit(offset, adev->wb.used); | ||
533 | __set_bit(offset + 1, adev->wb.used); | ||
534 | *wb = offset; | ||
535 | return 0; | ||
536 | } else { | ||
537 | return -EINVAL; | ||
538 | } | ||
539 | } | ||
540 | |||
541 | /** | ||
519 | * amdgpu_wb_free - Free a wb entry | 542 | * amdgpu_wb_free - Free a wb entry |
520 | * | 543 | * |
521 | * @adev: amdgpu_device pointer | 544 | * @adev: amdgpu_device pointer |
@@ -530,6 +553,22 @@ void amdgpu_wb_free(struct amdgpu_device *adev, u32 wb) | |||
530 | } | 553 | } |
531 | 554 | ||
532 | /** | 555 | /** |
556 | * amdgpu_wb_free_64bit - Free a wb entry | ||
557 | * | ||
558 | * @adev: amdgpu_device pointer | ||
559 | * @wb: wb index | ||
560 | * | ||
561 | * Free a wb slot allocated for use by the driver (all asics) | ||
562 | */ | ||
563 | void amdgpu_wb_free_64bit(struct amdgpu_device *adev, u32 wb) | ||
564 | { | ||
565 | if ((wb + 1) < adev->wb.num_wb) { | ||
566 | __clear_bit(wb, adev->wb.used); | ||
567 | __clear_bit(wb + 1, adev->wb.used); | ||
568 | } | ||
569 | } | ||
570 | |||
571 | /** | ||
533 | * amdgpu_vram_location - try to find VRAM location | 572 | * amdgpu_vram_location - try to find VRAM location |
534 | * @adev: amdgpu device structure holding all necessary informations | 573 | * @adev: amdgpu device structure holding all necessary informations |
535 | * @mc: memory controller structure holding memory informations | 574 | * @mc: memory controller structure holding memory informations |