void intel_extreme_uninit(intel_info &info) { CALLED(); if (!info.fake_interrupts && info.shared_info->vblank_sem > 0) { // disable interrupt generation write16(info, find_reg(info, INTEL_INTERRUPT_ENABLED), 0); write16(info, find_reg(info, INTEL_INTERRUPT_MASK), ~0); remove_io_interrupt_handler(info.irq, intel_interrupt_handler, &info); if (info.use_msi && gPCIx86Module != NULL) { gPCIx86Module->disable_msi(info.pci->bus, info.pci->device, info.pci->function); gPCIx86Module->unconfigure_msi(info.pci->bus, info.pci->device, info.pci->function); } } gGART->unmap_aperture(info.aperture); delete_area(info.registers_area); delete_area(info.shared_area); }
static int32 intel_interrupt_handler(void* data) { intel_info &info = *(intel_info*)data; uint32 reg = find_reg(info, INTEL_INTERRUPT_IDENTITY); uint16 identity = read16(info, reg); if (identity == 0) return B_UNHANDLED_INTERRUPT; int32 handled = B_HANDLED_INTERRUPT; while (identity != 0) { // TODO: verify that these aren't actually the same bool hasPCH = info.device_type.HasPlatformControlHub(); uint16 mask = hasPCH ? PCH_INTERRUPT_VBLANK_PIPEA : INTERRUPT_VBLANK_PIPEA; if ((identity & mask) != 0) { handled = release_vblank_sem(info); // make sure we'll get another one of those write32(info, INTEL_DISPLAY_A_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } mask = hasPCH ? PCH_INTERRUPT_VBLANK_PIPEB : INTERRUPT_VBLANK_PIPEB; if ((identity & mask) != 0) { handled = release_vblank_sem(info); // make sure we'll get another one of those write32(info, INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); } // setting the bit clears it! write16(info, reg, identity); identity = read16(info, reg); } return handled; }
void handle_fields (char *str) { char reg_name[1000]; char docref[1000]; struct reg *rp; if (sscanf (str, "%*s %s %s", reg_name, docref) != 2) { syntax_error (NULL); return; } if ((rp = find_reg (reg_name)) == NULL) { syntax_error ("reg_name not found"); return; } rp->docref = strdup (docref); curreg = rp; }
static void init_interrupt_handler(intel_info &info) { info.shared_info->vblank_sem = create_sem(0, "intel extreme vblank"); if (info.shared_info->vblank_sem < B_OK) return; status_t status = B_OK; // We need to change the owner of the sem to the calling team (usually the // app_server), because userland apps cannot acquire kernel semaphores thread_id thread = find_thread(NULL); thread_info threadInfo; if (get_thread_info(thread, &threadInfo) != B_OK || set_sem_owner(info.shared_info->vblank_sem, threadInfo.team) != B_OK) { status = B_ERROR; } // Find the right interrupt vector, using MSIs if available. info.irq = 0xff; info.use_msi = false; if (info.pci->u.h0.interrupt_pin != 0x00) info.irq = info.pci->u.h0.interrupt_line; if (gPCIx86Module != NULL && gPCIx86Module->get_msi_count(info.pci->bus, info.pci->device, info.pci->function) >= 1) { uint8 msiVector = 0; if (gPCIx86Module->configure_msi(info.pci->bus, info.pci->device, info.pci->function, 1, &msiVector) == B_OK && gPCIx86Module->enable_msi(info.pci->bus, info.pci->device, info.pci->function) == B_OK) { ERROR("using message signaled interrupts\n"); info.irq = msiVector; info.use_msi = true; } } if (status == B_OK && info.irq != 0xff) { // we've gotten an interrupt line for us to use info.fake_interrupts = false; status = install_io_interrupt_handler(info.irq, &intel_interrupt_handler, (void*)&info, 0); if (status == B_OK) { write32(info, INTEL_DISPLAY_A_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); write32(info, INTEL_DISPLAY_B_PIPE_STATUS, DISPLAY_PIPE_VBLANK_STATUS | DISPLAY_PIPE_VBLANK_ENABLED); write16(info, find_reg(info, INTEL_INTERRUPT_IDENTITY), ~0); // enable interrupts - we only want VBLANK interrupts bool hasPCH = info.device_type.HasPlatformControlHub(); uint16 enable = hasPCH ? (PCH_INTERRUPT_VBLANK_PIPEA | PCH_INTERRUPT_VBLANK_PIPEB) : (INTERRUPT_VBLANK_PIPEA | INTERRUPT_VBLANK_PIPEB); write16(info, find_reg(info, INTEL_INTERRUPT_ENABLED), enable); write16(info, find_reg(info, INTEL_INTERRUPT_MASK), ~enable); } } if (status < B_OK) { // There is no interrupt reserved for us, or we couldn't install our // interrupt handler, let's fake the vblank interrupt for our clients // using a timer interrupt info.fake_interrupts = true; // TODO: fake interrupts! TRACE("Fake interrupt mode (no PCI interrupt line assigned\n"); status = B_ERROR; } if (status < B_OK) { delete_sem(info.shared_info->vblank_sem); info.shared_info->vblank_sem = B_ERROR; } }
void global_alloc () { find_reg (0); find_reg (1); }
//---------------------------------------------------------------------- void jump_pattern_t::spoil(int reg) { int idx = find_reg(reg); if ( idx != -1 ) spoiled[idx] = true; }