aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2006-04-27 03:09:02 -0400
committerPaul Mackerras <paulus@samba.org>2006-04-29 04:01:58 -0400
commit95a1ca6cd8e702a19ee56efae522a5816a56a205 (patch)
treeb641fb9888afa4b7e51a337a78f0824f729b3881 /arch/powerpc/platforms
parent29f147d746326e4db5fe350c70373081d61a2965 (diff)
[PATCH] powerpc: add all the iSeries virtual devices to the device tree
We do this by putting them in the flattened device tree at setup time. This required the flattened device tree blob to be made bigger. Currenly we don't do anything with these. Also make a function static. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/platforms')
-rw-r--r--arch/powerpc/platforms/iseries/setup.c88
-rw-r--r--arch/powerpc/platforms/iseries/vio.c2
2 files changed, 88 insertions, 2 deletions
diff --git a/arch/powerpc/platforms/iseries/setup.c b/arch/powerpc/platforms/iseries/setup.c
index 3c51448a1855..4862b8e7c78c 100644
--- a/arch/powerpc/platforms/iseries/setup.c
+++ b/arch/powerpc/platforms/iseries/setup.c
@@ -28,6 +28,7 @@
28#include <linux/major.h> 28#include <linux/major.h>
29#include <linux/root_dev.h> 29#include <linux/root_dev.h>
30#include <linux/kernel.h> 30#include <linux/kernel.h>
31#include <linux/if_ether.h> /* ETH_ALEN */
31 32
32#include <asm/processor.h> 33#include <asm/processor.h>
33#include <asm/machdep.h> 34#include <asm/machdep.h>
@@ -45,6 +46,7 @@
45#include <asm/cache.h> 46#include <asm/cache.h>
46#include <asm/sections.h> 47#include <asm/sections.h>
47#include <asm/abs_addr.h> 48#include <asm/abs_addr.h>
49#include <asm/iseries/hv_types.h>
48#include <asm/iseries/hv_lp_config.h> 50#include <asm/iseries/hv_lp_config.h>
49#include <asm/iseries/hv_call_event.h> 51#include <asm/iseries/hv_call_event.h>
50#include <asm/iseries/hv_call_xm.h> 52#include <asm/iseries/hv_call_xm.h>
@@ -710,7 +712,7 @@ define_machine(iseries) {
710}; 712};
711 713
712struct blob { 714struct blob {
713 unsigned char data[PAGE_SIZE]; 715 unsigned char data[PAGE_SIZE * 2];
714 unsigned long next; 716 unsigned long next;
715}; 717};
716 718
@@ -911,6 +913,88 @@ void dt_model(struct iseries_flat_dt *dt)
911 dt_prop_str(dt, "compatible", "IBM,iSeries"); 913 dt_prop_str(dt, "compatible", "IBM,iSeries");
912} 914}
913 915
916void dt_vdevices(struct iseries_flat_dt *dt)
917{
918 u32 reg = 0;
919 HvLpIndexMap vlan_map;
920 int i;
921 char buf[32];
922
923 dt_start_node(dt, "vdevice");
924 dt_prop_u32(dt, "#address-cells", 1);
925 dt_prop_u32(dt, "#size-cells", 0);
926
927 snprintf(buf, sizeof(buf), "viocons@%08x", reg);
928 dt_start_node(dt, buf);
929 dt_prop_str(dt, "device_type", "serial");
930 dt_prop_empty(dt, "compatible");
931 dt_prop_u32(dt, "reg", reg);
932 dt_end_node(dt);
933 reg++;
934
935 snprintf(buf, sizeof(buf), "v-scsi@%08x", reg);
936 dt_start_node(dt, buf);
937 dt_prop_str(dt, "device_type", "vscsi");
938 dt_prop_str(dt, "compatible", "IBM,v-scsi");
939 dt_prop_u32(dt, "reg", reg);
940 dt_end_node(dt);
941 reg++;
942
943 vlan_map = HvLpConfig_getVirtualLanIndexMap();
944 for (i = 0; i < HVMAXARCHITECTEDVIRTUALLANS; i++) {
945 unsigned char mac_addr[ETH_ALEN];
946
947 if ((vlan_map & (0x8000 >> i)) == 0)
948 continue;
949 snprintf(buf, 32, "vlan@%08x", reg + i);
950 dt_start_node(dt, buf);
951 dt_prop_str(dt, "device_type", "vlan");
952 dt_prop_empty(dt, "compatible");
953 dt_prop_u32(dt, "reg", reg + i);
954
955 mac_addr[0] = 0x02;
956 mac_addr[1] = 0x01;
957 mac_addr[2] = 0xff;
958 mac_addr[3] = i;
959 mac_addr[4] = 0xff;
960 mac_addr[5] = HvLpConfig_getLpIndex_outline();
961 dt_prop(dt, "local-mac-address", (char *)mac_addr, ETH_ALEN);
962 dt_prop(dt, "mac-address", (char *)mac_addr, ETH_ALEN);
963
964 dt_end_node(dt);
965 }
966 reg += HVMAXARCHITECTEDVIRTUALLANS;
967
968 for (i = 0; i < HVMAXARCHITECTEDVIRTUALDISKS; i++) {
969 snprintf(buf, 32, "viodasd@%08x", reg + i);
970 dt_start_node(dt, buf);
971 dt_prop_str(dt, "device_type", "viodasd");
972 dt_prop_empty(dt, "compatible");
973 dt_prop_u32(dt, "reg", reg + i);
974 dt_end_node(dt);
975 }
976 reg += HVMAXARCHITECTEDVIRTUALDISKS;
977 for (i = 0; i < HVMAXARCHITECTEDVIRTUALCDROMS; i++) {
978 snprintf(buf, 32, "viocd@%08x", reg + i);
979 dt_start_node(dt, buf);
980 dt_prop_str(dt, "device_type", "viocd");
981 dt_prop_empty(dt, "compatible");
982 dt_prop_u32(dt, "reg", reg + i);
983 dt_end_node(dt);
984 }
985 reg += HVMAXARCHITECTEDVIRTUALCDROMS;
986 for (i = 0; i < HVMAXARCHITECTEDVIRTUALTAPES; i++) {
987 snprintf(buf, 32, "viotape@%08x", reg + i);
988 dt_start_node(dt, buf);
989 dt_prop_str(dt, "device_type", "viotape");
990 dt_prop_empty(dt, "compatible");
991 dt_prop_u32(dt, "reg", reg + i);
992 dt_end_node(dt);
993 }
994
995 dt_end_node(dt);
996}
997
914void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size) 998void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
915{ 999{
916 u64 tmp[2]; 1000 u64 tmp[2];
@@ -941,6 +1025,8 @@ void build_flat_dt(struct iseries_flat_dt *dt, unsigned long phys_mem_size)
941 1025
942 dt_cpus(dt); 1026 dt_cpus(dt);
943 1027
1028 dt_vdevices(dt);
1029
944 dt_end_node(dt); 1030 dt_end_node(dt);
945 1031
946 dt_push_u32(dt, OF_DT_END); 1032 dt_push_u32(dt, OF_DT_END);
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index ad36ab0639f0..22045a2829a9 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -71,7 +71,7 @@ static struct vio_dev *__init vio_register_device_iseries(char *type,
71 return viodev; 71 return viodev;
72} 72}
73 73
74void __init probe_bus_iseries(void) 74static void __init probe_bus_iseries(void)
75{ 75{
76 HvLpIndexMap vlan_map; 76 HvLpIndexMap vlan_map;
77 struct vio_dev *viodev; 77 struct vio_dev *viodev;