diff options
author | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-24 11:56:03 +0100 |
---|---|---|
committer | Thomas Huth <thuth@linux.vnet.ibm.com> | 2011-11-24 11:56:03 +0100 |
commit | c20f4bc8aca38a7aa9d7691a7c97bea8921627c7 (patch) | |
tree | 556cf7da1d21454a701ca74b0f52062b2e8f74d4 /board-qemu/virtio-net/module_entry.c | |
parent | 008fe5610d27796bbf6ae5ef74e14314c237c4c1 (diff) | |
download | SLOF-c20f4bc8aca38a7aa9d7691a7c97bea8921627c7.zip SLOF-c20f4bc8aca38a7aa9d7691a7c97bea8921627c7.tar.gz SLOF-c20f4bc8aca38a7aa9d7691a7c97bea8921627c7.tar.bz2 |
Support for virtio-net PCI devices
Added a driver for the "virtio-net" virtualized network devices from KVM/qemu.
Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'board-qemu/virtio-net/module_entry.c')
-rw-r--r-- | board-qemu/virtio-net/module_entry.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/board-qemu/virtio-net/module_entry.c b/board-qemu/virtio-net/module_entry.c new file mode 100644 index 0000000..9e6ceda --- /dev/null +++ b/board-qemu/virtio-net/module_entry.c @@ -0,0 +1,51 @@ +/****************************************************************************** + * Copyright (c) 2004, 2011 IBM Corporation + * All rights reserved. + * This program and the accompanying materials + * are made available under the terms of the BSD License + * which accompanies this distribution, and is available at + * http://www.opensource.org/licenses/bsd-license.php + * + * Contributors: + * IBM Corporation - initial implementation + *****************************************************************************/ + +#include <string.h> +#include <netdriver_int.h> +#include <libhvcall.h> +#include "virtio-net.h" + +extern char __module_start[]; +extern char __module_end[]; +extern char __bss_start[]; +extern char __bss_end[]; + +snk_kernel_t *snk_kernel_interface; +snk_module_t *snk_module_interface; + + +snk_module_t* module_init(snk_kernel_t *snk_kernel_int, pci_config_t *conf) +{ + long module_size; + + module_size = __module_end - __module_start; + if (module_size >= 0x800000) { + snk_kernel_int->print("Module size (%llu bytes) is too big!\n", + module_size); + return 0; + } + + memset(__bss_start, 0, __bss_end - __bss_start); + + snk_kernel_interface = snk_kernel_int; + snk_module_interface = &virtionet_interface; + snk_module_interface->link_addr = module_init; + + if (snk_kernel_int->version != snk_module_interface->version) + return 0; + + if (vn_module_init_pci(snk_kernel_int, conf)) + return 0; + + return &virtionet_interface; +} |