2006-09-08 15:35:55 -06:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2006 Ben Skeggs.
|
|
|
|
*
|
|
|
|
* 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, and/or sell copies of the Software, and to
|
|
|
|
* permit persons to whom the 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 THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS 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:
|
|
|
|
* Ben Skeggs <darktama@iinet.net.au>
|
|
|
|
*/
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
#include "drmP.h"
|
|
|
|
#include "drm.h"
|
|
|
|
#include "nouveau_drm.h"
|
|
|
|
#include "nouveau_drv.h"
|
|
|
|
#include "nouveau_reg.h"
|
|
|
|
|
|
|
|
void nouveau_irq_preinstall(drm_device_t *dev)
|
|
|
|
{
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
|
|
|
DRM_DEBUG("IRQ: preinst\n");
|
|
|
|
|
2007-03-26 03:43:48 -06:00
|
|
|
if (!dev_priv) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dev_priv->mmio) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv->mmio\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
/* Disable/Clear PFIFO interrupts */
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_EN_0, 0);
|
2007-03-07 03:00:55 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_0, 0xFFFFFFFF);
|
2006-08-26 16:55:02 -06:00
|
|
|
/* Disable/Clear PGRAPH interrupts */
|
2006-10-10 16:28:15 -06:00
|
|
|
if (dev_priv->card_type<NV_40)
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR_EN, 0);
|
2006-10-10 16:28:15 -06:00
|
|
|
else
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV40_PGRAPH_INTR_EN, 0);
|
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, 0xFFFFFFFF);
|
2006-08-26 16:55:02 -06:00
|
|
|
#if 0
|
|
|
|
/* Disable/Clear CRTC0/1 interrupts */
|
|
|
|
NV_WRITE(NV_CRTC0_INTEN, 0);
|
|
|
|
NV_WRITE(NV_CRTC0_INTSTAT, NV_CRTC_INTR_VBLANK);
|
|
|
|
NV_WRITE(NV_CRTC1_INTEN, 0);
|
|
|
|
NV_WRITE(NV_CRTC1_INTSTAT, NV_CRTC_INTR_VBLANK);
|
|
|
|
#endif
|
|
|
|
/* Master disable */
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PMC_INTR_EN_0, 0);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void nouveau_irq_postinstall(drm_device_t *dev)
|
|
|
|
{
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
2007-03-26 03:43:48 -06:00
|
|
|
if (!dev_priv) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dev_priv->mmio) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv->mmio\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
DRM_DEBUG("IRQ: postinst\n");
|
|
|
|
|
|
|
|
/* Enable PFIFO error reporting */
|
2007-07-03 23:31:01 -06:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_EN_0, 0xFFFFFFFF);
|
2007-03-07 03:00:55 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_0, 0xFFFFFFFF);
|
2006-08-26 16:55:02 -06:00
|
|
|
|
|
|
|
/* Enable PGRAPH interrupts */
|
2006-10-10 16:28:15 -06:00
|
|
|
if (dev_priv->card_type<NV_40)
|
2007-07-03 23:31:01 -06:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR_EN, 0xFFFFFFFF);
|
2006-10-10 16:28:15 -06:00
|
|
|
else
|
2007-07-03 23:31:01 -06:00
|
|
|
NV_WRITE(NV40_PGRAPH_INTR_EN, 0xFFFFFFFF);
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, 0xFFFFFFFF);
|
2006-08-26 16:55:02 -06:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* Enable CRTC0/1 interrupts */
|
|
|
|
NV_WRITE(NV_CRTC0_INTEN, NV_CRTC_INTR_VBLANK);
|
|
|
|
NV_WRITE(NV_CRTC1_INTEN, NV_CRTC_INTR_VBLANK);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Master enable */
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PMC_INTR_EN_0, NV_PMC_INTR_EN_0_MASTER_ENABLE);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void nouveau_irq_uninstall(drm_device_t *dev)
|
|
|
|
{
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
|
2007-03-26 03:43:48 -06:00
|
|
|
if (!dev_priv) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!dev_priv->mmio) {
|
|
|
|
DRM_ERROR("AIII, no dev_priv->mmio\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
DRM_DEBUG("IRQ: uninst\n");
|
|
|
|
|
|
|
|
/* Disable PFIFO interrupts */
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_EN_0, 0);
|
2006-08-26 16:55:02 -06:00
|
|
|
/* Disable PGRAPH interrupts */
|
2006-10-10 16:28:15 -06:00
|
|
|
if (dev_priv->card_type<NV_40)
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR_EN, 0);
|
2006-10-10 16:28:15 -06:00
|
|
|
else
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV40_PGRAPH_INTR_EN, 0);
|
2006-08-26 16:55:02 -06:00
|
|
|
#if 0
|
|
|
|
/* Disable CRTC0/1 interrupts */
|
|
|
|
NV_WRITE(NV_CRTC0_INTEN, 0);
|
|
|
|
NV_WRITE(NV_CRTC1_INTEN, 0);
|
|
|
|
#endif
|
|
|
|
/* Master disable */
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PMC_INTR_EN_0, 0);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2006-10-10 16:28:15 -06:00
|
|
|
static void nouveau_fifo_irq_handler(drm_device_t *dev)
|
2006-08-26 16:55:02 -06:00
|
|
|
{
|
2006-10-16 14:29:31 -06:00
|
|
|
uint32_t status, chmode, chstat, channel;
|
2006-10-10 16:28:15 -06:00
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
2006-08-26 16:55:02 -06:00
|
|
|
|
2007-02-27 21:14:08 -07:00
|
|
|
status = NV_READ(NV03_PFIFO_INTR_0);
|
2006-08-26 16:55:02 -06:00
|
|
|
if (!status)
|
|
|
|
return;
|
2007-02-02 20:57:06 -07:00
|
|
|
chmode = NV_READ(NV04_PFIFO_MODE);
|
|
|
|
chstat = NV_READ(NV04_PFIFO_DMA);
|
|
|
|
channel=NV_READ(NV03_PFIFO_CACHE1_PUSH1)&(nouveau_fifo_number(dev)-1);
|
2006-08-26 16:55:02 -06:00
|
|
|
|
2006-10-16 14:29:31 -06:00
|
|
|
DRM_DEBUG("NV: PFIFO interrupt! Channel=%d, INTSTAT=0x%08x/MODE=0x%08x/PEND=0x%08x\n", channel, status, chmode, chstat);
|
2006-08-26 16:55:02 -06:00
|
|
|
|
2006-10-12 13:18:55 -06:00
|
|
|
if (status & NV_PFIFO_INTR_CACHE_ERROR) {
|
2006-10-17 06:44:05 -06:00
|
|
|
uint32_t c1get, c1method, c1data;
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
DRM_ERROR("NV: PFIFO error interrupt\n");
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
c1get = NV_READ(NV03_PFIFO_CACHE1_GET) >> 2;
|
2006-10-17 06:44:05 -06:00
|
|
|
if (dev_priv->card_type < NV_40) {
|
|
|
|
/* Untested, so it may not work.. */
|
2007-02-02 20:57:06 -07:00
|
|
|
c1method = NV_READ(NV04_PFIFO_CACHE1_METHOD(c1get));
|
|
|
|
c1data = NV_READ(NV04_PFIFO_CACHE1_DATA(c1get));
|
2006-10-17 06:44:05 -06:00
|
|
|
} else {
|
2007-02-02 20:57:06 -07:00
|
|
|
c1method = NV_READ(NV40_PFIFO_CACHE1_METHOD(c1get));
|
|
|
|
c1data = NV_READ(NV40_PFIFO_CACHE1_DATA(c1get));
|
2006-10-17 06:44:05 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
DRM_ERROR("NV: Channel %d/%d - Method 0x%04x, Data 0x%08x\n",
|
2006-10-17 08:07:48 -06:00
|
|
|
channel, (c1method >> 13) & 7,
|
2006-10-17 06:44:05 -06:00
|
|
|
c1method & 0x1ffc, c1data
|
|
|
|
);
|
|
|
|
|
2006-10-12 13:18:55 -06:00
|
|
|
status &= ~NV_PFIFO_INTR_CACHE_ERROR;
|
2007-03-07 03:00:55 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_0, NV_PFIFO_INTR_CACHE_ERROR);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2006-10-14 08:36:11 -06:00
|
|
|
if (status & NV_PFIFO_INTR_DMA_PUSHER) {
|
|
|
|
DRM_INFO("NV: PFIFO DMA pusher interrupt\n");
|
|
|
|
|
|
|
|
status &= ~NV_PFIFO_INTR_DMA_PUSHER;
|
2007-03-07 03:00:55 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_0, NV_PFIFO_INTR_DMA_PUSHER);
|
2006-10-14 08:36:11 -06:00
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV04_PFIFO_CACHE1_DMA_STATE, 0x00000000);
|
|
|
|
if (NV_READ(NV04_PFIFO_CACHE1_DMA_PUT)!=NV_READ(NV04_PFIFO_CACHE1_DMA_GET))
|
2006-10-14 08:36:11 -06:00
|
|
|
{
|
2007-02-02 20:57:06 -07:00
|
|
|
uint32_t getval=NV_READ(NV04_PFIFO_CACHE1_DMA_GET)+4;
|
|
|
|
NV_WRITE(NV04_PFIFO_CACHE1_DMA_GET,getval);
|
2006-10-14 08:36:11 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
if (status) {
|
|
|
|
DRM_INFO("NV: unknown PFIFO interrupt. status=0x%08x\n", status);
|
|
|
|
|
2007-03-07 03:00:55 -07:00
|
|
|
NV_WRITE(NV03_PFIFO_INTR_0, status);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PFIFO_PENDING);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2007-02-02 22:13:27 -07:00
|
|
|
#if 0
|
2006-10-10 16:28:15 -06:00
|
|
|
static void nouveau_nv04_context_switch(drm_device_t *dev)
|
|
|
|
{
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
uint32_t channel,i;
|
|
|
|
uint32_t max=0;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV04_PGRAPH_FIFO,0x0);
|
|
|
|
channel=NV_READ(NV03_PFIFO_CACHE1_PUSH1)&(nouveau_fifo_number(dev)-1);
|
|
|
|
//DRM_INFO("raw PFIFO_CACH1_PHS1 reg is %x\n",NV_READ(NV03_PFIFO_CACHE1_PUSH1));
|
2006-10-10 16:28:15 -06:00
|
|
|
//DRM_INFO("currently on channel %d\n",channel);
|
|
|
|
for (i=0;i<nouveau_fifo_number(dev);i++)
|
|
|
|
if ((dev_priv->fifos[i].used)&&(i!=channel)) {
|
|
|
|
uint32_t put,get,pending;
|
|
|
|
//put=NV_READ(dev_priv->ramfc_offset+i*32);
|
|
|
|
//get=NV_READ(dev_priv->ramfc_offset+4+i*32);
|
|
|
|
put=NV_READ(NV03_FIFO_REGS_DMAPUT(i));
|
|
|
|
get=NV_READ(NV03_FIFO_REGS_DMAGET(i));
|
2007-02-02 20:57:06 -07:00
|
|
|
pending=NV_READ(NV04_PFIFO_DMA);
|
2006-10-10 16:28:15 -06:00
|
|
|
//DRM_INFO("Channel %d (put/get %x/%x)\n",i,put,get);
|
|
|
|
/* mark all pending channels as such */
|
|
|
|
if ((put!=get)&!(pending&(1<<i)))
|
|
|
|
{
|
|
|
|
pending|=(1<<i);
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV04_PFIFO_DMA,pending);
|
2006-10-10 16:28:15 -06:00
|
|
|
}
|
|
|
|
max++;
|
|
|
|
}
|
|
|
|
nouveau_wait_for_idle(dev);
|
|
|
|
|
|
|
|
#if 1
|
|
|
|
/* 2-channel commute */
|
2007-02-02 20:57:06 -07:00
|
|
|
// NV_WRITE(NV03_PFIFO_CACHE1_PUSH1,channel|0x100);
|
2006-10-10 16:28:15 -06:00
|
|
|
if (channel==0)
|
|
|
|
channel=1;
|
|
|
|
else
|
|
|
|
channel=0;
|
|
|
|
// dev_priv->cur_fifo=channel;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV04_PFIFO_NEXT_CHANNEL,channel|0x100);
|
2006-10-10 16:28:15 -06:00
|
|
|
#endif
|
2007-02-02 20:57:06 -07:00
|
|
|
//NV_WRITE(NV03_PFIFO_CACHE1_PUSH1,max|0x100);
|
2006-10-10 16:28:15 -06:00
|
|
|
//NV_WRITE(0x2050,max|0x100);
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV04_PGRAPH_FIFO,0x1);
|
2006-10-10 16:28:15 -06:00
|
|
|
|
|
|
|
}
|
2007-02-02 22:13:27 -07:00
|
|
|
#endif
|
2006-10-10 16:28:15 -06:00
|
|
|
|
2007-02-27 21:14:08 -07:00
|
|
|
static void
|
|
|
|
nouveau_graph_dump_trap_info(drm_device_t *dev)
|
|
|
|
{
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
uint32_t address;
|
|
|
|
uint32_t channel;
|
|
|
|
uint32_t method, subc, data;
|
|
|
|
|
|
|
|
address = NV_READ(0x400704);
|
|
|
|
data = NV_READ(0x400708);
|
|
|
|
channel = (address >> 20) & 0x1F;
|
|
|
|
subc = (address >> 16) & 0x7;
|
|
|
|
method = address & 0x1FFC;
|
|
|
|
|
|
|
|
DRM_ERROR("NV: nSource: 0x%08x, nStatus: 0x%08x\n",
|
|
|
|
NV_READ(0x400108), NV_READ(0x400104));
|
|
|
|
DRM_ERROR("NV: Channel %d/%d (class 0x%04x) -"
|
|
|
|
"Method 0x%04x, Data 0x%08x\n",
|
|
|
|
channel, subc,
|
|
|
|
NV_READ(0x400160+subc*4) & 0xFFFF,
|
|
|
|
method, data
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2006-10-10 16:28:15 -06:00
|
|
|
static void nouveau_pgraph_irq_handler(drm_device_t *dev)
|
2006-08-26 16:55:02 -06:00
|
|
|
{
|
|
|
|
uint32_t status;
|
2006-10-10 16:28:15 -06:00
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
2006-08-26 16:55:02 -06:00
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
status = NV_READ(NV03_PGRAPH_INTR);
|
2006-08-26 16:55:02 -06:00
|
|
|
if (!status)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (status & NV_PGRAPH_INTR_NOTIFY) {
|
|
|
|
uint32_t nsource, nstatus, instance, notify;
|
|
|
|
DRM_DEBUG("NV: PGRAPH notify interrupt\n");
|
|
|
|
|
|
|
|
nstatus = NV_READ(0x00400104);
|
|
|
|
nsource = NV_READ(0x00400108);
|
|
|
|
DRM_DEBUG("nsource:0x%08x\tnstatus:0x%08x\n", nsource, nstatus);
|
|
|
|
|
2007-02-27 21:14:08 -07:00
|
|
|
/* if this wasn't NOTIFICATION_PENDING, dump extra trap info */
|
|
|
|
if (nsource & ~(1<<0)) {
|
|
|
|
nouveau_graph_dump_trap_info(dev);
|
|
|
|
} else {
|
|
|
|
instance = NV_READ(0x00400158);
|
|
|
|
notify = NV_READ(0x00400150) >> 16;
|
|
|
|
DRM_DEBUG("instance:0x%08x\tnotify:0x%08x\n",
|
|
|
|
nsource, nstatus);
|
|
|
|
}
|
2006-08-26 16:55:02 -06:00
|
|
|
|
|
|
|
status &= ~NV_PGRAPH_INTR_NOTIFY;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, NV_PGRAPH_INTR_NOTIFY);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (status & NV_PGRAPH_INTR_BUFFER_NOTIFY) {
|
|
|
|
uint32_t nsource, nstatus, instance, notify;
|
|
|
|
DRM_DEBUG("NV: PGRAPH buffer notify interrupt\n");
|
|
|
|
|
|
|
|
nstatus = NV_READ(0x00400104);
|
|
|
|
nsource = NV_READ(0x00400108);
|
|
|
|
DRM_DEBUG("nsource:0x%08x\tnstatus:0x%08x\n", nsource, nstatus);
|
|
|
|
|
|
|
|
instance = NV_READ(0x00400158);
|
|
|
|
notify = NV_READ(0x00400150) >> 16;
|
2006-10-17 06:08:03 -06:00
|
|
|
DRM_DEBUG("instance:0x%08x\tnotify:0x%08x\n", instance, notify);
|
2006-08-26 16:55:02 -06:00
|
|
|
|
|
|
|
status &= ~NV_PGRAPH_INTR_BUFFER_NOTIFY;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, NV_PGRAPH_INTR_BUFFER_NOTIFY);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (status & NV_PGRAPH_INTR_MISSING_HW) {
|
|
|
|
DRM_ERROR("NV: PGRAPH missing hw interrupt\n");
|
|
|
|
|
|
|
|
status &= ~NV_PGRAPH_INTR_MISSING_HW;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, NV_PGRAPH_INTR_MISSING_HW);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (status & NV_PGRAPH_INTR_ERROR) {
|
2006-11-16 14:05:23 -07:00
|
|
|
uint32_t nsource, nstatus, instance;
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
DRM_ERROR("NV: PGRAPH error interrupt\n");
|
|
|
|
|
2006-11-16 14:05:23 -07:00
|
|
|
nstatus = NV_READ(0x00400104);
|
|
|
|
nsource = NV_READ(0x00400108);
|
2007-01-24 14:16:23 -07:00
|
|
|
DRM_ERROR("nsource:0x%08x\tnstatus:0x%08x\n", nsource, nstatus);
|
2006-11-16 14:05:23 -07:00
|
|
|
|
|
|
|
instance = NV_READ(0x00400158);
|
2007-01-24 14:16:23 -07:00
|
|
|
DRM_ERROR("instance:0x%08x\n", instance);
|
2006-11-16 14:05:23 -07:00
|
|
|
|
2007-02-27 21:14:08 -07:00
|
|
|
nouveau_graph_dump_trap_info(dev);
|
2006-11-16 14:05:23 -07:00
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
status &= ~NV_PGRAPH_INTR_ERROR;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, NV_PGRAPH_INTR_ERROR);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2006-10-10 16:28:15 -06:00
|
|
|
if (status & NV_PGRAPH_INTR_CONTEXT_SWITCH) {
|
2007-02-02 20:57:06 -07:00
|
|
|
uint32_t channel=NV_READ(NV03_PFIFO_CACHE1_PUSH1)&(nouveau_fifo_number(dev)-1);
|
2006-10-10 16:28:15 -06:00
|
|
|
DRM_INFO("NV: PGRAPH context switch interrupt channel %x\n",channel);
|
|
|
|
switch(dev_priv->card_type)
|
|
|
|
{
|
|
|
|
case NV_04:
|
2006-10-12 09:31:49 -06:00
|
|
|
case NV_05:
|
2006-10-10 16:28:15 -06:00
|
|
|
nouveau_nv04_context_switch(dev);
|
|
|
|
break;
|
|
|
|
case NV_10:
|
2007-05-08 13:18:02 -06:00
|
|
|
case NV_17:
|
2006-10-10 16:28:15 -06:00
|
|
|
nouveau_nv10_context_switch(dev);
|
|
|
|
break;
|
2007-01-13 15:19:41 -07:00
|
|
|
case NV_20:
|
2007-01-17 06:46:59 -07:00
|
|
|
case NV_30:
|
2007-01-13 15:19:41 -07:00
|
|
|
nouveau_nv20_context_switch(dev);
|
|
|
|
break;
|
2006-10-10 16:28:15 -06:00
|
|
|
default:
|
|
|
|
DRM_INFO("NV: Context switch not implemented\n");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
status &= ~NV_PGRAPH_INTR_CONTEXT_SWITCH;
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, NV_PGRAPH_INTR_CONTEXT_SWITCH);
|
2006-10-10 16:28:15 -06:00
|
|
|
}
|
|
|
|
|
2006-08-26 16:55:02 -06:00
|
|
|
if (status) {
|
|
|
|
DRM_INFO("NV: Unknown PGRAPH interrupt! STAT=0x%08x\n", status);
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PGRAPH_INTR, status);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
NV_WRITE(NV03_PMC_INTR_0, NV_PMC_INTR_0_PGRAPH_PENDING);
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
2006-10-10 16:28:15 -06:00
|
|
|
static void nouveau_crtc_irq_handler(drm_device_t *dev, int crtc)
|
2006-08-26 16:55:02 -06:00
|
|
|
{
|
2006-10-10 16:28:15 -06:00
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
2006-08-26 16:55:02 -06:00
|
|
|
if (crtc&1) {
|
|
|
|
NV_WRITE(NV_CRTC0_INTSTAT, NV_CRTC_INTR_VBLANK);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (crtc&2) {
|
|
|
|
NV_WRITE(NV_CRTC1_INTSTAT, NV_CRTC_INTR_VBLANK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
irqreturn_t nouveau_irq_handler(DRM_IRQ_ARGS)
|
|
|
|
{
|
|
|
|
drm_device_t *dev = (drm_device_t*)arg;
|
|
|
|
drm_nouveau_private_t *dev_priv = dev->dev_private;
|
|
|
|
uint32_t status;
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
status = NV_READ(NV03_PMC_INTR_0);
|
2006-11-20 17:41:46 -07:00
|
|
|
if (!status)
|
|
|
|
return IRQ_NONE;
|
2006-08-26 16:55:02 -06:00
|
|
|
|
|
|
|
DRM_DEBUG("PMC INTSTAT: 0x%08x\n", status);
|
|
|
|
|
2007-02-02 20:57:06 -07:00
|
|
|
if (status & NV_PMC_INTR_0_PFIFO_PENDING) {
|
2006-10-10 16:28:15 -06:00
|
|
|
nouveau_fifo_irq_handler(dev);
|
2007-02-02 20:57:06 -07:00
|
|
|
status &= ~NV_PMC_INTR_0_PFIFO_PENDING;
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
2007-02-02 20:57:06 -07:00
|
|
|
if (status & NV_PMC_INTR_0_PGRAPH_PENDING) {
|
2006-10-10 16:28:15 -06:00
|
|
|
nouveau_pgraph_irq_handler(dev);
|
2007-02-02 20:57:06 -07:00
|
|
|
status &= ~NV_PMC_INTR_0_PGRAPH_PENDING;
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
2007-02-02 20:57:06 -07:00
|
|
|
if (status & NV_PMC_INTR_0_CRTCn_PENDING) {
|
2006-10-10 16:28:15 -06:00
|
|
|
nouveau_crtc_irq_handler(dev, (status>>24)&3);
|
2007-02-02 20:57:06 -07:00
|
|
|
status &= ~NV_PMC_INTR_0_CRTCn_PENDING;
|
2006-08-26 16:55:02 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
if (status)
|
|
|
|
DRM_ERROR("Unhandled PMC INTR status bits 0x%08x\n", status);
|
|
|
|
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|