diff --git a/repos/dde_ipxe/lib/mk/dde_ipxe_nic.inc b/repos/dde_ipxe/lib/mk/dde_ipxe_nic.inc index 545a102a8..dc28bbbeb 100644 --- a/repos/dde_ipxe/lib/mk/dde_ipxe_nic.inc +++ b/repos/dde_ipxe/lib/mk/dde_ipxe_nic.inc @@ -12,6 +12,7 @@ SRC_C += $(addprefix drivers/bus/, pciextra.c) SRC_C += $(addprefix drivers/bitbash/, bitbash.c spi_bit.c) SRC_C += $(addprefix drivers/nvs/, nvs.c threewire.c) SRC_C += $(addprefix drivers/net/, pcnet32.c intel.c eepro100.c realtek.c mii.c) +SRC_C += $(addprefix drivers/net/tg3/, tg3.c tg3_hw.c tg3_phy.c) INC_DIR += $(LIB_DIR)/include diff --git a/repos/dde_ipxe/patches/tg3.patch b/repos/dde_ipxe/patches/tg3.patch new file mode 100644 index 000000000..eb4e2da2e --- /dev/null +++ b/repos/dde_ipxe/patches/tg3.patch @@ -0,0 +1,13 @@ +diff --git a/src/drivers/net/tg3/tg3.c b/src/drivers/net/tg3/tg3.c +index 32ca160..85dcc56 100644 +--- a/src/drivers/net/tg3/tg3.c ++++ b/src/drivers/net/tg3/tg3.c +@@ -772,7 +772,7 @@ static int tg3_init_one(struct pci_device *pdev) + tp->regs = ioremap(reg_base, reg_size); + if (!tp->regs) { + DBGC(&pdev->dev, "Failed to remap device registers\n"); +- errno = -ENOENT; ++ //errno = -ENOENT; + goto err_out_disable_pdev; + } + diff --git a/repos/dde_ipxe/ports/dde_ipxe.hash b/repos/dde_ipxe/ports/dde_ipxe.hash index 7e85e365d..f0b51e195 100644 --- a/repos/dde_ipxe/ports/dde_ipxe.hash +++ b/repos/dde_ipxe/ports/dde_ipxe.hash @@ -1 +1 @@ -dd11e6a750e68271c2e7d293e9c1d272f7bc78e0 +eff35e8421342189782bdf285801a13fdaa751ec diff --git a/repos/dde_ipxe/ports/dde_ipxe.port b/repos/dde_ipxe/ports/dde_ipxe.port index 66cca0cc1..30fa26458 100644 --- a/repos/dde_ipxe/ports/dde_ipxe.port +++ b/repos/dde_ipxe/ports/dde_ipxe.port @@ -7,7 +7,9 @@ REV(ipxe) := c4bce43c3c4d3c5ebb2d926b58ad16dc9642c19d DIR(ipxe) := src/lib/dde_ipxe PATCHES := patches/dde_ipxe.patch \ - patches/add_devices.patch + patches/add_devices.patch \ + patches/tg3.patch + PATCH_OPT := -p1 -d ${DIR(ipxe)} # vi: set ft=make : diff --git a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc index 10ee742ae..a5fd7f75e 100644 --- a/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc +++ b/repos/dde_ipxe/src/lib/dde_ipxe/dde_support.cc @@ -39,9 +39,6 @@ #include -//using namespace Genode; - - /**************** ** Migriation ** ****************/ @@ -79,10 +76,9 @@ extern "C" void dde_udelay(unsigned long usecs) { /* * This function is called only once during rdtsc calibration (usecs will be - * 10000, see dde.c 'udelay'. We do not use DDE timers here, since Genode's - * timer connection is the most precise one around. + * 10000, see dde.c 'udelay'. */ - Timer::Connection timer; + static Timer::Connection timer; timer.usleep(usecs); } @@ -311,31 +307,28 @@ extern "C" int dde_interrupt_attach(void(*handler)(void *), void *priv) } - - /*************************************************** ** Support for aligned and DMA memory allocation ** ***************************************************/ enum { BACKING_STORE_SIZE = 1024 * 1024 }; +struct Backing_store +{ + Genode::Allocator_avl _avl{Genode::env()->heap()}; + Backing_store(){ + Genode::addr_t base = pci_drv().alloc_dma_memory(BACKING_STORE_SIZE); + /* add to allocator */ + _avl.add_range(base, BACKING_STORE_SIZE); + } +}; + static Genode::Allocator_avl& allocator() { - static Genode::Allocator_avl _avl(Genode::env()->heap()); - return _avl; -} + static Backing_store _instance; + return _instance._avl; - -extern "C" int dde_dma_mem_init() -{ - try { - Genode::addr_t base = pci_drv().alloc_dma_memory(BACKING_STORE_SIZE); - /* add to allocator */ - allocator().add_range(base, BACKING_STORE_SIZE); - } catch (...) { return false; } - - return true; } @@ -414,7 +407,7 @@ struct Slab_backend_alloc : public Genode::Allocator, public Genode::Rm_connection { enum { - VM_SIZE = 512 * 1024, + VM_SIZE = 1024 * 1024, BLOCK_SIZE = 64 * 1024, ELEMENTS = VM_SIZE / BLOCK_SIZE, }; @@ -516,7 +509,7 @@ struct Slab { enum { SLAB_START_LOG2 = 5, /* 32 B */ - SLAB_STOP_LOG2 = 10, /* 1 KiB */ + SLAB_STOP_LOG2 = 13, /* 8 KiB */ NUM_SLABS = (SLAB_STOP_LOG2 - SLAB_START_LOG2) + 1, }; diff --git a/repos/dde_ipxe/src/lib/dde_ipxe/include/dde_support.h b/repos/dde_ipxe/src/lib/dde_ipxe/include/dde_support.h index ce2f5aac1..16ac90a21 100644 --- a/repos/dde_ipxe/src/lib/dde_ipxe/include/dde_support.h +++ b/repos/dde_ipxe/src/lib/dde_ipxe/include/dde_support.h @@ -53,8 +53,6 @@ void dde_printf(const char *fmt, ...); ** Support for aligned and DMA memory allocation ** ***************************************************/ -int dde_dma_mem_init(); - void *dde_dma_alloc(dde_size_t size, dde_size_t align, dde_size_t offset); void dde_dma_free(void *p, dde_size_t size); diff --git a/repos/dde_ipxe/src/lib/dde_ipxe/nic.c b/repos/dde_ipxe/src/lib/dde_ipxe/nic.c index a542ccfa4..61c7349fc 100644 --- a/repos/dde_ipxe/src/lib/dde_ipxe/nic.c +++ b/repos/dde_ipxe/src/lib/dde_ipxe/nic.c @@ -40,7 +40,9 @@ extern struct pci_driver realtek_driver, ifec_driver, intel_driver, - pcnet32_driver; + pcnet32_driver, + tg3_pci_driver; + /** * Driver database (used for probing)PCI_BASE_CLASS_NETWORK @@ -49,7 +51,8 @@ static struct pci_driver *pci_drivers[] = { &realtek_driver, &ifec_driver, &intel_driver, - &pcnet32_driver + &pcnet32_driver, + &tg3_pci_driver }; /** @@ -303,12 +306,6 @@ int dde_ipxe_nic_init(void *ep) /* find iPXE NIC device */ net_dev = find_netdev_by_location(BUS_TYPE_PCI, location); - /* initialize DMA memory backend allocator for nic driver */ - if (!dde_dma_mem_init()) { - LOG("initialization of block memory failed!"); - return 0; - } - /* open iPXE NIC device */ if (netdev_open(net_dev)) { LOG("opening device " FMT_BUSDEVFN " failed",