Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / SLOF / clients / net-snk / app / main.c
1 /******************************************************************************
2  * Copyright (c) 2004, 2011 IBM Corporation
3  * All rights reserved.
4  * This program and the accompanying materials
5  * are made available under the terms of the BSD License
6  * which accompanies this distribution, and is available at
7  * http://www.opensource.org/licenses/bsd-license.php
8  *
9  * Contributors:
10  *     IBM Corporation - initial implementation
11  *****************************************************************************/
12
13 #include <string.h>
14 #include <stdio.h>
15 #include <of.h>
16 #include <netapps/netapps.h>
17 #include <libbootmsg.h>
18
19 #ifdef SNK_BIOSEMU_APPS
20 #include "biosemu/biosemu.h"
21 #include "biosemu/vbe.h"
22 #endif
23
24 extern void _callback_entry(void);
25 int callback(int argc, char *argv[]);
26
27
28 int
29 main(int argc, char *argv[])
30 {
31         int i;
32         of_set_callback((void *) &_callback_entry);
33
34         if (strcmp(argv[0], "netboot") == 0 && argc >= 5)
35                 return netboot(argc, argv);
36         if (strcmp(argv[0], "ping") == 0)
37                 return ping(argc, argv);
38 #ifdef SNK_BIOSEMU_APPS
39         // BIOS Emulator applications
40         if (strcmp(argv[0], "biosemu") == 0)
41                 return biosemu(argc, argv);
42         if (strcmp(argv[0], "get_vbe_info") == 0)
43                 return vbe_get_info(argc, argv);
44 #endif
45
46         printf("Unknown client application called\n");
47         for (i = 0; i < argc; i++)
48                 printf("argv[%d] %s\n", i, argv[i]);
49
50         return -1;
51 }
52
53 int
54 callback(int argc, char *argv[])
55 {
56         int i;
57
58         printf("\n");
59
60         /*
61          * Register your application's callback handler here, similar to
62          * the way you would register an application.
63          * Please note that callback functions can be called safely only after
64          * your application has called of_yield(). If you return or exit() from
65          * your client application, the callback can no longer be used.
66          */
67 #if 0
68         if (strcmp(argv[0], "example") == 0)
69                 return example(argc, argv);
70 #endif
71
72         printf("No such callback function\n");
73         for (i = 0; i < argc; i++)
74                 printf("argv[%d] %s\n", i, argv[i]);
75
76         return (-1);
77 }