blob: dab04db321139e9ee3dff1ca3240733fd3b63e7a [file] [log] [blame]
Patrick Georgi114e7b22010-05-05 11:19:50 +00001/*
2 * sconfig, coreboot device tree compiler
3 *
4 * Copyright (C) 2010 coresystems GmbH
5 * written by Patrick Georgi <patrick.georgi@coresystems.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA, 02110-1301 USA
19 */
20
21#include "sconfig.h"
22#include "sconfig.tab.h"
23
Patrick Georgi7fc9e292010-07-15 15:59:07 +000024extern int linenum;
25
Patrick Georgi114e7b22010-05-05 11:19:50 +000026struct device *head, *lastdev;
27
28struct header headers;
29
30static int devcount = 0;
31
32static struct device root;
33static struct device mainboard = {
34 .name = "mainboard",
35 .name_underscore = "mainboard",
36 .id = 0,
37 .chip = &mainboard,
38 .type = chip,
39 .chiph_exists = 1,
40 .children = &root
41};
42
43static struct device root = {
44 .name = "dev_root",
45 .name_underscore = "dev_root",
46 .id = 0,
47 .chip = &mainboard,
48 .type = device,
49 .path = " .type = DEVICE_PATH_ROOT ",
50 .ops = "&default_dev_ops_root",
51 .parent = &root,
52 .bus = &root,
53 .enabled = 1
54};
55
Patrick Georgi68befd52010-05-05 12:05:25 +000056static struct device *new_dev(struct device *parent, struct device *bus) {
Patrick Georgi114e7b22010-05-05 11:19:50 +000057 struct device *dev = malloc(sizeof(struct device));
58 memset(dev, 0, sizeof(struct device));
59 dev->id = ++devcount;
Patrick Georgi68befd52010-05-05 12:05:25 +000060 dev->parent = parent;
61 dev->bus = bus;
Sven Schnelle270a9082011-03-01 19:58:15 +000062 dev->subsystem_vendor = -1;
63 dev->subsystem_device = -1;
Patrick Georgi114e7b22010-05-05 11:19:50 +000064 head->next = dev;
65 head = dev;
66 return dev;
67}
68
69static int device_match(struct device *a, struct device *b) {
70 if ((a->bustype == b->bustype) && (a->bus == b->bus) && (a->path_a == b->path_a) && (a->path_b == b->path_b))
71 return 1;
72 return 0;
73}
74
75void fold_in(struct device *parent) {
76 struct device *child = parent->children;
77 struct device *latest = 0;
78 while (child != latest) {
79 if (child->children) {
80 if (!latest) latest = child->children;
81 parent->latestchild->next_sibling = child->children;
82 parent->latestchild = child->latestchild;
83 }
84 child = child->next_sibling;
85 }
86}
87
88int yywrap(void) {
89 return 1;
90}
91
92void yyerror (char const *str)
93{
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +000094 extern char *yytext;
95 fprintf (stderr, "line %d: %s: %s\n", linenum + 1, yytext, str);
96 exit(1);
Patrick Georgi114e7b22010-05-05 11:19:50 +000097}
98
99void postprocess_devtree(void) {
100 root.next_sibling = root.children;
101 root.next_sibling->next_sibling = root.next_sibling->children;
102
103 struct device *dev = &root;
104 while (dev) {
105 /* skip "chip" elements in children chain */
106 while (dev->children && (dev->children->type == chip)) dev->children = dev->children->children;
107 /* skip "chip" elements and functions of the same device in sibling chain */
108 while (dev->sibling && dev->sibling->used) dev->sibling = dev->sibling->sibling;
109 /* If end of chain, and parent is a chip, move on */
110 if (!dev->sibling && (dev->parent->type == chip)) dev->sibling = dev->parent->sibling;
111 /* skip chips */
112 while (dev->sibling && dev->sibling->type == chip) dev->sibling = dev->sibling->children;
113 /* skip duplicate function elements in nextdev chain */
114 while (dev->nextdev && dev->nextdev->used) dev->nextdev = dev->nextdev->nextdev;
115 dev = dev->next_sibling;
116 }
117}
118
Patrick Georgi68befd52010-05-05 12:05:25 +0000119struct device *new_chip(struct device *parent, struct device *bus, char *path) {
120 struct device *new_chip = new_dev(parent, bus);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000121 new_chip->chiph_exists = 1;
122 new_chip->name = path;
123 new_chip->name_underscore = strdup(new_chip->name);
124 char *c;
125 for (c = new_chip->name_underscore; *c; c++) {
126 if (*c == '/') *c = '_';
127 if (*c == '-') *c = '_';
128 }
129 new_chip->type = chip;
130 new_chip->chip = new_chip;
131
132 struct stat st;
133 char *chip_h = malloc(strlen(path)+12);
Stefan Reinauer76c44ae2011-10-14 12:41:46 -0700134 sprintf(chip_h, "src/%s", path);
135 if ((stat(chip_h, &st) == -1) && (errno == ENOENT)) {
136 fprintf(stderr, "ERROR: Chip component %s does not exist.\n",
137 path);
138 exit(1);
139 }
140
Patrick Georgi114e7b22010-05-05 11:19:50 +0000141 sprintf(chip_h, "src/%s/chip.h", path);
142 if ((stat(chip_h, &st) == -1) && (errno == ENOENT))
143 new_chip->chiph_exists = 0;
144
Patrick Georgi68befd52010-05-05 12:05:25 +0000145 if (parent->latestchild) {
146 parent->latestchild->next_sibling = new_chip;
147 parent->latestchild->sibling = new_chip;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000148 }
Patrick Georgi68befd52010-05-05 12:05:25 +0000149 parent->latestchild = new_chip;
150 if (!parent->children)
151 parent->children = new_chip;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000152 return new_chip;
153}
154
155void add_header(struct device *dev) {
156 if (dev->chiph_exists) {
157 int include_exists = 0;
158 struct header *h = &headers;
159 while (h->next) {
160 int result = strcmp(dev->name, h->next->name);
161 if (result == 0) {
162 include_exists = 1;
163 break;
164 }
165 if (result < 0) break;
166 h = h->next;
167 }
168 if (!include_exists) {
169 struct header *tmp = h->next;
170 h->next = malloc(sizeof(struct header));
171 memset(h->next, 0, sizeof(struct header));
172 h->next->name = dev->name;
173 h->next->next = tmp;
174 }
175 }
176}
177
Patrick Georgi68befd52010-05-05 12:05:25 +0000178struct device *new_device(struct device *parent, struct device *busdev, const int bus, const char *devnum, int enabled) {
179 struct device *new_d = new_dev(parent, busdev);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000180 new_d->bustype = bus;
181
182 char *tmp;
183 new_d->path_a = strtol(strdup(devnum), &tmp, 16);
184 if (*tmp == '.') {
185 tmp++;
186 new_d->path_b = strtol(tmp, NULL, 16);
187 }
188
189 char *name = malloc(10);
190 sprintf(name, "_dev%d", new_d->id);
191 new_d->name = name;
192 new_d->name_underscore = name; // shouldn't be necessary, but avoid 0-ptr
193 new_d->type = device;
194 new_d->enabled = enabled;
195 new_d->chip = new_d->parent->chip;
196
Patrick Georgi68befd52010-05-05 12:05:25 +0000197 if (parent->latestchild) {
198 parent->latestchild->next_sibling = new_d;
199 parent->latestchild->sibling = new_d;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000200 }
Patrick Georgi68befd52010-05-05 12:05:25 +0000201 parent->latestchild = new_d;
202 if (!parent->children)
203 parent->children = new_d;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000204
205 lastdev->nextdev = new_d;
206 lastdev = new_d;
207 if (bus == PCI) {
208 new_d->path = ".type=DEVICE_PATH_PCI,{.pci={ .devfn = PCI_DEVFN(0x%x,%d)}}";
209 }
210 if (bus == PNP) {
211 new_d->path = ".type=DEVICE_PATH_PNP,{.pnp={ .port = 0x%x, .device = 0x%x }}";
212 }
213 if (bus == I2C) {
214 new_d->path = ".type=DEVICE_PATH_I2C,{.i2c={ .device = 0x%x }}";
215 }
216 if (bus == APIC) {
217 new_d->path = ".type=DEVICE_PATH_APIC,{.apic={ .apic_id = 0x%x }}";
218 }
219 if (bus == APIC_CLUSTER) {
220 new_d->path = ".type=DEVICE_PATH_APIC_CLUSTER,{.apic_cluster={ .cluster = 0x%x }}";
221 }
222 if (bus == PCI_DOMAIN) {
223 new_d->path = ".type=DEVICE_PATH_PCI_DOMAIN,{.pci_domain={ .domain = 0x%x }}";
224 }
225 return new_d;
226}
227
228void alias_siblings(struct device *d) {
229 while (d) {
230 int link = 0;
231 struct device *cmp = d->next_sibling;
232 while (cmp && (cmp->bus == d->bus) && (cmp->path_a == d->path_a) && (cmp->path_b == d->path_b)) {
233 if (cmp->type==device && !cmp->used) {
234 if (device_match(d, cmp)) {
235 d->multidev = 1;
236
Patrick Georgi114e7b22010-05-05 11:19:50 +0000237 cmp->id = d->id;
238 cmp->name = d->name;
239 cmp->used = 1;
240 cmp->link = ++link;
241 }
242 }
243 cmp = cmp->next_sibling;
244 }
245 d = d->next_sibling;
246 }
247}
248
Patrick Georgi68befd52010-05-05 12:05:25 +0000249void add_resource(struct device *dev, int type, int index, int base) {
Patrick Georgi114e7b22010-05-05 11:19:50 +0000250 struct resource *r = malloc(sizeof(struct resource));
251 memset (r, 0, sizeof(struct resource));
252 r->type = type;
253 r->index = index;
254 r->base = base;
Patrick Georgi68befd52010-05-05 12:05:25 +0000255 if (dev->res) {
256 struct resource *head = dev->res;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000257 while (head->next) head = head->next;
258 head->next = r;
259 } else {
Patrick Georgi68befd52010-05-05 12:05:25 +0000260 dev->res = r;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000261 }
Patrick Georgi68befd52010-05-05 12:05:25 +0000262 dev->rescnt++;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000263}
264
Patrick Georgi68befd52010-05-05 12:05:25 +0000265void add_register(struct device *dev, char *name, char *val) {
Patrick Georgi114e7b22010-05-05 11:19:50 +0000266 struct reg *r = malloc(sizeof(struct reg));
267 memset (r, 0, sizeof(struct reg));
268 r->key = name;
269 r->value = val;
Patrick Georgi68befd52010-05-05 12:05:25 +0000270 if (dev->reg) {
271 struct reg *head = dev->reg;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000272 // sorting to be equal to sconfig's behaviour
273 int sort = strcmp(r->key, head->key);
274 if (sort == 0) {
275 printf("ERROR: duplicate 'register' key.\n");
276 exit(1);
277 }
278 if (sort<0) {
279 r->next = head;
Patrick Georgi68befd52010-05-05 12:05:25 +0000280 dev->reg = r;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000281 } else {
282 while ((head->next) && (strcmp(head->next->key, r->key)<0)) head = head->next;
283 r->next = head->next;
284 head->next = r;
285 }
286 } else {
Patrick Georgi68befd52010-05-05 12:05:25 +0000287 dev->reg = r;
Patrick Georgi114e7b22010-05-05 11:19:50 +0000288 }
289}
290
Sven Schnelle270a9082011-03-01 19:58:15 +0000291void add_pci_subsystem_ids(struct device *dev, int vendor, int device, int inherit)
292{
293 if (dev->bustype != PCI && dev->bustype != PCI_DOMAIN) {
294 printf("ERROR: 'subsystem' only allowed for PCI devices\n");
295 exit(1);
296 }
297
298 dev->subsystem_vendor = vendor;
299 dev->subsystem_device = device;
300 dev->inherit_subsystem = inherit;
301}
302
Patrick Georgi114e7b22010-05-05 11:19:50 +0000303static void pass0(FILE *fil, struct device *ptr) {
Myles Watson894a3472010-06-09 22:41:35 +0000304 if (ptr->type == device && ptr->id == 0)
305 fprintf(fil, "struct bus %s_links[];\n", ptr->name);
Myles Watsonc25cc112010-05-21 14:33:48 +0000306 if ((ptr->type == device) && (ptr->id != 0) && (!ptr->used)) {
Stefan Reinauerdf61dd22010-08-09 12:02:00 +0000307 fprintf(fil, "static struct device %s;\n", ptr->name);
Myles Watsonc25cc112010-05-21 14:33:48 +0000308 if (ptr->rescnt > 0)
309 fprintf(fil, "struct resource %s_res[];\n", ptr->name);
Myles Watson894a3472010-06-09 22:41:35 +0000310 if (ptr->children || ptr->multidev)
311 fprintf(fil, "struct bus %s_links[];\n", ptr->name);
Myles Watsonc25cc112010-05-21 14:33:48 +0000312 }
Patrick Georgi114e7b22010-05-05 11:19:50 +0000313}
314
315static void pass1(FILE *fil, struct device *ptr) {
316 if (!ptr->used && (ptr->type == device)) {
Stefan Reinauerdf61dd22010-08-09 12:02:00 +0000317 if (ptr->id != 0)
318 fprintf(fil, "static ", ptr->name);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000319 fprintf(fil, "struct device %s = {\n", ptr->name);
320 fprintf(fil, "\t.ops = %s,\n", (ptr->ops)?(ptr->ops):"0");
Myles Watson894a3472010-06-09 22:41:35 +0000321 fprintf(fil, "\t.bus = &%s_links[%d],\n", ptr->bus->name, ptr->bus->link);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000322 fprintf(fil, "\t.path = {");
323 fprintf(fil, ptr->path, ptr->path_a, ptr->path_b);
324 fprintf(fil, "},\n");
325 fprintf(fil, "\t.enabled = %d,\n", ptr->enabled);
326 fprintf(fil, "\t.on_mainboard = 1,\n");
Sven Schnelle270a9082011-03-01 19:58:15 +0000327 if (ptr->subsystem_vendor > 0)
328 fprintf(fil, "\t.subsystem_vendor = 0x%04x,\n", ptr->subsystem_vendor);
329
330 if (ptr->subsystem_device > 0)
331 fprintf(fil, "\t.subsystem_device = 0x%04x,\n", ptr->subsystem_device);
332
Patrick Georgi114e7b22010-05-05 11:19:50 +0000333 if (ptr->rescnt > 0) {
Myles Watsonc25cc112010-05-21 14:33:48 +0000334 fprintf(fil, "\t.resource_list = &%s_res[0],\n", ptr->name);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000335 }
336 int link = 0;
Myles Watson894a3472010-06-09 22:41:35 +0000337 if (ptr->children || ptr->multidev)
338 fprintf(fil, "\t.link_list = &%s_links[0],\n", ptr->name);
339 else
340 fprintf(fil, "\t.link_list = NULL,\n", ptr->name);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000341 if (ptr->sibling)
342 fprintf(fil, "\t.sibling = &%s,\n", ptr->sibling->name);
343 if (ptr->chip->chiph_exists) {
344 fprintf(fil, "\t.chip_ops = &%s_ops,\n", ptr->chip->name_underscore);
345 fprintf(fil, "\t.chip_info = &%s_info_%d,\n", ptr->chip->name_underscore, ptr->chip->id);
346 }
347 if (ptr->nextdev)
348 fprintf(fil, "\t.next=&%s\n", ptr->nextdev->name);
349 fprintf(fil, "};\n");
350 }
Myles Watsonc25cc112010-05-21 14:33:48 +0000351 if (ptr->rescnt > 0) {
352 int i=1;
353 fprintf(fil, "struct resource %s_res[] = {\n", ptr->name);
354 struct resource *r = ptr->res;
355 while (r) {
356 fprintf(fil, "\t\t{ .flags=IORESOURCE_FIXED | IORESOURCE_ASSIGNED | IORESOURCE_");
357 if (r->type == IRQ) fprintf(fil, "IRQ");
358 if (r->type == DRQ) fprintf(fil, "DRQ");
359 if (r->type == IO) fprintf(fil, "IO");
360 fprintf(fil, ", .index=0x%x, .base=0x%x,", r->index, r->base);
361 if (r->next)
362 fprintf(fil, ".next=&%s_res[%d]},\n", ptr->name, i++);
363 else
364 fprintf(fil, ".next=NULL },\n");
365 r = r->next;
366 }
367 fprintf(fil, "\t };\n");
368 }
Myles Watson894a3472010-06-09 22:41:35 +0000369 if (!ptr->used && ptr->type == device && (ptr->children || ptr->multidev)) {
370 fprintf(fil, "struct bus %s_links[] = {\n", ptr->name);
371 if (ptr->multidev) {
372 struct device *d = ptr;
373 while (d) {
374 if (device_match(d, ptr)) {
375 fprintf(fil, "\t\t[%d] = {\n", d->link);
376 fprintf(fil, "\t\t\t.link_num = %d,\n", d->link);
377 fprintf(fil, "\t\t\t.dev = &%s,\n", d->name);
378 if (d->children)
379 fprintf(fil, "\t\t\t.children = &%s,\n", d->children->name);
Myles Watson1965a232010-06-10 04:06:52 +0000380 if (d->next_sibling && device_match(d->next_sibling, ptr))
Myles Watson894a3472010-06-09 22:41:35 +0000381 fprintf(fil, "\t\t\t.next=&%s_links[%d],\n", d->name, d->link+1);
382 else
383 fprintf(fil, "\t\t\t.next = NULL,\n");
384 fprintf(fil, "\t\t},\n");
385 }
386 d = d->next_sibling;
387 }
388 } else {
389 if (ptr->children) {
390 fprintf(fil, "\t\t[0] = {\n");
391 fprintf(fil, "\t\t\t.link_num = 0,\n");
392 fprintf(fil, "\t\t\t.dev = &%s,\n", ptr->name);
393 fprintf(fil, "\t\t\t.children = &%s,\n", ptr->children->name);
394 fprintf(fil, "\t\t\t.next = NULL,\n");
395 fprintf(fil, "\t\t},\n");
396 }
397 }
398 fprintf(fil, "\t};\n");
399 }
Patrick Georgi114e7b22010-05-05 11:19:50 +0000400 if ((ptr->type == chip) && (ptr->chiph_exists)) {
401 if (ptr->reg) {
402 fprintf(fil, "struct %s_config %s_info_%d\t= {\n", ptr->name_underscore, ptr->name_underscore, ptr->id);
403 struct reg *r = ptr->reg;
404 while (r) {
405 fprintf(fil, "\t.%s = %s,\n", r->key, r->value);
406 r = r->next;
407 }
408 fprintf(fil, "};\n\n");
409 } else {
410 fprintf(fil, "struct %s_config %s_info_%d;\n", ptr->name_underscore, ptr->name_underscore, ptr->id);
411 }
412 }
413}
414
415static void walk_device_tree(FILE *fil, struct device *ptr, void (*func)(FILE *, struct device*), struct device *chips) {
416 do {
417 func(fil, ptr);
418 ptr = ptr->next_sibling;
419 } while (ptr);
420}
421
Sven Schnelle270a9082011-03-01 19:58:15 +0000422static void inherit_subsystem_ids(FILE *file, struct device *dev)
423{
424 struct device *p;
Sven Schnelle270a9082011-03-01 19:58:15 +0000425
426 if (dev->subsystem_vendor != -1 && dev->subsystem_device != -1) {
427 /* user already gave us a subsystem vendor/device */
428 return;
429 }
430
Sylvain "ythier" Hitier5325a482011-03-01 21:57:11 +0000431 for(p = dev; p && p != p->parent; p = p->parent) {
Sven Schnelle270a9082011-03-01 19:58:15 +0000432
433 if (p->bustype != PCI && p->bustype != PCI_DOMAIN)
434 continue;
435
436 if (p->inherit_subsystem) {
437 dev->subsystem_vendor = p->subsystem_vendor;
438 dev->subsystem_device = p->subsystem_device;
439 break;
440 }
441 }
442}
443
Patrick Georgi114e7b22010-05-05 11:19:50 +0000444int main(int argc, char** argv) {
445 if (argc != 3) {
446 printf("usage: sconfig vendor/mainboard outputdir\n");
447 return 1;
448 }
449 char *mainboard=argv[1];
450 char *outputdir=argv[2];
451 char *devtree=malloc(strlen(mainboard)+30);
452 char *outputc=malloc(strlen(outputdir)+10);
453 sprintf(devtree, "src/mainboard/%s/devicetree.cb", mainboard);
454 sprintf(outputc, "%s/static.c", outputdir);
455
456 headers.next = malloc(sizeof(struct header));
457 headers.next->name = malloc(strlen(mainboard)+12);
458 headers.next->next = 0;
459 sprintf(headers.next->name, "mainboard/%s", mainboard);
460
461 FILE *filec = fopen(devtree, "r");
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +0000462 if (!filec) {
463 fprintf(stderr, "Could not open file '%s' for reading: ", devtree);
464 perror(NULL);
465 exit(1);
466 }
467
Patrick Georgi114e7b22010-05-05 11:19:50 +0000468 yyrestart(filec);
469
Patrick Georgi68befd52010-05-05 12:05:25 +0000470 lastdev = head = &root;
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +0000471
Patrick Georgi114e7b22010-05-05 11:19:50 +0000472 yyparse();
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +0000473
Patrick Georgi114e7b22010-05-05 11:19:50 +0000474 fclose(filec);
475
476 if ((head->type == chip) && (!head->chiph_exists)) {
477 struct device *tmp = head;
478 head = &root;
479 while (head->next != tmp) head = head->next;
480 }
481
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +0000482 FILE *staticc = fopen(outputc, "w");
483 if (!staticc) {
484 fprintf(stderr, "Could not open file '%s' for writing: ", outputc);
485 perror(NULL);
486 exit(1);
487 }
488
Patrick Georgi114e7b22010-05-05 11:19:50 +0000489 fprintf(staticc, "#include <device/device.h>\n");
490 fprintf(staticc, "#include <device/pci.h>\n");
491 struct header *h = &headers;
492 while (h->next) {
493 h = h->next;
494 fprintf(staticc, "#include \"%s/chip.h\"\n", h->name);
495 }
Sven Schnelle270a9082011-03-01 19:58:15 +0000496
497 walk_device_tree(staticc, &root, inherit_subsystem_ids, NULL);
498
Patrick Georgi114e7b22010-05-05 11:19:50 +0000499 fprintf(staticc, "\n/* pass 0 */\n");
500 walk_device_tree(staticc, &root, pass0, NULL);
Myles Watson70679a02010-09-01 21:03:03 +0000501 fprintf(staticc, "\n/* pass 1 */\nstruct mainboard_config mainboard_info_0;\nstruct device *last_dev = &%s;\n", lastdev->name);
Patrick Georgi114e7b22010-05-05 11:19:50 +0000502 walk_device_tree(staticc, &root, pass1, NULL);
503
504 fclose(staticc);
Stefan Reinauer7c1f6b82010-08-16 18:21:56 +0000505
Patrick Georgi114e7b22010-05-05 11:19:50 +0000506 return 0;
507}