aboutsummaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2011-11-24 11:56:03 +0100
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-11-24 11:56:03 +0100
commitc20f4bc8aca38a7aa9d7691a7c97bea8921627c7 (patch)
tree556cf7da1d21454a701ca74b0f52062b2e8f74d4 /clients
parent008fe5610d27796bbf6ae5ef74e14314c237c4c1 (diff)
downloadSLOF-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 'clients')
-rw-r--r--clients/net-snk/include/netdriver_int.h22
-rw-r--r--clients/net-snk/kernel/modules.c3
-rw-r--r--clients/net-snk/oflib/of.c11
3 files changed, 19 insertions, 17 deletions
diff --git a/clients/net-snk/include/netdriver_int.h b/clients/net-snk/include/netdriver_int.h
index 99aa358..7612f59 100644
--- a/clients/net-snk/include/netdriver_int.h
+++ b/clients/net-snk/include/netdriver_int.h
@@ -28,8 +28,13 @@ typedef struct {
int type;
} bar_t;
+typedef enum {
+ CONFIG_TYPE_PCI,
+ CONFIG_TYPE_VIO
+} mod_config_type;
typedef struct {
+ mod_config_type config_type;
unsigned long long puid;
unsigned int bus;
unsigned int devfn;
@@ -42,7 +47,9 @@ typedef struct {
} pci_config_t;
typedef struct {
- unsigned int reg;
+ mod_config_type config_type;
+ unsigned int reg_len;
+ unsigned int reg[12];
char compat[64];
} vio_config_t;
@@ -181,17 +188,4 @@ typedef struct {
} data;
} ioctl_net_data_t;
-/* paflof */
-enum {
- PAFLOF_GDEPTH,
- PAFLOF_GIO_BEHAVIOR,
- PAFLOF_GSTATUS,
- PAFLOF_POP,
- PAFLOF_PUSH,
-};
-/* - clint */
-enum {
- CLINT_EXECUTE
-};
-
#endif /* _NETDRIVER_INT_H */
diff --git a/clients/net-snk/kernel/modules.c b/clients/net-snk/kernel/modules.c
index 3592a28..b1d5efb 100644
--- a/clients/net-snk/kernel/modules.c
+++ b/clients/net-snk/kernel/modules.c
@@ -1,5 +1,5 @@
/******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation
+ * 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
@@ -40,6 +40,7 @@ static const mod_descriptor_t modules[] = {
{ "net_e1000", MOD_TYPE_NETWORK },
{ "net_bcm", MOD_TYPE_NETWORK },
{ "net_veth", MOD_TYPE_NETWORK },
+ { "net_virtio", MOD_TYPE_NETWORK },
{ NULL, 0 }
};
diff --git a/clients/net-snk/oflib/of.c b/clients/net-snk/oflib/of.c
index e74d2b0..a4aea2d 100644
--- a/clients/net-snk/oflib/of.c
+++ b/clients/net-snk/oflib/of.c
@@ -728,7 +728,9 @@ get_puid(phandle_t node)
static int set_vio_config(vio_config_t * vio_config, phandle_t net)
{
- of_getprop(net, "reg", &vio_config->reg, 4);
+ vio_config->config_type = CONFIG_TYPE_VIO;
+ vio_config->reg_len = of_getprop(net, "reg", vio_config->reg,
+ sizeof(vio_config->reg));
of_getprop(net, "compatible", &vio_config->compat, 64);
return 0;
@@ -741,6 +743,8 @@ static int set_pci_config(pci_config_t * pci_config, phandle_t net)
int len, bar_nr;
unsigned int *assigned_ptr;
+ pci_config->config_type = CONFIG_TYPE_PCI;
+
of_getprop(net, "vendor-id", &pci_config->vendor_id, 4);
of_getprop(net, "device-id", &pci_config->device_id, 4);
of_getprop(net, "revision-id", &pci_config->revision_id, 4);
@@ -781,8 +785,11 @@ static int set_config(snk_kernel_t * snk_kernel_interface)
parent = of_parent(net);
of_getprop(parent, "compatible", compat, 64);
- if (!strcmp(compat, "IBM,vdevice"))
+
+ if (strcmp(compat, "IBM,vdevice") == 0
+ || strncmp(compat, "ibm,virtio", 10) == 0)
return set_vio_config(&snk_kernel_interface->vio_conf, net);
+
return set_pci_config(&snk_kernel_interface->pci_conf, net);
}