added no-INT-assigned capability to kerneldriver. Updated docs.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14439 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
Other authors:
|
||||
Mark Watson;
|
||||
Rudolf Cornelissen 3/2002-9/2005.
|
||||
Rudolf Cornelissen 3/2002-10/2005.
|
||||
*/
|
||||
|
||||
/* standard kernel driver stuff */
|
||||
@@ -852,7 +852,6 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
thread_id thid;
|
||||
thread_info thinfo;
|
||||
status_t result = B_OK;
|
||||
vuint32 *regs;
|
||||
char shared_name[B_OS_NAME_LENGTH];
|
||||
physical_entry map[1];
|
||||
size_t net_buf_size;
|
||||
@@ -971,14 +970,19 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
/* map the device */
|
||||
result = map_device(di);
|
||||
if (result < 0) goto free_shared_and_alldma;
|
||||
|
||||
/* we will be returning OK status for sure now */
|
||||
result = B_OK;
|
||||
|
||||
/* disable and clear any pending interrupts */
|
||||
disable_vbi(di->regs);
|
||||
|
||||
/* preset we can't use INT related functions */
|
||||
si->ps.int_assigned = false;
|
||||
|
||||
/* create a semaphore for vertical blank management */
|
||||
si->vblank = create_sem(0, di->name);
|
||||
if (si->vblank < 0) {
|
||||
result = si->vblank;
|
||||
goto unmap;
|
||||
}
|
||||
if (si->vblank < 0) goto mark_as_open;
|
||||
|
||||
/* change the owner of the semaphores to the opener's team */
|
||||
/* this is required because apps can't aquire kernel semaphores */
|
||||
@@ -986,29 +990,31 @@ static status_t open_hook (const char* name, uint32 flags, void** cookie) {
|
||||
get_thread_info(thid, &thinfo);
|
||||
set_sem_owner(si->vblank, thinfo.team);
|
||||
|
||||
/* assign local regs pointer for SAMPLExx() macros */
|
||||
regs = di->regs;
|
||||
|
||||
/* disable and clear any pending interrupts */
|
||||
disable_vbi(regs);
|
||||
|
||||
/* If there is a valid interrupt line assigned then set up interrupts */
|
||||
if ((di->pcii.u.h0.interrupt_pin == 0x00) ||
|
||||
(di->pcii.u.h0.interrupt_line == 0xff) || /* no IRQ assigned */
|
||||
(di->pcii.u.h0.interrupt_line <= 0x02)) /* system IRQ assigned */
|
||||
{
|
||||
/* we are aborting! */
|
||||
/* Note: the R4 graphics driver kit lacks this statement!! */
|
||||
result = B_ERROR;
|
||||
/* interrupt does not exist so exit without installing our handler */
|
||||
goto delete_the_sem;
|
||||
/* delete the semaphore as it won't be used */
|
||||
delete_sem(si->vblank);
|
||||
si->vblank = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* otherwise install our interrupt handler */
|
||||
result = install_io_interrupt_handler(di->pcii.u.h0.interrupt_line, nv_interrupt, (void *)di, 0);
|
||||
/* bail if we couldn't install the handler */
|
||||
if (result != B_OK) goto delete_the_sem;
|
||||
if (result != B_OK)
|
||||
{
|
||||
/* delete the semaphore as it won't be used */
|
||||
delete_sem(si->vblank);
|
||||
si->vblank = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* inform accelerant(s) we can use INT related functions */
|
||||
si->ps.int_assigned = true;
|
||||
}
|
||||
}
|
||||
|
||||
mark_as_open:
|
||||
@@ -1021,12 +1027,6 @@ mark_as_open:
|
||||
goto done;
|
||||
|
||||
|
||||
delete_the_sem:
|
||||
delete_sem(si->vblank);
|
||||
|
||||
unmap:
|
||||
unmap_device(di);
|
||||
|
||||
free_shared_and_alldma:
|
||||
/* clean up our aligned DMA area */
|
||||
delete_area(si->dma_area);
|
||||
@@ -1106,8 +1106,11 @@ free_hook (void* dev) {
|
||||
remove_io_interrupt_handler(di->pcii.u.h0.interrupt_line, nv_interrupt, di);
|
||||
|
||||
/* delete the semaphores, ignoring any errors ('cause the owning team may have died on us) */
|
||||
delete_sem(si->vblank);
|
||||
si->vblank = -1;
|
||||
if (si->ps.int_assigned)
|
||||
{
|
||||
delete_sem(si->vblank);
|
||||
si->vblank = -1;
|
||||
}
|
||||
|
||||
/* free regs and framebuffer areas */
|
||||
unmap_device(di);
|
||||
|
||||
Reference in New Issue
Block a user