/*********************************************************************** * dibdrv_SetROP2 */ static INT dibdrv_SetROP2( PHYSDEV dev, INT rop ) { PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetROP2 ); dibdrv_physdev *pdev = get_dibdrv_pdev(dev); update_masks( pdev, rop ); return next->funcs->pSetROP2( next, rop ); }
int intr_disconnect(intrec *idesc) { intrec **hook, *head; int irq; int errcode = 0; if (idesc == NULL) return (-1); irq = idesc->intr; /* find pointer that keeps the reference to this interrupt descriptor */ hook = find_pred(idesc, irq); if (hook == NULL) return (-1); /* make copy of original list head, the line after may overwrite it */ head = intreclist_head[irq]; /* unlink: make predecessor point to idesc->next instead of to idesc */ *hook = idesc->next; /* now check whether the element we removed was the list head */ if (idesc == head) { intrmask_t oldspl = splq(1 << irq); /* we want to remove the list head, which was known to intr_mux */ icu_unset(irq, (inthand2_t*)intr_mux); /* check whether the new list head is the only element on list */ head = intreclist_head[irq]; if (head != NULL) { if (head->next != NULL) { /* install the multiplex handler with new list head as argument */ errcode = icu_setup(irq, (inthand2_t*)intr_mux, head, 0, 0); if (errcode == 0) update_intrname(irq, -1); } else { /* install the one remaining handler for this irq */ errcode = icu_setup(irq, head->handler, head->argument, head->maskptr, head->flags); if (errcode == 0) update_intrname(irq, (intptr_t)head->devdata); } } splx(oldspl); } update_masks(idesc->maskptr, irq); #ifdef RESOURCE_CHECK resource_free(idesc->devdata); #endif /* RESOURCE_CHECK */ return (0); }
static int ixp425_teardown_intr(device_t dev, device_t child, struct resource *res, void *cookie) { uint32_t mask, mask2; get_masks(res, &mask, &mask2); update_masks(intr_enabled &~ mask, intr_enabled2 &~ mask2); return (BUS_TEARDOWN_INTR(device_get_parent(dev), child, res, cookie)); }
static int ixp425_setup_intr(device_t dev, device_t child, struct resource *res, int flags, driver_filter_t *filt, driver_intr_t *intr, void *arg, void **cookiep) { uint32_t mask, mask2; BUS_SETUP_INTR(device_get_parent(dev), child, res, flags, filt, intr, arg, cookiep); get_masks(res, &mask, &mask2); update_masks(intr_enabled | mask, intr_enabled2 | mask2); return (0); }
static int add_intrdesc(intrec *idesc) { int irq = idesc->intr; intrec *head = intreclist_head[irq]; if (head == NULL) { /* first handler for this irq, just install it */ if (icu_setup(irq, idesc->handler, idesc->argument, idesc->maskptr, idesc->flags) != 0) return (-1); update_intrname(irq, (intptr_t)idesc->devdata); /* keep reference */ intreclist_head[irq] = idesc; } else { if ((idesc->flags & INTR_EXCL) != 0 || (head->flags & INTR_EXCL) != 0) { /* * can't append new handler, if either list head or * new handler do not allow interrupts to be shared */ if (bootverbose) printf("\tdevice combination doesn't support " "shared irq%d\n", irq); return (-1); } if (head->next == NULL) { /* * second handler for this irq, replace device driver's * handler by shared interrupt multiplexer function */ icu_unset(irq, head->handler); if (icu_setup(irq, (inthand2_t*)intr_mux, head, 0, 0) != 0) return (-1); if (bootverbose) printf("\tusing shared irq%d.\n", irq); update_intrname(irq, -1); } /* just append to the end of the chain */ while (head->next != NULL) head = head->next; head->next = idesc; } update_masks(idesc->maskptr, irq); return (0); }
/*********************************************************************** * dibdrv_SetDIBColorTable */ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RGBQUAD *colors ) { PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetDIBColorTable ); dibdrv_physdev *pdev = get_dibdrv_pdev(dev); TRACE("(%p, %d, %d, %p)\n", dev, pos, count, colors); if( pdev->dib.color_table && pos < pdev->dib.color_table_size ) { if( pos + count > pdev->dib.color_table_size ) count = pdev->dib.color_table_size - pos; memcpy( pdev->dib.color_table + pos, colors, count * sizeof(RGBQUAD) ); pdev->bkgnd_color = get_pixel_color( pdev, GetBkColor( dev->hdc ), FALSE ); update_fg_colors( pdev ); update_masks( pdev, GetROP2( dev->hdc ) ); } return next->funcs->pSetDIBColorTable( next, pos, count, colors ); }