dde_ipxe: enable BCM57cxx cards

Add tg3 driver files and adjust Genode's ipxe code. Tested on Fiasco.OC only.

issue #1609
This commit is contained in:
Sebastian Sumpf 2015-07-01 10:41:59 +02:00 committed by Christian Helmuth
parent b13b0113c8
commit ffaf65efa0
7 changed files with 39 additions and 35 deletions

View File

@ -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/bitbash/, bitbash.c spi_bit.c)
SRC_C += $(addprefix drivers/nvs/, nvs.c threewire.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/, 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 INC_DIR += $(LIB_DIR)/include

View File

@ -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;
}

View File

@ -1 +1 @@
dd11e6a750e68271c2e7d293e9c1d272f7bc78e0 eff35e8421342189782bdf285801a13fdaa751ec

View File

@ -7,7 +7,9 @@ REV(ipxe) := c4bce43c3c4d3c5ebb2d926b58ad16dc9642c19d
DIR(ipxe) := src/lib/dde_ipxe DIR(ipxe) := src/lib/dde_ipxe
PATCHES := patches/dde_ipxe.patch \ PATCHES := patches/dde_ipxe.patch \
patches/add_devices.patch patches/add_devices.patch \
patches/tg3.patch
PATCH_OPT := -p1 -d ${DIR(ipxe)} PATCH_OPT := -p1 -d ${DIR(ipxe)}
# vi: set ft=make : # vi: set ft=make :

View File

@ -39,9 +39,6 @@
#include <dde_support.h> #include <dde_support.h>
//using namespace Genode;
/**************** /****************
** Migriation ** ** 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 * 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 * 10000, see dde.c 'udelay'.
* timer connection is the most precise one around.
*/ */
Timer::Connection timer; static Timer::Connection timer;
timer.usleep(usecs); 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 ** ** Support for aligned and DMA memory allocation **
***************************************************/ ***************************************************/
enum { BACKING_STORE_SIZE = 1024 * 1024 }; 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& allocator()
{ {
static Genode::Allocator_avl _avl(Genode::env()->heap()); static Backing_store _instance;
return _avl; 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 public Genode::Rm_connection
{ {
enum { enum {
VM_SIZE = 512 * 1024, VM_SIZE = 1024 * 1024,
BLOCK_SIZE = 64 * 1024, BLOCK_SIZE = 64 * 1024,
ELEMENTS = VM_SIZE / BLOCK_SIZE, ELEMENTS = VM_SIZE / BLOCK_SIZE,
}; };
@ -516,7 +509,7 @@ struct Slab
{ {
enum { enum {
SLAB_START_LOG2 = 5, /* 32 B */ 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, NUM_SLABS = (SLAB_STOP_LOG2 - SLAB_START_LOG2) + 1,
}; };

View File

@ -53,8 +53,6 @@ void dde_printf(const char *fmt, ...);
** Support for aligned and DMA memory allocation ** ** 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_alloc(dde_size_t size, dde_size_t align, dde_size_t offset);
void dde_dma_free(void *p, dde_size_t size); void dde_dma_free(void *p, dde_size_t size);

View File

@ -40,7 +40,9 @@ extern struct pci_driver
realtek_driver, realtek_driver,
ifec_driver, ifec_driver,
intel_driver, intel_driver,
pcnet32_driver; pcnet32_driver,
tg3_pci_driver;
/** /**
* Driver database (used for probing)PCI_BASE_CLASS_NETWORK * Driver database (used for probing)PCI_BASE_CLASS_NETWORK
@ -49,7 +51,8 @@ static struct pci_driver *pci_drivers[] = {
&realtek_driver, &realtek_driver,
&ifec_driver, &ifec_driver,
&intel_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 */ /* find iPXE NIC device */
net_dev = find_netdev_by_location(BUS_TYPE_PCI, location); 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 */ /* open iPXE NIC device */
if (netdev_open(net_dev)) { if (netdev_open(net_dev)) {
LOG("opening device " FMT_BUSDEVFN " failed", LOG("opening device " FMT_BUSDEVFN " failed",