diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2013-04-08 11:13:01 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-04-09 10:23:50 -0400 |
commit | 9ed8b1f93ca3a274079cb36826af1331f83cd118 (patch) | |
tree | e993a18bf16c041da976e16871cd3fb5eeadf6c2 /drivers/gpu/drm/radeon/si.c | |
parent | 367cbe2fec9b57b72605e2ac4cfd4f2fa823a256 (diff) |
drm/radeon: clean up vram/gtt location handling
Add a per-asic MC (memory controller) mask which holds the
mak address mask the asic is capable of. Use this when
calculating the vram and gtt locations rather using asic
specific functions or limiting everything to 32 bits.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/si.c')
-rw-r--r-- | drivers/gpu/drm/radeon/si.c | 44 |
1 files changed, 2 insertions, 42 deletions
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c index bafbe3216952..862b52c69882 100644 --- a/drivers/gpu/drm/radeon/si.c +++ b/drivers/gpu/drm/radeon/si.c | |||
@@ -2538,46 +2538,6 @@ static void si_mc_program(struct radeon_device *rdev) | |||
2538 | rv515_vga_render_disable(rdev); | 2538 | rv515_vga_render_disable(rdev); |
2539 | } | 2539 | } |
2540 | 2540 | ||
2541 | /* SI MC address space is 40 bits */ | ||
2542 | static void si_vram_location(struct radeon_device *rdev, | ||
2543 | struct radeon_mc *mc, u64 base) | ||
2544 | { | ||
2545 | mc->vram_start = base; | ||
2546 | if (mc->mc_vram_size > (0xFFFFFFFFFFULL - base + 1)) { | ||
2547 | dev_warn(rdev->dev, "limiting VRAM to PCI aperture size\n"); | ||
2548 | mc->real_vram_size = mc->aper_size; | ||
2549 | mc->mc_vram_size = mc->aper_size; | ||
2550 | } | ||
2551 | mc->vram_end = mc->vram_start + mc->mc_vram_size - 1; | ||
2552 | dev_info(rdev->dev, "VRAM: %lluM 0x%016llX - 0x%016llX (%lluM used)\n", | ||
2553 | mc->mc_vram_size >> 20, mc->vram_start, | ||
2554 | mc->vram_end, mc->real_vram_size >> 20); | ||
2555 | } | ||
2556 | |||
2557 | static void si_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc) | ||
2558 | { | ||
2559 | u64 size_af, size_bf; | ||
2560 | |||
2561 | size_af = ((0xFFFFFFFFFFULL - mc->vram_end) + mc->gtt_base_align) & ~mc->gtt_base_align; | ||
2562 | size_bf = mc->vram_start & ~mc->gtt_base_align; | ||
2563 | if (size_bf > size_af) { | ||
2564 | if (mc->gtt_size > size_bf) { | ||
2565 | dev_warn(rdev->dev, "limiting GTT\n"); | ||
2566 | mc->gtt_size = size_bf; | ||
2567 | } | ||
2568 | mc->gtt_start = (mc->vram_start & ~mc->gtt_base_align) - mc->gtt_size; | ||
2569 | } else { | ||
2570 | if (mc->gtt_size > size_af) { | ||
2571 | dev_warn(rdev->dev, "limiting GTT\n"); | ||
2572 | mc->gtt_size = size_af; | ||
2573 | } | ||
2574 | mc->gtt_start = (mc->vram_end + 1 + mc->gtt_base_align) & ~mc->gtt_base_align; | ||
2575 | } | ||
2576 | mc->gtt_end = mc->gtt_start + mc->gtt_size - 1; | ||
2577 | dev_info(rdev->dev, "GTT: %lluM 0x%016llX - 0x%016llX\n", | ||
2578 | mc->gtt_size >> 20, mc->gtt_start, mc->gtt_end); | ||
2579 | } | ||
2580 | |||
2581 | static void si_vram_gtt_location(struct radeon_device *rdev, | 2541 | static void si_vram_gtt_location(struct radeon_device *rdev, |
2582 | struct radeon_mc *mc) | 2542 | struct radeon_mc *mc) |
2583 | { | 2543 | { |
@@ -2587,9 +2547,9 @@ static void si_vram_gtt_location(struct radeon_device *rdev, | |||
2587 | mc->real_vram_size = 0xFFC0000000ULL; | 2547 | mc->real_vram_size = 0xFFC0000000ULL; |
2588 | mc->mc_vram_size = 0xFFC0000000ULL; | 2548 | mc->mc_vram_size = 0xFFC0000000ULL; |
2589 | } | 2549 | } |
2590 | si_vram_location(rdev, &rdev->mc, 0); | 2550 | radeon_vram_location(rdev, &rdev->mc, 0); |
2591 | rdev->mc.gtt_base_align = 0; | 2551 | rdev->mc.gtt_base_align = 0; |
2592 | si_gtt_location(rdev, mc); | 2552 | radeon_gtt_location(rdev, mc); |
2593 | } | 2553 | } |
2594 | 2554 | ||
2595 | static int si_mc_init(struct radeon_device *rdev) | 2555 | static int si_mc_init(struct radeon_device *rdev) |