Commit 54bd5206 authored by Ilija Hadzic's avatar Ilija Hadzic Committed by Dave Airlie

drm/radeon/kms: use defined constants for crtc/hpd count instead of hard-coded value 6

radeon_driver_irq_preinstall_kms and radeon_driver_irq_uninstall_kms
hard code the loop to 6 which happens to be the current maximum
number of crtcs and hpd pins; if one day an ASIC with more crtcs
(or hpd pins) comes out, this is a trouble waiting to happen.

introduce constants for maximum CRTC count, maximum HPD pins count
and maximum HDMI blocks count (per FIXME in radeon_irq structure)
and correct the loops in radeon_driver_irq_preinstall_kms and
radeon_driver_irq_uninstall_kms

v2: take care of goofs pointed out by Alex Deucher
Signed-off-by: default avatarIlija Hadzic <ihadzic@research.bell-labs.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 77b1bad4
...@@ -437,25 +437,26 @@ union radeon_irq_stat_regs { ...@@ -437,25 +437,26 @@ union radeon_irq_stat_regs {
struct evergreen_irq_stat_regs evergreen; struct evergreen_irq_stat_regs evergreen;
}; };
#define RADEON_MAX_HPD_PINS 6
#define RADEON_MAX_CRTCS 6
#define RADEON_MAX_HDMI_BLOCKS 2
struct radeon_irq { struct radeon_irq {
bool installed; bool installed;
bool sw_int; bool sw_int;
/* FIXME: use a define max crtc rather than hardcode it */ bool crtc_vblank_int[RADEON_MAX_CRTCS];
bool crtc_vblank_int[6]; bool pflip[RADEON_MAX_CRTCS];
bool pflip[6];
wait_queue_head_t vblank_queue; wait_queue_head_t vblank_queue;
/* FIXME: use defines for max hpd/dacs */ bool hpd[RADEON_MAX_HPD_PINS];
bool hpd[6];
bool gui_idle; bool gui_idle;
bool gui_idle_acked; bool gui_idle_acked;
wait_queue_head_t idle_queue; wait_queue_head_t idle_queue;
/* FIXME: use defines for max HDMI blocks */ bool hdmi[RADEON_MAX_HDMI_BLOCKS];
bool hdmi[2];
spinlock_t sw_lock; spinlock_t sw_lock;
int sw_refcount; int sw_refcount;
union radeon_irq_stat_regs stat_regs; union radeon_irq_stat_regs stat_regs;
spinlock_t pflip_lock[6]; spinlock_t pflip_lock[RADEON_MAX_CRTCS];
int pflip_refcount[6]; int pflip_refcount[RADEON_MAX_CRTCS];
}; };
int radeon_irq_kms_init(struct radeon_device *rdev); int radeon_irq_kms_init(struct radeon_device *rdev);
......
...@@ -67,10 +67,10 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev) ...@@ -67,10 +67,10 @@ void radeon_driver_irq_preinstall_kms(struct drm_device *dev)
/* Disable *all* interrupts */ /* Disable *all* interrupts */
rdev->irq.sw_int = false; rdev->irq.sw_int = false;
rdev->irq.gui_idle = false; rdev->irq.gui_idle = false;
for (i = 0; i < rdev->num_crtc; i++) for (i = 0; i < RADEON_MAX_HPD_PINS; i++)
rdev->irq.crtc_vblank_int[i] = false;
for (i = 0; i < 6; i++) {
rdev->irq.hpd[i] = false; rdev->irq.hpd[i] = false;
for (i = 0; i < RADEON_MAX_CRTCS; i++) {
rdev->irq.crtc_vblank_int[i] = false;
rdev->irq.pflip[i] = false; rdev->irq.pflip[i] = false;
} }
radeon_irq_set(rdev); radeon_irq_set(rdev);
...@@ -99,10 +99,10 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev) ...@@ -99,10 +99,10 @@ void radeon_driver_irq_uninstall_kms(struct drm_device *dev)
/* Disable *all* interrupts */ /* Disable *all* interrupts */
rdev->irq.sw_int = false; rdev->irq.sw_int = false;
rdev->irq.gui_idle = false; rdev->irq.gui_idle = false;
for (i = 0; i < rdev->num_crtc; i++) for (i = 0; i < RADEON_MAX_HPD_PINS; i++)
rdev->irq.crtc_vblank_int[i] = false;
for (i = 0; i < 6; i++) {
rdev->irq.hpd[i] = false; rdev->irq.hpd[i] = false;
for (i = 0; i < RADEON_MAX_CRTCS; i++) {
rdev->irq.crtc_vblank_int[i] = false;
rdev->irq.pflip[i] = false; rdev->irq.pflip[i] = false;
} }
radeon_irq_set(rdev); radeon_irq_set(rdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment