/*
*/
/*
* drm_irq.c -- IRQ IOCTL and function support
* Created: Fri Oct 18 2003 by anholt@FreeBSD.org
*/
/*
* Copyright 2003 Eric Anholt
* All Rights Reserved.
*
* 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
* ERIC ANHOLT BE LIABLE FOR ANY CLAIM, DAMAGES OR 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:
* Eric Anholt <anholt@FreeBSD.org>
*
*/
#include "drmP.h"
#include "drm.h"
#include "drm_io32.h"
/*ARGSUSED*/
int
{
return (EINVAL);
return (0);
}
static irqreturn_t
{
int ret;
return (ret);
}
/*ARGSUSED*/
static int
{
DRM_ERROR("drm_install_irq_handle: cannot get vgatext's dip");
return (DDI_FAILURE);
}
if (ddi_intr_hilevel(dip, 0) != 0) {
DRM_ERROR("drm_install_irq_handle: "
"high-level interrupts are not supported");
return (DDI_FAILURE);
}
DRM_ERROR("drm_install_irq_handle: cannot get iblock cookie");
return (DDI_FAILURE);
}
/* setup the interrupt handler */
DRM_ERROR("drm_install_irq_handle: ddi_add_intr failed");
return (DDI_FAILURE);
}
return (DDI_SUCCESS);
}
/*ARGSUSED*/
int
{
int ret;
DRM_ERROR("drm_irq_install: dev_private is NULL");
return (EINVAL);
}
if (dev->irq_enabled) {
DRM_ERROR("drm_irq_install: irq already enabled");
return (EBUSY);
}
dev->context_flag = 0;
/* before installing handler */
/* install handler */
if (ret != DDI_SUCCESS) {
DRM_ERROR("drm_irq_install: drm_install_irq_handle failed");
return (ret);
}
}
/* after installing handler */
return (0);
}
static void
{
}
/*ARGSUSED*/
int
{
if (!dev->irq_enabled) {
return (EINVAL);
}
dev->irq_enabled = 0;
}
return (DDI_SUCCESS);
}
/*ARGSUSED*/
int
{
int err;
case DRM_INST_HANDLER:
/*
* Handle drivers whose DRM used to require IRQ setup but the
* no longer does.
*/
return (drm_irq_install(dev));
case DRM_UNINST_HANDLER:
return (err);
default:
return (EINVAL);
}
}
/*ARGSUSED*/
int
{
unsigned int sequence;
if (!dev->irq_enabled)
return (EINVAL);
#ifdef _MULTI_DATAMODEL
sizeof (vblwait32));
} else {
#endif
sizeof (vblwait));
#ifdef _MULTI_DATAMODEL
}
#endif
return (EINVAL);
}
if (flags & _DRM_VBLANK_SECONDARY) {
return (ENOTSUP);
} else {
return (ENOTSUP);
}
}
#ifdef DEBUG
return (EINVAL);
}
#endif
if ((flags & _DRM_VBLANK_NEXTONMISS) &&
}
if (flags & _DRM_VBLANK_SIGNAL) {
/*
* Don't block process, send signal when vblank interrupt
*/
} else {
/* block until vblank interrupt */
if (flags & _DRM_VBLANK_SECONDARY) {
} else {
}
}
#ifdef _MULTI_DATAMODEL
sizeof (vblwait32));
} else {
#endif
sizeof (vblwait));
#ifdef _MULTI_DATAMODEL
}
#endif
return (ret);
}
/*ARGSUSED*/
void
{
}
}
}
/*
* Schedule a tasklet to call back a driver hook with the HW lock held.
*
* \param dev DRM device.
* \param func Driver callback.
*
* This is intended for triggering actions that require the HW lock from an
* interrupt handler. The lock will be grabbed ASAP after the interrupt handler
* completes. Note that the callback may be called from interrupt or process
* context, it must not make any assumptions about this. Also, the HW lock will
* be held with the kernel context or any client context.
*/
void
{
if (dev->locked_tasklet_func) {
return;
}
}