Example #1
0
File: e100.c Project: mcorley/jos
int 
e100_pci_attach(struct pci_func *pcif)
{ 
	// The device has been found but needs to be enabled.
	pci_func_enable(pcif);

	// Record the IRQ line and base I/O port assigned to the device 
	// so we'll be able to communicate with the E100.
	e100.io_base = pcif->reg_base[E100_IO];
	e100.irq_line = pcif->irq_line;

	e100_init();
	return 0;
}
Example #2
0
int e100_attach(pci_pdata_t pd) {
	pci_func_enable(pd);
	e100.busno = pd->busno;
	e100.slot = pd->slot;
	e100.func = pd->func;
	e100.device = pd->device;
	e100.vendor = pd->vendor;
	e100.class_code= pd->class_code;
	int i;
	for (i = 0; i < 6; i++) {
		e100.addr_base[i] = pd->addr_base[i];
		e100.addr_size[i] = pd->addr_size[i];
	}
	e100.irq_line = pd->irq_line;

	// initialize network interface controller
	nic.io_base = pd->addr_base[E100_IO];
	nic.io_size = pd->addr_size[E100_IO];

	// initize e100 driver
	e100_init();

	return 0;
}