static void pciproxy_cleanup(void) { pciproxy_device_t *temp; int i; unsigned char b; /* walk the list and clean everything up */ while (first_dev != NULL) { /* disable the device */ pciproxy_do_read_config(first_dev->fd_config, PCI_COMMAND, &b, 1); b &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY); pciproxy_do_write_config(first_dev->fd_config, PCI_COMMAND, &b, 1); /* remove the irq mapping */ if (first_dev->hostirq != -1) hostirq_unmap(first_dev->hostirq); /* at the moment one can't remove pci devices from the bridge once they are added. * While this makes sense, we have to be careful what is cleaned up here and what * the generic pci cleanup code does. */ /* unmap all mappings */ for (i = 0; i < MAX_BARS; i++) { if (first_dev->bars[i].used) { #ifdef BAR_ACCESS_USERSPACE if (first_dev->bars[i].mapped) remove_io_range(first_dev->bars[i].rangeid); unmap_mem((char *) first_dev->bars[i].lvbase, first_dev->bars[i].mmum.size); #else if (first_dev->bars[i].mapped) _remove_mmu_mapping(&(first_dev->bars[i].mmum)); #endif } } /* close the config fd */ close(first_dev->fd_config); /* goto to next list entry, free memory */ temp = first_dev; first_dev = first_dev->next; free(temp); } }
/* This function is sometimes called (indirectly) from the console thread */ static void vclose( void ) { if( !cv->is_open ) return; /* make sure the display power is on when we leave */ if( cv->blank ) vpowermode( kAVPowerOn ); cv->is_open = 0; if( cv->vmode.lvbase ) { /* XXX: memset on the framebuffer causes the process to die ?!? */ size_t size = (cv->vmode.h * cv->vmode.rowbytes)/sizeof(long); long *p = (long*)(cv->vmode.lvbase + cv->vmode.offs); while( size-- ) *p++ = 0; } unmap_mem( cv->vmode.lvbase, FBBUF_SIZE( &cv->vmode ) ); console_set_gfx_mode(0); }
void unset_card() { unmap_mem(); }