void console_init(void) { #if defined(__BOOT_BLOCK__) && CONFIG_BOOTBLOCK_CONSOLE || \ !defined(__BOOT_BLOCK__) && CONFIG_EARLY_CONSOLE #if CONFIG_CONSOLE_SERIAL uart_init(); #endif #if CONFIG_DRIVERS_OXFORD_OXPCIE && CONFIG_CONSOLE_SERIAL8250MEM oxford_init(); #endif #if CONFIG_CONSOLE_NE2K ne2k_init(CONFIG_CONSOLE_NE2K_IO_PORT); #endif #if CONFIG_CONSOLE_CBMEM && CONFIG_EARLY_CBMEM_INIT && !defined(__BOOT_BLOCK__) cbmemc_init(); #endif #if CONFIG_SPKMODEM spkmodem_init(); #endif #if CONFIG_USBDEBUG_IN_ROMSTAGE && !defined(__BOOT_BLOCK__) usbdebug_init(); #endif static const char console_test[] = "\n\ncoreboot-" COREBOOT_VERSION COREBOOT_EXTRA_VERSION " " COREBOOT_BUILD " starting...\n"; print_info(console_test); #endif /* CONFIG_EARLY_CONSOLE */ }
static int ne2k_driver_probe(struct vmm_driver *dev, const struct vmm_devid *devid) { int rc; struct vmm_netdev *ndev; struct nic_priv_data *priv_data; ndev = vmm_malloc(sizeof(struct vmm_netdev)); if(!ndev) { rc = VMM_EFAIL; goto free_nothing; } vmm_memset(ndev,0, sizeof(struct vmm_netdev)); priv_data = vmm_malloc(sizeof(struct nic_priv_data)); if(!priv_data) { rc = VMM_EFAIL; goto free_chardev; } vmm_memset(priv_data,0, sizeof(struct nic_priv_data)); if (ne2k_init(priv_data)) { rc = VMM_EFAIL; goto free_chardev; } priv_data->txrx_thread = vmm_hyperthread_create("ne2k-isa-driver", dp83902a_poll, priv_data); if (priv_data == NULL) { rc = VMM_EFAIL; goto free_chardev; } vmm_hyperthread_run(priv_data->txrx_thread); vmm_strcpy(ndev->name, dev->node->name); ndev->dev = dev; ndev->ioctl = NULL; ndev->read = ne2k_read; ndev->write = ne2k_write; ndev->priv = (void *)priv_data; rc = vmm_netdev_register(ndev); if(rc) { goto free_port; } dev->priv = (void *)ndev; return VMM_OK; free_port: vmm_free(priv_data); free_chardev: vmm_free(ndev); free_nothing: return rc; }
void arch_init() { pci_init(); #ifdef __CONFIG_ENABLE_MPTABLES__ mptables_parse(); ioapic_init(); // MUST BE AFTER PCI/ISA INIT! // TODO: move these back to regular init. requires fixing the // __CONFIG_NETWORKING__ inits to not need multiple cores running. #endif // this returns when all other cores are done and ready to receive IPIs #ifdef __CONFIG_SINGLE_CORE__ smp_percpu_init(); #else smp_boot(); #endif proc_init(); /* EXPERIMENTAL NETWORK FUNCTIONALITY * To enable, define __CONFIG_NETWORKING__ in your Makelocal * If enabled, will load the rl8168 driver (if device exists) * and will a boot into userland matrix, so remote syscalls can be performed. * If in simulation, will do some debugging information with the ne2k device * * Note: If you use this, you should also define the mac address of the * teathered machine via USER_MAC_ADDRESS in Makelocal. * * Additionally, you should have a look at the syscall server in the tools directory */ #ifdef __CONFIG_NETWORKING__ #ifdef __CONFIG_SINGLE_CORE__ warn("You currently can't have networking if you boot into single core mode!!\n"); #else rl8168_init(); ne2k_init(); e1000_init(); #endif // __CONFIG_SINGLE_CORE__ #endif // __CONFIG_NETWORKING__ perfmon_init(); #ifdef __CONFIG_MONITOR_ON_INT__ /* Handler to read a char from the interrupt source and call the monitor. * Need to read the character so the device will send another interrupt. * Note this will read from both the serial and the keyboard, and throw away * the result. We condition, since we don't want to trigger on a keyboard * up interrupt */ void mon_int(struct trapframe *tf, void *data) { // Enable interrupts here so that we can receive // other interrupts (e.g. from the NIC) enable_irq(); if (cons_getc()) monitor(0); }