/*
*/
/* radeon_irq.c -- IRQ handling for radeon -*- linux-c -*- */
/*
* Copyright (C) The Weather Channel, Inc. 2002. All Rights Reserved.
*
* The Weather Channel (TM) funded Tungsten Graphics to develop the
* initial release of the Radeon 8500 driver under the XFree86 license.
* This notice must be preserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Authors:
* Keith Whitwell <keith@tungstengraphics.com>
* Michel D�zer <michel@daenzer.net>
*/
#include "drmP.h"
#include "radeon_drm.h"
#include "radeon_drv.h"
#include "radeon_io32.h"
static inline u32
{
if (irqs)
return (irqs);
}
/*
* Interrupts - Used for device synchronization and flushing in the
* following circumstances:
*
* - Exclusive FB access with hw idle:
* - Wait for GUI Idle (?) interrupt, then do normal flush.
*
* - Frame throttling, NV_fence:
* - Drop marker irq's into command stream ahead of time.
* - Wait on irq's with lock *not held*
* - Check each for termination condition
*
* - Internally in cp_getbuffer, etc:
* - as above, but wait with lock held???
*
* NOTE: These functions are misleadingly named -- the irq's aren't
* tied to dma at all, this is just a hangover from dri prehistory.
*/
{
/*
* Only consider the bits we're interested in - others could be used
* outside the DRM
*/
if (!stat)
return (IRQ_NONE);
/* SW interrupt */
if (stat & RADEON_SW_INT_TEST) {
}
/* VBLANK interrupt */
if ((vblank_crtc &
if (stat & RADEON_CRTC_VBLANK_STAT)
if (stat & RADEON_CRTC2_VBLANK_STAT)
} else if (((stat & RADEON_CRTC_VBLANK_STAT) &&
(vblank_crtc & DRM_RADEON_VBLANK_CRTC1)) ||
((stat & RADEON_CRTC2_VBLANK_STAT) &&
}
return (IRQ_HANDLED);
}
{
unsigned int ret;
BEGIN_RING(4);
ADVANCE_RING();
COMMIT_RING();
return (ret);
}
{
int ret = 0;
return (0);
return (ret);
}
{
unsigned int cur_vblank;
int ret = 0;
if (!dev_priv) {
return (EINVAL);
}
/*
* I don't know why reset Intr Status Register here,
* it might miss intr. So, I remove the code which
* exists in open source, and changes as follows:
*/
if (crtc == DRM_RADEON_VBLANK_CRTC1) {
} else if (crtc == DRM_RADEON_VBLANK_CRTC2) {
} else
return (EINVAL);
/*
* Assume that the user has missed the current sequence number
* by about a day rather than she wants to wait for years
* using vertical blanks...
*/
*sequence = cur_vblank;
return (ret);
}
int
{
}
int
{
}
/*
* Needs the lock as it touches the ring.
*/
/*ARGSUSED*/
int
{
int result;
if (!dev_priv) {
return (EINVAL);
}
#ifdef _MULTI_DATAMODEL
sizeof (emit32));
} else {
#endif
#ifdef _MULTI_DATAMODEL
}
#endif
DRM_ERROR("copy_to_user\n");
return (EFAULT);
}
return (0);
}
/*
* Doesn't need the hardware lock.
*/
/*ARGSUSED*/
int
{
if (!dev_priv) {
return (EINVAL);
}
}
{
}
}
}
/*
* drm_dma.h hooks
*/
void
{
/* Disable *all* interrupts */
/* Clear bits if they're already high */
(void) radeon_acknowledge_irqs(dev_priv,
}
void
{
}
void
{
if (!dev_priv)
return;
/* Disable *all* interrupts */
}
int
{
value = 0;
if (flag & RADEON_CRTC_VBLANK_MASK)
if (flag & RADEON_CRTC2_VBLANK_MASK)
return (value);
}
int
{
DRM_ERROR("called with invalid crtc 0x%x\n",
(unsigned int)value);
return (EINVAL);
}
return (0);
}