xref: /titanic_51/usr/src/uts/common/sys/bootprops.h (revision dedec472759b1a1a25044d504201ef59ccbffb56)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5ae115bc7Smrj  * Common Development and Distribution License (the "License").
6ae115bc7Smrj  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*dedec472SJack Meng  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_BOOTPROPS_H
277c478bd9Sstevel@tonic-gate #define	_BOOTPROPS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #include <sys/types.h>
306cefaae1SJack Meng #include <netinet/in.h>
316cefaae1SJack Meng #include <sys/t_kuser.h>
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
347c478bd9Sstevel@tonic-gate extern "C" {
357c478bd9Sstevel@tonic-gate #endif
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * Boot properties related to netboot:
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate #define	BP_HOST_IP			"host-ip"
417c478bd9Sstevel@tonic-gate #define	BP_SUBNET_MASK			"subnet-mask"
427c478bd9Sstevel@tonic-gate #define	BP_ROUTER_IP			"router-ip"
437c478bd9Sstevel@tonic-gate #define	BP_BOOT_MAC			"boot-mac"
447c478bd9Sstevel@tonic-gate #define	BP_SERVER_IP			"server-ip"
457c478bd9Sstevel@tonic-gate #define	BP_SERVER_NAME			"server-name"
467c478bd9Sstevel@tonic-gate #define	BP_SERVER_PATH			"server-path"
477c478bd9Sstevel@tonic-gate #define	BP_SERVER_ROOTOPTS		"server-rootopts"
487c478bd9Sstevel@tonic-gate #define	BP_BOOTP_RESPONSE		"bootp-response"
49*dedec472SJack Meng 
50*dedec472SJack Meng /*
51*dedec472SJack Meng  * Boot properties related to iscsiboot:
52*dedec472SJack Meng  */
53ae115bc7Smrj #define	BP_NETWORK_INTERFACE		"network-interface"
54*dedec472SJack Meng #define	BP_ISCSI_TARGET_NAME		"iscsi-target-name"
55*dedec472SJack Meng #define	BP_ISCSI_TARGET_IP		"iscsi-target-ip"
56*dedec472SJack Meng #define	BP_ISCSI_INITIATOR_ID		"iscsi-initiator-id"
57*dedec472SJack Meng #define	BP_ISCSI_PORT			"iscsi-port"
58*dedec472SJack Meng #define	BP_ISCSI_TPGT			"iscsi-tpgt"
59*dedec472SJack Meng #define	BP_ISCSI_LUN			"iscsi-lun"
60*dedec472SJack Meng #define	BP_ISCSI_PAR			"iscsi-partition"
61*dedec472SJack Meng #define	BP_ISCSI_NETWORK_BOOTPATH	"iscsi-network-bootpath"
62*dedec472SJack Meng #define	BP_ISCSI_DISK			"/iscsi-hba/disk"
63*dedec472SJack Meng #define	BP_BOOTPATH			"bootpath"
64*dedec472SJack Meng #define	BP_CHAP_USER			"chap-user"
65*dedec472SJack Meng #define	BP_CHAP_PASSWORD		"chap-password"
66*dedec472SJack Meng #define	BP_LOCAL_MAC_ADDRESS		"local-mac-address"
677c478bd9Sstevel@tonic-gate 
686cefaae1SJack Meng /*
696cefaae1SJack Meng  * kifconf prototypes
706cefaae1SJack Meng  */
716cefaae1SJack Meng int
726cefaae1SJack Meng kdlifconfig(TIUSER *tiptr, int af, void *myIPaddr, void *mymask,
736cefaae1SJack Meng     struct in_addr *mybraddr, struct in_addr *gateway, char *ifname);
746cefaae1SJack Meng int
756cefaae1SJack Meng ksetifflags(TIUSER *tiptr, uint_t value, char *ifname);
766cefaae1SJack Meng int
776cefaae1SJack Meng kifioctl(TIUSER *tiptr, int cmd, struct netbuf *nbuf, char *ifname);
786cefaae1SJack Meng 
796cefaae1SJack Meng /*
806cefaae1SJack Meng  * Boot properties related to iscsi boot:
816cefaae1SJack Meng  */
826cefaae1SJack Meng #define	IB_BOOT_MACLEN		6
836cefaae1SJack Meng #define	IB_IP_BUFLEN		16
846cefaae1SJack Meng 
856cefaae1SJack Meng /*
866cefaae1SJack Meng  * iSCSI boot initiator's properties
876cefaae1SJack Meng  */
886cefaae1SJack Meng typedef struct _ib_ini_prop {
896cefaae1SJack Meng 	uchar_t		*ini_name;
90*dedec472SJack Meng 	size_t		ini_name_len;
916cefaae1SJack Meng 	uchar_t		*ini_chap_name;
92*dedec472SJack Meng 	size_t		ini_chap_name_len;
936cefaae1SJack Meng 	uchar_t		*ini_chap_sec;
94*dedec472SJack Meng 	size_t		ini_chap_sec_len;
956cefaae1SJack Meng } ib_ini_prop_t;
966cefaae1SJack Meng 
976cefaae1SJack Meng /*
986cefaae1SJack Meng  * iSCSI boot nic's properties
996cefaae1SJack Meng  */
1006cefaae1SJack Meng typedef struct _ib_nic_prop {
1016cefaae1SJack Meng 	uchar_t		nic_mac[6];
1026cefaae1SJack Meng 	uchar_t		nic_vlan[2];
1036cefaae1SJack Meng 	union {
1046cefaae1SJack Meng 		struct in_addr	u_in4;
1056cefaae1SJack Meng 		struct in6_addr	u_in6;
1066cefaae1SJack Meng 	} nic_ip_u;
1076cefaae1SJack Meng 	union {
1086cefaae1SJack Meng 		struct in_addr	u_in4;
1096cefaae1SJack Meng 		struct in6_addr	u_in6;
1106cefaae1SJack Meng 	} nic_gw_u;
1116cefaae1SJack Meng 	union {
1126cefaae1SJack Meng 		struct in_addr	u_in4;
1136cefaae1SJack Meng 		struct in6_addr	u_in6;
1146cefaae1SJack Meng 	} nic_dhcp_u;
1156cefaae1SJack Meng 	int		sin_family;
1166cefaae1SJack Meng 	uchar_t		sub_mask_prefix;
1176cefaae1SJack Meng 
1186cefaae1SJack Meng } ib_nic_prop_t;
1196cefaae1SJack Meng 
1206cefaae1SJack Meng /*
1216cefaae1SJack Meng  * iSCSI boot target's properties
1226cefaae1SJack Meng  */
1236cefaae1SJack Meng typedef struct _ib_tgt_prop {
1246cefaae1SJack Meng 	union {
1256cefaae1SJack Meng 		struct in_addr	u_in4;
1266cefaae1SJack Meng 		struct in6_addr	u_in6;
1276cefaae1SJack Meng 	}tgt_ip_u;
1286cefaae1SJack Meng 	int		sin_family;
1296cefaae1SJack Meng 	uint32_t	tgt_port;
1306cefaae1SJack Meng 	uchar_t		tgt_boot_lun[8];
1316cefaae1SJack Meng 	uchar_t		*tgt_name;
132*dedec472SJack Meng 	size_t		tgt_name_len;
1336cefaae1SJack Meng 	uchar_t		*tgt_chap_name;
134*dedec472SJack Meng 	size_t		tgt_chap_name_len;
1356cefaae1SJack Meng 	uchar_t		*tgt_chap_sec;
136*dedec472SJack Meng 	size_t		tgt_chap_sec_len;
1376cefaae1SJack Meng 	int		lun_online;
138*dedec472SJack Meng 	uchar_t		*tgt_boot_par;
139*dedec472SJack Meng 	size_t		tgt_boot_par_len;
140*dedec472SJack Meng 	uint16_t	tgt_tpgt;
1416cefaae1SJack Meng } ib_tgt_prop_t;
1426cefaae1SJack Meng 
1436cefaae1SJack Meng /*
1446cefaae1SJack Meng  * iSCSI boot properties
1456cefaae1SJack Meng  */
1466cefaae1SJack Meng typedef struct _ib_boot_prop {
1476cefaae1SJack Meng 	ib_ini_prop_t	boot_init;
1486cefaae1SJack Meng 	ib_nic_prop_t	boot_nic;
1496cefaae1SJack Meng 	ib_tgt_prop_t	boot_tgt;
1506cefaae1SJack Meng } ib_boot_prop_t;
1516cefaae1SJack Meng 
1526cefaae1SJack Meng void
1536cefaae1SJack Meng ld_ib_prop();
1546cefaae1SJack Meng 
155*dedec472SJack Meng void
156*dedec472SJack Meng iscsi_boot_prop_free();
157*dedec472SJack Meng 
158*dedec472SJack Meng void
159*dedec472SJack Meng get_iscsi_bootpath_vhci(char *bootpath);
160*dedec472SJack Meng 
161*dedec472SJack Meng void
162*dedec472SJack Meng get_iscsi_bootpath_phy(char *bootpath);
163*dedec472SJack Meng 
1647c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
1657c478bd9Sstevel@tonic-gate }
1667c478bd9Sstevel@tonic-gate #endif
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #endif	/* _BOOTPROPS_H */
169