/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
#ifndef _LIBDEVINFO_H
#define _LIBDEVINFO_H
#ifdef __cplusplus
extern "C" {
#endif
#include <errno.h>
#include <libnvpair.h>
#include <sys/openpromio.h>
#include <sys/ddi_impldefs.h>
#include <sys/devinfo_impl.h>
#include <limits.h>
/*
* flags for di_walk_node
*/
#define DI_WALK_CLDFIRST 0
/*
* flags for di_walk_link
*/
/*
* return code for node_callback
*/
#define DI_WALK_CONTINUE 0
/*
* flags for di_walk_minor
*/
/*
* flags for di_walk_hp
*/
/* nodeid types */
/* node & device states */
/* property types */
#define DI_PROP_TYPE_BOOLEAN 0
/* private macro for checking if a prop type is valid */
((type) == DI_PROP_TYPE_INT64))
/* opaque handles */
/*
* Null handles to make handles really opaque
*/
/*
* IEEE 1275 properties and other standardized property names
*/
/* Interface Prototypes */
/*
* Snapshot initialization and cleanup
*/
/*
* node: traversal, data access, and parameters
*/
extern void di_devfs_path_free(char *path_buf);
/*
* path_node: traversal, data access, and parameters
*/
/*
* minor_node: traversal, data access, and parameters
*/
/*
* node: property access
*/
const char *prop_name);
/*
* prom_node: property access
*/
extern di_prom_handle_t di_prom_init(void);
int **prom_prop_data);
char **prom_prop_data);
/*
* path_node: property access
*/
int **prop_data);
char **prop_data);
/*
*/
/*
* hp_node: traversal, data access, and parameters
*/
void *arg));
/*
* Private interfaces
*
* The interfaces and structures below are private to this implementation
* of Solaris and are subject to change at any time without notice.
*
* Applications and drivers using these interfaces may fail
* to run on future releases.
*/
const char *name);
/*
* Interfaces for handling IEEE 1275 and other standardized properties
*/
/* structure for a single slot */
typedef struct di_slot_name {
char *name;
/*
* IEEE 1275 generic names.
*/
extern char *di_pciclass2_node_name(uint32_t);
extern void di_pciclass2_node_name_free(char *);
/*
* XXX Remove the private di_path_(addr,next,next_phci,next_client) interfaces
* below after NWS consolidation switches to using di_path_bus_addr,
* di_path_phci_next_path, and di_path_client_next_path per CR6638521.
*/
/*
* Interfaces for private data
*/
struct di_priv_data *priv_data);
/*
* Prtconf needs to know property lists, raw prop_data, and private data
*/
/*
* The value of the dip's devi_flags field
*/
/*
* Types of links for devlink lookup
*/
/*
* Flag for di_devlink_init()
*/
/*
* Flag for di_devlink_close()
*/
/*
* For devfsadm synchronous link creation interfaces
*/
/*
* devlink create argument
*/
struct dca_off {
int dca_error;
int dca_flags;
};
int (*devlink_callback)(di_devlink_t, void *));
int (*devlink_callback)(di_devlink_t, void *));
/*
* Private interfaces for I/O retire
*/
typedef struct di_retire {
void *rt_hdl;
} di_retire_t;
/*
* Private interfaces for /etc/logindevperm
*/
extern int di_devperm_logout(const char *);
/*
* in a snapshot.
*/
/*
* Private hotplug interfaces to be used between cfgadm pci plugin and
* devfsadm link generator.
*/
extern char *di_dli_name(char *);
extern int di_dli_openr(char *);
extern int di_dli_openw(char *);
extern void di_dli_close(int);
/*
* Private interface for parsing path_to_inst binding file
*/
extern int devfs_parse_binding_file(const char *,
int (*)(void *, const char *, int, const char *), void *);
extern int devfs_walk_minor_nodes(const char *,
int (*)(void *, const char *), void *);
/*
* finddev - alternate readdir to discover only /dev persisted device names
*/
extern int device_exists(const char *);
extern int finddev_readdir(const char *, finddevhdl_t *);
extern int finddev_emptydir(const char *);
extern void finddev_close(finddevhdl_t);
extern const char *finddev_next(finddevhdl_t);
/*
* Private interfaces for non-global /dev profile
*/
extern void di_prof_fini(di_prof_t);
extern int di_prof_commit(di_prof_t);
extern int di_prof_add_dev(di_prof_t, const char *);
extern int di_prof_add_devann(di_prof_t, const char *, const char *);
extern int di_prof_add_exclude(di_prof_t, const char *);
extern int di_prof_add_symlink(di_prof_t, const char *, const char *);
extern int di_prof_add_map(di_prof_t, const char *, const char *);
/*
* Private interfaces for <driver><instance><minor> to path conversion.
* NOTE: These interfaces do not require or cause attach. The implementation
* uses the kernel instance-tree (/etc/path_to_inst) and the di_devlinks
* database information.
*/
extern di_dim_t di_dim_init(void);
extern void di_dim_fini(di_dim_t);
extern char *di_dim_path_devices(di_dim_t,
extern char *di_dim_path_dev(di_dim_t,
/*
* Alias related exported interfaces
*/
/*
* Private Chassis-Receptacle-Occupant-Link (di_cro) interfaces:
*/
/* di_cro_ opaque handles */
/* di_cro_ snapshot/record-array interfaces */
void di_cro_fini(di_cro_hdl_t h);
char *di_cro_get_fletcher(di_cro_hdl_t h);
char *di_cro_get_date(di_cro_hdl_t h);
char *di_cro_get_server_id(di_cro_hdl_t h);
char *di_cro_get_product_id(di_cro_hdl_t h);
char *di_cro_get_chassis_id(di_cro_hdl_t h);
char *re_product_id,
char *re_chassis_id,
char *re_alias_id,
char *re_receptacle_name,
char *re_receptacle_type,
char *re_receptacle_fmri,
char *re_occupant_type,
char *re_occupant_instance,
char *re_devchassis_path,
char *re_occupant_devices,
char *re_occupant_paths,
char *re_occupant_compdev,
char *re_occupant_devid,
char *re_occupant_mfg,
char *re_occupant_model,
char *re_occupant_part,
char *re_occupant_serial,
char *re_occupant_firm,
char *re_occupant_misc_1,
char *re_occupant_misc_2,
char *re_occupant_misc_3);
char *query);
/*
* di_cro_ record field index interfaces
*
* Example:
* for (i = 0; more; i++)
* xxx = di_cro_rec_fgeti_xxx(r, i, &more, ":");
*
* If you know that there is only one item in the array:
* xxx = di_cro_rec_fgeti_xxx(r, 0, NULL, NULL);
*/
char *di_cro_rec_fgeti_product_id(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_chassis_id(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_alias_id(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_receptacle_name(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_receptacle_type(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_receptacle_fmri(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_type(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_instance(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_devchassis_path(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_devices(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_paths(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_compdev(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_devid(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_mfg(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_model(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_part(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_serial(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_firm(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_misc_1(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_misc_2(di_cro_rec_t r, int, int *, char *);
char *di_cro_rec_fgeti_occupant_misc_3(di_cro_rec_t r, int, int *, char *);
void di_cro_rec_priv_set(di_cro_rec_t r, void *);
void *di_cro_rec_priv_get(di_cro_rec_t r);
char *di_cro_strclean(char *, int, int);
/*
* Private: The following di_crodc_ interfaces are for devchassisd(1M).
* Return 0 on success, caller must strfree() non-NULL returned strings.
*
* When a chassis is ailased, move <product_id>.<chassis_id> directory into
* <alias_id> symlink into '.ca', or a <product_id>.<chassis_id> directory.
*/
char **, char **);
/*
* Private: The following di_cromk_ interfaces are for fmd(1M) cro construction
*/
char *product_id,
char *chassis_id,
char *alias_id,
char *receptacle_name,
char *receptacle_fmri,
char *receptacle_type,
char *occupant_type,
char *occupant_instance,
char *devchassis_path,
char **occupant_devices, int n_occupant_devices,
char **occupant_paths, int n_occupant_paths,
char **occupant_compdev, int n_occupant_compdev,
char *occupant_devid,
char *occupant_mfg,
char *occupant_model,
char *occupant_part,
char *occupant_serial,
char *occupant_firm,
char **occupant_misc_1, int n_occupant_misc_1,
char **occupant_misc_2, int n_occupant_misc_2,
char **occupant_misc_3, int n_occupant_misc_3);
void di_cromk_end(di_cromk_hdl_t h,
int flags,
char *root_server_id,
char *root_product_id,
char *root_chassis_id,
void di_cromk_cleanup();
/*
* Private: di_pca_ Product-id.Chassis-id Alias-id interfaces used by
* di_cromk_ (in the future by fmtopo for <alias-id> authority).
*/
void di_pca_fini(di_pca_hdl_t h);
int di_pca_rec_add(di_pca_hdl_t h,
char *product_id, char *chassis_id,
char *di_pca_rec_get_product_id(di_pca_rec_t r);
char *di_pca_rec_get_chassis_id(di_pca_rec_t r);
char *di_pca_rec_get_alias_id(di_pca_rec_t r);
char *di_pca_rec_get_comment(di_pca_rec_t r);
#define DI_PCA_SUCCESS 0
#ifdef __cplusplus
}
#endif
#endif /* _LIBDEVINFO_H */