2 * Copyright (C) 2010 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * You can also choose to distribute this program under the terms of
20 * the Unmodified Binary Distribution Licence (as given in the file
21 * COPYING.UBDL), provided that you have satisfied its requirements.
24 #include <ipxe/netdevice.h>
25 #include <ipxe/command.h>
26 #include <ipxe/parseopt.h>
27 #include <hci/ifmgmt_cmd.h>
30 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
38 /** "startpxe" options */
39 struct startpxe_options {};
41 /** "startpxe" option list */
42 static struct option_descriptor startpxe_opts[] = {};
47 * @v netdev Network device
48 * @v opts Command options
49 * @ret rc Return status code
51 static int startpxe_payload ( struct net_device *netdev,
52 struct startpxe_options *opts __unused ) {
54 if ( netdev_is_open ( netdev ) )
55 pxe_activate ( netdev );
60 /** "startpxe" command descriptor */
61 static struct ifcommon_command_descriptor startpxe_cmd =
62 IFCOMMON_COMMAND_DESC ( struct startpxe_options, startpxe_opts,
63 0, MAX_ARGUMENTS, "[<interface>]",
64 startpxe_payload, 0 );
67 * The "startpxe" command
69 * @v argc Argument count
70 * @v argv Argument list
71 * @ret rc Return status code
73 static int startpxe_exec ( int argc, char **argv ) {
74 return ifcommon_exec ( argc, argv, &startpxe_cmd );
77 /** "stoppxe" options */
78 struct stoppxe_options {};
80 /** "stoppxe" option list */
81 static struct option_descriptor stoppxe_opts[] = {};
83 /** "stoppxe" command descriptor */
84 static struct command_descriptor stoppxe_cmd =
85 COMMAND_DESC ( struct stoppxe_options, stoppxe_opts, 0, 0, NULL );
88 * The "stoppxe" command
90 * @v argc Argument count
91 * @v argv Argument list
92 * @ret rc Return status code
94 static int stoppxe_exec ( int argc __unused, char **argv __unused ) {
95 struct stoppxe_options opts;
99 if ( ( rc = parse_options ( argc, argv, &stoppxe_cmd, &opts ) ) != 0 )
108 struct command pxe_commands[] __command = {
111 .exec = startpxe_exec,
115 .exec = stoppxe_exec,