aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/platforms/iseries/dt.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/powerpc/platforms/iseries/dt.c')
-rw-r--r--arch/powerpc/platforms/iseries/dt.c98
1 files changed, 97 insertions, 1 deletions
diff --git a/arch/powerpc/platforms/iseries/dt.c b/arch/powerpc/platforms/iseries/dt.c
index d194140c1ebf..39c676ab9d6d 100644
--- a/arch/powerpc/platforms/iseries/dt.c
+++ b/arch/powerpc/platforms/iseries/dt.c
@@ -1,5 +1,6 @@
1/* 1/*
2 * Copyright (c) 2005-2006 Michael Ellerman, IBM Corporation 2 * Copyright (C) 2005-2006 Michael Ellerman, IBM Corporation
3 * Copyright (C) 2000-2004, IBM Corporation
3 * 4 *
4 * Description: 5 * Description:
5 * This file contains all the routines to build a flattened device 6 * This file contains all the routines to build a flattened device
@@ -76,6 +77,101 @@ static char __initdata device_type_pci[] = "pci";
76static char __initdata device_type_vdevice[] = "vdevice"; 77static char __initdata device_type_vdevice[] = "vdevice";
77static char __initdata device_type_vscsi[] = "vscsi"; 78static char __initdata device_type_vscsi[] = "vscsi";
78 79
80
81/* EBCDIC to ASCII conversion routines */
82
83unsigned char e2a(unsigned char x)
84{
85 switch (x) {
86 case 0xF0:
87 return '0';
88 case 0xF1:
89 return '1';
90 case 0xF2:
91 return '2';
92 case 0xF3:
93 return '3';
94 case 0xF4:
95 return '4';
96 case 0xF5:
97 return '5';
98 case 0xF6:
99 return '6';
100 case 0xF7:
101 return '7';
102 case 0xF8:
103 return '8';
104 case 0xF9:
105 return '9';
106 case 0xC1:
107 return 'A';
108 case 0xC2:
109 return 'B';
110 case 0xC3:
111 return 'C';
112 case 0xC4:
113 return 'D';
114 case 0xC5:
115 return 'E';
116 case 0xC6:
117 return 'F';
118 case 0xC7:
119 return 'G';
120 case 0xC8:
121 return 'H';
122 case 0xC9:
123 return 'I';
124 case 0xD1:
125 return 'J';
126 case 0xD2:
127 return 'K';
128 case 0xD3:
129 return 'L';
130 case 0xD4:
131 return 'M';
132 case 0xD5:
133 return 'N';
134 case 0xD6:
135 return 'O';
136 case 0xD7:
137 return 'P';
138 case 0xD8:
139 return 'Q';
140 case 0xD9:
141 return 'R';
142 case 0xE2:
143 return 'S';
144 case 0xE3:
145 return 'T';
146 case 0xE4:
147 return 'U';
148 case 0xE5:
149 return 'V';
150 case 0xE6:
151 return 'W';
152 case 0xE7:
153 return 'X';
154 case 0xE8:
155 return 'Y';
156 case 0xE9:
157 return 'Z';
158 }
159 return ' ';
160}
161EXPORT_SYMBOL(e2a);
162
163unsigned char* strne2a(unsigned char *dest, const unsigned char *src, size_t n)
164{
165 int i;
166
167 n = strnlen(src, n);
168
169 for (i = 0; i < n; i++)
170 dest[i] = e2a(src[i]);
171
172 return dest;
173}
174
79static struct iseries_flat_dt * __init dt_init(void) 175static struct iseries_flat_dt * __init dt_init(void)
80{ 176{
81 struct iseries_flat_dt *dt; 177 struct iseries_flat_dt *dt;