Temporarily disabled interrupt handling: this fixes a strange symptom that happen

on stippi's and my laptop when connected to a power outlet (no interrupts arrive
anymore but timer interrupts).
Need to investigate this a bit more...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16553 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-02-28 21:22:26 +00:00
parent 3a14d2275f
commit adbba9cd76
@@ -1,21 +1,23 @@
/* /*
Copyright (c) 2002-2004, Thomas Kurschel * Copyright 2006, Haiku, Inc. All Rights Reserved.
* Copyright 2002-2004, Thomas Kurschel
*
Part of Radeon kernel driver * Distributed under the terms of the MIT License.
Interrupt handling. Currently, none of this is used
as I haven't got the HW spec.
*/ */
#include "radeon_driver.h" /** Interrupt handling. Currently, none of this is used
#include <stdio.h> * as I haven't got the HW spec.
*/
#include "mmio.h" #include "mmio.h"
#include "radeon_driver.h"
#include "rbbm_regs.h" #include "rbbm_regs.h"
#include <stdio.h>
/** Disable all interrupts */
// disable all interrupts
static void static void
Radeon_DisableIRQ(device_info *di) Radeon_DisableIRQ(device_info *di)
{ {
@@ -23,35 +25,35 @@ Radeon_DisableIRQ( device_info *di )
} }
// interrupt worker routine /** Interrupt worker routine
// handles standard interrupts, i.e. VBI and DMA * handles standard interrupts, i.e. VBI and DMA
*/
static uint32 static uint32
Radeon_ThreadInterruptWork(vuint8 *regs, device_info *di, uint32 int_status) Radeon_ThreadInterruptWork(vuint8 *regs, device_info *di, uint32 int_status)
{ {
shared_info *si = di->si; shared_info *si = di->si;
uint32 handled = B_HANDLED_INTERRUPT; uint32 handled = B_HANDLED_INTERRUPT;
if( (int_status & RADEON_CRTC_VBLANK_STAT) != 0 && if ((int_status & RADEON_CRTC_VBLANK_STAT) != 0
si->crtc[0].vblank >= 0 ) && si->crtc[0].vblank >= 0) {
{
int32 blocked; int32 blocked;
++di->vbi_count[0]; ++di->vbi_count[0];
if( (get_sem_count( si->crtc[0].vblank, &blocked ) == B_OK) && (blocked < 0) ) { if (get_sem_count(si->crtc[0].vblank, &blocked ) == B_OK && blocked < 0) {
release_sem_etc(si->crtc[0].vblank, -blocked, B_DO_NOT_RESCHEDULE); release_sem_etc(si->crtc[0].vblank, -blocked, B_DO_NOT_RESCHEDULE);
handled = B_INVOKE_SCHEDULER; handled = B_INVOKE_SCHEDULER;
} }
} }
if( (int_status & RADEON_CRTC2_VBLANK_STAT) != 0 && if ((int_status & RADEON_CRTC2_VBLANK_STAT) != 0
si->crtc[1].vblank >= 0 ) && si->crtc[1].vblank >= 0) {
{
int32 blocked; int32 blocked;
++di->vbi_count[1]; ++di->vbi_count[1];
if( (get_sem_count( si->crtc[1].vblank, &blocked ) == B_OK) && (blocked < 0) ) { if (get_sem_count(si->crtc[1].vblank, &blocked) == B_OK && blocked < 0) {
release_sem_etc(si->crtc[1].vblank, -blocked, B_DO_NOT_RESCHEDULE); release_sem_etc(si->crtc[1].vblank, -blocked, B_DO_NOT_RESCHEDULE);
handled = B_INVOKE_SCHEDULER; handled = B_INVOKE_SCHEDULER;
} }
@@ -66,7 +68,9 @@ Radeon_ThreadInterruptWork( vuint8 *regs, device_info *di, uint32 int_status )
} }
// Capture interrupt handler #if 0
/** Capture interrupt handler */
static int32 static int32
Radeon_HandleCaptureInterrupt(vuint8 *regs, device_info *di, uint32 cap_status) Radeon_HandleCaptureInterrupt(vuint8 *regs, device_info *di, uint32 cap_status)
{ {
@@ -84,7 +88,7 @@ Radeon_HandleCaptureInterrupt( vuint8 *regs, device_info *di, uint32 cap_status
restore_interrupts(prev_irq_state); restore_interrupts(prev_irq_state);
// don't release if semaphore count is positive, i.e. notifications are piling up // don't release if semaphore count is positive, i.e. notifications are piling up
if( (get_sem_count( di->cap_sem, &blocked ) == B_OK) && (blocked <= 0) ) { if (get_sem_count(di->cap_sem, &blocked) == B_OK && blocked <= 0) {
release_sem_etc(di->cap_sem, 1, B_DO_NOT_RESCHEDULE); release_sem_etc(di->cap_sem, 1, B_DO_NOT_RESCHEDULE);
handled = B_INVOKE_SCHEDULER; handled = B_INVOKE_SCHEDULER;
} }
@@ -95,7 +99,9 @@ Radeon_HandleCaptureInterrupt( vuint8 *regs, device_info *di, uint32 cap_status
return handled; return handled;
} }
// Main interrupt handler
/** Main interrupt handler */
static int32 static int32
Radeon_Interrupt(void *data) Radeon_Interrupt(void *data)
{ {
@@ -140,8 +146,11 @@ Radeon_Interrupt(void *data)
return handled; return handled;
} }
#endif
static int32 timer_interrupt_func( timer *te )
static int32
timer_interrupt_func(timer *te)
{ {
bigtime_t now = system_time(); bigtime_t now = system_time();
/* get the pointer to the device we're handling this time */ /* get the pointer to the device we're handling this time */
@@ -165,17 +174,22 @@ static int32 timer_interrupt_func( timer *te )
} }
/* do the things we do when we notice a vertical retrace */ /* do the things we do when we notice a vertical retrace */
result = Radeon_ThreadInterruptWork(regs, di, result = Radeon_ThreadInterruptWork(regs, di,
RADEON_CRTC_VBLANK_STAT | RADEON_CRTC_VBLANK_STAT
(di->num_crtc > 1 ? RADEON_CRTC2_VBLANK_STAT : 0 )); | (di->num_crtc > 1 ? RADEON_CRTC2_VBLANK_STAT : 0));
} }
/* pick the "other" timer */ /* pick the "other" timer */
to = (timer *)&(di->ti_a); to = (timer *)&di->ti_a;
if (to == te) to = (timer *)&(di->ti_b); if (to == te)
to = (timer *)&di->ti_b;
/* our guess as to when we should be back */ /* our guess as to when we should be back */
((timer_info *)to)->when_target = now + when; ((timer_info *)to)->when_target = now + when;
/* reschedule the interrupt */ /* reschedule the interrupt */
add_timer(to, timer_interrupt_func, ((timer_info *)to)->when_target, B_ONE_SHOT_ABSOLUTE_TIMER); add_timer(to, timer_interrupt_func, ((timer_info *)to)->when_target,
B_ONE_SHOT_ABSOLUTE_TIMER);
/* remember the currently active timer */ /* remember the currently active timer */
di->current_timer = (timer_info *)to; di->current_timer = (timer_info *)to;
} }
@@ -184,9 +198,11 @@ static int32 timer_interrupt_func( timer *te )
} }
// setup IRQ handlers. /** Setup IRQ handlers.
// includes an VBI emulator via a timer (according to sample code), * Includes an VBI emulator via a timer (according to sample code),
// though this makes sense for one CRTC only * though this makes sense for one CRTC only.
*/
status_t status_t
Radeon_SetupIRQ(device_info *di, char *buffer) Radeon_SetupIRQ(device_info *di, char *buffer)
{ {
@@ -250,7 +266,7 @@ Radeon_SetupIRQ( device_info *di, char *buffer )
Radeon_DisableIRQ(di); Radeon_DisableIRQ(di);
/* if we're faking interrupts */ /* if we're faking interrupts */
if ((di->pcii.u.h0.interrupt_pin == 0x00) || (di->pcii.u.h0.interrupt_line == 0xff)){ if (di->pcii.u.h0.interrupt_pin == 0x00 || di->pcii.u.h0.interrupt_line == 0xff) {
SHOW_INFO0( 3, "We like to fake IRQ" ); SHOW_INFO0( 3, "We like to fake IRQ" );
/* fake some kind of interrupt with a timer */ /* fake some kind of interrupt with a timer */
di->shutdown_virtual_irq = false; di->shutdown_virtual_irq = false;
@@ -259,7 +275,7 @@ Radeon_SetupIRQ( device_info *di, char *buffer )
di->ti_a.di = di; /* refer to ourself */ di->ti_a.di = di; /* refer to ourself */
di->ti_b.di = di; di->ti_b.di = di;
di->current_timer = &(di->ti_a); di->current_timer = &di->ti_a;
/* program the first timer interrupt, and it will handle the rest */ /* program the first timer interrupt, and it will handle the rest */
result = add_timer((timer *)(di->current_timer), timer_interrupt_func, result = add_timer((timer *)(di->current_timer), timer_interrupt_func,
@@ -268,12 +284,15 @@ Radeon_SetupIRQ( device_info *di, char *buffer )
goto err5; goto err5;
} else { } else {
/* otherwise install our interrupt handler */ /* otherwise install our interrupt handler */
dprintf("radeon: real interrupt handling disabled\n");
#if 0
result = install_io_interrupt_handler(di->pcii.u.h0.interrupt_line, result = install_io_interrupt_handler(di->pcii.u.h0.interrupt_line,
Radeon_Interrupt, (void *)di, 0); Radeon_Interrupt, (void *)di, 0);
if (result != B_OK) if (result != B_OK)
goto err5; goto err5;
SHOW_INFO(3, "installed IRQ @ %d", di->pcii.u.h0.interrupt_line); SHOW_INFO(3, "installed IRQ @ %d", di->pcii.u.h0.interrupt_line);
#endif
} }
return B_OK; return B_OK;
@@ -292,7 +311,8 @@ err1:
} }
// clean-up interrupt handling /** Clean-up interrupt handling */
void void
Radeon_CleanupIRQ(device_info *di) Radeon_CleanupIRQ(device_info *di)
{ {
@@ -300,6 +320,7 @@ Radeon_CleanupIRQ( device_info *di )
Radeon_DisableIRQ(di); Radeon_DisableIRQ(di);
#if 0
/* if we were faking the interrupts */ /* if we were faking the interrupts */
if ((di->pcii.u.h0.interrupt_pin == 0x00) || (di->pcii.u.h0.interrupt_line == 0xff)){ if ((di->pcii.u.h0.interrupt_pin == 0x00) || (di->pcii.u.h0.interrupt_line == 0xff)){
/* stop our interrupt faking thread */ /* stop our interrupt faking thread */
@@ -312,6 +333,7 @@ Radeon_CleanupIRQ( device_info *di )
/* remove interrupt handler */ /* remove interrupt handler */
remove_io_interrupt_handler(di->pcii.u.h0.interrupt_line, Radeon_Interrupt, di); remove_io_interrupt_handler(di->pcii.u.h0.interrupt_line, Radeon_Interrupt, di);
} }
#endif
delete_sem(si->crtc[0].vblank); delete_sem(si->crtc[0].vblank);