Blame utils/fwparam_ibft/iscsi_obp.h

Packit eace71
/*
Packit eace71
 * Copyright (C) IBM Corporation. 2007
Packit eace71
 * Author: Doug Maxey <dwm@austin.ibm.com>
Packit eace71
 *
Packit eace71
 * This program is free software: you can redistribute it and/or modify
Packit eace71
 * it under the terms of the GNU General Public License as published by
Packit eace71
 * the Free Software Foundation, either version 2 of the License, or
Packit eace71
 * (at your option) any later version.
Packit eace71
 *
Packit eace71
 * This program is distributed in the hope that it will be useful,
Packit eace71
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit eace71
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit eace71
 * GNU General Public License for more details.
Packit eace71
 *
Packit eace71
 * You should have received a copy of the GNU General Public License
Packit eace71
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit eace71
 */
Packit eace71
Packit eace71
#ifndef ISCSI_OBP_H_
Packit eace71
#define ISCSI_OBP_H_
Packit eace71
Packit eace71
enum  ofw_dev_type {
Packit eace71
	OFW_DT_NONE,
Packit eace71
	OFW_DT_BLOCK,
Packit eace71
	OFW_DT_NETWORK,
Packit eace71
	OFW_DT_ISCSI,
Packit eace71
};
Packit eace71
Packit eace71
enum obp_tftp_qual {
Packit eace71
	OBP_QUAL_NONE,
Packit eace71
	OBP_QUAL_BOOTP,
Packit eace71
	OBP_QUAL_DHCPV6,
Packit eace71
	OBP_QUAL_IPV6,
Packit eace71
	OBP_QUAL_ISCSI,
Packit eace71
	OBP_QUAL_PING,
Packit eace71
	OBP_QUAL_COUNT,		/* Numnber of defined OBP qualifiers */
Packit eace71
};
Packit eace71
Packit eace71
enum obp_param {
Packit eace71
	/*
Packit eace71
	 * Defined iscsi boot parameters.
Packit eace71
	 */
Packit eace71
	OBP_PARAM_NONE,
Packit eace71
	OBP_PARAM_BLKSIZE,	/* default is 512 */
Packit eace71
	OBP_PARAM_BOOTP_RETRIES, /* default 5 */
Packit eace71
	OBP_PARAM_CHAPID,	/* target chap id */
Packit eace71
	OBP_PARAM_CHAPPW,	/* target chap password */
Packit eace71
	OBP_PARAM_CIADDR,	/* client (my) ip addr */
Packit eace71
	OBP_PARAM_DHCP,		/* dhcp server address */
Packit eace71
	OBP_PARAM_FILENAME,	/* boot filename */
Packit eace71
	OBP_PARAM_GIADDR,	/* gateway addr */
Packit eace71
	OBP_PARAM_ICHAPID,	/* initiator chapid */
Packit eace71
	OBP_PARAM_ICHAPPW,	/* initiator chap password */
Packit eace71
	OBP_PARAM_ILUN,		/* misnomer, really the target lun */
Packit eace71
	OBP_PARAM_INAME,	/* NB: target iqn */
Packit eace71
	OBP_PARAM_IPORT,	/* initiator port, defaults to 3260 */
Packit eace71
	OBP_PARAM_ISID,		/* session id */
Packit eace71
	OBP_PARAM_ISNS,		/* sns server address */
Packit eace71
	OBP_PARAM_ITNAME,	/* NB: Initiator iqn */
Packit eace71
	OBP_PARAM_SIADDR,	/* iscsi server ip address. */
Packit eace71
	OBP_PARAM_SLP,		/* slp server address */
Packit eace71
	OBP_PARAM_SUBNET_MASK,
Packit eace71
	OBP_PARAM_TFTP_RETRIES,	/* default 5 */
Packit eace71
	OBP_PARAM_TIMEOUT,	/* ping timeout period. */
Packit eace71
Packit eace71
	OBP_PARAM_COUNT,	/* number of defined OBP_PARAMs */
Packit eace71
};
Packit eace71
Packit eace71
struct ofw_obp_param {
Packit eace71
	unsigned char  len;	/* length of value string. */
Packit eace71
	char	       val[1];	/* string value from the property */
Packit eace71
};
Packit eace71
Packit eace71
struct ofw_dev {
Packit eace71
	char *prop_path; /* where we found these properties. */
Packit eace71
	enum ofw_dev_type type;	/* known type of boot device. */
Packit eace71
	int qual_count;		/* count of qualifiers. */
Packit eace71
	enum obp_tftp_qual quals[OBP_QUAL_COUNT];
Packit eace71
	struct ofw_obp_param *param[OBP_PARAM_COUNT];
Packit eace71
	int cfg_part;		/* boot partition number. */
Packit eace71
	char *dev_path;		/* path to this ofw device. */
Packit eace71
	unsigned char mac[6];	/* The binary mac address. */
Packit eace71
};
Packit eace71
Packit eace71
const char *obp_qual_set(struct ofw_dev *ofwdev, const char *qual);
Packit eace71
void add_obp_parm(struct ofw_dev *ofwdev, enum obp_param parm, const char *str);
Packit eace71
void obp_parm_addr(struct ofw_dev *ofwdev, const char *parm, const char *addr);
Packit eace71
void obp_parm_iqn(struct ofw_dev *ofwdev, const char *parm, const char *iqn);
Packit eace71
void obp_parm_hexnum(struct ofw_dev *ofwdev, const char *parm,
Packit eace71
		     const char *numstr);
Packit eace71
void obp_parm_str(struct ofw_dev *ofwdev, const char *parm, const char *str);
Packit eace71
Packit eace71
#endif /* ISCSI_OBP_H_ */