diff options
author | Yang Zhang <yang.z.zhang@intel.com> | 2015-08-28 09:58:54 +0800 |
---|---|---|
committer | Yang Zhang <yang.z.zhang@intel.com> | 2015-09-01 12:44:00 +0800 |
commit | e44e3482bdb4d0ebde2d8b41830ac2cdb07948fb (patch) | |
tree | 66b09f592c55df2878107a468a91d21506104d3f /qemu/roms/SLOF/clients/net-snk/app/main.c | |
parent | 9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (diff) |
Add qemu 2.4.0
Change-Id: Ic99cbad4b61f8b127b7dc74d04576c0bcbaaf4f5
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
Diffstat (limited to 'qemu/roms/SLOF/clients/net-snk/app/main.c')
-rw-r--r-- | qemu/roms/SLOF/clients/net-snk/app/main.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/qemu/roms/SLOF/clients/net-snk/app/main.c b/qemu/roms/SLOF/clients/net-snk/app/main.c new file mode 100644 index 000000000..90e14b370 --- /dev/null +++ b/qemu/roms/SLOF/clients/net-snk/app/main.c @@ -0,0 +1,77 @@ +/****************************************************************************** + * Copyright (c) 2004, 2011 IBM Corporation + * All rights reserved. + * This program and the accompanying materials + * are made available under the terms of the BSD License + * which accompanies this distribution, and is available at + * http://www.opensource.org/licenses/bsd-license.php + * + * Contributors: + * IBM Corporation - initial implementation + *****************************************************************************/ + +#include <string.h> +#include <stdio.h> +#include <of.h> +#include <netapps/netapps.h> +#include <libbootmsg.h> + +#ifdef SNK_BIOSEMU_APPS +#include "biosemu/biosemu.h" +#include "biosemu/vbe.h" +#endif + +extern void _callback_entry(void); +int callback(int argc, char *argv[]); + + +int +main(int argc, char *argv[]) +{ + int i; + of_set_callback((void *) &_callback_entry); + + if (strcmp(argv[0], "netboot") == 0 && argc >= 5) + return netboot(argc, argv); + if (strcmp(argv[0], "ping") == 0) + return ping(argc, argv); +#ifdef SNK_BIOSEMU_APPS + // BIOS Emulator applications + if (strcmp(argv[0], "biosemu") == 0) + return biosemu(argc, argv); + if (strcmp(argv[0], "get_vbe_info") == 0) + return vbe_get_info(argc, argv); +#endif + + printf("Unknown client application called\n"); + for (i = 0; i < argc; i++) + printf("argv[%d] %s\n", i, argv[i]); + + return -1; +} + +int +callback(int argc, char *argv[]) +{ + int i; + + printf("\n"); + + /* + * Register your application's callback handler here, similar to + * the way you would register an application. + * Please note that callback functions can be called safely only after + * your application has called of_yield(). If you return or exit() from + * your client application, the callback can no longer be used. + */ +#if 0 + if (strcmp(argv[0], "example") == 0) + return example(argc, argv); +#endif + + printf("No such callback function\n"); + for (i = 0; i < argc; i++) + printf("argv[%d] %s\n", i, argv[i]); + + return (-1); +} |