aboutsummaryrefslogtreecommitdiff
path: root/clients
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2010-12-03 15:02:36 +1100
committerThomas Huth <thuth@linux.vnet.ibm.com>2011-03-22 15:22:00 +0100
commit39426bad550f340dcf2b544ae23f465fbbbc42f5 (patch)
tree1974f16adec8b1322b4adeaa65783780a5ebeb25 /clients
parentcf69a59a3edefc3bea57cceea2cbedd25c7b680d (diff)
downloadSLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.zip
SLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.tar.gz
SLOF-39426bad550f340dcf2b544ae23f465fbbbc42f5.tar.bz2
Initial qemu/KVM board support
Added a new board for SLOF running on KVM/qemu. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Diffstat (limited to 'clients')
-rw-r--r--clients/net-snk/include/netdriver_int.h11
-rw-r--r--clients/net-snk/kernel/modules.c1
-rw-r--r--clients/net-snk/libc/Makefile4
-rw-r--r--clients/net-snk/libc/socket/Makefile3
-rw-r--r--clients/net-snk/libc/time/Makefile2
-rw-r--r--clients/net-snk/make.rules2
-rw-r--r--clients/net-snk/oflib/of.c33
-rw-r--r--clients/net-snk/oflib/pci.c25
8 files changed, 51 insertions, 30 deletions
diff --git a/clients/net-snk/include/netdriver_int.h b/clients/net-snk/include/netdriver_int.h
index 375f2c5..2f286ad 100644
--- a/clients/net-snk/include/netdriver_int.h
+++ b/clients/net-snk/include/netdriver_int.h
@@ -28,6 +28,7 @@ typedef struct {
int type;
} bar_t;
+
typedef struct {
unsigned long long puid;
unsigned int bus;
@@ -40,6 +41,11 @@ typedef struct {
unsigned int interrupt_line;
} pci_config_t;
+typedef struct {
+ unsigned int reg;
+ char compat[64];
+} vio_config_t;
+
#define MOD_TYPE_NETWORK 0
#define MOD_TYPE_OTHER 1
@@ -112,7 +118,10 @@ typedef struct {
io_write_t io_write;
romfs_lookup_t k_romfs_lookup;
translate_addr_t translate_addr;
- pci_config_t pci_conf;
+ union {
+ pci_config_t pci_conf;
+ vio_config_t vio_conf;
+ };
k_open_t k_open;
k_close_t k_close;
k_read_t k_read;
diff --git a/clients/net-snk/kernel/modules.c b/clients/net-snk/kernel/modules.c
index 9d4281c..91ed959 100644
--- a/clients/net-snk/kernel/modules.c
+++ b/clients/net-snk/kernel/modules.c
@@ -38,6 +38,7 @@ static const mod_descriptor_t modules[] = {
{ "net_nx203x", (void*) 0xF800000, MOD_TYPE_NETWORK },
{ "net_mcmal" , (void*) 0xF800000, MOD_TYPE_NETWORK },
{ "net_spider", (void*) 0xF800000, MOD_TYPE_NETWORK },
+ { "net_veth", (void*) 0xF800000, MOD_TYPE_NETWORK },
{ "mod_paflof", (void*) 0x6200000, MOD_TYPE_OTHER },
{ 0 , (void*) 0 }
};
diff --git a/clients/net-snk/libc/Makefile b/clients/net-snk/libc/Makefile
index aed7d9b..74c9ead 100644
--- a/clients/net-snk/libc/Makefile
+++ b/clients/net-snk/libc/Makefile
@@ -19,7 +19,9 @@ include $(TOP)/make.rules
CFLAGS = -g -I$(TOP)/include -I$(LIBCMNDIR)/libc/include -O2 \
- -fno-builtin -ffreestanding -nostdinc -msoft-float -Wall
+ -fno-builtin -ffreestanding -nostdinc -msoft-float -Wall \
+ -fno-stack-protector
+
LDFLAGS= -nostdlib
OBJS = sbrk.o io.o ioctl.o
diff --git a/clients/net-snk/libc/socket/Makefile b/clients/net-snk/libc/socket/Makefile
index d4bd4be..a1c5039 100644
--- a/clients/net-snk/libc/socket/Makefile
+++ b/clients/net-snk/libc/socket/Makefile
@@ -19,7 +19,8 @@ include $(TOP)/make.rules
CFLAGS = -g -I$(TOP)/include -I$(LIBCMNDIR)/libc/include -O2 \
- -fno-builtin -ffreestanding -msoft-float -Wall
+ -fno-builtin -ffreestanding -msoft-float -Wall \
+ -fno-stack-protector
LDFLAGS= -nostdlib
diff --git a/clients/net-snk/libc/time/Makefile b/clients/net-snk/libc/time/Makefile
index fa90b01..46b7d4e 100644
--- a/clients/net-snk/libc/time/Makefile
+++ b/clients/net-snk/libc/time/Makefile
@@ -20,7 +20,7 @@ include $(TOP)/make.rules
CFLAGS = -g -I$(TOP)/include -I$(LIBCMNDIR)/libc/include -O2 -msoft-float \
- -Wall -fno-builtin -ffreestanding -nostdinc
+ -Wall -fno-builtin -ffreestanding -nostdinc -fno-stack-protector
LDFLAGS= -nostdlib
diff --git a/clients/net-snk/make.rules b/clients/net-snk/make.rules
index 060e659..be492d7 100644
--- a/clients/net-snk/make.rules
+++ b/clients/net-snk/make.rules
@@ -21,7 +21,7 @@ LIBCMNDIR ?= $(ROOTDIR)/lib
CFLAGS = -g -I. -I$(TOP)/include -I$(LIBCMNDIR)/libc/include \
-I$(LIBCMNDIR)/libbootmsg -I$(INCLCMNDIR)/$(CPUARCH) \
-O2 -fno-builtin -ffreestanding -msoft-float -mno-altivec \
- -Wall $(FLAG) -nostdinc
+ -Wall $(FLAG) -nostdinc -fno-stack-protector
ifeq ($(SNK_LJTAG_PROCESS), 1)
CFLAGS += -I$(TOP)/../../board-malta/include
CFLAGS += -I$(TOP)/../../include/cbea
diff --git a/clients/net-snk/oflib/of.c b/clients/net-snk/oflib/of.c
index 5b8256d..a4d98b8 100644
--- a/clients/net-snk/oflib/of.c
+++ b/clients/net-snk/oflib/of.c
@@ -691,17 +691,21 @@ get_puid(phandle_t node)
return 0;
}
+static int set_vio_config(vio_config_t * vio_config, phandle_t net)
+{
+ of_getprop(net, "reg", &vio_config->reg, 4);
+ of_getprop(net, "compatible", &vio_config->compat, 64);
+
+ return 0;
+}
+
/* Fill in the pci config structure from the device tree */
-static int
-set_pci_config(pci_config_t * pci_config)
+static int set_pci_config(pci_config_t * pci_config, phandle_t net)
{
- unsigned char buf[1024];
+ unsigned char buf[400];
int len, bar_nr;
unsigned int *assigned_ptr;
- phandle_t net = get_boot_device();
- if (net == -1)
- return -1;
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);
@@ -732,6 +736,21 @@ set_pci_config(pci_config_t * pci_config)
return 0;
}
+static int set_config(snk_kernel_t * snk_kernel_interface)
+{
+ phandle_t parent, net = get_boot_device();
+ char compat[64];
+
+ if (net == -1)
+ return -1;
+
+ parent = of_parent(net);
+ of_getprop(parent, "compatible", compat, 64);
+ if (!strcmp(compat, "IBM,vdevice"))
+ return set_vio_config(&snk_kernel_interface->vio_conf, net);
+ return set_pci_config(&snk_kernel_interface->pci_conf, net);
+}
+
void
get_mac(char *mac)
{
@@ -792,7 +811,7 @@ glue_init(snk_kernel_t * snk_kernel_interface, unsigned int * timebase,
return -2;
/* Setup Kernel Struct */
- if (set_pci_config(&snk_kernel_interface->pci_conf) == -1) {
+ if (set_config(snk_kernel_interface) == -1) {
snk_kernel_interface->print(" No net device found \n");
}
diff --git a/clients/net-snk/oflib/pci.c b/clients/net-snk/oflib/pci.c
index dac629a..2a75829 100644
--- a/clients/net-snk/oflib/pci.c
+++ b/clients/net-snk/oflib/pci.c
@@ -16,6 +16,7 @@
#include <string.h>
#include <kernel.h>
#include <cpu.h>
+#include <cache.h>
int
pci_calc_bar_size(long long puid, int bus, int devfn, int bar)
@@ -49,19 +50,13 @@ read_io(void *addr, size_t sz)
switch (sz) {
case 1:
- set_ci();
- ret = (unsigned int) *((unsigned char *) addr);
- clr_ci();
+ ret = ci_read_8(addr);
break;
case 2:
- set_ci();
- ret = (unsigned int) *((unsigned short *) addr);
- clr_ci();
+ ret = ci_read_16(addr);
break;
case 4:
- set_ci();
- ret = *((unsigned int *) addr);
- clr_ci();
+ ret = ci_read_32(addr);
break;
default:
ret = 0;
@@ -75,19 +70,13 @@ write_io(void *addr, unsigned int value, size_t sz)
{
switch (sz) {
case 1:
- set_ci();
- *((unsigned char *) addr) = (unsigned char) value;
- clr_ci();
+ ci_write_8(addr, value);
break;
case 2:
- set_ci();
- *((unsigned short *) addr) = (unsigned short) value;
- clr_ci();
+ ci_write_16(addr, value);
break;
case 4:
- set_ci();
- *((unsigned int *) addr) = value;
- clr_ci();
+ ci_write_32(addr, value);
break;
default:
return -1;