mirror of
https://github.com/genodelabs/genode.git
synced 2025-01-20 19:49:28 +00:00
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:
parent
b13b0113c8
commit
ffaf65efa0
@ -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
|
||||
|
||||
|
13
repos/dde_ipxe/patches/tg3.patch
Normal file
13
repos/dde_ipxe/patches/tg3.patch
Normal 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;
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
dd11e6a750e68271c2e7d293e9c1d272f7bc78e0
|
||||
eff35e8421342189782bdf285801a13fdaa751ec
|
||||
|
@ -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 :
|
||||
|
@ -39,9 +39,6 @@
|
||||
#include <dde_support.h>
|
||||
|
||||
|
||||
//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,
|
||||
};
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user