Example #1
0
File: e1000.c Project: scyphus/aos
void
e1000_update_hw(void)
{
    struct pci *pci;
    struct e1000_device *e1000dev;
    struct netdev *netdev;
    int idx;

    idx = 0;
    pci = pci_list();
    while ( NULL != pci ) {
        if ( 0x8086 == pci->device->vendor_id ) {
            switch ( pci->device->device_id ) {
            case E1000_PRO1000MT:
            case E1000_82545EM:
            case E1000_82541PI:
            case E1000_82573L:
            case E1000_82567LM:
            case E1000_82577LM:
            case E1000_82579LM:
                e1000dev = e1000_init_hw(pci->device);
                netdev = netdev_add_device(e1000dev->macaddr, e1000dev);
                netdev->recvpkt = e1000_recvpkt;
                netdev->sendpkt = e1000_sendpkt;
                idx++;
                break;
            default:
                ;
            }
        }
        pci = pci->next;
    }
}
Example #2
0
static int pci_cmd(int argc, const cmd_args *argv)
{
    if (argc < 2) {
        printf("pci commands:\n");
usage:
        printf("%s list\n", argv[0].str);
        printf("%s config dump <bus> <devfn>\n", argv[0].str);
        printf("%s config <rb|rh|rw> <bus> <devfn> <offset>\n", argv[0].str);
        printf("%s config <mb|mh|mw> <bus> <devfn> <offset> <value>\n", argv[0].str);
        goto out;
    }

    if (!strcmp(argv[1].str, "list")) {
        pci_list();
    } else if (!strcmp(argv[1].str, "config")) {
        if (pci_config(argc, argv)) {
            goto usage;
        }
    } else {
        goto usage;
    }

out:
    return 0;
}
Example #3
0
File: kernel.c Project: Kloniks/muk
void kernel_main(unsigned long magic,
		 unsigned long addr)
{
  multiboot_info_t *mbi;

  if (magic != MULTIBOOT_BOOTLOADER_MAGIC)
    return;

  mbi = (multiboot_info_t*)addr;

  /* kernel init
   */
  serial_init(DEBUG_SERIAL_PORT,
	      DEBUG_SERIAL_SPEED,
	      UART_8BITS_WORD,
	      UART_NO_PARITY,
	      UART_1_STOP_BIT);
  cls();

  cpu_cli();
  printf("[x] interrupts disabled\n");

  gdt_initialize();
  printf("[x] gdt initialized\n");

  idt_initialize();
  printf("[x] idt initialized\n");

  breakpoint_initialize();

#if defined(USE_APIC)
  apic_initialize();
  serial_printl("[x] apic initialized\n");
#else
  pic_initialize();
  serial_printl("[x] pic initialized\n");
#endif /* USE_APIC */

  /* initialize the kernel
   */
  {
    kernel_init(mbi);
  }

  /* memory initialization
   */
  {
    phys_init(mbi);
    phys_debug();
/*     vm_init(); */
/*     unit_test_vm(); */
/*     cpu_hlt(); */
  }

#if defined(USE_PCI)
  pci_initialize();
  pci_list();
#endif

  cpu_sti();

#if defined(USE_TASK)
 {
   /* subsystems
    */
   event_initialize();
   sched_initialize();
   task_initialize();

   /* tasks
    */
   idle_initialize();
   muksh_initialize();
   net_initialize();

/*    task_test(); */

   /* start scheduling
    */
   sched_start();
 }
#endif

 /* endless loop
  */
 serial_printl("[?] kernel loop\n");
 while (1)
   {
     serial_printl("k");
     cpu_hlt();
   }
}