int dev_bootstrap(void) { int err = 0; pcnet32 *nic = NULL; pci_module_hooks *bus = NULL; SHOW_FLOW0(3, "entry"); err = module_get(PCI_BUS_MODULE_NAME, 0, (void **)&bus); if(err < 0) { SHOW_FLOW(3, "Error finding ISA bus module: %d", err); return err; } SHOW_FLOW(3, "Got bus module: %p", bus); nic = pcnet32_new(bus, PCNET_INIT_MODE0 | PCNET_INIT_RXLEN_128 | PCNET_INIT_TXLEN_32, 2048, 2048); if (nic == NULL) { SHOW_FLOW0(3, "pcnet_new returned 0."); return ERR_GENERAL; } if (pcnet32_detect(nic) > -1) { if (pcnet32_init(nic) < 0) { SHOW_FLOW0(3, "pcnet_init failed."); pcnet32_delete(nic); return ERR_GENERAL; } pcnet32_start(nic); if (devfs_publish_indexed_device("net/pcnet32", nic, &pcnet32_hooks) < 0) { SHOW_FLOW0(3, "failed to register device /dev/net/pcnet32/0"); return ERR_GENERAL; } } return 0; }
void pcnet32_test_run() { xprintf("PCNET32 TEST\n"); xprintf("root fnode %p\n", process_current()->root); xprintf("root filesystem name %s\n", process_current()->root->mounted->filesystem->name); xprintf("file id %d\n", process_current()->root->file_id); pci_init(); // ide_init(); ether_init(); ip_init(); pcnet32_init(); //pcnet32 // mounting devfs devfs_mount(); // registering devfs driver_register_devfs(); // mounting tarfs at standard boot location tarfs_mount(multiboot_get_module(0), "/System/Startup"); shell_run(); xprintf("pcnet32_test end\n"); }